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,104 @@
|
|
1
|
+
import { useState } from 'react';
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
3
|
+
import Tabs from './Tabs';
|
4
|
+
import Typography from '../Typography';
|
5
|
+
|
6
|
+
const meta: Meta<typeof Tabs> = {
|
7
|
+
title: 'Components/Tabs',
|
8
|
+
component: Tabs,
|
9
|
+
parameters: {
|
10
|
+
layout: 'centered',
|
11
|
+
},
|
12
|
+
tags: ['autodocs'],
|
13
|
+
};
|
14
|
+
|
15
|
+
type Story = StoryObj<typeof Tabs>;
|
16
|
+
|
17
|
+
const TabContentOne = () => (
|
18
|
+
<div>
|
19
|
+
<Typography as="h1" children="Tab--1" fontSize={32} fontWeight="bold" />
|
20
|
+
<Typography as="p" children="This is the content for Tab - 1" />
|
21
|
+
</div>
|
22
|
+
);
|
23
|
+
const TabContentTwo = () => (
|
24
|
+
<div>
|
25
|
+
<Typography as="h1" children="Tab--2" fontSize={32} fontWeight="bold" />
|
26
|
+
<Typography as="p" children="This is the content for Tab - 2" />
|
27
|
+
</div>
|
28
|
+
);
|
29
|
+
const TabContentThree = () => (
|
30
|
+
<div>
|
31
|
+
<Typography as="h1" children="Tab--3" fontSize={32} fontWeight="bold" />
|
32
|
+
<Typography as="p" children="This is the content for Tab - 3" />
|
33
|
+
</div>
|
34
|
+
);
|
35
|
+
const TabContentFour = () => (
|
36
|
+
<div>
|
37
|
+
<Typography as="h1" children="Tab--4" fontSize={32} fontWeight="bold" />
|
38
|
+
<Typography as="p" children="This is the content for Tab - 4" />
|
39
|
+
</div>
|
40
|
+
);
|
41
|
+
|
42
|
+
export const DefaultTabs: Story = {
|
43
|
+
render: () => {
|
44
|
+
const [activeTabIdDefault, setActiveTabIdDefault] = useState<string>('0');
|
45
|
+
|
46
|
+
const tabsData = [
|
47
|
+
{ label: 'Tab--1', component: <TabContentOne /> },
|
48
|
+
{ label: 'Tab--2', component: <TabContentTwo /> },
|
49
|
+
{ label: 'Tab--3', component: <TabContentThree /> },
|
50
|
+
];
|
51
|
+
|
52
|
+
return (
|
53
|
+
<Tabs
|
54
|
+
tabsData={tabsData}
|
55
|
+
activeTabId={activeTabIdDefault}
|
56
|
+
onTabClick={setActiveTabIdDefault}
|
57
|
+
/>
|
58
|
+
);
|
59
|
+
},
|
60
|
+
};
|
61
|
+
export const CapsuleTabs: Story = {
|
62
|
+
render: () => {
|
63
|
+
const [activeTabIdCapsule, setActiveTabIdCapsule] = useState<string>('0');
|
64
|
+
|
65
|
+
const tabsDataForCapsule = [
|
66
|
+
{ label: 'Loremipsum_1', component: <TabContentOne /> },
|
67
|
+
{ label: 'Loremipsum_2', component: <TabContentTwo /> },
|
68
|
+
{ label: 'Loremipsum_3', component: <TabContentThree /> },
|
69
|
+
{ label: 'Loremipsum_4', component: <TabContentFour /> },
|
70
|
+
{ label: 'Loremipsum_5', component: <TabContentFour /> },
|
71
|
+
];
|
72
|
+
|
73
|
+
return (
|
74
|
+
<Tabs
|
75
|
+
variant={'capsule'}
|
76
|
+
tabsData={tabsDataForCapsule}
|
77
|
+
activeTabId={activeTabIdCapsule}
|
78
|
+
onTabClick={setActiveTabIdCapsule}
|
79
|
+
/>
|
80
|
+
);
|
81
|
+
},
|
82
|
+
};
|
83
|
+
|
84
|
+
export const TabsWithDisabledTab: Story = {
|
85
|
+
render: () => {
|
86
|
+
const [activeTabId, setActiveTabId] = useState<string>('0');
|
87
|
+
|
88
|
+
const tabsDataWithOneDisableAttribute = [
|
89
|
+
{ label: 'Tab--1', component: <TabContentOne /> },
|
90
|
+
{ label: 'Tab--2', component: <TabContentTwo />, disabled: true },
|
91
|
+
{ label: 'Tab--3', component: <TabContentThree /> },
|
92
|
+
];
|
93
|
+
|
94
|
+
return (
|
95
|
+
<Tabs
|
96
|
+
tabsData={tabsDataWithOneDisableAttribute}
|
97
|
+
activeTabId={activeTabId}
|
98
|
+
onTabClick={setActiveTabId}
|
99
|
+
/>
|
100
|
+
);
|
101
|
+
},
|
102
|
+
};
|
103
|
+
|
104
|
+
export default meta;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { TabsProps } from './types';
|
2
|
+
import './Tabs.scss';
|
3
|
+
import classNames from 'classnames';
|
4
|
+
import Typography from '../Typography';
|
5
|
+
import '../../assets/styles/_colors.scss';
|
6
|
+
|
7
|
+
const Tabs = ({
|
8
|
+
variant = 'default',
|
9
|
+
tabsData,
|
10
|
+
activeTabId,
|
11
|
+
onTabClick,
|
12
|
+
}: TabsProps) => {
|
13
|
+
const tabs = tabsData.map((tab, index) => ({
|
14
|
+
id: index.toString(),
|
15
|
+
label: tab.label,
|
16
|
+
component: tab.component,
|
17
|
+
disabled: tab.disabled,
|
18
|
+
}));
|
19
|
+
|
20
|
+
return (
|
21
|
+
<div className={`ff-tabs-container`}>
|
22
|
+
<div className={`ff-tab-row--${variant}`}>
|
23
|
+
{tabs.map((tab) => (
|
24
|
+
<button
|
25
|
+
key={tab.id}
|
26
|
+
onClick={() => !tab.disabled && onTabClick(tab.id)}
|
27
|
+
disabled={tab.disabled}
|
28
|
+
className={classNames(`ff-tab-button--${variant}`, {
|
29
|
+
disabled: tab.disabled,
|
30
|
+
active: activeTabId === tab.id,
|
31
|
+
})}
|
32
|
+
>
|
33
|
+
<Typography
|
34
|
+
children={tab.label}
|
35
|
+
lineHeight="18px"
|
36
|
+
fontWeight={activeTabId === tab.id ? 'semi-bold' : 'regular'}
|
37
|
+
color={
|
38
|
+
activeTabId === tab.id
|
39
|
+
? 'var(--tabs-label-active-color)'
|
40
|
+
: 'var(--tabs-label-default-color)'
|
41
|
+
}
|
42
|
+
className={classNames('ff-tab-label', {
|
43
|
+
'ff-tab-label--active': activeTabId === tab.id,
|
44
|
+
})}
|
45
|
+
/>
|
46
|
+
|
47
|
+
<Typography
|
48
|
+
children=""
|
49
|
+
color=""
|
50
|
+
className={classNames('ff-tab-bar', {
|
51
|
+
'ff-tab-bar--active': activeTabId === tab.id,
|
52
|
+
})}
|
53
|
+
/>
|
54
|
+
</button>
|
55
|
+
))}
|
56
|
+
</div>
|
57
|
+
<div className={`ff-tab-content`}>
|
58
|
+
{tabs.find((tab) => tab.id === activeTabId)?.component}
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
);
|
62
|
+
};
|
63
|
+
|
64
|
+
export default Tabs;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Tabs';
|
@@ -0,0 +1,38 @@
|
|
1
|
+
export interface Tab {
|
2
|
+
/**
|
3
|
+
* Unique identifier for the tab, for handling click events.
|
4
|
+
*/
|
5
|
+
id: string;
|
6
|
+
/**
|
7
|
+
* Display label for the tab.
|
8
|
+
*/
|
9
|
+
label: string;
|
10
|
+
/**
|
11
|
+
* The content to display when this tab is active.
|
12
|
+
*/
|
13
|
+
component: JSX.Element | React.ReactNode;
|
14
|
+
/**
|
15
|
+
* Optional property to indicate if the tab is disabled.
|
16
|
+
*/
|
17
|
+
disabled?: boolean;
|
18
|
+
}
|
19
|
+
|
20
|
+
export interface TabsProps {
|
21
|
+
/**
|
22
|
+
* An array of tab objects containing label, component, and optional disabled status.
|
23
|
+
*/
|
24
|
+
tabsData: { label: string; component: JSX.Element; disabled?: boolean }[];
|
25
|
+
/**
|
26
|
+
* Defines the styling variant of the tabs.
|
27
|
+
*/
|
28
|
+
variant?: 'default' | 'capsule';
|
29
|
+
/**
|
30
|
+
* activeTabId : The ID of the currently active tab.
|
31
|
+
*/
|
32
|
+
activeTabId: string;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* onTabClick : function updates the active tab state when a user interacts with the tabs,
|
36
|
+
*/
|
37
|
+
onTabClick: (id: string) => void;
|
38
|
+
}
|
@@ -0,0 +1,145 @@
|
|
1
|
+
@use '../../assets/styles/colors' as *;
|
2
|
+
@import '../../assets/styles/fonts';
|
3
|
+
|
4
|
+
.ff-textarea-container {
|
5
|
+
display: flex;
|
6
|
+
flex-direction: column;
|
7
|
+
position: relative;
|
8
|
+
gap: 5px;
|
9
|
+
@extend .fontSm;
|
10
|
+
.msg-character-count {
|
11
|
+
@extend .font-size-8;
|
12
|
+
display: flex;
|
13
|
+
color: var(--text-area-default-color);
|
14
|
+
justify-content: flex-end;
|
15
|
+
}
|
16
|
+
.ff-textarea {
|
17
|
+
padding: 8px;
|
18
|
+
min-width: 428px;
|
19
|
+
min-height: 80px;
|
20
|
+
gap: 0px;
|
21
|
+
border: 1px solid var(--default-icon-color);
|
22
|
+
border-radius: 4px;
|
23
|
+
outline: none;
|
24
|
+
line-height: 18px;
|
25
|
+
font-weight: 400;
|
26
|
+
&--resize {
|
27
|
+
resize: none;
|
28
|
+
}
|
29
|
+
&:disabled {
|
30
|
+
opacity: 0.5;
|
31
|
+
cursor: not-allowed;
|
32
|
+
&:hover {
|
33
|
+
border-color: var(--default-icon-color);
|
34
|
+
color: inherit;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
&::placeholder {
|
38
|
+
opacity: 0;
|
39
|
+
}
|
40
|
+
&--danger {
|
41
|
+
border-color: var(--error_light);
|
42
|
+
}
|
43
|
+
&--transparentBackground {
|
44
|
+
background: transparent;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
.ff-textarea-label-container {
|
49
|
+
@extend .ff-textarea;
|
50
|
+
display: flex;
|
51
|
+
position: absolute;
|
52
|
+
border: none;
|
53
|
+
outline: none;
|
54
|
+
margin-top: 1px;
|
55
|
+
transition: all 0.3s ease-in-out;
|
56
|
+
|
57
|
+
.ff-textarea-label {
|
58
|
+
padding: 1px;
|
59
|
+
height: 10px;
|
60
|
+
width: auto;
|
61
|
+
background-color: var(--drawer-footer-bg);
|
62
|
+
color: var(--text-area-default-color);
|
63
|
+
&--danger {
|
64
|
+
color: var(--error_light);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
.required-asterisk {
|
69
|
+
color: var(--error_light);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
&:hover {
|
73
|
+
.ff-textarea-label {
|
74
|
+
color: var(--text-color);
|
75
|
+
}
|
76
|
+
.ff-textarea {
|
77
|
+
border-color: var(--text-color);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
&:focus-within {
|
81
|
+
.ff-textarea-label-container {
|
82
|
+
font-weight: 400;
|
83
|
+
line-height: 12px;
|
84
|
+
letter-spacing: 0.5px;
|
85
|
+
text-align: left;
|
86
|
+
top: -6px;
|
87
|
+
@extend .font-size-8;
|
88
|
+
background-color: transparent;
|
89
|
+
padding: 0px 2px;
|
90
|
+
margin-left: 7px;
|
91
|
+
}
|
92
|
+
.ff-textarea-label {
|
93
|
+
&--primary {
|
94
|
+
color: var(--brand-color);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
.ff-textarea {
|
98
|
+
&--primary {
|
99
|
+
border-color: var(--brand-color);
|
100
|
+
}
|
101
|
+
|
102
|
+
&::placeholder {
|
103
|
+
opacity: 1;
|
104
|
+
margin-bottom: 1px;
|
105
|
+
@extend .font-size-8;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
.ff-textarea-message {
|
111
|
+
@extend .font-size-8;
|
112
|
+
padding: 0px 4px;
|
113
|
+
margin-left: 8px;
|
114
|
+
line-height: 12px;
|
115
|
+
&--danger {
|
116
|
+
color: var(--error_light);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
&--float {
|
121
|
+
.ff-textarea-label-container {
|
122
|
+
letter-spacing: 0.5px;
|
123
|
+
top: -6px;
|
124
|
+
@extend .font-size-8;
|
125
|
+
background-color: transparent;
|
126
|
+
line-height: 12px;
|
127
|
+
padding: 0px 2px;
|
128
|
+
margin-left: 7px;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
&--disabled {
|
132
|
+
&:hover {
|
133
|
+
.ff-textarea-label {
|
134
|
+
color: var(--text-area-default-color);
|
135
|
+
}
|
136
|
+
.ff-textarea {
|
137
|
+
border-color: var(--default-icon-color);
|
138
|
+
}
|
139
|
+
}
|
140
|
+
cursor: not-allowed;
|
141
|
+
.ff-textarea-label-container {
|
142
|
+
cursor: not-allowed;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import Textarea from './Textarea';
|
3
|
+
import { ChangeEvent, useState } from 'react';
|
4
|
+
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
5
|
+
const meta: Meta<typeof Textarea> = {
|
6
|
+
title: 'Components/Textarea',
|
7
|
+
component: Textarea,
|
8
|
+
parameters: {
|
9
|
+
layout: 'centered',
|
10
|
+
},
|
11
|
+
tags: ['autodocs'],
|
12
|
+
};
|
13
|
+
|
14
|
+
type Story = StoryObj<typeof Textarea>;
|
15
|
+
|
16
|
+
const defaultArgs = {
|
17
|
+
name: 'textarea',
|
18
|
+
label: '',
|
19
|
+
disabled: false,
|
20
|
+
placeholder: 'Type Your Description Here',
|
21
|
+
value: '',
|
22
|
+
variant: 'primary',
|
23
|
+
rows: 4,
|
24
|
+
cols: 30,
|
25
|
+
capacity: 200,
|
26
|
+
resize: false,
|
27
|
+
};
|
28
|
+
|
29
|
+
export const Default: Story = {
|
30
|
+
args: {
|
31
|
+
...defaultArgs,
|
32
|
+
label: 'Description',
|
33
|
+
variant: 'default',
|
34
|
+
},
|
35
|
+
};
|
36
|
+
export const Primary: Story = {
|
37
|
+
args: {
|
38
|
+
...defaultArgs,
|
39
|
+
label: 'Description',
|
40
|
+
variant: 'primary',
|
41
|
+
},
|
42
|
+
};
|
43
|
+
export const Disabled: Story = {
|
44
|
+
args: {
|
45
|
+
...defaultArgs,
|
46
|
+
label: 'Description',
|
47
|
+
variant: 'primary',
|
48
|
+
disabled: true,
|
49
|
+
},
|
50
|
+
};
|
51
|
+
|
52
|
+
export const Controlled: Story = {
|
53
|
+
render: () => {
|
54
|
+
const [value, setValue] = useState<string>('');
|
55
|
+
const [error, setError] = useState<boolean>(false);
|
56
|
+
const [helperText, setHelperText] = useState<string>();
|
57
|
+
|
58
|
+
const onChangeHandler = (event: ChangeEvent<HTMLTextAreaElement>) => {
|
59
|
+
const value = event.target.value;
|
60
|
+
if (event.target.required) {
|
61
|
+
if (checkEmpty(value)) {
|
62
|
+
setError(true);
|
63
|
+
setHelperText(`${event?.target?.name} is required`);
|
64
|
+
} else {
|
65
|
+
setError(false);
|
66
|
+
setHelperText('');
|
67
|
+
}
|
68
|
+
}
|
69
|
+
setValue(value);
|
70
|
+
};
|
71
|
+
return (
|
72
|
+
<>
|
73
|
+
<Textarea
|
74
|
+
{...defaultArgs}
|
75
|
+
onChange={onChangeHandler}
|
76
|
+
disabled={false}
|
77
|
+
capacity={200}
|
78
|
+
value={value}
|
79
|
+
name="Description"
|
80
|
+
label="Description"
|
81
|
+
placeholder="Type Your Description Here"
|
82
|
+
variant="primary"
|
83
|
+
required={false}
|
84
|
+
error={error}
|
85
|
+
helperText={helperText}
|
86
|
+
/>
|
87
|
+
</>
|
88
|
+
);
|
89
|
+
},
|
90
|
+
};
|
91
|
+
|
92
|
+
export default meta;
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import classNames from 'classnames';
|
2
|
+
import './Textarea.scss';
|
3
|
+
import { TextareaProps } from './Types';
|
4
|
+
import { truncateText } from '../../utils/truncateText/truncateText';
|
5
|
+
const Textarea = ({
|
6
|
+
capacity = 200,
|
7
|
+
name,
|
8
|
+
label,
|
9
|
+
value,
|
10
|
+
variant = 'primary',
|
11
|
+
error,
|
12
|
+
helperText = '',
|
13
|
+
disabled = false,
|
14
|
+
required = false,
|
15
|
+
placeholder = 'Enter text',
|
16
|
+
className = '',
|
17
|
+
onChange,
|
18
|
+
onBlur,
|
19
|
+
onFocus,
|
20
|
+
rows = 4,
|
21
|
+
cols = 40,
|
22
|
+
resize = false,
|
23
|
+
...props
|
24
|
+
}: TextareaProps) => {
|
25
|
+
return (
|
26
|
+
<div
|
27
|
+
className={classNames('ff-textarea-container', {
|
28
|
+
'ff-textarea-container--disabled': disabled,
|
29
|
+
'ff-textarea-container--float': !!value,
|
30
|
+
})}
|
31
|
+
>
|
32
|
+
<label
|
33
|
+
htmlFor={name}
|
34
|
+
className={classNames('ff-textarea-label-container', {
|
35
|
+
'ff-textarea-label-container--danger': error,
|
36
|
+
})}
|
37
|
+
>
|
38
|
+
<span
|
39
|
+
className={classNames(
|
40
|
+
`ff-textarea-label ff-textarea-label--${variant}`,
|
41
|
+
{
|
42
|
+
'ff-textarea-label--danger': error,
|
43
|
+
}
|
44
|
+
)}
|
45
|
+
>
|
46
|
+
{required && <span className="required-asterisk">*</span>}
|
47
|
+
{label}
|
48
|
+
</span>
|
49
|
+
</label>
|
50
|
+
<textarea
|
51
|
+
maxLength={capacity}
|
52
|
+
name={name}
|
53
|
+
value={value}
|
54
|
+
id={name}
|
55
|
+
className={classNames(
|
56
|
+
`ff-textarea ff-textarea--${variant}`,
|
57
|
+
className,
|
58
|
+
{
|
59
|
+
'ff-textarea--danger': error,
|
60
|
+
'ff-textarea--resize': !resize,
|
61
|
+
}
|
62
|
+
)}
|
63
|
+
placeholder={truncateText(placeholder, 25)}
|
64
|
+
disabled={disabled}
|
65
|
+
onChange={onChange}
|
66
|
+
onBlur={onBlur}
|
67
|
+
onFocus={onFocus}
|
68
|
+
required={required}
|
69
|
+
rows={rows}
|
70
|
+
cols={cols}
|
71
|
+
{...props}
|
72
|
+
/>
|
73
|
+
<div className="msg-character-count">
|
74
|
+
{!!capacity && (
|
75
|
+
<span>
|
76
|
+
<span>{value?.length}</span>/{capacity}
|
77
|
+
</span>
|
78
|
+
)}
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
);
|
82
|
+
};
|
83
|
+
|
84
|
+
export default Textarea;
|
@@ -0,0 +1,82 @@
|
|
1
|
+
export interface TextareaProps {
|
2
|
+
/**
|
3
|
+
* Name | name of the textarea field
|
4
|
+
*/
|
5
|
+
name: string;
|
6
|
+
/**
|
7
|
+
* Label | field label to be displayed
|
8
|
+
*/
|
9
|
+
label: string;
|
10
|
+
/**
|
11
|
+
* value | textarea field value
|
12
|
+
*/
|
13
|
+
value: string;
|
14
|
+
/**
|
15
|
+
* variants to set color/style of the textarea field
|
16
|
+
*/
|
17
|
+
variant?: 'default' | 'primary';
|
18
|
+
/**
|
19
|
+
* error | If true, error message will be displayed
|
20
|
+
*/
|
21
|
+
error?: boolean;
|
22
|
+
/**
|
23
|
+
* helperText | error, success, warning message to be shown
|
24
|
+
*/
|
25
|
+
helperText?: string;
|
26
|
+
/**
|
27
|
+
* to disable the textarea field
|
28
|
+
*/
|
29
|
+
disabled?: boolean;
|
30
|
+
/**
|
31
|
+
* if true, textarea field will be mandatory
|
32
|
+
*/
|
33
|
+
required?: boolean;
|
34
|
+
/**
|
35
|
+
* placeholder for the textarea field
|
36
|
+
*/
|
37
|
+
placeholder?: string;
|
38
|
+
/**
|
39
|
+
* classnames to style the textarea field
|
40
|
+
*/
|
41
|
+
className?: string;
|
42
|
+
/**
|
43
|
+
* onChange, onKeyDown, onBlur, onFocus actions
|
44
|
+
*/
|
45
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
46
|
+
|
47
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
48
|
+
|
49
|
+
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
50
|
+
|
51
|
+
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
|
52
|
+
/**
|
53
|
+
* id to select the textarea field uniquely
|
54
|
+
*/
|
55
|
+
id?: string;
|
56
|
+
/**
|
57
|
+
* if on, suggestion popup will be displayed
|
58
|
+
*/
|
59
|
+
autoComplete?: 'on' | 'off';
|
60
|
+
/**
|
61
|
+
* background of the textarea field prop
|
62
|
+
*/
|
63
|
+
|
64
|
+
/**
|
65
|
+
* capacity | Maximum number of characters allowed in the textarea.
|
66
|
+
*/
|
67
|
+
capacity?: number;
|
68
|
+
/**
|
69
|
+
* rows | Number of visible text lines in the textarea.
|
70
|
+
* Used to control the height of the textarea.
|
71
|
+
*/
|
72
|
+
rows?: number;
|
73
|
+
/**
|
74
|
+
* cols | Number of visible character widths in the textarea.
|
75
|
+
* Used to control the width of the textarea.
|
76
|
+
*/
|
77
|
+
cols?: number;
|
78
|
+
/**
|
79
|
+
* for resizing purpose
|
80
|
+
*/
|
81
|
+
resize?: boolean;
|
82
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './Textarea';
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React, { createContext, useState } from 'react';
|
2
|
+
import { ThemeContextType, ThemeProviderProps, Theme } from './types';
|
3
|
+
import '../../assets/Themes/Theme.scss';
|
4
|
+
|
5
|
+
const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
|
6
|
+
|
7
|
+
const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, theme }) => {
|
8
|
+
const [currentTheme, setCurrentTheme] = useState<Theme>(
|
9
|
+
theme || 'ff-light-theme'
|
10
|
+
);
|
11
|
+
|
12
|
+
const applyTheme = (newTheme: Theme) => setCurrentTheme(newTheme);
|
13
|
+
|
14
|
+
return (
|
15
|
+
<ThemeContext.Provider
|
16
|
+
value={{ currentTheme, setCurrentTheme, applyTheme }}
|
17
|
+
>
|
18
|
+
<div className={currentTheme}>{children}</div>
|
19
|
+
</ThemeContext.Provider>
|
20
|
+
);
|
21
|
+
};
|
22
|
+
|
23
|
+
export { ThemeContext };
|
24
|
+
export default ThemeProvider;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './ThemeProvider';
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { ReactNode } from "react";
|
2
|
+
|
3
|
+
export type Theme = 'ff-light-theme' | 'ff-dark-theme' | 'ff-grey-theme';
|
4
|
+
|
5
|
+
export interface ThemeContextType {
|
6
|
+
currentTheme: Theme;
|
7
|
+
setCurrentTheme: React.Dispatch<React.SetStateAction<Theme>>;
|
8
|
+
applyTheme: (newTheme: Theme) => void;
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface ThemeProviderProps {
|
12
|
+
children?: ReactNode;
|
13
|
+
theme?: Theme;
|
14
|
+
}
|