@intlayer/design-system 6.1.5 → 6.1.6
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/dist/.vite/manifest.json +13 -9
- package/dist/Form-CriPBaZk.js.map +1 -1
- package/dist/Form-DJrUK3mm.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.cjs +51 -15
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.d.ts +44 -5
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion/Accordion.mjs +52 -16
- package/dist/components/Accordion/Accordion.mjs.map +1 -1
- package/dist/components/Avatar/index.cjs +114 -31
- package/dist/components/Avatar/index.cjs.map +1 -1
- package/dist/components/Avatar/index.d.ts +46 -2
- package/dist/components/Avatar/index.d.ts.map +1 -1
- package/dist/components/Avatar/index.mjs +115 -32
- package/dist/components/Avatar/index.mjs.map +1 -1
- package/dist/components/Badge/index.cjs +88 -9
- package/dist/components/Badge/index.cjs.map +1 -1
- package/dist/components/Badge/index.d.ts +80 -2
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.mjs +89 -10
- package/dist/components/Badge/index.mjs.map +1 -1
- package/dist/components/Breadcrumb/index.cjs +124 -59
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.d.ts +89 -5
- package/dist/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/components/Breadcrumb/index.mjs +124 -59
- package/dist/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/components/Button/Button.cjs +44 -25
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.d.ts +95 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.mjs +44 -25
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/ClickOutsideDiv/index.cjs +38 -7
- package/dist/components/ClickOutsideDiv/index.cjs.map +1 -1
- package/dist/components/ClickOutsideDiv/index.d.ts +13 -0
- package/dist/components/ClickOutsideDiv/index.d.ts.map +1 -1
- package/dist/components/ClickOutsideDiv/index.mjs +39 -8
- package/dist/components/ClickOutsideDiv/index.mjs.map +1 -1
- package/dist/components/Container/index.cjs +2 -0
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.d.ts +42 -0
- package/dist/components/Container/index.d.ts.map +1 -1
- package/dist/components/Container/index.mjs +2 -0
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditor.cjs +80 -33
- package/dist/components/ContentEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditor.d.ts +29 -0
- package/dist/components/ContentEditor/ContentEditor.d.ts.map +1 -1
- package/dist/components/ContentEditor/ContentEditor.mjs +80 -33
- package/dist/components/ContentEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorInput.cjs +58 -31
- package/dist/components/ContentEditor/ContentEditorInput.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorInput.d.ts +33 -0
- package/dist/components/ContentEditor/ContentEditorInput.d.ts.map +1 -1
- package/dist/components/ContentEditor/ContentEditorInput.mjs +58 -31
- package/dist/components/ContentEditor/ContentEditorInput.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs +58 -30
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +35 -0
- package/dist/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs +59 -31
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
- package/dist/components/ContentEditor/index.cjs +4 -0
- package/dist/components/ContentEditor/index.cjs.map +1 -1
- package/dist/components/ContentEditor/index.d.ts +2 -0
- package/dist/components/ContentEditor/index.d.ts.map +1 -1
- package/dist/components/ContentEditor/index.mjs +5 -1
- package/dist/components/ContentEditor/index.mjs.map +1 -1
- package/dist/components/ContentSelector/ContentSelector.cjs +9 -1
- package/dist/components/ContentSelector/ContentSelector.cjs.map +1 -1
- package/dist/components/ContentSelector/ContentSelector.d.ts +167 -0
- package/dist/components/ContentSelector/ContentSelector.d.ts.map +1 -1
- package/dist/components/ContentSelector/ContentSelector.mjs +9 -1
- package/dist/components/ContentSelector/ContentSelector.mjs.map +1 -1
- package/dist/components/CopyButton/index.cjs +23 -8
- package/dist/components/CopyButton/index.cjs.map +1 -1
- package/dist/components/CopyButton/index.d.ts +78 -0
- package/dist/components/CopyButton/index.d.ts.map +1 -1
- package/dist/components/CopyButton/index.mjs +23 -8
- package/dist/components/CopyButton/index.mjs.map +1 -1
- package/dist/components/CopyToClipboard/index.cjs +58 -22
- package/dist/components/CopyToClipboard/index.cjs.map +1 -1
- package/dist/components/CopyToClipboard/index.d.ts +68 -2
- package/dist/components/CopyToClipboard/index.d.ts.map +1 -1
- package/dist/components/CopyToClipboard/index.mjs +59 -23
- package/dist/components/CopyToClipboard/index.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +4 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +4 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +3 -0
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +3 -0
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DropDown/index.cjs +6 -4
- package/dist/components/DropDown/index.cjs.map +1 -1
- package/dist/components/DropDown/index.d.ts +92 -15
- package/dist/components/DropDown/index.d.ts.map +1 -1
- package/dist/components/DropDown/index.mjs +6 -4
- package/dist/components/DropDown/index.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.d.ts +38 -0
- package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.cjs +10 -2
- package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.mjs +10 -2
- package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.d.ts +42 -0
- package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +58 -0
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
- package/dist/components/Footer/index.cjs.map +1 -1
- package/dist/components/Footer/index.d.ts +101 -0
- package/dist/components/Footer/index.d.ts.map +1 -1
- package/dist/components/Footer/index.mjs.map +1 -1
- package/dist/components/Form/elements/MultiselectElement.d.ts.map +1 -1
- package/dist/components/Form/elements/SelectElement.d.ts.map +1 -1
- package/dist/components/Form/elements/SwitchSelectorElement.d.ts.map +1 -1
- package/dist/components/Headers/index.cjs.map +1 -1
- package/dist/components/Headers/index.d.ts +69 -2
- package/dist/components/Headers/index.d.ts.map +1 -1
- package/dist/components/Headers/index.mjs.map +1 -1
- package/dist/components/HeightResizer/index.cjs +10 -7
- package/dist/components/HeightResizer/index.cjs.map +1 -1
- package/dist/components/HeightResizer/index.d.ts +89 -0
- package/dist/components/HeightResizer/index.d.ts.map +1 -1
- package/dist/components/HeightResizer/index.mjs +10 -7
- package/dist/components/HeightResizer/index.mjs.map +1 -1
- package/dist/components/InformationTag/index.cjs.map +1 -1
- package/dist/components/InformationTag/index.d.ts +72 -0
- package/dist/components/InformationTag/index.d.ts.map +1 -1
- package/dist/components/InformationTag/index.mjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.cjs.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.d.ts +100 -0
- package/dist/components/KeyboardScreenAdapter/index.d.ts.map +1 -1
- package/dist/components/KeyboardScreenAdapter/index.mjs.map +1 -1
- package/dist/components/Label/index.cjs +25 -3
- package/dist/components/Label/index.cjs.map +1 -1
- package/dist/components/Label/index.d.ts +65 -1
- package/dist/components/Label/index.d.ts.map +1 -1
- package/dist/components/Label/index.mjs +26 -4
- package/dist/components/Label/index.mjs.map +1 -1
- package/dist/components/Link/Link.cjs +0 -4
- package/dist/components/Link/Link.cjs.map +1 -1
- package/dist/components/Link/Link.d.ts +169 -0
- package/dist/components/Link/Link.d.ts.map +1 -1
- package/dist/components/Link/Link.mjs +0 -4
- package/dist/components/Link/Link.mjs.map +1 -1
- package/dist/components/Loader/index.cjs.map +1 -1
- package/dist/components/Loader/index.d.ts +82 -11
- package/dist/components/Loader/index.d.ts.map +1 -1
- package/dist/components/Loader/index.mjs.map +1 -1
- package/dist/components/Loader/spinner.cjs.map +1 -1
- package/dist/components/Loader/spinner.d.ts +56 -0
- package/dist/components/Loader/spinner.d.ts.map +1 -1
- package/dist/components/Loader/spinner.mjs.map +1 -1
- package/dist/components/MarkDownRender/MarkDownRender.cjs +0 -1
- package/dist/components/MarkDownRender/MarkDownRender.cjs.map +1 -1
- package/dist/components/MarkDownRender/MarkDownRender.d.ts +147 -0
- package/dist/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
- package/dist/components/MarkDownRender/MarkDownRender.mjs +0 -1
- package/dist/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
- package/dist/components/MarkDownRender/processor.cjs +12 -9
- package/dist/components/MarkDownRender/processor.cjs.map +1 -1
- package/dist/components/MarkDownRender/processor.d.ts.map +1 -1
- package/dist/components/MarkDownRender/processor.mjs +12 -9
- package/dist/components/MarkDownRender/processor.mjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.d.ts +152 -0
- package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
- package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +5 -0
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts +81 -3
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.mjs +5 -0
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/Burger.cjs.map +1 -1
- package/dist/components/Navbar/Burger.d.ts +54 -0
- package/dist/components/Navbar/Burger.d.ts.map +1 -1
- package/dist/components/Navbar/Burger.mjs.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.d.ts +78 -0
- package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
- package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.d.ts +88 -0
- package/dist/components/Navbar/MobileNavbar.d.ts.map +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/components/Navbar/index.cjs.map +1 -1
- package/dist/components/Navbar/index.d.ts +69 -0
- package/dist/components/Navbar/index.d.ts.map +1 -1
- package/dist/components/Navbar/index.mjs.map +1 -1
- package/dist/components/Navbar/useNavigation.cjs +8 -1
- package/dist/components/Navbar/useNavigation.cjs.map +1 -1
- package/dist/components/Navbar/useNavigation.d.ts +83 -0
- package/dist/components/Navbar/useNavigation.d.ts.map +1 -1
- package/dist/components/Navbar/useNavigation.mjs +8 -1
- package/dist/components/Navbar/useNavigation.mjs.map +1 -1
- package/dist/components/Pattern/DotPattern.cjs.map +1 -1
- package/dist/components/Pattern/DotPattern.d.ts +101 -0
- package/dist/components/Pattern/DotPattern.d.ts.map +1 -1
- package/dist/components/Pattern/DotPattern.mjs.map +1 -1
- package/dist/components/Pattern/GridPattern.cjs.map +1 -1
- package/dist/components/Pattern/GridPattern.d.ts +114 -0
- package/dist/components/Pattern/GridPattern.d.ts.map +1 -1
- package/dist/components/Pattern/GridPattern.mjs.map +1 -1
- package/dist/components/Pattern/SpotLight.cjs.map +1 -1
- package/dist/components/Pattern/SpotLight.d.ts +125 -0
- package/dist/components/Pattern/SpotLight.d.ts.map +1 -1
- package/dist/components/Pattern/SpotLight.mjs.map +1 -1
- package/dist/components/Popover/index.cjs +10 -10
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.ts +110 -15
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.mjs +10 -10
- package/dist/components/Popover/index.mjs.map +1 -1
- package/dist/components/PressableSpan/PressableSpan.cjs +22 -5
- package/dist/components/PressableSpan/PressableSpan.cjs.map +1 -1
- package/dist/components/PressableSpan/PressableSpan.d.ts +105 -3
- package/dist/components/PressableSpan/PressableSpan.d.ts.map +1 -1
- package/dist/components/PressableSpan/PressableSpan.mjs +22 -5
- package/dist/components/PressableSpan/PressableSpan.mjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.d.ts +182 -0
- package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.cjs.map +1 -1
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts +44 -0
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.d.ts.map +1 -1
- package/dist/components/RightDrawer/isElementAtTopAndNotCovered.mjs.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.d.ts +102 -0
- package/dist/components/RightDrawer/useRightDrawerStore.d.ts.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
- package/dist/components/Select/Multiselect.cjs.map +1 -1
- package/dist/components/Select/Multiselect.d.ts +125 -18
- package/dist/components/Select/Multiselect.d.ts.map +1 -1
- package/dist/components/Select/Multiselect.mjs.map +1 -1
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.d.ts +214 -7
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs.map +1 -1
- package/dist/components/SwitchSelector/index.d.ts +157 -8
- package/dist/components/SwitchSelector/index.d.ts.map +1 -1
- package/dist/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.d.ts +184 -0
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.mjs.map +1 -1
- package/dist/components/Tag/index.cjs.map +1 -1
- package/dist/components/Tag/index.d.ts +223 -0
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.mjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.d.ts +91 -0
- package/dist/components/TextArea/AutoSizeTextArea.d.ts.map +1 -1
- package/dist/components/TextArea/AutoSizeTextArea.mjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.d.ts +145 -0
- package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/components/TextArea/TextArea.d.ts +74 -0
- package/dist/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/Toaster/Toast.cjs +4 -0
- package/dist/components/Toaster/Toast.cjs.map +1 -1
- package/dist/components/Toaster/Toast.d.ts +148 -2
- package/dist/components/Toaster/Toast.d.ts.map +1 -1
- package/dist/components/Toaster/Toast.mjs +4 -0
- package/dist/components/Toaster/Toast.mjs.map +1 -1
- package/dist/components/Toaster/Toaster.cjs.map +1 -1
- package/dist/components/Toaster/Toaster.d.ts +42 -0
- package/dist/components/Toaster/Toaster.d.ts.map +1 -1
- package/dist/components/Toaster/Toaster.mjs.map +1 -1
- package/dist/components/Toaster/useToast.cjs.map +1 -1
- package/dist/components/Toaster/useToast.d.ts +199 -2
- package/dist/components/Toaster/useToast.d.ts.map +1 -1
- package/dist/components/Toaster/useToast.mjs.map +1 -1
- package/dist/components/WithResizer/index.cjs.map +1 -1
- package/dist/components/WithResizer/index.d.ts +143 -0
- package/dist/components/WithResizer/index.d.ts.map +1 -1
- package/dist/components/WithResizer/index.mjs.map +1 -1
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +4 -4
- package/dist/components/index.mjs.map +1 -1
- package/dist/hooks/auth.cjs +2 -2
- package/dist/hooks/auth.cjs.map +1 -1
- package/dist/hooks/auth.mjs +2 -2
- package/dist/hooks/auth.mjs.map +1 -1
- package/dist/hooks/reactQuery.cjs +2 -1
- package/dist/hooks/reactQuery.cjs.map +1 -1
- package/dist/hooks/reactQuery.d.ts +1 -1
- package/dist/hooks/reactQuery.d.ts.map +1 -1
- package/dist/hooks/reactQuery.mjs +2 -1
- package/dist/hooks/reactQuery.mjs.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.cjs +3 -3
- package/dist/hooks/useAuth/useOAuth2.cjs.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.mjs +3 -3
- package/dist/hooks/useAuth/useOAuth2.mjs.map +1 -1
- package/dist/hooks/useAuth/useSession.cjs +3 -3
- package/dist/hooks/useAuth/useSession.cjs.map +1 -1
- package/dist/hooks/useAuth/useSession.mjs +3 -3
- package/dist/hooks/useAuth/useSession.mjs.map +1 -1
- package/dist/utils/image.cjs +30 -0
- package/dist/utils/image.cjs.map +1 -0
- package/dist/utils/image.d.ts +37 -0
- package/dist/utils/image.d.ts.map +1 -0
- package/dist/utils/image.mjs +30 -0
- package/dist/utils/image.mjs.map +1 -0
- package/package.json +20 -18
- package/dist/utils/capitalize.cjs +0 -10
- package/dist/utils/capitalize.cjs.map +0 -1
- package/dist/utils/capitalize.d.ts +0 -2
- package/dist/utils/capitalize.d.ts.map +0 -1
- package/dist/utils/capitalize.mjs +0 -10
- package/dist/utils/capitalize.mjs.map +0 -1
|
@@ -1,11 +1,89 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { TabProps } from '../TabSelector';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the DesktopNavbar component
|
|
5
|
+
* @template T - The tab props type extending TabProps
|
|
6
|
+
*/
|
|
3
7
|
type DesktopNavbarProps<T extends TabProps> = {
|
|
8
|
+
/** Logo component or element displayed on the left side */
|
|
4
9
|
logo: ReactNode;
|
|
10
|
+
/** Array of navigation sections as tab elements */
|
|
5
11
|
sections: ReactElement<T>[];
|
|
12
|
+
/** Right-aligned items (e.g., user menu, search, settings) */
|
|
6
13
|
rightItems?: ReactNode;
|
|
14
|
+
/** Currently selected tab key for highlighting active state */
|
|
7
15
|
selectedChoice: T['key'];
|
|
8
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Desktop Navigation Bar Component
|
|
19
|
+
*
|
|
20
|
+
* A horizontal navigation bar optimized for desktop and tablet viewports.
|
|
21
|
+
* Features a sticky header with backdrop blur, left-aligned logo, center navigation tabs,
|
|
22
|
+
* and right-aligned utility items.
|
|
23
|
+
*
|
|
24
|
+
* Features:
|
|
25
|
+
* - Sticky positioning with z-index layering (z-50)
|
|
26
|
+
* - Semi-transparent backdrop with blur effect for modern glass-morphism design
|
|
27
|
+
* - Responsive spacing that adapts across screen sizes
|
|
28
|
+
* - Horizontal scrollable tabs for overflow content
|
|
29
|
+
* - Left-to-right layout: Logo → Navigation → Utility Items
|
|
30
|
+
* - Integrated with TabSelector for consistent tab behavior
|
|
31
|
+
*
|
|
32
|
+
* Layout Structure:
|
|
33
|
+
* ```
|
|
34
|
+
* [Logo] -------- [Nav Tab 1] [Nav Tab 2] [Nav Tab 3] -------- [Right Items]
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* Responsive Behavior:
|
|
38
|
+
* - Base: 2vw margin-left, 3-unit gap between tabs
|
|
39
|
+
* - Large (≥1024px): 5vw margin-left, 3-unit gap between tabs
|
|
40
|
+
* - Extra Large (≥1280px): 10vw margin-left, 6-unit gap between tabs
|
|
41
|
+
* - Right items: 2-unit gap on mobile, 4-unit gap on medium screens
|
|
42
|
+
*
|
|
43
|
+
* Styling Features:
|
|
44
|
+
* - Semi-transparent card background (`bg-card/80`)
|
|
45
|
+
* - Subtle shadow with controlled blur (`shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)]`)
|
|
46
|
+
* - Backdrop blur effect for content behind navbar
|
|
47
|
+
* - Horizontal overflow scrolling for tab content
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* Basic usage:
|
|
51
|
+
* ```tsx
|
|
52
|
+
* const navigationTabs = [
|
|
53
|
+
* { key: 'home', label: 'Home', href: '/' },
|
|
54
|
+
* { key: 'products', label: 'Products', href: '/products' },
|
|
55
|
+
* { key: 'about', label: 'About', href: '/about' }
|
|
56
|
+
* ];
|
|
57
|
+
*
|
|
58
|
+
* <DesktopNavbar
|
|
59
|
+
* logo={<CompanyLogo />}
|
|
60
|
+
* sections={navigationTabs}
|
|
61
|
+
* selectedChoice="home"
|
|
62
|
+
* rightItems={<UserProfileMenu />}
|
|
63
|
+
* />
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* With multiple right items:
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <DesktopNavbar
|
|
70
|
+
* logo={<Logo />}
|
|
71
|
+
* sections={navSections}
|
|
72
|
+
* selectedChoice={currentPage}
|
|
73
|
+
* rightItems={
|
|
74
|
+
* <>
|
|
75
|
+
* <SearchButton />
|
|
76
|
+
* <NotificationBell />
|
|
77
|
+
* <UserMenu />
|
|
78
|
+
* </>
|
|
79
|
+
* }
|
|
80
|
+
* />
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @template T - Tab properties type extending TabProps for type safety
|
|
84
|
+
* @param props - DesktopNavbar component props
|
|
85
|
+
* @returns Horizontal desktop navigation JSX element
|
|
86
|
+
*/
|
|
9
87
|
export declare const DesktopNavbar: <T extends TabProps>({ logo, sections, rightItems, selectedChoice, }: DesktopNavbarProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
88
|
export {};
|
|
11
89
|
//# sourceMappingURL=DesktopNavbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesktopNavbar.d.ts","sourceRoot":"","sources":["../../../src/components/Navbar/DesktopNavbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,KAAK,QAAQ,EAAiC,MAAM,gBAAgB,CAAC;AAE9E,KAAK,kBAAkB,CAAC,CAAC,SAAS,QAAQ,IAAI;IAC5C,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,QAAQ,EAAE,iDAK/C,kBAAkB,CAAC,CAAC,CAAC,4CAgBvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"DesktopNavbar.d.ts","sourceRoot":"","sources":["../../../src/components/Navbar/DesktopNavbar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,KAAK,QAAQ,EAAiC,MAAM,gBAAgB,CAAC;AAE9E;;;GAGG;AACH,KAAK,kBAAkB,CAAC,CAAC,SAAS,QAAQ,IAAI;IAC5C,2DAA2D;IAC3D,IAAI,EAAE,SAAS,CAAC;IAChB,mDAAmD;IACnD,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,8DAA8D;IAC9D,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,+DAA+D;IAC/D,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,QAAQ,EAAE,iDAK/C,kBAAkB,CAAC,CAAC,CAAC,4CAgBvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesktopNavbar.mjs","sources":["../../../src/components/Navbar/DesktopNavbar.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { type TabProps, TabSelector, TabSelectorColor } from '../TabSelector';\n\ntype DesktopNavbarProps<T extends TabProps> = {\n logo: ReactNode;\n sections: ReactElement<T>[];\n rightItems?: ReactNode;\n selectedChoice: T['key'];\n};\n\nexport const DesktopNavbar = <T extends TabProps>({\n logo,\n sections,\n rightItems,\n selectedChoice,\n}: DesktopNavbarProps<T>) => (\n <nav className=\"bg-card/80 sticky top-0 z-50 flex w-full items-center px-4 py-3 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur\">\n {logo}\n\n <TabSelector\n selectedChoice={selectedChoice}\n className=\"text-neutral ml-[2vw] gap-3 overflow-x-auto tracking-wide lg:ml-[5vw] lg:gap-3 xl:ml-[10vw] xl:gap-6\"\n tabs={sections}\n hoverable\n color={TabSelectorColor.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"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"DesktopNavbar.mjs","sources":["../../../src/components/Navbar/DesktopNavbar.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { type TabProps, TabSelector, TabSelectorColor } from '../TabSelector';\n\n/**\n * Props for the DesktopNavbar component\n * @template T - The tab props type extending TabProps\n */\ntype DesktopNavbarProps<T extends TabProps> = {\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 TabProps>({\n logo,\n sections,\n rightItems,\n selectedChoice,\n}: DesktopNavbarProps<T>) => (\n <nav className=\"bg-card/80 sticky top-0 z-50 flex w-full items-center px-4 py-3 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur\">\n {logo}\n\n <TabSelector\n selectedChoice={selectedChoice}\n className=\"text-neutral ml-[2vw] gap-3 overflow-x-auto tracking-wide lg:ml-[5vw] lg:gap-3 xl:ml-[10vw] xl:gap-6\"\n tabs={sections}\n hoverable\n color={TabSelectorColor.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"],"names":[],"mappings":";;;AA2FO,MAAM,gBAAgB,CAAqB;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MACE,qBAAC,OAAA,EAAI,WAAU,yHACZ,UAAA;AAAA,EAAA;AAAA,EAED;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAU;AAAA,MACV,MAAM;AAAA,MACN,WAAS;AAAA,MACT,OAAO,iBAAiB;AAAA,IAAA;AAAA,EAAA;AAAA,EAG1B,oBAAC,OAAA,EAAI,WAAU,qDACZ,UAAA,WAAA,CACH;AAAA,EAAA,CACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNavbar.cjs","sources":["../../../src/components/Navbar/MobileNavbar.tsx"],"sourcesContent":["'use client';\n\nimport { m, type Variants } from 'framer-motion';\nimport { useRef, useState, type ReactElement, type ReactNode } from 'react';\nimport { useScrollBlockage, useScrollDetection } from '../../hooks';\nimport { cn } from '../../utils/cn';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\nimport type { TabProps } from '../TabSelector';\nimport { Burger } from './Burger';\n\ntype MobileNavbarProps<T extends TabProps> = {\n logo: ReactNode;\n topChildren?: ReactNode;\n topSections?: ReactElement<T>[];\n bottomChildren?: ReactNode;\n bottomSections?: ReactElement<T>[];\n rightItems?: ReactNode;\n};\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\nconst bgStyle =\n 'bg-card/95 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur';\n\nexport const MobileNavbar = <T extends TabProps>({\n logo,\n topChildren,\n topSections = [],\n bottomChildren,\n bottomSections = [],\n rightItems,\n}: MobileNavbarProps<T>) => {\n const [isHidden, setIsHidden] = useState<boolean>(false);\n const [isUnrolled, setIsUnrolled] = useState<boolean>(false);\n\n const navRef = useRef<HTMLDivElement>(null);\n\n useScrollBlockage({\n disableScroll: isUnrolled,\n key: 'mobile_nav',\n });\n\n useScrollDetection({\n onScrollUp: () => setIsHidden(false),\n onScrollDown: () => setIsHidden(true),\n isEnabled: !isUnrolled,\n });\n\n const backDivHeight = !isHidden ? (navRef.current?.clientHeight ?? 0) : 0;\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=\"text-text flex w-full flex-col pb-[20%] pt-10 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-[400px] 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"],"names":["useState","useRef","useScrollBlockage","useScrollDetection","jsxs","cn","jsx","Burger","isUnrolled","MaxHeightSmoother","m"],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"MobileNavbar.cjs","sources":["../../../src/components/Navbar/MobileNavbar.tsx"],"sourcesContent":["'use client';\n\nimport { m, type Variants } from 'framer-motion';\nimport { useRef, useState, type ReactElement, type ReactNode } from 'react';\nimport { useScrollBlockage, useScrollDetection } from '../../hooks';\nimport { cn } from '../../utils/cn';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\nimport type { TabProps } 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 TabProps> = {\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};\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 collapsible full-screen menu,\n * scroll-aware behavior, and smooth animations. Optimized for touch interactions and\n * mobile user experience patterns.\n *\n * Features:\n * - Collapsible 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 collapsible full-screen menu\n */\nexport const MobileNavbar = <T extends TabProps>({\n logo,\n topChildren,\n topSections = [],\n bottomChildren,\n bottomSections = [],\n rightItems,\n}: MobileNavbarProps<T>) => {\n const [isHidden, setIsHidden] = useState<boolean>(false);\n const [isUnrolled, setIsUnrolled] = useState<boolean>(false);\n\n const navRef = useRef<HTMLDivElement>(null);\n\n useScrollBlockage({\n disableScroll: isUnrolled,\n key: 'mobile_nav',\n });\n\n useScrollDetection({\n onScrollUp: () => setIsHidden(false),\n onScrollDown: () => setIsHidden(true),\n isEnabled: !isUnrolled,\n });\n\n const backDivHeight = !isHidden ? (navRef.current?.clientHeight ?? 0) : 0;\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=\"text-text flex w-full flex-col pb-[20%] pt-10 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-[400px] 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"],"names":["useState","useRef","useScrollBlockage","useScrollDetection","jsxs","cn","jsx","Burger","isUnrolled","MaxHeightSmoother","m"],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAM,cAAwB;AAAA,EAC5B,MAAM;AAAA,IACJ,YAAY,EAAE,iBAAiB,MAAM,eAAe,IAAA;AAAA,EAAI;AAAA,EAE1D,QAAQ;AAAA,IACN,YAAY,EAAE,iBAAiB,MAAM,kBAAkB,GAAA;AAAA,EAAG;AAE9D;AAMA,MAAM,UACJ;AAgFK,MAAM,eAAe,CAAqB;AAAA,EAC/C;AAAA,EACA;AAAA,EACA,cAAc,CAAA;AAAA,EACd;AAAA,EACA,iBAAiB,CAAA;AAAA,EACjB;AACF,MAA4B;AAC1B,QAAM,CAAC,UAAU,WAAW,IAAIA,aAAAA,SAAkB,KAAK;AACvD,QAAM,CAAC,YAAY,aAAa,IAAIA,aAAAA,SAAkB,KAAK;AAE3D,QAAM,SAASC,aAAAA,OAAuB,IAAI;AAE1CC,kDAAkB;AAAA,IAChB,eAAe;AAAA,IACf,KAAK;AAAA,EAAA,CACN;AAEDC,8CAAmB;AAAA,IACjB,YAAY,MAAM,YAAY,KAAK;AAAA,IACnC,cAAc,MAAM,YAAY,IAAI;AAAA,IACpC,WAAW,CAAC;AAAA,EAAA,CACb;AAED,QAAM,gBAAgB,CAAC,WAAY,OAAO,SAAS,gBAAgB,IAAK;AAExE,QAAM,iBAAiB,YAAY,SAAS,eAAe,SAAS;AAEpE,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAAA;AAAAA,QACT;AAAA,QACA;AAAA,QACA,WAAW,sBAAsB;AAAA,MAAA;AAAA,MAEnC,IAAG;AAAA,MAEH,UAAA;AAAA,QAAAD,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,KAAK;AAAA,YAEJ,UAAA;AAAA,cAAA;AAAA,cAEDA,2BAAAA,KAAC,OAAA,EAAI,WAAU,qDACb,UAAA;AAAA,gBAAAE,2BAAAA,IAAC,OAAA,EAAI,WAAU,8CACZ,UAAA,YACH;AAAA,gBAEC,kBACCA,2BAAAA;AAAAA,kBAACC,yBAAAA;AAAAA,kBAAA;AAAA,oBACC,UAAU;AAAA,oBACV,SAAS,MAAM,cAAc,CAACC,gBAAe,CAACA,WAAU;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAC1D,EAAA,CAEJ;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGFF,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD,SAAAA;AAAAA,cACT;AAAA,cACA;AAAA,YAAA;AAAA,YAGF,UAAAC,2BAAAA,IAACG,sDAAA,EAAkB,UAAU,CAAC,YAC5B,UAAAL,2BAAAA;AAAAA,cAACM,aAAAA,EAAE;AAAA,cAAF;AAAA,gBACC,WAAU;AAAA,gBACV,SAAS,MAAM,cAAc,KAAK;AAAA,gBAClC,SAAS,aAAa,SAAS;AAAA,gBAC/B,UAAU;AAAA,gBACV,OAAO;AAAA,kBACL,QAAQ,gBAAgB,aAAa;AAAA,gBAAA;AAAA,gBAGtC,UAAA;AAAA,kBAAA;AAAA,kBACDN,2BAAAA,KAAC,OAAA,EAAI,WAAU,uCACZ,UAAA;AAAA,oBAAA;AAAA,oBACA;AAAA,kBAAA,GACH;AAAA,kBAEAE,2BAAAA,IAAC,OAAA,EAAI,WAAU,gFACZ,UAAA,eAAA,CACH;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA,EACF,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
|
|
@@ -1,13 +1,101 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { TabProps } from '../TabSelector';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the MobileNavbar component
|
|
5
|
+
* @template T - The tab props type extending TabProps
|
|
6
|
+
*/
|
|
3
7
|
type MobileNavbarProps<T extends TabProps> = {
|
|
8
|
+
/** Logo component or element displayed in the header */
|
|
4
9
|
logo: ReactNode;
|
|
10
|
+
/** Additional content displayed at the top of expanded mobile menu */
|
|
5
11
|
topChildren?: ReactNode;
|
|
12
|
+
/** Navigation sections displayed in the top area of expanded menu */
|
|
6
13
|
topSections?: ReactElement<T>[];
|
|
14
|
+
/** Additional content displayed at the bottom of expanded mobile menu */
|
|
7
15
|
bottomChildren?: ReactNode;
|
|
16
|
+
/** Navigation sections displayed in the bottom area of expanded menu */
|
|
8
17
|
bottomSections?: ReactElement<T>[];
|
|
18
|
+
/** Right-aligned items in the collapsed header (e.g., search, notifications) */
|
|
9
19
|
rightItems?: ReactNode;
|
|
10
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Mobile Navigation Bar Component
|
|
23
|
+
*
|
|
24
|
+
* A sophisticated mobile-first navigation component with collapsible full-screen menu,
|
|
25
|
+
* scroll-aware behavior, and smooth animations. Optimized for touch interactions and
|
|
26
|
+
* mobile user experience patterns.
|
|
27
|
+
*
|
|
28
|
+
* Features:
|
|
29
|
+
* - Collapsible hamburger menu with full-screen overlay
|
|
30
|
+
* - Auto-hide on scroll down, show on scroll up for screen space optimization
|
|
31
|
+
* - Background scroll prevention when menu is open
|
|
32
|
+
* - Staggered animations for smooth menu item reveals
|
|
33
|
+
* - Flexible content areas (top/bottom children and sections)
|
|
34
|
+
* - Responsive layout with viewport-aware sizing
|
|
35
|
+
* - Backdrop blur effects for modern glass-morphism design
|
|
36
|
+
*
|
|
37
|
+
* Layout Structure:
|
|
38
|
+
* ```
|
|
39
|
+
* [Logo] ----------- [Right Items] [Burger]
|
|
40
|
+
* (when expanded)
|
|
41
|
+
* ┌─────────────────────────────────────────┐
|
|
42
|
+
* │ [Top Children] │
|
|
43
|
+
* │ [Top Sections - Navigation Items] │
|
|
44
|
+
* │ [Bottom Sections - Navigation Items] │
|
|
45
|
+
* │ [Bottom Children] │
|
|
46
|
+
* └─────────────────────────────────────────┘
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Behavioral Features:
|
|
50
|
+
* - Sticky positioning with dynamic hide/show based on scroll direction
|
|
51
|
+
* - Background scroll locking when menu is expanded
|
|
52
|
+
* - Click outside to close expanded menu
|
|
53
|
+
* - Smooth height animations with MaxHeightSmoother
|
|
54
|
+
* - Intelligent burger button visibility (only shown if sections exist)
|
|
55
|
+
*
|
|
56
|
+
* Animation Details:
|
|
57
|
+
* - Menu items animate in with staggered timing (70ms delay between items)
|
|
58
|
+
* - Exit animations are reversed with 50ms stagger
|
|
59
|
+
* - Initial delay of 200ms before items start animating in
|
|
60
|
+
* - Full viewport height menu with dynamic height calculation
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* Basic mobile navbar:
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <MobileNavbar
|
|
66
|
+
* logo={<MobileLogo />}
|
|
67
|
+
* topSections={primaryNavItems}
|
|
68
|
+
* rightItems={<SearchIcon />}
|
|
69
|
+
* />
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* Full-featured mobile navbar:
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <MobileNavbar
|
|
76
|
+
* logo={<Logo />}
|
|
77
|
+
* topChildren={<WelcomeMessage />}
|
|
78
|
+
* topSections={mainNavItems}
|
|
79
|
+
* bottomSections={utilityNavItems}
|
|
80
|
+
* bottomChildren={<UserProfile />}
|
|
81
|
+
* rightItems={
|
|
82
|
+
* <>
|
|
83
|
+
* <NotificationIcon />
|
|
84
|
+
* <SearchIcon />
|
|
85
|
+
* </>
|
|
86
|
+
* }
|
|
87
|
+
* />
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* Accessibility Features:
|
|
91
|
+
* - Menu expanded state communicated via aria-expanded
|
|
92
|
+
* - Focus management and keyboard navigation support
|
|
93
|
+
* - Screen reader friendly with semantic nav structure
|
|
94
|
+
*
|
|
95
|
+
* @template T - Tab properties type extending TabProps for type safety
|
|
96
|
+
* @param props - MobileNavbar component props
|
|
97
|
+
* @returns Mobile navigation with collapsible full-screen menu
|
|
98
|
+
*/
|
|
11
99
|
export declare const MobileNavbar: <T extends TabProps>({ logo, topChildren, topSections, bottomChildren, bottomSections, rightItems, }: MobileNavbarProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
12
100
|
export {};
|
|
13
101
|
//# sourceMappingURL=MobileNavbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNavbar.d.ts","sourceRoot":"","sources":["../../../src/components/Navbar/MobileNavbar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,KAAK,iBAAiB,CAAC,CAAC,SAAS,QAAQ,IAAI;IAC3C,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,cAAc,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"MobileNavbar.d.ts","sourceRoot":"","sources":["../../../src/components/Navbar/MobileNavbar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;GAGG;AACH,KAAK,iBAAiB,CAAC,CAAC,SAAS,QAAQ,IAAI;IAC3C,wDAAwD;IACxD,IAAI,EAAE,SAAS,CAAC;IAChB,sEAAsE;IACtE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,qEAAqE;IACrE,WAAW,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAChC,yEAAyE;IACzE,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,wEAAwE;IACxE,cAAc,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,gFAAgF;IAChF,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB,CAAC;AAsBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,QAAQ,EAAE,iFAO9C,iBAAiB,CAAC,CAAC,CAAC,4CAgFtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNavbar.mjs","sources":["../../../src/components/Navbar/MobileNavbar.tsx"],"sourcesContent":["'use client';\n\nimport { m, type Variants } from 'framer-motion';\nimport { useRef, useState, type ReactElement, type ReactNode } from 'react';\nimport { useScrollBlockage, useScrollDetection } from '../../hooks';\nimport { cn } from '../../utils/cn';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\nimport type { TabProps } from '../TabSelector';\nimport { Burger } from './Burger';\n\ntype MobileNavbarProps<T extends TabProps> = {\n logo: ReactNode;\n topChildren?: ReactNode;\n topSections?: ReactElement<T>[];\n bottomChildren?: ReactNode;\n bottomSections?: ReactElement<T>[];\n rightItems?: ReactNode;\n};\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\nconst bgStyle =\n 'bg-card/95 shadow-[0_0_10px_-15px_rgba(0,0,0,0.3)] backdrop-blur';\n\nexport const MobileNavbar = <T extends TabProps>({\n logo,\n topChildren,\n topSections = [],\n bottomChildren,\n bottomSections = [],\n rightItems,\n}: MobileNavbarProps<T>) => {\n const [isHidden, setIsHidden] = useState<boolean>(false);\n const [isUnrolled, setIsUnrolled] = useState<boolean>(false);\n\n const navRef = useRef<HTMLDivElement>(null);\n\n useScrollBlockage({\n disableScroll: isUnrolled,\n key: 'mobile_nav',\n });\n\n useScrollDetection({\n onScrollUp: () => setIsHidden(false),\n onScrollDown: () => setIsHidden(true),\n isEnabled: !isUnrolled,\n });\n\n const backDivHeight = !isHidden ? (navRef.current?.clientHeight ?? 0) : 0;\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=\"text-text flex w-full flex-col pb-[20%] pt-10 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-[400px] 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"],"names":["isUnrolled"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"MobileNavbar.mjs","sources":["../../../src/components/Navbar/MobileNavbar.tsx"],"sourcesContent":["'use client';\n\nimport { m, type Variants } from 'framer-motion';\nimport { useRef, useState, type ReactElement, type ReactNode } from 'react';\nimport { useScrollBlockage, useScrollDetection } from '../../hooks';\nimport { cn } from '../../utils/cn';\nimport { MaxHeightSmoother } from '../MaxHeightSmoother';\nimport type { TabProps } 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 TabProps> = {\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};\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 collapsible full-screen menu,\n * scroll-aware behavior, and smooth animations. Optimized for touch interactions and\n * mobile user experience patterns.\n *\n * Features:\n * - Collapsible 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 collapsible full-screen menu\n */\nexport const MobileNavbar = <T extends TabProps>({\n logo,\n topChildren,\n topSections = [],\n bottomChildren,\n bottomSections = [],\n rightItems,\n}: MobileNavbarProps<T>) => {\n const [isHidden, setIsHidden] = useState<boolean>(false);\n const [isUnrolled, setIsUnrolled] = useState<boolean>(false);\n\n const navRef = useRef<HTMLDivElement>(null);\n\n useScrollBlockage({\n disableScroll: isUnrolled,\n key: 'mobile_nav',\n });\n\n useScrollDetection({\n onScrollUp: () => setIsHidden(false),\n onScrollDown: () => setIsHidden(true),\n isEnabled: !isUnrolled,\n });\n\n const backDivHeight = !isHidden ? (navRef.current?.clientHeight ?? 0) : 0;\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=\"text-text flex w-full flex-col pb-[20%] pt-10 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-[400px] 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"],"names":["isUnrolled"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAM,cAAwB;AAAA,EAC5B,MAAM;AAAA,IACJ,YAAY,EAAE,iBAAiB,MAAM,eAAe,IAAA;AAAA,EAAI;AAAA,EAE1D,QAAQ;AAAA,IACN,YAAY,EAAE,iBAAiB,MAAM,kBAAkB,GAAA;AAAA,EAAG;AAE9D;AAMA,MAAM,UACJ;AAgFK,MAAM,eAAe,CAAqB;AAAA,EAC/C;AAAA,EACA;AAAA,EACA,cAAc,CAAA;AAAA,EACd;AAAA,EACA,iBAAiB,CAAA;AAAA,EACjB;AACF,MAA4B;AAC1B,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkB,KAAK;AACvD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAkB,KAAK;AAE3D,QAAM,SAAS,OAAuB,IAAI;AAE1C,oBAAkB;AAAA,IAChB,eAAe;AAAA,IACf,KAAK;AAAA,EAAA,CACN;AAED,qBAAmB;AAAA,IACjB,YAAY,MAAM,YAAY,KAAK;AAAA,IACnC,cAAc,MAAM,YAAY,IAAI;AAAA,IACpC,WAAW,CAAC;AAAA,EAAA,CACb;AAED,QAAM,gBAAgB,CAAC,WAAY,OAAO,SAAS,gBAAgB,IAAK;AAExE,QAAM,iBAAiB,YAAY,SAAS,eAAe,SAAS;AAEpE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,WAAW,sBAAsB;AAAA,MAAA;AAAA,MAEnC,IAAG;AAAA,MAEH,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,KAAK;AAAA,YAEJ,UAAA;AAAA,cAAA;AAAA,cAED,qBAAC,OAAA,EAAI,WAAU,qDACb,UAAA;AAAA,gBAAA,oBAAC,OAAA,EAAI,WAAU,8CACZ,UAAA,YACH;AAAA,gBAEC,kBACC;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,UAAU;AAAA,oBACV,SAAS,MAAM,cAAc,CAACA,gBAAe,CAACA,WAAU;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAC1D,EAAA,CAEJ;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGF;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA;AAAA,YAAA;AAAA,YAGF,UAAA,oBAAC,mBAAA,EAAkB,UAAU,CAAC,YAC5B,UAAA;AAAA,cAAC,EAAE;AAAA,cAAF;AAAA,gBACC,WAAU;AAAA,gBACV,SAAS,MAAM,cAAc,KAAK;AAAA,gBAClC,SAAS,aAAa,SAAS;AAAA,gBAC/B,UAAU;AAAA,gBACV,OAAO;AAAA,kBACL,QAAQ,gBAAgB,aAAa;AAAA,gBAAA;AAAA,gBAGtC,UAAA;AAAA,kBAAA;AAAA,kBACD,qBAAC,OAAA,EAAI,WAAU,uCACZ,UAAA;AAAA,oBAAA;AAAA,oBACA;AAAA,kBAAA,GACH;AAAA,kBAEA,oBAAC,OAAA,EAAI,WAAU,gFACZ,UAAA,eAAA,CACH;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA,EACF,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Navbar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { useDevice, useIsMounted } from '../../hooks';\nimport type { TabProps } from '../TabSelector';\nimport { DesktopNavbar } from './DesktopNavbar';\nimport { MobileNavbar } from './MobileNavbar';\n\ntype NavbarProps<T extends TabProps> = {\n logo: ReactNode;\n selectedChoice: T['key'];\n desktopSections?: ReactElement<T>[];\n mobileTopChildren?: ReactNode;\n mobileTopSections?: ReactElement<T>[];\n mobileBottomChildren?: ReactNode;\n mobileBottomSections?: ReactElement<T>[];\n rightItemsDesktop?: ReactNode;\n rightItemsMobile?: ReactNode;\n};\n\nexport const Navbar = <T extends TabProps>({\n logo,\n mobileTopChildren,\n desktopSections = [],\n mobileTopSections = [],\n mobileBottomChildren,\n mobileBottomSections = [],\n rightItemsDesktop,\n rightItemsMobile,\n selectedChoice,\n}: NavbarProps<T>) => {\n const { isMobile } = useDevice('lg');\n const isMoUnted = useIsMounted();\n\n if (!isMoUnted) return <></>;\n\n return isMobile ? (\n <MobileNavbar\n topChildren={mobileTopChildren}\n topSections={mobileTopSections}\n bottomChildren={mobileBottomChildren}\n bottomSections={mobileBottomSections}\n logo={logo}\n rightItems={rightItemsMobile}\n />\n ) : (\n <DesktopNavbar\n sections={desktopSections}\n rightItems={rightItemsDesktop}\n logo={logo}\n selectedChoice={selectedChoice}\n />\n );\n};\n"],"names":["useDevice","useIsMounted","jsx","Fragment","MobileNavbar","DesktopNavbar"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Navbar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { useDevice, useIsMounted } from '../../hooks';\nimport type { TabProps } 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 TabProps> = {\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};\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 * - Automatic detection with no flash of unstyled content\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 const Navbar = <T extends TabProps>({\n logo,\n mobileTopChildren,\n desktopSections = [],\n mobileTopSections = [],\n mobileBottomChildren,\n mobileBottomSections = [],\n rightItemsDesktop,\n rightItemsMobile,\n selectedChoice,\n}: NavbarProps<T>) => {\n const { isMobile } = useDevice('lg');\n const isMoUnted = useIsMounted();\n\n if (!isMoUnted) return <></>;\n\n return isMobile ? (\n <MobileNavbar\n topChildren={mobileTopChildren}\n topSections={mobileTopSections}\n bottomChildren={mobileBottomChildren}\n bottomSections={mobileBottomSections}\n logo={logo}\n rightItems={rightItemsMobile}\n />\n ) : (\n <DesktopNavbar\n sections={desktopSections}\n rightItems={rightItemsDesktop}\n logo={logo}\n selectedChoice={selectedChoice}\n />\n );\n};\n"],"names":["useDevice","useIsMounted","jsx","Fragment","MobileNavbar","DesktopNavbar"],"mappings":";;;;;;;;;;;;;;;AAyFO,MAAM,SAAS,CAAqB;AAAA,EACzC;AAAA,EACA;AAAA,EACA,kBAAkB,CAAA;AAAA,EAClB,oBAAoB,CAAA;AAAA,EACpB;AAAA,EACA,uBAAuB,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACpB,QAAM,EAAE,SAAA,IAAaA,gBAAAA,UAAU,IAAI;AACnC,QAAM,YAAYC,mBAAAA,aAAA;AAElB,MAAI,CAAC,UAAW,QAAOC,+BAAAC,WAAAA,UAAA,CAAA,CAAE;AAEzB,SAAO,WACLD,2BAAAA;AAAAA,IAACE,+BAAAA;AAAAA,IAAA;AAAA,MACC,aAAa;AAAA,MACb,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB;AAAA,MACA,YAAY;AAAA,IAAA;AAAA,EAAA,IAGdF,2BAAAA;AAAAA,IAACG,gCAAAA;AAAAA,IAAA;AAAA,MACC,UAAU;AAAA,MACV,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
|
|
@@ -1,16 +1,85 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { TabProps } from '../TabSelector';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the responsive Navbar component
|
|
5
|
+
* @template T - The tab props type extending TabProps
|
|
6
|
+
*/
|
|
3
7
|
type NavbarProps<T extends TabProps> = {
|
|
8
|
+
/** Logo component or element to display in navbar */
|
|
4
9
|
logo: ReactNode;
|
|
10
|
+
/** Currently selected tab key for active state management */
|
|
5
11
|
selectedChoice: T['key'];
|
|
12
|
+
/** Navigation sections displayed on desktop layout */
|
|
6
13
|
desktopSections?: ReactElement<T>[];
|
|
14
|
+
/** Additional content displayed at top of mobile navbar */
|
|
7
15
|
mobileTopChildren?: ReactNode;
|
|
16
|
+
/** Navigation sections displayed at top of mobile navbar */
|
|
8
17
|
mobileTopSections?: ReactElement<T>[];
|
|
18
|
+
/** Additional content displayed at bottom of mobile navbar */
|
|
9
19
|
mobileBottomChildren?: ReactNode;
|
|
20
|
+
/** Navigation sections displayed at bottom of mobile navbar */
|
|
10
21
|
mobileBottomSections?: ReactElement<T>[];
|
|
22
|
+
/** Right-aligned items for desktop navbar (e.g., user menu, settings) */
|
|
11
23
|
rightItemsDesktop?: ReactNode;
|
|
24
|
+
/** Right-aligned items for mobile navbar */
|
|
12
25
|
rightItemsMobile?: ReactNode;
|
|
13
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Responsive Navbar Component
|
|
29
|
+
*
|
|
30
|
+
* A highly adaptable navigation component that automatically switches between desktop and mobile
|
|
31
|
+
* layouts based on screen size. Provides comprehensive navigation structure with flexible content areas.
|
|
32
|
+
*
|
|
33
|
+
* Features:
|
|
34
|
+
* - Automatic responsive switching at 'lg' breakpoint (1024px)
|
|
35
|
+
* - Separate section configurations for desktop and mobile layouts
|
|
36
|
+
* - Support for logo placement and right-aligned utility items
|
|
37
|
+
* - Generic typing for tab properties and selected states
|
|
38
|
+
* - Mobile-specific top/bottom content areas for enhanced mobile UX
|
|
39
|
+
* - Hydration-safe rendering with useIsMounted hook
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* Basic usage:
|
|
43
|
+
* ```tsx
|
|
44
|
+
* const navSections = [
|
|
45
|
+
* { key: 'home', label: 'Home', href: '/' },
|
|
46
|
+
* { key: 'about', label: 'About', href: '/about' }
|
|
47
|
+
* ];
|
|
48
|
+
*
|
|
49
|
+
* <Navbar
|
|
50
|
+
* logo={<Logo />}
|
|
51
|
+
* selectedChoice="home"
|
|
52
|
+
* desktopSections={navSections}
|
|
53
|
+
* mobileTopSections={navSections}
|
|
54
|
+
* rightItemsDesktop={<UserMenu />}
|
|
55
|
+
* />
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* Advanced mobile configuration:
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <Navbar
|
|
62
|
+
* logo={<Logo />}
|
|
63
|
+
* selectedChoice={activeTab}
|
|
64
|
+
* desktopSections={mainNavItems}
|
|
65
|
+
* mobileTopSections={primaryMobileNavItems}
|
|
66
|
+
* mobileTopChildren={<SearchBar />}
|
|
67
|
+
* mobileBottomSections={secondaryMobileNavItems}
|
|
68
|
+
* mobileBottomChildren={<UserProfile />}
|
|
69
|
+
* rightItemsDesktop={<DesktopActions />}
|
|
70
|
+
* rightItemsMobile={<MobileActions />}
|
|
71
|
+
* />
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* Responsive Behavior:
|
|
75
|
+
* - Desktop (≥1024px): Shows DesktopNavbar with horizontal layout
|
|
76
|
+
* - Mobile (<1024px): Shows MobileNavbar with collapsible vertical layout
|
|
77
|
+
* - Automatic detection with no flash of unstyled content
|
|
78
|
+
*
|
|
79
|
+
* @template T - Tab properties type extending TabProps for type safety
|
|
80
|
+
* @param props - Navbar component props
|
|
81
|
+
* @returns Responsive navbar JSX element
|
|
82
|
+
*/
|
|
14
83
|
export declare const Navbar: <T extends TabProps>({ logo, mobileTopChildren, desktopSections, mobileTopSections, mobileBottomChildren, mobileBottomSections, rightItemsDesktop, rightItemsMobile, selectedChoice, }: NavbarProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
15
84
|
export {};
|
|
16
85
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Navbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C,KAAK,WAAW,CAAC,CAAC,SAAS,QAAQ,IAAI;IACrC,IAAI,EAAE,SAAS,CAAC;IAChB,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IACzB,eAAe,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,iBAAiB,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,oBAAoB,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,QAAQ,EAAE,mKAUxC,WAAW,CAAC,CAAC,CAAC,4CAuBhB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Navbar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI/C;;;GAGG;AACH,KAAK,WAAW,CAAC,CAAC,SAAS,QAAQ,IAAI;IACrC,qDAAqD;IACrD,IAAI,EAAE,SAAS,CAAC;IAChB,6DAA6D;IAC7D,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IACzB,sDAAsD;IACtD,eAAe,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,8DAA8D;IAC9D,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,+DAA+D;IAC/D,oBAAoB,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,QAAQ,EAAE,mKAUxC,WAAW,CAAC,CAAC,CAAC,4CAuBhB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/Navbar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { useDevice, useIsMounted } from '../../hooks';\nimport type { TabProps } from '../TabSelector';\nimport { DesktopNavbar } from './DesktopNavbar';\nimport { MobileNavbar } from './MobileNavbar';\n\ntype NavbarProps<T extends TabProps> = {\n logo: ReactNode;\n selectedChoice: T['key'];\n desktopSections?: ReactElement<T>[];\n mobileTopChildren?: ReactNode;\n mobileTopSections?: ReactElement<T>[];\n mobileBottomChildren?: ReactNode;\n mobileBottomSections?: ReactElement<T>[];\n rightItemsDesktop?: ReactNode;\n rightItemsMobile?: ReactNode;\n};\n\nexport const Navbar = <T extends TabProps>({\n logo,\n mobileTopChildren,\n desktopSections = [],\n mobileTopSections = [],\n mobileBottomChildren,\n mobileBottomSections = [],\n rightItemsDesktop,\n rightItemsMobile,\n selectedChoice,\n}: NavbarProps<T>) => {\n const { isMobile } = useDevice('lg');\n const isMoUnted = useIsMounted();\n\n if (!isMoUnted) return <></>;\n\n return isMobile ? (\n <MobileNavbar\n topChildren={mobileTopChildren}\n topSections={mobileTopSections}\n bottomChildren={mobileBottomChildren}\n bottomSections={mobileBottomSections}\n logo={logo}\n rightItems={rightItemsMobile}\n />\n ) : (\n <DesktopNavbar\n sections={desktopSections}\n rightItems={rightItemsDesktop}\n logo={logo}\n selectedChoice={selectedChoice}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/Navbar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { useDevice, useIsMounted } from '../../hooks';\nimport type { TabProps } 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 TabProps> = {\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};\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 * - Automatic detection with no flash of unstyled content\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 const Navbar = <T extends TabProps>({\n logo,\n mobileTopChildren,\n desktopSections = [],\n mobileTopSections = [],\n mobileBottomChildren,\n mobileBottomSections = [],\n rightItemsDesktop,\n rightItemsMobile,\n selectedChoice,\n}: NavbarProps<T>) => {\n const { isMobile } = useDevice('lg');\n const isMoUnted = useIsMounted();\n\n if (!isMoUnted) return <></>;\n\n return isMobile ? (\n <MobileNavbar\n topChildren={mobileTopChildren}\n topSections={mobileTopSections}\n bottomChildren={mobileBottomChildren}\n bottomSections={mobileBottomSections}\n logo={logo}\n rightItems={rightItemsMobile}\n />\n ) : (\n <DesktopNavbar\n sections={desktopSections}\n rightItems={rightItemsDesktop}\n logo={logo}\n selectedChoice={selectedChoice}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAyFO,MAAM,SAAS,CAAqB;AAAA,EACzC;AAAA,EACA;AAAA,EACA,kBAAkB,CAAA;AAAA,EAClB,oBAAoB,CAAA;AAAA,EACpB;AAAA,EACA,uBAAuB,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF,MAAsB;AACpB,QAAM,EAAE,SAAA,IAAa,UAAU,IAAI;AACnC,QAAM,YAAY,aAAA;AAElB,MAAI,CAAC,UAAW,QAAO,oBAAA,UAAA,CAAA,CAAE;AAEzB,SAAO,WACL;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAa;AAAA,MACb,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB;AAAA,MACA,YAAY;AAAA,IAAA;AAAA,EAAA,IAGd;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAU;AAAA,MACV,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -51,7 +51,14 @@ const useNavActions = () => {
|
|
|
51
51
|
onClick?.();
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
/** Currently active section ID, null if no section is active */
|
|
56
|
+
activeSection,
|
|
57
|
+
/** Handler for logo click interactions */
|
|
58
|
+
onClickLogo,
|
|
59
|
+
/** Handler for section navigation clicks */
|
|
60
|
+
onClickSection
|
|
61
|
+
};
|
|
55
62
|
};
|
|
56
63
|
exports.useNavActions = useNavActions;
|
|
57
64
|
//# sourceMappingURL=useNavigation.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigation.cjs","sources":["../../../src/components/Navbar/useNavigation.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\ninterface SectionData {\n id: string;\n offsetTop: number;\n offsetHeight: number;\n}\n\nexport const useNavActions = () => {\n const [activeSection, setActiveSection] = useState<string | null>(null);\n\n const detectActiveSection = () => {\n const scrollY = window.scrollY;\n const sections = document.querySelectorAll('section');\n const sectionsData: SectionData[] = [];\n\n sections.forEach((section) =>\n sectionsData.push({\n id: section.id,\n offsetTop: section.offsetTop,\n offsetHeight: section.offsetHeight,\n })\n );\n\n const currentSection = sectionsData.find(\n (section) =>\n section.offsetTop <= scrollY + window.screen.height / 4 &&\n section.offsetTop + section.offsetHeight >\n scrollY + window.screen.height / 4\n );\n\n if (currentSection) {\n setActiveSection(currentSection.id);\n }\n };\n\n useEffect(() => {\n window.addEventListener('scroll', detectActiveSection, { passive: true });\n\n return () => {\n window.removeEventListener('scroll', detectActiveSection);\n };\n }, []);\n\n const onClickLogo = (onClick: (url: string) => void) => {\n setActiveSection(null);\n\n if (window.location.pathname === '/') {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n } else {\n onClick('/');\n }\n };\n\n const onClickSection = (\n sectionId: string,\n url?: string,\n onClick?: () => void\n ) => {\n setActiveSection(sectionId);\n\n if (window.location.pathname === url) {\n const sectionEl = document.getElementById(sectionId);\n\n if (sectionEl) {\n sectionEl.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'nearest',\n });\n }\n } else {\n onClick?.();\n }\n };\n\n return {
|
|
1
|
+
{"version":3,"file":"useNavigation.cjs","sources":["../../../src/components/Navbar/useNavigation.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\n/**\n * Interface describing section data used for scroll detection\n */\ninterface SectionData {\n /** Unique identifier of the section element */\n id: string;\n /** Distance from top of document to section start */\n offsetTop: number;\n /** Height of the section element */\n offsetHeight: number;\n}\n\n/**\n * Navigation Actions Hook\n *\n * A comprehensive hook for managing navigation interactions and scroll-based section detection.\n * Provides automatic active section detection based on scroll position and handles smooth\n * scrolling navigation behaviors.\n *\n * Features:\n * - Automatic active section detection based on scroll position\n * - Smooth scrolling to sections within the same page\n * - Logo click handling with home navigation\n * - Section click handling with conditional scrolling vs navigation\n * - Passive scroll event listeners for optimal performance\n * - Viewport-aware active section calculation (using screen height / 4 offset)\n *\n * Active Section Detection:\n * - Monitors all `<section>` elements on the page\n * - Calculates which section is currently in the \"active\" zone\n * - Active zone is defined as the top 25% of the viewport\n * - Updates activeSection state as user scrolls\n *\n * Navigation Behaviors:\n * - Logo click: Scrolls to top if on home page, navigates to home if on other pages\n * - Section click: Smooth scrolls if on same page, executes callback if different page\n * - All scrolling uses smooth behavior for better UX\n *\n * @example\n * Basic usage in navigation component:\n * ```tsx\n * const { activeSection, onClickLogo, onClickSection } = useNavActions();\n *\n * // In navigation items\n * const navItems = sections.map(section => (\n * <TabSelectorItem\n * key={section.id}\n * isActive={activeSection === section.id}\n * onClick={() => onClickSection(section.id, section.url, section.onClick)}\n * >\n * {section.label}\n * </TabSelectorItem>\n * ));\n *\n * // In logo\n * <Logo onClick={() => onClickLogo(navigate)} />\n * ```\n *\n * @example\n * Advanced usage with routing:\n * ```tsx\n * const { activeSection, onClickLogo, onClickSection } = useNavActions();\n * const navigate = useNavigate();\n *\n * const handleLogoClick = () => {\n * onClickLogo((url) => {\n * navigate(url);\n * // Additional logic like analytics\n * trackEvent('logo_click');\n * });\n * };\n *\n * const handleSectionClick = (sectionId: string) => {\n * onClickSection(\n * sectionId,\n * `/page#${sectionId}`,\n * () => {\n * navigate(`/page#${sectionId}`);\n * trackEvent('section_navigation', { sectionId });\n * }\n * );\n * };\n * ```\n *\n * Performance Considerations:\n * - Uses passive scroll event listeners to prevent blocking\n * - Automatically cleans up event listeners on unmount\n * - Efficiently queries DOM elements using native selectors\n * - Calculates section positions dynamically for accuracy\n *\n * @returns Object containing navigation state and action handlers\n */\nexport const useNavActions = () => {\n /** Currently active section ID based on scroll position */\n const [activeSection, setActiveSection] = useState<string | null>(null);\n\n /**\n * Detects which section is currently active based on scroll position\n * Uses viewport-aware calculation to determine active section\n */\n const detectActiveSection = () => {\n const scrollY = window.scrollY;\n const sections = document.querySelectorAll('section');\n const sectionsData: SectionData[] = [];\n\n // Collect position data for all sections\n sections.forEach((section) =>\n sectionsData.push({\n id: section.id,\n offsetTop: section.offsetTop,\n offsetHeight: section.offsetHeight,\n })\n );\n\n // Find section that intersects with the active zone (top 25% of viewport)\n const currentSection = sectionsData.find(\n (section) =>\n section.offsetTop <= scrollY + window.screen.height / 4 &&\n section.offsetTop + section.offsetHeight >\n scrollY + window.screen.height / 4\n );\n\n if (currentSection) {\n setActiveSection(currentSection.id);\n }\n };\n\n // Set up scroll listener for active section detection\n useEffect(() => {\n window.addEventListener('scroll', detectActiveSection, { passive: true });\n\n return () => {\n window.removeEventListener('scroll', detectActiveSection);\n };\n }, []);\n\n /**\n * Handles logo click behavior\n * Scrolls to top if on home page, navigates to home if on other pages\n *\n * @param onClick - Callback function to handle navigation (e.g., router.push)\n */\n const onClickLogo = (onClick: (url: string) => void) => {\n setActiveSection(null);\n\n if (window.location.pathname === '/') {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n } else {\n onClick('/');\n }\n };\n\n /**\n * Handles section navigation click behavior\n * Smooth scrolls if on same page, executes callback if different page\n *\n * @param sectionId - ID of the target section element\n * @param url - URL of the page containing the section (optional)\n * @param onClick - Callback function to handle navigation (optional)\n */\n const onClickSection = (\n sectionId: string,\n url?: string,\n onClick?: () => void\n ) => {\n setActiveSection(sectionId);\n\n // If on the same page, scroll to section\n if (window.location.pathname === url) {\n const sectionEl = document.getElementById(sectionId);\n\n if (sectionEl) {\n sectionEl.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'nearest',\n });\n }\n } else {\n // If on different page, execute callback (typically navigation)\n onClick?.();\n }\n };\n\n return {\n /** Currently active section ID, null if no section is active */\n activeSection,\n /** Handler for logo click interactions */\n onClickLogo,\n /** Handler for section navigation clicks */\n onClickSection,\n };\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAgGO,MAAM,gBAAgB,MAAM;AAEjC,QAAM,CAAC,eAAe,gBAAgB,IAAIA,aAAAA,SAAwB,IAAI;AAMtE,QAAM,sBAAsB,MAAM;AAChC,UAAM,UAAU,OAAO;AACvB,UAAM,WAAW,SAAS,iBAAiB,SAAS;AACpD,UAAM,eAA8B,CAAA;AAGpC,aAAS;AAAA,MAAQ,CAAC,YAChB,aAAa,KAAK;AAAA,QAChB,IAAI,QAAQ;AAAA,QACZ,WAAW,QAAQ;AAAA,QACnB,cAAc,QAAQ;AAAA,MAAA,CACvB;AAAA,IAAA;AAIH,UAAM,iBAAiB,aAAa;AAAA,MAClC,CAAC,YACC,QAAQ,aAAa,UAAU,OAAO,OAAO,SAAS,KACtD,QAAQ,YAAY,QAAQ,eAC1B,UAAU,OAAO,OAAO,SAAS;AAAA,IAAA;AAGvC,QAAI,gBAAgB;AAClB,uBAAiB,eAAe,EAAE;AAAA,IACpC;AAAA,EACF;AAGAC,eAAAA,UAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,qBAAqB,EAAE,SAAS,MAAM;AAExE,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,mBAAmB;AAAA,IAC1D;AAAA,EACF,GAAG,CAAA,CAAE;AAQL,QAAM,cAAc,CAAC,YAAmC;AACtD,qBAAiB,IAAI;AAErB,QAAI,OAAO,SAAS,aAAa,KAAK;AACpC,aAAO,SAAS,EAAE,KAAK,GAAG,UAAU,UAAU;AAAA,IAChD,OAAO;AACL,cAAQ,GAAG;AAAA,IACb;AAAA,EACF;AAUA,QAAM,iBAAiB,CACrB,WACA,KACA,YACG;AACH,qBAAiB,SAAS;AAG1B,QAAI,OAAO,SAAS,aAAa,KAAK;AACpC,YAAM,YAAY,SAAS,eAAe,SAAS;AAEnD,UAAI,WAAW;AACb,kBAAU,eAAe;AAAA,UACvB,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ;AAAA,QAAA,CACT;AAAA,MACH;AAAA,IACF,OAAO;AAEL,gBAAA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA;AAAA,IAEL;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1,6 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Actions Hook
|
|
3
|
+
*
|
|
4
|
+
* A comprehensive hook for managing navigation interactions and scroll-based section detection.
|
|
5
|
+
* Provides automatic active section detection based on scroll position and handles smooth
|
|
6
|
+
* scrolling navigation behaviors.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Automatic active section detection based on scroll position
|
|
10
|
+
* - Smooth scrolling to sections within the same page
|
|
11
|
+
* - Logo click handling with home navigation
|
|
12
|
+
* - Section click handling with conditional scrolling vs navigation
|
|
13
|
+
* - Passive scroll event listeners for optimal performance
|
|
14
|
+
* - Viewport-aware active section calculation (using screen height / 4 offset)
|
|
15
|
+
*
|
|
16
|
+
* Active Section Detection:
|
|
17
|
+
* - Monitors all `<section>` elements on the page
|
|
18
|
+
* - Calculates which section is currently in the "active" zone
|
|
19
|
+
* - Active zone is defined as the top 25% of the viewport
|
|
20
|
+
* - Updates activeSection state as user scrolls
|
|
21
|
+
*
|
|
22
|
+
* Navigation Behaviors:
|
|
23
|
+
* - Logo click: Scrolls to top if on home page, navigates to home if on other pages
|
|
24
|
+
* - Section click: Smooth scrolls if on same page, executes callback if different page
|
|
25
|
+
* - All scrolling uses smooth behavior for better UX
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* Basic usage in navigation component:
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const { activeSection, onClickLogo, onClickSection } = useNavActions();
|
|
31
|
+
*
|
|
32
|
+
* // In navigation items
|
|
33
|
+
* const navItems = sections.map(section => (
|
|
34
|
+
* <TabSelectorItem
|
|
35
|
+
* key={section.id}
|
|
36
|
+
* isActive={activeSection === section.id}
|
|
37
|
+
* onClick={() => onClickSection(section.id, section.url, section.onClick)}
|
|
38
|
+
* >
|
|
39
|
+
* {section.label}
|
|
40
|
+
* </TabSelectorItem>
|
|
41
|
+
* ));
|
|
42
|
+
*
|
|
43
|
+
* // In logo
|
|
44
|
+
* <Logo onClick={() => onClickLogo(navigate)} />
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* Advanced usage with routing:
|
|
49
|
+
* ```tsx
|
|
50
|
+
* const { activeSection, onClickLogo, onClickSection } = useNavActions();
|
|
51
|
+
* const navigate = useNavigate();
|
|
52
|
+
*
|
|
53
|
+
* const handleLogoClick = () => {
|
|
54
|
+
* onClickLogo((url) => {
|
|
55
|
+
* navigate(url);
|
|
56
|
+
* // Additional logic like analytics
|
|
57
|
+
* trackEvent('logo_click');
|
|
58
|
+
* });
|
|
59
|
+
* };
|
|
60
|
+
*
|
|
61
|
+
* const handleSectionClick = (sectionId: string) => {
|
|
62
|
+
* onClickSection(
|
|
63
|
+
* sectionId,
|
|
64
|
+
* `/page#${sectionId}`,
|
|
65
|
+
* () => {
|
|
66
|
+
* navigate(`/page#${sectionId}`);
|
|
67
|
+
* trackEvent('section_navigation', { sectionId });
|
|
68
|
+
* }
|
|
69
|
+
* );
|
|
70
|
+
* };
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* Performance Considerations:
|
|
74
|
+
* - Uses passive scroll event listeners to prevent blocking
|
|
75
|
+
* - Automatically cleans up event listeners on unmount
|
|
76
|
+
* - Efficiently queries DOM elements using native selectors
|
|
77
|
+
* - Calculates section positions dynamically for accuracy
|
|
78
|
+
*
|
|
79
|
+
* @returns Object containing navigation state and action handlers
|
|
80
|
+
*/
|
|
1
81
|
export declare const useNavActions: () => {
|
|
82
|
+
/** Currently active section ID, null if no section is active */
|
|
2
83
|
activeSection: string | null;
|
|
84
|
+
/** Handler for logo click interactions */
|
|
3
85
|
onClickLogo: (onClick: (url: string) => void) => void;
|
|
86
|
+
/** Handler for section navigation clicks */
|
|
4
87
|
onClickSection: (sectionId: string, url?: string, onClick?: () => void) => void;
|
|
5
88
|
};
|
|
6
89
|
//# sourceMappingURL=useNavigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/Navbar/useNavigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/Navbar/useNavigation.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,eAAO,MAAM,aAAa;IA6FtB,gEAAgE;;IAEhE,0CAA0C;2BA7Cd,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI;IA+CjD,4CAA4C;gCA5BjC,MAAM,QACX,MAAM,YACF,MAAM,IAAI;CA6BvB,CAAC"}
|
|
@@ -49,7 +49,14 @@ const useNavActions = () => {
|
|
|
49
49
|
onClick?.();
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
return {
|
|
52
|
+
return {
|
|
53
|
+
/** Currently active section ID, null if no section is active */
|
|
54
|
+
activeSection,
|
|
55
|
+
/** Handler for logo click interactions */
|
|
56
|
+
onClickLogo,
|
|
57
|
+
/** Handler for section navigation clicks */
|
|
58
|
+
onClickSection
|
|
59
|
+
};
|
|
53
60
|
};
|
|
54
61
|
export {
|
|
55
62
|
useNavActions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigation.mjs","sources":["../../../src/components/Navbar/useNavigation.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\ninterface SectionData {\n id: string;\n offsetTop: number;\n offsetHeight: number;\n}\n\nexport const useNavActions = () => {\n const [activeSection, setActiveSection] = useState<string | null>(null);\n\n const detectActiveSection = () => {\n const scrollY = window.scrollY;\n const sections = document.querySelectorAll('section');\n const sectionsData: SectionData[] = [];\n\n sections.forEach((section) =>\n sectionsData.push({\n id: section.id,\n offsetTop: section.offsetTop,\n offsetHeight: section.offsetHeight,\n })\n );\n\n const currentSection = sectionsData.find(\n (section) =>\n section.offsetTop <= scrollY + window.screen.height / 4 &&\n section.offsetTop + section.offsetHeight >\n scrollY + window.screen.height / 4\n );\n\n if (currentSection) {\n setActiveSection(currentSection.id);\n }\n };\n\n useEffect(() => {\n window.addEventListener('scroll', detectActiveSection, { passive: true });\n\n return () => {\n window.removeEventListener('scroll', detectActiveSection);\n };\n }, []);\n\n const onClickLogo = (onClick: (url: string) => void) => {\n setActiveSection(null);\n\n if (window.location.pathname === '/') {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n } else {\n onClick('/');\n }\n };\n\n const onClickSection = (\n sectionId: string,\n url?: string,\n onClick?: () => void\n ) => {\n setActiveSection(sectionId);\n\n if (window.location.pathname === url) {\n const sectionEl = document.getElementById(sectionId);\n\n if (sectionEl) {\n sectionEl.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'nearest',\n });\n }\n } else {\n onClick?.();\n }\n };\n\n return {
|
|
1
|
+
{"version":3,"file":"useNavigation.mjs","sources":["../../../src/components/Navbar/useNavigation.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\n/**\n * Interface describing section data used for scroll detection\n */\ninterface SectionData {\n /** Unique identifier of the section element */\n id: string;\n /** Distance from top of document to section start */\n offsetTop: number;\n /** Height of the section element */\n offsetHeight: number;\n}\n\n/**\n * Navigation Actions Hook\n *\n * A comprehensive hook for managing navigation interactions and scroll-based section detection.\n * Provides automatic active section detection based on scroll position and handles smooth\n * scrolling navigation behaviors.\n *\n * Features:\n * - Automatic active section detection based on scroll position\n * - Smooth scrolling to sections within the same page\n * - Logo click handling with home navigation\n * - Section click handling with conditional scrolling vs navigation\n * - Passive scroll event listeners for optimal performance\n * - Viewport-aware active section calculation (using screen height / 4 offset)\n *\n * Active Section Detection:\n * - Monitors all `<section>` elements on the page\n * - Calculates which section is currently in the \"active\" zone\n * - Active zone is defined as the top 25% of the viewport\n * - Updates activeSection state as user scrolls\n *\n * Navigation Behaviors:\n * - Logo click: Scrolls to top if on home page, navigates to home if on other pages\n * - Section click: Smooth scrolls if on same page, executes callback if different page\n * - All scrolling uses smooth behavior for better UX\n *\n * @example\n * Basic usage in navigation component:\n * ```tsx\n * const { activeSection, onClickLogo, onClickSection } = useNavActions();\n *\n * // In navigation items\n * const navItems = sections.map(section => (\n * <TabSelectorItem\n * key={section.id}\n * isActive={activeSection === section.id}\n * onClick={() => onClickSection(section.id, section.url, section.onClick)}\n * >\n * {section.label}\n * </TabSelectorItem>\n * ));\n *\n * // In logo\n * <Logo onClick={() => onClickLogo(navigate)} />\n * ```\n *\n * @example\n * Advanced usage with routing:\n * ```tsx\n * const { activeSection, onClickLogo, onClickSection } = useNavActions();\n * const navigate = useNavigate();\n *\n * const handleLogoClick = () => {\n * onClickLogo((url) => {\n * navigate(url);\n * // Additional logic like analytics\n * trackEvent('logo_click');\n * });\n * };\n *\n * const handleSectionClick = (sectionId: string) => {\n * onClickSection(\n * sectionId,\n * `/page#${sectionId}`,\n * () => {\n * navigate(`/page#${sectionId}`);\n * trackEvent('section_navigation', { sectionId });\n * }\n * );\n * };\n * ```\n *\n * Performance Considerations:\n * - Uses passive scroll event listeners to prevent blocking\n * - Automatically cleans up event listeners on unmount\n * - Efficiently queries DOM elements using native selectors\n * - Calculates section positions dynamically for accuracy\n *\n * @returns Object containing navigation state and action handlers\n */\nexport const useNavActions = () => {\n /** Currently active section ID based on scroll position */\n const [activeSection, setActiveSection] = useState<string | null>(null);\n\n /**\n * Detects which section is currently active based on scroll position\n * Uses viewport-aware calculation to determine active section\n */\n const detectActiveSection = () => {\n const scrollY = window.scrollY;\n const sections = document.querySelectorAll('section');\n const sectionsData: SectionData[] = [];\n\n // Collect position data for all sections\n sections.forEach((section) =>\n sectionsData.push({\n id: section.id,\n offsetTop: section.offsetTop,\n offsetHeight: section.offsetHeight,\n })\n );\n\n // Find section that intersects with the active zone (top 25% of viewport)\n const currentSection = sectionsData.find(\n (section) =>\n section.offsetTop <= scrollY + window.screen.height / 4 &&\n section.offsetTop + section.offsetHeight >\n scrollY + window.screen.height / 4\n );\n\n if (currentSection) {\n setActiveSection(currentSection.id);\n }\n };\n\n // Set up scroll listener for active section detection\n useEffect(() => {\n window.addEventListener('scroll', detectActiveSection, { passive: true });\n\n return () => {\n window.removeEventListener('scroll', detectActiveSection);\n };\n }, []);\n\n /**\n * Handles logo click behavior\n * Scrolls to top if on home page, navigates to home if on other pages\n *\n * @param onClick - Callback function to handle navigation (e.g., router.push)\n */\n const onClickLogo = (onClick: (url: string) => void) => {\n setActiveSection(null);\n\n if (window.location.pathname === '/') {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n } else {\n onClick('/');\n }\n };\n\n /**\n * Handles section navigation click behavior\n * Smooth scrolls if on same page, executes callback if different page\n *\n * @param sectionId - ID of the target section element\n * @param url - URL of the page containing the section (optional)\n * @param onClick - Callback function to handle navigation (optional)\n */\n const onClickSection = (\n sectionId: string,\n url?: string,\n onClick?: () => void\n ) => {\n setActiveSection(sectionId);\n\n // If on the same page, scroll to section\n if (window.location.pathname === url) {\n const sectionEl = document.getElementById(sectionId);\n\n if (sectionEl) {\n sectionEl.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'nearest',\n });\n }\n } else {\n // If on different page, execute callback (typically navigation)\n onClick?.();\n }\n };\n\n return {\n /** Currently active section ID, null if no section is active */\n activeSection,\n /** Handler for logo click interactions */\n onClickLogo,\n /** Handler for section navigation clicks */\n onClickSection,\n };\n};\n"],"names":[],"mappings":";;AAgGO,MAAM,gBAAgB,MAAM;AAEjC,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAwB,IAAI;AAMtE,QAAM,sBAAsB,MAAM;AAChC,UAAM,UAAU,OAAO;AACvB,UAAM,WAAW,SAAS,iBAAiB,SAAS;AACpD,UAAM,eAA8B,CAAA;AAGpC,aAAS;AAAA,MAAQ,CAAC,YAChB,aAAa,KAAK;AAAA,QAChB,IAAI,QAAQ;AAAA,QACZ,WAAW,QAAQ;AAAA,QACnB,cAAc,QAAQ;AAAA,MAAA,CACvB;AAAA,IAAA;AAIH,UAAM,iBAAiB,aAAa;AAAA,MAClC,CAAC,YACC,QAAQ,aAAa,UAAU,OAAO,OAAO,SAAS,KACtD,QAAQ,YAAY,QAAQ,eAC1B,UAAU,OAAO,OAAO,SAAS;AAAA,IAAA;AAGvC,QAAI,gBAAgB;AAClB,uBAAiB,eAAe,EAAE;AAAA,IACpC;AAAA,EACF;AAGA,YAAU,MAAM;AACd,WAAO,iBAAiB,UAAU,qBAAqB,EAAE,SAAS,MAAM;AAExE,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,mBAAmB;AAAA,IAC1D;AAAA,EACF,GAAG,CAAA,CAAE;AAQL,QAAM,cAAc,CAAC,YAAmC;AACtD,qBAAiB,IAAI;AAErB,QAAI,OAAO,SAAS,aAAa,KAAK;AACpC,aAAO,SAAS,EAAE,KAAK,GAAG,UAAU,UAAU;AAAA,IAChD,OAAO;AACL,cAAQ,GAAG;AAAA,IACb;AAAA,EACF;AAUA,QAAM,iBAAiB,CACrB,WACA,KACA,YACG;AACH,qBAAiB,SAAS;AAG1B,QAAI,OAAO,SAAS,aAAa,KAAK;AACpC,YAAM,YAAY,SAAS,eAAe,SAAS;AAEnD,UAAI,WAAW;AACb,kBAAU,eAAe;AAAA,UACvB,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ;AAAA,QAAA,CACT;AAAA,MACH;AAAA,IACF,OAAO;AAEL,gBAAA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA;AAAA,IAEL;AAAA;AAAA,IAEA;AAAA;AAAA,IAEA;AAAA,EAAA;AAEJ;"}
|