@heymantle/litho 0.0.15 → 0.0.16
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/AI_COMPONENTS_GUIDE.md +28 -15
- package/AI_INTEGRATION_GUIDE.md +3 -3
- package/AI_PATTERNS_GUIDE.md +59 -25
- package/COMPONENT_QUICK_REFERENCE.md +3 -3
- package/dist/cjs/components/ActionList.js +33 -25
- package/dist/cjs/components/AnnouncementBar.js +115 -18
- package/dist/cjs/components/AnnouncementCard.js +269 -0
- package/dist/cjs/components/AppProvider.js +15 -2
- package/dist/cjs/components/Autocomplete.js +58 -36
- package/dist/cjs/components/Badge.js +28 -14
- package/dist/cjs/components/Banner.js +37 -27
- package/dist/cjs/components/Box.js +50 -38
- package/dist/cjs/components/Button.js +338 -109
- package/dist/cjs/components/ButtonGroup.js +27 -14
- package/dist/cjs/components/Card.js +311 -143
- package/dist/cjs/components/Checkbox.js +55 -47
- package/dist/cjs/components/CheckboxCard.js +222 -0
- package/dist/cjs/components/CheckboxCardGroup.js +384 -0
- package/dist/cjs/components/ChoiceList.js +21 -11
- package/dist/cjs/components/Code.js +22 -8
- package/dist/cjs/components/Collapsible.js +24 -11
- package/dist/cjs/components/ColorField.js +163 -38
- package/dist/cjs/components/ContextualSaveBar.js +13 -6
- package/dist/cjs/components/DatePicker.js +48 -37
- package/dist/cjs/components/Disclosure.js +35 -22
- package/dist/cjs/components/Divider.js +82 -18
- package/dist/cjs/components/DropZone.js +111 -37
- package/dist/cjs/components/EmptyState.js +18 -6
- package/dist/cjs/components/Filters.js +84 -36
- package/dist/cjs/components/FooterHelp.js +14 -4
- package/dist/cjs/components/Form.js +13 -2
- package/dist/cjs/components/Frame.js +57 -22
- package/dist/cjs/components/FrameSaveBar.js +37 -6
- package/dist/cjs/components/Grid.js +31 -15
- package/dist/cjs/components/HorizontalStack.js +38 -25
- package/dist/cjs/components/Icon.js +683 -61
- package/dist/cjs/components/Image.js +35 -22
- package/dist/cjs/components/InlineError.js +19 -10
- package/dist/cjs/components/Label.js +21 -12
- package/dist/cjs/components/Layout.js +33 -24
- package/dist/cjs/components/LayoutSection.js +84 -22
- package/dist/cjs/components/Link.js +35 -22
- package/dist/cjs/components/List.js +28 -12
- package/dist/cjs/components/Listbox.js +53 -31
- package/dist/cjs/components/Loading.js +14 -2
- package/dist/cjs/components/Modal.js +22 -40
- package/dist/cjs/components/Navigation.js +107 -36
- package/dist/cjs/components/Page.js +44 -31
- package/dist/cjs/components/Pagination.js +20 -5
- package/dist/cjs/components/Pane.js +67 -4
- package/dist/cjs/components/Popover.js +37 -21
- package/dist/cjs/components/PopoverManager.js +14 -1
- package/dist/cjs/components/ProgressBar.js +28 -15
- package/dist/cjs/components/RadioButton.js +32 -24
- package/dist/cjs/components/RadioButtonCard.js +92 -67
- package/dist/cjs/components/RadioButtonCardGroup.js +379 -0
- package/dist/cjs/components/RangeSlider.js +34 -26
- package/dist/cjs/components/ResourceList.js +28 -14
- package/dist/cjs/components/Select.js +38 -26
- package/dist/cjs/components/SkeletonText.js +33 -18
- package/dist/cjs/components/Spinner.js +24 -12
- package/dist/cjs/components/Stack.js +131 -71
- package/dist/cjs/components/TabNavigation.js +27 -1
- package/dist/cjs/components/Table.js +58 -18
- package/dist/cjs/components/Tabs.js +52 -23
- package/dist/cjs/components/Tag.js +37 -16
- package/dist/cjs/components/Text.js +32 -18
- package/dist/cjs/components/TextField.js +119 -69
- package/dist/cjs/components/Thumbnail.js +25 -11
- package/dist/cjs/components/TimePicker.js +22 -1
- package/dist/cjs/components/Tip.js +140 -25
- package/dist/cjs/components/ToastNotification.js +107 -34
- package/dist/cjs/components/ToastProvider.js +13 -3
- package/dist/cjs/components/Tooltip.js +50 -41
- package/dist/cjs/components/TopBar.js +83 -9
- package/dist/cjs/components/VerticalStack.js +31 -16
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/stories/Autocomplete.stories.js +10 -10
- package/dist/cjs/stories/Checkbox.stories.js +6 -8
- package/dist/cjs/stories/CheckboxCardGroup.stories.js +459 -0
- package/dist/cjs/stories/Collapsible.stories.js +11 -11
- package/dist/cjs/stories/ColorField.stories.js +2 -3
- package/dist/cjs/stories/ComplexExamples.stories.js +48 -77
- package/dist/cjs/stories/ContextualSaveBar.stories.js +1 -1
- package/dist/cjs/stories/Divider.stories.js +15 -16
- package/dist/cjs/stories/DropZone.stories.js +3 -3
- package/dist/cjs/stories/FooterHelp.stories.js +3 -4
- package/dist/cjs/stories/Form.stories.js +2 -4
- package/dist/cjs/stories/Grid.stories.js +24 -33
- package/dist/cjs/stories/Icon.stories.js +22 -23
- package/dist/cjs/stories/Image.stories.js +12 -15
- package/dist/cjs/stories/InlineError.stories.js +0 -1
- package/dist/cjs/stories/Layout.stories.js +96 -2
- package/dist/cjs/stories/LayoutSection.stories.js +13 -18
- package/dist/cjs/stories/List.stories.js +24 -28
- package/dist/cjs/stories/Listbox.stories.js +2 -2
- package/dist/cjs/stories/Loading.stories.js +21 -25
- package/dist/cjs/stories/Modal.stories.js +0 -1
- package/dist/cjs/stories/Pagination.stories.js +4 -4
- package/dist/cjs/stories/Pane.stories.js +10 -18
- package/dist/cjs/stories/Popover.stories.js +7 -7
- package/dist/cjs/stories/PopoverManager.stories.js +9 -9
- package/dist/cjs/stories/ProgressBar.stories.js +8 -8
- package/dist/cjs/stories/RadioButton.stories.js +2 -2
- package/dist/cjs/stories/RadioButtonCard.stories.js +2 -2
- package/dist/cjs/stories/RadioButtonCardGroup.stories.js +502 -0
- package/dist/cjs/stories/RangeSlider.stories.js +1 -3
- package/dist/cjs/stories/ResourceList.stories.js +13 -13
- package/dist/cjs/stories/Spinner.stories.js +9 -9
- package/dist/cjs/stories/Stack.stories.js +233 -51
- package/dist/cjs/stories/Tabs.stories.js +2 -2
- package/dist/cjs/stories/Tag.stories.js +1 -1
- package/dist/cjs/stories/Thumbnail.stories.js +17 -18
- package/dist/cjs/stories/TimePicker.stories.js +0 -5
- package/dist/cjs/stories/Tip.stories.js +1 -1
- package/dist/esm/components/ActionList.js +33 -25
- package/dist/esm/components/AnnouncementBar.js +115 -18
- package/dist/esm/components/AnnouncementCard.js +254 -0
- package/dist/esm/components/AppProvider.js +15 -2
- package/dist/esm/components/Autocomplete.js +58 -36
- package/dist/esm/components/Badge.js +28 -14
- package/dist/esm/components/Banner.js +37 -27
- package/dist/esm/components/Box.js +50 -38
- package/dist/esm/components/Button.js +338 -109
- package/dist/esm/components/ButtonGroup.js +27 -14
- package/dist/esm/components/Card.js +300 -140
- package/dist/esm/components/Checkbox.js +55 -47
- package/dist/esm/components/CheckboxCard.js +207 -0
- package/dist/esm/components/CheckboxCardGroup.js +370 -0
- package/dist/esm/components/ChoiceList.js +21 -11
- package/dist/esm/components/Code.js +22 -8
- package/dist/esm/components/Collapsible.js +24 -11
- package/dist/esm/components/ColorField.js +165 -40
- package/dist/esm/components/ContextualSaveBar.js +13 -6
- package/dist/esm/components/DatePicker.js +48 -37
- package/dist/esm/components/Disclosure.js +35 -22
- package/dist/esm/components/Divider.js +78 -20
- package/dist/esm/components/DropZone.js +111 -37
- package/dist/esm/components/EmptyState.js +18 -6
- package/dist/esm/components/Filters.js +84 -36
- package/dist/esm/components/FooterHelp.js +14 -4
- package/dist/esm/components/Form.js +13 -2
- package/dist/esm/components/Frame.js +57 -22
- package/dist/esm/components/FrameSaveBar.js +37 -6
- package/dist/esm/components/Grid.js +31 -15
- package/dist/esm/components/HorizontalStack.js +38 -25
- package/dist/esm/components/Icon.js +681 -62
- package/dist/esm/components/Image.js +35 -22
- package/dist/esm/components/InlineError.js +19 -10
- package/dist/esm/components/Label.js +21 -12
- package/dist/esm/components/Layout.js +58 -25
- package/dist/esm/components/LayoutSection.js +84 -22
- package/dist/esm/components/Link.js +35 -22
- package/dist/esm/components/List.js +28 -12
- package/dist/esm/components/Listbox.js +53 -31
- package/dist/esm/components/Loading.js +14 -2
- package/dist/esm/components/Modal.js +69 -41
- package/dist/esm/components/Navigation.js +107 -36
- package/dist/esm/components/Page.js +44 -31
- package/dist/esm/components/Pagination.js +20 -5
- package/dist/esm/components/Pane.js +67 -4
- package/dist/esm/components/Popover.js +37 -21
- package/dist/esm/components/PopoverManager.js +14 -1
- package/dist/esm/components/ProgressBar.js +28 -15
- package/dist/esm/components/RadioButton.js +32 -24
- package/dist/esm/components/RadioButtonCard.js +92 -67
- package/dist/esm/components/RadioButtonCardGroup.js +364 -0
- package/dist/esm/components/RangeSlider.js +34 -26
- package/dist/esm/components/ResourceList.js +28 -14
- package/dist/esm/components/Select.js +38 -26
- package/dist/esm/components/SkeletonText.js +33 -18
- package/dist/esm/components/Spinner.js +24 -12
- package/dist/esm/components/Stack.js +131 -71
- package/dist/esm/components/TabNavigation.js +27 -1
- package/dist/esm/components/Table.js +58 -18
- package/dist/esm/components/Tabs.js +52 -23
- package/dist/esm/components/Tag.js +37 -16
- package/dist/esm/components/Text.js +32 -18
- package/dist/esm/components/TextField.js +119 -69
- package/dist/esm/components/Thumbnail.js +25 -11
- package/dist/esm/components/TimePicker.js +22 -1
- package/dist/esm/components/Tip.js +140 -25
- package/dist/esm/components/ToastNotification.js +107 -34
- package/dist/esm/components/ToastProvider.js +13 -3
- package/dist/esm/components/Tooltip.js +50 -41
- package/dist/esm/components/TopBar.js +83 -9
- package/dist/esm/components/VerticalStack.js +31 -16
- package/dist/esm/index.js +6 -0
- package/dist/esm/stories/Autocomplete.stories.js +10 -10
- package/dist/esm/stories/Checkbox.stories.js +6 -8
- package/dist/esm/stories/CheckboxCardGroup.stories.js +421 -0
- package/dist/esm/stories/Collapsible.stories.js +11 -11
- package/dist/esm/stories/ColorField.stories.js +2 -3
- package/dist/esm/stories/ComplexExamples.stories.js +48 -77
- package/dist/esm/stories/ContextualSaveBar.stories.js +1 -1
- package/dist/esm/stories/Divider.stories.js +15 -16
- package/dist/esm/stories/DropZone.stories.js +3 -3
- package/dist/esm/stories/FooterHelp.stories.js +3 -4
- package/dist/esm/stories/Form.stories.js +2 -4
- package/dist/esm/stories/Grid.stories.js +24 -33
- package/dist/esm/stories/Icon.stories.js +22 -23
- package/dist/esm/stories/Image.stories.js +12 -15
- package/dist/esm/stories/InlineError.stories.js +0 -1
- package/dist/esm/stories/Layout.stories.js +93 -2
- package/dist/esm/stories/LayoutSection.stories.js +13 -18
- package/dist/esm/stories/List.stories.js +24 -28
- package/dist/esm/stories/Listbox.stories.js +2 -2
- package/dist/esm/stories/Loading.stories.js +21 -25
- package/dist/esm/stories/Modal.stories.js +0 -1
- package/dist/esm/stories/Pagination.stories.js +4 -4
- package/dist/esm/stories/Pane.stories.js +10 -18
- package/dist/esm/stories/Popover.stories.js +7 -7
- package/dist/esm/stories/PopoverManager.stories.js +9 -9
- package/dist/esm/stories/ProgressBar.stories.js +8 -8
- package/dist/esm/stories/RadioButton.stories.js +2 -2
- package/dist/esm/stories/RadioButtonCard.stories.js +2 -2
- package/dist/esm/stories/RadioButtonCardGroup.stories.js +461 -0
- package/dist/esm/stories/RangeSlider.stories.js +1 -3
- package/dist/esm/stories/ResourceList.stories.js +13 -13
- package/dist/esm/stories/Spinner.stories.js +9 -9
- package/dist/esm/stories/Stack.stories.js +224 -51
- package/dist/esm/stories/Tabs.stories.js +2 -2
- package/dist/esm/stories/Tag.stories.js +1 -1
- package/dist/esm/stories/Thumbnail.stories.js +17 -18
- package/dist/esm/stories/TimePicker.stories.js +0 -5
- package/dist/esm/stories/Tip.stories.js +1 -1
- package/dist/types/components/ActionList.d.ts +1 -31
- package/dist/types/components/ActionList.d.ts.map +1 -1
- package/dist/types/components/AnnouncementBar.d.ts +1 -19
- package/dist/types/components/AnnouncementBar.d.ts.map +1 -1
- package/dist/types/components/AnnouncementCard.d.ts +3 -0
- package/dist/types/components/AnnouncementCard.d.ts.map +1 -0
- package/dist/types/components/AppProvider.d.ts +14 -1
- package/dist/types/components/AppProvider.d.ts.map +1 -1
- package/dist/types/components/Autocomplete.d.ts +1 -71
- package/dist/types/components/Autocomplete.d.ts.map +1 -1
- package/dist/types/components/Badge.d.ts +1 -19
- package/dist/types/components/Badge.d.ts.map +1 -1
- package/dist/types/components/Banner.d.ts +1 -37
- package/dist/types/components/Banner.d.ts.map +1 -1
- package/dist/types/components/Box.d.ts +1 -68
- package/dist/types/components/Box.d.ts.map +1 -1
- package/dist/types/components/Button.d.ts +1 -131
- package/dist/types/components/Button.d.ts.map +1 -1
- package/dist/types/components/ButtonGroup.d.ts +1 -22
- package/dist/types/components/ButtonGroup.d.ts.map +1 -1
- package/dist/types/components/Card.d.ts +54 -59
- package/dist/types/components/Card.d.ts.map +1 -1
- package/dist/types/components/Checkbox.d.ts +1 -63
- package/dist/types/components/Checkbox.d.ts.map +1 -1
- package/dist/types/components/CheckboxCard.d.ts +3 -0
- package/dist/types/components/CheckboxCard.d.ts.map +1 -0
- package/dist/types/components/CheckboxCardGroup.d.ts +3 -0
- package/dist/types/components/CheckboxCardGroup.d.ts.map +1 -0
- package/dist/types/components/ChoiceList.d.ts +1 -42
- package/dist/types/components/ChoiceList.d.ts.map +1 -1
- package/dist/types/components/Code.d.ts +1 -26
- package/dist/types/components/Code.d.ts.map +1 -1
- package/dist/types/components/Collapsible.d.ts +1 -15
- package/dist/types/components/Collapsible.d.ts.map +1 -1
- package/dist/types/components/ColorField.d.ts +13 -34
- package/dist/types/components/ColorField.d.ts.map +1 -1
- package/dist/types/components/ContextualSaveBar.d.ts +13 -6
- package/dist/types/components/ContextualSaveBar.d.ts.map +1 -1
- package/dist/types/components/DatePicker.d.ts +1 -64
- package/dist/types/components/DatePicker.d.ts.map +1 -1
- package/dist/types/components/Disclosure.d.ts +1 -25
- package/dist/types/components/Disclosure.d.ts.map +1 -1
- package/dist/types/components/Divider.d.ts +1 -19
- package/dist/types/components/Divider.d.ts.map +1 -1
- package/dist/types/components/DropZone.d.ts +1 -62
- package/dist/types/components/DropZone.d.ts.map +1 -1
- package/dist/types/components/EmptyState.d.ts +1 -50
- package/dist/types/components/EmptyState.d.ts.map +1 -1
- package/dist/types/components/Filters.d.ts +13 -68
- package/dist/types/components/Filters.d.ts.map +1 -1
- package/dist/types/components/FooterHelp.d.ts +14 -4
- package/dist/types/components/FooterHelp.d.ts.map +1 -1
- package/dist/types/components/Form.d.ts +13 -2
- package/dist/types/components/Form.d.ts.map +1 -1
- package/dist/types/components/Frame.d.ts +15 -36
- package/dist/types/components/Frame.d.ts.map +1 -1
- package/dist/types/components/FrameSaveBar.d.ts +3 -6
- package/dist/types/components/FrameSaveBar.d.ts.map +1 -1
- package/dist/types/components/Grid.d.ts +5 -21
- package/dist/types/components/Grid.d.ts.map +1 -1
- package/dist/types/components/HorizontalStack.d.ts +1 -34
- package/dist/types/components/HorizontalStack.d.ts.map +1 -1
- package/dist/types/components/Icon.d.ts +1 -41
- package/dist/types/components/Icon.d.ts.map +1 -1
- package/dist/types/components/Image.d.ts +1 -43
- package/dist/types/components/Image.d.ts.map +1 -1
- package/dist/types/components/InlineError.d.ts +1 -20
- package/dist/types/components/InlineError.d.ts.map +1 -1
- package/dist/types/components/Label.d.ts +1 -26
- package/dist/types/components/Label.d.ts.map +1 -1
- package/dist/types/components/Layout.d.ts +24 -15
- package/dist/types/components/Layout.d.ts.map +1 -1
- package/dist/types/components/LayoutSection.d.ts +1 -19
- package/dist/types/components/LayoutSection.d.ts.map +1 -1
- package/dist/types/components/Link.d.ts +1 -37
- package/dist/types/components/Link.d.ts.map +1 -1
- package/dist/types/components/List.d.ts +5 -17
- package/dist/types/components/List.d.ts.map +1 -1
- package/dist/types/components/Listbox.d.ts +1 -32
- package/dist/types/components/Listbox.d.ts.map +1 -1
- package/dist/types/components/Loading.d.ts +14 -2
- package/dist/types/components/Loading.d.ts.map +1 -1
- package/dist/types/components/Modal.d.ts +26 -35
- package/dist/types/components/Modal.d.ts.map +1 -1
- package/dist/types/components/Navigation.d.ts +1 -25
- package/dist/types/components/Navigation.d.ts.map +1 -1
- package/dist/types/components/Page.d.ts +1 -57
- package/dist/types/components/Page.d.ts.map +1 -1
- package/dist/types/components/Pagination.d.ts +13 -3
- package/dist/types/components/Pagination.d.ts.map +1 -1
- package/dist/types/components/Pane.d.ts +55 -3
- package/dist/types/components/Pane.d.ts.map +1 -1
- package/dist/types/components/Popover.d.ts +5 -37
- package/dist/types/components/Popover.d.ts.map +1 -1
- package/dist/types/components/PopoverManager.d.ts.map +1 -1
- package/dist/types/components/ProgressBar.d.ts +1 -22
- package/dist/types/components/ProgressBar.d.ts.map +1 -1
- package/dist/types/components/RadioButton.d.ts +1 -37
- package/dist/types/components/RadioButton.d.ts.map +1 -1
- package/dist/types/components/RadioButtonCard.d.ts +1 -39
- package/dist/types/components/RadioButtonCard.d.ts.map +1 -1
- package/dist/types/components/RadioButtonCardGroup.d.ts +3 -0
- package/dist/types/components/RadioButtonCardGroup.d.ts.map +1 -0
- package/dist/types/components/RangeSlider.d.ts +1 -42
- package/dist/types/components/RangeSlider.d.ts.map +1 -1
- package/dist/types/components/ResourceList.d.ts +5 -30
- package/dist/types/components/ResourceList.d.ts.map +1 -1
- package/dist/types/components/Select.d.ts +1 -46
- package/dist/types/components/Select.d.ts.map +1 -1
- package/dist/types/components/SkeletonText.d.ts +1 -26
- package/dist/types/components/SkeletonText.d.ts.map +1 -1
- package/dist/types/components/Spinner.d.ts +1 -16
- package/dist/types/components/Spinner.d.ts.map +1 -1
- package/dist/types/components/Stack.d.ts +1 -47
- package/dist/types/components/Stack.d.ts.map +1 -1
- package/dist/types/components/TabNavigation.d.ts.map +1 -1
- package/dist/types/components/Table.d.ts +13 -58
- package/dist/types/components/Table.d.ts.map +1 -1
- package/dist/types/components/Tabs.d.ts +3 -41
- package/dist/types/components/Tabs.d.ts.map +1 -1
- package/dist/types/components/Tag.d.ts +1 -24
- package/dist/types/components/Tag.d.ts.map +1 -1
- package/dist/types/components/Text.d.ts +1 -30
- package/dist/types/components/Text.d.ts.map +1 -1
- package/dist/types/components/TextField.d.ts +1 -109
- package/dist/types/components/TextField.d.ts.map +1 -1
- package/dist/types/components/Thumbnail.d.ts +1 -16
- package/dist/types/components/Thumbnail.d.ts.map +1 -1
- package/dist/types/components/TimePicker.d.ts +28 -1
- package/dist/types/components/TimePicker.d.ts.map +1 -1
- package/dist/types/components/Tip.d.ts +1 -21
- package/dist/types/components/Tip.d.ts.map +1 -1
- package/dist/types/components/ToastNotification.d.ts +1 -34
- package/dist/types/components/ToastNotification.d.ts.map +1 -1
- package/dist/types/components/ToastProvider.d.ts +13 -3
- package/dist/types/components/ToastProvider.d.ts.map +1 -1
- package/dist/types/components/Tooltip.d.ts +1 -54
- package/dist/types/components/Tooltip.d.ts.map +1 -1
- package/dist/types/components/TopBar.d.ts +1 -19
- package/dist/types/components/TopBar.d.ts.map +1 -1
- package/dist/types/components/VerticalStack.d.ts +1 -25
- package/dist/types/components/VerticalStack.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -0
- package/index.css +76 -14
- package/package.json +4 -3
|
@@ -51,7 +51,44 @@ import { MobileAcceptMajor } from "@shopify/polaris-icons";
|
|
|
51
51
|
import { tv } from "tailwind-variants";
|
|
52
52
|
import Icon from "./Icon.js";
|
|
53
53
|
import { useFrame } from "./Frame.js";
|
|
54
|
-
|
|
54
|
+
/**
|
|
55
|
+
* @component Listbox
|
|
56
|
+
*
|
|
57
|
+
* @description A selectable list component that renders options as interactive items with optional icons and descriptions.
|
|
58
|
+
*
|
|
59
|
+
* @usage
|
|
60
|
+
* - DO: Use for custom-styled selection lists with full keyboard navigation.
|
|
61
|
+
* - DON'T: Use for simple dropdowns (use Select).
|
|
62
|
+
*
|
|
63
|
+
* @accessibility
|
|
64
|
+
* - Implements listbox ARIA pattern with keyboard arrow navigation and selection.
|
|
65
|
+
*
|
|
66
|
+
* @alternative
|
|
67
|
+
* - If you need a native dropdown, use `Select`. If you need a searchable list, use `Autocomplete`.
|
|
68
|
+
*
|
|
69
|
+
* @param {Object} props - The properties object.
|
|
70
|
+
* @param {Array<Object>} props.options - Array of options to render in the listbox.
|
|
71
|
+
* Each option should be an object with the following properties:
|
|
72
|
+
* - `label` {string}: The display label of the option.
|
|
73
|
+
* - `value` {string | number}: The unique value of the option.
|
|
74
|
+
* - `icon` {React.ComponentType | string} [optional]: Icon source (Polaris, Lucide component, or string) rendered via `<Icon>`. Colors automatically based on selected state.
|
|
75
|
+
* - `showIconOnMobile` {boolean} [optional, default: true]: When false, the option icon is hidden on mobile and only shown at md (≥800px) breakpoint.
|
|
76
|
+
* - `selected` {boolean}: Whether the option is currently selected.
|
|
77
|
+
* - `onAction` {function}: A callback function invoked when the option is clicked or "Enter" is pressed.
|
|
78
|
+
* @param {boolean} [props.showIcon=false] - Determines whether to display an icon next to selected options.
|
|
79
|
+
* @param {React.ReactNode} [props.icon=MobileAcceptMajor] - The icon to display for selected options (default is `MobileAcceptMajor`).
|
|
80
|
+
* @param {boolean} [props.displayHorizontallyOnMobile=false] - Determines whether to display the listbox horizontally on mobile.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const options = [
|
|
84
|
+
* { label: "Option 1", value: "opt1", selected: false, onAction: () => console.log("Option 1 clicked") },
|
|
85
|
+
* { label: "Option 2", value: "opt2", selected: true, onAction: () => console.log("Option 2 clicked") },
|
|
86
|
+
* ];
|
|
87
|
+
*
|
|
88
|
+
* <Listbox options={options} showIcon={true} icon={CustomIcon} />
|
|
89
|
+
*
|
|
90
|
+
* @returns {JSX.Element} The rendered Listbox component.
|
|
91
|
+
*/ var styles = tv({
|
|
55
92
|
base: "Litho-Listbox__Option rounded-md cursor-pointer min-h-8 py-1 flex items-center justify-between pl-3 focus:outline-hidden active:ring-0",
|
|
56
93
|
variants: {
|
|
57
94
|
showIcon: {
|
|
@@ -80,32 +117,7 @@ var containerStyles = tv({
|
|
|
80
117
|
displayHorizontallyOnMobile: false
|
|
81
118
|
}
|
|
82
119
|
});
|
|
83
|
-
|
|
84
|
-
* A customizable Listbox component for displaying a list of options with selectable states.
|
|
85
|
-
* The component supports keyboard navigation and optional icons for selected items.
|
|
86
|
-
*
|
|
87
|
-
* @component
|
|
88
|
-
* @param {Object} props - The properties object.
|
|
89
|
-
* @param {Array<Object>} props.options - Array of options to render in the listbox.
|
|
90
|
-
* Each option should be an object with the following properties:
|
|
91
|
-
* - `label` {string}: The display label of the option.
|
|
92
|
-
* - `value` {string | number}: The unique value of the option.
|
|
93
|
-
* - `selected` {boolean}: Whether the option is currently selected.
|
|
94
|
-
* - `onAction` {function}: A callback function invoked when the option is clicked or "Enter" is pressed.
|
|
95
|
-
* @param {boolean} [props.showIcon=false] - Determines whether to display an icon next to selected options.
|
|
96
|
-
* @param {React.ReactNode} [props.icon=MobileAcceptMajor] - The icon to display for selected options (default is `MobileAcceptMajor`).
|
|
97
|
-
* @param {boolean} [props.displayHorizontallyOnMobile=false] - Determines whether to display the listbox horizontally on mobile.
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* const options = [
|
|
101
|
-
* { label: "Option 1", value: "opt1", selected: false, onAction: () => console.log("Option 1 clicked") },
|
|
102
|
-
* { label: "Option 2", value: "opt2", selected: true, onAction: () => console.log("Option 2 clicked") },
|
|
103
|
-
* ];
|
|
104
|
-
*
|
|
105
|
-
* <Listbox options={options} showIcon={true} icon={CustomIcon} />
|
|
106
|
-
*
|
|
107
|
-
* @returns {JSX.Element} The rendered Listbox component.
|
|
108
|
-
*/ function Listbox() {
|
|
120
|
+
function Listbox() {
|
|
109
121
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
110
122
|
var options = props.options, _props_showIcon = props.showIcon, showIcon = _props_showIcon === void 0 ? false : _props_showIcon, _props_displayHorizontallyOnMobile = props.displayHorizontallyOnMobile, displayHorizontallyOnMobile = _props_displayHorizontallyOnMobile === void 0 ? false : _props_displayHorizontallyOnMobile, _props_icon = props.icon, icon = _props_icon === void 0 ? MobileAcceptMajor : _props_icon;
|
|
111
123
|
var screenSizes = useFrame().screenSizes;
|
|
@@ -161,7 +173,7 @@ var containerStyles = tv({
|
|
|
161
173
|
displayHorizontallyOnMobile: displayHorizontallyOnMobile
|
|
162
174
|
}),
|
|
163
175
|
children: options.map(function(option, index) {
|
|
164
|
-
var selected = option.selected, label = option.label, value = option.value, onAction = option.onAction;
|
|
176
|
+
var selected = option.selected, label = option.label, value = option.value, optionIcon = option.icon, _option_showIconOnMobile = option.showIconOnMobile, showIconOnMobile = _option_showIconOnMobile === void 0 ? true : _option_showIconOnMobile, onAction = option.onAction;
|
|
165
177
|
var classes = styles({
|
|
166
178
|
selected: selected,
|
|
167
179
|
showIcon: showIcon,
|
|
@@ -182,9 +194,19 @@ var containerStyles = tv({
|
|
|
182
194
|
return handleKeyDown(e, index);
|
|
183
195
|
},
|
|
184
196
|
children: [
|
|
185
|
-
/*#__PURE__*/
|
|
186
|
-
className: "whitespace-nowrap pointer-events-none w-full",
|
|
187
|
-
children:
|
|
197
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
198
|
+
className: "flex items-center gap-2 whitespace-nowrap pointer-events-none w-full",
|
|
199
|
+
children: [
|
|
200
|
+
optionIcon && /*#__PURE__*/ _jsx("span", {
|
|
201
|
+
className: showIconOnMobile ? "" : "hidden @md:inline-flex",
|
|
202
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
203
|
+
source: optionIcon,
|
|
204
|
+
color: selected ? "active" : "subdued",
|
|
205
|
+
size: "sm"
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
label
|
|
209
|
+
]
|
|
188
210
|
}),
|
|
189
211
|
showIcon && /*#__PURE__*/ _jsx("div", {
|
|
190
212
|
className: "w-5 h-5 pointer-events-none",
|
|
@@ -48,9 +48,21 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
48
48
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
49
|
import { useEffect, useState } from "react";
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* @component Loading
|
|
52
|
+
*
|
|
53
|
+
* @description A page-level progress bar that animates across the top of the viewport during navigation or data fetching.
|
|
54
|
+
*
|
|
55
|
+
* @usage
|
|
56
|
+
* - DO: Use as a page-level loading indicator at the top of the viewport during navigation or data fetching.
|
|
57
|
+
* - DON'T: Use for inline or localized loading states; use `Spinner` for those cases.
|
|
58
|
+
*
|
|
59
|
+
* @accessibility
|
|
60
|
+
* - The progress bar is purely visual; pair with `aria-busy` on the loading container if screen reader announcements are needed.
|
|
61
|
+
*
|
|
62
|
+
* @alternative
|
|
63
|
+
* - If you need an inline loading indicator, use `Spinner` instead.
|
|
64
|
+
* - If you need placeholder content while data loads, use `SkeletonText` instead.
|
|
52
65
|
*
|
|
53
|
-
* @component
|
|
54
66
|
* @param {Object} props - The props object.
|
|
55
67
|
* @param {number} [props.maxDuration=10000] - The maximum duration (in milliseconds) for the loading progress bar to reach 100%.
|
|
56
68
|
* @returns {JSX.Element} A fixed progress bar displayed at the top of the page.
|
|
@@ -61,17 +61,68 @@ import Text from "./Text.js";
|
|
|
61
61
|
import Tooltip from "./Tooltip.js";
|
|
62
62
|
import { useFrame } from "./Frame.js";
|
|
63
63
|
import { useBodyScrollLock } from "../utilities/useBodyScrollLock.js";
|
|
64
|
-
|
|
64
|
+
/**
|
|
65
|
+
* @component Modal
|
|
66
|
+
*
|
|
67
|
+
* @description A dialog overlay that focuses the user on a specific task or confirmation, with header, body sections, and footer actions.
|
|
68
|
+
*
|
|
69
|
+
* @usage
|
|
70
|
+
* - DO: Use for focused tasks that require user attention or input, like confirmations or forms.
|
|
71
|
+
* - DON'T: Use for content that should remain accessible while reading the page (use Pane).
|
|
72
|
+
*
|
|
73
|
+
* @accessibility
|
|
74
|
+
* - Traps focus within the modal when open; supports Escape key dismissal.
|
|
75
|
+
* - Ensure `title` provides context for screen readers.
|
|
76
|
+
*
|
|
77
|
+
* @alternative
|
|
78
|
+
* - If you need a side panel that doesn't block the page, use `Pane`.
|
|
79
|
+
* - If you need inline messaging, use `Banner`.
|
|
80
|
+
*
|
|
81
|
+
* @param {Object} props - The component props.
|
|
82
|
+
* @param {React.ReactNode} [props.children] - The content of the modal.
|
|
83
|
+
* @param {string} [props.title] - The title of the modal.
|
|
84
|
+
* @param {string} [props.subtitle] - The subtitle of the modal.
|
|
85
|
+
* @param {boolean} [props.open=false] - Whether the modal is open.
|
|
86
|
+
* @param {Function} [props.onClose] - Callback function for closing the modal.
|
|
87
|
+
* @param {boolean} [props.sectioned=false] - Whether the modal content should be sectioned.
|
|
88
|
+
* @param {Object} [props.primaryAction] - The primary action for the modal.
|
|
89
|
+
* @param {string} [props.primaryAction.content] - Content of the primary action button.
|
|
90
|
+
* @param {Function} [props.primaryAction.onAction] - Callback for the primary action.
|
|
91
|
+
* @param {boolean} [props.primaryAction.loading=false] - Whether the primary action is loading.
|
|
92
|
+
* @param {boolean} [props.primaryAction.disabled=false] - Whether the primary action is disabled.
|
|
93
|
+
* @param {boolean} [props.primaryAction.destructive=false] - Whether the primary action is destructive.
|
|
94
|
+
* @param {Object} [props.secondaryAction] - The secondary action for the modal.
|
|
95
|
+
* @param {string} [props.secondaryAction.content] - Content of the secondary action button.
|
|
96
|
+
* @param {Function} [props.secondaryAction.onAction] - Callback for the secondary action.
|
|
97
|
+
* @param {boolean} [props.secondaryAction.disabled=false] - Whether the secondary action is disabled.
|
|
98
|
+
* @param {Object[]} [props.secondaryActions=[]] - Additional secondary actions.
|
|
99
|
+
* @param {Object} [props.destructiveAction] - A destructive action for the modal.
|
|
100
|
+
* @param {boolean} [props.loading=false] - Whether the modal is in a loading state.
|
|
101
|
+
* @param {string} [props.size="default"] - The size of the modal (default, large, or full).
|
|
102
|
+
* @param {React.ReactNode} [props.leftAccessory] - Left accessory content in the footer.
|
|
103
|
+
* @param {boolean} [props.hideCloseButton=false] - Whether to hide the close button.
|
|
104
|
+
* @param {Function} [props.backAction] - Callback function for the back button. When provided, displays a back button next to the title.
|
|
105
|
+
* @param {number} [props.zIndexOverride=1000] - The z-index of the modal.
|
|
106
|
+
* @param {boolean} [props.autoFocusFirstInput=true] - Whether to focus the first input when the modal opens.
|
|
107
|
+
* @param {boolean} [props.pinToTop=false] - Whether to pin the modal to the top of the viewport instead of centering it vertically. Useful when modal content changes height dynamically.
|
|
108
|
+
* @param {string} [props.bodyClassName] - Additional CSS classes to apply to the modal body.
|
|
109
|
+
* @returns {React.ReactPortal|null} The rendered modal component or null if not open.
|
|
110
|
+
*/ export var ModalContext = /*#__PURE__*/ createContext(false);
|
|
65
111
|
var containerStyles = tv({
|
|
66
|
-
base: "Litho-ModalContainer fixed inset-0 block flex flex-col justify-end
|
|
112
|
+
base: "Litho-ModalContainer fixed inset-0 block flex flex-col justify-end items-center pointer-events-none",
|
|
67
113
|
variants: {
|
|
68
114
|
hidden: {
|
|
69
115
|
true: "hidden opacity-0 pointer-events-none",
|
|
70
116
|
false: ""
|
|
117
|
+
},
|
|
118
|
+
pinToTop: {
|
|
119
|
+
true: "md:justify-start md:py-5",
|
|
120
|
+
false: "md:justify-center"
|
|
71
121
|
}
|
|
72
122
|
},
|
|
73
123
|
defaultVariants: {
|
|
74
|
-
hidden: false
|
|
124
|
+
hidden: false,
|
|
125
|
+
pinToTop: false
|
|
75
126
|
}
|
|
76
127
|
});
|
|
77
128
|
var styles = tv({
|
|
@@ -118,40 +169,9 @@ var sectionStyles = tv({
|
|
|
118
169
|
flush: false
|
|
119
170
|
}
|
|
120
171
|
});
|
|
121
|
-
|
|
122
|
-
* Modal component for displaying a customizable dialog.
|
|
123
|
-
*
|
|
124
|
-
* @param {Object} props - The component props.
|
|
125
|
-
* @param {React.ReactNode} [props.children] - The content of the modal.
|
|
126
|
-
* @param {string} [props.title] - The title of the modal.
|
|
127
|
-
* @param {string} [props.subtitle] - The subtitle of the modal.
|
|
128
|
-
* @param {boolean} [props.open=false] - Whether the modal is open.
|
|
129
|
-
* @param {Function} [props.onClose] - Callback function for closing the modal.
|
|
130
|
-
* @param {boolean} [props.sectioned=false] - Whether the modal content should be sectioned.
|
|
131
|
-
* @param {Object} [props.primaryAction] - The primary action for the modal.
|
|
132
|
-
* @param {string} [props.primaryAction.content] - Content of the primary action button.
|
|
133
|
-
* @param {Function} [props.primaryAction.onAction] - Callback for the primary action.
|
|
134
|
-
* @param {boolean} [props.primaryAction.loading=false] - Whether the primary action is loading.
|
|
135
|
-
* @param {boolean} [props.primaryAction.disabled=false] - Whether the primary action is disabled.
|
|
136
|
-
* @param {boolean} [props.primaryAction.destructive=false] - Whether the primary action is destructive.
|
|
137
|
-
* @param {Object} [props.secondaryAction] - The secondary action for the modal.
|
|
138
|
-
* @param {string} [props.secondaryAction.content] - Content of the secondary action button.
|
|
139
|
-
* @param {Function} [props.secondaryAction.onAction] - Callback for the secondary action.
|
|
140
|
-
* @param {boolean} [props.secondaryAction.disabled=false] - Whether the secondary action is disabled.
|
|
141
|
-
* @param {Object[]} [props.secondaryActions=[]] - Additional secondary actions.
|
|
142
|
-
* @param {Object} [props.destructiveAction] - A destructive action for the modal.
|
|
143
|
-
* @param {boolean} [props.loading=false] - Whether the modal is in a loading state.
|
|
144
|
-
* @param {string} [props.size="default"] - The size of the modal (default, large, or full).
|
|
145
|
-
* @param {React.ReactNode} [props.leftAccessory] - Left accessory content in the footer.
|
|
146
|
-
* @param {boolean} [props.hideCloseButton=false] - Whether to hide the close button.
|
|
147
|
-
* @param {Function} [props.backAction] - Callback function for the back button. When provided, displays a back button next to the title.
|
|
148
|
-
* @param {number} [props.zIndexOverride=1000] - The z-index of the modal.
|
|
149
|
-
* @param {boolean} [props.autoFocusFirstInput=true] - Whether to focus the first input when the modal opens.
|
|
150
|
-
* @param {string} [props.bodyClassName] - Additional CSS classes to apply to the modal body.
|
|
151
|
-
* @returns {React.ReactPortal|null} The rendered modal component or null if not open.
|
|
152
|
-
*/ function Modal() {
|
|
172
|
+
function Modal() {
|
|
153
173
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
154
|
-
var children = props.children, title = props.title, subtitle = props.subtitle, open = props.open, _props_hidden = props.hidden, hidden = _props_hidden === void 0 ? false : _props_hidden, onClose = props.onClose, sectioned = props.sectioned, primaryAction = props.primaryAction, secondaryAction = props.secondaryAction, _props_secondaryActions = props.secondaryActions, secondaryActions = _props_secondaryActions === void 0 ? [] : _props_secondaryActions, destructiveAction = props.destructiveAction, loading = props.loading, _props_size = props.size, size = _props_size === void 0 ? "default" : _props_size, leftAccessory = props.leftAccessory, _props_hideCloseButton = props.hideCloseButton, hideCloseButton = _props_hideCloseButton === void 0 ? false : _props_hideCloseButton, backAction = props.backAction, zIndexOverride = props.zIndexOverride, _props_autoFocusFirstInput = props.autoFocusFirstInput, autoFocusFirstInput = _props_autoFocusFirstInput === void 0 ? true : _props_autoFocusFirstInput, bodyClassName = props.bodyClassName;
|
|
174
|
+
var children = props.children, title = props.title, subtitle = props.subtitle, open = props.open, _props_hidden = props.hidden, hidden = _props_hidden === void 0 ? false : _props_hidden, onClose = props.onClose, sectioned = props.sectioned, primaryAction = props.primaryAction, secondaryAction = props.secondaryAction, _props_secondaryActions = props.secondaryActions, secondaryActions = _props_secondaryActions === void 0 ? [] : _props_secondaryActions, destructiveAction = props.destructiveAction, loading = props.loading, _props_size = props.size, size = _props_size === void 0 ? "default" : _props_size, leftAccessory = props.leftAccessory, _props_hideCloseButton = props.hideCloseButton, hideCloseButton = _props_hideCloseButton === void 0 ? false : _props_hideCloseButton, backAction = props.backAction, zIndexOverride = props.zIndexOverride, _props_autoFocusFirstInput = props.autoFocusFirstInput, autoFocusFirstInput = _props_autoFocusFirstInput === void 0 ? true : _props_autoFocusFirstInput, _props_pinToTop = props.pinToTop, pinToTop = _props_pinToTop === void 0 ? false : _props_pinToTop, bodyClassName = props.bodyClassName;
|
|
155
175
|
var setModalIsOpen = useFrame().setModalIsOpen;
|
|
156
176
|
var modalContentRef = useRef(null);
|
|
157
177
|
var hasChildren = !!children;
|
|
@@ -160,7 +180,8 @@ var sectionStyles = tv({
|
|
|
160
180
|
size: size
|
|
161
181
|
});
|
|
162
182
|
var containerClasses = containerStyles({
|
|
163
|
-
hidden: hidden
|
|
183
|
+
hidden: hidden,
|
|
184
|
+
pinToTop: pinToTop
|
|
164
185
|
});
|
|
165
186
|
var headerClasses = headerStyles({
|
|
166
187
|
hasChildren: hasChildren
|
|
@@ -170,7 +191,7 @@ var sectionStyles = tv({
|
|
|
170
191
|
var _useState = _sliced_to_array(useState(null), 2), container = _useState[0], setContainer = _useState[1];
|
|
171
192
|
useEffect(function() {
|
|
172
193
|
var div = document.createElement("div");
|
|
173
|
-
div.className = "@container Litho-ModalPortal";
|
|
194
|
+
div.className = "@container/main Litho-ModalPortal";
|
|
174
195
|
setContainer(div);
|
|
175
196
|
document.body.appendChild(div);
|
|
176
197
|
return function() {
|
|
@@ -313,6 +334,7 @@ var sectionStyles = tv({
|
|
|
313
334
|
onClick: primaryAction.onAction,
|
|
314
335
|
loading: primaryAction.loading,
|
|
315
336
|
disabled: primaryAction.disabled,
|
|
337
|
+
insight: primaryAction.insight,
|
|
316
338
|
destructive: primaryAction.destructive,
|
|
317
339
|
url: primaryAction.url,
|
|
318
340
|
tooltip: primaryAction.tooltip,
|
|
@@ -329,6 +351,7 @@ var sectionStyles = tv({
|
|
|
329
351
|
/*#__PURE__*/ _jsx("div", {
|
|
330
352
|
className: overlayClasses,
|
|
331
353
|
onClick: onClose,
|
|
354
|
+
"aria-hidden": "true",
|
|
332
355
|
style: zIndexOverride ? {
|
|
333
356
|
zIndex: zIndexOverride - 1
|
|
334
357
|
} : {}
|
|
@@ -337,19 +360,24 @@ var sectionStyles = tv({
|
|
|
337
360
|
}), container);
|
|
338
361
|
}
|
|
339
362
|
/**
|
|
340
|
-
*
|
|
363
|
+
* @component Modal.Section
|
|
364
|
+
*
|
|
365
|
+
* @usage
|
|
366
|
+
* - DO: Divide modal content into bordered sections for visual separation.
|
|
341
367
|
*
|
|
342
368
|
* @param {Object} props - The component props.
|
|
343
369
|
* @param {React.ReactNode} [props.children] - The content of the section.
|
|
344
370
|
* @param {boolean} [props.flush=false] - Whether the section should be flush with no padding.
|
|
371
|
+
* @param {string} [props.className] - Additional CSS classes to apply to the section.
|
|
345
372
|
* @returns {JSX.Element} The rendered section.
|
|
346
373
|
*/ function Section() {
|
|
347
374
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
348
|
-
var children = props.children, flush = props.flush, title = props.title, _props_titleVariant = props.titleVariant, titleVariant = _props_titleVariant === void 0 ? "headingSm" : _props_titleVariant, description = props.description, action = props.action, icon = props.icon, accessory = props.accessory, tooltip = props.tooltip;
|
|
375
|
+
var children = props.children, flush = props.flush, title = props.title, _props_titleVariant = props.titleVariant, titleVariant = _props_titleVariant === void 0 ? "headingSm" : _props_titleVariant, description = props.description, action = props.action, icon = props.icon, accessory = props.accessory, tooltip = props.tooltip, className = props.className;
|
|
349
376
|
var showHeader = !!(title || action);
|
|
350
377
|
var sectionClasses = sectionStyles({
|
|
351
378
|
flush: flush,
|
|
352
|
-
showHeader: showHeader
|
|
379
|
+
showHeader: showHeader,
|
|
380
|
+
className: className
|
|
353
381
|
});
|
|
354
382
|
return /*#__PURE__*/ _jsxs("div", {
|
|
355
383
|
className: sectionClasses,
|
|
@@ -26,6 +26,30 @@ function _object_spread(target) {
|
|
|
26
26
|
}
|
|
27
27
|
return target;
|
|
28
28
|
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
29
53
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
30
54
|
import React from "react";
|
|
31
55
|
import { tv } from "tailwind-variants";
|
|
@@ -34,7 +58,34 @@ import Icon from "./Icon.js";
|
|
|
34
58
|
import Text from "./Text.js";
|
|
35
59
|
import { ChevronLeftMinor, ChevronRightMinor, ExternalMinor } from "@shopify/polaris-icons";
|
|
36
60
|
import { useFrame } from "./Frame.js";
|
|
37
|
-
|
|
61
|
+
/**
|
|
62
|
+
* @component Navigation
|
|
63
|
+
*
|
|
64
|
+
* @description A sidebar navigation component that renders a vertical list of links and sections for primary app navigation within a Frame.
|
|
65
|
+
*
|
|
66
|
+
* @usage
|
|
67
|
+
* - DO: Use as the primary navigation sidebar within a Frame layout.
|
|
68
|
+
* - DON'T: Use for in-page content tabs (use Tabs).
|
|
69
|
+
*
|
|
70
|
+
* @accessibility
|
|
71
|
+
* - Renders as a `<nav>` element; ensure navigation items have descriptive labels.
|
|
72
|
+
*
|
|
73
|
+
* @alternative
|
|
74
|
+
* - If you need in-page tab switching, use `Tabs`. If you need a top bar, use `TopBar`.
|
|
75
|
+
*
|
|
76
|
+
* @param {Object} props - Component properties.
|
|
77
|
+
* @param {Object} [props.breadcrumb] - Breadcrumb navigation item.
|
|
78
|
+
* @param {string} [props.breadcrumb.content] - Label for the breadcrumb.
|
|
79
|
+
* @param {Function} [props.breadcrumb.onAction] - Callback for breadcrumb action.
|
|
80
|
+
* @param {Array<Object>} [props.sections] - Array of navigation sections.
|
|
81
|
+
* @param {Object} [props.sections[].title] - Section title configuration.
|
|
82
|
+
* @param {string} [props.sections[].title.label] - Title label.
|
|
83
|
+
* @param {boolean} [props.sections[].title.selected] - Whether the title is selected.
|
|
84
|
+
* @param {Function} [props.sections[].title.onAction] - Callback for title action.
|
|
85
|
+
* @param {Array<Object>} [props.sections[].links] - Array of link configurations for the section.
|
|
86
|
+
* @param {Array<Object>} [props.footerLinks] - Array of footer link configurations.
|
|
87
|
+
* @returns {JSX.Element} The rendered Navigation component.
|
|
88
|
+
*/ var styles = tv({
|
|
38
89
|
base: "Litho-Navigation h-full w-full pt-12 @md:pt-0 pr-2.5 pb-3 @md:pb-0 flex flex-col gap-2 justify-between bg-surface-normal"
|
|
39
90
|
});
|
|
40
91
|
var sectionStyles = tv({
|
|
@@ -51,24 +102,7 @@ var titleStyles = tv({
|
|
|
51
102
|
}
|
|
52
103
|
}
|
|
53
104
|
});
|
|
54
|
-
|
|
55
|
-
* Navigation component.
|
|
56
|
-
* A sidebar navigation component for displaying links, sections, and footer links.
|
|
57
|
-
*
|
|
58
|
-
* @component
|
|
59
|
-
* @param {Object} props - Component properties.
|
|
60
|
-
* @param {Object} [props.breadcrumb] - Breadcrumb navigation item.
|
|
61
|
-
* @param {string} [props.breadcrumb.content] - Label for the breadcrumb.
|
|
62
|
-
* @param {Function} [props.breadcrumb.onAction] - Callback for breadcrumb action.
|
|
63
|
-
* @param {Array<Object>} [props.sections] - Array of navigation sections.
|
|
64
|
-
* @param {Object} [props.sections[].title] - Section title configuration.
|
|
65
|
-
* @param {string} [props.sections[].title.label] - Title label.
|
|
66
|
-
* @param {boolean} [props.sections[].title.selected] - Whether the title is selected.
|
|
67
|
-
* @param {Function} [props.sections[].title.onAction] - Callback for title action.
|
|
68
|
-
* @param {Array<Object>} [props.sections[].links] - Array of link configurations for the section.
|
|
69
|
-
* @param {Array<Object>} [props.footerLinks] - Array of footer link configurations.
|
|
70
|
-
* @returns {JSX.Element} The rendered Navigation component.
|
|
71
|
-
*/ function Navigation() {
|
|
105
|
+
function Navigation() {
|
|
72
106
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
73
107
|
var breadcrumb = props.breadcrumb, sections = props.sections, footerLinks = props.footerLinks;
|
|
74
108
|
var setShowMobileNavigation = useFrame().setShowMobileNavigation;
|
|
@@ -90,7 +124,7 @@ var titleStyles = tv({
|
|
|
90
124
|
})
|
|
91
125
|
}),
|
|
92
126
|
sections && sections.map(function(section, index) {
|
|
93
|
-
var _section_title, _section_title1;
|
|
127
|
+
var _section_title, _section_title1, _section_title2;
|
|
94
128
|
if (!section.links) return null;
|
|
95
129
|
var titleClasses = titleStyles({
|
|
96
130
|
selected: (_section_title = section.title) === null || _section_title === void 0 ? void 0 : _section_title.selected,
|
|
@@ -106,17 +140,34 @@ var titleStyles = tv({
|
|
|
106
140
|
return /*#__PURE__*/ _jsxs("div", {
|
|
107
141
|
className: sectionClasses,
|
|
108
142
|
children: [
|
|
109
|
-
section.title && /*#__PURE__*/
|
|
143
|
+
section.title && /*#__PURE__*/ _jsxs("div", _object_spread_props(_object_spread({
|
|
110
144
|
className: titleClasses,
|
|
111
|
-
onClick: handleTitleClick
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
145
|
+
onClick: handleTitleClick
|
|
146
|
+
}, ((_section_title2 = section.title) === null || _section_title2 === void 0 ? void 0 : _section_title2.onAction) ? {
|
|
147
|
+
role: "button",
|
|
148
|
+
tabIndex: 0,
|
|
149
|
+
onKeyDown: function(e) {
|
|
150
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
handleTitleClick();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} : {}), {
|
|
156
|
+
children: [
|
|
157
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
158
|
+
color: section.title.selected ? "link" : "normal",
|
|
159
|
+
fontWeight: "medium",
|
|
160
|
+
variant: "bodySm",
|
|
161
|
+
truncate: true,
|
|
162
|
+
children: section.title.label
|
|
163
|
+
}),
|
|
164
|
+
section.title.onAction && /*#__PURE__*/ _jsx(Icon, {
|
|
165
|
+
source: ChevronRightMinor,
|
|
166
|
+
color: "subdued",
|
|
167
|
+
className: "opacity-50"
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
})),
|
|
120
171
|
section.links.map(function(link, index) {
|
|
121
172
|
return /*#__PURE__*/ _jsx(Navigation.Link, _object_spread({}, link), "navigation-link-".concat(index));
|
|
122
173
|
})
|
|
@@ -206,9 +257,19 @@ var linkStyles = tv({
|
|
|
206
257
|
showDividerAbove && /*#__PURE__*/ _jsx("div", {
|
|
207
258
|
className: "h-px w-full bg-tint-3 dark:bg-tint-alt-3 my-3"
|
|
208
259
|
}),
|
|
209
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
260
|
+
/*#__PURE__*/ _jsxs("div", _object_spread_props(_object_spread({
|
|
210
261
|
className: linkClasses,
|
|
211
|
-
onClick: handleClick
|
|
262
|
+
onClick: handleClick
|
|
263
|
+
}, onAction ? {
|
|
264
|
+
role: "link",
|
|
265
|
+
tabIndex: 0,
|
|
266
|
+
onKeyDown: function(e) {
|
|
267
|
+
if (e.key === "Enter") {
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
handleClick();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
} : {}), {
|
|
212
273
|
children: [
|
|
213
274
|
/*#__PURE__*/ _jsxs("div", {
|
|
214
275
|
className: "flex items-center gap-2 truncate",
|
|
@@ -238,7 +299,7 @@ var linkStyles = tv({
|
|
|
238
299
|
className: "opacity-50"
|
|
239
300
|
}) : accessory ? accessory : null
|
|
240
301
|
]
|
|
241
|
-
}),
|
|
302
|
+
})),
|
|
242
303
|
(expanded || selected || subLinkIsSelected || grandChildLinkIsSelected) && !disclosure && subLinks && /*#__PURE__*/ _jsx("div", {
|
|
243
304
|
className: "flex flex-col mb-3",
|
|
244
305
|
children: subLinks.map(function(subLink, index) {
|
|
@@ -296,9 +357,19 @@ var subLinkStyles = tv({
|
|
|
296
357
|
setShowMobileNavigation(false);
|
|
297
358
|
}
|
|
298
359
|
};
|
|
299
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
360
|
+
return /*#__PURE__*/ _jsxs("div", _object_spread_props(_object_spread({
|
|
300
361
|
className: subLinkClasses,
|
|
301
|
-
onClick: handleClick
|
|
362
|
+
onClick: handleClick
|
|
363
|
+
}, onAction ? {
|
|
364
|
+
role: "link",
|
|
365
|
+
tabIndex: 0,
|
|
366
|
+
onKeyDown: function(e) {
|
|
367
|
+
if (e.key === "Enter") {
|
|
368
|
+
e.preventDefault();
|
|
369
|
+
handleClick();
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
} : {}), {
|
|
302
373
|
children: [
|
|
303
374
|
/*#__PURE__*/ _jsxs("div", {
|
|
304
375
|
className: "flex items-center gap-2",
|
|
@@ -321,7 +392,7 @@ var subLinkStyles = tv({
|
|
|
321
392
|
})),
|
|
322
393
|
accessory
|
|
323
394
|
]
|
|
324
|
-
});
|
|
395
|
+
}));
|
|
325
396
|
}
|
|
326
397
|
Navigation.SubLink = SubLink;
|
|
327
398
|
export default Navigation;
|
|
@@ -106,7 +106,46 @@ import Popover from "./Popover.js";
|
|
|
106
106
|
import ActionList from "./ActionList.js";
|
|
107
107
|
import { ArrowLeftMinor, MobileHorizontalDotsMajor } from "@shopify/polaris-icons";
|
|
108
108
|
import { useFrame } from "./Frame.js";
|
|
109
|
-
|
|
109
|
+
/**
|
|
110
|
+
* @component Page
|
|
111
|
+
*
|
|
112
|
+
* @description A top-level page container that renders a title bar with heading, breadcrumbs, actions, and a content area.
|
|
113
|
+
*
|
|
114
|
+
* @usage
|
|
115
|
+
* - DO: Use as the root container for each page view with title and primary/secondary actions.
|
|
116
|
+
* - DON'T: Nest Page inside another Page.
|
|
117
|
+
*
|
|
118
|
+
* @accessibility
|
|
119
|
+
* - Page title renders as the main heading; ensure it accurately describes the page content.
|
|
120
|
+
*
|
|
121
|
+
* @alternative
|
|
122
|
+
* - If you need a simple container without page-level chrome, use `Card` or `Layout`.
|
|
123
|
+
*
|
|
124
|
+
* @param {Object} props - Props for the component.
|
|
125
|
+
* @param {string|React.ReactNode} props.title - The title of the page. Can be a string or React element.
|
|
126
|
+
* @param {string|React.ReactNode} props.subtitle - The subtitle of the page. Can be a string or React element.
|
|
127
|
+
* @param {Object} [props.backAction] - Configuration for the back action button.
|
|
128
|
+
* @param {Function} [props.backAction.onAction] - Callback when the back action is triggered.
|
|
129
|
+
* @param {string} [props.backAction.accessibilityLabel] - Accessibility label for the back action button.
|
|
130
|
+
* @param {boolean} [props.narrowWidth=false] - Whether to use a narrow width layout.
|
|
131
|
+
* @param {boolean} [props.fullWidth=false] - Whether to use a full-width layout.
|
|
132
|
+
* @param {boolean} [props.showTitleInTopBar=true] - Whether to show the title in the top bar area.
|
|
133
|
+
* @param {boolean} [props.wrapInContentContainer=true] - Whether to wrap the content in a container with padding.
|
|
134
|
+
* @param {Object} [props.primaryAction] - Configuration for the primary action button.
|
|
135
|
+
* @param {Function} [props.primaryAction.onAction] - Callback when the primary action is triggered.
|
|
136
|
+
* @param {boolean} [props.primaryAction.loading] - Whether the primary action button is in a loading state.
|
|
137
|
+
* @param {boolean} [props.primaryAction.disabled] - Whether the primary action button is disabled.
|
|
138
|
+
* @param {boolean} [props.primaryAction.destructive] - Whether the primary action button is styled as destructive.
|
|
139
|
+
* @param {string} [props.primaryAction.tooltip] - Tooltip to show when hovering over the primary action button.
|
|
140
|
+
* @param {React.ReactNode} [props.primaryAction.content="Save"] - Content for the primary action button.
|
|
141
|
+
* @param {Object[]} [props.secondaryActions=[]] - List of secondary actions.
|
|
142
|
+
* @param {string} [props.moreActionsLabel="Actions"] - Label for the "More Actions" button in mobile view.
|
|
143
|
+
* @param {React.ReactNode} [props.titleMetadata] - Metadata displayed alongside the title.
|
|
144
|
+
* @param {React.ReactNode} [props.children] - Content for the main section of the page.
|
|
145
|
+
* @param {Object} [props.footerActions] - Configuration for the footer actions.
|
|
146
|
+
* @param {string} [props.className] - Additional CSS classes for the Page.
|
|
147
|
+
* @returns {React.ReactElement} Rendered Page component.
|
|
148
|
+
*/ var styles = tv({
|
|
110
149
|
base: "Litho-Page w-full mx-auto",
|
|
111
150
|
variants: {
|
|
112
151
|
narrowWidth: {
|
|
@@ -178,36 +217,7 @@ var contentStyles = tv({
|
|
|
178
217
|
wrapInContentContainer: true
|
|
179
218
|
}
|
|
180
219
|
});
|
|
181
|
-
|
|
182
|
-
* Page component that provides a structured layout with a header, primary and secondary actions, and content.
|
|
183
|
-
*
|
|
184
|
-
* @component
|
|
185
|
-
*
|
|
186
|
-
* @param {Object} props - Props for the component.
|
|
187
|
-
* @param {string|React.ReactNode} props.title - The title of the page. Can be a string or React element.
|
|
188
|
-
* @param {string|React.ReactNode} props.subtitle - The subtitle of the page. Can be a string or React element.
|
|
189
|
-
* @param {Object} [props.backAction] - Configuration for the back action button.
|
|
190
|
-
* @param {Function} [props.backAction.onAction] - Callback when the back action is triggered.
|
|
191
|
-
* @param {string} [props.backAction.accessibilityLabel] - Accessibility label for the back action button.
|
|
192
|
-
* @param {boolean} [props.narrowWidth=false] - Whether to use a narrow width layout.
|
|
193
|
-
* @param {boolean} [props.fullWidth=false] - Whether to use a full-width layout.
|
|
194
|
-
* @param {boolean} [props.showTitleInTopBar=true] - Whether to show the title in the top bar area.
|
|
195
|
-
* @param {boolean} [props.wrapInContentContainer=true] - Whether to wrap the content in a container with padding.
|
|
196
|
-
* @param {Object} [props.primaryAction] - Configuration for the primary action button.
|
|
197
|
-
* @param {Function} [props.primaryAction.onAction] - Callback when the primary action is triggered.
|
|
198
|
-
* @param {boolean} [props.primaryAction.loading] - Whether the primary action button is in a loading state.
|
|
199
|
-
* @param {boolean} [props.primaryAction.disabled] - Whether the primary action button is disabled.
|
|
200
|
-
* @param {boolean} [props.primaryAction.destructive] - Whether the primary action button is styled as destructive.
|
|
201
|
-
* @param {string} [props.primaryAction.tooltip] - Tooltip to show when hovering over the primary action button.
|
|
202
|
-
* @param {React.ReactNode} [props.primaryAction.content="Save"] - Content for the primary action button.
|
|
203
|
-
* @param {Object[]} [props.secondaryActions=[]] - List of secondary actions.
|
|
204
|
-
* @param {string} [props.moreActionsLabel="Actions"] - Label for the "More Actions" button in mobile view.
|
|
205
|
-
* @param {React.ReactNode} [props.titleMetadata] - Metadata displayed alongside the title.
|
|
206
|
-
* @param {React.ReactNode} [props.children] - Content for the main section of the page.
|
|
207
|
-
* @param {Object} [props.footerActions] - Configuration for the footer actions.
|
|
208
|
-
* @param {string} [props.className] - Additional CSS classes for the Page.
|
|
209
|
-
* @returns {React.ReactElement} Rendered Page component.
|
|
210
|
-
*/ function Page() {
|
|
220
|
+
function Page() {
|
|
211
221
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
212
222
|
var title = props.title, subtitle = props.subtitle, _props_showTitleInTopBar = props.showTitleInTopBar, showTitleInTopBar = _props_showTitleInTopBar === void 0 ? true : _props_showTitleInTopBar, tmp = props.backAction, _backAction = tmp === void 0 ? null : tmp, children = props.children, narrowWidth = props.narrowWidth, fullWidth = props.fullWidth, primaryAction = props.primaryAction, _props_secondaryActions = props.secondaryActions, secondaryActions = _props_secondaryActions === void 0 ? [] : _props_secondaryActions, titleMetadata = props.titleMetadata, _props_moreActionsLabel = props.moreActionsLabel, moreActionsLabel = _props_moreActionsLabel === void 0 ? "Actions" : _props_moreActionsLabel, _props_wrapInContentContainer = props.wrapInContentContainer, wrapInContentContainer = _props_wrapInContentContainer === void 0 ? true : _props_wrapInContentContainer, footerActions = props.footerActions, className = props.className;
|
|
213
223
|
var paneIsOpen = useFrame().paneIsOpen;
|
|
@@ -368,6 +378,7 @@ var contentStyles = tv({
|
|
|
368
378
|
disclosure: true,
|
|
369
379
|
insight: action.insight,
|
|
370
380
|
icon: action.icon,
|
|
381
|
+
pressed: action.pressed,
|
|
371
382
|
onClick: function() {
|
|
372
383
|
return togglePopover(index);
|
|
373
384
|
},
|
|
@@ -384,6 +395,7 @@ var contentStyles = tv({
|
|
|
384
395
|
return /*#__PURE__*/ _jsx(Button, {
|
|
385
396
|
plain: !action.destructive && !action.insight,
|
|
386
397
|
onClick: action.onAction || action.onClick,
|
|
398
|
+
pressed: action.pressed,
|
|
387
399
|
disabled: action.disabled,
|
|
388
400
|
icon: action.icon,
|
|
389
401
|
loading: action.loading,
|
|
@@ -406,6 +418,7 @@ var contentStyles = tv({
|
|
|
406
418
|
url: primaryAction.url,
|
|
407
419
|
loading: primaryAction.loading,
|
|
408
420
|
disabled: primaryAction.disabled,
|
|
421
|
+
pressed: primaryAction.pressed,
|
|
409
422
|
destructive: primaryAction.destructive,
|
|
410
423
|
tooltip: primaryAction.tooltip,
|
|
411
424
|
connectedDisclosure: primaryAction.connectedDisclosure,
|