@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
|
@@ -1,4 +1,56 @@
|
|
|
1
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
|
+
}
|
|
2
54
|
function _type_of(obj) {
|
|
3
55
|
"@swc/helpers - typeof";
|
|
4
56
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -12,6 +64,58 @@ import Spinner from "./Spinner.js";
|
|
|
12
64
|
import Text from "./Text.js";
|
|
13
65
|
import Tooltip from "./Tooltip.js";
|
|
14
66
|
import { useFrame } from "./Frame.js";
|
|
67
|
+
import { ModalContext } from "./Modal.js";
|
|
68
|
+
/**
|
|
69
|
+
* @component Card
|
|
70
|
+
*
|
|
71
|
+
* @description A bordered container component that groups related content into a visually distinct section with optional header, sections, and actions.
|
|
72
|
+
*
|
|
73
|
+
* @usage
|
|
74
|
+
* - DO: Group related content into a visually distinct, bordered container.
|
|
75
|
+
* - DON'T: Nest Cards inside other Cards.
|
|
76
|
+
*
|
|
77
|
+
* @accessibility
|
|
78
|
+
* - Card uses semantic grouping; ensure heading props render appropriate heading levels.
|
|
79
|
+
*
|
|
80
|
+
* @alternative
|
|
81
|
+
* - If you need a plain container without borders, use `Box`.
|
|
82
|
+
* - If you need a full-page layout, use `Layout`.
|
|
83
|
+
*
|
|
84
|
+
* @param {Object} props - Props for the Card component.
|
|
85
|
+
* @param {boolean} [props.allowOverflow=false] - Allows content to overflow the Card boundaries.
|
|
86
|
+
* @param {React.ReactNode} [props.children] - Child elements to render inside the Card.
|
|
87
|
+
* @param {boolean} [props.hideOnPrint] - Hides the Card when printing.
|
|
88
|
+
* @param {string|React.ReactNode} [props.title] - Title of the Card.
|
|
89
|
+
* @param {string} [props.titleVariant='headingMd'] - Typography variant for the Card title.
|
|
90
|
+
* @param {string} [props.description] - Description of the Card.
|
|
91
|
+
* @param {string} [props.descriptionVariant='bodyMd'] - Typography variant for the Card description.
|
|
92
|
+
* @param {React.ElementType|Object} [props.icon] - Icon to render alongside the title.
|
|
93
|
+
* @param {React.ReactNode|import("./Tooltip").TooltipContentObject} [props.tooltip] - Tooltip content for the title.
|
|
94
|
+
* @param {string} [props.tooltipPreferredPosition='above'] - Preferred position for the tooltip.
|
|
95
|
+
* @param {boolean} [props.outlined=false] - Applies outlined styling to the Card.
|
|
96
|
+
* @param {string} [props.shadow='default'] - Applies a shadow to the Card. Can be 'default', or 'none'.
|
|
97
|
+
* @param {boolean} [props.highlighted=false] - Applies highlighted styling to the Card.
|
|
98
|
+
* @param {boolean} [props.subdued=false] - Applies subdued styling to the Card.
|
|
99
|
+
* @param {boolean} [props.alternate=false] - Applies alternate styling to the Card.
|
|
100
|
+
* @param {boolean} [props.padded=false] - Adds padding to the Card body.
|
|
101
|
+
* @param {boolean} [props.loading=false] - Shows a loading spinner in place of the title.
|
|
102
|
+
* @param {boolean} [props.paddedHalf=false] - Adds half padding to the Card body.
|
|
103
|
+
* @param {boolean} [props.removeHeaderBottomPadding=false] - Removes bottom padding from the header.
|
|
104
|
+
* @param {Function} [props.onClick] - Click handler for the Card, making it clickable.
|
|
105
|
+
* @param {Object} [props.emptyState={}] - Configures the empty state of the Card.
|
|
106
|
+
* @param {Object} [props.action] - Action button or configuration to render in the Card header.
|
|
107
|
+
* @param {string} [props.className] - Additional classes to apply to the Card.
|
|
108
|
+
* @param {string} [props.headerClassName] - Additional classes to apply to the Card header.
|
|
109
|
+
* @param {React.ReactNode} [props.accessory] - Accessory element to render in the header.
|
|
110
|
+
* @param {boolean} [props.fullWidthOnMobile] - Makes the Card full width on mobile. Defaults to `true` for top-level cards, `false` for nested cards.
|
|
111
|
+
* @param {boolean} [props.roundedOnMobile] - Makes the Card rounded on mobile. Defaults to `false` for top-level cards, `true` for nested cards.
|
|
112
|
+
* @returns {React.ReactElement} The rendered Card component.
|
|
113
|
+
*/ var CardContext = /*#__PURE__*/ React.createContext({
|
|
114
|
+
nested: false
|
|
115
|
+
});
|
|
116
|
+
var NESTED_CONTEXT = {
|
|
117
|
+
nested: true
|
|
118
|
+
};
|
|
15
119
|
var styles = tv({
|
|
16
120
|
base: "Litho-Card relative",
|
|
17
121
|
variants: {
|
|
@@ -48,7 +152,7 @@ var styles = tv({
|
|
|
48
152
|
false: ""
|
|
49
153
|
},
|
|
50
154
|
highlighted: {
|
|
51
|
-
true: "cursor-pointer
|
|
155
|
+
true: "cursor-pointer outline outline-form-border-focus",
|
|
52
156
|
false: ""
|
|
53
157
|
},
|
|
54
158
|
shadow: {
|
|
@@ -59,6 +163,10 @@ var styles = tv({
|
|
|
59
163
|
embedded: {
|
|
60
164
|
true: "",
|
|
61
165
|
false: ""
|
|
166
|
+
},
|
|
167
|
+
nested: {
|
|
168
|
+
true: "",
|
|
169
|
+
false: ""
|
|
62
170
|
}
|
|
63
171
|
},
|
|
64
172
|
compoundVariants: [
|
|
@@ -82,7 +190,14 @@ var styles = tv({
|
|
|
82
190
|
subdued: false,
|
|
83
191
|
alternate: false,
|
|
84
192
|
highlighted: true,
|
|
85
|
-
className: "bg-surface-
|
|
193
|
+
className: "bg-surface-selected hover:bg-surface-selected dark:border-t dark:border-tint-alt-2"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
nested: true,
|
|
197
|
+
subdued: false,
|
|
198
|
+
alternate: false,
|
|
199
|
+
highlighted: false,
|
|
200
|
+
className: "outline-edge-light @md:outline-edge-light"
|
|
86
201
|
}
|
|
87
202
|
],
|
|
88
203
|
defaultVariants: {
|
|
@@ -92,7 +207,8 @@ var styles = tv({
|
|
|
92
207
|
outlined: false,
|
|
93
208
|
highlighted: false,
|
|
94
209
|
shadow: "default",
|
|
95
|
-
embedded: false
|
|
210
|
+
embedded: false,
|
|
211
|
+
nested: false
|
|
96
212
|
}
|
|
97
213
|
});
|
|
98
214
|
var headerStyles = tv({
|
|
@@ -139,41 +255,14 @@ var bodyStyles = tv({
|
|
|
139
255
|
}
|
|
140
256
|
]
|
|
141
257
|
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
* @component
|
|
146
|
-
* @param {Object} props - Props for the Card component.
|
|
147
|
-
* @param {boolean} [props.allowOverflow=false] - Allows content to overflow the Card boundaries.
|
|
148
|
-
* @param {React.ReactNode} [props.children] - Child elements to render inside the Card.
|
|
149
|
-
* @param {boolean} [props.hideOnPrint] - Hides the Card when printing.
|
|
150
|
-
* @param {string|React.ReactNode} [props.title] - Title of the Card.
|
|
151
|
-
* @param {string} [props.titleVariant='headingMd'] - Typography variant for the Card title.
|
|
152
|
-
* @param {string} [props.description] - Description of the Card.
|
|
153
|
-
* @param {React.ElementType|Object} [props.icon] - Icon to render alongside the title.
|
|
154
|
-
* @param {React.ReactNode|import("./Tooltip").TooltipContentObject} [props.tooltip] - Tooltip content for the title.
|
|
155
|
-
* @param {string} [props.tooltipPreferredPosition='above'] - Preferred position for the tooltip.
|
|
156
|
-
* @param {boolean} [props.outlined=false] - Applies outlined styling to the Card.
|
|
157
|
-
* @param {string} [props.shadow='default'] - Applies a shadow to the Card. Can be 'default', or 'none'.
|
|
158
|
-
* @param {boolean} [props.highlighted=false] - Applies highlighted styling to the Card.
|
|
159
|
-
* @param {boolean} [props.subdued=false] - Applies subdued styling to the Card.
|
|
160
|
-
* @param {boolean} [props.alternate=false] - Applies alternate styling to the Card.
|
|
161
|
-
* @param {boolean} [props.padded=false] - Adds padding to the Card body.
|
|
162
|
-
* @param {boolean} [props.loading=false] - Shows a loading spinner in place of the title.
|
|
163
|
-
* @param {boolean} [props.paddedHalf=false] - Adds half padding to the Card body.
|
|
164
|
-
* @param {boolean} [props.removeHeaderBottomPadding=false] - Removes bottom padding from the header.
|
|
165
|
-
* @param {Function} [props.onClick] - Click handler for the Card, making it clickable.
|
|
166
|
-
* @param {Object} [props.emptyState={}] - Configures the empty state of the Card.
|
|
167
|
-
* @param {Object} [props.action] - Action button or configuration to render in the Card header.
|
|
168
|
-
* @param {string} [props.className] - Additional classes to apply to the Card.
|
|
169
|
-
* @param {string} [props.headerClassName] - Additional classes to apply to the Card header.
|
|
170
|
-
* @param {React.ReactNode} [props.accessory] - Accessory element to render in the header.
|
|
171
|
-
* @param {boolean} [props.fullWidthOnMobile=true] - Makes the Card full width on mobile.
|
|
172
|
-
* @param {boolean} [props.roundedOnMobile=false] - Makes the Card rounded on mobile.
|
|
173
|
-
* @returns {React.ReactElement} The rendered Card component.
|
|
174
|
-
*/ var Card = function(param) {
|
|
175
|
-
var _param_allowOverflow = param.allowOverflow, allowOverflow = _param_allowOverflow === void 0 ? false : _param_allowOverflow, _param_roundedOnMobile = param.roundedOnMobile, roundedOnMobile = _param_roundedOnMobile === void 0 ? false : _param_roundedOnMobile, children = param.children, hideOnPrint = param.hideOnPrint, title = param.title, _param_titleVariant = param.titleVariant, titleVariant = _param_titleVariant === void 0 ? "headingMd" : _param_titleVariant, description = param.description, icon = param.icon, tooltip = param.tooltip, _param_tooltipPreferredPosition = param.tooltipPreferredPosition, tooltipPreferredPosition = _param_tooltipPreferredPosition === void 0 ? "above" : _param_tooltipPreferredPosition, _param_outlined = param.outlined, outlined = _param_outlined === void 0 ? false : _param_outlined, _param_highlighted = param.highlighted, highlighted = _param_highlighted === void 0 ? false : _param_highlighted, _param_subdued = param.subdued, subdued = _param_subdued === void 0 ? false : _param_subdued, _param_alternate = param.alternate, alternate = _param_alternate === void 0 ? false : _param_alternate, _param_padded = param.padded, padded = _param_padded === void 0 ? false : _param_padded, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading, _param_paddedHalf = param.paddedHalf, paddedHalf = _param_paddedHalf === void 0 ? false : _param_paddedHalf, _param_removeHeaderBottomPadding = param.removeHeaderBottomPadding, removeHeaderBottomPadding = _param_removeHeaderBottomPadding === void 0 ? false : _param_removeHeaderBottomPadding, onClick = param.onClick, _param_emptyState = param.emptyState, emptyState = _param_emptyState === void 0 ? {} : _param_emptyState, action = param.action, className = param.className, headerClassName = param.headerClassName, accessory = param.accessory, _param_fullHeightBody = param.fullHeightBody, fullHeightBody = _param_fullHeightBody === void 0 ? false : _param_fullHeightBody, _param_fullWidthOnMobile = param.fullWidthOnMobile, fullWidthOnMobile = _param_fullWidthOnMobile === void 0 ? true : _param_fullWidthOnMobile, _param_shadow = param.shadow, shadow = _param_shadow === void 0 ? "default" : _param_shadow;
|
|
258
|
+
var Card = function(param) {
|
|
259
|
+
var _param_allowOverflow = param.allowOverflow, allowOverflow = _param_allowOverflow === void 0 ? false : _param_allowOverflow, roundedOnMobile = param.roundedOnMobile, children = param.children, hideOnPrint = param.hideOnPrint, title = param.title, _param_titleVariant = param.titleVariant, titleVariant = _param_titleVariant === void 0 ? "headingMd" : _param_titleVariant, description = param.description, _param_descriptionVariant = param.descriptionVariant, descriptionVariant = _param_descriptionVariant === void 0 ? "bodyMd" : _param_descriptionVariant, icon = param.icon, tooltip = param.tooltip, _param_tooltipPreferredPosition = param.tooltipPreferredPosition, tooltipPreferredPosition = _param_tooltipPreferredPosition === void 0 ? "above" : _param_tooltipPreferredPosition, _param_outlined = param.outlined, outlined = _param_outlined === void 0 ? false : _param_outlined, _param_highlighted = param.highlighted, highlighted = _param_highlighted === void 0 ? false : _param_highlighted, _param_subdued = param.subdued, subdued = _param_subdued === void 0 ? false : _param_subdued, _param_alternate = param.alternate, alternate = _param_alternate === void 0 ? false : _param_alternate, _param_padded = param.padded, padded = _param_padded === void 0 ? false : _param_padded, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading, _param_paddedHalf = param.paddedHalf, paddedHalf = _param_paddedHalf === void 0 ? false : _param_paddedHalf, _param_removeHeaderBottomPadding = param.removeHeaderBottomPadding, removeHeaderBottomPadding = _param_removeHeaderBottomPadding === void 0 ? false : _param_removeHeaderBottomPadding, onClick = param.onClick, _param_emptyState = param.emptyState, emptyState = _param_emptyState === void 0 ? {} : _param_emptyState, action = param.action, className = param.className, headerClassName = param.headerClassName, accessory = param.accessory, _param_fullHeightBody = param.fullHeightBody, fullHeightBody = _param_fullHeightBody === void 0 ? false : _param_fullHeightBody, fullWidthOnMobile = param.fullWidthOnMobile, _param_shadow = param.shadow, shadow = _param_shadow === void 0 ? "default" : _param_shadow, nestedProp = param.nested;
|
|
176
260
|
var embedded = useFrame().embedded;
|
|
261
|
+
var _React_useContext = React.useContext(CardContext), cardNested = _React_useContext.nested;
|
|
262
|
+
var isInModal = React.useContext(ModalContext);
|
|
263
|
+
var nested = nestedProp !== null && nestedProp !== void 0 ? nestedProp : cardNested || isInModal;
|
|
264
|
+
var resolvedFullWidthOnMobile = fullWidthOnMobile !== null && fullWidthOnMobile !== void 0 ? fullWidthOnMobile : nested ? false : true;
|
|
265
|
+
var resolvedRoundedOnMobile = roundedOnMobile !== null && roundedOnMobile !== void 0 ? roundedOnMobile : nested ? true : false;
|
|
177
266
|
var showHeader = !!(title || action);
|
|
178
267
|
var isClickable = !!onClick;
|
|
179
268
|
var classes = styles({
|
|
@@ -182,12 +271,13 @@ var bodyStyles = tv({
|
|
|
182
271
|
alternate: alternate,
|
|
183
272
|
allowOverflow: allowOverflow,
|
|
184
273
|
isClickable: isClickable,
|
|
185
|
-
fullWidthOnMobile:
|
|
186
|
-
roundedOnMobile:
|
|
274
|
+
fullWidthOnMobile: resolvedFullWidthOnMobile,
|
|
275
|
+
roundedOnMobile: resolvedRoundedOnMobile,
|
|
187
276
|
outlined: outlined,
|
|
188
|
-
shadow: shadow,
|
|
277
|
+
shadow: nested ? "none" : shadow,
|
|
189
278
|
highlighted: highlighted,
|
|
190
|
-
embedded: embedded
|
|
279
|
+
embedded: embedded,
|
|
280
|
+
nested: nested
|
|
191
281
|
});
|
|
192
282
|
var headerClasses = headerStyles({
|
|
193
283
|
padded: padded,
|
|
@@ -217,89 +307,103 @@ var bodyStyles = tv({
|
|
|
217
307
|
}
|
|
218
308
|
return React.Children.toArray(children).map(process);
|
|
219
309
|
};
|
|
220
|
-
return /*#__PURE__*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
|
|
310
|
+
return /*#__PURE__*/ _jsx(CardContext.Provider, {
|
|
311
|
+
value: NESTED_CONTEXT,
|
|
312
|
+
children: /*#__PURE__*/ _jsxs("div", _object_spread_props(_object_spread({
|
|
313
|
+
className: "".concat(classes).concat(className ? " ".concat(className) : ""),
|
|
314
|
+
onClick: isClickable ? onClick : undefined
|
|
315
|
+
}, isClickable ? {
|
|
316
|
+
role: "button",
|
|
317
|
+
tabIndex: 0,
|
|
318
|
+
onKeyDown: function(e) {
|
|
319
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
320
|
+
e.preventDefault();
|
|
321
|
+
onClick();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
} : {}), {
|
|
325
|
+
children: [
|
|
326
|
+
showHeader && /*#__PURE__*/ _jsxs("div", {
|
|
327
|
+
className: "".concat(headerClasses).concat(headerClassName ? " ".concat(headerClassName) : ""),
|
|
328
|
+
children: [
|
|
329
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
330
|
+
className: "w-full flex gap-2 justify-between items-center",
|
|
331
|
+
children: [
|
|
332
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
333
|
+
className: "Litho-Card__HeaderTitle flex items-center gap-2",
|
|
334
|
+
children: [
|
|
335
|
+
loading ? /*#__PURE__*/ _jsx(Spinner, {
|
|
336
|
+
size: "small"
|
|
337
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
338
|
+
children: [
|
|
339
|
+
icon && typeof icon === "function" && /*#__PURE__*/ _jsx(Icon, {
|
|
340
|
+
source: icon,
|
|
341
|
+
color: "subdued"
|
|
342
|
+
}),
|
|
343
|
+
icon && (typeof icon === "undefined" ? "undefined" : _type_of(icon)) === "object" && icon
|
|
344
|
+
]
|
|
345
|
+
}),
|
|
346
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
347
|
+
children: [
|
|
348
|
+
title && typeof title === "string" ? /*#__PURE__*/ _jsx(Text, {
|
|
349
|
+
variant: titleVariant,
|
|
350
|
+
children: title
|
|
351
|
+
}) : title,
|
|
352
|
+
description && /*#__PURE__*/ _jsx(Text, {
|
|
353
|
+
color: "subdued",
|
|
354
|
+
variant: descriptionVariant,
|
|
355
|
+
children: description
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
}),
|
|
359
|
+
tooltip && /*#__PURE__*/ _jsx(Tooltip, {
|
|
360
|
+
content: tooltip,
|
|
361
|
+
preferredPosition: tooltipPreferredPosition
|
|
362
|
+
})
|
|
363
|
+
]
|
|
364
|
+
}),
|
|
365
|
+
action && /*#__PURE__*/ _jsx("div", {
|
|
366
|
+
className: "Litho-Card__HeaderAction self-start",
|
|
367
|
+
children: action.content ? /*#__PURE__*/ _jsx(Button, {
|
|
368
|
+
link: true,
|
|
369
|
+
onClick: action.onAction || action.onClick,
|
|
370
|
+
primary: action.primary,
|
|
371
|
+
destructive: action.destructive,
|
|
372
|
+
icon: action.icon,
|
|
373
|
+
loading: action.loading,
|
|
374
|
+
disabled: action.disabled,
|
|
375
|
+
connectedDisclosure: action.connectedDisclosure,
|
|
376
|
+
children: action.content
|
|
377
|
+
}) : action
|
|
378
|
+
})
|
|
379
|
+
]
|
|
380
|
+
}),
|
|
381
|
+
accessory && /*#__PURE__*/ _jsx("div", {
|
|
382
|
+
className: "Litho-Card__HeaderAccessory pr-2",
|
|
383
|
+
children: accessory
|
|
384
|
+
})
|
|
385
|
+
]
|
|
386
|
+
}),
|
|
387
|
+
emptyState.showIf ? /*#__PURE__*/ _jsx("div", {
|
|
388
|
+
className: bodyStyles({
|
|
389
|
+
padding: "full",
|
|
390
|
+
showHeader: showHeader,
|
|
391
|
+
fullHeight: fullHeightBody
|
|
277
392
|
}),
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
children:
|
|
393
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
394
|
+
color: "subdued",
|
|
395
|
+
children: emptyState.text
|
|
281
396
|
})
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}),
|
|
290
|
-
children: /*#__PURE__*/ _jsx(Text, {
|
|
291
|
-
color: "subdued",
|
|
292
|
-
children: emptyState.text
|
|
397
|
+
}) : /*#__PURE__*/ _jsx("div", {
|
|
398
|
+
className: bodyStyles({
|
|
399
|
+
padding: padded ? "full" : paddedHalf ? "half" : "none",
|
|
400
|
+
showHeader: showHeader,
|
|
401
|
+
fullHeight: fullHeightBody
|
|
402
|
+
}),
|
|
403
|
+
children: processCardChildren(children)
|
|
293
404
|
})
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
padding: padded ? "full" : paddedHalf ? "half" : "none",
|
|
297
|
-
showHeader: showHeader,
|
|
298
|
-
fullHeight: fullHeightBody
|
|
299
|
-
}),
|
|
300
|
-
children: processCardChildren(children)
|
|
301
|
-
})
|
|
302
|
-
]
|
|
405
|
+
]
|
|
406
|
+
}))
|
|
303
407
|
});
|
|
304
408
|
};
|
|
305
409
|
var sectionStyles = tv({
|
|
@@ -389,9 +493,12 @@ var sectionBodyStyles = tv({
|
|
|
389
493
|
]
|
|
390
494
|
});
|
|
391
495
|
/**
|
|
392
|
-
*
|
|
496
|
+
* @component Card.Section
|
|
497
|
+
*
|
|
498
|
+
* @usage
|
|
499
|
+
* - DO: Divide a Card into logical content segments.
|
|
500
|
+
* - DON'T: Nest sections within sections.
|
|
393
501
|
*
|
|
394
|
-
* @component
|
|
395
502
|
* @param {Object} props - Props for the Section component.
|
|
396
503
|
* @param {string|React.ReactNode} [props.title] - Title of the Section.
|
|
397
504
|
* @param {string} [props.titleVariant='headingSm'] - Typography variant for the Section title.
|
|
@@ -409,12 +516,13 @@ var sectionBodyStyles = tv({
|
|
|
409
516
|
* @param {React.ElementType|Object} [props.icon] - Icon to render alongside the title.
|
|
410
517
|
* @param {string} [props.tooltip] - Tooltip content for the title.
|
|
411
518
|
* @param {string} [props.description] - Description text for the Section.
|
|
519
|
+
* @param {string} [props.descriptionVariant='bodyMd'] - Typography variant for the Section description.
|
|
412
520
|
* @param {React.ReactNode} [props.accessory] - Accessory element to render in the Section header.
|
|
413
521
|
* @param {Object} [props.emptyState={}] - Configures the empty state of the Section.
|
|
414
522
|
*
|
|
415
523
|
* @returns {React.ReactElement} The rendered Section component.
|
|
416
524
|
*/ Card.Section = function(param) {
|
|
417
|
-
var title = param.title, _param_titleVariant = param.titleVariant, titleVariant = _param_titleVariant === void 0 ? "headingSm" : _param_titleVariant, action = param.action, children = param.children, _param_padded = param.padded, padded = _param_padded === void 0 ? true : _param_padded, _param_paddedHalf = param.paddedHalf, paddedHalf = _param_paddedHalf === void 0 ? false : _param_paddedHalf, _param_isFirst = param.isFirst, isFirst = _param_isFirst === void 0 ? false : _param_isFirst, _param_cardHasHeader = param.cardHasHeader, cardHasHeader = _param_cardHasHeader === void 0 ? false : _param_cardHasHeader, _param_borderBottom = param.borderBottom, borderBottom = _param_borderBottom === void 0 ? true : _param_borderBottom, _param_borderTop = param.borderTop, borderTop = _param_borderTop === void 0 ? false : _param_borderTop, _param_subdued = param.subdued, subdued = _param_subdued === void 0 ? false : _param_subdued, _param_headerGap = param.headerGap, headerGap = _param_headerGap === void 0 ? "0" : _param_headerGap, _param_gap = param.gap, gap = _param_gap === void 0 ? "0" : _param_gap, icon = param.icon, tooltip = param.tooltip, description = param.description, accessory = param.accessory, _param_emptyState = param.emptyState, emptyState = _param_emptyState === void 0 ? {} : _param_emptyState, className = param.className, sectionBodyClassName = param.sectionBodyClassName;
|
|
525
|
+
var title = param.title, _param_titleVariant = param.titleVariant, titleVariant = _param_titleVariant === void 0 ? "headingSm" : _param_titleVariant, action = param.action, children = param.children, _param_padded = param.padded, padded = _param_padded === void 0 ? true : _param_padded, _param_paddedHalf = param.paddedHalf, paddedHalf = _param_paddedHalf === void 0 ? false : _param_paddedHalf, _param_isFirst = param.isFirst, isFirst = _param_isFirst === void 0 ? false : _param_isFirst, _param_cardHasHeader = param.cardHasHeader, cardHasHeader = _param_cardHasHeader === void 0 ? false : _param_cardHasHeader, _param_borderBottom = param.borderBottom, borderBottom = _param_borderBottom === void 0 ? true : _param_borderBottom, _param_borderTop = param.borderTop, borderTop = _param_borderTop === void 0 ? false : _param_borderTop, _param_subdued = param.subdued, subdued = _param_subdued === void 0 ? false : _param_subdued, _param_headerGap = param.headerGap, headerGap = _param_headerGap === void 0 ? "0" : _param_headerGap, _param_gap = param.gap, gap = _param_gap === void 0 ? "0" : _param_gap, icon = param.icon, tooltip = param.tooltip, description = param.description, _param_descriptionVariant = param.descriptionVariant, descriptionVariant = _param_descriptionVariant === void 0 ? "bodyMd" : _param_descriptionVariant, accessory = param.accessory, _param_emptyState = param.emptyState, emptyState = _param_emptyState === void 0 ? {} : _param_emptyState, className = param.className, sectionBodyClassName = param.sectionBodyClassName;
|
|
418
526
|
var showHeader = !!(title || action);
|
|
419
527
|
var sectionClasses = sectionStyles({
|
|
420
528
|
borderBottom: borderBottom,
|
|
@@ -424,7 +532,7 @@ var sectionBodyStyles = tv({
|
|
|
424
532
|
});
|
|
425
533
|
var sectionHeaderClasses = sectionHeaderStyles();
|
|
426
534
|
var sectionBodyClasses = sectionBodyStyles({
|
|
427
|
-
padding: paddedHalf ? "half" : padded ? "full" : "none",
|
|
535
|
+
padding: paddedHalf || padded === "half" ? "half" : padded ? "full" : "none",
|
|
428
536
|
showHeader: showHeader,
|
|
429
537
|
cardHasHeader: cardHasHeader,
|
|
430
538
|
isFirst: isFirst,
|
|
@@ -479,6 +587,7 @@ var sectionBodyStyles = tv({
|
|
|
479
587
|
}),
|
|
480
588
|
description && /*#__PURE__*/ _jsx(Text, {
|
|
481
589
|
color: "subdued",
|
|
590
|
+
variant: descriptionVariant,
|
|
482
591
|
children: description
|
|
483
592
|
})
|
|
484
593
|
]
|
|
@@ -501,17 +610,28 @@ var sectionBodyStyles = tv({
|
|
|
501
610
|
};
|
|
502
611
|
Card.Section.displayName = "Card.Section";
|
|
503
612
|
var clickableRowStyles = tv({
|
|
504
|
-
base: "Litho-Card__Row py-1.5 px-2
|
|
613
|
+
base: "Litho-Card__Row py-1.5 px-2 @md:px-2.5 rounded-md",
|
|
505
614
|
variants: {
|
|
615
|
+
interactive: {
|
|
616
|
+
true: "cursor-pointer hover:bg-tint-2 active:bg-tint-3"
|
|
617
|
+
},
|
|
506
618
|
disabled: {
|
|
507
619
|
true: "opacity-50 cursor-not-allowed pointer-events-none"
|
|
508
620
|
}
|
|
621
|
+
},
|
|
622
|
+
defaultVariants: {
|
|
623
|
+
interactive: true
|
|
509
624
|
}
|
|
510
625
|
});
|
|
511
626
|
/**
|
|
512
|
-
*
|
|
627
|
+
* @component Card.ClickableRow
|
|
628
|
+
*
|
|
629
|
+
* @usage
|
|
630
|
+
* - DO: Use for rows that navigate or trigger actions.
|
|
631
|
+
*
|
|
632
|
+
* @accessibility
|
|
633
|
+
* - Renders as a clickable element; ensure it is keyboard accessible and has a clear action label.
|
|
513
634
|
*
|
|
514
|
-
* @component
|
|
515
635
|
* @param {Object} props - Props for the ClickableRow component.
|
|
516
636
|
* @param {React.ReactNode} [props.children] - Child elements to render inside the row.
|
|
517
637
|
* @param {Function} [props.onClick] - Click handler for the row.
|
|
@@ -519,24 +639,43 @@ var clickableRowStyles = tv({
|
|
|
519
639
|
* @param {string} [props.url] - URL to open when the row is clicked.
|
|
520
640
|
* @param {string} [props.className] - Additional classes to apply to the row.
|
|
521
641
|
* @param {boolean} [props.disabled=false] - Disables interaction with the row.
|
|
642
|
+
* @param {string} [props.accessibilityLabel] - Accessible label for the row (aria-label).
|
|
522
643
|
*
|
|
523
644
|
* @returns {React.ReactElement} The rendered ClickableRow component.
|
|
524
645
|
*/ Card.ClickableRow = function(param) {
|
|
525
|
-
var children = param.children, onClick = param.onClick, id = param.id, url = param.url, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, className = param.className;
|
|
646
|
+
var children = param.children, onClick = param.onClick, id = param.id, url = param.url, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, className = param.className, accessibilityLabel = param.accessibilityLabel;
|
|
526
647
|
var classes = clickableRowStyles({
|
|
527
648
|
disabled: disabled
|
|
528
649
|
});
|
|
650
|
+
var handleClick = url ? function() {
|
|
651
|
+
return window.open(url, "_blank");
|
|
652
|
+
} : onClick;
|
|
653
|
+
var handleKeyDown = function(e) {
|
|
654
|
+
if (disabled) return;
|
|
655
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
656
|
+
e.preventDefault();
|
|
657
|
+
handleClick === null || handleClick === void 0 ? void 0 : handleClick(e);
|
|
658
|
+
}
|
|
659
|
+
};
|
|
529
660
|
return /*#__PURE__*/ _jsx("div", {
|
|
530
661
|
id: id,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
662
|
+
role: "button",
|
|
663
|
+
tabIndex: disabled ? -1 : 0,
|
|
664
|
+
"aria-disabled": disabled || undefined,
|
|
665
|
+
"aria-label": accessibilityLabel,
|
|
666
|
+
onClick: disabled ? undefined : handleClick,
|
|
667
|
+
onKeyDown: handleKeyDown,
|
|
534
668
|
className: "".concat(classes).concat(className ? " ".concat(className) : ""),
|
|
535
669
|
children: children
|
|
536
670
|
});
|
|
537
671
|
};
|
|
538
672
|
Card.ClickableRow.displayName = "Card.ClickableRow";
|
|
539
|
-
|
|
673
|
+
/**
|
|
674
|
+
* Rows container component for grouping multiple Card.Row elements.
|
|
675
|
+
*
|
|
676
|
+
* @usage
|
|
677
|
+
* - DO: Use to group multiple `Card.Row` elements with consistent spacing.
|
|
678
|
+
*/ Card.Rows = function(param) {
|
|
540
679
|
var children = param.children;
|
|
541
680
|
return /*#__PURE__*/ _jsx("div", {
|
|
542
681
|
className: "px-1.5 pb-1.5 @md:pb-2 @md:px-2",
|
|
@@ -545,9 +684,11 @@ Card.Rows = function(param) {
|
|
|
545
684
|
};
|
|
546
685
|
Card.Rows.displayName = "Card.Rows";
|
|
547
686
|
/**
|
|
548
|
-
*
|
|
687
|
+
* @component Card.Row
|
|
688
|
+
*
|
|
689
|
+
* @usage
|
|
690
|
+
* - DO: Use for individual data rows within `Card.Rows`.
|
|
549
691
|
*
|
|
550
|
-
* @component
|
|
551
692
|
* @param {Object} props - Props for the Row component.
|
|
552
693
|
* @param {React.ReactNode} [props.children] - Child elements to render inside the row.
|
|
553
694
|
* @param {Function} [props.onClick] - Click handler for the row.
|
|
@@ -555,21 +696,40 @@ Card.Rows.displayName = "Card.Rows";
|
|
|
555
696
|
* @param {string} [props.url] - URL to open when the row is clicked.
|
|
556
697
|
* @param {string} [props.className] - Additional classes to apply to the row.
|
|
557
698
|
* @param {boolean} [props.disabled=false] - Disables interaction with the row.
|
|
699
|
+
* @param {string} [props.accessibilityLabel] - Accessible label for the row (aria-label).
|
|
558
700
|
*
|
|
559
701
|
* @returns {React.ReactElement} The rendered Row component.
|
|
560
702
|
*/ Card.Row = function(param) {
|
|
561
|
-
var children = param.children, onClick = param.onClick, id = param.id, url = param.url, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, className = param.className;
|
|
703
|
+
var children = param.children, onClick = param.onClick, id = param.id, url = param.url, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, className = param.className, accessibilityLabel = param.accessibilityLabel;
|
|
704
|
+
var isInteractive = !!(onClick || url);
|
|
562
705
|
var classes = clickableRowStyles({
|
|
563
|
-
disabled: disabled
|
|
706
|
+
disabled: isInteractive ? disabled : false,
|
|
707
|
+
interactive: isInteractive
|
|
564
708
|
});
|
|
709
|
+
var handleClick = url ? function() {
|
|
710
|
+
return window.open(url, "_blank");
|
|
711
|
+
} : onClick;
|
|
712
|
+
var handleKeyDown = function(e) {
|
|
713
|
+
if (!isInteractive || disabled) return;
|
|
714
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
715
|
+
e.preventDefault();
|
|
716
|
+
handleClick === null || handleClick === void 0 ? void 0 : handleClick(e);
|
|
717
|
+
}
|
|
718
|
+
};
|
|
565
719
|
return /*#__PURE__*/ _jsx("div", {
|
|
566
720
|
id: id,
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
721
|
+
role: isInteractive ? "button" : undefined,
|
|
722
|
+
tabIndex: isInteractive ? disabled ? -1 : 0 : undefined,
|
|
723
|
+
"aria-disabled": isInteractive && disabled ? true : undefined,
|
|
724
|
+
"aria-label": accessibilityLabel,
|
|
725
|
+
onClick: isInteractive && !disabled ? handleClick : undefined,
|
|
726
|
+
onKeyDown: isInteractive ? handleKeyDown : undefined,
|
|
570
727
|
className: "".concat(classes).concat(className ? " ".concat(className) : ""),
|
|
571
728
|
children: children
|
|
572
729
|
});
|
|
573
730
|
};
|
|
574
731
|
Card.Row.displayName = "Card.Row";
|
|
732
|
+
export var useCard = function() {
|
|
733
|
+
return React.useContext(CardContext);
|
|
734
|
+
};
|
|
575
735
|
export default Card;
|