-
Notifications
You must be signed in to change notification settings - Fork 59
[UIK-5656][input-tags] rewrite component to NS #3100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
slizhevskyv-semrush
wants to merge
1
commit into
release/v17
Choose a base branch
from
UIK-5656/rewrite-component-to-ns
base: release/v17
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| import type { NSScrollArea } from '@semcore/base-components'; | ||
| import type { PropGetterFn, Intergalactic } from '@semcore/core'; | ||
| import type { NSInput } from '@semcore/input'; | ||
| import type { NSTag } from '@semcore/tag'; | ||
|
|
||
| import type { LocalizedMessages } from './translations/__intergalactic-dynamic-locales'; | ||
|
|
||
| declare namespace NSInputTags { | ||
| type Size = 'l' | 'm'; | ||
| type Props = Omit<NSInput.Props, 'size'> & | ||
| NSScrollArea.Props & { | ||
| /** | ||
| * Component size | ||
| * @default m | ||
| */ | ||
| size?: NSInputTags.Size; | ||
| /** Event is called when tags need to be added */ | ||
| onAppend?: (values: string[], event: React.KeyboardEvent | React.ClipboardEvent) => void; | ||
| /** Event is called when tags need to be removed */ | ||
| onRemove?: (event: React.KeyboardEvent | React.MouseEvent) => void; | ||
| /** List delimiter of tags. Don't forget to add 'Enter' and 'Tab' to hande corresponding hotkeys. | ||
| * @default [',', ';', '|', 'Enter', 'Tab'] | ||
| * */ | ||
| delimiters?: string[]; | ||
| /** Specifies the locale for i18n support */ | ||
| locale?: string; | ||
| }; | ||
| type DefaultProps = { | ||
| size: 'm'; | ||
| delimiters: NSInputTags.Props['delimiters']; | ||
| i18n: LocalizedMessages; | ||
| locale: 'en'; | ||
| }; | ||
| type Ctx = { | ||
| getValueProps: PropGetterFn; | ||
| getTagProps: PropGetterFn; | ||
| }; | ||
|
|
||
| namespace Value { | ||
| type Props = NSInput.Value.Props; | ||
|
|
||
| type Component = NSInput.Value.Component; | ||
| } | ||
|
|
||
| namespace TagsContainer { | ||
| type Component = Intergalactic.Component<'ul'>; | ||
| } | ||
|
|
||
| namespace Tag { | ||
| type Props = NSTag.Props & { | ||
| /** Property enabling the ability to remove a tag on click */ | ||
| editable?: boolean; | ||
| }; | ||
|
|
||
| namespace Text { | ||
| type Props = NSTag.Props; | ||
| type Ctx = NSTag.Ctx; | ||
|
|
||
| namespace Content { | ||
| type Props = NSTag.Text.Props; | ||
|
|
||
| type Component = Intergalactic.Component<'div', Props>; | ||
| } | ||
|
|
||
| type Component = Intergalactic.Component<'div', Props, Ctx> & { | ||
| Content: Content.Component; | ||
| }; | ||
| } | ||
|
|
||
| namespace Close { | ||
| type Component = NSTag.Close.Component; | ||
| } | ||
|
|
||
| namespace Addon { | ||
| type Component = NSTag.Addon.Component; | ||
| } | ||
|
|
||
| namespace Circle { | ||
| type Component = NSTag.Circle.Component; | ||
| } | ||
|
|
||
| type Component = Intergalactic.Component<'div', Props> & { | ||
| Text: Text.Component; | ||
| Close: Close.Component; | ||
| Addon: Addon.Component; | ||
| Circle: Circle.Component; | ||
| }; | ||
| } | ||
|
|
||
| type Component = Intergalactic.Component<'div', Props, Ctx> & { | ||
| Value: Value.Component; | ||
| TagsContainer: TagsContainer.Component; | ||
| Tag: Tag.Component; | ||
| }; | ||
| } | ||
|
|
||
| /** @deprecated It will be removed in v19. */ | ||
| export type InputTagsSize = NSInputTags.Size; | ||
| /** @deprecated It will be removed in v19. */ | ||
| export type InputTagsProps = NSInputTags.Props; | ||
| /** @deprecated It will be removed in v19. */ | ||
| export type InputTagsDefaultProps = NSInput.DefaultProps; | ||
| /** @deprecated It will be removed in v19. */ | ||
| export type InputTagsContext = NSInputTags.Ctx; | ||
| /** @deprecated It will be removed in v19. */ | ||
| export type InputTagsTagProps = NSInputTags.Tag.Props; | ||
| /** @deprecated It will be removed in v19. */ | ||
| export type InputTagsComponent = NSInputTags.Component; | ||
| /** @deprecated It will be removed in v19. */ | ||
| export type InputTagsValueProps = NSInputTags.Value.Props; | ||
|
|
||
| export type { NSInputTags }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| export { default } from './InputTags'; | ||
| export * from './InputTags'; | ||
| export * from './InputTags.type'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
stories/components/input-tags/docs/examples/entering_and_editing_tags.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
stories/components/input-tags/docs/examples/wrapping_email_in_tag.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
stories/components/input-tags/tests/examples/entering_and_editing_tags.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure this is correct...