@epam/uui 5.5.1 → 5.5.2
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/assets/styles/buttonLayout.scss +67 -67
- package/assets/styles/controlLayout.scss +28 -28
- package/assets/styles/dnd.scss +9 -9
- package/assets/styles/effects.scss +7 -7
- package/assets/styles/icons.scss +19 -19
- package/assets/styles/index.scss +8 -8
- package/assets/styles/inputs.scss +74 -74
- package/assets/styles/text-size.scss +42 -42
- package/assets/styles/typography.scss +174 -174
- package/build/assets/styles/buttonLayout.scss +67 -0
- package/build/assets/styles/controlLayout.scss +28 -0
- package/build/assets/styles/dnd.scss +9 -0
- package/build/assets/styles/effects.scss +7 -0
- package/build/assets/styles/icons.scss +19 -0
- package/build/assets/styles/index.scss +8 -0
- package/build/assets/styles/inputs.scss +74 -0
- package/build/assets/styles/text-size.scss +42 -0
- package/build/assets/styles/typography.scss +174 -0
- package/build/index.esm.js +4740 -0
- package/build/index.esm.js.map +1 -0
- package/build/index.js +4905 -0
- package/build/index.js.map +1 -0
- package/build/package.json +37 -0
- package/build/readme.md +5 -0
- package/build/stats.html +4838 -0
- package/build/styles.css +11145 -0
- package/build/styles.css.map +1 -0
- package/components/buttons/Button.module.scss +157 -0
- package/components/buttons/Button.tsx +53 -0
- package/components/buttons/IconButton.module.scss +44 -0
- package/components/buttons/IconButton.tsx +23 -0
- package/components/buttons/LinkButton.module.scss +85 -0
- package/components/buttons/LinkButton.tsx +48 -0
- package/components/buttons/TabButton.module.scss +94 -0
- package/components/buttons/TabButton.tsx +50 -0
- package/components/buttons/VerticalTabButton.module.scss +7 -0
- package/components/buttons/VerticalTabButton.tsx +12 -0
- package/components/buttons/__tests__/Button.test.tsx +34 -0
- package/components/buttons/__tests__/IconButton.test.tsx +16 -0
- package/components/buttons/__tests__/LinkButton.test.tsx +16 -0
- package/components/buttons/__tests__/TabButton.test.tsx +16 -0
- package/components/buttons/__tests__/VerticalTabButton.test.tsx +16 -0
- package/components/buttons/__tests__/__snapshots__/Button.test.tsx.snap +60 -0
- package/components/buttons/__tests__/__snapshots__/IconButton.test.tsx.snap +34 -0
- package/components/buttons/__tests__/__snapshots__/LinkButton.test.tsx.snap +47 -0
- package/components/buttons/__tests__/__snapshots__/TabButton.test.tsx.snap +31 -0
- package/components/buttons/__tests__/__snapshots__/VerticalTabButton.test.tsx.snap +31 -0
- package/components/buttons/helper.ts +22 -0
- package/components/buttons/index.ts +5 -0
- package/components/datePickers/Calendar.module.scss +143 -0
- package/components/datePickers/Calendar.tsx +10 -0
- package/components/datePickers/CalendarPresets.module.scss +30 -0
- package/components/datePickers/CalendarPresets.tsx +9 -0
- package/components/datePickers/DatePicker.tsx +79 -0
- package/components/datePickers/DatePickerBody.module.scss +107 -0
- package/components/datePickers/DatePickerBody.tsx +78 -0
- package/components/datePickers/DatePickerHeader.module.scss +15 -0
- package/components/datePickers/DatePickerHeader.tsx +126 -0
- package/components/datePickers/RangeDatePicker.module.scss +101 -0
- package/components/datePickers/RangeDatePicker.tsx +120 -0
- package/components/datePickers/RangeDatePickerBody.module.scss +128 -0
- package/components/datePickers/RangeDatePickerBody.tsx +263 -0
- package/components/datePickers/__tests__/Calendar.test.tsx +11 -0
- package/components/datePickers/__tests__/CalendarPresets.test.tsx +11 -0
- package/components/datePickers/__tests__/DatePicker.test.tsx +153 -0
- package/components/datePickers/__tests__/DatePickerBody.test.tsx +64 -0
- package/components/datePickers/__tests__/DatePickerHeader.test.tsx +195 -0
- package/components/datePickers/__tests__/RangeDatePicker.test.tsx +323 -0
- package/components/datePickers/__tests__/RangeDatePickerBody.test.tsx +284 -0
- package/components/datePickers/__tests__/__snapshots__/Calendar.test.tsx.snap +524 -0
- package/components/datePickers/__tests__/__snapshots__/CalendarPresets.test.tsx.snap +61 -0
- package/components/datePickers/__tests__/__snapshots__/DatePicker.test.tsx.snap +59 -0
- package/components/datePickers/__tests__/__snapshots__/DatePickerBody.test.tsx.snap +619 -0
- package/components/datePickers/__tests__/__snapshots__/RangeDatePicker.test.tsx.snap +119 -0
- package/components/datePickers/__tests__/__snapshots__/RangeDatePickerBody.test.tsx.snap +1231 -0
- package/components/datePickers/index.ts +5 -0
- package/components/dnd/DropMarker.module.scss +62 -0
- package/components/dnd/DropMarker.tsx +28 -0
- package/components/dnd/__tests__/DropMarker.test.tsx +31 -0
- package/components/dnd/__tests__/__snapshots__/DropMarker.test.tsx.snap +7 -0
- package/components/dnd/index.tsx +1 -0
- package/components/fileUpload/DropSpot.module.scss +47 -0
- package/components/fileUpload/DropSpot.tsx +68 -0
- package/components/fileUpload/FileCard.module.scss +88 -0
- package/components/fileUpload/FileCard.tsx +147 -0
- package/components/fileUpload/SvgCircleProgress.module.scss +8 -0
- package/components/fileUpload/SvgCircleProgress.tsx +41 -0
- package/components/fileUpload/__tests__/DropSpot.test.tsx +15 -0
- package/components/fileUpload/__tests__/FileCard.test.tsx +57 -0
- package/components/fileUpload/__tests__/SvgCircleProgress.test.tsx +10 -0
- package/components/fileUpload/__tests__/__snapshots__/DropSpot.test.tsx.snap +130 -0
- package/components/fileUpload/__tests__/__snapshots__/FileCard.test.tsx.snap +266 -0
- package/components/fileUpload/__tests__/__snapshots__/SvgCircleProgress.test.tsx.snap +26 -0
- package/components/fileUpload/index.ts +3 -0
- package/components/filters/FilterDatePickerBody.tsx +58 -0
- package/components/filters/FilterItemBody.tsx +23 -0
- package/components/filters/FilterNumericBody.module.scss +4 -0
- package/components/filters/FilterNumericBody.tsx +131 -0
- package/components/filters/FilterPanelItemToggler.module.scss +140 -0
- package/components/filters/FilterPanelItemToggler.tsx +91 -0
- package/components/filters/FilterPickerBody.tsx +75 -0
- package/components/filters/FilterRangeDatePickerBody.module.scss +92 -0
- package/components/filters/FilterRangeDatePickerBody.tsx +85 -0
- package/components/filters/FiltersPanel.tsx +218 -0
- package/components/filters/FiltersPanelItem.module.scss +22 -0
- package/components/filters/FiltersPanelItem.tsx +269 -0
- package/components/filters/PresetPanel/Preset.module.scss +25 -0
- package/components/filters/PresetPanel/Preset.tsx +61 -0
- package/components/filters/PresetPanel/PresetActionsDropdown.module.scss +23 -0
- package/components/filters/PresetPanel/PresetActionsDropdown.tsx +138 -0
- package/components/filters/PresetPanel/PresetInput.module.scss +55 -0
- package/components/filters/PresetPanel/PresetInput.tsx +54 -0
- package/components/filters/PresetPanel/PresetsPanel.module.scss +34 -0
- package/components/filters/PresetPanel/PresetsPanel.tsx +112 -0
- package/components/filters/PresetPanel/__tests__/Preset.test.tsx +44 -0
- package/components/filters/PresetPanel/__tests__/PresetActionsDropdown.test.tsx +28 -0
- package/components/filters/PresetPanel/__tests__/PresetInput.test.tsx +10 -0
- package/components/filters/PresetPanel/__tests__/__snapshots__/Preset.test.tsx.snap +101 -0
- package/components/filters/PresetPanel/__tests__/__snapshots__/PresetActionsDropdown.test.tsx.snap +19 -0
- package/components/filters/PresetPanel/__tests__/__snapshots__/PresetInput.test.tsx.snap +38 -0
- package/components/filters/PresetPanel/__tests__/__snapshots__/presetsPanel.test.tsx.snap +101 -0
- package/components/filters/PresetPanel/__tests__/presetsPanel.test.tsx +381 -0
- package/components/filters/PresetPanel/constants.ts +4 -0
- package/components/filters/PresetPanel/index.ts +1 -0
- package/components/filters/__tests__/__snapshots__/filtersPanel.test.tsx.snap +295 -0
- package/components/filters/__tests__/filtersPanel.test.tsx +375 -0
- package/components/filters/constants.ts +4 -0
- package/components/filters/defaultPredicates.ts +11 -0
- package/components/filters/index.ts +4 -0
- package/components/forms/Form.tsx +39 -0
- package/components/forms/index.tsx +2 -0
- package/components/forms/useForm.tsx +39 -0
- package/components/index.ts +14 -0
- package/components/inputs/Checkbox.module.scss +162 -0
- package/components/inputs/Checkbox.tsx +43 -0
- package/components/inputs/InputAddon.module.scss +11 -0
- package/components/inputs/InputAddon.tsx +11 -0
- package/components/inputs/MultiSwitch.tsx +54 -0
- package/components/inputs/NumericInput.module.scss +97 -0
- package/components/inputs/NumericInput.tsx +53 -0
- package/components/inputs/RadioInput.module.scss +200 -0
- package/components/inputs/RadioInput.tsx +30 -0
- package/components/inputs/Slider.module.scss +130 -0
- package/components/inputs/Slider.tsx +11 -0
- package/components/inputs/Switch.module.scss +172 -0
- package/components/inputs/Switch.tsx +22 -0
- package/components/inputs/TextArea.module.scss +210 -0
- package/components/inputs/TextArea.tsx +47 -0
- package/components/inputs/TextInput.module.scss +199 -0
- package/components/inputs/TextInput.tsx +60 -0
- package/components/inputs/TimePicker.module.scss +68 -0
- package/components/inputs/TimePicker.tsx +79 -0
- package/components/inputs/TimePickerBody.tsx +10 -0
- package/components/inputs/__tests__/Checkbox.test.tsx +15 -0
- package/components/inputs/__tests__/InputAddon.test.tsx +12 -0
- package/components/inputs/__tests__/MultiSwitch.test.tsx +16 -0
- package/components/inputs/__tests__/NumericInput.test.tsx +19 -0
- package/components/inputs/__tests__/RadioInput.test.tsx +15 -0
- package/components/inputs/__tests__/Slider.test.tsx +22 -0
- package/components/inputs/__tests__/Switch.test.tsx +15 -0
- package/components/inputs/__tests__/TextArea.test.tsx +15 -0
- package/components/inputs/__tests__/TextInput.test.tsx +20 -0
- package/components/inputs/__tests__/TimePicker.test.tsx +19 -0
- package/components/inputs/__tests__/TimePickerBody.test.tsx +38 -0
- package/components/inputs/__tests__/__snapshots__/Checkbox.test.tsx.snap +37 -0
- package/components/inputs/__tests__/__snapshots__/InputAddon.test.tsx.snap +9 -0
- package/components/inputs/__tests__/__snapshots__/MultiSwitch.test.tsx.snap +37 -0
- package/components/inputs/__tests__/__snapshots__/NumericInput.test.tsx.snap +95 -0
- package/components/inputs/__tests__/__snapshots__/RadioInput.test.tsx.snap +40 -0
- package/components/inputs/__tests__/__snapshots__/Slider.test.tsx.snap +157 -0
- package/components/inputs/__tests__/__snapshots__/Switch.test.tsx.snap +48 -0
- package/components/inputs/__tests__/__snapshots__/TextArea.test.tsx.snap +38 -0
- package/components/inputs/__tests__/__snapshots__/TextInput.test.tsx.snap +55 -0
- package/components/inputs/__tests__/__snapshots__/TimePicker.test.tsx +19 -0
- package/components/inputs/__tests__/__snapshots__/TimePicker.test.tsx.snap +45 -0
- package/components/inputs/__tests__/__snapshots__/TimePickerBody.test.tsx +38 -0
- package/components/inputs/__tests__/__snapshots__/TimePickerBody.test.tsx.snap +327 -0
- package/components/inputs/__tests__/__snapshots__/__snapshots__/TimePicker.test.tsx.snap +45 -0
- package/components/inputs/__tests__/__snapshots__/__snapshots__/TimePickerBody.test.tsx.snap +327 -0
- package/components/inputs/index.ts +10 -0
- package/components/layout/Accordion.module.scss +180 -0
- package/components/layout/Accordion.tsx +35 -0
- package/components/layout/Blocker.module.scss +30 -0
- package/components/layout/Blocker.tsx +11 -0
- package/components/layout/CheckboxGroup.module.scss +21 -0
- package/components/layout/CheckboxGroup.tsx +74 -0
- package/components/layout/ControlGroup.module.scss +15 -0
- package/components/layout/ControlGroup.tsx +5 -0
- package/components/layout/FlexItems/FlexCell.module.scss +5 -0
- package/components/layout/FlexItems/FlexCell.tsx +11 -0
- package/components/layout/FlexItems/FlexRow.module.scss +122 -0
- package/components/layout/FlexItems/FlexRow.tsx +63 -0
- package/components/layout/FlexItems/Panel.module.scss +34 -0
- package/components/layout/FlexItems/Panel.tsx +29 -0
- package/components/layout/FlexItems/__tests__/FlexCell.test.tsx +15 -0
- package/components/layout/FlexItems/__tests__/FlexRow.test.tsx +17 -0
- package/components/layout/FlexItems/__tests__/FlexSpacer.test.tsx +10 -0
- package/components/layout/FlexItems/__tests__/Panel.test.tsx +15 -0
- package/components/layout/FlexItems/__tests__/__snapshots__/FlexCell.test.tsx.snap +34 -0
- package/components/layout/FlexItems/__tests__/__snapshots__/FlexRow.test.tsx.snap +26 -0
- package/components/layout/FlexItems/__tests__/__snapshots__/FlexSpacer.test.tsx.snap +7 -0
- package/components/layout/FlexItems/__tests__/__snapshots__/Panel.test.tsx.snap +14 -0
- package/components/layout/FlexItems/index.ts +4 -0
- package/components/layout/LabeledInput.module.scss +139 -0
- package/components/layout/LabeledInput.tsx +22 -0
- package/components/layout/RadioGroup.module.scss +21 -0
- package/components/layout/RadioGroup.tsx +68 -0
- package/components/layout/ScrollBars.module.scss +56 -0
- package/components/layout/ScrollBars.tsx +11 -0
- package/components/layout/VirtualList.module.scss +10 -0
- package/components/layout/VirtualList.tsx +126 -0
- package/components/layout/__tests__/Accordion.test.tsx +16 -0
- package/components/layout/__tests__/Blocker.test.tsx +10 -0
- package/components/layout/__tests__/CheckboxGroup.test.tsx +33 -0
- package/components/layout/__tests__/ControlGroup.test.tsx +18 -0
- package/components/layout/__tests__/LabeledInput.test.tsx +26 -0
- package/components/layout/__tests__/RadioGroup.test.tsx +33 -0
- package/components/layout/__tests__/ScrollBars.test.tsx +17 -0
- package/components/layout/__tests__/VirtualList.test.tsx +10 -0
- package/components/layout/__tests__/__snapshots__/Accordion.test.tsx.snap +65 -0
- package/components/layout/__tests__/__snapshots__/Blocker.test.tsx.snap +36 -0
- package/components/layout/__tests__/__snapshots__/CheckboxGroup.test.tsx.snap +99 -0
- package/components/layout/__tests__/__snapshots__/ControlGroup.test.tsx.snap +33 -0
- package/components/layout/__tests__/__snapshots__/LabeledInput.test.tsx.snap +89 -0
- package/components/layout/__tests__/__snapshots__/RadioGroup.test.tsx.snap +95 -0
- package/components/layout/__tests__/__snapshots__/ScrollBars.test.tsx.snap +68 -0
- package/components/layout/__tests__/__snapshots__/VirtualList.test.tsx.snap +90 -0
- package/components/layout/index.ts +10 -0
- package/components/navigation/Anchor.module.scss +7 -0
- package/components/navigation/Anchor.tsx +5 -0
- package/components/navigation/MainMenu/Burger/Burger.module.scss +81 -0
- package/components/navigation/MainMenu/Burger/Burger.tsx +18 -0
- package/components/navigation/MainMenu/Burger/BurgerButton.module.scss +69 -0
- package/components/navigation/MainMenu/Burger/BurgerButton.tsx +28 -0
- package/components/navigation/MainMenu/Burger/BurgerGroupHeader.module.scss +31 -0
- package/components/navigation/MainMenu/Burger/BurgerGroupHeader.tsx +19 -0
- package/components/navigation/MainMenu/Burger/BurgerSearch.module.scss +51 -0
- package/components/navigation/MainMenu/Burger/BurgerSearch.tsx +23 -0
- package/components/navigation/MainMenu/Burger/__tests__/Burger.test.tsx +13 -0
- package/components/navigation/MainMenu/Burger/__tests__/BurgerButton.test.tsx +18 -0
- package/components/navigation/MainMenu/Burger/__tests__/BurgerGroupHeader.test.tsx +10 -0
- package/components/navigation/MainMenu/Burger/__tests__/BurgerSearch.test.tsx +20 -0
- package/components/navigation/MainMenu/Burger/__tests__/__snapshots__/Burger.test.tsx.snap +21 -0
- package/components/navigation/MainMenu/Burger/__tests__/__snapshots__/BurgerButton.test.tsx.snap +46 -0
- package/components/navigation/MainMenu/Burger/__tests__/__snapshots__/BurgerGroupHeader.test.tsx.snap +16 -0
- package/components/navigation/MainMenu/Burger/__tests__/__snapshots__/BurgerSearch.test.tsx.snap +55 -0
- package/components/navigation/MainMenu/Burger/index.ts +4 -0
- package/components/navigation/MainMenu/GlobalMenu.module.scss +32 -0
- package/components/navigation/MainMenu/GlobalMenu.tsx +15 -0
- package/components/navigation/MainMenu/MainMenu.module.scss +53 -0
- package/components/navigation/MainMenu/MainMenu.tsx +22 -0
- package/components/navigation/MainMenu/MainMenuAvatar.module.scss +41 -0
- package/components/navigation/MainMenu/MainMenuAvatar.tsx +31 -0
- package/components/navigation/MainMenu/MainMenuButton.module.scss +60 -0
- package/components/navigation/MainMenu/MainMenuButton.tsx +17 -0
- package/components/navigation/MainMenu/MainMenuDropdown.module.scss +44 -0
- package/components/navigation/MainMenu/MainMenuDropdown.tsx +47 -0
- package/components/navigation/MainMenu/MainMenuIcon.module.scss +25 -0
- package/components/navigation/MainMenu/MainMenuIcon.tsx +17 -0
- package/components/navigation/MainMenu/MainMenuSearch.module.scss +51 -0
- package/components/navigation/MainMenu/MainMenuSearch.tsx +27 -0
- package/components/navigation/MainMenu/__tests__/GlobalMenu.test.tsx +10 -0
- package/components/navigation/MainMenu/__tests__/MainMenu.test.tsx +45 -0
- package/components/navigation/MainMenu/__tests__/MainMenuAvatar.test.tsx +27 -0
- package/components/navigation/MainMenu/__tests__/MainMenuButton.test.tsx +30 -0
- package/components/navigation/MainMenu/__tests__/MainMenuDropdown.test.tsx +24 -0
- package/components/navigation/MainMenu/__tests__/MainMenuIcon.test.tsx +18 -0
- package/components/navigation/MainMenu/__tests__/MainMenuSearch.test.tsx +28 -0
- package/components/navigation/MainMenu/__tests__/__snapshots__/GlobalMenu.test.tsx.snap +17 -0
- package/components/navigation/MainMenu/__tests__/__snapshots__/MainMenu.test.tsx.snap +103 -0
- package/components/navigation/MainMenu/__tests__/__snapshots__/MainMenuAvatar.test.tsx.snap +39 -0
- package/components/navigation/MainMenu/__tests__/__snapshots__/MainMenuButton.test.tsx.snap +37 -0
- package/components/navigation/MainMenu/__tests__/__snapshots__/MainMenuDropdown.test.tsx.snap +46 -0
- package/components/navigation/MainMenu/__tests__/__snapshots__/MainMenuIcon.test.tsx.snap +39 -0
- package/components/navigation/MainMenu/__tests__/__snapshots__/MainMenuSearch.test.tsx.snap +55 -0
- package/components/navigation/MainMenu/index.ts +8 -0
- package/components/navigation/__tests__/Anchor.test.tsx +21 -0
- package/components/navigation/__tests__/__snapshots__/Anchor.test.tsx.snap +29 -0
- package/components/navigation/index.ts +2 -0
- package/components/overlays/Alert.module.scss +77 -0
- package/components/overlays/Alert.tsx +89 -0
- package/components/overlays/ConfirmationModal.tsx +41 -0
- package/components/overlays/Dropdown.tsx +4 -0
- package/components/overlays/DropdownContainer.module.scss +93 -0
- package/components/overlays/DropdownContainer.tsx +27 -0
- package/components/overlays/DropdownMenu.module.scss +181 -0
- package/components/overlays/DropdownMenu.tsx +262 -0
- package/components/overlays/Modals.module.scss +63 -0
- package/components/overlays/Modals.tsx +92 -0
- package/components/overlays/NotificationCard.module.scss +76 -0
- package/components/overlays/NotificationCard.tsx +103 -0
- package/components/overlays/Tooltip.module.scss +90 -0
- package/components/overlays/Tooltip.tsx +24 -0
- package/components/overlays/__tests__/Alert.test.tsx +57 -0
- package/components/overlays/__tests__/ConfirmationModal.test.tsx +29 -0
- package/components/overlays/__tests__/Dropdown.test.tsx +16 -0
- package/components/overlays/__tests__/DropdownContainer.test.tsx +28 -0
- package/components/overlays/__tests__/DropdownMenu.test.tsx +26 -0
- package/components/overlays/__tests__/Modals.test.tsx +35 -0
- package/components/overlays/__tests__/NotificationCard.test.tsx +52 -0
- package/components/overlays/__tests__/Tooltip.test.tsx +20 -0
- package/components/overlays/__tests__/__snapshots__/Alert.test.tsx.snap +183 -0
- package/components/overlays/__tests__/__snapshots__/ConfirmationModal.test.tsx.snap +351 -0
- package/components/overlays/__tests__/__snapshots__/Dropdown.test.tsx.snap +51 -0
- package/components/overlays/__tests__/__snapshots__/DropdownContainer.test.tsx.snap +45 -0
- package/components/overlays/__tests__/__snapshots__/DropdownMenu.test.tsx.snap +90 -0
- package/components/overlays/__tests__/__snapshots__/Modals.test.tsx.snap +134 -0
- package/components/overlays/__tests__/__snapshots__/NotificationCard.test.tsx.snap +284 -0
- package/components/overlays/__tests__/__snapshots__/Tooltip.test.tsx.snap +5 -0
- package/components/overlays/index.ts +8 -0
- package/components/pickers/DataPickerBody.module.scss +54 -0
- package/components/pickers/DataPickerBody.tsx +69 -0
- package/components/pickers/DataPickerCell.module.scss +93 -0
- package/components/pickers/DataPickerCell.tsx +95 -0
- package/components/pickers/DataPickerFooter.tsx +85 -0
- package/components/pickers/DataPickerHeader.module.scss +19 -0
- package/components/pickers/DataPickerHeader.tsx +24 -0
- package/components/pickers/DataPickerRow.module.scss +11 -0
- package/components/pickers/DataPickerRow.tsx +38 -0
- package/components/pickers/MobileDropdownWrapper.module.scss +20 -0
- package/components/pickers/MobileDropdownWrapper.tsx +40 -0
- package/components/pickers/PickerInput.module.scss +39 -0
- package/components/pickers/PickerInput.tsx +197 -0
- package/components/pickers/PickerItem.module.scss +32 -0
- package/components/pickers/PickerItem.tsx +66 -0
- package/components/pickers/PickerList.tsx +83 -0
- package/components/pickers/PickerListItem.module.scss +3 -0
- package/components/pickers/PickerListItem.tsx +55 -0
- package/components/pickers/PickerModal.module.scss +27 -0
- package/components/pickers/PickerModal.tsx +167 -0
- package/components/pickers/PickerToggler.module.scss +249 -0
- package/components/pickers/PickerToggler.tsx +88 -0
- package/components/pickers/__tests__/DataPickerBody.test.tsx +58 -0
- package/components/pickers/__tests__/DataPickerRow.test.tsx +39 -0
- package/components/pickers/__tests__/PickerInput.test.tsx +1073 -0
- package/components/pickers/__tests__/PickerList.test.tsx +597 -0
- package/components/pickers/__tests__/PickerModal.test.tsx +521 -0
- package/components/pickers/__tests__/PickerToggler.test.tsx +40 -0
- package/components/pickers/__tests__/__snapshots__/DataPickerBody.test.tsx.snap +201 -0
- package/components/pickers/__tests__/__snapshots__/DataPickerRow.test.tsx.snap +100 -0
- package/components/pickers/__tests__/__snapshots__/PickerInput.test.tsx.snap +705 -0
- package/components/pickers/__tests__/__snapshots__/PickerList.test.tsx.snap +980 -0
- package/components/pickers/__tests__/__snapshots__/PickerModal.test.tsx.snap +2062 -0
- package/components/pickers/__tests__/__snapshots__/PickerToggler.test.tsx.snap +81 -0
- package/components/pickers/__tests__/highlight.test.tsx +37 -0
- package/components/pickers/__tests__/mocks.ts +87 -0
- package/components/pickers/helpers.ts +4 -0
- package/components/pickers/highlight.tsx +93 -0
- package/components/pickers/index.ts +12 -0
- package/components/pickers/types.ts +7 -0
- package/components/tables/ColumnHeaderDropdown/ColumnHeaderDropdown.tsx +46 -0
- package/components/tables/ColumnHeaderDropdown/SortingPanel.module.scss +14 -0
- package/components/tables/ColumnHeaderDropdown/SortingPanel.tsx +27 -0
- package/components/tables/ColumnHeaderDropdown/index.ts +1 -0
- package/components/tables/DataRowsContainer/DataRowsContainer.module.scss +21 -0
- package/components/tables/DataRowsContainer/DataRowsContainer.tsx +27 -0
- package/components/tables/DataRowsContainer/DataRowsGroups.tsx +86 -0
- package/components/tables/DataRowsContainer/index.tsx +1 -0
- package/components/tables/DataRowsContainer/utils.ts +15 -0
- package/components/tables/DataTable.module.scss +54 -0
- package/components/tables/DataTable.tsx +172 -0
- package/components/tables/DataTableCell.module.scss +65 -0
- package/components/tables/DataTableCell.tsx +51 -0
- package/components/tables/DataTableHeaderCell.module.scss +161 -0
- package/components/tables/DataTableHeaderCell.tsx +151 -0
- package/components/tables/DataTableHeaderRow.module.scss +23 -0
- package/components/tables/DataTableHeaderRow.tsx +19 -0
- package/components/tables/DataTableRow.module.scss +58 -0
- package/components/tables/DataTableRow.tsx +31 -0
- package/components/tables/__tests__/ColumnHeaderDropdown.test.tsx +25 -0
- package/components/tables/__tests__/DataTable.test.tsx +23 -0
- package/components/tables/__tests__/DataTableCell.test.tsx +66 -0
- package/components/tables/__tests__/DataTableHeaderCell.test.tsx +21 -0
- package/components/tables/__tests__/DataTableHeaderRow.test.tsx +28 -0
- package/components/tables/__tests__/DataTableRow.test.tsx +30 -0
- package/components/tables/__tests__/__snapshots__/ColumnHeaderDropdown.test.tsx.snap +138 -0
- package/components/tables/__tests__/__snapshots__/DataTable.test.tsx.snap +122 -0
- package/components/tables/__tests__/__snapshots__/DataTableCell.test.tsx.snap +45 -0
- package/components/tables/__tests__/__snapshots__/DataTableHeaderCell.test.tsx.snap +34 -0
- package/components/tables/__tests__/__snapshots__/DataTableHeaderRow.test.tsx.snap +51 -0
- package/components/tables/__tests__/__snapshots__/DataTableRow.test.tsx.snap +54 -0
- package/components/tables/columnsConfigurationModal/ColumnRow.module.scss +45 -0
- package/components/tables/columnsConfigurationModal/ColumnRow.tsx +66 -0
- package/components/tables/columnsConfigurationModal/ColumnsConfigurationModal.module.scss +55 -0
- package/components/tables/columnsConfigurationModal/ColumnsConfigurationModal.tsx +153 -0
- package/components/tables/columnsConfigurationModal/PinIconButton.tsx +55 -0
- package/components/tables/columnsConfigurationModal/__tests__/ColumnsConfigurationModal.test.tsx +72 -0
- package/components/tables/columnsConfigurationModal/__tests__/__snapshots__/ColumnsConfigurationModal.test.tsx.snap +877 -0
- package/components/tables/columnsConfigurationModal/index.ts +1 -0
- package/components/tables/index.ts +9 -0
- package/components/tables/types.ts +33 -0
- package/components/tables/variables.scss +25 -0
- package/components/types.ts +34 -0
- package/components/typography/RichTextView.tsx +17 -0
- package/components/typography/Text.module.scss +54 -0
- package/components/typography/Text.tsx +59 -0
- package/components/typography/TextPlaceholder.module.scss +46 -0
- package/components/typography/TextPlaceholder.tsx +38 -0
- package/components/typography/__tests__/RichTextView.test.tsx +27 -0
- package/components/typography/__tests__/Text.test.tsx +21 -0
- package/components/typography/__tests__/TextPlaceholder.test.tsx +23 -0
- package/components/typography/__tests__/__snapshots__/RichTextView.test.tsx.snap +21 -0
- package/components/typography/__tests__/__snapshots__/Text.test.tsx.snap +18 -0
- package/components/typography/__tests__/__snapshots__/TextPlaceholder.test.tsx.snap +65 -0
- package/components/typography/index.ts +3 -0
- package/components/widgets/AvatarStack.module.scss +36 -0
- package/components/widgets/AvatarStack.tsx +5 -0
- package/components/widgets/Badge.module.scss +334 -0
- package/components/widgets/Badge.tsx +97 -0
- package/components/widgets/CountIndicator.module.scss +52 -0
- package/components/widgets/CountIndicator.tsx +38 -0
- package/components/widgets/DataRowAddons.module.scss +57 -0
- package/components/widgets/DataRowAddons.tsx +66 -0
- package/components/widgets/IndeterminateBar.module.scss +42 -0
- package/components/widgets/IndeterminateBar.tsx +16 -0
- package/components/widgets/IndicatorBar.module.scss +3 -0
- package/components/widgets/IndicatorBar.tsx +20 -0
- package/components/widgets/Paginator.module.scss +66 -0
- package/components/widgets/Paginator.tsx +64 -0
- package/components/widgets/ProgressBar.module.scss +52 -0
- package/components/widgets/ProgressBar.tsx +33 -0
- package/components/widgets/Spinner.module.scss +38 -0
- package/components/widgets/Spinner.tsx +11 -0
- package/components/widgets/StatusIndicator.module.scss +72 -0
- package/components/widgets/StatusIndicator.tsx +50 -0
- package/components/widgets/Tag.module.scss +142 -0
- package/components/widgets/Tag.tsx +73 -0
- package/components/widgets/__tests__/AvatarStack.test.tsx +19 -0
- package/components/widgets/__tests__/Badge.test.tsx +30 -0
- package/components/widgets/__tests__/IndeterminateBar.test.tsx +15 -0
- package/components/widgets/__tests__/IndicatorBar.test.tsx +15 -0
- package/components/widgets/__tests__/Paginator.test.tsx +19 -0
- package/components/widgets/__tests__/ProgressBar.test.tsx +25 -0
- package/components/widgets/__tests__/Spinner.test.tsx +10 -0
- package/components/widgets/__tests__/StatusIndicator.test.tsx +17 -0
- package/components/widgets/__tests__/Tag.test.tsx +18 -0
- package/components/widgets/__tests__/__snapshots__/AvatarStack.test.tsx.snap +55 -0
- package/components/widgets/__tests__/__snapshots__/Badge.test.tsx.snap +48 -0
- package/components/widgets/__tests__/__snapshots__/IndeterminateBar.test.tsx.snap +21 -0
- package/components/widgets/__tests__/__snapshots__/IndicatorBar.test.tsx.snap +30 -0
- package/components/widgets/__tests__/__snapshots__/Paginator.test.tsx.snap +127 -0
- package/components/widgets/__tests__/__snapshots__/ProgressBar.test.tsx.snap +107 -0
- package/components/widgets/__tests__/__snapshots__/Spinner.test.tsx.snap +21 -0
- package/components/widgets/__tests__/__snapshots__/StatusIndicator.test.tsx.snap +31 -0
- package/components/widgets/__tests__/__snapshots__/Tag.test.tsx.snap +48 -0
- package/components/widgets/index.ts +12 -0
- package/globals.d.ts +12 -0
- package/helpers/index.ts +2 -0
- package/helpers/text-layout.module.scss +81 -0
- package/helpers/textLayout.tsx +35 -0
- package/helpers/useColumnsWithFilters.tsx +34 -0
- package/i18n.ts +105 -0
- package/icons/accept-12.svg +1 -0
- package/icons/accept-18.svg +1 -0
- package/icons/accept-24.svg +1 -0
- package/icons/action-settings-12.svg +1 -0
- package/icons/action-settings-18.svg +1 -0
- package/icons/action-settings-24.svg +1 -0
- package/icons/btn-cross-12.svg +1 -0
- package/icons/btn-cross-18.svg +1 -0
- package/icons/btn-cross-24.svg +1 -0
- package/icons/burger-close.svg +3 -0
- package/icons/burger.svg +3 -0
- package/icons/calendar-12.svg +1 -0
- package/icons/calendar-18.svg +1 -0
- package/icons/calendar-24.svg +1 -0
- package/icons/check-12.svg +3 -0
- package/icons/check-18.svg +3 -0
- package/icons/checkbox-checked.svg +21 -0
- package/icons/checkbox-partial.svg +21 -0
- package/icons/checkbox_tick.svg +44 -0
- package/icons/chevron-down-24.svg +1 -0
- package/icons/chevron-up-24.svg +1 -0
- package/icons/content-edit-12.svg +1 -0
- package/icons/content-edit-18.svg +1 -0
- package/icons/content-edit-24.svg +1 -0
- package/icons/empty-table.svg +58 -0
- package/icons/fileUpload/file-file-24.svg +1 -0
- package/icons/fileUpload/file-file_chart-24.svg +1 -0
- package/icons/fileUpload/file-file_eml-24.svg +1 -0
- package/icons/fileUpload/file-file_excel-24.svg +1 -0
- package/icons/fileUpload/file-file_image-24.svg +1 -0
- package/icons/fileUpload/file-file_pdf-24.svg +1 -0
- package/icons/fileUpload/file-file_table-24.svg +1 -0
- package/icons/fileUpload/file-file_text-24.svg +1 -0
- package/icons/fileUpload/file-file_video-24.svg +1 -0
- package/icons/fileUpload/file-file_word-24.svg +1 -0
- package/icons/fileUpload/shape.svg +2 -0
- package/icons/filter.svg +11 -0
- package/icons/folding-arrow-12.svg +1 -0
- package/icons/folding-arrow-18.svg +1 -0
- package/icons/folding-arrow-24.svg +1 -0
- package/icons/global_menu.svg +9 -0
- package/icons/help-fill-10.svg +3 -0
- package/icons/help-fill-16.svg +3 -0
- package/icons/icons.tsx +116 -0
- package/icons/info-12.svg +3 -0
- package/icons/info-18.svg +1 -0
- package/icons/info-24.svg +1 -0
- package/icons/logo-arrow.svg +4 -0
- package/icons/menu_input_cancel.svg +84 -0
- package/icons/modal-close-cross.svg +22 -0
- package/icons/navigation-close-24.svg +1 -0
- package/icons/navigation-more_vert-12.svg +1 -0
- package/icons/navigation-more_vert-18.svg +1 -0
- package/icons/navigation-more_vert-24.svg +1 -0
- package/icons/notification-check_circle-fill-24.svg +1 -0
- package/icons/notification-done-12.svg +1 -0
- package/icons/notification-done-18.svg +1 -0
- package/icons/notification-done-24.svg +1 -0
- package/icons/notification-error-fill-10.svg +1 -0
- package/icons/notification-error-fill-24.svg +1 -0
- package/icons/notification-help-fill-24.svg +1 -0
- package/icons/notification-warning-fill-24.svg +1 -0
- package/icons/partly-select-12.svg +3 -0
- package/icons/partly-select-18.svg +3 -0
- package/icons/radio-point.svg +3 -0
- package/icons/search-12.svg +1 -0
- package/icons/search-18.svg +1 -0
- package/icons/search-24.svg +1 -0
- package/icons/search-with-background.svg +4 -0
- package/icons/settings-18.svg +1 -0
- package/icons/slider-rating/active_mark_blue_icon.svg +23 -0
- package/icons/slider-rating/active_mark_green_icon.svg +23 -0
- package/icons/slider-rating/active_mark_red_icon.svg +23 -0
- package/icons/slider-rating/active_mark_violet_icon.svg +23 -0
- package/icons/slider-rating/active_mark_yellow_icon.svg +23 -0
- package/icons/slider-rating/line_blue_icon.svg +31 -0
- package/icons/slider-rating/line_gray_icon.svg +20 -0
- package/icons/slider-rating/line_red_icon.svg +42 -0
- package/icons/slider-rating/line_violet_icon.svg +33 -0
- package/icons/slider-rating/line_yellow_icon.svg +34 -0
- package/icons/slider-rating/na_active_icon.svg +13 -0
- package/icons/slider-rating/na_icon.svg +13 -0
- package/icons/snackbar/cross.svg +1 -0
- package/icons/snackbar/info.svg +1 -0
- package/icons/snackbar/success.svg +1 -0
- package/icons/snackbar/warning.svg +1 -0
- package/icons/sort.svg +5 -0
- package/icons/sort_asc-12.svg +1 -0
- package/icons/sort_desc-12.svg +1 -0
- package/icons/star-empty.svg +3 -0
- package/icons/star-filled.svg +3 -0
- package/icons/tick-12.svg +1 -0
- package/icons/tick-24.svg +1 -0
- package/icons/triangle.svg +10 -0
- package/index.tsx +5 -0
- package/package.json +7 -7
- package/readme.md +4 -4
- package/themeTodo.md +21 -0
- package/tsconfig.json +12 -0
- package/index.esm.js +0 -4740
- package/index.esm.js.map +0 -1
- package/index.js +0 -4905
- package/index.js.map +0 -1
- package/stats.html +0 -4838
- package/styles.css +0 -11145
- package/styles.css.map +0 -1
- /package/{components → build/components}/buttons/Button.d.ts +0 -0
- /package/{components → build/components}/buttons/Button.d.ts.map +0 -0
- /package/{components → build/components}/buttons/IconButton.d.ts +0 -0
- /package/{components → build/components}/buttons/IconButton.d.ts.map +0 -0
- /package/{components → build/components}/buttons/LinkButton.d.ts +0 -0
- /package/{components → build/components}/buttons/LinkButton.d.ts.map +0 -0
- /package/{components → build/components}/buttons/TabButton.d.ts +0 -0
- /package/{components → build/components}/buttons/TabButton.d.ts.map +0 -0
- /package/{components → build/components}/buttons/VerticalTabButton.d.ts +0 -0
- /package/{components → build/components}/buttons/VerticalTabButton.d.ts.map +0 -0
- /package/{components → build/components}/buttons/helper.d.ts +0 -0
- /package/{components → build/components}/buttons/helper.d.ts.map +0 -0
- /package/{components → build/components}/buttons/index.d.ts +0 -0
- /package/{components → build/components}/buttons/index.d.ts.map +0 -0
- /package/{components → build/components}/datePickers/Calendar.d.ts +0 -0
- /package/{components → build/components}/datePickers/Calendar.d.ts.map +0 -0
- /package/{components → build/components}/datePickers/CalendarPresets.d.ts +0 -0
- /package/{components → build/components}/datePickers/CalendarPresets.d.ts.map +0 -0
- /package/{components → build/components}/datePickers/DatePicker.d.ts +0 -0
- /package/{components → build/components}/datePickers/DatePicker.d.ts.map +0 -0
- /package/{components → build/components}/datePickers/DatePickerBody.d.ts +0 -0
- /package/{components → build/components}/datePickers/DatePickerBody.d.ts.map +0 -0
- /package/{components → build/components}/datePickers/DatePickerHeader.d.ts +0 -0
- /package/{components → build/components}/datePickers/DatePickerHeader.d.ts.map +0 -0
- /package/{components → build/components}/datePickers/RangeDatePicker.d.ts +0 -0
- /package/{components → build/components}/datePickers/RangeDatePicker.d.ts.map +0 -0
- /package/{components → build/components}/datePickers/RangeDatePickerBody.d.ts +0 -0
- /package/{components → build/components}/datePickers/RangeDatePickerBody.d.ts.map +0 -0
- /package/{components → build/components}/datePickers/index.d.ts +0 -0
- /package/{components → build/components}/datePickers/index.d.ts.map +0 -0
- /package/{components → build/components}/dnd/DropMarker.d.ts +0 -0
- /package/{components → build/components}/dnd/DropMarker.d.ts.map +0 -0
- /package/{components → build/components}/dnd/index.d.ts +0 -0
- /package/{components → build/components}/dnd/index.d.ts.map +0 -0
- /package/{components → build/components}/fileUpload/DropSpot.d.ts +0 -0
- /package/{components → build/components}/fileUpload/DropSpot.d.ts.map +0 -0
- /package/{components → build/components}/fileUpload/FileCard.d.ts +0 -0
- /package/{components → build/components}/fileUpload/FileCard.d.ts.map +0 -0
- /package/{components → build/components}/fileUpload/SvgCircleProgress.d.ts +0 -0
- /package/{components → build/components}/fileUpload/SvgCircleProgress.d.ts.map +0 -0
- /package/{components → build/components}/fileUpload/index.d.ts +0 -0
- /package/{components → build/components}/fileUpload/index.d.ts.map +0 -0
- /package/{components → build/components}/filters/FilterDatePickerBody.d.ts +0 -0
- /package/{components → build/components}/filters/FilterDatePickerBody.d.ts.map +0 -0
- /package/{components → build/components}/filters/FilterItemBody.d.ts +0 -0
- /package/{components → build/components}/filters/FilterItemBody.d.ts.map +0 -0
- /package/{components → build/components}/filters/FilterNumericBody.d.ts +0 -0
- /package/{components → build/components}/filters/FilterNumericBody.d.ts.map +0 -0
- /package/{components → build/components}/filters/FilterPanelItemToggler.d.ts +0 -0
- /package/{components → build/components}/filters/FilterPanelItemToggler.d.ts.map +0 -0
- /package/{components → build/components}/filters/FilterPickerBody.d.ts +0 -0
- /package/{components → build/components}/filters/FilterPickerBody.d.ts.map +0 -0
- /package/{components → build/components}/filters/FilterRangeDatePickerBody.d.ts +0 -0
- /package/{components → build/components}/filters/FilterRangeDatePickerBody.d.ts.map +0 -0
- /package/{components → build/components}/filters/FiltersPanel.d.ts +0 -0
- /package/{components → build/components}/filters/FiltersPanel.d.ts.map +0 -0
- /package/{components → build/components}/filters/FiltersPanelItem.d.ts +0 -0
- /package/{components → build/components}/filters/FiltersPanelItem.d.ts.map +0 -0
- /package/{components → build/components}/filters/PresetPanel/Preset.d.ts +0 -0
- /package/{components → build/components}/filters/PresetPanel/Preset.d.ts.map +0 -0
- /package/{components → build/components}/filters/PresetPanel/PresetActionsDropdown.d.ts +0 -0
- /package/{components → build/components}/filters/PresetPanel/PresetActionsDropdown.d.ts.map +0 -0
- /package/{components → build/components}/filters/PresetPanel/PresetInput.d.ts +0 -0
- /package/{components → build/components}/filters/PresetPanel/PresetInput.d.ts.map +0 -0
- /package/{components → build/components}/filters/PresetPanel/PresetsPanel.d.ts +0 -0
- /package/{components → build/components}/filters/PresetPanel/PresetsPanel.d.ts.map +0 -0
- /package/{components → build/components}/filters/PresetPanel/constants.d.ts +0 -0
- /package/{components → build/components}/filters/PresetPanel/constants.d.ts.map +0 -0
- /package/{components → build/components}/filters/PresetPanel/index.d.ts +0 -0
- /package/{components → build/components}/filters/PresetPanel/index.d.ts.map +0 -0
- /package/{components → build/components}/filters/constants.d.ts +0 -0
- /package/{components → build/components}/filters/constants.d.ts.map +0 -0
- /package/{components → build/components}/filters/defaultPredicates.d.ts +0 -0
- /package/{components → build/components}/filters/defaultPredicates.d.ts.map +0 -0
- /package/{components → build/components}/filters/index.d.ts +0 -0
- /package/{components → build/components}/filters/index.d.ts.map +0 -0
- /package/{components → build/components}/forms/Form.d.ts +0 -0
- /package/{components → build/components}/forms/Form.d.ts.map +0 -0
- /package/{components → build/components}/forms/index.d.ts +0 -0
- /package/{components → build/components}/forms/index.d.ts.map +0 -0
- /package/{components → build/components}/forms/useForm.d.ts +0 -0
- /package/{components → build/components}/forms/useForm.d.ts.map +0 -0
- /package/{components → build/components}/index.d.ts +0 -0
- /package/{components → build/components}/index.d.ts.map +0 -0
- /package/{components → build/components}/inputs/Checkbox.d.ts +0 -0
- /package/{components → build/components}/inputs/Checkbox.d.ts.map +0 -0
- /package/{components → build/components}/inputs/InputAddon.d.ts +0 -0
- /package/{components → build/components}/inputs/InputAddon.d.ts.map +0 -0
- /package/{components → build/components}/inputs/MultiSwitch.d.ts +0 -0
- /package/{components → build/components}/inputs/MultiSwitch.d.ts.map +0 -0
- /package/{components → build/components}/inputs/NumericInput.d.ts +0 -0
- /package/{components → build/components}/inputs/NumericInput.d.ts.map +0 -0
- /package/{components → build/components}/inputs/RadioInput.d.ts +0 -0
- /package/{components → build/components}/inputs/RadioInput.d.ts.map +0 -0
- /package/{components → build/components}/inputs/Slider.d.ts +0 -0
- /package/{components → build/components}/inputs/Slider.d.ts.map +0 -0
- /package/{components → build/components}/inputs/Switch.d.ts +0 -0
- /package/{components → build/components}/inputs/Switch.d.ts.map +0 -0
- /package/{components → build/components}/inputs/TextArea.d.ts +0 -0
- /package/{components → build/components}/inputs/TextArea.d.ts.map +0 -0
- /package/{components → build/components}/inputs/TextInput.d.ts +0 -0
- /package/{components → build/components}/inputs/TextInput.d.ts.map +0 -0
- /package/{components → build/components}/inputs/TimePicker.d.ts +0 -0
- /package/{components → build/components}/inputs/TimePicker.d.ts.map +0 -0
- /package/{components → build/components}/inputs/TimePickerBody.d.ts +0 -0
- /package/{components → build/components}/inputs/TimePickerBody.d.ts.map +0 -0
- /package/{components → build/components}/inputs/index.d.ts +0 -0
- /package/{components → build/components}/inputs/index.d.ts.map +0 -0
- /package/{components → build/components}/layout/Accordion.d.ts +0 -0
- /package/{components → build/components}/layout/Accordion.d.ts.map +0 -0
- /package/{components → build/components}/layout/Blocker.d.ts +0 -0
- /package/{components → build/components}/layout/Blocker.d.ts.map +0 -0
- /package/{components → build/components}/layout/CheckboxGroup.d.ts +0 -0
- /package/{components → build/components}/layout/CheckboxGroup.d.ts.map +0 -0
- /package/{components → build/components}/layout/ControlGroup.d.ts +0 -0
- /package/{components → build/components}/layout/ControlGroup.d.ts.map +0 -0
- /package/{components → build/components}/layout/FlexItems/FlexCell.d.ts +0 -0
- /package/{components → build/components}/layout/FlexItems/FlexCell.d.ts.map +0 -0
- /package/{components → build/components}/layout/FlexItems/FlexRow.d.ts +0 -0
- /package/{components → build/components}/layout/FlexItems/FlexRow.d.ts.map +0 -0
- /package/{components → build/components}/layout/FlexItems/Panel.d.ts +0 -0
- /package/{components → build/components}/layout/FlexItems/Panel.d.ts.map +0 -0
- /package/{components → build/components}/layout/FlexItems/index.d.ts +0 -0
- /package/{components → build/components}/layout/FlexItems/index.d.ts.map +0 -0
- /package/{components → build/components}/layout/LabeledInput.d.ts +0 -0
- /package/{components → build/components}/layout/LabeledInput.d.ts.map +0 -0
- /package/{components → build/components}/layout/RadioGroup.d.ts +0 -0
- /package/{components → build/components}/layout/RadioGroup.d.ts.map +0 -0
- /package/{components → build/components}/layout/ScrollBars.d.ts +0 -0
- /package/{components → build/components}/layout/ScrollBars.d.ts.map +0 -0
- /package/{components → build/components}/layout/VirtualList.d.ts +0 -0
- /package/{components → build/components}/layout/VirtualList.d.ts.map +0 -0
- /package/{components → build/components}/layout/index.d.ts +0 -0
- /package/{components → build/components}/layout/index.d.ts.map +0 -0
- /package/{components → build/components}/navigation/Anchor.d.ts +0 -0
- /package/{components → build/components}/navigation/Anchor.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/Burger.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/Burger.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/BurgerButton.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/BurgerButton.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/BurgerGroupHeader.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/BurgerGroupHeader.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/BurgerSearch.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/BurgerSearch.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/index.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/Burger/index.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/GlobalMenu.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/GlobalMenu.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenu.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenu.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuAvatar.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuAvatar.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuButton.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuButton.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuDropdown.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuDropdown.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuIcon.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuIcon.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuSearch.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/MainMenuSearch.d.ts.map +0 -0
- /package/{components → build/components}/navigation/MainMenu/index.d.ts +0 -0
- /package/{components → build/components}/navigation/MainMenu/index.d.ts.map +0 -0
- /package/{components → build/components}/navigation/index.d.ts +0 -0
- /package/{components → build/components}/navigation/index.d.ts.map +0 -0
- /package/{components → build/components}/overlays/Alert.d.ts +0 -0
- /package/{components → build/components}/overlays/Alert.d.ts.map +0 -0
- /package/{components → build/components}/overlays/ConfirmationModal.d.ts +0 -0
- /package/{components → build/components}/overlays/ConfirmationModal.d.ts.map +0 -0
- /package/{components → build/components}/overlays/Dropdown.d.ts +0 -0
- /package/{components → build/components}/overlays/Dropdown.d.ts.map +0 -0
- /package/{components → build/components}/overlays/DropdownContainer.d.ts +0 -0
- /package/{components → build/components}/overlays/DropdownContainer.d.ts.map +0 -0
- /package/{components → build/components}/overlays/DropdownMenu.d.ts +0 -0
- /package/{components → build/components}/overlays/DropdownMenu.d.ts.map +0 -0
- /package/{components → build/components}/overlays/Modals.d.ts +0 -0
- /package/{components → build/components}/overlays/Modals.d.ts.map +0 -0
- /package/{components → build/components}/overlays/NotificationCard.d.ts +0 -0
- /package/{components → build/components}/overlays/NotificationCard.d.ts.map +0 -0
- /package/{components → build/components}/overlays/Tooltip.d.ts +0 -0
- /package/{components → build/components}/overlays/Tooltip.d.ts.map +0 -0
- /package/{components → build/components}/overlays/index.d.ts +0 -0
- /package/{components → build/components}/overlays/index.d.ts.map +0 -0
- /package/{components → build/components}/pickers/DataPickerBody.d.ts +0 -0
- /package/{components → build/components}/pickers/DataPickerBody.d.ts.map +0 -0
- /package/{components → build/components}/pickers/DataPickerCell.d.ts +0 -0
- /package/{components → build/components}/pickers/DataPickerCell.d.ts.map +0 -0
- /package/{components → build/components}/pickers/DataPickerFooter.d.ts +0 -0
- /package/{components → build/components}/pickers/DataPickerFooter.d.ts.map +0 -0
- /package/{components → build/components}/pickers/DataPickerHeader.d.ts +0 -0
- /package/{components → build/components}/pickers/DataPickerHeader.d.ts.map +0 -0
- /package/{components → build/components}/pickers/DataPickerRow.d.ts +0 -0
- /package/{components → build/components}/pickers/DataPickerRow.d.ts.map +0 -0
- /package/{components → build/components}/pickers/MobileDropdownWrapper.d.ts +0 -0
- /package/{components → build/components}/pickers/MobileDropdownWrapper.d.ts.map +0 -0
- /package/{components → build/components}/pickers/PickerInput.d.ts +0 -0
- /package/{components → build/components}/pickers/PickerInput.d.ts.map +0 -0
- /package/{components → build/components}/pickers/PickerItem.d.ts +0 -0
- /package/{components → build/components}/pickers/PickerItem.d.ts.map +0 -0
- /package/{components → build/components}/pickers/PickerList.d.ts +0 -0
- /package/{components → build/components}/pickers/PickerList.d.ts.map +0 -0
- /package/{components → build/components}/pickers/PickerListItem.d.ts +0 -0
- /package/{components → build/components}/pickers/PickerListItem.d.ts.map +0 -0
- /package/{components → build/components}/pickers/PickerModal.d.ts +0 -0
- /package/{components → build/components}/pickers/PickerModal.d.ts.map +0 -0
- /package/{components → build/components}/pickers/PickerToggler.d.ts +0 -0
- /package/{components → build/components}/pickers/PickerToggler.d.ts.map +0 -0
- /package/{components → build/components}/pickers/helpers.d.ts +0 -0
- /package/{components → build/components}/pickers/helpers.d.ts.map +0 -0
- /package/{components → build/components}/pickers/highlight.d.ts +0 -0
- /package/{components → build/components}/pickers/highlight.d.ts.map +0 -0
- /package/{components → build/components}/pickers/index.d.ts +0 -0
- /package/{components → build/components}/pickers/index.d.ts.map +0 -0
- /package/{components → build/components}/pickers/types.d.ts +0 -0
- /package/{components → build/components}/pickers/types.d.ts.map +0 -0
- /package/{components → build/components}/tables/ColumnHeaderDropdown/ColumnHeaderDropdown.d.ts +0 -0
- /package/{components → build/components}/tables/ColumnHeaderDropdown/ColumnHeaderDropdown.d.ts.map +0 -0
- /package/{components → build/components}/tables/ColumnHeaderDropdown/SortingPanel.d.ts +0 -0
- /package/{components → build/components}/tables/ColumnHeaderDropdown/SortingPanel.d.ts.map +0 -0
- /package/{components → build/components}/tables/ColumnHeaderDropdown/index.d.ts +0 -0
- /package/{components → build/components}/tables/ColumnHeaderDropdown/index.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataRowsContainer/DataRowsContainer.d.ts +0 -0
- /package/{components → build/components}/tables/DataRowsContainer/DataRowsContainer.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataRowsContainer/DataRowsGroups.d.ts +0 -0
- /package/{components → build/components}/tables/DataRowsContainer/DataRowsGroups.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataRowsContainer/index.d.ts +0 -0
- /package/{components → build/components}/tables/DataRowsContainer/index.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataRowsContainer/utils.d.ts +0 -0
- /package/{components → build/components}/tables/DataRowsContainer/utils.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataTable.d.ts +0 -0
- /package/{components → build/components}/tables/DataTable.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataTableCell.d.ts +0 -0
- /package/{components → build/components}/tables/DataTableCell.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataTableHeaderCell.d.ts +0 -0
- /package/{components → build/components}/tables/DataTableHeaderCell.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataTableHeaderRow.d.ts +0 -0
- /package/{components → build/components}/tables/DataTableHeaderRow.d.ts.map +0 -0
- /package/{components → build/components}/tables/DataTableRow.d.ts +0 -0
- /package/{components → build/components}/tables/DataTableRow.d.ts.map +0 -0
- /package/{components → build/components}/tables/columnsConfigurationModal/ColumnRow.d.ts +0 -0
- /package/{components → build/components}/tables/columnsConfigurationModal/ColumnRow.d.ts.map +0 -0
- /package/{components → build/components}/tables/columnsConfigurationModal/ColumnsConfigurationModal.d.ts +0 -0
- /package/{components → build/components}/tables/columnsConfigurationModal/ColumnsConfigurationModal.d.ts.map +0 -0
- /package/{components → build/components}/tables/columnsConfigurationModal/PinIconButton.d.ts +0 -0
- /package/{components → build/components}/tables/columnsConfigurationModal/PinIconButton.d.ts.map +0 -0
- /package/{components → build/components}/tables/columnsConfigurationModal/index.d.ts +0 -0
- /package/{components → build/components}/tables/columnsConfigurationModal/index.d.ts.map +0 -0
- /package/{components → build/components}/tables/index.d.ts +0 -0
- /package/{components → build/components}/tables/index.d.ts.map +0 -0
- /package/{components → build/components}/tables/types.d.ts +0 -0
- /package/{components → build/components}/tables/types.d.ts.map +0 -0
- /package/{components → build/components}/types.d.ts +0 -0
- /package/{components → build/components}/types.d.ts.map +0 -0
- /package/{components → build/components}/typography/RichTextView.d.ts +0 -0
- /package/{components → build/components}/typography/RichTextView.d.ts.map +0 -0
- /package/{components → build/components}/typography/Text.d.ts +0 -0
- /package/{components → build/components}/typography/Text.d.ts.map +0 -0
- /package/{components → build/components}/typography/TextPlaceholder.d.ts +0 -0
- /package/{components → build/components}/typography/TextPlaceholder.d.ts.map +0 -0
- /package/{components → build/components}/typography/index.d.ts +0 -0
- /package/{components → build/components}/typography/index.d.ts.map +0 -0
- /package/{components → build/components}/widgets/AvatarStack.d.ts +0 -0
- /package/{components → build/components}/widgets/AvatarStack.d.ts.map +0 -0
- /package/{components → build/components}/widgets/Badge.d.ts +0 -0
- /package/{components → build/components}/widgets/Badge.d.ts.map +0 -0
- /package/{components → build/components}/widgets/CountIndicator.d.ts +0 -0
- /package/{components → build/components}/widgets/CountIndicator.d.ts.map +0 -0
- /package/{components → build/components}/widgets/DataRowAddons.d.ts +0 -0
- /package/{components → build/components}/widgets/DataRowAddons.d.ts.map +0 -0
- /package/{components → build/components}/widgets/IndeterminateBar.d.ts +0 -0
- /package/{components → build/components}/widgets/IndeterminateBar.d.ts.map +0 -0
- /package/{components → build/components}/widgets/IndicatorBar.d.ts +0 -0
- /package/{components → build/components}/widgets/IndicatorBar.d.ts.map +0 -0
- /package/{components → build/components}/widgets/Paginator.d.ts +0 -0
- /package/{components → build/components}/widgets/Paginator.d.ts.map +0 -0
- /package/{components → build/components}/widgets/ProgressBar.d.ts +0 -0
- /package/{components → build/components}/widgets/ProgressBar.d.ts.map +0 -0
- /package/{components → build/components}/widgets/Spinner.d.ts +0 -0
- /package/{components → build/components}/widgets/Spinner.d.ts.map +0 -0
- /package/{components → build/components}/widgets/StatusIndicator.d.ts +0 -0
- /package/{components → build/components}/widgets/StatusIndicator.d.ts.map +0 -0
- /package/{components → build/components}/widgets/Tag.d.ts +0 -0
- /package/{components → build/components}/widgets/Tag.d.ts.map +0 -0
- /package/{components → build/components}/widgets/index.d.ts +0 -0
- /package/{components → build/components}/widgets/index.d.ts.map +0 -0
- /package/{helpers → build/helpers}/index.d.ts +0 -0
- /package/{helpers → build/helpers}/index.d.ts.map +0 -0
- /package/{helpers → build/helpers}/textLayout.d.ts +0 -0
- /package/{helpers → build/helpers}/textLayout.d.ts.map +0 -0
- /package/{helpers → build/helpers}/useColumnsWithFilters.d.ts +0 -0
- /package/{helpers → build/helpers}/useColumnsWithFilters.d.ts.map +0 -0
- /package/{i18n.d.ts → build/i18n.d.ts} +0 -0
- /package/{i18n.d.ts.map → build/i18n.d.ts.map} +0 -0
- /package/{icons → build/icons}/icons.d.ts +0 -0
- /package/{icons → build/icons}/icons.d.ts.map +0 -0
- /package/{index.d.ts → build/index.d.ts} +0 -0
- /package/{index.d.ts.map → build/index.d.ts.map} +0 -0
|
@@ -0,0 +1,1073 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ArrayDataSource, CascadeSelection } from '@epam/uui-core';
|
|
3
|
+
import {
|
|
4
|
+
renderSnapshotWithContextAsync, setupComponentForTest, screen, within, fireEvent, waitFor, userEvent, PickerInputTestObject,
|
|
5
|
+
} from '@epam/uui-test-utils';
|
|
6
|
+
import { Modals, PickerToggler } from '@epam/uui-components';
|
|
7
|
+
import { DataPickerRow, FlexCell, PickerItem, Text, Button } from '../../';
|
|
8
|
+
import { PickerInput, PickerInputProps } from '../PickerInput';
|
|
9
|
+
import { IHasEditMode } from '../../types';
|
|
10
|
+
import { TestItemType, mockDataSource, mockDataSourceAsync, mockSmallDataSourceAsync, mockTreeLikeDataSourceAsync } from './mocks';
|
|
11
|
+
|
|
12
|
+
type PickerInputComponentProps<TItem, TId> = PickerInputProps<TItem, TId>;
|
|
13
|
+
|
|
14
|
+
async function setupPickerInputForTest<TItem = TestItemType, TId = number>(params: Partial<PickerInputComponentProps<TItem, TId>>) {
|
|
15
|
+
const { result, mocks, setProps } = await setupComponentForTest<PickerInputComponentProps<TItem, TId>>(
|
|
16
|
+
(context): PickerInputComponentProps<TItem, TId> => {
|
|
17
|
+
if (params.selectionMode === 'single') {
|
|
18
|
+
return Object.assign({
|
|
19
|
+
onValueChange: jest.fn().mockImplementation((newValue) => context.current?.setProperty('value', newValue)),
|
|
20
|
+
dataSource: mockDataSourceAsync,
|
|
21
|
+
disableClear: false,
|
|
22
|
+
searchPosition: 'input',
|
|
23
|
+
getName: (item: TestItemType) => item.level,
|
|
24
|
+
value: params.value as TId,
|
|
25
|
+
selectionMode: 'single',
|
|
26
|
+
searchDebounceDelay: 0,
|
|
27
|
+
}, params) as PickerInputComponentProps<TItem, TId>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return Object.assign({
|
|
31
|
+
onValueChange: jest.fn().mockImplementation((newValue) => context.current?.setProperty('value', newValue)),
|
|
32
|
+
dataSource: mockDataSourceAsync,
|
|
33
|
+
disableClear: false,
|
|
34
|
+
searchPosition: 'input',
|
|
35
|
+
getName: (item: TestItemType) => item.level,
|
|
36
|
+
value: params.value as number[],
|
|
37
|
+
selectionMode: 'multi',
|
|
38
|
+
searchDebounceDelay: 0,
|
|
39
|
+
}, params) as PickerInputComponentProps<TItem, TId>;
|
|
40
|
+
},
|
|
41
|
+
(props) => (
|
|
42
|
+
<>
|
|
43
|
+
<PickerInput { ...props } />
|
|
44
|
+
<Modals />
|
|
45
|
+
</>
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
const input = screen.queryByRole('textbox') as HTMLElement;
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
setProps,
|
|
52
|
+
result,
|
|
53
|
+
mocks,
|
|
54
|
+
dom: { input, container: result.container, target: result.container.firstElementChild as HTMLElement },
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
describe('PickerInput', () => {
|
|
59
|
+
it('should render with minimum props', async () => {
|
|
60
|
+
const tree = await renderSnapshotWithContextAsync(
|
|
61
|
+
<PickerInput value={ null } onValueChange={ jest.fn } selectionMode="single" dataSource={ mockDataSource } disableClear searchPosition="input" />,
|
|
62
|
+
);
|
|
63
|
+
expect(tree).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should render with maximum props', async () => {
|
|
67
|
+
const tree = await renderSnapshotWithContextAsync(
|
|
68
|
+
<PickerInput
|
|
69
|
+
value={ [2, 3] }
|
|
70
|
+
onValueChange={ jest.fn }
|
|
71
|
+
selectionMode="multi"
|
|
72
|
+
dataSource={ mockDataSource }
|
|
73
|
+
size="48"
|
|
74
|
+
maxItems={ 20 }
|
|
75
|
+
editMode="modal"
|
|
76
|
+
valueType="id"
|
|
77
|
+
getName={ (item) => item?.level ?? '' }
|
|
78
|
+
autoFocus
|
|
79
|
+
placeholder="Test placeholder"
|
|
80
|
+
filter={ (item: any) => item.level === 'A1' }
|
|
81
|
+
sorting={ { direction: 'desc', field: 'level' } }
|
|
82
|
+
searchPosition="body"
|
|
83
|
+
minBodyWidth={ 900 }
|
|
84
|
+
renderNotFound={ () => null }
|
|
85
|
+
renderFooter={ (props) => <div>{props as unknown as ReactNode}</div> }
|
|
86
|
+
cascadeSelection
|
|
87
|
+
dropdownHeight={ 48 }
|
|
88
|
+
minCharsToSearch={ 4 }
|
|
89
|
+
/>,
|
|
90
|
+
);
|
|
91
|
+
expect(tree).toMatchSnapshot();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should open body', async () => {
|
|
95
|
+
const { dom, result } = await setupPickerInputForTest({
|
|
96
|
+
value: undefined,
|
|
97
|
+
selectionMode: 'single',
|
|
98
|
+
dataSource: mockSmallDataSourceAsync,
|
|
99
|
+
getName: ({ name }) => name,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
fireEvent.click(dom.input);
|
|
103
|
+
|
|
104
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
105
|
+
|
|
106
|
+
expect(result.baseElement).toMatchSnapshot();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe('[selectionMode single]', () => {
|
|
110
|
+
it('[valueType id] should select & clear option', async () => {
|
|
111
|
+
const { dom, mocks } = await setupPickerInputForTest({
|
|
112
|
+
value: undefined,
|
|
113
|
+
selectionMode: 'single',
|
|
114
|
+
});
|
|
115
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select');
|
|
116
|
+
fireEvent.click(dom.input);
|
|
117
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
118
|
+
const optionC2 = await screen.findByText('C2');
|
|
119
|
+
fireEvent.click(optionC2);
|
|
120
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith(12);
|
|
121
|
+
fireEvent.click(window.document.body);
|
|
122
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
123
|
+
expect(screen.getByPlaceholderText('C2')).toBeInTheDocument();
|
|
124
|
+
const clear = screen.getByRole('button');
|
|
125
|
+
fireEvent.click(clear);
|
|
126
|
+
expect(screen.queryByText('C2')).not.toBeInTheDocument();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('[valueType entity] should select & clear option', async () => {
|
|
130
|
+
const { dom, mocks } = await setupPickerInputForTest({
|
|
131
|
+
value: undefined,
|
|
132
|
+
selectionMode: 'single',
|
|
133
|
+
valueType: 'entity',
|
|
134
|
+
});
|
|
135
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select');
|
|
136
|
+
fireEvent.click(dom.input);
|
|
137
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
138
|
+
const optionC2 = await screen.findByText('C2');
|
|
139
|
+
fireEvent.click(optionC2);
|
|
140
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith({ id: 12, level: 'C2', name: 'Proficiency' });
|
|
141
|
+
fireEvent.click(window.document.body);
|
|
142
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
143
|
+
expect(screen.getByPlaceholderText('C2')).toBeInTheDocument();
|
|
144
|
+
const clear = screen.getByRole('button');
|
|
145
|
+
fireEvent.click(clear);
|
|
146
|
+
expect(screen.queryByText('C2')).not.toBeInTheDocument();
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('should render names of items by getName', async () => {
|
|
150
|
+
const { mocks, dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
151
|
+
value: 3,
|
|
152
|
+
selectionMode: 'single',
|
|
153
|
+
getName: ({ name }) => name,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toBeUndefined();
|
|
157
|
+
await waitFor(async () => expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Elementary+'));
|
|
158
|
+
|
|
159
|
+
fireEvent.click(dom.input);
|
|
160
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
161
|
+
const optionC2 = await screen.findByText('Proficiency');
|
|
162
|
+
fireEvent.click(optionC2);
|
|
163
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith(12);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('should render entity name in placeholder', async () => {
|
|
167
|
+
const { dom } = await setupPickerInputForTest({
|
|
168
|
+
value: undefined,
|
|
169
|
+
selectionMode: 'single',
|
|
170
|
+
entityName: 'Language Level',
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select Language Level');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('should ignore plural entity name in placeholder', async () => {
|
|
177
|
+
const { dom } = await setupPickerInputForTest({
|
|
178
|
+
value: undefined,
|
|
179
|
+
selectionMode: 'single',
|
|
180
|
+
entityName: 'Language Level',
|
|
181
|
+
entityPluralName: 'Multiple Language Levels',
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select Language Level');
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it.each<[CascadeSelection]>(
|
|
188
|
+
[[false], [true], ['implicit'], ['explicit']],
|
|
189
|
+
)
|
|
190
|
+
('should pick single element with cascadeSelection = %s', async (cascadeSelection) => {
|
|
191
|
+
const { mocks, dom } = await setupPickerInputForTest({
|
|
192
|
+
value: undefined,
|
|
193
|
+
getName: ({ name }) => name,
|
|
194
|
+
selectionMode: 'single',
|
|
195
|
+
cascadeSelection,
|
|
196
|
+
dataSource: mockTreeLikeDataSourceAsync,
|
|
197
|
+
});
|
|
198
|
+
fireEvent.click(dom.input);
|
|
199
|
+
|
|
200
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
201
|
+
|
|
202
|
+
// Check parent
|
|
203
|
+
await PickerInputTestObject.clickOptionByText('Parent 2');
|
|
204
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith(2);
|
|
205
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Parent 2');
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('should work with maxItems properly', async () => {
|
|
209
|
+
const { mocks, dom } = await setupPickerInputForTest({
|
|
210
|
+
value: undefined,
|
|
211
|
+
maxItems: 1,
|
|
212
|
+
selectionMode: 'single',
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
fireEvent.click(dom.input);
|
|
216
|
+
|
|
217
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
218
|
+
|
|
219
|
+
// Check parent
|
|
220
|
+
await PickerInputTestObject.clickOptionByText('A1');
|
|
221
|
+
fireEvent.click(dom.input);
|
|
222
|
+
await PickerInputTestObject.clickOptionByText('A1+');
|
|
223
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith(3);
|
|
224
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('A1+');
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it('should disable clear', async () => {
|
|
228
|
+
const { dom, setProps } = await setupPickerInputForTest({
|
|
229
|
+
value: 2,
|
|
230
|
+
selectionMode: 'single',
|
|
231
|
+
disableClear: false,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
await waitFor(() => expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('A1'));
|
|
235
|
+
|
|
236
|
+
const clearButton = within(dom.container).getByRole('button', { name: 'Clear' });
|
|
237
|
+
expect(clearButton).toBeInTheDocument();
|
|
238
|
+
fireEvent.click(clearButton);
|
|
239
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select');
|
|
240
|
+
setProps({ disableClear: true, value: 2 });
|
|
241
|
+
expect(within(dom.container).queryByRole('button', { name: 'Clear' })).not.toBeInTheDocument();
|
|
242
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('A1');
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('should clear selected item', async () => {
|
|
246
|
+
const { dom } = await setupPickerInputForTest({
|
|
247
|
+
value: undefined,
|
|
248
|
+
selectionMode: 'single',
|
|
249
|
+
maxItems: 100,
|
|
250
|
+
});
|
|
251
|
+
fireEvent.click(dom.input);
|
|
252
|
+
|
|
253
|
+
expect(await PickerInputTestObject.hasOptions()).toBeTruthy();
|
|
254
|
+
|
|
255
|
+
const clearButton = within(screen.getByRole('dialog')).getByRole('button', { name: 'CLEAR' });
|
|
256
|
+
expect(clearButton).toBeInTheDocument();
|
|
257
|
+
expect(clearButton).toHaveAttribute('aria-disabled', 'true');
|
|
258
|
+
|
|
259
|
+
await PickerInputTestObject.clickOptionByText('A1');
|
|
260
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('A1');
|
|
261
|
+
|
|
262
|
+
fireEvent.click(dom.input);
|
|
263
|
+
|
|
264
|
+
const clearButton2 = within(screen.getByRole('dialog')).getByRole('button', { name: 'CLEAR' });
|
|
265
|
+
expect(clearButton2).toHaveAttribute('aria-disabled', 'false');
|
|
266
|
+
|
|
267
|
+
fireEvent.click(clearButton2);
|
|
268
|
+
|
|
269
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select');
|
|
270
|
+
const clearButton3 = within(screen.getByRole('dialog')).getByRole('button', { name: 'CLEAR' });
|
|
271
|
+
expect(clearButton3).toHaveAttribute('aria-disabled', 'true');
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
describe('[selectionMode multi]', () => {
|
|
276
|
+
it('[valueType id] should select & clear several options', async () => {
|
|
277
|
+
const { dom, mocks } = await setupPickerInputForTest({
|
|
278
|
+
value: undefined,
|
|
279
|
+
selectionMode: 'multi',
|
|
280
|
+
});
|
|
281
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select');
|
|
282
|
+
fireEvent.click(dom.input);
|
|
283
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
284
|
+
|
|
285
|
+
await PickerInputTestObject.clickOptionCheckbox('A1');
|
|
286
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2]);
|
|
287
|
+
|
|
288
|
+
await PickerInputTestObject.clickOptionCheckbox('A1+');
|
|
289
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2, 3]);
|
|
290
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['A1', 'A1+']);
|
|
291
|
+
|
|
292
|
+
fireEvent.click(window.document.body);
|
|
293
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
294
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['A1', 'A1+']);
|
|
295
|
+
|
|
296
|
+
PickerInputTestObject.removeSelectedTagByText(dom.input, 'A1+');
|
|
297
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['A1']);
|
|
298
|
+
|
|
299
|
+
PickerInputTestObject.removeSelectedTagByText(dom.input, 'A1');
|
|
300
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual([]);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it('[valueType entity] should select & clear several options', async () => {
|
|
304
|
+
const { dom, mocks } = await setupPickerInputForTest({
|
|
305
|
+
value: undefined,
|
|
306
|
+
selectionMode: 'multi',
|
|
307
|
+
valueType: 'entity',
|
|
308
|
+
});
|
|
309
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select');
|
|
310
|
+
fireEvent.click(dom.input);
|
|
311
|
+
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
312
|
+
|
|
313
|
+
await PickerInputTestObject.clickOptionCheckbox('A1');
|
|
314
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([{ id: 2, level: 'A1', name: 'Elementary' }]);
|
|
315
|
+
|
|
316
|
+
await PickerInputTestObject.clickOptionCheckbox('A1+');
|
|
317
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([
|
|
318
|
+
{ id: 2, level: 'A1', name: 'Elementary' },
|
|
319
|
+
{ id: 3, level: 'A1+', name: 'Elementary+' },
|
|
320
|
+
]);
|
|
321
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['A1', 'A1+']);
|
|
322
|
+
|
|
323
|
+
fireEvent.click(window.document.body);
|
|
324
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
325
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['A1', 'A1+']);
|
|
326
|
+
|
|
327
|
+
PickerInputTestObject.removeSelectedTagByText(dom.input, 'A1+');
|
|
328
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['A1']);
|
|
329
|
+
|
|
330
|
+
PickerInputTestObject.removeSelectedTagByText(dom.input, 'A1');
|
|
331
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual([]);
|
|
332
|
+
});
|
|
333
|
+
it('should render names of items by getName', async () => {
|
|
334
|
+
const { dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
335
|
+
value: [3, 4],
|
|
336
|
+
selectionMode: 'multi',
|
|
337
|
+
getName: ({ name }) => name,
|
|
338
|
+
});
|
|
339
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['', '']);
|
|
340
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select');
|
|
341
|
+
await waitFor(() => expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['Elementary+', 'Pre-Intermediate']));
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
it('should render entity name with \'s\' in placeholder', async () => {
|
|
345
|
+
const { dom } = await setupPickerInputForTest({
|
|
346
|
+
value: undefined,
|
|
347
|
+
selectionMode: 'multi',
|
|
348
|
+
entityName: 'Language Level',
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select Language Levels');
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
it('should render plural entity name in placeholder', async () => {
|
|
355
|
+
const { dom } = await setupPickerInputForTest({
|
|
356
|
+
value: undefined,
|
|
357
|
+
selectionMode: 'multi',
|
|
358
|
+
entityName: 'Language Level',
|
|
359
|
+
entityPluralName: 'Multiple Language Levels',
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
expect(PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Please select Multiple Language Levels');
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
it('should pick single element with cascadeSelection = false', async () => {
|
|
366
|
+
const { mocks, dom } = await setupPickerInputForTest({
|
|
367
|
+
value: undefined,
|
|
368
|
+
getName: ({ name }) => name,
|
|
369
|
+
selectionMode: 'multi',
|
|
370
|
+
cascadeSelection: false,
|
|
371
|
+
dataSource: mockTreeLikeDataSourceAsync,
|
|
372
|
+
});
|
|
373
|
+
fireEvent.click(dom.input);
|
|
374
|
+
expect(await PickerInputTestObject.hasOptions()).toBeTruthy();
|
|
375
|
+
await PickerInputTestObject.clickOptionCheckbox('Parent 2');
|
|
376
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2]);
|
|
377
|
+
|
|
378
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['Parent 2']);
|
|
379
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual(['Parent 1', 'Parent 3']);
|
|
380
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['Parent 2']);
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
it.each<[CascadeSelection]>(
|
|
384
|
+
[[true], ['explicit']],
|
|
385
|
+
)
|
|
386
|
+
('should pick multiple elements with cascadeSelection = %s', async (cascadeSelection) => {
|
|
387
|
+
const { mocks, dom } = await setupPickerInputForTest({
|
|
388
|
+
value: undefined,
|
|
389
|
+
getName: ({ name }) => name,
|
|
390
|
+
selectionMode: 'multi',
|
|
391
|
+
cascadeSelection,
|
|
392
|
+
dataSource: mockTreeLikeDataSourceAsync,
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
fireEvent.click(dom.input);
|
|
396
|
+
expect(await PickerInputTestObject.hasOptions()).toBeTruthy();
|
|
397
|
+
// Check parent
|
|
398
|
+
await PickerInputTestObject.clickOptionCheckbox('Parent 2');
|
|
399
|
+
// Unfold parent
|
|
400
|
+
await PickerInputTestObject.clickOptionUnfold('Parent 2');
|
|
401
|
+
// Test if checkboxes are checked/unchecked
|
|
402
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2, 2.1, 2.2, 2.3]);
|
|
403
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['Parent 2', 'Child 2.1', 'Child 2.2', 'Child 2.3']);
|
|
404
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['Parent 2', 'Child 2.1', 'Child 2.2', 'Child 2.3']);
|
|
405
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual(['Parent 1', 'Parent 3']);
|
|
406
|
+
|
|
407
|
+
// Check child
|
|
408
|
+
await PickerInputTestObject.clickOptionCheckbox('Child 2.2');
|
|
409
|
+
// Test if checkboxes are checked/unchecked
|
|
410
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2.1, 2.3]);
|
|
411
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['Child 2.1', 'Child 2.3']);
|
|
412
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['Child 2.1', 'Child 2.3']);
|
|
413
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual(['Parent 1', 'Parent 2', 'Child 2.2', 'Parent 3']);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('should pick single element with cascadeSelection = implicit', async () => {
|
|
417
|
+
const { mocks, dom } = await setupPickerInputForTest({
|
|
418
|
+
value: undefined,
|
|
419
|
+
getName: ({ name }) => name,
|
|
420
|
+
selectionMode: 'multi',
|
|
421
|
+
cascadeSelection: 'implicit',
|
|
422
|
+
dataSource: mockTreeLikeDataSourceAsync,
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
fireEvent.click(dom.input);
|
|
426
|
+
expect(await PickerInputTestObject.hasOptions()).toBeTruthy();
|
|
427
|
+
|
|
428
|
+
// Check parent
|
|
429
|
+
await PickerInputTestObject.clickOptionCheckbox('Parent 2');
|
|
430
|
+
// Unfold parent
|
|
431
|
+
await PickerInputTestObject.clickOptionUnfold('Parent 2');
|
|
432
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2]);
|
|
433
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['Parent 2']);
|
|
434
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['Parent 2', 'Child 2.1', 'Child 2.2', 'Child 2.3']);
|
|
435
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual(['Parent 1', 'Parent 3']);
|
|
436
|
+
|
|
437
|
+
// Check child
|
|
438
|
+
await PickerInputTestObject.clickOptionCheckbox('Child 2.2');
|
|
439
|
+
// Test if checkboxes are checked/unchecked
|
|
440
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2.1, 2.3]);
|
|
441
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['Child 2.1', 'Child 2.3']);
|
|
442
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['Child 2.1', 'Child 2.3']);
|
|
443
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual(['Parent 1', 'Parent 2', 'Child 2.2', 'Parent 3']);
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
it('should wrap up if number of elements is greater than maxItems', async () => {
|
|
447
|
+
const { mocks, dom } = await setupPickerInputForTest({
|
|
448
|
+
value: undefined,
|
|
449
|
+
maxItems: 3,
|
|
450
|
+
entityPluralName: 'languages',
|
|
451
|
+
selectionMode: 'multi',
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
fireEvent.click(dom.input);
|
|
455
|
+
expect(await PickerInputTestObject.hasOptions()).toBeTruthy();
|
|
456
|
+
|
|
457
|
+
// Check parent
|
|
458
|
+
await PickerInputTestObject.clickOptionByText('A1');
|
|
459
|
+
await PickerInputTestObject.clickOptionByText('A1+');
|
|
460
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2, 3]);
|
|
461
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['A1', 'A1+']);
|
|
462
|
+
|
|
463
|
+
await PickerInputTestObject.clickOptionByText('A2');
|
|
464
|
+
await PickerInputTestObject.clickOptionByText('A2+');
|
|
465
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2, 3, 4, 5]);
|
|
466
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['4 languages selected']);
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
it('should disable clear', async () => {
|
|
470
|
+
const { setProps, dom, result } = await setupPickerInputForTest({
|
|
471
|
+
value: [2, 3],
|
|
472
|
+
selectionMode: 'multi',
|
|
473
|
+
disableClear: false,
|
|
474
|
+
});
|
|
475
|
+
await waitFor(() => expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['A1', 'A1+']));
|
|
476
|
+
PickerInputTestObject.clearInput(result.container);
|
|
477
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual([]);
|
|
478
|
+
|
|
479
|
+
setProps({ disableClear: true, value: [2, 3] });
|
|
480
|
+
expect(PickerInputTestObject.hasClearInputButton(result.container)).toBeFalsy();
|
|
481
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['A1', 'A1+']);
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
it('should select all', async () => {
|
|
485
|
+
const { dom } = await setupPickerInputForTest({
|
|
486
|
+
value: [],
|
|
487
|
+
selectionMode: 'multi',
|
|
488
|
+
maxItems: 100,
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
fireEvent.click(dom.input);
|
|
492
|
+
expect(await PickerInputTestObject.hasOptions()).toBeTruthy();
|
|
493
|
+
|
|
494
|
+
await PickerInputTestObject.clickSelectAllOptions();
|
|
495
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual(['A1', 'A1+', 'A2', 'A2+', 'B1', 'B1+', 'B2', 'B2+', 'C1', 'C1+', 'C2']);
|
|
496
|
+
|
|
497
|
+
await PickerInputTestObject.clickClearAllOptions();
|
|
498
|
+
expect(PickerInputTestObject.getSelectedTagsText(dom.input)).toEqual([]);
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
describe('show only selected', () => {
|
|
502
|
+
it('should show only selected items', async () => {
|
|
503
|
+
const { dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
504
|
+
value: [4, 2, 6, 8],
|
|
505
|
+
selectionMode: 'multi',
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
fireEvent.click(dom.input);
|
|
509
|
+
|
|
510
|
+
const dialog = await screen.findByRole('dialog');
|
|
511
|
+
expect(dialog).toBeInTheDocument();
|
|
512
|
+
|
|
513
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
514
|
+
|
|
515
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['A1', 'A2', 'B1', 'B2']);
|
|
516
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual(['A1+', 'A2+', 'B1+', 'B2+', 'C1', 'C1+', 'C2']);
|
|
517
|
+
|
|
518
|
+
await PickerInputTestObject.clickShowOnlySelected();
|
|
519
|
+
|
|
520
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['A2', 'A1', 'B1', 'B2']);
|
|
521
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual([]);
|
|
522
|
+
});
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
it('should clear search on show only selected toggle', async () => {
|
|
526
|
+
const { dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
527
|
+
value: [4, 2, 6, 8],
|
|
528
|
+
selectionMode: 'multi',
|
|
529
|
+
searchPosition: 'body',
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
fireEvent.click(dom.target);
|
|
533
|
+
|
|
534
|
+
const dialog = await PickerInputTestObject.findDialog();
|
|
535
|
+
expect(dialog).toBeInTheDocument();
|
|
536
|
+
|
|
537
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
538
|
+
|
|
539
|
+
const searchInput = within(dialog).queryByRole('searchbox') as HTMLInputElement;
|
|
540
|
+
fireEvent.change(searchInput, { target: { value: 'search' } });
|
|
541
|
+
|
|
542
|
+
await PickerInputTestObject.clickShowOnlySelected();
|
|
543
|
+
|
|
544
|
+
await waitFor(() => expect(searchInput.value).toEqual(''));
|
|
545
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['A2', 'A1', 'B1', 'B2']);
|
|
546
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual([]);
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
it('should turn off show only selected mode on search change', async () => {
|
|
550
|
+
const { dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
551
|
+
value: [4, 2, 6, 8],
|
|
552
|
+
selectionMode: 'multi',
|
|
553
|
+
searchPosition: 'body',
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
fireEvent.click(dom.target);
|
|
557
|
+
|
|
558
|
+
const dialog = screen.queryByRole('dialog');
|
|
559
|
+
expect(dialog).toBeInTheDocument();
|
|
560
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
561
|
+
|
|
562
|
+
await PickerInputTestObject.clickShowOnlySelected();
|
|
563
|
+
|
|
564
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['A2', 'A1', 'B1', 'B2']);
|
|
565
|
+
expect(await PickerInputTestObject.findUncheckedOptions()).toEqual([]);
|
|
566
|
+
|
|
567
|
+
const searchInput = within(dialog).getByRole('searchbox') as HTMLInputElement;
|
|
568
|
+
fireEvent.change(searchInput, { target: { value: 'search' } });
|
|
569
|
+
|
|
570
|
+
const showOnlySelectedSwitch = within(dialog).queryByRole('switch', { name: 'Show only selected' }) as HTMLInputElement;
|
|
571
|
+
|
|
572
|
+
await waitFor(() => expect(showOnlySelectedSwitch.checked).toEqual(false));
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
it('should disable input', async () => {
|
|
577
|
+
const { dom } = await setupPickerInputForTest({
|
|
578
|
+
value: undefined,
|
|
579
|
+
selectionMode: 'single',
|
|
580
|
+
isDisabled: true,
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
expect(dom.input.hasAttribute('disabled')).toBeTruthy();
|
|
584
|
+
expect(dom.input.getAttribute('aria-disabled')?.trim()).toEqual('true');
|
|
585
|
+
|
|
586
|
+
fireEvent.click(dom.input);
|
|
587
|
+
expect(screen.queryByRole('dialog')).toBeNull();
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
it('should make an input readonly', async () => {
|
|
591
|
+
const { dom } = await setupPickerInputForTest({
|
|
592
|
+
value: undefined,
|
|
593
|
+
selectionMode: 'single',
|
|
594
|
+
isReadonly: true,
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
expect(dom.input.hasAttribute('readonly')).toBeTruthy();
|
|
598
|
+
expect(dom.input.getAttribute('aria-readonly')?.trim()).toEqual('true');
|
|
599
|
+
|
|
600
|
+
fireEvent.click(dom.input);
|
|
601
|
+
expect(screen.queryByRole('dialog')).toBeNull();
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
it.each<[IHasEditMode['mode'] | undefined]>(
|
|
605
|
+
[[undefined], ['form'], ['cell'], ['inline']],
|
|
606
|
+
)('should render with mode = %s', async (mode) => {
|
|
607
|
+
const props: PickerInputComponentProps<TestItemType, number> = {
|
|
608
|
+
value: [],
|
|
609
|
+
onValueChange: () => {},
|
|
610
|
+
valueType: 'id',
|
|
611
|
+
dataSource: mockDataSourceAsync,
|
|
612
|
+
disableClear: false,
|
|
613
|
+
searchPosition: 'input',
|
|
614
|
+
getName: (item: TestItemType) => item.level,
|
|
615
|
+
selectionMode: 'multi',
|
|
616
|
+
mode,
|
|
617
|
+
};
|
|
618
|
+
expect(await renderSnapshotWithContextAsync(<PickerInput { ...props } />)).toMatchSnapshot();
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
it.each<['left' | 'right' | undefined]>(
|
|
622
|
+
[[undefined], ['left'], ['right']],
|
|
623
|
+
)('should render icon at specific position', async (iconPosition) => {
|
|
624
|
+
const props: PickerInputComponentProps<TestItemType, number> = {
|
|
625
|
+
value: [],
|
|
626
|
+
onValueChange: () => {},
|
|
627
|
+
valueType: 'id',
|
|
628
|
+
dataSource: mockDataSourceAsync,
|
|
629
|
+
disableClear: false,
|
|
630
|
+
searchPosition: 'input',
|
|
631
|
+
getName: (item: TestItemType) => item.level,
|
|
632
|
+
selectionMode: 'multi',
|
|
633
|
+
icon: () => <div data-testid = "test-icon" />,
|
|
634
|
+
iconPosition,
|
|
635
|
+
};
|
|
636
|
+
expect(await renderSnapshotWithContextAsync(<PickerInput { ...props } />)).toMatchSnapshot();
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
it('should pass onClick to the icon', async () => {
|
|
640
|
+
const { mocks } = await setupPickerInputForTest({
|
|
641
|
+
value: undefined,
|
|
642
|
+
onIconClick: jest.fn(),
|
|
643
|
+
icon: () => <div data-testid = "test-icon" />,
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
const iconContainer = screen.getByTestId('test-icon').parentElement as Element;
|
|
647
|
+
fireEvent.click(iconContainer);
|
|
648
|
+
expect(mocks.onIconClick).toBeCalledTimes(1);
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
it('should open dialog only when minCharsToSearch is reached', async () => {
|
|
652
|
+
const { dom } = await setupPickerInputForTest({
|
|
653
|
+
value: undefined,
|
|
654
|
+
minCharsToSearch: 1,
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
fireEvent.click(dom.input);
|
|
658
|
+
|
|
659
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
660
|
+
fireEvent.change(dom.input, { target: { value: 'A' } });
|
|
661
|
+
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
it('should use modal edit mode', async () => {
|
|
665
|
+
const { dom } = await setupPickerInputForTest({
|
|
666
|
+
value: undefined,
|
|
667
|
+
selectionMode: 'single',
|
|
668
|
+
editMode: 'modal',
|
|
669
|
+
});
|
|
670
|
+
fireEvent.click(dom.input);
|
|
671
|
+
expect(screen.getByAria('modal', 'true')).toBeInTheDocument();
|
|
672
|
+
|
|
673
|
+
expect(
|
|
674
|
+
await PickerInputTestObject.findOptionsText({ busy: false, editMode: 'modal' }),
|
|
675
|
+
).toEqual(
|
|
676
|
+
['A1', 'A1+', 'A2', 'A2+', 'B1', 'B1+', 'B2', 'B2+', 'C1', 'C1+', 'C2'],
|
|
677
|
+
);
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
it('should render input as invalid', async () => {
|
|
681
|
+
const props: PickerInputComponentProps<TestItemType, number | undefined> = {
|
|
682
|
+
value: undefined,
|
|
683
|
+
onValueChange: () => {},
|
|
684
|
+
valueType: 'id',
|
|
685
|
+
dataSource: mockDataSourceAsync,
|
|
686
|
+
disableClear: false,
|
|
687
|
+
searchPosition: 'input',
|
|
688
|
+
getName: (item: TestItemType) => item.level,
|
|
689
|
+
selectionMode: 'single',
|
|
690
|
+
isInvalid: true,
|
|
691
|
+
};
|
|
692
|
+
expect(await renderSnapshotWithContextAsync(<PickerInput { ...props } />)).toMatchSnapshot();
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
it('should support single line', async () => {
|
|
696
|
+
const props: PickerInputComponentProps<TestItemType, number> = {
|
|
697
|
+
value: [],
|
|
698
|
+
onValueChange: () => {},
|
|
699
|
+
dataSource: mockDataSourceAsync,
|
|
700
|
+
disableClear: false,
|
|
701
|
+
searchPosition: 'input',
|
|
702
|
+
getName: (item: TestItemType) => item.level,
|
|
703
|
+
selectionMode: 'multi',
|
|
704
|
+
isSingleLine: true,
|
|
705
|
+
};
|
|
706
|
+
expect(await renderSnapshotWithContextAsync(<PickerInput { ...props } />)).toMatchSnapshot();
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
it('should provide custom placeholder', async () => {
|
|
710
|
+
const { dom } = await setupPickerInputForTest({
|
|
711
|
+
value: undefined,
|
|
712
|
+
selectionMode: 'multi',
|
|
713
|
+
placeholder: 'Custom placeholder',
|
|
714
|
+
});
|
|
715
|
+
expect(await PickerInputTestObject.getPlaceholderText(dom.input)).toEqual('Custom placeholder');
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
it('should define minBodyWidth', async () => {
|
|
719
|
+
const { dom } = await setupPickerInputForTest({
|
|
720
|
+
value: undefined,
|
|
721
|
+
selectionMode: 'multi',
|
|
722
|
+
minBodyWidth: 300,
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
fireEvent.click(dom.input);
|
|
726
|
+
|
|
727
|
+
const dialog = await screen.findByRole('dialog');
|
|
728
|
+
expect(dialog).toBeInTheDocument();
|
|
729
|
+
|
|
730
|
+
const dialogBody = dialog.getElementsByClassName('uui-dropdown-body')[0];
|
|
731
|
+
expect(dialogBody).toHaveStyle('min-width: 300px');
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
it('should define dropdownHeight', async () => {
|
|
735
|
+
const { dom } = await setupPickerInputForTest({
|
|
736
|
+
value: undefined,
|
|
737
|
+
selectionMode: 'multi',
|
|
738
|
+
dropdownHeight: 100,
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
fireEvent.click(dom.input);
|
|
742
|
+
|
|
743
|
+
const dialog = await screen.findByRole('dialog');
|
|
744
|
+
expect(dialog).toBeInTheDocument();
|
|
745
|
+
|
|
746
|
+
const dialogBody = dialog.firstElementChild?.firstElementChild;
|
|
747
|
+
expect(dialogBody).toHaveStyle('max-height: 100px');
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
it('should render custom toggler', async () => {
|
|
751
|
+
const { mocks, dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
752
|
+
value: undefined,
|
|
753
|
+
selectionMode: 'multi',
|
|
754
|
+
renderToggler: (props) => (
|
|
755
|
+
<Button
|
|
756
|
+
rawProps={ {
|
|
757
|
+
...props.rawProps,
|
|
758
|
+
'data-testid': 'test-toggler',
|
|
759
|
+
} }
|
|
760
|
+
size="36"
|
|
761
|
+
onClick={ props.onClick }
|
|
762
|
+
ref={ props.ref }
|
|
763
|
+
iconPosition="left"
|
|
764
|
+
fill="ghost"
|
|
765
|
+
caption={ props.selection?.map((s) => s.value?.name).join(', ') }
|
|
766
|
+
/>
|
|
767
|
+
),
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
expect(dom.target.getAttribute('type')).toBe('button');
|
|
771
|
+
|
|
772
|
+
fireEvent.click(dom.target);
|
|
773
|
+
expect(await PickerInputTestObject.hasOptions()).toBeTruthy();
|
|
774
|
+
|
|
775
|
+
await PickerInputTestObject.clickOptionCheckbox('A1');
|
|
776
|
+
await PickerInputTestObject.clickOptionCheckbox('A1+');
|
|
777
|
+
expect(mocks.onValueChange).toHaveBeenLastCalledWith([2, 3]);
|
|
778
|
+
|
|
779
|
+
expect(await PickerInputTestObject.findCheckedOptions()).toEqual(['A1', 'A1+']);
|
|
780
|
+
expect(screen.getByTestId('test-toggler').textContent?.trim()).toEqual('Elementary, Elementary+');
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
it('Should render toggler without arrow icon', async () => {
|
|
784
|
+
const { dom } = await setupPickerInputForTest({
|
|
785
|
+
value: undefined,
|
|
786
|
+
selectionMode: 'single',
|
|
787
|
+
entityName: 'Language Level',
|
|
788
|
+
searchPosition: 'input',
|
|
789
|
+
renderToggler: () => <PickerToggler dropdownIcon={ () => <div data-testid = "arrow-icon" /> } pickerMode="single" searchPosition="none" closePickerBody={ () => {} } />,
|
|
790
|
+
minCharsToSearch: 3,
|
|
791
|
+
});
|
|
792
|
+
|
|
793
|
+
expect(within(dom.container).queryByTestId('arrow-icon')).not.toBeInTheDocument();
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
it('Should render toggler with arrow icon', async () => {
|
|
797
|
+
const { dom } = await setupPickerInputForTest({
|
|
798
|
+
value: undefined,
|
|
799
|
+
selectionMode: 'single',
|
|
800
|
+
entityName: 'Language Level',
|
|
801
|
+
renderToggler: () => <PickerToggler isDropdown dropdownIcon={ () => <div data-testid = "arrow-icon" /> } pickerMode="single" searchPosition="none" closePickerBody={ () => {} } />,
|
|
802
|
+
minCharsToSearch: undefined,
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
expect(within(dom.container).getByTestId('arrow-icon')).toBeInTheDocument();
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
it('should render search in input', async () => {
|
|
809
|
+
const { dom } = await setupPickerInputForTest({
|
|
810
|
+
value: undefined,
|
|
811
|
+
selectionMode: 'multi',
|
|
812
|
+
searchPosition: 'input',
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
expect(dom.input.getAttribute('readonly')).toBeNull();
|
|
816
|
+
fireEvent.click(dom.input);
|
|
817
|
+
const dialog = await screen.findByRole('dialog');
|
|
818
|
+
expect(dialog).toBeInTheDocument();
|
|
819
|
+
|
|
820
|
+
const bodyInput = within(dialog).queryByPlaceholderText('Search');
|
|
821
|
+
expect(bodyInput).not.toBeInTheDocument();
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
it('should render search in body', async () => {
|
|
825
|
+
const { dom } = await setupPickerInputForTest({
|
|
826
|
+
value: undefined,
|
|
827
|
+
selectionMode: 'multi',
|
|
828
|
+
searchPosition: 'body',
|
|
829
|
+
});
|
|
830
|
+
|
|
831
|
+
expect(dom.input.hasAttribute('readonly')).toBeTruthy();
|
|
832
|
+
fireEvent.click(dom.input);
|
|
833
|
+
|
|
834
|
+
const dialog = await screen.findByRole('dialog');
|
|
835
|
+
expect(dialog).toBeInTheDocument();
|
|
836
|
+
const bodyInput = within(dialog).getByPlaceholderText('Search');
|
|
837
|
+
expect(bodyInput).toBeInTheDocument();
|
|
838
|
+
expect(bodyInput.hasAttribute('readonly')).toBeFalsy();
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
it('should not render search in none mode', async () => {
|
|
842
|
+
const { dom } = await setupPickerInputForTest({
|
|
843
|
+
value: undefined,
|
|
844
|
+
selectionMode: 'multi',
|
|
845
|
+
searchPosition: 'none',
|
|
846
|
+
});
|
|
847
|
+
|
|
848
|
+
expect(dom.input.hasAttribute('readonly')).toBeTruthy();
|
|
849
|
+
fireEvent.click(dom.input);
|
|
850
|
+
|
|
851
|
+
const dialog = await screen.findByRole('dialog');
|
|
852
|
+
expect(dialog).toBeInTheDocument();
|
|
853
|
+
expect(within(dialog).queryByPlaceholderText('Search')).not.toBeInTheDocument();
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
it('should render custom not found', async () => {
|
|
857
|
+
const mockEmptyDS = new ArrayDataSource<TestItemType, number, any>({
|
|
858
|
+
items: [],
|
|
859
|
+
getId: ({ id }) => id,
|
|
860
|
+
});
|
|
861
|
+
|
|
862
|
+
const customText = 'Custom Text or Component';
|
|
863
|
+
|
|
864
|
+
const { dom } = await setupPickerInputForTest({
|
|
865
|
+
value: undefined,
|
|
866
|
+
selectionMode: 'multi',
|
|
867
|
+
dataSource: mockEmptyDS,
|
|
868
|
+
renderNotFound: () => (
|
|
869
|
+
<FlexCell grow={ 1 } textAlign="center" rawProps={ { 'data-testid': 'test-custom-not-found' } }>
|
|
870
|
+
<Text>{customText}</Text>
|
|
871
|
+
</FlexCell>
|
|
872
|
+
),
|
|
873
|
+
});
|
|
874
|
+
|
|
875
|
+
fireEvent.click(dom.input);
|
|
876
|
+
const notFound = within(await screen.findByRole('dialog')).getByTestId('test-custom-not-found');
|
|
877
|
+
expect(notFound).toHaveTextContent(customText);
|
|
878
|
+
});
|
|
879
|
+
|
|
880
|
+
it('should render custom row', async () => {
|
|
881
|
+
const { dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
882
|
+
value: undefined,
|
|
883
|
+
selectionMode: 'multi',
|
|
884
|
+
renderRow: (props) => (
|
|
885
|
+
<DataPickerRow
|
|
886
|
+
{ ...props }
|
|
887
|
+
key={ props.rowKey }
|
|
888
|
+
alignActions="center"
|
|
889
|
+
renderItem={ (item, rowProps) => <PickerItem { ...rowProps } title={ item.name } /> }
|
|
890
|
+
/>
|
|
891
|
+
),
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
fireEvent.click(dom.input);
|
|
895
|
+
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
896
|
+
|
|
897
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
898
|
+
|
|
899
|
+
expect(await PickerInputTestObject.findOptionsText({ busy: false })).toEqual([
|
|
900
|
+
'Elementary',
|
|
901
|
+
'Elementary+',
|
|
902
|
+
'Pre-Intermediate',
|
|
903
|
+
'Pre-Intermediate+',
|
|
904
|
+
'Intermediate',
|
|
905
|
+
'Intermediate+',
|
|
906
|
+
'Upper-Intermediate',
|
|
907
|
+
'Upper-Intermediate+',
|
|
908
|
+
'Advanced',
|
|
909
|
+
'Advanced+',
|
|
910
|
+
'Proficiency',
|
|
911
|
+
]);
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
it('should search items', async () => {
|
|
915
|
+
const { dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
916
|
+
value: undefined,
|
|
917
|
+
selectionMode: 'multi',
|
|
918
|
+
searchPosition: 'body',
|
|
919
|
+
getSearchFields: (item) => [item!.level],
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
expect(dom.input.hasAttribute('readonly')).toBeTruthy();
|
|
923
|
+
fireEvent.click(dom.input);
|
|
924
|
+
|
|
925
|
+
const dialog = await screen.findByRole('dialog');
|
|
926
|
+
expect(dialog).toBeInTheDocument();
|
|
927
|
+
|
|
928
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
929
|
+
|
|
930
|
+
expect(await PickerInputTestObject.findOptionsText({ busy: false })).toEqual([
|
|
931
|
+
'A1',
|
|
932
|
+
'A1+',
|
|
933
|
+
'A2',
|
|
934
|
+
'A2+',
|
|
935
|
+
'B1',
|
|
936
|
+
'B1+',
|
|
937
|
+
'B2',
|
|
938
|
+
'B2+',
|
|
939
|
+
'C1',
|
|
940
|
+
'C1+',
|
|
941
|
+
'C2',
|
|
942
|
+
]);
|
|
943
|
+
|
|
944
|
+
const bodyInput = within(dialog).getByPlaceholderText('Search');
|
|
945
|
+
fireEvent.change(bodyInput, { target: { value: 'A' } });
|
|
946
|
+
|
|
947
|
+
await waitFor(() => expect(PickerInputTestObject.getOptions({ busy: false }).length).toBe(4));
|
|
948
|
+
|
|
949
|
+
expect(await PickerInputTestObject.findOptionsText({ busy: false })).toEqual([
|
|
950
|
+
'A1',
|
|
951
|
+
'A1+',
|
|
952
|
+
'A2',
|
|
953
|
+
'A2+',
|
|
954
|
+
]);
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
describe('keyboard navigation', () => {
|
|
958
|
+
let btn;
|
|
959
|
+
function addFocusableElementBefore() {
|
|
960
|
+
const btnEl = document.createElement('button');
|
|
961
|
+
document.body.prepend(btnEl);
|
|
962
|
+
return btnEl;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
beforeAll(() => {
|
|
966
|
+
btn = addFocusableElementBefore();
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
const testInputFocus = async (selectionMode, searchPosition?) => {
|
|
970
|
+
const user = userEvent.setup();
|
|
971
|
+
const { dom } = await setupPickerInputForTest({
|
|
972
|
+
value: undefined,
|
|
973
|
+
selectionMode,
|
|
974
|
+
searchPosition,
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
// click the button just before PickerInput
|
|
978
|
+
await user.click(btn);
|
|
979
|
+
// move to PickerInput by Tab key
|
|
980
|
+
await user.tab();
|
|
981
|
+
|
|
982
|
+
expect(dom.input).not.toHaveAttribute('readOnly');
|
|
983
|
+
expect(dom.input).toEqual(document.activeElement);
|
|
984
|
+
|
|
985
|
+
return user;
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
it('[selectionMode single] should focus input on Tab', async () => await testInputFocus('single'));
|
|
989
|
+
|
|
990
|
+
it('[selectionMode multi] should focus input on Tab', async () => await testInputFocus('multi', 'input'));
|
|
991
|
+
|
|
992
|
+
it('[selectionMode single] should open dropdown when start typing', async () => {
|
|
993
|
+
const user = await testInputFocus('single');
|
|
994
|
+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
995
|
+
|
|
996
|
+
await user.keyboard('a');
|
|
997
|
+
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
it('should focus on first item on open and then move focus by arrows', async () => {
|
|
1001
|
+
const { dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
1002
|
+
value: undefined,
|
|
1003
|
+
selectionMode: 'multi',
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
fireEvent.click(dom.input);
|
|
1007
|
+
|
|
1008
|
+
const dialog = await screen.findByRole('dialog');
|
|
1009
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
1010
|
+
|
|
1011
|
+
let focusedItem = dialog.querySelector('.uui-focus');
|
|
1012
|
+
expect(focusedItem.getAttribute('aria-posinset')).toBe('1');
|
|
1013
|
+
|
|
1014
|
+
fireEvent.keyDown(dom.input, { key: 'ArrowDown', code: 'ArrowDown', charCode: 40 });
|
|
1015
|
+
focusedItem = dialog.querySelector('.uui-focus');
|
|
1016
|
+
expect(focusedItem.getAttribute('aria-posinset')).toBe('2');
|
|
1017
|
+
|
|
1018
|
+
fireEvent.keyDown(dom.input, { key: 'ArrowUp', code: 'ArrowUp', charCode: 38 });
|
|
1019
|
+
focusedItem = dialog.querySelector('.uui-focus');
|
|
1020
|
+
expect(focusedItem.getAttribute('aria-posinset')).toBe('1');
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
it('should focus first founded item after search', async () => {
|
|
1024
|
+
const { dom } = await setupPickerInputForTest<TestItemType, number>({
|
|
1025
|
+
value: undefined,
|
|
1026
|
+
selectionMode: 'single',
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
fireEvent.click(dom.input);
|
|
1030
|
+
|
|
1031
|
+
const dialog = await screen.findByRole('dialog');
|
|
1032
|
+
|
|
1033
|
+
fireEvent.change(dom.input, { target: { value: 'A' } });
|
|
1034
|
+
|
|
1035
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
1036
|
+
|
|
1037
|
+
const focusedItem = dialog.querySelector('.uui-focus');
|
|
1038
|
+
expect(focusedItem.getAttribute('aria-posinset')).toBe('1');
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
it('should select focused item by enter', async () => {
|
|
1042
|
+
const { dom, mocks } = await setupPickerInputForTest<TestItemType, number>({
|
|
1043
|
+
value: undefined,
|
|
1044
|
+
selectionMode: 'single',
|
|
1045
|
+
});
|
|
1046
|
+
|
|
1047
|
+
fireEvent.click(dom.input);
|
|
1048
|
+
|
|
1049
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
1050
|
+
|
|
1051
|
+
fireEvent.keyDown(dom.input, { key: 'Enter', code: 'Enter', charCode: 13 });
|
|
1052
|
+
expect(mocks.onValueChange).toHaveBeenCalledWith(2);
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
it('should remove last item from selection by backspace in case of searchPosition="input"', async () => {
|
|
1056
|
+
const { dom, mocks } = await setupPickerInputForTest<TestItemType, number>({
|
|
1057
|
+
value: [2, 3, 4],
|
|
1058
|
+
selectionMode: 'multi',
|
|
1059
|
+
searchPosition: 'input',
|
|
1060
|
+
});
|
|
1061
|
+
|
|
1062
|
+
fireEvent.click(dom.input);
|
|
1063
|
+
|
|
1064
|
+
await PickerInputTestObject.waitForOptionsToBeReady();
|
|
1065
|
+
|
|
1066
|
+
fireEvent.keyDown(dom.input, { key: 'Backspace', code: 'Backspace', charCode: 8 });
|
|
1067
|
+
expect(mocks.onValueChange).toHaveBeenCalledWith([2, 3]);
|
|
1068
|
+
|
|
1069
|
+
fireEvent.keyDown(dom.input, { key: 'Backspace', code: 'Backspace', charCode: 8 });
|
|
1070
|
+
expect(mocks.onValueChange).toHaveBeenCalledWith([2]);
|
|
1071
|
+
});
|
|
1072
|
+
});
|
|
1073
|
+
});
|