@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,91 @@
|
|
|
1
|
+
import { Meta, Unstyled } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { CustomThemeProvider } from '../../theme';
|
|
3
|
+
|
|
4
|
+
import { TypographyItem } from '../../storybook/Components';
|
|
5
|
+
import Text from './Text';
|
|
6
|
+
import { TextTypes } from '@a-little-world/little-world-design-system-core';
|
|
7
|
+
|
|
8
|
+
<Meta title="Foundations/Typography" />
|
|
9
|
+
|
|
10
|
+
<CustomThemeProvider>
|
|
11
|
+
# Typography
|
|
12
|
+
|
|
13
|
+
All accepted Typography across the Little World appliction is stored in `TextTypes`, which is comprised of two different types: Heading & Body.
|
|
14
|
+
All font-sizes use the [rem]()
|
|
15
|
+
|
|
16
|
+
## Headings
|
|
17
|
+
|
|
18
|
+
Headings are used to summmarize and highlight a particular section on a page.
|
|
19
|
+
Font-family: 'Signika Negative'
|
|
20
|
+
Font-family: 'Work Sans'
|
|
21
|
+
|
|
22
|
+
Here are the following Heading sizes that we use across the app:
|
|
23
|
+
|
|
24
|
+
<Unstyled>
|
|
25
|
+
|
|
26
|
+
<TypographyItem
|
|
27
|
+
item={<Text type={TextTypes.Heading1}>Heading1</Text>}
|
|
28
|
+
details={'Font Size: Mobile: 4rem, Desktop: 5rem'}
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<TypographyItem
|
|
32
|
+
item={<Text type={TextTypes.Heading2}>Heading2</Text>}
|
|
33
|
+
details={'Font Size: Mobile: 3.5rem, Desktop: 4rem'}
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<TypographyItem
|
|
37
|
+
item={<Text type={TextTypes.Heading3}>Heading3</Text>}
|
|
38
|
+
details={'Font Size: Mobile: 2.5rem, Desktop: 3rem'}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<TypographyItem
|
|
42
|
+
item={<Text type={TextTypes.Heading4}>Heading4</Text>}
|
|
43
|
+
details={'Font Size: Mobile: 2rem, Desktop: 2rem'}
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<TypographyItem
|
|
47
|
+
item={<Text type={TextTypes.Heading5}>Heading5</Text>}
|
|
48
|
+
details={'Font Size: Mobile: 1.5rem, Desktop: 1.5rem'}
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
<TypographyItem item={<Text type={TextTypes.Heading6}>Heading6</Text>} details={'Font Size: Mobile: 1rem, Desktop: 1rem'} />
|
|
52
|
+
</Unstyled>
|
|
53
|
+
|
|
54
|
+
## Body
|
|
55
|
+
|
|
56
|
+
Font-family: 'Signika Negative'
|
|
57
|
+
|
|
58
|
+
Here are the following Body sizes that we use across the app:
|
|
59
|
+
|
|
60
|
+
<Unstyled>
|
|
61
|
+
<TypographyItem
|
|
62
|
+
item={<Text type={TextTypes.Body1}>Body1</Text>}
|
|
63
|
+
details={'Font Size: Mobile: 2rem, Desktop: 2.5rem'}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<TypographyItem
|
|
67
|
+
item={<Text type={TextTypes.Body2}>Body2</Text>}
|
|
68
|
+
details={'Font Size: Mobile: 1.75rem, Desktop: 2rem'}
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<TypographyItem
|
|
72
|
+
item={<Text type={TextTypes.Body3}>Body3</Text>}
|
|
73
|
+
details={'Font Size: Mobile: 1.5rem, Desktop: 1.5rem'}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<TypographyItem
|
|
77
|
+
item={<Text type={TextTypes.Body4}>Body4</Text>}
|
|
78
|
+
details={'Font Size: Mobile: 1.25rem, Desktop: 1.25rem'}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
<TypographyItem
|
|
82
|
+
item={<Text type={TextTypes.Body5}>Body5</Text>}
|
|
83
|
+
details={'Font Size: Mobile: 1rem, Desktop: 1rem'}
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<TypographyItem item={<Text type={TextTypes.Body6}>Body6</Text>} details={'Font Size: Mobile: 0.8725rem, Desktop: 0.8725rem'} />
|
|
87
|
+
|
|
88
|
+
<TypographyItem item={<Text type={TextTypes.Body7}>Body7</Text>} details={'Font Size: Mobile: 0.75rem, Desktop: 0.75rem'} />
|
|
89
|
+
|
|
90
|
+
</Unstyled>
|
|
91
|
+
</CustomThemeProvider>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import TextArea, { TextAreaSize, TextAreaProps } from './TextArea';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: TextArea,
|
|
7
|
+
title: 'Components/TextArea',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Default = (args: TextAreaProps) => <TextArea {...args} />;
|
|
11
|
+
|
|
12
|
+
Default.args = {
|
|
13
|
+
placeholder: 'Insert your text',
|
|
14
|
+
id: 'text input id',
|
|
15
|
+
label: 'Text Input',
|
|
16
|
+
readOnly: false,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const MessageBox = (args: TextAreaProps) => <TextArea {...args} />;
|
|
20
|
+
|
|
21
|
+
MessageBox.args = {
|
|
22
|
+
placeholder: 'Insert your message',
|
|
23
|
+
id: 'message box id',
|
|
24
|
+
expandable: true,
|
|
25
|
+
size: TextAreaSize.Xsmall,
|
|
26
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { Ref, useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import useAutosizeTextArea from '../../hooks/useAutosizeTextArea';
|
|
4
|
+
import InputError from '../InputError/InputError';
|
|
5
|
+
import Label from '../Label/Label';
|
|
6
|
+
import {
|
|
7
|
+
TextAreaSize,
|
|
8
|
+
TextTypes,
|
|
9
|
+
} from '@a-little-world/little-world-design-system-core';
|
|
10
|
+
import { Area, AreaWrapper, Counter } from './styles';
|
|
11
|
+
|
|
12
|
+
export { TextAreaSize };
|
|
13
|
+
|
|
14
|
+
export interface TextAreaProps
|
|
15
|
+
extends React.ComponentPropsWithoutRef<'textarea'> {
|
|
16
|
+
displayCount?: boolean;
|
|
17
|
+
error?: string;
|
|
18
|
+
expandable?: boolean;
|
|
19
|
+
id?: string;
|
|
20
|
+
inputRef?: Ref<HTMLFormElement>;
|
|
21
|
+
label?: string;
|
|
22
|
+
labelTooltip?: string;
|
|
23
|
+
maxLength?: number;
|
|
24
|
+
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
25
|
+
onSubmit?: () => boolean;
|
|
26
|
+
size?: TextAreaSize;
|
|
27
|
+
value?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const TextArea: React.FC<TextAreaProps> = ({
|
|
31
|
+
displayCount = true,
|
|
32
|
+
error,
|
|
33
|
+
expandable,
|
|
34
|
+
id,
|
|
35
|
+
inputRef,
|
|
36
|
+
label,
|
|
37
|
+
labelTooltip,
|
|
38
|
+
maxLength,
|
|
39
|
+
onChange,
|
|
40
|
+
onSubmit,
|
|
41
|
+
readOnly,
|
|
42
|
+
size = TextAreaSize.Small,
|
|
43
|
+
value,
|
|
44
|
+
...areaProps
|
|
45
|
+
}) => {
|
|
46
|
+
const [internalValue, setInternalValue] = useState(value ?? '');
|
|
47
|
+
const textAreaRef = useRef<HTMLTextAreaElement | null>(null);
|
|
48
|
+
const isTouchDeviceRef = useRef(
|
|
49
|
+
typeof window !== 'undefined' &&
|
|
50
|
+
('ontouchstart' in window || navigator.maxTouchPoints > 0),
|
|
51
|
+
);
|
|
52
|
+
useAutosizeTextArea(textAreaRef.current, internalValue, expandable);
|
|
53
|
+
const [textAreaCount, setTextAreaCount] = useState(0);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setTextAreaCount(value?.length || 0);
|
|
57
|
+
setInternalValue(value || '');
|
|
58
|
+
}, [value]);
|
|
59
|
+
|
|
60
|
+
const handleOnChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
61
|
+
onChange?.(e);
|
|
62
|
+
setTextAreaCount(e.target.value.length);
|
|
63
|
+
setInternalValue(e.target.value);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handleKeyDown = async (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
67
|
+
if (
|
|
68
|
+
onSubmit &&
|
|
69
|
+
e.key === 'Enter' &&
|
|
70
|
+
!e.shiftKey &&
|
|
71
|
+
!isTouchDeviceRef.current
|
|
72
|
+
) {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
const submitSuccessful = await onSubmit();
|
|
75
|
+
if (submitSuccessful) setInternalValue('');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<AreaWrapper $size={size}>
|
|
81
|
+
{label && (
|
|
82
|
+
<Label bold htmlFor={id} tooltipText={labelTooltip}>
|
|
83
|
+
{label}
|
|
84
|
+
</Label>
|
|
85
|
+
)}
|
|
86
|
+
{Boolean(displayCount && !readOnly && maxLength) && (
|
|
87
|
+
<Counter
|
|
88
|
+
type={TextTypes.Body7}
|
|
89
|
+
>{`${textAreaCount}/${maxLength}`}</Counter>
|
|
90
|
+
)}
|
|
91
|
+
<Area
|
|
92
|
+
ref={e => {
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
inputRef?.(e);
|
|
95
|
+
textAreaRef.current = e;
|
|
96
|
+
}}
|
|
97
|
+
id={id}
|
|
98
|
+
$hasError={Boolean(error)}
|
|
99
|
+
$size={size}
|
|
100
|
+
$expandable={Boolean(expandable)}
|
|
101
|
+
maxLength={maxLength}
|
|
102
|
+
onChange={handleOnChange}
|
|
103
|
+
onKeyDown={handleKeyDown}
|
|
104
|
+
readOnly={readOnly}
|
|
105
|
+
value={value}
|
|
106
|
+
{...areaProps}
|
|
107
|
+
/>
|
|
108
|
+
{!readOnly && (
|
|
109
|
+
<InputError visible={Boolean(error)} textAlign="left">
|
|
110
|
+
{error}
|
|
111
|
+
</InputError>
|
|
112
|
+
)}
|
|
113
|
+
</AreaWrapper>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default TextArea;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { INPUT_ERROR_CSS } from '../InputError/InputError';
|
|
4
|
+
import Text from '../Text/Text';
|
|
5
|
+
import {
|
|
6
|
+
TextAreaDimensions,
|
|
7
|
+
TextAreaSize,
|
|
8
|
+
} from '@a-little-world/little-world-design-system-core';
|
|
9
|
+
|
|
10
|
+
export const AreaWrapper = styled.div<{ $size?: TextAreaSize }>`
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
width: 100%;
|
|
14
|
+
max-width: ${({ $size }) =>
|
|
15
|
+
$size === TextAreaSize.Small ? '500px' : '100%'};
|
|
16
|
+
position: relative;
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export const Area = styled.textarea<{
|
|
20
|
+
$expandable: boolean;
|
|
21
|
+
$hasError: boolean;
|
|
22
|
+
$size: TextAreaSize;
|
|
23
|
+
}>`
|
|
24
|
+
width: 100%;
|
|
25
|
+
font-family: 'Signika Negative', sans-serif;
|
|
26
|
+
font-size: 1rem;
|
|
27
|
+
height: ${({ $size }) => TextAreaDimensions[$size]};
|
|
28
|
+
border: 1px solid ${({ theme }) => theme.color.border.moderate};
|
|
29
|
+
border-radius: ${({ $size, theme }) =>
|
|
30
|
+
$size === TextAreaSize.Xsmall ? theme.radius.large : theme.radius.xxsmall};
|
|
31
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
32
|
+
color: ${({ theme }) => theme.color.text.primary};
|
|
33
|
+
padding: ${({ $size, theme }) =>
|
|
34
|
+
$size === TextAreaSize.Small
|
|
35
|
+
? theme.spacing.xxsmall
|
|
36
|
+
: $size === TextAreaSize.Xsmall
|
|
37
|
+
? '11px 14px'
|
|
38
|
+
: theme.spacing.small};
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
margin-bottom: ${({ theme, readOnly }) =>
|
|
41
|
+
readOnly ? 0 : theme.spacing.xxxxsmall};
|
|
42
|
+
resize: none;
|
|
43
|
+
|
|
44
|
+
${({ $expandable, $size }) =>
|
|
45
|
+
$expandable &&
|
|
46
|
+
css`
|
|
47
|
+
min-height: ${TextAreaDimensions[$size]};
|
|
48
|
+
max-height: 13rem;
|
|
49
|
+
max-height: 25dvh;
|
|
50
|
+
`}
|
|
51
|
+
${({ $hasError }) => $hasError && INPUT_ERROR_CSS};
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
export const Counter = styled(Text)`
|
|
55
|
+
position: absolute;
|
|
56
|
+
bottom: 0px;
|
|
57
|
+
right: ${({ theme }) => theme.spacing.xxxxsmall};
|
|
58
|
+
`;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { ManOnRocketImage, WavyLinesImage } from '../Illustrations';
|
|
4
|
+
import TextPage, { ContentTypes } from './TextContent';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Text,
|
|
8
|
+
title: 'Components/TextContent',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Default = args => (
|
|
12
|
+
<div>
|
|
13
|
+
<TextPage
|
|
14
|
+
content={[
|
|
15
|
+
{ text: 'Type: Heading', type: ContentTypes.Heading },
|
|
16
|
+
{ text: 'Type: Title', type: ContentTypes.Title },
|
|
17
|
+
{ text: 'Type: Subtitle', type: ContentTypes.Subtitle },
|
|
18
|
+
{ text: 'Type: Paragraph', type: ContentTypes.Paragraph },
|
|
19
|
+
{ text: 'Type: Sentence', type: ContentTypes.Sentence },
|
|
20
|
+
{
|
|
21
|
+
text: 'Type: Image',
|
|
22
|
+
type: ContentTypes.Image,
|
|
23
|
+
Image: ManOnRocketImage,
|
|
24
|
+
imageWidth: '50%',
|
|
25
|
+
imageMaxWidth: '200px',
|
|
26
|
+
},
|
|
27
|
+
{ text: 'Type: List Item (below)', type: ContentTypes.Emphasize },
|
|
28
|
+
{
|
|
29
|
+
text: 'Type: List',
|
|
30
|
+
type: ContentTypes.List,
|
|
31
|
+
listItems: ['Example 1', 'Example 2', 'Example 3'],
|
|
32
|
+
},
|
|
33
|
+
{ text: 'Type: Ordered List (below)', type: ContentTypes.Emphasize },
|
|
34
|
+
{
|
|
35
|
+
text: 'Type: OrderedList',
|
|
36
|
+
type: ContentTypes.OrderedList,
|
|
37
|
+
listItems: ['Example 1', 'Example 2', 'Example 3'],
|
|
38
|
+
style: { color: 'red' },
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
text: 'Type: Emphasize',
|
|
42
|
+
type: ContentTypes.Emphasize,
|
|
43
|
+
style: { marginBottom: '32px' },
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
text: 'Type: Image',
|
|
47
|
+
type: ContentTypes.Image,
|
|
48
|
+
Image: WavyLinesImage,
|
|
49
|
+
},
|
|
50
|
+
]}
|
|
51
|
+
{...args}
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
import Text from '../Text/Text';
|
|
4
|
+
import { TextTypes } from '@a-little-world/little-world-design-system-core';
|
|
5
|
+
import { ContentWrapper, ImageWrapper, List, ListItem } from './styles';
|
|
6
|
+
|
|
7
|
+
export enum ContentTypes {
|
|
8
|
+
Paragraph = 'paragraph',
|
|
9
|
+
List = 'list',
|
|
10
|
+
OrderedList = 'orderedList',
|
|
11
|
+
Title = 'title',
|
|
12
|
+
Subtitle = 'subtitle',
|
|
13
|
+
Heading = 'heading',
|
|
14
|
+
Emphasize = 'emphasize',
|
|
15
|
+
Sentence = 'sentence',
|
|
16
|
+
Image = 'image',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type Props = {
|
|
20
|
+
content: {
|
|
21
|
+
center?: boolean;
|
|
22
|
+
type: ContentTypes;
|
|
23
|
+
text?: string;
|
|
24
|
+
listItems?: string[];
|
|
25
|
+
color?: string;
|
|
26
|
+
Image?: React.ElementType;
|
|
27
|
+
imageWidth?: string;
|
|
28
|
+
imageMaxWidth?: string;
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
}[];
|
|
31
|
+
marginBottom?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const TextPage = ({ content, marginBottom }: Props) => {
|
|
35
|
+
return (
|
|
36
|
+
<ContentWrapper $marginBottom={marginBottom}>
|
|
37
|
+
{content.map(
|
|
38
|
+
({
|
|
39
|
+
color,
|
|
40
|
+
center,
|
|
41
|
+
text,
|
|
42
|
+
type,
|
|
43
|
+
listItems,
|
|
44
|
+
Image,
|
|
45
|
+
imageWidth,
|
|
46
|
+
imageMaxWidth,
|
|
47
|
+
style,
|
|
48
|
+
}) => {
|
|
49
|
+
if (type === ContentTypes.Heading)
|
|
50
|
+
return (
|
|
51
|
+
<Text
|
|
52
|
+
style={style}
|
|
53
|
+
key={text}
|
|
54
|
+
tag="h2"
|
|
55
|
+
type={TextTypes.Heading3}
|
|
56
|
+
color={color}
|
|
57
|
+
center={center}
|
|
58
|
+
>
|
|
59
|
+
{text}
|
|
60
|
+
</Text>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (type === ContentTypes.Title)
|
|
64
|
+
return (
|
|
65
|
+
<Text
|
|
66
|
+
style={style}
|
|
67
|
+
key={text}
|
|
68
|
+
tag="h3"
|
|
69
|
+
type={TextTypes.Body2}
|
|
70
|
+
bold
|
|
71
|
+
color={color}
|
|
72
|
+
center={center}
|
|
73
|
+
>
|
|
74
|
+
{text}
|
|
75
|
+
</Text>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
if (type === ContentTypes.Subtitle)
|
|
79
|
+
return (
|
|
80
|
+
<Text
|
|
81
|
+
style={style}
|
|
82
|
+
key={text}
|
|
83
|
+
tag="h4"
|
|
84
|
+
type={TextTypes.Body3}
|
|
85
|
+
bold
|
|
86
|
+
color={color}
|
|
87
|
+
center={center}
|
|
88
|
+
>
|
|
89
|
+
{text}
|
|
90
|
+
</Text>
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
if (type === ContentTypes.Paragraph)
|
|
94
|
+
return (
|
|
95
|
+
<Text style={style} key={text} center={center}>
|
|
96
|
+
{text}
|
|
97
|
+
</Text>
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (type === ContentTypes.Sentence)
|
|
101
|
+
return (
|
|
102
|
+
<Text style={style} key={text} center={center}>
|
|
103
|
+
{text}
|
|
104
|
+
</Text>
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
if (type === ContentTypes.List)
|
|
108
|
+
return (
|
|
109
|
+
<List key={listItems?.[0]} style={style}>
|
|
110
|
+
{listItems?.map(item => (
|
|
111
|
+
<ListItem key={item} tag="li">
|
|
112
|
+
{item}
|
|
113
|
+
</ListItem>
|
|
114
|
+
))}
|
|
115
|
+
</List>
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
if (type === ContentTypes.OrderedList)
|
|
119
|
+
return (
|
|
120
|
+
<List key={listItems?.[0]} as="ol" $ordered style={style}>
|
|
121
|
+
{listItems?.map(item => (
|
|
122
|
+
<ListItem key={item} tag="li">
|
|
123
|
+
{item}
|
|
124
|
+
</ListItem>
|
|
125
|
+
))}
|
|
126
|
+
</List>
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
if (type === ContentTypes.Emphasize)
|
|
130
|
+
return (
|
|
131
|
+
<Text style={style} key={text} bold color={color} center={center}>
|
|
132
|
+
{text}
|
|
133
|
+
</Text>
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
if (type === ContentTypes.Image)
|
|
137
|
+
return (
|
|
138
|
+
Image && (
|
|
139
|
+
<ImageWrapper
|
|
140
|
+
$width={imageWidth}
|
|
141
|
+
$maxWidth={imageMaxWidth}
|
|
142
|
+
$marginBottom={marginBottom}
|
|
143
|
+
>
|
|
144
|
+
<Image color={color} {...style} />
|
|
145
|
+
</ImageWrapper>
|
|
146
|
+
)
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
)}
|
|
150
|
+
</ContentWrapper>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export default TextPage;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import Text from '../Text/Text';
|
|
4
|
+
|
|
5
|
+
export const ContentWrapper = styled.div<{ $marginBottom?: string }>`
|
|
6
|
+
width: 100%;
|
|
7
|
+
margin: auto;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: ${({ theme }) => theme.spacing.xsmall};
|
|
11
|
+
${({ $marginBottom }) =>
|
|
12
|
+
$marginBottom &&
|
|
13
|
+
css`
|
|
14
|
+
margin-bottom: ${$marginBottom};
|
|
15
|
+
`}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const List = styled.ul<{ $ordered?: boolean }>`
|
|
19
|
+
padding-inline-start: ${({ theme }) => theme.spacing.small};
|
|
20
|
+
margin-block-start: 0;
|
|
21
|
+
margin-block-end: ${({ theme }) => theme.spacing.xxsmall};
|
|
22
|
+
list-style: ${({ $ordered }) => ($ordered ? 'decimal' : 'disc')};
|
|
23
|
+
|
|
24
|
+
> li:not(:last-child) {
|
|
25
|
+
margin-bottom: ${({ theme }) => theme.spacing.xxsmall};
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const ListItem = styled(Text)`
|
|
30
|
+
display: list-item;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export const ImageWrapper = styled.div<{
|
|
34
|
+
$marginBottom?: string;
|
|
35
|
+
$width?: string;
|
|
36
|
+
$maxWidth?: string;
|
|
37
|
+
}>`
|
|
38
|
+
margin: 0 auto;
|
|
39
|
+
width: ${({ $width }) => $width || '100%'};
|
|
40
|
+
max-width: ${({ $maxWidth }) => $maxWidth || '100%'};
|
|
41
|
+
|
|
42
|
+
${({ $marginBottom }) =>
|
|
43
|
+
$marginBottom &&
|
|
44
|
+
css`
|
|
45
|
+
margin-bottom: ${$marginBottom};
|
|
46
|
+
`};
|
|
47
|
+
`;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import TextInput from './TextInput';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: TextInput,
|
|
7
|
+
title: 'Components/TextInput',
|
|
8
|
+
argTypes: {
|
|
9
|
+
defaultValue: { control: 'text' },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Default = args => <TextInput {...args} />;
|
|
14
|
+
|
|
15
|
+
export const TelephoneInput = args => {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<TextInput label="Enter your number" type="tel" {...args} />
|
|
19
|
+
<TextInput
|
|
20
|
+
label="Only German numbers permitted"
|
|
21
|
+
type="tel"
|
|
22
|
+
{...args}
|
|
23
|
+
onlyCountries={['de']}
|
|
24
|
+
/>
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const InputWithOnSubmit = args => (
|
|
30
|
+
<TextInput
|
|
31
|
+
{...args}
|
|
32
|
+
onSubmit={() => {
|
|
33
|
+
return true;
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
Default.args = {
|
|
39
|
+
placeholder: 'Insert your text',
|
|
40
|
+
id: 'text input id',
|
|
41
|
+
label: 'Text Input',
|
|
42
|
+
type: 'text',
|
|
43
|
+
};
|