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,150 @@
|
|
1
|
+
@use '../../assets/styles/fonts';
|
2
|
+
|
3
|
+
.ff-input-container {
|
4
|
+
display: flex;
|
5
|
+
flex-direction: column;
|
6
|
+
position: relative;
|
7
|
+
|
8
|
+
.ff-input {
|
9
|
+
padding: 6px 8px;
|
10
|
+
border: 1px solid var(--input-default-border-color);
|
11
|
+
border-radius: 4px;
|
12
|
+
outline: none;
|
13
|
+
line-height: 18px;
|
14
|
+
@extend .fontSm;
|
15
|
+
&:disabled {
|
16
|
+
cursor: not-allowed;
|
17
|
+
}
|
18
|
+
&::placeholder {
|
19
|
+
opacity: 0;
|
20
|
+
line-height: 18px;
|
21
|
+
}
|
22
|
+
&--disabled {
|
23
|
+
background: transparent;
|
24
|
+
border-color: var(--input-default-border-color);
|
25
|
+
}
|
26
|
+
&--danger {
|
27
|
+
border-color: var(--input-error-text-color);
|
28
|
+
}
|
29
|
+
&--transparentBackground {
|
30
|
+
background: transparent;
|
31
|
+
}
|
32
|
+
&--no-border {
|
33
|
+
border: none;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
.ff-input-label-container {
|
38
|
+
@extend .ff-input;
|
39
|
+
display: flex;
|
40
|
+
gap: 2px;
|
41
|
+
position: absolute;
|
42
|
+
border: none;
|
43
|
+
outline: none;
|
44
|
+
line-height: 18px;
|
45
|
+
margin-top: 1px;
|
46
|
+
transition: all 0.3s ease-in-out;
|
47
|
+
|
48
|
+
.ff-input-label {
|
49
|
+
color: var(--input-default-label-color);
|
50
|
+
&--danger {
|
51
|
+
color: var(--input-error-text-color);
|
52
|
+
}
|
53
|
+
&--disabled {
|
54
|
+
color: var(--input-default-border-color);
|
55
|
+
background-color: var(--input-label-bg-color);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
.required-asterisk {
|
60
|
+
color: var(--input-error-text-color);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
&:hover {
|
64
|
+
.ff-input-label {
|
65
|
+
color: var(--input-hover-border-color);
|
66
|
+
&--no-hover {
|
67
|
+
color: var(--input-default-label-color);
|
68
|
+
}
|
69
|
+
&--disabled {
|
70
|
+
color: var(--input-default-border-color);
|
71
|
+
}
|
72
|
+
&--danger {
|
73
|
+
color: var(--input-error-text-color);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
.ff-input {
|
77
|
+
border-color: var(--input-hover-border-color);
|
78
|
+
&--no-hover {
|
79
|
+
border-color: var(--input-default-border-color);
|
80
|
+
}
|
81
|
+
&--disabled {
|
82
|
+
background: transparent;
|
83
|
+
border-color: var(--input-default-border-color);
|
84
|
+
}
|
85
|
+
&--danger {
|
86
|
+
border-color: var(--input-error-text-color);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
&:focus-within {
|
91
|
+
.ff-input-label-container {
|
92
|
+
top: -6px;
|
93
|
+
@extend .font-size-8;
|
94
|
+
background-color: var(--input-label-bg-color);
|
95
|
+
line-height: 12px;
|
96
|
+
padding: 0px 2px;
|
97
|
+
margin-left: 10px;
|
98
|
+
}
|
99
|
+
.ff-input-label {
|
100
|
+
&--primary {
|
101
|
+
color: var(--brand-color);
|
102
|
+
}
|
103
|
+
&--danger {
|
104
|
+
color: var(--input-error-text-color);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
.ff-input {
|
108
|
+
&--primary {
|
109
|
+
border-color: var(--brand-color);
|
110
|
+
}
|
111
|
+
&--danger {
|
112
|
+
border-color: var(--input-error-text-color);
|
113
|
+
}
|
114
|
+
|
115
|
+
&::placeholder {
|
116
|
+
opacity: 1;
|
117
|
+
margin-bottom: 1px;
|
118
|
+
@extend .font-size-8;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
.ff-input-message {
|
124
|
+
@extend .font-size-8;
|
125
|
+
padding: 0px 4px;
|
126
|
+
margin-left: 8px;
|
127
|
+
line-height: 12px;
|
128
|
+
&--danger {
|
129
|
+
color: var(--input-error-text-color);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
&--float {
|
134
|
+
.ff-input-label-container {
|
135
|
+
//re-written label container code to place it at on border
|
136
|
+
top: -6px;
|
137
|
+
@extend .font-size-8;
|
138
|
+
background-color: var(--input-label-bg-color);
|
139
|
+
line-height: 12px;
|
140
|
+
padding: 0px 2px;
|
141
|
+
margin-left: 10px;
|
142
|
+
}
|
143
|
+
&--disabled {
|
144
|
+
cursor: not-allowed;
|
145
|
+
.ff-input-label-container {
|
146
|
+
cursor: not-allowed;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import Input from './Input';
|
3
|
+
import { ChangeEvent, useState } from 'react';
|
4
|
+
|
5
|
+
const meta: Meta<typeof Input> = {
|
6
|
+
title: 'Components/Input',
|
7
|
+
component: Input,
|
8
|
+
parameters: {
|
9
|
+
layout: 'centered',
|
10
|
+
},
|
11
|
+
tags: ['autodocs'],
|
12
|
+
};
|
13
|
+
|
14
|
+
type Story = StoryObj<typeof Input>;
|
15
|
+
|
16
|
+
const defaultArgs = {
|
17
|
+
name: 'input',
|
18
|
+
label: '',
|
19
|
+
disabled: false,
|
20
|
+
placeholder: 'Enter your name',
|
21
|
+
value: '',
|
22
|
+
type: 'text',
|
23
|
+
};
|
24
|
+
|
25
|
+
export const Default: Story = {
|
26
|
+
args: {
|
27
|
+
...defaultArgs,
|
28
|
+
label: 'Name',
|
29
|
+
variant: 'default',
|
30
|
+
type: 'text',
|
31
|
+
},
|
32
|
+
};
|
33
|
+
export const Primary: Story = {
|
34
|
+
args: {
|
35
|
+
...defaultArgs,
|
36
|
+
label: 'Name',
|
37
|
+
variant: 'primary',
|
38
|
+
type: 'text',
|
39
|
+
},
|
40
|
+
};
|
41
|
+
export const DisabledWithValue: Story = {
|
42
|
+
args: {
|
43
|
+
...defaultArgs,
|
44
|
+
label: 'Name',
|
45
|
+
variant: 'primary',
|
46
|
+
type: 'text',
|
47
|
+
value: 'Disabled',
|
48
|
+
disabled: true,
|
49
|
+
required: true,
|
50
|
+
},
|
51
|
+
};
|
52
|
+
|
53
|
+
export const Controlled: Story = {
|
54
|
+
render: () => {
|
55
|
+
const [value, setValue] = useState<string>('');
|
56
|
+
const [error, setError] = useState<boolean>(false);
|
57
|
+
const [helperText, setHelperText] = useState<string>();
|
58
|
+
|
59
|
+
const onChangeHandler = (event: ChangeEvent<HTMLInputElement>) => {
|
60
|
+
const value = event.target.value;
|
61
|
+
if (event.target.required) {
|
62
|
+
if (value.length <= 0) {
|
63
|
+
setError(true);
|
64
|
+
setHelperText(`${event?.target?.name} is required`);
|
65
|
+
} else if (value.length >= 10) {
|
66
|
+
setError(true);
|
67
|
+
setHelperText(`Name should be within 10 characters`);
|
68
|
+
} else {
|
69
|
+
setError(false);
|
70
|
+
setHelperText('');
|
71
|
+
}
|
72
|
+
}
|
73
|
+
setValue(value);
|
74
|
+
};
|
75
|
+
return (
|
76
|
+
<>
|
77
|
+
<Input
|
78
|
+
{...defaultArgs}
|
79
|
+
type="text"
|
80
|
+
onChange={onChangeHandler}
|
81
|
+
disabled={false}
|
82
|
+
value={value}
|
83
|
+
name="Name"
|
84
|
+
label="Name"
|
85
|
+
placeholder="Enter name here"
|
86
|
+
variant="primary"
|
87
|
+
required={true}
|
88
|
+
error={error}
|
89
|
+
helperText={helperText}
|
90
|
+
/>
|
91
|
+
</>
|
92
|
+
);
|
93
|
+
},
|
94
|
+
};
|
95
|
+
|
96
|
+
export default meta;
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import classNames from 'classnames';
|
2
|
+
import './Input.scss';
|
3
|
+
import { InputProps } from './types';
|
4
|
+
|
5
|
+
const Input = ({
|
6
|
+
type = 'text',
|
7
|
+
variant = 'primary',
|
8
|
+
name = '',
|
9
|
+
label,
|
10
|
+
disabled = false,
|
11
|
+
required = false,
|
12
|
+
placeholder = 'Enter input',
|
13
|
+
value = '',
|
14
|
+
helperText = '',
|
15
|
+
error,
|
16
|
+
noBorder,
|
17
|
+
className = '',
|
18
|
+
onChange,
|
19
|
+
onBlur,
|
20
|
+
onFocus,
|
21
|
+
autoComplete = 'off',
|
22
|
+
minValue = -Infinity,
|
23
|
+
maxValue = Infinity,
|
24
|
+
transparentBackground = false,
|
25
|
+
...props
|
26
|
+
}: InputProps) => {
|
27
|
+
return (
|
28
|
+
<div
|
29
|
+
className={classNames('ff-input-container', {
|
30
|
+
'ff-input-container--float': !!value,
|
31
|
+
'ff-input-container--disabled': !!disabled,
|
32
|
+
})}
|
33
|
+
>
|
34
|
+
<label
|
35
|
+
htmlFor={name}
|
36
|
+
className={classNames('ff-input-label-container', {
|
37
|
+
'ff-input-label-container--danger': !!error,
|
38
|
+
})}
|
39
|
+
>
|
40
|
+
{required && <span className="required-asterisk">*</span>}
|
41
|
+
<span
|
42
|
+
className={classNames(`ff-input-label ff-input-label--${variant}`, {
|
43
|
+
'ff-input-label--no-hover': !!value,
|
44
|
+
'ff-input-label--disabled': !!disabled,
|
45
|
+
'ff-input-label--danger': !!error,
|
46
|
+
})}
|
47
|
+
>
|
48
|
+
{label}
|
49
|
+
</span>
|
50
|
+
</label>
|
51
|
+
<input
|
52
|
+
name={name}
|
53
|
+
value={value}
|
54
|
+
type={type}
|
55
|
+
spellCheck={false}
|
56
|
+
id={name}
|
57
|
+
className={classNames(
|
58
|
+
`ff-input ff-input--${variant} default-input `,
|
59
|
+
{
|
60
|
+
['ff-input--transparentBackground']: !!transparentBackground,
|
61
|
+
'ff-input--no-hover': !!value,
|
62
|
+
'ff-input--disabled': !!disabled,
|
63
|
+
'ff-input--danger': !!error,
|
64
|
+
'ff-input--no-border': !!noBorder,
|
65
|
+
},
|
66
|
+
`${className}`
|
67
|
+
)}
|
68
|
+
placeholder={placeholder}
|
69
|
+
disabled={disabled}
|
70
|
+
onChange={onChange}
|
71
|
+
onFocus={onFocus}
|
72
|
+
onBlur={onBlur}
|
73
|
+
required={required}
|
74
|
+
autoComplete={autoComplete}
|
75
|
+
min={minValue}
|
76
|
+
max={maxValue}
|
77
|
+
{...props}
|
78
|
+
/>
|
79
|
+
|
80
|
+
{helperText && error && (
|
81
|
+
<span
|
82
|
+
className={classNames('ff-input-message', {
|
83
|
+
'ff-input-message--danger': !!error,
|
84
|
+
})}
|
85
|
+
>
|
86
|
+
{helperText}
|
87
|
+
</span>
|
88
|
+
)}
|
89
|
+
</div>
|
90
|
+
);
|
91
|
+
};
|
92
|
+
|
93
|
+
export default Input;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {default} from './Input'
|
@@ -0,0 +1,77 @@
|
|
1
|
+
export interface InputProps {
|
2
|
+
/**
|
3
|
+
* Name | name of the input field
|
4
|
+
*/
|
5
|
+
name: string;
|
6
|
+
/**
|
7
|
+
* Label | field label to be displayed
|
8
|
+
*/
|
9
|
+
label: string;
|
10
|
+
/**
|
11
|
+
* value | input field value
|
12
|
+
*/
|
13
|
+
value: string | number;
|
14
|
+
/**
|
15
|
+
* variants to set color/style of the input field
|
16
|
+
*/
|
17
|
+
variant?: 'default' | 'primary';
|
18
|
+
/**
|
19
|
+
* type to set color/style of the input field
|
20
|
+
*/
|
21
|
+
type: 'text' | 'password' | 'number' | 'email' | 'url' | 'time';
|
22
|
+
/**
|
23
|
+
* error | If true, error message will be displayed
|
24
|
+
*/
|
25
|
+
error?: boolean;
|
26
|
+
/**
|
27
|
+
* helperText | error, success, warning message to be shown
|
28
|
+
*/
|
29
|
+
helperText?: string;
|
30
|
+
/**
|
31
|
+
* to disable the input field
|
32
|
+
*/
|
33
|
+
disabled?: boolean;
|
34
|
+
/**
|
35
|
+
* if true, input field will be mandatory
|
36
|
+
*/
|
37
|
+
required?: boolean;
|
38
|
+
/**
|
39
|
+
* placeholder for the input field
|
40
|
+
*/
|
41
|
+
placeholder?: string;
|
42
|
+
/**
|
43
|
+
* classnames to style the input field
|
44
|
+
*/
|
45
|
+
className?: string;
|
46
|
+
/**
|
47
|
+
* noBorder prop 'true' removes border of input
|
48
|
+
*/
|
49
|
+
noBorder?: boolean;
|
50
|
+
/**
|
51
|
+
* onChange, onKeyDown, onBlur, onFocus actions
|
52
|
+
*/
|
53
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
54
|
+
|
55
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
56
|
+
|
57
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
58
|
+
|
59
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
60
|
+
/**
|
61
|
+
* id to select the input field uniquely
|
62
|
+
*/
|
63
|
+
id?: string;
|
64
|
+
/**
|
65
|
+
* if on, suggestion popup will be displayed
|
66
|
+
*/
|
67
|
+
autoComplete?: 'on' | 'off';
|
68
|
+
/**
|
69
|
+
* minimum and maximum values for the number type input field and their functions
|
70
|
+
*/
|
71
|
+
minValue?: number;
|
72
|
+
maxValue?: number;
|
73
|
+
/**
|
74
|
+
* background of the input field prop
|
75
|
+
*/
|
76
|
+
transparentBackground?: boolean;
|
77
|
+
}
|
@@ -0,0 +1,185 @@
|
|
1
|
+
@use '../../assets/styles/fonts';
|
2
|
+
|
3
|
+
.ff-input-with-dropdown-container {
|
4
|
+
display: flex;
|
5
|
+
flex-direction: column;
|
6
|
+
|
7
|
+
.ff-input-with-dropdown {
|
8
|
+
display: flex;
|
9
|
+
border: 1px solid var(--input-default-border-color);
|
10
|
+
border-radius: 4px;
|
11
|
+
padding: 0;
|
12
|
+
position: relative;
|
13
|
+
|
14
|
+
.ff-floating-label-input-container {
|
15
|
+
.ff-floating-label {
|
16
|
+
position: absolute;
|
17
|
+
z-index: 99;
|
18
|
+
color: var(--input-default-border-color);
|
19
|
+
top: 7px;
|
20
|
+
left: 7px;
|
21
|
+
@extend .fontSm;
|
22
|
+
transition: all 0.3s ease-in-out;
|
23
|
+
|
24
|
+
.ff-required-asterisk {
|
25
|
+
color: var(--input-error-text-color);
|
26
|
+
}
|
27
|
+
&--filled {
|
28
|
+
color: var(--input-active-text-color);
|
29
|
+
}
|
30
|
+
&--no-hover {
|
31
|
+
color: var(--input-default-border-color);
|
32
|
+
}
|
33
|
+
&--error {
|
34
|
+
color: var(--input-error-text-color);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
.ff-floating-input {
|
39
|
+
position: relative;
|
40
|
+
padding: 6px 7px;
|
41
|
+
line-height: 18px;
|
42
|
+
border: none;
|
43
|
+
outline: none;
|
44
|
+
border-right: 1px solid var(--input-default-border-color);
|
45
|
+
border-radius: 4px 0 0 4px;
|
46
|
+
@extend .fontSm;
|
47
|
+
top: 1px;
|
48
|
+
|
49
|
+
&::-webkit-outer-spin-button,
|
50
|
+
&::-webkit-inner-spin-button {
|
51
|
+
-webkit-appearance: none;
|
52
|
+
margin: 0;
|
53
|
+
}
|
54
|
+
&::placeholder {
|
55
|
+
opacity: 0;
|
56
|
+
}
|
57
|
+
&:disabled {
|
58
|
+
cursor: not-allowed;
|
59
|
+
background: transparent;
|
60
|
+
}
|
61
|
+
&--error {
|
62
|
+
border-color: var(--input-error-text-color);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
&--no-hover {
|
68
|
+
border-color: var(--input-default-border-color);
|
69
|
+
}
|
70
|
+
&--disabled {
|
71
|
+
cursor: not-allowed;
|
72
|
+
opacity: 0.5;
|
73
|
+
}
|
74
|
+
&--error {
|
75
|
+
border-color: var(--input-error-text-color);
|
76
|
+
}
|
77
|
+
|
78
|
+
.ff-floating-dropdown {
|
79
|
+
min-width: 120px;
|
80
|
+
border: none;
|
81
|
+
outline: none;
|
82
|
+
margin: 0;
|
83
|
+
&:disabled {
|
84
|
+
cursor: not-allowed;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
&:hover {
|
89
|
+
.ff-input-with-dropdown {
|
90
|
+
border-color: var(--input-hover-border-color);
|
91
|
+
|
92
|
+
&--filled {
|
93
|
+
border-color: var(--input-default-border-color);
|
94
|
+
}
|
95
|
+
&--disabled {
|
96
|
+
border-color: var(--input-default-border-color);
|
97
|
+
}
|
98
|
+
&--error {
|
99
|
+
border-color: var(--input-error-text-color);
|
100
|
+
}
|
101
|
+
.ff-floating-label {
|
102
|
+
color: var(--input-hover-border-color);
|
103
|
+
&--filled {
|
104
|
+
color: var(--input-default-border-color);
|
105
|
+
}
|
106
|
+
&--disabled {
|
107
|
+
color: var(--input-default-border-color);
|
108
|
+
}
|
109
|
+
&--error {
|
110
|
+
color: var(--input-error-text-color);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
.ff-floating-input {
|
114
|
+
border-color: var(--input-hover-border-color);
|
115
|
+
&--filled {
|
116
|
+
border-color: var(--input-default-border-color);
|
117
|
+
}
|
118
|
+
&--disabled {
|
119
|
+
border-color: var(--input-default-border-color);
|
120
|
+
}
|
121
|
+
&--error {
|
122
|
+
border-color: var(--input-error-text-color);
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
&:focus-within {
|
129
|
+
.ff-input-with-dropdown {
|
130
|
+
border-color: var(--input-active-text-color);
|
131
|
+
&--error {
|
132
|
+
border-color: var(--input-error-text-color);
|
133
|
+
}
|
134
|
+
|
135
|
+
.ff-floating-label {
|
136
|
+
top: -6.5px;
|
137
|
+
background-color: var(--input-label-bg-color);
|
138
|
+
padding: 0px 2px;
|
139
|
+
color: var(--input-active-text-color);
|
140
|
+
line-height: 12px;
|
141
|
+
font-size: 8px !important;
|
142
|
+
|
143
|
+
&--error {
|
144
|
+
color: var(--input-error-text-color);
|
145
|
+
}
|
146
|
+
}
|
147
|
+
.ff-floating-input {
|
148
|
+
border-color: var(--input-active-text-color);
|
149
|
+
&--error {
|
150
|
+
border-color: var(--input-error-text-color);
|
151
|
+
}
|
152
|
+
&::placeholder {
|
153
|
+
opacity: 1;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
&--filled {
|
159
|
+
.ff-input-with-dropdown {
|
160
|
+
.ff-floating-label-input-container {
|
161
|
+
border-color: var(--input-active-text-color);
|
162
|
+
.ff-floating-label {
|
163
|
+
//re-written label container code to place it at on border
|
164
|
+
top: -6px;
|
165
|
+
background-color: var(--input-label-bg-color);
|
166
|
+
padding: 0px 2px;
|
167
|
+
line-height: 12px;
|
168
|
+
font-size: 8px !important;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
span {
|
173
|
+
font-size: 8px;
|
174
|
+
}
|
175
|
+
.required-asterisk {
|
176
|
+
color: var(--input-error-text-color);
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
.ff-helper-text {
|
181
|
+
color: var(--input-error-text-color);
|
182
|
+
@extend .font-size-8;
|
183
|
+
padding: 0 11px;
|
184
|
+
}
|
185
|
+
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import InputWithDropdown from './InputWithDropdown';
|
3
|
+
import { ChangeEvent, useState } from 'react';
|
4
|
+
import { Option } from './types';
|
5
|
+
|
6
|
+
const meta: Meta<typeof InputWithDropdown> = {
|
7
|
+
title: 'Components/InputWithDropdown',
|
8
|
+
component: InputWithDropdown,
|
9
|
+
parameters: {
|
10
|
+
layout: 'centered',
|
11
|
+
},
|
12
|
+
tags: ['autodocs'],
|
13
|
+
};
|
14
|
+
|
15
|
+
type Story = StoryObj<typeof InputWithDropdown>;
|
16
|
+
|
17
|
+
let optionsList = [
|
18
|
+
{ label: 'option 1', value: 'option 1' },
|
19
|
+
{ label: 'option 2', value: 'option 2' },
|
20
|
+
{ label: 'option 3', value: 'option 3' },
|
21
|
+
{ label: 'option 4', value: 'option 4' },
|
22
|
+
];
|
23
|
+
let selectedOption = { label: 'option 2', value: 'option 2' };
|
24
|
+
|
25
|
+
const defaultArgs = {
|
26
|
+
label: 'Field-Name',
|
27
|
+
disabled: false,
|
28
|
+
placeholder: 'Enter your name',
|
29
|
+
optionsList: optionsList,
|
30
|
+
selectedOption: selectedOption,
|
31
|
+
};
|
32
|
+
|
33
|
+
export const Default: Story = {
|
34
|
+
args: {
|
35
|
+
...defaultArgs,
|
36
|
+
disabled: false,
|
37
|
+
required: false,
|
38
|
+
},
|
39
|
+
};
|
40
|
+
|
41
|
+
export const DisabledWithValue: Story = {
|
42
|
+
args: {
|
43
|
+
...defaultArgs,
|
44
|
+
variant: 'primary',
|
45
|
+
type: 'text',
|
46
|
+
value: 'Disabled',
|
47
|
+
disabled: true,
|
48
|
+
required: 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 optionsListToPass = [
|
59
|
+
{ label: 'milliseconds', value: 'milliseconds' },
|
60
|
+
{ label: 'seconds', value: 'seconds' },
|
61
|
+
{ label: 'minutes', value: 'minutes' },
|
62
|
+
{ label: 'hours', value: 'hours' },
|
63
|
+
];
|
64
|
+
|
65
|
+
const [selectedOption, setSelectedOption] = useState<Option>({
|
66
|
+
label: 'milliseconds',
|
67
|
+
value: 'milliseconds',
|
68
|
+
});
|
69
|
+
|
70
|
+
const onDropdownChangeHandler = (option: Option) => {
|
71
|
+
setSelectedOption(option);
|
72
|
+
setValue('0');
|
73
|
+
};
|
74
|
+
|
75
|
+
const onInputChangeHandler = (event: ChangeEvent<HTMLInputElement>) => {
|
76
|
+
const inputValue = event.target.value;
|
77
|
+
setValue(inputValue);
|
78
|
+
|
79
|
+
// Validation logic
|
80
|
+
if (event.target) {
|
81
|
+
if (inputValue.length <= 0) {
|
82
|
+
setError(true);
|
83
|
+
setHelperText(`${event.target.name} is required`);
|
84
|
+
} else if (inputValue.length > 4) {
|
85
|
+
setError(true);
|
86
|
+
setHelperText(`${event.target.name} should be upto 999`);
|
87
|
+
} else {
|
88
|
+
setError(false);
|
89
|
+
setHelperText('');
|
90
|
+
}
|
91
|
+
}
|
92
|
+
};
|
93
|
+
|
94
|
+
return (
|
95
|
+
<InputWithDropdown
|
96
|
+
{...defaultArgs}
|
97
|
+
name="ImplicitTime"
|
98
|
+
label="ImplicitTime"
|
99
|
+
placeholder={`Enter ImplicitTime here`}
|
100
|
+
value={value}
|
101
|
+
type="number"
|
102
|
+
required={true}
|
103
|
+
error={error}
|
104
|
+
helperText={helperText}
|
105
|
+
optionsList={optionsListToPass}
|
106
|
+
selectedOption={selectedOption}
|
107
|
+
onInputChangeHandler={onInputChangeHandler}
|
108
|
+
onDropdownChangeHandler={onDropdownChangeHandler}
|
109
|
+
/>
|
110
|
+
);
|
111
|
+
},
|
112
|
+
};
|
113
|
+
|
114
|
+
export default meta;
|