@economic/taco 2.47.0-server.4 → 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 +2 -2
- 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/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 +21 -25
- 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 +29 -30
- 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 +136 -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 +12 -10
- 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 +12 -12
- 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 +34 -29
- 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 +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js.map +1 -1
- 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 +54 -39
- 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 -37
- 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 +20 -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 +50 -41
- 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/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 -24
- 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/taco.cjs.development.js +7857 -6877
- 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 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n showTotal?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n showTotal?: boolean;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n showTotal = true,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind =\n handleClickFindNext !== undefined &&\n handleClickFindPrevious !== undefined &&\n findCurrent !== undefined &&\n findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n onClear?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n event.stopPropagation();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center\">\n {loading ? (\n <Spinner className=\"h-4 w-4\" />\n ) : showTotal ? (\n <span className=\"border-r border-black/[0.25] pr-2\">{`${findCurrent ?? 0}/${findTotal ?? 0}`}</span>\n ) : null}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-grey-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","loading","onChange","handleChange","onClear","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","settingsContent","shortcut","showTotal","value","attributes","internalRef","useMergedRef","containerRef","useRef","focused","setFocused","useState","texts","useLocalization","isActive","length","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","_internalRef$current","preventDefault","focus","handleBlur","relatedTarget","_containerRef$current","contains","_attributes$onBlur","onBlur","call","handleClear","requestAnimationFrame","_internalRef$current2","blur","handleFocus","_attributes$onFocus","onFocus","handleKeyDown","_props$onKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","stopPropagation","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","Spinner","findPrevious","shift","findNext","onClickCapture","_internalRef$current3","cn","Icon","button","name","_internalRef$current4","input","Input","_attributes$ariaLabe","placeholder","target","_attributes$placehold","prefix","settingsClassname","style","opacity","_internalRef$current5"],"mappings":";;;;;;;;;;;MAwCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,OAAO,GAAG,KAAK;IACfC,QAAQ,EAAEC,YAAY;IACtBC,OAAO;IACPC,eAAe,EAAEC,mBAAmB;IACpCC,mBAAmB,EAAEC,uBAAuB;IAC5CC,eAAe;IACfC,QAAQ;IACRC,SAAS,GAAG,IAAI;IAChBC,KAAK;IACL,GAAGC;GACN,GAAGhB,KAAK;EACT,MAAMiB,WAAW,GAAGC,YAAY,CAAmBjB,GAAG,CAAC;EACvD,MAAMkB,YAAY,GAAGrB,cAAK,CAACsB,MAAM,CAAiB,IAAI,CAAC;EACvD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGxB,cAAK,CAACyB,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,QAAQ,GAAGX,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEY,MAAM;EAC9B,MAAMC,OAAO,GACTnB,mBAAmB,KAAKoB,SAAS,IACjClB,uBAAuB,KAAKkB,SAAS,IACrC3B,WAAW,KAAK2B,SAAS,IACzB1B,SAAS,KAAK0B,SAAS;EAE3BC,gBAAgB,CAACjB,QAAQ,EAAGkB,KAAoB;IAC5C,IAAIC,QAAQ,CAACC,aAAa,KAAKhB,WAAW,CAACiB,OAAO,EAAE;MAAA,IAAAC,oBAAA;MAChDJ,KAAK,CAACK,cAAc,EAAE;MACtB,CAAAD,oBAAA,GAAAlB,WAAW,CAACiB,OAAO,cAAAC,oBAAA,uBAAnBA,oBAAA,CAAqBE,KAAK,EAAE;;GAEnC,CAAC;EAEF,MAAMC,UAAU,GAAIP,KAAyC;;IACzD,IACIZ,YAAY,CA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qBAAA,GAAM5E,WAAW,CAACiB,OAAO,cAAA2D,qBAAA,uBAAnBA,qBAAA,CAAqBxD,KAAK,EAAE;;;MAElD+B,QAAQ,EAAE,CAAC;OACVxD,eAAe,CACd,CACJ;;EAId,OAAOuE,KAAK;AAChB,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n showTotal?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n showTotal?: boolean;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n showTotal = true,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind =\n handleClickFindNext !== undefined &&\n handleClickFindPrevious !== undefined &&\n findCurrent !== undefined &&\n findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n onClear?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n event.stopPropagation();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center\">\n {loading ? (\n <Spinner className=\"h-4 w-4\" />\n ) : showTotal ? (\n <span className=\"border-r border-black/[0.25] pr-2\">{`${findCurrent ?? 0}/${findTotal ?? 0}`}</span>\n ) : null}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-grey-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","_props$loading","loading","handleChange","onChange","onClear","handleClickFindNext","onClickFindNext","handleClickFindPrevious","onClickFindPrevious","settingsContent","shortcut","_props$showTotal","showTotal","value","attributes","_objectWithoutPropertiesLoose","_excluded","internalRef","useMergedRef","containerRef","useRef","_React$useState","useState","focused","setFocused","_useLocalization","useLocalization","texts","isActive","length","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","_internalRef$current","preventDefault","focus","handleBlur","relatedTarget","_containerRef$current","contains","_attributes$onBlur","onBlur","call","handleClear","requestAnimationFrame","_internalRef$current2","blur","handleFocus","_attributes$onFocus","onFocus","handleKeyDown","_props$onKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","stopPropagation","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","Spinner","findPrevious","shift","findNext","onClickCapture","_internalRef$current3","cn","Icon","button","name","_internalRef$current4","input","Input","_attributes$ariaLabe","placeholder","target","_attributes$placehold","prefix","settingsClassname","style","opacity","_internalRef$current5"],"mappings":";;;;;;;;;;;;;IAwCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,IACIC,WAAW,GAYXF,KAAK,CAZLE,WAAW;IACXC,SAAS,GAWTH,KAAK,CAXLG,SAAS;IAAAC,cAAA,GAWTJ,KAAK,CAVLK,OAAO;IAAPA,OAAO,GAAAD,cAAA,cAAG,KAAK,GAAAA,cAAA;IACLE,YAAY,GAStBN,KAAK,CATLO,QAAQ;IACRC,OAAO,GAQPR,KAAK,CARLQ,OAAO;IACUC,mBAAmB,GAOpCT,KAAK,CAPLU,eAAe;IACMC,uBAAuB,GAM5CX,KAAK,CANLY,mBAAmB;IACnBC,eAAe,GAKfb,KAAK,CALLa,eAAe;IACfC,QAAQ,GAIRd,KAAK,CAJLc,QAAQ;IAAAC,gBAAA,GAIRf,KAAK,CAHLgB,SAAS;IAATA,SAAS,GAAAD,gBAAA,cAAG,IAAI,GAAAA,gBAAA;IAChBE,KAAK,GAELjB,KAAK,CAFLiB,KAAK;IACFC,UAAU,GAAAC,6BAAA,CACbnB,KAAK,EAAAoB,SAAA;EACT,IAAMC,WAAW,GAAGC,YAAY,CAAmBrB,GAAG,CAAC;EACvD,IAAMsB,YAAY,GAAGzB,cAAK,CAAC0B,MAAM,CAAiB,IAAI,CAAC;EACvD,IAAAC,eAAA,GAA8B3B,cAAK,CAAC4B,QAAQ,CAAC,KAAK,CAAC;IAA5CC,OAAO,GAAAF,eAAA;IAAEG,UAAU,GAAAH,eAAA;EAC1B,IAAAI,gBAAA,GAAkBC,eAAe,EAAE;IAA3BC,KAAK,GAAAF,gBAAA,CAALE,KAAK;EACb,IAAMC,QAAQ,GAAGf,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEgB,MAAM;EAC9B,IAAMC,OAAO,GACTz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I/D,KAAK,CAACsC,WAAW,CAACuB,WAAW;IACpEG,MAAM,EAAEvB,IAAI;IACZP,OAAO,EAAEA,OAAO;IAChBhE,GAAG,EAAEoB,WAAW;IAChBJ,KAAK,EAAEA,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI;KAEvB;EAED,IAAIJ,eAAe,EAAE;IACjB,IAAMmF,iBAAiB,GAAGZ,EAAE,CACxB,+NAA+N,CAClO;IAED,oBACItF;MACIyE,SAAS,EAAEa,EAAE,CAAC,gBAAgB,EAAE;QAAE,2CAA2C,EAAEzD;OAAS,CAAC;MACzF1B,GAAG,EAAEsB,YAAY;;;MAGjB0E,KAAK,EAAE;QAAEC,OAAO,EAAE;;OACjBT,KAAK,eACN3F;;MAEImD,MAAM,EAAEL,UAAU;MAClB2B,SAAS,EAAEyB,iBAAiB;MAC5Bd,cAAc,EAAE,SAAAA;QAAA,IAAAiB,qBAAA;QAAA,QAAAA,qBAAA,GAAM9E,WAAW,CAACmB,OAAO,cAAA2D,qBAAA,uBAAnBA,qBAAA,CAAqBxD,KAAK,EAAE;;;MAElD+B,QAAQ,EAAE,CAAC;OACV7D,eAAe,CACd,CACJ;;EAId,OAAO4E,KAAK;AAChB,CAAC;;;;"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { forwardRef, createElement, useRef, useEffect, Fragment } from 'react';
|
2
2
|
import cn from 'clsx';
|
3
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
3
4
|
import { Icon } from '../Icon/Icon.js';
|
4
5
|
import { Badge } from '../Badge/Badge.js';
|
5
6
|
import { Root, Trigger, Portal, Content } from '@radix-ui/react-popover';
|
@@ -9,52 +10,50 @@ import { Combobox } from '../Combobox/Combobox.js';
|
|
9
10
|
import { MultiListbox, Listbox } from '../Listbox/Listbox.js';
|
10
11
|
import { useSelect } from './useSelect.js';
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
style,
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
more = 0
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
const className = cn('inline-flex relative w-full', {
|
13
|
+
var _excluded = ["autoFocus", "className", "highlighted", "style"],
|
14
|
+
_excluded2 = ["editable"];
|
15
|
+
var BaseSelect = /*#__PURE__*/forwardRef(function BaseSelect(props, ref) {
|
16
|
+
var autoFocus = props.autoFocus,
|
17
|
+
externalClassName = props.className,
|
18
|
+
style = props.style,
|
19
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
20
|
+
var _useSelect = useSelect(otherProps, ref),
|
21
|
+
button = _useSelect.button,
|
22
|
+
listbox = _useSelect.listbox,
|
23
|
+
popover = _useSelect.popover,
|
24
|
+
input = _useSelect.input,
|
25
|
+
text = _useSelect.text,
|
26
|
+
_useSelect$more = _useSelect.more,
|
27
|
+
more = _useSelect$more === void 0 ? 0 : _useSelect$more;
|
28
|
+
var internalRef = useRef(null);
|
29
|
+
var selectDimensions = useBoundingClientRectListener(internalRef);
|
30
|
+
var className = cn('inline-flex relative w-full', {
|
31
31
|
'yt-select--readonly': props.readOnly
|
32
32
|
}, externalClassName);
|
33
|
-
|
33
|
+
var inputClassname = cn(getInputClasses(props), 'h-8 text-left !pr-0', {
|
34
34
|
'border-blue-500': popover.open,
|
35
35
|
'select-text': otherProps.readOnly
|
36
36
|
});
|
37
|
-
useEffect(()
|
37
|
+
useEffect(function () {
|
38
38
|
if (autoFocus && internalRef.current) {
|
39
39
|
internalRef.current.focus();
|
40
40
|
}
|
41
41
|
}, []);
|
42
|
-
|
42
|
+
var renderMultiSelection = function renderMultiSelection() {
|
43
43
|
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement("span", {
|
44
44
|
className: "flex-grow truncate text-left"
|
45
45
|
}, text), more > 0 && /*#__PURE__*/createElement(Badge, {
|
46
46
|
className: "ml-2"
|
47
|
-
},
|
47
|
+
}, "+" + more));
|
48
48
|
};
|
49
|
-
|
50
|
-
...listbox,
|
49
|
+
var commonListboxProps = _extends({}, listbox, {
|
51
50
|
className: 'w-auto',
|
52
51
|
invalid: undefined,
|
53
52
|
style: {
|
54
53
|
minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
|
55
54
|
},
|
56
55
|
tabIndex: popover.open ? 0 : -1
|
57
|
-
};
|
56
|
+
});
|
58
57
|
return /*#__PURE__*/createElement("span", {
|
59
58
|
className: className,
|
60
59
|
"data-taco": "select",
|
@@ -77,11 +76,9 @@ const BaseSelect = /*#__PURE__*/forwardRef(function BaseSelect(props, ref) {
|
|
77
76
|
type: "text"
|
78
77
|
}))));
|
79
78
|
});
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
...otherProps
|
84
|
-
} = props;
|
79
|
+
var Select = /*#__PURE__*/forwardRef(function Select(props, ref) {
|
80
|
+
var editable = props.editable,
|
81
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
85
82
|
if (editable) {
|
86
83
|
return /*#__PURE__*/createElement(Combobox, Object.assign({}, otherProps, {
|
87
84
|
dialog: undefined,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Icon } from '../Icon/Icon';\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useSelect } from './useSelect';\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\n\nexport type SelectTexts = {\n /**\n * The text displayed when all options are selected when multiselect mode in on.\n */\n allOptionsSelected: string;\n};\n\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\n Omit<ComboboxProps, 'inline'> & {\n /**\n * Allows to select multiple values.\n * All the selected values will be combined in a comma-seperated string as the value of the input.\n */\n multiselect?: boolean;\n };\n\nexport type SelectProps = BaseSelectProps & {\n /**\n * Creates an editable select.\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\n * even if there is no value in the input.\n * After user starts typing, matching data will be displayed.\n */\n editable?: boolean;\n};\n\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\n const internalRef = React.useRef<HTMLButtonElement>(null);\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left !pr-0', {\n 'border-blue-500': popover.open,\n 'select-text': otherProps.readOnly,\n });\n\n React.useEffect(() => {\n if (autoFocus && internalRef.current) {\n internalRef.current.focus();\n }\n }, []);\n\n const renderMultiSelection = (): React.ReactNode => {\n return (\n <>\n <span className=\"flex-grow truncate text-left\">{text}</span>\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\n </>\n );\n };\n\n const commonListboxProps: ListboxProps = {\n ...listbox,\n className: 'w-auto',\n invalid: undefined,\n style: { minWidth: selectDimensions?.width },\n tabIndex: popover.open ? 0 : -1,\n };\n\n return (\n <span className={className} data-taco=\"select\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\n <span className=\"flex h-8 w-8 items-center justify-center\">\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n <input {...input} className=\"hidden\" type=\"text\" />\n </PopoverPrimitive.Root>\n </span>\n );\n});\n\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\n const { editable, ...otherProps } = props;\n\n if (editable) {\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\n }\n\n return <BaseSelect {...otherProps} ref={ref} />;\n});\n"],"names":["BaseSelect","React","props","ref","autoFocus","className","
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Icon } from '../Icon/Icon';\nimport { Listbox, MultiListbox, ListboxProps } from '../Listbox/Listbox';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { useSelect } from './useSelect';\nimport { Combobox, ComboboxProps } from '../Combobox/Combobox';\nimport { Badge } from '../Badge/Badge';\nimport { getInputClasses } from '../Input/util';\n\nexport type SelectTexts = {\n /**\n * The text displayed when all options are selected when multiselect mode in on.\n */\n allOptionsSelected: string;\n};\n\nexport type BaseSelectProps = Omit<ListboxProps, 'dialog'> &\n Omit<ComboboxProps, 'inline'> & {\n /**\n * Allows to select multiple values.\n * All the selected values will be combined in a comma-seperated string as the value of the input.\n */\n multiselect?: boolean;\n };\n\nexport type SelectProps = BaseSelectProps & {\n /**\n * Creates an editable select.\n * Setting this will render a inline Combobox which will display the provided data on click/focus,\n * even if there is no value in the input.\n * After user starts typing, matching data will be displayed.\n */\n editable?: boolean;\n};\n\nconst BaseSelect = React.forwardRef(function BaseSelect(props: BaseSelectProps, ref: React.Ref<HTMLInputElement>) {\n const { autoFocus, className: externalClassName, highlighted, style, ...otherProps } = props;\n const { button, listbox, popover, input, text, more = 0 } = useSelect(otherProps, ref);\n const internalRef = React.useRef<HTMLButtonElement>(null);\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn('inline-flex relative w-full', { 'yt-select--readonly': props.readOnly }, externalClassName);\n const inputClassname = cn(getInputClasses(props), 'h-8 text-left !pr-0', {\n 'border-blue-500': popover.open,\n 'select-text': otherProps.readOnly,\n });\n\n React.useEffect(() => {\n if (autoFocus && internalRef.current) {\n internalRef.current.focus();\n }\n }, []);\n\n const renderMultiSelection = (): React.ReactNode => {\n return (\n <>\n <span className=\"flex-grow truncate text-left\">{text}</span>\n {more > 0 && <Badge className=\"ml-2\">{`+${more}`}</Badge>}\n </>\n );\n };\n\n const commonListboxProps: ListboxProps = {\n ...listbox,\n className: 'w-auto',\n invalid: undefined,\n style: { minWidth: selectDimensions?.width },\n tabIndex: popover.open ? 0 : -1,\n };\n\n return (\n <span className={className} data-taco=\"select\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Trigger {...button} className={inputClassname} ref={internalRef}>\n {props.multiselect ? renderMultiSelection() : <span className=\"flex-grow truncate text-left\">{text}</span>}\n <span className=\"flex h-8 w-8 items-center justify-center\">\n <Icon className=\"pointer-events-none\" name={popover.open ? 'chevron-up' : 'chevron-down'} />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content align=\"start\" sideOffset={4}>\n {props.multiselect ? <MultiListbox {...commonListboxProps} /> : <Listbox {...commonListboxProps} />}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n <input {...input} className=\"hidden\" type=\"text\" />\n </PopoverPrimitive.Root>\n </span>\n );\n});\n\nexport const Select = React.forwardRef(function Select(props: SelectProps, ref: React.Ref<HTMLInputElement>) {\n const { editable, ...otherProps } = props;\n\n if (editable) {\n return <Combobox {...otherProps} dialog={undefined} inline ref={ref} />;\n }\n\n return <BaseSelect {...otherProps} ref={ref} />;\n});\n"],"names":["BaseSelect","React","props","ref","autoFocus","externalClassName","className","style","otherProps","_objectWithoutPropertiesLoose","_excluded","_useSelect","useSelect","button","listbox","popover","input","text","_useSelect$more","more","internalRef","selectDimensions","useBoundingClientRectListener","cn","readOnly","inputClassname","getInputClasses","open","current","focus","renderMultiSelection","Badge","commonListboxProps","_extends","invalid","undefined","minWidth","width","tabIndex","PopoverPrimitive","multiselect","Icon","name","align","sideOffset","MultiListbox","Listbox","type","Select","editable","_excluded2","Combobox","dialog","inline"],"mappings":";;;;;;;;;;;;;;AAqCA,IAAMA,UAAU,gBAAGC,UAAgB,CAAC,SAASD,UAAUA,CAACE,KAAsB,EAAEC,GAAgC;MACpGC,SAAS,GAAsEF,KAAK,CAApFE,SAAS;IAAaC,iBAAiB,GAAwCH,KAAK,CAAzEI,SAAS;IAAkCC,KAAK,GAAoBL,KAAK,CAA9BK,KAAK;IAAKC,UAAU,GAAAC,6BAAA,CAAKP,KAAK,EAAAQ,SAAA;EAC5F,IAAAC,UAAA,GAA4DC,SAAS,CAACJ,UAAU,EAAEL,GAAG,CAAC;IAA9EU,MAAM,GAAAF,UAAA,CAANE,MAAM;IAAEC,OAAO,GAAAH,UAAA,CAAPG,OAAO;IAAEC,OAAO,GAAAJ,UAAA,CAAPI,OAAO;IAAEC,KAAK,GAAAL,UAAA,CAALK,KAAK;IAAEC,IAAI,GAAAN,UAAA,CAAJM,IAAI;IAAAC,eAAA,GAAAP,UAAA,CAAEQ,IAAI;IAAJA,IAAI,GAAAD,eAAA,cAAG,CAAC,GAAAA,eAAA;EACvD,IAAME,WAAW,GAAGnB,MAAY,CAAoB,IAAI,CAAC;EACzD,IAAMoB,gBAAgB,GAAGC,6BAA6B,CAACF,WAAW,CAAC;EACnE,IAAMd,SAAS,GAAGiB,EAAE,CAAC,6BAA6B,EAAE;IAAE,qBAAqB,EAAErB,KAAK,CAACsB;GAAU,EAAEnB,iBAAiB,CAAC;EACjH,IAAMoB,cAAc,GAAGF,EAAE,CAACG,eAAe,CAACxB,KA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tC,cAACsC,OAAwB;IAACI,KAAK,EAAC,OAAO;IAACC,UAAU,EAAE;KAC/C1C,KAAK,CAACsC,WAAW,gBAAGvC,cAAC4C,YAAY,oBAAKb,kBAAkB,EAAI,gBAAG/B,cAAC6C,OAAO,oBAAKd,kBAAkB,EAAI,CAC5E,CACL,eAC1B/B,yCAAWe,KAAK;IAAEV,SAAS,EAAC,QAAQ;IAACyC,IAAI,EAAC;KAAS,CAC/B,CACrB;AAEf,CAAC,CAAC;IAEWC,MAAM,gBAAG/C,UAAgB,CAAC,SAAS+C,MAAMA,CAAC9C,KAAkB,EAAEC,GAAgC;EACvG,IAAQ8C,QAAQ,GAAoB/C,KAAK,CAAjC+C,QAAQ;IAAKzC,UAAU,GAAAC,6BAAA,CAAKP,KAAK,EAAAgD,UAAA;EAEzC,IAAID,QAAQ,EAAE;IACV,oBAAOhD,cAACkD,QAAQ,oBAAK3C,UAAU;MAAE4C,MAAM,EAAEjB,SAAS;MAAEkB,MAAM;MAAClD,GAAG,EAAEA;OAAO;;EAG3E,oBAAOF,cAACD,UAAU,oBAAKQ,UAAU;IAAEL,GAAG,EAAEA;KAAO;AACnD,CAAC;;;;"}
|
@@ -1,43 +1,49 @@
|
|
1
1
|
import { useState, useMemo, useRef, useEffect, createElement, Fragment, cloneElement } 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 { v4 } from 'uuid';
|
6
7
|
import { createCustomEvent } from '../../utils/input.js';
|
7
8
|
import { useFlattenedData, findByValue, setInputValueByRef, sanitizeItem } from '../Listbox/util.js';
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
'aria-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
texts
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
10
|
+
var _excluded = ["aria-label", "aria-labelledby", "data", "defaultValue", "disabled", "emptyValue", "id", "multiselect", "onBlur", "onClick", "onChange", "readOnly", "tabIndex", "value"];
|
11
|
+
var useSelect = function useSelect(_ref, ref) {
|
12
|
+
var ariaLabel = _ref['aria-label'],
|
13
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
14
|
+
_ref$data = _ref.data,
|
15
|
+
data = _ref$data === void 0 ? [] : _ref$data,
|
16
|
+
defaultValue = _ref.defaultValue,
|
17
|
+
disabled = _ref.disabled,
|
18
|
+
emptyValue = _ref.emptyValue,
|
19
|
+
nativeId = _ref.id,
|
20
|
+
multiselect = _ref.multiselect,
|
21
|
+
onBlur = _ref.onBlur,
|
22
|
+
onChange = _ref.onChange,
|
23
|
+
readOnly = _ref.readOnly,
|
24
|
+
tabIndex = _ref.tabIndex,
|
25
|
+
value = _ref.value,
|
26
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
27
|
+
var _useLocalization = useLocalization(),
|
28
|
+
texts = _useLocalization.texts;
|
29
|
+
var flattenedData = useFlattenedData(data);
|
30
|
+
var listboxInputRef = useMergedRef(ref);
|
31
|
+
var _React$useState = useState(false),
|
32
|
+
open = _React$useState[0],
|
33
|
+
setOpen = _React$useState[1];
|
34
|
+
var id = useMemo(function () {
|
35
|
+
return nativeId || "select_" + v4();
|
36
|
+
}, [nativeId]);
|
37
|
+
var inputRef = useRef(null);
|
38
|
+
var buttonId = id + "-button";
|
35
39
|
// support 'escape' resetting to the value that was set when the listbox opened
|
36
|
-
|
37
|
-
|
40
|
+
var _React$useState2 = useState(value),
|
41
|
+
lastValue = _React$useState2[0],
|
42
|
+
setLastValue = _React$useState2[1];
|
43
|
+
useEffect(function () {
|
38
44
|
setLastValue(value);
|
39
45
|
}, [open]);
|
40
|
-
useEffect(()
|
46
|
+
useEffect(function () {
|
41
47
|
if (value === undefined) {
|
42
48
|
if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
|
43
49
|
setInputValueByRef(inputRef.current, defaultValue);
|
@@ -59,13 +65,13 @@ const useSelect = ({
|
|
59
65
|
}
|
60
66
|
}, []);
|
61
67
|
// event handlers
|
62
|
-
|
68
|
+
var handleButtonKeyDown = function handleButtonKeyDown(event) {
|
63
69
|
if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
|
64
70
|
event.preventDefault();
|
65
71
|
setOpen(true);
|
66
72
|
}
|
67
73
|
};
|
68
|
-
|
74
|
+
var handleListboxKeyDown = function handleListboxKeyDown(event) {
|
69
75
|
switch (event.key) {
|
70
76
|
case 'Escape':
|
71
77
|
{
|
@@ -90,7 +96,7 @@ const useSelect = ({
|
|
90
96
|
otherProps.onKeyDown(event);
|
91
97
|
}
|
92
98
|
};
|
93
|
-
|
99
|
+
var handleListboxClick = function handleListboxClick(event) {
|
94
100
|
event.preventDefault();
|
95
101
|
if (!multiselect) {
|
96
102
|
setOpen(false);
|
@@ -99,12 +105,14 @@ const useSelect = ({
|
|
99
105
|
}
|
100
106
|
}
|
101
107
|
};
|
102
|
-
|
103
|
-
|
108
|
+
var text = '';
|
109
|
+
var more = 0;
|
104
110
|
if (value !== undefined) {
|
105
111
|
if (multiselect) {
|
106
|
-
|
107
|
-
if (selectedValues.length === flattenedData.filter(
|
112
|
+
var selectedValues = (value === null || value === void 0 ? void 0 : value.toString().split(',')) || [];
|
113
|
+
if (selectedValues.length === flattenedData.filter(function (item) {
|
114
|
+
return !item.disabled;
|
115
|
+
}).length) {
|
108
116
|
text = texts.select.allOptionsSelected;
|
109
117
|
} else {
|
110
118
|
var _findByValue$text, _findByValue;
|
@@ -112,7 +120,7 @@ const useSelect = ({
|
|
112
120
|
more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
|
113
121
|
}
|
114
122
|
} else {
|
115
|
-
|
123
|
+
var item = findByValue(flattenedData, value);
|
116
124
|
if (item) {
|
117
125
|
text = item.icon ? (/*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/cloneElement(item.icon, {
|
118
126
|
className: cn(item.icon.props.className, 'mr-1 -mt-px')
|
@@ -120,90 +128,91 @@ const useSelect = ({
|
|
120
128
|
}
|
121
129
|
}
|
122
130
|
}
|
123
|
-
|
131
|
+
var handleInputChange = function handleInputChange(event) {
|
124
132
|
event.persist();
|
125
133
|
if (onChange) {
|
126
134
|
var _item$path$split, _item$path;
|
127
|
-
|
128
|
-
event.detail = sanitizeItem(
|
129
|
-
|
135
|
+
var _item = findByValue(flattenedData, event.target.value);
|
136
|
+
event.detail = sanitizeItem(_item);
|
137
|
+
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 : [];
|
130
138
|
if (indexes.length > 1) {
|
131
139
|
// we don't want to map the current item
|
132
140
|
indexes.pop();
|
133
141
|
// we need to rebuild the path as we map
|
134
|
-
|
135
|
-
event.detail.parents = indexes.map(i
|
142
|
+
var lastPath;
|
143
|
+
event.detail.parents = indexes.map(function (i) {
|
136
144
|
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
137
|
-
return sanitizeItem(flattenedData.find(
|
145
|
+
return sanitizeItem(flattenedData.find(function (i) {
|
146
|
+
return i.path === lastPath;
|
147
|
+
}));
|
138
148
|
});
|
139
149
|
}
|
140
150
|
onChange(event);
|
141
151
|
}
|
142
152
|
};
|
143
|
-
|
153
|
+
var handleButtonClick = function handleButtonClick(event) {
|
144
154
|
if (readOnly) {
|
145
155
|
event.preventDefault();
|
146
156
|
}
|
147
157
|
};
|
148
158
|
// select the value text if the select is readonly
|
149
|
-
|
159
|
+
var handleButtonFocus = function handleButtonFocus(event) {
|
150
160
|
if (readOnly) {
|
151
|
-
|
152
|
-
if (
|
161
|
+
var _value = event.currentTarget.querySelector(':first-child');
|
162
|
+
if (_value) {
|
153
163
|
var _window$getSelection, _window$getSelection$;
|
154
|
-
(_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : (_window$getSelection$ = _window$getSelection.selectAllChildren) === null || _window$getSelection$ === void 0 ? void 0 : _window$getSelection$.call(_window$getSelection,
|
164
|
+
(_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : (_window$getSelection$ = _window$getSelection.selectAllChildren) === null || _window$getSelection$ === void 0 ? void 0 : _window$getSelection$.call(_window$getSelection, _value);
|
155
165
|
}
|
156
166
|
}
|
157
167
|
};
|
158
|
-
|
168
|
+
var button = {
|
159
169
|
'aria-haspopup': 'listbox',
|
160
|
-
'aria-label': ariaLabel ?
|
161
|
-
'aria-labelledby': ariaLabelledBy ?
|
170
|
+
'aria-label': ariaLabel ? ariaLabel + " " + text : undefined,
|
171
|
+
'aria-labelledby': ariaLabelledBy ? ariaLabelledBy + " " + buttonId : undefined,
|
162
172
|
'aria-readonly': readOnly ? 'true' : undefined,
|
163
173
|
disabled: disabled,
|
164
174
|
id: buttonId,
|
165
175
|
onClick: handleButtonClick,
|
166
176
|
onFocus: handleButtonFocus,
|
167
177
|
onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,
|
168
|
-
tabIndex,
|
178
|
+
tabIndex: tabIndex,
|
169
179
|
type: 'button'
|
170
180
|
};
|
171
|
-
|
172
|
-
...otherProps,
|
181
|
+
var listbox = _extends({}, otherProps, {
|
173
182
|
'aria-label': ariaLabel,
|
174
183
|
'aria-labelledby': ariaLabelledBy,
|
175
|
-
data,
|
176
|
-
disabled,
|
177
|
-
emptyValue,
|
178
|
-
onBlur,
|
184
|
+
data: data,
|
185
|
+
disabled: disabled,
|
186
|
+
emptyValue: emptyValue,
|
187
|
+
onBlur: onBlur,
|
179
188
|
onClick: handleListboxClick,
|
180
|
-
onChange: event
|
189
|
+
onChange: function onChange(event) {
|
181
190
|
setInputValueByRef(inputRef.current, event.target.value);
|
182
191
|
},
|
183
192
|
onKeyDown: handleListboxKeyDown,
|
184
193
|
ref: listboxInputRef,
|
185
|
-
value
|
186
|
-
};
|
187
|
-
|
194
|
+
value: value
|
195
|
+
});
|
196
|
+
var input = {
|
188
197
|
onChange: handleInputChange,
|
189
198
|
ref: inputRef,
|
190
199
|
value: String(value !== null && value !== void 0 ? value : '')
|
191
200
|
};
|
192
201
|
return {
|
193
|
-
button,
|
194
|
-
listbox,
|
195
|
-
input,
|
202
|
+
button: button,
|
203
|
+
listbox: listbox,
|
204
|
+
input: input,
|
196
205
|
popover: {
|
197
|
-
open,
|
198
|
-
onOpenChange: open
|
206
|
+
open: open,
|
207
|
+
onOpenChange: function onOpenChange(open) {
|
199
208
|
if (!open && onBlur) {
|
200
209
|
onBlur(createCustomEvent('blur'));
|
201
210
|
}
|
202
211
|
setOpen(open);
|
203
212
|
}
|
204
213
|
},
|
205
|
-
text,
|
206
|
-
more
|
214
|
+
text: text,
|
215
|
+
more: more
|
207
216
|
};
|
208
217
|
};
|
209
218
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useSelect.js","sources":["../../../../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { v4 as uuid } from 'uuid';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useLocalization } from '../Provider/Localization';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick,\n onChange,\n readOnly,\n tabIndex,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useMergedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n } else {\n if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.key) {\n case 'Escape': {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, 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(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (readOnly) {\n event.preventDefault();\n }\n };\n\n // select the value text if the select is readonly\n const handleButtonFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (readOnly) {\n const value = event.currentTarget.querySelector(':first-child');\n\n if (value) {\n window.getSelection()?.selectAllChildren?.(value);\n }\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n 'aria-readonly': readOnly ? 'true' : undefined,\n disabled: disabled,\n id: buttonId,\n onClick: handleButtonClick,\n onFocus: handleButtonFocus,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n tabIndex,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: open => {\n if (!open && onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n setOpen(open);\n },\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","ariaLabel","ariaLabelledBy","data","defaultValue","disabled","emptyValue","id","nativeId","multiselect","onBlur","onClick","onChange","readOnly","tabIndex","value","otherProps","ref","texts","useLocalization","flattenedData","useFlattenedData","listboxInputRef","useMergedRef","open","setOpen","React","uuid","inputRef","buttonId","lastValue","setLastValue","undefined","findByValue","setInputValueByRef","current","length","handleButtonKeyDown","event","key","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","createCustomEvent","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","_findByValue$text","_findByValue","icon","className","cn","props","handleInputChange","persist","_item$path$split","_item$path","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","handleButtonClick","handleButtonFocus","currentTarget","querySelector","_window$getSelection","_window$getSelection$","window","getSelection","selectAllChildren","call","button","onFocus","type","listbox","input","String","popover","onOpenChange"],"mappings":";;;;;;;;MAyBaA,SAAS,GAAGA,CACrB;EACI,YAAY,EAAEC,SAAS;EACvB,iBAAiB,EAAEC,cAAc;EACjCC,IAAI,GAAG,EAAE;EACTC,YAAY;EACZC,QAAQ;EACRC,UAAU;EACVC,EAAE,EAAEC,QAAQ;EACZC,WAAW;EACXC,MAAM;EACNC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,KAAK;EACL,GAAGC;CACO,EACdC,GAAgC;EAEhC,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,aAAa,GAAGC,gBAAgB,CAAClB,IAAI,CAAC;EAC5C,MAAMmB,eAAe,GAAGC,YAAY,CAAmBN,GAAG,CAAC;EAC3D,MAAM,CAACO,IAAI,EAAEC,OAAO,CAAC,GAAGC,QAAc,CAAC,KAAK,CAAC;EAC7C,MAAMnB,EAAE,GAAGmB,OAAa,CAAC,MAAMlB,QAAQ,IAAI,UAAUmB,EAAI,EAAE,EAAE,EAAE,CAACnB,QAAQ,CAAC,CAAC;EAC1E,MAAMoB,QAAQ,GAAGF,MAAY,CAAmB,IAAI,CAAC;EACrD,MAAMG,QAAQ,GAAG,GAAGtB,EAAE,SAAS;;EAE/B,MAAM,CAACuB,SAAS,EAAEC,YAAY,CAAC,GAAGL,QAAc,CAAsCX,KAAK,CAAC;EAE5FW,SAAe,CAAC;IACZK,YAAY,CAAChB,KAAK,CAAC;GACtB,EAAE,CAACS,IAAI,CAAC,CAAC;EAEVE,SAAe,CAAC;IACZ,IAAIX,KAAK,KAAKiB,SAAS,EAAE;MACrB,IAAI5B,YAAY,KAAK4B,SAAS,IAAIC,WAAW,CAACb,aAAa,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;IACNC,OAAO,EAAEgC,kBAAkB;IAC3B/B,QAAQ,EAAE0B,KAAK;MACXJ,kBAAkB,CAACN,QAAQ,CAACO,OAAO,EAAEG,KAAK,CAAC0B,MAAM,CAACjD,KAAK,CAAC;KAC3D;IACD2B,SAAS,EAAED,oBAAoB;IAC/BxB,GAAG,EAAEK,eAAe;IACpBP;GACH;EAED,MAAM2E,KAAK,GAAuB;IAC9B9E,QAAQ,EAAEgD,iBAAiB;IAC3B3C,GAAG,EAAEW,QAAQ;IACbb,KAAK,EAAE4E,MAAM,CAAC5E,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;GAC5B;EAED,OAAO;IACHuE,MAAM;IACNG,OAAO;IACPC,KAAK;IACLE,OAAO,EAAE;MACLpE,IAAI;MACJqE,YAAY,EAAErE,IAAI;QACd,IAAI,CAACA,IAAI,IAAId,MAAM,EAAE;UACjBA,MAAM,CAACkC,iBAAiB,CAAC,MAAM,CAAC,CAAC;;QAErCnB,OAAO,CAACD,IAAI,CAAC;;KAEpB;IACDqB,IAAI;IACJC;GACH;AACL;;;;"}
|
1
|
+
{"version":3,"file":"useSelect.js","sources":["../../../../../../../src/components/Select/useSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { v4 as uuid } from 'uuid';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { useLocalization } from '../Provider/Localization';\nimport { SelectProps } from './Select';\nimport { ListboxProps } from '../Listbox/Listbox';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { setInputValueByRef, findByValue, useFlattenedData, sanitizeItem } from '../Listbox/util';\nimport { ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { createCustomEvent } from '../../utils/input';\n\ntype InternalButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;\ntype InternalListboxProps = ListboxProps & { ref: React.ForwardedRef<HTMLInputElement> };\ntype InternalInputProps = React.InputHTMLAttributes<HTMLInputElement> & { ref: React.ForwardedRef<HTMLInputElement> };\n\ntype useSelect = React.HtmlHTMLAttributes<HTMLDivElement> & {\n button: InternalButtonProps;\n listbox: InternalListboxProps;\n input: InternalInputProps;\n popover: Pick<PopoverPrimitive.PopoverProps, 'onOpenChange' | 'open'>;\n text: string | JSX.Element;\n more?: number;\n};\n\nexport const useSelect = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data = [],\n defaultValue,\n disabled,\n emptyValue,\n id: nativeId,\n multiselect,\n onBlur,\n onClick,\n onChange,\n readOnly,\n tabIndex,\n value,\n ...otherProps\n }: SelectProps,\n ref: React.Ref<HTMLInputElement>\n): useSelect => {\n const { texts } = useLocalization();\n const flattenedData = useFlattenedData(data);\n const listboxInputRef = useMergedRef<HTMLInputElement>(ref);\n const [open, setOpen] = React.useState(false);\n const id = React.useMemo(() => nativeId || `select_${uuid()}`, [nativeId]);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const buttonId = `${id}-button`;\n // support 'escape' resetting to the value that was set when the listbox opened\n const [lastValue, setLastValue] = React.useState<ScrollableListItemValue | undefined>(value);\n\n React.useEffect(() => {\n setLastValue(value);\n }, [open]);\n\n React.useEffect(() => {\n if (value === undefined) {\n if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {\n setInputValueByRef(inputRef.current, defaultValue);\n } else {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n } else {\n if (!multiselect && !findByValue(flattenedData, value)) {\n if (emptyValue !== undefined) {\n setInputValueByRef(inputRef.current, emptyValue);\n } else if (data.length > 0) {\n setInputValueByRef(inputRef.current, data[0].value);\n }\n }\n }\n }, []);\n\n // event handlers\n const handleButtonKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>): void => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n setOpen(true);\n }\n };\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n switch (event.key) {\n case 'Escape': {\n event.preventDefault();\n if (lastValue !== undefined) {\n setInputValueByRef(listboxInputRef.current, lastValue);\n }\n\n setOpen(false);\n break;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n setOpen(false);\n break;\n }\n\n default:\n }\n\n if (otherProps.onKeyDown) {\n otherProps.onKeyDown(event);\n }\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>): void => {\n event.preventDefault();\n if (!multiselect) {\n setOpen(false);\n if (onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n }\n };\n\n let text: string | JSX.Element = '';\n let more = 0;\n\n if (value !== undefined) {\n if (multiselect) {\n const selectedValues = value?.toString().split(',') || [];\n\n if (selectedValues.length === flattenedData.filter(item => !item.disabled).length) {\n text = texts.select.allOptionsSelected;\n } else {\n text = findByValue(flattenedData, selectedValues[0])?.text ?? '';\n more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;\n }\n } else {\n const item = findByValue(flattenedData, value);\n\n if (item) {\n text = item.icon ? (\n <>\n {React.cloneElement(item.icon, {\n className: cn(item.icon.props.className, 'mr-1 -mt-px'),\n })}\n {item.text}\n </>\n ) : (\n item.text\n );\n }\n }\n }\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (onChange) {\n const item = findByValue(flattenedData, 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(flattenedData.find(i => i.path === lastPath));\n });\n }\n\n onChange(event);\n }\n };\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (readOnly) {\n event.preventDefault();\n }\n };\n\n // select the value text if the select is readonly\n const handleButtonFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (readOnly) {\n const value = event.currentTarget.querySelector(':first-child');\n\n if (value) {\n window.getSelection()?.selectAllChildren?.(value);\n }\n }\n };\n\n const button: InternalButtonProps = {\n 'aria-haspopup': 'listbox' as const,\n 'aria-label': ariaLabel ? `${ariaLabel} ${text}` : undefined,\n 'aria-labelledby': ariaLabelledBy ? `${ariaLabelledBy} ${buttonId}` : undefined,\n 'aria-readonly': readOnly ? 'true' : undefined,\n disabled: disabled,\n id: buttonId,\n onClick: handleButtonClick,\n onFocus: handleButtonFocus,\n onKeyDown: !disabled && !readOnly ? handleButtonKeyDown : undefined,\n tabIndex,\n type: 'button',\n };\n\n const listbox: InternalListboxProps = {\n ...otherProps,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n emptyValue,\n onBlur,\n onClick: handleListboxClick,\n onChange: event => {\n setInputValueByRef(inputRef.current, event.target.value);\n },\n onKeyDown: handleListboxKeyDown,\n ref: listboxInputRef,\n value,\n };\n\n const input: InternalInputProps = {\n onChange: handleInputChange,\n ref: inputRef,\n value: String(value ?? ''),\n };\n\n return {\n button,\n listbox,\n input,\n popover: {\n open,\n onOpenChange: open => {\n if (!open && onBlur) {\n onBlur(createCustomEvent('blur'));\n }\n setOpen(open);\n },\n },\n text,\n more,\n };\n};\n"],"names":["useSelect","_ref","ref","ariaLabel","ariaLabelledBy","_ref$data","data","defaultValue","disabled","emptyValue","nativeId","id","multiselect","onBlur","onChange","readOnly","tabIndex","value","otherProps","_objectWithoutPropertiesLoose","_excluded","_useLocalization","useLocalization","texts","flattenedData","useFlattenedData","listboxInputRef","useMergedRef","_React$useState","React","open","setOpen","uuid","inputRef","buttonId","_React$useState2","lastValue","setLastValue","undefined","findByValue","setInputValueByRef","current","length","handleButtonKeyDown","event","key","preventDefault","handleListboxKeyDown","onKeyDown","handleListboxClick","createCustomEvent","text","more","selectedValues","toString","split","filter","item","select","allOptionsSelected","_findByValue$text","_findByValue","icon","className","cn","props","handleInputChange","persist","_item$path$split","_item$path","target","detail","sanitizeItem","indexes","path","pop","lastPath","parents","map","i","join","find","handleButtonClick","handleButtonFocus","currentTarget","querySelector","_window$getSelection","_window$getSelection$","window","getSelection","selectAllChildren","call","button","onClick","onFocus","type","listbox","_extends","input","String","popover","onOpenChange"],"mappings":";;;;;;;;;;IAyBaA,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAkBlBC,GAAgC;MAhBdC,SAAS,GAAAF,IAAA,CAAvB,YAAY;IACOG,cAAc,GAAAH,IAAA,CAAjC,iBAAiB;IAAAI,SAAA,GAAAJ,IAAA,CACjBK,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,EAAE,GAAAA,SAAA;IACTE,YAAY,GAAAN,IAAA,CAAZM,YAAY;IACZC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;IACNC,QAAQ,GAAAT,IAAA,CAAZU,EAAE;IACFC,WAAW,GAAAX,IAAA,CAAXW,WAAW;IACXC,MAAM,GAAAZ,IAAA,CAANY,MAAM;IAENC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,QAAQ,GAAAd,IAAA,CAARc,QAAQ;IACRC,QAAQ,GAAAf,IAAA,CAARe,QAAQ;IACRC,KAAK,GAAAhB,IAAA,CAALgB,KAAK;IACFC,UAAU,GAAAC,6BAAA,CAAAlB,IAAA,EAAAmB,SAAA;EAIjB,IAAAC,gBAAA,GAAkBC,eAAe,EAAE;IAA3BC,KAAK,GAAAF,gBAAA,CAALE,KAAK;EACb,IAAMC,aAAa,GAAGC,gBAAgB,CAACnB,IAAI,CAAC;EAC5C,IAAMoB,eAAe,GAAGC,YAAY,CAAmBzB,GAAG,CAAC;EAC3D,IAAA0B,eAAA,GAAwBC,QAAc,CAAC,KAAK,CAAC;IAAtCC,IAAI,GAAAF,eAAA;IAAEG,OAAO,GAAAH,eAAA;EACpB,IAAMj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