@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,48 @@
|
|
|
1
|
+
import { Meta, Unstyled } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { CustomThemeProvider } from '../theme';
|
|
3
|
+
|
|
4
|
+
import RadiusSection from './RadiusDocumentation';
|
|
5
|
+
|
|
6
|
+
<Meta title="Foundations/Border Radius" />
|
|
7
|
+
|
|
8
|
+
<CustomThemeProvider>
|
|
9
|
+
# Border Radius System
|
|
10
|
+
|
|
11
|
+
The border radius system provides consistent border radius values across the Little World Design System. These values are used to create rounded corners on various UI elements, from subtle to dramatic effects.
|
|
12
|
+
|
|
13
|
+
## Border Radius Tokens
|
|
14
|
+
|
|
15
|
+
<Unstyled>
|
|
16
|
+
<RadiusSection />
|
|
17
|
+
</Unstyled>
|
|
18
|
+
|
|
19
|
+
## Usage Guidelines
|
|
20
|
+
|
|
21
|
+
- **xxxsmall (4px)**: Use for subtle rounding on small elements like buttons
|
|
22
|
+
- **xxsmall (8px)**: Use for standard rounding on cards and containers
|
|
23
|
+
- **xsmall (12px)**: Use for comfortable rounding on medium-sized elements
|
|
24
|
+
- **small (16px)**: Use for noticeable rounding on larger elements
|
|
25
|
+
- **medium (20px)**: Use for prominent rounding on major UI elements
|
|
26
|
+
- **large (24px)**: Use for generous rounding on hero sections
|
|
27
|
+
- **xlarge (32px)**: Use for substantial rounding on large containers
|
|
28
|
+
- **xxlarge (40px)**: Use for maximum rounding on very large elements
|
|
29
|
+
- **massive (100px)**: Use for dramatic rounding on special elements
|
|
30
|
+
- **half (50%)**: Use for creating circular elements
|
|
31
|
+
- **full (100%)**: Use for creating fully rounded elements
|
|
32
|
+
|
|
33
|
+
## Implementation
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// Use radius tokens in styled-components
|
|
37
|
+
const Card = styled.div`
|
|
38
|
+
border-radius: ${({ theme }) => theme.radius.medium};
|
|
39
|
+
padding: ${({ theme }) => theme.spacing.medium};
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const Circle = styled.div`
|
|
43
|
+
border-radius: ${({ theme }) => theme.radius.half};
|
|
44
|
+
width: 100px;
|
|
45
|
+
height: 100px;
|
|
46
|
+
`;
|
|
47
|
+
```
|
|
48
|
+
</CustomThemeProvider>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Meta, Unstyled } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { CustomThemeProvider } from '../theme';
|
|
3
|
+
|
|
4
|
+
import SpacingSection from './SpacingDocumentation';
|
|
5
|
+
|
|
6
|
+
<Meta title="Foundations/Spacing" />
|
|
7
|
+
|
|
8
|
+
<CustomThemeProvider>
|
|
9
|
+
# Spacing System
|
|
10
|
+
|
|
11
|
+
The spacing system provides consistent spacing values across the Little World Design System. All spacing values are based on an 8px base unit and follow a systematic scale.
|
|
12
|
+
|
|
13
|
+
## Spacing Scale
|
|
14
|
+
|
|
15
|
+
Our spacing system uses a base unit of 8px, with values calculated as multiples of this base unit. This ensures consistency and makes it easy to maintain proportional spacing throughout the application.
|
|
16
|
+
|
|
17
|
+
## Spacing Tokens
|
|
18
|
+
|
|
19
|
+
<Unstyled>
|
|
20
|
+
<SpacingSection />
|
|
21
|
+
</Unstyled>
|
|
22
|
+
|
|
23
|
+
## Usage Guidelines
|
|
24
|
+
|
|
25
|
+
- **xxxxsmall (2px)**: Use for minimal spacing, such as between closely related elements
|
|
26
|
+
- **xxxsmall (4px)**: Use for tight spacing in compact layouts
|
|
27
|
+
- **xxsmall (8px)**: Use for standard spacing between related elements
|
|
28
|
+
- **xsmall (12px)**: Use for comfortable spacing in most layouts
|
|
29
|
+
- **small (16px)**: Use for standard spacing between sections
|
|
30
|
+
- **medium (24px)**: Use for breathing room between major sections
|
|
31
|
+
- **large (32px)**: Use for generous spacing between page sections
|
|
32
|
+
- **xlarge (40px)**: Use for substantial spacing in spacious layouts
|
|
33
|
+
- **xxlarge (64px)**: Use for maximum spacing in hero sections
|
|
34
|
+
- **massive (120px)**: Use for dramatic spacing in large layouts
|
|
35
|
+
|
|
36
|
+
## Implementation
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
// Use spacing tokens in styled-components
|
|
40
|
+
const Container = styled.div`
|
|
41
|
+
padding: ${({ theme }) => theme.spacing.medium};
|
|
42
|
+
margin-bottom: ${({ theme }) => theme.spacing.large};
|
|
43
|
+
`;
|
|
44
|
+
```
|
|
45
|
+
</CustomThemeProvider>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import "@testing-library/jest-dom/extend-expect";
|
|
4
|
+
import {
|
|
5
|
+
render as defaultRender,
|
|
6
|
+
RenderOptions,
|
|
7
|
+
RenderResult,
|
|
8
|
+
} from "@testing-library/react";
|
|
9
|
+
import userEvent, { UserEvent } from "@testing-library/user-event";
|
|
10
|
+
import { ThemeProvider } from "styled-components";
|
|
11
|
+
import { themes } from "./theme";
|
|
12
|
+
|
|
13
|
+
interface CustomRenderOptions extends Omit<RenderOptions, "wrapper"> {
|
|
14
|
+
wrapper?: React.ComponentType<{ children: ReactNode }>;
|
|
15
|
+
router?: unknown;
|
|
16
|
+
mocks?: unknown[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function render(
|
|
20
|
+
ui: ReactNode,
|
|
21
|
+
{
|
|
22
|
+
wrapper: CustomWrapper,
|
|
23
|
+
router,
|
|
24
|
+
mocks = [],
|
|
25
|
+
...options
|
|
26
|
+
}: CustomRenderOptions = {}
|
|
27
|
+
): RenderResult {
|
|
28
|
+
const Wrapper =
|
|
29
|
+
CustomWrapper ||
|
|
30
|
+
(({ children }: { children: ReactNode }) => (
|
|
31
|
+
<ThemeProvider theme={themes.light}>{children}</ThemeProvider>
|
|
32
|
+
));
|
|
33
|
+
|
|
34
|
+
return defaultRender(ui, { wrapper: Wrapper, ...options });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function renderWithUser(
|
|
38
|
+
ui: ReactNode,
|
|
39
|
+
options?: CustomRenderOptions
|
|
40
|
+
): RenderResult & { user: UserEvent } {
|
|
41
|
+
return {
|
|
42
|
+
user: userEvent.setup(),
|
|
43
|
+
...render(ui, options),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Re-export everything
|
|
48
|
+
export * from "@testing-library/react";
|
|
49
|
+
export { render, renderWithUser };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ReactNode,
|
|
3
|
+
createContext,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import { DefaultTheme, ThemeProvider } from 'styled-components';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
ThemeVariants,
|
|
13
|
+
ThemeContextType,
|
|
14
|
+
defaultThemeVariant,
|
|
15
|
+
tokensPixelated,
|
|
16
|
+
} from '@a-little-world/little-world-design-system-core';
|
|
17
|
+
|
|
18
|
+
export const lightTheme: DefaultTheme = {
|
|
19
|
+
...tokensPixelated,
|
|
20
|
+
color: tokensPixelated.color.theme.light,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const darkTheme: DefaultTheme = {
|
|
24
|
+
...tokensPixelated,
|
|
25
|
+
color: tokensPixelated.color.theme.dark,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const defaultTheme = lightTheme;
|
|
29
|
+
|
|
30
|
+
export const themes = {
|
|
31
|
+
light: lightTheme,
|
|
32
|
+
dark: darkTheme,
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
export interface ThemeProviderProps {
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
defaultMode?: ThemeVariants;
|
|
38
|
+
enableDarkMode?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const themeContext = createContext<ThemeContextType>({
|
|
42
|
+
toggleMode: () => {},
|
|
43
|
+
setMode: (_mode: ThemeVariants) => {},
|
|
44
|
+
currentMode: defaultThemeVariant,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const { Provider } = themeContext;
|
|
48
|
+
|
|
49
|
+
export const CustomThemeProvider = ({
|
|
50
|
+
children,
|
|
51
|
+
defaultMode = defaultThemeVariant,
|
|
52
|
+
enableDarkMode = false,
|
|
53
|
+
}: ThemeProviderProps) => {
|
|
54
|
+
const [currentMode, setCurrentMode] = useState<ThemeVariants>(defaultMode);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (enableDarkMode && typeof window !== 'undefined') {
|
|
58
|
+
const savedTheme = localStorage.getItem('theme') as ThemeVariants;
|
|
59
|
+
const prefersDark =
|
|
60
|
+
window.matchMedia &&
|
|
61
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
62
|
+
if (savedTheme && ['dark', 'light'].includes(savedTheme)) {
|
|
63
|
+
setCurrentMode(savedTheme);
|
|
64
|
+
} else if (prefersDark) {
|
|
65
|
+
setCurrentMode(ThemeVariants.dark);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, [enableDarkMode]);
|
|
69
|
+
|
|
70
|
+
const toggleMode = useCallback(() => {
|
|
71
|
+
setCurrentMode((currentMode: ThemeVariants) =>
|
|
72
|
+
currentMode === ThemeVariants.light
|
|
73
|
+
? ThemeVariants.dark
|
|
74
|
+
: ThemeVariants.light,
|
|
75
|
+
);
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
const setMode = useCallback((mode: ThemeVariants) => {
|
|
79
|
+
setCurrentMode(mode);
|
|
80
|
+
}, []);
|
|
81
|
+
|
|
82
|
+
const contextValue = useMemo(
|
|
83
|
+
() => ({
|
|
84
|
+
currentMode,
|
|
85
|
+
toggleMode,
|
|
86
|
+
setMode,
|
|
87
|
+
}),
|
|
88
|
+
[currentMode, toggleMode, setMode],
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Provider value={contextValue}>
|
|
93
|
+
<ThemeProvider theme={themes[currentMode] || defaultTheme}>
|
|
94
|
+
{children}
|
|
95
|
+
</ThemeProvider>
|
|
96
|
+
</Provider>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { keyframes } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const enterFromRight = keyframes`
|
|
4
|
+
from {
|
|
5
|
+
opacity: 0;
|
|
6
|
+
transform: translateX(200px);
|
|
7
|
+
}
|
|
8
|
+
to {
|
|
9
|
+
opacity: 1;
|
|
10
|
+
transform: translateX(0);
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const enterFromLeft = keyframes`
|
|
15
|
+
from {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
transform: translateX(-200px);
|
|
18
|
+
}
|
|
19
|
+
to {
|
|
20
|
+
opacity: 1;
|
|
21
|
+
transform: translateX(0);
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export const exitToRight = keyframes`
|
|
26
|
+
from {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
transform: translateX(0);
|
|
29
|
+
}
|
|
30
|
+
to {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
transform: translateX(200px);
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const exitToLeft = keyframes`
|
|
37
|
+
from {
|
|
38
|
+
opacity: 1;
|
|
39
|
+
transform: translateX(0);
|
|
40
|
+
}
|
|
41
|
+
to {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
transform: translateX(-200px);
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
export const slideUpAndFade = keyframes`
|
|
48
|
+
from {
|
|
49
|
+
opacity: 0;
|
|
50
|
+
transform: translateY(2px);
|
|
51
|
+
}
|
|
52
|
+
to {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
transform: translateY(0);
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
export const slideRightAndFade = keyframes`
|
|
59
|
+
from {
|
|
60
|
+
opacity: 0;
|
|
61
|
+
transform: translateX(-2px);
|
|
62
|
+
}
|
|
63
|
+
to {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
transform: translateX(0);
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const slideDownAndFade = keyframes`
|
|
70
|
+
from {
|
|
71
|
+
opacity: 0;
|
|
72
|
+
transform: translateY(-2px);
|
|
73
|
+
}
|
|
74
|
+
to {
|
|
75
|
+
opacity: 1;
|
|
76
|
+
transform: translateY(0);
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
export const slideLeftAndFade = keyframes`
|
|
81
|
+
from {
|
|
82
|
+
opacity: 0;
|
|
83
|
+
transform: translateX(2px);
|
|
84
|
+
}
|
|
85
|
+
to {
|
|
86
|
+
opacity: 1;
|
|
87
|
+
transform: translateX(0);
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
export const scaleIn = keyframes`
|
|
92
|
+
from {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
transform: rotateX(-30deg) scale(0.9);
|
|
95
|
+
}
|
|
96
|
+
to {
|
|
97
|
+
opacity: 1;
|
|
98
|
+
transform: rotateX(0deg) scale(1);
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
|
|
102
|
+
export const scaleOut = keyframes`
|
|
103
|
+
from {
|
|
104
|
+
opacity: 1;
|
|
105
|
+
transform: rotateX(0deg) scale(1);
|
|
106
|
+
}
|
|
107
|
+
to {
|
|
108
|
+
opacity: 0;
|
|
109
|
+
transform: rotateX(-10deg) scale(0.95);
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
export const fadeIn = keyframes`
|
|
114
|
+
from {
|
|
115
|
+
opacity: 0;
|
|
116
|
+
}
|
|
117
|
+
to {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
export const fadeOut = keyframes`
|
|
123
|
+
from {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
}
|
|
126
|
+
to {
|
|
127
|
+
opacity: 0;
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
SvgTransformOptions,
|
|
4
|
+
ParsedSvg,
|
|
5
|
+
SvgElement,
|
|
6
|
+
Gradients,
|
|
7
|
+
GradientTypes,
|
|
8
|
+
} from '@a-little-world/little-world-design-system-core';
|
|
9
|
+
import IconGradient from '../components/Icon/IconGradient';
|
|
10
|
+
|
|
11
|
+
// Helper function to generate unique keys
|
|
12
|
+
const generateUniqueKey = (element: SvgElement, index: string | number) => {
|
|
13
|
+
return `${element.type}-${index}-${Math.random()
|
|
14
|
+
.toString(36)
|
|
15
|
+
.substring(2, 11)}`;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Helper function to safely render children, filtering out null values
|
|
19
|
+
const renderChildren = (
|
|
20
|
+
children: SvgElement[],
|
|
21
|
+
options: SvgTransformOptions,
|
|
22
|
+
parentIndex: string | number,
|
|
23
|
+
) => {
|
|
24
|
+
return children
|
|
25
|
+
.map((child, i) => renderSvgElement(child, options, `${parentIndex}-${i}`))
|
|
26
|
+
.filter(Boolean); // Filter out null elements
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Renders SVG elements recursively
|
|
30
|
+
const renderSvgElement = (
|
|
31
|
+
element: SvgElement,
|
|
32
|
+
options: SvgTransformOptions,
|
|
33
|
+
index: string | number,
|
|
34
|
+
) => {
|
|
35
|
+
const { gradient, gradientId, color } = options;
|
|
36
|
+
|
|
37
|
+
// Get all attributes and override fill for path elements if needed
|
|
38
|
+
const attrs = { ...element.attributes };
|
|
39
|
+
|
|
40
|
+
// Handle color attributes for SVG elements based on the colorAttribute property
|
|
41
|
+
// If element has color set that isn't #000 - do not override
|
|
42
|
+
if (element.colorAttribute && element.colorAttribute !== 'none') {
|
|
43
|
+
if (attrs[element.colorAttribute] === '#000') {
|
|
44
|
+
attrs[element.colorAttribute] = gradient
|
|
45
|
+
? `url(#${gradientId})`
|
|
46
|
+
: color || 'currentColor';
|
|
47
|
+
} else {
|
|
48
|
+
attrs[element.colorAttribute] =
|
|
49
|
+
attrs[element.colorAttribute] || color || 'currentColor';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Add unique key attribute
|
|
54
|
+
const elementKey = generateUniqueKey(element, index);
|
|
55
|
+
|
|
56
|
+
switch (element.type) {
|
|
57
|
+
case 'path':
|
|
58
|
+
return <path key={elementKey} {...attrs} />;
|
|
59
|
+
case 'g':
|
|
60
|
+
return (
|
|
61
|
+
<g key={elementKey} {...attrs}>
|
|
62
|
+
{renderChildren(element.children, options, index)}
|
|
63
|
+
</g>
|
|
64
|
+
);
|
|
65
|
+
case 'defs':
|
|
66
|
+
return (
|
|
67
|
+
<defs key={elementKey} {...attrs}>
|
|
68
|
+
{renderChildren(element.children, options, index)}
|
|
69
|
+
</defs>
|
|
70
|
+
);
|
|
71
|
+
case 'linearGradient':
|
|
72
|
+
return (
|
|
73
|
+
<linearGradient key={elementKey} {...attrs}>
|
|
74
|
+
{renderChildren(element.children, options, index)}
|
|
75
|
+
</linearGradient>
|
|
76
|
+
);
|
|
77
|
+
case 'clipPath':
|
|
78
|
+
return (
|
|
79
|
+
<clipPath key={elementKey} {...attrs}>
|
|
80
|
+
{renderChildren(element.children, options, index)}
|
|
81
|
+
</clipPath>
|
|
82
|
+
);
|
|
83
|
+
case 'stop':
|
|
84
|
+
return <stop key={elementKey} {...attrs} />;
|
|
85
|
+
case 'circle':
|
|
86
|
+
return <circle key={elementKey} {...attrs} />;
|
|
87
|
+
case 'rect':
|
|
88
|
+
return <rect key={elementKey} {...attrs} />;
|
|
89
|
+
case 'line':
|
|
90
|
+
return <line key={elementKey} {...attrs} />;
|
|
91
|
+
case 'polygon':
|
|
92
|
+
return <polygon key={elementKey} {...attrs} />;
|
|
93
|
+
case 'polyline':
|
|
94
|
+
return <polyline key={elementKey} {...attrs} />;
|
|
95
|
+
case 'ellipse':
|
|
96
|
+
return <ellipse key={elementKey} {...attrs} />;
|
|
97
|
+
default:
|
|
98
|
+
console.warn(`Unsupported SVG element type: ${element.type}`);
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const createReactSvg = (
|
|
104
|
+
svgData: ParsedSvg,
|
|
105
|
+
options: SvgTransformOptions,
|
|
106
|
+
) => {
|
|
107
|
+
const {
|
|
108
|
+
className,
|
|
109
|
+
width,
|
|
110
|
+
height,
|
|
111
|
+
gradient,
|
|
112
|
+
gradientId,
|
|
113
|
+
gradientType,
|
|
114
|
+
label,
|
|
115
|
+
} = options;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<svg
|
|
119
|
+
aria-labelledby={label}
|
|
120
|
+
fill="none"
|
|
121
|
+
focusable={false}
|
|
122
|
+
width={width}
|
|
123
|
+
height={height}
|
|
124
|
+
className={className}
|
|
125
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
126
|
+
viewBox={svgData.viewBox}
|
|
127
|
+
>
|
|
128
|
+
{svgData.elements.map((element, index) =>
|
|
129
|
+
renderSvgElement(element, options, index),
|
|
130
|
+
)}
|
|
131
|
+
{gradient && (
|
|
132
|
+
<IconGradient
|
|
133
|
+
variation={gradient as Gradients}
|
|
134
|
+
type={gradientType as GradientTypes}
|
|
135
|
+
id={gradientId as string}
|
|
136
|
+
/>
|
|
137
|
+
)}
|
|
138
|
+
</svg>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { CustomThemeProvider } from '../theme';
|
|
3
|
+
|
|
4
|
+
<Meta title="Foundations/Text Parser" />
|
|
5
|
+
|
|
6
|
+
<CustomThemeProvider>
|
|
7
|
+
# Text Parser
|
|
8
|
+
|
|
9
|
+
The Little World Text Parser allows for copy to include pre-defined tags that allows the rendered text to contain certain styling or functional elements.
|
|
10
|
+
The Parser automatically converts html links included in the text into clickable html anchors, unless they are included as part of a pre-defined tag.
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
https://little-world.com and little-world.com // both will be converted into html anchors
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Tags follow the html tag format and must be written as such:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
<highlight>This text will be highlighted</highlight>
|
|
20
|
+
<bold>This text will be bold in the current color</bold>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
When using tags that correspond to html elements, attributes for that element can be included in a JSON object within the opening tag:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
<a {"href": "little-world"}>this is an anchor</a>
|
|
27
|
+
<button {"data-cal-link":"www.validlink.com", "data-cal-config":"{ layout: stacked }"}>Click Me</button>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The [Text](?path=/story/components-text--default) component has the text parser baked into it.
|
|
31
|
+
Therefore it always recommended to wrap all text in the Text Component to benefit from the parser (plus get the correctly styling and types).
|
|
32
|
+
|
|
33
|
+
## Valid Little World tags
|
|
34
|
+
|
|
35
|
+
| Tag | Output | Requires |
|
|
36
|
+
| --------- | ------------------------------------- | -------------- |
|
|
37
|
+
| a | html anchor tag | href attribute |
|
|
38
|
+
| button | html button element | |
|
|
39
|
+
| bold | bold text | |
|
|
40
|
+
| highlight | html strong tag and "highlight" color | - |
|
|
41
|
+
</CustomThemeProvider>
|