@economic/taco 2.47.0-server.3 → 2.47.0-server.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Icon/components/Autopay.d.ts +3 -0
- package/dist/components/Icon/components/AutopayPaused.d.ts +3 -0
- package/dist/components/Icon/components/Person.d.ts +3 -0
- package/dist/components/Icon/components/PersonSolid.d.ts +3 -0
- package/dist/components/Icon/components/Wallet.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/Select2/components/Option.d.ts +4 -4
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +32 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/esm/index.css +11 -2
- package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js +32 -24
- package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js +84 -61
- package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js +16 -15
- package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js +12 -13
- package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js +104 -68
- package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +38 -29
- package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Donut/util.js +2 -2
- package/dist/esm/packages/taco/src/charts/components/Donut/util.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Legend.js +45 -37
- package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js +32 -24
- package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js +5 -3
- package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Tooltip.js +26 -25
- package/dist/esm/packages/taco/src/charts/components/Tooltip.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/utils/color.js +13 -12
- package/dist/esm/packages/taco/src/charts/utils/color.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/utils/common.js +39 -26
- package/dist/esm/packages/taco/src/charts/utils/common.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +30 -31
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Alert/Alert.js +7 -9
- package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js +14 -13
- package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/Context.js +2 -2
- package/dist/esm/packages/taco/src/components/AlertDialog/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +10 -9
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Footer.js +4 -4
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Trigger.js +5 -6
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +2 -2
- package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js +26 -27
- package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js +12 -14
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Banner/Banner.js +7 -10
- package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Banner/util.js +3 -3
- package/dist/esm/packages/taco/src/components/Banner/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Button/Button.js +28 -29
- package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Button/util.js +25 -24
- package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +75 -71
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +14 -15
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +24 -22
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +21 -23
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +76 -64
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +60 -57
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +27 -28
- package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/Context.js +4 -4
- package/dist/esm/packages/taco/src/components/Dialog/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/Dialog.js +54 -39
- package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +36 -38
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js +3 -3
- package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js +2 -2
- package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Trigger.js +5 -6
- package/dist/esm/packages/taco/src/components/Dialog/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/util.js +7 -3
- package/dist/esm/packages/taco/src/components/Dialog/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Context.js +5 -5
- package/dist/esm/packages/taco/src/components/Drawer/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +61 -51
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +134 -145
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/util.js +5 -5
- package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js +14 -12
- package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Form/Form.js +7 -6
- package/dist/esm/packages/taco/src/components/Form/Form.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js +9 -7
- package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +37 -36
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/Header.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js +14 -10
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Badge.js +5 -4
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Badge.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js +7 -9
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +9 -9
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +66 -46
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Button.js +12 -8
- package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Link.js +22 -18
- package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Logo.js +4 -4
- package/dist/esm/packages/taco/src/components/Header/components/Logo.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +10 -9
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js +5 -7
- package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js +7 -7
- package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Person.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Person.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +14 -4
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/IconButton/IconButton.js +22 -23
- package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +45 -44
- package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js +8 -5
- package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/Layout.js +7 -5
- package/dist/esm/packages/taco/src/components/Layout/Layout.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Layout/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Context.js +4 -2
- package/dist/esm/packages/taco/src/components/Layout/components/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Page.js +2 -2
- package/dist/esm/packages/taco/src/components/Layout/components/Page.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +34 -27
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/components/Top.js +9 -6
- package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Button.js +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Collapsible.js +10 -7
- package/dist/esm/packages/taco/src/components/List/components/Collapsible.js.map +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Item.js +15 -13
- package/dist/esm/packages/taco/src/components/List/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Link.js +3 -3
- package/dist/esm/packages/taco/src/components/List/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/List/components/Toggle.js +29 -27
- package/dist/esm/packages/taco/src/components/List/components/Toggle.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/Listbox.js +21 -26
- package/dist/esm/packages/taco/src/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +82 -70
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useListbox.js +56 -51
- package/dist/esm/packages/taco/src/components/Listbox/useListbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js +83 -65
- package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useTypeahead.js +9 -10
- package/dist/esm/packages/taco/src/components/Listbox/useTypeahead.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/util.js +78 -48
- package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Context.js +2 -2
- package/dist/esm/packages/taco/src/components/Menu/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Menu.js +42 -26
- package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Checkbox.js +8 -8
- package/dist/esm/packages/taco/src/components/Menu/components/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +27 -21
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js +3 -3
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js +32 -32
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Link.js +10 -10
- package/dist/esm/packages/taco/src/components/Menu/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js +15 -16
- package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js +7 -7
- package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +5 -5
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +6 -6
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +41 -36
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js +6 -6
- package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js +6 -6
- package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js +14 -11
- package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +31 -24
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +7 -7
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/util.js +9 -7
- package/dist/esm/packages/taco/src/components/Navigation2/components/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +48 -51
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +26 -23
- package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +53 -39
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/usePagination.js +17 -7
- package/dist/esm/packages/taco/src/components/Pagination/usePagination.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/usePaginationShortcuts.js +8 -9
- package/dist/esm/packages/taco/src/components/Pagination/usePaginationShortcuts.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js +45 -43
- package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Primitives.js +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Primitives.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/util.js +3 -1
- package/dist/esm/packages/taco/src/components/Popover/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Progress/Progress.js +13 -11
- package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +13 -12
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Provider.js +8 -8
- package/dist/esm/packages/taco/src/components/Provider/Provider.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +54 -47
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/util.js +7 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js +7 -5
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Report/useReport.js +1 -1
- package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +17 -13
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +11 -11
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +44 -39
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/Select.js +28 -31
- package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +79 -70
- package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +154 -121
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Collection.js +2 -4
- package/dist/esm/packages/taco/src/components/Select2/components/Collection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Context.js +4 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js +45 -41
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +145 -129
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Group.js +8 -8
- package/dist/esm/packages/taco/src/components/Select2/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +36 -35
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js +9 -10
- package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Title.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Title.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +173 -128
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +32 -23
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js +13 -6
- package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +16 -13
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Spinner/Spinner.js +17 -12
- package/dist/esm/packages/taco/src/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Switch/Switch.js +14 -14
- package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +28 -23
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/PaginatedTable.js +7 -3
- package/dist/esm/packages/taco/src/components/Table/components/PaginatedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/Table.js +22 -18
- package/dist/esm/packages/taco/src/components/Table/components/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +100 -92
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +136 -118
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowDraggable.js +55 -55
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js +35 -41
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js +77 -71
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useRowCreation.js +56 -30
- package/dist/esm/packages/taco/src/components/Table/hooks/useRowCreation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTable.js +151 -142
- package/dist/esm/packages/taco/src/components/Table/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js +22 -20
- package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +9 -12
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +41 -41
- package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/rowIndexPath.js +16 -14
- package/dist/esm/packages/taco/src/components/Table/util/rowIndexPath.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js +32 -26
- package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util.js +37 -30
- package/dist/esm/packages/taco/src/components/Table/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +23 -23
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Cell.js +13 -14
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js +21 -23
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js +20 -17
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +67 -73
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingDisplayCell.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingDisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +19 -20
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +26 -25
- package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +45 -40
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +7 -8
- package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +18 -19
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +7 -10
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +38 -36
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +15 -15
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +8 -11
- package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +164 -201
- package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +40 -27
- package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +18 -16
- package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js +25 -19
- package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +29 -35
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +34 -35
- package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js +18 -16
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +8 -11
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toast.js +19 -20
- package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js +117 -96
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/util.js +6 -4
- package/dist/esm/packages/taco/src/components/Toast/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +10 -9
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tour/Tour.js +49 -46
- package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +33 -27
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +15 -13
- package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +1 -1
- package/dist/esm/packages/taco/src/components/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/esm/packages/taco/src/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js +11 -6
- package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useBoundingClientRectListener.js +19 -13
- package/dist/esm/packages/taco/src/hooks/useBoundingClientRectListener.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js +4 -4
- package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useId.js +4 -2
- package/dist/esm/packages/taco/src/hooks/useId.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js +20 -18
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIsFormControl.js +7 -5
- package/dist/esm/packages/taco/src/hooks/useIsFormControl.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIsHoverStatePaused.js +9 -5
- package/dist/esm/packages/taco/src/hooks/useIsHoverStatePaused.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIsLargeScreen.js +3 -1
- package/dist/esm/packages/taco/src/hooks/useIsLargeScreen.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useLazyEffect.js +2 -2
- package/dist/esm/packages/taco/src/hooks/useLazyEffect.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js +24 -22
- package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useMatchMedia.js +13 -6
- package/dist/esm/packages/taco/src/hooks/useMatchMedia.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useMergedRef.js +3 -3
- package/dist/esm/packages/taco/src/hooks/useMergedRef.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/usePrevious.js +2 -2
- package/dist/esm/packages/taco/src/hooks/usePrevious.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/BubbleSelect.js +14 -14
- package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Button.js +16 -13
- package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +50 -44
- package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Context.js +4 -2
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Group.js +9 -5
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js +16 -18
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js +47 -40
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Title.js +9 -10
- package/dist/esm/packages/taco/src/primitives/Listbox2/components/Title.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +22 -20
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js +24 -27
- package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Sortable/components/List.js +11 -10
- package/dist/esm/packages/taco/src/primitives/Sortable/components/List.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +22 -19
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js +25 -22
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js +6 -6
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +30 -14
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js +18 -19
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +34 -34
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/Cell.js +10 -12
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js +19 -18
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +42 -40
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js +5 -7
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +19 -24
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +56 -55
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +27 -23
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js +13 -16
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +86 -87
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js +14 -11
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +85 -58
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js +18 -20
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js +11 -6
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +58 -49
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +28 -32
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +44 -37
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js +11 -11
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js +6 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js +23 -22
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +59 -42
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js +39 -39
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +21 -16
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +16 -15
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +51 -40
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js +13 -9
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +57 -51
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.js +71 -67
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +40 -37
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js +64 -44
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js +62 -51
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js +6 -6
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRef.js +13 -5
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRef.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +93 -77
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyle.js +15 -15
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyle.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js +31 -41
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +31 -30
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/listeners/useTableRowActiveListener.js +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/listeners/useTableRowActiveListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +14 -15
- package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/util/rows.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/Core/util/rows.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +42 -36
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js +67 -74
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnFreezing.js +11 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnFreezing.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnOrdering.js +5 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnOrdering.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFontSize.js +15 -5
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFontSize.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFooter.js +5 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFooter.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js +26 -16
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActions.js +9 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +42 -23
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js +9 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowDrag.js +9 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowDrag.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowDrop.js +5 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowDrop.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +9 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGoto.js +5 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGoto.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGroups.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGroups.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowHeight.js +15 -5
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowHeight.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js +14 -9
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +25 -13
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +43 -22
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js +34 -24
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js +4 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +18 -16
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowHeightListener.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowHeightListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +6 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +8 -8
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +6 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js +8 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js +17 -17
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSortingListener.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSortingListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +55 -55
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +59 -30
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js +4 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js +33 -19
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +11 -11
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +21 -19
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js +6 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +138 -106
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js +3 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
- package/dist/esm/packages/taco/src/types.js +1 -1
- package/dist/esm/packages/taco/src/types.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/aria.js +2 -2
- package/dist/esm/packages/taco/src/utils/aria.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/date.js +47 -23
- package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/debounce.js +10 -4
- package/dist/esm/packages/taco/src/utils/debounce.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/device.js +4 -2
- package/dist/esm/packages/taco/src/utils/device.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +26 -20
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useDraggable.js +40 -38
- package/dist/esm/packages/taco/src/utils/hooks/useDraggable.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useDropTarget.js +9 -7
- package/dist/esm/packages/taco/src/utils/hooks/useDropTarget.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useListKeyboardNavigation.js +20 -9
- package/dist/esm/packages/taco/src/utils/hooks/useListKeyboardNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useListScrollTo.js +9 -9
- package/dist/esm/packages/taco/src/utils/hooks/useListScrollTo.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useOnClickOutside.js +8 -6
- package/dist/esm/packages/taco/src/utils/hooks/useOnClickOutside.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useTimer.js +16 -11
- package/dist/esm/packages/taco/src/utils/hooks/useTimer.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +11 -6
- package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/input.js +10 -7
- package/dist/esm/packages/taco/src/utils/input.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/keyboard.js +8 -5
- package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/mergeRefs.js +2 -2
- package/dist/esm/packages/taco/src/utils/mergeRefs.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/tailwind.js +5 -5
- package/dist/esm/packages/taco/src/utils/tailwind.js.map +1 -1
- package/dist/esm/packages/taco/tailwind.colors.js +1 -1
- package/dist/esm/packages/taco/tailwind.colors.js.map +1 -1
- package/dist/index.css +11 -2
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.d.ts +3 -0
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +0 -1
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +0 -3
- package/dist/primitives/Table/types.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +2 -1
- package/dist/taco.cjs.development.js +7944 -6916
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +1 -2
@@ -1,5 +1,6 @@
|
|
1
1
|
import { forwardRef, useMemo, createRef, useEffect, createElement } from 'react';
|
2
2
|
import cn from 'clsx';
|
3
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
3
4
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
4
5
|
import { useLocalization } from '../Provider/Localization.js';
|
5
6
|
import { Spinner } from '../Spinner/Spinner.js';
|
@@ -8,9 +9,13 @@ import { getInputClasses } from '../Input/util.js';
|
|
8
9
|
import { getNextIndexFromKey } from '../../utils/hooks/useListKeyboardNavigation.js';
|
9
10
|
import { useListScrollTo } from '../../utils/hooks/useListScrollTo.js';
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
var _excluded = ["data", "disabled", "highlighted", "id", "invalid", "loading", "onChange", "onClick", "onFocus", "onKeyDown", "readOnly", "scrollOnFocus", "value", "multiselect", "selectedIndexes", "allOptionsSelected"],
|
13
|
+
_excluded2 = ["children", "icon"];
|
14
|
+
var getId = function getId(id, value) {
|
15
|
+
return id + "_" + value;
|
16
|
+
};
|
17
|
+
var getNextEnabledItem = function getNextEnabledItem(event, data, index) {
|
18
|
+
var nextIndex = getNextIndexFromKey(event.key, data.length, index);
|
14
19
|
if (nextIndex) {
|
15
20
|
if (nextIndex === index) {
|
16
21
|
return index;
|
@@ -20,35 +25,36 @@ const getNextEnabledItem = (event, data, index) => {
|
|
20
25
|
}
|
21
26
|
return nextIndex;
|
22
27
|
};
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
allOptionsSelected = false,
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
28
|
+
var ScrollableList = /*#__PURE__*/forwardRef(function ScrollableList(props, ref) {
|
29
|
+
var data = props.data,
|
30
|
+
disabled = props.disabled,
|
31
|
+
id = props.id,
|
32
|
+
loading = props.loading,
|
33
|
+
setCurrentIndex = props.onChange,
|
34
|
+
onClick = props.onClick,
|
35
|
+
onFocus = props.onFocus,
|
36
|
+
onKeyDown = props.onKeyDown,
|
37
|
+
readOnly = props.readOnly,
|
38
|
+
_props$scrollOnFocus = props.scrollOnFocus,
|
39
|
+
scrollOnFocus = _props$scrollOnFocus === void 0 ? false : _props$scrollOnFocus,
|
40
|
+
currentIndex = props.value,
|
41
|
+
multiselect = props.multiselect,
|
42
|
+
_props$selectedIndexe = props.selectedIndexes,
|
43
|
+
selectedIndexes = _props$selectedIndexe === void 0 ? [] : _props$selectedIndexe,
|
44
|
+
_props$allOptionsSele = props.allOptionsSelected,
|
45
|
+
allOptionsSelected = _props$allOptionsSele === void 0 ? false : _props$allOptionsSele,
|
46
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
47
|
+
var listRef = useMergedRef(ref);
|
48
|
+
var itemRefs = useMemo(function () {
|
49
|
+
return data.map(function () {
|
50
|
+
return /*#__PURE__*/createRef();
|
51
|
+
});
|
52
|
+
}, [data]);
|
53
|
+
var _useLocalization = useLocalization(),
|
54
|
+
texts = _useLocalization.texts;
|
55
|
+
var _useListScrollTo = useListScrollTo(listRef, itemRefs),
|
56
|
+
scrollTo = _useListScrollTo.scrollTo;
|
57
|
+
useEffect(function () {
|
52
58
|
var _itemRefs$currentInde;
|
53
59
|
if (currentIndex && (_itemRefs$currentInde = itemRefs[currentIndex]) !== null && _itemRefs$currentInde !== void 0 && _itemRefs$currentInde.current) {
|
54
60
|
var _itemRefs$currentInde2;
|
@@ -57,11 +63,11 @@ const ScrollableList = /*#__PURE__*/forwardRef(function ScrollableList(props, re
|
|
57
63
|
});
|
58
64
|
}
|
59
65
|
}, []);
|
60
|
-
useEffect(()
|
66
|
+
useEffect(function () {
|
61
67
|
scrollTo(currentIndex);
|
62
68
|
}, [currentIndex]);
|
63
|
-
|
64
|
-
|
69
|
+
var handleKeyDown = function handleKeyDown(event) {
|
70
|
+
var nextIndex = getNextEnabledItem(event, data, currentIndex);
|
65
71
|
if (nextIndex !== undefined && nextIndex !== currentIndex) {
|
66
72
|
event.preventDefault();
|
67
73
|
scrollTo(nextIndex);
|
@@ -69,21 +75,23 @@ const ScrollableList = /*#__PURE__*/forwardRef(function ScrollableList(props, re
|
|
69
75
|
}
|
70
76
|
if (onKeyDown) {
|
71
77
|
event.persist();
|
72
|
-
|
78
|
+
var index = nextIndex !== undefined ? nextIndex : currentIndex;
|
73
79
|
onKeyDown(event, index);
|
74
80
|
}
|
75
81
|
// Stops the keyboard event from propagating so that keyboard event on other components outside the scrollable
|
76
82
|
// list are not executed.
|
77
83
|
event.stopPropagation();
|
78
84
|
};
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
+
var handleClick = function handleClick(index) {
|
86
|
+
return function (event) {
|
87
|
+
setCurrentIndex(index);
|
88
|
+
if (onClick) {
|
89
|
+
event.persist();
|
90
|
+
onClick(event, index);
|
91
|
+
}
|
92
|
+
};
|
85
93
|
};
|
86
|
-
|
94
|
+
var handleFocus = function handleFocus(event) {
|
87
95
|
if (scrollOnFocus) {
|
88
96
|
scrollTo(currentIndex);
|
89
97
|
}
|
@@ -92,17 +100,19 @@ const ScrollableList = /*#__PURE__*/forwardRef(function ScrollableList(props, re
|
|
92
100
|
onFocus(event);
|
93
101
|
}
|
94
102
|
};
|
95
|
-
|
103
|
+
var getOptionCheckedState = function getOptionCheckedState(optionValue, index) {
|
96
104
|
if (optionValue === '#ALL-OPTIONS#') {
|
97
105
|
return allOptionsSelected;
|
98
106
|
} else if (!optionValue || !selectedIndexes) {
|
99
107
|
return false;
|
100
108
|
} else {
|
101
|
-
return selectedIndexes.findIndex(
|
109
|
+
return selectedIndexes.findIndex(function (i) {
|
110
|
+
return i === index;
|
111
|
+
}) !== -1;
|
102
112
|
}
|
103
113
|
};
|
104
|
-
|
105
|
-
|
114
|
+
var options = data.map(function (option, index) {
|
115
|
+
var depth = option.path ? option.path.split('.').length - 1 : 0;
|
106
116
|
return {
|
107
117
|
'aria-selected': multiselect ? getOptionCheckedState(String(option.value), index) : currentIndex === index,
|
108
118
|
'data-focused': currentIndex === index,
|
@@ -118,48 +128,50 @@ const ScrollableList = /*#__PURE__*/forwardRef(function ScrollableList(props, re
|
|
118
128
|
ref: itemRefs[index],
|
119
129
|
role: 'option',
|
120
130
|
style: depth > 0 ? {
|
121
|
-
paddingLeft:
|
131
|
+
paddingLeft: depth + 1 + "rem"
|
122
132
|
} : undefined
|
123
133
|
};
|
124
134
|
});
|
125
|
-
|
126
|
-
...otherProps,
|
135
|
+
var list = _extends({}, otherProps, {
|
127
136
|
className: cn('inline-flex flex-col list-none !p-0 m-0 overflow-y-auto h-auto', getInputClasses(props), {
|
128
137
|
'yt-list--multiselect': multiselect,
|
129
138
|
'pointer-events-none': disabled,
|
130
139
|
'cursor-not-allowed': disabled || readOnly
|
131
140
|
}, otherProps.className),
|
132
|
-
disabled,
|
133
|
-
id,
|
141
|
+
disabled: disabled,
|
142
|
+
id: id,
|
134
143
|
onFocus: !disabled && !readOnly ? handleFocus : undefined,
|
135
144
|
onKeyDown: !disabled && !readOnly ? handleKeyDown : undefined,
|
136
|
-
readOnly,
|
145
|
+
readOnly: readOnly,
|
137
146
|
ref: listRef,
|
138
147
|
role: options.length <= 0 || loading ? 'presentation' : 'listbox',
|
139
148
|
tabIndex: otherProps.tabIndex || 0
|
140
|
-
};
|
149
|
+
});
|
141
150
|
return /*#__PURE__*/createElement("ul", Object.assign({}, list, {
|
142
151
|
"data-taco": "scrollable-list"
|
143
152
|
}), loading ? (/*#__PURE__*/createElement("li", {
|
144
153
|
className: "yt-list__empty"
|
145
154
|
}, /*#__PURE__*/createElement("span", null, /*#__PURE__*/createElement(Spinner, {
|
146
155
|
delay: 0
|
147
|
-
})), /*#__PURE__*/createElement("span", null, texts.listbox.loading))) : options.length ? options.map(({
|
148
|
-
children,
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
156
|
+
})), /*#__PURE__*/createElement("span", null, texts.listbox.loading))) : options.length ? options.map(function (_ref) {
|
157
|
+
var children = _ref.children,
|
158
|
+
icon = _ref.icon,
|
159
|
+
optionProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
160
|
+
return /*#__PURE__*/createElement("li", Object.assign({}, optionProps), icon, /*#__PURE__*/createElement("span", {
|
161
|
+
className: "flex-grow truncate text-left"
|
162
|
+
}, children), multiselect && (/*#__PURE__*/createElement(Checkbox
|
163
|
+
// In multiselect variant, this checkbox only acts as visual representation of item being selected,
|
164
|
+
// so need to be taken out of screen reader scope.
|
165
|
+
, {
|
166
|
+
"aria-hidden": true,
|
167
|
+
tabIndex: -1,
|
168
|
+
checked: optionProps['aria-selected'],
|
169
|
+
onChange: function onChange() {
|
170
|
+
return null;
|
171
|
+
},
|
172
|
+
className: "pointer-events-none ml-2 self-center p-px"
|
173
|
+
})));
|
174
|
+
}) : (/*#__PURE__*/createElement("li", {
|
163
175
|
className: "yt-list__empty"
|
164
176
|
}, /*#__PURE__*/createElement("span", null, texts.listbox.empty))));
|
165
177
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ScrollableList.js","sources":["../../../../../../../src/components/Listbox/ScrollableList.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getNextIndexFromKey } from '../../utils/hooks/useListKeyboardNavigation';\nimport { useListScrollTo } from '../../utils/hooks/useListScrollTo';\nimport './ScrollableList.css';\nimport { Spinner } from '../Spinner/Spinner';\nimport { useLocalization } from '../Provider/Localization';\nimport { Checkbox } from '../Checkbox/Checkbox';\nimport { getInputClasses } from '../Input/util';\n\nexport type ScrollableListItemValue = string | number | boolean | null;\n\nexport type ScrollableListItem = {\n /**\n * Set whether the item is disabled.\n * This will both change the style and make the item unselectable\n */\n disabled?: boolean;\n /* Specifies whether the item has child items -- intended for internal use only */\n hasChildren?: boolean;\n /** Place an icon before the item's text */\n icon?: React.ReactElement;\n /* The index path to the item -- intended for internal use only */\n path?: string;\n /** Text describing the item */\n text: string | JSX.Element;\n /** Value of the item */\n value: ScrollableListItemValue;\n /** Child items to show hierarchical data */\n children?: ScrollableListItem[];\n};\n\n/** @internal */\nexport type ScrollableListProps = Omit<\n React.HTMLAttributes<HTMLUListElement>,\n 'defaultValue' | 'id' | 'onChange' | 'onClick' | 'onKeyDown'\n> & {\n /** Data indicating the options in scrollable list */\n data: ScrollableListItem[];\n /** Sets the list to be disabled */\n disabled?: boolean;\n /** Draws attention to the scrollable list by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Set an id for the scrollable list */\n id: string;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /**\n * Shows a loading indicator with a text next to it.\n * Read more about how to provide the text in `Provider` component.\n */\n loading?: boolean;\n /**\n * Handler called when current active/selected option changes in a scrollable list.\n * @param index indicates the index of the current active option\n */\n onChange: (index: number) => void;\n /** Handler called when option is clicked */\n onClick?: (event: React.MouseEvent<HTMLLIElement>, index: number) => void;\n /**\n * Set whether the selected item should be scrolled into view when listbox is focused.\n * Default value is `false`\n */\n scrollOnFocus?: boolean;\n /** Handler called when a key is pressed */\n onKeyDown?: (event: React.KeyboardEvent<HTMLUListElement>, index: number | undefined) => void;\n /* Sets the list to read only mode */\n readOnly?: boolean;\n /**\n * Value of the scrollable list representing the selected item.\n * It needs to be an existing value from the provided data.\n */\n value: number | undefined;\n /**\n * Allows to select multiple items from the list\n */\n multiselect?: boolean;\n /**\n * Contains the currently selected values when multiselect mode is ON.\n */\n selectedIndexes?: number[];\n /**\n * True when all available (not disabled) options are selected\n */\n allOptionsSelected?: boolean;\n};\n\n/** @internal */\nexport type ScrollableListPropsWithRef = ScrollableListProps & React.RefAttributes<HTMLUListElement>;\n\nexport const getId = (id: string, value: ScrollableListItemValue): string => `${id}_${value}`;\n\nconst getNextEnabledItem = (\n event: React.KeyboardEvent<HTMLElement>,\n data: ScrollableListItem[],\n index: number | undefined\n): number | undefined => {\n const nextIndex = getNextIndexFromKey(event.key, data.length, index);\n\n if (nextIndex) {\n if (nextIndex === index) {\n return index;\n } else if (data[nextIndex] && data[nextIndex].disabled) {\n return getNextEnabledItem(event, data, nextIndex);\n }\n }\n\n return nextIndex;\n};\n\nexport const ScrollableList = React.forwardRef(function ScrollableList(\n props: ScrollableListProps,\n ref: React.Ref<HTMLUListElement>\n) {\n const {\n data,\n disabled,\n highlighted,\n id,\n invalid: _,\n loading,\n onChange: setCurrentIndex,\n onClick,\n onFocus,\n onKeyDown,\n readOnly,\n scrollOnFocus = false,\n value: currentIndex,\n multiselect,\n selectedIndexes = [],\n allOptionsSelected = false,\n ...otherProps\n } = props;\n const listRef = useMergedRef<HTMLUListElement>(ref);\n const itemRefs = React.useMemo(() => data.map(() => React.createRef<HTMLLIElement>()), [data]);\n const { texts } = useLocalization();\n const { scrollTo } = useListScrollTo(listRef, itemRefs);\n\n React.useEffect(() => {\n if (currentIndex && itemRefs[currentIndex]?.current) {\n itemRefs[currentIndex].current?.scrollIntoView({\n block: 'center',\n });\n }\n }, []);\n\n React.useEffect(() => {\n scrollTo(currentIndex);\n }, [currentIndex]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLUListElement>): void => {\n const nextIndex = getNextEnabledItem(event, data, currentIndex);\n\n if (nextIndex !== undefined && nextIndex !== currentIndex) {\n event.preventDefault();\n scrollTo(nextIndex);\n setCurrentIndex(nextIndex);\n }\n\n if (onKeyDown) {\n event.persist();\n const index = nextIndex !== undefined ? nextIndex : currentIndex;\n onKeyDown(event, index);\n }\n\n // Stops the keyboard event from propagating so that keyboard event on other components outside the scrollable\n // list are not executed.\n event.stopPropagation();\n };\n\n const handleClick = (index: number) => (event: React.MouseEvent<HTMLLIElement>) => {\n setCurrentIndex(index);\n\n if (onClick) {\n event.persist();\n onClick(event, index);\n }\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLUListElement>): void => {\n if (scrollOnFocus) {\n scrollTo(currentIndex);\n }\n\n if (onFocus) {\n event.persist();\n onFocus(event);\n }\n };\n\n const getOptionCheckedState = (optionValue: string, index: number): boolean => {\n if (optionValue === '#ALL-OPTIONS#') {\n return allOptionsSelected;\n } else if (!optionValue || !selectedIndexes) {\n return false;\n } else {\n return selectedIndexes.findIndex(i => i === index) !== -1;\n }\n };\n\n const options = data.map((option, index) => {\n const depth = option.path ? option.path.split('.').length - 1 : 0;\n\n return {\n 'aria-selected': multiselect ? getOptionCheckedState(String(option.value), index) : currentIndex === index,\n 'data-focused': currentIndex === index,\n children: option.text,\n className: cn(\n 'flex items-center px-3 w-full cursor-pointer bg-white flex-[0_0_2rem] focus:wcag-blue-500 focus:border-blue-500',\n {\n 'sticky top-0 font-bold': depth === 0 && !!option.hasChildren,\n }\n ),\n disabled: option.disabled,\n icon: option.icon,\n id: getId(id, option.value),\n key: getId(id, option.value),\n onClick: !disabled && !readOnly ? handleClick(index) : undefined,\n ref: itemRefs[index],\n role: 'option',\n style:\n depth > 0\n ? {\n paddingLeft: `${depth + 1}rem`,\n }\n : undefined,\n };\n });\n\n const list: React.HTMLAttributes<HTMLUListElement> &\n React.RefAttributes<HTMLUListElement> & { disabled?: boolean; readOnly?: boolean } = {\n ...otherProps,\n className: cn(\n 'inline-flex flex-col list-none !p-0 m-0 overflow-y-auto h-auto',\n getInputClasses(props),\n {\n 'yt-list--multiselect': multiselect,\n 'pointer-events-none': disabled,\n 'cursor-not-allowed': disabled || readOnly,\n },\n otherProps.className\n ),\n disabled,\n id,\n onFocus: !disabled && !readOnly ? handleFocus : undefined,\n onKeyDown: !disabled && !readOnly ? handleKeyDown : undefined,\n readOnly,\n ref: listRef,\n role: options.length <= 0 || loading ? 'presentation' : 'listbox',\n tabIndex: otherProps.tabIndex || 0,\n };\n\n return (\n <ul {...list} data-taco=\"scrollable-list\">\n {loading ? (\n <li className=\"yt-list__empty\">\n <span>\n <Spinner delay={0} />\n </span>\n <span>{texts.listbox.loading}</span>\n </li>\n ) : options.length ? (\n options.map(({ children, icon, ...optionProps }) => (\n <li {...optionProps}>\n {icon}\n <span className=\"flex-grow truncate text-left\">{children}</span>\n {multiselect && (\n <Checkbox\n // In multiselect variant, this checkbox only acts as visual representation of item being selected,\n // so need to be taken out of screen reader scope.\n aria-hidden\n tabIndex={-1}\n checked={optionProps['aria-selected']}\n onChange={() => null}\n className=\"pointer-events-none ml-2 self-center p-px\"\n />\n )}\n </li>\n ))\n ) : (\n <li className=\"yt-list__empty\">\n <span>{texts.listbox.empty}</span>\n </li>\n )}\n </ul>\n );\n});\n"],"names":["getId","id","value","getNextEnabledItem","event","data","index","nextIndex","getNextIndexFromKey","key","length","disabled","ScrollableList","React","props","ref","highlighted","invalid","_","loading","onChange","setCurrentIndex","onClick","onFocus","onKeyDown","readOnly","scrollOnFocus","currentIndex","multiselect","selectedIndexes","allOptionsSelected","otherProps","listRef","useMergedRef","itemRefs","map","texts","useLocalization","scrollTo","useListScrollTo","_itemRefs$currentInde","current","_itemRefs$currentInde2","scrollIntoView","block","handleKeyDown","undefined","preventDefault","persist","stopPropagation","handleClick","handleFocus","getOptionCheckedState","optionValue","findIndex","i","options","option","depth","path","split","String","children","text","className","cn","hasChildren","icon","role","style","paddingLeft","list","getInputClasses","tabIndex","Spinner","delay","listbox","optionProps","Checkbox","checked","empty"],"mappings":";;;;;;;;;;MA2FaA,KAAK,GAAGA,CAACC,EAAU,EAAEC,KAA8B,KAAa,GAAGD,EAAE,IAAIC,KAAK;AAE3F,MAAMC,kBAAkB,GAAGA,CACvBC,KAAuC,EACvCC,IAA0B,EAC1BC,KAAyB;EAEzB,MAAMC,SAAS,GAAGC,mBAAmB,CAACJ,KAAK,CAACK,GAAG,EAAEJ,IAAI,CAACK,MAAM,EAAEJ,KAAK,CAAC;EAEpE,IAAIC,SAAS,EAAE;IACX,IAAIA,SAAS,KAAKD,KAAK,EAAE;MACrB,OAAOA,KAAK;KACf,MAAM,IAAID,IAAI,CAACE,SAAS,CAAC,IAAIF,IAAI,CAACE,SAAS,CAAC,CAACI,QAAQ,EAAE;MACpD,OAAOR,kBAAkB,CAACC,KAAK,EAAEC,IAAI,EAAEE,SAAS,CAAC;;;EAIzD,OAAOA,SAAS;AACpB,CAAC;MAEYK,cAAc,gBAAGC,UAAgB,CAAC,SAASD,cAAcA,CAClEE,KAA0B,EAC1BC,GAAgC;EAEhC,MAAM;IACFV,IAAI;IACJM,QAAQ;IACRK,WAAW;IACXf,EAAE;IACFgB,OAAO,EAAEC,CAAC;IACVC,OAAO;IACPC,QAAQ,EAAEC,eAAe;IACzBC,OAAO;IACPC,OAAO;IACPC,SAAS;IACTC,QAAQ;IACRC,aAAa,GAAG,KAAK;IACrBxB,KAAK,EAAEyB,YAAY;IACnBC,WAAW;IACXC,eAAe,GA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AAG,SAAS;IACjEsD,QAAQ,EAAE1C,UAAU,CAAC0C,QAAQ,IAAI;GACpC;EAED,oBACI5D,sCAAQ0D,IAAI;iBAAY;MACnBpD,OAAO,iBACJN;IAAImD,SAAS,EAAC;kBACVnD,yCACIA,cAAC6D,OAAO;IAACC,KAAK,EAAE;IAAK,CAClB,eACP9D,4BAAOuB,KAAK,CAACwC,OAAO,CAACzD,OAAO,CAAQ,CACnC,IACLqC,OAAO,CAAC9C,MAAM,GACd8C,OAAO,CAACrB,GAAG,CAAC,CAAC;IAAE2B,QAAQ;IAAEK,IAAI;IAAE,GAAGU;GAAa,mBAC3ChE,sCAAQgE,WAAW,GACdV,IAAI,eACLtD;IAAMmD,SAAS,EAAC;KAAgCF,QAAQ,CAAQ,EAC/DlC,WAAW,kBACRf,cAACiE;;;;;IAIGL,QAAQ,EAAE,CAAC,CAAC;IACZM,OAAO,EAAEF,WAAW,CAAC,eAAe,CAAC;IACrCzD,QAAQ,EAAEA,MAAM,IAAI;IACpB4C,SAAS,EAAC;IACZ,CACL,CACA,CACR,CAAC,iBAEFnD;IAAImD,SAAS,EAAC;kBACVnD,4BAAOuB,KAAK,CAACwC,OAAO,CAACI,KAAK,CAAQ,CACjC,CACR,CACA;AAEb,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"ScrollableList.js","sources":["../../../../../../../src/components/Listbox/ScrollableList.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getNextIndexFromKey } from '../../utils/hooks/useListKeyboardNavigation';\nimport { useListScrollTo } from '../../utils/hooks/useListScrollTo';\nimport './ScrollableList.css';\nimport { Spinner } from '../Spinner/Spinner';\nimport { useLocalization } from '../Provider/Localization';\nimport { Checkbox } from '../Checkbox/Checkbox';\nimport { getInputClasses } from '../Input/util';\n\nexport type ScrollableListItemValue = string | number | boolean | null;\n\nexport type ScrollableListItem = {\n /**\n * Set whether the item is disabled.\n * This will both change the style and make the item unselectable\n */\n disabled?: boolean;\n /* Specifies whether the item has child items -- intended for internal use only */\n hasChildren?: boolean;\n /** Place an icon before the item's text */\n icon?: React.ReactElement;\n /* The index path to the item -- intended for internal use only */\n path?: string;\n /** Text describing the item */\n text: string | JSX.Element;\n /** Value of the item */\n value: ScrollableListItemValue;\n /** Child items to show hierarchical data */\n children?: ScrollableListItem[];\n};\n\n/** @internal */\nexport type ScrollableListProps = Omit<\n React.HTMLAttributes<HTMLUListElement>,\n 'defaultValue' | 'id' | 'onChange' | 'onClick' | 'onKeyDown'\n> & {\n /** Data indicating the options in scrollable list */\n data: ScrollableListItem[];\n /** Sets the list to be disabled */\n disabled?: boolean;\n /** Draws attention to the scrollable list by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Set an id for the scrollable list */\n id: string;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /**\n * Shows a loading indicator with a text next to it.\n * Read more about how to provide the text in `Provider` component.\n */\n loading?: boolean;\n /**\n * Handler called when current active/selected option changes in a scrollable list.\n * @param index indicates the index of the current active option\n */\n onChange: (index: number) => void;\n /** Handler called when option is clicked */\n onClick?: (event: React.MouseEvent<HTMLLIElement>, index: number) => void;\n /**\n * Set whether the selected item should be scrolled into view when listbox is focused.\n * Default value is `false`\n */\n scrollOnFocus?: boolean;\n /** Handler called when a key is pressed */\n onKeyDown?: (event: React.KeyboardEvent<HTMLUListElement>, index: number | undefined) => void;\n /* Sets the list to read only mode */\n readOnly?: boolean;\n /**\n * Value of the scrollable list representing the selected item.\n * It needs to be an existing value from the provided data.\n */\n value: number | undefined;\n /**\n * Allows to select multiple items from the list\n */\n multiselect?: boolean;\n /**\n * Contains the currently selected values when multiselect mode is ON.\n */\n selectedIndexes?: number[];\n /**\n * True when all available (not disabled) options are selected\n */\n allOptionsSelected?: boolean;\n};\n\n/** @internal */\nexport type ScrollableListPropsWithRef = ScrollableListProps & React.RefAttributes<HTMLUListElement>;\n\nexport const getId = (id: string, value: ScrollableListItemValue): string => `${id}_${value}`;\n\nconst getNextEnabledItem = (\n event: React.KeyboardEvent<HTMLElement>,\n data: ScrollableListItem[],\n index: number | undefined\n): number | undefined => {\n const nextIndex = getNextIndexFromKey(event.key, data.length, index);\n\n if (nextIndex) {\n if (nextIndex === index) {\n return index;\n } else if (data[nextIndex] && data[nextIndex].disabled) {\n return getNextEnabledItem(event, data, nextIndex);\n }\n }\n\n return nextIndex;\n};\n\nexport const ScrollableList = React.forwardRef(function ScrollableList(\n props: ScrollableListProps,\n ref: React.Ref<HTMLUListElement>\n) {\n const {\n data,\n disabled,\n highlighted,\n id,\n invalid: _,\n loading,\n onChange: setCurrentIndex,\n onClick,\n onFocus,\n onKeyDown,\n readOnly,\n scrollOnFocus = false,\n value: currentIndex,\n multiselect,\n selectedIndexes = [],\n allOptionsSelected = false,\n ...otherProps\n } = props;\n const listRef = useMergedRef<HTMLUListElement>(ref);\n const itemRefs = React.useMemo(() => data.map(() => React.createRef<HTMLLIElement>()), [data]);\n const { texts } = useLocalization();\n const { scrollTo } = useListScrollTo(listRef, itemRefs);\n\n React.useEffect(() => {\n if (currentIndex && itemRefs[currentIndex]?.current) {\n itemRefs[currentIndex].current?.scrollIntoView({\n block: 'center',\n });\n }\n }, []);\n\n React.useEffect(() => {\n scrollTo(currentIndex);\n }, [currentIndex]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLUListElement>): void => {\n const nextIndex = getNextEnabledItem(event, data, currentIndex);\n\n if (nextIndex !== undefined && nextIndex !== currentIndex) {\n event.preventDefault();\n scrollTo(nextIndex);\n setCurrentIndex(nextIndex);\n }\n\n if (onKeyDown) {\n event.persist();\n const index = nextIndex !== undefined ? nextIndex : currentIndex;\n onKeyDown(event, index);\n }\n\n // Stops the keyboard event from propagating so that keyboard event on other components outside the scrollable\n // list are not executed.\n event.stopPropagation();\n };\n\n const handleClick = (index: number) => (event: React.MouseEvent<HTMLLIElement>) => {\n setCurrentIndex(index);\n\n if (onClick) {\n event.persist();\n onClick(event, index);\n }\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLUListElement>): void => {\n if (scrollOnFocus) {\n scrollTo(currentIndex);\n }\n\n if (onFocus) {\n event.persist();\n onFocus(event);\n }\n };\n\n const getOptionCheckedState = (optionValue: string, index: number): boolean => {\n if (optionValue === '#ALL-OPTIONS#') {\n return allOptionsSelected;\n } else if (!optionValue || !selectedIndexes) {\n return false;\n } else {\n return selectedIndexes.findIndex(i => i === index) !== -1;\n }\n };\n\n const options = data.map((option, index) => {\n const depth = option.path ? option.path.split('.').length - 1 : 0;\n\n return {\n 'aria-selected': multiselect ? getOptionCheckedState(String(option.value), index) : currentIndex === index,\n 'data-focused': currentIndex === index,\n children: option.text,\n className: cn(\n 'flex items-center px-3 w-full cursor-pointer bg-white flex-[0_0_2rem] focus:wcag-blue-500 focus:border-blue-500',\n {\n 'sticky top-0 font-bold': depth === 0 && !!option.hasChildren,\n }\n ),\n disabled: option.disabled,\n icon: option.icon,\n id: getId(id, option.value),\n key: getId(id, option.value),\n onClick: !disabled && !readOnly ? handleClick(index) : undefined,\n ref: itemRefs[index],\n role: 'option',\n style:\n depth > 0\n ? {\n paddingLeft: `${depth + 1}rem`,\n }\n : undefined,\n };\n });\n\n const list: React.HTMLAttributes<HTMLUListElement> &\n React.RefAttributes<HTMLUListElement> & { disabled?: boolean; readOnly?: boolean } = {\n ...otherProps,\n className: cn(\n 'inline-flex flex-col list-none !p-0 m-0 overflow-y-auto h-auto',\n getInputClasses(props),\n {\n 'yt-list--multiselect': multiselect,\n 'pointer-events-none': disabled,\n 'cursor-not-allowed': disabled || readOnly,\n },\n otherProps.className\n ),\n disabled,\n id,\n onFocus: !disabled && !readOnly ? handleFocus : undefined,\n onKeyDown: !disabled && !readOnly ? handleKeyDown : undefined,\n readOnly,\n ref: listRef,\n role: options.length <= 0 || loading ? 'presentation' : 'listbox',\n tabIndex: otherProps.tabIndex || 0,\n };\n\n return (\n <ul {...list} data-taco=\"scrollable-list\">\n {loading ? (\n <li className=\"yt-list__empty\">\n <span>\n <Spinner delay={0} />\n </span>\n <span>{texts.listbox.loading}</span>\n </li>\n ) : options.length ? (\n options.map(({ children, icon, ...optionProps }) => (\n <li {...optionProps}>\n {icon}\n <span className=\"flex-grow truncate text-left\">{children}</span>\n {multiselect && (\n <Checkbox\n // In multiselect variant, this checkbox only acts as visual representation of item being selected,\n // so need to be taken out of screen reader scope.\n aria-hidden\n tabIndex={-1}\n checked={optionProps['aria-selected']}\n onChange={() => null}\n className=\"pointer-events-none ml-2 self-center p-px\"\n />\n )}\n </li>\n ))\n ) : (\n <li className=\"yt-list__empty\">\n <span>{texts.listbox.empty}</span>\n </li>\n )}\n </ul>\n );\n});\n"],"names":["getId","id","value","getNextEnabledItem","event","data","index","nextIndex","getNextIndexFromKey","key","length","disabled","ScrollableList","React","props","ref","loading","setCurrentIndex","onChange","onClick","onFocus","onKeyDown","readOnly","_props$scrollOnFocus","scrollOnFocus","currentIndex","multiselect","_props$selectedIndexe","selectedIndexes","_props$allOptionsSele","allOptionsSelected","otherProps","_objectWithoutPropertiesLoose","_excluded","listRef","useMergedRef","itemRefs","map","_useLocalization","useLocalization","texts","_useListScrollTo","useListScrollTo","scrollTo","_itemRefs$currentInde","current","_itemRefs$currentInde2","scrollIntoView","block","handleKeyDown","undefined","preventDefault","persist","stopPropagation","handleClick","handleFocus","getOptionCheckedState","optionValue","findIndex","i","options","option","depth","path","split","String","children","text","className","cn","hasChildren","icon","role","style","paddingLeft","list","_extends","getInputClasses","tabIndex","Spinner","delay","listbox","_ref","optionProps","_excluded2","Checkbox","checked","empty"],"mappings":";;;;;;;;;;;;;IA2FaA,KAAK,GAAG,SAARA,KAAKA,CAAIC,EAAU,EAAEC,KAA8B;EAAA,OAAgBD,EAAE,SAAIC,KAAK;AAAA;AAE3F,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CACpBC,KAAuC,EACvCC,IAA0B,EAC1BC,KAAyB;EAEzB,IAAMC,SAAS,GAAGC,mBAAmB,CAACJ,KAAK,CAAC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Q;IACRP,GAAG,EAAEmB,OAAO;IACZsC,IAAI,EAAEZ,OAAO,CAAClD,MAAM,IAAI,CAAC,IAAIM,OAAO,GAAG,cAAc,GAAG,SAAS;IACjE8D,QAAQ,EAAE/C,UAAU,CAAC+C,QAAQ,IAAI;IACpC;EAED,oBACIjE,sCAAQ8D,IAAI;iBAAY;MACnB3D,OAAO,iBACJH;IAAIuD,SAAS,EAAC;kBACVvD,yCACIA,cAACkE,OAAO;IAACC,KAAK,EAAE;IAAK,CAClB,eACPnE,4BAAO2B,KAAK,CAACyC,OAAO,CAACjE,OAAO,CAAQ,CACnC,IACL4C,OAAO,CAAClD,MAAM,GACdkD,OAAO,CAACvB,GAAG,CAAC,UAAA6C,IAAA;IAAA,IAAGhB,QAAQ,GAAAgB,IAAA,CAARhB,QAAQ;MAAEK,IAAI,GAAAW,IAAA,CAAJX,IAAI;MAAKY,WAAW,GAAAnD,6BAAA,CAAAkD,IAAA,EAAAE,UAAA;IAAA,oBACzCvE,sCAAQsE,WAAW,GACdZ,IAAI,eACL1D;MAAMuD,SAAS,EAAC;OAAgCF,QAAQ,CAAQ,EAC/DxC,WAAW,kBACRb,cAACwE;;;;;MAIGP,QAAQ,EAAE,CAAC,CAAC;MACZQ,OAAO,EAAEH,WAAW,CAAC,eAAe,CAAC;MACrCjE,QAAQ,EAAE,SAAAA;QAAA,OAAM,IAAI;;MACpBkD,SAAS,EAAC;MACZ,CACL,CACA;GACR,CAAC,iBAEFvD;IAAIuD,SAAS,EAAC;kBACVvD,4BAAO2B,KAAK,CAACyC,OAAO,CAACM,KAAK,CAAQ,CACjC,CACR,CACA;AAEb,CAAC;;;;"}
|
@@ -1,51 +1,55 @@
|
|
1
1
|
import { useMemo, useEffect } from 'react';
|
2
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
3
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
3
4
|
import { v4 } from 'uuid';
|
4
5
|
import { useFlattenedData, getIndexFromValue, getActiveDescendant, setInputValueByRef, findByValue, sanitizeItem } from './util.js';
|
5
6
|
import { useTypeahead } from './useTypeahead.js';
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
8
|
+
var _excluded = ["data", "defaultValue", "disabled", "emptyValue", "id", "invalid", "name", "onChange", "onFocus", "onKeyDown", "value"];
|
9
|
+
var useListbox = function useListbox(_ref, ref) {
|
10
|
+
var _ref$data = _ref.data,
|
11
|
+
externalData = _ref$data === void 0 ? [] : _ref$data,
|
12
|
+
defaultValue = _ref.defaultValue,
|
13
|
+
disabled = _ref.disabled,
|
14
|
+
emptyValue = _ref.emptyValue,
|
15
|
+
nativeId = _ref.id,
|
16
|
+
invalid = _ref.invalid,
|
17
|
+
name = _ref.name,
|
18
|
+
onChange = _ref.onChange,
|
19
|
+
onFocus = _ref.onFocus,
|
20
|
+
onKeyDown = _ref.onKeyDown,
|
21
|
+
_ref$value = _ref.value,
|
22
|
+
value = _ref$value === void 0 ? emptyValue : _ref$value,
|
23
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
24
|
+
var data = useFlattenedData(emptyValue !== undefined ? [{
|
22
25
|
text: '',
|
23
26
|
value: emptyValue
|
24
|
-
}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
}].concat(externalData) : externalData);
|
28
|
+
var id = useMemo(function () {
|
29
|
+
return nativeId || v4();
|
30
|
+
}, [nativeId]);
|
31
|
+
var inputRef = useMergedRef(ref);
|
32
|
+
var currentIndex = value !== undefined ? getIndexFromValue(data, value) : undefined;
|
33
|
+
var _useTypeahead = useTypeahead({
|
34
|
+
data: data,
|
35
|
+
currentIndex: currentIndex
|
36
|
+
}),
|
37
|
+
getNextIndex = _useTypeahead.getNextIndex;
|
38
|
+
var setInputValueByIndex = function setInputValueByIndex(index) {
|
35
39
|
if (index !== undefined) {
|
36
|
-
|
40
|
+
var option = data[index];
|
37
41
|
if (option && !option.disabled) {
|
38
42
|
setInputValueByRef(inputRef.current, option.value);
|
39
43
|
}
|
40
44
|
}
|
41
45
|
};
|
42
|
-
|
46
|
+
var handleListboxChange = function handleListboxChange(index) {
|
43
47
|
setInputValueByIndex(index);
|
44
48
|
};
|
45
|
-
useEffect(()
|
49
|
+
useEffect(function () {
|
46
50
|
if (data.length && currentIndex === undefined) {
|
47
51
|
if (defaultValue !== undefined) {
|
48
|
-
|
52
|
+
var defaultValueIndex = getIndexFromValue(data, defaultValue);
|
49
53
|
if (defaultValueIndex !== undefined) {
|
50
54
|
setInputValueByIndex(defaultValueIndex);
|
51
55
|
}
|
@@ -54,12 +58,12 @@ const useListbox = ({
|
|
54
58
|
}
|
55
59
|
}
|
56
60
|
}, [data]);
|
57
|
-
|
58
|
-
|
61
|
+
var handleListboxKeyDown = function handleListboxKeyDown(event) {
|
62
|
+
var charKey = event.key;
|
59
63
|
// event.key always returns the whole string (String.fromCharCode(event.keyCode) does not)
|
60
64
|
// We need to filter out only alphabetical or numeric letters, that's why that condition has been changed
|
61
65
|
if (charKey.length === 1 && /(\w)/g.test(charKey)) {
|
62
|
-
|
66
|
+
var nextIndex = getNextIndex(charKey);
|
63
67
|
if (nextIndex > -1 && nextIndex !== currentIndex) {
|
64
68
|
setInputValueByIndex(nextIndex);
|
65
69
|
}
|
@@ -70,7 +74,7 @@ const useListbox = ({
|
|
70
74
|
onKeyDown(event);
|
71
75
|
}
|
72
76
|
};
|
73
|
-
|
77
|
+
var handleListboxFocus = function handleListboxFocus(event) {
|
74
78
|
if (currentIndex === undefined && data.length) {
|
75
79
|
setInputValueByIndex(0);
|
76
80
|
}
|
@@ -79,50 +83,51 @@ const useListbox = ({
|
|
79
83
|
onFocus(event);
|
80
84
|
}
|
81
85
|
};
|
82
|
-
|
86
|
+
var handleInputChange = function handleInputChange(event) {
|
83
87
|
event.persist();
|
84
88
|
if (onChange) {
|
85
89
|
var _item$path$split, _item$path;
|
86
|
-
|
90
|
+
var item = findByValue(data, event.target.value);
|
87
91
|
event.detail = sanitizeItem(item);
|
88
|
-
|
92
|
+
var indexes = (_item$path$split = item === null || item === void 0 ? void 0 : (_item$path = item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
|
89
93
|
if (indexes.length > 1) {
|
90
94
|
// we don't want to map the current item
|
91
95
|
indexes.pop();
|
92
96
|
// we need to rebuild the path as we map
|
93
|
-
|
94
|
-
event.detail.parents = indexes.map(i
|
97
|
+
var lastPath;
|
98
|
+
event.detail.parents = indexes.map(function (i) {
|
95
99
|
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
96
|
-
return sanitizeItem(data.find(
|
100
|
+
return sanitizeItem(data.find(function (i) {
|
101
|
+
return i.path === lastPath;
|
102
|
+
}));
|
97
103
|
});
|
98
104
|
}
|
99
105
|
onChange(event);
|
100
106
|
}
|
101
107
|
};
|
102
|
-
|
103
|
-
...otherProps,
|
108
|
+
var list = _extends({}, otherProps, {
|
104
109
|
'aria-activedescendant': getActiveDescendant(data, currentIndex, id),
|
105
|
-
data,
|
106
|
-
disabled,
|
107
|
-
id,
|
108
|
-
invalid,
|
110
|
+
data: data,
|
111
|
+
disabled: disabled,
|
112
|
+
id: id,
|
113
|
+
invalid: invalid,
|
109
114
|
onChange: handleListboxChange,
|
110
115
|
onFocus: handleListboxFocus,
|
111
116
|
onKeyDown: handleListboxKeyDown,
|
112
117
|
scrollOnFocus: true,
|
113
118
|
tabIndex: disabled ? -1 : otherProps.tabIndex ? otherProps.tabIndex : 0,
|
114
119
|
value: currentIndex
|
115
|
-
};
|
116
|
-
|
117
|
-
name,
|
120
|
+
});
|
121
|
+
var input = {
|
122
|
+
name: name,
|
118
123
|
onChange: handleInputChange,
|
119
124
|
ref: inputRef,
|
120
125
|
tabIndex: -1,
|
121
126
|
value: value !== null && value !== void 0 ? value : ''
|
122
127
|
};
|
123
128
|
return {
|
124
|
-
list,
|
125
|
-
input
|
129
|
+
list: list,
|
130
|
+
input: input
|
126
131
|
};
|
127
132
|
};
|
128
133
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useListbox.js","sources":["../../../../../../../src/components/Listbox/useListbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { ListboxProps } from './Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, getIndexFromValue, findByValue, getActiveDescendant, useFlattenedData, sanitizeItem } from './util';\nimport { ScrollableListProps } from './ScrollableList';\nimport { useTypeahead } from './useTypeahead';\n\ntype useListbox = {\n list: ScrollableListProps;\n input: Omit<React.HTMLAttributes<HTMLInputElement>, 'defaultValue'>;\n};\n\nexport const useListbox = (\n {\n data: externalData = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n invalid,\n name,\n onChange,\n onFocus,\n onKeyDown,\n value = emptyValue,\n ...otherProps\n }: ListboxProps,\n ref: React.Ref<HTMLInputElement>\n): useListbox => {\n const data = useFlattenedData(emptyValue !== undefined ? [{ text: '', value: emptyValue }, ...externalData] : externalData);\n const id = React.useMemo(() => nativeId || uuid(), [nativeId]);\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const currentIndex = value !== undefined ? getIndexFromValue(data, value) : undefined;\n const { getNextIndex } = useTypeahead({ data, currentIndex });\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value);\n }\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setInputValueByIndex(index);\n };\n\n React.useEffect(() => {\n if (data.length && currentIndex === undefined) {\n if (defaultValue !== undefined) {\n const defaultValueIndex = getIndexFromValue(data, defaultValue);\n\n if (defaultValueIndex !== undefined) {\n setInputValueByIndex(defaultValueIndex);\n }\n } else {\n setInputValueByIndex(0);\n }\n }\n }, [data]);\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n const charKey = event.key;\n\n // event.key always returns the whole string (String.fromCharCode(event.keyCode) does not)\n // We need to filter out only alphabetical or numeric letters, that's why that condition has been changed\n if (charKey.length === 1 && /(\\w)/g.test(charKey)) {\n const nextIndex = getNextIndex(charKey);\n\n if (nextIndex > -1 && nextIndex !== currentIndex) {\n setInputValueByIndex(nextIndex);\n }\n return;\n }\n\n if (onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxFocus = (event: React.FocusEvent<HTMLElement>): void => {\n if (currentIndex === undefined && data.length) {\n setInputValueByIndex(0);\n }\n\n if (onFocus) {\n event.persist();\n onFocus(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(data, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(data.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const list: ScrollableListProps = {\n ...otherProps,\n 'aria-activedescendant': getActiveDescendant(data, currentIndex, id),\n data,\n disabled,\n id,\n invalid,\n onChange: handleListboxChange,\n onFocus: handleListboxFocus,\n onKeyDown: handleListboxKeyDown,\n scrollOnFocus: true,\n tabIndex: disabled ? -1 : otherProps.tabIndex ? otherProps.tabIndex : 0,\n value: currentIndex,\n };\n\n const input = {\n name,\n onChange: handleInputChange,\n ref: inputRef,\n tabIndex: -1,\n value: value ?? '',\n };\n\n return { list, input };\n};\n"],"names":["useListbox","data","externalData","defaultValue","disabled","emptyValue","
|
1
|
+
{"version":3,"file":"useListbox.js","sources":["../../../../../../../src/components/Listbox/useListbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport { ListboxProps } from './Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, getIndexFromValue, findByValue, getActiveDescendant, useFlattenedData, sanitizeItem } from './util';\nimport { ScrollableListProps } from './ScrollableList';\nimport { useTypeahead } from './useTypeahead';\n\ntype useListbox = {\n list: ScrollableListProps;\n input: Omit<React.HTMLAttributes<HTMLInputElement>, 'defaultValue'>;\n};\n\nexport const useListbox = (\n {\n data: externalData = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n invalid,\n name,\n onChange,\n onFocus,\n onKeyDown,\n value = emptyValue,\n ...otherProps\n }: ListboxProps,\n ref: React.Ref<HTMLInputElement>\n): useListbox => {\n const data = useFlattenedData(emptyValue !== undefined ? [{ text: '', value: emptyValue }, ...externalData] : externalData);\n const id = React.useMemo(() => nativeId || uuid(), [nativeId]);\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const currentIndex = value !== undefined ? getIndexFromValue(data, value) : undefined;\n const { getNextIndex } = useTypeahead({ data, currentIndex });\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value);\n }\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setInputValueByIndex(index);\n };\n\n React.useEffect(() => {\n if (data.length && currentIndex === undefined) {\n if (defaultValue !== undefined) {\n const defaultValueIndex = getIndexFromValue(data, defaultValue);\n\n if (defaultValueIndex !== undefined) {\n setInputValueByIndex(defaultValueIndex);\n }\n } else {\n setInputValueByIndex(0);\n }\n }\n }, [data]);\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n const charKey = event.key;\n\n // event.key always returns the whole string (String.fromCharCode(event.keyCode) does not)\n // We need to filter out only alphabetical or numeric letters, that's why that condition has been changed\n if (charKey.length === 1 && /(\\w)/g.test(charKey)) {\n const nextIndex = getNextIndex(charKey);\n\n if (nextIndex > -1 && nextIndex !== currentIndex) {\n setInputValueByIndex(nextIndex);\n }\n return;\n }\n\n if (onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxFocus = (event: React.FocusEvent<HTMLElement>): void => {\n if (currentIndex === undefined && data.length) {\n setInputValueByIndex(0);\n }\n\n if (onFocus) {\n event.persist();\n onFocus(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(data, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const indexes = item?.path?.split('.') ?? [];\n\n if (indexes.length > 1) {\n // we don't want to map the current item\n indexes.pop();\n // we need to rebuild the path as we map\n let lastPath: string;\n\n (event as any).detail.parents = indexes.map(i => {\n lastPath = lastPath ? [lastPath, i].join('.') : i;\n return sanitizeItem(data.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const list: ScrollableListProps = {\n ...otherProps,\n 'aria-activedescendant': getActiveDescendant(data, currentIndex, id),\n data,\n disabled,\n id,\n invalid,\n onChange: handleListboxChange,\n onFocus: handleListboxFocus,\n onKeyDown: handleListboxKeyDown,\n scrollOnFocus: true,\n tabIndex: disabled ? -1 : otherProps.tabIndex ? otherProps.tabIndex : 0,\n value: currentIndex,\n };\n\n const input = {\n name,\n onChange: handleInputChange,\n ref: inputRef,\n tabIndex: -1,\n value: value ?? '',\n };\n\n return { list, input };\n};\n"],"names":["useListbox","_ref","ref","data","externalData","_ref$data","defaultValue","disabled","emptyValue","nativeId","id","invalid","name","onChange","onFocus","onKeyDown","_ref$value","value","otherProps","_objectWithoutPropertiesLoose","_excluded","useFlattenedData","undefined","text","concat","React","uuid","inputRef","useMergedRef","currentIndex","getIndexFromValue","_useTypeahead","useTypeahead","getNextIndex","setInputValueByIndex","index","option","setInputValueByRef","current","handleListboxChange","length","defaultValueIndex","handleListboxKeyDown","event","charKey","key","test","nextIndex","persist","handleListboxFocus","handleInputChange","_item$path$split","_item$path","item","findByValue","target","detail","sanitizeItem","indexes","path","split","pop","lastPath","parents","map","i","join","find","list","_extends","getActiveDescendant","scrollOnFocus","tabIndex","input"],"mappings":";;;;;;;;IAaaA,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA,EAenBC,GAAgC;uBAb5BC,IAAI;IAAEC,YAAY,GAAAC,SAAA,cAAG,EAAE,GAAAA,SAAA;IACvBC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IACZC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IACRC,UAAU,GAAAP,IAAA,CAAVO,UAAU;IACNC,QAAQ,GAAAR,IAAA,CAAZS,EAAE;IACFC,OAAO,GAAAV,IAAA,CAAPU,OAAO;IACPC,IAAI,GAAAX,IAAA,CAAJW,IAAI;IACJC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ;IACRC,OAAO,GAAAb,IAAA,CAAPa,OAAO;IACPC,SAAS,GAAAd,IAAA,CAATc,SAAS;IAAAC,UAAA,GAAAf,IAAA,CACTgB,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAGR,UAAU,GAAAQ,UAAA;IACfE,UAAU,GAAAC,6BAAA,CAAAlB,IAAA,EAAAmB,SAAA;EAIjB,IAAMjB,IAAI,GAAGkB,gBAAgB,CAACb,UAAU,KAAKc,SAAS,IAAI;IAAEC,IAAI,EAAE,EAAE;IAAEN,KAAK,EAAET;GAAY,EAAAgB,MAAA,CAAKpB,YAAY,IAAIA,YAAY,CAAC;EAC3H,IAAMM,EAAE,GAAGe,OAAa,CAAC;IAAA,OAAMhB,QAAQ,IAAIiB,EAAI,EAAE;KAAE,CAACjB,QAAQ,CAAC,CAAC;EAC9D,IAAMkB,QAAQ,GAAGC,YAAY,CAAmB1B,GAAG,CAAC;EACpD,IAAM2B,YAAY,GAAGZ,KA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