@a-little-world/little-world-design-system 2.10.0
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/.babelrc +7 -0
- package/.storybook/main.ts +36 -0
- package/.storybook/preview-head.html +6 -0
- package/.storybook/preview.ts +15 -0
- package/.turbo/turbo-build.log +14 -0
- package/CHANGELOG.md +398 -0
- package/LICENSE +21 -0
- package/README.md +180 -0
- package/__mocks__/focus-trap-react.tsx +1 -0
- package/__mocks__/svg.tsx +6 -0
- package/dist/cjs/components/Accordion/Accordion.d.ts +15 -0
- package/dist/cjs/components/Accordion/Accordion.js +20 -0
- package/dist/cjs/components/Accordion/styles.d.ts +18 -0
- package/dist/cjs/components/Accordion/styles.js +100 -0
- package/dist/cjs/components/Button/Button.d.ts +9 -0
- package/dist/cjs/components/Button/Button.js +17 -0
- package/dist/cjs/components/Button/styles.d.ts +16 -0
- package/dist/cjs/components/Button/styles.js +313 -0
- package/dist/cjs/components/Card/Card.d.ts +11 -0
- package/dist/cjs/components/Card/Card.js +108 -0
- package/dist/cjs/components/Checkbox/Checkbox.d.ts +15 -0
- package/dist/cjs/components/Checkbox/Checkbox.js +24 -0
- package/dist/cjs/components/Checkbox/styles.d.ts +27 -0
- package/dist/cjs/components/Checkbox/styles.js +108 -0
- package/dist/cjs/components/CheckboxGrid/CheckboxGrid.d.ts +22 -0
- package/dist/cjs/components/CheckboxGrid/CheckboxGrid.js +73 -0
- package/dist/cjs/components/CheckboxGrid/styles.d.ts +64 -0
- package/dist/cjs/components/CheckboxGrid/styles.js +137 -0
- package/dist/cjs/components/Dropdown/Dropdown.d.ts +25 -0
- package/dist/cjs/components/Dropdown/Dropdown.js +70 -0
- package/dist/cjs/components/Dropdown/styles.d.ts +15 -0
- package/dist/cjs/components/Dropdown/styles.js +145 -0
- package/dist/cjs/components/Icon/Icon.d.ts +10 -0
- package/dist/cjs/components/Icon/Icon.js +82 -0
- package/dist/cjs/components/Icon/IconGradient.d.ts +4 -0
- package/dist/cjs/components/Icon/IconGradient.js +29 -0
- package/dist/cjs/components/Icon/createIconComponent.d.ts +10 -0
- package/dist/cjs/components/Icon/createIconComponent.js +31 -0
- package/dist/cjs/components/Icon/getDefaultIconProps.d.ts +2 -0
- package/dist/cjs/components/Icon/getDefaultIconProps.js +15 -0
- package/dist/cjs/components/Icon/index.d.ts +553 -0
- package/dist/cjs/components/Icon/index.js +342 -0
- package/dist/cjs/components/Illustrations/Illustration.d.ts +3 -0
- package/dist/cjs/components/Illustrations/Illustration.js +12 -0
- package/dist/cjs/components/Illustrations/createIllustrationComponent.d.ts +10 -0
- package/dist/cjs/components/Illustrations/createIllustrationComponent.js +23 -0
- package/dist/cjs/components/Illustrations/index.d.ts +152 -0
- package/dist/cjs/components/Illustrations/index.js +81 -0
- package/dist/cjs/components/InputError/InputError.d.ts +15 -0
- package/dist/cjs/components/InputError/InputError.js +79 -0
- package/dist/cjs/components/Label/Label.d.ts +10 -0
- package/dist/cjs/components/Label/Label.js +68 -0
- package/dist/cjs/components/Link/Link.d.ts +6 -0
- package/dist/cjs/components/Link/Link.js +48 -0
- package/dist/cjs/components/Link/styles.d.ts +22 -0
- package/dist/cjs/components/Link/styles.js +99 -0
- package/dist/cjs/components/Loading/Loading.d.ts +10 -0
- package/dist/cjs/components/Loading/Loading.js +27 -0
- package/dist/cjs/components/Loading/LoadingLogo.d.ts +8 -0
- package/dist/cjs/components/Loading/LoadingLogo.js +31 -0
- package/dist/cjs/components/Loading/styles.d.ts +15 -0
- package/dist/cjs/components/Loading/styles.js +107 -0
- package/dist/cjs/components/Modal/Modal.d.ts +20 -0
- package/dist/cjs/components/Modal/Modal.js +95 -0
- package/dist/cjs/components/Modal/styles.d.ts +4 -0
- package/dist/cjs/components/Modal/styles.js +102 -0
- package/dist/cjs/components/MultiCheckbox/MultiCheckbox.d.ts +15 -0
- package/dist/cjs/components/MultiCheckbox/MultiCheckbox.js +61 -0
- package/dist/cjs/components/MultiCheckbox/styles.d.ts +1 -0
- package/dist/cjs/components/MultiCheckbox/styles.js +15 -0
- package/dist/cjs/components/MultiDropdown/MultiDropdown.d.ts +28 -0
- package/dist/cjs/components/MultiDropdown/MultiDropdown.js +124 -0
- package/dist/cjs/components/MultiDropdown/styles.d.ts +7 -0
- package/dist/cjs/components/MultiDropdown/styles.js +44 -0
- package/dist/cjs/components/MultiSelection/MultiSelection.d.ts +16 -0
- package/dist/cjs/components/MultiSelection/MultiSelection.js +62 -0
- package/dist/cjs/components/MultiSelection/styles.d.ts +9 -0
- package/dist/cjs/components/MultiSelection/styles.js +99 -0
- package/dist/cjs/components/NavigationMenu/NavigationMenu.d.ts +35 -0
- package/dist/cjs/components/NavigationMenu/NavigationMenu.js +85 -0
- package/dist/cjs/components/NavigationMenu/styles.d.ts +81 -0
- package/dist/cjs/components/NavigationMenu/styles.js +296 -0
- package/dist/cjs/components/Popover/InfoPopover.d.ts +8 -0
- package/dist/cjs/components/Popover/InfoPopover.js +46 -0
- package/dist/cjs/components/Popover/Popover.d.ts +16 -0
- package/dist/cjs/components/Popover/Popover.js +61 -0
- package/dist/cjs/components/Popover/styles.d.ts +14 -0
- package/dist/cjs/components/Popover/styles.js +116 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.d.ts +8 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.js +85 -0
- package/dist/cjs/components/RadioGroup/RadioGroup.d.ts +16 -0
- package/dist/cjs/components/RadioGroup/RadioGroup.js +24 -0
- package/dist/cjs/components/RadioGroup/styles.d.ts +12 -0
- package/dist/cjs/components/RadioGroup/styles.js +126 -0
- package/dist/cjs/components/Separator/Separator.d.ts +11 -0
- package/dist/cjs/components/Separator/Separator.js +61 -0
- package/dist/cjs/components/Separator/styles.d.ts +6 -0
- package/dist/cjs/components/Separator/styles.js +57 -0
- package/dist/cjs/components/Slider/Slider.d.ts +12 -0
- package/dist/cjs/components/Slider/Slider.js +17 -0
- package/dist/cjs/components/Slider/styles.d.ts +6 -0
- package/dist/cjs/components/Slider/styles.js +57 -0
- package/dist/cjs/components/StarRating/StarRating.d.ts +22 -0
- package/dist/cjs/components/StarRating/StarRating.js +143 -0
- package/dist/cjs/components/StarRating/styles.d.ts +35 -0
- package/dist/cjs/components/StarRating/styles.js +104 -0
- package/dist/cjs/components/StatusMessage/StatusMessage.d.ts +4 -0
- package/dist/cjs/components/StatusMessage/StatusMessage.js +112 -0
- package/dist/cjs/components/Switch/Switch.d.ts +15 -0
- package/dist/cjs/components/Switch/Switch.js +19 -0
- package/dist/cjs/components/Switch/styles.d.ts +14 -0
- package/dist/cjs/components/Switch/styles.js +99 -0
- package/dist/cjs/components/Tags/Tags.d.ts +15 -0
- package/dist/cjs/components/Tags/Tags.js +17 -0
- package/dist/cjs/components/Tags/styles.d.ts +19 -0
- package/dist/cjs/components/Tags/styles.js +119 -0
- package/dist/cjs/components/Text/Text.d.ts +11 -0
- package/dist/cjs/components/Text/Text.js +13 -0
- package/dist/cjs/components/Text/styles.d.ts +8 -0
- package/dist/cjs/components/Text/styles.js +98 -0
- package/dist/cjs/components/Text/types.d.ts +8 -0
- package/dist/cjs/components/Text/types.js +2 -0
- package/dist/cjs/components/TextArea/TextArea.d.ts +19 -0
- package/dist/cjs/components/TextArea/TextArea.js +84 -0
- package/dist/cjs/components/TextArea/styles.d.ts +22 -0
- package/dist/cjs/components/TextArea/styles.js +81 -0
- package/dist/cjs/components/TextContent/TextContent.d.ts +28 -0
- package/dist/cjs/components/TextContent/TextContent.js +46 -0
- package/dist/cjs/components/TextContent/styles.d.ts +24 -0
- package/dist/cjs/components/TextContent/styles.js +75 -0
- package/dist/cjs/components/TextInput/TextInput.d.ts +8 -0
- package/dist/cjs/components/TextInput/TextInput.js +49 -0
- package/dist/cjs/components/TextInput/styles.d.ts +18 -0
- package/dist/cjs/components/TextInput/styles.js +150 -0
- package/dist/cjs/components/Toast/Toast.d.ts +5 -0
- package/dist/cjs/components/Toast/Toast.js +90 -0
- package/dist/cjs/components/Toast/styles.d.ts +27 -0
- package/dist/cjs/components/Toast/styles.js +164 -0
- package/dist/cjs/components/Tooltip/Tooltip.d.ts +9 -0
- package/dist/cjs/components/Tooltip/Tooltip.js +55 -0
- package/dist/cjs/components/Tooltip/styles.d.ts +2 -0
- package/dist/cjs/components/Tooltip/styles.js +24 -0
- package/dist/cjs/components/Widget/AttachmentWidget.d.ts +18 -0
- package/dist/cjs/components/Widget/AttachmentWidget.js +124 -0
- package/dist/cjs/components/Widget/CallWidget.d.ts +11 -0
- package/dist/cjs/components/Widget/CallWidget.js +84 -0
- package/dist/cjs/components/Widget/Widget.d.ts +26 -0
- package/dist/cjs/components/Widget/Widget.js +87 -0
- package/dist/cjs/globalStyles.d.ts +5 -0
- package/dist/cjs/globalStyles.js +66 -0
- package/dist/cjs/hooks/useAutosizeTextArea.d.ts +2 -0
- package/dist/cjs/hooks/useAutosizeTextArea.js +14 -0
- package/dist/cjs/index.d.ts +51 -0
- package/dist/cjs/index.js +139 -0
- package/dist/cjs/storybook/BreakpointDocumentation.d.ts +3 -0
- package/dist/cjs/storybook/BreakpointDocumentation.js +139 -0
- package/dist/cjs/storybook/Components.d.ts +2 -0
- package/dist/cjs/storybook/Components.js +30 -0
- package/dist/cjs/storybook/Documentation.d.ts +5 -0
- package/dist/cjs/storybook/Documentation.js +67 -0
- package/dist/cjs/storybook/RadiusDocumentation.d.ts +3 -0
- package/dist/cjs/storybook/RadiusDocumentation.js +150 -0
- package/dist/cjs/storybook/SpacingDocumentation.d.ts +3 -0
- package/dist/cjs/storybook/SpacingDocumentation.js +146 -0
- package/dist/cjs/theme/index.d.ts +17 -0
- package/dist/cjs/theme/index.js +90 -0
- package/dist/cjs/utils/animations.d.ts +12 -0
- package/dist/cjs/utils/animations.js +120 -0
- package/dist/cjs/utils/createReactSvg.d.ts +3 -0
- package/dist/cjs/utils/createReactSvg.js +77 -0
- package/dist/cjs/utils/parser.d.ts +12 -0
- package/dist/cjs/utils/parser.js +200 -0
- package/dist/cjs/utils/replaceUrlsWithAnchors.d.ts +6 -0
- package/dist/cjs/utils/replaceUrlsWithAnchors.js +32 -0
- package/dist/cjs/utils/status.d.ts +6 -0
- package/dist/cjs/utils/status.js +54 -0
- package/dist/cjs/utils/styles.d.ts +1 -0
- package/dist/cjs/utils/styles.js +5 -0
- package/dist/cjs/utils/types.d.ts +1 -0
- package/dist/cjs/utils/types.js +2 -0
- package/dist/esm/components/Accordion/Accordion.d.ts +15 -0
- package/dist/esm/components/Accordion/Accordion.js +14 -0
- package/dist/esm/components/Accordion/styles.d.ts +18 -0
- package/dist/esm/components/Accordion/styles.js +61 -0
- package/dist/esm/components/Button/Button.d.ts +9 -0
- package/dist/esm/components/Button/Button.js +10 -0
- package/dist/esm/components/Button/styles.d.ts +16 -0
- package/dist/esm/components/Button/styles.js +277 -0
- package/dist/esm/components/Card/Card.d.ts +11 -0
- package/dist/esm/components/Card/Card.js +66 -0
- package/dist/esm/components/Checkbox/Checkbox.d.ts +15 -0
- package/dist/esm/components/Checkbox/Checkbox.js +17 -0
- package/dist/esm/components/Checkbox/styles.d.ts +27 -0
- package/dist/esm/components/Checkbox/styles.js +69 -0
- package/dist/esm/components/CheckboxGrid/CheckboxGrid.d.ts +22 -0
- package/dist/esm/components/CheckboxGrid/CheckboxGrid.js +35 -0
- package/dist/esm/components/CheckboxGrid/styles.d.ts +64 -0
- package/dist/esm/components/CheckboxGrid/styles.js +98 -0
- package/dist/esm/components/Dropdown/Dropdown.d.ts +25 -0
- package/dist/esm/components/Dropdown/Dropdown.js +32 -0
- package/dist/esm/components/Dropdown/styles.d.ts +15 -0
- package/dist/esm/components/Dropdown/styles.js +106 -0
- package/dist/esm/components/Icon/Icon.d.ts +10 -0
- package/dist/esm/components/Icon/Icon.js +42 -0
- package/dist/esm/components/Icon/IconGradient.d.ts +4 -0
- package/dist/esm/components/Icon/IconGradient.js +24 -0
- package/dist/esm/components/Icon/createIconComponent.d.ts +10 -0
- package/dist/esm/components/Icon/createIconComponent.js +24 -0
- package/dist/esm/components/Icon/getDefaultIconProps.d.ts +2 -0
- package/dist/esm/components/Icon/getDefaultIconProps.js +11 -0
- package/dist/esm/components/Icon/index.d.ts +553 -0
- package/dist/esm/components/Icon/index.js +338 -0
- package/dist/esm/components/Illustrations/Illustration.d.ts +3 -0
- package/dist/esm/components/Illustrations/Illustration.js +5 -0
- package/dist/esm/components/Illustrations/createIllustrationComponent.d.ts +10 -0
- package/dist/esm/components/Illustrations/createIllustrationComponent.js +16 -0
- package/dist/esm/components/Illustrations/index.d.ts +152 -0
- package/dist/esm/components/Illustrations/index.js +78 -0
- package/dist/esm/components/InputError/InputError.d.ts +15 -0
- package/dist/esm/components/InputError/InputError.js +40 -0
- package/dist/esm/components/Label/Label.d.ts +10 -0
- package/dist/esm/components/Label/Label.js +30 -0
- package/dist/esm/components/Link/Link.d.ts +6 -0
- package/dist/esm/components/Link/Link.js +13 -0
- package/dist/esm/components/Link/styles.d.ts +22 -0
- package/dist/esm/components/Link/styles.js +63 -0
- package/dist/esm/components/Loading/Loading.d.ts +10 -0
- package/dist/esm/components/Loading/Loading.js +21 -0
- package/dist/esm/components/Loading/LoadingLogo.d.ts +8 -0
- package/dist/esm/components/Loading/LoadingLogo.js +26 -0
- package/dist/esm/components/Loading/styles.d.ts +15 -0
- package/dist/esm/components/Loading/styles.js +71 -0
- package/dist/esm/components/Modal/Modal.d.ts +20 -0
- package/dist/esm/components/Modal/Modal.js +59 -0
- package/dist/esm/components/Modal/styles.d.ts +4 -0
- package/dist/esm/components/Modal/styles.js +63 -0
- package/dist/esm/components/MultiCheckbox/MultiCheckbox.d.ts +15 -0
- package/dist/esm/components/MultiCheckbox/MultiCheckbox.js +23 -0
- package/dist/esm/components/MultiCheckbox/styles.d.ts +1 -0
- package/dist/esm/components/MultiCheckbox/styles.js +9 -0
- package/dist/esm/components/MultiDropdown/MultiDropdown.d.ts +28 -0
- package/dist/esm/components/MultiDropdown/MultiDropdown.js +86 -0
- package/dist/esm/components/MultiDropdown/styles.d.ts +7 -0
- package/dist/esm/components/MultiDropdown/styles.js +38 -0
- package/dist/esm/components/MultiSelection/MultiSelection.d.ts +16 -0
- package/dist/esm/components/MultiSelection/MultiSelection.js +24 -0
- package/dist/esm/components/MultiSelection/styles.d.ts +9 -0
- package/dist/esm/components/MultiSelection/styles.js +63 -0
- package/dist/esm/components/NavigationMenu/NavigationMenu.d.ts +35 -0
- package/dist/esm/components/NavigationMenu/NavigationMenu.js +40 -0
- package/dist/esm/components/NavigationMenu/styles.d.ts +81 -0
- package/dist/esm/components/NavigationMenu/styles.js +257 -0
- package/dist/esm/components/Popover/InfoPopover.d.ts +8 -0
- package/dist/esm/components/Popover/InfoPopover.js +8 -0
- package/dist/esm/components/Popover/Popover.d.ts +16 -0
- package/dist/esm/components/Popover/Popover.js +22 -0
- package/dist/esm/components/Popover/styles.d.ts +14 -0
- package/dist/esm/components/Popover/styles.js +80 -0
- package/dist/esm/components/ProgressBar/ProgressBar.d.ts +8 -0
- package/dist/esm/components/ProgressBar/ProgressBar.js +47 -0
- package/dist/esm/components/RadioGroup/RadioGroup.d.ts +16 -0
- package/dist/esm/components/RadioGroup/RadioGroup.js +19 -0
- package/dist/esm/components/RadioGroup/styles.d.ts +12 -0
- package/dist/esm/components/RadioGroup/styles.js +90 -0
- package/dist/esm/components/Separator/Separator.d.ts +11 -0
- package/dist/esm/components/Separator/Separator.js +23 -0
- package/dist/esm/components/Separator/styles.d.ts +6 -0
- package/dist/esm/components/Separator/styles.js +51 -0
- package/dist/esm/components/Slider/Slider.d.ts +12 -0
- package/dist/esm/components/Slider/Slider.js +12 -0
- package/dist/esm/components/Slider/styles.d.ts +6 -0
- package/dist/esm/components/Slider/styles.js +51 -0
- package/dist/esm/components/StarRating/StarRating.d.ts +22 -0
- package/dist/esm/components/StarRating/StarRating.js +107 -0
- package/dist/esm/components/StarRating/styles.d.ts +35 -0
- package/dist/esm/components/StarRating/styles.js +65 -0
- package/dist/esm/components/StatusMessage/StatusMessage.d.ts +4 -0
- package/dist/esm/components/StatusMessage/StatusMessage.js +74 -0
- package/dist/esm/components/Switch/Switch.d.ts +15 -0
- package/dist/esm/components/Switch/Switch.js +14 -0
- package/dist/esm/components/Switch/styles.d.ts +14 -0
- package/dist/esm/components/Switch/styles.js +63 -0
- package/dist/esm/components/Tags/Tags.d.ts +15 -0
- package/dist/esm/components/Tags/Tags.js +10 -0
- package/dist/esm/components/Tags/styles.d.ts +19 -0
- package/dist/esm/components/Tags/styles.js +80 -0
- package/dist/esm/components/Text/Text.d.ts +11 -0
- package/dist/esm/components/Text/Text.js +8 -0
- package/dist/esm/components/Text/styles.d.ts +8 -0
- package/dist/esm/components/Text/styles.js +62 -0
- package/dist/esm/components/Text/types.d.ts +8 -0
- package/dist/esm/components/Text/types.js +1 -0
- package/dist/esm/components/TextArea/TextArea.d.ts +19 -0
- package/dist/esm/components/TextArea/TextArea.js +45 -0
- package/dist/esm/components/TextArea/styles.d.ts +22 -0
- package/dist/esm/components/TextArea/styles.js +42 -0
- package/dist/esm/components/TextContent/TextContent.d.ts +28 -0
- package/dist/esm/components/TextContent/TextContent.js +40 -0
- package/dist/esm/components/TextContent/styles.d.ts +24 -0
- package/dist/esm/components/TextContent/styles.js +36 -0
- package/dist/esm/components/TextInput/TextInput.d.ts +8 -0
- package/dist/esm/components/TextInput/TextInput.js +42 -0
- package/dist/esm/components/TextInput/styles.d.ts +18 -0
- package/dist/esm/components/TextInput/styles.js +111 -0
- package/dist/esm/components/Toast/Toast.d.ts +5 -0
- package/dist/esm/components/Toast/Toast.js +54 -0
- package/dist/esm/components/Toast/styles.d.ts +27 -0
- package/dist/esm/components/Toast/styles.js +125 -0
- package/dist/esm/components/Tooltip/Tooltip.d.ts +9 -0
- package/dist/esm/components/Tooltip/Tooltip.js +16 -0
- package/dist/esm/components/Tooltip/styles.d.ts +2 -0
- package/dist/esm/components/Tooltip/styles.js +18 -0
- package/dist/esm/components/Widget/AttachmentWidget.d.ts +18 -0
- package/dist/esm/components/Widget/AttachmentWidget.js +85 -0
- package/dist/esm/components/Widget/CallWidget.d.ts +11 -0
- package/dist/esm/components/Widget/CallWidget.js +46 -0
- package/dist/esm/components/Widget/Widget.d.ts +26 -0
- package/dist/esm/components/Widget/Widget.js +46 -0
- package/dist/esm/globalStyles.d.ts +5 -0
- package/dist/esm/globalStyles.js +64 -0
- package/dist/esm/hooks/useAutosizeTextArea.d.ts +2 -0
- package/dist/esm/hooks/useAutosizeTextArea.js +12 -0
- package/dist/esm/index.d.ts +51 -0
- package/dist/esm/index.js +45 -0
- package/dist/esm/storybook/BreakpointDocumentation.d.ts +3 -0
- package/dist/esm/storybook/BreakpointDocumentation.js +101 -0
- package/dist/esm/storybook/Components.d.ts +2 -0
- package/dist/esm/storybook/Components.js +23 -0
- package/dist/esm/storybook/Documentation.d.ts +5 -0
- package/dist/esm/storybook/Documentation.js +62 -0
- package/dist/esm/storybook/RadiusDocumentation.d.ts +3 -0
- package/dist/esm/storybook/RadiusDocumentation.js +112 -0
- package/dist/esm/storybook/SpacingDocumentation.d.ts +3 -0
- package/dist/esm/storybook/SpacingDocumentation.js +108 -0
- package/dist/esm/theme/index.d.ts +17 -0
- package/dist/esm/theme/index.js +53 -0
- package/dist/esm/utils/animations.d.ts +12 -0
- package/dist/esm/utils/animations.js +117 -0
- package/dist/esm/utils/createReactSvg.d.ts +3 -0
- package/dist/esm/utils/createReactSvg.js +70 -0
- package/dist/esm/utils/parser.d.ts +12 -0
- package/dist/esm/utils/parser.js +195 -0
- package/dist/esm/utils/replaceUrlsWithAnchors.d.ts +6 -0
- package/dist/esm/utils/replaceUrlsWithAnchors.js +29 -0
- package/dist/esm/utils/status.d.ts +6 -0
- package/dist/esm/utils/status.js +49 -0
- package/dist/esm/utils/styles.d.ts +1 -0
- package/dist/esm/utils/styles.js +1 -0
- package/dist/esm/utils/types.d.ts +1 -0
- package/dist/esm/utils/types.js +1 -0
- package/jest.config.ts +30 -0
- package/package.json +98 -0
- package/src/components/Accordion/Accordion.stories.tsx +66 -0
- package/src/components/Accordion/Accordion.tsx +59 -0
- package/src/components/Accordion/styles.tsx +68 -0
- package/src/components/Button/Button.stories.tsx +119 -0
- package/src/components/Button/Button.tsx +59 -0
- package/src/components/Button/styles.tsx +313 -0
- package/src/components/Card/Card.stories.tsx +22 -0
- package/src/components/Card/Card.tsx +125 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +11 -0
- package/src/components/Checkbox/Checkbox.tsx +112 -0
- package/src/components/Checkbox/styles.tsx +96 -0
- package/src/components/CheckboxGrid/CheckboxGrid.stories.tsx +49 -0
- package/src/components/CheckboxGrid/CheckboxGrid.tsx +126 -0
- package/src/components/CheckboxGrid/styles.tsx +122 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +59 -0
- package/src/components/Dropdown/Dropdown.tsx +128 -0
- package/src/components/Dropdown/styles.tsx +120 -0
- package/src/components/Icon/Icon.stories.tsx +44 -0
- package/src/components/Icon/Icon.test.tsx +20 -0
- package/src/components/Icon/Icon.tsx +88 -0
- package/src/components/Icon/IconDocs.mdx +22 -0
- package/src/components/Icon/IconGradient.tsx +70 -0
- package/src/components/Icon/createIconComponent.tsx +63 -0
- package/src/components/Icon/getDefaultIconProps.ts +23 -0
- package/src/components/Icon/index.ts +499 -0
- package/src/components/Illustrations/Illustration.tsx +18 -0
- package/src/components/Illustrations/Illustrations.stories.tsx +53 -0
- package/src/components/Illustrations/createIllustrationComponent.tsx +39 -0
- package/src/components/Illustrations/index.ts +118 -0
- package/src/components/InputError/InputError.tsx +86 -0
- package/src/components/Label/Label.stories.tsx +18 -0
- package/src/components/Label/Label.tsx +76 -0
- package/src/components/Link/Link.stories.tsx +14 -0
- package/src/components/Link/Link.test.tsx +27 -0
- package/src/components/Link/Link.tsx +68 -0
- package/src/components/Link/styles.tsx +86 -0
- package/src/components/Loading/Loading.stories.tsx +26 -0
- package/src/components/Loading/Loading.tsx +65 -0
- package/src/components/Loading/LoadingLogo.tsx +141 -0
- package/src/components/Loading/styles.ts +95 -0
- package/src/components/Modal/Modal.stories.tsx +52 -0
- package/src/components/Modal/Modal.test.tsx +98 -0
- package/src/components/Modal/Modal.tsx +115 -0
- package/src/components/Modal/ModalDocs.mdx +21 -0
- package/src/components/Modal/styles.tsx +67 -0
- package/src/components/MultiCheckbox/MultiCheckbox.stories.tsx +24 -0
- package/src/components/MultiCheckbox/MultiCheckbox.tsx +73 -0
- package/src/components/MultiCheckbox/styles.tsx +10 -0
- package/src/components/MultiDropdown/MultiDropdown.stories.tsx +105 -0
- package/src/components/MultiDropdown/MultiDropdown.tsx +247 -0
- package/src/components/MultiDropdown/styles.tsx +45 -0
- package/src/components/MultiSelection/MultiSelection.stories.tsx +19 -0
- package/src/components/MultiSelection/MultiSelection.tsx +74 -0
- package/src/components/MultiSelection/styles.tsx +78 -0
- package/src/components/NavigationMenu/NavigationMenu.stories.tsx +108 -0
- package/src/components/NavigationMenu/NavigationMenu.tsx +151 -0
- package/src/components/NavigationMenu/styles.tsx +293 -0
- package/src/components/Popover/InfoPopover.tsx +40 -0
- package/src/components/Popover/Popover.stories.tsx +85 -0
- package/src/components/Popover/Popover.tsx +68 -0
- package/src/components/Popover/styles.tsx +109 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +15 -0
- package/src/components/ProgressBar/ProgressBar.tsx +76 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +42 -0
- package/src/components/RadioGroup/RadioGroup.tsx +91 -0
- package/src/components/RadioGroup/styles.tsx +100 -0
- package/src/components/Separator/Separator.stories.tsx +27 -0
- package/src/components/Separator/Separator.tsx +52 -0
- package/src/components/Separator/styles.tsx +57 -0
- package/src/components/Slider/Slider.stories.tsx +27 -0
- package/src/components/Slider/Slider.tsx +61 -0
- package/src/components/Slider/styles.tsx +57 -0
- package/src/components/StarRating/StarRating.stories.tsx +20 -0
- package/src/components/StarRating/StarRating.tsx +212 -0
- package/src/components/StarRating/styles.ts +76 -0
- package/src/components/StatusMessage/StatusMessage.stories.tsx +44 -0
- package/src/components/StatusMessage/StatusMessage.tsx +110 -0
- package/src/components/Switch/Switch.stories.tsx +12 -0
- package/src/components/Switch/Switch.tsx +83 -0
- package/src/components/Switch/styles.tsx +75 -0
- package/src/components/Tags/Tags.stories.tsx +44 -0
- package/src/components/Tags/Tags.tsx +68 -0
- package/src/components/Tags/styles.tsx +89 -0
- package/src/components/Text/Text.stories.tsx +288 -0
- package/src/components/Text/Text.tsx +58 -0
- package/src/components/Text/styles.tsx +75 -0
- package/src/components/Text/types.ts +9 -0
- package/src/components/Text/typography.mdx +91 -0
- package/src/components/TextArea/TextArea.stories.tsx +26 -0
- package/src/components/TextArea/TextArea.tsx +117 -0
- package/src/components/TextArea/styles.tsx +58 -0
- package/src/components/TextContent/TextContent.stories.tsx +54 -0
- package/src/components/TextContent/TextContent.tsx +154 -0
- package/src/components/TextContent/styles.tsx +47 -0
- package/src/components/TextInput/TextInput.stories.tsx +43 -0
- package/src/components/TextInput/TextInput.tsx +146 -0
- package/src/components/TextInput/styles.tsx +129 -0
- package/src/components/Toast/Toast.stories.tsx +55 -0
- package/src/components/Toast/Toast.tsx +139 -0
- package/src/components/Toast/styles.tsx +142 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +31 -0
- package/src/components/Tooltip/Tooltip.tsx +48 -0
- package/src/components/Tooltip/styles.tsx +20 -0
- package/src/components/Widget/AttachmentWidget.stories.tsx +14 -0
- package/src/components/Widget/AttachmentWidget.tsx +142 -0
- package/src/components/Widget/CallWidget.stories.tsx +38 -0
- package/src/components/Widget/CallWidget.tsx +114 -0
- package/src/components/Widget/Widget.stories.tsx +10 -0
- package/src/components/Widget/Widget.tsx +104 -0
- package/src/globalStyles.ts +68 -0
- package/src/hooks/useAutosizeTextArea.tsx +19 -0
- package/src/index.ts +107 -0
- package/src/setupTests.ts +8 -0
- package/src/storybook/BreakpointDocumentation.tsx +126 -0
- package/src/storybook/Components.tsx +29 -0
- package/src/storybook/Documentation.tsx +86 -0
- package/src/storybook/RadiusDocumentation.tsx +133 -0
- package/src/storybook/SpacingDocumentation.tsx +131 -0
- package/src/storybook/breakpoints.mdx +83 -0
- package/src/storybook/colors.mdx +118 -0
- package/src/storybook/radius.mdx +48 -0
- package/src/storybook/spacing.mdx +45 -0
- package/src/testUtils.tsx +49 -0
- package/src/theme/index.tsx +98 -0
- package/src/utils/animations.ts +129 -0
- package/src/utils/createReactSvg.tsx +140 -0
- package/src/utils/parser.mdx +41 -0
- package/src/utils/parser.test.tsx +542 -0
- package/src/utils/parser.tsx +333 -0
- package/src/utils/replaceUrlsWithAnchors.test.ts +42 -0
- package/src/utils/replaceUrlsWithAnchors.ts +32 -0
- package/src/utils/status.tsx +85 -0
- package/src/utils/styles.ts +1 -0
- package/src/utils/types.ts +1 -0
- package/tsconfig.json +34 -0
- package/tsconfig.test.json +16 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import Button from '../components/Button/Button';
|
|
4
|
+
import Link from '../components/Link/Link';
|
|
5
|
+
import replaceUrlsWithAnchors from './replaceUrlsWithAnchors';
|
|
6
|
+
const ColorText = styled.strong `
|
|
7
|
+
color: ${({ theme, color }) => color === SupportedColorTags.bold
|
|
8
|
+
? 'currentColor'
|
|
9
|
+
: theme.color.text[color]};
|
|
10
|
+
`;
|
|
11
|
+
const ANCHOR_TAG = 'a';
|
|
12
|
+
const BUTTON_TAG = 'button';
|
|
13
|
+
var SupportedColorTags;
|
|
14
|
+
(function (SupportedColorTags) {
|
|
15
|
+
SupportedColorTags["highlight"] = "highlight";
|
|
16
|
+
SupportedColorTags["bold"] = "bold";
|
|
17
|
+
})(SupportedColorTags || (SupportedColorTags = {}));
|
|
18
|
+
const findTags = (text) => {
|
|
19
|
+
const tags = [];
|
|
20
|
+
const textLength = text.length;
|
|
21
|
+
let position = 0;
|
|
22
|
+
while (position < textLength) {
|
|
23
|
+
const openBracket = text.indexOf('<', position);
|
|
24
|
+
if (openBracket === -1)
|
|
25
|
+
break;
|
|
26
|
+
const closeBracket = text.indexOf('>', openBracket);
|
|
27
|
+
if (closeBracket === -1)
|
|
28
|
+
break;
|
|
29
|
+
const tagContent = text.substring(openBracket + 1, closeBracket);
|
|
30
|
+
// Check if it's a valid opening tag (starts with letter)
|
|
31
|
+
if (/^[a-zA-Z]/.test(tagContent)) {
|
|
32
|
+
const firstSpace = tagContent.indexOf(' ');
|
|
33
|
+
const tagName = firstSpace === -1 ? tagContent : tagContent.substring(0, firstSpace);
|
|
34
|
+
const attributesText = firstSpace === -1 ? '' : tagContent.substring(firstSpace + 1);
|
|
35
|
+
// Parse attributes safely
|
|
36
|
+
let attributes = {};
|
|
37
|
+
if (attributesText.trim()) {
|
|
38
|
+
try {
|
|
39
|
+
attributes = JSON.parse(attributesText);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Invalid JSON - treat as plain text
|
|
43
|
+
position = closeBracket + 1;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Look for closing tag
|
|
48
|
+
const closingTag = `</${tagName}>`;
|
|
49
|
+
const closingTagIndex = text.indexOf(closingTag, closeBracket + 1);
|
|
50
|
+
if (closingTagIndex !== -1) {
|
|
51
|
+
// Found complete tag
|
|
52
|
+
tags.push({
|
|
53
|
+
start: openBracket,
|
|
54
|
+
end: closingTagIndex + closingTag.length,
|
|
55
|
+
tagName,
|
|
56
|
+
attributes,
|
|
57
|
+
hasClosingTag: true,
|
|
58
|
+
contentStart: closeBracket + 1,
|
|
59
|
+
contentEnd: closingTagIndex,
|
|
60
|
+
});
|
|
61
|
+
position = closingTagIndex + closingTag.length;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// No closing tag - treat as plain text
|
|
65
|
+
position = closeBracket + 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// Not a valid tag - move past it
|
|
70
|
+
position = closeBracket + 1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return tags;
|
|
74
|
+
};
|
|
75
|
+
const parseContent = (content, options) => {
|
|
76
|
+
const tags = findTags(content);
|
|
77
|
+
if (tags.length === 0) {
|
|
78
|
+
return [content];
|
|
79
|
+
}
|
|
80
|
+
const components = [];
|
|
81
|
+
let currentIndex = 0;
|
|
82
|
+
for (const tag of tags) {
|
|
83
|
+
// Add text before this tag
|
|
84
|
+
if (tag.start > currentIndex) {
|
|
85
|
+
components.push(content.substring(currentIndex, tag.start));
|
|
86
|
+
}
|
|
87
|
+
// Extract content between tags
|
|
88
|
+
const tagContent = content.substring(tag.contentStart, tag.contentEnd);
|
|
89
|
+
// Process the tag based on type and options
|
|
90
|
+
if (tag.tagName === ANCHOR_TAG) {
|
|
91
|
+
// Always process anchor tags
|
|
92
|
+
const nestedContent = parseContent(tagContent, options);
|
|
93
|
+
components.push(tag.attributes.href ? (React.createElement(Link, { key: `${tag.tagName}-${tag.start}-${tag.end}`, to: tag.attributes.href, ...tag.attributes }, nestedContent)) : (React.createElement(React.Fragment, null, nestedContent)));
|
|
94
|
+
}
|
|
95
|
+
else if (options.onlyLinks) {
|
|
96
|
+
// In onlyLinks mode, treat all non-anchor tags as plain text
|
|
97
|
+
components.push(content.substring(tag.start, tag.end));
|
|
98
|
+
}
|
|
99
|
+
else if (tag.tagName === BUTTON_TAG) {
|
|
100
|
+
const nestedContent = parseContent(tagContent, options);
|
|
101
|
+
components.push(React.createElement(Button, { key: `${tag.tagName}-${tag.start}-${tag.end}`, ...tag.attributes }, nestedContent));
|
|
102
|
+
}
|
|
103
|
+
else if (Object.values(SupportedColorTags).includes(tag.tagName)) {
|
|
104
|
+
const nestedContent = parseContent(tagContent, options);
|
|
105
|
+
components.push(React.createElement(ColorText, { key: `${tag.tagName}-${tag.start}-${tag.end}`, color: SupportedColorTags[tag.tagName] }, nestedContent));
|
|
106
|
+
}
|
|
107
|
+
else if (options.customElements) {
|
|
108
|
+
// Check for custom elements
|
|
109
|
+
const customElement = options.customElements.find(element => element.tag === tag.tagName);
|
|
110
|
+
if (customElement) {
|
|
111
|
+
const nestedContent = parseContent(tagContent, options);
|
|
112
|
+
components.push(React.createElement(customElement.Component, { key: `${tag.tagName}-${tag.start}-${tag.end}`, ...tag.attributes, ...customElement.props }, nestedContent));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
// Unrecognized tag, add as plain text
|
|
116
|
+
components.push(content.substring(tag.start, tag.end));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// Unrecognized tag, add as plain text
|
|
121
|
+
components.push(content.substring(tag.start, tag.end));
|
|
122
|
+
}
|
|
123
|
+
currentIndex = tag.end;
|
|
124
|
+
}
|
|
125
|
+
// Add remaining text after last tag
|
|
126
|
+
if (currentIndex < content.length) {
|
|
127
|
+
components.push(content.substring(currentIndex));
|
|
128
|
+
}
|
|
129
|
+
return components;
|
|
130
|
+
};
|
|
131
|
+
const textParser = (text, options = {}) => {
|
|
132
|
+
const nonInteractive = options.nonInteractive || false;
|
|
133
|
+
// First convert HTML links to recognised anchor tags
|
|
134
|
+
const textWithParsedUrls = nonInteractive
|
|
135
|
+
? text
|
|
136
|
+
: replaceUrlsWithAnchors(text);
|
|
137
|
+
// Find all complete tags
|
|
138
|
+
const tags = findTags(textWithParsedUrls);
|
|
139
|
+
if (tags.length === 0) {
|
|
140
|
+
return textWithParsedUrls;
|
|
141
|
+
}
|
|
142
|
+
const components = [];
|
|
143
|
+
let currentIndex = 0;
|
|
144
|
+
for (const tag of tags) {
|
|
145
|
+
// Add text before this tag
|
|
146
|
+
if (tag.start > currentIndex) {
|
|
147
|
+
components.push(textWithParsedUrls.substring(currentIndex, tag.start));
|
|
148
|
+
}
|
|
149
|
+
// Extract content between tags
|
|
150
|
+
const content = textWithParsedUrls.substring(tag.contentStart, tag.contentEnd);
|
|
151
|
+
// Process the tag based on type
|
|
152
|
+
if (tag.tagName === ANCHOR_TAG) {
|
|
153
|
+
// Always process anchor tags (even in onlyLinks mode)
|
|
154
|
+
const nestedContent = parseContent(content, options);
|
|
155
|
+
components.push(tag.attributes.href && !nonInteractive ? (React.createElement(Link, { key: `${tag.tagName}-${tag.start}-${tag.end}`, to: tag.attributes.href, ...tag.attributes }, nestedContent)) : (React.createElement(React.Fragment, null, nestedContent)));
|
|
156
|
+
}
|
|
157
|
+
else if (options.onlyLinks) {
|
|
158
|
+
// In onlyLinks mode, treat all non-anchor tags as plain text
|
|
159
|
+
components.push(textWithParsedUrls.substring(tag.start, tag.end));
|
|
160
|
+
}
|
|
161
|
+
else if (tag.tagName === BUTTON_TAG) {
|
|
162
|
+
const nestedContent = parseContent(content, options);
|
|
163
|
+
components.push(nonInteractive ? (React.createElement(React.Fragment, null, nestedContent)) : (React.createElement(Button, { key: `${tag.tagName}-${tag.start}-${tag.end}`, ...tag.attributes }, nestedContent)));
|
|
164
|
+
}
|
|
165
|
+
else if (Object.values(SupportedColorTags).includes(tag.tagName)) {
|
|
166
|
+
const nestedContent = parseContent(content, options);
|
|
167
|
+
components.push(nonInteractive ? (React.createElement(React.Fragment, null, nestedContent)) : (React.createElement(ColorText, { key: `${tag.tagName}-${tag.start}-${tag.end}`, color: SupportedColorTags[tag.tagName] }, nestedContent)));
|
|
168
|
+
}
|
|
169
|
+
else if (options.customElements) {
|
|
170
|
+
// Check for custom elements
|
|
171
|
+
const customElement = options.customElements.find(element => element.tag === tag.tagName);
|
|
172
|
+
if (customElement) {
|
|
173
|
+
const nestedContent = parseContent(content, options);
|
|
174
|
+
components.push(React.createElement(customElement.Component, { key: `${tag.tagName}-${tag.start}-${tag.end}`, ...tag.attributes, ...customElement.props }, nestedContent));
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// Unrecognized tag, add as plain text
|
|
178
|
+
components.push(textWithParsedUrls.substring(tag.start, tag.end));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// Unrecognized tag, add as plain text
|
|
183
|
+
components.push(textWithParsedUrls.substring(tag.start, tag.end));
|
|
184
|
+
}
|
|
185
|
+
currentIndex = tag.end;
|
|
186
|
+
}
|
|
187
|
+
// Add remaining text after last tag
|
|
188
|
+
if (currentIndex < textWithParsedUrls.length) {
|
|
189
|
+
components.push(textWithParsedUrls.substring(currentIndex));
|
|
190
|
+
}
|
|
191
|
+
return (React.createElement("span", null, components.map((section, index) => typeof section === 'string'
|
|
192
|
+
? section
|
|
193
|
+
: React.cloneElement(section, { key: index }))));
|
|
194
|
+
};
|
|
195
|
+
export default textParser;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isValidUrl } from '@a-little-world/little-world-design-system-core';
|
|
2
|
+
// Example outputs:
|
|
3
|
+
/*
|
|
4
|
+
Input: Check out www.google.com for more info
|
|
5
|
+
Output: Check out <a href="https://www.google.com" target="_blank">www.google.com</a> for more info
|
|
6
|
+
|
|
7
|
+
Input: Visit little-world.io and https://example.com
|
|
8
|
+
Output: Visit <a href="https://little-world.io" target="_blank">little-world.io</a> and <a href="https://example.com" target="_blank">https://example.com</a>
|
|
9
|
+
*/
|
|
10
|
+
const urlPattern = /(?<=^|\s)(?:https?:\/\/)?(?:www\.)?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?:\/[^\s]*)?/g;
|
|
11
|
+
/**
|
|
12
|
+
* Replaces all URLs in a text with HTML anchor tags
|
|
13
|
+
* @param text - The input text containing URLs
|
|
14
|
+
* @returns The text with URLs replaced with anchor tags
|
|
15
|
+
*/
|
|
16
|
+
export default function replaceUrlsWithAnchors(text) {
|
|
17
|
+
return text.replace(urlPattern, match => {
|
|
18
|
+
// Ensure URL has protocol for href
|
|
19
|
+
try {
|
|
20
|
+
if (!isValidUrl(match))
|
|
21
|
+
return match;
|
|
22
|
+
const href = match.startsWith('http') ? match : `https://${match}`;
|
|
23
|
+
return `<a {"target":"_blank", "href":"${href}"}>${match}</a>`;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return match;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
const Wrapper = styled.div `
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
5
|
+
margin: ${({ theme }) => theme.spacing.medium}; 0 ${({ theme }) => theme.spacing.xsmall}; 0;
|
|
6
|
+
`;
|
|
7
|
+
const ReactStatus = styled.div `
|
|
8
|
+
border-radius: 4px;
|
|
9
|
+
padding: ${({ theme }) => theme.spacing.xxsmall}
|
|
10
|
+
${({ theme }) => theme.spacing.xsmall};
|
|
11
|
+
font-family: monospace;
|
|
12
|
+
background: #20232a;
|
|
13
|
+
color: #61dafb;
|
|
14
|
+
display: flex;
|
|
15
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
16
|
+
align-items: center;
|
|
17
|
+
font-size: 1rem;
|
|
18
|
+
`;
|
|
19
|
+
const FigmaStatus = styled.a `
|
|
20
|
+
border-radius: 4px;
|
|
21
|
+
padding: ${({ theme }) => theme.spacing.xxsmall}
|
|
22
|
+
${({ theme }) => theme.spacing.xsmall};
|
|
23
|
+
display: flex;
|
|
24
|
+
gap: ${({ theme }) => theme.spacing.xsmall};
|
|
25
|
+
align-items: center;
|
|
26
|
+
background: #000;
|
|
27
|
+
text-decoration: none;
|
|
28
|
+
color: #fff;
|
|
29
|
+
font-size: 0.9rem;
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
background: #333;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const Status = ({ React, Figma }) => {
|
|
36
|
+
return (React.createElement(Wrapper, null,
|
|
37
|
+
React && (React.createElement(ReactStatus, null,
|
|
38
|
+
React.createElement("img", { src: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xMS41IC0xMC4yMzE3NCAyMyAyMC40NjM0OCI+CiAgPHRpdGxlPlJlYWN0IExvZ288L3RpdGxlPgogIDxjaXJjbGUgY3g9IjAiIGN5PSIwIiByPSIyLjA1IiBmaWxsPSIjNjFkYWZiIi8+CiAgPGcgc3Ryb2tlPSIjNjFkYWZiIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiPgogICAgPGVsbGlwc2Ugcng9IjExIiByeT0iNC4yIi8+CiAgICA8ZWxsaXBzZSByeD0iMTEiIHJ5PSI0LjIiIHRyYW5zZm9ybT0icm90YXRlKDYwKSIvPgogICAgPGVsbGlwc2Ugcng9IjExIiByeT0iNC4yIiB0cmFuc2Zvcm09InJvdGF0ZSgxMjApIi8+CiAgPC9nPgo8L3N2Zz4K", alt: "", height: "20" }),
|
|
39
|
+
React.createElement("div", null, React))),
|
|
40
|
+
Figma && (React.createElement(FigmaStatus, { href: Figma },
|
|
41
|
+
React.createElement("svg", { height: "20px", viewBox: "0 0 38 57" },
|
|
42
|
+
React.createElement("path", { fill: "#1abcfe", d: "M19 28.5a9.5 9.5 0 1 1 19 0 9.5 9.5 0 0 1-19 0z" }),
|
|
43
|
+
React.createElement("path", { fill: "#0acf83", d: "M0 47.5A9.5 9.5 0 0 1 9.5 38H19v9.5a9.5 9.5 0 1 1-19 0z" }),
|
|
44
|
+
React.createElement("path", { fill: "#ff7262", d: "M19 0v19h9.5a9.5 9.5 0 1 0 0-19H19z" }),
|
|
45
|
+
React.createElement("path", { fill: "#f24e1e", d: "M0 9.5A9.5 9.5 0 0 0 9.5 19H19V0H9.5A9.5 9.5 0 0 0 0 9.5z" }),
|
|
46
|
+
React.createElement("path", { fill: "#a259ff", d: "M0 28.5A9.5 9.5 0 0 0 9.5 38H19V19H9.5A9.5 9.5 0 0 0 0 28.5z" })),
|
|
47
|
+
React.createElement("div", null, "Link")))));
|
|
48
|
+
};
|
|
49
|
+
export default Status;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pixelate: (value: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const pixelate = (value) => `${value}px`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ValueOf<T> = T[keyof T];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
testEnvironment: 'jsdom',
|
|
3
|
+
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
|
|
4
|
+
moduleNameMapper: {
|
|
5
|
+
'\\.svg': '<rootDir>/__mocks__/svg.js',
|
|
6
|
+
},
|
|
7
|
+
transform: {
|
|
8
|
+
'^.+\\.(ts|tsx)$': [
|
|
9
|
+
'ts-jest',
|
|
10
|
+
{
|
|
11
|
+
tsconfig: 'tsconfig.test.json',
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
testMatch: ['**/__tests__/**/*.(ts|tsx|js)', '**/*.(test|spec).(ts|tsx|js)'],
|
|
16
|
+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
|
17
|
+
collectCoverageFrom: [
|
|
18
|
+
'src/**/*.{ts,tsx}',
|
|
19
|
+
'!src/**/*.d.ts',
|
|
20
|
+
'!src/setupTests.ts',
|
|
21
|
+
],
|
|
22
|
+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
23
|
+
globals: {
|
|
24
|
+
'ts-jest': {
|
|
25
|
+
useESM: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
export default config;
|
package/package.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@a-little-world/little-world-design-system",
|
|
3
|
+
"version": "2.10.0",
|
|
4
|
+
"description": "Design system for Little World applications",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.js",
|
|
7
|
+
"types": "./dist/esm/index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/a-little-world/little-world-design-system.git"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public",
|
|
14
|
+
"registry": "https://registry.npmjs.org"
|
|
15
|
+
},
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "LGPL-3.0-only",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/a-little-world/little-world-design-system/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/a-little-world/little-world-design-system#readme",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@babel/cli": "^7.19.3",
|
|
24
|
+
"@babel/core": "^7.20.2",
|
|
25
|
+
"@babel/preset-env": "^7.20.2",
|
|
26
|
+
"@babel/preset-react": "^7.18.6",
|
|
27
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
28
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
29
|
+
"@mdx-js/react": "^2.2.1",
|
|
30
|
+
"@storybook/addon-a11y": "10.0.8",
|
|
31
|
+
"@storybook/addon-themes": "10.0.8",
|
|
32
|
+
"@storybook/addon-webpack5-compiler-swc": "^4.0.2",
|
|
33
|
+
"@storybook/react-webpack5": "10.0.8",
|
|
34
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
35
|
+
"@testing-library/react": "^14.3.1",
|
|
36
|
+
"@testing-library/user-event": "^14.4.3",
|
|
37
|
+
"@types/jest": "^29.2.4",
|
|
38
|
+
"@types/lodash": "^4.17.16",
|
|
39
|
+
"@types/mdx": "^2.0.3",
|
|
40
|
+
"@types/react": "^19.1.10",
|
|
41
|
+
"@types/react-dom": "^19.1.7",
|
|
42
|
+
"@types/styled-components": "^5.1.26",
|
|
43
|
+
"babel-cli": "^6.26.0",
|
|
44
|
+
"babel-core": "^6.26.3",
|
|
45
|
+
"jest": "^29.3.1",
|
|
46
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
47
|
+
"react-router-dom": "^6.28.2",
|
|
48
|
+
"rimraf": "^6.0.1",
|
|
49
|
+
"storybook": "10.0.8",
|
|
50
|
+
"storybook-addon-remix-react-router": "^5.0.0",
|
|
51
|
+
"styled-components": "^6.1.18",
|
|
52
|
+
"ts-jest": "^29.1.0",
|
|
53
|
+
"ts-loader": "^9.4.2",
|
|
54
|
+
"ts-node": "^10.9.2",
|
|
55
|
+
"typescript": "^5.9.2",
|
|
56
|
+
"eslint-plugin-storybook": "10.0.8",
|
|
57
|
+
"@storybook/addon-docs": "10.0.8"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
61
|
+
"@radix-ui/react-checkbox": "^1.3.3",
|
|
62
|
+
"@radix-ui/react-label": "^2.1.7",
|
|
63
|
+
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
64
|
+
"@radix-ui/react-popover": "1.1.15",
|
|
65
|
+
"@radix-ui/react-progress": "^1.1.7",
|
|
66
|
+
"@radix-ui/react-radio-group": "^1.3.8",
|
|
67
|
+
"@radix-ui/react-select": "^2.2.6",
|
|
68
|
+
"@radix-ui/react-separator": "^1.1.7",
|
|
69
|
+
"@radix-ui/react-slider": "^1.3.6",
|
|
70
|
+
"@radix-ui/react-switch": "^1.2.6",
|
|
71
|
+
"@radix-ui/react-toast": "^1.2.15",
|
|
72
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
73
|
+
"csstype": "^3.1.2",
|
|
74
|
+
"lodash": "^4.17.21",
|
|
75
|
+
"react-phone-input-2": "^2.15.1",
|
|
76
|
+
"@a-little-world/little-world-design-system-core": "1.7.0"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"react": "^19.0.0",
|
|
80
|
+
"react-dom": "^19.0.0",
|
|
81
|
+
"react-router-dom": "^6.28.2",
|
|
82
|
+
"styled-components": "^6.1.18"
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"test": "jest",
|
|
86
|
+
"test-watch": "jest --watch",
|
|
87
|
+
"storybook": "storybook dev -p 6006",
|
|
88
|
+
"build-storybook": "storybook build",
|
|
89
|
+
"build": "rimraf dist && npm run build:esm && npm run build:cjs",
|
|
90
|
+
"build:esm": "tsc --outDir dist/esm",
|
|
91
|
+
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
|
92
|
+
"watch": "tsc --watch",
|
|
93
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
94
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
95
|
+
"format": "prettier --write src",
|
|
96
|
+
"format:check": "prettier --check src"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Text from '../Text/Text';
|
|
4
|
+
import Accordion, { AccordionContent } from './Accordion';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: Accordion,
|
|
9
|
+
title: 'Components/Accordion',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Default = args => {
|
|
13
|
+
return <Accordion {...args} />;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const WithCustomContent = args => {
|
|
17
|
+
return <Accordion {...args} />;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const CustomContentWrapper = styled(AccordionContent)`
|
|
21
|
+
background-color: ${({ theme }) => theme.color.surface.accent};
|
|
22
|
+
padding: ${({ theme }) => theme.spacing.medium};
|
|
23
|
+
border-radius: ${({ theme }) => theme.radius.medium};
|
|
24
|
+
border: 1px solid ${({ theme }) => theme.color.border.moderate};
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
Default.args = {
|
|
28
|
+
items: [
|
|
29
|
+
{
|
|
30
|
+
content: (
|
|
31
|
+
<Text>This is content of the highest quality. The finest degree.</Text>
|
|
32
|
+
),
|
|
33
|
+
header: 'High quality content',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
content: <Text>This is content of a medium quality. A new normal.</Text>,
|
|
37
|
+
header:
|
|
38
|
+
'Content of a mid range but testing out a longer sentence to see the design when it is multi-line',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
content: <Text>This is content of the lowest quality. A new low.</Text>,
|
|
42
|
+
header: 'Low quality content',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
WithCustomContent.args = {
|
|
48
|
+
ContentWrapper: CustomContentWrapper,
|
|
49
|
+
items: [
|
|
50
|
+
{
|
|
51
|
+
content: (
|
|
52
|
+
<Text>This is content of the highest quality. The finest degree.</Text>
|
|
53
|
+
),
|
|
54
|
+
header: 'High quality content',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
content: <Text>This is content of a medium quality. A new normal.</Text>,
|
|
58
|
+
header:
|
|
59
|
+
'Content of a mid range but testing out a longer sentence to see the design when it is multi-line',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
content: <Text>This is content of the lowest quality. A new low.</Text>,
|
|
63
|
+
header: 'Low quality content',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { AccordionBaseProps } from '@a-little-world/little-world-design-system-core';
|
|
4
|
+
import Text from '../Text/Text';
|
|
5
|
+
import { TextTypes } from '@a-little-world/little-world-design-system-core';
|
|
6
|
+
import {
|
|
7
|
+
AccordionContent,
|
|
8
|
+
AccordionHeader,
|
|
9
|
+
AccordionItem,
|
|
10
|
+
AccordionRoot,
|
|
11
|
+
AccordionTrigger,
|
|
12
|
+
TriggerIcon,
|
|
13
|
+
} from './styles';
|
|
14
|
+
|
|
15
|
+
export { AccordionContent };
|
|
16
|
+
export interface AccordionProps extends AccordionBaseProps {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
ContentWrapper?: React.ComponentType<{ children: React.ReactNode }>;
|
|
20
|
+
defaultOpen?: boolean;
|
|
21
|
+
onToggle?: (isOpen: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Accordion: React.FC<AccordionProps> = ({
|
|
25
|
+
className,
|
|
26
|
+
ContentWrapper,
|
|
27
|
+
headerType,
|
|
28
|
+
headerColor,
|
|
29
|
+
items,
|
|
30
|
+
}) => {
|
|
31
|
+
return (
|
|
32
|
+
<AccordionRoot className={className} type="single" collapsible>
|
|
33
|
+
{items.map(({ content, header }) => (
|
|
34
|
+
<AccordionItem value={header} key={header}>
|
|
35
|
+
<AccordionHeader id={header}>
|
|
36
|
+
<AccordionTrigger>
|
|
37
|
+
<Text type={headerType || TextTypes.Body4} color={headerColor}>
|
|
38
|
+
{header}
|
|
39
|
+
</Text>
|
|
40
|
+
<TriggerIcon
|
|
41
|
+
label="accordion toggle icon"
|
|
42
|
+
width="14px"
|
|
43
|
+
height="14px"
|
|
44
|
+
color={headerColor}
|
|
45
|
+
/>
|
|
46
|
+
</AccordionTrigger>
|
|
47
|
+
</AccordionHeader>
|
|
48
|
+
{ContentWrapper ? (
|
|
49
|
+
<ContentWrapper>{content}</ContentWrapper>
|
|
50
|
+
) : (
|
|
51
|
+
<AccordionContent>{content}</AccordionContent>
|
|
52
|
+
)}
|
|
53
|
+
</AccordionItem>
|
|
54
|
+
))}
|
|
55
|
+
</AccordionRoot>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default Accordion;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as Accordion from '@radix-ui/react-accordion';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { ChevronDownIcon } from '../Icon';
|
|
5
|
+
|
|
6
|
+
export const AccordionRoot = styled(Accordion.Root)`
|
|
7
|
+
border: 1px solid ${({ theme }) => theme.color.border.subtle};
|
|
8
|
+
border-radius: 8px;
|
|
9
|
+
|
|
10
|
+
:root {
|
|
11
|
+
--radix-accordion-content-width: 100%;
|
|
12
|
+
--radix-collapsible-content-width: 100%;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export const AccordionItem = styled(Accordion.Item)`
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
margin: 0;
|
|
19
|
+
width: 100%;
|
|
20
|
+
border-bottom: 1px solid ${({ theme }) => theme.color.border.subtle};
|
|
21
|
+
padding: ${({ theme }) => theme.spacing.xxsmall}
|
|
22
|
+
${({ theme }) => theme.spacing.small};
|
|
23
|
+
padding-bottom: 0px;
|
|
24
|
+
|
|
25
|
+
&:last-child {
|
|
26
|
+
border-top-width: 0px;
|
|
27
|
+
border-bottom-width: 0px;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const AccordionHeader = styled(Accordion.Header)`
|
|
32
|
+
margin: 0;
|
|
33
|
+
width: 100%;
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const AccordionContent = styled(Accordion.Content)`
|
|
37
|
+
width: 100%;
|
|
38
|
+
background: ${({ theme }) => theme.color.surface.secondary};
|
|
39
|
+
border-radius: 10px;
|
|
40
|
+
gap: ${({ theme }) => theme.spacing.xxsmall};
|
|
41
|
+
padding: ${({ theme }) => theme.spacing.small};
|
|
42
|
+
margin-bottom: ${({ theme }) => theme.spacing.small};
|
|
43
|
+
line-height: 1.5;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
|
|
47
|
+
&[hidden] {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
export const AccordionTrigger = styled(Accordion.Trigger)`
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: flex-start;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
background: none;
|
|
57
|
+
padding: ${({ theme }) => theme.spacing.xxsmall} 0;
|
|
58
|
+
padding-bottom: ${({ theme }) => theme.spacing.small};
|
|
59
|
+
gap: ${({ theme }) => theme.spacing.small};
|
|
60
|
+
width: 100%;
|
|
61
|
+
border: none;
|
|
62
|
+
text-align: left;
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
export const TriggerIcon = styled(ChevronDownIcon)`
|
|
66
|
+
flex-shrink: 0;
|
|
67
|
+
margin-top: 6px;
|
|
68
|
+
`;
|