@true-engineering/true-react-common-ui-kit 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +13 -0
- package/dist/components/AccountInfo/AccountInfo.d.ts +11 -0
- package/dist/components/AccountInfo/AccountInfo.styles.d.ts +64 -0
- package/dist/components/AccountInfo/index.d.ts +2 -0
- package/dist/components/AddButton/AddButton.d.ts +12 -0
- package/dist/components/AddButton/AddButton.styles.d.ts +28 -0
- package/dist/components/AddButton/index.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +28 -0
- package/dist/components/Button/Button.styles.d.ts +150 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +21 -0
- package/dist/components/Checkbox/Checkbox.styles.d.ts +47 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/CloseButton/CloseButton.d.ts +10 -0
- package/dist/components/CloseButton/CloseButton.styles.d.ts +27 -0
- package/dist/components/CloseButton/index.d.ts +2 -0
- package/dist/components/Colors/Colors.d.ts +2 -0
- package/dist/components/Colors/Colors.styles.d.ts +32 -0
- package/dist/components/Colors/index.d.ts +2 -0
- package/dist/components/CssBaseline/CssBaseline.d.ts +7 -0
- package/dist/components/CssBaseline/CssBaseline.styles.d.ts +11 -0
- package/dist/components/CssBaseline/index.d.ts +2 -0
- package/dist/components/DateInput/DateInput.d.ts +14 -0
- package/dist/components/DateInput/DateInput.styles.d.ts +11 -0
- package/dist/components/DateInput/index.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts +34 -0
- package/dist/components/DatePicker/DatePicker.styles.d.ts +46 -0
- package/dist/components/DatePicker/DatePickerHeader/DatePickerHeader.d.ts +14 -0
- package/dist/components/DatePicker/DatePickerHeader/DatePickerHeader.styles.d.ts +69 -0
- package/dist/components/DatePicker/DatePickerHeader/index.d.ts +1 -0
- package/dist/components/DatePicker/DatePickerInput/DatePickerInput.d.ts +11 -0
- package/dist/components/DatePicker/DatePickerInput/DatePickerInput.styles.d.ts +20 -0
- package/dist/components/DatePicker/DatePickerInput/index.d.ts +1 -0
- package/dist/components/DatePicker/index.d.ts +4 -0
- package/dist/components/Description/Description.d.ts +12 -0
- package/dist/components/Description/Description.styles.d.ts +24 -0
- package/dist/components/Description/index.d.ts +2 -0
- package/dist/components/FiltersPane/FilterInterval/FilterInterval.d.ts +26 -0
- package/dist/components/FiltersPane/FilterInterval/FilterInterval.styles.d.ts +52 -0
- package/dist/components/FiltersPane/FilterInterval/index.d.ts +1 -0
- package/dist/components/FiltersPane/FilterMultiSelect/FilterMultiSelect.d.ts +5 -0
- package/dist/components/FiltersPane/FilterMultiSelect/index.d.ts +1 -0
- package/dist/components/FiltersPane/FilterSelect/FilterSelect.d.ts +25 -0
- package/dist/components/FiltersPane/FilterSelect/FilterSelect.styles.d.ts +124 -0
- package/dist/components/FiltersPane/FilterSelect/index.d.ts +1 -0
- package/dist/components/FiltersPane/FilterSelect/locales.d.ts +11 -0
- package/dist/components/FiltersPane/FilterValueView/FilterValueView.d.ts +3 -0
- package/dist/components/FiltersPane/FilterValueView/FilterValueView.styles.d.ts +12 -0
- package/dist/components/FiltersPane/FilterValueView/index.d.ts +1 -0
- package/dist/components/FiltersPane/FilterWithDates/FilterWithDates.d.ts +23 -0
- package/dist/components/FiltersPane/FilterWithDates/FilterWithDates.styles.d.ts +47 -0
- package/dist/components/FiltersPane/FilterWithDates/index.d.ts +1 -0
- package/dist/components/FiltersPane/FilterWithPeriod/FilterWithPeriod.d.ts +16 -0
- package/dist/components/FiltersPane/FilterWithPeriod/FilterWithPeriod.styles.d.ts +12 -0
- package/dist/components/FiltersPane/FilterWithPeriod/index.d.ts +1 -0
- package/dist/components/FiltersPane/FilterWrapper/FilterWrapper.d.ts +27 -0
- package/dist/components/FiltersPane/FilterWrapper/FilterWrapper.styles.d.ts +96 -0
- package/dist/components/FiltersPane/FilterWrapper/index.d.ts +1 -0
- package/dist/components/FiltersPane/FiltersPane.d.ts +22 -0
- package/dist/components/FiltersPane/FiltersPane.styles.d.ts +57 -0
- package/dist/components/FiltersPane/FiltersPaneSearch/FiltersPaneSearch.d.ts +26 -0
- package/dist/components/FiltersPane/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +91 -0
- package/dist/components/FiltersPane/FiltersPaneSearch/index.d.ts +1 -0
- package/dist/components/FiltersPane/index.d.ts +16 -0
- package/dist/components/FiltersPane/locales.d.ts +28 -0
- package/dist/components/FiltersPane/types.d.ts +77 -0
- package/dist/components/Flag/Flag.d.ts +8 -0
- package/dist/components/Flag/Flag.styles.d.ts +12 -0
- package/dist/components/Flag/augment.d.ts +1 -0
- package/dist/components/Flag/index.d.ts +2 -0
- package/dist/components/FlexibleTable/FlexibleTable.d.ts +25 -0
- package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +101 -0
- package/dist/components/FlexibleTable/TableRow.d.ts +28 -0
- package/dist/components/FlexibleTable/TableValue.d.ts +21 -0
- package/dist/components/FlexibleTable/index.d.ts +3 -0
- package/dist/components/FlexibleTable/types.d.ts +44 -0
- package/dist/components/Icon/ComplexIconBoilerplate.d.ts +7 -0
- package/dist/components/Icon/Icon.d.ts +11 -0
- package/dist/components/Icon/Icon.styles.d.ts +8 -0
- package/dist/components/Icon/IconBoilerplate.d.ts +6 -0
- package/dist/components/Icon/complexIcons/augment.d.ts +1 -0
- package/dist/components/Icon/complexIcons/icons.d.ts +4 -0
- package/dist/components/Icon/complexIcons/index.d.ts +1 -0
- package/dist/components/Icon/icons/icons.d.ts +9 -0
- package/dist/components/Icon/icons/index.d.ts +1 -0
- package/dist/components/Icon/index.d.ts +4 -0
- package/dist/components/IncrementInput/ChangeButton.d.ts +11 -0
- package/dist/components/IncrementInput/IncrementInput.d.ts +8 -0
- package/dist/components/IncrementInput/IncrementInput.styles.d.ts +63 -0
- package/dist/components/IncrementInput/index.d.ts +2 -0
- package/dist/components/Input/Input.d.ts +45 -0
- package/dist/components/Input/Input.styles.d.ts +247 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/List/List.d.ts +21 -0
- package/dist/components/List/List.styles.d.ts +39 -0
- package/dist/components/List/index.d.ts +2 -0
- package/dist/components/Modal/Modal.d.ts +26 -0
- package/dist/components/Modal/Modal.styles.d.ts +239 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/MoreMenu/MoreMenu.d.ts +14 -0
- package/dist/components/MoreMenu/MoreMenu.styles.d.ts +53 -0
- package/dist/components/MoreMenu/index.d.ts +2 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +19 -0
- package/dist/components/MultiSelect/MultiSelect.styles.d.ts +44 -0
- package/dist/components/MultiSelect/MultiSelectInput/MultiSelectInput.d.ts +11 -0
- package/dist/components/MultiSelect/MultiSelectInput/MultiSelectInput.styles.d.ts +62 -0
- package/dist/components/MultiSelect/MultiSelectInput/index.d.ts +1 -0
- package/dist/components/MultiSelect/index.d.ts +3 -0
- package/dist/components/MultiSelectList/MultiSelectList.d.ts +28 -0
- package/dist/components/MultiSelectList/MultiSelectList.styles.d.ts +105 -0
- package/dist/components/MultiSelectList/index.d.ts +2 -0
- package/dist/components/MultiSelectList/locales.d.ts +11 -0
- package/dist/components/Notification/Notification.d.ts +16 -0
- package/dist/components/Notification/Notification.styles.d.ts +37 -0
- package/dist/components/Notification/index.d.ts +2 -0
- package/dist/components/NumberInput/NumberInput.d.ts +13 -0
- package/dist/components/NumberInput/helpers.d.ts +2 -0
- package/dist/components/NumberInput/index.d.ts +1 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts +13 -0
- package/dist/components/PhoneInput/PhoneInput.styles.d.ts +66 -0
- package/dist/components/PhoneInput/PhoneInputCountryList/PhoneInputCountryList.d.ts +15 -0
- package/dist/components/PhoneInput/PhoneInputCountryList/PhoneInputCountryList.styles.d.ts +83 -0
- package/dist/components/PhoneInput/PhoneInputCountryList/index.d.ts +2 -0
- package/dist/components/PhoneInput/index.d.ts +5 -0
- package/dist/components/PhoneInput/phone-info.d.ts +2 -0
- package/dist/components/PhoneInput/types.d.ts +15 -0
- package/dist/components/RadioButton/RadioButton.d.ts +13 -0
- package/dist/components/RadioButton/RadioButton.styles.d.ts +30 -0
- package/dist/components/RadioButton/index.d.ts +2 -0
- package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +382 -0
- package/dist/components/ScrollIntoViewIfNeeded/index.d.ts +1 -0
- package/dist/components/SearchInput/SearchInput.d.ts +7 -0
- package/dist/components/SearchInput/SearchInput.styles.d.ts +39 -0
- package/dist/components/SearchInput/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +27 -0
- package/dist/components/Select/Select.styles.d.ts +61 -0
- package/dist/components/Select/SelectList/SelectList.d.ts +21 -0
- package/dist/components/Select/SelectList/SelectList.styles.d.ts +46 -0
- package/dist/components/Select/SelectList/index.d.ts +1 -0
- package/dist/components/Select/helpers.d.ts +3 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/SmartInput/SmartInput.d.ts +22 -0
- package/dist/components/SmartInput/helpers.d.ts +10 -0
- package/dist/components/SmartInput/index.d.ts +1 -0
- package/dist/components/Switch/Switch.d.ts +20 -0
- package/dist/components/Switch/Switch.styles.d.ts +62 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/TextArea/TextArea.d.ts +29 -0
- package/dist/components/TextArea/TextArea.styles.d.ts +128 -0
- package/dist/components/TextArea/index.d.ts +2 -0
- package/dist/components/TextWithInfo/TextWithInfo.d.ts +15 -0
- package/dist/components/TextWithInfo/TextWithInfo.styles.d.ts +48 -0
- package/dist/components/TextWithInfo/index.d.ts +2 -0
- package/dist/components/TextWithTooltip/TextWithTooltip.d.ts +20 -0
- package/dist/components/TextWithTooltip/TextWithTooltip.styles.d.ts +14 -0
- package/dist/components/TextWithTooltip/index.d.ts +2 -0
- package/dist/components/ThemedPreloader/ThemedPreloader.d.ts +12 -0
- package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +14 -0
- package/dist/components/ThemedPreloader/components/DefaultPreloader/DefaultPreloader.d.ts +2 -0
- package/dist/components/ThemedPreloader/components/DefaultPreloader/index.d.ts +1 -0
- package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.d.ts +7 -0
- package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.d.ts +43 -0
- package/dist/components/ThemedPreloader/components/DotsPreloader/index.d.ts +2 -0
- package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.d.ts +9 -0
- package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.styles.d.ts +9 -0
- package/dist/components/ThemedPreloader/components/SvgPreloader/index.d.ts +2 -0
- package/dist/components/ThemedPreloader/components/index.d.ts +2 -0
- package/dist/components/ThemedPreloader/index.d.ts +2 -0
- package/dist/components/Toaster/Toaster.d.ts +17 -0
- package/dist/components/Toaster/Toaster.styles.d.ts +45 -0
- package/dist/components/Toaster/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +10 -0
- package/dist/components/Tooltip/Tooltip.styles.d.ts +35 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/types.d.ts +1 -0
- package/dist/components/index.d.ts +36 -0
- package/dist/helpers/colors.d.ts +2 -0
- package/dist/helpers/data-attributes.d.ts +5 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/phone.d.ts +11 -0
- package/dist/helpers/popper-helpers.d.ts +2 -0
- package/dist/helpers/utils.d.ts +17 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/use-did-mount-effect.d.ts +2 -0
- package/dist/hooks/use-dropdown.d.ts +11 -0
- package/dist/hooks/use-is-mounted.d.ts +1 -0
- package/dist/hooks/use-on-click-outside.d.ts +5 -0
- package/dist/hooks/use-theme.d.ts +9 -0
- package/dist/hooks/use-tweak-styles.d.ts +2 -0
- package/dist/index.d.ts +5 -0
- package/dist/style.css +745 -0
- package/dist/theme.d.ts +67 -0
- package/dist/true-react-common-ui-kit.js +26961 -0
- package/dist/true-react-common-ui-kit.js.map +1 -0
- package/dist/true-react-common-ui-kit.umd.cjs +26951 -0
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -0
- package/dist/types.d.ts +35 -0
- package/dist/vite-env.d.ts +1 -0
- package/package.json +90 -0
- package/src/components/AccountInfo/AccountInfo.stories.tsx +35 -0
- package/src/components/AccountInfo/AccountInfo.styles.ts +55 -0
- package/src/components/AccountInfo/AccountInfo.tsx +106 -0
- package/src/components/AccountInfo/index.ts +2 -0
- package/src/components/AddButton/AddButton.stories.tsx +21 -0
- package/src/components/AddButton/AddButton.styles.ts +34 -0
- package/src/components/AddButton/AddButton.tsx +49 -0
- package/src/components/AddButton/index.ts +2 -0
- package/src/components/Button/Button.stories.tsx +61 -0
- package/src/components/Button/Button.styles.ts +196 -0
- package/src/components/Button/Button.tsx +195 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +35 -0
- package/src/components/Checkbox/Checkbox.styles.ts +59 -0
- package/src/components/Checkbox/Checkbox.tsx +93 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/CloseButton/CloseButton.styles.ts +34 -0
- package/src/components/CloseButton/CloseButton.tsx +37 -0
- package/src/components/CloseButton/index.ts +2 -0
- package/src/components/Colors/Colors.stories.tsx +7 -0
- package/src/components/Colors/Colors.styles.ts +38 -0
- package/src/components/Colors/Colors.tsx +34 -0
- package/src/components/Colors/index.ts +2 -0
- package/src/components/CssBaseline/CssBaseline.styles.ts +15 -0
- package/src/components/CssBaseline/CssBaseline.tsx +17 -0
- package/src/components/CssBaseline/index.ts +2 -0
- package/src/components/DateInput/DateInput.stories.tsx +63 -0
- package/src/components/DateInput/DateInput.styles.ts +14 -0
- package/src/components/DateInput/DateInput.tsx +60 -0
- package/src/components/DateInput/index.ts +2 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +96 -0
- package/src/components/DatePicker/DatePicker.styles.ts +54 -0
- package/src/components/DatePicker/DatePicker.tsx +358 -0
- package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.styles.ts +84 -0
- package/src/components/DatePicker/DatePickerHeader/DatePickerHeader.tsx +94 -0
- package/src/components/DatePicker/DatePickerHeader/index.ts +1 -0
- package/src/components/DatePicker/DatePickerInput/DatePickerInput.styles.ts +25 -0
- package/src/components/DatePicker/DatePickerInput/DatePickerInput.tsx +31 -0
- package/src/components/DatePicker/DatePickerInput/index.ts +1 -0
- package/src/components/DatePicker/index.ts +4 -0
- package/src/components/Description/Description.stories.tsx +29 -0
- package/src/components/Description/Description.styles.ts +31 -0
- package/src/components/Description/Description.tsx +69 -0
- package/src/components/Description/index.ts +2 -0
- package/src/components/FiltersPane/FilterInterval/FilterInterval.styles.ts +64 -0
- package/src/components/FiltersPane/FilterInterval/FilterInterval.tsx +162 -0
- package/src/components/FiltersPane/FilterInterval/index.ts +1 -0
- package/src/components/FiltersPane/FilterMultiSelect/FilterMultiSelect.tsx +14 -0
- package/src/components/FiltersPane/FilterMultiSelect/index.ts +1 -0
- package/src/components/FiltersPane/FilterSelect/FilterSelect.styles.ts +144 -0
- package/src/components/FiltersPane/FilterSelect/FilterSelect.tsx +397 -0
- package/src/components/FiltersPane/FilterSelect/index.ts +1 -0
- package/src/components/FiltersPane/FilterSelect/locales.ts +37 -0
- package/src/components/FiltersPane/FilterValueView/FilterValueView.styles.tsx +15 -0
- package/src/components/FiltersPane/FilterValueView/FilterValueView.tsx +186 -0
- package/src/components/FiltersPane/FilterValueView/index.tsx +1 -0
- package/src/components/FiltersPane/FilterWithDates/FilterWithDates.styles.ts +60 -0
- package/src/components/FiltersPane/FilterWithDates/FilterWithDates.tsx +222 -0
- package/src/components/FiltersPane/FilterWithDates/index.ts +1 -0
- package/src/components/FiltersPane/FilterWithPeriod/FilterWithPeriod.styles.ts +17 -0
- package/src/components/FiltersPane/FilterWithPeriod/FilterWithPeriod.tsx +231 -0
- package/src/components/FiltersPane/FilterWithPeriod/index.ts +1 -0
- package/src/components/FiltersPane/FilterWrapper/FilterWrapper.styles.ts +110 -0
- package/src/components/FiltersPane/FilterWrapper/FilterWrapper.tsx +360 -0
- package/src/components/FiltersPane/FilterWrapper/index.ts +1 -0
- package/src/components/FiltersPane/FiltersPane.stories.tsx +307 -0
- package/src/components/FiltersPane/FiltersPane.styles.ts +71 -0
- package/src/components/FiltersPane/FiltersPane.tsx +193 -0
- package/src/components/FiltersPane/FiltersPaneSearch/FiltersPaneSearch.styles.ts +109 -0
- package/src/components/FiltersPane/FiltersPaneSearch/FiltersPaneSearch.tsx +175 -0
- package/src/components/FiltersPane/FiltersPaneSearch/index.ts +1 -0
- package/src/components/FiltersPane/index.ts +20 -0
- package/src/components/FiltersPane/locales.ts +107 -0
- package/src/components/FiltersPane/types.ts +126 -0
- package/src/components/Flag/Flag.stories.tsx +29 -0
- package/src/components/Flag/Flag.styles.ts +18 -0
- package/src/components/Flag/Flag.tsx +28 -0
- package/src/components/Flag/augment.d.ts +1 -0
- package/src/components/Flag/index.ts +2 -0
- package/src/components/FlexibleTable/FlexibleTable.stories.tsx +80 -0
- package/src/components/FlexibleTable/FlexibleTable.styles.ts +131 -0
- package/src/components/FlexibleTable/FlexibleTable.tsx +241 -0
- package/src/components/FlexibleTable/TableRow.tsx +164 -0
- package/src/components/FlexibleTable/TableValue.tsx +86 -0
- package/src/components/FlexibleTable/fixture-test.ts +254 -0
- package/src/components/FlexibleTable/index.ts +3 -0
- package/src/components/FlexibleTable/types.ts +58 -0
- package/src/components/Icon/ComplexIconBoilerplate.tsx +17 -0
- package/src/components/Icon/Icon.stories.tsx +88 -0
- package/src/components/Icon/Icon.styles.ts +10 -0
- package/src/components/Icon/Icon.tsx +34 -0
- package/src/components/Icon/IconBoilerplate.tsx +42 -0
- package/src/components/Icon/complexIcons/augment.d.ts +1 -0
- package/src/components/Icon/complexIcons/avatarGreen.svg +58 -0
- package/src/components/Icon/complexIcons/icons.ts +7 -0
- package/src/components/Icon/complexIcons/index.ts +1 -0
- package/src/components/Icon/icons/icons.ts +838 -0
- package/src/components/Icon/icons/index.ts +1 -0
- package/src/components/Icon/index.ts +4 -0
- package/src/components/IncrementInput/ChangeButton.tsx +34 -0
- package/src/components/IncrementInput/IncrementInput.stories.tsx +34 -0
- package/src/components/IncrementInput/IncrementInput.styles.ts +77 -0
- package/src/components/IncrementInput/IncrementInput.tsx +95 -0
- package/src/components/IncrementInput/index.ts +2 -0
- package/src/components/Input/Input.stories.tsx +92 -0
- package/src/components/Input/Input.styles.ts +305 -0
- package/src/components/Input/Input.tsx +308 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/List/List.stories.tsx +62 -0
- package/src/components/List/List.styles.ts +52 -0
- package/src/components/List/List.tsx +75 -0
- package/src/components/List/index.ts +2 -0
- package/src/components/Modal/Modal.stories.tsx +113 -0
- package/src/components/Modal/Modal.styles.ts +308 -0
- package/src/components/Modal/Modal.tsx +210 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/MoreMenu/MoreMenu.stories.tsx +46 -0
- package/src/components/MoreMenu/MoreMenu.styles.ts +68 -0
- package/src/components/MoreMenu/MoreMenu.tsx +91 -0
- package/src/components/MoreMenu/index.ts +2 -0
- package/src/components/MultiSelect/MultiSelect.stories.tsx +46 -0
- package/src/components/MultiSelect/MultiSelect.styles.ts +55 -0
- package/src/components/MultiSelect/MultiSelect.tsx +98 -0
- package/src/components/MultiSelect/MultiSelectInput/MultiSelectInput.styles.ts +73 -0
- package/src/components/MultiSelect/MultiSelectInput/MultiSelectInput.tsx +62 -0
- package/src/components/MultiSelect/MultiSelectInput/index.ts +1 -0
- package/src/components/MultiSelect/index.ts +3 -0
- package/src/components/MultiSelectList/MultiSelectList.styles.ts +125 -0
- package/src/components/MultiSelectList/MultiSelectList.tsx +519 -0
- package/src/components/MultiSelectList/index.ts +2 -0
- package/src/components/MultiSelectList/locales.ts +37 -0
- package/src/components/Notification/Notification.stories.tsx +51 -0
- package/src/components/Notification/Notification.styles.ts +50 -0
- package/src/components/Notification/Notification.tsx +84 -0
- package/src/components/Notification/index.ts +2 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +35 -0
- package/src/components/NumberInput/NumberInput.tsx +142 -0
- package/src/components/NumberInput/helpers.ts +68 -0
- package/src/components/NumberInput/index.ts +1 -0
- package/src/components/PhoneInput/PhoneInput.stories.tsx +71 -0
- package/src/components/PhoneInput/PhoneInput.styles.ts +84 -0
- package/src/components/PhoneInput/PhoneInput.tsx +223 -0
- package/src/components/PhoneInput/PhoneInputCountryList/PhoneInputCountryList.stories.tsx +21 -0
- package/src/components/PhoneInput/PhoneInputCountryList/PhoneInputCountryList.styles.ts +100 -0
- package/src/components/PhoneInput/PhoneInputCountryList/PhoneInputCountryList.tsx +171 -0
- package/src/components/PhoneInput/PhoneInputCountryList/index.ts +2 -0
- package/src/components/PhoneInput/index.ts +6 -0
- package/src/components/PhoneInput/phone-info.ts +2167 -0
- package/src/components/PhoneInput/types.ts +16 -0
- package/src/components/RadioButton/RadioButton.stories.tsx +46 -0
- package/src/components/RadioButton/RadioButton.styles.ts +37 -0
- package/src/components/RadioButton/RadioButton.tsx +56 -0
- package/src/components/RadioButton/index.ts +2 -0
- package/src/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.ts +66 -0
- package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -0
- package/src/components/SearchInput/SearchInput.stories.tsx +24 -0
- package/src/components/SearchInput/SearchInput.styles.ts +50 -0
- package/src/components/SearchInput/SearchInput.tsx +63 -0
- package/src/components/SearchInput/index.ts +2 -0
- package/src/components/Select/Select.stories.tsx +230 -0
- package/src/components/Select/Select.styles.ts +74 -0
- package/src/components/Select/Select.tsx +440 -0
- package/src/components/Select/SelectList/SelectList.styles.ts +57 -0
- package/src/components/Select/SelectList/SelectList.tsx +135 -0
- package/src/components/Select/SelectList/index.ts +1 -0
- package/src/components/Select/helpers.ts +13 -0
- package/src/components/Select/index.ts +3 -0
- package/src/components/SmartInput/SmartInput.stories.tsx +63 -0
- package/src/components/SmartInput/SmartInput.tsx +177 -0
- package/src/components/SmartInput/helpers.ts +85 -0
- package/src/components/SmartInput/index.ts +1 -0
- package/src/components/Switch/Switch.stories.tsx +40 -0
- package/src/components/Switch/Switch.styles.ts +75 -0
- package/src/components/Switch/Switch.tsx +89 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/TextArea/TextArea.stories.tsx +35 -0
- package/src/components/TextArea/TextArea.styles.ts +153 -0
- package/src/components/TextArea/TextArea.tsx +178 -0
- package/src/components/TextArea/index.ts +2 -0
- package/src/components/TextWithInfo/TextWithInfo.stories.tsx +53 -0
- package/src/components/TextWithInfo/TextWithInfo.styles.ts +60 -0
- package/src/components/TextWithInfo/TextWithInfo.tsx +67 -0
- package/src/components/TextWithInfo/index.ts +2 -0
- package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -0
- package/src/components/TextWithTooltip/TextWithTooltip.styles.ts +19 -0
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +163 -0
- package/src/components/TextWithTooltip/index.ts +2 -0
- package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +41 -0
- package/src/components/ThemedPreloader/ThemedPreloader.styles.ts +21 -0
- package/src/components/ThemedPreloader/ThemedPreloader.tsx +56 -0
- package/src/components/ThemedPreloader/components/DefaultPreloader/DefaultPreloader.tsx +34 -0
- package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -0
- package/src/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.ts +54 -0
- package/src/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.tsx +18 -0
- package/src/components/ThemedPreloader/components/DotsPreloader/index.ts +2 -0
- package/src/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.styles.ts +11 -0
- package/src/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.tsx +32 -0
- package/src/components/ThemedPreloader/components/SvgPreloader/index.ts +2 -0
- package/src/components/ThemedPreloader/components/index.ts +2 -0
- package/src/components/ThemedPreloader/index.ts +2 -0
- package/src/components/Toaster/Toaster.stories.tsx +34 -0
- package/src/components/Toaster/Toaster.styles.ts +59 -0
- package/src/components/Toaster/Toaster.tsx +113 -0
- package/src/components/Toaster/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +21 -0
- package/src/components/Tooltip/Tooltip.styles.ts +45 -0
- package/src/components/Tooltip/Tooltip.tsx +40 -0
- package/src/components/Tooltip/index.ts +3 -0
- package/src/components/Tooltip/types.ts +1 -0
- package/src/components/index.ts +36 -0
- package/src/helpers/colors.ts +2 -0
- package/src/helpers/data-attributes.ts +18 -0
- package/src/helpers/dateHelpers/date-helpers.ts +9 -0
- package/src/helpers/index.ts +5 -0
- package/src/helpers/phone.ts +106 -0
- package/src/helpers/popper-helpers.ts +17 -0
- package/src/helpers/utils.ts +164 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/use-did-mount-effect.ts +21 -0
- package/src/hooks/use-dropdown.ts +85 -0
- package/src/hooks/use-is-mounted.ts +15 -0
- package/src/hooks/use-on-click-outside.ts +92 -0
- package/src/hooks/use-theme.ts +36 -0
- package/src/hooks/use-tweak-styles.ts +14 -0
- package/src/index.ts +5 -0
- package/src/theme.ts +155 -0
- package/src/types.ts +106 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { IFilterIntervalProps } from './FilterInterval';
|
|
3
|
+
import { IFilterMultiSelectProps } from './FilterMultiSelect';
|
|
4
|
+
import { IFilterSelectProps } from './FilterSelect';
|
|
5
|
+
import { IFilterWithDatesProps } from './FilterWithDates';
|
|
6
|
+
import { IFilterWithPeriodProps } from './FilterWithPeriod';
|
|
7
|
+
import { IFilterLocaleKey, IPartialFilterLocale } from './locales';
|
|
8
|
+
import { IMultiSelectListValues } from '../MultiSelectList';
|
|
9
|
+
|
|
10
|
+
export const PERIODS = [
|
|
11
|
+
'THIS_MONTH',
|
|
12
|
+
'LAST_MONTH',
|
|
13
|
+
'THIS_YEAR',
|
|
14
|
+
'LAST_YEAR',
|
|
15
|
+
'CUSTOM',
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
export type IPeriodType = (typeof PERIODS)[number];
|
|
19
|
+
|
|
20
|
+
export type IFilterMultiSelectValues<Option = string> =
|
|
21
|
+
IMultiSelectListValues<Option>;
|
|
22
|
+
|
|
23
|
+
export type IPeriodsList = Array<IPeriodType | [string, IPeriodGetter]>;
|
|
24
|
+
|
|
25
|
+
export interface IFiltersPaneSearchPayload<Value> {
|
|
26
|
+
value?: string;
|
|
27
|
+
field?: Value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IFilterValueViewProps<Value> {
|
|
31
|
+
value?: Value;
|
|
32
|
+
filter: ConfigItem<Value>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface IDatePeriod {
|
|
36
|
+
from: Date | null;
|
|
37
|
+
to: Date | null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface IPeriod extends IDatePeriod {
|
|
41
|
+
periodType: string;
|
|
42
|
+
label?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type IPeriodGetter = () => IDatePeriod;
|
|
46
|
+
|
|
47
|
+
export type IFilterWithDatesValue = IDatePeriod;
|
|
48
|
+
|
|
49
|
+
export type MultiSelectOptionType<Value> = Value | undefined extends
|
|
50
|
+
| IFilterMultiSelectValues<infer Option>
|
|
51
|
+
| undefined
|
|
52
|
+
? Option
|
|
53
|
+
: unknown;
|
|
54
|
+
|
|
55
|
+
export interface IConfigItemBasicBase<Value> {
|
|
56
|
+
name: string;
|
|
57
|
+
isInline?: boolean;
|
|
58
|
+
requiredFilledFilters?: string[];
|
|
59
|
+
localeKey?: IFilterLocaleKey;
|
|
60
|
+
locale?: IPartialFilterLocale;
|
|
61
|
+
getSelectedValueView?: (v: Value) => ReactNode;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type IIntervalConfigItem<Value> = IConfigItemBasicBase<Value> & {
|
|
65
|
+
type: 'interval';
|
|
66
|
+
} & Omit<IFilterIntervalProps, 'value' | 'onChange' | 'labelName'>;
|
|
67
|
+
|
|
68
|
+
export interface IBooleanConfigItem<Value> extends IConfigItemBasicBase<Value> {
|
|
69
|
+
type: 'boolean';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type IMultiSelectConfigItem<Value> = IConfigItemBasicBase<Value> & {
|
|
73
|
+
type: 'multiSelect';
|
|
74
|
+
} & Omit<
|
|
75
|
+
IFilterMultiSelectProps<Value, MultiSelectOptionType<Value>>,
|
|
76
|
+
'value' | 'onChange'
|
|
77
|
+
>;
|
|
78
|
+
|
|
79
|
+
export type ISelectConfigItem<Value> = IConfigItemBasicBase<Value> & {
|
|
80
|
+
type: 'select';
|
|
81
|
+
} & Omit<IFilterSelectProps<Value>, 'value' | 'onChange'>;
|
|
82
|
+
|
|
83
|
+
// Дата без периодов
|
|
84
|
+
export type IDateRangeWithoutPeriodConfigItem<Value> =
|
|
85
|
+
IConfigItemBasicBase<Value> & {
|
|
86
|
+
type: 'dateRangeWithoutPeriod';
|
|
87
|
+
dateFormat?: string;
|
|
88
|
+
} & Omit<
|
|
89
|
+
IFilterWithDatesProps,
|
|
90
|
+
'value' | 'onChange' | 'onStartBtnSubmit' | 'onEndBtnSubmit'
|
|
91
|
+
>;
|
|
92
|
+
|
|
93
|
+
// Дата С ПЕРИОДАМИ
|
|
94
|
+
export type IDateRangeConfigItem<Value> = IConfigItemBasicBase<Value> & {
|
|
95
|
+
type: 'dateRange';
|
|
96
|
+
dateFormat?: string;
|
|
97
|
+
} & Omit<IFilterWithPeriodProps, 'value' | 'onChange' | 'setIsOpen'>;
|
|
98
|
+
|
|
99
|
+
export type CustomComponent<Value> = FC<{
|
|
100
|
+
value?: Value;
|
|
101
|
+
onChange: (v?: Value) => void;
|
|
102
|
+
onClose?: () => void;
|
|
103
|
+
filter: ICustomConfigItem<Value>;
|
|
104
|
+
localeKey?: IFilterLocaleKey;
|
|
105
|
+
locale?: IPartialFilterLocale;
|
|
106
|
+
}>;
|
|
107
|
+
|
|
108
|
+
export interface ICustomConfigItem<Value> extends IConfigItemBasicBase<Value> {
|
|
109
|
+
[key: string]: any;
|
|
110
|
+
type: 'custom';
|
|
111
|
+
component: CustomComponent<Value>;
|
|
112
|
+
valueViewType?: 'range' | 'multiple';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type ConfigItem<Value> =
|
|
116
|
+
| ISelectConfigItem<Value>
|
|
117
|
+
| IMultiSelectConfigItem<Value>
|
|
118
|
+
| ICustomConfigItem<Value>
|
|
119
|
+
| IDateRangeWithoutPeriodConfigItem<Value>
|
|
120
|
+
| IDateRangeConfigItem<Value>
|
|
121
|
+
| IIntervalConfigItem<Value>
|
|
122
|
+
| IBooleanConfigItem<Value>;
|
|
123
|
+
|
|
124
|
+
export type ConfigType<Values> = {
|
|
125
|
+
[K in keyof Values]: ConfigItem<Values[K]>;
|
|
126
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ComponentStory } from '@storybook/react';
|
|
2
|
+
import { countries } from 'country-flag-icons';
|
|
3
|
+
import { Flag } from './Flag';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Flag',
|
|
7
|
+
component: Flag,
|
|
8
|
+
argTypes: {
|
|
9
|
+
countryCode: { control: 'select', options: countries },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Template: ComponentStory<typeof Flag> = (args) => (
|
|
14
|
+
<div style={{ width: 60, height: 40 }}>
|
|
15
|
+
<Flag {...args} />
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const Default = Template.bind({});
|
|
20
|
+
|
|
21
|
+
Default.args = {
|
|
22
|
+
countryCode: 'ug',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
Default.parameters = {
|
|
26
|
+
controls: {
|
|
27
|
+
exclude: ['data'],
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { colors } from '../../theme';
|
|
2
|
+
import { ComponentStyles } from '../../types';
|
|
3
|
+
|
|
4
|
+
export const styles = {
|
|
5
|
+
root: {
|
|
6
|
+
// приходится хардкодить в компоненте, тк либа Flags выдает флаги с 2-3 пиксельным отступом снизу
|
|
7
|
+
// если будет нужно, то можно вынести border на уровень пропсов
|
|
8
|
+
border: [1, 'solid', colors.BORDER_MAIN],
|
|
9
|
+
borderRadius: 2,
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
noFlag: {
|
|
13
|
+
width: 20,
|
|
14
|
+
color: colors.FONT_MEDIUM,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type FlagStyles = ComponentStyles<typeof styles>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import Flags from 'country-flag-icons/react/3x2';
|
|
3
|
+
import { hasFlag } from 'country-flag-icons';
|
|
4
|
+
import { useTheme } from '../../hooks';
|
|
5
|
+
import { Icon } from '../Icon';
|
|
6
|
+
import { ICommonProps } from '../../types';
|
|
7
|
+
|
|
8
|
+
import { FlagStyles, styles } from './Flag.styles';
|
|
9
|
+
|
|
10
|
+
export interface IFlagProps extends ICommonProps {
|
|
11
|
+
tweakStyles?: FlagStyles;
|
|
12
|
+
countryCode?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Flag: FC<IFlagProps> = ({ countryCode = '', tweakStyles }) => {
|
|
16
|
+
const { classes } = useTheme('Flag', styles, tweakStyles);
|
|
17
|
+
const CC = countryCode.toUpperCase();
|
|
18
|
+
|
|
19
|
+
const TheFlag = hasFlag(CC)
|
|
20
|
+
? Flags[CC as keyof typeof Flags]
|
|
21
|
+
: () => (
|
|
22
|
+
<div className={classes.noFlag}>
|
|
23
|
+
<Icon type="minus" />
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return <TheFlag className={classes.root} />;
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'country-flag-icons/react/3x2';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ComponentStory } from '@storybook/react';
|
|
2
|
+
import { FlexibleTable } from './FlexibleTable';
|
|
3
|
+
import { FlexibleTableConfigType } from './types';
|
|
4
|
+
import content from './fixture-test';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Table/FlexibleTable',
|
|
8
|
+
component: FlexibleTable,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
interface ITableContent {
|
|
12
|
+
contractCode: string;
|
|
13
|
+
validFrom: Date;
|
|
14
|
+
validTo: Date;
|
|
15
|
+
title: string;
|
|
16
|
+
signDate: Date;
|
|
17
|
+
partner: string;
|
|
18
|
+
partnerDescription: string;
|
|
19
|
+
parentContract: string;
|
|
20
|
+
currency: string;
|
|
21
|
+
status: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const config: FlexibleTableConfigType<ITableContent> = {
|
|
25
|
+
contractCode: {
|
|
26
|
+
title: 'Contract Code',
|
|
27
|
+
},
|
|
28
|
+
title: {
|
|
29
|
+
title: 'Title',
|
|
30
|
+
minWidth: 320,
|
|
31
|
+
},
|
|
32
|
+
validFrom: {
|
|
33
|
+
title: 'Valid From',
|
|
34
|
+
},
|
|
35
|
+
validTo: {
|
|
36
|
+
title: 'Valid From',
|
|
37
|
+
},
|
|
38
|
+
signDate: {
|
|
39
|
+
title: 'Sign Date',
|
|
40
|
+
},
|
|
41
|
+
partner: {
|
|
42
|
+
title: 'Partner',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const Template: ComponentStory<typeof FlexibleTable<ITableContent>> = (
|
|
47
|
+
args,
|
|
48
|
+
) => (
|
|
49
|
+
<FlexibleTable<ITableContent>
|
|
50
|
+
{...args}
|
|
51
|
+
uniqueField="contractCode"
|
|
52
|
+
expandableRowComponent={(item, _, close) =>
|
|
53
|
+
item.contractCode === 'OB_UT_M119' ? (
|
|
54
|
+
<div onClick={close}>всем привет :) {item.contractCode}</div>
|
|
55
|
+
) : null
|
|
56
|
+
}
|
|
57
|
+
content={content}
|
|
58
|
+
config={config}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export const Default = Template.bind({});
|
|
63
|
+
|
|
64
|
+
Default.args = {
|
|
65
|
+
isHorizontallyScrollable: true,
|
|
66
|
+
isFirstColumnSticky: true,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
Default.parameters = {
|
|
70
|
+
controls: {
|
|
71
|
+
exclude: [
|
|
72
|
+
'data',
|
|
73
|
+
'testId',
|
|
74
|
+
'onHeadClick',
|
|
75
|
+
'onRowClick',
|
|
76
|
+
'onRowHover',
|
|
77
|
+
'expandableRowComponent',
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { colors } from '../../theme';
|
|
2
|
+
import { rgba } from '../../helpers';
|
|
3
|
+
import { ComponentStyles } from '../../types';
|
|
4
|
+
|
|
5
|
+
const STICKY_SHADOW_PADDING = 12;
|
|
6
|
+
|
|
7
|
+
export const styles = {
|
|
8
|
+
root: {
|
|
9
|
+
position: 'relative',
|
|
10
|
+
width: '100%',
|
|
11
|
+
borderCollapse: 'separate',
|
|
12
|
+
borderSpacing: 0,
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
row: {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
scroll: {
|
|
20
|
+
overflow: 'auto',
|
|
21
|
+
/*
|
|
22
|
+
Чтобы сделать таблицу на всю высоту проставьте
|
|
23
|
+
height у родителя таблицы у себя в проекте.
|
|
24
|
+
Например: height: calc(100vh -{высота шапки}px)
|
|
25
|
+
*/
|
|
26
|
+
maxHeight: '100%',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
horizontallyScrolled: {
|
|
30
|
+
'& $cellSticky': {
|
|
31
|
+
boxShadow: '4px 0 4px rgba(0, 0, 0, 0.05)',
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
'& $headerSticky::before': {
|
|
35
|
+
boxShadow: '4px 0 4px rgba(0, 0, 0, 0.05)',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
loader: {
|
|
40
|
+
position: 'sticky',
|
|
41
|
+
left: 0,
|
|
42
|
+
maxWidth: '100vw',
|
|
43
|
+
height: 48,
|
|
44
|
+
display: 'flex',
|
|
45
|
+
justifyContent: 'center',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
headerRow: {
|
|
50
|
+
verticalAlign: 'bottom',
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
activeRow: {},
|
|
54
|
+
|
|
55
|
+
cell: {
|
|
56
|
+
position: 'relative',
|
|
57
|
+
boxSizing: 'content-box',
|
|
58
|
+
padding: [14, 7, 14, 7],
|
|
59
|
+
fontSize: 14,
|
|
60
|
+
lineHeight: 1.42,
|
|
61
|
+
zIndex: 5,
|
|
62
|
+
verticalAlign: 'top',
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
cellSticky: {
|
|
66
|
+
zIndex: 19,
|
|
67
|
+
paddingLeft: 24,
|
|
68
|
+
paddingRight: 12,
|
|
69
|
+
transition: ['box-shadow', '0.25s', 'ease-in-out'],
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
cellSecond: {
|
|
73
|
+
paddingLeft: STICKY_SHADOW_PADDING,
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
header: {
|
|
77
|
+
position: 'sticky',
|
|
78
|
+
boxSizing: 'content-box',
|
|
79
|
+
top: 0,
|
|
80
|
+
zIndex: 10,
|
|
81
|
+
fontSize: 12,
|
|
82
|
+
fontWeight: 'normal',
|
|
83
|
+
padding: [0, 7, 16, 7],
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
headerSticky: {
|
|
87
|
+
zIndex: 20,
|
|
88
|
+
left: 0,
|
|
89
|
+
paddingLeft: 24,
|
|
90
|
+
paddingRight: 12,
|
|
91
|
+
|
|
92
|
+
'&::before': {
|
|
93
|
+
content: '""',
|
|
94
|
+
display: 'block',
|
|
95
|
+
width: '100%',
|
|
96
|
+
height: '100%',
|
|
97
|
+
position: 'absolute',
|
|
98
|
+
left: 0,
|
|
99
|
+
top: 0,
|
|
100
|
+
background: 'transparent',
|
|
101
|
+
pointerEvents: 'none',
|
|
102
|
+
zIndex: 1,
|
|
103
|
+
transition: ['box-shadow', '0.25s', 'ease-in-out'],
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
'&::after': {
|
|
107
|
+
content: '""',
|
|
108
|
+
display: 'block',
|
|
109
|
+
width: STICKY_SHADOW_PADDING,
|
|
110
|
+
height: '100%',
|
|
111
|
+
position: 'absolute',
|
|
112
|
+
left: '100%',
|
|
113
|
+
top: 0,
|
|
114
|
+
background: `linear-gradient(90deg, ${colors.CLASSIC_WHITE}, ${rgba(
|
|
115
|
+
colors.CLASSIC_WHITE,
|
|
116
|
+
0,
|
|
117
|
+
)})`,
|
|
118
|
+
zIndex: 0,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
headerSecond: {
|
|
123
|
+
paddingLeft: STICKY_SHADOW_PADDING,
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
editableRow: {
|
|
127
|
+
cursor: 'pointer',
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type FlexibleTableStyles = ComponentStyles<typeof styles>;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
RefObject,
|
|
3
|
+
useCallback,
|
|
4
|
+
useEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
|
|
11
|
+
import { ThemedPreloader } from '../ThemedPreloader';
|
|
12
|
+
import { addDataAttributes } from '../../helpers';
|
|
13
|
+
import { useTheme } from '../../hooks';
|
|
14
|
+
import { ICommonProps } from '../../types';
|
|
15
|
+
import {
|
|
16
|
+
FlexibleTableConfigType,
|
|
17
|
+
IInfinityScrollConfig,
|
|
18
|
+
ITitleComponent,
|
|
19
|
+
} from './types';
|
|
20
|
+
import TableRow from './TableRow';
|
|
21
|
+
|
|
22
|
+
import { FlexibleTableStyles, styles } from './FlexibleTable.styles';
|
|
23
|
+
|
|
24
|
+
export interface IFlexibleTableProps<Values extends Record<string, any>>
|
|
25
|
+
extends ICommonProps {
|
|
26
|
+
tweakStyles?: FlexibleTableStyles;
|
|
27
|
+
content: Values[];
|
|
28
|
+
headerContent?: Partial<Record<keyof Values, any>>;
|
|
29
|
+
enabledColumns?: Array<keyof Values>;
|
|
30
|
+
activeRows?: number[];
|
|
31
|
+
config?: FlexibleTableConfigType<Values>;
|
|
32
|
+
isHorizontallyScrollable?: boolean;
|
|
33
|
+
isFirstColumnSticky?: boolean;
|
|
34
|
+
infinityScrollConfig?: IInfinityScrollConfig;
|
|
35
|
+
uniqueField?: keyof Values;
|
|
36
|
+
onHeadClick?: (column: keyof Values) => void;
|
|
37
|
+
onRowClick?: (id: string) => void;
|
|
38
|
+
onRowHover?: (id?: string) => void;
|
|
39
|
+
rowAttributes?: Array<keyof Values>;
|
|
40
|
+
refForScroll?: RefObject<HTMLDivElement>;
|
|
41
|
+
nothingFoundContent?: React.ReactNode;
|
|
42
|
+
expandableRowComponent?: (
|
|
43
|
+
item: Values,
|
|
44
|
+
isOpen: boolean,
|
|
45
|
+
close: () => void,
|
|
46
|
+
) => React.ReactNode;
|
|
47
|
+
testId?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function FlexibleTable<Values extends Record<string, any>>({
|
|
51
|
+
data,
|
|
52
|
+
tweakStyles,
|
|
53
|
+
content,
|
|
54
|
+
headerContent,
|
|
55
|
+
config,
|
|
56
|
+
activeRows,
|
|
57
|
+
enabledColumns,
|
|
58
|
+
isHorizontallyScrollable,
|
|
59
|
+
isFirstColumnSticky,
|
|
60
|
+
infinityScrollConfig,
|
|
61
|
+
uniqueField,
|
|
62
|
+
onHeadClick,
|
|
63
|
+
onRowHover,
|
|
64
|
+
onRowClick,
|
|
65
|
+
refForScroll,
|
|
66
|
+
rowAttributes,
|
|
67
|
+
nothingFoundContent,
|
|
68
|
+
testId,
|
|
69
|
+
expandableRowComponent,
|
|
70
|
+
}: IFlexibleTableProps<Values>): JSX.Element {
|
|
71
|
+
const { classes } = useTheme('FlexibleTable', styles, tweakStyles);
|
|
72
|
+
|
|
73
|
+
const observer = useRef<IntersectionObserver>();
|
|
74
|
+
const scrollRef = useRef<HTMLDivElement>(null);
|
|
75
|
+
|
|
76
|
+
const [isHorizontallyScrolled, setIsHorizontallyScrolled] = useState(false);
|
|
77
|
+
|
|
78
|
+
const initIntersectionObserver = useCallback(
|
|
79
|
+
(node: HTMLDivElement) => {
|
|
80
|
+
if (infinityScrollConfig) {
|
|
81
|
+
if (
|
|
82
|
+
infinityScrollConfig.isLoading ||
|
|
83
|
+
infinityScrollConfig.activePage >= infinityScrollConfig.totalPages
|
|
84
|
+
) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (observer.current) {
|
|
89
|
+
observer.current.disconnect();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
observer.current = new IntersectionObserver((entries) => {
|
|
93
|
+
if (entries[0].isIntersecting) {
|
|
94
|
+
infinityScrollConfig.onInfinityScroll(
|
|
95
|
+
infinityScrollConfig.activePage + 1,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
if (node) {
|
|
101
|
+
observer.current.observe(node);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
[
|
|
106
|
+
infinityScrollConfig?.activePage,
|
|
107
|
+
infinityScrollConfig?.totalPages,
|
|
108
|
+
infinityScrollConfig?.onInfinityScroll,
|
|
109
|
+
],
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const tableRowClasses = useMemo(
|
|
113
|
+
() => ({
|
|
114
|
+
root: classes.row,
|
|
115
|
+
active: classes.activeRow,
|
|
116
|
+
editable: classes.editableRow,
|
|
117
|
+
cell: {
|
|
118
|
+
root: classes.cell,
|
|
119
|
+
sticky: classes.cellSticky,
|
|
120
|
+
second: classes.cellSecond,
|
|
121
|
+
},
|
|
122
|
+
}),
|
|
123
|
+
[tweakStyles],
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
const scrollContainer = (refForScroll ?? scrollRef).current;
|
|
128
|
+
if (
|
|
129
|
+
scrollContainer === null ||
|
|
130
|
+
!isHorizontallyScrollable ||
|
|
131
|
+
!isFirstColumnSticky
|
|
132
|
+
) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const scrollHandler = (e: Event) => {
|
|
136
|
+
setIsHorizontallyScrolled((e.target as HTMLDivElement).scrollLeft > 0);
|
|
137
|
+
};
|
|
138
|
+
scrollContainer.addEventListener('scroll', scrollHandler);
|
|
139
|
+
return () => scrollContainer.removeEventListener('scroll', scrollHandler);
|
|
140
|
+
}, [scrollRef]);
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<div
|
|
144
|
+
ref={refForScroll ?? scrollRef}
|
|
145
|
+
className={clsx(
|
|
146
|
+
isHorizontallyScrollable && classes.scroll,
|
|
147
|
+
isHorizontallyScrolled && classes.horizontallyScrolled,
|
|
148
|
+
)}
|
|
149
|
+
>
|
|
150
|
+
<table
|
|
151
|
+
className={classes.root}
|
|
152
|
+
data-testid={testId}
|
|
153
|
+
{...addDataAttributes(data)}
|
|
154
|
+
>
|
|
155
|
+
<thead>
|
|
156
|
+
<tr className={clsx(classes.row, classes.headerRow)}>
|
|
157
|
+
{(enabledColumns || Object.keys(content[0])).map((key, idx) => {
|
|
158
|
+
const itemConfig = config?.[key];
|
|
159
|
+
|
|
160
|
+
let titleContent = itemConfig?.title ?? '';
|
|
161
|
+
|
|
162
|
+
if (itemConfig?.titleComponent !== undefined) {
|
|
163
|
+
const TitleComponent =
|
|
164
|
+
itemConfig?.titleComponent as ITitleComponent<any>;
|
|
165
|
+
titleContent = <TitleComponent value={headerContent?.[key]} />;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<th
|
|
170
|
+
className={clsx(
|
|
171
|
+
classes.header,
|
|
172
|
+
isFirstColumnSticky && idx === 0 && classes.headerSticky,
|
|
173
|
+
isFirstColumnSticky && idx === 1 && classes.headerSecond,
|
|
174
|
+
)}
|
|
175
|
+
style={{
|
|
176
|
+
minWidth: itemConfig?.minWidth,
|
|
177
|
+
width: itemConfig?.width,
|
|
178
|
+
maxWidth: itemConfig?.maxWidth,
|
|
179
|
+
textAlign: itemConfig?.titleAlign ?? 'left',
|
|
180
|
+
}}
|
|
181
|
+
key={key as string}
|
|
182
|
+
onClick={() => (onHeadClick ? onHeadClick(key) : undefined)}
|
|
183
|
+
>
|
|
184
|
+
{titleContent}
|
|
185
|
+
</th>
|
|
186
|
+
);
|
|
187
|
+
})}
|
|
188
|
+
</tr>
|
|
189
|
+
</thead>
|
|
190
|
+
<tbody>
|
|
191
|
+
{content.length === 0 &&
|
|
192
|
+
nothingFoundContent !== undefined &&
|
|
193
|
+
!infinityScrollConfig?.isLoading &&
|
|
194
|
+
(infinityScrollConfig?.isLastPage === undefined ||
|
|
195
|
+
infinityScrollConfig.isLastPage) && (
|
|
196
|
+
<tr>
|
|
197
|
+
<td
|
|
198
|
+
colSpan={(enabledColumns || Object.keys(content[0])).length}
|
|
199
|
+
>
|
|
200
|
+
{nothingFoundContent}
|
|
201
|
+
</td>
|
|
202
|
+
</tr>
|
|
203
|
+
)}
|
|
204
|
+
|
|
205
|
+
{content.map((item, idx) => (
|
|
206
|
+
<TableRow
|
|
207
|
+
item={item}
|
|
208
|
+
uniqueField={uniqueField}
|
|
209
|
+
isActive={activeRows?.includes(idx) ?? false}
|
|
210
|
+
isFirstColumnSticky={isFirstColumnSticky}
|
|
211
|
+
onRowClick={onRowClick}
|
|
212
|
+
onRowHover={onRowHover}
|
|
213
|
+
enabledColumns={enabledColumns}
|
|
214
|
+
config={config}
|
|
215
|
+
classes={tableRowClasses}
|
|
216
|
+
key={uniqueField ? item[uniqueField] : idx}
|
|
217
|
+
rowAttributes={rowAttributes}
|
|
218
|
+
expandableRowComponent={expandableRowComponent}
|
|
219
|
+
/>
|
|
220
|
+
))}
|
|
221
|
+
|
|
222
|
+
{infinityScrollConfig !== undefined &&
|
|
223
|
+
!infinityScrollConfig.isLastPage && (
|
|
224
|
+
<tr>
|
|
225
|
+
<td
|
|
226
|
+
colSpan={(enabledColumns || Object.keys(content[0])).length}
|
|
227
|
+
>
|
|
228
|
+
<div
|
|
229
|
+
ref={initIntersectionObserver}
|
|
230
|
+
className={classes.loader}
|
|
231
|
+
>
|
|
232
|
+
<ThemedPreloader type="dots" />
|
|
233
|
+
</div>
|
|
234
|
+
</td>
|
|
235
|
+
</tr>
|
|
236
|
+
)}
|
|
237
|
+
</tbody>
|
|
238
|
+
</table>
|
|
239
|
+
</div>
|
|
240
|
+
);
|
|
241
|
+
}
|