@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,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { TagAppearance } from '@a-little-world/little-world-design-system-core';
|
|
4
|
+
import Tags, { Tag } from './Tags';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Tags,
|
|
8
|
+
title: 'Components/Tags',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Default = args => {
|
|
12
|
+
return <Tags {...args} />;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const SingleTag = args => {
|
|
16
|
+
return <Tag {...args}>Volunteer</Tag>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const ColorTest = () => {
|
|
20
|
+
return (
|
|
21
|
+
<div style={{ padding: '20px' }}>
|
|
22
|
+
<Tag color="red" appearance={TagAppearance.filled}>Red Filled</Tag>
|
|
23
|
+
<br />
|
|
24
|
+
<Tag color="blue" appearance={TagAppearance.outline}>Blue Outline</Tag>
|
|
25
|
+
<br />
|
|
26
|
+
<Tag color="#00ff00" appearance={TagAppearance.filled}>Green Filled</Tag>
|
|
27
|
+
<br />
|
|
28
|
+
<Tag appearance={TagAppearance.error}>Error Tag</Tag>
|
|
29
|
+
<br />
|
|
30
|
+
<Tag appearance={TagAppearance.success}>Success Tag</Tag>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
Default.args = {
|
|
36
|
+
content: [
|
|
37
|
+
'Coffee',
|
|
38
|
+
'Mocha',
|
|
39
|
+
'Tea',
|
|
40
|
+
'Flat white',
|
|
41
|
+
'Capuccino',
|
|
42
|
+
'Hot Chocolate',
|
|
43
|
+
],
|
|
44
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { FC, PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
TagAppearance,
|
|
5
|
+
TagSizes,
|
|
6
|
+
TextTypes,
|
|
7
|
+
} from '@a-little-world/little-world-design-system-core';
|
|
8
|
+
import { StyledTag, TagsContainer } from './styles';
|
|
9
|
+
|
|
10
|
+
interface TagProps {
|
|
11
|
+
bold?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
appearance?: TagAppearance;
|
|
14
|
+
size?: TagSizes;
|
|
15
|
+
color?: string;
|
|
16
|
+
}
|
|
17
|
+
interface TagsProps extends TagProps {
|
|
18
|
+
content: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Tag: FC<PropsWithChildren<TagProps>> = ({
|
|
22
|
+
bold,
|
|
23
|
+
children,
|
|
24
|
+
className,
|
|
25
|
+
size = TagSizes.large,
|
|
26
|
+
appearance = TagAppearance.outline,
|
|
27
|
+
color,
|
|
28
|
+
}) => {
|
|
29
|
+
return (
|
|
30
|
+
<StyledTag
|
|
31
|
+
className={className}
|
|
32
|
+
bold={bold}
|
|
33
|
+
type={size === TagSizes.small ? TextTypes.Body6 : TextTypes.Body5}
|
|
34
|
+
$appearance={appearance}
|
|
35
|
+
$color={color}
|
|
36
|
+
$size={size}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</StyledTag>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function Tags({
|
|
44
|
+
appearance,
|
|
45
|
+
bold,
|
|
46
|
+
color,
|
|
47
|
+
content,
|
|
48
|
+
className,
|
|
49
|
+
size,
|
|
50
|
+
}: TagsProps) {
|
|
51
|
+
return (
|
|
52
|
+
<TagsContainer className={className}>
|
|
53
|
+
{content.map(tag => (
|
|
54
|
+
<Tag
|
|
55
|
+
key={tag}
|
|
56
|
+
bold={bold}
|
|
57
|
+
size={size}
|
|
58
|
+
color={color}
|
|
59
|
+
appearance={appearance}
|
|
60
|
+
>
|
|
61
|
+
{tag}
|
|
62
|
+
</Tag>
|
|
63
|
+
))}
|
|
64
|
+
</TagsContainer>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default Tags;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import Text from '../Text/Text';
|
|
3
|
+
import {
|
|
4
|
+
TagAppearance,
|
|
5
|
+
TagSizes,
|
|
6
|
+
} from '@a-little-world/little-world-design-system-core';
|
|
7
|
+
|
|
8
|
+
export const StyledTag = styled(Text)<{
|
|
9
|
+
$size: TagSizes;
|
|
10
|
+
$appearance?: TagAppearance;
|
|
11
|
+
$color?: string;
|
|
12
|
+
}>`
|
|
13
|
+
font-family: 'Signika Negative';
|
|
14
|
+
line-height: 1;
|
|
15
|
+
text-align: center;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
gap: ${({ theme }) => theme.spacing.xxxsmall};
|
|
20
|
+
background: ${({ theme }) => theme.color.surface.primary};
|
|
21
|
+
border: 2px solid currentColor;
|
|
22
|
+
border-radius: ${({ theme }) => theme.radius.large};
|
|
23
|
+
min-width: 60px;
|
|
24
|
+
width: fit-content;
|
|
25
|
+
text-wrap: nowrap;
|
|
26
|
+
filter: drop-shadow(0px 1px 3px rgb(0 0 0 / 22%));
|
|
27
|
+
|
|
28
|
+
${({ theme, $size }) => {
|
|
29
|
+
if ($size === TagSizes.small) {
|
|
30
|
+
return css`
|
|
31
|
+
height: 30px;
|
|
32
|
+
padding: ${theme.spacing.xsmall};
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
if ($size === TagSizes.large) {
|
|
36
|
+
return css`
|
|
37
|
+
height: 33px;
|
|
38
|
+
padding: ${theme.spacing.xxsmall} ${theme.spacing.xsmall};
|
|
39
|
+
|
|
40
|
+
@media (min-width: ${theme.breakpoints.small}) {
|
|
41
|
+
padding: ${theme.spacing.xxsmall} ${theme.spacing.small};
|
|
42
|
+
min-width: 80px;
|
|
43
|
+
height: 40px;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
return '';
|
|
48
|
+
}}
|
|
49
|
+
|
|
50
|
+
${({ theme, $appearance, $color }) => {
|
|
51
|
+
if ($appearance === TagAppearance.outline) {
|
|
52
|
+
return css`
|
|
53
|
+
color: ${$color || theme.color.text.primary};
|
|
54
|
+
border: 2px solid ${$color || theme.color.border.selected};
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
if ($appearance === TagAppearance.filled) {
|
|
58
|
+
return css`
|
|
59
|
+
color: ${theme.color.text.reversed};
|
|
60
|
+
background: ${$color || theme.color.text.bold};
|
|
61
|
+
border: 2px solid ${$color || theme.color.border.contrast};
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
if ($appearance === TagAppearance.error) {
|
|
65
|
+
return css`
|
|
66
|
+
color: ${theme.color.text.error};
|
|
67
|
+
background: ${theme.color.surface.error};
|
|
68
|
+
border: 0px;
|
|
69
|
+
filter: none;
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
if ($appearance === TagAppearance.success) {
|
|
73
|
+
return css`
|
|
74
|
+
color: ${theme.color.text.success};
|
|
75
|
+
background: ${theme.color.surface.success};
|
|
76
|
+
border: 0px;
|
|
77
|
+
filter: none;
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
return '';
|
|
81
|
+
}}
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
export const TagsContainer = styled.div`
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-wrap: wrap;
|
|
87
|
+
gap: ${({ theme }) => theme.spacing.xsmall};
|
|
88
|
+
padding-top: ${({ theme }) => theme.spacing.xxxsmall};
|
|
89
|
+
`;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Text from './Text';
|
|
4
|
+
import CallWidget from '../Widget/CallWidget';
|
|
5
|
+
import AttachmentWidget from '../Widget/AttachmentWidget';
|
|
6
|
+
import textParser from '../../utils/parser';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
component: Text,
|
|
10
|
+
title: 'Components/Text',
|
|
11
|
+
argTypes: {
|
|
12
|
+
text: { control: 'text' },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Default = ({ text, ...rest }) => <Text {...rest}>{text}</Text>;
|
|
17
|
+
|
|
18
|
+
Default.args = {
|
|
19
|
+
text: 'Little World for a better society',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Comprehensive visual test for the textParser
|
|
23
|
+
export const ParserShowcase = () => {
|
|
24
|
+
// Configure custom elements using actual Widget components
|
|
25
|
+
const customElements = [
|
|
26
|
+
{
|
|
27
|
+
Component: CallWidget,
|
|
28
|
+
tag: 'CallWidget',
|
|
29
|
+
props: { isPreview: false },
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
Component: AttachmentWidget,
|
|
33
|
+
tag: 'AttachmentWidget',
|
|
34
|
+
props: { isPreview: false },
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const showcaseText = `Welcome to the Little World Text Parser showcase! This story demonstrates all the powerful features of our text parser.
|
|
39
|
+
|
|
40
|
+
🔗 AUTOMATIC LINK DETECTION:
|
|
41
|
+
|
|
42
|
+
Visit our website at https://little-world.com or check out little-world.com for more information.
|
|
43
|
+
|
|
44
|
+
📝 BASIC STYLING TAGS:
|
|
45
|
+
|
|
46
|
+
This text contains <highlight>highlighted content</highlight> and <bold>bold text</bold> for emphasis.
|
|
47
|
+
|
|
48
|
+
🔗 CUSTOM ANCHOR TAGS:
|
|
49
|
+
|
|
50
|
+
Click this <a {"href": "https://little-world.com", "target": "_blank"}>external link</a> or this <a {"href": "/internal-page"}>internal link</a>.
|
|
51
|
+
|
|
52
|
+
🔘 INTERACTIVE BUTTONS:
|
|
53
|
+
|
|
54
|
+
<button {"className": "custom-button"}>Click me!</button>
|
|
55
|
+
<button {"appearance": "secondary"}>Secondary Button</button>
|
|
56
|
+
<button {"data-cal-link": "www.calendly.com/example", "data-cal-config": "{'layout': 'stacked'}"}>Schedule Meeting</button>
|
|
57
|
+
|
|
58
|
+
🧩 CUSTOM WIDGET COMPONENTS (Real Components):
|
|
59
|
+
|
|
60
|
+
<CallWidget {"isMissed": false, "header": "Video Anruf", "description": "Incoming video call", "isPreview": false, "isOutgoing": false}>
|
|
61
|
+
Call content
|
|
62
|
+
</CallWidget>
|
|
63
|
+
|
|
64
|
+
<CallWidget {"isMissed": true, "header": "Anruf Verpasst", "description": "Zurück Rufen", "isPreview": false, "isOutgoing": false}>
|
|
65
|
+
Missed call with description
|
|
66
|
+
</CallWidget>
|
|
67
|
+
|
|
68
|
+
<AttachmentWidget {"attachmentTitle": "Photo", "caption": "Beautiful sunset", "imageSrc": "https://picsum.photos/200/150", "isPreview": false}>
|
|
69
|
+
Attachment content
|
|
70
|
+
</AttachmentWidget>
|
|
71
|
+
|
|
72
|
+
🔄 NESTED CONTENT WITH CUSTOM ELEMENTS:
|
|
73
|
+
|
|
74
|
+
<CallWidget {"isMissed": false, "header": "Mixed Content Call", "isPreview": false}>
|
|
75
|
+
This call widget contains <highlight>highlighted text</highlight> and <a {"href": "https://example.com"}>a link</a>!
|
|
76
|
+
</CallWidget>
|
|
77
|
+
|
|
78
|
+
🎨 MIXED CONTENT:
|
|
79
|
+
|
|
80
|
+
You can combine <highlight>highlighted text</highlight> with <a {"href": "https://example.com"}>clickable links</a> and <bold>bold formatting</bold> in the same paragraph.
|
|
81
|
+
|
|
82
|
+
⚠️ EDGE CASES THAT DON'T BREAK THE PARSER:
|
|
83
|
+
|
|
84
|
+
This text has incomplete tags like <incomplete and <missing> without closing tags.
|
|
85
|
+
It also handles special characters: <30min, <100% success rate, and other HTML-like content.
|
|
86
|
+
|
|
87
|
+
📧 REAL-WORLD EXAMPLE (German text that previously caused hanging):
|
|
88
|
+
|
|
89
|
+
Hallo Andreas, auch die anderen bekommen diese Email typischerweise innerhalb von <30min - in Ausnahmefällen auch mal in ein paar Stunden (Server-Verzögerungen).
|
|
90
|
+
|
|
91
|
+
Bei manchen landen diese Systemnachrichten im Spam-Ordner und wenn der Nutzer dann den Absender nicht als "kein Spam" bzw "zulassen" markiert, passiert das immer wieder.
|
|
92
|
+
|
|
93
|
+
🔄 NESTED AND COMPLEX SCENARIOS:
|
|
94
|
+
|
|
95
|
+
<highlight>This highlighted text contains a <a {"href": "/nested-link"}>nested link</a> inside it</highlight>.
|
|
96
|
+
|
|
97
|
+
Multiple links: <a {"href": "/first"}>First link</a> and <a {"href": "/second"}>Second link</a> in the same paragraph.
|
|
98
|
+
|
|
99
|
+
📊 PERFORMANCE TEST:
|
|
100
|
+
|
|
101
|
+
This paragraph contains many elements: <bold>bold</bold>, <highlight>highlight</highlight>, <a {"href": "/link1"}>link1</a>, <button>button1</button>, <a {"href": "/link2"}>link2</a>, <highlight>more highlighting</highlight>, and <bold>more bold text</bold>.
|
|
102
|
+
|
|
103
|
+
✅ ALL FEATURES WORKING:
|
|
104
|
+
|
|
105
|
+
- ✓ Automatic URL detection
|
|
106
|
+
- ✓ Custom anchor tags with JSON attributes
|
|
107
|
+
- ✓ Interactive buttons with data attributes
|
|
108
|
+
- ✓ Text styling (bold, highlight)
|
|
109
|
+
- ✓ Custom Widget components (CallWidget, AttachmentWidget)
|
|
110
|
+
- ✓ Nested content support
|
|
111
|
+
- ✓ Graceful handling of malformed content
|
|
112
|
+
- ✓ No hanging on complex text
|
|
113
|
+
- ✓ Performance with multiple elements
|
|
114
|
+
- ✓ Non-interactive mode (buttons/links as plain text)
|
|
115
|
+
- ✓ Only-links mode (only anchor tags processed)`;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div style={{ maxWidth: '800px', lineHeight: '1.6', padding: '20px' }}>
|
|
119
|
+
{/* Main showcase with all features */}
|
|
120
|
+
<div style={{ marginBottom: '40px' }}>
|
|
121
|
+
<Text tag="h2" type="Body3" bold style={{ marginBottom: '20px' }}>
|
|
122
|
+
🎯 Complete Parser Showcase
|
|
123
|
+
</Text>
|
|
124
|
+
|
|
125
|
+
<div
|
|
126
|
+
style={{
|
|
127
|
+
padding: '16px',
|
|
128
|
+
backgroundColor: '#e3f2fd',
|
|
129
|
+
borderRadius: '8px',
|
|
130
|
+
border: '1px solid #2196f3',
|
|
131
|
+
marginBottom: '20px',
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<Text style={{ color: '#1565c0', fontSize: '14px' }}>
|
|
135
|
+
💡 <strong>Visual Testing:</strong> This showcase demonstrates all
|
|
136
|
+
parser features including custom widgets, styling tags, buttons, and
|
|
137
|
+
links. Test the onlyLinks, nonInteractive, and parser disabled modes
|
|
138
|
+
below.
|
|
139
|
+
</Text>
|
|
140
|
+
</div>
|
|
141
|
+
<Text>{textParser(showcaseText, { customElements })}</Text>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
{/* onlyLinks demonstration */}
|
|
145
|
+
<div
|
|
146
|
+
style={{
|
|
147
|
+
marginBottom: '40px',
|
|
148
|
+
padding: '24px',
|
|
149
|
+
backgroundColor: '#f5f5f5',
|
|
150
|
+
borderRadius: '12px',
|
|
151
|
+
border: '1px solid #e0e0e0',
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
<Text tag="h3" bold style={{ marginBottom: '16px', color: '#333' }}>
|
|
155
|
+
🔗 Parser with onlyLinks Option
|
|
156
|
+
</Text>
|
|
157
|
+
<div style={{ marginTop: '24px' }}>
|
|
158
|
+
<Text
|
|
159
|
+
style={{ fontSize: '14px', color: '#666', marginBottom: '16px' }}
|
|
160
|
+
>
|
|
161
|
+
💡 <strong>Test:</strong> Notice that only the <a> tag renders
|
|
162
|
+
as a clickable link, while <button> and <highlight> tags
|
|
163
|
+
are displayed as plain text. This demonstrates the onlyLinks
|
|
164
|
+
functionality.
|
|
165
|
+
</Text>
|
|
166
|
+
<Text disableParser>
|
|
167
|
+
{textParser(
|
|
168
|
+
`This text has <highlight>highlighted content</highlight>, <button>a button</button>, and <a {"href": "/test"}>a link</a>.`,
|
|
169
|
+
{ onlyLinks: true },
|
|
170
|
+
)}
|
|
171
|
+
</Text>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
{/* nonInteractive demonstration */}
|
|
176
|
+
<div
|
|
177
|
+
style={{
|
|
178
|
+
marginBottom: '40px',
|
|
179
|
+
padding: '24px',
|
|
180
|
+
backgroundColor: '#fff3cd',
|
|
181
|
+
borderRadius: '12px',
|
|
182
|
+
border: '1px solid #ffeaa7',
|
|
183
|
+
}}
|
|
184
|
+
>
|
|
185
|
+
<Text tag="h3" bold style={{ marginBottom: '16px', color: '#856404' }}>
|
|
186
|
+
🔒 Parser with nonInteractive Option
|
|
187
|
+
</Text>
|
|
188
|
+
<div style={{ marginTop: '24px' }}>
|
|
189
|
+
<Text
|
|
190
|
+
style={{ fontSize: '14px', color: '#856404', marginBottom: '16px' }}
|
|
191
|
+
>
|
|
192
|
+
💡 <strong>Test:</strong> Interactive elements (buttons, links) are
|
|
193
|
+
rendered as plain text, but styling tags (bold, highlight) are
|
|
194
|
+
preserved. URLs are not converted to clickable links.
|
|
195
|
+
</Text>
|
|
196
|
+
<Text disableParser>
|
|
197
|
+
{textParser(
|
|
198
|
+
`This text demonstrates nonInteractive mode:
|
|
199
|
+
|
|
200
|
+
🔗 URLs stay as plain text: https://little-world.com and little-world.com
|
|
201
|
+
|
|
202
|
+
🎨 Styling tags still work: <highlight>highlighted content</highlight> and <bold>bold text</bold>
|
|
203
|
+
|
|
204
|
+
🔘 Buttons become plain text: <button {"appearance": "secondary"}>Click me!</button>
|
|
205
|
+
|
|
206
|
+
🔗 Links become plain text: <a {"href": "https://example.com"}>External link</a>
|
|
207
|
+
|
|
208
|
+
🧩 Custom widgets still render: <CallWidget {"isMissed": false, "header": "Non-Interactive Call", "isPreview": false}>Call content</CallWidget>
|
|
209
|
+
|
|
210
|
+
📝 Mixed content: <highlight>Highlighted text</highlight> with <a {"href": "/test"}>plain link text</a> and <button>plain button text</button>.`,
|
|
211
|
+
{ nonInteractive: true, customElements },
|
|
212
|
+
)}
|
|
213
|
+
</Text>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
{/* Parser disabled demonstration */}
|
|
218
|
+
<div
|
|
219
|
+
style={{
|
|
220
|
+
marginBottom: '40px',
|
|
221
|
+
padding: '24px',
|
|
222
|
+
backgroundColor: '#e8f4f8',
|
|
223
|
+
borderRadius: '12px',
|
|
224
|
+
border: '1px solid #b3d9e6',
|
|
225
|
+
}}
|
|
226
|
+
>
|
|
227
|
+
<Text tag="h3" bold style={{ marginBottom: '16px', color: '#0c5460' }}>
|
|
228
|
+
🚫 Parser Completely Disabled
|
|
229
|
+
</Text>
|
|
230
|
+
<Text
|
|
231
|
+
disableParser
|
|
232
|
+
style={{
|
|
233
|
+
backgroundColor: '#f8f9fa',
|
|
234
|
+
padding: '16px',
|
|
235
|
+
borderRadius: '8px',
|
|
236
|
+
border: '1px solid #dee2e6',
|
|
237
|
+
fontFamily: 'monospace',
|
|
238
|
+
fontSize: '14px',
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
{`Raw text with no parsing: <highlight>not highlighted</highlight>
|
|
242
|
+
Links not converted: https://little-world.com
|
|
243
|
+
Buttons not created: <button>Just text</button>`}
|
|
244
|
+
</Text>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
ParserShowcase.parameters = {
|
|
251
|
+
docs: {
|
|
252
|
+
description: {
|
|
253
|
+
story: `This story showcases all the features of the Little World Text Parser:
|
|
254
|
+
|
|
255
|
+
**Automatic Features:**
|
|
256
|
+
- Converts URLs to clickable links automatically
|
|
257
|
+
- Handles both HTTP/HTTPS and domain-only formats
|
|
258
|
+
|
|
259
|
+
**Custom Tags:**
|
|
260
|
+
- \`<a {"href": "url"}>\` - Creates clickable links with JSON attributes
|
|
261
|
+
- \`<button {"appearance": "secondary"}\` - Creates interactive buttons with styling
|
|
262
|
+
- \`<highlight>\` - Applies highlight styling
|
|
263
|
+
- \`<bold>\` - Applies bold formatting
|
|
264
|
+
|
|
265
|
+
**Parser Options:**
|
|
266
|
+
- \`onlyLinks: true\` - Only processes anchor tags, treats other tags as plain text
|
|
267
|
+
- \`nonInteractive: true\` - Renders interactive elements (buttons, links) as plain text while preserving styling
|
|
268
|
+
|
|
269
|
+
**Custom Widget Components:**
|
|
270
|
+
- \`<CallWidget>\` - Renders call widgets with missed/incoming call states
|
|
271
|
+
- \`<AttachmentWidget>\` - Renders file/photo attachments with previews
|
|
272
|
+
- Full JSON attribute support and nested content handling
|
|
273
|
+
|
|
274
|
+
**Robust Parsing:**
|
|
275
|
+
- Gracefully handles malformed HTML-like content
|
|
276
|
+
- Won't hang on complex or problematic text
|
|
277
|
+
- Safely parses JSON attributes with fallback
|
|
278
|
+
- Ignores incomplete or invalid tags
|
|
279
|
+
|
|
280
|
+
**Performance:**
|
|
281
|
+
- Uses zero regex for maximum reliability
|
|
282
|
+
- Fast string-based parsing
|
|
283
|
+
- Handles large text efficiently
|
|
284
|
+
|
|
285
|
+
The parser is used automatically in all Text components unless \`disableParser={true}\` is set.`,
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TextBaseProps,
|
|
3
|
+
TextTypes,
|
|
4
|
+
} from '@a-little-world/little-world-design-system-core';
|
|
5
|
+
import React, { CSSProperties } from 'react';
|
|
6
|
+
|
|
7
|
+
import textParser from '../../utils/parser';
|
|
8
|
+
import { StyledElement } from './styles';
|
|
9
|
+
|
|
10
|
+
type TextProps = TextBaseProps & {
|
|
11
|
+
className?: string;
|
|
12
|
+
disableParser?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
tag?:
|
|
16
|
+
| 'p'
|
|
17
|
+
| 'h1'
|
|
18
|
+
| 'h2'
|
|
19
|
+
| 'h3'
|
|
20
|
+
| 'h4'
|
|
21
|
+
| 'h5'
|
|
22
|
+
| 'h6'
|
|
23
|
+
| 'li'
|
|
24
|
+
| 'label'
|
|
25
|
+
| 'span'
|
|
26
|
+
| 'strong'
|
|
27
|
+
| 'div';
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const Text = ({
|
|
31
|
+
bold = false,
|
|
32
|
+
center = false,
|
|
33
|
+
children,
|
|
34
|
+
color,
|
|
35
|
+
className,
|
|
36
|
+
disableParser = false,
|
|
37
|
+
id,
|
|
38
|
+
style,
|
|
39
|
+
tag = 'p',
|
|
40
|
+
type = TextTypes.Body5,
|
|
41
|
+
}: TextProps) => (
|
|
42
|
+
<StyledElement
|
|
43
|
+
className={className}
|
|
44
|
+
style={style}
|
|
45
|
+
id={id}
|
|
46
|
+
$bold={bold}
|
|
47
|
+
$center={center}
|
|
48
|
+
$color={color}
|
|
49
|
+
$type={type}
|
|
50
|
+
as={tag}
|
|
51
|
+
>
|
|
52
|
+
{typeof children === 'string' && !disableParser
|
|
53
|
+
? (textParser(children) as React.ReactNode)
|
|
54
|
+
: (children as React.ReactNode)}
|
|
55
|
+
</StyledElement>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export default Text;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import {
|
|
3
|
+
TextTypes,
|
|
4
|
+
getTextStyle,
|
|
5
|
+
} from '@a-little-world/little-world-design-system-core';
|
|
6
|
+
|
|
7
|
+
const BODY_SHARED_STYLES = css`
|
|
8
|
+
font-family: 'Signika Negative', sans-serif;
|
|
9
|
+
-webkit-font-smoothing: antialiased;
|
|
10
|
+
-moz-osx-font-smoothing: grayscale;
|
|
11
|
+
margin: 0;
|
|
12
|
+
line-height: 1.5;
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const HEADING_SHARED_STYLES = css<{ $color?: string }>`
|
|
16
|
+
font-family: 'Work Sans', sans-serif;
|
|
17
|
+
font-weight: bold;
|
|
18
|
+
-webkit-font-smoothing: antialiased;
|
|
19
|
+
-moz-osx-font-smoothing: grayscale;
|
|
20
|
+
line-height: 1.1;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const BODY_5_CSS = css`
|
|
24
|
+
${BODY_SHARED_STYLES}
|
|
25
|
+
font-size: 1rem;
|
|
26
|
+
|
|
27
|
+
@media (min-width: ${({ theme }) => theme.breakpoints.small}) {
|
|
28
|
+
font-size: 1rem;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
const styles = {
|
|
33
|
+
[TextTypes.Heading1]: getTextStyle(TextTypes.Heading1),
|
|
34
|
+
[TextTypes.Heading2]: getTextStyle(TextTypes.Heading2),
|
|
35
|
+
[TextTypes.Heading3]: getTextStyle(TextTypes.Heading3),
|
|
36
|
+
[TextTypes.Heading4]: getTextStyle(TextTypes.Heading4),
|
|
37
|
+
[TextTypes.Heading5]: getTextStyle(TextTypes.Heading5),
|
|
38
|
+
[TextTypes.Heading6]: getTextStyle(TextTypes.Heading6),
|
|
39
|
+
[TextTypes.Body1]: getTextStyle(TextTypes.Body1),
|
|
40
|
+
[TextTypes.Body2]: getTextStyle(TextTypes.Body2),
|
|
41
|
+
[TextTypes.Body3]: getTextStyle(TextTypes.Body3),
|
|
42
|
+
[TextTypes.Body4]: getTextStyle(TextTypes.Body4),
|
|
43
|
+
[TextTypes.Body5]: getTextStyle(TextTypes.Body5),
|
|
44
|
+
[TextTypes.Body6]: getTextStyle(TextTypes.Body6),
|
|
45
|
+
[TextTypes.Body7]: getTextStyle(TextTypes.Body7),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const StyledElement = styled.div<{
|
|
49
|
+
$bold: boolean;
|
|
50
|
+
$center: boolean;
|
|
51
|
+
$color?: string;
|
|
52
|
+
$type: keyof typeof TextTypes;
|
|
53
|
+
}>`
|
|
54
|
+
${({ $bold }) => $bold && 'font-weight: bold;'}
|
|
55
|
+
${({ $center }) => $center && 'text-align: center;'}
|
|
56
|
+
${({ $color }) => $color && `color: ${$color};`}
|
|
57
|
+
white-space: pre-line;
|
|
58
|
+
|
|
59
|
+
${({ $type, theme }) => {
|
|
60
|
+
const style = styles[$type];
|
|
61
|
+
return css`
|
|
62
|
+
${style.styleType === 'body' ? BODY_SHARED_STYLES : HEADING_SHARED_STYLES}
|
|
63
|
+
font-size: ${style.fontSize}rem;
|
|
64
|
+
${style.fontWeight ? `font-weight: ${style.fontWeight};` : ''}
|
|
65
|
+
${style.lineHeight ? `line-height: ${style.lineHeight};` : ''}
|
|
66
|
+
|
|
67
|
+
${style.desktopFontSize &&
|
|
68
|
+
css`
|
|
69
|
+
@media (min-width: ${theme.breakpoints.small}) {
|
|
70
|
+
font-size: ${style.desktopFontSize}rem;
|
|
71
|
+
}
|
|
72
|
+
`}
|
|
73
|
+
`;
|
|
74
|
+
}}
|
|
75
|
+
`;
|