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,61 @@
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
2
|
+
import './Checkbox.scss';
|
3
|
+
import classNames from 'classnames';
|
4
|
+
import Icon from '../Icon';
|
5
|
+
import { CheckboxProps } from './types';
|
6
|
+
import '../../assets/styles/_colors.scss';
|
7
|
+
import Typography from '../Typography';
|
8
|
+
|
9
|
+
const Checkbox: React.FC<CheckboxProps> = ({
|
10
|
+
id,
|
11
|
+
name,
|
12
|
+
label,
|
13
|
+
disabled = false,
|
14
|
+
checked: initialChecked = false,
|
15
|
+
partial = false,
|
16
|
+
onChange,
|
17
|
+
}) => {
|
18
|
+
const [checked, setChecked] = useState(initialChecked);
|
19
|
+
|
20
|
+
useEffect(() => {
|
21
|
+
setChecked(initialChecked);
|
22
|
+
}, [initialChecked]);
|
23
|
+
|
24
|
+
const handleCheckboxChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
25
|
+
if (!disabled) {
|
26
|
+
setChecked((prev) => !prev), onChange?.(event);
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
return (
|
31
|
+
<label className="ff-checkbox--overlay" htmlFor={id}>
|
32
|
+
<input
|
33
|
+
type="checkbox"
|
34
|
+
className="ff-checkbox-input"
|
35
|
+
id={id}
|
36
|
+
name={name}
|
37
|
+
checked={checked}
|
38
|
+
onChange={handleCheckboxChange}
|
39
|
+
disabled={disabled}
|
40
|
+
/>
|
41
|
+
<span
|
42
|
+
className={classNames('ff-checkbox-custom', {
|
43
|
+
'ff-checkbox-checked': checked,
|
44
|
+
'ff-storybook-checkbox--partial': partial && !checked,
|
45
|
+
})}
|
46
|
+
>
|
47
|
+
{checked && (
|
48
|
+
<Icon
|
49
|
+
name="tick"
|
50
|
+
height={6}
|
51
|
+
width={8}
|
52
|
+
color="var(--primary-icon-color)"
|
53
|
+
/>
|
54
|
+
)}
|
55
|
+
</span>
|
56
|
+
<Typography as="label">{label}</Typography>
|
57
|
+
</label>
|
58
|
+
);
|
59
|
+
};
|
60
|
+
|
61
|
+
export default Checkbox;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Checkbox';
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export interface CheckboxProps {
|
2
|
+
/**
|
3
|
+
* Unique ID for the checkbox input
|
4
|
+
*/
|
5
|
+
id?: string;
|
6
|
+
/**
|
7
|
+
* Name attribute for the checkbox input
|
8
|
+
*/
|
9
|
+
name?: string;
|
10
|
+
/**
|
11
|
+
* Optional side label
|
12
|
+
*/
|
13
|
+
label?: string;
|
14
|
+
/**
|
15
|
+
* Optional disable attribute
|
16
|
+
*/
|
17
|
+
disabled?: boolean;
|
18
|
+
/**
|
19
|
+
* Optional checked attribute to prefill
|
20
|
+
*/
|
21
|
+
checked?: boolean;
|
22
|
+
/**
|
23
|
+
* Optional onChange function
|
24
|
+
*/
|
25
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
26
|
+
/**
|
27
|
+
* For partially checked checkbox
|
28
|
+
*/
|
29
|
+
partial?: boolean;
|
30
|
+
}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
@use '../../assets/styles/colors' as *;
|
2
|
+
@use '../../assets/styles/fonts' as *;
|
3
|
+
|
4
|
+
@mixin chip-variant-background($color) {
|
5
|
+
background-color: $color;
|
6
|
+
color: $drawer-footer-bg;
|
7
|
+
}
|
8
|
+
|
9
|
+
.ff-chip-wrapper {
|
10
|
+
display: inline-flex;
|
11
|
+
margin: 5px;
|
12
|
+
justify-content: center;
|
13
|
+
align-items: center;
|
14
|
+
|
15
|
+
.ff-default-chip-style {
|
16
|
+
display: flex;
|
17
|
+
align-items: center;
|
18
|
+
justify-content: space-around;
|
19
|
+
width: fit-content;
|
20
|
+
gap: 5px;
|
21
|
+
height: 17px;
|
22
|
+
border-radius: 25px;
|
23
|
+
padding: 1px 6px;
|
24
|
+
line-height: 15px;
|
25
|
+
border: none;
|
26
|
+
transition: transform 0.5s ease, box-shadow 0.5s ease, padding 1s ease;
|
27
|
+
box-shadow: 1px 1px 3px 0px $ff-chips-blur-color inset,
|
28
|
+
-1px -1px 2px 0px $drawer-footer-bg inset,
|
29
|
+
1px -1px 2px 0px $ff-chips-blur-color inset,
|
30
|
+
-1px -1px 2px 0px $ff-chips-blur-color, 1px 1px 2px 0px $drawer-footer-bg;
|
31
|
+
&--fullText:hover {
|
32
|
+
box-shadow: 1px 1px 6px 0px $ff-chips-blur-color inset,
|
33
|
+
-1px -1px 4px 0px $drawer-footer-bg inset;
|
34
|
+
padding-right: 12px;
|
35
|
+
}
|
36
|
+
@extend .fontXs;
|
37
|
+
|
38
|
+
&--primary {
|
39
|
+
@include chip-variant-background($ff-chips-fill-color);
|
40
|
+
color: $text-color;
|
41
|
+
}
|
42
|
+
|
43
|
+
&--success {
|
44
|
+
@include chip-variant-background($ff-success);
|
45
|
+
}
|
46
|
+
|
47
|
+
&--error {
|
48
|
+
@include chip-variant-background($ff-error-light);
|
49
|
+
}
|
50
|
+
|
51
|
+
&--warning {
|
52
|
+
@include chip-variant-background($ff-warning);
|
53
|
+
}
|
54
|
+
&--custom {
|
55
|
+
@extend .fontSm;
|
56
|
+
background: #610b861a; //TODO: add color code name
|
57
|
+
color: #610b86; //TODO: add color code name
|
58
|
+
padding: 2px 8px;
|
59
|
+
border-radius: 12px;
|
60
|
+
cursor: pointer;
|
61
|
+
white-space: nowrap;
|
62
|
+
box-shadow: none;
|
63
|
+
transition: background-color 0.3s ease, color 0.3s ease;
|
64
|
+
&:hover {
|
65
|
+
background-color: #610b86; //TODO: add color code name
|
66
|
+
color: #fdfaff; //TODO: add color code name
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import Chip from './Chip';
|
3
|
+
import '../../assets/styles/_colors.scss';
|
4
|
+
import './Chip.scss';
|
5
|
+
import Typography from '../Typography';
|
6
|
+
const meta: Meta<typeof Chip> = {
|
7
|
+
title: 'Components/Chip',
|
8
|
+
component: Chip,
|
9
|
+
parameters: {
|
10
|
+
layout: 'left',
|
11
|
+
},
|
12
|
+
tags: ['autodocs'],
|
13
|
+
};
|
14
|
+
|
15
|
+
type Story = StoryObj<typeof Chip>;
|
16
|
+
|
17
|
+
const defaultArgs = {
|
18
|
+
label: 'SM 0',
|
19
|
+
};
|
20
|
+
|
21
|
+
export const Primary: Story = {
|
22
|
+
args: {
|
23
|
+
...defaultArgs,
|
24
|
+
variant: 'primary',
|
25
|
+
fullText: 'Sub Modules 0',
|
26
|
+
},
|
27
|
+
};
|
28
|
+
|
29
|
+
export const withoutExpand: Story = {
|
30
|
+
args: {
|
31
|
+
...defaultArgs,
|
32
|
+
},
|
33
|
+
};
|
34
|
+
|
35
|
+
export const Group: Story = {
|
36
|
+
render: () => {
|
37
|
+
const items = ['Item 1', 'Item 2', 'Item 3'];
|
38
|
+
|
39
|
+
return (
|
40
|
+
<Typography as="div">
|
41
|
+
{items.map((item) => (
|
42
|
+
<Chip
|
43
|
+
key={item}
|
44
|
+
label={item}
|
45
|
+
variant="primary"
|
46
|
+
fullText="hover item"
|
47
|
+
/>
|
48
|
+
))}
|
49
|
+
</Typography>
|
50
|
+
);
|
51
|
+
},
|
52
|
+
};
|
53
|
+
export const CustomChip: Story = {
|
54
|
+
render: () => {
|
55
|
+
const items = ['Item 1', 'Item 2', 'Item 3'];
|
56
|
+
|
57
|
+
return (
|
58
|
+
<Typography as="div">
|
59
|
+
{items.map((item) => (
|
60
|
+
<Chip key={item} label={item} variant="custom" />
|
61
|
+
))}
|
62
|
+
</Typography>
|
63
|
+
);
|
64
|
+
},
|
65
|
+
};
|
66
|
+
|
67
|
+
export const Success: Story = {
|
68
|
+
args: {
|
69
|
+
...defaultArgs,
|
70
|
+
variant: 'success',
|
71
|
+
fullText: 'Sub Modules 0',
|
72
|
+
},
|
73
|
+
};
|
74
|
+
export const Errors: Story = {
|
75
|
+
args: {
|
76
|
+
...defaultArgs,
|
77
|
+
variant: 'error',
|
78
|
+
fullText: 'Sub Modules 0',
|
79
|
+
},
|
80
|
+
};
|
81
|
+
export const Warning: Story = {
|
82
|
+
args: {
|
83
|
+
...defaultArgs,
|
84
|
+
variant: 'warning',
|
85
|
+
fullText: 'Sub Modules 0',
|
86
|
+
},
|
87
|
+
};
|
88
|
+
export default meta;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { useState } from 'react';
|
2
|
+
import './Chip.scss';
|
3
|
+
import classNames from 'classnames';
|
4
|
+
import { ChipsProps } from './types';
|
5
|
+
import Typography from '../Typography';
|
6
|
+
|
7
|
+
const Chip = ({
|
8
|
+
label = '',
|
9
|
+
fullText = '',
|
10
|
+
variant = 'primary',
|
11
|
+
onClick = () => {},
|
12
|
+
}: ChipsProps) => {
|
13
|
+
const [isHovered, setIsHovered] = useState(false);
|
14
|
+
const labelText = isHovered && fullText ? fullText : label;
|
15
|
+
const handleOnMouseEnter = () => setIsHovered(true);
|
16
|
+
const handleOnMouseLeave = () => setIsHovered(false);
|
17
|
+
|
18
|
+
return (
|
19
|
+
<div className="ff-chip-wrapper">
|
20
|
+
<button
|
21
|
+
onMouseEnter={handleOnMouseEnter}
|
22
|
+
onMouseLeave={handleOnMouseLeave}
|
23
|
+
onClick={onClick}
|
24
|
+
className={classNames(
|
25
|
+
`ff-default-chip-style ff-default-chip-style--${variant}`,
|
26
|
+
{ ['ff-default-chip-style--fullText']: !!fullText }
|
27
|
+
)}
|
28
|
+
>
|
29
|
+
{labelText && <Typography as="p">{labelText}</Typography>}
|
30
|
+
</button>
|
31
|
+
</div>
|
32
|
+
);
|
33
|
+
};
|
34
|
+
|
35
|
+
export default Chip;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Chip';
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export interface ChipsProps {
|
2
|
+
/**
|
3
|
+
* The text to be displayed on the Chip.
|
4
|
+
*/
|
5
|
+
label: string;
|
6
|
+
/**
|
7
|
+
* The text to be displayed on hover.
|
8
|
+
*/
|
9
|
+
fullText?: string;
|
10
|
+
/**
|
11
|
+
* The variant of the Chip.
|
12
|
+
*/
|
13
|
+
variant?: 'primary' | 'success' | 'error' | 'warning' | 'custom';
|
14
|
+
|
15
|
+
/**
|
16
|
+
* The callback function to be executed when the Chip is clicked.
|
17
|
+
*/
|
18
|
+
onClick?: () => void;
|
19
|
+
}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
@import '../../assets/styles/colors';
|
2
|
+
@import '../../assets/styles/fonts';
|
3
|
+
|
4
|
+
.ff-drawer-container {
|
5
|
+
.ff-overlay {
|
6
|
+
position: fixed;
|
7
|
+
inset: 0;
|
8
|
+
background-color: $drawer-title-color;
|
9
|
+
opacity: 0.5;
|
10
|
+
}
|
11
|
+
|
12
|
+
.ff-drawer {
|
13
|
+
height: 100vh;
|
14
|
+
position: fixed;
|
15
|
+
right: 0;
|
16
|
+
top: 0;
|
17
|
+
bottom: 0;
|
18
|
+
min-width: 450px;
|
19
|
+
background-color: $primary-button-text-color;
|
20
|
+
z-index: 999;
|
21
|
+
transform: translateX(100%);
|
22
|
+
opacity: 0;
|
23
|
+
|
24
|
+
&--open {
|
25
|
+
transform: translateX(0);
|
26
|
+
opacity: 1;
|
27
|
+
}
|
28
|
+
&--small {
|
29
|
+
width: 444px;
|
30
|
+
}
|
31
|
+
&--medium {
|
32
|
+
width: 666px;
|
33
|
+
}
|
34
|
+
&--large {
|
35
|
+
width: 888px;
|
36
|
+
}
|
37
|
+
&--x-large {
|
38
|
+
width: calc(100vw - 10px);
|
39
|
+
}
|
40
|
+
&--open,
|
41
|
+
&--medium,
|
42
|
+
&--large,
|
43
|
+
&--x-large {
|
44
|
+
transition: all 0.4s ease-in-out;
|
45
|
+
border-radius: 5px;
|
46
|
+
border: 2px solid $border-color;
|
47
|
+
}
|
48
|
+
|
49
|
+
.ff-drawer-header {
|
50
|
+
padding: 10px 8px 10px 8px;
|
51
|
+
display: flex;
|
52
|
+
gap: 10px;
|
53
|
+
border-bottom: 2px solid $border-color;
|
54
|
+
|
55
|
+
.ff-drawer-title {
|
56
|
+
@extend .fontSm;
|
57
|
+
font-weight: 600;
|
58
|
+
color: $drawer-title-color;
|
59
|
+
display: flex;
|
60
|
+
align-items: center;
|
61
|
+
gap: 12px;
|
62
|
+
}
|
63
|
+
|
64
|
+
.ff-drawer-action-section {
|
65
|
+
width: 100%;
|
66
|
+
display: flex;
|
67
|
+
align-items: center;
|
68
|
+
justify-content: space-between;
|
69
|
+
gap: 12px;
|
70
|
+
|
71
|
+
.ff-action-button {
|
72
|
+
display: flex;
|
73
|
+
align-items: center;
|
74
|
+
gap: 12px;
|
75
|
+
|
76
|
+
.ff-expand-collapse-button {
|
77
|
+
cursor: pointer;
|
78
|
+
background-color: $button-bg-color;
|
79
|
+
outline: none;
|
80
|
+
border: none;
|
81
|
+
margin: 0;
|
82
|
+
border: 1px solid transparent;
|
83
|
+
display: flex;
|
84
|
+
align-items: center;
|
85
|
+
justify-content: center;
|
86
|
+
border-radius: 6px;
|
87
|
+
padding: 6px;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
.ff-drawer-body {
|
94
|
+
background-color: $drawer-footer-bg;
|
95
|
+
padding: 8px;
|
96
|
+
height: calc(100vh - 76px);
|
97
|
+
overflow: hidden auto;
|
98
|
+
}
|
99
|
+
|
100
|
+
.no-footer {
|
101
|
+
height: 100vh;
|
102
|
+
}
|
103
|
+
|
104
|
+
.ff-drawer-footer {
|
105
|
+
position: absolute;
|
106
|
+
bottom: 0;
|
107
|
+
left: 0;
|
108
|
+
right: 0;
|
109
|
+
padding: 5px 16px 5px 16px;
|
110
|
+
display: flex;
|
111
|
+
justify-content: space-between;
|
112
|
+
border-top: 2px solid $drawer-footer-border;
|
113
|
+
|
114
|
+
.button-container {
|
115
|
+
display: flex;
|
116
|
+
justify-content: flex-end;
|
117
|
+
gap: 16px;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import Drawer from './Drawer';
|
3
|
+
import { useState } from 'react';
|
4
|
+
import Button from '../Button';
|
5
|
+
|
6
|
+
const meta: Meta<typeof Drawer> = {
|
7
|
+
title: 'Components/Drawer',
|
8
|
+
component: Drawer,
|
9
|
+
parameters: {
|
10
|
+
layout: 'centered',
|
11
|
+
},
|
12
|
+
tags: ['autodocs'],
|
13
|
+
};
|
14
|
+
|
15
|
+
export default meta;
|
16
|
+
|
17
|
+
type Story = StoryObj<typeof Drawer>;
|
18
|
+
const defaultArgs = {
|
19
|
+
isOpen: true,
|
20
|
+
title: 'Drawer Title',
|
21
|
+
showEditButton: false,
|
22
|
+
_isExpanded: false,
|
23
|
+
onClose: () => {},
|
24
|
+
primaryButtonProps: {
|
25
|
+
label: 'Create',
|
26
|
+
variant: 'primary',
|
27
|
+
disabled: false,
|
28
|
+
onClick: () => {},
|
29
|
+
},
|
30
|
+
secondaryButtonProps: {
|
31
|
+
label: 'Cancel',
|
32
|
+
variant: 'secondary',
|
33
|
+
disabled: false,
|
34
|
+
onClick: () => {},
|
35
|
+
},
|
36
|
+
leftPrimaryButtonProps: {
|
37
|
+
label: 'Next',
|
38
|
+
variant: 'primary',
|
39
|
+
disabled: false,
|
40
|
+
onClick: () => {},
|
41
|
+
},
|
42
|
+
leftSecondaryButtonProps: {
|
43
|
+
label: 'Previuos',
|
44
|
+
variant: 'secondary',
|
45
|
+
disabled: false,
|
46
|
+
onClick: () => {},
|
47
|
+
},
|
48
|
+
onEdit: () => {},
|
49
|
+
overlay: false,
|
50
|
+
isFooterRequired: true,
|
51
|
+
footerContent: null,
|
52
|
+
};
|
53
|
+
|
54
|
+
export const Default: Story = {
|
55
|
+
args: {
|
56
|
+
...defaultArgs,
|
57
|
+
size: 'medium',
|
58
|
+
},
|
59
|
+
};
|
60
|
+
|
61
|
+
export const Controlled: Story = {
|
62
|
+
render: () => {
|
63
|
+
const [showModal, setShowModal] = useState(false);
|
64
|
+
|
65
|
+
return (
|
66
|
+
<>
|
67
|
+
<div>
|
68
|
+
<Button
|
69
|
+
onClick={() => setShowModal(true)}
|
70
|
+
label="show modal"
|
71
|
+
variant="primary"
|
72
|
+
disabled={false}
|
73
|
+
/>
|
74
|
+
</div>
|
75
|
+
<Drawer
|
76
|
+
{...defaultArgs}
|
77
|
+
isOpen={showModal}
|
78
|
+
onClose={() => setShowModal(false)}
|
79
|
+
isFooterRequired={true}
|
80
|
+
_isExpanded={false}
|
81
|
+
size="medium"
|
82
|
+
>
|
83
|
+
<span>Drawer body</span>
|
84
|
+
</Drawer>
|
85
|
+
</>
|
86
|
+
);
|
87
|
+
},
|
88
|
+
};
|
@@ -0,0 +1,179 @@
|
|
1
|
+
import { createPortal } from 'react-dom';
|
2
|
+
import { DrawerProps } from './Types.js';
|
3
|
+
import Button from '../Button/Button.js';
|
4
|
+
import classNames from 'classnames';
|
5
|
+
import './Drawer.scss';
|
6
|
+
import { useEffect, useState } from 'react';
|
7
|
+
import Icon from '../Icon';
|
8
|
+
import useEscapeKey from '../../hooks/keyboardevents/useEscKeyEvent.js';
|
9
|
+
|
10
|
+
const Drawer = ({
|
11
|
+
isOpen = true,
|
12
|
+
children = 'Drawer content area',
|
13
|
+
onClose = () => {},
|
14
|
+
title = 'drawer',
|
15
|
+
primaryButtonProps = {},
|
16
|
+
secondaryButtonProps = {},
|
17
|
+
leftPrimaryButtonProps = {},
|
18
|
+
leftSecondaryButtonProps = {},
|
19
|
+
showEditButton = false,
|
20
|
+
onEdit = () => {},
|
21
|
+
overlay = false,
|
22
|
+
isFooterRequired = true,
|
23
|
+
footerContent = null,
|
24
|
+
size = 'medium',
|
25
|
+
_isExpanded = false,
|
26
|
+
isBackButtonVisible = false,
|
27
|
+
_isCloseModalButtonVisible = true,
|
28
|
+
}: DrawerProps) => {
|
29
|
+
const [isExpanded, setIsExpanded] = useState(_isExpanded);
|
30
|
+
|
31
|
+
const handleEsc = useEscapeKey('Escape');
|
32
|
+
|
33
|
+
handleEsc(onClose);
|
34
|
+
|
35
|
+
const toggleExpand = () => {
|
36
|
+
setIsExpanded((prev) => !prev);
|
37
|
+
};
|
38
|
+
|
39
|
+
const onCancel = () => {
|
40
|
+
if (secondaryButtonProps.onClick) {
|
41
|
+
secondaryButtonProps.onClick();
|
42
|
+
} else {
|
43
|
+
onClose();
|
44
|
+
}
|
45
|
+
};
|
46
|
+
|
47
|
+
useEffect(() => {
|
48
|
+
closeModal();
|
49
|
+
}, [isOpen]);
|
50
|
+
|
51
|
+
const closeModal = () => {
|
52
|
+
if (!isOpen) {
|
53
|
+
setTimeout(() => {
|
54
|
+
return null;
|
55
|
+
}, 1000);
|
56
|
+
}
|
57
|
+
};
|
58
|
+
|
59
|
+
const drawerSize = isExpanded ? 'x-large' : size;
|
60
|
+
|
61
|
+
return createPortal(
|
62
|
+
<div className="ff-drawer-container">
|
63
|
+
{overlay && <div className="ff-overlay" />}
|
64
|
+
|
65
|
+
<div
|
66
|
+
className={classNames('ff-drawer', `ff-drawer--${drawerSize}`, {
|
67
|
+
'ff-drawer--open': isOpen,
|
68
|
+
})}
|
69
|
+
>
|
70
|
+
<div className="ff-drawer-header">
|
71
|
+
<div className="ff-drawer-action-section">
|
72
|
+
<div className="ff-action-button">
|
73
|
+
{showEditButton && (
|
74
|
+
<button className="ff-expand-collapse-button" onClick={onEdit}>
|
75
|
+
{/* icons are not provided yet so using dummy icons */}
|
76
|
+
<Icon name="logo" height={16} width={16} />
|
77
|
+
Edit
|
78
|
+
</button>
|
79
|
+
)}
|
80
|
+
{_isExpanded && (
|
81
|
+
<button
|
82
|
+
className="ff-expand-collapse-button"
|
83
|
+
onClick={toggleExpand}
|
84
|
+
>
|
85
|
+
<Icon
|
86
|
+
name={isExpanded ? 'logo' : 'logo'}
|
87
|
+
height={16}
|
88
|
+
width={16}
|
89
|
+
/>
|
90
|
+
</button>
|
91
|
+
)}
|
92
|
+
{isBackButtonVisible && (
|
93
|
+
<button className="ff-expand-collapse-button" onClick={onClose}>
|
94
|
+
<Icon
|
95
|
+
name="error"
|
96
|
+
height={16}
|
97
|
+
width={16}
|
98
|
+
hoverEffect={false}
|
99
|
+
/>
|
100
|
+
</button>
|
101
|
+
)}
|
102
|
+
<div className="ff-drawer-title">{title}</div>
|
103
|
+
</div>
|
104
|
+
{_isCloseModalButtonVisible && (
|
105
|
+
<div>
|
106
|
+
<button onClick={onClose}>
|
107
|
+
<Icon
|
108
|
+
name="info"
|
109
|
+
height={16}
|
110
|
+
width={16}
|
111
|
+
hoverEffect={false}
|
112
|
+
/>
|
113
|
+
</button>
|
114
|
+
</div>
|
115
|
+
)}
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div
|
120
|
+
className={classNames('ff-drawer-body', {
|
121
|
+
'no-footer': !isFooterRequired,
|
122
|
+
})}
|
123
|
+
>
|
124
|
+
{children}
|
125
|
+
</div>
|
126
|
+
|
127
|
+
{isFooterRequired && (
|
128
|
+
<div className="ff-drawer-footer">
|
129
|
+
{footerContent ? (
|
130
|
+
footerContent
|
131
|
+
) : (
|
132
|
+
<>
|
133
|
+
<div className="button-container">
|
134
|
+
{leftSecondaryButtonProps.label && (
|
135
|
+
<Button
|
136
|
+
{...leftSecondaryButtonProps}
|
137
|
+
onClick={leftPrimaryButtonProps.onClick}
|
138
|
+
variant="secondary"
|
139
|
+
transparentBackground={true}
|
140
|
+
/>
|
141
|
+
)}
|
142
|
+
{leftPrimaryButtonProps.label && (
|
143
|
+
<Button
|
144
|
+
{...leftPrimaryButtonProps}
|
145
|
+
onClick={leftPrimaryButtonProps.onClick}
|
146
|
+
variant="primary"
|
147
|
+
transparentBackground={true}
|
148
|
+
/>
|
149
|
+
)}
|
150
|
+
</div>
|
151
|
+
<div className="button-container">
|
152
|
+
{secondaryButtonProps.label && (
|
153
|
+
<Button
|
154
|
+
{...secondaryButtonProps}
|
155
|
+
onClick={onCancel}
|
156
|
+
variant="secondary"
|
157
|
+
transparentBackground={true}
|
158
|
+
/>
|
159
|
+
)}
|
160
|
+
{primaryButtonProps.label && (
|
161
|
+
<Button
|
162
|
+
{...primaryButtonProps}
|
163
|
+
onClick={primaryButtonProps.onClick}
|
164
|
+
variant="primary"
|
165
|
+
transparentBackground={true}
|
166
|
+
/>
|
167
|
+
)}
|
168
|
+
</div>
|
169
|
+
</>
|
170
|
+
)}
|
171
|
+
</div>
|
172
|
+
)}
|
173
|
+
</div>
|
174
|
+
</div>,
|
175
|
+
document.body
|
176
|
+
);
|
177
|
+
};
|
178
|
+
|
179
|
+
export default Drawer;
|