@heymantle/litho 0.0.14 → 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/README.md +52 -0
- 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 +57 -13
- package/dist/cjs/components/Divider.js +82 -18
- package/dist/cjs/components/DropZone.js +194 -68
- 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 +37 -26
- 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 +32 -39
- 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 +63 -30
- 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 +85 -29
- package/dist/cjs/components/Tabs.js +84 -24
- 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/playwright.config.js +114 -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/cjs/styles/Table.js +2 -7
- package/dist/cjs/tests/visual/stories.spec.js +637 -0
- package/dist/cjs/utilities/dates.js +7 -7
- 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 +50 -6
- package/dist/esm/components/Divider.js +78 -20
- package/dist/esm/components/DropZone.js +194 -68
- 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 +62 -27
- 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 +79 -40
- 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 +63 -30
- 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 +85 -29
- package/dist/esm/components/Tabs.js +84 -24
- 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/playwright.config.js +104 -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/esm/styles/Table.js +2 -7
- package/dist/esm/tests/visual/stories.spec.js +633 -0
- package/dist/esm/utilities/dates.js +7 -7
- 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 +3 -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 -35
- 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 +40 -34
- 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/dist/types/styles/Table.d.ts.map +1 -1
- package/index.css +76 -14
- package/package.json +15 -5
|
@@ -55,7 +55,78 @@ import InlineError from "./InlineError.js";
|
|
|
55
55
|
import Label from "./Label.js";
|
|
56
56
|
import Link from "./Link.js";
|
|
57
57
|
import Text from "./Text.js";
|
|
58
|
-
|
|
58
|
+
/**
|
|
59
|
+
* @component TextField
|
|
60
|
+
*
|
|
61
|
+
* @description A text input component with label, help text, error handling, prefix/suffix, and character count support.
|
|
62
|
+
*
|
|
63
|
+
* @usage
|
|
64
|
+
* - DO: Use for single-line or multi-line text input with built-in labeling and validation.
|
|
65
|
+
* - DON'T: Use for selection from a fixed list (use Select or Autocomplete).
|
|
66
|
+
*
|
|
67
|
+
* @accessibility
|
|
68
|
+
* - Always provide a `label` prop; the label is programmatically associated with the input via `htmlFor`.
|
|
69
|
+
*
|
|
70
|
+
* @alternative
|
|
71
|
+
* - If you need a dropdown selection, use `Select`. If you need searchable selection, use `Autocomplete`.
|
|
72
|
+
*
|
|
73
|
+
* @param {Object} props - The properties for the TextField component.
|
|
74
|
+
* @param {string} [props.prefix] - Text content to display before the input.
|
|
75
|
+
* @param {string} [props.suffix] - Text content to display after the input.
|
|
76
|
+
* @param {string} [props.placeholder] - Placeholder text for the input.
|
|
77
|
+
* @param {string} [props.value=''] - The current value of the input.
|
|
78
|
+
* @param {string} [props.helpText] - Helper text to display below the input.
|
|
79
|
+
* @param {string} [props.label] - Label text for the input field.
|
|
80
|
+
* @param {string} [props.labelVariant='bodyMd'] - Visual variant for the label text.
|
|
81
|
+
* @param {Object} [props.labelAction] - Action button to display next to the label.
|
|
82
|
+
* @param {boolean} [props.labelHidden] - Whether to visually hide the label.
|
|
83
|
+
* @param {boolean} [props.disabled=false] - Whether the input is disabled. Defaults to false.
|
|
84
|
+
* @param {boolean} [props.clearButton] - Whether to show a clear button.
|
|
85
|
+
* @param {boolean} [props.readOnly] - Whether the input is read-only.
|
|
86
|
+
* @param {boolean} [props.autoFocus] - Whether to focus the input on mount.
|
|
87
|
+
* @param {boolean} [props.focused] - Whether the input is focused.
|
|
88
|
+
* @param {number} [props.multiline=1] - Number of lines for multiline input (1 for single line). Defaults to 1.
|
|
89
|
+
* @param {boolean} [props.autoGrow=false] - Whether textarea should automatically grow with content. Only applies when multiline > 1.
|
|
90
|
+
* @param {number} [props.maxHeight] - Maximum height in pixels before scrolling starts. Only applies when autoGrow is true.
|
|
91
|
+
* @param {string} [props.error] - Error message to display.
|
|
92
|
+
* @param {ReactNode} [props.connectedRight] - React element to connect to the right of the input.
|
|
93
|
+
* @param {ReactNode} [props.connectedLeft] - React element to connect to the left of the input.
|
|
94
|
+
* @param {string} [props.type='text'] - HTML input type. Defaults to 'text'.
|
|
95
|
+
* @param {boolean} [props.subdued=false] - Whether to use subdued styling.
|
|
96
|
+
* @param {string} [props.name] - Name attribute for the input.
|
|
97
|
+
* @param {string} [props.id] - ID for the input element.
|
|
98
|
+
* @param {string} [props.role] - ARIA role.
|
|
99
|
+
* @param {number} [props.step] - Step value for number inputs.
|
|
100
|
+
* @param {number} [props.largeStep=10] - Large step value when using shift + arrows.
|
|
101
|
+
* @param {string} [props.autoComplete] - HTML autocomplete attribute.
|
|
102
|
+
* @param {number} [props.max] - Maximum value for number inputs.
|
|
103
|
+
* @param {number} [props.maxLength] - Maximum length for text input.
|
|
104
|
+
* @param {number} [props.min] - Minimum value for number inputs.
|
|
105
|
+
* @param {number} [props.minLength] - Minimum length for text input.
|
|
106
|
+
* @param {string} [props.pattern] - Input validation pattern.
|
|
107
|
+
* @param {boolean} [props.spellCheck] - Whether to enable spell checking.
|
|
108
|
+
* @param {string} [props.ariaOwns] - ARIA owns attribute.
|
|
109
|
+
* @param {string} [props.ariaControls] - ARIA controls attribute.
|
|
110
|
+
* @param {boolean} [props.ariaExpanded] - ARIA expanded attribute.
|
|
111
|
+
* @param {string} [props.ariaActiveDescendant] - ARIA active descendant attribute.
|
|
112
|
+
* @param {string} [props.ariaAutocomplete] - ARIA autocomplete attribute.
|
|
113
|
+
* @param {('left'|'center'|'right')} [props.align='left'] - Text alignment within the input.
|
|
114
|
+
* @param {boolean} [props.requiredIndicator] - Whether to show a required field indicator.
|
|
115
|
+
* @param {boolean} [props.selectTextOnFocus] - Whether to select all text when focused.
|
|
116
|
+
* @param {Function} [props.onClearButtonClick] - Handler for clear button click.
|
|
117
|
+
* @param {Function} [props.onChange] - Handler for value changes.
|
|
118
|
+
* @param {Function} [props.onFocus] - Handler for input focus.
|
|
119
|
+
* @param {Function} [props.onBlur] - Handler for input blur.
|
|
120
|
+
* @param {Function} [props.onKeyDown] - Handler for key down.
|
|
121
|
+
* @param {ReactNode} [props.tooltip] - Tooltip content for the label.
|
|
122
|
+
* @param {string} [props.className] - Additional CSS classes.
|
|
123
|
+
* @param {string} [props.containerClassName] - Additional CSS classes for the outer container (Litho-TextFieldContainer).
|
|
124
|
+
* @param {ReactNode} [props.icon] - Icon to display before the input.
|
|
125
|
+
* @param {string} [props.iconColor='subdued'] - Color of the icon. Defaults to 'subdued'.
|
|
126
|
+
* @param {boolean} [props.disableFocusStyles=false] - Whether to disable focused styles when the input is focused.
|
|
127
|
+
* @param {boolean} [props.insight=false] - Whether to use insight/AI styling with insight-alt background, border, and text colors.
|
|
128
|
+
* @returns {JSX.Element} The rendered TextField component.
|
|
129
|
+
*/ var styles = tv({
|
|
59
130
|
base: "Litho-TextField group relative rounded-md border min-h-8 cursor-text",
|
|
60
131
|
variants: {
|
|
61
132
|
disabled: {
|
|
@@ -72,6 +143,10 @@ var styles = tv({
|
|
|
72
143
|
transparent: {
|
|
73
144
|
true: "border-transparent",
|
|
74
145
|
false: ""
|
|
146
|
+
},
|
|
147
|
+
insight: {
|
|
148
|
+
true: "",
|
|
149
|
+
false: ""
|
|
75
150
|
}
|
|
76
151
|
},
|
|
77
152
|
compoundVariants: [
|
|
@@ -119,12 +194,27 @@ var styles = tv({
|
|
|
119
194
|
hasError: false,
|
|
120
195
|
subdued: true,
|
|
121
196
|
class: "bg-form-bg"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
focused: false,
|
|
200
|
+
disabled: false,
|
|
201
|
+
hasError: false,
|
|
202
|
+
insight: true,
|
|
203
|
+
class: "bg-form-bg-insight border-form-border-insight"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
focused: true,
|
|
207
|
+
disabled: false,
|
|
208
|
+
hasError: false,
|
|
209
|
+
insight: true,
|
|
210
|
+
class: "bg-form-bg-insight-low border-form-border-insight ring ring-form-focus-insight"
|
|
122
211
|
}
|
|
123
212
|
],
|
|
124
213
|
defaultVariants: {
|
|
125
214
|
disabled: false,
|
|
126
215
|
hasError: false,
|
|
127
|
-
focused: false
|
|
216
|
+
focused: false,
|
|
217
|
+
insight: false
|
|
128
218
|
}
|
|
129
219
|
});
|
|
130
220
|
var inputStyles = tv({
|
|
@@ -155,13 +245,23 @@ var inputStyles = tv({
|
|
|
155
245
|
true: "placeholder-form-placeholder-error",
|
|
156
246
|
false: "placeholder-form-placeholder"
|
|
157
247
|
},
|
|
248
|
+
insight: {
|
|
249
|
+
true: "text-insight-alt-fg placeholder-insight-alt-fg/50",
|
|
250
|
+
false: ""
|
|
251
|
+
},
|
|
158
252
|
type: {
|
|
159
253
|
time: "hide-time-picker"
|
|
160
254
|
}
|
|
161
255
|
}
|
|
162
256
|
});
|
|
163
257
|
var iconStyles = tv({
|
|
164
|
-
base: "Litho-TextField__Icon pl-0.5"
|
|
258
|
+
base: "Litho-TextField__Icon pl-0.5",
|
|
259
|
+
variants: {
|
|
260
|
+
hasMultiline: {
|
|
261
|
+
true: "self-start pt-1",
|
|
262
|
+
false: ""
|
|
263
|
+
}
|
|
264
|
+
}
|
|
165
265
|
});
|
|
166
266
|
var clearButtonStyles = tv({
|
|
167
267
|
base: "Litho-TextField__ClearButton mr-1 rounded-md h-6 w-6 flex self-center items-center justify-center cursor-pointer bg-btn-outline hover:bg-btn-outline-low active:bg-btn-outline-lower",
|
|
@@ -172,65 +272,11 @@ var clearButtonStyles = tv({
|
|
|
172
272
|
}
|
|
173
273
|
}
|
|
174
274
|
});
|
|
175
|
-
|
|
176
|
-
* Renders a TextField component.
|
|
177
|
-
*
|
|
178
|
-
* @function TextField
|
|
179
|
-
* @param {Object} props - The properties for the TextField component.
|
|
180
|
-
* @param {string} [props.prefix] - Text content to display before the input.
|
|
181
|
-
* @param {string} [props.suffix] - Text content to display after the input.
|
|
182
|
-
* @param {string} [props.placeholder] - Placeholder text for the input.
|
|
183
|
-
* @param {string} [props.value=''] - The current value of the input.
|
|
184
|
-
* @param {string} [props.helpText] - Helper text to display below the input.
|
|
185
|
-
* @param {string} [props.label] - Label text for the input field.
|
|
186
|
-
* @param {string} [props.labelVariant='bodyMd'] - Visual variant for the label text.
|
|
187
|
-
* @param {Object} [props.labelAction] - Action button to display next to the label.
|
|
188
|
-
* @param {boolean} [props.labelHidden] - Whether to visually hide the label.
|
|
189
|
-
* @param {boolean} [props.disabled=false] - Whether the input is disabled. Defaults to false.
|
|
190
|
-
* @param {boolean} [props.clearButton] - Whether to show a clear button.
|
|
191
|
-
* @param {boolean} [props.readOnly] - Whether the input is read-only.
|
|
192
|
-
* @param {boolean} [props.autoFocus] - Whether to focus the input on mount.
|
|
193
|
-
* @param {boolean} [props.focused] - Whether the input is focused.
|
|
194
|
-
* @param {number} [props.multiline=1] - Number of lines for multiline input (1 for single line). Defaults to 1.
|
|
195
|
-
* @param {boolean} [props.autoGrow=false] - Whether textarea should automatically grow with content. Only applies when multiline > 1.
|
|
196
|
-
* @param {number} [props.maxHeight] - Maximum height in pixels before scrolling starts. Only applies when autoGrow is true.
|
|
197
|
-
* @param {string} [props.error] - Error message to display.
|
|
198
|
-
* @param {ReactNode} [props.connectedRight] - React element to connect to the right of the input.
|
|
199
|
-
* @param {ReactNode} [props.connectedLeft] - React element to connect to the left of the input.
|
|
200
|
-
* @param {string} [props.type='text'] - HTML input type. Defaults to 'text'.
|
|
201
|
-
* @param {boolean} [props.subdued=false] - Whether to use subdued styling.
|
|
202
|
-
* @param {string} [props.name] - Name attribute for the input.
|
|
203
|
-
* @param {string} [props.id] - ID for the input element.
|
|
204
|
-
* @param {string} [props.role] - ARIA role.
|
|
205
|
-
* @param {number} [props.step] - Step value for number inputs.
|
|
206
|
-
* @param {number} [props.largeStep=10] - Large step value when using shift + arrows.
|
|
207
|
-
* @param {string} [props.autoComplete] - HTML autocomplete attribute.
|
|
208
|
-
* @param {number} [props.max] - Maximum value for number inputs.
|
|
209
|
-
* @param {number} [props.maxLength] - Maximum length for text input.
|
|
210
|
-
* @param {number} [props.min] - Minimum value for number inputs.
|
|
211
|
-
* @param {number} [props.minLength] - Minimum length for text input.
|
|
212
|
-
* @param {string} [props.pattern] - Input validation pattern.
|
|
213
|
-
* @param {boolean} [props.spellCheck] - Whether to enable spell checking.
|
|
214
|
-
* @param {string} [props.ariaOwns] - ARIA owns attribute.
|
|
215
|
-
* @param {string} [props.ariaControls] - ARIA controls attribute.
|
|
216
|
-
* @param {boolean} [props.ariaExpanded] - ARIA expanded attribute.
|
|
217
|
-
* @param {string} [props.ariaActiveDescendant] - ARIA active descendant attribute.
|
|
218
|
-
* @param {string} [props.ariaAutocomplete] - ARIA autocomplete attribute.
|
|
219
|
-
* @param {('left'|'center'|'right')} [props.align='left'] - Text alignment within the input.
|
|
220
|
-
* @param {boolean} [props.requiredIndicator] - Whether to show a required field indicator.
|
|
221
|
-
* @param {boolean} [props.selectTextOnFocus] - Whether to select all text when focused.
|
|
222
|
-
* @param {Function} [props.onClearButtonClick] - Handler for clear button click.
|
|
223
|
-
* @param {Function} [props.onChange] - Handler for value changes.
|
|
224
|
-
* @param {Function} [props.onFocus] - Handler for input focus.
|
|
225
|
-
* @param {Function} [props.onBlur] - Handler for input blur.
|
|
226
|
-
* @param {Function} [props.onKeyDown] - Handler for key down.
|
|
227
|
-
* @param {ReactNode} [props.tooltip] - Tooltip content for the label.
|
|
228
|
-
* @param {string} [props.className] - Additional CSS classes.
|
|
229
|
-
* @param {boolean} [props.disableFocusStyles=false] - Whether to disable focused styles when the input is focused.
|
|
230
|
-
* @returns {JSX.Element} The rendered TextField component.
|
|
231
|
-
*/ function TextField() {
|
|
275
|
+
function TextField() {
|
|
232
276
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
233
|
-
var prefix = props.prefix, _suffix = props.suffix, placeholder = props.placeholder, _props_value = props.value, value = _props_value === void 0 ? "" : _props_value, helpText = props.helpText, label = props.label, _props_labelVariant = props.labelVariant, labelVariant = _props_labelVariant === void 0 ? "bodyMd" : _props_labelVariant, labelAction = props.labelAction, labelHidden = props.labelHidden, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, clearButton = props.clearButton, readOnly = props.readOnly, autoFocus = props.autoFocus, _focused = props.focused, _props_multiline = props.multiline, multiline = _props_multiline === void 0 ? 1 : _props_multiline, _props_autoGrow = props.autoGrow, autoGrow = _props_autoGrow === void 0 ? false : _props_autoGrow, maxHeight = props.maxHeight, error = props.error, connectedRight = props.connectedRight, connectedLeft = props.connectedLeft, _props_type = props.type, type = _props_type === void 0 ? "text" : _props_type, _props_subdued = props.subdued, subdued = _props_subdued === void 0 ? false : _props_subdued, name = props.name, _id = props.id, role = props.role, step = props.step, _props_largeStep = props.largeStep, largeStep = _props_largeStep === void 0 ? 10 : _props_largeStep, autoComplete = props.autoComplete, max = props.max, maxLength = props.maxLength, min = props.min, minLength = props.minLength, _props_showCharacterCount = props.showCharacterCount, showCharacterCount = _props_showCharacterCount === void 0 ? false : _props_showCharacterCount, pattern = props.pattern, spellCheck = props.spellCheck, ariaOwns = props.ariaOwns, ariaControls = props.ariaControls, ariaExpanded = props.ariaExpanded, ariaActiveDescendant = props.ariaActiveDescendant, ariaAutocomplete = props.ariaAutocomplete, _props_align = props.align, align = _props_align === void 0 ? "left" : _props_align, requiredIndicator = props.requiredIndicator, selectTextOnFocus = props.selectTextOnFocus, onClearButtonClick = props.onClearButtonClick, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, tooltip = props.tooltip, className = props.className, _inputRef = props.inputRef, icon = props.icon, _props_transparent = props.transparent, transparent = _props_transparent === void 0 ? false : _props_transparent, _props_showNumberSteppers = props.showNumberSteppers, showNumberSteppers = _props_showNumberSteppers === void 0 ? true : _props_showNumberSteppers, onKeyDown = props.onKeyDown, _props_disableFocusStyles = props.disableFocusStyles, disableFocusStyles = _props_disableFocusStyles === void 0 ? false : _props_disableFocusStyles;
|
|
277
|
+
var prefix = props.prefix, _suffix = props.suffix, placeholder = props.placeholder, _props_value = props.value, value = _props_value === void 0 ? "" : _props_value, helpText = props.helpText, label = props.label, _props_labelVariant = props.labelVariant, labelVariant = _props_labelVariant === void 0 ? "bodyMd" : _props_labelVariant, labelAction = props.labelAction, labelHidden = props.labelHidden, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, clearButton = props.clearButton, readOnly = props.readOnly, autoFocus = props.autoFocus, _focused = props.focused, _props_multiline = props.multiline, multiline = _props_multiline === void 0 ? 1 : _props_multiline, _props_autoGrow = props.autoGrow, autoGrow = _props_autoGrow === void 0 ? false : _props_autoGrow, maxHeight = props.maxHeight, error = props.error, connectedRight = props.connectedRight, connectedLeft = props.connectedLeft, _props_type = props.type, type = _props_type === void 0 ? "text" : _props_type, _props_subdued = props.subdued, subdued = _props_subdued === void 0 ? false : _props_subdued, name = props.name, _id = props.id, role = props.role, step = props.step, _props_largeStep = props.largeStep, largeStep = _props_largeStep === void 0 ? 10 : _props_largeStep, autoComplete = props.autoComplete, max = props.max, maxLength = props.maxLength, min = props.min, minLength = props.minLength, _props_showCharacterCount = props.showCharacterCount, showCharacterCount = _props_showCharacterCount === void 0 ? false : _props_showCharacterCount, pattern = props.pattern, spellCheck = props.spellCheck, ariaOwns = props.ariaOwns, ariaControls = props.ariaControls, ariaExpanded = props.ariaExpanded, ariaActiveDescendant = props.ariaActiveDescendant, ariaAutocomplete = props.ariaAutocomplete, _props_align = props.align, align = _props_align === void 0 ? "left" : _props_align, requiredIndicator = props.requiredIndicator, selectTextOnFocus = props.selectTextOnFocus, onClearButtonClick = props.onClearButtonClick, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, tooltip = props.tooltip, className = props.className, containerClassName = props.containerClassName, _inputRef = props.inputRef, icon = props.icon, _iconColor = props.iconColor, _props_transparent = props.transparent, transparent = _props_transparent === void 0 ? false : _props_transparent, _props_insight = props.insight, insight = _props_insight === void 0 ? false : _props_insight, _props_showNumberSteppers = props.showNumberSteppers, showNumberSteppers = _props_showNumberSteppers === void 0 ? true : _props_showNumberSteppers, onKeyDown = props.onKeyDown, _props_disableFocusStyles = props.disableFocusStyles, disableFocusStyles = _props_disableFocusStyles === void 0 ? false : _props_disableFocusStyles;
|
|
278
|
+
var effectiveIcon = insight && !icon ? MagicMajor : icon;
|
|
279
|
+
var effectiveIconColor = insight ? _iconColor || "insight-icon" : _iconColor || "subdued";
|
|
234
280
|
var suffix = maxLength && showCharacterCount ? "".concat(value.length, " / ").concat(maxLength) : _suffix;
|
|
235
281
|
var _internalRef = useRef(null);
|
|
236
282
|
var inputRef = _inputRef || _internalRef;
|
|
@@ -238,7 +284,7 @@ var clearButtonStyles = tv({
|
|
|
238
284
|
var _useState1 = _sliced_to_array(useState(_focused), 2), focused = _useState1[0], setFocused = _useState1[1];
|
|
239
285
|
var hasError = !!error;
|
|
240
286
|
var hasSuffix = !!suffix || maxLength && showCharacterCount;
|
|
241
|
-
var hasPrefix = !!prefix || !!
|
|
287
|
+
var hasPrefix = !!prefix || !!effectiveIcon;
|
|
242
288
|
var hasMultiline = multiline > 1;
|
|
243
289
|
var hasConnectedLeft = !!connectedLeft;
|
|
244
290
|
var hasConnectedRight = !!connectedRight;
|
|
@@ -291,9 +337,12 @@ var clearButtonStyles = tv({
|
|
|
291
337
|
hasError: hasError,
|
|
292
338
|
focused: Boolean(focused && !readOnly && !disableFocusStyles),
|
|
293
339
|
subdued: subdued,
|
|
294
|
-
transparent: transparent
|
|
340
|
+
transparent: transparent,
|
|
341
|
+
insight: insight
|
|
342
|
+
});
|
|
343
|
+
var iconClasses = iconStyles({
|
|
344
|
+
hasMultiline: hasMultiline
|
|
295
345
|
});
|
|
296
|
-
var iconClasses = iconStyles();
|
|
297
346
|
var inputClasses = inputStyles({
|
|
298
347
|
hasSuffix: hasSuffix,
|
|
299
348
|
hasPrefix: hasPrefix,
|
|
@@ -302,7 +351,8 @@ var clearButtonStyles = tv({
|
|
|
302
351
|
hasError: hasError,
|
|
303
352
|
readOnly: readOnly,
|
|
304
353
|
align: align,
|
|
305
|
-
type: type
|
|
354
|
+
type: type,
|
|
355
|
+
insight: insight
|
|
306
356
|
});
|
|
307
357
|
var clearButtonClasses = clearButtonStyles({
|
|
308
358
|
visible: (value === null || value === void 0 ? void 0 : value.length) > 0 && !readOnly && !disabled
|
|
@@ -333,9 +383,9 @@ var clearButtonStyles = tv({
|
|
|
333
383
|
}
|
|
334
384
|
};
|
|
335
385
|
var memoizedIcon = useMemo(function() {
|
|
336
|
-
return
|
|
386
|
+
return effectiveIcon;
|
|
337
387
|
}, [
|
|
338
|
-
|
|
388
|
+
effectiveIcon
|
|
339
389
|
]);
|
|
340
390
|
useEffect(function() {
|
|
341
391
|
// Handle auto-growing textarea
|
|
@@ -387,7 +437,7 @@ var clearButtonStyles = tv({
|
|
|
387
437
|
className: iconClasses,
|
|
388
438
|
children: /*#__PURE__*/ _jsx(Icon, {
|
|
389
439
|
source: memoizedIcon,
|
|
390
|
-
color:
|
|
440
|
+
color: effectiveIconColor
|
|
391
441
|
})
|
|
392
442
|
}),
|
|
393
443
|
/*#__PURE__*/ _jsx(InputElement, {
|
|
@@ -493,7 +543,7 @@ var clearButtonStyles = tv({
|
|
|
493
543
|
})
|
|
494
544
|
});
|
|
495
545
|
return /*#__PURE__*/ _jsxs("div", {
|
|
496
|
-
className: "Litho-TextFieldContainer flex flex-col gap-1",
|
|
546
|
+
className: "Litho-TextFieldContainer flex flex-col gap-1".concat(containerClassName ? " ".concat(containerClassName) : ""),
|
|
497
547
|
children: [
|
|
498
548
|
label && !labelHidden && /*#__PURE__*/ _jsxs("div", {
|
|
499
549
|
className: "flex justify-between items-end",
|
|
@@ -2,7 +2,30 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { tv } from "tailwind-variants";
|
|
3
3
|
import Icon from "./Icon.js";
|
|
4
4
|
import { ImageMajor } from "@shopify/polaris-icons";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @component Thumbnail
|
|
7
|
+
*
|
|
8
|
+
* @description A small, fixed-size image preview component with automatic placeholder fallback when no source is provided.
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
* - DO: Use for small, fixed-size image previews in lists, tables, or resource items.
|
|
12
|
+
* - DON'T: Use for large content images or hero banners; use `Image` for those cases.
|
|
13
|
+
*
|
|
14
|
+
* @accessibility
|
|
15
|
+
* - Always provide an `alt` prop describing the image content for screen readers.
|
|
16
|
+
* - When no image is available, the component renders a placeholder icon automatically.
|
|
17
|
+
*
|
|
18
|
+
* @alternative
|
|
19
|
+
* - If you need a full-size responsive image, use `Image` instead.
|
|
20
|
+
* - If you need an icon without an image container, use `Icon` instead.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} props - The component props.
|
|
23
|
+
* @param {string} [props.src] - The image source URL.
|
|
24
|
+
* @param {string} [props.alt] - The alternative text for the image.
|
|
25
|
+
* @param {("small"|"medium"|"large"|number)} [props.size="medium"] - The size of the thumbnail. Can be "small", "medium", "large", or a numeric pixel value.
|
|
26
|
+
* @param {boolean} [props.skeleton=false] - Whether to show a skeleton loader instead of the image.
|
|
27
|
+
* @returns {JSX.Element} The rendered Thumbnail component.
|
|
28
|
+
*/ var imageContainerStyles = tv({
|
|
6
29
|
base: "relative flex items-center justify-center overflow-hidden rounded-lg border border-tint-4 bg-surface-higher group",
|
|
7
30
|
variants: {
|
|
8
31
|
size: {
|
|
@@ -21,16 +44,7 @@ var imageStyles = tv({
|
|
|
21
44
|
size: "medium"
|
|
22
45
|
}
|
|
23
46
|
});
|
|
24
|
-
|
|
25
|
-
* Thumbnail component to display an image or a placeholder icon.
|
|
26
|
-
*
|
|
27
|
-
* @param {Object} props - The component props.
|
|
28
|
-
* @param {string} [props.src] - The image source URL.
|
|
29
|
-
* @param {string} [props.alt] - The alternative text for the image.
|
|
30
|
-
* @param {("small"|"medium"|"large"|number)} [props.size="medium"] - The size of the thumbnail. Can be "small", "medium", "large", or a numeric pixel value.
|
|
31
|
-
* @param {boolean} [props.skeleton=false] - Whether to show a skeleton loader instead of the image.
|
|
32
|
-
* @returns {JSX.Element} The rendered Thumbnail component.
|
|
33
|
-
*/ function Thumbnail() {
|
|
47
|
+
function Thumbnail() {
|
|
34
48
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
35
49
|
var src = props.src, alt = props.alt, _props_size = props.size, size = _props_size === void 0 ? "medium" : _props_size, _props_skeleton = props.skeleton, skeleton = _props_skeleton === void 0 ? false : _props_skeleton;
|
|
36
50
|
var sizeIsInteger = Number.isInteger(size);
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import TextField from "./TextField.js";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @component TimePicker
|
|
5
|
+
*
|
|
6
|
+
* @description A time selection input that wraps a TextField with type='time' for picking specific times.
|
|
7
|
+
*
|
|
8
|
+
* @usage
|
|
9
|
+
* - DO: Use for selecting specific times in scheduling or event forms.
|
|
10
|
+
* - DON'T: Use for date selection (use DatePicker).
|
|
11
|
+
*
|
|
12
|
+
* @accessibility
|
|
13
|
+
* - Wraps a TextField with type="time" for native keyboard and screen reader support; always provide a label.
|
|
14
|
+
*
|
|
15
|
+
* @alternative
|
|
16
|
+
* - If you need date selection, use `DatePicker`. If you need freeform text input, use `TextField`.
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} [props={}] - The properties for the TimePicker component.
|
|
19
|
+
* @param {string} [props.label="Time:"] - The label text for the time input.
|
|
20
|
+
* @param {boolean} [props.labelInline=true] - Whether to display the label inline as a prefix.
|
|
21
|
+
* @param {string} [props.value] - The current time value (in HH:mm format).
|
|
22
|
+
* @param {Function} [props.onChange] - Callback function invoked when the time value changes.
|
|
23
|
+
* @returns {JSX.Element} The rendered TimePicker component.
|
|
24
|
+
*/ function TimePicker() {
|
|
4
25
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
5
26
|
var _props_label = props.label, label = _props_label === void 0 ? "Time:" : _props_label, _props_labelInline = props.labelInline, labelInline = _props_labelInline === void 0 ? true : _props_labelInline, value = props.value, onChange = props.onChange;
|
|
6
27
|
return /*#__PURE__*/ _jsx(TextField, {
|
|
@@ -1,10 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
function _define_property(obj, key, value) {
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function _object_spread(target) {
|
|
16
|
+
for(var i = 1; i < arguments.length; i++){
|
|
17
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
18
|
+
var ownKeys = Object.keys(source);
|
|
19
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
20
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
21
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
ownKeys.forEach(function(key) {
|
|
25
|
+
_define_property(target, key, source[key]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
function ownKeys(object, enumerableOnly) {
|
|
31
|
+
var keys = Object.keys(object);
|
|
32
|
+
if (Object.getOwnPropertySymbols) {
|
|
33
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
34
|
+
if (enumerableOnly) {
|
|
35
|
+
symbols = symbols.filter(function(sym) {
|
|
36
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
keys.push.apply(keys, symbols);
|
|
40
|
+
}
|
|
41
|
+
return keys;
|
|
42
|
+
}
|
|
43
|
+
function _object_spread_props(target, source) {
|
|
44
|
+
source = source != null ? source : {};
|
|
45
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
46
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
47
|
+
} else {
|
|
48
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
49
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return target;
|
|
53
|
+
}
|
|
1
54
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
55
|
import React, { cloneElement, isValidElement, useMemo } from "react";
|
|
3
56
|
import { tv } from "tailwind-variants";
|
|
4
57
|
import Icon from "./Icon.js";
|
|
58
|
+
import Button from "./Button.js";
|
|
59
|
+
import Text from "./Text.js";
|
|
5
60
|
import { AlertMinor, CancelMinor, InfoMinor, MagicMajor } from "@shopify/polaris-icons";
|
|
6
|
-
|
|
7
|
-
|
|
61
|
+
/**
|
|
62
|
+
* @component Tip
|
|
63
|
+
*
|
|
64
|
+
* @description A subtle inline hint component that displays contextual guidance or tips within a page section.
|
|
65
|
+
*
|
|
66
|
+
* @usage
|
|
67
|
+
* - DO: Provide helpful, non-critical contextual hints or best practices inline.
|
|
68
|
+
* - DON'T: Use for important alerts or errors (use Banner).
|
|
69
|
+
*
|
|
70
|
+
* @accessibility
|
|
71
|
+
* - Tip content is read as regular page content; ensure the tip text is meaningful without relying on its icon.
|
|
72
|
+
*
|
|
73
|
+
* @alternative
|
|
74
|
+
* - If you need a prominent alert with actions, use `Banner`.
|
|
75
|
+
* - If you need a global notification bar, use `AnnouncementBar`.
|
|
76
|
+
*
|
|
77
|
+
* @param {Object} props - The component props.
|
|
78
|
+
* @param {"info" | "critical" | "success" | "warning" | "attention" | "highlight" | "neutral" | "plain" | "minimal"} [props.status="info"] - The status type of the tip.
|
|
79
|
+
* @param {Function} [props.onDismiss] - Function to call when the dismiss button is clicked.
|
|
80
|
+
* @param {Function} [props.onClick] - Function to call when the tip is clicked.
|
|
81
|
+
* @param {React.ReactNode} props.children - The content of the tip.
|
|
82
|
+
* @param {React.ElementType} [props.icon] - Custom icon for the tip.
|
|
83
|
+
* @param {"left" | "right" | "center"} [props.align="left"] - The alignment of the tip.
|
|
84
|
+
* @param {Array<{content: string, onAction: Function}>} [props.actions] - Array of action objects to show as buttons at the bottom.
|
|
85
|
+
* @param {string | React.ReactNode} [props.title=null] - Optional title shown above the tip content.
|
|
86
|
+
* @returns {JSX.Element} The rendered Tip component.
|
|
87
|
+
*/ var styles = tv({
|
|
88
|
+
base: "Litho-Tip relative flex rounded-md",
|
|
8
89
|
variants: {
|
|
9
90
|
status: {
|
|
10
91
|
success: "bg-success-alt text-success-alt-fg",
|
|
@@ -14,7 +95,8 @@ var styles = tv({
|
|
|
14
95
|
highlight: "bg-highlight-alt text-highlight-alt-fg",
|
|
15
96
|
insight: "bg-insight-alt text-insight-alt-fg",
|
|
16
97
|
info: "bg-info-alt text-info-alt-fg",
|
|
17
|
-
plain: "bg-transparent text-subdued
|
|
98
|
+
plain: "bg-transparent text-high border border-border-subdued rounded-lg",
|
|
99
|
+
minimal: "bg-transparent text-high"
|
|
18
100
|
},
|
|
19
101
|
dismissible: {
|
|
20
102
|
true: "pr-8"
|
|
@@ -24,19 +106,29 @@ var styles = tv({
|
|
|
24
106
|
},
|
|
25
107
|
border: {
|
|
26
108
|
true: "border border-tint-2"
|
|
109
|
+
},
|
|
110
|
+
padding: {
|
|
111
|
+
default: "p-2",
|
|
112
|
+
md: "p-3",
|
|
113
|
+
lg: "p-4"
|
|
27
114
|
}
|
|
28
115
|
},
|
|
29
116
|
defaultVariants: {
|
|
30
117
|
status: "info",
|
|
31
118
|
dismissible: false,
|
|
32
119
|
clickable: false,
|
|
33
|
-
border: false
|
|
120
|
+
border: false,
|
|
121
|
+
padding: "default"
|
|
34
122
|
},
|
|
35
123
|
compoundVariants: [
|
|
36
124
|
{
|
|
37
125
|
clickable: true,
|
|
38
126
|
status: "info",
|
|
39
127
|
className: "hover:outline hover:outline-info-alt-lower"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
status: "minimal",
|
|
131
|
+
className: "!p-0"
|
|
40
132
|
}
|
|
41
133
|
]
|
|
42
134
|
});
|
|
@@ -81,29 +173,20 @@ var statusHelpers = {
|
|
|
81
173
|
insight: {
|
|
82
174
|
icon: MagicMajor
|
|
83
175
|
},
|
|
84
|
-
neutral: {}
|
|
176
|
+
neutral: {},
|
|
177
|
+
minimal: {}
|
|
85
178
|
};
|
|
86
|
-
|
|
87
|
-
* Tip component for displaying informational messages with optional dismiss functionality.
|
|
88
|
-
*
|
|
89
|
-
* @param {Object} props - The component props.
|
|
90
|
-
* @param {"info" | "critical" | "success" | "warning" | "attention" | "highlight" | "neutral"} [props.status="info"] - The status type of the tip.
|
|
91
|
-
* @param {Function} [props.onDismiss] - Function to call when the dismiss button is clicked.
|
|
92
|
-
* @param {Function} [props.onClick] - Function to call when the tip is clicked.
|
|
93
|
-
* @param {React.ReactNode} props.children - The content of the tip.
|
|
94
|
-
* @param {React.ElementType} [props.icon] - Custom icon for the tip.
|
|
95
|
-
* @param {"left" | "right" | "center"} [props.align="left"] - The alignment of the tip.
|
|
96
|
-
* @returns {JSX.Element} The rendered Tip component.
|
|
97
|
-
*/ function Tip() {
|
|
179
|
+
function Tip() {
|
|
98
180
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
99
181
|
var _statusHelpers_status;
|
|
100
|
-
var _props_status = props.status, status = _props_status === void 0 ? "info" : _props_status, onClick = props.onClick, onDismiss = props.onDismiss, children = props.children, _icon = props.icon, _props_align = props.align, align = _props_align === void 0 ? "left" : _props_align, border = props.border;
|
|
182
|
+
var _props_status = props.status, status = _props_status === void 0 ? "info" : _props_status, onClick = props.onClick, onDismiss = props.onDismiss, children = props.children, _icon = props.icon, _props_align = props.align, align = _props_align === void 0 ? "left" : _props_align, border = props.border, actions = props.actions, _props_title = props.title, title = _props_title === void 0 ? null : _props_title, _props_padding = props.padding, padding = _props_padding === void 0 ? "default" : _props_padding;
|
|
101
183
|
var icon = _icon === null ? null : _icon || ((_statusHelpers_status = statusHelpers[status]) === null || _statusHelpers_status === void 0 ? void 0 : _statusHelpers_status.icon) || InfoMinor;
|
|
102
184
|
var classes = styles({
|
|
103
185
|
status: status,
|
|
104
186
|
dismissible: !!onDismiss,
|
|
105
187
|
clickable: !!onClick,
|
|
106
|
-
border: border
|
|
188
|
+
border: border,
|
|
189
|
+
padding: padding
|
|
107
190
|
});
|
|
108
191
|
var base = "-alt-icon";
|
|
109
192
|
var iconColorMap = {
|
|
@@ -115,7 +198,9 @@ var statusHelpers = {
|
|
|
115
198
|
highlight: "highlight".concat(base),
|
|
116
199
|
insight: "insight".concat(base),
|
|
117
200
|
neutral: "neutral".concat(base),
|
|
118
|
-
default: "info".concat(base)
|
|
201
|
+
default: "info".concat(base),
|
|
202
|
+
plain: "subdued",
|
|
203
|
+
minimal: "subdued"
|
|
119
204
|
};
|
|
120
205
|
var iconColor = iconColorMap[status] || iconColorMap.default;
|
|
121
206
|
var processedChildren = useMemo(function() {
|
|
@@ -139,9 +224,19 @@ var statusHelpers = {
|
|
|
139
224
|
children,
|
|
140
225
|
status
|
|
141
226
|
]);
|
|
142
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
227
|
+
return /*#__PURE__*/ _jsxs("div", _object_spread_props(_object_spread({
|
|
143
228
|
className: classes,
|
|
144
|
-
onClick: onClick
|
|
229
|
+
onClick: onClick
|
|
230
|
+
}, onClick ? {
|
|
231
|
+
role: "button",
|
|
232
|
+
tabIndex: 0,
|
|
233
|
+
onKeyDown: function(e) {
|
|
234
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
235
|
+
e.preventDefault();
|
|
236
|
+
onClick(e);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
} : {}), {
|
|
145
240
|
children: [
|
|
146
241
|
/*#__PURE__*/ _jsxs("div", {
|
|
147
242
|
className: innerStyles({
|
|
@@ -152,8 +247,28 @@ var statusHelpers = {
|
|
|
152
247
|
source: icon,
|
|
153
248
|
color: iconColor
|
|
154
249
|
}),
|
|
155
|
-
/*#__PURE__*/
|
|
156
|
-
|
|
250
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
251
|
+
className: "flex flex-col gap-1 flex-1",
|
|
252
|
+
children: [
|
|
253
|
+
title != null && title !== "" && /*#__PURE__*/ _jsx(Text, {
|
|
254
|
+
fontWeight: "medium",
|
|
255
|
+
children: title
|
|
256
|
+
}),
|
|
257
|
+
/*#__PURE__*/ _jsx("div", {
|
|
258
|
+
children: processedChildren
|
|
259
|
+
}),
|
|
260
|
+
(actions === null || actions === void 0 ? void 0 : actions.length) > 0 && /*#__PURE__*/ _jsx("div", {
|
|
261
|
+
className: "relative -left-3 flex items-center",
|
|
262
|
+
children: actions.map(function(action, i) {
|
|
263
|
+
return /*#__PURE__*/ _jsx(Button, {
|
|
264
|
+
plain: true,
|
|
265
|
+
size: "small",
|
|
266
|
+
onClick: action.onAction,
|
|
267
|
+
children: action.content
|
|
268
|
+
}, i);
|
|
269
|
+
})
|
|
270
|
+
})
|
|
271
|
+
]
|
|
157
272
|
})
|
|
158
273
|
]
|
|
159
274
|
}),
|
|
@@ -168,6 +283,6 @@ var statusHelpers = {
|
|
|
168
283
|
})
|
|
169
284
|
})
|
|
170
285
|
]
|
|
171
|
-
});
|
|
286
|
+
}));
|
|
172
287
|
}
|
|
173
288
|
export default Tip;
|