@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,4 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
+
import { extends as _extends, objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
3
|
import { useLocalization } from '../../Provider/Localization.js';
|
3
4
|
import { useTable as useTable$1, useRowState, useSortBy, useExpanded, usePagination } from 'react-table';
|
4
5
|
import { getColumnsFromChildren, getInternalSortRules, sanitizeRowProps } from '../util.js';
|
@@ -9,191 +10,199 @@ import { useRowSelect } from './plugins/useRowSelect.js';
|
|
9
10
|
import { useTableKeyboardNavigation } from './useTableKeyboardNavigation.js';
|
10
11
|
import { useRowDraggable } from './plugins/useRowDraggable.js';
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
var _excluded = ["children", "data", "dangerouslyHijackGlobalKeyboardNavigation", "onRowClick", "onRowDrag", "onSelectedRows", "rowClassName", "rowExpansionRenderer", "rowHeight", "selectedRows", "disableSorting", "manualSorting", "onSort", "sortRules", "activeIndex", "defaultActiveIndex", "onChangeActiveIndex", "disablePagination", "length", "onPaginate", "pageSize", "pageIndex", "inlineEditingUniqueId", "onRowCreate", "actions", "onRowEdit", "onRowCopy", "onRowDelete", "onRowActive", "windowed"],
|
14
|
+
_excluded2 = ["headerGroups", "rows", "sortedRows", "prepareRow", "state", "page", "gotoPage", "setPageSize"];
|
15
|
+
var useTableRowActive = function useTableRowActive(activeIndex, rows, rowExpansionRenderer, handleonRowActive) {
|
16
|
+
React__default.useEffect(function () {
|
14
17
|
if (activeIndex !== undefined && rows.length && handleonRowActive) {
|
15
|
-
|
18
|
+
var focusedRow = rows[activeIndex];
|
16
19
|
if (focusedRow) {
|
17
|
-
|
20
|
+
var sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);
|
18
21
|
handleonRowActive(sanitizedFocusedRow);
|
19
22
|
}
|
20
23
|
}
|
21
24
|
}, [activeIndex, rows]);
|
22
25
|
};
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
var useTableInstance = function useTableInstance(instance, ref) {
|
27
|
+
var sanitizedInstance = React__default.useMemo(function () {
|
28
|
+
return {
|
29
|
+
toggleAllRowsExpanded: instance.toggleAllRowsExpanded,
|
30
|
+
toggleHideAllColumns: instance.toggleHideAllColumns,
|
31
|
+
toggleHideColumn: instance.toggleHideColumn,
|
32
|
+
toggleEditing: instance.toggleEditing,
|
33
|
+
toggleRowEditing: instance.toggleRowEditing,
|
34
|
+
resetRowEditing: instance.resetRowEditing,
|
35
|
+
toggleRowExpanded: instance.toggleRowExpanded,
|
36
|
+
toggleSortBy: instance.toggleSortBy
|
37
|
+
};
|
38
|
+
}, []);
|
39
|
+
React__default.useEffect(function () {
|
35
40
|
if (ref !== null && ref !== void 0 && ref.current) {
|
36
41
|
ref.current.instance = sanitizedInstance;
|
37
42
|
}
|
38
43
|
}, [ref]);
|
39
44
|
return sanitizedInstance;
|
40
45
|
};
|
41
|
-
|
42
|
-
React__default.useEffect(()
|
46
|
+
var useTablePaginationListener = function useTablePaginationListener(disablePagination, onPaginate, state) {
|
47
|
+
React__default.useEffect(function () {
|
43
48
|
if (!disablePagination && onPaginate) {
|
44
49
|
onPaginate(state.pageIndex, state.pageSize);
|
45
50
|
}
|
46
51
|
}, [state.pageIndex, state.pageSize]);
|
47
52
|
};
|
48
|
-
|
49
|
-
React__default.useEffect(()
|
53
|
+
var useTableSortingListener = function useTableSortingListener(data, sortedRows, onSort, manualSorting, state) {
|
54
|
+
React__default.useEffect(function () {
|
50
55
|
if (onSort) {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
56
|
+
var sortRules = state.sortBy.map(function (rule) {
|
57
|
+
return {
|
58
|
+
accessor: rule.id,
|
59
|
+
desc: rule.desc
|
60
|
+
};
|
61
|
+
});
|
55
62
|
if (manualSorting) {
|
56
63
|
onSort(sortRules);
|
57
64
|
} else {
|
58
|
-
|
65
|
+
var sortedData;
|
59
66
|
if (sortRules.length && sortedRows !== null && sortedRows !== void 0 && sortedRows.length) {
|
60
|
-
sortedData = sortedRows.map(
|
67
|
+
sortedData = sortedRows.map(function (row) {
|
68
|
+
return row.original;
|
69
|
+
});
|
61
70
|
}
|
62
71
|
onSort(sortRules, sortedData || data);
|
63
72
|
}
|
64
73
|
}
|
65
74
|
}, [onSort && JSON.stringify(state.sortBy), manualSorting]);
|
66
75
|
};
|
67
|
-
|
68
|
-
|
76
|
+
var DEFAULT_PAGE_SIZE = 10;
|
77
|
+
var useTable = function useTable(props, ref) {
|
69
78
|
var _otherProps$tabIndex;
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
onRowCopy,
|
103
|
-
onRowDelete,
|
104
|
-
onRowActive,
|
105
|
-
windowed = false,
|
106
|
-
...otherProps
|
107
|
-
} = props;
|
79
|
+
var children = props.children,
|
80
|
+
data = props.data,
|
81
|
+
onRowClick = props.onRowClick,
|
82
|
+
onRowDrag = props.onRowDrag,
|
83
|
+
onSelectedRows = props.onSelectedRows,
|
84
|
+
rowClassName = props.rowClassName,
|
85
|
+
rowExpansionRenderer = props.rowExpansionRenderer,
|
86
|
+
rowHeight = props.rowHeight,
|
87
|
+
selectedRows = props.selectedRows,
|
88
|
+
disableSorting = props.disableSorting,
|
89
|
+
manualSorting = props.manualSorting,
|
90
|
+
onSort = props.onSort,
|
91
|
+
sortRules = props.sortRules,
|
92
|
+
_props$disablePaginat = props.disablePagination,
|
93
|
+
disablePagination = _props$disablePaginat === void 0 ? true : _props$disablePaginat,
|
94
|
+
length = props.length,
|
95
|
+
onPaginate = props.onPaginate,
|
96
|
+
_props$pageSize = props.pageSize,
|
97
|
+
pageSize = _props$pageSize === void 0 ? DEFAULT_PAGE_SIZE : _props$pageSize,
|
98
|
+
_props$pageIndex = props.pageIndex,
|
99
|
+
pageIndex = _props$pageIndex === void 0 ? 0 : _props$pageIndex,
|
100
|
+
_props$inlineEditingU = props.inlineEditingUniqueId,
|
101
|
+
inlineEditingUniqueId = _props$inlineEditingU === void 0 ? undefined : _props$inlineEditingU,
|
102
|
+
onRowCreate = props.onRowCreate,
|
103
|
+
actions = props.actions,
|
104
|
+
onRowEdit = props.onRowEdit,
|
105
|
+
onRowCopy = props.onRowCopy,
|
106
|
+
onRowDelete = props.onRowDelete,
|
107
|
+
onRowActive = props.onRowActive,
|
108
|
+
_props$windowed = props.windowed,
|
109
|
+
windowed = _props$windowed === void 0 ? false : _props$windowed,
|
110
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
108
111
|
if (onSelectedRows && !selectedRows || !onSelectedRows && selectedRows) {
|
109
112
|
throw new Error('Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection');
|
110
113
|
}
|
111
|
-
|
112
|
-
texts,
|
113
|
-
locale
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
114
|
+
var _useLocalization = useLocalization(),
|
115
|
+
texts = _useLocalization.texts,
|
116
|
+
locale = _useLocalization.locale;
|
117
|
+
var _React$useMemo = React__default.useMemo(function () {
|
118
|
+
return getColumnsFromChildren(children, rowExpansionRenderer);
|
119
|
+
}, [children, rowExpansionRenderer]),
|
120
|
+
columns = _React$useMemo.columns,
|
121
|
+
defaultSortRules = _React$useMemo.sortRules;
|
122
|
+
var manualPagination = !disablePagination && !!onPaginate && !!length;
|
123
|
+
var _useReactTable = useTable$1({
|
124
|
+
columns: columns,
|
125
|
+
data: data,
|
126
|
+
initialState: {
|
127
|
+
// @ts-expect-error: not sure how to type this correctly right now
|
128
|
+
sortBy: getInternalSortRules(sortRules) || defaultSortRules,
|
129
|
+
pageSize: !disablePagination ? pageSize : undefined,
|
130
|
+
pageIndex: !disablePagination ? pageIndex : undefined
|
131
|
+
},
|
132
|
+
manualPagination: manualPagination,
|
133
|
+
pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,
|
134
|
+
manualSortBy: manualSorting,
|
135
|
+
disableSortBy: disableSorting,
|
136
|
+
// most of these resets preventions are needed for editing mode
|
137
|
+
autoResetExpanded: false,
|
138
|
+
autoResetSelectedRows: false,
|
139
|
+
autoResetSortBy: false,
|
140
|
+
autoResetPage: false,
|
141
|
+
sortTypes: React__default.useMemo(function () {
|
142
|
+
return sortTypes(locale);
|
143
|
+
}, []),
|
144
|
+
useControlledState: function useControlledState(currentState) {
|
145
|
+
return React__default.useMemo(function () {
|
146
|
+
return _extends({}, currentState, {
|
147
|
+
selectedRowIds: selectedRows || []
|
148
|
+
});
|
149
|
+
}, [currentState, selectedRows]);
|
150
|
+
}
|
151
|
+
}, useRowState, useSortBy, useExpanded, usePagination, useRowSelect(onSelectedRows), useRowDraggable(onRowDrag), useRowEditing(inlineEditingUniqueId), useRowActions(inlineEditingUniqueId, {
|
152
|
+
onRowCreate: onRowCreate,
|
153
|
+
onRowEdit: onRowEdit,
|
154
|
+
onRowCopy: onRowCopy,
|
155
|
+
onRowDelete: onRowDelete
|
156
|
+
}, actions, rowExpansionRenderer, texts, windowed)),
|
157
|
+
headerGroups = _useReactTable.headerGroups,
|
158
|
+
rows = _useReactTable.rows,
|
159
|
+
sortedRows = _useReactTable.sortedRows,
|
160
|
+
prepareBaseRow = _useReactTable.prepareRow,
|
161
|
+
state = _useReactTable.state,
|
162
|
+
page = _useReactTable.page,
|
163
|
+
gotoPage = _useReactTable.gotoPage,
|
164
|
+
setPageSize = _useReactTable.setPageSize,
|
165
|
+
instance = _objectWithoutPropertiesLoose(_useReactTable, _excluded2);
|
162
166
|
useTablePaginationListener(disablePagination, onPaginate, state);
|
163
167
|
useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
168
|
+
var sanitizedInstance = useTableInstance(instance, ref);
|
169
|
+
var visibleRows = !disablePagination && !manualPagination ? page : rows;
|
170
|
+
var _useTableKeyboardNavi = useTableKeyboardNavigation(props, visibleRows, {
|
171
|
+
onRowClick: onRowClick,
|
172
|
+
onRowCreate: onRowCreate,
|
173
|
+
onRowEdit: onRowEdit,
|
174
|
+
onRowCopy: onRowCopy,
|
175
|
+
onRowDelete: onRowDelete,
|
176
|
+
rowExpansionRenderer: rowExpansionRenderer
|
177
|
+
}, ref),
|
178
|
+
activeIndex = _useTableKeyboardNavi[0],
|
179
|
+
setActiveIndex = _useTableKeyboardNavi[1],
|
180
|
+
handleKeyDown = _useTableKeyboardNavi[2],
|
181
|
+
handleFocus = _useTableKeyboardNavi[3];
|
174
182
|
useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);
|
175
|
-
|
183
|
+
var prepareRow = React__default.useCallback(function (row, index) {
|
176
184
|
prepareBaseRow(row);
|
177
|
-
row.setActive = ()
|
185
|
+
row.setActive = function () {
|
186
|
+
return setActiveIndex(index);
|
187
|
+
};
|
178
188
|
}, [prepareBaseRow, setActiveIndex]);
|
179
189
|
return {
|
180
190
|
rowProps: {
|
181
|
-
activeIndex,
|
182
|
-
setActiveIndex,
|
183
|
-
onRowClick,
|
184
|
-
rowClassName,
|
185
|
-
rowExpansionRenderer,
|
186
|
-
rowHeight,
|
187
|
-
inlineEditingUniqueId
|
191
|
+
activeIndex: activeIndex,
|
192
|
+
setActiveIndex: setActiveIndex,
|
193
|
+
onRowClick: onRowClick,
|
194
|
+
rowClassName: rowClassName,
|
195
|
+
rowExpansionRenderer: rowExpansionRenderer,
|
196
|
+
rowHeight: rowHeight,
|
197
|
+
inlineEditingUniqueId: inlineEditingUniqueId
|
188
198
|
},
|
189
|
-
tableProps: {
|
190
|
-
|
191
|
-
headerGroups,
|
199
|
+
tableProps: _extends({}, otherProps, {
|
200
|
+
headerGroups: headerGroups,
|
192
201
|
onFocus: handleFocus,
|
193
202
|
onKeyDown: handleKeyDown,
|
194
203
|
tabIndex: (_otherProps$tabIndex = otherProps.tabIndex) !== null && _otherProps$tabIndex !== void 0 ? _otherProps$tabIndex : 0
|
195
|
-
},
|
196
|
-
state,
|
204
|
+
}),
|
205
|
+
state: state,
|
197
206
|
pagination: !disablePagination ? {
|
198
207
|
length: manualPagination && length ? length : data.length,
|
199
208
|
pageIndex: state.pageIndex,
|
@@ -202,7 +211,7 @@ const useTable = (props, ref) => {
|
|
202
211
|
setPageSize: setPageSize
|
203
212
|
} : null,
|
204
213
|
rows: visibleRows,
|
205
|
-
prepareRow,
|
214
|
+
prepareRow: prepareRow,
|
206
215
|
instance: sanitizedInstance
|
207
216
|
};
|
208
217
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTable.js","sources":["../../../../../../../../src/components/Table/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useTable as useReactTable, useExpanded, useSortBy, usePagination, useRowState } from 'react-table';\nimport { getColumnsFromChildren, getInternalSortRules } from '../util';\nimport { sortTypes } from '../util/sortTypes';\nimport { useRowEditing } from './plugins/useRowEditing';\nimport { useRowActions } from './plugins/useRowActions';\nimport { useRowSelect } from './plugins/useRowSelect';\nimport {\n InternalTable,\n InternalTableRow,\n PaginationHandler,\n RowActiveHandler,\n SortHandler,\n LegacyTableProps,\n LegacyTableRef,\n} from '../types';\nimport { useTableKeyboardNavigation } from './useTableKeyboardNavigation';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useRowDraggable } from './plugins/useRowDraggable';\nimport { sanitizeRowProps } from '../util';\n\nconst useTableRowActive = (\n activeIndex: number | undefined,\n rows: InternalTableRow[],\n rowExpansionRenderer: LegacyTableProps<any>['rowExpansionRenderer'],\n handleonRowActive: RowActiveHandler<any> | undefined\n) => {\n React.useEffect(() => {\n if (activeIndex !== undefined && rows.length && handleonRowActive) {\n const focusedRow = rows[activeIndex];\n if (focusedRow) {\n const sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);\n handleonRowActive(sanitizedFocusedRow);\n }\n }\n }, [activeIndex, rows]);\n};\n\nconst useTableInstance = (instance: any, ref: React.RefObject<LegacyTableRef>): object => {\n const sanitizedInstance = React.useMemo(\n () => ({\n toggleAllRowsExpanded: instance.toggleAllRowsExpanded,\n toggleHideAllColumns: instance.toggleHideAllColumns,\n toggleHideColumn: instance.toggleHideColumn,\n toggleEditing: instance.toggleEditing,\n toggleRowEditing: instance.toggleRowEditing,\n resetRowEditing: instance.resetRowEditing,\n toggleRowExpanded: instance.toggleRowExpanded,\n toggleSortBy: instance.toggleSortBy,\n }),\n []\n );\n\n React.useEffect(() => {\n if (ref?.current) {\n ref.current.instance = sanitizedInstance;\n }\n }, [ref]);\n\n return sanitizedInstance;\n};\n\nconst useTablePaginationListener = (disablePagination: boolean, onPaginate: PaginationHandler | undefined, state: any): void => {\n React.useEffect(() => {\n if (!disablePagination && onPaginate) {\n onPaginate(state.pageIndex, state.pageSize);\n }\n }, [state.pageIndex, state.pageSize]);\n};\n\nconst useTableSortingListener = (\n data: any[],\n sortedRows: any[],\n onSort: SortHandler<any> | undefined,\n manualSorting: boolean,\n state: any\n): void => {\n React.useEffect(() => {\n if (onSort) {\n const sortRules = state.sortBy.map((rule: any) => ({ accessor: rule.id, desc: rule.desc }));\n\n if (manualSorting) {\n onSort(sortRules);\n } else {\n let sortedData;\n\n if (sortRules.length && sortedRows?.length) {\n sortedData = sortedRows.map((row: any) => row.original);\n }\n\n onSort(sortRules, sortedData || data);\n }\n }\n }, [onSort && JSON.stringify(state.sortBy), manualSorting]);\n};\n\nconst DEFAULT_PAGE_SIZE = 10;\n\nexport const useTable = <T extends {}>(\n props: LegacyTableProps<T> & { windowed?: boolean },\n ref: React.RefObject<LegacyTableRef>\n): InternalTable => {\n const {\n children,\n data,\n dangerouslyHijackGlobalKeyboardNavigation: _,\n onRowClick,\n onRowDrag,\n onSelectedRows,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n selectedRows,\n\n // sorting\n disableSorting,\n manualSorting,\n onSort,\n sortRules,\n\n //index\n activeIndex: _1,\n defaultActiveIndex: _2,\n onChangeActiveIndex: _3,\n\n // pagination\n disablePagination = true,\n length,\n onPaginate,\n pageSize = DEFAULT_PAGE_SIZE,\n pageIndex = 0,\n\n // row editing\n inlineEditingUniqueId = undefined,\n onRowCreate,\n\n // actions\n actions,\n onRowEdit,\n onRowCopy,\n onRowDelete,\n onRowActive,\n\n windowed = false,\n\n ...otherProps\n } = props;\n\n if ((onSelectedRows && !selectedRows) || (!onSelectedRows && selectedRows)) {\n throw new Error(\n 'Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection'\n );\n }\n\n const { texts, locale } = useLocalization();\n const { columns, sortRules: defaultSortRules } = React.useMemo(\n () => getColumnsFromChildren(children, rowExpansionRenderer),\n [children, rowExpansionRenderer]\n );\n\n const manualPagination = !disablePagination && !!onPaginate && !!length;\n\n const {\n headerGroups,\n rows,\n sortedRows,\n prepareRow: prepareBaseRow,\n state,\n // pagination\n page,\n gotoPage,\n setPageSize,\n ...instance\n }: any = useReactTable(\n {\n columns,\n data,\n initialState: {\n // @ts-expect-error: not sure how to type this correctly right now\n sortBy: getInternalSortRules(sortRules) || defaultSortRules,\n pageSize: !disablePagination ? pageSize : undefined,\n pageIndex: !disablePagination ? pageIndex : undefined,\n },\n manualPagination,\n pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,\n manualSortBy: manualSorting,\n disableSortBy: disableSorting,\n // most of these resets preventions are needed for editing mode\n autoResetExpanded: false,\n autoResetSelectedRows: false,\n autoResetSortBy: false,\n autoResetPage: false,\n sortTypes: React.useMemo(() => sortTypes(locale), []),\n useControlledState: currentState => {\n return React.useMemo(\n () => ({\n ...currentState,\n selectedRowIds: selectedRows || [],\n }),\n [currentState, selectedRows]\n );\n },\n },\n useRowState,\n useSortBy,\n useExpanded,\n usePagination,\n useRowSelect(onSelectedRows),\n useRowDraggable(onRowDrag),\n useRowEditing(inlineEditingUniqueId),\n useRowActions(\n inlineEditingUniqueId,\n { onRowCreate, onRowEdit, onRowCopy, onRowDelete },\n actions,\n rowExpansionRenderer,\n texts,\n windowed\n )\n );\n\n useTablePaginationListener(disablePagination, onPaginate, state);\n useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);\n\n const sanitizedInstance = useTableInstance(instance, ref);\n\n const visibleRows = !disablePagination && !manualPagination ? page : rows;\n\n const [activeIndex, setActiveIndex, handleKeyDown, handleFocus] = useTableKeyboardNavigation<T>(\n props,\n visibleRows,\n { onRowClick, onRowCreate, onRowEdit, onRowCopy, onRowDelete, rowExpansionRenderer },\n ref\n );\n\n useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);\n\n const prepareRow = React.useCallback(\n (row: any, index: number) => {\n prepareBaseRow(row);\n row.setActive = () => setActiveIndex(index);\n },\n [prepareBaseRow, setActiveIndex]\n );\n\n return {\n rowProps: {\n activeIndex,\n setActiveIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n inlineEditingUniqueId,\n },\n tableProps: {\n ...otherProps,\n headerGroups,\n onFocus: handleFocus,\n onKeyDown: handleKeyDown,\n tabIndex: otherProps.tabIndex ?? 0,\n },\n state,\n pagination: !disablePagination\n ? {\n length: manualPagination && length ? length : data.length,\n pageIndex: state.pageIndex,\n pageSize: state.pageSize,\n setPageIndex: gotoPage,\n setPageSize: setPageSize,\n }\n : null,\n rows: visibleRows,\n prepareRow,\n instance: sanitizedInstance,\n };\n};\n"],"names":["useTableRowActive","activeIndex","rows","rowExpansionRenderer","handleonRowActive","React","useEffect","undefined","length","focusedRow","sanitizedFocusedRow","sanitizeRowProps","useTableInstance","instance","ref","sanitizedInstance","useMemo","toggleAllRowsExpanded","toggleHideAllColumns","toggleHideColumn","toggleEditing","toggleRowEditing","resetRowEditing","toggleRowExpanded","toggleSortBy","current","useTablePaginationListener","disablePagination","onPaginate","state","pageIndex","pageSize","useTableSortingListener","data","sortedRows","onSort","manualSorting","sortRules","sortBy","map","rule","accessor","id","desc","sortedData","row","original","JSON","stringify","DEFAULT_PAGE_SIZE","useTable","props","children","dangerouslyHijackGlobalKeyboardNavigation","_","onRowClick","onRowDrag","onSelectedRows","rowClassName","rowHeight","selectedRows","disableSorting","_1","defaultActiveIndex","_2","onChangeActiveIndex","_3","inlineEditingUniqueId","onRowCreate","actions","onRowEdit","onRowCopy","onRowDelete","onRowActive","windowed","otherProps","Error","texts","locale","useLocalization","columns","defaultSortRules","getColumnsFromChildren","manualPagination","headerGroups","prepareRow","prepareBaseRow","page","gotoPage","setPageSize","useReactTable","initialState","getInternalSortRules","pageCount","Math","ceil","manualSortBy","disableSortBy","autoResetExpanded","autoResetSelectedRows","autoResetSortBy","autoResetPage","sortTypes","useControlledState","currentState","selectedRowIds","useRowState","useSortBy","useExpanded","usePagination","useRowSelect","useRowDraggable","useRowEditing","useRowActions","visibleRows","setActiveIndex","handleKeyDown","handleFocus","useTableKeyboardNavigation","useCallback","index","setActive","rowProps","tableProps","onFocus","onKeyDown","tabIndex","_otherProps$tabIndex","pagination","setPageIndex"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,iBAAiB,GAAGA,CACtBC,WAA+B,EAC/BC,IAAwB,EACxBC,oBAAmE,EACnEC,iBAAoD;EAEpDC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIL,WAAW,KAAKM,SAAS,IAAIL,IAAI,CAACM,MAAM,IAAIJ,iBAAiB,EAAE;MAC/D,MAAMK,UAAU,GAAGP,IAAI,CAACD,WAAW,CAAC;MACpC,IAAIQ,UAAU,EAAE;QACZ,MAAMC,mBAAmB,GAAGC,gBAAgB,CAACF,UAAU,EAAEN,oBAAoB,CAAC;QAC9EC,iBAAiB,CAACM,mBAAmB,CAAC;;;GAGjD,EAAE,CAACT,WAAW,EAAEC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAMU,gBAAgB,GAAGA,CAACC,QAAa,EAAEC,GAAoC;EACzE,MAAMC,iBAAiB,GAAGV,cAAK,CAACW,OAAO,CACnC,OAAO;IACHC,qBAAqB,EAAEJ,QAAQ,CAACI,qBAAqB;IACrDC,oBAAoB,EAAEL,QAAQ,CAACK,oBAAoB;IACnDC,gBAAgB,EAAEN,QAAQ,CAACM,gBAAgB;IAC3CC,aAAa,EAAEP,QAAQ,CAACO,aAAa;IACrCC,gBAAgB,EAAER,QAAQ,CAACQ,gBAAgB;IAC3CC,eAAe,EAAET,QAAQ,CAACS,eAAe;IACzCC,iBAAiB,EAAEV,QAAQ,CAACU,iBAAiB;IAC7CC,YAAY,EAAEX,QAAQ,CAACW;GAC1B,CAAC,EACF,EAAE,CACL;EA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AAA,oBAAA,GAAI;KACpC;IACDlG,KAAK;IACLmG,UAAU,EAAE,CAACrG,iBAAiB,GACxB;MACInB,MAAM,EAAE2E,gBAAgB,IAAI3E,MAAM,GAAGA,MAAM,GAAGyB,IAAI,CAACzB,MAAM;MACzDsB,SAAS,EAAED,KAAK,CAACC,SAAS;MAC1BC,QAAQ,EAAEF,KAAK,CAACE,QAAQ;MACxBkG,YAAY,EAAEzC,QAAQ;MACtBC,WAAW,EAAEA;KAChB,GACD,IAAI;IACVvF,IAAI,EAAEgH,WAAW;IACjB7B,UAAU;IACVxE,QAAQ,EAAEE;GACb;AACL;;;;"}
|
1
|
+
{"version":3,"file":"useTable.js","sources":["../../../../../../../../src/components/Table/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useTable as useReactTable, useExpanded, useSortBy, usePagination, useRowState } from 'react-table';\nimport { getColumnsFromChildren, getInternalSortRules } from '../util';\nimport { sortTypes } from '../util/sortTypes';\nimport { useRowEditing } from './plugins/useRowEditing';\nimport { useRowActions } from './plugins/useRowActions';\nimport { useRowSelect } from './plugins/useRowSelect';\nimport {\n InternalTable,\n InternalTableRow,\n PaginationHandler,\n RowActiveHandler,\n SortHandler,\n LegacyTableProps,\n LegacyTableRef,\n} from '../types';\nimport { useTableKeyboardNavigation } from './useTableKeyboardNavigation';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useRowDraggable } from './plugins/useRowDraggable';\nimport { sanitizeRowProps } from '../util';\n\nconst useTableRowActive = (\n activeIndex: number | undefined,\n rows: InternalTableRow[],\n rowExpansionRenderer: LegacyTableProps<any>['rowExpansionRenderer'],\n handleonRowActive: RowActiveHandler<any> | undefined\n) => {\n React.useEffect(() => {\n if (activeIndex !== undefined && rows.length && handleonRowActive) {\n const focusedRow = rows[activeIndex];\n if (focusedRow) {\n const sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);\n handleonRowActive(sanitizedFocusedRow);\n }\n }\n }, [activeIndex, rows]);\n};\n\nconst useTableInstance = (instance: any, ref: React.RefObject<LegacyTableRef>): object => {\n const sanitizedInstance = React.useMemo(\n () => ({\n toggleAllRowsExpanded: instance.toggleAllRowsExpanded,\n toggleHideAllColumns: instance.toggleHideAllColumns,\n toggleHideColumn: instance.toggleHideColumn,\n toggleEditing: instance.toggleEditing,\n toggleRowEditing: instance.toggleRowEditing,\n resetRowEditing: instance.resetRowEditing,\n toggleRowExpanded: instance.toggleRowExpanded,\n toggleSortBy: instance.toggleSortBy,\n }),\n []\n );\n\n React.useEffect(() => {\n if (ref?.current) {\n ref.current.instance = sanitizedInstance;\n }\n }, [ref]);\n\n return sanitizedInstance;\n};\n\nconst useTablePaginationListener = (disablePagination: boolean, onPaginate: PaginationHandler | undefined, state: any): void => {\n React.useEffect(() => {\n if (!disablePagination && onPaginate) {\n onPaginate(state.pageIndex, state.pageSize);\n }\n }, [state.pageIndex, state.pageSize]);\n};\n\nconst useTableSortingListener = (\n data: any[],\n sortedRows: any[],\n onSort: SortHandler<any> | undefined,\n manualSorting: boolean,\n state: any\n): void => {\n React.useEffect(() => {\n if (onSort) {\n const sortRules = state.sortBy.map((rule: any) => ({ accessor: rule.id, desc: rule.desc }));\n\n if (manualSorting) {\n onSort(sortRules);\n } else {\n let sortedData;\n\n if (sortRules.length && sortedRows?.length) {\n sortedData = sortedRows.map((row: any) => row.original);\n }\n\n onSort(sortRules, sortedData || data);\n }\n }\n }, [onSort && JSON.stringify(state.sortBy), manualSorting]);\n};\n\nconst DEFAULT_PAGE_SIZE = 10;\n\nexport const useTable = <T extends {}>(\n props: LegacyTableProps<T> & { windowed?: boolean },\n ref: React.RefObject<LegacyTableRef>\n): InternalTable => {\n const {\n children,\n data,\n dangerouslyHijackGlobalKeyboardNavigation: _,\n onRowClick,\n onRowDrag,\n onSelectedRows,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n selectedRows,\n\n // sorting\n disableSorting,\n manualSorting,\n onSort,\n sortRules,\n\n //index\n activeIndex: _1,\n defaultActiveIndex: _2,\n onChangeActiveIndex: _3,\n\n // pagination\n disablePagination = true,\n length,\n onPaginate,\n pageSize = DEFAULT_PAGE_SIZE,\n pageIndex = 0,\n\n // row editing\n inlineEditingUniqueId = undefined,\n onRowCreate,\n\n // actions\n actions,\n onRowEdit,\n onRowCopy,\n onRowDelete,\n onRowActive,\n\n windowed = false,\n\n ...otherProps\n } = props;\n\n if ((onSelectedRows && !selectedRows) || (!onSelectedRows && selectedRows)) {\n throw new Error(\n 'Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection'\n );\n }\n\n const { texts, locale } = useLocalization();\n const { columns, sortRules: defaultSortRules } = React.useMemo(\n () => getColumnsFromChildren(children, rowExpansionRenderer),\n [children, rowExpansionRenderer]\n );\n\n const manualPagination = !disablePagination && !!onPaginate && !!length;\n\n const {\n headerGroups,\n rows,\n sortedRows,\n prepareRow: prepareBaseRow,\n state,\n // pagination\n page,\n gotoPage,\n setPageSize,\n ...instance\n }: any = useReactTable(\n {\n columns,\n data,\n initialState: {\n // @ts-expect-error: not sure how to type this correctly right now\n sortBy: getInternalSortRules(sortRules) || defaultSortRules,\n pageSize: !disablePagination ? pageSize : undefined,\n pageIndex: !disablePagination ? pageIndex : undefined,\n },\n manualPagination,\n pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,\n manualSortBy: manualSorting,\n disableSortBy: disableSorting,\n // most of these resets preventions are needed for editing mode\n autoResetExpanded: false,\n autoResetSelectedRows: false,\n autoResetSortBy: false,\n autoResetPage: false,\n sortTypes: React.useMemo(() => sortTypes(locale), []),\n useControlledState: currentState => {\n return React.useMemo(\n () => ({\n ...currentState,\n selectedRowIds: selectedRows || [],\n }),\n [currentState, selectedRows]\n );\n },\n },\n useRowState,\n useSortBy,\n useExpanded,\n usePagination,\n useRowSelect(onSelectedRows),\n useRowDraggable(onRowDrag),\n useRowEditing(inlineEditingUniqueId),\n useRowActions(\n inlineEditingUniqueId,\n { onRowCreate, onRowEdit, onRowCopy, onRowDelete },\n actions,\n rowExpansionRenderer,\n texts,\n windowed\n )\n );\n\n useTablePaginationListener(disablePagination, onPaginate, state);\n useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);\n\n const sanitizedInstance = useTableInstance(instance, ref);\n\n const visibleRows = !disablePagination && !manualPagination ? page : rows;\n\n const [activeIndex, setActiveIndex, handleKeyDown, handleFocus] = useTableKeyboardNavigation<T>(\n props,\n visibleRows,\n { onRowClick, onRowCreate, onRowEdit, onRowCopy, onRowDelete, rowExpansionRenderer },\n ref\n );\n\n useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);\n\n const prepareRow = React.useCallback(\n (row: any, index: number) => {\n prepareBaseRow(row);\n row.setActive = () => setActiveIndex(index);\n },\n [prepareBaseRow, setActiveIndex]\n );\n\n return {\n rowProps: {\n activeIndex,\n setActiveIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n inlineEditingUniqueId,\n },\n tableProps: {\n ...otherProps,\n headerGroups,\n onFocus: handleFocus,\n onKeyDown: handleKeyDown,\n tabIndex: otherProps.tabIndex ?? 0,\n },\n state,\n pagination: !disablePagination\n ? {\n length: manualPagination && length ? length : data.length,\n pageIndex: state.pageIndex,\n pageSize: state.pageSize,\n setPageIndex: gotoPage,\n setPageSize: setPageSize,\n }\n : null,\n rows: visibleRows,\n prepareRow,\n instance: sanitizedInstance,\n };\n};\n"],"names":["useTableRowActive","activeIndex","rows","rowExpansionRenderer","handleonRowActive","React","useEffect","undefined","length","focusedRow","sanitizedFocusedRow","sanitizeRowProps","useTableInstance","instance","ref","sanitizedInstance","useMemo","toggleAllRowsExpanded","toggleHideAllColumns","toggleHideColumn","toggleEditing","toggleRowEditing","resetRowEditing","toggleRowExpanded","toggleSortBy","current","useTablePaginationListener","disablePagination","onPaginate","state","pageIndex","pageSize","useTableSortingListener","data","sortedRows","onSort","manualSorting","sortRules","sortBy","map","rule","accessor","id","desc","sortedData","row","original","JSON","stringify","DEFAULT_PAGE_SIZE","useTable","props","children","onRowClick","onRowDrag","onSelectedRows","rowClassName","rowHeight","selectedRows","disableSorting","_props$disablePaginat","_props$pageSize","_props$pageIndex","_props$inlineEditingU","inlineEditingUniqueId","onRowCreate","actions","onRowEdit","onRowCopy","onRowDelete","onRowActive","_props$windowed","windowed","otherProps","_objectWithoutPropertiesLoose","_excluded","Error","_useLocalization","useLocalization","texts","locale","_React$useMemo","getColumnsFromChildren","columns","defaultSortRules","manualPagination","_useReactTable","useReactTable","initialState","getInternalSortRules","pageCount","Math","ceil","manualSortBy","disableSortBy","autoResetExpanded","autoResetSelectedRows","autoResetSortBy","autoResetPage","sortTypes","useControlledState","currentState","_extends","selectedRowIds","useRowState","useSortBy","useExpanded","usePagination","useRowSelect","useRowDraggable","useRowEditing","useRowActions","headerGroups","prepareBaseRow","prepareRow","page","gotoPage","setPageSize","_excluded2","visibleRows","_useTableKeyboardNavi","useTableKeyboardNavigation","setActiveIndex","handleKeyDown","handleFocus","useCallback","index","setActive","rowProps","tableProps","onFocus","onKeyDown","tabIndex","_otherProps$tabIndex","pagination","setPageIndex"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CACnBC,WAA+B,EAC/BC,IAAwB,EACxBC,oBAAmE,EACnEC,iBAAoD;EAEpDC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIL,WAAW,KAAKM,SAAS,IAAIL,IAAI,CAACM,MAAM,IAAIJ,iBAAiB,EAAE;MAC/D,IAAMK,UAAU,GAAGP,IAAI,CAACD,WAAW,CAAC;MACpC,IAAIQ,UAAU,EAAE;QACZ,IAAMC,mBAAmB,GAAGC,gBAAgB,CAACF,UAAU,EAAEN,oBAAoB,CAAC;QAC9EC,iBAAiB,CAACM,mBAAmB,CAAC;;;GAGjD,EAAE,CAACT,WAAW,EAAEC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,IAAMU,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,QAA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B,GACD,IAAI;IACVnH,IAAI,EAAEqH,WAAW;IACjBL,UAAU,EAAVA,UAAU;IACVrG,QAAQ,EAAEE;GACb;AACL;;;;"}
|
@@ -3,21 +3,23 @@ import { getNextIndexFromKey } from '../../../utils/hooks/useListKeyboardNavigat
|
|
3
3
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
4
4
|
import { sanitizeRowProps } from '../util.js';
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
var useTableKeyboardNavigation = function useTableKeyboardNavigation(props, rows, rowProps, ref) {
|
7
|
+
var useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;
|
8
|
+
var _useControllableState = useControllableState({
|
9
|
+
prop: props.activeIndex,
|
10
|
+
defaultProp: props.defaultActiveIndex !== undefined ? props.defaultActiveIndex : useGlobalKeyboardNavigation ? 0 : undefined,
|
11
|
+
onChange: function onChange(index) {
|
12
|
+
if (index !== undefined) {
|
13
|
+
var _props$onChangeActive;
|
14
|
+
(_props$onChangeActive = props.onChangeActiveIndex) === null || _props$onChangeActive === void 0 ? void 0 : _props$onChangeActive.call(props, index);
|
15
|
+
}
|
15
16
|
}
|
16
|
-
}
|
17
|
-
|
18
|
-
|
17
|
+
}),
|
18
|
+
activeIndex = _useControllableState[0],
|
19
|
+
setActiveIndex = _useControllableState[1];
|
20
|
+
var onKeyDown = function onKeyDown(event) {
|
19
21
|
var _document$activeEleme, _document$activeEleme2;
|
20
|
-
|
22
|
+
var isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;
|
21
23
|
if (useGlobalKeyboardNavigation && document.activeElement !== ref.current && ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('type')) !== 'search' && document.activeElement !== document.body && ((_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 ? void 0 : _document$activeEleme2.getAttribute('role')) !== 'dialog') {
|
22
24
|
return;
|
23
25
|
}
|
@@ -26,9 +28,9 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
|
26
28
|
return;
|
27
29
|
}
|
28
30
|
if (activeIndex !== undefined) {
|
29
|
-
|
31
|
+
var currentRow = rows[activeIndex];
|
30
32
|
if (currentRow) {
|
31
|
-
|
33
|
+
var sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);
|
32
34
|
if (rowProps.onRowClick && event.key === 'Enter') {
|
33
35
|
event.preventDefault();
|
34
36
|
rowProps.onRowClick(sanitizedRow);
|
@@ -85,28 +87,28 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
|
|
85
87
|
}
|
86
88
|
}
|
87
89
|
}
|
88
|
-
|
90
|
+
var nextIndex = getNextIndexFromKey(event.key, rows.length, activeIndex);
|
89
91
|
if (nextIndex !== undefined) {
|
90
92
|
event.preventDefault();
|
91
93
|
setActiveIndex(nextIndex);
|
92
94
|
}
|
93
95
|
};
|
94
|
-
|
96
|
+
var handleKeyDown = function handleKeyDown(event) {
|
95
97
|
if (!useGlobalKeyboardNavigation) {
|
96
98
|
onKeyDown(event.nativeEvent);
|
97
99
|
}
|
98
100
|
};
|
99
|
-
React__default.useEffect(()
|
101
|
+
React__default.useEffect(function () {
|
100
102
|
if (useGlobalKeyboardNavigation) {
|
101
103
|
window.addEventListener('keydown', onKeyDown);
|
102
104
|
}
|
103
|
-
return ()
|
105
|
+
return function () {
|
104
106
|
if (useGlobalKeyboardNavigation) {
|
105
107
|
window.removeEventListener('keydown', onKeyDown);
|
106
108
|
}
|
107
109
|
};
|
108
110
|
}, [onKeyDown]);
|
109
|
-
|
111
|
+
var handleFocus = function handleFocus() {
|
110
112
|
if (activeIndex === undefined && rows.length) {
|
111
113
|
setActiveIndex(0);
|
112
114
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTableKeyboardNavigation.js","sources":["../../../../../../../../src/components/Table/hooks/useTableKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { getNextIndexFromKey } from '../../../utils/hooks/useListKeyboardNavigation';\nimport { sanitizeRowProps } from '../util';\nimport { LegacyTableProps } from '../types';\n\nexport const useTableKeyboardNavigation = <T extends {}>(\n props: LegacyTableProps<T>,\n rows: any[],\n rowProps: any,\n ref: React.RefObject<HTMLDivElement>\n): [\n number | undefined,\n (index: number) => void,\n (event: React.KeyboardEvent<HTMLElement>) => void,\n (event: React.FocusEvent<HTMLElement>) => void\n] => {\n const useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;\n\n const [activeIndex, setActiveIndex] = useControllableState<number | undefined>({\n prop: props.activeIndex,\n defaultProp:\n props.defaultActiveIndex !== undefined ? props.defaultActiveIndex : useGlobalKeyboardNavigation ? 0 : undefined,\n onChange: index => {\n if (index !== undefined) {\n props.onChangeActiveIndex?.(index);\n }\n },\n });\n\n const onKeyDown = (event: KeyboardEvent): void => {\n const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;\n\n if (\n useGlobalKeyboardNavigation &&\n document.activeElement !== ref.current &&\n document.activeElement?.getAttribute('type') !== 'search' &&\n document.activeElement !== document.body &&\n document.activeElement?.getAttribute('role') !== 'dialog'\n ) {\n return;\n }\n // abort key handling if other elements inside table are focused and we don't use global keyboard navigation\n if (!useGlobalKeyboardNavigation && document.activeElement !== ref.current) {\n return;\n }\n\n if (activeIndex !== undefined) {\n const currentRow = rows[activeIndex];\n\n if (currentRow) {\n const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);\n\n if (rowProps.onRowClick && event.key === 'Enter') {\n event.preventDefault();\n rowProps.onRowClick(sanitizedRow);\n return;\n }\n\n if (currentRow.toggleRowSelected && event.key === ' ') {\n event.preventDefault();\n currentRow.toggleRowSelected();\n return;\n }\n\n if (currentRow.toggleRowExpanded) {\n if (currentRow.isExpanded && event.key === 'ArrowLeft') {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n } else if (!currentRow.isExpanded && event.key === 'ArrowRight') {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n }\n }\n\n // inline editing\n if (currentRow.toggleRowEditing) {\n if (currentRow.canEdit && !currentRow.isEditing) {\n if (rowProps.onRowCreate && event.shiftKey && event.key === 'n') {\n event.preventDefault();\n\n if (!currentRow.isExpanded) {\n currentRow.toggleRowExpanded();\n }\n\n rowProps.onRowCreate(sanitizedRow, event);\n return;\n }\n\n if (event.key === 'e') {\n event.preventDefault();\n currentRow.toggleRowEditing();\n return;\n }\n }\n }\n\n if (rowProps.onRowEdit && event.key === 'e' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowEdit(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowCopy && event.key === 'c' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowCopy(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowDelete && event.key === 'Delete' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowDelete(sanitizedRow, event);\n return;\n }\n }\n }\n\n const nextIndex = getNextIndexFromKey(event.key, rows.length, activeIndex);\n\n if (nextIndex !== undefined) {\n event.preventDefault();\n setActiveIndex(nextIndex);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n if (!useGlobalKeyboardNavigation) {\n onKeyDown(event.nativeEvent);\n }\n };\n\n React.useEffect(() => {\n if (useGlobalKeyboardNavigation) {\n window.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n if (useGlobalKeyboardNavigation) {\n window.removeEventListener('keydown', onKeyDown);\n }\n };\n }, [onKeyDown]);\n\n const handleFocus = (): void => {\n if (activeIndex === undefined && rows.length) {\n setActiveIndex(0);\n }\n };\n\n return [activeIndex, setActiveIndex, handleKeyDown, handleFocus];\n};\n"],"names":["useTableKeyboardNavigation","props","rows","rowProps","ref","useGlobalKeyboardNavigation","dangerouslyHijackGlobalKeyboardNavigation","activeIndex","setActiveIndex","useControllableState","prop","defaultProp","defaultActiveIndex","undefined","onChange","index","_props$onChangeActive","onChangeActiveIndex","call","onKeyDown","event","isModifierKeyPressed","metaKey","ctrlKey","altKey","shiftKey","document","activeElement","current","_document$activeEleme","getAttribute","body","_document$activeEleme2","currentRow","sanitizedRow","sanitizeRowProps","rowExpansionRenderer","onRowClick","key","preventDefault","toggleRowSelected","toggleRowExpanded","isExpanded","toggleRowEditing","canEdit","isEditing","onRowCreate","onRowEdit","onRowCopy","onRowDelete","nextIndex","getNextIndexFromKey","length","handleKeyDown","nativeEvent","React","useEffect","window","addEventListener","removeEventListener","handleFocus"],"mappings":";;;;;MAMaA,0BAA0B,GAAGA,CACtCC,KAA0B,EAC1BC,IAAW,EACXC,QAAa,EACbC,GAAoC;EAOpC,MAAMC,2BAA2B,GAAGJ,KAAK,CAACK,yCAAyC;EAEnF,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,oBAAoB,CAAqB;IAC3EC,IAAI,EAAET,KAAK,CAACM,WAAW;IACvBI,WAAW,EACPV,KAAK,CAACW,kBAAkB,KAAKC,SAAS,GAAGZ,KAAK,CAACW,kBAAkB,GAAGP,2BAA2B,GAAG,CAAC,GAAGQ,SAAS;IACnHC,QAAQ,EAAEC,KAAK;MACX,IAAIA,KAAK,KAAKF,SAAS,EAAE;QAAA,IAAAG,qBAAA;QACrB,CAAAA,qBAAA,GAAAf,KAAK,CAACgB,mBAAmB,cAAAD,qBAAA,uBAAzBA,qBAAA,CAAAE,IAAA,CAAAjB,KAAK,EAAuBc,KAAK,CAAC;;;GAG7C,CAAC;EAEF,MAAMI,SAAS,GAAIC,KAAoB;;IACnC,MAAMC,oBAAoB,GAAGD,KAAK,CAACE,OAAO,IAAIF,KAAK,CAACG,OAAO,IAAIH,KAAK,CAACI,MAAM,IAAIJ,KAAK,CAACK,QAAQ;IAE7F,IACIpB,2BAA2B,IAC3BqB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W,CAACf,YAAY,EAAEd,KAAK,CAAC;UACzC;;;;IAKZ,MAAM8B,SAAS,GAAGC,mBAAmB,CAAC/B,KAAK,CAACkB,GAAG,EAAEpC,IAAI,CAACkD,MAAM,EAAE7C,WAAW,CAAC;IAE1E,IAAI2C,SAAS,KAAKrC,SAAS,EAAE;MACzBO,KAAK,CAACmB,cAAc,EAAE;MACtB/B,cAAc,CAAC0C,SAAS,CAAC;;GAEhC;EAED,MAAMG,aAAa,GAAIjC,KAAuC;IAC1D,IAAI,CAACf,2BAA2B,EAAE;MAC9Bc,SAAS,CAACC,KAAK,CAACkC,WAAW,CAAC;;GAEnC;EAEDC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAInD,2BAA2B,EAAE;MAC7BoD,MAAM,CAACC,gBAAgB,CAAC,SAAS,EAAEvC,SAAS,CAAC;;IAGjD,OAAO;MACH,IAAId,2BAA2B,EAAE;QAC7BoD,MAAM,CAACE,mBAAmB,CAAC,SAAS,EAAExC,SAAS,CAAC;;KAEvD;GACJ,EAAE,CAACA,SAAS,CAAC,CAAC;EAEf,MAAMyC,WAAW,GAAGA;IAChB,IAAIrD,WAAW,KAAKM,SAAS,IAAIX,IAAI,CAACkD,MAAM,EAAE;MAC1C5C,cAAc,CAAC,CAAC,CAAC;;GAExB;EAED,OAAO,CAACD,WAAW,EAAEC,cAAc,EAAE6C,aAAa,EAAEO,WAAW,CAAC;AACpE;;;;"}
|
1
|
+
{"version":3,"file":"useTableKeyboardNavigation.js","sources":["../../../../../../../../src/components/Table/hooks/useTableKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { getNextIndexFromKey } from '../../../utils/hooks/useListKeyboardNavigation';\nimport { sanitizeRowProps } from '../util';\nimport { LegacyTableProps } from '../types';\n\nexport const useTableKeyboardNavigation = <T extends {}>(\n props: LegacyTableProps<T>,\n rows: any[],\n rowProps: any,\n ref: React.RefObject<HTMLDivElement>\n): [\n number | undefined,\n (index: number) => void,\n (event: React.KeyboardEvent<HTMLElement>) => void,\n (event: React.FocusEvent<HTMLElement>) => void\n] => {\n const useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;\n\n const [activeIndex, setActiveIndex] = useControllableState<number | undefined>({\n prop: props.activeIndex,\n defaultProp:\n props.defaultActiveIndex !== undefined ? props.defaultActiveIndex : useGlobalKeyboardNavigation ? 0 : undefined,\n onChange: index => {\n if (index !== undefined) {\n props.onChangeActiveIndex?.(index);\n }\n },\n });\n\n const onKeyDown = (event: KeyboardEvent): void => {\n const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;\n\n if (\n useGlobalKeyboardNavigation &&\n document.activeElement !== ref.current &&\n document.activeElement?.getAttribute('type') !== 'search' &&\n document.activeElement !== document.body &&\n document.activeElement?.getAttribute('role') !== 'dialog'\n ) {\n return;\n }\n // abort key handling if other elements inside table are focused and we don't use global keyboard navigation\n if (!useGlobalKeyboardNavigation && document.activeElement !== ref.current) {\n return;\n }\n\n if (activeIndex !== undefined) {\n const currentRow = rows[activeIndex];\n\n if (currentRow) {\n const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);\n\n if (rowProps.onRowClick && event.key === 'Enter') {\n event.preventDefault();\n rowProps.onRowClick(sanitizedRow);\n return;\n }\n\n if (currentRow.toggleRowSelected && event.key === ' ') {\n event.preventDefault();\n currentRow.toggleRowSelected();\n return;\n }\n\n if (currentRow.toggleRowExpanded) {\n if (currentRow.isExpanded && event.key === 'ArrowLeft') {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n } else if (!currentRow.isExpanded && event.key === 'ArrowRight') {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n }\n }\n\n // inline editing\n if (currentRow.toggleRowEditing) {\n if (currentRow.canEdit && !currentRow.isEditing) {\n if (rowProps.onRowCreate && event.shiftKey && event.key === 'n') {\n event.preventDefault();\n\n if (!currentRow.isExpanded) {\n currentRow.toggleRowExpanded();\n }\n\n rowProps.onRowCreate(sanitizedRow, event);\n return;\n }\n\n if (event.key === 'e') {\n event.preventDefault();\n currentRow.toggleRowEditing();\n return;\n }\n }\n }\n\n if (rowProps.onRowEdit && event.key === 'e' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowEdit(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowCopy && event.key === 'c' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowCopy(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowDelete && event.key === 'Delete' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowDelete(sanitizedRow, event);\n return;\n }\n }\n }\n\n const nextIndex = getNextIndexFromKey(event.key, rows.length, activeIndex);\n\n if (nextIndex !== undefined) {\n event.preventDefault();\n setActiveIndex(nextIndex);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n if (!useGlobalKeyboardNavigation) {\n onKeyDown(event.nativeEvent);\n }\n };\n\n React.useEffect(() => {\n if (useGlobalKeyboardNavigation) {\n window.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n if (useGlobalKeyboardNavigation) {\n window.removeEventListener('keydown', onKeyDown);\n }\n };\n }, [onKeyDown]);\n\n const handleFocus = (): void => {\n if (activeIndex === undefined && rows.length) {\n setActiveIndex(0);\n }\n };\n\n return [activeIndex, setActiveIndex, handleKeyDown, handleFocus];\n};\n"],"names":["useTableKeyboardNavigation","props","rows","rowProps","ref","useGlobalKeyboardNavigation","dangerouslyHijackGlobalKeyboardNavigation","_useControllableState","useControllableState","prop","activeIndex","defaultProp","defaultActiveIndex","undefined","onChange","index","_props$onChangeActive","onChangeActiveIndex","call","setActiveIndex","onKeyDown","event","isModifierKeyPressed","metaKey","ctrlKey","altKey","shiftKey","document","activeElement","current","_document$activeEleme","getAttribute","body","_document$activeEleme2","currentRow","sanitizedRow","sanitizeRowProps","rowExpansionRenderer","onRowClick","key","preventDefault","toggleRowSelected","toggleRowExpanded","isExpanded","toggleRowEditing","canEdit","isEditing","onRowCreate","onRowEdit","onRowCopy","onRowDelete","nextIndex","getNextIndexFromKey","length","handleKeyDown","nativeEvent","React","useEffect","window","addEventListener","removeEventListener","handleFocus"],"mappings":";;;;;IAMaA,0BAA0B,GAAG,SAA7BA,0BAA0BA,CACnCC,KAA0B,EAC1BC,IAAW,EACXC,QAAa,EACbC,GAAoC;EAOpC,IAAMC,2BAA2B,GAAGJ,KAAK,CAACK,yCAAyC;EAEnF,IAAAC,qBAAA,GAAsCC,oBAAoB,CAAqB;MAC3EC,IAAI,EAAER,KAAK,CAACS,WAAW;MACvBC,WAAW,EACPV,KAAK,CAACW,kBAAkB,KAAKC,SAAS,GAAGZ,KAAK,CAACW,kBAAkB,GAAGP,2BAA2B,GAAG,CAAC,GAAGQ,SAAS;MACnHC,QAAQ,EAAE,SAAAA,SAAAC,KAAK;QACX,IAAIA,KAAK,KAAKF,SAAS,EAAE;UAAA,IAAAG,qBAAA;UACrB,CAAAA,qBAAA,GAAAf,KAAK,CAACgB,mBAAmB,cAAAD,qBAAA,uBAAzBA,qBAAA,CAAAE,IAAA,CAAAjB,KAAK,EAAuBc,KAAK,CAAC;;;KAG7C,CAAC;IATKL,WAAW,GAAAH,qBAAA;IAAEY,cAAc,GAAAZ,qBAAA;EAWlC,IAAMa,SAAS,GAAG,SAAZA,SAASA,CAAIC,KAAoB;;IACnC,IAAMC,oBAAoB,GAAGD,KAAK,CAACE,OAAO,IAAIF,KAAK,CAACG,OAAO,IAAIH,KAAK,CAACI,MAAM,IAAIJ,KAAK,CAACK,QAAQ;IAE7F,IACIrB,2BAA2B,IAC3BsB,QAAQ,CAACC,aAAa,KAAKxB,GAAG,CAACyB,OAAO,IACtC,EAAAC,qBAAA,GAAAH,QAAQ,CAACC,aAAa,cAAAE,qBAAA,uBAAtBA,qBAAA,CAAwBC,YAAY,CAAC,MAAM,CAAC,MAAK,QAAQ,IACzDJ,QAAQ,CAACC,aAAa,KAA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Q,KAAK,CAACmB,cAAc,EAAE;MACtBrB,cAAc,CAACgC,SAAS,CAAC;;GAEhC;EAED,IAAMG,aAAa,GAAG,SAAhBA,aAAaA,CAAIjC,KAAuC;IAC1D,IAAI,CAAChB,2BAA2B,EAAE;MAC9Be,SAAS,CAACC,KAAK,CAACkC,WAAW,CAAC;;GAEnC;EAEDC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIpD,2BAA2B,EAAE;MAC7BqD,MAAM,CAACC,gBAAgB,CAAC,SAAS,EAAEvC,SAAS,CAAC;;IAGjD,OAAO;MACH,IAAIf,2BAA2B,EAAE;QAC7BqD,MAAM,CAACE,mBAAmB,CAAC,SAAS,EAAExC,SAAS,CAAC;;KAEvD;GACJ,EAAE,CAACA,SAAS,CAAC,CAAC;EAEf,IAAMyC,WAAW,GAAG,SAAdA,WAAWA;IACb,IAAInD,WAAW,KAAKG,SAAS,IAAIX,IAAI,CAACmD,MAAM,EAAE;MAC1ClC,cAAc,CAAC,CAAC,CAAC;;GAExB;EAED,OAAO,CAACT,WAAW,EAAES,cAAc,EAAEmC,aAAa,EAAEO,WAAW,CAAC;AACpE;;;;"}
|
@@ -1,15 +1,13 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
import cn from 'clsx';
|
3
|
+
import { extends as _extends } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
3
4
|
import { Icon } from '../../Icon/Icon.js';
|
4
5
|
|
5
|
-
|
6
|
-
cell
|
7
|
-
})
|
8
|
-
|
9
|
-
|
10
|
-
...(cell.getSortByToggleProps && cell.getSortByToggleProps({
|
11
|
-
title: undefined
|
12
|
-
})),
|
6
|
+
var Column = function Column(_ref) {
|
7
|
+
var cell = _ref.cell;
|
8
|
+
var props = _extends({}, cell.getHeaderProps(), cell.getSortByToggleProps && cell.getSortByToggleProps({
|
9
|
+
title: undefined
|
10
|
+
}), {
|
13
11
|
className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-700 hover:text-black', cell.className, {
|
14
12
|
'yt-table__cell__group': !!cell.columns,
|
15
13
|
'cursor-pointer': !cell.disableSorting,
|
@@ -17,11 +15,10 @@ const Column = ({
|
|
17
15
|
'justify-end text-right': cell.align === 'right',
|
18
16
|
'justify-center text-center': cell.align === 'center' || !cell.align
|
19
17
|
}),
|
20
|
-
style: {
|
21
|
-
...cell.style,
|
18
|
+
style: _extends({}, cell.style, {
|
22
19
|
flex: cell.flex
|
23
|
-
}
|
24
|
-
};
|
20
|
+
})
|
21
|
+
});
|
25
22
|
if (cell.isSorted) {
|
26
23
|
props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';
|
27
24
|
}
|