pixel-react 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.prettierrc.js +13 -0
- package/.storybook/main.ts +26 -0
- package/.storybook/preview.ts +26 -0
- package/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +1 -0
- package/README.md +25 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.scss +0 -0
- package/lib/StyleGuide/ColorPalette/ColorPalette.d.ts +3 -0
- package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
- package/lib/StyleGuide/ColorPalette/colorPaletteList.d.ts +3 -0
- package/lib/StyleGuide/ColorPalette/index.d.ts +1 -0
- package/lib/StyleGuide/ColorPalette/types.d.ts +15 -0
- package/lib/StyleGuide/Typography/Typography.d.ts +3 -0
- package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
- package/lib/StyleGuide/Typography/TypographyList.d.ts +5 -0
- package/lib/StyleGuide/Typography/types.d.ts +8 -0
- package/lib/assets/utils/functionUtils.d.ts +1 -0
- package/lib/components/Accordion/Accordion.d.ts +8 -0
- package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
- package/lib/components/Accordion/index.d.ts +1 -0
- package/lib/components/Accordion/types.d.ts +27 -0
- package/lib/components/AddResourceButton/AddButton.d.ts +4 -0
- package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
- package/lib/components/AddResourceButton/ArrowsButton/ArrowsButton.d.ts +6 -0
- package/lib/components/AddResourceButton/index.d.ts +1 -0
- package/lib/components/AddResourceButton/type.d.ts +65 -0
- package/lib/components/Button/Button.d.ts +5 -0
- package/lib/components/Button/Button.stories.d.ts +12 -0
- package/lib/components/Button/index.d.ts +1 -0
- package/lib/components/Button/types.d.ts +61 -0
- package/lib/components/Charts/DonutChart/DonutChart.d.ts +5 -0
- package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
- package/lib/components/Charts/DonutChart/index.d.ts +1 -0
- package/lib/components/Charts/DonutChart/type.d.ts +13 -0
- package/lib/components/Charts/RadialChart/RadialChart.d.ts +5 -0
- package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
- package/lib/components/Charts/RadialChart/index.d.ts +1 -0
- package/lib/components/Charts/RadialChart/types.d.ts +25 -0
- package/lib/components/Checkbox/Checkbox.d.ts +6 -0
- package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
- package/lib/components/Checkbox/index.d.ts +1 -0
- package/lib/components/Checkbox/types.d.ts +30 -0
- package/lib/components/Chip/Chip.d.ts +4 -0
- package/lib/components/Chip/Chip.stories.d.ts +14 -0
- package/lib/components/Chip/index.d.ts +1 -0
- package/lib/components/Chip/types.d.ts +18 -0
- package/lib/components/Drawer/Drawer.d.ts +4 -0
- package/lib/components/Drawer/Drawer.stories.d.ts +7 -0
- package/lib/components/Drawer/Types.d.ts +85 -0
- package/lib/components/Drawer/index.d.ts +1 -0
- package/lib/components/ExpandableMenu/ExpandableMenu.d.ts +5 -0
- package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
- package/lib/components/ExpandableMenu/index.d.ts +1 -0
- package/lib/components/ExpandableMenu/types.d.ts +34 -0
- package/lib/components/FileDropzone/Dropzone.d.ts +5 -0
- package/lib/components/FileDropzone/FileDropzone.d.ts +4 -0
- package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
- package/lib/components/FileDropzone/FilePreview.d.ts +4 -0
- package/lib/components/FileDropzone/index.d.ts +1 -0
- package/lib/components/FileDropzone/types.d.ts +103 -0
- package/lib/components/Form/Form.d.ts +16 -0
- package/lib/components/Form/Form.stories.d.ts +6 -0
- package/lib/components/Form/index.d.ts +1 -0
- package/lib/components/Form/types.d.ts +1 -0
- package/lib/components/GridLayout/GridLayout.d.ts +6 -0
- package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
- package/lib/components/GridLayout/index.d.ts +2 -0
- package/lib/components/GridLayout/types.d.ts +57 -0
- package/lib/components/HighlightText/HighlightText.d.ts +4 -0
- package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
- package/lib/components/HighlightText/index.d.ts +1 -0
- package/lib/components/HighlightText/types.d.ts +4 -0
- package/lib/components/Icon/Icon.d.ts +4 -0
- package/lib/components/Icon/Icon.stories.d.ts +7 -0
- package/lib/components/Icon/iconList.d.ts +2 -0
- package/lib/components/Icon/index.d.ts +1 -0
- package/lib/components/Icon/types.d.ts +10 -0
- package/lib/components/Input/Input.d.ts +4 -0
- package/lib/components/Input/Input.stories.d.ts +9 -0
- package/lib/components/Input/index.d.ts +1 -0
- package/lib/components/Input/types.d.ts +74 -0
- package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +4 -0
- package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +8 -0
- package/lib/components/InputWithDropdown/index.d.ts +1 -0
- package/lib/components/InputWithDropdown/types.d.ts +88 -0
- package/lib/components/LazyLoad/LazyLoad.d.ts +2 -0
- package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
- package/lib/components/LazyLoad/LazyLoading.d.ts +2 -0
- package/lib/components/LazyLoad/index.d.ts +1 -0
- package/lib/components/MenuOption/MenuOption.d.ts +4 -0
- package/lib/components/MenuOption/MenuOption.stories.d.ts +15 -0
- package/lib/components/MenuOption/index.d.ts +1 -0
- package/lib/components/MenuOption/types.d.ts +134 -0
- package/lib/components/MiniModal/MiniModal.d.ts +4 -0
- package/lib/components/MiniModal/MiniModal.stories.d.ts +9 -0
- package/lib/components/MiniModal/index.d.ts +1 -0
- package/lib/components/MiniModal/types.d.ts +89 -0
- package/lib/components/MultiSelect/Dropdown.d.ts +4 -0
- package/lib/components/MultiSelect/MultiSelect.d.ts +4 -0
- package/lib/components/MultiSelect/MultiSelect.stories.d.ts +9 -0
- package/lib/components/MultiSelect/MultiSelectTypes.d.ts +18 -0
- package/lib/components/MultiSelect/dropdownTypes.d.ts +15 -0
- package/lib/components/MultiSelect/index.d.ts +1 -0
- package/lib/components/RadioButton/RadioButton.d.ts +4 -0
- package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
- package/lib/components/RadioButton/index.d.ts +1 -0
- package/lib/components/RadioButton/radioButtonTypes.d.ts +35 -0
- package/lib/components/RadioGroup/RadioGroup.d.ts +4 -0
- package/lib/components/RadioGroup/RadioGroup.stories.d.ts +8 -0
- package/lib/components/RadioGroup/index.d.ts +1 -0
- package/lib/components/RadioGroup/radioGroupTypes.d.ts +47 -0
- package/lib/components/Search/Search.d.ts +4 -0
- package/lib/components/Search/Search.stories.d.ts +6 -0
- package/lib/components/Search/index.d.ts +1 -0
- package/lib/components/Search/types.d.ts +15 -0
- package/lib/components/Select/Select.d.ts +4 -0
- package/lib/components/Select/Select.stories.d.ts +13 -0
- package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
- package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +15 -0
- package/lib/components/Select/index.d.ts +1 -0
- package/lib/components/Select/types.d.ts +68 -0
- package/lib/components/Table/Table.d.ts +4 -0
- package/lib/components/Table/Table.stories.d.ts +11 -0
- package/lib/components/Table/Types.d.ts +98 -0
- package/lib/components/Table/index.d.ts +1 -0
- package/lib/components/TableTree/TableTree.d.ts +21 -0
- package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
- package/lib/components/TableTree/data.d.ts +313 -0
- package/lib/components/TableTree/index.d.ts +1 -0
- package/lib/components/Tabs/Tabs.d.ts +5 -0
- package/lib/components/Tabs/Tabs.stories.d.ts +8 -0
- package/lib/components/Tabs/index.d.ts +1 -0
- package/lib/components/Tabs/types.d.ts +40 -0
- package/lib/components/TextArea/Textarea.d.ts +4 -0
- package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
- package/lib/components/TextArea/Types.d.ts +78 -0
- package/lib/components/TextArea/index.d.ts +1 -0
- package/lib/components/ThemeProvider/ThemeProvider.d.ts +7 -0
- package/lib/components/ThemeProvider/index.d.ts +1 -0
- package/lib/components/ThemeProvider/types.d.ts +11 -0
- package/lib/components/Toast/Toast.d.ts +5 -0
- package/lib/components/Toast/Toast.stories.d.ts +6 -0
- package/lib/components/Toast/index.d.ts +1 -0
- package/lib/components/Toast/types.d.ts +20 -0
- package/lib/components/Toggle/Toggle.d.ts +5 -0
- package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
- package/lib/components/Toggle/index.d.ts +1 -0
- package/lib/components/Toggle/types.d.ts +50 -0
- package/lib/components/Tooltip/Tooltip.d.ts +5 -0
- package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
- package/lib/components/Tooltip/index.d.ts +1 -0
- package/lib/components/Tooltip/types.d.ts +37 -0
- package/lib/components/Typography/Typography.d.ts +5 -0
- package/lib/components/Typography/Typography.stories.d.ts +10 -0
- package/lib/components/Typography/index.d.ts +1 -0
- package/lib/components/Typography/types.d.ts +47 -0
- package/lib/hooks/keyboardevents/useEscKeyEvent.d.ts +2 -0
- package/lib/hooks/useClickOutside.d.ts +2 -0
- package/lib/hooks/useFileDropzone.d.ts +3 -0
- package/lib/hooks/usePortalPosition.d.ts +9 -0
- package/lib/hooks/useTheme.d.ts +3 -0
- package/lib/index.css +404 -0
- package/lib/index.d.ts +1286 -0
- package/lib/index.esm.css +404 -0
- package/lib/index.esm.js +9317 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +9376 -0
- package/lib/index.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/utils/TableCell/TableCell.d.ts +1 -0
- package/lib/utils/checkEmpty/checkEmpty.d.ts +3 -0
- package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
- package/lib/utils/ffID/ffID.stories.d.ts +6 -0
- package/lib/utils/ffID/ffid.d.ts +2 -0
- package/lib/utils/getExtension/getExtension.d.ts +4 -0
- package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
- package/lib/utils/truncateText/truncateText.d.ts +1 -0
- package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
- package/package.json +62 -0
- package/rollup.config.mjs +57 -0
- package/src/StyleGuide/ColorPalette/ColorPalette.scss +58 -0
- package/src/StyleGuide/ColorPalette/ColorPalette.stories.tsx +16 -0
- package/src/StyleGuide/ColorPalette/ColorPalette.tsx +61 -0
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +97 -0
- package/src/StyleGuide/ColorPalette/index.ts +1 -0
- package/src/StyleGuide/ColorPalette/types.ts +17 -0
- package/src/StyleGuide/Typography/Typography.scss +100 -0
- package/src/StyleGuide/Typography/Typography.stories.tsx +16 -0
- package/src/StyleGuide/Typography/Typography.tsx +60 -0
- package/src/StyleGuide/Typography/TypographyList.ts +3 -0
- package/src/StyleGuide/Typography/types.ts +9 -0
- package/src/assets/Themes/BaseTheme.scss +130 -0
- package/src/assets/Themes/DarkTheme.scss +131 -0
- package/src/assets/Themes/Theme.scss +200 -0
- package/src/assets/icons/Arrow.svg +5 -0
- package/src/assets/icons/accordion_header_icon.svg +10 -0
- package/src/assets/icons/arrow_down.svg +3 -0
- package/src/assets/icons/arrow_right.svg +5 -0
- package/src/assets/icons/arrow_up.svg +3 -0
- package/src/assets/icons/arrows_down_icon.svg +3 -0
- package/src/assets/icons/arrows_right_icon.svg +10 -0
- package/src/assets/icons/arrows_top_icon.svg +3 -0
- package/src/assets/icons/check_mark.svg +3 -0
- package/src/assets/icons/close_pill.svg +3 -0
- package/src/assets/icons/delete.svg +17 -0
- package/src/assets/icons/dropzone_icon.svg +18 -0
- package/src/assets/icons/error.svg +17 -0
- package/src/assets/icons/file.svg +12 -0
- package/src/assets/icons/info.svg +17 -0
- package/src/assets/icons/logo.svg +18 -0
- package/src/assets/icons/manage_apps.svg +3 -0
- package/src/assets/icons/moon_stars.svg +10 -0
- package/src/assets/icons/more.svg +11 -0
- package/src/assets/icons/plus_icon.svg +11 -0
- package/src/assets/icons/remove.svg +12 -0
- package/src/assets/icons/replace.svg +12 -0
- package/src/assets/icons/search.svg +3 -0
- package/src/assets/icons/success.svg +13 -0
- package/src/assets/icons/sun_icon.svg +10 -0
- package/src/assets/icons/tick_icon.svg +5 -0
- package/src/assets/icons/toast_close.svg +3 -0
- package/src/assets/icons/warning.svg +17 -0
- package/src/assets/icons/wrong_mark.svg +3 -0
- package/src/assets/styles/_colors.scss +145 -0
- package/src/assets/styles/_fonts.scss +68 -0
- package/src/assets/styles/_mixins.scss +20 -0
- package/src/assets/utils/functionUtils.ts +5 -0
- package/src/components/Accordion/Accordion.scss +45 -0
- package/src/components/Accordion/Accordion.stories.tsx +31 -0
- package/src/components/Accordion/Accordion.tsx +62 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/Accordion/types.ts +28 -0
- package/src/components/AddResourceButton/AddButton.scss +36 -0
- package/src/components/AddResourceButton/AddButton.stories.tsx +126 -0
- package/src/components/AddResourceButton/AddButton.tsx +121 -0
- package/src/components/AddResourceButton/ArrowsButton/ArrowsButton.scss +160 -0
- package/src/components/AddResourceButton/ArrowsButton/ArrowsButton.tsx +38 -0
- package/src/components/AddResourceButton/index.ts +1 -0
- package/src/components/AddResourceButton/type.ts +60 -0
- package/src/components/Button/Button.scss +148 -0
- package/src/components/Button/Button.stories.tsx +74 -0
- package/src/components/Button/Button.tsx +66 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Button/types.ts +65 -0
- package/src/components/Charts/DonutChart/DonutChart.scss +76 -0
- package/src/components/Charts/DonutChart/DonutChart.stories.tsx +30 -0
- package/src/components/Charts/DonutChart/DonutChart.tsx +241 -0
- package/src/components/Charts/DonutChart/index.ts +1 -0
- package/src/components/Charts/DonutChart/type.ts +23 -0
- package/src/components/Charts/RadialChart/RadialChart.scss +12 -0
- package/src/components/Charts/RadialChart/RadialChart.stories.tsx +36 -0
- package/src/components/Charts/RadialChart/RadialChart.tsx +174 -0
- package/src/components/Charts/RadialChart/index.ts +1 -0
- package/src/components/Charts/RadialChart/types.ts +32 -0
- package/src/components/Checkbox/Checkbox.scss +89 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +47 -0
- package/src/components/Checkbox/Checkbox.tsx +61 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Checkbox/types.ts +30 -0
- package/src/components/Chip/Chip.scss +70 -0
- package/src/components/Chip/Chip.stories.tsx +88 -0
- package/src/components/Chip/Chip.tsx +35 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/Chip/types.ts +19 -0
- package/src/components/Drawer/Drawer.scss +121 -0
- package/src/components/Drawer/Drawer.stories.tsx +88 -0
- package/src/components/Drawer/Drawer.tsx +179 -0
- package/src/components/Drawer/Types.ts +88 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/ExpandableMenu/ExpandableMenu.scss +110 -0
- package/src/components/ExpandableMenu/ExpandableMenu.stories.tsx +67 -0
- package/src/components/ExpandableMenu/ExpandableMenu.tsx +101 -0
- package/src/components/ExpandableMenu/index.ts +1 -0
- package/src/components/ExpandableMenu/types.ts +34 -0
- package/src/components/FileDropzone/Dropzone.tsx +55 -0
- package/src/components/FileDropzone/FileDropzone.scss +134 -0
- package/src/components/FileDropzone/FileDropzone.stories.tsx +83 -0
- package/src/components/FileDropzone/FileDropzone.tsx +98 -0
- package/src/components/FileDropzone/FilePreview.tsx +75 -0
- package/src/components/FileDropzone/index.ts +1 -0
- package/src/components/FileDropzone/types.ts +113 -0
- package/src/components/Form/Form.scss +98 -0
- package/src/components/Form/Form.stories.tsx +177 -0
- package/src/components/Form/Form.tsx +57 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/Form/types.ts +1 -0
- package/src/components/Form/validation.json +29 -0
- package/src/components/GridLayout/GridLayout.scss +71 -0
- package/src/components/GridLayout/GridLayout.stories.tsx +128 -0
- package/src/components/GridLayout/GridLayout.tsx +30 -0
- package/src/components/GridLayout/GridLayoutStory.scss +25 -0
- package/src/components/GridLayout/index.ts +1 -0
- package/src/components/GridLayout/types.ts +64 -0
- package/src/components/HighlightText/HighlightText.scss +3 -0
- package/src/components/HighlightText/HighlightText.stories.tsx +22 -0
- package/src/components/HighlightText/HighlightText.tsx +33 -0
- package/src/components/HighlightText/index.ts +1 -0
- package/src/components/HighlightText/types.ts +4 -0
- package/src/components/Icon/Icon.stories.tsx +37 -0
- package/src/components/Icon/Icon.tsx +43 -0
- package/src/components/Icon/Icons.scss +34 -0
- package/src/components/Icon/iconList.ts +62 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/components/Icon/types.ts +10 -0
- package/src/components/Input/Input.scss +150 -0
- package/src/components/Input/Input.stories.tsx +96 -0
- package/src/components/Input/Input.tsx +93 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Input/types.ts +77 -0
- package/src/components/InputWithDropdown/InputWithDropdown.scss +185 -0
- package/src/components/InputWithDropdown/InputWithDropdown.stories.tsx +114 -0
- package/src/components/InputWithDropdown/InputWithDropdown.tsx +85 -0
- package/src/components/InputWithDropdown/index.ts +1 -0
- package/src/components/InputWithDropdown/types.ts +110 -0
- package/src/components/LazyLoad/LazyLoad.d.ts +3 -0
- package/src/components/LazyLoad/LazyLoad.stories.tsx +33 -0
- package/src/components/LazyLoad/LazyLoad.ts +2 -0
- package/src/components/LazyLoad/LazyLoading.tsx +19 -0
- package/src/components/LazyLoad/index.ts +1 -0
- package/src/components/MenuOption/MenuOption.scss +69 -0
- package/src/components/MenuOption/MenuOption.stories.tsx +259 -0
- package/src/components/MenuOption/MenuOption.tsx +126 -0
- package/src/components/MenuOption/index.ts +1 -0
- package/src/components/MenuOption/types.ts +161 -0
- package/src/components/MiniModal/MiniModal.scss +139 -0
- package/src/components/MiniModal/MiniModal.stories.tsx +475 -0
- package/src/components/MiniModal/MiniModal.tsx +218 -0
- package/src/components/MiniModal/index.ts +1 -0
- package/src/components/MiniModal/types.ts +88 -0
- package/src/components/MultiSelect/Dropdown.scss +66 -0
- package/src/components/MultiSelect/Dropdown.tsx +77 -0
- package/src/components/MultiSelect/MultiSelect.scss +190 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +85 -0
- package/src/components/MultiSelect/MultiSelect.tsx +260 -0
- package/src/components/MultiSelect/MultiSelectTypes.ts +19 -0
- package/src/components/MultiSelect/dropdownTypes.ts +15 -0
- package/src/components/MultiSelect/index.ts +1 -0
- package/src/components/RadioButton/RadioButton.scss +99 -0
- package/src/components/RadioButton/RadioButton.stories.tsx +43 -0
- package/src/components/RadioButton/RadioButton.tsx +32 -0
- package/src/components/RadioButton/index.ts +1 -0
- package/src/components/RadioButton/radioButtonTypes.tsx +40 -0
- package/src/components/RadioGroup/RadioGroup.scss +5 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +81 -0
- package/src/components/RadioGroup/RadioGroup.tsx +30 -0
- package/src/components/RadioGroup/index.ts +1 -0
- package/src/components/RadioGroup/radioGroupTypes.tsx +54 -0
- package/src/components/Search/Search.scss +87 -0
- package/src/components/Search/Search.stories.tsx +26 -0
- package/src/components/Search/Search.tsx +103 -0
- package/src/components/Search/index.ts +1 -0
- package/src/components/Search/types.ts +15 -0
- package/src/components/Select/Select.scss +247 -0
- package/src/components/Select/Select.stories.tsx +156 -0
- package/src/components/Select/Select.tsx +368 -0
- package/src/components/Select/components/Dropdown/Dropdown.scss +70 -0
- package/src/components/Select/components/Dropdown/Dropdown.tsx +89 -0
- package/src/components/Select/components/Dropdown/dropdownTypes.ts +19 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Select/types.ts +122 -0
- package/src/components/Table/Table.scss +101 -0
- package/src/components/Table/Table.stories.tsx +345 -0
- package/src/components/Table/Table.tsx +128 -0
- package/src/components/Table/Types.ts +100 -0
- package/src/components/Table/index.ts +1 -0
- package/src/components/TableTree/TableTree.scss +142 -0
- package/src/components/TableTree/TableTree.stories.tsx +121 -0
- package/src/components/TableTree/TableTree.tsx +216 -0
- package/src/components/TableTree/TableTreeStories.scss +22 -0
- package/src/components/TableTree/data.ts +573 -0
- package/src/components/TableTree/index.ts +1 -0
- package/src/components/Tabs/Tabs.scss +76 -0
- package/src/components/Tabs/Tabs.stories.tsx +104 -0
- package/src/components/Tabs/Tabs.tsx +64 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tabs/types.ts +38 -0
- package/src/components/TextArea/Textarea.scss +145 -0
- package/src/components/TextArea/Textarea.stories.tsx +92 -0
- package/src/components/TextArea/Textarea.tsx +84 -0
- package/src/components/TextArea/Types.ts +82 -0
- package/src/components/TextArea/index.tsx +1 -0
- package/src/components/ThemeProvider/ThemeProvider.tsx +24 -0
- package/src/components/ThemeProvider/index.ts +1 -0
- package/src/components/ThemeProvider/types.ts +14 -0
- package/src/components/Toast/Toast.scss +121 -0
- package/src/components/Toast/Toast.stories.tsx +180 -0
- package/src/components/Toast/Toast.tsx +116 -0
- package/src/components/Toast/index.ts +1 -0
- package/src/components/Toast/types.ts +27 -0
- package/src/components/Toggle/Toggle.scss +132 -0
- package/src/components/Toggle/Toggle.stories.tsx +132 -0
- package/src/components/Toggle/Toggle.tsx +96 -0
- package/src/components/Toggle/index.ts +1 -0
- package/src/components/Toggle/types.ts +43 -0
- package/src/components/Tooltip/Tooltip.scss +27 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +97 -0
- package/src/components/Tooltip/Tooltip.tsx +194 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Tooltip/types.ts +60 -0
- package/src/components/Typography/Typography.scss +49 -0
- package/src/components/Typography/Typography.stories.tsx +57 -0
- package/src/components/Typography/Typography.tsx +39 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/Typography/types.ts +56 -0
- package/src/fonts/Montserrat/Montserrat-Medium.ttf +0 -0
- package/src/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/src/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Black.ttf +0 -0
- package/src/fonts/Poppins/Poppins-BlackItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Bold.ttf +0 -0
- package/src/fonts/Poppins/Poppins-BoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraBoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraLight.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ExtraLightItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Italic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Light.ttf +0 -0
- package/src/fonts/Poppins/Poppins-LightItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Medium.ttf +0 -0
- package/src/fonts/Poppins/Poppins-MediumItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Regular.ttf +0 -0
- package/src/fonts/Poppins/Poppins-SemiBold.ttf +0 -0
- package/src/fonts/Poppins/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/fonts/Poppins/Poppins-Thin.ttf +0 -0
- package/src/fonts/Poppins/Poppins-ThinItalic.ttf +0 -0
- package/src/hooks/keyboardevents/useEscKeyEvent.tsx +31 -0
- package/src/hooks/useClickOutside.tsx +30 -0
- package/src/hooks/useFileDropzone.tsx +273 -0
- package/src/hooks/usePortalPosition.tsx +53 -0
- package/src/hooks/useTheme.tsx +13 -0
- package/src/index.ts +91 -0
- package/src/utils/TableCell/TableCell.ts +16 -0
- package/src/utils/checkEmpty/checkEmpty.stories.tsx +34 -0
- package/src/utils/checkEmpty/checkEmpty.ts +10 -0
- package/src/utils/ffID/ffID.stories.tsx +35 -0
- package/src/utils/ffID/ffid.ts +9 -0
- package/src/utils/getExtension/getExtension.stories.tsx +23 -0
- package/src/utils/getExtension/getExtension.ts +28 -0
- package/src/utils/truncateText/truncateText.stories.tsx +37 -0
- package/src/utils/truncateText/truncateText.ts +4 -0
- package/tsconfig.json +55 -0
- package/ui-library.zip +0 -0
- package/vite.config.js +30 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import classNames from 'classnames';
|
3
|
+
import { ToggleProps } from './types';
|
4
|
+
import './Toggle.scss';
|
5
|
+
import Icon from '../Icon';
|
6
|
+
|
7
|
+
const Toggle: React.FC<ToggleProps> = ({
|
8
|
+
onChange,
|
9
|
+
variant = 'primary',
|
10
|
+
disabled,
|
11
|
+
checked = false,
|
12
|
+
id = 'toggle',
|
13
|
+
size = 'large',
|
14
|
+
icon,
|
15
|
+
}) => {
|
16
|
+
const handleChange = (e: any) => {
|
17
|
+
if (onChange) {
|
18
|
+
onChange(e);
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
const baseIconSizes = {
|
23
|
+
large: 10,
|
24
|
+
medium: 8,
|
25
|
+
small: 6,
|
26
|
+
};
|
27
|
+
|
28
|
+
const defaultIconSize = baseIconSizes[size as 'small' | 'medium' | 'large'];
|
29
|
+
|
30
|
+
const defaultIcons = {
|
31
|
+
checked: {
|
32
|
+
name: 'check_mark',
|
33
|
+
width: defaultIconSize,
|
34
|
+
height: defaultIconSize,
|
35
|
+
},
|
36
|
+
unchecked: {
|
37
|
+
name: 'wrong_mark',
|
38
|
+
width: defaultIconSize,
|
39
|
+
height: defaultIconSize,
|
40
|
+
},
|
41
|
+
};
|
42
|
+
|
43
|
+
const iconNames = {
|
44
|
+
checked: { ...defaultIcons.checked, ...icon?.checked },
|
45
|
+
unchecked: { ...defaultIcons.unchecked, ...icon?.unchecked },
|
46
|
+
};
|
47
|
+
|
48
|
+
return (
|
49
|
+
<div className="ff--switch-container">
|
50
|
+
<input
|
51
|
+
className="ff--switch-checkbox"
|
52
|
+
id={`ff-toggle-${id}`}
|
53
|
+
type="checkbox"
|
54
|
+
disabled={!!disabled}
|
55
|
+
onChange={handleChange}
|
56
|
+
checked={checked}
|
57
|
+
/>
|
58
|
+
<label
|
59
|
+
className={classNames(
|
60
|
+
`ff--switch-label default--${size} ff--switch-label--${variant}`,
|
61
|
+
{
|
62
|
+
'ff--switch-label--disabled': disabled,
|
63
|
+
}
|
64
|
+
)}
|
65
|
+
htmlFor={`ff-toggle-${id}`}
|
66
|
+
>
|
67
|
+
<span
|
68
|
+
className={classNames(
|
69
|
+
`ff--switch-button ff--switch-button--${size}`,
|
70
|
+
{
|
71
|
+
checked: checked,
|
72
|
+
}
|
73
|
+
)}
|
74
|
+
>
|
75
|
+
{checked ? (
|
76
|
+
<Icon
|
77
|
+
name={iconNames.checked.name}
|
78
|
+
width={iconNames.checked.width}
|
79
|
+
height={iconNames.checked.height}
|
80
|
+
className={`ff-checked-icon--${variant}`}
|
81
|
+
/>
|
82
|
+
) : (
|
83
|
+
<Icon
|
84
|
+
name={iconNames.unchecked.name}
|
85
|
+
width={iconNames.unchecked.width}
|
86
|
+
height={iconNames.unchecked.height}
|
87
|
+
className={`ff-unchecked-icon--${variant}`}
|
88
|
+
/>
|
89
|
+
)}
|
90
|
+
</span>
|
91
|
+
</label>
|
92
|
+
</div>
|
93
|
+
);
|
94
|
+
};
|
95
|
+
|
96
|
+
export default Toggle;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Toggle';
|
@@ -0,0 +1,43 @@
|
|
1
|
+
export interface ToggleProps {
|
2
|
+
/**
|
3
|
+
* Optional onChange handler
|
4
|
+
*/
|
5
|
+
onChange?: (event: React.MouseEvent<HTMLInputElement, MouseEvent>) => void;
|
6
|
+
/**
|
7
|
+
* Optional disabled state
|
8
|
+
*/
|
9
|
+
disabled?: boolean;
|
10
|
+
/**
|
11
|
+
* Optional checked state
|
12
|
+
*/
|
13
|
+
checked?: boolean;
|
14
|
+
/**
|
15
|
+
* Optional id
|
16
|
+
*/
|
17
|
+
id?: string;
|
18
|
+
/**
|
19
|
+
* What background color to occur upon toggled
|
20
|
+
*/
|
21
|
+
variant?: 'primary' | 'secondary';
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Defines the size of the toggle
|
25
|
+
*/
|
26
|
+
size?: 'small' | 'medium' | 'large';
|
27
|
+
/**
|
28
|
+
* Optional icon configuration for the toggle. This allows for custom icons to be used for both the checked and unchecked states.
|
29
|
+
*
|
30
|
+
* @property checked - Icon configuration for the checked state.
|
31
|
+
* @property unchecked - Icon configuration for the unchecked state.
|
32
|
+
*
|
33
|
+
* @example
|
34
|
+
* {
|
35
|
+
* checked: { name: 'checked-icon', width: 24, height: 24 },
|
36
|
+
* unchecked: { name: 'unchecked-icon', width: 24, height: 24 }
|
37
|
+
* }
|
38
|
+
*/
|
39
|
+
icon?: {
|
40
|
+
checked?: { name: string; width: number; height: number };
|
41
|
+
unchecked?: { name: string; width: number; height: number };
|
42
|
+
};
|
43
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
@import '../../assets/styles/colors';
|
2
|
+
@import '../../assets/styles/fonts';
|
3
|
+
|
4
|
+
.ff-tooltip-container {
|
5
|
+
cursor: auto;
|
6
|
+
display: inline-block;
|
7
|
+
}
|
8
|
+
|
9
|
+
.ff-tooltip {
|
10
|
+
@extend .fontSm;
|
11
|
+
position: fixed;
|
12
|
+
width: max-content;
|
13
|
+
max-width: 60vw;
|
14
|
+
word-wrap: break-word;
|
15
|
+
background-color: var(--tooltip-bg-color);
|
16
|
+
line-height: 18px;
|
17
|
+
color: var(--tooltip-text-color);
|
18
|
+
text-align: center;
|
19
|
+
border-radius: 5px;
|
20
|
+
padding: 6px 12px;
|
21
|
+
opacity: 0;
|
22
|
+
|
23
|
+
&--visible {
|
24
|
+
opacity: 1;
|
25
|
+
transition: opacity 0.3s;
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import Tooltip from './Tooltip';
|
3
|
+
import Icon from '../Icon';
|
4
|
+
|
5
|
+
const meta: Meta<typeof Tooltip> = {
|
6
|
+
title: 'Components/Tooltip',
|
7
|
+
component: Tooltip,
|
8
|
+
tags: ['autodocs'],
|
9
|
+
parameters: {
|
10
|
+
layout: 'centered',
|
11
|
+
},
|
12
|
+
argTypes: {
|
13
|
+
title: { control: 'text' },
|
14
|
+
placement: { control: { type: 'select' } },
|
15
|
+
disabled: { control: { type: 'boolean' } },
|
16
|
+
},
|
17
|
+
};
|
18
|
+
type Story = StoryObj<typeof Tooltip>;
|
19
|
+
export const Default: Story = {
|
20
|
+
args: {
|
21
|
+
title: 'Default',
|
22
|
+
placement: 'bottom',
|
23
|
+
children: 'Hover on me to check tooltip',
|
24
|
+
},
|
25
|
+
};
|
26
|
+
|
27
|
+
export const Controlled: Story = {
|
28
|
+
args: {
|
29
|
+
title: 'Tooltip',
|
30
|
+
disabled: true,
|
31
|
+
children: 'Hover on me to check tooltip',
|
32
|
+
placement: 'bottom',
|
33
|
+
},
|
34
|
+
render: (args) => {
|
35
|
+
return <Tooltip {...args}>{args.children}</Tooltip>;
|
36
|
+
},
|
37
|
+
};
|
38
|
+
|
39
|
+
export const Top: Story = {
|
40
|
+
args: {
|
41
|
+
title: 'Top',
|
42
|
+
placement: 'top',
|
43
|
+
children: 'Hover on me to check top',
|
44
|
+
},
|
45
|
+
};
|
46
|
+
|
47
|
+
export const Left: Story = {
|
48
|
+
args: {
|
49
|
+
title: 'Left',
|
50
|
+
placement: 'left',
|
51
|
+
children: 'Hover on me to check left',
|
52
|
+
},
|
53
|
+
};
|
54
|
+
export const Right: Story = {
|
55
|
+
args: {
|
56
|
+
title: 'Right',
|
57
|
+
placement: 'right',
|
58
|
+
children: 'Hover on me to check right',
|
59
|
+
},
|
60
|
+
};
|
61
|
+
export const TopStart: Story = {
|
62
|
+
args: {
|
63
|
+
title: 'Top Start',
|
64
|
+
placement: 'top-start',
|
65
|
+
children: 'Hover on me to check top start',
|
66
|
+
},
|
67
|
+
};
|
68
|
+
export const TopEnd: Story = {
|
69
|
+
args: {
|
70
|
+
title: 'Top End',
|
71
|
+
placement: 'top-end',
|
72
|
+
children: 'Hover on me to check top end',
|
73
|
+
},
|
74
|
+
};
|
75
|
+
export const BottomStart: Story = {
|
76
|
+
args: {
|
77
|
+
title: 'Bottom Start',
|
78
|
+
placement: 'bottom-start',
|
79
|
+
children: 'Hover on me to check bottom start',
|
80
|
+
},
|
81
|
+
};
|
82
|
+
export const BottomEnd: Story = {
|
83
|
+
args: {
|
84
|
+
title: 'Bottom End',
|
85
|
+
placement: 'bottom-end',
|
86
|
+
children: 'Hover on me to check bottom end',
|
87
|
+
},
|
88
|
+
};
|
89
|
+
export const TooltipWithIcon: Story = {
|
90
|
+
args: {
|
91
|
+
title: <Icon name="logo" />,
|
92
|
+
placement: 'bottom',
|
93
|
+
children: 'Hover on me to check jsx',
|
94
|
+
},
|
95
|
+
};
|
96
|
+
|
97
|
+
export default meta;
|
@@ -0,0 +1,194 @@
|
|
1
|
+
import React, { useEffect, useRef, useState, useContext } from 'react';
|
2
|
+
import './Tooltip.scss';
|
3
|
+
import { createPortal } from 'react-dom';
|
4
|
+
import {
|
5
|
+
Position,
|
6
|
+
TooltipProps,
|
7
|
+
TooltipContainerRef,
|
8
|
+
TitleRef,
|
9
|
+
IsTitleEmpty,
|
10
|
+
} from './types';
|
11
|
+
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
12
|
+
import { ThemeContext } from '../ThemeProvider/ThemeProvider';
|
13
|
+
import classNames from 'classnames';
|
14
|
+
|
15
|
+
const Tooltip: React.FC<TooltipProps> = ({
|
16
|
+
title,
|
17
|
+
children,
|
18
|
+
placement = 'bottom',
|
19
|
+
disabled = false,
|
20
|
+
}) => {
|
21
|
+
const [isVisible, setIsVisible] = useState(false);
|
22
|
+
const titleRef: TitleRef = useRef(null);
|
23
|
+
const tooltipContainerRef: TooltipContainerRef = useRef(null);
|
24
|
+
const [tooltipContainerPosition, setTooltipContainerPosition] = useState({
|
25
|
+
posX: 0,
|
26
|
+
fromRight: 0,
|
27
|
+
posY: 0,
|
28
|
+
width: 0,
|
29
|
+
fromBottom: 0,
|
30
|
+
});
|
31
|
+
const [titleDimensions, setTitleDimensions] = useState({
|
32
|
+
height: 0,
|
33
|
+
width: 0,
|
34
|
+
});
|
35
|
+
const [childrenContainerHeight, setChildrenContainerHeight] = useState(0);
|
36
|
+
const { posX, fromRight, posY, width } = tooltipContainerPosition;
|
37
|
+
const { height: titleHeight, width: titleWidth } = titleDimensions;
|
38
|
+
const themeContext = useContext(ThemeContext);
|
39
|
+
const currentTheme = themeContext?.currentTheme;
|
40
|
+
const styles: Position = {
|
41
|
+
left: {
|
42
|
+
top: posY,
|
43
|
+
left: posX - titleWidth - 5,
|
44
|
+
},
|
45
|
+
right: {
|
46
|
+
top: posY,
|
47
|
+
left: fromRight + 5,
|
48
|
+
},
|
49
|
+
top: {
|
50
|
+
top: posY - titleHeight - 5,
|
51
|
+
left: posX - titleWidth / 2 + width / 2,
|
52
|
+
},
|
53
|
+
bottom: {
|
54
|
+
top: posY + childrenContainerHeight + 5,
|
55
|
+
left: posX - titleWidth / 2 + width / 2,
|
56
|
+
},
|
57
|
+
'top-start': {
|
58
|
+
top: posY - titleHeight - 5,
|
59
|
+
left: posX,
|
60
|
+
},
|
61
|
+
'top-end': {
|
62
|
+
top: posY - titleHeight - 5,
|
63
|
+
left: fromRight - titleWidth,
|
64
|
+
},
|
65
|
+
'bottom-start': {
|
66
|
+
top: posY + childrenContainerHeight + 5,
|
67
|
+
left: posX,
|
68
|
+
},
|
69
|
+
'bottom-end': {
|
70
|
+
top: posY + childrenContainerHeight + 5,
|
71
|
+
left: fromRight - titleWidth,
|
72
|
+
},
|
73
|
+
};
|
74
|
+
|
75
|
+
const handleScroll = () => {
|
76
|
+
if (tooltipContainerRef.current) {
|
77
|
+
setIsVisible(false);
|
78
|
+
}
|
79
|
+
};
|
80
|
+
|
81
|
+
const handleClickAnywhere = () => {
|
82
|
+
setIsVisible(false);
|
83
|
+
};
|
84
|
+
|
85
|
+
const isTitleEmpty: IsTitleEmpty = (tooltipValue) => {
|
86
|
+
// If the value is a string, use the checkEmpty util function
|
87
|
+
if (typeof tooltipValue === 'string') {
|
88
|
+
return checkEmpty(tooltipValue);
|
89
|
+
}
|
90
|
+
|
91
|
+
// If the value is a valid React element, check if it has any children
|
92
|
+
if (React.isValidElement(tooltipValue)) {
|
93
|
+
return React.Children.count(tooltipValue.props.children) === 0;
|
94
|
+
}
|
95
|
+
|
96
|
+
// For non-string, non-element values, check if it's null or undefined
|
97
|
+
return tooltipValue === undefined || tooltipValue === null;
|
98
|
+
};
|
99
|
+
|
100
|
+
useEffect(() => {
|
101
|
+
window.addEventListener('scroll', handleScroll);
|
102
|
+
window.addEventListener('click', handleClickAnywhere);
|
103
|
+
return () => {
|
104
|
+
window.removeEventListener('scroll', handleScroll);
|
105
|
+
window.removeEventListener('click', handleClickAnywhere);
|
106
|
+
};
|
107
|
+
}, []);
|
108
|
+
|
109
|
+
const calculateDim = () => {
|
110
|
+
if (tooltipContainerRef.current) {
|
111
|
+
const computedStyle = window.getComputedStyle(
|
112
|
+
tooltipContainerRef.current
|
113
|
+
);
|
114
|
+
if (
|
115
|
+
computedStyle.display === 'none' ||
|
116
|
+
computedStyle.visibility === 'hidden' ||
|
117
|
+
computedStyle.opacity === '0'
|
118
|
+
) {
|
119
|
+
setIsVisible(false);
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
if (titleRef.current) {
|
124
|
+
setTitleDimensions({
|
125
|
+
height: titleRef.current.offsetHeight,
|
126
|
+
width: titleRef.current.offsetWidth,
|
127
|
+
});
|
128
|
+
}
|
129
|
+
|
130
|
+
if (tooltipContainerRef.current && titleRef.current) {
|
131
|
+
const rect = tooltipContainerRef.current.getBoundingClientRect();
|
132
|
+
setChildrenContainerHeight(rect.height);
|
133
|
+
const leftSpaceAvailable =
|
134
|
+
rect.left +
|
135
|
+
window.scrollX +
|
136
|
+
tooltipContainerRef.current.offsetWidth / 2 -
|
137
|
+
titleRef.current.offsetWidth / 2;
|
138
|
+
const rightSpaceAvailable =
|
139
|
+
window.innerWidth -
|
140
|
+
rect.right +
|
141
|
+
tooltipContainerRef.current.offsetWidth / 2 -
|
142
|
+
titleRef.current.offsetWidth / 2;
|
143
|
+
let posX = rect.left + window.scrollX;
|
144
|
+
|
145
|
+
if (leftSpaceAvailable < 0) {
|
146
|
+
posX -= leftSpaceAvailable;
|
147
|
+
}
|
148
|
+
if (rightSpaceAvailable < 0) {
|
149
|
+
posX += rightSpaceAvailable;
|
150
|
+
}
|
151
|
+
|
152
|
+
setTooltipContainerPosition({
|
153
|
+
posX,
|
154
|
+
fromRight: rect.right,
|
155
|
+
posY: rect.top,
|
156
|
+
width: tooltipContainerRef.current.offsetWidth,
|
157
|
+
fromBottom: window.innerHeight - tooltipContainerRef.current.offsetTop,
|
158
|
+
});
|
159
|
+
}
|
160
|
+
};
|
161
|
+
|
162
|
+
useEffect(() => {
|
163
|
+
calculateDim();
|
164
|
+
}, [isVisible]);
|
165
|
+
|
166
|
+
return (
|
167
|
+
<div
|
168
|
+
ref={tooltipContainerRef}
|
169
|
+
className={classNames('ff-tooltip-container', currentTheme)}
|
170
|
+
onMouseEnter={() => setIsVisible(true)}
|
171
|
+
onMouseLeave={() => setIsVisible(false)}
|
172
|
+
>
|
173
|
+
{children}
|
174
|
+
|
175
|
+
{isVisible &&
|
176
|
+
!disabled &&
|
177
|
+
!isTitleEmpty(title) &&
|
178
|
+
createPortal(
|
179
|
+
<div
|
180
|
+
ref={titleRef}
|
181
|
+
style={styles[placement]}
|
182
|
+
className={classNames('ff-tooltip', currentTheme, {
|
183
|
+
'ff-tooltip--visible': isVisible,
|
184
|
+
})}
|
185
|
+
>
|
186
|
+
{title}
|
187
|
+
</div>,
|
188
|
+
document.body
|
189
|
+
)}
|
190
|
+
</div>
|
191
|
+
);
|
192
|
+
};
|
193
|
+
|
194
|
+
export default Tooltip;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Tooltip';
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
|
3
|
+
type TooltipContainerRef = React.RefObject<HTMLDivElement>;
|
4
|
+
type TitleRef = React.RefObject<HTMLDivElement>;
|
5
|
+
type IsTitleEmpty = (tooltipValue: ReactNode | string) => boolean;
|
6
|
+
|
7
|
+
interface Position {
|
8
|
+
[key: string]: {
|
9
|
+
top?: number;
|
10
|
+
left?: number;
|
11
|
+
};
|
12
|
+
}
|
13
|
+
interface TooltipProps {
|
14
|
+
/**
|
15
|
+
* The text or content to be displayed inside the tooltip.
|
16
|
+
* This can be a string or any React node.
|
17
|
+
*/
|
18
|
+
title?: string | React.ReactNode;
|
19
|
+
|
20
|
+
/**
|
21
|
+
* The children over which the tooltip will be displayed.
|
22
|
+
* Typically a button or any other interactive element.
|
23
|
+
*/
|
24
|
+
children: React.ReactNode;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* The placement of the tooltip relative to the children.
|
28
|
+
* Defines where the tooltip appears: top, bottom, left, right, etc.
|
29
|
+
*
|
30
|
+
* @default 'bottom'
|
31
|
+
*/
|
32
|
+
placement?:
|
33
|
+
| 'top'
|
34
|
+
| 'bottom'
|
35
|
+
| 'left'
|
36
|
+
| 'right'
|
37
|
+
| 'top-start'
|
38
|
+
| 'top-end'
|
39
|
+
| 'bottom-start'
|
40
|
+
| 'bottom-end';
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Whether the tooltip is disabled.
|
44
|
+
* If true, the tooltip will not be displayed.
|
45
|
+
*
|
46
|
+
* @default false
|
47
|
+
*/
|
48
|
+
disabled?: boolean;
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
export {
|
53
|
+
TooltipContainerRef,
|
54
|
+
TitleRef,
|
55
|
+
IsTitleEmpty,
|
56
|
+
Position,
|
57
|
+
TooltipProps,
|
58
|
+
};
|
59
|
+
|
60
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
@mixin fontPoppins($size: 16px) {
|
2
|
+
font-family: 'Poppins', sans-serif;
|
3
|
+
font-size: $size;
|
4
|
+
}
|
5
|
+
|
6
|
+
@font-face {
|
7
|
+
font-family: 'Poppins';
|
8
|
+
font-weight: 400;
|
9
|
+
src: local('Poppins-Regular'),
|
10
|
+
url(../../fonts/Poppins/Poppins-Regular.ttf) format('truetype');
|
11
|
+
}
|
12
|
+
|
13
|
+
@font-face {
|
14
|
+
font-family: 'Poppins';
|
15
|
+
font-weight: 500;
|
16
|
+
src: local('Poppins-Medium'),
|
17
|
+
url(../../fonts/Poppins/Poppins-Medium.ttf) format('truetype');
|
18
|
+
}
|
19
|
+
|
20
|
+
@font-face {
|
21
|
+
font-family: 'Poppins';
|
22
|
+
font-weight: 600;
|
23
|
+
src: local('Poppins-SemiBold'),
|
24
|
+
url(../../fonts/Poppins/Poppins-SemiBold.ttf) format('truetype');
|
25
|
+
}
|
26
|
+
|
27
|
+
@font-face {
|
28
|
+
font-family: 'Poppins';
|
29
|
+
font-weight: 700;
|
30
|
+
src: local('Poppins-Bold'),
|
31
|
+
url(../../fonts/Poppins/Poppins-Bold.ttf) format('truetype');
|
32
|
+
}
|
33
|
+
|
34
|
+
.ff-text {
|
35
|
+
@include fontPoppins();
|
36
|
+
|
37
|
+
&--regular {
|
38
|
+
font-weight: 400;
|
39
|
+
}
|
40
|
+
&--medium {
|
41
|
+
font-weight: 500;
|
42
|
+
}
|
43
|
+
&--semi-bold {
|
44
|
+
font-weight: 600;
|
45
|
+
}
|
46
|
+
&--bold {
|
47
|
+
font-weight: 700;
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import Typography from './Typography';
|
3
|
+
|
4
|
+
const meta: Meta<typeof Typography> = {
|
5
|
+
title: 'Components/Typography',
|
6
|
+
component: Typography,
|
7
|
+
parameters: {
|
8
|
+
layout: 'centered',
|
9
|
+
},
|
10
|
+
tags: ['autodocs'],
|
11
|
+
};
|
12
|
+
|
13
|
+
type Story = StoryObj<typeof Typography>;
|
14
|
+
|
15
|
+
export const Docs: Story = {
|
16
|
+
args: {
|
17
|
+
children: 'Typography',
|
18
|
+
},
|
19
|
+
};
|
20
|
+
|
21
|
+
export const Regular12px: Story = {
|
22
|
+
args: {
|
23
|
+
fontWeight: 'regular',
|
24
|
+
fontSize: '12px',
|
25
|
+
as: 'h1',
|
26
|
+
children: 'This is Regular text with 400 font weight and 12px font size.',
|
27
|
+
},
|
28
|
+
};
|
29
|
+
|
30
|
+
export const Medium12px: Story = {
|
31
|
+
args: {
|
32
|
+
fontWeight: 'medium',
|
33
|
+
fontSize: '14px',
|
34
|
+
as: 'p',
|
35
|
+
children: 'This is Medium text with 500 font weight and 14px font size.',
|
36
|
+
},
|
37
|
+
};
|
38
|
+
|
39
|
+
export const SemiBold14px: Story = {
|
40
|
+
args: {
|
41
|
+
fontWeight: 'bold',
|
42
|
+
fontSize: '14px',
|
43
|
+
as: 'li',
|
44
|
+
children: 'This is SemiBold text with 600 font weight and 14px font size.',
|
45
|
+
},
|
46
|
+
};
|
47
|
+
|
48
|
+
export const Bold14px: Story = {
|
49
|
+
args: {
|
50
|
+
fontWeight: 'bold',
|
51
|
+
fontSize: '16px',
|
52
|
+
as: 'h2',
|
53
|
+
children: 'This is Bold text with 700 font weight and 16px font size.',
|
54
|
+
},
|
55
|
+
};
|
56
|
+
|
57
|
+
export default meta;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TypographyProps } from './types';
|
3
|
+
import './Typography.scss';
|
4
|
+
|
5
|
+
const Typography: React.FC<TypographyProps> = ({
|
6
|
+
fontWeight = 'regular',
|
7
|
+
fontSize = 12,
|
8
|
+
lineHeight = 'normal',
|
9
|
+
color = '',
|
10
|
+
textAlign = 'left',
|
11
|
+
as: Element = 'span',
|
12
|
+
letterSpacing = '',
|
13
|
+
className = '',
|
14
|
+
children,
|
15
|
+
htmlFor = '',
|
16
|
+
onClick = () => {},
|
17
|
+
}) => {
|
18
|
+
const fontSizeValue =
|
19
|
+
typeof fontSize === 'number' ? `${fontSize}px` : fontSize;
|
20
|
+
|
21
|
+
return (
|
22
|
+
<Element
|
23
|
+
className={`ff-text ff-text--${fontWeight} ${className}`}
|
24
|
+
{...(Element === 'label' && { htmlFor })}
|
25
|
+
style={{
|
26
|
+
fontSize: fontSizeValue,
|
27
|
+
lineHeight,
|
28
|
+
color,
|
29
|
+
textAlign,
|
30
|
+
letterSpacing,
|
31
|
+
}}
|
32
|
+
onClick={onClick}
|
33
|
+
>
|
34
|
+
{children}
|
35
|
+
</Element>
|
36
|
+
);
|
37
|
+
};
|
38
|
+
|
39
|
+
export default Typography;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Typography';
|