@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
|
@@ -32,10 +32,20 @@ import Button from "./Button.js";
|
|
|
32
32
|
import ButtonGroup from "./ButtonGroup.js";
|
|
33
33
|
import Tooltip from "./Tooltip.js";
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* @component Pagination
|
|
36
|
+
*
|
|
37
|
+
* @description A page navigation component with previous/next controls and optional page number display for paginated content.
|
|
38
|
+
*
|
|
39
|
+
* @usage
|
|
40
|
+
* - DO: Use for navigating between pages of paginated content.
|
|
41
|
+
* - DON'T: Use for in-page section navigation (use Tabs).
|
|
42
|
+
*
|
|
43
|
+
* @accessibility
|
|
44
|
+
* - Pagination buttons should have descriptive labels ("Previous page", "Next page"); disabled states are communicated to screen readers.
|
|
45
|
+
*
|
|
46
|
+
* @alternative
|
|
47
|
+
* - If you need tab-based content switching, use `Tabs`. If you need infinite scroll, implement custom scroll handling.
|
|
37
48
|
*
|
|
38
|
-
* @component
|
|
39
49
|
* @param {Object} props - The properties for the Pagination component.
|
|
40
50
|
* @param {boolean} [props.hasNext] - Indicates whether there is a next page/step.
|
|
41
51
|
* @param {boolean} [props.hasPrevious] - Indicates whether there is a previous page/step.
|
|
@@ -59,7 +69,7 @@ import Tooltip from "./Tooltip.js";
|
|
|
59
69
|
* />
|
|
60
70
|
*/ function Pagination() {
|
|
61
71
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
62
|
-
var hasNext = props.hasNext, hasPrevious = props.hasPrevious, nextURL = props.nextURL, previousURL = props.previousURL, onNext = props.onNext, onPrevious = props.onPrevious, nextTooltip = props.nextTooltip, previousTooltip = props.previousTooltip;
|
|
72
|
+
var hasNext = props.hasNext, hasPrevious = props.hasPrevious, nextURL = props.nextURL, previousURL = props.previousURL, onNext = props.onNext, onPrevious = props.onPrevious, nextTooltip = props.nextTooltip, previousTooltip = props.previousTooltip, _props_segmented = props.segmented, segmented = _props_segmented === void 0 ? true : _props_segmented, _props_plain = props.plain, plain = _props_plain === void 0 ? false : _props_plain, _props_link = props.link, link = _props_link === void 0 ? false : _props_link;
|
|
63
73
|
var renderButtonWithTooltip = function(tooltip, buttonProps) {
|
|
64
74
|
var button = /*#__PURE__*/ _jsx(Button, _object_spread({}, buttonProps));
|
|
65
75
|
return tooltip ? /*#__PURE__*/ _jsx(Tooltip, {
|
|
@@ -70,11 +80,14 @@ import Tooltip from "./Tooltip.js";
|
|
|
70
80
|
return /*#__PURE__*/ _jsx("div", {
|
|
71
81
|
className: "Litho-Pagination",
|
|
72
82
|
children: /*#__PURE__*/ _jsxs(ButtonGroup, {
|
|
73
|
-
segmented:
|
|
83
|
+
segmented: segmented,
|
|
84
|
+
gap: "0",
|
|
74
85
|
children: [
|
|
75
86
|
renderButtonWithTooltip(previousTooltip, {
|
|
76
87
|
icon: ChevronLeftMinor,
|
|
77
88
|
disabled: !hasPrevious,
|
|
89
|
+
plain: plain,
|
|
90
|
+
link: link,
|
|
78
91
|
onClick: hasPrevious ? function() {
|
|
79
92
|
if (onPrevious) {
|
|
80
93
|
onPrevious();
|
|
@@ -86,6 +99,8 @@ import Tooltip from "./Tooltip.js";
|
|
|
86
99
|
renderButtonWithTooltip(nextTooltip, {
|
|
87
100
|
icon: ChevronRightMinor,
|
|
88
101
|
disabled: !hasNext,
|
|
102
|
+
plain: plain,
|
|
103
|
+
link: link,
|
|
89
104
|
onClick: hasNext ? function() {
|
|
90
105
|
if (onNext) {
|
|
91
106
|
onNext();
|
|
@@ -61,7 +61,35 @@ import { useMobile } from "../utilities/useMobile.js";
|
|
|
61
61
|
import { useBodyScrollLock } from "../utilities/useBodyScrollLock.js";
|
|
62
62
|
import { useKeyboardAction } from "../utilities/useKeyboardAction.js";
|
|
63
63
|
import Tooltip from "./Tooltip.js";
|
|
64
|
-
|
|
64
|
+
/**
|
|
65
|
+
* @component Pane
|
|
66
|
+
*
|
|
67
|
+
* @description A slide-in side panel overlay for displaying supplementary content, detail views, or multi-tab workflows alongside the main page.
|
|
68
|
+
*
|
|
69
|
+
* @usage
|
|
70
|
+
* - DO: Use for secondary content panels that slide in from the side without blocking the main page.
|
|
71
|
+
* - DON'T: Use for focused tasks requiring full attention (use Modal).
|
|
72
|
+
*
|
|
73
|
+
* @accessibility
|
|
74
|
+
* - Manages focus within the pane when open; supports keyboard dismissal via Escape key. Ensure title provides context.
|
|
75
|
+
*
|
|
76
|
+
* @alternative
|
|
77
|
+
* - If you need a blocking dialog, use `Modal`. If you need inline expandable content, use `Collapsible`.
|
|
78
|
+
*
|
|
79
|
+
* @param {Object} props - Component properties.
|
|
80
|
+
* @param {boolean} props.open - Whether the pane is open.
|
|
81
|
+
* @param {Function} [props.onClose] - Callback fired when the pane is closed.
|
|
82
|
+
* @param {Function} [props.onOpen] - Callback fired when the pane should be opened (for auto-open functionality).
|
|
83
|
+
* @param {React.ReactNode} props.children - Content to render inside the pane.
|
|
84
|
+
* @param {Object} [props.tabStorage] - Shared tab storage object for managing pane tabs.
|
|
85
|
+
* @param {Function} [props.onTabRemove] - Callback when a tab is removed, receives (tabId, tab).
|
|
86
|
+
* @param {Object} [props.onExpandRef] - Ref to expose the expand function to the parent.
|
|
87
|
+
* @param {string} [props.tabId] - Optional tab ID; if provided, will reuse an existing tab with this ID.
|
|
88
|
+
* @param {string} [props.tabTitle] - Tab title to display.
|
|
89
|
+
* @param {string} [props.tabKey] - Optional stable key for tab deduplication.
|
|
90
|
+
* @param {string} [props.orgId] - Optional organization ID to scope the pane state.
|
|
91
|
+
* @returns {JSX.Element|null} The rendered Pane component, or null if not open.
|
|
92
|
+
*/ // Reference counter for pane open state (shared across all Pane components)
|
|
65
93
|
var paneOpenCount = 0;
|
|
66
94
|
var MIN_PANE_WIDTH = 360;
|
|
67
95
|
var MAX_PANE_WIDTH = 800;
|
|
@@ -663,7 +691,21 @@ function Pane() {
|
|
|
663
691
|
})
|
|
664
692
|
});
|
|
665
693
|
}
|
|
666
|
-
|
|
694
|
+
/**
|
|
695
|
+
* @component Pane.Header
|
|
696
|
+
*
|
|
697
|
+
* @usage
|
|
698
|
+
* - DO: Provide title and close action for the pane.
|
|
699
|
+
*
|
|
700
|
+
* @param {Object} props - Component properties.
|
|
701
|
+
* @param {string|React.ReactNode} [props.title] - Title text or custom element for the header.
|
|
702
|
+
* @param {string|React.ReactNode} [props.subtitle] - Subtitle text or custom element.
|
|
703
|
+
* @param {Array<Object>} [props.actions=[]] - Array of action button configurations.
|
|
704
|
+
* @param {boolean} [props.bottomBorder=true] - Whether to show a bottom border.
|
|
705
|
+
* @param {React.ReactNode} [props.subHeader] - Additional content rendered below the header row.
|
|
706
|
+
* @param {Object} [props.backAction] - Back navigation action with onAction callback and accessibilityLabel.
|
|
707
|
+
* @returns {JSX.Element} The rendered Pane.Header component.
|
|
708
|
+
*/ function Header() {
|
|
667
709
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
668
710
|
var title = props.title, subtitle = props.subtitle, _props_actions = props.actions, actions = _props_actions === void 0 ? [] : _props_actions, _props_bottomBorder = props.bottomBorder, bottomBorder = _props_bottomBorder === void 0 ? true : _props_bottomBorder, subHeader = props.subHeader, tmp = props.backAction, _backAction = tmp === void 0 ? null : tmp;
|
|
669
711
|
var _useState = _sliced_to_array(useState(null), 2), showActionsPopover = _useState[0], setShowActionsPopover = _useState[1];
|
|
@@ -755,7 +797,18 @@ function Header() {
|
|
|
755
797
|
});
|
|
756
798
|
}
|
|
757
799
|
Pane.Header = Header;
|
|
758
|
-
|
|
800
|
+
/**
|
|
801
|
+
* @component Pane.Content
|
|
802
|
+
*
|
|
803
|
+
* @usage
|
|
804
|
+
* - DO: Wrap scrollable content within the pane.
|
|
805
|
+
*
|
|
806
|
+
* @param {Object} props - Component properties.
|
|
807
|
+
* @param {React.ReactNode} props.children - Content to render inside the pane body.
|
|
808
|
+
* @param {boolean} [props.padded=true] - Whether to apply padding to the content area.
|
|
809
|
+
* @param {string} [props.className] - Additional CSS class names.
|
|
810
|
+
* @returns {JSX.Element} The rendered Pane.Content component.
|
|
811
|
+
*/ function Content() {
|
|
759
812
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
760
813
|
var children = props.children, _props_padded = props.padded, padded = _props_padded === void 0 ? true : _props_padded, className = props.className;
|
|
761
814
|
return /*#__PURE__*/ _jsx("div", {
|
|
@@ -764,7 +817,17 @@ function Content() {
|
|
|
764
817
|
});
|
|
765
818
|
}
|
|
766
819
|
Pane.Content = Content;
|
|
767
|
-
|
|
820
|
+
/**
|
|
821
|
+
* @component Pane.Footer
|
|
822
|
+
*
|
|
823
|
+
* @usage
|
|
824
|
+
* - DO: Place action buttons at the bottom of the pane.
|
|
825
|
+
*
|
|
826
|
+
* @param {Object} props - Component properties.
|
|
827
|
+
* @param {React.ReactNode} props.children - Content to render inside the footer.
|
|
828
|
+
* @param {boolean} [props.topBorder=true] - Whether to show a top border.
|
|
829
|
+
* @returns {JSX.Element} The rendered Pane.Footer component.
|
|
830
|
+
*/ function Footer() {
|
|
768
831
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
769
832
|
var children = props.children, _props_topBorder = props.topBorder, topBorder = _props_topBorder === void 0 ? true : _props_topBorder;
|
|
770
833
|
var isMobile = useMobile(MOBILE_BREAKPOINT);
|
|
@@ -102,24 +102,21 @@ import React, { useEffect, useId, useMemo, useRef, useState, useLayoutEffect } f
|
|
|
102
102
|
import { createPortal } from "react-dom";
|
|
103
103
|
import { tv } from "tailwind-variants";
|
|
104
104
|
import PopoverManager from "./PopoverManager.js";
|
|
105
|
-
var TOP_SPACING = 4;
|
|
106
|
-
var EDGE_SPACING = 16;
|
|
107
|
-
var styles = tv({
|
|
108
|
-
base: "Litho-Popover bg-surface-highest rounded-sm max-h-100 overflow-y-auto overflow-x-hidden shadow-popover dark:shadow-popover-dark outline outline-tint-3 min-w-32 overscroll-contain dark:outline-hidden dark:border-t dark:border-tint-alt-2",
|
|
109
|
-
variants: {
|
|
110
|
-
maxWidth: {
|
|
111
|
-
default: "max-w-80",
|
|
112
|
-
datePicker: "max-w-75 @sm:max-w-full",
|
|
113
|
-
none: ""
|
|
114
|
-
},
|
|
115
|
-
sectioned: {
|
|
116
|
-
true: "Litho-Popover--Sectioned p-4",
|
|
117
|
-
false: ""
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
105
|
/**
|
|
122
|
-
*
|
|
106
|
+
* @component Popover
|
|
107
|
+
*
|
|
108
|
+
* @description An anchored floating panel that displays interactive content like menus, forms, or action lists when triggered.
|
|
109
|
+
*
|
|
110
|
+
* @usage
|
|
111
|
+
* - DO: Display interactive content (menus, forms, pickers) anchored to a trigger.
|
|
112
|
+
* - DON'T: Use for simple text hints (use Tooltip).
|
|
113
|
+
*
|
|
114
|
+
* @accessibility
|
|
115
|
+
* - Manages focus trap and keyboard dismissal (Escape key); ensure the trigger has `aria-expanded` and `aria-haspopup`.
|
|
116
|
+
*
|
|
117
|
+
* @alternative
|
|
118
|
+
* - If you need non-interactive supplementary text, use `Tooltip`.
|
|
119
|
+
* - If you need a full dialog, use `Modal`.
|
|
123
120
|
*
|
|
124
121
|
* @param {Object} props - The component props.
|
|
125
122
|
* @param {string|React.ComponentType} [props.activatorWrapper="div"] - The wrapper element for the activator.
|
|
@@ -137,7 +134,23 @@ var styles = tv({
|
|
|
137
134
|
* @param {string} [props.className] - Additional class name for the popover.
|
|
138
135
|
* @param {string} [props.containerClassName] - Additional class name for the popover container.
|
|
139
136
|
* @returns {JSX.Element} The rendered popover component.
|
|
140
|
-
*/
|
|
137
|
+
*/ var TOP_SPACING = 4;
|
|
138
|
+
var EDGE_SPACING = 16;
|
|
139
|
+
var styles = tv({
|
|
140
|
+
base: "Litho-Popover bg-surface-highest rounded-sm max-h-100 overflow-y-auto overflow-x-hidden shadow-popover dark:shadow-popover-dark outline outline-tint-3 min-w-32 overscroll-contain dark:outline-hidden dark:border-t dark:border-tint-alt-2",
|
|
141
|
+
variants: {
|
|
142
|
+
maxWidth: {
|
|
143
|
+
default: "max-w-80",
|
|
144
|
+
datePicker: "max-w-75 @sm:max-w-full",
|
|
145
|
+
none: ""
|
|
146
|
+
},
|
|
147
|
+
sectioned: {
|
|
148
|
+
true: "Litho-Popover--Sectioned p-4",
|
|
149
|
+
false: ""
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
function Popover() {
|
|
141
154
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
142
155
|
var activatorWrapper = props.activatorWrapper, _props_activatorDisplayType = props.activatorDisplayType, activatorDisplayType = _props_activatorDisplayType === void 0 ? "inline-block" : _props_activatorDisplayType, activator = props.activator, children = props.children, onClose = props.onClose, activeProp = props.active, fixed = props.fixed, zIndexOverride = props.zIndexOverride, _props_sectioned = props.sectioned, sectioned = _props_sectioned === void 0 ? false : _props_sectioned, _props_preferredAlignment = props.preferredAlignment, preferredAlignment = _props_preferredAlignment === void 0 ? "center" : _props_preferredAlignment, _props_preferredPosition = props.preferredPosition, preferredPosition = _props_preferredPosition === void 0 ? "below" : _props_preferredPosition, _props_horizontalOffset = props.horizontalOffset, horizontalOffset = _props_horizontalOffset === void 0 ? 0 : _props_horizontalOffset, _props_matchActivatorWidth = props.matchActivatorWidth, matchActivatorWidth = _props_matchActivatorWidth === void 0 ? false : _props_matchActivatorWidth, _props_maxWidth = props.maxWidth, maxWidth = _props_maxWidth === void 0 ? "default" : _props_maxWidth, className = props.className, containerClassName = props.containerClassName, _props_closeOnResize = props.closeOnResize, closeOnResize = _props_closeOnResize === void 0 ? true : _props_closeOnResize, _props_debounceResizeObserver = props.debounceResizeObserver, debounceResizeObserver = _props_debounceResizeObserver === void 0 ? false : _props_debounceResizeObserver, _props_usePortal = props.usePortal, usePortal = _props_usePortal === void 0 ? true : _props_usePortal;
|
|
143
156
|
var ActivatorWrapper = activatorWrapper || "div";
|
|
@@ -409,7 +422,7 @@ var styles = tv({
|
|
|
409
422
|
children: memoizedActivator
|
|
410
423
|
}),
|
|
411
424
|
active && typeof children !== "undefined" && (usePortal ? /*#__PURE__*/ createPortal(/*#__PURE__*/ _jsx("div", {
|
|
412
|
-
className: "@container",
|
|
425
|
+
className: "@container/main",
|
|
413
426
|
children: /*#__PURE__*/ _jsx("div", {
|
|
414
427
|
ref: popoverRef,
|
|
415
428
|
style: popoverStyle,
|
|
@@ -417,7 +430,7 @@ var styles = tv({
|
|
|
417
430
|
children: children
|
|
418
431
|
})
|
|
419
432
|
}), document.body) : /*#__PURE__*/ _jsx("div", {
|
|
420
|
-
className: "@container",
|
|
433
|
+
className: "@container/main",
|
|
421
434
|
children: /*#__PURE__*/ _jsx("div", {
|
|
422
435
|
ref: popoverRef,
|
|
423
436
|
style: popoverStyle,
|
|
@@ -442,7 +455,10 @@ var sectionStyles = tv({
|
|
|
442
455
|
}
|
|
443
456
|
});
|
|
444
457
|
/**
|
|
445
|
-
*
|
|
458
|
+
* @component Popover.Section
|
|
459
|
+
*
|
|
460
|
+
* @usage
|
|
461
|
+
* - DO: Use to divide Popover content into logical segments with borders.
|
|
446
462
|
*
|
|
447
463
|
* @param {Object} props - The component props.
|
|
448
464
|
* @param {React.ReactNode} [props.children] - The content of the section.
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @component PopoverManager
|
|
3
|
+
*
|
|
4
|
+
* @description An internal event-based coordination utility that tracks active popovers and emits change events to manage open/close state.
|
|
5
|
+
*
|
|
6
|
+
* @usage
|
|
7
|
+
* - DO: Use to coordinate popover open/close state across multiple Popover instances.
|
|
8
|
+
* - DON'T: Import directly in most cases; Popover uses it internally.
|
|
9
|
+
*
|
|
10
|
+
* @alternative
|
|
11
|
+
* - If you need to render a popover, use `Popover` directly. PopoverManager is an internal coordination utility.
|
|
12
|
+
*
|
|
13
|
+
* @module PopoverManager
|
|
14
|
+
*/ import { EventEmitter } from "events";
|
|
2
15
|
var PopoverManager = new EventEmitter();
|
|
3
16
|
PopoverManager.activePopovers = [];
|
|
4
17
|
PopoverManager.open = function(id) {
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { tv } from "tailwind-variants";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @component ProgressBar
|
|
5
|
+
*
|
|
6
|
+
* @description A horizontal bar that visually represents completion progress as a percentage with configurable size and color.
|
|
7
|
+
*
|
|
8
|
+
* @usage
|
|
9
|
+
* - DO: Show completion percentage or progress of a task.
|
|
10
|
+
* - DON'T: Use for indeterminate loading (use Spinner or Loading).
|
|
11
|
+
*
|
|
12
|
+
* @accessibility
|
|
13
|
+
* - Include an accessible label describing the progress context.
|
|
14
|
+
* - Consider adding visible percentage text.
|
|
15
|
+
*
|
|
16
|
+
* @alternative
|
|
17
|
+
* - If you need an indeterminate loading indicator, use `Spinner`.
|
|
18
|
+
* - If you need a status label, use `Badge`.
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} props - Properties to configure the progress bar.
|
|
21
|
+
* @param {number} [props.progress=0] - The progress percentage (0-100).
|
|
22
|
+
* @param {number} [props.previousProgress] - The previous period's progress percentage (0-100).
|
|
23
|
+
* @param {boolean} [props.comparisonMode=false] - Whether to show comparison between current and previous period.
|
|
24
|
+
* @param {("small"|"medium"|"large")} [props.size="medium"] - The size of the progress bar.
|
|
25
|
+
* @param {("attention"|"highlight"|"success"|"warning"|"critical"|"neutral"|"positive"|"negative")} [props.color="attention"] - The color of the progress indicator.
|
|
26
|
+
* @param {boolean} [props.animated=true] - Whether the progress bar should animate width changes.
|
|
27
|
+
*
|
|
28
|
+
* @returns {JSX.Element} The rendered progress bar component.
|
|
29
|
+
*/ var styles = tv({
|
|
4
30
|
base: "Litho-ProgressBar relative bg-tint-2 dark:bg-tint-alt-2 rounded-full overflow-hidden min-w-12",
|
|
5
31
|
variants: {
|
|
6
32
|
size: {
|
|
@@ -39,20 +65,7 @@ var barStyles = tv({
|
|
|
39
65
|
animated: true
|
|
40
66
|
}
|
|
41
67
|
});
|
|
42
|
-
|
|
43
|
-
* A progress bar component with configurable size, color, and animation.
|
|
44
|
-
* Can be used in single or comparison mode to show progress changes.
|
|
45
|
-
*
|
|
46
|
-
* @param {Object} props - Properties to configure the progress bar.
|
|
47
|
-
* @param {number} [props.progress=0] - The progress percentage (0-100).
|
|
48
|
-
* @param {number} [props.previousProgress] - The previous period's progress percentage (0-100).
|
|
49
|
-
* @param {boolean} [props.comparisonMode=false] - Whether to show comparison between current and previous period.
|
|
50
|
-
* @param {("small"|"medium"|"large")} [props.size="medium"] - The size of the progress bar.
|
|
51
|
-
* @param {("attention"|"highlight"|"success"|"warning"|"critical"|"neutral"|"positive"|"negative")} [props.color="attention"] - The color of the progress indicator.
|
|
52
|
-
* @param {boolean} [props.animated=true] - Whether the progress bar should animate width changes.
|
|
53
|
-
*
|
|
54
|
-
* @returns {JSX.Element} The rendered progress bar component.
|
|
55
|
-
*/ function ProgressBar() {
|
|
68
|
+
function ProgressBar() {
|
|
56
69
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
57
70
|
var _props_progress = props.progress, progress = _props_progress === void 0 ? 0 : _props_progress, previousProgress = props.previousProgress, _props_comparisonMode = props.comparisonMode, comparisonMode = _props_comparisonMode === void 0 ? false : _props_comparisonMode, _props_size = props.size, size = _props_size === void 0 ? "medium" : _props_size, _props_color = props.color, color = _props_color === void 0 ? "attention" : _props_color, _props_animated = props.animated, animated = _props_animated === void 0 ? true : _props_animated, className = props.className;
|
|
58
71
|
var classes = styles({
|
|
@@ -2,7 +2,37 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { tv } from "tailwind-variants";
|
|
3
3
|
import Text from "./Text.js";
|
|
4
4
|
import Label from "./Label.js";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @component RadioButton
|
|
7
|
+
*
|
|
8
|
+
* @description A single radio input for selecting one option from a mutually exclusive group.
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
* - DO: Use for selecting one option from a mutually exclusive group.
|
|
12
|
+
* - DON'T: Use for multi-select (use Checkbox).
|
|
13
|
+
*
|
|
14
|
+
* @accessibility
|
|
15
|
+
* - Group radio buttons with a shared `name` prop; ensure each has a descriptive `label`.
|
|
16
|
+
*
|
|
17
|
+
* @alternative
|
|
18
|
+
* - If you need a rich card-style radio, use `RadioButtonCard`. If you need grouped options with a label, use `ChoiceList`.
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} props - Props for the RadioButton component.
|
|
21
|
+
* @param {string} [props.label] - The text label for the radio button.
|
|
22
|
+
* @param {boolean} [props.labelHidden=false] - If true, hides the label visually but keeps it available for screen readers.
|
|
23
|
+
* @param {string} [props.id] - The unique identifier for the radio input.
|
|
24
|
+
* @param {string} [props.name] - The name attribute for the radio input (must be the same for grouped buttons).
|
|
25
|
+
* @param {string} [props.value] - The value attribute for the radio input.
|
|
26
|
+
* @param {string} [props.error] - An error message associated with the radio button, if any.
|
|
27
|
+
* @param {boolean} [props.checked=false] - Indicates whether the radio button is checked.
|
|
28
|
+
* @param {boolean} [props.disabled=false] - Indicates whether the radio button is disabled.
|
|
29
|
+
* @param {string} [props.helpText] - Additional descriptive text for the radio button.
|
|
30
|
+
* @param {function} [props.onChange] - Callback function called when the radio button state changes.
|
|
31
|
+
* @param {function} [props.onFocus] - Callback function called when the radio button gains focus.
|
|
32
|
+
* @param {function} [props.onBlur] - Callback function called when the radio button loses focus.
|
|
33
|
+
*
|
|
34
|
+
* @returns {JSX.Element} The rendered RadioButton component.
|
|
35
|
+
*/ var styles = tv({
|
|
6
36
|
base: "Litho-RadioButton group flex gap-2",
|
|
7
37
|
variants: {
|
|
8
38
|
disabled: {
|
|
@@ -51,29 +81,7 @@ var radioStyles = tv({
|
|
|
51
81
|
}
|
|
52
82
|
]
|
|
53
83
|
});
|
|
54
|
-
|
|
55
|
-
* RadioButton Component
|
|
56
|
-
*
|
|
57
|
-
* A custom radio button component with support for labels, help text, and extensive styling using Tailwind Variants (tv).
|
|
58
|
-
*
|
|
59
|
-
* @component
|
|
60
|
-
*
|
|
61
|
-
* @param {Object} props - Props for the RadioButton component.
|
|
62
|
-
* @param {string} [props.label] - The text label for the radio button.
|
|
63
|
-
* @param {boolean} [props.labelHidden=false] - If true, hides the label visually but keeps it available for screen readers.
|
|
64
|
-
* @param {string} [props.id] - The unique identifier for the radio input.
|
|
65
|
-
* @param {string} [props.name] - The name attribute for the radio input (must be the same for grouped buttons).
|
|
66
|
-
* @param {string} [props.value] - The value attribute for the radio input.
|
|
67
|
-
* @param {string} [props.error] - An error message associated with the radio button, if any.
|
|
68
|
-
* @param {boolean} [props.checked=false] - Indicates whether the radio button is checked.
|
|
69
|
-
* @param {boolean} [props.disabled=false] - Indicates whether the radio button is disabled.
|
|
70
|
-
* @param {string} [props.helpText] - Additional descriptive text for the radio button.
|
|
71
|
-
* @param {function} [props.onChange] - Callback function called when the radio button state changes.
|
|
72
|
-
* @param {function} [props.onFocus] - Callback function called when the radio button gains focus.
|
|
73
|
-
* @param {function} [props.onBlur] - Callback function called when the radio button loses focus.
|
|
74
|
-
*
|
|
75
|
-
* @returns {JSX.Element} The rendered RadioButton component.
|
|
76
|
-
*/ function RadioButton() {
|
|
84
|
+
function RadioButton() {
|
|
77
85
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
78
86
|
var label = props.label, tooltip = props.tooltip, labelHidden = props.labelHidden, id = props.id, name = props.name, value = props.value, error = props.error, _props_checked = props.checked, checked = _props_checked === void 0 ? false : _props_checked, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, helpText = props.helpText, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, _props_alignItems = props.alignItems, alignItems = _props_alignItems === void 0 ? "stretch" : _props_alignItems;
|
|
79
87
|
var hasError = !!error;
|
|
@@ -2,8 +2,42 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { tv } from "tailwind-variants";
|
|
3
3
|
import Text from "./Text.js";
|
|
4
4
|
import Label from "./Label.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @component RadioButtonCard
|
|
7
|
+
*
|
|
8
|
+
* @description A card-styled radio input that displays a title and description within a selectable card container.
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
* - DO: Use for visually prominent single-choice selections with descriptive content.
|
|
12
|
+
* - DON'T: Use for simple inline radio inputs (use RadioButton).
|
|
13
|
+
*
|
|
14
|
+
* @accessibility
|
|
15
|
+
* - The entire card is clickable and keyboard accessible; ensure title clearly describes the option.
|
|
16
|
+
*
|
|
17
|
+
* @alternative
|
|
18
|
+
* - If you need a simple inline radio button, use `RadioButton`. If you need a checkbox-style card, use `CheckboxCard`.
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} props - Props for the RadioButtonCard component.
|
|
21
|
+
* @param {string} [props.label] - The text label for the radio button.
|
|
22
|
+
* @param {boolean} [props.labelHidden=false] - If true, hides the label visually but keeps it available for screen readers.
|
|
23
|
+
* @param {string} [props.id] - The unique identifier for the radio input.
|
|
24
|
+
* @param {string} [props.name] - The name attribute for the radio input (must be the same for grouped buttons).
|
|
25
|
+
* @param {string} [props.description] - A description of the radio button.
|
|
26
|
+
* @param {string} [props.value] - The value attribute for the radio input.
|
|
27
|
+
* @param {string} [props.error] - An error message associated with the radio button, if any.
|
|
28
|
+
* @param {boolean} [props.checked=false] - Indicates whether the radio button is checked.
|
|
29
|
+
* @param {boolean} [props.disabled=false] - Indicates whether the radio button is disabled.
|
|
30
|
+
* @param {string} [props.helpText] - Additional descriptive text for the radio button.
|
|
31
|
+
* @param {function} [props.onChange] - Callback function called when the radio button state changes.
|
|
32
|
+
* @param {function} [props.onFocus] - Callback function called when the radio button gains focus.
|
|
33
|
+
* @param {function} [props.onBlur] - Callback function called when the radio button loses focus.
|
|
34
|
+
* @param {boolean} [props.hideRadioButton=false] - When true, hides the visual radio button control.
|
|
35
|
+
* @param {React.ReactNode} [props.icon=null] - Optional icon JSX to display in the card.
|
|
36
|
+
* @param {boolean} [props.allowDeselect=true] - When true, clicking an already-selected card deselects it by calling onChange with a synthetic event where target.value is null.
|
|
37
|
+
*
|
|
38
|
+
* @returns {JSX.Element} The rendered RadioButton component.
|
|
39
|
+
*/ var styles = tv({
|
|
40
|
+
base: "Litho-RadioButtonCardContainer border border-transparent rounded-lg p-3 pl-4 flex justify-between gap-2 hover:border-form-border-focus hover:ring hover:ring-form-focus",
|
|
7
41
|
variants: {
|
|
8
42
|
disabled: {
|
|
9
43
|
true: "bg-tint-1",
|
|
@@ -18,12 +52,12 @@ var styles = tv({
|
|
|
18
52
|
{
|
|
19
53
|
disabled: false,
|
|
20
54
|
checked: true,
|
|
21
|
-
class: "border-form-border-focus
|
|
55
|
+
class: "border-form-border-focus bg-surface-selected"
|
|
22
56
|
},
|
|
23
57
|
{
|
|
24
58
|
disabled: false,
|
|
25
59
|
checked: false,
|
|
26
|
-
class: "
|
|
60
|
+
class: ""
|
|
27
61
|
}
|
|
28
62
|
]
|
|
29
63
|
});
|
|
@@ -61,32 +95,9 @@ var radioStyles = tv({
|
|
|
61
95
|
}
|
|
62
96
|
]
|
|
63
97
|
});
|
|
64
|
-
|
|
65
|
-
* RadioButton Component
|
|
66
|
-
*
|
|
67
|
-
* A custom radio button component with support for labels, help text, and extensive styling using Tailwind Variants (tv).
|
|
68
|
-
*
|
|
69
|
-
* @component
|
|
70
|
-
*
|
|
71
|
-
* @param {Object} props - Props for the RadioButton component.
|
|
72
|
-
* @param {string} [props.label] - The text label for the radio button.
|
|
73
|
-
* @param {boolean} [props.labelHidden=false] - If true, hides the label visually but keeps it available for screen readers.
|
|
74
|
-
* @param {string} [props.id] - The unique identifier for the radio input.
|
|
75
|
-
* @param {string} [props.name] - The name attribute for the radio input (must be the same for grouped buttons).
|
|
76
|
-
* @param {string} [props.description] - A description of the radio button.
|
|
77
|
-
* @param {string} [props.value] - The value attribute for the radio input.
|
|
78
|
-
* @param {string} [props.error] - An error message associated with the radio button, if any.
|
|
79
|
-
* @param {boolean} [props.checked=false] - Indicates whether the radio button is checked.
|
|
80
|
-
* @param {boolean} [props.disabled=false] - Indicates whether the radio button is disabled.
|
|
81
|
-
* @param {string} [props.helpText] - Additional descriptive text for the radio button.
|
|
82
|
-
* @param {function} [props.onChange] - Callback function called when the radio button state changes.
|
|
83
|
-
* @param {function} [props.onFocus] - Callback function called when the radio button gains focus.
|
|
84
|
-
* @param {function} [props.onBlur] - Callback function called when the radio button loses focus.
|
|
85
|
-
*
|
|
86
|
-
* @returns {JSX.Element} The rendered RadioButton component.
|
|
87
|
-
*/ function RadioButtonCard() {
|
|
98
|
+
function RadioButtonCard() {
|
|
88
99
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
89
|
-
var label = props.label, tooltip = props.tooltip, labelHidden = props.labelHidden, id = props.id, name = props.name, description = props.description, value = props.value, error = props.error, _props_checked = props.checked, checked = _props_checked === void 0 ? false : _props_checked, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, helpText = props.helpText, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur;
|
|
100
|
+
var label = props.label, tooltip = props.tooltip, labelHidden = props.labelHidden, id = props.id, name = props.name, description = props.description, value = props.value, error = props.error, _props_checked = props.checked, checked = _props_checked === void 0 ? false : _props_checked, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, helpText = props.helpText, _props_hideRadioButton = props.hideRadioButton, hideRadioButton = _props_hideRadioButton === void 0 ? false : _props_hideRadioButton, _props_icon = props.icon, icon = _props_icon === void 0 ? null : _props_icon, _props_allowDeselect = props.allowDeselect, allowDeselect = _props_allowDeselect === void 0 ? true : _props_allowDeselect, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, _props_labelFontWeight = props.labelFontWeight, labelFontWeight = _props_labelFontWeight === void 0 ? "semibold" : _props_labelFontWeight;
|
|
90
101
|
var hasError = !!error;
|
|
91
102
|
var classes = styles({
|
|
92
103
|
checked: checked,
|
|
@@ -113,57 +124,71 @@ var radioStyles = tv({
|
|
|
113
124
|
onBlur(event);
|
|
114
125
|
}
|
|
115
126
|
};
|
|
127
|
+
var handleLabelClick = function() {
|
|
128
|
+
if (allowDeselect && checked && !disabled) {
|
|
129
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
130
|
+
target: {
|
|
131
|
+
value: null
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
116
136
|
return /*#__PURE__*/ _jsxs("div", {
|
|
117
137
|
className: "flex flex-col gap-1",
|
|
118
138
|
children: [
|
|
119
139
|
/*#__PURE__*/ _jsxs("label", {
|
|
120
140
|
className: classes,
|
|
141
|
+
onClick: handleLabelClick,
|
|
121
142
|
children: [
|
|
122
143
|
/*#__PURE__*/ _jsxs("div", {
|
|
123
|
-
className: "flex
|
|
144
|
+
className: "flex items-center gap-4",
|
|
124
145
|
children: [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
fontWeight: "semibold",
|
|
129
|
-
as: "p",
|
|
130
|
-
children: label
|
|
146
|
+
icon && /*#__PURE__*/ _jsx("div", {
|
|
147
|
+
className: "flex-shrink-0",
|
|
148
|
+
children: icon
|
|
131
149
|
}),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
150
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
151
|
+
children: [
|
|
152
|
+
label && !labelHidden && /*#__PURE__*/ _jsx(Label, {
|
|
153
|
+
tooltip: tooltip,
|
|
154
|
+
disabled: disabled,
|
|
155
|
+
fontWeight: labelFontWeight,
|
|
156
|
+
as: "p",
|
|
157
|
+
children: label
|
|
158
|
+
}),
|
|
159
|
+
description && /*#__PURE__*/ _jsx(Text, {
|
|
160
|
+
color: disabled ? "disabled" : "subdued",
|
|
161
|
+
children: description
|
|
162
|
+
})
|
|
163
|
+
]
|
|
135
164
|
})
|
|
136
165
|
]
|
|
137
166
|
}),
|
|
138
|
-
/*#__PURE__*/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
checked && hasError && /*#__PURE__*/ _jsx("div", {
|
|
161
|
-
className: "rounded-full w-1.5 h-1.5 ".concat(disabled ? "bg-form-input-fg-disabled" : "bg-form-bg")
|
|
162
|
-
})
|
|
163
|
-
]
|
|
167
|
+
/*#__PURE__*/ _jsx("input", {
|
|
168
|
+
type: "radio",
|
|
169
|
+
id: id,
|
|
170
|
+
name: name,
|
|
171
|
+
value: value,
|
|
172
|
+
checked: checked,
|
|
173
|
+
disabled: disabled,
|
|
174
|
+
onChange: handleChange,
|
|
175
|
+
onFocus: handleFocus,
|
|
176
|
+
onBlur: handleBlur,
|
|
177
|
+
className: "sr-only"
|
|
178
|
+
}),
|
|
179
|
+
!hideRadioButton && /*#__PURE__*/ _jsx("div", {
|
|
180
|
+
className: "Litho-RadioButton__ControlContainer w-5 h-5 flex items-center",
|
|
181
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
182
|
+
className: radioClasses,
|
|
183
|
+
children: [
|
|
184
|
+
checked && !hasError && /*#__PURE__*/ _jsx("div", {
|
|
185
|
+
className: "rounded-full w-1.5 h-1.5 ".concat(disabled ? "bg-form-input-fg-disabled" : "bg-form-input-fg-light")
|
|
186
|
+
}),
|
|
187
|
+
checked && hasError && /*#__PURE__*/ _jsx("div", {
|
|
188
|
+
className: "rounded-full w-1.5 h-1.5 ".concat(disabled ? "bg-form-input-fg-disabled" : "bg-form-bg")
|
|
164
189
|
})
|
|
165
|
-
|
|
166
|
-
|
|
190
|
+
]
|
|
191
|
+
})
|
|
167
192
|
})
|
|
168
193
|
]
|
|
169
194
|
}),
|