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,56 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
export interface TypographyProps {
|
4
|
+
/**
|
5
|
+
* Font Weight
|
6
|
+
*/
|
7
|
+
fontWeight?: 'regular' | 'medium' | 'semi-bold' | 'bold';
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Font Size
|
11
|
+
*/
|
12
|
+
|
13
|
+
fontSize?: number | string;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Line height
|
17
|
+
*/
|
18
|
+
|
19
|
+
lineHeight?: string;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Color
|
23
|
+
*/
|
24
|
+
|
25
|
+
color?: string;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Text alignment
|
29
|
+
*/
|
30
|
+
textAlign?: 'left' | 'right' | 'center' | 'justify';
|
31
|
+
|
32
|
+
/**
|
33
|
+
* For JSX elements
|
34
|
+
*/
|
35
|
+
as?: keyof JSX.IntrinsicElements;
|
36
|
+
/**
|
37
|
+
* htmlFor attribute for element=label,
|
38
|
+
*/
|
39
|
+
htmlFor?: string;
|
40
|
+
/**
|
41
|
+
* The content to display within the Typography component
|
42
|
+
*/
|
43
|
+
children: React.ReactNode;
|
44
|
+
/**
|
45
|
+
* To add styles in Typography
|
46
|
+
*/
|
47
|
+
className?: string;
|
48
|
+
/**
|
49
|
+
* To add letter spacing in Typography
|
50
|
+
*/
|
51
|
+
letterSpacing?: string;
|
52
|
+
/**
|
53
|
+
* To add onClick function
|
54
|
+
*/
|
55
|
+
onClick?: () => void;
|
56
|
+
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { useEffect } from 'react';
|
2
|
+
|
3
|
+
function useEscapeKey(key: string) {
|
4
|
+
|
5
|
+
return (callBack: ()=>void)=>{
|
6
|
+
|
7
|
+
|
8
|
+
const handleKeyDown: (event: KeyboardEvent) => void = (event) => {
|
9
|
+
if (event?.key === key) {
|
10
|
+
console.log('Handel called Closing modal');
|
11
|
+
callBack()
|
12
|
+
}
|
13
|
+
};
|
14
|
+
useEffect(() => {
|
15
|
+
window.addEventListener('keydown', handleKeyDown);
|
16
|
+
|
17
|
+
return () => {
|
18
|
+
window.removeEventListener('keydown', handleKeyDown);
|
19
|
+
};
|
20
|
+
}, []);
|
21
|
+
|
22
|
+
}
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
}
|
30
|
+
|
31
|
+
export default useEscapeKey;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { useEffect } from 'react';
|
2
|
+
|
3
|
+
const useClickOutside = (
|
4
|
+
ref: React.RefObject<HTMLElement>,
|
5
|
+
callback: () => void,
|
6
|
+
ignoreRefs: Array<React.RefObject<HTMLElement> | undefined> = []
|
7
|
+
) => {
|
8
|
+
useEffect(() => {
|
9
|
+
const handleClickOutside = (event: MouseEvent) => {
|
10
|
+
if (
|
11
|
+
ref.current &&
|
12
|
+
!ref.current.contains(event.target as Node) &&
|
13
|
+
!ignoreRefs.some(
|
14
|
+
(ignoreRef) =>
|
15
|
+
ignoreRef?.current &&
|
16
|
+
ignoreRef.current.contains(event.target as Node)
|
17
|
+
)
|
18
|
+
) {
|
19
|
+
callback();
|
20
|
+
}
|
21
|
+
};
|
22
|
+
|
23
|
+
document.addEventListener('mousedown', handleClickOutside);
|
24
|
+
return () => {
|
25
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
26
|
+
};
|
27
|
+
}, [ref, callback, ignoreRefs]);
|
28
|
+
};
|
29
|
+
|
30
|
+
export default useClickOutside;
|
@@ -0,0 +1,273 @@
|
|
1
|
+
import { useState, useCallback } from 'react';
|
2
|
+
import { getExtensionWithPeriod } from '../utils/getExtension/getExtension';
|
3
|
+
import {
|
4
|
+
DropzoneOptions,
|
5
|
+
DropzoneState,
|
6
|
+
FileError,
|
7
|
+
FileRejection,
|
8
|
+
FileState,
|
9
|
+
} from '../components/FileDropzone/types';
|
10
|
+
import { checkEmpty } from '../utils/checkEmpty/checkEmpty';
|
11
|
+
|
12
|
+
const useFileDropzone = (options: DropzoneOptions): DropzoneState => {
|
13
|
+
const {
|
14
|
+
accept,
|
15
|
+
multiple,
|
16
|
+
maxSize,
|
17
|
+
maxFiles,
|
18
|
+
onMaxFilesError,
|
19
|
+
onDrop,
|
20
|
+
maxSizeErrorMessage,
|
21
|
+
invalidFileMessage,
|
22
|
+
fileExistMessage,
|
23
|
+
validateMIMEType = false,
|
24
|
+
} = options;
|
25
|
+
|
26
|
+
const [files, setFiles] = useState<FileState>({ accepted: [], rejected: [] });
|
27
|
+
const [isDragActive, setIsDragActive] = useState(false);
|
28
|
+
|
29
|
+
const validateFileMIMEType = (
|
30
|
+
file: File,
|
31
|
+
extensionWithPeriod: string
|
32
|
+
): boolean => {
|
33
|
+
if (accept.includes(file.type)) return true;
|
34
|
+
|
35
|
+
// these special types doesn't have MIME type, user can pass . extension and get it validated based on file name extension
|
36
|
+
const specialTypes = ['.ipa', '.yml', '.md', '.pem', '.properties'];
|
37
|
+
return (
|
38
|
+
specialTypes.includes(extensionWithPeriod) &&
|
39
|
+
accept.includes(extensionWithPeriod)
|
40
|
+
);
|
41
|
+
};
|
42
|
+
|
43
|
+
const validateFile = useCallback(
|
44
|
+
(file: File): FileError[] => {
|
45
|
+
const errors: FileError[] = [];
|
46
|
+
|
47
|
+
if (maxSize && file.size > maxSize) {
|
48
|
+
errors.push({
|
49
|
+
message: maxSizeErrorMessage
|
50
|
+
? maxSizeErrorMessage
|
51
|
+
: 'File size exceeds the limit',
|
52
|
+
code: 'file-size-exceeded',
|
53
|
+
});
|
54
|
+
}
|
55
|
+
|
56
|
+
const extensionWithPeriod = getExtensionWithPeriod(file).toLowerCase();
|
57
|
+
|
58
|
+
if (validateMIMEType) {
|
59
|
+
if (!validateFileMIMEType(file, extensionWithPeriod)) {
|
60
|
+
errors.push({
|
61
|
+
message: invalidFileMessage
|
62
|
+
? invalidFileMessage
|
63
|
+
: 'Unsupported File Format',
|
64
|
+
code: 'file-invalid-type',
|
65
|
+
});
|
66
|
+
}
|
67
|
+
} else if (accept && !accept.includes(extensionWithPeriod)) {
|
68
|
+
errors.push({
|
69
|
+
message: invalidFileMessage
|
70
|
+
? invalidFileMessage
|
71
|
+
: 'Unsupported File Format',
|
72
|
+
code: 'file-invalid-type',
|
73
|
+
});
|
74
|
+
}
|
75
|
+
|
76
|
+
const fileExists = files.accepted.some(
|
77
|
+
(existingFile) =>
|
78
|
+
existingFile.name === file.name &&
|
79
|
+
getExtensionWithPeriod(existingFile) === getExtensionWithPeriod(file)
|
80
|
+
);
|
81
|
+
|
82
|
+
if (fileExists) {
|
83
|
+
errors.push({
|
84
|
+
message: fileExistMessage ? fileExistMessage : 'File already exists.',
|
85
|
+
code: 'file-exists',
|
86
|
+
});
|
87
|
+
}
|
88
|
+
|
89
|
+
return errors;
|
90
|
+
},
|
91
|
+
[
|
92
|
+
accept,
|
93
|
+
maxSize,
|
94
|
+
files,
|
95
|
+
maxSizeErrorMessage,
|
96
|
+
invalidFileMessage,
|
97
|
+
fileExistMessage,
|
98
|
+
]
|
99
|
+
);
|
100
|
+
|
101
|
+
const replaceFile = useCallback(
|
102
|
+
(fileToReplace: File, newFile: File) => {
|
103
|
+
if (
|
104
|
+
fileToReplace.name === newFile.name &&
|
105
|
+
fileToReplace.size === newFile.size
|
106
|
+
) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
const errors = validateFile(newFile);
|
110
|
+
|
111
|
+
setFiles((prevFiles) => {
|
112
|
+
const updatedAccepted = prevFiles.accepted.filter(
|
113
|
+
(file) => file.name !== fileToReplace.name
|
114
|
+
);
|
115
|
+
const updatedRejected = prevFiles.rejected.filter(
|
116
|
+
(rejection) => rejection.file.name !== fileToReplace.name
|
117
|
+
);
|
118
|
+
|
119
|
+
return {
|
120
|
+
accepted: !checkEmpty(errors)
|
121
|
+
? updatedAccepted
|
122
|
+
: [...updatedAccepted, newFile],
|
123
|
+
rejected: !checkEmpty(errors)
|
124
|
+
? [...updatedRejected, { file: newFile, errors }]
|
125
|
+
: updatedRejected,
|
126
|
+
};
|
127
|
+
});
|
128
|
+
},
|
129
|
+
[validateFile]
|
130
|
+
);
|
131
|
+
|
132
|
+
const handleReplaceClick = useCallback(
|
133
|
+
(fileToReplace: File) => {
|
134
|
+
const input = document.createElement('input');
|
135
|
+
input.type = 'file';
|
136
|
+
input.accept = accept.join(',');
|
137
|
+
input.onchange = (event: Event) => {
|
138
|
+
const newFile = (event.target as HTMLInputElement)?.files?.[0];
|
139
|
+
if (newFile) {
|
140
|
+
replaceFile(fileToReplace, newFile);
|
141
|
+
}
|
142
|
+
};
|
143
|
+
input.click();
|
144
|
+
},
|
145
|
+
[accept, replaceFile]
|
146
|
+
);
|
147
|
+
|
148
|
+
const removeFile = useCallback((fileToRemove: File) => {
|
149
|
+
setFiles((prevFiles) => ({
|
150
|
+
accepted: prevFiles.accepted.filter((file) => file !== fileToRemove),
|
151
|
+
rejected: prevFiles.rejected.filter(
|
152
|
+
(rejection) => rejection.file !== fileToRemove
|
153
|
+
),
|
154
|
+
}));
|
155
|
+
}, []);
|
156
|
+
|
157
|
+
const handleRemoveClick = useCallback(
|
158
|
+
(file: File) => {
|
159
|
+
removeFile(file);
|
160
|
+
},
|
161
|
+
[removeFile]
|
162
|
+
);
|
163
|
+
|
164
|
+
const handleDrop = useCallback(
|
165
|
+
(
|
166
|
+
event: React.DragEvent<HTMLElement> | React.ChangeEvent<HTMLInputElement>
|
167
|
+
) => {
|
168
|
+
event.preventDefault();
|
169
|
+
event.stopPropagation();
|
170
|
+
|
171
|
+
const droppedFiles =
|
172
|
+
'dataTransfer' in event
|
173
|
+
? event.dataTransfer?.files
|
174
|
+
: event.target?.files;
|
175
|
+
if (!droppedFiles) return;
|
176
|
+
|
177
|
+
const droppedOrSelectedFiles = Array.from(droppedFiles);
|
178
|
+
|
179
|
+
if (maxFiles && droppedOrSelectedFiles.length > maxFiles) {
|
180
|
+
if (onMaxFilesError) onMaxFilesError();
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
|
184
|
+
const accepted: File[] = [];
|
185
|
+
const rejected: FileRejection[] = [];
|
186
|
+
|
187
|
+
droppedOrSelectedFiles.forEach((file) => {
|
188
|
+
const errors = validateFile(file);
|
189
|
+
if (!checkEmpty(errors)) {
|
190
|
+
rejected.push({ file, errors });
|
191
|
+
} else {
|
192
|
+
accepted.push(file);
|
193
|
+
}
|
194
|
+
});
|
195
|
+
|
196
|
+
setFiles((prevFiles) => ({
|
197
|
+
accepted: [
|
198
|
+
...prevFiles.accepted,
|
199
|
+
...accepted.filter(
|
200
|
+
(newFile) =>
|
201
|
+
!prevFiles.accepted.some(
|
202
|
+
(file) =>
|
203
|
+
file.name === newFile.name &&
|
204
|
+
getExtensionWithPeriod(file) ===
|
205
|
+
getExtensionWithPeriod(newFile)
|
206
|
+
)
|
207
|
+
),
|
208
|
+
],
|
209
|
+
rejected: [
|
210
|
+
...prevFiles.rejected,
|
211
|
+
...rejected.filter(
|
212
|
+
(newFile) =>
|
213
|
+
!prevFiles.rejected.some(
|
214
|
+
(file) =>
|
215
|
+
file.file.name === newFile.file.name &&
|
216
|
+
getExtensionWithPeriod(file.file) ===
|
217
|
+
getExtensionWithPeriod(newFile.file)
|
218
|
+
)
|
219
|
+
),
|
220
|
+
],
|
221
|
+
}));
|
222
|
+
|
223
|
+
if ('dataTransfer' in event) {
|
224
|
+
event.dataTransfer?.clearData();
|
225
|
+
} else {
|
226
|
+
(event.target as HTMLInputElement).value = '';
|
227
|
+
}
|
228
|
+
|
229
|
+
if (onDrop) onDrop(accepted, rejected, event);
|
230
|
+
},
|
231
|
+
[maxFiles, validateFile, onMaxFilesError, onDrop]
|
232
|
+
);
|
233
|
+
|
234
|
+
const handleDragOver = useCallback((event: React.DragEvent<HTMLElement>) => {
|
235
|
+
event.preventDefault();
|
236
|
+
setIsDragActive(true);
|
237
|
+
}, []);
|
238
|
+
|
239
|
+
const handleDragLeave = useCallback(() => {
|
240
|
+
setIsDragActive(false);
|
241
|
+
}, []);
|
242
|
+
|
243
|
+
const getRootProps = useCallback(
|
244
|
+
(): React.HTMLAttributes<HTMLElement> => ({
|
245
|
+
onDragOver: handleDragOver,
|
246
|
+
onDragLeave: handleDragLeave,
|
247
|
+
onDrop: handleDrop,
|
248
|
+
}),
|
249
|
+
[handleDragOver, handleDragLeave, handleDrop, isDragActive]
|
250
|
+
);
|
251
|
+
|
252
|
+
const getInputProps = useCallback(
|
253
|
+
(): React.InputHTMLAttributes<HTMLInputElement> => ({
|
254
|
+
type: 'file',
|
255
|
+
onChange: handleDrop,
|
256
|
+
multiple,
|
257
|
+
accept: accept ? accept.join(',') : '',
|
258
|
+
}),
|
259
|
+
[handleDrop, multiple, accept]
|
260
|
+
);
|
261
|
+
|
262
|
+
return {
|
263
|
+
getRootProps,
|
264
|
+
getInputProps,
|
265
|
+
acceptedFiles: files.accepted,
|
266
|
+
rejectedFiles: files.rejected,
|
267
|
+
isDragActive,
|
268
|
+
handleRemoveClick,
|
269
|
+
handleReplaceClick,
|
270
|
+
};
|
271
|
+
};
|
272
|
+
|
273
|
+
export default useFileDropzone;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { RefObject, useEffect } from 'react';
|
2
|
+
|
3
|
+
export interface PortalPosition {
|
4
|
+
positionX: number;
|
5
|
+
positionY: number;
|
6
|
+
width: number;
|
7
|
+
fromBottom: number;
|
8
|
+
}
|
9
|
+
|
10
|
+
const portalPosition: PortalPosition = {
|
11
|
+
positionX: 0,
|
12
|
+
positionY: 0,
|
13
|
+
width: 0,
|
14
|
+
fromBottom: 0,
|
15
|
+
};
|
16
|
+
|
17
|
+
const calculatePosition = (portalRef: RefObject<HTMLElement>) => {
|
18
|
+
if (!portalRef?.current) {
|
19
|
+
return portalPosition;
|
20
|
+
}
|
21
|
+
const dropdownRect = portalRef.current.getBoundingClientRect();
|
22
|
+
const newPosition = {
|
23
|
+
positionX: dropdownRect.left + window.scrollX,
|
24
|
+
positionY: dropdownRect.top + window.scrollY,
|
25
|
+
width: portalRef.current.offsetWidth,
|
26
|
+
fromBottom: window.innerHeight - (dropdownRect.top + dropdownRect.height),
|
27
|
+
};
|
28
|
+
return newPosition;
|
29
|
+
};
|
30
|
+
|
31
|
+
const usePortalPosition = (
|
32
|
+
portalRef: RefObject<HTMLElement>,
|
33
|
+
isPortalOpen: Boolean
|
34
|
+
) => {
|
35
|
+
useEffect(() => {
|
36
|
+
const handleUpdate = () => {
|
37
|
+
calculatePosition(portalRef);
|
38
|
+
};
|
39
|
+
|
40
|
+
if (isPortalOpen) {
|
41
|
+
window.addEventListener('resize', handleUpdate);
|
42
|
+
window.addEventListener('scroll', handleUpdate);
|
43
|
+
}
|
44
|
+
return () => {
|
45
|
+
window.removeEventListener('resize', handleUpdate);
|
46
|
+
window.removeEventListener('scroll', handleUpdate);
|
47
|
+
};
|
48
|
+
}, [isPortalOpen]);
|
49
|
+
|
50
|
+
return calculatePosition;
|
51
|
+
};
|
52
|
+
|
53
|
+
export default usePortalPosition;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { useContext } from 'react';
|
2
|
+
import { ThemeContextType } from '../components/ThemeProvider/types';
|
3
|
+
import { ThemeContext } from '../components/ThemeProvider/ThemeProvider';
|
4
|
+
|
5
|
+
const useTheme = (): ThemeContextType => {
|
6
|
+
const context = useContext(ThemeContext);
|
7
|
+
if (context === undefined) {
|
8
|
+
throw new Error('useTheme must be used within a ThemeProvider');
|
9
|
+
}
|
10
|
+
return context;
|
11
|
+
};
|
12
|
+
|
13
|
+
export default useTheme;
|
package/src/index.ts
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
import Button from './components/Button';
|
2
|
+
import Drawer from './components/Drawer';
|
3
|
+
import Icon from './components/Icon';
|
4
|
+
import Accordion from './components/Accordion';
|
5
|
+
import MultiSelect from './components/MultiSelect';
|
6
|
+
import Toaster from './components/Toast/Toast';
|
7
|
+
import { Container, Row, Col } from './components/GridLayout/GridLayout';
|
8
|
+
import Toggle from './components/Toggle';
|
9
|
+
import Chip from './components/Chip';
|
10
|
+
import Tooltip from './components/Tooltip';
|
11
|
+
import Input from './components/Input';
|
12
|
+
import RadialChart from './components/Charts/RadialChart';
|
13
|
+
import ExpandableMenu from './components/ExpandableMenu';
|
14
|
+
import Select from './components/Select/Select';
|
15
|
+
import TextArea from './components/TextArea';
|
16
|
+
|
17
|
+
import MenuOption from './components/MenuOption';
|
18
|
+
import Table from './components/Table';
|
19
|
+
|
20
|
+
import AddResourceButton from './components/AddResourceButton';
|
21
|
+
import DonutChart from './components/Charts/DonutChart';
|
22
|
+
import FileDropzone from './components/FileDropzone';
|
23
|
+
import LazyLoad from './components/LazyLoad/LazyLoad';
|
24
|
+
import ThemeProvider from './components/ThemeProvider';
|
25
|
+
import Typography from './components/Typography';
|
26
|
+
import useTheme from './hooks/useTheme';
|
27
|
+
import Form from './components/Form';
|
28
|
+
|
29
|
+
|
30
|
+
import InputWithDropdown from './components/InputWithDropdown';
|
31
|
+
import RadioButton from './components/RadioButton';
|
32
|
+
import RadioGroup from './components/RadioGroup';
|
33
|
+
import MiniModal from './components/MiniModal';
|
34
|
+
import TableTree from './components/TableTree';
|
35
|
+
import Tabs from './components/Tabs';
|
36
|
+
import HighlightText from './components/HighlightText';
|
37
|
+
import Checkbox from './components/Checkbox';
|
38
|
+
import Search from './components/Search'
|
39
|
+
|
40
|
+
// Utils imports
|
41
|
+
import { checkEmpty } from './utils/checkEmpty/checkEmpty';
|
42
|
+
import {
|
43
|
+
getExtension,
|
44
|
+
getExtensionWithPeriod,
|
45
|
+
} from './utils/getExtension/getExtension';
|
46
|
+
|
47
|
+
export {
|
48
|
+
Button,
|
49
|
+
Tooltip,
|
50
|
+
Icon,
|
51
|
+
Accordion,
|
52
|
+
MultiSelect,
|
53
|
+
Toaster,
|
54
|
+
Toggle,
|
55
|
+
Chip,
|
56
|
+
Drawer,
|
57
|
+
Input,
|
58
|
+
RadialChart,
|
59
|
+
ExpandableMenu,
|
60
|
+
Select,
|
61
|
+
TextArea,
|
62
|
+
MenuOption,
|
63
|
+
AddResourceButton,
|
64
|
+
DonutChart,
|
65
|
+
FileDropzone,
|
66
|
+
LazyLoad,
|
67
|
+
ThemeProvider,
|
68
|
+
Typography,
|
69
|
+
useTheme,
|
70
|
+
InputWithDropdown,
|
71
|
+
Table,
|
72
|
+
|
73
|
+
RadioButton,
|
74
|
+
RadioGroup,
|
75
|
+
Form,
|
76
|
+
|
77
|
+
MiniModal,
|
78
|
+
Container,
|
79
|
+
Row,
|
80
|
+
Col,
|
81
|
+
HighlightText,
|
82
|
+
TableTree,
|
83
|
+
Tabs,
|
84
|
+
Checkbox,
|
85
|
+
Search,
|
86
|
+
|
87
|
+
// utils exports
|
88
|
+
checkEmpty,
|
89
|
+
getExtension,
|
90
|
+
getExtensionWithPeriod,
|
91
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export const prepareData = (dataObj: any, columnObj: any) => {
|
2
|
+
let cellData = dataObj[columnObj.accessor];
|
3
|
+
if (columnObj.cell) {
|
4
|
+
return columnObj.cell({
|
5
|
+
value: cellData,
|
6
|
+
row: dataObj,
|
7
|
+
column: columnObj.accessor,
|
8
|
+
});
|
9
|
+
} else if (columnObj.accessor) {
|
10
|
+
return cellData;
|
11
|
+
} else if (cellData && typeof cellData !== 'object') {
|
12
|
+
return cellData;
|
13
|
+
} else {
|
14
|
+
return '--';
|
15
|
+
}
|
16
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { checkEmpty } from './checkEmpty';
|
2
|
+
|
3
|
+
export default {
|
4
|
+
title: 'Utils/isEmptyValue',
|
5
|
+
component: checkEmpty,
|
6
|
+
};
|
7
|
+
|
8
|
+
export const Default = () => {
|
9
|
+
const testCases = [
|
10
|
+
{ value: null, expected: true },
|
11
|
+
{ value: undefined, expected: true },
|
12
|
+
{ value: '', expected: true },
|
13
|
+
{ value: [], expected: true },
|
14
|
+
{ value: {}, expected: true },
|
15
|
+
{ value: 0, expected: true },
|
16
|
+
{ value: 'Hello', expected: false },
|
17
|
+
{ value: [1, 2, 3], expected: false },
|
18
|
+
{ value: { key: 'value' }, expected: false },
|
19
|
+
];
|
20
|
+
|
21
|
+
return (
|
22
|
+
<div>
|
23
|
+
<h1>
|
24
|
+
<u>checkEmpty(value)</u> - true / false
|
25
|
+
</h1>
|
26
|
+
{testCases.map((test, index) => (
|
27
|
+
<div key={index}>
|
28
|
+
checkEmpty( {JSON.stringify(test.value)} ) -
|
29
|
+
{checkEmpty(test.value) ? 'True' : 'False'}
|
30
|
+
</div>
|
31
|
+
))}
|
32
|
+
</div>
|
33
|
+
);
|
34
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
type valueType = any;
|
2
|
+
|
3
|
+
export const checkEmpty = (value: valueType) => {
|
4
|
+
if (!value) {
|
5
|
+
return true;
|
6
|
+
} else if (typeof value === 'object') {
|
7
|
+
if (Array.isArray(value)) return value.length === 0;
|
8
|
+
else return Object.keys(value).length === 0;
|
9
|
+
} else return false;
|
10
|
+
};
|