@intlayer/design-system 9.4.3 → 9.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/esm/api/useAuth/useOAuth2.mjs +1 -1
- package/dist/esm/api/useAuth/useSession.mjs +2 -2
- package/dist/esm/components/Badge/index.mjs +2 -4
- package/dist/esm/components/Badge/index.mjs.map +1 -1
- package/dist/esm/components/Breadcrumb/index.mjs +0 -4
- package/dist/esm/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/esm/components/Button/Button.mjs +2 -7
- package/dist/esm/components/Button/Button.mjs.map +1 -1
- package/dist/esm/components/Container/index.mjs +0 -2
- package/dist/esm/components/Container/index.mjs.map +1 -1
- package/dist/esm/components/CopyButton/index.mjs +1 -1
- package/dist/esm/components/CopyButton/index.mjs.map +1 -1
- package/dist/esm/components/IDE/MarkDownRender.mjs +1 -1
- package/dist/esm/components/Input/Checkbox.mjs +0 -2
- package/dist/esm/components/Input/Checkbox.mjs.map +1 -1
- package/dist/esm/components/Input/Radio.mjs +0 -2
- package/dist/esm/components/Input/Radio.mjs.map +1 -1
- package/dist/esm/components/Link/Link.mjs +4 -28
- package/dist/esm/components/Link/Link.mjs.map +1 -1
- package/dist/esm/components/Navbar/DesktopNavbar.mjs +1 -1
- package/dist/esm/components/Navbar/DesktopNavbar.mjs.map +1 -1
- package/dist/esm/components/Navbar/MobileNavbar.mjs +14 -3
- package/dist/esm/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/esm/components/Navbar/index.mjs +22 -15
- package/dist/esm/components/Navbar/index.mjs.map +1 -1
- package/dist/esm/components/Pagination/Pagination.mjs +0 -2
- package/dist/esm/components/Pagination/Pagination.mjs.map +1 -1
- package/dist/esm/components/Pattern/GridDistortionPattern.mjs +1 -1
- package/dist/esm/components/Status/index.mjs +1 -1
- package/dist/esm/components/SwitchSelector/SwitchSelector.mjs +1 -5
- package/dist/esm/components/SwitchSelector/SwitchSelector.mjs.map +1 -1
- package/dist/esm/components/SwitchSelector/VerticalSwitchSelector.mjs +2 -6
- package/dist/esm/components/SwitchSelector/VerticalSwitchSelector.mjs.map +1 -1
- package/dist/esm/components/TabSelector/TabSelector.mjs +2 -6
- package/dist/esm/components/TabSelector/TabSelector.mjs.map +1 -1
- package/dist/esm/components/Table/Table.mjs +1 -1
- package/dist/esm/components/Table/Table.mjs.map +1 -1
- package/dist/esm/components/Tag/index.mjs +0 -1
- package/dist/esm/components/Tag/index.mjs.map +1 -1
- package/dist/esm/hooks/index.mjs +2 -1
- package/dist/esm/hooks/useDevice.mjs +105 -37
- package/dist/esm/hooks/useDevice.mjs.map +1 -1
- package/dist/esm/hooks/useListKeyboardNavigation.mjs +73 -0
- package/dist/esm/hooks/useListKeyboardNavigation.mjs.map +1 -0
- package/dist/esm/routes.mjs +123 -122
- package/dist/esm/routes.mjs.map +1 -1
- package/dist/types/api/hooks/ai.d.ts +10 -11
- package/dist/types/api/hooks/ai.d.ts.map +1 -1
- package/dist/types/api/hooks/analytics.d.ts +3 -4
- package/dist/types/api/hooks/analytics.d.ts.map +1 -1
- package/dist/types/api/hooks/asset.d.ts +5 -6
- package/dist/types/api/hooks/asset.d.ts.map +1 -1
- package/dist/types/api/hooks/audit.d.ts +3 -4
- package/dist/types/api/hooks/audit.d.ts.map +1 -1
- package/dist/types/api/hooks/auth.d.ts +25 -26
- package/dist/types/api/hooks/auth.d.ts.map +1 -1
- package/dist/types/api/hooks/bitbucket.d.ts +4 -5
- package/dist/types/api/hooks/bitbucket.d.ts.map +1 -1
- package/dist/types/api/hooks/dictionary.d.ts +8 -9
- package/dist/types/api/hooks/dictionary.d.ts.map +1 -1
- package/dist/types/api/hooks/discussions.d.ts +2 -3
- package/dist/types/api/hooks/discussions.d.ts.map +1 -1
- package/dist/types/api/hooks/editor.d.ts +2 -3
- package/dist/types/api/hooks/editor.d.ts.map +1 -1
- package/dist/types/api/hooks/environment.d.ts +6 -7
- package/dist/types/api/hooks/environment.d.ts.map +1 -1
- package/dist/types/api/hooks/github.d.ts +6 -7
- package/dist/types/api/hooks/github.d.ts.map +1 -1
- package/dist/types/api/hooks/gitlab.d.ts +4 -5
- package/dist/types/api/hooks/gitlab.d.ts.map +1 -1
- package/dist/types/api/hooks/newsletter.d.ts +3 -4
- package/dist/types/api/hooks/newsletter.d.ts.map +1 -1
- package/dist/types/api/hooks/organization.d.ts +11 -12
- package/dist/types/api/hooks/organization.d.ts.map +1 -1
- package/dist/types/api/hooks/project.d.ts +18 -19
- package/dist/types/api/hooks/project.d.ts.map +1 -1
- package/dist/types/api/hooks/reviewer.d.ts +21 -22
- package/dist/types/api/hooks/reviewer.d.ts.map +1 -1
- package/dist/types/api/hooks/search.d.ts +1 -2
- package/dist/types/api/hooks/search.d.ts.map +1 -1
- package/dist/types/api/hooks/showcaseProject.d.ts +8 -9
- package/dist/types/api/hooks/showcaseProject.d.ts.map +1 -1
- package/dist/types/api/hooks/stripe.d.ts +24 -25
- package/dist/types/api/hooks/stripe.d.ts.map +1 -1
- package/dist/types/api/hooks/tag.d.ts +4 -5
- package/dist/types/api/hooks/tag.d.ts.map +1 -1
- package/dist/types/api/hooks/translate.d.ts +4 -5
- package/dist/types/api/hooks/translate.d.ts.map +1 -1
- package/dist/types/api/hooks/user.d.ts +6 -7
- package/dist/types/api/hooks/user.d.ts.map +1 -1
- package/dist/types/api/hooks/utils.d.ts +2 -3
- package/dist/types/api/hooks/utils.d.ts.map +1 -1
- package/dist/types/api/useAuth/useAuth.d.ts +1 -2
- package/dist/types/api/useAuth/useAuth.d.ts.map +1 -1
- package/dist/types/api/useAuth/useOAuth2.d.ts +2 -3
- package/dist/types/api/useAuth/useOAuth2.d.ts.map +1 -1
- package/dist/types/api/useAuth/useSession.d.ts +2 -3
- package/dist/types/api/useAuth/useSession.d.ts.map +1 -1
- package/dist/types/api/useIntlayerAPI.d.ts +25 -26
- package/dist/types/api/useIntlayerAPI.d.ts.map +1 -1
- package/dist/types/api/useUser/index.d.ts +1 -2
- package/dist/types/api/useUser/index.d.ts.map +1 -1
- package/dist/types/components/Accordion/Accordion.d.ts +2 -3
- package/dist/types/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/types/components/Avatar/image.d.ts +2 -3
- package/dist/types/components/Avatar/image.d.ts.map +1 -1
- package/dist/types/components/Avatar/index.d.ts +3 -4
- package/dist/types/components/Avatar/index.d.ts.map +1 -1
- package/dist/types/components/Badge/index.d.ts +8 -9
- package/dist/types/components/Badge/index.d.ts.map +1 -1
- package/dist/types/components/Breadcrumb/breadcrumb.content.d.ts +2 -2
- package/dist/types/components/Breadcrumb/breadcrumb.content.d.ts.map +1 -1
- package/dist/types/components/Breadcrumb/index.d.ts +3 -4
- package/dist/types/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/types/components/Browser/Browser.content.d.ts +2 -2
- package/dist/types/components/Browser/Browser.content.d.ts.map +1 -1
- package/dist/types/components/Browser/Browser.d.ts +2 -3
- package/dist/types/components/Browser/Browser.d.ts.map +1 -1
- package/dist/types/components/Browser/extractUrlFromSitemap.d.ts +1 -2
- package/dist/types/components/Browser/extractUrlFromSitemap.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts +8 -9
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Carousel/index.d.ts +1 -2
- package/dist/types/components/Carousel/index.d.ts.map +1 -1
- package/dist/types/components/ClickOutsideDiv/index.d.ts +2 -3
- package/dist/types/components/ClickOutsideDiv/index.d.ts.map +1 -1
- package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts +2 -3
- package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts.map +1 -1
- package/dist/types/components/Command/index.d.ts +2 -3
- package/dist/types/components/Command/index.d.ts.map +1 -1
- package/dist/types/components/Container/index.d.ts +11 -12
- package/dist/types/components/Container/index.d.ts.map +1 -1
- package/dist/types/components/ContentEditor/ContentEditor.d.ts +2 -3
- package/dist/types/components/ContentEditor/ContentEditor.d.ts.map +1 -1
- package/dist/types/components/ContentEditor/ContentEditorInput.d.ts +2 -3
- package/dist/types/components/ContentEditor/ContentEditorInput.d.ts.map +1 -1
- package/dist/types/components/ContentEditor/ContentEditorTextArea.d.ts +2 -3
- package/dist/types/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
- package/dist/types/components/ContentSelector/ContentSelector.d.ts +1 -2
- package/dist/types/components/ContentSelector/ContentSelector.d.ts.map +1 -1
- package/dist/types/components/CopyButton/CopyButton.content.d.ts +2 -2
- package/dist/types/components/CopyButton/CopyButton.content.d.ts.map +1 -1
- package/dist/types/components/CopyButton/index.d.ts +2 -3
- package/dist/types/components/CopyButton/index.d.ts.map +1 -1
- package/dist/types/components/CopyToClipboard/index.d.ts +3 -4
- package/dist/types/components/CopyToClipboard/index.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/DictionaryEditor.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/ItemLayout.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/ItemLayout.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/ArrayWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/ArrayWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/BooleanWrapper.d.ts +2 -3
- package/dist/types/components/DictionaryEditor/NodeWrapper/BooleanWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/ConditionWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/ConditionWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/FileWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/FileWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/HtmlWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/HtmlWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/InsertionWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/InsertionWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/NumberWrapper.d.ts +2 -3
- package/dist/types/components/DictionaryEditor/NodeWrapper/NumberWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/PluralWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/PluralWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/SelectWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/SelectWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/StringWrapper.d.ts +2 -3
- package/dist/types/components/DictionaryEditor/NodeWrapper/StringWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/TranslationWrapper.d.ts +1 -2
- package/dist/types/components/DictionaryEditor/NodeWrapper/TranslationWrapper.d.ts.map +1 -1
- package/dist/types/components/DictionaryEditor/NodeWrapper/index.d.ts +3 -4
- package/dist/types/components/DictionaryEditor/NodeWrapper/index.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/SafeHtmlRenderer.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/SafeHtmlRenderer.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts +4 -5
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/object.d.ts +2 -3
- package/dist/types/components/DictionaryFieldEditor/ContentEditorView/object.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +2 -2
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts +2 -2
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts +4 -5
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +2 -2
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +2 -3
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/EnumKeyInput.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/EnumKeyInput.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/JSONEditor.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts +3 -4
- package/dist/types/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +2 -2
- package/dist/types/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/NodeEditor.d.ts +2 -3
- package/dist/types/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/NodeTypeSelector.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +2 -2
- package/dist/types/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/StructureEditor.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/StructureEditor.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/StructureView/StructureView.d.ts +3 -4
- package/dist/types/components/DictionaryFieldEditor/StructureView/StructureView.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts +2 -2
- package/dist/types/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts +2 -3
- package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts +2 -3
- package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts +2 -2
- package/dist/types/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/getIsEditableSection.d.ts +1 -2
- package/dist/types/components/DictionaryFieldEditor/getIsEditableSection.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +2 -2
- package/dist/types/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts.map +1 -1
- package/dist/types/components/DropDown/index.d.ts +7 -8
- package/dist/types/components/DropDown/index.d.ts.map +1 -1
- package/dist/types/components/EditableField/EditableFieldInput.d.ts +1 -2
- package/dist/types/components/EditableField/EditableFieldInput.d.ts.map +1 -1
- package/dist/types/components/EditableField/EditableFieldLayout.d.ts +1 -2
- package/dist/types/components/EditableField/EditableFieldLayout.d.ts.map +1 -1
- package/dist/types/components/EditableField/EditableFieldTextArea.d.ts +1 -2
- package/dist/types/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
- package/dist/types/components/ExpandCollapse/ExpandCollapse.d.ts +2 -3
- package/dist/types/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/dist/types/components/Flags/Flag.d.ts +1 -2
- package/dist/types/components/Flags/Flag.d.ts.map +1 -1
- package/dist/types/components/Flags/flags.d.ts +305 -305
- package/dist/types/components/Flags/flags.d.ts.map +1 -1
- package/dist/types/components/Footer/index.d.ts +3 -4
- package/dist/types/components/Footer/index.d.ts.map +1 -1
- package/dist/types/components/Form/Form.d.ts +1 -2
- package/dist/types/components/Form/Form.d.ts.map +1 -1
- package/dist/types/components/Form/FormBase.d.ts +2 -3
- package/dist/types/components/Form/FormBase.d.ts.map +1 -1
- package/dist/types/components/Form/FormControl.d.ts +1 -2
- package/dist/types/components/Form/FormControl.d.ts.map +1 -1
- package/dist/types/components/Form/FormDescription.d.ts +1 -2
- package/dist/types/components/Form/FormDescription.d.ts.map +1 -1
- package/dist/types/components/Form/FormField.d.ts +2 -3
- package/dist/types/components/Form/FormField.d.ts.map +1 -1
- package/dist/types/components/Form/FormItem.d.ts +2 -3
- package/dist/types/components/Form/FormItem.d.ts.map +1 -1
- package/dist/types/components/Form/FormLabel.d.ts +1 -2
- package/dist/types/components/Form/FormLabel.d.ts.map +1 -1
- package/dist/types/components/Form/FormMessage.d.ts +1 -2
- package/dist/types/components/Form/FormMessage.d.ts.map +1 -1
- package/dist/types/components/Form/elements/AutoSizeTextAreaElement.d.ts +1 -2
- package/dist/types/components/Form/elements/AutoSizeTextAreaElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/CheckboxElement.d.ts +1 -2
- package/dist/types/components/Form/elements/CheckboxElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/EditableFieldInputElement.d.ts +1 -2
- package/dist/types/components/Form/elements/EditableFieldInputElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -2
- package/dist/types/components/Form/elements/EditableFieldTextAreaElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/FormElement.d.ts +2 -3
- package/dist/types/components/Form/elements/FormElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/FormElementWrapper.d.ts +1 -2
- package/dist/types/components/Form/elements/FormElementWrapper.d.ts.map +1 -1
- package/dist/types/components/Form/elements/InputElement.d.ts +1 -2
- package/dist/types/components/Form/elements/InputElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/InputPasswordElement.d.ts +1 -2
- package/dist/types/components/Form/elements/InputPasswordElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/MultiselectElement.d.ts +1 -2
- package/dist/types/components/Form/elements/MultiselectElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/OTPElement.d.ts +1 -2
- package/dist/types/components/Form/elements/OTPElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/SearchInputElement.d.ts +1 -2
- package/dist/types/components/Form/elements/SearchInputElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/SelectElement.d.ts +1 -2
- package/dist/types/components/Form/elements/SelectElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/SwitchSelectorElement.d.ts +1 -2
- package/dist/types/components/Form/elements/SwitchSelectorElement.d.ts.map +1 -1
- package/dist/types/components/Form/elements/TextAreaElement.d.ts +1 -2
- package/dist/types/components/Form/elements/TextAreaElement.d.ts.map +1 -1
- package/dist/types/components/Form/layout/FormItemLayout.d.ts +2 -3
- package/dist/types/components/Form/layout/FormItemLayout.d.ts.map +1 -1
- package/dist/types/components/Form/layout/FormLabelLayout.d.ts +2 -3
- package/dist/types/components/Form/layout/FormLabelLayout.d.ts.map +1 -1
- package/dist/types/components/Form/layout/RequiredStar.d.ts +1 -2
- package/dist/types/components/Form/layout/RequiredStar.d.ts.map +1 -1
- package/dist/types/components/HTMLRender/HTMLRender.d.ts +2 -3
- package/dist/types/components/HTMLRender/HTMLRender.d.ts.map +1 -1
- package/dist/types/components/Headers/index.d.ts +7 -8
- package/dist/types/components/Headers/index.d.ts.map +1 -1
- package/dist/types/components/HeightResizer/index.d.ts +1 -2
- package/dist/types/components/HeightResizer/index.d.ts.map +1 -1
- package/dist/types/components/HideShow/index.d.ts +2 -3
- package/dist/types/components/HideShow/index.d.ts.map +1 -1
- package/dist/types/components/IDE/Code.d.ts +2 -3
- package/dist/types/components/IDE/Code.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockClient.d.ts +6 -6
- package/dist/types/components/IDE/CodeBlockClient.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockHighlight.d.ts +1 -2
- package/dist/types/components/IDE/CodeBlockHighlight.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockServer.d.ts +3 -4
- package/dist/types/components/IDE/CodeBlockServer.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockShiki.d.ts +2 -3
- package/dist/types/components/IDE/CodeBlockShiki.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeConditionalRenderer.d.ts +1 -2
- package/dist/types/components/IDE/CodeConditionalRenderer.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeContext.d.ts +6 -7
- package/dist/types/components/IDE/CodeContext.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeFormatSelector.d.ts +1 -2
- package/dist/types/components/IDE/CodeFormatSelector.d.ts.map +1 -1
- package/dist/types/components/IDE/ContentDeclarationFormatSelector.d.ts +1 -2
- package/dist/types/components/IDE/ContentDeclarationFormatSelector.d.ts.map +1 -1
- package/dist/types/components/IDE/CopyCode.d.ts +1 -2
- package/dist/types/components/IDE/CopyCode.d.ts.map +1 -1
- package/dist/types/components/IDE/FileList.d.ts +2 -3
- package/dist/types/components/IDE/FileList.d.ts.map +1 -1
- package/dist/types/components/IDE/FileTree.d.ts +1 -2
- package/dist/types/components/IDE/FileTree.d.ts.map +1 -1
- package/dist/types/components/IDE/IDE.d.ts +2 -3
- package/dist/types/components/IDE/IDE.d.ts.map +1 -1
- package/dist/types/components/IDE/MarkDownRender.d.ts +1 -2
- package/dist/types/components/IDE/MarkDownRender.d.ts.map +1 -1
- package/dist/types/components/IDE/MonacoCode.d.ts +1 -2
- package/dist/types/components/IDE/MonacoCode.d.ts.map +1 -1
- package/dist/types/components/IDE/PackageManagerSelector.d.ts +1 -2
- package/dist/types/components/IDE/PackageManagerSelector.d.ts.map +1 -1
- package/dist/types/components/IDE/codeTransformer.d.ts +4 -5
- package/dist/types/components/IDE/codeTransformer.d.ts.map +1 -1
- package/dist/types/components/IDE/createFileTree.d.ts +2 -3
- package/dist/types/components/IDE/createFileTree.d.ts.map +1 -1
- package/dist/types/components/IDE/shikiBundle.d.ts +9 -10
- package/dist/types/components/IDE/shikiBundle.d.ts.map +1 -1
- package/dist/types/components/IDE/shikiLanguages.d.ts +11 -12
- package/dist/types/components/IDE/shikiLanguages.d.ts.map +1 -1
- package/dist/types/components/IDE/shikiThemes.d.ts +3 -4
- package/dist/types/components/IDE/shikiThemes.d.ts.map +1 -1
- package/dist/types/components/InformationTag/index.d.ts +1 -2
- package/dist/types/components/InformationTag/index.d.ts.map +1 -1
- package/dist/types/components/Input/Checkbox.d.ts +6 -7
- package/dist/types/components/Input/Checkbox.d.ts.map +1 -1
- package/dist/types/components/Input/Input.d.ts +5 -6
- package/dist/types/components/Input/Input.d.ts.map +1 -1
- package/dist/types/components/Input/InputPassword.d.ts +1 -2
- package/dist/types/components/Input/InputPassword.d.ts.map +1 -1
- package/dist/types/components/Input/OTPInput.d.ts +13 -14
- package/dist/types/components/Input/OTPInput.d.ts.map +1 -1
- package/dist/types/components/Input/Radio.d.ts +6 -7
- package/dist/types/components/Input/Radio.d.ts.map +1 -1
- package/dist/types/components/Input/SearchInput.d.ts +1 -2
- package/dist/types/components/Input/SearchInput.d.ts.map +1 -1
- package/dist/types/components/KeyboardScreenAdapter/index.d.ts +1 -2
- package/dist/types/components/KeyboardScreenAdapter/index.d.ts.map +1 -1
- package/dist/types/components/KeyboardShortcut/KeyboardShortcut.d.ts +4 -5
- package/dist/types/components/KeyboardShortcut/KeyboardShortcut.d.ts.map +1 -1
- package/dist/types/components/Label/index.d.ts +2 -3
- package/dist/types/components/Label/index.d.ts.map +1 -1
- package/dist/types/components/LanguageBackground/LanguageBackground.d.ts +1 -2
- package/dist/types/components/LanguageBackground/LanguageBackground.d.ts.map +1 -1
- package/dist/types/components/LanguageBackground/LanguageSection.d.ts +2 -3
- package/dist/types/components/LanguageBackground/LanguageSection.d.ts.map +1 -1
- package/dist/types/components/Link/Link.d.ts +11 -12
- package/dist/types/components/Link/Link.d.ts.map +1 -1
- package/dist/types/components/Loader/index.content.d.ts +2 -2
- package/dist/types/components/Loader/index.content.d.ts.map +1 -1
- package/dist/types/components/Loader/index.d.ts +2 -3
- package/dist/types/components/Loader/index.d.ts.map +1 -1
- package/dist/types/components/Loader/spinner.d.ts +1 -2
- package/dist/types/components/Loader/spinner.d.ts.map +1 -1
- package/dist/types/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.d.ts +2 -3
- package/dist/types/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.d.ts.map +1 -1
- package/dist/types/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.d.ts +2 -3
- package/dist/types/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.d.ts.map +1 -1
- package/dist/types/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts +2 -3
- package/dist/types/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts.map +1 -1
- package/dist/types/components/Logo/Logo.d.ts +2 -3
- package/dist/types/components/Logo/Logo.d.ts.map +1 -1
- package/dist/types/components/Logo/LogoTextOnly.d.ts +1 -2
- package/dist/types/components/Logo/LogoTextOnly.d.ts.map +1 -1
- package/dist/types/components/Logo/LogoWithText.d.ts +1 -2
- package/dist/types/components/Logo/LogoWithText.d.ts.map +1 -1
- package/dist/types/components/Logo/LogoWithTextBelow.d.ts +2 -3
- package/dist/types/components/Logo/LogoWithTextBelow.d.ts.map +1 -1
- package/dist/types/components/MarkDownRender/MarkDownIframe.d.ts +1 -2
- package/dist/types/components/MarkDownRender/MarkDownIframe.d.ts.map +1 -1
- package/dist/types/components/MarkDownRender/MarkDownRender.d.ts +4 -4
- package/dist/types/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/extensions.d.ts +1 -2
- package/dist/types/components/MarkdownEditor/extensions.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/generative/AICompletionCommands.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/generative/AICompletionCommands.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/generative/AISelector.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/generative/AISelector.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/generative/AISelectorCommands.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/generative/AISelectorCommands.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/generative/GenerativeMenuSwitch.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/generative/GenerativeMenuSwitch.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/generative/useAICompletion.d.ts +3 -4
- package/dist/types/components/MarkdownEditor/generative/useAICompletion.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/imageUpload.d.ts +3 -4
- package/dist/types/components/MarkdownEditor/imageUpload.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/components/editor-bubble-item.d.ts +2 -2
- package/dist/types/components/MarkdownEditor/novel/components/editor-bubble-item.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/components/editor-bubble.d.ts +3 -3
- package/dist/types/components/MarkdownEditor/novel/components/editor-bubble.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/components/editor-command-item.d.ts +3 -3
- package/dist/types/components/MarkdownEditor/novel/components/editor-command-item.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/components/editor-command.d.ts +4 -5
- package/dist/types/components/MarkdownEditor/novel/components/editor-command.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/components/editor.d.ts +4 -5
- package/dist/types/components/MarkdownEditor/novel/components/editor.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/extensions/ai-highlight.d.ts +6 -7
- package/dist/types/components/MarkdownEditor/novel/extensions/ai-highlight.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/extensions/code-block-shiki.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/novel/extensions/code-block-shiki.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/extensions/image-resizer.d.ts +1 -2
- package/dist/types/components/MarkdownEditor/novel/extensions/image-resizer.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/extensions/slash-command.d.ts +4 -4
- package/dist/types/components/MarkdownEditor/novel/extensions/slash-command.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/plugins/upload-images.d.ts +6 -7
- package/dist/types/components/MarkdownEditor/novel/plugins/upload-images.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/utils/atoms.d.ts +4 -5
- package/dist/types/components/MarkdownEditor/novel/utils/atoms.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/utils/index.d.ts +4 -5
- package/dist/types/components/MarkdownEditor/novel/utils/index.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/selectors/ColorSelector.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/selectors/ColorSelector.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/selectors/LinkSelector.d.ts +1 -2
- package/dist/types/components/MarkdownEditor/selectors/LinkSelector.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/selectors/NodeSelector.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/selectors/NodeSelector.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/selectors/TextButtons.d.ts +1 -2
- package/dist/types/components/MarkdownEditor/selectors/TextButtons.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/slashCommand.d.ts +2 -3
- package/dist/types/components/MarkdownEditor/slashCommand.d.ts.map +1 -1
- package/dist/types/components/MaxHeightSmoother/index.d.ts +1 -2
- package/dist/types/components/MaxHeightSmoother/index.d.ts.map +1 -1
- package/dist/types/components/MaxWidthSmoother/index.d.ts +1 -2
- package/dist/types/components/MaxWidthSmoother/index.d.ts.map +1 -1
- package/dist/types/components/Modal/Modal.d.ts +2 -3
- package/dist/types/components/Modal/Modal.d.ts.map +1 -1
- package/dist/types/components/Navbar/Burger.d.ts +1 -2
- package/dist/types/components/Navbar/Burger.d.ts.map +1 -1
- package/dist/types/components/Navbar/DesktopNavbar.d.ts +1 -2
- package/dist/types/components/Navbar/DesktopNavbar.d.ts.map +1 -1
- package/dist/types/components/Navbar/MobileNavbar.d.ts +8 -2
- package/dist/types/components/Navbar/MobileNavbar.d.ts.map +1 -1
- package/dist/types/components/Navbar/index.d.ts +2 -2
- package/dist/types/components/Navbar/index.d.ts.map +1 -1
- package/dist/types/components/Navbar/useNavigation.d.ts +1 -2
- package/dist/types/components/Navbar/useNavigation.d.ts.map +1 -1
- package/dist/types/components/Pagination/NumberItemsSelector.d.ts +2 -3
- package/dist/types/components/Pagination/NumberItemsSelector.d.ts.map +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +6 -7
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/Pagination/ShowingResultsNumberItems.d.ts +2 -3
- package/dist/types/components/Pagination/ShowingResultsNumberItems.d.ts.map +1 -1
- package/dist/types/components/Pattern/DotPattern.d.ts +1 -2
- package/dist/types/components/Pattern/DotPattern.d.ts.map +1 -1
- package/dist/types/components/Pattern/GridDistortionPattern.d.ts +1 -2
- package/dist/types/components/Pattern/GridDistortionPattern.d.ts.map +1 -1
- package/dist/types/components/Pattern/GridPattern.d.ts +1 -2
- package/dist/types/components/Pattern/GridPattern.d.ts.map +1 -1
- package/dist/types/components/Pattern/SpotLight.d.ts +1 -2
- package/dist/types/components/Pattern/SpotLight.d.ts.map +1 -1
- package/dist/types/components/Popover/dynamic.d.ts +1 -2
- package/dist/types/components/Popover/dynamic.d.ts.map +1 -1
- package/dist/types/components/Popover/static.d.ts +8 -8
- package/dist/types/components/Popover/static.d.ts.map +1 -1
- package/dist/types/components/PressableSpan/PressableSpan.d.ts +1 -2
- package/dist/types/components/PressableSpan/PressableSpan.d.ts.map +1 -1
- package/dist/types/components/RightDrawer/RightDrawer.d.ts +1 -2
- package/dist/types/components/RightDrawer/RightDrawer.d.ts.map +1 -1
- package/dist/types/components/RightDrawer/isElementAtTopAndNotCovered.d.ts +1 -2
- package/dist/types/components/RightDrawer/isElementAtTopAndNotCovered.d.ts.map +1 -1
- package/dist/types/components/RightDrawer/useRightDrawer.d.ts +4 -5
- package/dist/types/components/RightDrawer/useRightDrawer.d.ts.map +1 -1
- package/dist/types/components/Select/Multiselect.d.ts +1 -2
- package/dist/types/components/Select/Multiselect.d.ts.map +1 -1
- package/dist/types/components/Select/Select.d.ts +5 -6
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/DiscordLogo.d.ts +1 -2
- package/dist/types/components/SocialNetworks/DiscordLogo.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/FacebookLogo.d.ts +1 -2
- package/dist/types/components/SocialNetworks/FacebookLogo.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/InstagramLogo.d.ts +1 -2
- package/dist/types/components/SocialNetworks/InstagramLogo.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/ProductHuntLogo.d.ts +1 -2
- package/dist/types/components/SocialNetworks/ProductHuntLogo.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/TiktokLogo.d.ts +1 -2
- package/dist/types/components/SocialNetworks/TiktokLogo.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/XLogo.d.ts +1 -2
- package/dist/types/components/SocialNetworks/XLogo.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/YoutubeLogo.d.ts +1 -2
- package/dist/types/components/SocialNetworks/YoutubeLogo.d.ts.map +1 -1
- package/dist/types/components/SocialNetworks/index.d.ts +2 -2
- package/dist/types/components/SocialNetworks/index.d.ts.map +1 -1
- package/dist/types/components/Status/index.d.ts +1 -2
- package/dist/types/components/Status/index.d.ts.map +1 -1
- package/dist/types/components/Steps/index.d.ts +2 -3
- package/dist/types/components/Steps/index.d.ts.map +1 -1
- package/dist/types/components/Steps/steps.content.d.ts +2 -2
- package/dist/types/components/Steps/steps.content.d.ts.map +1 -1
- package/dist/types/components/SwitchSelector/SwitchSelector.d.ts +13 -14
- package/dist/types/components/SwitchSelector/SwitchSelector.d.ts.map +1 -1
- package/dist/types/components/SwitchSelector/VerticalSwitchSelector.d.ts +3 -4
- package/dist/types/components/SwitchSelector/VerticalSwitchSelector.d.ts.map +1 -1
- package/dist/types/components/SwitchSelector/useSwitchSelector.d.ts +1 -2
- package/dist/types/components/SwitchSelector/useSwitchSelector.d.ts.map +1 -1
- package/dist/types/components/Tab/Tab.d.ts +3 -4
- package/dist/types/components/Tab/Tab.d.ts.map +1 -1
- package/dist/types/components/Tab/TabContext.d.ts +3 -4
- package/dist/types/components/Tab/TabContext.d.ts.map +1 -1
- package/dist/types/components/TabSelector/TabSelector.d.ts +5 -6
- package/dist/types/components/TabSelector/TabSelector.d.ts.map +1 -1
- package/dist/types/components/Table/ExpandButton.d.ts +1 -2
- package/dist/types/components/Table/ExpandButton.d.ts.map +1 -1
- package/dist/types/components/Table/SmartTable.d.ts +1 -2
- package/dist/types/components/Table/SmartTable.d.ts.map +1 -1
- package/dist/types/components/Table/Table.d.ts +2 -3
- package/dist/types/components/Table/Table.d.ts.map +1 -1
- package/dist/types/components/Table/TableElements.d.ts +4 -5
- package/dist/types/components/Table/TableElements.d.ts.map +1 -1
- package/dist/types/components/Table/useTableWidths.d.ts +1 -2
- package/dist/types/components/Table/useTableWidths.d.ts.map +1 -1
- package/dist/types/components/Tag/index.d.ts +7 -8
- package/dist/types/components/Tag/index.d.ts.map +1 -1
- package/dist/types/components/TechLogo/TechLogo.d.ts +2 -3
- package/dist/types/components/TechLogo/TechLogo.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Adonis.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Adonis.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Angular.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Angular.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Anthropic.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Anthropic.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Astro.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Astro.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Atlassian.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Atlassian.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Bitbucket.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Bitbucket.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/ChatGPT.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/ChatGPT.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Claude.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Claude.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/DeepSeek.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/DeepSeek.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Elysia.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Elysia.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Express.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Express.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Fastify.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Fastify.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Gemini.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Gemini.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/GitHub.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/GitHub.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/GitLab.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/GitLab.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Google.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Google.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/GoogleAI.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/GoogleAI.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Grok.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Grok.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/HTMX.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/HTMX.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Hono.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Hono.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/LinkedIn.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/LinkedIn.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Lit.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Lit.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Lynx.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Lynx.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Microsoft.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Microsoft.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Mistral.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Mistral.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/NestJS.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/NestJS.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Nextjs.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Nextjs.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Node.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Node.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Nuxt.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Nuxt.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Ollama.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Ollama.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/OpenAI.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/OpenAI.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Perplexity.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Perplexity.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Preact.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Preact.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Reactjs.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Reactjs.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Remix.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Remix.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Solid.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Solid.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Svelte.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Svelte.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Tanstack.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Tanstack.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Vanilla.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Vanilla.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Vitejs.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Vitejs.d.ts.map +1 -1
- package/dist/types/components/TechLogo/logos/Vuejs.d.ts +1 -2
- package/dist/types/components/TechLogo/logos/Vuejs.d.ts.map +1 -1
- package/dist/types/components/TechLogo/types.d.ts +1 -2
- package/dist/types/components/TechLogo/types.d.ts.map +1 -1
- package/dist/types/components/Terminal/Terminal.d.ts +2 -3
- package/dist/types/components/Terminal/Terminal.d.ts.map +1 -1
- package/dist/types/components/TextArea/AutoSizeTextArea.d.ts +2 -3
- package/dist/types/components/TextArea/AutoSizeTextArea.d.ts.map +1 -1
- package/dist/types/components/TextArea/AutocompleteTextArea.d.ts +2 -3
- package/dist/types/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
- package/dist/types/components/TextArea/ContentEditableTextArea.d.ts +4 -5
- package/dist/types/components/TextArea/ContentEditableTextArea.d.ts.map +1 -1
- package/dist/types/components/TextArea/TextArea.d.ts +2 -3
- package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/types/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.d.ts +1 -2
- package/dist/types/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.d.ts.map +1 -1
- package/dist/types/components/ThemeSwitcherDropDown/MobileThemeSwitcher.d.ts +1 -2
- package/dist/types/components/ThemeSwitcherDropDown/MobileThemeSwitcher.d.ts.map +1 -1
- package/dist/types/components/ThemeSwitcherDropDown/types.d.ts +1 -2
- package/dist/types/components/ThemeSwitcherDropDown/types.d.ts.map +1 -1
- package/dist/types/components/Toaster/Toast.d.ts +10 -11
- package/dist/types/components/Toaster/Toast.d.ts.map +1 -1
- package/dist/types/components/Toaster/Toaster.d.ts +1 -2
- package/dist/types/components/Toaster/Toaster.d.ts.map +1 -1
- package/dist/types/components/Toaster/useToast.d.ts +2 -2
- package/dist/types/components/Toaster/useToast.d.ts.map +1 -1
- package/dist/types/components/WithResizer/index.d.ts +1 -2
- package/dist/types/components/WithResizer/index.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +3 -2
- package/dist/types/hooks/useDevice.d.ts +27 -17
- package/dist/types/hooks/useDevice.d.ts.map +1 -1
- package/dist/types/hooks/useGetElementById.d.ts +1 -2
- package/dist/types/hooks/useGetElementById.d.ts.map +1 -1
- package/dist/types/hooks/useGetElementOrWindow.d.ts +1 -2
- package/dist/types/hooks/useGetElementOrWindow.d.ts.map +1 -1
- package/dist/types/hooks/useHorizontalSwipe.d.ts +3 -4
- package/dist/types/hooks/useHorizontalSwipe.d.ts.map +1 -1
- package/dist/types/hooks/useIsMounted.d.ts +1 -2
- package/dist/types/hooks/useIsMounted.d.ts.map +1 -1
- package/dist/types/hooks/useItemSelector.d.ts +2 -3
- package/dist/types/hooks/useItemSelector.d.ts.map +1 -1
- package/dist/types/hooks/useKeyboardDetector.d.ts +1 -2
- package/dist/types/hooks/useKeyboardDetector.d.ts.map +1 -1
- package/dist/types/hooks/useListKeyboardNavigation.d.ts +31 -0
- package/dist/types/hooks/useListKeyboardNavigation.d.ts.map +1 -0
- package/dist/types/hooks/usePersistedStore.d.ts +1 -2
- package/dist/types/hooks/usePersistedStore.d.ts.map +1 -1
- package/dist/types/hooks/useScreenWidth.d.ts +1 -2
- package/dist/types/hooks/useScreenWidth.d.ts.map +1 -1
- package/dist/types/hooks/useScrollBlockage/index.d.ts +1 -2
- package/dist/types/hooks/useScrollBlockage/index.d.ts.map +1 -1
- package/dist/types/hooks/useScrollBlockage/useScrollBlockageStore.d.ts +2 -3
- package/dist/types/hooks/useScrollBlockage/useScrollBlockageStore.d.ts.map +1 -1
- package/dist/types/hooks/useScrollDetection.d.ts +1 -2
- package/dist/types/hooks/useScrollDetection.d.ts.map +1 -1
- package/dist/types/hooks/useScrollY.d.ts +1 -2
- package/dist/types/hooks/useScrollY.d.ts.map +1 -1
- package/dist/types/hooks/useSearch.d.ts +1 -2
- package/dist/types/hooks/useSearch.d.ts.map +1 -1
- package/dist/types/hooks/useStickToBottom.d.ts +2 -3
- package/dist/types/hooks/useStickToBottom.d.ts.map +1 -1
- package/dist/types/libs/auth.d.ts +2 -3
- package/dist/types/libs/auth.d.ts.map +1 -1
- package/dist/types/providers/DeferredAuthProvider.d.ts +2 -3
- package/dist/types/providers/DeferredAuthProvider.d.ts.map +1 -1
- package/dist/types/providers/ReactQueryProvider.d.ts +2 -3
- package/dist/types/providers/ReactQueryProvider.d.ts.map +1 -1
- package/dist/types/providers/ThemeProvider.d.ts +5 -6
- package/dist/types/providers/ThemeProvider.d.ts.map +1 -1
- package/dist/types/routes.d.ts +320 -320
- package/dist/types/routes.d.ts.map +1 -1
- package/dist/types/structured-data/buildAuthorJsonLd.d.ts +2 -3
- package/dist/types/structured-data/buildAuthorJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildBreadcrumbsJsonLd.d.ts +3 -4
- package/dist/types/structured-data/buildBreadcrumbsJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildCreativeWorkJsonLd.d.ts +4 -5
- package/dist/types/structured-data/buildCreativeWorkJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildFAQPageJsonLd.d.ts +3 -4
- package/dist/types/structured-data/buildFAQPageJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildItemListJsonLd.d.ts +3 -4
- package/dist/types/structured-data/buildItemListJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildOrganizationJsonLd.d.ts +2 -3
- package/dist/types/structured-data/buildOrganizationJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildProductJsonLd.d.ts +3 -4
- package/dist/types/structured-data/buildProductJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildSoftwareApplicationJsonLd.d.ts +2 -3
- package/dist/types/structured-data/buildSoftwareApplicationJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildWebsiteJsonLd.d.ts +2 -3
- package/dist/types/structured-data/buildWebsiteJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/normalizeJsonLdUrl.d.ts +2 -3
- package/dist/types/structured-data/normalizeJsonLdUrl.d.ts.map +1 -1
- package/dist/types/utils/observeScrollExtent.d.ts +1 -2
- package/dist/types/utils/observeScrollExtent.d.ts.map +1 -1
- package/dist/types/utils/scheduleFrameTask.d.ts +1 -2
- package/dist/types/utils/scheduleFrameTask.d.ts.map +1 -1
- package/package.json +55 -60
- package/styles/globals.css +11 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.mjs","names":[],"sources":["../../../../src/components/Link/Link.tsx"],"sourcesContent":["import { getLocalizedUrl } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ExternalLink, MoveRight } from 'lucide-react';\nimport {\n type AnchorHTMLAttributes,\n type DetailedHTMLProps,\n type FC,\n isValidElement,\n type ReactNode,\n} from 'react';\n\nexport type LinkVariant =\n | 'default'\n | 'invisible-link'\n | 'button'\n | 'button-outlined'\n | 'hoverable';\n\n/**\n * Color theme variants for Link component\n */\nexport type LinkColor =\n | 'primary'\n | 'secondary'\n | 'neutral'\n | 'light'\n | 'dark'\n | 'text'\n | 'text-inverse'\n | 'error'\n | 'success'\n | 'custom';\n\nexport type LinkRoundedSize =\n | 'none'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | '2xl'\n | '3xl'\n | 'full';\n\nexport type LinkSize = 'sm' | 'md' | 'lg' | 'xl' | 'custom';\n\nexport type LinkUnderlined = 'default' | 'true' | 'false';\n\nexport const linkVariants = cva(\n 'gap-3 transition-all duration-300 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n default:\n 'h-auto justify-start border-inherit bg-current/0 px-1 font-medium decoration-[1.5] underline-offset-5 hover:bg-current/0 hover:text-current/80 hover:underline hover:underline-offset-6',\n 'invisible-link':\n 'h-auto justify-start border-inherit bg-current/0 px-1',\n\n button:\n 'relative inline-flex min-h-8 cursor-pointer flex-row items-center justify-center gap-2 rounded-full bg-current px-6 text-center font-medium text-sm text-text ring-0 *:text-text-opposite hover:bg-current/90 hover:ring-5 aria-selected:ring-5 aria-[current]:ring-5 max-md:py-2',\n\n 'button-outlined':\n 'relative inline-flex min-h-8 cursor-pointer flex-row items-center justify-center gap-2 rounded-full border-[1.3px] border-current px-6 text-center font-medium text-sm text-text ring-0 *:text-text hover:bg-current/20 hover:ring-5 aria-selected:ring-5 aria-[current]:ring-5 max-md:py-2',\n\n hoverable:\n 'rounded-lg border-none bg-current/0 transition *:text-current! hover:bg-current/10 aria-[current]:bg-current/5',\n },\n roundedSize: {\n none: 'rounded-none',\n sm: 'rounded-lg [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-xl',\n md: 'rounded-xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl',\n lg: 'rounded-2xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-3xl',\n xl: 'rounded-3xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-4xl',\n '2xl':\n 'rounded-4xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[2.5rem]',\n '3xl':\n 'rounded-[2.5rem] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[3rem]',\n full: 'rounded-full',\n },\n color: {\n primary: 'text-primary',\n secondary: 'text-secondary',\n neutral: 'text-neutral',\n light: 'text-white',\n dark: 'text-neutral-800',\n text: 'text-text',\n 'text-inverse': 'text-text-opposite',\n error: 'text-error',\n success: 'text-success',\n custom: '',\n },\n size: {\n sm: 'text-sm',\n md: 'text-base',\n lg: 'text-lg',\n xl: 'text-xl',\n custom: '',\n },\n underlined: {\n default: '',\n true: 'underline',\n false: 'no-underline',\n },\n },\n // Compound variants handle height and padding\n compoundVariants: [\n // ---------------------------------------------------------\n // FIX START: Correctly Handle Contrast for TEXT_INVERSE\n // ---------------------------------------------------------\n {\n // Filled Button + Inverse Color (e.g., White Button):\n // We DO NOT override parent text color (it must remain 'text-opposite' so bg-current is white).\n // We ONLY override children to be 'text-text' (Dark) so they show up on white.\n variant: 'button',\n color: 'text-inverse',\n class: '*:text-text',\n },\n {\n // Outlined Button + Inverse Color (e.g., White Border):\n // Parent is 'text-opposite' (Border is white).\n // Children must also be 'text-opposite' (White text) to show on dark background.\n variant: 'button-outlined',\n color: 'text-inverse',\n class: 'text-text-opposite *:text-text-opposite',\n },\n\n // Min height and padding for button variants\n {\n variant: ['button', 'button-outlined'],\n size: 'sm',\n class: 'min-h-7 px-3 text-xs max-md:py-1',\n },\n {\n variant: ['button', 'button-outlined'],\n size: 'md',\n class: 'min-h-8 px-6 text-sm max-md:py-2',\n },\n {\n variant: ['button', 'button-outlined'],\n size: 'lg',\n class: 'min-h-10 px-8 text-lg max-md:py-3',\n },\n {\n variant: ['button', 'button-outlined'],\n size: 'xl',\n class: 'min-h-11 px-10 text-xl max-md:py-4',\n },\n // Ring color variants\n {\n variant: ['button', 'button-outlined'],\n color: 'primary',\n class: 'ring-primary/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'secondary',\n class: 'ring-secondary/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'neutral',\n class: 'ring-neutral/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'light',\n class: 'ring-white/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'dark',\n class: 'ring-neutral-800/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'text',\n class: 'ring-text/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'text-inverse',\n class: 'ring-text-opposite/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'error',\n class: 'ring-error/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'success',\n class: 'ring-success/20',\n },\n ],\n\n defaultVariants: {\n variant: 'default',\n roundedSize: 'md',\n underlined: 'default',\n size: 'custom',\n },\n }\n);\n\nexport type LinkProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n> &\n VariantProps<typeof linkVariants> & {\n label: string;\n isExternalLink?: boolean;\n isPageSection?: boolean;\n isActive?: boolean;\n locale?: LocalesValues;\n };\n\nexport const checkIsExternalLink = (\n {\n href,\n isExternalLink: isExternalLinkProp,\n }: Pick<LinkProps, 'href' | 'isExternalLink'>,\n url?: string\n): boolean => {\n // Explicit prop override takes precedence\n if (typeof isExternalLinkProp === 'boolean') {\n return isExternalLinkProp;\n }\n\n const isValidHref = typeof href === 'string' && href.trim() !== '';\n\n if (!isValidHref) return false;\n\n // Relative URLs (e.g., '/about') are always internal\n if (!/^https?:\\/\\//.test(href)) {\n return false;\n }\n\n // Compare base domains\n if (url) {\n try {\n const hrefHost = new URL(href).hostname;\n // Ensure the reference url has a protocol so URL() can parse it correctly\n const currentHost = new URL(\n url.startsWith('http') ? url : `https://${url}`\n ).hostname;\n\n // Extract the root domain (e.g., 'app.intlayer.org' -> 'intlayer.org')\n const getBaseDomain = (host: string) =>\n host.split('.').slice(-2).join('.');\n\n return getBaseDomain(hrefHost) !== getBaseDomain(currentHost);\n } catch {\n // If URL parsing fails for any reason, default to treating it as external\n return true;\n }\n }\n\n // Absolute URL with no comparison URL provided\n return true;\n};\n\nexport const isTextChildren = (children: ReactNode): boolean => {\n if (typeof children === 'string' || typeof children === 'number') {\n return true;\n }\n if (Array.isArray(children)) {\n return children.every(isTextChildren);\n }\n if (isValidElement(children)) {\n return isTextChildren(\n (children.props as { children?: ReactNode }).children\n );\n }\n return false;\n};\n\nexport const Link: FC<LinkProps> = (props) => {\n const {\n variant = 'default',\n color = 'custom',\n roundedSize,\n children,\n label,\n className,\n isActive,\n underlined,\n locale,\n size: sizeProp,\n isExternalLink: isExternalLinkProp,\n isPageSection: isPageSectionProp,\n href: hrefProp,\n rel: relProp,\n target: targetProp,\n ...otherProps\n } = props;\n\n const isButton = variant === 'button' || variant === 'button-outlined';\n const size = sizeProp ?? (isButton ? 'md' : 'custom');\n\n const isExternalLink = isExternalLinkProp ?? checkIsExternalLink(props);\n const isPageSection = isPageSectionProp ?? hrefProp?.startsWith('#') ?? false;\n\n const isChildrenString = isTextChildren(children);\n\n /**\n * External links always carry the full safety/SEO `rel`, so a caller cannot\n * accidentally strip `nofollow`. Internal links keep whatever the caller asked for.\n */\n const rel = isExternalLink ? 'noopener noreferrer nofollow' : relProp;\n\n const target = isExternalLink ? '_blank' : (targetProp ?? '_self');\n\n const resolvedHref =\n locale && hrefProp && !isExternalLink && !isPageSection\n ? getLocalizedUrl(hrefProp, locale)\n : hrefProp;\n\n const href = resolvedHref === '' ? undefined : resolvedHref;\n\n return (\n <a\n {...otherProps}\n href={href}\n aria-label={label}\n rel={rel}\n target={target}\n aria-current={isActive ? 'page' : undefined}\n suppressHydrationWarning\n className={cn(\n linkVariants({\n variant,\n color,\n roundedSize,\n underlined,\n size,\n className,\n })\n )}\n >\n {isButton && isChildrenString ? <span>{children}</span> : children}\n\n {isExternalLink && isChildrenString && (\n <ExternalLink className=\"ml-2 inline-block size-4\" />\n )}\n {isPageSection && <MoveRight className=\"ml-2 inline-block size-4\" />}\n </a>\n );\n};\n"],"mappings":";;;;;;;;AAiDA,MAAa,eAAe,IAC1B,iHACA;CACE,UAAU;EACR,SAAS;GACP,SACE;GACF,kBACE;GAEF,QACE;GAEF,mBACE;GAEF,WACE;EACJ;EACA,aAAa;GACX,MAAM;GACN,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,OACE;GACF,OACE;GACF,MAAM;EACR;EACA,OAAO;GACL,SAAS;GACT,WAAW;GACX,SAAS;GACT,OAAO;GACP,MAAM;GACN,MAAM;GACN,gBAAgB;GAChB,OAAO;GACP,SAAS;GACT,QAAQ;EACV;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,QAAQ;EACV;EACA,YAAY;GACV,SAAS;GACT,MAAM;GACN,OAAO;EACT;CACF;CAEA,kBAAkB;EAIhB;GAIE,SAAS;GACT,OAAO;GACP,OAAO;EACT;EACA;GAIE,SAAS;GACT,OAAO;GACP,OAAO;EACT;EAGA;GACE,SAAS,CAAC,UAAU,iBAAiB;GACrC,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS,CAAC,UAAU,iBAAiB;GACrC,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS,CAAC,UAAU,iBAAiB;GACrC,MAAM;GACN,OAAO;EACT;EACA;GACE,SAAS,CAAC,UAAU,iBAAiB;GACrC,MAAM;GACN,OAAO;EACT;EAEA;GACE,SAAS,CAAC,UAAU,iBAAiB;GACrC,OAAO;GACP,OAAO;EACT;EACA;GACE,SAAS,CAAC,UAAU,iBAAiB;GACrC,OAAO;GACP,OAAO;EACT;EACA;GACE,SAAS,CAAC,UAAU,iBAAiB;GACrC,OAA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C/C;CAEF,OAAO;AACT;AAEA,MAAa,QAAuB,UAAU;CAC5C,MAAM,EACJ,UAAU,WACV,QAAQ,UACR,aACA,UACA,OACA,WACA,UACA,YACA,QACA,MAAM,UACN,gBAAgB,oBAChB,eAAe,mBACf,MAAM,UACN,KAAK,SACL,QAAQ,YACR,GAAG,eACD;CAEJ,MAAM,WAAW,YAAY,YAAY,YAAY;CACrD,MAAM,OAAO,aAAa,WAAW,OAAO;CAE5C,MAAM,iBAAiB,sBAAsB,oBAAoB,KAAK;CACtE,MAAM,gBAAgB,qBAAqB,UAAU,WAAW,GAAG,KAAK;CAExE,MAAM,mBAAmB,eAAe,QAAQ;;;;;CAMhD,MAAM,MAAM,iBAAiB,iCAAiC;CAE9D,MAAM,SAAS,iBAAiB,WAAY,cAAc;CAE1D,MAAM,eACJ,UAAU,YAAY,CAAC,kBAAkB,CAAC,gBACtC,gBAAgB,UAAU,MAAM,IAChC;CAEN,MAAM,OAAO,iBAAiB,KAAK,SAAY;CAE/C,OACE,qBAAC,KAAD;EACE,GAAI;EACE;EACN,cAAY;EACP;EACG;EACR,gBAAc,WAAW,SAAS;EAClC;EACA,WAAW,GACT,aAAa;GACX;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,CACH;YAjBF;GAmBG,YAAY,mBAAmB,oBAAC,QAAD,EAAO,SAAe,KAAI;GAEzD,kBAAkB,oBACjB,oBAAC,cAAD,EAAc,WAAU,2BAA4B;GAErD,iBAAiB,oBAAC,WAAD,EAAW,WAAU,2BAA4B;EAClE;;AAEP"}
|
|
1
|
+
{"version":3,"file":"Link.mjs","names":[],"sources":["../../../../src/components/Link/Link.tsx"],"sourcesContent":["import { getLocalizedUrl } from '@intlayer/core/localization';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ExternalLink, MoveRight } from 'lucide-react';\nimport {\n type AnchorHTMLAttributes,\n type DetailedHTMLProps,\n type FC,\n isValidElement,\n type ReactNode,\n} from 'react';\n\nexport type LinkVariant =\n | 'default'\n | 'invisible-link'\n | 'button'\n | 'button-outlined'\n | 'hoverable';\n\n/**\n * Color theme variants for Link component\n */\nexport type LinkColor =\n | 'neutral'\n | 'text'\n | 'error'\n | 'success'\n | 'custom'\n | 'text-inverse';\n\nexport type LinkRoundedSize =\n | 'none'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | '2xl'\n | '3xl'\n | 'full';\n\nexport type LinkSize = 'sm' | 'md' | 'lg' | 'xl' | 'custom';\n\nexport type LinkUnderlined = 'default' | 'true' | 'false';\n\nexport const linkVariants = cva(\n 'gap-3 transition-all duration-300 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n default:\n 'h-auto justify-start border-inherit bg-current/0 px-1 font-medium decoration-[1.5] underline-offset-5 hover:bg-current/0 hover:underline hover:underline-offset-6 hover:opacity-80',\n 'invisible-link':\n 'h-auto justify-start border-inherit bg-current/0 px-1',\n\n button:\n 'relative inline-flex min-h-8 cursor-pointer flex-row items-center justify-center gap-2 rounded-full bg-current px-6 text-center font-medium text-sm text-text ring-0 *:text-text-opposite hover:bg-current/90 hover:ring-5 aria-selected:ring-5 aria-[current]:ring-5 max-md:py-2',\n\n 'button-outlined':\n 'relative inline-flex min-h-8 cursor-pointer flex-row items-center justify-center gap-2 rounded-full border-[1.3px] border-current! px-6 text-center font-medium text-sm text-text ring-0 *:text-text hover:bg-current/30! hover:ring-5 aria-selected:ring-5 aria-[current]:ring-5 max-md:py-2',\n\n hoverable:\n 'block rounded-lg border-none bg-current/0 transition *:text-current! hover:bg-current/10 aria-[current]:bg-current/5',\n },\n roundedSize: {\n none: 'rounded-none',\n sm: 'rounded-lg [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-xl',\n md: 'rounded-xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl',\n lg: 'rounded-2xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-3xl',\n xl: 'rounded-3xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-4xl',\n '2xl':\n 'rounded-4xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[2.5rem]',\n '3xl':\n 'rounded-[2.5rem] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[3rem]',\n full: 'rounded-full',\n },\n color: {\n neutral: 'text-neutral',\n text: 'text-text',\n error: 'text-error',\n success: 'text-success',\n 'text-inverse': 'text-text-opposite',\n custom: '',\n },\n size: {\n sm: 'text-sm',\n md: 'text-base',\n lg: 'text-lg',\n xl: 'text-xl',\n custom: '',\n },\n underlined: {\n default: '',\n true: 'underline',\n false: 'no-underline',\n },\n },\n // Compound variants handle height and padding\n compoundVariants: [\n // ---------------------------------------------------------\n // FIX START: Correctly Handle Contrast for TEXT_INVERSE\n // ---------------------------------------------------------\n {\n // Filled Button + Inverse Color (e.g., White Button):\n // We DO NOT override parent text color (it must remain 'text-opposite' so bg-current is white).\n // We ONLY override children to be 'text-text' (Dark) so they show up on white.\n variant: 'button',\n color: 'text-inverse',\n class: '*:text-text',\n },\n {\n // Outlined Button + Inverse Color (e.g., White Border):\n // Parent is 'text-opposite' (Border is white).\n // Children must also be 'text-opposite' (White text) to show on dark background.\n variant: 'button-outlined',\n color: 'text-inverse',\n class: 'text-text-opposite *:text-text-opposite',\n },\n // Min height and padding for button variants\n {\n variant: ['button', 'button-outlined'],\n size: 'sm',\n class: 'min-h-7 px-3 text-xs max-md:py-1',\n },\n {\n variant: ['button', 'button-outlined'],\n size: 'md',\n class: 'min-h-8 px-6 text-sm max-md:py-2',\n },\n {\n variant: ['button', 'button-outlined'],\n size: 'lg',\n class: 'min-h-10 px-8 text-lg max-md:py-3',\n },\n {\n variant: ['button', 'button-outlined'],\n size: 'xl',\n class: 'min-h-11 px-10 text-xl max-md:py-4',\n },\n // Ring color variants\n\n {\n variant: ['button', 'button-outlined'],\n color: 'neutral',\n class: 'ring-neutral/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'text',\n class: 'ring-text/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'text-inverse',\n class: 'ring-text-opposite/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'error',\n class: 'ring-error/20',\n },\n {\n variant: ['button', 'button-outlined'],\n color: 'success',\n class: 'ring-success/20',\n },\n ],\n\n defaultVariants: {\n variant: 'default',\n roundedSize: 'md',\n underlined: 'default',\n size: 'custom',\n },\n }\n);\n\nexport type LinkProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n> &\n VariantProps<typeof linkVariants> & {\n label: string;\n isExternalLink?: boolean;\n isPageSection?: boolean;\n isActive?: boolean;\n locale?: LocalesValues;\n };\n\nexport const checkIsExternalLink = (\n {\n href,\n isExternalLink: isExternalLinkProp,\n }: Pick<LinkProps, 'href' | 'isExternalLink'>,\n url?: string\n): boolean => {\n // Explicit prop override takes precedence\n if (typeof isExternalLinkProp === 'boolean') {\n return isExternalLinkProp;\n }\n\n const isValidHref = typeof href === 'string' && href.trim() !== '';\n\n if (!isValidHref) return false;\n\n // Relative URLs (e.g., '/about') are always internal\n if (!/^https?:\\/\\//.test(href)) {\n return false;\n }\n\n // Compare base domains\n if (url) {\n try {\n const hrefHost = new URL(href).hostname;\n // Ensure the reference url has a protocol so URL() can parse it correctly\n const currentHost = new URL(\n url.startsWith('http') ? url : `https://${url}`\n ).hostname;\n\n // Extract the root domain (e.g., 'app.intlayer.org' -> 'intlayer.org')\n const getBaseDomain = (host: string) =>\n host.split('.').slice(-2).join('.');\n\n return getBaseDomain(hrefHost) !== getBaseDomain(currentHost);\n } catch {\n // If URL parsing fails for any reason, default to treating it as external\n return true;\n }\n }\n\n // Absolute URL with no comparison URL provided\n return true;\n};\n\nexport const isTextChildren = (children: ReactNode): boolean => {\n if (typeof children === 'string' || typeof children === 'number') {\n return true;\n }\n if (Array.isArray(children)) {\n return children.every(isTextChildren);\n }\n if (isValidElement(children)) {\n return isTextChildren(\n (children.props as { children?: ReactNode }).children\n );\n }\n return false;\n};\n\nexport const Link: FC<LinkProps> = (props) => {\n const {\n variant = 'default',\n color = 'custom',\n roundedSize,\n children,\n label,\n className,\n isActive,\n underlined,\n locale,\n size: sizeProp,\n isExternalLink: isExternalLinkProp,\n isPageSection: isPageSectionProp,\n href: hrefProp,\n rel: relProp,\n target: targetProp,\n ...otherProps\n } = props;\n\n const isButton = variant === 'button' || variant === 'button-outlined';\n const size = sizeProp ?? (isButton ? 'md' : 'custom');\n\n const isExternalLink = isExternalLinkProp ?? checkIsExternalLink(props);\n const isPageSection = isPageSectionProp ?? hrefProp?.startsWith('#') ?? false;\n\n const isChildrenString = isTextChildren(children);\n\n /**\n * External links always carry the full safety/SEO `rel`, so a caller cannot\n * accidentally strip `nofollow`. Internal links keep whatever the caller asked for.\n */\n const rel = isExternalLink ? 'noopener noreferrer nofollow' : relProp;\n\n const target = isExternalLink ? '_blank' : (targetProp ?? '_self');\n\n const resolvedHref =\n locale && hrefProp && !isExternalLink && !isPageSection\n ? getLocalizedUrl(hrefProp, locale)\n : hrefProp;\n\n const href = resolvedHref === '' ? undefined : resolvedHref;\n\n return (\n <a\n {...otherProps}\n href={href}\n aria-label={label}\n rel={rel}\n target={target}\n aria-current={isActive ? 'page' : undefined}\n suppressHydrationWarning\n className={cn(\n linkVariants({\n variant,\n color,\n roundedSize,\n underlined,\n size,\n className,\n })\n )}\n >\n {isButton && isChildrenString ? <span>{children}</span> : children}\n\n {isExternalLink && isChildrenString && (\n <ExternalLink className=\"ml-2 inline-block size-4\" />\n )}\n {isPageSection && <MoveRight className=\"ml-2 inline-block size-4\" />}\n </a>\n );\n};\n"],"mappings":";;;;;;;;AA6CA,MAAa,eAAe,IAC1B,iHACA;CACE,UAAU;EACR,SAAS;GACP,SACE;GACF,kBACE;GAEF,QACE;GAEF,mBACE;GAEF,WACE;EACJ;EACA,aAAa;GACX,MAAM;GACN,IAAI;GACJ,IAAI;GACJ,IAAI;G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AW,SAAS;EAClC;EACA,WAAW,GACT,aAAa;GACX;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,CACH;YAjBF;GAmBG,YAAY,mBAAmB,oBAAC,QAAD,EAAO,SAAe,KAAI;GAEzD,kBAAkB,oBACjB,oBAAC,cAAD,EAAc,WAAU,2BAA4B;GAErD,iBAAiB,oBAAC,WAAD,EAAW,WAAU,2BAA4B;EAClE;;AAEP"}
|
|
@@ -83,7 +83,7 @@ const DesktopNavbar = ({ logo, sections, rightItems, selectedChoice }) => /* @__
|
|
|
83
83
|
className: "ml-[2vw] h-auto gap-3 overflow-x-auto text-muted-foreground tracking-wide lg:ml-[5vw] lg:gap-3 xl:ml-[10vw] xl:gap-6",
|
|
84
84
|
tabs: sections,
|
|
85
85
|
hoverable: true,
|
|
86
|
-
color: "
|
|
86
|
+
color: "text"
|
|
87
87
|
}),
|
|
88
88
|
/* @__PURE__ */ jsx("div", {
|
|
89
89
|
className: "mr-4 flex items-center justify-end gap-2 md:gap-4",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesktopNavbar.mjs","names":[],"sources":["../../../../src/components/Navbar/DesktopNavbar.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { TabSelector, type TabSelectorItemProps } from '../TabSelector';\n\n/**\n * Props for the DesktopNavbar component\n * @template T - The tab props type extending TabProps\n */\ntype DesktopNavbarProps<T extends TabSelectorItemProps> = {\n /** Logo component or element displayed on the left side */\n logo: ReactNode;\n /** Array of navigation sections as tab elements */\n sections: ReactElement<T>[];\n /** Right-aligned items (e.g., user menu, search, settings) */\n rightItems?: ReactNode;\n /** Currently selected tab key for highlighting active state */\n selectedChoice: T['key'];\n};\n\n/**\n * Desktop Navigation Bar Component\n *\n * A horizontal navigation bar optimized for desktop and tablet viewports.\n * Features a sticky header with backdrop blur, left-aligned logo, center navigation tabs,\n * and right-aligned utility items.\n *\n * Features:\n * - Sticky positioning with z-index layering (z-50)\n * - Semi-transparent backdrop with blur effect for modern glass-morphism design\n * - Responsive spacing that adapts across screen sizes\n * - Horizontal scrollable tabs for overflow content\n * - Left-to-right layout: Logo → Navigation → Utility Items\n * - Integrated with TabSelector for consistent tab behavior\n *\n * Layout Structure:\n * ```\n * [Logo] -------- [Nav Tab 1] [Nav Tab 2] [Nav Tab 3] -------- [Right Items]\n * ```\n *\n * Responsive Behavior:\n * - Base: 2vw margin-left, 3-unit gap between tabs\n * - Large (≥1024px): 5vw margin-left, 3-unit gap between tabs\n * - Extra Large (≥1280px): 10vw margin-left, 6-unit gap between tabs\n * - Right items: 2-unit gap on mobile, 4-unit gap on medium screens\n *\n * Styling Features:\n * - Semi-transparent card background (`bg-card/80`)\n * - Subtle shadow with controlled blur (`shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)]`)\n * - Backdrop blur effect for content behind navbar\n * - Horizontal overflow scrolling for tab content\n *\n * @example\n * Basic usage:\n * ```tsx\n * const navigationTabs = [\n * { key: 'home', label: 'Home', href: '/' },\n * { key: 'products', label: 'Products', href: '/products' },\n * { key: 'about', label: 'About', href: '/about' }\n * ];\n *\n * <DesktopNavbar\n * logo={<CompanyLogo />}\n * sections={navigationTabs}\n * selectedChoice=\"home\"\n * rightItems={<UserProfileMenu />}\n * />\n * ```\n *\n * @example\n * With multiple right items:\n * ```tsx\n * <DesktopNavbar\n * logo={<Logo />}\n * sections={navSections}\n * selectedChoice={currentPage}\n * rightItems={\n * <>\n * <SearchButton />\n * <NotificationBell />\n * <UserMenu />\n * </>\n * }\n * />\n * ```\n *\n * @template T - Tab properties type extending TabProps for type safety\n * @param props - DesktopNavbar component props\n * @returns Horizontal desktop navigation JSX element\n */\nexport const DesktopNavbar = <T extends TabSelectorItemProps>({\n logo,\n sections,\n rightItems,\n selectedChoice,\n}: DesktopNavbarProps<T>) => (\n <nav className=\"sticky top-0 z-50 flex w-full items-center border-neutral border-b px-4 py-3 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur-2xl\">\n {logo}\n\n <TabSelector\n selectedChoice={selectedChoice}\n className=\"ml-[2vw] h-auto gap-3 overflow-x-auto text-muted-foreground tracking-wide lg:ml-[5vw] lg:gap-3 xl:ml-[10vw] xl:gap-6\"\n tabs={sections}\n hoverable\n color=\"
|
|
1
|
+
{"version":3,"file":"DesktopNavbar.mjs","names":[],"sources":["../../../../src/components/Navbar/DesktopNavbar.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { TabSelector, type TabSelectorItemProps } from '../TabSelector';\n\n/**\n * Props for the DesktopNavbar component\n * @template T - The tab props type extending TabProps\n */\ntype DesktopNavbarProps<T extends TabSelectorItemProps> = {\n /** Logo component or element displayed on the left side */\n logo: ReactNode;\n /** Array of navigation sections as tab elements */\n sections: ReactElement<T>[];\n /** Right-aligned items (e.g., user menu, search, settings) */\n rightItems?: ReactNode;\n /** Currently selected tab key for highlighting active state */\n selectedChoice: T['key'];\n};\n\n/**\n * Desktop Navigation Bar Component\n *\n * A horizontal navigation bar optimized for desktop and tablet viewports.\n * Features a sticky header with backdrop blur, left-aligned logo, center navigation tabs,\n * and right-aligned utility items.\n *\n * Features:\n * - Sticky positioning with z-index layering (z-50)\n * - Semi-transparent backdrop with blur effect for modern glass-morphism design\n * - Responsive spacing that adapts across screen sizes\n * - Horizontal scrollable tabs for overflow content\n * - Left-to-right layout: Logo → Navigation → Utility Items\n * - Integrated with TabSelector for consistent tab behavior\n *\n * Layout Structure:\n * ```\n * [Logo] -------- [Nav Tab 1] [Nav Tab 2] [Nav Tab 3] -------- [Right Items]\n * ```\n *\n * Responsive Behavior:\n * - Base: 2vw margin-left, 3-unit gap between tabs\n * - Large (≥1024px): 5vw margin-left, 3-unit gap between tabs\n * - Extra Large (≥1280px): 10vw margin-left, 6-unit gap between tabs\n * - Right items: 2-unit gap on mobile, 4-unit gap on medium screens\n *\n * Styling Features:\n * - Semi-transparent card background (`bg-card/80`)\n * - Subtle shadow with controlled blur (`shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)]`)\n * - Backdrop blur effect for content behind navbar\n * - Horizontal overflow scrolling for tab content\n *\n * @example\n * Basic usage:\n * ```tsx\n * const navigationTabs = [\n * { key: 'home', label: 'Home', href: '/' },\n * { key: 'products', label: 'Products', href: '/products' },\n * { key: 'about', label: 'About', href: '/about' }\n * ];\n *\n * <DesktopNavbar\n * logo={<CompanyLogo />}\n * sections={navigationTabs}\n * selectedChoice=\"home\"\n * rightItems={<UserProfileMenu />}\n * />\n * ```\n *\n * @example\n * With multiple right items:\n * ```tsx\n * <DesktopNavbar\n * logo={<Logo />}\n * sections={navSections}\n * selectedChoice={currentPage}\n * rightItems={\n * <>\n * <SearchButton />\n * <NotificationBell />\n * <UserMenu />\n * </>\n * }\n * />\n * ```\n *\n * @template T - Tab properties type extending TabProps for type safety\n * @param props - DesktopNavbar component props\n * @returns Horizontal desktop navigation JSX element\n */\nexport const DesktopNavbar = <T extends TabSelectorItemProps>({\n logo,\n sections,\n rightItems,\n selectedChoice,\n}: DesktopNavbarProps<T>) => (\n <nav className=\"sticky top-0 z-50 flex w-full items-center border-neutral border-b px-4 py-3 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur-2xl\">\n {logo}\n\n <TabSelector\n selectedChoice={selectedChoice}\n className=\"ml-[2vw] h-auto gap-3 overflow-x-auto text-muted-foreground tracking-wide lg:ml-[5vw] lg:gap-3 xl:ml-[10vw] xl:gap-6\"\n tabs={sections}\n hoverable\n color=\"text\"\n />\n\n <div className=\"mr-4 flex items-center justify-end gap-2 md:gap-4\">\n {rightItems}\n </div>\n </nav>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,MAAa,iBAAiD,EAC5D,MACA,UACA,YACA,qBAEA,qBAAC,OAAD;CAAK,WAAU;WAAf;EACG;EAED,oBAAC,aAAD;GACkB;GAChB,WAAU;GACV,MAAM;GACN;GACA,OAAM;EACP;EAED,oBAAC,OAAD;GAAK,WAAU;aACZ;EACE;CACF"}
|
|
@@ -107,21 +107,32 @@ const bgStyle = "bg-card/95 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blu
|
|
|
107
107
|
* @param props - MobileNavbar component props
|
|
108
108
|
* @returns Mobile navigation with rollable full-screen menu
|
|
109
109
|
*/
|
|
110
|
-
const MobileNavbar = ({ logo, topChildren, topSections = [], bottomChildren, bottomSections = [], rightItems, rollable = true }) => {
|
|
110
|
+
const MobileNavbar = ({ logo, topChildren, topSections = [], bottomChildren, bottomSections = [], rightItems, rollable = true, isActive = true }) => {
|
|
111
111
|
const [isHidden, setIsHidden] = useState(false);
|
|
112
112
|
const [isUnrolled, setIsUnrolled] = useState(false);
|
|
113
113
|
const [headerHeight, setHeaderHeight] = useState(0);
|
|
114
114
|
const navRef = useRef(null);
|
|
115
115
|
useScrollBlockage({
|
|
116
|
-
disableScroll: rollable,
|
|
116
|
+
disableScroll: isActive && rollable,
|
|
117
117
|
key: "mobile_nav"
|
|
118
118
|
});
|
|
119
119
|
useScrollDetection({
|
|
120
120
|
onScrollUp: () => setIsHidden(false),
|
|
121
121
|
onScrollDown: () => setIsHidden(true),
|
|
122
|
-
isEnabled: !isUnrolled && rollable
|
|
122
|
+
isEnabled: isActive && !isUnrolled && rollable
|
|
123
123
|
});
|
|
124
124
|
/**
|
|
125
|
+
* Clears the transient state when the desktop layout takes over. Without it,
|
|
126
|
+
* a viewport that grows past the breakpoint while the header is scrolled away
|
|
127
|
+
* — or while the menu is open — restores that state on the way back, and the
|
|
128
|
+
* user returns to a navbar that is translated off screen.
|
|
129
|
+
*/
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (isActive) return;
|
|
132
|
+
setIsHidden(false);
|
|
133
|
+
setIsUnrolled(false);
|
|
134
|
+
}, [isActive]);
|
|
135
|
+
/**
|
|
125
136
|
* Measures the collapsed header so the rolled-down panel can size itself to
|
|
126
137
|
* the rest of the viewport.
|
|
127
138
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNavbar.mjs","names":[],"sources":["../../../../src/components/Navbar/MobileNavbar.tsx"],"sourcesContent":["'use client';\n\nimport { useScrollBlockage } from '@hooks/useScrollBlockage';\nimport { useScrollDetection } from '@hooks/useScrollDetection';\nimport { cn } from '@utils/cn';\nimport { m, type Variants } from 'framer-motion';\nimport {\n type ReactElement,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\nimport type { TabSelectorItemProps } from '../TabSelector';\nimport { Burger } from './Burger';\n\n/**\n * Props for the MobileNavbar component\n * @template T - The tab props type extending TabProps\n */\ntype MobileNavbarProps<T extends TabSelectorItemProps> = {\n /** Logo component or element displayed in the header */\n logo: ReactNode;\n /** Additional content displayed at the top of expanded mobile menu */\n topChildren?: ReactNode;\n /** Navigation sections displayed in the top area of expanded menu */\n topSections?: ReactElement<T>[];\n /** Additional content displayed at the bottom of expanded mobile menu */\n bottomChildren?: ReactNode;\n /** Navigation sections displayed in the bottom area of expanded menu */\n bottomSections?: ReactElement<T>[];\n /** Right-aligned items in the collapsed header (e.g., search, notifications) */\n rightItems?: ReactNode;\n /** Whether the navbar should be rollable (default: true) */\n rollable?: boolean;\n};\n\n/**\n * Framer Motion animation variants for staggered menu item reveals\n * Creates a smooth cascading effect when menu opens/closes\n */\nconst navVariants: Variants = {\n open: {\n transition: { staggerChildren: 0.07, delayChildren: 0.2 },\n },\n closed: {\n transition: { staggerChildren: 0.05, staggerDirection: -1 },\n },\n};\n\n/**\n * Shared background styling for mobile navbar components\n * Provides glass-morphism effect with blur and transparency\n */\nconst bgStyle =\n 'bg-card/95 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur';\n\n/**\n * Mobile Navigation Bar Component\n *\n * A sophisticated mobile-first navigation component with rollable full-screen menu,\n * scroll-aware behavior, and smooth animations. Optimized for touch interactions and\n * mobile user experience patterns.\n *\n * Features:\n * - rollable hamburger menu with full-screen overlay\n * - Auto-hide on scroll down, show on scroll up for screen space optimization\n * - Background scroll prevention when menu is open\n * - Staggered animations for smooth menu item reveals\n * - Flexible content areas (top/bottom children and sections)\n * - Responsive layout with viewport-aware sizing\n * - Backdrop blur effects for modern glass-morphism design\n *\n * Layout Structure:\n * ```\n * [Logo] ----------- [Right Items] [Burger]\n * (when expanded)\n * ┌─────────────────────────────────────────┐\n * │ [Top Children] │\n * │ [Top Sections - Navigation Items] │\n * │ [Bottom Sections - Navigation Items] │\n * │ [Bottom Children] │\n * └─────────────────────────────────────────┘\n * ```\n *\n * Behavioral Features:\n * - Sticky positioning with dynamic hide/show based on scroll direction\n * - Background scroll locking when menu is expanded\n * - Click outside to close expanded menu\n * - Smooth height animations with MaxHeightSmoother\n * - Intelligent burger button visibility (only shown if sections exist)\n *\n * Animation Details:\n * - Menu items animate in with staggered timing (70ms delay between items)\n * - Exit animations are reversed with 50ms stagger\n * - Initial delay of 200ms before items start animating in\n * - Full viewport height menu with dynamic height calculation\n *\n * @example\n * Basic mobile navbar:\n * ```tsx\n * <MobileNavbar\n * logo={<MobileLogo />}\n * topSections={primaryNavItems}\n * rightItems={<SearchIcon />}\n * />\n * ```\n *\n * @example\n * Full-featured mobile navbar:\n * ```tsx\n * <MobileNavbar\n * logo={<Logo />}\n * topChildren={<WelcomeMessage />}\n * topSections={mainNavItems}\n * bottomSections={utilityNavItems}\n * bottomChildren={<UserProfile />}\n * rightItems={\n * <>\n * <NotificationIcon />\n * <SearchIcon />\n * </>\n * }\n * />\n * ```\n *\n * Accessibility Features:\n * - Menu expanded state communicated via aria-expanded\n * - Focus management and keyboard navigation support\n * - Screen reader friendly with semantic nav structure\n *\n * @template T - Tab properties type extending TabProps for type safety\n * @param props - MobileNavbar component props\n * @returns Mobile navigation with rollable full-screen menu\n */\nexport const MobileNavbar = <T extends TabSelectorItemProps>({\n logo,\n topChildren,\n topSections = [],\n bottomChildren,\n bottomSections = [],\n rightItems,\n rollable = true,\n}: MobileNavbarProps<T>) => {\n const [isHidden, setIsHidden] = useState<boolean>(false);\n const [isUnrolled, setIsUnrolled] = useState<boolean>(false);\n const [headerHeight, setHeaderHeight] = useState<number>(0);\n\n const navRef = useRef<HTMLDivElement>(null);\n\n useScrollBlockage({\n disableScroll: rollable,\n key: 'mobile_nav',\n });\n\n useScrollDetection({\n onScrollUp: () => setIsHidden(false),\n onScrollDown: () => setIsHidden(true),\n isEnabled: !isUnrolled && rollable,\n });\n\n /**\n * Measures the collapsed header so the rolled-down panel can size itself to\n * the rest of the viewport.\n *\n * Reading `clientHeight` from the render body forced a layout on every\n * render, and `useScrollDetection` re-renders this component on each wheel\n * event — so the measurement ran once per scroll frame. A `ResizeObserver`\n * callback runs *after* layout, which makes the same read free, and the\n * height is published only when it actually changed.\n */\n useEffect(() => {\n const headerElement = navRef.current;\n\n if (!headerElement) return;\n\n const resizeObserver = new ResizeObserver(([entry]) => {\n if (!entry) return;\n\n // Border box, to stay equivalent to the `clientHeight` this replaces:\n // `contentRect` would drop the header's vertical padding.\n const measuredHeight =\n entry.borderBoxSize?.[0]?.blockSize ?? entry.contentRect.height;\n\n setHeaderHeight((previousHeight) =>\n previousHeight === measuredHeight ? previousHeight : measuredHeight\n );\n });\n\n resizeObserver.observe(headerElement);\n\n return () => resizeObserver.disconnect();\n }, []);\n\n const backDivHeight = isHidden ? 0 : headerHeight;\n\n const isBurgerShowed = topSections.length + bottomSections.length > 0;\n\n return (\n <nav\n className={cn(\n bgStyle,\n 'sticky top-0 z-50 flex w-screen flex-col transition',\n isHidden ? '-translate-y-full' : 'translate-y-0'\n )}\n id=\"mobile-menu\"\n >\n <div\n className=\"flex w-full items-center justify-between gap-1 px-4 py-3 md:gap-[10vw]\"\n ref={navRef}\n >\n {logo}\n\n <div className=\"flex w-full flex-1 items-center justify-end gap-6\">\n <div className=\"flex w-full items-center justify-end gap-1\">\n {rightItems}\n </div>\n\n {isBurgerShowed && (\n <Burger\n isActive={isUnrolled}\n onClick={() => setIsUnrolled((isUnrolled) => !isUnrolled)}\n />\n )}\n </div>\n </div>\n\n <div\n className={cn(\n bgStyle,\n 'absolute bottom-0 left-0 w-full translate-y-full'\n )}\n >\n <MaxHeightSmoother isHidden={!isUnrolled}>\n <m.div\n className=\"flex w-full flex-col pt-10 pb-[20%] text-foreground text-lg tracking-wide\"\n onClick={() => setIsUnrolled(false)}\n animate={isUnrolled ? 'open' : 'closed'}\n variants={navVariants}\n style={{\n height: `calc(100vh - ${backDivHeight}px)`,\n }}\n >\n {topChildren}\n <div className=\"flex h-full flex-col justify-center\">\n {topSections}\n {bottomSections}\n </div>\n\n <div className=\"m-auto flex w-full max-w-100 items-center justify-center gap-1 px-5 py-3\">\n {bottomChildren}\n </div>\n </m.div>\n </MaxHeightSmoother>\n </div>\n </nav>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA0CA,MAAM,cAAwB;CAC5B,MAAM,EACJ,YAAY;EAAE,iBAAiB;EAAM,eAAe;CAAI,EAC1D;CACA,QAAQ,EACN,YAAY;EAAE,iBAAiB;EAAM,kBAAkB;CAAG,EAC5D;AACF;;;;;AAMA,MAAM,UACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFF,MAAa,gBAAgD,EAC3D,MACA,aACA,cAAc,CAAC,GACf,gBACA,iBAAiB,CAAC,GAClB,YACA,WAAW,WACe;CAC1B,MAAM,CAAC,UAAU,eAAe,SAAkB,KAAK;CACvD,MAAM,CAAC,YAAY,iBAAiB,SAAkB,KAAK;CAC3D,MAAM,CAAC,cAAc,mBAAmB,SAAiB,CAAC;CAE1D,MAAM,SAAS,OAAuB,IAAI;CAE1C,kBAAkB;EAChB,eAAe;EACf,KAAK;CACP,CAAC;CAED,mBAAmB;EACjB,kBAAkB,YAAY,KAAK;EACnC,oBAAoB,YAAY,IAAI;EACpC,WAAW,CAAC,cAAc;CAC5B,CAAC;;;;;;;;;;;CAYD,gBAAgB;EACd,MAAM,gBAAgB,OAAO;EAE7B,IAAI,CAAC,eAAe;EAEpB,MAAM,iBAAiB,IAAI,gBAAgB,CAAC,WAAW;GACrD,IAAI,CAAC,OAAO;GAIZ,MAAM,iBACJ,MAAM,gBAAgB,EAAE,EAAE,aAAa,MAAM,YAAY;GAE3D,iBAAiB,mBACf,mBAAmB,iBAAiB,iBAAiB,cACvD;EACF,CAAC;EAED,eAAe,QAAQ,aAAa;EAEpC,aAAa,eAAe,WAAW;CACzC,GAAG,CAAC,CAAC;CAEL,MAAM,gBAAgB,WAAW,IAAI;CAErC,MAAM,iBAAiB,YAAY,SAAS,eAAe,SAAS;CAEpE,OACE,qBAAC,OAAD;EACE,WAAW,GACT,SACA,uDACA,WAAW,sBAAsB,eACnC;EACA,IAAG;YANL,CAQE,qBAAC,OAAD;GACE,WAAU;GACV,KAAK;aAFP,CAIG,MAED,qBAAC,OAAD;IAAK,WAAU;cAAf,CACE,oBAAC,OAAD;KAAK,WAAU;eACZ;IACE,IAEJ,kBACC,oBAAC,QAAD;KACE,UAAU;KACV,eAAe,eAAe,eAAe,CAAC,UAAU;IACzD,EAEA;KACF;MAEL,oBAAC,OAAD;GACE,WAAW,GACT,SACA,kDACF;aAEA,oBAAC,mBAAD;IAAmB,UAAU,CAAC;cAC5B,qBAAC,EAAE,KAAH;KACE,WAAU;KACV,eAAe,cAAc,KAAK;KAClC,SAAS,aAAa,SAAS;KAC/B,UAAU;KACV,OAAO,EACL,QAAQ,gBAAgB,cAAc,KACxC;eAPF;MASG;MACD,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACG,aACA,cACE;;MAEL,oBAAC,OAAD;OAAK,WAAU;iBACZ;MACE;KACA;;GACU;EAChB,EACF;;AAET"}
|
|
1
|
+
{"version":3,"file":"MobileNavbar.mjs","names":[],"sources":["../../../../src/components/Navbar/MobileNavbar.tsx"],"sourcesContent":["'use client';\n\nimport { useScrollBlockage } from '@hooks/useScrollBlockage';\nimport { useScrollDetection } from '@hooks/useScrollDetection';\nimport { cn } from '@utils/cn';\nimport { m, type Variants } from 'framer-motion';\nimport {\n type ReactElement,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\nimport type { TabSelectorItemProps } from '../TabSelector';\nimport { Burger } from './Burger';\n\n/**\n * Props for the MobileNavbar component\n * @template T - The tab props type extending TabProps\n */\ntype MobileNavbarProps<T extends TabSelectorItemProps> = {\n /** Logo component or element displayed in the header */\n logo: ReactNode;\n /** Additional content displayed at the top of expanded mobile menu */\n topChildren?: ReactNode;\n /** Navigation sections displayed in the top area of expanded menu */\n topSections?: ReactElement<T>[];\n /** Additional content displayed at the bottom of expanded mobile menu */\n bottomChildren?: ReactNode;\n /** Navigation sections displayed in the bottom area of expanded menu */\n bottomSections?: ReactElement<T>[];\n /** Right-aligned items in the collapsed header (e.g., search, notifications) */\n rightItems?: ReactNode;\n /** Whether the navbar should be rollable (default: true) */\n rollable?: boolean;\n /**\n * Whether this navbar is the one on screen. The responsive switch is done in\n * CSS, so the desktop layout keeps this component mounted but hidden; a\n * hidden navbar must not lock the page scroll or answer scroll events.\n * Defaults to `true`, for the standalone use of this component.\n */\n isActive?: boolean;\n};\n\n/**\n * Framer Motion animation variants for staggered menu item reveals\n * Creates a smooth cascading effect when menu opens/closes\n */\nconst navVariants: Variants = {\n open: {\n transition: { staggerChildren: 0.07, delayChildren: 0.2 },\n },\n closed: {\n transition: { staggerChildren: 0.05, staggerDirection: -1 },\n },\n};\n\n/**\n * Shared background styling for mobile navbar components\n * Provides glass-morphism effect with blur and transparency\n */\nconst bgStyle =\n 'bg-card/95 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur';\n\n/**\n * Mobile Navigation Bar Component\n *\n * A sophisticated mobile-first navigation component with rollable full-screen menu,\n * scroll-aware behavior, and smooth animations. Optimized for touch interactions and\n * mobile user experience patterns.\n *\n * Features:\n * - rollable hamburger menu with full-screen overlay\n * - Auto-hide on scroll down, show on scroll up for screen space optimization\n * - Background scroll prevention when menu is open\n * - Staggered animations for smooth menu item reveals\n * - Flexible content areas (top/bottom children and sections)\n * - Responsive layout with viewport-aware sizing\n * - Backdrop blur effects for modern glass-morphism design\n *\n * Layout Structure:\n * ```\n * [Logo] ----------- [Right Items] [Burger]\n * (when expanded)\n * ┌─────────────────────────────────────────┐\n * │ [Top Children] │\n * │ [Top Sections - Navigation Items] │\n * │ [Bottom Sections - Navigation Items] │\n * │ [Bottom Children] │\n * └─────────────────────────────────────────┘\n * ```\n *\n * Behavioral Features:\n * - Sticky positioning with dynamic hide/show based on scroll direction\n * - Background scroll locking when menu is expanded\n * - Click outside to close expanded menu\n * - Smooth height animations with MaxHeightSmoother\n * - Intelligent burger button visibility (only shown if sections exist)\n *\n * Animation Details:\n * - Menu items animate in with staggered timing (70ms delay between items)\n * - Exit animations are reversed with 50ms stagger\n * - Initial delay of 200ms before items start animating in\n * - Full viewport height menu with dynamic height calculation\n *\n * @example\n * Basic mobile navbar:\n * ```tsx\n * <MobileNavbar\n * logo={<MobileLogo />}\n * topSections={primaryNavItems}\n * rightItems={<SearchIcon />}\n * />\n * ```\n *\n * @example\n * Full-featured mobile navbar:\n * ```tsx\n * <MobileNavbar\n * logo={<Logo />}\n * topChildren={<WelcomeMessage />}\n * topSections={mainNavItems}\n * bottomSections={utilityNavItems}\n * bottomChildren={<UserProfile />}\n * rightItems={\n * <>\n * <NotificationIcon />\n * <SearchIcon />\n * </>\n * }\n * />\n * ```\n *\n * Accessibility Features:\n * - Menu expanded state communicated via aria-expanded\n * - Focus management and keyboard navigation support\n * - Screen reader friendly with semantic nav structure\n *\n * @template T - Tab properties type extending TabProps for type safety\n * @param props - MobileNavbar component props\n * @returns Mobile navigation with rollable full-screen menu\n */\nexport const MobileNavbar = <T extends TabSelectorItemProps>({\n logo,\n topChildren,\n topSections = [],\n bottomChildren,\n bottomSections = [],\n rightItems,\n rollable = true,\n isActive = true,\n}: MobileNavbarProps<T>) => {\n const [isHidden, setIsHidden] = useState<boolean>(false);\n const [isUnrolled, setIsUnrolled] = useState<boolean>(false);\n const [headerHeight, setHeaderHeight] = useState<number>(0);\n\n const navRef = useRef<HTMLDivElement>(null);\n\n useScrollBlockage({\n disableScroll: isActive && rollable,\n key: 'mobile_nav',\n });\n\n useScrollDetection({\n onScrollUp: () => setIsHidden(false),\n onScrollDown: () => setIsHidden(true),\n isEnabled: isActive && !isUnrolled && rollable,\n });\n\n /**\n * Clears the transient state when the desktop layout takes over. Without it,\n * a viewport that grows past the breakpoint while the header is scrolled away\n * — or while the menu is open — restores that state on the way back, and the\n * user returns to a navbar that is translated off screen.\n */\n useEffect(() => {\n if (isActive) return;\n\n setIsHidden(false);\n setIsUnrolled(false);\n }, [isActive]);\n\n /**\n * Measures the collapsed header so the rolled-down panel can size itself to\n * the rest of the viewport.\n *\n * Reading `clientHeight` from the render body forced a layout on every\n * render, and `useScrollDetection` re-renders this component on each wheel\n * event — so the measurement ran once per scroll frame. A `ResizeObserver`\n * callback runs *after* layout, which makes the same read free, and the\n * height is published only when it actually changed.\n */\n useEffect(() => {\n const headerElement = navRef.current;\n\n if (!headerElement) return;\n\n const resizeObserver = new ResizeObserver(([entry]) => {\n if (!entry) return;\n\n // Border box, to stay equivalent to the `clientHeight` this replaces:\n // `contentRect` would drop the header's vertical padding.\n const measuredHeight =\n entry.borderBoxSize?.[0]?.blockSize ?? entry.contentRect.height;\n\n setHeaderHeight((previousHeight) =>\n previousHeight === measuredHeight ? previousHeight : measuredHeight\n );\n });\n\n resizeObserver.observe(headerElement);\n\n return () => resizeObserver.disconnect();\n }, []);\n\n const backDivHeight = isHidden ? 0 : headerHeight;\n\n const isBurgerShowed = topSections.length + bottomSections.length > 0;\n\n return (\n <nav\n className={cn(\n bgStyle,\n 'sticky top-0 z-50 flex w-screen flex-col transition',\n isHidden ? '-translate-y-full' : 'translate-y-0'\n )}\n id=\"mobile-menu\"\n >\n <div\n className=\"flex w-full items-center justify-between gap-1 px-4 py-3 md:gap-[10vw]\"\n ref={navRef}\n >\n {logo}\n\n <div className=\"flex w-full flex-1 items-center justify-end gap-6\">\n <div className=\"flex w-full items-center justify-end gap-1\">\n {rightItems}\n </div>\n\n {isBurgerShowed && (\n <Burger\n isActive={isUnrolled}\n onClick={() => setIsUnrolled((isUnrolled) => !isUnrolled)}\n />\n )}\n </div>\n </div>\n\n <div\n className={cn(\n bgStyle,\n 'absolute bottom-0 left-0 w-full translate-y-full'\n )}\n >\n <MaxHeightSmoother isHidden={!isUnrolled}>\n <m.div\n className=\"flex w-full flex-col pt-10 pb-[20%] text-foreground text-lg tracking-wide\"\n onClick={() => setIsUnrolled(false)}\n animate={isUnrolled ? 'open' : 'closed'}\n variants={navVariants}\n style={{\n height: `calc(100vh - ${backDivHeight}px)`,\n }}\n >\n {topChildren}\n <div className=\"flex h-full flex-col justify-center\">\n {topSections}\n {bottomSections}\n </div>\n\n <div className=\"m-auto flex w-full max-w-100 items-center justify-center gap-1 px-5 py-3\">\n {bottomChildren}\n </div>\n </m.div>\n </MaxHeightSmoother>\n </div>\n </nav>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAiDA,MAAM,cAAwB;CAC5B,MAAM,EACJ,YAAY;EAAE,iBAAiB;EAAM,eAAe;CAAI,EAC1D;CACA,QAAQ,EACN,YAAY;EAAE,iBAAiB;EAAM,kBAAkB;CAAG,EAC5D;AACF;;;;;AAMA,MAAM,UACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFF,MAAa,gBAAgD,EAC3D,MACA,aACA,cAAc,CAAC,GACf,gBACA,iBAAiB,CAAC,GAClB,YACA,WAAW,MACX,WAAW,WACe;CAC1B,MAAM,CAAC,UAAU,eAAe,SAAkB,KAAK;CACvD,MAAM,CAAC,YAAY,iBAAiB,SAAkB,KAA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K;KAClC,SAAS,aAAa,SAAS;KAC/B,UAAU;KACV,OAAO,EACL,QAAQ,gBAAgB,cAAc,KACxC;eAPF;MASG;MACD,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACG,aACA,cACE;;MAEL,oBAAC,OAAD;OAAK,WAAU;iBACZ;MACE;KACA;;GACU;EAChB,EACF;;AAET"}
|
|
@@ -4,25 +4,32 @@ import { useDevice } from "../../hooks/useDevice.mjs";
|
|
|
4
4
|
import { DesktopNavbar } from "./DesktopNavbar.mjs";
|
|
5
5
|
import { Burger } from "./Burger.mjs";
|
|
6
6
|
import { MobileNavbar } from "./MobileNavbar.mjs";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/components/Navbar/index.tsx
|
|
10
10
|
const Navbar = ({ logo, mobileTopChildren, desktopSections = [], mobileTopSections = [], mobileBottomChildren, mobileBottomSections = [], rightItemsDesktop, rightItemsMobile, selectedChoice, mobileRollable = true }) => {
|
|
11
11
|
const { isMobile } = useDevice("lg");
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
13
|
+
className: "contents lg:hidden",
|
|
14
|
+
children: /* @__PURE__ */ jsx(MobileNavbar, {
|
|
15
|
+
topChildren: mobileTopChildren,
|
|
16
|
+
topSections: mobileTopSections,
|
|
17
|
+
bottomChildren: mobileBottomChildren,
|
|
18
|
+
bottomSections: mobileBottomSections,
|
|
19
|
+
logo,
|
|
20
|
+
rightItems: rightItemsMobile,
|
|
21
|
+
rollable: mobileRollable,
|
|
22
|
+
isActive: isMobile === true
|
|
23
|
+
})
|
|
24
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: "hidden lg:contents",
|
|
26
|
+
children: /* @__PURE__ */ jsx(DesktopNavbar, {
|
|
27
|
+
sections: desktopSections,
|
|
28
|
+
rightItems: rightItemsDesktop,
|
|
29
|
+
logo,
|
|
30
|
+
selectedChoice
|
|
31
|
+
})
|
|
32
|
+
})] });
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/Navbar/index.tsx"],"sourcesContent":["'use client';\n\nimport { useDevice } from '@hooks/useDevice';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TabSelectorItemProps } from '../TabSelector';\nimport { DesktopNavbar } from './DesktopNavbar';\nimport { MobileNavbar } from './MobileNavbar';\n\n/**\n * Props for the responsive Navbar component\n * @template T - The tab props type extending TabProps\n */\ntype NavbarProps<T extends TabSelectorItemProps> = {\n /** Logo component or element to display in navbar */\n logo: ReactNode;\n /** Currently selected tab key for active state management */\n selectedChoice: T['key'];\n /** Navigation sections displayed on desktop layout */\n desktopSections?: ReactElement<T>[];\n /** Additional content displayed at top of mobile navbar */\n mobileTopChildren?: ReactNode;\n /** Navigation sections displayed at top of mobile navbar */\n mobileTopSections?: ReactElement<T>[];\n /** Additional content displayed at bottom of mobile navbar */\n mobileBottomChildren?: ReactNode;\n /** Navigation sections displayed at bottom of mobile navbar */\n mobileBottomSections?: ReactElement<T>[];\n /** Right-aligned items for desktop navbar (e.g., user menu, settings) */\n rightItemsDesktop?: ReactNode;\n /** Right-aligned items for mobile navbar */\n rightItemsMobile?: ReactNode;\n /** Whether the mobile navbar should be rollable (default: true) */\n mobileRollable?: boolean;\n};\n\n/**\n * Responsive Navbar Component\n *\n * A highly adaptable navigation component that automatically switches between desktop and mobile\n * layouts based on screen size. Provides comprehensive navigation structure with flexible content areas.\n *\n * Features:\n * - Automatic responsive switching at 'lg' breakpoint (1024px)\n * - Separate section configurations for desktop and mobile layouts\n * - Support for logo placement and right-aligned utility items\n * - Generic typing for tab properties and selected states\n * - Mobile-specific top/bottom content areas for enhanced mobile UX\n * - Hydration-safe rendering with useIsMounted hook\n *\n * @example\n * Basic usage:\n * ```tsx\n * const navSections = [\n * { key: 'home', label: 'Home', href: '/' },\n * { key: 'about', label: 'About', href: '/about' }\n * ];\n *\n * <Navbar\n * logo={<Logo />}\n * selectedChoice=\"home\"\n * desktopSections={navSections}\n * mobileTopSections={navSections}\n * rightItemsDesktop={<UserMenu />}\n * />\n * ```\n *\n * @example\n * Advanced mobile configuration:\n * ```tsx\n * <Navbar\n * logo={<Logo />}\n * selectedChoice={activeTab}\n * desktopSections={mainNavItems}\n * mobileTopSections={primaryMobileNavItems}\n * mobileTopChildren={<SearchBar />}\n * mobileBottomSections={secondaryMobileNavItems}\n * mobileBottomChildren={<UserProfile />}\n * rightItemsDesktop={<DesktopActions />}\n * rightItemsMobile={<MobileActions />}\n * />\n * ```\n *\n * Responsive Behavior:\n * - Desktop (≥1024px): Shows DesktopNavbar with horizontal layout\n * - Mobile (<1024px): Shows MobileNavbar with collapsible vertical layout\n * -
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/components/Navbar/index.tsx"],"sourcesContent":["'use client';\n\nimport { useDevice } from '@hooks/useDevice';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TabSelectorItemProps } from '../TabSelector';\nimport { DesktopNavbar } from './DesktopNavbar';\nimport { MobileNavbar } from './MobileNavbar';\n\n/**\n * Props for the responsive Navbar component\n * @template T - The tab props type extending TabProps\n */\ntype NavbarProps<T extends TabSelectorItemProps> = {\n /** Logo component or element to display in navbar */\n logo: ReactNode;\n /** Currently selected tab key for active state management */\n selectedChoice: T['key'];\n /** Navigation sections displayed on desktop layout */\n desktopSections?: ReactElement<T>[];\n /** Additional content displayed at top of mobile navbar */\n mobileTopChildren?: ReactNode;\n /** Navigation sections displayed at top of mobile navbar */\n mobileTopSections?: ReactElement<T>[];\n /** Additional content displayed at bottom of mobile navbar */\n mobileBottomChildren?: ReactNode;\n /** Navigation sections displayed at bottom of mobile navbar */\n mobileBottomSections?: ReactElement<T>[];\n /** Right-aligned items for desktop navbar (e.g., user menu, settings) */\n rightItemsDesktop?: ReactNode;\n /** Right-aligned items for mobile navbar */\n rightItemsMobile?: ReactNode;\n /** Whether the mobile navbar should be rollable (default: true) */\n mobileRollable?: boolean;\n};\n\n/**\n * Responsive Navbar Component\n *\n * A highly adaptable navigation component that automatically switches between desktop and mobile\n * layouts based on screen size. Provides comprehensive navigation structure with flexible content areas.\n *\n * Features:\n * - Automatic responsive switching at 'lg' breakpoint (1024px)\n * - Separate section configurations for desktop and mobile layouts\n * - Support for logo placement and right-aligned utility items\n * - Generic typing for tab properties and selected states\n * - Mobile-specific top/bottom content areas for enhanced mobile UX\n * - Hydration-safe rendering with useIsMounted hook\n *\n * @example\n * Basic usage:\n * ```tsx\n * const navSections = [\n * { key: 'home', label: 'Home', href: '/' },\n * { key: 'about', label: 'About', href: '/about' }\n * ];\n *\n * <Navbar\n * logo={<Logo />}\n * selectedChoice=\"home\"\n * desktopSections={navSections}\n * mobileTopSections={navSections}\n * rightItemsDesktop={<UserMenu />}\n * />\n * ```\n *\n * @example\n * Advanced mobile configuration:\n * ```tsx\n * <Navbar\n * logo={<Logo />}\n * selectedChoice={activeTab}\n * desktopSections={mainNavItems}\n * mobileTopSections={primaryMobileNavItems}\n * mobileTopChildren={<SearchBar />}\n * mobileBottomSections={secondaryMobileNavItems}\n * mobileBottomChildren={<UserProfile />}\n * rightItemsDesktop={<DesktopActions />}\n * rightItemsMobile={<MobileActions />}\n * />\n * ```\n *\n * Responsive Behavior:\n * - Desktop (≥1024px): Shows DesktopNavbar with horizontal layout\n * - Mobile (<1024px): Shows MobileNavbar with collapsible vertical layout\n * - Both are mounted and CSS picks one, so server-rendered and prerendered\n * markup paints the right layout with no swap once the bundle hydrates\n *\n * @template T - Tab properties type extending TabProps for type safety\n * @param props - Navbar component props\n * @returns Responsive navbar JSX element\n */\nexport { Burger } from './Burger';\nexport { DesktopNavbar } from './DesktopNavbar';\nexport { MobileNavbar } from './MobileNavbar';\n\nexport const Navbar = <T extends TabSelectorItemProps>({\n logo,\n mobileTopChildren,\n desktopSections = [],\n mobileTopSections = [],\n mobileBottomChildren,\n mobileBottomSections = [],\n rightItemsDesktop,\n rightItemsMobile,\n selectedChoice,\n mobileRollable = true,\n}: NavbarProps<T>) => {\n // Only decides which navbar *behaves*, never which one is shown: the media\n // query cannot resolve before hydration, and picking the layout in JS baked\n // the desktop navbar into the prerendered HTML — mobile visitors watched it\n // swap once the bundle arrived. CSS makes the first paint already correct.\n const { isMobile } = useDevice('lg');\n\n return (\n <>\n {/* `contents` keeps the wrapper out of the layout, so each navbar still\n sticks and stretches exactly as it did when rendered on its own. */}\n <div className=\"contents lg:hidden\">\n <MobileNavbar\n topChildren={mobileTopChildren}\n topSections={mobileTopSections}\n bottomChildren={mobileBottomChildren}\n bottomSections={mobileBottomSections}\n logo={logo}\n rightItems={rightItemsMobile}\n rollable={mobileRollable}\n isActive={isMobile === true}\n />\n </div>\n <div className=\"hidden lg:contents\">\n <DesktopNavbar\n sections={desktopSections}\n rightItems={rightItemsDesktop}\n logo={logo}\n selectedChoice={selectedChoice}\n />\n </div>\n </>\n );\n};\n"],"mappings":";;;;;;;;;AAgGA,MAAa,UAA0C,EACrD,MACA,mBACA,kBAAkB,CAAC,GACnB,oBAAoB,CAAC,GACrB,sBACA,uBAAuB,CAAC,GACxB,mBACA,kBACA,gBACA,iBAAiB,WACG;CAKpB,MAAM,EAAE,aAAa,UAAU,IAAI;CAEnC,OACE,4CAGE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,cAAD;GACE,aAAa;GACb,aAAa;GACb,gBAAgB;GAChB,gBAAgB;GACV;GACN,YAAY;GACZ,UAAU;GACV,UAAU,aAAa;EACxB;CACE,IACL,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,eAAD;GACE,UAAU;GACV,YAAY;GACN;GACU;EACjB;CACE,EACL;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.mjs","names":[],"sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["'use client';\n\nimport { useItemSelector } from '@hooks/useItemSelector';\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react';\nimport {\n type ComponentProps,\n type FC,\n type HTMLAttributes,\n useEffect,\n useRef,\n} from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button } from '../Button';\n\nexport const paginationVariants = cva(\n 'flex items-center justify-center gap-1',\n {\n variants: {\n size: {\n sm: 'gap-1',\n md: 'gap-2',\n lg: 'gap-3',\n },\n color: {\n text: 'background-text',\n primary: 'background-primary',\n secondary: 'background-secondary',\n neutral: 'background-neutral',\n },\n variant: {\n default: '',\n bordered: 'rounded-lg border border-border p-2',\n ghost: 'bg-transparent',\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'default',\n },\n }\n);\n\nexport type PaginationSize = 'sm' | 'md' | 'lg';\n\nexport type PaginationVariant = 'default' | 'bordered' | 'ghost';\n\nexport type PaginationProps = HTMLAttributes<HTMLDivElement> &\n VariantProps<typeof paginationVariants> & {\n currentPage: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n showFirstLast?: boolean;\n showPrevNext?: boolean;\n maxVisiblePages?: number;\n disabled?: boolean;\n };\n\nconst generatePageNumbers = (\n currentPage: number,\n totalPages: number,\n maxVisiblePages: number\n): (number | 'ellipsis')[] => {\n if (totalPages <= maxVisiblePages) {\n return Array.from({ length: totalPages }, (_, i) => i + 1);\n }\n\n const pages: (number | 'ellipsis')[] = [];\n const halfVisible = Math.floor(maxVisiblePages / 2);\n\n pages.push(1);\n\n if (currentPage <= halfVisible + 2) {\n for (let i = 2; i <= Math.min(maxVisiblePages - 1, totalPages - 1); i++) {\n pages.push(i);\n }\n if (totalPages > maxVisiblePages) {\n pages.push('ellipsis');\n }\n if (totalPages > 1) {\n pages.push(totalPages);\n }\n } else if (currentPage >= totalPages - halfVisible - 1) {\n if (totalPages > maxVisiblePages) {\n pages.push('ellipsis');\n }\n for (\n let i = Math.max(2, totalPages - maxVisiblePages + 2);\n i <= totalPages;\n i++\n ) {\n pages.push(i);\n }\n } else {\n pages.push('ellipsis');\n const start = currentPage - halfVisible;\n const end = currentPage + halfVisible;\n for (let i = start; i <= end; i++) {\n pages.push(i);\n }\n pages.push('ellipsis');\n pages.push(totalPages);\n }\n\n return pages;\n};\n\nconst selector = (option: HTMLElement) =>\n option?.getAttribute('aria-current') === 'true';\n\nconst getButtonSize = (size?: PaginationSize | `${PaginationSize}` | null) => {\n if (size === 'sm') {\n return 'icon-sm';\n } else if (size === 'lg') {\n return 'icon-lg';\n } else {\n return 'icon-md';\n }\n};\n\nconst InputIndicator: FC<ComponentProps<'div'>> = (props) => (\n <div\n className=\"absolute top-0 z-0 h-full w-auto rounded-xl bg-text/20 ring-4 ring-text/10 transition-[left,width] duration-300 ease-in-out [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl motion-reduce:transition-none\"\n {...props}\n />\n);\n\nexport const Pagination: FC<PaginationProps> = ({\n currentPage,\n totalPages,\n onPageChange,\n showFirstLast = false,\n showPrevNext = true,\n maxVisiblePages = 5,\n disabled = false,\n size = 'md',\n variant = 'default',\n color = 'text',\n className,\n ...props\n}) => {\n const { goToNextPage, goToPreviousPage } = useIntlayer('pagination');\n\n const pageNumbers = generatePageNumbers(\n currentPage,\n totalPages,\n maxVisiblePages\n );\n\n const buttonSize = getButtonSize(size);\n const isFirstPage = currentPage === 1;\n const isLastPage = currentPage === totalPages;\n\n const optionsRefs = useRef<HTMLElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition, scheduleMeasurement } = useItemSelector(\n optionsRefs,\n {\n selector,\n isHoverable: true,\n }\n );\n\n useEffect(() => {\n const timer = setTimeout(() => {\n scheduleMeasurement();\n }, 300);\n\n return () => clearTimeout(timer);\n }, [currentPage, scheduleMeasurement]);\n\n if (totalPages <= 1) return null;\n\n const handlePageChange = (page: number) => {\n if (!disabled && page >= 1 && page <= totalPages && page !== currentPage) {\n onPageChange(page);\n }\n };\n\n return (\n <div\n className={cn(paginationVariants({ size, variant }), className)}\n {...props}\n >\n <div className=\"relative flex items-center gap-1\">\n {choiceIndicatorPosition && (\n <InputIndicator style={choiceIndicatorPosition} ref={indicatorRef} />\n )}\n\n {showPrevNext && (\n <Button\n variant=\"outline\"\n size={buttonSize}\n color=\"text\"\n onClick={() => handlePageChange(currentPage - 1)}\n disabled={disabled || isFirstPage}\n label={goToPreviousPage.value}\n Icon={ChevronLeft}\n ref={(el) => {\n if (el) optionsRefs.current[0] = el;\n }}\n className=\"min-w-0 px-2\"\n />\n )}\n\n <div className=\"flex items-center gap-1 max-md:gap-0.5\">\n {pageNumbers.map((page, index) => {\n if (page === 'ellipsis') {\n const isFirstEllipsis = index === pageNumbers.indexOf('ellipsis');\n const ellipsisKey = isFirstEllipsis\n ? 'ellipsis-start'\n : 'ellipsis-end';\n return (\n <div\n key={ellipsisKey}\n className=\"flex h-8 min-w-8 items-center justify-center px-1\"\n >\n <MoreHorizontal className=\"h-4 w-4 text-muted-foreground\" />\n </div>\n );\n }\n\n const isActive = page === currentPage;\n // Calculate ref index: offset by 1 if showPrevNext, then count only non-ellipsis items\n const refIndex =\n (showPrevNext ? 1 : 0) +\n pageNumbers.slice(0, index).filter((p) => p !== 'ellipsis')\n .length;\n\n return (\n <Button\n key={page}\n variant={isActive ? 'default' : 'outline'}\n size={buttonSize}\n color=\"text\"\n onClick={() => handlePageChange(page)}\n disabled={disabled}\n label={`Go to page ${page}`}\n aria-current={isActive ? 'true' : 'false'}\n ref={(el) => {\n if (el) optionsRefs.current[refIndex] = el;\n }}\n className={cn(\n 'flex aspect-square h-8 w-8 min-w-0 items-center justify-center p-0 text-sm',\n size === 'sm' && 'h-6 w-6 text-xs',\n size === 'lg' && 'size-10 text-base',\n isActive && 'font-semibold'\n )}\n >\n {page}\n </Button>\n );\n })}\n </div>\n\n {showPrevNext && (\n <Button\n variant=\"outline\"\n size={buttonSize}\n color=\"text\"\n onClick={() => handlePageChange(currentPage + 1)}\n disabled={disabled || isLastPage}\n label={goToNextPage.value}\n Icon={ChevronRight}\n ref={(el) => {\n const lastRefIndex =\n (showPrevNext ? 1 : 0) +\n pageNumbers.filter((p) => p !== 'ellipsis').length;\n if (el) optionsRefs.current[lastRefIndex] = el;\n }}\n className=\"min-w-0 px-2\"\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,qBAAqB,IAChC,0CACA;CACE,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,OAAO;GACL,MAAM;GACN,SAAS;GACT,WAAW;GACX,SAAS;EACX;EACA,SAAS;GACP,SAAS;GACT,UAAU;GACV,OAAO;EACT;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;AACF,CACF;AAiBA,MAAM,uBACJ,aACA,YACA,oBAC4B;CAC5B,IAAI,cAAc,iBAChB,OAAO,MAAM,KAAK,EAAE,QAAQ,WAAW,IAAI,GAAG,MAAM,IAAI,CAAC;CAG3D,MAAM,QAAiC,CAAC;CACxC,MAAM,cAAc,KAAK,MAAM,kBAAkB,CAAC;CAElD,MAAM,KAAK,CAAC;CAEZ,IAAI,eAAe,cAAc,GAAG;EAClC,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,IAAI,kBAAkB,GAAG,aAAa,CAAC,GAAG,KAClE,MAAM,KAAK,CAAC;EAEd,IAAI,aAAa,iBACf,MAAM,KAAK,UAAU;EAEvB,IAAI,aAAa,GACf,MAAM,KAAK,UAAU;CAEzB,OAAO,IAAI,eAAe,aAAa,cAAc,GAAG;EACtD,IAAI,aAAa,iBACf,MA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KACN,OAAM;KACN,eAAe,iBAAiB,cAAc,CAAC;KAC/C,UAAU,YAAY;KACtB,OAAO,aAAa;KACpB,MAAM;KACN,MAAM,OAAO;MACX,MAAM,gBACH,eAAe,IAAI,KACpB,YAAY,QAAQ,MAAM,MAAM,UAAU,CAAC,CAAC;MAC9C,IAAI,IAAI,YAAY,QAAQ,gBAAgB;KAC9C;KACA,WAAU;IACX;GAEA;;CACF;AAET"}
|
|
1
|
+
{"version":3,"file":"Pagination.mjs","names":[],"sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["'use client';\n\nimport { useItemSelector } from '@hooks/useItemSelector';\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react';\nimport {\n type ComponentProps,\n type FC,\n type HTMLAttributes,\n useEffect,\n useRef,\n} from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Button } from '../Button';\n\nexport const paginationVariants = cva(\n 'flex items-center justify-center gap-1',\n {\n variants: {\n size: {\n sm: 'gap-1',\n md: 'gap-2',\n lg: 'gap-3',\n },\n color: {\n text: 'background-text',\n neutral: 'background-neutral',\n },\n variant: {\n default: '',\n bordered: 'rounded-lg border border-border p-2',\n ghost: 'bg-transparent',\n },\n },\n defaultVariants: {\n size: 'md',\n variant: 'default',\n },\n }\n);\n\nexport type PaginationSize = 'sm' | 'md' | 'lg';\n\nexport type PaginationVariant = 'default' | 'bordered' | 'ghost';\n\nexport type PaginationProps = HTMLAttributes<HTMLDivElement> &\n VariantProps<typeof paginationVariants> & {\n currentPage: number;\n totalPages: number;\n onPageChange: (page: number) => void;\n showFirstLast?: boolean;\n showPrevNext?: boolean;\n maxVisiblePages?: number;\n disabled?: boolean;\n };\n\nconst generatePageNumbers = (\n currentPage: number,\n totalPages: number,\n maxVisiblePages: number\n): (number | 'ellipsis')[] => {\n if (totalPages <= maxVisiblePages) {\n return Array.from({ length: totalPages }, (_, i) => i + 1);\n }\n\n const pages: (number | 'ellipsis')[] = [];\n const halfVisible = Math.floor(maxVisiblePages / 2);\n\n pages.push(1);\n\n if (currentPage <= halfVisible + 2) {\n for (let i = 2; i <= Math.min(maxVisiblePages - 1, totalPages - 1); i++) {\n pages.push(i);\n }\n if (totalPages > maxVisiblePages) {\n pages.push('ellipsis');\n }\n if (totalPages > 1) {\n pages.push(totalPages);\n }\n } else if (currentPage >= totalPages - halfVisible - 1) {\n if (totalPages > maxVisiblePages) {\n pages.push('ellipsis');\n }\n for (\n let i = Math.max(2, totalPages - maxVisiblePages + 2);\n i <= totalPages;\n i++\n ) {\n pages.push(i);\n }\n } else {\n pages.push('ellipsis');\n const start = currentPage - halfVisible;\n const end = currentPage + halfVisible;\n for (let i = start; i <= end; i++) {\n pages.push(i);\n }\n pages.push('ellipsis');\n pages.push(totalPages);\n }\n\n return pages;\n};\n\nconst selector = (option: HTMLElement) =>\n option?.getAttribute('aria-current') === 'true';\n\nconst getButtonSize = (size?: PaginationSize | `${PaginationSize}` | null) => {\n if (size === 'sm') {\n return 'icon-sm';\n } else if (size === 'lg') {\n return 'icon-lg';\n } else {\n return 'icon-md';\n }\n};\n\nconst InputIndicator: FC<ComponentProps<'div'>> = (props) => (\n <div\n className=\"absolute top-0 z-0 h-full w-auto rounded-xl bg-text/20 ring-4 ring-text/10 transition-[left,width] duration-300 ease-in-out [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl motion-reduce:transition-none\"\n {...props}\n />\n);\n\nexport const Pagination: FC<PaginationProps> = ({\n currentPage,\n totalPages,\n onPageChange,\n showFirstLast = false,\n showPrevNext = true,\n maxVisiblePages = 5,\n disabled = false,\n size = 'md',\n variant = 'default',\n color = 'text',\n className,\n ...props\n}) => {\n const { goToNextPage, goToPreviousPage } = useIntlayer('pagination');\n\n const pageNumbers = generatePageNumbers(\n currentPage,\n totalPages,\n maxVisiblePages\n );\n\n const buttonSize = getButtonSize(size);\n const isFirstPage = currentPage === 1;\n const isLastPage = currentPage === totalPages;\n\n const optionsRefs = useRef<HTMLElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition, scheduleMeasurement } = useItemSelector(\n optionsRefs,\n {\n selector,\n isHoverable: true,\n }\n );\n\n useEffect(() => {\n const timer = setTimeout(() => {\n scheduleMeasurement();\n }, 300);\n\n return () => clearTimeout(timer);\n }, [currentPage, scheduleMeasurement]);\n\n if (totalPages <= 1) return null;\n\n const handlePageChange = (page: number) => {\n if (!disabled && page >= 1 && page <= totalPages && page !== currentPage) {\n onPageChange(page);\n }\n };\n\n return (\n <div\n className={cn(paginationVariants({ size, variant }), className)}\n {...props}\n >\n <div className=\"relative flex items-center gap-1\">\n {choiceIndicatorPosition && (\n <InputIndicator style={choiceIndicatorPosition} ref={indicatorRef} />\n )}\n\n {showPrevNext && (\n <Button\n variant=\"outline\"\n size={buttonSize}\n color=\"text\"\n onClick={() => handlePageChange(currentPage - 1)}\n disabled={disabled || isFirstPage}\n label={goToPreviousPage.value}\n Icon={ChevronLeft}\n ref={(el) => {\n if (el) optionsRefs.current[0] = el;\n }}\n className=\"min-w-0 px-2\"\n />\n )}\n\n <div className=\"flex items-center gap-1 max-md:gap-0.5\">\n {pageNumbers.map((page, index) => {\n if (page === 'ellipsis') {\n const isFirstEllipsis = index === pageNumbers.indexOf('ellipsis');\n const ellipsisKey = isFirstEllipsis\n ? 'ellipsis-start'\n : 'ellipsis-end';\n return (\n <div\n key={ellipsisKey}\n className=\"flex h-8 min-w-8 items-center justify-center px-1\"\n >\n <MoreHorizontal className=\"h-4 w-4 text-muted-foreground\" />\n </div>\n );\n }\n\n const isActive = page === currentPage;\n // Calculate ref index: offset by 1 if showPrevNext, then count only non-ellipsis items\n const refIndex =\n (showPrevNext ? 1 : 0) +\n pageNumbers.slice(0, index).filter((p) => p !== 'ellipsis')\n .length;\n\n return (\n <Button\n key={page}\n variant={isActive ? 'default' : 'outline'}\n size={buttonSize}\n color=\"text\"\n onClick={() => handlePageChange(page)}\n disabled={disabled}\n label={`Go to page ${page}`}\n aria-current={isActive ? 'true' : 'false'}\n ref={(el) => {\n if (el) optionsRefs.current[refIndex] = el;\n }}\n className={cn(\n 'flex aspect-square h-8 w-8 min-w-0 items-center justify-center p-0 text-sm',\n size === 'sm' && 'h-6 w-6 text-xs',\n size === 'lg' && 'size-10 text-base',\n isActive && 'font-semibold'\n )}\n >\n {page}\n </Button>\n );\n })}\n </div>\n\n {showPrevNext && (\n <Button\n variant=\"outline\"\n size={buttonSize}\n color=\"text\"\n onClick={() => handlePageChange(currentPage + 1)}\n disabled={disabled || isLastPage}\n label={goToNextPage.value}\n Icon={ChevronRight}\n ref={(el) => {\n const lastRefIndex =\n (showPrevNext ? 1 : 0) +\n pageNumbers.filter((p) => p !== 'ellipsis').length;\n if (el) optionsRefs.current[lastRefIndex] = el;\n }}\n className=\"min-w-0 px-2\"\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,qBAAqB,IAChC,0CACA;CACE,UAAU;EACR,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;EACA,OAAO;GACL,MAAM;GACN,SAAS;EACX;EACA,SAAS;GACP,SAAS;GACT,UAAU;GACV,OAAO;EACT;CACF;CACA,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;AACF,CACF;AAiBA,MAAM,uBACJ,aACA,YACA,oBAC4B;CAC5B,IAAI,cAAc,iBAChB,OAAO,MAAM,KAAK,EAAE,QAAQ,WAAW,IAAI,GAAG,MAAM,IAAI,CAAC;CAG3D,MAAM,QAAiC,CAAC;CACxC,MAAM,cAAc,KAAK,MAAM,kBAAkB,CAAC;CAElD,MAAM,KAAK,CAAC;CAEZ,IAAI,eAAe,cAAc,GAAG;EAClC,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,IAAI,kBAAkB,GAAG,aAAa,CAAC,GAAG,KAClE,MAAM,KAAK,CAAC;EAEd,IAAI,aAAa,iBACf,MAAM,K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AS,QAAQ,qBACjB,YAAY,eACd;iBAEC;MACK,GAnBD,IAmBC;KAEZ,CAAC;IACE;IAEJ,gBACC,oBAAC,QAAD;KACE,SAAQ;KACR,MAAM;KACN,OAAM;KACN,eAAe,iBAAiB,cAAc,CAAC;KAC/C,UAAU,YAAY;KACtB,OAAO,aAAa;KACpB,MAAM;KACN,MAAM,OAAO;MACX,MAAM,gBACH,eAAe,IAAI,KACpB,YAAY,QAAQ,MAAM,MAAM,UAAU,CAAC,CAAC;MAC9C,IAAI,IAAI,YAAY,QAAQ,gBAAgB;KAC9C;KACA,WAAU;IACX;GAEA;;CACF;AAET"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useTheme } from "../../providers/ThemeProvider.mjs";
|
|
4
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
|
+
import { useTheme } from "../../providers/ThemeProvider.mjs";
|
|
5
5
|
import { useEffect, useRef } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTheme } from "../../providers/ThemeProvider.mjs";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import cn from "cnfast";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/Status/index.tsx
|
|
6
6
|
const Status = ({ className, ...props }) => {
|
|
@@ -17,8 +17,6 @@ const defaultChoices = [{
|
|
|
17
17
|
const switchSelectorVariant = cva("flex h-fit w-fit cursor-pointer flex-row gap-2 rounded-full border-[1.3px] p-0.38", {
|
|
18
18
|
variants: {
|
|
19
19
|
color: {
|
|
20
|
-
primary: "border-primary text-primary",
|
|
21
|
-
secondary: "border-secondary text-secondary",
|
|
22
20
|
neutral: "border-neutral text-neutral",
|
|
23
21
|
white: "border-white text-white",
|
|
24
22
|
black: "border-black text-black",
|
|
@@ -45,8 +43,6 @@ const choiceVariant = cva("z-1 flex-1 cursor-pointer font-medium text-sm transit
|
|
|
45
43
|
defaultVariants: { size: "md" }
|
|
46
44
|
});
|
|
47
45
|
const indicatorVariant = cva("absolute top-0 z-0 h-full w-auto rounded-full transition-all duration-300 ease-in-out motion-reduce:transition-none", { variants: { color: {
|
|
48
|
-
primary: "bg-primary data-[indicator=true]:text-primary-foreground",
|
|
49
|
-
secondary: "bg-secondary data-[indicator=true]:text-secondary-foreground",
|
|
50
46
|
neutral: "bg-neutral data-[indicator=true]:text-white",
|
|
51
47
|
white: "bg-white data-[indicator=true]:text-black",
|
|
52
48
|
black: "bg-black data-[indicator=true]:text-white",
|
|
@@ -58,7 +54,7 @@ const indicatorVariant = cva("absolute top-0 z-0 h-full w-auto rounded-full tran
|
|
|
58
54
|
* This component is horizontal.
|
|
59
55
|
*/
|
|
60
56
|
const SwitchSelector = (props) => {
|
|
61
|
-
const { choices = defaultChoices, color = "
|
|
57
|
+
const { choices = defaultChoices, color = "text", size = "md", className, itemClassName } = props;
|
|
62
58
|
const { selectedIndex, indicatorIndex, handleChange, optionsRefs, indicatorRef, choiceIndicatorPosition, setHoveredIndex, disabled } = useSwitchSelector({
|
|
63
59
|
choices,
|
|
64
60
|
value: props.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchSelector.mjs","names":[],"sources":["../../../../src/components/SwitchSelector/SwitchSelector.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { useSwitchSelector } from './useSwitchSelector';\n\nexport type SwitchSelectorChoice<T = boolean> = {\n content: ReactNode;\n value: T;\n} & HTMLAttributes<HTMLButtonElement>;\nexport type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];\n\nexport const defaultChoices: SwitchSelectorChoices<boolean> = [\n { content: 'Off', value: false },\n { content: 'On', value: true },\n];\n\nexport type SwitchSelectorColor =\n | '
|
|
1
|
+
{"version":3,"file":"SwitchSelector.mjs","names":[],"sources":["../../../../src/components/SwitchSelector/SwitchSelector.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { useSwitchSelector } from './useSwitchSelector';\n\nexport type SwitchSelectorChoice<T = boolean> = {\n content: ReactNode;\n value: T;\n} & HTMLAttributes<HTMLButtonElement>;\nexport type SwitchSelectorChoices<T> = SwitchSelectorChoice<T>[];\n\nexport const defaultChoices: SwitchSelectorChoices<boolean> = [\n { content: 'Off', value: false },\n { content: 'On', value: true },\n];\n\nexport type SwitchSelectorColor =\n | 'neutral'\n | 'white'\n | 'black'\n | 'text'\n | 'error';\n\nexport type SwitchSelectorSize = 'xs' | 'sm' | 'md' | 'lg';\n\nexport type SwitchSelectorBaseProps<T = boolean> = {\n choices?: SwitchSelectorChoices<T>;\n value?: T;\n defaultValue?: T;\n onChange?: (choice: T) => void;\n className?: string;\n itemClassName?: string;\n hoverable?: boolean;\n disabled?: boolean;\n [key: string]: any;\n};\n\nexport type SwitchSelectorProps<T = boolean> = SwitchSelectorBaseProps<T> &\n VariantProps<typeof switchSelectorVariant> &\n VariantProps<typeof choiceVariant>;\n\nexport const switchSelectorVariant = cva(\n 'flex h-fit w-fit cursor-pointer flex-row gap-2 rounded-full border-[1.3px] p-0.38',\n {\n variants: {\n color: {\n neutral: 'border-neutral text-neutral',\n white: 'border-white text-white',\n black: 'border-black text-black',\n text: 'border-foreground text-foreground',\n error: 'border-error text-error',\n },\n disabled: {\n true: 'cursor-not-allowed opacity-50',\n false: '',\n },\n },\n defaultVariants: {\n color: 'text',\n disabled: false,\n },\n }\n);\n\nexport const choiceVariant = cva(\n 'z-1 flex-1 cursor-pointer font-medium text-sm transition-all duration-300 ease-in-out aria-selected:cursor-default data-[indicator=true]:text-background motion-reduce:transition-none',\n {\n variants: {\n size: {\n xs: 'px-2 py-0.5 text-xs',\n sm: 'px-2 py-1 text-xs',\n md: 'p-2 text-sm',\n lg: 'p-4 text-base',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\nexport const indicatorVariant = cva(\n 'absolute top-0 z-0 h-full w-auto rounded-full transition-all duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n neutral: 'bg-neutral data-[indicator=true]:text-white',\n white: 'bg-white data-[indicator=true]:text-black',\n black: 'bg-black data-[indicator=true]:text-white',\n text: 'bg-foreground data-[indicator=true]:text-background',\n error: 'bg-error data-[indicator=true]:text-white',\n },\n },\n }\n);\n/**\n * Component that allows the user to select one of the provided choices.\n * This component is horizontal.\n */\nexport const SwitchSelector = <T,>(props: SwitchSelectorProps<T>) => {\n const {\n choices = defaultChoices as SwitchSelectorChoices<T>,\n color = 'text',\n size = 'md',\n className,\n itemClassName,\n } = props;\n\n const {\n selectedIndex,\n indicatorIndex,\n handleChange,\n optionsRefs,\n indicatorRef,\n choiceIndicatorPosition,\n setHoveredIndex,\n disabled,\n } = useSwitchSelector(\n {\n choices,\n value: props.value,\n defaultValue: props.defaultValue,\n onChange: props.onChange,\n hoverable: props.hoverable,\n disabled: props.disabled,\n },\n 'horizontal'\n );\n\n return (\n <div\n className={switchSelectorVariant({\n color,\n disabled,\n className,\n })}\n role=\"tablist\"\n aria-disabled={disabled ? 'true' : undefined}\n >\n <div className=\"relative flex size-full flex-row items-center justify-center\">\n {choices.map((choice, index) => {\n const { content, value, ...buttonProps } = choice;\n\n const isKeyOfKey =\n typeof value === 'string' || typeof value === 'number';\n\n const isSelected = index === selectedIndex;\n const isIndicatorOwner = index === indicatorIndex;\n\n return (\n <button\n {...buttonProps}\n type=\"button\"\n className={cn(\n choiceVariant({\n size,\n }),\n disabled && 'cursor-not-allowed',\n itemClassName\n )}\n key={isKeyOfKey ? value : index}\n role=\"tab\"\n onClick={() => handleChange(value)}\n aria-selected={isSelected ? 'true' : undefined}\n data-indicator={isIndicatorOwner ? 'true' : undefined}\n disabled={disabled}\n tabIndex={isSelected ? 0 : -1}\n ref={(el) => {\n optionsRefs.current[index] = el!;\n }}\n onMouseEnter={() => !disabled && setHoveredIndex(index)}\n onMouseLeave={() => !disabled && setHoveredIndex(null)}\n >\n {content}\n </button>\n );\n })}\n\n {choiceIndicatorPosition && (\n <div\n className={cn(\n indicatorVariant({\n color,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n />\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAaA,MAAa,iBAAiD,CAC5D;CAAE,SAAS;CAAO,OAAO;AAAM,GAC/B;CAAE,SAAS;CAAM,OAAO;AAAK,CAC/B;AA2BA,MAAa,wBAAwB,IACnC,qFACA;CACE,UAAU;EACR,OAAO;GACL,SAAS;GACT,OAAO;GACP,OAAO;GACP,MAAM;GACN,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,OAAO;EACP,UAAU;CACZ;AACF,CACF;AAEA,MAAa,gBAAgB,IAC3B,0LACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;CACN,EACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CACF;AAEA,MAAa,mBAAmB,IAC9B,uHACA,EACE,UAAU,EACR,OAAO;CACL,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;AACT,EACF,EACF,CACF;;;;;AAKA,MAAa,kBAAsB,UAAkC;CACnE,MAAM,EACJ,UAAU,gBACV,QAAQ,QACR,OAAO,MACP,WACA,kBACE;CAEJ,MAAM,EACJ,eACA,gBACA,cACA,aACA,cACA,yBACA,iBACA,aACE,kBACF;EACE;EACA,OAAO,MAAM;EACb,cAAc,MAAM;EACpB,UAAU,MAAM;EAChB,WAAW,MAAM;EACjB,UAAU,MAAM;CAClB,GACA,YACF;CAEA,OACE,oBAAC,OAAD;EACE,WAAW,sBAAsB;GAC/B;GACA;GACA;EACF,CAAC;EACD,MAAK;EACL,iBAAe,WAAW,SAAS;YAEnC,qBAAC,OAAD;GAAK,WAAU;aAAf,CACG,QAAQ,KAAK,QAAQ,UAAU;IAC9B,MAAM,EAAE,SAAS,OAAO,GAAG,gBAAgB;IAE3C,MAAM,aACJ,OAAO,UAAU,YAAY,OAAO,UAAU;IAEhD,MAAM,aAAa,UAAU;IAC7B,MAAM,mBAAmB,UAAU;IAEnC,OACE,8BAAC,UAAD;KACE,GAAI;KACJ,MAAK;KACL,WAAW,GACT,cAAc,EACZ,KACF,CAAC,GACD,YAAY,sBACZ,aACF;KACA,KAAK,aAAa,QAAQ;KAC1B,MAAK;KACL,eAAe,aAAa,KAAK;KACjC,iBAAe,aAAa,SAAS;KACrC,kBAAgB,mBAAmB,SAAS;KAClC;KACV,UAAU,aAAa,IAAI;KAC3B,MAAM,OAAO;MACX,YAAY,QAAQ,SAAS;KAC/B;KACA,oBAAoB,CAAC,YAAY,gBAAgB,KAAK;KACtD,oBAAoB,CAAC,YAAY,gBAAgB,IAAI;IAG/C,GADL,OACK;GAEZ,CAAC,GAEA,2BACC,oBAAC,OAAD;IACE,WAAW,GACT,iBAAiB,EACf,MACF,CAAC,CACH;IACA,OAAO;IACP,KAAK;GACN,EAEA;;CACF;AAET"}
|
|
@@ -11,8 +11,6 @@ import { cva } from "class-variance-authority";
|
|
|
11
11
|
const verticalSwitchSelectorVariant = cva("flex h-fit w-fit cursor-pointer flex-col gap-2 rounded-2xl border-[1.3px] p-1", {
|
|
12
12
|
variants: {
|
|
13
13
|
color: {
|
|
14
|
-
primary: "border-primary text-primary",
|
|
15
|
-
secondary: "border-secondary text-secondary",
|
|
16
14
|
[`error`]: "border-error bg-error text-error",
|
|
17
15
|
neutral: "border-neutral text-neutral",
|
|
18
16
|
light: "border-white text-white",
|
|
@@ -25,7 +23,7 @@ const verticalSwitchSelectorVariant = cva("flex h-fit w-fit cursor-pointer flex-
|
|
|
25
23
|
}
|
|
26
24
|
},
|
|
27
25
|
defaultVariants: {
|
|
28
|
-
color: `
|
|
26
|
+
color: `text`,
|
|
29
27
|
disabled: false
|
|
30
28
|
}
|
|
31
29
|
});
|
|
@@ -38,8 +36,6 @@ const verticalChoiceVariant = cva("z-1 w-full cursor-pointer font-medium text-sm
|
|
|
38
36
|
defaultVariants: { size: `md` }
|
|
39
37
|
});
|
|
40
38
|
const verticalIndicatorVariant = cva("absolute left-0 z-0 h-auto w-full rounded-xl transition-all duration-300 ease-in-out motion-reduce:transition-none", { variants: { color: {
|
|
41
|
-
primary: "bg-primary data-[indicator=true]:text-foreground",
|
|
42
|
-
secondary: "bg-secondary data-[indicator=true]:text-foreground",
|
|
43
39
|
[`error`]: "bg-error data-[indicator=true]:text-foreground",
|
|
44
40
|
neutral: "bg-neutral data-[indicator=true]:text-white",
|
|
45
41
|
light: "bg-white data-[indicator=true]:text-black",
|
|
@@ -51,7 +47,7 @@ const verticalIndicatorVariant = cva("absolute left-0 z-0 h-auto w-full rounded-
|
|
|
51
47
|
* This component is vertical.
|
|
52
48
|
*/
|
|
53
49
|
const VerticalSwitchSelector = (props) => {
|
|
54
|
-
const { choices = defaultChoices, color = "
|
|
50
|
+
const { choices = defaultChoices, color = "text", size = "md", className, itemClassName } = props;
|
|
55
51
|
const { selectedIndex, indicatorIndex, handleChange, optionsRefs, indicatorRef, choiceIndicatorPosition, setHoveredIndex, disabled } = useSwitchSelector({
|
|
56
52
|
choices,
|
|
57
53
|
value: props.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalSwitchSelector.mjs","names":[],"sources":["../../../../src/components/SwitchSelector/VerticalSwitchSelector.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n defaultChoices,\n type SwitchSelectorBaseProps,\n type SwitchSelectorChoices,\n} from './SwitchSelector';\nimport { useSwitchSelector } from './useSwitchSelector';\n\nconst verticalSwitchSelectorVariant = cva(\n 'flex h-fit w-fit cursor-pointer flex-col gap-2 rounded-2xl border-[1.3px] p-1',\n {\n variants: {\n color: {\n
|
|
1
|
+
{"version":3,"file":"VerticalSwitchSelector.mjs","names":[],"sources":["../../../../src/components/SwitchSelector/VerticalSwitchSelector.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n defaultChoices,\n type SwitchSelectorBaseProps,\n type SwitchSelectorChoices,\n} from './SwitchSelector';\nimport { useSwitchSelector } from './useSwitchSelector';\n\nconst verticalSwitchSelectorVariant = cva(\n 'flex h-fit w-fit cursor-pointer flex-col gap-2 rounded-2xl border-[1.3px] p-1',\n {\n variants: {\n color: {\n [`${'error'}`]: 'border-error bg-error text-error',\n neutral: 'border-neutral text-neutral',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-foreground',\n },\n disabled: {\n true: 'cursor-not-allowed opacity-50',\n false: '',\n },\n },\n defaultVariants: {\n color: `${'text'}`,\n disabled: false,\n },\n }\n);\n\nconst verticalChoiceVariant = cva(\n 'z-1 w-full cursor-pointer font-medium text-sm transition-all duration-300 ease-in-out aria-selected:cursor-default data-[indicator=true]:text-foreground-opposite motion-reduce:transition-none',\n {\n variants: {\n size: {\n sm: 'px-2 py-1 text-xs',\n md: 'p-2 text-sm',\n lg: 'p-4 text-base',\n },\n },\n defaultVariants: {\n size: `${'md'}`,\n },\n }\n);\n\nconst verticalIndicatorVariant = cva(\n 'absolute left-0 z-0 h-auto w-full rounded-xl transition-all duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n [`${'error'}`]: 'bg-error data-[indicator=true]:text-foreground',\n neutral: 'bg-neutral data-[indicator=true]:text-white',\n light: 'bg-white data-[indicator=true]:text-black',\n dark: 'bg-neutral-800 data-[indicator=true]:text-white',\n text: 'bg-text data-[indicator=true]:text-foreground-opposite',\n },\n },\n }\n);\n\nexport type VerticalSwitchSelectorProps<T = boolean> =\n SwitchSelectorBaseProps<T> &\n VariantProps<typeof verticalSwitchSelectorVariant> &\n VariantProps<typeof verticalChoiceVariant>;\n\n/**\n * Component that allows the user to select one of the provided choices.\n * This component is vertical.\n */\nexport const VerticalSwitchSelector = <T,>(\n props: VerticalSwitchSelectorProps<T>\n) => {\n const {\n choices = defaultChoices as SwitchSelectorChoices<T>,\n color = 'text',\n size = 'md',\n className,\n itemClassName,\n } = props;\n\n const {\n selectedIndex,\n indicatorIndex,\n handleChange,\n optionsRefs,\n indicatorRef,\n choiceIndicatorPosition,\n setHoveredIndex,\n disabled,\n } = useSwitchSelector(\n {\n choices,\n value: props.value,\n defaultValue: props.defaultValue,\n onChange: props.onChange,\n hoverable: props.hoverable,\n disabled: props.disabled,\n },\n 'vertical'\n );\n\n return (\n <div\n className={verticalSwitchSelectorVariant({\n color,\n disabled,\n className,\n })}\n role=\"tablist\"\n aria-disabled={disabled ? 'true' : undefined}\n >\n <div className=\"relative flex h-fit w-full flex-col items-center justify-center\">\n {choices.map((choice, index) => {\n const { content, value, ...buttonProps } = choice;\n\n const isKeyOfKey =\n typeof value === 'string' || typeof value === 'number';\n\n const isSelected = index === selectedIndex;\n const isIndicatorOwner = index === indicatorIndex;\n\n return (\n <button\n {...buttonProps}\n className={cn(\n verticalChoiceVariant({\n size,\n }),\n disabled && 'cursor-not-allowed',\n itemClassName\n )}\n key={isKeyOfKey ? value : index}\n role=\"tab\"\n onClick={() => handleChange(value)}\n aria-selected={isSelected ? 'true' : undefined}\n data-indicator={isIndicatorOwner ? 'true' : undefined}\n disabled={disabled || isSelected}\n tabIndex={isSelected ? 0 : -1}\n ref={(el) => {\n optionsRefs.current[index] = el!;\n }}\n onMouseEnter={() => !disabled && setHoveredIndex(index)}\n onMouseLeave={() => !disabled && setHoveredIndex(null)}\n >\n {content}\n </button>\n );\n })}\n\n {choiceIndicatorPosition && (\n <div\n className={cn(\n verticalIndicatorVariant({\n color,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n />\n )}\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;KAC1B,MAAK;KACL,eAAe,aAAa,KAAK;KACjC,iBAAe,aAAa,SAAS;KACrC,kBAAgB,mBAAmB,SAAS;KAC5C,UAAU,YAAY;KACtB,UAAU,aAAa,IAAI;KAC3B,MAAM,OAAO;MACX,YAAY,QAAQ,SAAS;KAC/B;KACA,oBAAoB,CAAC,YAAY,gBAAgB,KAAK;KACtD,oBAAoB,CAAC,YAAY,gBAAgB,IAAI;IAG/C,GADL,OACK;GAEZ,CAAC,GAEA,2BACC,oBAAC,OAAD;IACE,WAAW,GACT,yBAAyB,EACvB,MACF,CAAC,CACH;IACA,OAAO;IACP,KAAK;GACN,EAEA;;CACF;AAET"}
|
|
@@ -9,21 +9,17 @@ import { cva } from "class-variance-authority";
|
|
|
9
9
|
//#region src/components/TabSelector/TabSelector.tsx
|
|
10
10
|
const tabSelectorVariant = cva("relative z-0 flex size-full flex-row items-center gap-2", {
|
|
11
11
|
variants: { color: {
|
|
12
|
-
primary: "border-primary text-primary",
|
|
13
|
-
secondary: "border-secondary text-secondary",
|
|
14
12
|
error: "border-error bg-error text-error",
|
|
15
13
|
neutral: "border-neutral text-neutral",
|
|
16
14
|
light: "border-white text-white",
|
|
17
15
|
dark: "border-neutral-800 text-neutral-800",
|
|
18
16
|
text: "border-text text-foreground"
|
|
19
17
|
} },
|
|
20
|
-
defaultVariants: { color: "
|
|
18
|
+
defaultVariants: { color: "text" }
|
|
21
19
|
});
|
|
22
20
|
const indicatorVariant = cva("absolute -z-1 rounded-lg duration-300 ease-in-out motion-reduce:transition-none", {
|
|
23
21
|
variants: {
|
|
24
22
|
color: {
|
|
25
|
-
primary: "bg-primary/10 aria-selected:text-foreground",
|
|
26
|
-
secondary: "bg-secondary/10 aria-selected:text-foreground",
|
|
27
23
|
error: "bg-error/10 aria-selected:text-foreground",
|
|
28
24
|
neutral: "bg-neutral/10 aria-selected:text-white/10",
|
|
29
25
|
light: "bg-white/10 aria-selected:text-black",
|
|
@@ -54,7 +50,7 @@ const indicatorVariant = cva("absolute -z-1 rounded-lg duration-300 ease-in-out
|
|
|
54
50
|
* </TabSelector>
|
|
55
51
|
* ```
|
|
56
52
|
*/
|
|
57
|
-
const TabSelector = ({ tabs, selectedChoice, onTabClick, color = "
|
|
53
|
+
const TabSelector = ({ tabs, selectedChoice, onTabClick, color = "text", hoverable = false, orientation = "horizontal", className }) => {
|
|
58
54
|
const optionsRefs = useRef([]);
|
|
59
55
|
const indicatorRef = useRef(null);
|
|
60
56
|
const { choiceIndicatorPosition, scheduleMeasurement } = useItemSelector(optionsRefs, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabSelector.mjs","names":[],"sources":["../../../../src/components/TabSelector/TabSelector.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ItemSelectorOrientation,\n useItemSelector,\n} from '@hooks/useItemSelector';\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n cloneElement,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n useEffect,\n useRef,\n} from 'react';\n\nexport type TabSelectorColor
|
|
1
|
+
{"version":3,"file":"TabSelector.mjs","names":[],"sources":["../../../../src/components/TabSelector/TabSelector.tsx"],"sourcesContent":["'use client';\n\nimport {\n type ItemSelectorOrientation,\n useItemSelector,\n} from '@hooks/useItemSelector';\nimport { cn } from '@utils/cn';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n cloneElement,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n useEffect,\n useRef,\n} from 'react';\n\nexport type TabSelectorColor = 'error' | 'neutral' | 'light' | 'dark' | 'text';\n\nconst tabSelectorVariant = cva(\n 'relative z-0 flex size-full flex-row items-center gap-2',\n {\n variants: {\n color: {\n error: 'border-error bg-error text-error',\n neutral: 'border-neutral text-neutral',\n light: 'border-white text-white',\n dark: 'border-neutral-800 text-neutral-800',\n text: 'border-text text-foreground',\n },\n },\n defaultVariants: {\n color: 'text',\n },\n }\n);\n\nconst indicatorVariant = cva(\n 'absolute -z-1 rounded-lg duration-300 ease-in-out motion-reduce:transition-none',\n {\n variants: {\n color: {\n error: 'bg-error/10 aria-selected:text-foreground',\n neutral: 'bg-neutral/10 aria-selected:text-white/10',\n light: 'bg-white/10 aria-selected:text-black',\n dark: 'bg-neutral-800/10 aria-selected:text-white',\n text: 'bg-text/10 aria-selected:text-foreground-opposite',\n },\n orientation: {\n horizontal: 'top-0 h-full w-auto transition-[left,width]',\n vertical: 'left-0 h-auto w-full transition-[top,height]',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n }\n);\n\nexport type TabSelectorItemProps = HTMLAttributes<HTMLElement> & {\n key: string | number;\n};\n\nexport type TabSelectorProps<T extends TabSelectorItemProps> = {\n tabs: ReactElement<T>[];\n selectedChoice: T['key'];\n onTabClick?: (choice: T['key']) => void;\n hoverable?: boolean;\n orientation?: ItemSelectorOrientation;\n} & HTMLAttributes<HTMLElement> &\n Omit<VariantProps<typeof tabSelectorVariant>, 'color'> & {\n color?: TabSelectorColor | `${TabSelectorColor}`;\n };\n\n/**\n *\n * Component that allows the user to select one of the provided choices.\n *\n * Example:\n * ```jsx\n * <TabSelector\n * selectedChoice=\"option1\"\n * onTabClick={(choice) => console.log(choice)}\n * hoverable={true}\n * >\n * <Button key=\"option1\"/>\n * <Button key=\"option2\"/>\n * <Button key=\"option3\"/>\n * </TabSelector>\n * ```\n */\nexport const TabSelector = <T extends TabSelectorItemProps>({\n tabs,\n selectedChoice,\n onTabClick,\n color = 'text',\n hoverable = false,\n orientation = 'horizontal',\n className,\n}: TabSelectorProps<T>) => {\n const optionsRefs = useRef<HTMLElement[]>([]);\n const indicatorRef = useRef<HTMLDivElement | null>(null);\n const { choiceIndicatorPosition, scheduleMeasurement } = useItemSelector(\n optionsRefs,\n { isHoverable: hoverable, orientation }\n );\n\n useEffect(() => {\n scheduleMeasurement();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedChoice]);\n\n return (\n <div\n className={cn(\n tabSelectorVariant({\n color,\n }),\n className\n )}\n aria-orientation={orientation}\n aria-multiselectable=\"false\"\n role=\"tablist\"\n >\n {tabs.map((Tab, index) => {\n const key = Tab.key!;\n\n const isSelected = selectedChoice === key;\n\n return cloneElement(Tab, {\n key: key ?? index,\n role: 'tab',\n onClick: (e: MouseEvent<HTMLElement>) => {\n Tab.props?.onClick?.(e);\n onTabClick?.(key);\n },\n 'aria-selected': isSelected,\n 'data-active': isSelected as unknown as string,\n tabIndex: isSelected ? 0 : -1,\n ref: (el: HTMLElement) => {\n optionsRefs.current[index] = el!;\n },\n } as unknown as T);\n })}\n {choiceIndicatorPosition && (\n <div\n className={cn(\n indicatorVariant({\n color,\n orientation,\n })\n )}\n style={choiceIndicatorPosition}\n ref={indicatorRef}\n key={`${selectedChoice}${JSON.stringify(tabs.map((tab) => tab.key))}`}\n />\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAmBA,MAAM,qBAAqB,IACzB,2DACA;CACE,UAAU,EACR,OAAO;EACL,OAAO;EACP,SAAS;EACT,OAAO;EACP,MAAM;EACN,MAAM;CACR,EACF;CACA,iBAAiB,EACf,OAAO,OACT;AACF,CACF;AAEA,MAAM,mBAAmB,IACvB,mFACA;CACE,UAAU;EACR,OAAO;GACL,OAAO;GACP,SAAS;GACT,OAAO;GACP,MAAM;GACN,MAAM;EACR;EACA,aAAa;GACX,YAAY;GACZ,UAAU;EACZ;CACF;CACA,iBAAiB,EACf,aAAa,aACf;AACF,CACF;;;;;;;;;;;;;;;;;;AAkCA,MAAa,eAA+C,EAC1D,MACA,gBACA,YACA,QAAQ,QACR,YAAY,OACZ,cAAc,cACd,gBACyB;CACzB,MAAM,cAAc,OAAsB,CAAC,CAAC;CAC5C,MAAM,eAAe,OAA8B,IAAI;CACvD,MAAM,EAAE,yBAAyB,wBAAwB,gBACvD,aACA;EAAE,aAAa;EAAW;CAAY,CACxC;CAEA,gBAAgB;EACd,oBAAoB;CAEtB,GAAG,CAAC,cAAc,CAAC;CAEnB,OACE,qBAAC,OAAD;EACE,WAAW,GACT,mBAAmB,EACjB,MACF,CAAC,GACD,SACF;EACA,oBAAkB;EAClB,wBAAqB;EACrB,MAAK;YATP,CAWG,KAAK,KAAK,KAAK,UAAU;GACxB,MAAM,MAAM,IAAI;GAEhB,MAAM,aAAa,mBAAmB;GAEtC,OAAO,aAAa,KAAK;IACvB,KAAK,OAAO;IACZ,MAAM;IACN,UAAU,MAA+B;KACvC,IAAI,OAAO,UAAU,CAAC;KACtB,aAAa,GAAG;IAClB;IACA,iBAAiB;IACjB,eAAe;IACf,UAAU,aAAa,IAAI;IAC3B,MAAM,OAAoB;KACxB,YAAY,QAAQ,SAAS;IAC/B;GACF,CAAiB;EACnB,CAAC,GACA,2BACC,oBAAC,OAAD;GACE,WAAW,GACT,iBAAiB;IACf;IACA;GACF,CAAC,CACH;GACA,OAAO;GACP,KAAK;EAEN,GADM,GAAG,iBAAiB,KAAK,UAAU,KAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,GACnE,CAEA;;AAET"}
|
|
@@ -5,7 +5,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
//#region src/components/Table/Table.tsx
|
|
6
6
|
const Table = forwardRef(({ className, isInteractive, ...props }, ref) => /* @__PURE__ */ jsx("table", {
|
|
7
7
|
ref,
|
|
8
|
-
className: cn("w-full table-auto border-separate border-spacing-0 overflow-hidden rounded-2xl text-left text-sm", "[&_thead_tr:first-child_th:first-child]:rounded-tl-2xl", "[&_thead_tr:first-child_th:last-child]:rounded-tr-2xl", "[&_tbody_tr:last-child_td:first-child]:rounded-bl-2xl", "[&_tbody_tr:last-child_td:last-child]:rounded-br-2xl", "supports-[corner-shape:squircle]:rounded-3xl", "supports-[corner-shape:squircle]:[&_thead_tr:first-child_th:first-child]:rounded-tl-3xl", "supports-[corner-shape:squircle]:[&_thead_tr:first-child_th:last-child]:rounded-tr-3xl", "supports-[corner-shape:squircle]:[&_tbody_tr:last-child_td:first-child]:rounded-bl-3xl", "supports-[corner-shape:squircle]:[&_tbody_tr:last-child_td:last-child]:rounded-br-3xl", isInteractive && "[&_tbody_tr:hover]:bg-neutral/40 [&_tbody_tr
|
|
8
|
+
className: cn("w-full table-auto border-separate border-spacing-0 overflow-hidden rounded-2xl text-left text-sm", "[&_thead_tr:first-child_th:first-child]:rounded-tl-2xl", "[&_thead_tr:first-child_th:last-child]:rounded-tr-2xl", "[&_tbody_tr:last-child_td:first-child]:rounded-bl-2xl", "[&_tbody_tr:last-child_td:last-child]:rounded-br-2xl", "supports-[corner-shape:squircle]:rounded-3xl", "supports-[corner-shape:squircle]:[&_thead_tr:first-child_th:first-child]:rounded-tl-3xl", "supports-[corner-shape:squircle]:[&_thead_tr:first-child_th:last-child]:rounded-tr-3xl", "supports-[corner-shape:squircle]:[&_tbody_tr:last-child_td:first-child]:rounded-bl-3xl", "supports-[corner-shape:squircle]:[&_tbody_tr:last-child_td:last-child]:rounded-br-3xl", isInteractive && "[&_tbody_tr:hover]:bg-neutral/40 [&_tbody_tr]:cursor-pointer [&_tbody_tr]:transition-colors", className),
|
|
9
9
|
...props
|
|
10
10
|
}));
|
|
11
11
|
|