@true-engineering/true-react-common-ui-kit 2.6.0 → 3.0.0-alpha.0
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/dist/components/AccountInfo/AccountInfo.d.ts +2 -3
- package/dist/components/AccountInfo/AccountInfo.styles.d.ts +6 -64
- package/dist/components/AccountInfo/index.d.ts +1 -1
- package/dist/components/AddButton/AddButton.d.ts +2 -3
- package/dist/components/AddButton/AddButton.styles.d.ts +3 -28
- package/dist/components/AddButton/index.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -4
- package/dist/components/Button/Button.styles.d.ts +8 -150
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +3 -17
- package/dist/components/Checkbox/Checkbox.styles.d.ts +3 -50
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/CloseButton/CloseButton.d.ts +3 -5
- package/dist/components/CloseButton/CloseButton.styles.d.ts +3 -27
- package/dist/components/CloseButton/index.d.ts +1 -1
- package/dist/components/Colors/Colors.styles.d.ts +1 -32
- package/dist/components/Colors/index.d.ts +0 -1
- package/dist/components/CssBaseline/CssBaseline.d.ts +2 -4
- package/dist/components/CssBaseline/CssBaseline.styles.d.ts +3 -11
- package/dist/components/CssBaseline/index.d.ts +1 -1
- package/dist/components/DateInput/DateInput.d.ts +3 -3
- package/dist/components/DateInput/DateInput.styles.d.ts +6 -11
- package/dist/components/DateInput/index.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +5 -7
- package/dist/components/DatePicker/DatePicker.styles.d.ts +6 -33
- package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.d.ts +3 -3
- package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +7 -69
- package/dist/components/DatePicker/components/DatePickerHeader/index.d.ts +1 -1
- package/dist/components/DatePicker/index.d.ts +2 -2
- package/dist/components/Description/Description.d.ts +2 -3
- package/dist/components/Description/Description.styles.d.ts +3 -24
- package/dist/components/Description/index.d.ts +1 -1
- package/dist/components/FiltersPane/FiltersPane.d.ts +6 -8
- package/dist/components/FiltersPane/FiltersPane.styles.d.ts +8 -56
- package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.d.ts +2 -4
- package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +15 -52
- package/dist/components/FiltersPane/components/FilterInterval/index.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.d.ts +2 -4
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +15 -124
- package/dist/components/FiltersPane/components/FilterSelect/index.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.d.ts +3 -1
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.styles.d.ts +3 -12
- package/dist/components/FiltersPane/components/FilterValueView/index.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.d.ts +5 -7
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +26 -47
- package/dist/components/FiltersPane/components/FilterWithDates/index.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.d.ts +4 -6
- package/dist/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.styles.d.ts +7 -12
- package/dist/components/FiltersPane/components/FilterWithPeriod/index.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +5 -6
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +6 -96
- package/dist/components/FiltersPane/components/FilterWrapper/index.d.ts +1 -1
- package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.d.ts +2 -4
- package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +10 -91
- package/dist/components/FiltersPane/components/FiltersPaneSearch/index.d.ts +1 -1
- package/dist/components/FiltersPane/helpers.d.ts +1 -1
- package/dist/components/FiltersPane/index.d.ts +1 -1
- package/dist/components/FiltersPane/types.d.ts +1 -1
- package/dist/components/Flag/Flag.d.ts +2 -3
- package/dist/components/Flag/Flag.styles.d.ts +3 -12
- package/dist/components/Flag/index.d.ts +1 -1
- package/dist/components/FlexibleTable/FlexibleTable.d.ts +2 -4
- package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +7 -101
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.d.ts +17 -0
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +3 -0
- package/dist/components/FlexibleTable/components/FlexibleTableCell/index.d.ts +2 -0
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +19 -0
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +6 -0
- package/dist/components/FlexibleTable/components/FlexibleTableRow/index.d.ts +2 -0
- package/dist/components/FlexibleTable/components/index.d.ts +2 -2
- package/dist/components/FlexibleTable/index.d.ts +2 -1
- package/dist/components/Icon/Icon.d.ts +2 -3
- package/dist/components/Icon/Icon.styles.d.ts +3 -8
- package/dist/components/Icon/icons-list.d.ts +1 -1
- package/dist/components/Icon/index.d.ts +1 -1
- package/dist/components/IncrementInput/IncrementInput.d.ts +3 -3
- package/dist/components/IncrementInput/IncrementInput.styles.d.ts +7 -61
- package/dist/components/IncrementInput/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +2 -4
- package/dist/components/Input/Input.styles.d.ts +6 -247
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/List/List.d.ts +2 -4
- package/dist/components/List/List.styles.d.ts +3 -39
- package/dist/components/List/index.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts +2 -4
- package/dist/components/Modal/Modal.styles.d.ts +6 -239
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/MoreMenu/MoreMenu.d.ts +2 -4
- package/dist/components/MoreMenu/MoreMenu.styles.d.ts +6 -54
- package/dist/components/MoreMenu/index.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +8 -8
- package/dist/components/MultiSelect/MultiSelect.styles.d.ts +7 -44
- package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.d.ts +4 -4
- package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.d.ts +3 -62
- package/dist/components/MultiSelect/components/MultiSelectInput/index.d.ts +1 -1
- package/dist/components/MultiSelect/index.d.ts +2 -2
- package/dist/components/MultiSelect/types.d.ts +1 -1
- package/dist/components/MultiSelectList/MultiSelectList.d.ts +2 -4
- package/dist/components/MultiSelectList/MultiSelectList.styles.d.ts +13 -105
- package/dist/components/MultiSelectList/index.d.ts +1 -1
- package/dist/components/Notification/Notification.d.ts +4 -6
- package/dist/components/Notification/Notification.styles.d.ts +3 -37
- package/dist/components/Notification/index.d.ts +1 -1
- package/dist/components/Notification/types.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.d.ts +3 -3
- package/dist/components/PhoneInput/PhoneInput.styles.d.ts +9 -66
- package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.d.ts +2 -3
- package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.d.ts +7 -83
- package/dist/components/PhoneInput/components/PhoneInputCountryList/index.d.ts +1 -1
- package/dist/components/PhoneInput/index.d.ts +2 -2
- package/dist/components/RadioButton/RadioButton.d.ts +3 -4
- package/dist/components/RadioButton/RadioButton.styles.d.ts +3 -30
- package/dist/components/RadioButton/index.d.ts +1 -1
- package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +4 -4
- package/dist/components/SearchInput/SearchInput.d.ts +3 -4
- package/dist/components/SearchInput/SearchInput.styles.d.ts +7 -39
- package/dist/components/SearchInput/index.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +3 -4
- package/dist/components/Select/Select.styles.d.ts +33 -80
- package/dist/components/Select/components/SelectList/SelectList.d.ts +2 -4
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +3 -57
- package/dist/components/Select/components/SelectList/index.d.ts +1 -1
- package/dist/components/Select/components/SelectListItem/SelectListItem.styles.d.ts +2 -2
- package/dist/components/Select/index.d.ts +2 -2
- package/dist/components/SmartInput/SmartInput.d.ts +2 -2
- package/dist/components/SmartInput/helpers.d.ts +2 -2
- package/dist/components/SmartInput/types.d.ts +1 -1
- package/dist/components/Switch/Switch.d.ts +2 -4
- package/dist/components/Switch/Switch.styles.d.ts +3 -62
- package/dist/components/Switch/index.d.ts +1 -1
- package/dist/components/TextArea/TextArea.d.ts +2 -4
- package/dist/components/TextArea/TextArea.styles.d.ts +3 -128
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/TextWithInfo/TextWithInfo.d.ts +2 -3
- package/dist/components/TextWithInfo/TextWithInfo.styles.d.ts +3 -48
- package/dist/components/TextWithInfo/index.d.ts +1 -1
- package/dist/components/TextWithTooltip/TextWithTooltip.d.ts +2 -3
- package/dist/components/TextWithTooltip/TextWithTooltip.styles.d.ts +6 -14
- package/dist/components/TextWithTooltip/index.d.ts +1 -1
- package/dist/components/ThemedPreloader/ThemedPreloader.d.ts +2 -3
- package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +7 -14
- package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.d.ts +2 -4
- package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.d.ts +3 -43
- package/dist/components/ThemedPreloader/components/DotsPreloader/index.d.ts +1 -1
- package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.d.ts +2 -3
- package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.styles.d.ts +3 -9
- package/dist/components/ThemedPreloader/components/SvgPreloader/index.d.ts +1 -1
- package/dist/components/ThemedPreloader/index.d.ts +2 -2
- package/dist/components/Toaster/Toaster.d.ts +4 -5
- package/dist/components/Toaster/Toaster.styles.d.ts +6 -45
- package/dist/components/Toaster/index.d.ts +1 -1
- package/dist/components/Toaster/types.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +2 -3
- package/dist/components/Tooltip/Tooltip.styles.d.ts +3 -35
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/phone.d.ts +3 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/use-tweak-styles.d.ts +21 -2
- package/dist/index.d.ts +1 -1
- package/dist/theme/Provider.d.ts +11 -0
- package/dist/{theme.d.ts → theme/common.d.ts} +6 -10
- package/dist/theme/helpers.d.ts +10 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/types.d.ts +72 -0
- package/dist/true-react-common-ui-kit.js +2980 -2471
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +2912 -2403
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +4 -22
- package/package.json +2 -2
- package/src/components/AccountInfo/AccountInfo.styles.ts +5 -9
- package/src/components/AccountInfo/AccountInfo.tsx +13 -10
- package/src/components/AccountInfo/constants.ts +1 -1
- package/src/components/AccountInfo/index.ts +1 -1
- package/src/components/AddButton/AddButton.styles.ts +4 -4
- package/src/components/AddButton/AddButton.tsx +7 -6
- package/src/components/AddButton/index.ts +1 -1
- package/src/components/Button/Button.styles.ts +14 -9
- package/src/components/Button/Button.tsx +12 -19
- package/src/components/Button/index.ts +1 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +5 -9
- package/src/components/Checkbox/Checkbox.styles.ts +8 -24
- package/src/components/Checkbox/Checkbox.tsx +3 -25
- package/src/components/Checkbox/index.ts +1 -1
- package/src/components/CloseButton/CloseButton.styles.ts +4 -5
- package/src/components/CloseButton/CloseButton.tsx +6 -8
- package/src/components/CloseButton/index.ts +1 -1
- package/src/components/Colors/Colors.styles.ts +3 -5
- package/src/components/Colors/Colors.tsx +3 -3
- package/src/components/Colors/index.ts +0 -1
- package/src/components/CssBaseline/CssBaseline.styles.ts +4 -5
- package/src/components/CssBaseline/CssBaseline.tsx +6 -8
- package/src/components/CssBaseline/index.ts +1 -1
- package/src/components/DateInput/DateInput.styles.ts +10 -6
- package/src/components/DateInput/DateInput.tsx +20 -7
- package/src/components/DateInput/index.ts +1 -1
- package/src/components/DatePicker/DatePicker.styles.ts +8 -14
- package/src/components/DatePicker/DatePicker.tsx +15 -16
- package/src/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.ts +30 -26
- package/src/components/DatePicker/components/DatePickerHeader/DatePickerHeader.tsx +17 -7
- package/src/components/DatePicker/components/DatePickerHeader/index.ts +1 -1
- package/src/components/DatePicker/index.ts +2 -2
- package/src/components/Description/Description.styles.ts +4 -5
- package/src/components/Description/Description.tsx +6 -6
- package/src/components/Description/index.ts +1 -1
- package/src/components/FiltersPane/FiltersPane.styles.ts +38 -22
- package/src/components/FiltersPane/FiltersPane.tsx +23 -18
- package/src/components/FiltersPane/components/FilterInterval/FilterInterval.styles.ts +23 -27
- package/src/components/FiltersPane/components/FilterInterval/FilterInterval.tsx +25 -12
- package/src/components/FiltersPane/components/FilterInterval/index.ts +1 -1
- package/src/components/FiltersPane/components/FilterSelect/FilterSelect.styles.ts +21 -26
- package/src/components/FiltersPane/components/FilterSelect/FilterSelect.tsx +27 -14
- package/src/components/FiltersPane/components/FilterSelect/index.ts +1 -1
- package/src/components/FiltersPane/components/FilterValueView/FilterValueView.styles.tsx +4 -4
- package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +6 -4
- package/src/components/FiltersPane/components/FilterValueView/index.tsx +1 -1
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.ts +33 -26
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +54 -25
- package/src/components/FiltersPane/components/FilterWithDates/index.ts +1 -1
- package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.styles.ts +11 -7
- package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +12 -9
- package/src/components/FiltersPane/components/FilterWithPeriod/index.ts +1 -1
- package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.ts +11 -6
- package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.tsx +28 -10
- package/src/components/FiltersPane/components/FilterWrapper/index.ts +1 -1
- package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.ts +31 -24
- package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.tsx +23 -10
- package/src/components/FiltersPane/components/FiltersPaneSearch/index.ts +1 -1
- package/src/components/FiltersPane/helpers.ts +1 -1
- package/src/components/FiltersPane/index.ts +1 -1
- package/src/components/FiltersPane/types.ts +1 -1
- package/src/components/Flag/Flag.styles.ts +4 -5
- package/src/components/Flag/Flag.tsx +3 -5
- package/src/components/Flag/index.ts +1 -1
- package/src/components/FlexibleTable/FlexibleTable.stories.tsx +12 -0
- package/src/components/FlexibleTable/FlexibleTable.styles.ts +10 -37
- package/src/components/FlexibleTable/FlexibleTable.tsx +19 -28
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +28 -0
- package/src/components/FlexibleTable/components/{TableValue/TableValue.tsx → FlexibleTableCell/FlexibleTableCell.tsx} +11 -12
- package/src/components/FlexibleTable/components/FlexibleTableCell/index.ts +2 -0
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +19 -0
- package/src/components/FlexibleTable/components/{TableRow/TableRow.tsx → FlexibleTableRow/FlexibleTableRow.tsx} +24 -25
- package/src/components/FlexibleTable/components/FlexibleTableRow/index.ts +2 -0
- package/src/components/FlexibleTable/components/index.ts +2 -2
- package/src/components/FlexibleTable/index.ts +2 -1
- package/src/components/Icon/Icon.styles.ts +4 -4
- package/src/components/Icon/Icon.tsx +6 -7
- package/src/components/Icon/components/ComplexIconBoilerplate/ComplexIconBoilerplate.tsx +1 -1
- package/src/components/Icon/components/IconBolerplate/IconBoilerplate.tsx +1 -1
- package/src/components/Icon/helpers.ts +1 -1
- package/src/components/Icon/index.ts +1 -1
- package/src/components/IncrementInput/IncrementInput.styles.ts +12 -12
- package/src/components/IncrementInput/IncrementInput.tsx +59 -35
- package/src/components/IncrementInput/index.ts +1 -1
- package/src/components/Input/Input.styles.ts +8 -8
- package/src/components/Input/Input.tsx +10 -8
- package/src/components/Input/index.ts +1 -1
- package/src/components/List/List.styles.ts +4 -5
- package/src/components/List/List.tsx +3 -6
- package/src/components/List/index.ts +1 -1
- package/src/components/Modal/Modal.styles.ts +5 -7
- package/src/components/Modal/Modal.tsx +10 -8
- package/src/components/Modal/index.ts +1 -1
- package/src/components/MoreMenu/MoreMenu.styles.ts +5 -7
- package/src/components/MoreMenu/MoreMenu.tsx +10 -7
- package/src/components/MoreMenu/index.ts +1 -1
- package/src/components/MultiSelect/MultiSelect.styles.ts +11 -7
- package/src/components/MultiSelect/MultiSelect.tsx +24 -15
- package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.ts +4 -4
- package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +7 -6
- package/src/components/MultiSelect/components/MultiSelectInput/index.ts +1 -1
- package/src/components/MultiSelect/index.ts +2 -2
- package/src/components/MultiSelect/types.ts +1 -1
- package/src/components/MultiSelectList/MultiSelectList.styles.ts +37 -29
- package/src/components/MultiSelectList/MultiSelectList.tsx +36 -17
- package/src/components/MultiSelectList/helpers.ts +1 -1
- package/src/components/MultiSelectList/index.ts +1 -1
- package/src/components/Notification/Notification.styles.ts +14 -9
- package/src/components/Notification/Notification.tsx +6 -9
- package/src/components/Notification/index.ts +1 -1
- package/src/components/Notification/types.ts +1 -1
- package/src/components/PhoneInput/PhoneInput.styles.ts +18 -13
- package/src/components/PhoneInput/PhoneInput.tsx +34 -17
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.ts +18 -15
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +16 -6
- package/src/components/PhoneInput/components/PhoneInputCountryList/index.ts +1 -1
- package/src/components/PhoneInput/index.ts +2 -2
- package/src/components/RadioButton/RadioButton.styles.ts +4 -4
- package/src/components/RadioButton/RadioButton.tsx +6 -6
- package/src/components/RadioButton/index.ts +1 -1
- package/src/components/SearchInput/SearchInput.styles.ts +28 -28
- package/src/components/SearchInput/SearchInput.tsx +12 -7
- package/src/components/SearchInput/index.ts +1 -1
- package/src/components/Select/Select.styles.ts +71 -23
- package/src/components/Select/Select.tsx +33 -34
- package/src/components/Select/components/SelectList/SelectList.styles.ts +4 -5
- package/src/components/Select/components/SelectList/SelectList.tsx +6 -7
- package/src/components/Select/components/SelectList/index.ts +1 -1
- package/src/components/Select/components/SelectListItem/SelectListItem.styles.ts +2 -2
- package/src/components/Select/components/SelectListItem/SelectListItem.tsx +1 -1
- package/src/components/Select/helpers.ts +3 -2
- package/src/components/Select/index.ts +2 -2
- package/src/components/SmartInput/SmartInput.stories.tsx +2 -2
- package/src/components/SmartInput/SmartInput.tsx +2 -2
- package/src/components/SmartInput/helpers.ts +2 -2
- package/src/components/SmartInput/types.ts +1 -1
- package/src/components/Switch/Switch.styles.ts +4 -4
- package/src/components/Switch/Switch.tsx +3 -6
- package/src/components/Switch/index.ts +1 -1
- package/src/components/TextArea/TextArea.styles.ts +4 -4
- package/src/components/TextArea/TextArea.tsx +3 -6
- package/src/components/TextArea/index.ts +1 -1
- package/src/components/TextWithInfo/TextWithInfo.styles.ts +4 -5
- package/src/components/TextWithInfo/TextWithInfo.tsx +6 -5
- package/src/components/TextWithInfo/index.ts +1 -1
- package/src/components/TextWithTooltip/TextWithTooltip.styles.ts +8 -6
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +15 -9
- package/src/components/TextWithTooltip/index.ts +1 -1
- package/src/components/ThemedPreloader/ThemedPreloader.styles.ts +11 -6
- package/src/components/ThemedPreloader/ThemedPreloader.tsx +19 -11
- package/src/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.ts +4 -4
- package/src/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.tsx +3 -6
- package/src/components/ThemedPreloader/components/DotsPreloader/index.ts +1 -1
- package/src/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.styles.ts +4 -4
- package/src/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.tsx +5 -6
- package/src/components/ThemedPreloader/components/SvgPreloader/index.ts +1 -1
- package/src/components/ThemedPreloader/index.ts +2 -2
- package/src/components/Toaster/Toaster.styles.ts +8 -7
- package/src/components/Toaster/Toaster.tsx +15 -9
- package/src/components/Toaster/index.ts +1 -1
- package/src/components/Toaster/types.ts +1 -1
- package/src/components/Tooltip/Tooltip.styles.ts +20 -16
- package/src/components/Tooltip/Tooltip.tsx +10 -6
- package/src/components/Tooltip/index.ts +1 -1
- package/src/helpers/index.ts +0 -1
- package/src/helpers/misc.ts +1 -1
- package/src/helpers/phone.ts +4 -1
- package/src/hooks/index.ts +0 -1
- package/src/hooks/use-tweak-styles.ts +56 -12
- package/src/index.ts +1 -1
- package/src/theme/Provider.tsx +21 -0
- package/src/{theme.ts → theme/common.ts} +6 -6
- package/src/theme/helpers.ts +74 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/types.ts +137 -0
- package/src/types.ts +4 -82
- package/dist/components/FlexibleTable/components/TableRow/TableRow.d.ts +0 -28
- package/dist/components/FlexibleTable/components/TableRow/index.d.ts +0 -1
- package/dist/components/FlexibleTable/components/TableValue/TableValue.d.ts +0 -21
- package/dist/components/FlexibleTable/components/TableValue/index.d.ts +0 -1
- package/dist/components/IncrementInput/components/ChangeButton/ChangeButton.d.ts +0 -10
- package/dist/components/IncrementInput/components/ChangeButton/index.d.ts +0 -1
- package/dist/components/IncrementInput/components/index.d.ts +0 -1
- package/dist/helpers/deprecated.d.ts +0 -12
- package/dist/hooks/use-theme.d.ts +0 -9
- package/src/components/FlexibleTable/components/TableRow/index.ts +0 -1
- package/src/components/FlexibleTable/components/TableValue/index.ts +0 -1
- package/src/components/IncrementInput/components/ChangeButton/ChangeButton.tsx +0 -33
- package/src/components/IncrementInput/components/ChangeButton/index.ts +0 -1
- package/src/components/IncrementInput/components/index.ts +0 -1
- package/src/helpers/deprecated.ts +0 -23
- package/src/hooks/use-theme.ts +0 -32
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import { FC, useState, useRef, useMemo, MouseEvent, FocusEvent, FormEvent } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
+
import { addDataTestId, getTestId } from '@true-engineering/true-react-platform-helpers';
|
|
3
4
|
import {
|
|
4
5
|
getCountryCodeFromPhone,
|
|
5
6
|
getFullPhone,
|
|
6
7
|
getPhoneMask,
|
|
7
8
|
getPhoneObjFromString,
|
|
8
9
|
findCountryByCode,
|
|
10
|
+
addDataAttributes,
|
|
9
11
|
} from '../../helpers';
|
|
10
|
-
import { useOnClickOutsideWithRef,
|
|
12
|
+
import { useOnClickOutsideWithRef, useTweakStyles } from '../../hooks';
|
|
13
|
+
import { ICommonProps } from '../../types';
|
|
11
14
|
import { Flag } from '../Flag';
|
|
12
15
|
import { Icon } from '../Icon';
|
|
13
16
|
import { IInputProps, Input } from '../Input';
|
|
14
17
|
import { PhoneInputCountryList } from './components';
|
|
15
18
|
import { DEFAULT_VALUE } from './constants';
|
|
16
19
|
import { IPhoneInfo, IPhoneValue } from './types';
|
|
17
|
-
import {
|
|
20
|
+
import { useStyles, IPhoneInputStyles, inputStyles } from './PhoneInput.styles';
|
|
18
21
|
|
|
19
22
|
export interface IPhoneInputProps
|
|
20
|
-
extends Omit<
|
|
21
|
-
|
|
23
|
+
extends Omit<
|
|
24
|
+
IInputProps,
|
|
25
|
+
'value' | 'onChange' | 'type' | 'mask' | 'units' | 'placeholder' | 'tweakStyles'
|
|
26
|
+
>,
|
|
27
|
+
ICommonProps<IPhoneInputStyles> {
|
|
22
28
|
locale?: string;
|
|
23
29
|
codeSearchPlaceholder?: string;
|
|
24
30
|
noMatchesLabel?: string;
|
|
@@ -33,6 +39,7 @@ export const PhoneInput: FC<IPhoneInputProps> = ({
|
|
|
33
39
|
locale = 'ru',
|
|
34
40
|
value = DEFAULT_VALUE,
|
|
35
41
|
onChange,
|
|
42
|
+
data,
|
|
36
43
|
testId,
|
|
37
44
|
isDisabled,
|
|
38
45
|
isInvalid,
|
|
@@ -42,13 +49,27 @@ export const PhoneInput: FC<IPhoneInputProps> = ({
|
|
|
42
49
|
noMatchesLabel = 'Ничего не найдено',
|
|
43
50
|
...inputProps
|
|
44
51
|
}) => {
|
|
45
|
-
const
|
|
52
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
53
|
+
|
|
54
|
+
const tweakInputStyles = useTweakStyles({
|
|
55
|
+
innerStyles: inputStyles,
|
|
56
|
+
tweakStyles,
|
|
57
|
+
className: 'tweakInput',
|
|
58
|
+
currentComponentName: 'PhoneInput',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const tweakCountryListStyles = useTweakStyles({
|
|
62
|
+
tweakStyles,
|
|
63
|
+
className: 'tweakCountryList',
|
|
64
|
+
currentComponentName: 'PhoneInput',
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const [isListOpen, setIsListOpen] = useState(false);
|
|
68
|
+
const [isFocused, setFocused] = useState(false);
|
|
46
69
|
|
|
47
70
|
const list = useRef<HTMLDivElement>(null);
|
|
48
71
|
const inputWrapper = useRef<HTMLDivElement>(null);
|
|
49
72
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
50
|
-
const [isListOpen, setIsListOpen] = useState(false);
|
|
51
|
-
const [isFocused, setFocused] = useState(false);
|
|
52
73
|
|
|
53
74
|
const phoneWithCode = getFullPhone(value);
|
|
54
75
|
|
|
@@ -131,12 +152,8 @@ export const PhoneInput: FC<IPhoneInputProps> = ({
|
|
|
131
152
|
|
|
132
153
|
useOnClickOutsideWithRef(list, handleClose, inputWrapper);
|
|
133
154
|
|
|
134
|
-
const tweakInputStyles = useTweakStyles(componentStyles, tweakStyles, 'tweakInput');
|
|
135
|
-
|
|
136
|
-
const tweakCountryListStyles = useTweakStyles(componentStyles, tweakStyles, 'tweakCountryList');
|
|
137
|
-
|
|
138
155
|
return (
|
|
139
|
-
<div className={classes.root}
|
|
156
|
+
<div className={classes.root} {...addDataTestId(testId)} {...addDataAttributes(data)}>
|
|
140
157
|
<div
|
|
141
158
|
className={clsx(classes.countrySelectContainer, {
|
|
142
159
|
[classes.disabledCountrySelect]: isDisabled,
|
|
@@ -160,7 +177,6 @@ export const PhoneInput: FC<IPhoneInputProps> = ({
|
|
|
160
177
|
</div>
|
|
161
178
|
|
|
162
179
|
<Input
|
|
163
|
-
onChange={handleChange}
|
|
164
180
|
value={phoneWithCode}
|
|
165
181
|
mask={getPhoneMask(countryCode)}
|
|
166
182
|
// alwaysShowMask={false}
|
|
@@ -168,10 +184,11 @@ export const PhoneInput: FC<IPhoneInputProps> = ({
|
|
|
168
184
|
isDisabled={isDisabled}
|
|
169
185
|
isInvalid={isInvalid}
|
|
170
186
|
isActive={isListOpen || isActive}
|
|
171
|
-
testId={testId
|
|
187
|
+
testId={getTestId(testId, 'input')}
|
|
188
|
+
tweakStyles={tweakInputStyles}
|
|
189
|
+
onChange={handleChange}
|
|
172
190
|
onFocus={handleFocus}
|
|
173
191
|
onBlur={handleBlur}
|
|
174
|
-
tweakStyles={tweakInputStyles}
|
|
175
192
|
{...inputProps}
|
|
176
193
|
/>
|
|
177
194
|
|
|
@@ -180,11 +197,11 @@ export const PhoneInput: FC<IPhoneInputProps> = ({
|
|
|
180
197
|
<PhoneInputCountryList
|
|
181
198
|
selectedCountryCode={countryCode}
|
|
182
199
|
placeholder={codeSearchPlaceholder}
|
|
183
|
-
onChange={handleSelect}
|
|
184
|
-
closeList={handleClose}
|
|
185
200
|
locale={locale}
|
|
186
201
|
tweakStyles={tweakCountryListStyles}
|
|
187
202
|
noMatchesLabel={noMatchesLabel}
|
|
203
|
+
onChange={handleSelect}
|
|
204
|
+
closeList={handleClose}
|
|
188
205
|
/>
|
|
189
206
|
</div>
|
|
190
207
|
)}
|
package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { colors, dimensions, helpers } from '../../../../theme';
|
|
2
|
-
import {
|
|
1
|
+
import { colors, createThemedStyles, dimensions, helpers, ITweakStyles } from '../../../../theme';
|
|
2
|
+
import { IInputStyles } from '../../../Input';
|
|
3
3
|
|
|
4
4
|
const ROW_HEIGHT = 40;
|
|
5
5
|
const LIST_PADDING = 10;
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const useStyles = createThemedStyles('PhoneInputCountryList', {
|
|
8
8
|
root: {
|
|
9
9
|
borderRadius: dimensions.BORDER_RADIUS_SMALL,
|
|
10
10
|
backgroundColor: colors.CLASSIC_WHITE,
|
|
@@ -82,19 +82,22 @@ export const styles = {
|
|
|
82
82
|
color: colors.FONT_LABEL,
|
|
83
83
|
padding: [6, 16],
|
|
84
84
|
},
|
|
85
|
+
});
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
87
|
+
export const inputStyles: IInputStyles = {
|
|
88
|
+
inputWrapper: {
|
|
89
|
+
border: 'none',
|
|
90
|
+
height: 'calc(var(--control-height) - 2px)',
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
input: {
|
|
94
|
+
fontSize: 14,
|
|
95
|
+
lineHeight: '20px',
|
|
96
|
+
letterSpacing: 0.15,
|
|
97
97
|
},
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
export type
|
|
100
|
+
export type IPhoneInputCountryListStyles = ITweakStyles<
|
|
101
|
+
typeof useStyles,
|
|
102
|
+
{ tweakInput: IInputStyles }
|
|
103
|
+
>;
|
package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
findCountryIndexByCode,
|
|
7
7
|
sortCountriesByLocale,
|
|
8
8
|
} from '../../../../helpers';
|
|
9
|
-
import {
|
|
9
|
+
import { useTweakStyles } from '../../../../hooks';
|
|
10
10
|
import { ICommonProps } from '../../../../types';
|
|
11
11
|
import { Flag } from '../../../Flag';
|
|
12
12
|
import { Icon } from '../../../Icon';
|
|
@@ -14,10 +14,14 @@ import { Input } from '../../../Input';
|
|
|
14
14
|
import { ScrollIntoViewIfNeeded } from '../../../ScrollIntoViewIfNeeded';
|
|
15
15
|
import { phoneInfo } from '../../phone-info';
|
|
16
16
|
import { IPhoneInfo } from '../../types';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
useStyles,
|
|
19
|
+
IPhoneInputCountryListStyles,
|
|
20
|
+
inputStyles,
|
|
21
|
+
} from './PhoneInputCountryList.styles';
|
|
18
22
|
|
|
19
|
-
export interface IPhoneInputCountryListProps
|
|
20
|
-
tweakStyles
|
|
23
|
+
export interface IPhoneInputCountryListProps
|
|
24
|
+
extends Pick<ICommonProps<IPhoneInputCountryListStyles>, 'tweakStyles'> {
|
|
21
25
|
selectedCountryCode?: string;
|
|
22
26
|
locale: string;
|
|
23
27
|
placeholder: string;
|
|
@@ -35,8 +39,14 @@ export const PhoneInputCountryList: FC<IPhoneInputCountryListProps> = ({
|
|
|
35
39
|
onChange,
|
|
36
40
|
tweakStyles,
|
|
37
41
|
}) => {
|
|
38
|
-
const
|
|
39
|
-
|
|
42
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
43
|
+
|
|
44
|
+
const tweakInputStyles = useTweakStyles({
|
|
45
|
+
innerStyles: inputStyles,
|
|
46
|
+
tweakStyles,
|
|
47
|
+
className: 'tweakInput',
|
|
48
|
+
currentComponentName: 'PhoneInputCountryList',
|
|
49
|
+
});
|
|
40
50
|
|
|
41
51
|
const sortedCountries = useMemo(
|
|
42
52
|
() => sortCountriesByLocale(phoneInfo, locale),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './PhoneInputCountryList';
|
|
2
|
-
export type {
|
|
2
|
+
export type { IPhoneInputCountryListStyles } from './PhoneInputCountryList.styles';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './PhoneInput';
|
|
2
2
|
export { phoneInfo } from './phone-info';
|
|
3
3
|
export * from './types';
|
|
4
|
-
export type {
|
|
5
|
-
export type {
|
|
4
|
+
export type { IPhoneInputStyles } from './PhoneInput.styles';
|
|
5
|
+
export type { IPhoneInputCountryListStyles } from './components';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITweakStyles, createThemedStyles } from '../../theme';
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const useStyles = createThemedStyles('RadioButton', {
|
|
4
4
|
input: {
|
|
5
5
|
appearance: 'none',
|
|
6
6
|
cursor: 'pointer',
|
|
@@ -32,6 +32,6 @@ export const styles = {
|
|
|
32
32
|
},
|
|
33
33
|
|
|
34
34
|
isInvalid: {},
|
|
35
|
-
};
|
|
35
|
+
});
|
|
36
36
|
|
|
37
|
-
export type
|
|
37
|
+
export type IRadioButtonStyles = ITweakStyles<typeof useStyles>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { isReactNodeNotEmpty } from '@true-engineering/true-react-platform-helpers';
|
|
3
|
+
import { addDataTestId, isReactNodeNotEmpty } from '@true-engineering/true-react-platform-helpers';
|
|
4
4
|
import { addDataAttributes } from '../../helpers';
|
|
5
|
-
import { useTheme } from '../../hooks';
|
|
6
5
|
import { ICommonProps } from '../../types';
|
|
7
|
-
import {
|
|
6
|
+
import { useStyles, IRadioButtonStyles } from './RadioButton.styles';
|
|
8
7
|
|
|
9
|
-
export interface IRadioButtonProps<Value extends string> extends ICommonProps {
|
|
10
|
-
tweakStyles?: RadioButtonStyles;
|
|
8
|
+
export interface IRadioButtonProps<Value extends string> extends ICommonProps<IRadioButtonStyles> {
|
|
11
9
|
children?: ReactNode;
|
|
12
10
|
value: Value;
|
|
13
11
|
groupName: string;
|
|
@@ -25,15 +23,17 @@ export function RadioButton<Value extends string>({
|
|
|
25
23
|
isDisabled,
|
|
26
24
|
isInvalid,
|
|
27
25
|
data,
|
|
26
|
+
testId,
|
|
28
27
|
tweakStyles,
|
|
29
28
|
onChange,
|
|
30
29
|
}: IRadioButtonProps<Value>): JSX.Element {
|
|
31
|
-
const
|
|
30
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
32
31
|
|
|
33
32
|
return (
|
|
34
33
|
<label
|
|
35
34
|
className={clsx(classes.label, isDisabled && classes.isDisabled)}
|
|
36
35
|
htmlFor={`${groupName}--${value}`}
|
|
36
|
+
{...addDataTestId(testId)}
|
|
37
37
|
{...addDataAttributes(data)}
|
|
38
38
|
>
|
|
39
39
|
<input
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './RadioButton';
|
|
2
|
-
export type {
|
|
2
|
+
export type { IRadioButtonStyles } from './RadioButton.styles';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { rgba } from '../../helpers';
|
|
2
|
-
import { colors } from '../../theme';
|
|
3
|
-
import {
|
|
2
|
+
import { colors, ITweakStyles, createThemedStyles } from '../../theme';
|
|
3
|
+
import { IInputStyles } from '../Input';
|
|
4
4
|
|
|
5
5
|
const LEFT_PADDING = 44;
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const useStyles = createThemedStyles('SearchInput', {
|
|
8
8
|
root: {
|
|
9
9
|
position: 'relative',
|
|
10
10
|
},
|
|
@@ -19,32 +19,32 @@ export const styles = {
|
|
|
19
19
|
zIndex: 2,
|
|
20
20
|
color: colors.GREY_ACTIVE,
|
|
21
21
|
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const inputStyles: IInputStyles = {
|
|
25
|
+
inputWrapper: {
|
|
26
|
+
height: 35,
|
|
27
|
+
borderColor: 'transparent',
|
|
28
|
+
backgroundColor: rgba(colors.BORDER_MAIN, 0.3),
|
|
29
|
+
borderRadius: 18,
|
|
30
|
+
paddingLeft: LEFT_PADDING,
|
|
31
|
+
transitionProperty: 'background-color, border-color',
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
focused: {
|
|
35
|
+
backgroundColor: colors.CLASSIC_WHITE,
|
|
36
|
+
borderColor: colors.BORDER_MAIN,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
input: {
|
|
40
|
+
fontSize: 14,
|
|
41
|
+
paddingLeft: 0,
|
|
42
|
+
},
|
|
22
43
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
borderColor: 'transparent',
|
|
27
|
-
backgroundColor: rgba(colors.BORDER_MAIN, 0.3),
|
|
28
|
-
borderRadius: 18,
|
|
29
|
-
paddingLeft: LEFT_PADDING,
|
|
30
|
-
transitionProperty: 'background-color, border-color',
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
focused: {
|
|
34
|
-
backgroundColor: colors.CLASSIC_WHITE,
|
|
35
|
-
borderColor: colors.BORDER_MAIN,
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
input: {
|
|
39
|
-
fontSize: 14,
|
|
40
|
-
paddingLeft: 0,
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
label: {
|
|
44
|
-
left: LEFT_PADDING,
|
|
45
|
-
fontSize: 14,
|
|
46
|
-
},
|
|
44
|
+
label: {
|
|
45
|
+
left: LEFT_PADDING,
|
|
46
|
+
fontSize: 14,
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
export type
|
|
50
|
+
export type ISearchInputStyles = ITweakStyles<typeof useStyles, { tweakInput: IInputStyles }>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { addDataTestId, getTestId } from '@true-engineering/true-react-platform-helpers';
|
|
3
3
|
import { addDataAttributes } from '../../helpers';
|
|
4
|
-
import {
|
|
4
|
+
import { useTweakStyles } from '../../hooks';
|
|
5
|
+
import { ICommonProps } from '../../types';
|
|
5
6
|
import { Icon } from '../Icon';
|
|
6
7
|
import { IInputProps, Input } from '../Input';
|
|
7
|
-
import {
|
|
8
|
+
import { useStyles, inputStyles, ISearchInputStyles } from './SearchInput.styles';
|
|
8
9
|
|
|
9
10
|
export type ISearchInputProps = Omit<
|
|
10
11
|
IInputProps,
|
|
@@ -17,9 +18,8 @@ export type ISearchInputProps = Omit<
|
|
|
17
18
|
| 'hasFloatingLabel'
|
|
18
19
|
| 'border'
|
|
19
20
|
| 'tweakStyles'
|
|
20
|
-
> &
|
|
21
|
-
|
|
22
|
-
};
|
|
21
|
+
> &
|
|
22
|
+
ICommonProps<ISearchInputStyles>;
|
|
23
23
|
|
|
24
24
|
export const SearchInput: FC<ISearchInputProps> = ({
|
|
25
25
|
isClearable = true,
|
|
@@ -28,9 +28,14 @@ export const SearchInput: FC<ISearchInputProps> = ({
|
|
|
28
28
|
data,
|
|
29
29
|
...props
|
|
30
30
|
}) => {
|
|
31
|
-
const
|
|
31
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
32
32
|
|
|
33
|
-
const tweakInputStyles = useTweakStyles(
|
|
33
|
+
const tweakInputStyles = useTweakStyles({
|
|
34
|
+
innerStyles: inputStyles,
|
|
35
|
+
tweakStyles,
|
|
36
|
+
className: 'tweakInput',
|
|
37
|
+
currentComponentName: 'SearchInput',
|
|
38
|
+
});
|
|
34
39
|
|
|
35
40
|
return (
|
|
36
41
|
<div className={classes.root} {...addDataTestId(testId)} {...addDataAttributes(data)}>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './SearchInput';
|
|
2
|
-
export type {
|
|
2
|
+
export type { ISearchInputStyles } from './SearchInput.styles';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mergeStyles } from '@true-engineering/true-react-platform-helpers';
|
|
2
|
+
import { ITweakStyles, createThemedStyles } from '../../theme';
|
|
3
|
+
import { IInputStyles } from '../Input';
|
|
4
|
+
import { ISearchInputStyles } from '../SearchInput';
|
|
5
|
+
import { ISelectListStyles } from './components';
|
|
2
6
|
|
|
3
|
-
export const
|
|
7
|
+
export const useStyles = createThemedStyles('Select', {
|
|
4
8
|
root: {
|
|
5
9
|
width: '100%',
|
|
6
10
|
position: 'relative',
|
|
@@ -62,35 +66,79 @@ export const styles = {
|
|
|
62
66
|
width: 16,
|
|
63
67
|
height: 16,
|
|
64
68
|
},
|
|
69
|
+
});
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
const baseInputStyles: IInputStyles = {
|
|
72
|
+
input: {
|
|
73
|
+
paddingRight: 32,
|
|
74
|
+
},
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
76
|
+
disabled: {
|
|
77
|
+
'& $input': {
|
|
78
|
+
cursor: 'default',
|
|
75
79
|
},
|
|
80
|
+
},
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
controls: {
|
|
83
|
+
paddingRight: 32,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const readonlyInputBaseStyles: IInputStyles = {
|
|
88
|
+
inputIcon: {
|
|
89
|
+
width: 'auto',
|
|
80
90
|
},
|
|
91
|
+
};
|
|
81
92
|
|
|
82
|
-
|
|
93
|
+
const multiSelectInputBaseStyles: IInputStyles = {
|
|
94
|
+
inputIcon: {
|
|
95
|
+
width: 'auto',
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const readonlyInputStyles = mergeStyles(baseInputStyles, readonlyInputBaseStyles);
|
|
100
|
+
export const multiSelectInputStyles = mergeStyles(baseInputStyles, multiSelectInputBaseStyles);
|
|
101
|
+
export const readonlyMultiSelectStyles = mergeStyles(
|
|
102
|
+
baseInputStyles,
|
|
103
|
+
readonlyInputBaseStyles,
|
|
104
|
+
multiSelectInputBaseStyles,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
export const getInputStyles = ({
|
|
108
|
+
hasReadonlyInput,
|
|
109
|
+
isMultiSelect,
|
|
110
|
+
}: {
|
|
111
|
+
hasReadonlyInput: boolean;
|
|
112
|
+
isMultiSelect: boolean;
|
|
113
|
+
}): IInputStyles => {
|
|
114
|
+
if (hasReadonlyInput && isMultiSelect) {
|
|
115
|
+
return readonlyMultiSelectStyles;
|
|
116
|
+
}
|
|
117
|
+
if (hasReadonlyInput && !isMultiSelect) {
|
|
118
|
+
return readonlyInputStyles;
|
|
119
|
+
}
|
|
120
|
+
if (!hasReadonlyInput && isMultiSelect) {
|
|
121
|
+
return multiSelectInputStyles;
|
|
122
|
+
}
|
|
123
|
+
return baseInputStyles;
|
|
124
|
+
};
|
|
83
125
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
126
|
+
export const searchInputStyles: ISearchInputStyles = {
|
|
127
|
+
tweakInput: {
|
|
128
|
+
inputWrapper: {
|
|
129
|
+
height: 48,
|
|
130
|
+
borderRadius: 0,
|
|
131
|
+
border: 'none',
|
|
132
|
+
backgroundColor: 'transparent',
|
|
92
133
|
},
|
|
93
134
|
},
|
|
94
135
|
};
|
|
95
136
|
|
|
96
|
-
export type
|
|
137
|
+
export type ISelectStyles = ITweakStyles<
|
|
138
|
+
typeof useStyles,
|
|
139
|
+
{
|
|
140
|
+
tweakInput: IInputStyles;
|
|
141
|
+
tweakSelectList: ISelectListStyles;
|
|
142
|
+
tweakSearchInput: ISearchInputStyles;
|
|
143
|
+
}
|
|
144
|
+
>;
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
import { Portal } from 'react-overlays';
|
|
14
14
|
import clsx from 'clsx';
|
|
15
15
|
import { Styles } from 'jss';
|
|
16
|
-
import merge from 'lodash-es/merge';
|
|
17
16
|
import { debounce } from 'ts-debounce';
|
|
18
17
|
import {
|
|
19
18
|
getTestId,
|
|
@@ -23,14 +22,8 @@ import {
|
|
|
23
22
|
} from '@true-engineering/true-react-platform-helpers';
|
|
24
23
|
import { hasExactParent } from '../../helpers';
|
|
25
24
|
import { renderIcon } from '../../helpers/snippets';
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
useTheme,
|
|
29
|
-
useOnClickOutsideWithRef,
|
|
30
|
-
useDropdown,
|
|
31
|
-
useTweakStyles,
|
|
32
|
-
} from '../../hooks';
|
|
33
|
-
import { IDropdownWithPopperOptions, IIcon } from '../../types';
|
|
25
|
+
import { useIsMounted, useOnClickOutsideWithRef, useDropdown, useTweakStyles } from '../../hooks';
|
|
26
|
+
import { ICommonProps, IDropdownWithPopperOptions, IIcon } from '../../types';
|
|
34
27
|
import { IInputProps, Input } from '../Input';
|
|
35
28
|
import { ISearchInputProps, SearchInput } from '../SearchInput';
|
|
36
29
|
import { SelectList } from './components';
|
|
@@ -43,11 +36,11 @@ import {
|
|
|
43
36
|
isMultiSelectValue,
|
|
44
37
|
} from './helpers';
|
|
45
38
|
import { IMultipleSelectValue } from './types';
|
|
46
|
-
import {
|
|
39
|
+
import { useStyles, ISelectStyles, searchInputStyles, getInputStyles } from './Select.styles';
|
|
47
40
|
|
|
48
41
|
export interface ISelectProps<Value>
|
|
49
|
-
extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type'
|
|
50
|
-
|
|
42
|
+
extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type' | 'tweakStyles'>,
|
|
43
|
+
ICommonProps<ISelectStyles> {
|
|
51
44
|
defaultOptionLabel?: string;
|
|
52
45
|
allOptionsLabel?: string;
|
|
53
46
|
noMatchesLabel?: string;
|
|
@@ -122,7 +115,33 @@ export function Select<Value>(
|
|
|
122
115
|
optionsFilter,
|
|
123
116
|
...inputProps
|
|
124
117
|
} = props;
|
|
125
|
-
const
|
|
118
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
119
|
+
|
|
120
|
+
const shouldRenderSearchInputInList = searchInput?.shouldRenderInList === true;
|
|
121
|
+
const hasSearchInputInList = optionsMode !== 'normal' && shouldRenderSearchInputInList;
|
|
122
|
+
const isMultiSelect = isMultiSelectValue(props, value);
|
|
123
|
+
const hasReadonlyInput = isReadonly || optionsMode === 'normal' || shouldRenderSearchInputInList;
|
|
124
|
+
|
|
125
|
+
const tweakInputStyles = useTweakStyles({
|
|
126
|
+
innerStyles: getInputStyles({ hasReadonlyInput, isMultiSelect }),
|
|
127
|
+
tweakStyles,
|
|
128
|
+
className: 'tweakInput',
|
|
129
|
+
currentComponentName: 'Select',
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const tweakSearchInputStyles = useTweakStyles({
|
|
133
|
+
innerStyles: searchInputStyles,
|
|
134
|
+
tweakStyles,
|
|
135
|
+
className: 'tweakSearchInput',
|
|
136
|
+
currentComponentName: 'Select',
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const tweakSelectListStyles = useTweakStyles({
|
|
140
|
+
tweakStyles,
|
|
141
|
+
className: 'tweakSelectList',
|
|
142
|
+
currentComponentName: 'Select',
|
|
143
|
+
});
|
|
144
|
+
|
|
126
145
|
const isMounted = useIsMounted();
|
|
127
146
|
const [isListOpen, setIsListOpen] = useState(false);
|
|
128
147
|
const [areOptionsLoading, setAreOptionsLoading] = useState(false);
|
|
@@ -138,10 +157,6 @@ export function Select<Value>(
|
|
|
138
157
|
const list = useRef<HTMLDivElement>(null);
|
|
139
158
|
const input = useRef<HTMLInputElement>(null); // TODO ref снаружи?
|
|
140
159
|
|
|
141
|
-
const shouldRenderSearchInputInList = searchInput?.shouldRenderInList === true;
|
|
142
|
-
const hasSearchInputInList = optionsMode !== 'normal' && shouldRenderSearchInputInList;
|
|
143
|
-
|
|
144
|
-
const isMultiSelect = isMultiSelectValue(props, value);
|
|
145
160
|
const strValue = isMultiSelect ? value?.[0] : value;
|
|
146
161
|
const shouldShowAllOption =
|
|
147
162
|
isMultiSelect && isStringNotEmpty(allOptionsLabel) && searchValue === '';
|
|
@@ -420,22 +435,6 @@ export function Select<Value>(
|
|
|
420
435
|
// Последняя проверка на случай, если мы че то ищем в опциях
|
|
421
436
|
(optionsMode === 'normal' || hasEnoughSymbolsToSearch);
|
|
422
437
|
|
|
423
|
-
const hasReadonlyInput = isReadonly || optionsMode === 'normal' || shouldRenderSearchInputInList;
|
|
424
|
-
|
|
425
|
-
const tweakInputStyles = useMemo(
|
|
426
|
-
() =>
|
|
427
|
-
merge(
|
|
428
|
-
{},
|
|
429
|
-
componentStyles.tweakInput,
|
|
430
|
-
{ ...(hasReadonlyInput && { input: { cursor: 'pointer' } }) },
|
|
431
|
-
{ ...(isMultiSelect && { inputIcon: { width: 'auto' } }) },
|
|
432
|
-
tweakStyles?.tweakInput,
|
|
433
|
-
) as Styles,
|
|
434
|
-
[tweakStyles?.tweakInput, hasReadonlyInput],
|
|
435
|
-
);
|
|
436
|
-
|
|
437
|
-
const tweakSearchInputStyles = useTweakStyles(componentStyles, tweakStyles, 'tweakSearchInput');
|
|
438
|
-
|
|
439
438
|
// Эти значения ставятся в false по дефолту также в useDropdown
|
|
440
439
|
const {
|
|
441
440
|
shouldUsePopper = false,
|
|
@@ -504,7 +503,7 @@ export function Select<Value>(
|
|
|
504
503
|
activeValue={value}
|
|
505
504
|
isLoading={inputProps.isLoading}
|
|
506
505
|
loadingLabel={loadingLabel}
|
|
507
|
-
tweakStyles={
|
|
506
|
+
tweakStyles={tweakSelectListStyles}
|
|
508
507
|
testId={getTestId(testId, 'list')}
|
|
509
508
|
// скролл не работает с включеным поппером
|
|
510
509
|
shouldScrollToList={shouldScrollToList && !shouldUsePopper && !shouldHideOnScroll}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { colors, dimensions, helpers } from '../../../../theme';
|
|
2
|
-
import { ComponentStyles } from '../../../../types';
|
|
1
|
+
import { colors, createThemedStyles, dimensions, helpers, ITweakStyles } from '../../../../theme';
|
|
3
2
|
|
|
4
3
|
export const ROW_HEIGHT = 40;
|
|
5
4
|
export const CONTAINER_PADDING = 10;
|
|
6
5
|
export const CELL_PADDING = [10, 20];
|
|
7
6
|
|
|
8
|
-
export const
|
|
7
|
+
export const useStyles = createThemedStyles('SelectList', {
|
|
9
8
|
root: {
|
|
10
9
|
borderRadius: dimensions.BORDER_RADIUS_SMALL,
|
|
11
10
|
boxShadow: '0 13px 74px -27px rgba(0, 0, 0, 0.11)',
|
|
@@ -67,6 +66,6 @@ export const styles = {
|
|
|
67
66
|
},
|
|
68
67
|
|
|
69
68
|
defaultCell: {},
|
|
70
|
-
};
|
|
69
|
+
});
|
|
71
70
|
|
|
72
|
-
export type
|
|
71
|
+
export type ISelectListStyles = ITweakStyles<typeof useStyles>;
|