@economic/taco 2.19.0 → 2.20.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Provider/Localization.d.ts +18 -0
- package/dist/components/Report/components/Body/Body.d.ts +8 -0
- package/dist/components/Report/components/Cell/Cell.d.ts +3 -0
- package/dist/components/Report/components/Cell/DisplayCell.d.ts +7 -0
- package/dist/components/Report/components/Cell/GroupedCell.d.ts +7 -0
- package/dist/components/Report/components/Cell/util.d.ts +18 -0
- package/dist/components/Report/components/Footer/Footer.d.ts +6 -0
- package/dist/components/Report/components/Footer/Summary.d.ts +7 -0
- package/dist/components/Report/components/Header/Header.d.ts +37 -0
- package/dist/components/Report/components/Header/components/Goto.d.ts +6 -0
- package/dist/components/Report/components/Header/components/Menu.d.ts +17 -0
- package/dist/components/Report/components/Header/components/Resizer.d.ts +12 -0
- package/dist/components/Report/components/Header/components/SortIndicator.d.ts +15 -0
- package/dist/components/Report/components/Header/util.d.ts +4 -0
- package/dist/components/Report/components/Internal/Actions.d.ts +13 -0
- package/dist/components/Report/components/Internal/Expansion.d.ts +4 -0
- package/dist/components/Report/components/Internal/Selection.d.ts +4 -0
- package/dist/components/Report/components/Row/DisplayRow.d.ts +16 -0
- package/dist/components/Report/components/Row/Row.d.ts +8 -0
- package/dist/components/Report/components/Row/RowContext.d.ts +9 -0
- package/dist/components/Report/components/Row/SkeletonRow.d.ts +10 -0
- package/dist/components/Report/components/Toolbar/Toolbar.d.ts +15 -0
- package/dist/components/Report/components/Toolbar/components/Filters/Filters.d.ts +7 -0
- package/dist/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +7 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +12 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +9 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterComparator.d.ts +7 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/FilterValue.d.ts +10 -0
- package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +12 -0
- package/dist/components/Report/components/Toolbar/components/Filters/util.d.ts +2 -0
- package/dist/components/Report/components/Toolbar/components/Print/Print.d.ts +9 -0
- package/dist/components/Report/components/Toolbar/components/Print/PrintDialog.d.ts +17 -0
- package/dist/components/Report/components/Toolbar/components/Search/Search.d.ts +8 -0
- package/dist/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +7 -0
- package/dist/components/Report/components/Toolbar/components/Settings/Settings.d.ts +8 -0
- package/dist/components/Report/features/useReportExport.d.ts +3 -0
- package/dist/components/Report/styles/useColumnPinningStylesheet.d.ts +2 -0
- package/dist/components/Report/styles/useCssGridStylesheet.d.ts +3 -0
- package/dist/components/Report/styles/useStylesheet.d.ts +3 -0
- package/dist/components/Report/styles/util.d.ts +3 -0
- package/dist/components/Report/types.d.ts +20 -0
- package/dist/components/Report/useReport.d.ts +14 -0
- package/dist/components/Report/util/rows.d.ts +7 -0
- package/dist/components/Report/util/useTableGlobalShortcuts.d.ts +4 -0
- package/dist/components/Report/util/useTableRenderer.d.ts +9 -0
- package/dist/components/Table3/components/rows/Row.d.ts +1 -1
- package/dist/components/Table3/hooks/features/usePrinting.d.ts +7 -0
- package/dist/components/Table3/hooks/useTable.d.ts +5 -5
- package/dist/components/Table3/types.d.ts +21 -3
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +1 -1
- package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Alert/Alert.js +1 -1
- package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.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 +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
- package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Button/Button.js +1 -1
- package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
- package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +5 -5
- 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 +1 -1
- 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 +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Form/Form.js +1 -1
- package/dist/esm/packages/taco/src/components/Form/Form.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +2 -2
- package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/Header.js +1 -1
- 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 +1 -1
- 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/Display.js +2 -2
- 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 +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Button.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js +1 -1
- package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/IconButton/IconButton.js +1 -1
- package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
- package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Layout/Layout.js +2 -2
- 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/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 +2 -2
- package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/Listbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Progress/Progress.js +1 -1
- package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +18 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/util.js +1 -1
- package/dist/esm/packages/taco/src/components/RadioGroup/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +1 -1
- package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +3 -3
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/Select.js +1 -1
- package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Spinner/Spinner.js +1 -1
- package/dist/esm/packages/taco/src/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Switch/Switch.js +1 -1
- package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +2 -2
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +1 -1
- 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 +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +1 -6
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +4 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +5 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
- package/dist/esm/packages/taco/src/{primitives/Table/useTable/features/useTablePrinting.js → components/Table3/hooks/features/usePrinting.js} +3 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +4 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +1 -1
- package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js +2 -2
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +1 -1
- package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toast.js +2 -2
- package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +2 -2
- package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +1 -1
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js +27 -0
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +11 -21
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +42 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +10 -8
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +7 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -0
- package/dist/esm/packages/taco/src/utils/dom.js +10 -1
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/primitives/Table/types.d.ts +187 -2
- package/dist/primitives/Table/useTable/features/useTableColumnFreezing.d.ts +6 -0
- package/dist/primitives/Table/useTable/features/useTableFooter.d.ts +3 -0
- package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +1 -0
- package/dist/primitives/Table/useTable/features/useTableRef.d.ts +4 -0
- package/dist/primitives/Table/useTable/features/useTableRowActions.d.ts +6 -0
- package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +0 -1
- package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +1 -1
- package/dist/primitives/Table/useTable/features/useTableRowExpansion.d.ts +5 -0
- package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +1 -1
- package/dist/primitives/Table/useTable/features/useTableRowGroups.d.ts +5 -0
- package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +1 -0
- package/dist/primitives/Table/useTable/features/useTableSearch.d.ts +11 -0
- package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +5 -2
- package/dist/primitives/Table/useTable/features/useTableSettings.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableRowHeightListener.d.ts +2 -0
- package/dist/primitives/Table/useTable/listeners/useTableSearchListener.d.ts +2 -0
- package/dist/primitives/Table/useTable/listeners/useTableSettingsListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/useTable.d.ts +57 -0
- package/dist/primitives/Table/useTable/util/columns.d.ts +7 -1
- package/dist/primitives/Table/useTable/util/columns.spec.d.ts +1 -0
- package/dist/primitives/Table/useTable/util/filtering.d.ts +7 -0
- package/dist/primitives/Table/useTable/util/presets.d.ts +2 -0
- package/dist/primitives/Table/useTable/util/search.d.ts +2 -0
- package/dist/primitives/Table/useTable/util/settings.d.ts +13 -0
- package/dist/primitives/Table/useTable/util/setup.d.ts +14 -0
- package/dist/primitives/Table/useTable/util/sorting.d.ts +2 -0
- package/dist/primitives/Table/useTableDataLoader.d.ts +23 -0
- package/dist/taco.cjs.development.js +149 -68
- 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/dist/utils/dom.d.ts +1 -0
- package/package.json +4 -3
- package/types.json +20882 -7749
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Select2/components/Trigger.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Tag } from '../../Tag/Tag';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Icon } from '../../Icon/Icon';\nimport { Badge } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent } from '../../../utils/dom';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\n\ntype Select2TriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n emptyValue?: Select2OptionValue;\n placeholder?: string;\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const Trigger = React.forwardRef<HTMLButtonElement, Select2TriggerProps>(function Select2Trigger(props, ref) {\n const { multiple, value } = useSelect2Context();\n\n if (Array.isArray(value) || multiple) {\n const values = Array.isArray(value) ? value : value !== undefined ? [value] : undefined;\n return <Multiple {...props} ref={ref} values={values} />;\n }\n\n return <Single {...props} ref={ref} value={value} />;\n});\n\ntype ButtonProps = React.HTMLAttributes<HTMLButtonElement> &\n Omit<Select2TriggerProps, 'children' | 'open' | 'setValue' | 'value'>;\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Select2TriggerButton(props, ref) {\n const { children, onClick, tabIndex = 0, ...otherProps } = props;\n const { disabled, highlighted, invalid, open, readOnly } = useSelect2Context();\n\n const className = cn(\n 'cursor-pointer !px-1.5',\n getInputClasses({ ...props, disabled, highlighted, invalid, readOnly }).replace('w-full', ''),\n { 'w-full': !props.className?.includes('w-') },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n event.preventDefault();\n return;\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n return (\n <button\n {...otherProps}\n aria-invalid={invalid ? true : undefined}\n aria-readonly={readOnly ? true : undefined}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n ref={ref}\n role=\"combobox\"\n tabIndex={disabled || readOnly ? -1 : tabIndex}\n type=\"button\">\n {children}\n <Icon name={open ? 'chevron-up' : 'chevron-down'} className=\"pointer-events-none -mr-1 ml-auto\" />\n </button>\n );\n});\n\ntype SingleProps = Omit<Select2TriggerProps, 'value'> & { value?: Select2OptionValue; placeholder?: string };\n\nconst Single = React.forwardRef<HTMLButtonElement, SingleProps>(function Select2TriggerSingle(props, ref) {\n const { children, emptyValue, value, placeholder, ...buttonProps } = props;\n const { disabled, readOnly, tags } = useSelect2Context();\n const contentClassName = cn('truncate items-center gap-1');\n\n const currentValue = children.find(matchesValue(value));\n\n let output;\n\n if (placeholder && currentValue === undefined) {\n output = <div className={cn({ 'text-grey-700': disabled, 'text-grey-500': !disabled })}>{placeholder}</div>;\n } else if (currentValue) {\n if (tags && emptyValue !== undefined && emptyValue !== value) {\n output = (\n <Tag\n className=\"truncate\"\n color={currentValue.props.color}\n disabled={disabled}\n icon={currentValue.props.prefix}\n readOnly={readOnly}>\n {currentValue.props.children}\n </Tag>\n );\n } else {\n output = (\n <>\n {currentValue.props.prefix ? (\n typeof currentValue.props.prefix === 'string' ? (\n <Icon name={currentValue.props.prefix} className=\"mr-1 !h-5 !w-5\" />\n ) : (\n currentValue.props.prefix\n )\n ) : null}\n {currentValue.props.children}\n </>\n );\n }\n }\n\n return (\n <Button {...buttonProps} ref={ref}>\n <div className={contentClassName}>{output}</div>\n </Button>\n );\n});\n\ntype MultipleProps = Omit<Select2TriggerProps, 'value'> & {\n values?: Select2OptionValue[];\n};\n\nconst Multiple = React.forwardRef<HTMLButtonElement, MultipleProps>(function Select2TriggerMultiple(props, ref) {\n const { children, emptyValue: _, values = [], placeholder, ...buttonProps } = props;\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const buttonRef = useMergedRef<HTMLButtonElement>(ref);\n\n const valuesAsChildren = values\n .map(value => children.find(c => c.props.value === value))\n .filter(c => !!c) as React.ReactElement<Select2OptionProps>[];\n\n let content;\n let { className } = buttonProps;\n\n if (open) {\n className = cn('!absolute z-20', buttonProps.className);\n content = (\n <ScrollArea className=\"my-1 flex max-h-[5.5rem] flex-col\">\n <div className=\"flex flex-wrap gap-1\">\n {valuesAsChildren.length === 0 ? (\n <div className={cn({ 'text-grey-700': disabled, 'text-grey-500': !disabled })}>{placeholder}</div>\n ) : (\n valuesAsChildren.map(child => (\n <Tag\n key={String(child.props.value)}\n className=\"truncate\"\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.prefix}\n onDelete={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n ))\n )}\n </div>\n </ScrollArea>\n );\n } else {\n content = <MultipleValue key={String(open)} valuesAsChildren={valuesAsChildren} placeholder={placeholder} />;\n }\n\n return (\n <div\n className={cn('relative inline-flex flex-grow', { 'h-8': open })}\n style={{ width: open ? buttonRef.current?.offsetWidth : undefined }}>\n <Button {...buttonProps} className={className} ref={buttonRef}>\n {content}\n </Button>\n </div>\n );\n});\n\ntype MultipleValueProps = Omit<Select2TriggerProps, 'value' | 'children'> & {\n valuesAsChildren: React.ReactElement<Select2OptionProps>[];\n placeholder?: string;\n};\n\nconst MultipleValue = ({ valuesAsChildren, placeholder }: MultipleValueProps) => {\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLDivElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n const createClickHandler = tagValue => event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(tagValue);\n }\n };\n\n return (\n <div className=\"relative flex items-center gap-1 overflow-hidden\">\n <div className=\"flex gap-1 truncate\" ref={el => setContentRef(el)}>\n {valuesAsChildren.length === 0 ? (\n <div className={cn({ 'text-grey-700': disabled, 'text-grey-500': !disabled })}>{placeholder}</div>\n ) : (\n valuesAsChildren.map((child, index) => {\n const tag = (\n <Tag\n key={String(child.props.value)}\n className={cn('cursor-pointer', {\n truncate: index === boundaryIndex,\n hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false,\n })}\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.prefix}\n onDelete={open ? createClickHandler(child.props.value) : undefined}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n );\n\n if (index === boundaryIndex) {\n return (\n <Tooltip key={String(child.props.value)} title={String(child.props.children)}>\n {tag}\n </Tooltip>\n );\n }\n\n return tag;\n })\n )}\n </div>\n {boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (\n <Tooltip\n title={valuesAsChildren\n .slice(boundaryIndex + 1)\n .map(child => (child ? String(child.props.children) : ''))\n .join(', ')}>\n <Badge className=\"flex-shrink-0\">+{valuesAsChildren.length - (boundaryIndex + 1)}</Badge>\n </Tooltip>\n ) : null}\n </div>\n );\n};\n\nconst matchesValue = (value: undefined | any | any[]) => (child: React.ReactElement<any>) => {\n if (Array.isArray(value)) {\n return value.includes(child.props.value);\n }\n\n return child.props.value === value;\n};\n"],"names":["Trigger","React","forwardRef","Select2Trigger","props","ref","multiple","value","useSelect2Context","Array","isArray","values","undefined","Multiple","Single","Button","Select2TriggerButton","children","onClick","tabIndex","otherProps","disabled","highlighted","invalid","open","readOnly","className","cn","getInputClasses","replace","_props$className","includes","handleClick","event","preventDefault","role","type","Icon","name","Select2TriggerSingle","emptyValue","placeholder","buttonProps","tags","contentClassName","currentValue","find","matchesValue","output","Tag","color","icon","prefix","Select2TriggerMultiple","_","setValue","buttonRef","useMergedRef","valuesAsChildren","map","c","filter","content","ScrollArea","length","child","key","String","onDelete","stopPropagation","MultipleValue","style","width","_buttonRef$current","current","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","createClickHandler","tagValue","el","index","tag","truncate","hidden","Tooltip","title","slice","join","Badge"],"mappings":";;;;;;;;;;;;MAoBaA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAyC,SAASC,cAAcA,CAACC,KAAK,EAAEC,GAAG;EAC9G,MAAM;IAAEC,QAAQ;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE/C,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAID,QAAQ,EAAE;IAClC,MAAMK,MAAM,GAAGF,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,KAAKK,SAAS,GAAG,CAACL,KAAK,CAAC,GAAGK,SAAS;IACvF,oBAAOX,6BAACY,QAAQ,oBAAKT,KAAK;MAAEC,GAAG,EAAEA,GAAG;MAAEM,MAAM,EAAEA;OAAU;;EAG5D,oBAAOV,6BAACa,MAAM,oBAAKV,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEE,KAAK,EAAEA;KAAS;AACxD,CAAC;AAKD,MAAMQ,MAAM,gBAAGd,cAAK,CAACC,UAAU,CAAiC,SAASc,oBAAoBA,CAACZ,KAAK,EAAEC,GAAG;;EACpG,MAAM;IAAEY,QAAQ;IAAEC,OAAO;IAAEC,QAAQ,GAAG,CAAC;IAAE,GAAGC;GAAY,GAAGhB,KAAK;EAChE,MAAM;IAAEiB,QAAQ;IAAEC,WAAW;IAAEC,OAAO;IAAEC,IAAI;IAAEC;GAAU,GAAGjB,iBAAiB,EAAE;EAE9E,MAAMkB,SAAS,GAAGC,EAAE,CAChB,wBAAwB,EACxBC,eAAe,CAAC;IAAE,GAAGxB,KAAK;IAAEiB,QAAQ;IAAEC,WAAW;IAAEC,O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select2/components/Trigger.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Tag } from '../../Tag/Tag';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Icon } from '../../Icon/Icon';\nimport { Badge } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent } from '../../../utils/dom';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\n\ntype Select2TriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n emptyValue?: Select2OptionValue;\n placeholder?: string;\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nexport const Trigger = React.forwardRef<HTMLButtonElement, Select2TriggerProps>(function Select2Trigger(props, ref) {\n const { multiple, value } = useSelect2Context();\n\n if (Array.isArray(value) || multiple) {\n const values = Array.isArray(value) ? value : value !== undefined ? [value] : undefined;\n return <Multiple {...props} ref={ref} values={values} />;\n }\n\n return <Single {...props} ref={ref} value={value} />;\n});\n\ntype ButtonProps = React.HTMLAttributes<HTMLButtonElement> &\n Omit<Select2TriggerProps, 'children' | 'open' | 'setValue' | 'value'>;\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Select2TriggerButton(props, ref) {\n const { children, onClick, tabIndex = 0, ...otherProps } = props;\n const { disabled, highlighted, invalid, open, readOnly } = useSelect2Context();\n\n const className = cn(\n 'cursor-pointer !px-1.5',\n getInputClasses({ ...props, disabled, highlighted, invalid, readOnly }).replace('w-full', ''),\n { 'w-full': !props.className?.includes('w-') },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n event.preventDefault();\n return;\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n return (\n <button\n {...otherProps}\n aria-invalid={invalid ? true : undefined}\n aria-readonly={readOnly ? true : undefined}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n ref={ref}\n role=\"combobox\"\n tabIndex={disabled || readOnly ? -1 : tabIndex}\n type=\"button\">\n {children}\n <Icon name={open ? 'chevron-up' : 'chevron-down'} className=\"pointer-events-none -mr-1 ml-auto\" />\n </button>\n );\n});\n\ntype SingleProps = Omit<Select2TriggerProps, 'value'> & { value?: Select2OptionValue; placeholder?: string };\n\nconst Single = React.forwardRef<HTMLButtonElement, SingleProps>(function Select2TriggerSingle(props, ref) {\n const { children, emptyValue, value, placeholder, ...buttonProps } = props;\n const { disabled, readOnly, tags } = useSelect2Context();\n const contentClassName = cn('truncate items-center gap-1');\n\n const currentValue = children.find(matchesValue(value));\n\n let output;\n\n if (placeholder && currentValue === undefined) {\n output = <div className={cn({ 'text-grey-700': disabled, 'text-grey-500': !disabled })}>{placeholder}</div>;\n } else if (currentValue) {\n if (tags && emptyValue !== undefined && emptyValue !== value) {\n output = (\n <Tag\n className=\"truncate\"\n color={currentValue.props.color}\n disabled={disabled}\n icon={currentValue.props.prefix}\n readOnly={readOnly}>\n {currentValue.props.children}\n </Tag>\n );\n } else {\n output = (\n <>\n {currentValue.props.prefix ? (\n typeof currentValue.props.prefix === 'string' ? (\n <Icon name={currentValue.props.prefix} className=\"mr-1 !h-5 !w-5\" />\n ) : (\n currentValue.props.prefix\n )\n ) : null}\n {currentValue.props.children}\n </>\n );\n }\n }\n\n return (\n <Button {...buttonProps} ref={ref}>\n <div className={contentClassName}>{output}</div>\n </Button>\n );\n});\n\ntype MultipleProps = Omit<Select2TriggerProps, 'value'> & {\n values?: Select2OptionValue[];\n};\n\nconst Multiple = React.forwardRef<HTMLButtonElement, MultipleProps>(function Select2TriggerMultiple(props, ref) {\n const { children, emptyValue: _, values = [], placeholder, ...buttonProps } = props;\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const buttonRef = useMergedRef<HTMLButtonElement>(ref);\n\n const valuesAsChildren = values\n .map(value => children.find(c => c.props.value === value))\n .filter(c => !!c) as React.ReactElement<Select2OptionProps>[];\n\n let content;\n let { className } = buttonProps;\n\n if (open) {\n className = cn('!absolute z-20 !h-fit', buttonProps.className);\n content = (\n <ScrollArea className=\"my-1 flex max-h-[5.5rem] flex-col\">\n <div className=\"flex flex-wrap gap-1\">\n {valuesAsChildren.length === 0 ? (\n <div className={cn({ 'text-grey-700': disabled, 'text-grey-500': !disabled })}>{placeholder}</div>\n ) : (\n valuesAsChildren.map(child => (\n <Tag\n key={String(child.props.value)}\n className=\"truncate\"\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.prefix}\n onDelete={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n ))\n )}\n </div>\n </ScrollArea>\n );\n } else {\n content = <MultipleValue key={String(open)} valuesAsChildren={valuesAsChildren} placeholder={placeholder} />;\n }\n\n return (\n <div\n className={cn('relative inline-flex flex-grow', { 'h-8': open })}\n style={{ width: open ? buttonRef.current?.offsetWidth : undefined }}>\n <Button {...buttonProps} className={className} ref={buttonRef}>\n {content}\n </Button>\n </div>\n );\n});\n\ntype MultipleValueProps = Omit<Select2TriggerProps, 'value' | 'children'> & {\n valuesAsChildren: React.ReactElement<Select2OptionProps>[];\n placeholder?: string;\n};\n\nconst MultipleValue = ({ valuesAsChildren, placeholder }: MultipleValueProps) => {\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLDivElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n const createClickHandler = tagValue => event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(tagValue);\n }\n };\n\n return (\n <div className=\"relative flex items-center gap-1 overflow-hidden\">\n <div className=\"flex gap-1 truncate\" ref={el => setContentRef(el)}>\n {valuesAsChildren.length === 0 ? (\n <div className={cn({ 'text-grey-700': disabled, 'text-grey-500': !disabled })}>{placeholder}</div>\n ) : (\n valuesAsChildren.map((child, index) => {\n const tag = (\n <Tag\n key={String(child.props.value)}\n className={cn('cursor-pointer', {\n truncate: index === boundaryIndex,\n hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false,\n })}\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.prefix}\n onDelete={open ? createClickHandler(child.props.value) : undefined}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n );\n\n if (index === boundaryIndex) {\n return (\n <Tooltip key={String(child.props.value)} title={String(child.props.children)}>\n {tag}\n </Tooltip>\n );\n }\n\n return tag;\n })\n )}\n </div>\n {boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (\n <Tooltip\n title={valuesAsChildren\n .slice(boundaryIndex + 1)\n .map(child => (child ? String(child.props.children) : ''))\n .join(', ')}>\n <Badge className=\"flex-shrink-0\">+{valuesAsChildren.length - (boundaryIndex + 1)}</Badge>\n </Tooltip>\n ) : null}\n </div>\n );\n};\n\nconst matchesValue = (value: undefined | any | any[]) => (child: React.ReactElement<any>) => {\n if (Array.isArray(value)) {\n return value.includes(child.props.value);\n }\n\n return child.props.value === value;\n};\n"],"names":["Trigger","React","forwardRef","Select2Trigger","props","ref","multiple","value","useSelect2Context","Array","isArray","values","undefined","Multiple","Single","Button","Select2TriggerButton","children","onClick","tabIndex","otherProps","disabled","highlighted","invalid","open","readOnly","className","cn","getInputClasses","replace","_props$className","includes","handleClick","event","preventDefault","role","type","Icon","name","Select2TriggerSingle","emptyValue","placeholder","buttonProps","tags","contentClassName","currentValue","find","matchesValue","output","Tag","color","icon","prefix","Select2TriggerMultiple","_","setValue","buttonRef","useMergedRef","valuesAsChildren","map","c","filter","content","ScrollArea","length","child","key","String","onDelete","stopPropagation","MultipleValue","style","width","_buttonRef$current","current","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","createClickHandler","tagValue","el","index","tag","truncate","hidden","Tooltip","title","slice","join","Badge"],"mappings":";;;;;;;;;;;;MAoBaA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAyC,SAASC,cAAcA,CAACC,KAAK,EAAEC,GAAG;EAC9G,MAAM;IAAEC,QAAQ;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE/C,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAID,QAAQ,EAAE;IAClC,MAAMK,MAAM,GAAGF,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,KAAKK,SAAS,GAAG,CAACL,KAAK,CAAC,GAAGK,SAAS;IACvF,oBAAOX,6BAACY,QAAQ,oBAAKT,KAAK;MAAEC,GAAG,EAAEA,GAAG;MAAEM,MAAM,EAAEA;OAAU;;EAG5D,oBAAOV,6BAACa,MAAM,oBAAKV,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEE,KAAK,EAAEA;KAAS;AACxD,CAAC;AAKD,MAAMQ,MAAM,gBAAGd,cAAK,CAACC,UAAU,CAAiC,SAASc,oBAAoBA,CAACZ,KAAK,EAAEC,GAAG;;EACpG,MAAM;IAAEY,QAAQ;IAAEC,OAAO;IAAEC,QAAQ,GAAG,CAAC;IAAE,GAAGC;GAAY,GAAGhB,KAAK;EAChE,MAAM;IAAEiB,QAAQ;IAAEC,WAAW;IAAEC,OAAO;IAAEC,IAAI;IAAEC;GAAU,GAAGjB,iBAAiB,EAAE;EAE9E,MAAMkB,SAAS,GAAGC,EAAE,CAChB,wBAAwB,EACxBC,eAAe,CAAC;IAAE,GAAGxB,KAAK;IAAEiB,QAAQ;IAAEC,WAAW;IAAEC,OAAO;IAAEE;GAAU,CAAC,CAACI,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAC7F;IAAE,QAAQ,EAAE,GAAAC,gBAAA,GAAC1B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TwC,KAAK,CAAC7D,KAAK,CAACa,QAAQ,CAE5B;IAED,IAAImE,KAAK,KAAKL,aAAa,EAAE;MACzB,oBACI9E,6BAACuF,OAAO;QAACtB,GAAG,EAAEC,MAAM,CAACF,KAAK,CAAC7D,KAAK,CAACG,KAAK,CAAC;QAAEkF,KAAK,EAAEtB,MAAM,CAACF,KAAK,CAAC7D,KAAK,CAACa,QAAQ;SACtEoE,GAAG,CACE;;IAIlB,OAAOA,GAAG;GACb,CACJ,CACC,EACLN,aAAa,KAAKnE,SAAS,IAAImE,aAAa,KAAK,IAAI,IAAIA,aAAa,GAAGrB,gBAAgB,CAACM,MAAM,GAAG,CAAC,kBACjG/D,6BAACuF,OAAO;IACJC,KAAK,EAAE/B,gBAAgB,CAClBgC,KAAK,CAACX,aAAa,GAAG,CAAC,CAAC,CACxBpB,GAAG,CAACM,KAAK,IAAKA,KAAK,GAAGE,MAAM,CAACF,KAAK,CAAC7D,KAAK,CAACa,QAAQ,CAAC,GAAG,EAAG,CAAC,CACzD0E,IAAI,CAAC,IAAI;kBACd1F,6BAAC2F,KAAK;IAAClE,SAAS,EAAC;UAAkBgC,gBAAgB,CAACM,MAAM,IAAIe,aAAa,GAAG,CAAC,CAAC,CAAS,CACnF,IACV,IAAI,CACN;AAEd,CAAC;AAED,MAAMhC,YAAY,GAAIxC,KAA8B,IAAM0D,KAA8B;EACpF,IAAIxD,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACwB,QAAQ,CAACkC,KAAK,CAAC7D,KAAK,CAACG,KAAK,CAAC;;EAG5C,OAAO0D,KAAK,CAAC7D,KAAK,CAACG,KAAK,KAAKA,KAAK;AACtC,CAAC;;;;"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import cn from '
|
1
|
+
import cn from 'clsx';
|
2
2
|
|
3
3
|
const createOptionClassName = (shouldPauseHoverState = false) => cn('group mb-px flex w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none', {
|
4
4
|
'hover:wcag-grey-200': !shouldPauseHoverState
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utilities.js","sources":["../../../../../../../src/components/Select2/utilities.ts"],"sourcesContent":["import cn from '
|
1
|
+
{"version":3,"file":"utilities.js","sources":["../../../../../../../src/components/Select2/utilities.ts"],"sourcesContent":["import cn from 'clsx';\n\nexport const createOptionClassName = (shouldPauseHoverState = false) =>\n cn(\n 'group mb-px flex w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none',\n\n {\n 'hover:wcag-grey-200': !shouldPauseHoverState,\n }\n );\n\nexport const createCollectionClassName = () => 'flex flex-col gap-px';\n"],"names":["createOptionClassName","shouldPauseHoverState","cn","createCollectionClassName"],"mappings":";;MAEaA,qBAAqB,GAAGA,CAACC,qBAAqB,GAAG,KAAK,KAC/DC,EAAE,CACE,+PAA+P,EAE/P;EACI,qBAAqB,EAAE,CAACD;CAC3B;MAGIE,yBAAyB,GAAGA,MAAM;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Shortcut.js","sources":["../../../../../../../src/components/Shortcut/Shortcut.tsx"],"sourcesContent":["import React from 'react';\nimport cn from '
|
1
|
+
{"version":3,"file":"Shortcut.js","sources":["../../../../../../../src/components/Shortcut/Shortcut.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { isMacOs, KeyDownHandlerOptions } from '../../utils/keyboard';\n\nconst replaceWithShortform = (key: string) => {\n switch (key) {\n case 'Escape':\n return 'Esc';\n\n case 'Delete':\n return 'Del';\n\n case 'Space':\n case ' ':\n return 'Space';\n\n case 'ArrowLeft':\n return '◄';\n\n case 'ArrowRight':\n return '►';\n\n case 'ArrowUp':\n return '▲';\n\n case 'ArrowDown':\n return '▼';\n\n default:\n return key.length === 1 ? key.toLocaleUpperCase() : key;\n }\n};\n\nconst getShortcutText = (key: string | KeyDownHandlerOptions) => {\n if (!key) {\n return [];\n }\n\n if (typeof key === 'string') {\n return [replaceWithShortform(key)];\n }\n\n const keys: string[] = [];\n\n if (key.shift) {\n keys.push(isMacOs() ? '⇧' : 'Shift');\n }\n\n if (key.meta) {\n keys.push(isMacOs() ? '⌘' : 'Ctrl');\n }\n\n keys.push(replaceWithShortform(key.key));\n\n return keys;\n};\n\nexport type ShortcutProps = Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n keys: string | KeyDownHandlerOptions;\n};\nexport const Shortcut = ({ keys, ...props }: ShortcutProps) => {\n const className = cn('inline-flex gap-0.5', props.className);\n const texts = getShortcutText(keys);\n\n return (\n <span {...props} className={className}>\n {texts.map(key => (\n <kbd\n key={key}\n className=\"font-display text-grey-700 [[data-taco=tooltip]_&]:bg-grey-300/[0.25] rounded-sm bg-black/[0.09] px-1 text-center font-bold [[data-taco=tooltip]_&]:text-white\">\n {key}\n </kbd>\n ))}\n </span>\n );\n};\n"],"names":["replaceWithShortform","key","length","toLocaleUpperCase","getShortcutText","keys","shift","push","isMacOs","meta","Shortcut","props","className","cn","texts","React","map"],"mappings":";;;;AAIA,MAAMA,oBAAoB,GAAIC,GAAW;EACrC,QAAQA,GAAG;IACP,KAAK,QAAQ;MACT,OAAO,KAAK;IAEhB,KAAK,QAAQ;MACT,OAAO,KAAK;IAEhB,KAAK,OAAO;IACZ,KAAK,GAAG;MACJ,OAAO,OAAO;IAElB,KAAK,WAAW;MACZ,OAAO,GAAG;IAEd,KAAK,YAAY;MACb,OAAO,GAAG;IAEd,KAAK,SAAS;MACV,OAAO,GAAG;IAEd,KAAK,WAAW;MACZ,OAAO,GAAG;IAEd;MACI,OAAOA,GAAG,CAACC,MAAM,KAAK,CAAC,GAAGD,GAAG,CAACE,iBAAiB,EAAE,GAAGF,GAAG;;AAEnE,CAAC;AAED,MAAMG,eAAe,GAAIH,GAAmC;EACxD,IAAI,CAACA,GAAG,EAAE;IACN,OAAO,EAAE;;EAGb,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IACzB,OAAO,CAACD,oBAAoB,CAACC,GAAG,CAAC,CAAC;;EAGtC,MAAMI,IAAI,GAAa,EAAE;EAEzB,IAAIJ,GAAG,CAACK,KAAK,EAAE;IACXD,IAAI,CAACE,IAAI,CAACC,OAAO,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC;;EAGxC,IAAIP,GAAG,CAACQ,IAAI,EAAE;IACVJ,IAAI,CAACE,IAAI,CAACC,OAAO,EAAE,GAAG,GAAG,GAAG,MAAM,CAAC;;EAGvCH,IAAI,CAACE,IAAI,CAACP,oBAAoB,CAACC,GAAG,CAACA,GAAG,CAAC,CAAC;EAExC,OAAOI,IAAI;AACf,CAAC;MAKYK,QAAQ,GAAGA,CAAC;EAAEL,IAAI;EAAE,GAAGM;CAAsB;EACtD,MAAMC,SAAS,GAAGC,EAAE,CAAC,qBAAqB,EAAEF,KAAK,CAACC,SAAS,CAAC;EAC5D,MAAME,KAAK,GAAGV,eAAe,CAACC,IAAI,CAAC;EAEnC,oBACIU,uDAAUJ,KAAK;IAAEC,SAAS,EAAEA;MACvBE,KAAK,CAACE,GAAG,CAACf,GAAG,mBACVc;IACId,GAAG,EAAEA,GAAG;IACRW,SAAS,EAAC;KACTX,GAAG,CACF,CACT,CAAC,CACC;AAEf;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../../../../../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import React from 'react';\nimport cn from '
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../../../../../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport './Spinner.css';\n\nexport type SpinnerProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Define a delay in milliseconds after which the spinner is shown.\n * Default value is `350`ms\n */\n delay?: number;\n /** Define a text that will be displayed below spinner */\n label?: string;\n};\n\nexport const Spinner = React.forwardRef(function Spinner(props: SpinnerProps, ref: React.Ref<HTMLDivElement>) {\n const { delay = 350, label, ...otherProps } = props;\n const [visible, setVisibility] = React.useState(!delay);\n\n React.useEffect(() => {\n let timeout: number;\n\n if (delay) {\n timeout = window.setTimeout(() => setVisibility(true), delay);\n }\n\n return () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n };\n }, [delay]);\n\n if (!visible) {\n return null;\n }\n\n const className = cn('inline-flex flex-col relative items-center', otherProps.className);\n\n return (\n <div {...otherProps} className={className} data-taco=\"spinner\" ref={ref}>\n <svg\n className=\"h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]\"\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"50\" cy=\"50\" r=\"45\"></circle>\n </svg>\n {label && <span className=\"mt-4\">{label}</span>}\n </div>\n );\n});\n"],"names":["Spinner","React","forwardRef","props","ref","delay","label","otherProps","visible","setVisibility","useState","useEffect","timeout","window","setTimeout","clearTimeout","className","cn","viewBox","xmlns","cx","cy","r"],"mappings":";;;MAcaA,OAAO,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,OAAOA,CAACG,KAAmB,EAAEC,GAA8B;EACxG,MAAM;IAAEC,KAAK,GAAG,GAAG;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EACnD,MAAM,CAACK,OAAO,EAAEC,aAAa,CAAC,GAAGR,cAAK,CAACS,QAAQ,CAAC,CAACL,KAAK,CAAC;EAEvDJ,cAAK,CAACU,SAAS,CAAC;IACZ,IAAIC,OAAe;IAEnB,IAAIP,KAAK,EAAE;MACPO,OAAO,GAAGC,MAAM,CAACC,UAAU,CAAC,MAAML,aAAa,CAAC,IAAI,CAAC,EAAEJ,KAAK,CAAC;;IAGjE,OAAO;MACH,IAAIO,OAAO,EAAE;QACTG,YAAY,CAACH,OAAO,CAAC;;KAE5B;GACJ,EAAE,CAACP,KAAK,CAAC,CAAC;EAEX,IAAI,CAACG,OAAO,EAAE;IACV,OAAO,IAAI;;EAGf,MAAMQ,SAAS,GAAGC,EAAE,CAAC,4CAA4C,EAAEV,UAAU,CAACS,SAAS,CAAC;EAExF,oBACIf,sDAASM,UAAU;IAAES,SAAS,EAAEA,SAAS;iBAAY,SAAS;IAACZ,GAAG,EAAEA;mBAChEH;IACIe,SAAS,EAAC,wDAAwD;IAClEE,OAAO,EAAC,aAAa;IACrBC,KAAK,EAAC;kBACNlB;IAAQmB,EAAE,EAAC,IAAI;IAACC,EAAE,EAAC,IAAI;IAACC,CAAC,EAAC;IAAc,CACtC,EACLhB,KAAK,iBAAIL;IAAMe,SAAS,EAAC;KAAQV,KAAK,CAAQ,CAC7C;AAEd,CAAC;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from '
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PrimitiveSwitch from '@radix-ui/react-switch';\nimport { useId } from '../../hooks/useId';\n\ntype SwitchBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /** Label for the switch */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\ninterface UncontrolledSwitchProps extends SwitchBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\ninterface ControlledSwitchProps extends SwitchBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type SwitchProps = UncontrolledSwitchProps | ControlledSwitchProps;\n\nexport const Switch = React.forwardRef(function Switch(props: SwitchProps, ref: React.Ref<HTMLButtonElement>) {\n const { label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus',\n {\n 'mr-2': !!label,\n 'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,\n 'bg-grey-500/50 aria-checked:bg-blue-500/50 cursor-not-allowed': props.disabled,\n },\n props.className\n );\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n const element = (\n <PrimitiveSwitch.Root\n {...otherProps}\n {...labelledByProps}\n className={className}\n data-taco=\"switch\"\n onCheckedChange={onChange}\n ref={ref}>\n <PrimitiveSwitch.Thumb className=\"'will-change-transform mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]\" />\n </PrimitiveSwitch.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn('flex self-start cursor-pointer', {\n 'cursor-not-allowed text-grey-300': props.disabled,\n });\n\n return (\n <span className={labelContainerClassName} data-taco=\"switch-container\">\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nSwitch.displayName = 'Switch';\n"],"names":["Switch","React","props","ref","label","onChange","otherProps","id","useId","className","cn","disabled","labelledByProps","element","PrimitiveSwitch","onCheckedChange","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;MA6BaA,MAAM,gBAAGC,UAAgB,CAAC,SAASD,MAAMA,CAACE,KAAkB,EAAEC,GAAiC;EACxG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAChD,MAAMK,EAAE,GAAGC,KAAK,CAACN,KAAK,CAACK,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,kFAAkF,EAClF;IACI,MAAM,EAAE,CAAC,CAACN,KAAK;IACf,uFAAuF,EAAE,CAACF,KAAK,CAACS,QAAQ;IACxG,+DAA+D,EAAET,KAAK,CAACS;GAC1E,EACDT,KAAK,CAACO,SAAS,CAClB;EAED,IAAIG,eAAe,GAAkC,IAAI;EAEzD,IAAIR,KAAK,EAAE;IACPQ,eAAe,GAAG;MACd,iBAAiB,KAAKL,UAAU;MAChCA;KACH;;EAGL,MAAMM,OAAO,gBACTZ,cAACa,IAAoB,oBACbR,UAAU,EACVM,eAAe;IACnBH,SAAS,EAAEA,SAAS;iBACV,QAAQ;IAClBM,eAAe,EAAEV,QAAQ;IACzBF,GAAG,EAAEA;mBACLF,cAACa,KAAqB;IAACL,SAAS,EAAC;IAA6K,CAErN;EAED,IAAIL,KAAK,EAAE;IACP,MAAMY,uBAAuB,GAAGN,EAAE,CAAC,gCAAgC,EAAE;MACjE,kCAAkC,EAAER,KAAK,CAACS;KAC7C,CAAC;IAEF,oBACIV;MAAMQ,SAAS,EAAEO,uBAAuB;mBAAY;OAC/CH,OAAO,eACRZ;MAAOgB,OAAO,EAAEV,EAAE;MAAEA,EAAE,KAAKA;OACtBH,KAAK,CACF,CACL;;EAIf,OAAOS,OAAO;AAClB,CAAC;AACDb,MAAM,CAACkB,WAAW,GAAG,QAAQ;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import cn from '
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
4
4
|
import { Column } from '../util/renderColumn.js';
|
5
5
|
|
@@ -32,7 +32,7 @@ const BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(prop
|
|
32
32
|
}, headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup, index) => ( /*#__PURE__*/React__default.createElement("div", {
|
33
33
|
key: index,
|
34
34
|
role: "row",
|
35
|
-
className: "border-grey-300 flex h-auto min-h-[2.5rem] w-full select-none border-
|
35
|
+
className: "border-grey-300 flex h-auto min-h-[2.5rem] w-full select-none border-b-2 border-t-0 font-bold"
|
36
36
|
}, headerGroup.headers.map((cell, index) => ( /*#__PURE__*/React__default.createElement(Column, {
|
37
37
|
key: index,
|
38
38
|
index: index,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"BaseTable.js","sources":["../../../../../../../../src/components/Table/components/BaseTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from '
|
1
|
+
{"version":3,"file":"BaseTable.js","sources":["../../../../../../../../src/components/Table/components/BaseTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { HeaderGroup } from 'react-table';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { InternalBaseTable } from '../types';\nimport './Table.css';\nimport { Column } from '../util/renderColumn';\n\nexport const DefaultEmptyState = (): React.ReactNode => null;\n\nexport const BaseTable = React.forwardRef(function BaseTable(props: InternalBaseTable, ref: React.Ref<HTMLDivElement>) {\n const tableRef = useMergedRef<HTMLDivElement>(ref);\n const { autoFocus, children, disableSorting: _, headerGroups, headerRef, bodyRef, ...otherProps } = props;\n\n React.useEffect(() => {\n if (autoFocus && tableRef.current) {\n tableRef.current.focus();\n }\n }, []);\n\n const className = cn('yt-table flex flex-col focus:yt-focus focus:rounded-sm', props.className);\n\n return (\n <div {...otherProps} role=\"table\" className={className} ref={tableRef}>\n <div role=\"rowgroup\" className=\"yt-table__head\" ref={headerRef}>\n {headerGroups?.map((headerGroup: HeaderGroup<object>, index: number) => (\n <div\n key={index}\n role=\"row\"\n className=\"border-grey-300 flex h-auto min-h-[2.5rem] w-full select-none border-b-2 border-t-0 font-bold\">\n {headerGroup.headers.map((cell: any, index: number) => (\n <Column key={index} index={index} cell={cell} />\n ))}\n </div>\n ))}\n </div>\n\n <div role=\"rowgroup\" className=\"yt-table__body\" ref={bodyRef}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["DefaultEmptyState","BaseTable","React","forwardRef","props","ref","tableRef","useMergedRef","autoFocus","children","disableSorting","_","headerGroups","headerRef","bodyRef","otherProps","useEffect","current","focus","className","cn","role","map","headerGroup","index","key","headers","cell","Column"],"mappings":";;;;;MAQaA,iBAAiB,GAAGA,MAAuB;MAE3CC,SAAS,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,SAASA,CAACG,KAAwB,EAAEC,GAA8B;EACjH,MAAMC,QAAQ,GAAGC,YAAY,CAAiBF,GAAG,CAAC;EAClD,MAAM;IAAEG,SAAS;IAAEC,QAAQ;IAAEC,cAAc,EAAEC,CAAC;IAAEC,YAAY;IAAEC,SAAS;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGX,KAAK;EAEzGF,cAAK,CAACc,SAAS,CAAC;IACZ,IAAIR,SAAS,IAAIF,QAAQ,CAACW,OAAO,EAAE;MAC/BX,QAAQ,CAACW,OAAO,CAACC,KAAK,EAAE;;GAE/B,EAAE,EAAE,CAAC;EAEN,MAAMC,SAAS,GAAGC,EAAE,CAAC,wDAAwD,EAAEhB,KAAK,CAACe,SAAS,CAAC;EAE/F,oBACIjB,sDAASa,UAAU;IAAEM,IAAI,EAAC,OAAO;IAACF,SAAS,EAAEA,SAAS;IAAEd,GAAG,EAAEC;mBACzDJ;IAAKmB,IAAI,EAAC,UAAU;IAACF,SAAS,EAAC,gBAAgB;IAACd,GAAG,EAAEQ;KAChDD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEU,GAAG,CAAC,CAACC,WAAgC,EAAEC,KAAa,oBAC/DtB;IACIuB,GAAG,EAAED,KAAK;IACVH,IAAI,EAAC,KAAK;IACVF,SAAS,EAAC;KACTI,WAAW,CAACG,OAAO,CAACJ,GAAG,CAAC,CAACK,IAAS,EAAEH,KAAa,oBAC9CtB,6BAAC0B,MAAM;IAACH,GAAG,EAAED,KAAK;IAAEA,KAAK,EAAEA,KAAK;IAAEG,IAAI,EAAEA;IAAQ,CACnD,CAAC,CACA,CACT,CAAC,CACA,eAENzB;IAAKmB,IAAI,EAAC,UAAU;IAACF,SAAS,EAAC,gBAAgB;IAACd,GAAG,EAAES;KAChDL,QAAQ,CACP,CACJ;AAEd,CAAC;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import cn from '
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { useMergedRef } from '../../../hooks/useMergedRef.js';
|
4
4
|
import { useLocalization } from '../../Provider/Localization.js';
|
5
5
|
import { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WindowedTable.js","sources":["../../../../../../../../src/components/Table/components/WindowedTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { PluginHook } from 'react-table';\nimport { areEqual, VariableSizeList } from 'react-window';\nimport InfiniteLoader from 'react-window-infinite-loader';\nimport { TableProps, ForwardedGenericTableWithStatics, TableRef } from '../types';\nimport { useTable } from '../hooks/useTable';\nimport { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Row } from '../util/renderRow';\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst ROW_HEIGHT = 40;\n\nconst VariableRow = React.memo(({ data, index, style: { height: _, ...style } }: any) => {\n const { texts } = useLocalization();\n const { rows, setRowHeight, rowProps, tableProps, instance, prepareRow, rowHeights } = data;\n const row = rows[index];\n const ref = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (ref?.current) {\n setRowHeight(index, ref.current.getBoundingClientRect().height);\n }\n }, [rowHeights[index]]);\n\n if (row) {\n prepareRow(row, index);\n\n return (\n <Row\n {...rowProps}\n style={style}\n key={index}\n index={index}\n row={row}\n instance={instance}\n headerGroups={tableProps.headerGroups}\n setRowHeight={setRowHeight}\n ref={ref}\n />\n );\n }\n\n return (\n <div className=\"yt-table__row\" role=\"row\" style={style}>\n <div className=\"yt-table__cell text-grey-300\">{texts.table.loading}</div>\n </div>\n );\n}, areEqual);\n\nconst getAverageRowHeight = (rowHeights = {}) => {\n const keys = Object.keys(rowHeights);\n const estimatedHeight = keys.reduce((p, i) => p + rowHeights[i], 0);\n return estimatedHeight / keys.length;\n};\n\nexport const WindowedTable = React.forwardRef(function WindowedTable<T>(\n props: TableProps<T> & { plugins: PluginHook<{}>[] },\n ref: React.Ref<TableRef>\n) {\n const tableRef: any = useMergedRef<HTMLDivElement>(ref);\n const { emptyStateRenderer = DefaultEmptyState, length, loadMore, ...otherProps } = props;\n const { rowProps, tableProps, rows, prepareRow, instance, state } = useTable<T>({ ...otherProps, windowed: true }, tableRef);\n\n // determine heights for windowing calculations\n const headerRef = React.useRef<HTMLDivElement>(null);\n const [rowsRef, setRowsRef] = React.useState<any>(null);\n const tableDimensions = useBoundingClientRectListener(tableRef);\n const headerDimensions = useBoundingClientRectListener(headerRef);\n const height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null;\n\n // variable row height calculations\n const estimatedRowHeight = rowProps.rowHeight || ROW_HEIGHT;\n const rowHeights = React.useRef<Record<string, number>>({});\n const setRowHeight = React.useCallback((index: number, size: number) => {\n if (rowHeights.current[index] !== size) {\n rowHeights.current = {\n ...rowHeights.current,\n [index]: size,\n };\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }\n }, []);\n const getRowHeight = React.useCallback(index => rowHeights.current[index] || estimatedRowHeight, []);\n\n React.useEffect(() => {\n if (rowsRef && rowProps.activeIndex !== undefined) {\n rowsRef.scrollToItem(rowProps.activeIndex, 'start');\n }\n }, [rowsRef, rowProps.activeIndex]);\n\n // trigger recalculation of variable row heights if the data changes\n React.useEffect(() => {\n rowHeights.current = {};\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }, [rows.length]);\n\n const contentHeight = estimatedRowHeight * props.data.length || 0;\n const isScrollbarVisible = height !== null ? contentHeight > height : false;\n\n const className = cn(tableProps.className, 'yt-table--windowed', { 'table-with-scrollbar': isScrollbarVisible });\n\n let list;\n\n const itemData = {\n rows,\n setRowHeight,\n rowProps,\n tableProps,\n instance,\n prepareRow,\n state,\n rowHeights: rowHeights.current,\n };\n\n if (height && rows.length) {\n const listProps = {\n height,\n itemData,\n estimatedItemSize: getAverageRowHeight(rowHeights.current),\n itemSize: getRowHeight,\n width: '100%',\n };\n\n if (loadMore && length) {\n const isLoaded = (index: number) => !!rows[index];\n\n list = (\n <InfiniteLoader isItemLoaded={isLoaded} itemCount={length} loadMoreItems={loadMore as any}>\n {({ onItemsRendered, ref }: any) => (\n <VariableSizeList\n {...listProps}\n itemCount={length}\n onItemsRendered={onItemsRendered}\n ref={list => {\n ref(list);\n setRowsRef(list);\n }}>\n {VariableRow}\n </VariableSizeList>\n )}\n </InfiniteLoader>\n );\n } else {\n list = (\n <VariableSizeList\n {...listProps}\n itemCount={rows.length}\n ref={ref => {\n setRowsRef(ref);\n }}>\n {VariableRow}\n </VariableSizeList>\n );\n }\n }\n\n return (\n <BaseTable {...tableProps} className={className} headerRef={headerRef} ref={tableRef}>\n {list ? list : emptyStateRenderer()}\n </BaseTable>\n );\n}) as ForwardedGenericTableWithStatics;\n\nWindowedTable.Column = () => null;\nWindowedTable.Group = () => null;\n"],"names":["ROW_HEIGHT","VariableRow","React","memo","data","index","style","height","_","texts","useLocalization","rows","setRowHeight","rowProps","tableProps","instance","prepareRow","rowHeights","row","ref","useRef","useEffect","current","getBoundingClientRect","Row","key","headerGroups","className","role","table","loading","areEqual","getAverageRowHeight","keys","Object","estimatedHeight","reduce","p","i","length","WindowedTable","forwardRef","props","tableRef","useMergedRef","emptyStateRenderer","DefaultEmptyState","loadMore","otherProps","state","useTable","windowed","headerRef","rowsRef","setRowsRef","useState","tableDimensions","useBoundingClientRectListener","headerDimensions","estimatedRowHeight","rowHeight","useCallback","size","resetAfterIndex","getRowHeight","activeIndex","undefined","scrollToItem","contentHeight","isScrollbarVisible","cn","list","itemData","listProps","estimatedItemSize","itemSize","width","isLoaded","InfiniteLoader","isItemLoaded","itemCount","loadMoreItems","onItemsRendered","VariableSizeList","BaseTable","Column","Group"],"mappings":";;;;;;;;;;;AAaA,MAAMA,UAAU,GAAG,EAAE;AAErB,MAAMC,WAAW,gBAAGC,cAAK,CAACC,IAAI,CAAC,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC,KAAK,EAAE;IAAEC,MAAM,EAAEC,CAAC;IAAE,GAAGF;;CAAc;EAChF,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC,IAAI;IAAEC,YAAY;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,UAAU;IAAEC;GAAY,GAAGb,IAAI;EAC3F,MAAMc,GAAG,GAAGP,IAAI,CAACN,KAAK,CAAC;EACvB,MAAMc,GAAG,GAAGjB,cAAK,CAACkB,MAAM,CAAiB,IAAI,CAAC;EAE9ClB,cAAK,CAACmB,SAAS,CAAC;IACZ,IAAIF,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEG,OAAO,EAAE;MACdV,YAAY,CAACP,KAAK,EAAEc,GAAG,CAACG,OAAO,CAACC,qBAAqB,EAAE,CAAChB,MAAM,CAAC;;GAEtE,EAAE,CAACU,UAAU,CAACZ,KAAK,CAAC,CAAC,CAAC;EAEvB,IAAIa,GAAG,EAAE;IACLF,UAAU,CAACE,GAAG,EAAEb,KAAK,CAAC;IAEtB,oBACIH,6BAACsB,GAAG,oBACIX,QAAQ;MACZP,KAAK,EAAEA,KAAK;MACZmB,GAAG,EAAEpB,KAAK;MACVA,KAAK,EAAEA,KAAK;MACZa,GAAG,EAAEA,GAAG;MACRH,QAAQ,EAAEA,QAAQ;MAClBW,YAAY,EAAEZ,UAAU,CAACY,YAAY;MACrCd,YAAY,EAAEA,YAAY;MAC1BO,GAAG,EAAEA;OACP;;EAIV,oBACIjB;IAAKyB,SAAS,EAAC,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UAAU,CAACnC,GAAG,CAAC;;UAElBlB,WAAW,CAEnB;;;EAIT,oBACIC,6BAACkF,SAAS,oBAAKtE,UAAU;IAAEa,SAAS,EAAEA,SAAS;IAAEyB,SAAS,EAAEA,SAAS;IAAEjC,GAAG,EAAEwB;MACvE4B,IAAI,GAAGA,IAAI,GAAG1B,kBAAkB,EAAE,CAC3B;AAEpB,CAAC;AAEDL,aAAa,CAAC6C,MAAM,GAAG,MAAM,IAAI;AACjC7C,aAAa,CAAC8C,KAAK,GAAG,MAAM,IAAI;;;;"}
|
1
|
+
{"version":3,"file":"WindowedTable.js","sources":["../../../../../../../../src/components/Table/components/WindowedTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { PluginHook } from 'react-table';\nimport { areEqual, VariableSizeList } from 'react-window';\nimport InfiniteLoader from 'react-window-infinite-loader';\nimport { TableProps, ForwardedGenericTableWithStatics, TableRef } from '../types';\nimport { useTable } from '../hooks/useTable';\nimport { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Row } from '../util/renderRow';\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst ROW_HEIGHT = 40;\n\nconst VariableRow = React.memo(({ data, index, style: { height: _, ...style } }: any) => {\n const { texts } = useLocalization();\n const { rows, setRowHeight, rowProps, tableProps, instance, prepareRow, rowHeights } = data;\n const row = rows[index];\n const ref = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (ref?.current) {\n setRowHeight(index, ref.current.getBoundingClientRect().height);\n }\n }, [rowHeights[index]]);\n\n if (row) {\n prepareRow(row, index);\n\n return (\n <Row\n {...rowProps}\n style={style}\n key={index}\n index={index}\n row={row}\n instance={instance}\n headerGroups={tableProps.headerGroups}\n setRowHeight={setRowHeight}\n ref={ref}\n />\n );\n }\n\n return (\n <div className=\"yt-table__row\" role=\"row\" style={style}>\n <div className=\"yt-table__cell text-grey-300\">{texts.table.loading}</div>\n </div>\n );\n}, areEqual);\n\nconst getAverageRowHeight = (rowHeights = {}) => {\n const keys = Object.keys(rowHeights);\n const estimatedHeight = keys.reduce((p, i) => p + rowHeights[i], 0);\n return estimatedHeight / keys.length;\n};\n\nexport const WindowedTable = React.forwardRef(function WindowedTable<T>(\n props: TableProps<T> & { plugins: PluginHook<{}>[] },\n ref: React.Ref<TableRef>\n) {\n const tableRef: any = useMergedRef<HTMLDivElement>(ref);\n const { emptyStateRenderer = DefaultEmptyState, length, loadMore, ...otherProps } = props;\n const { rowProps, tableProps, rows, prepareRow, instance, state } = useTable<T>({ ...otherProps, windowed: true }, tableRef);\n\n // determine heights for windowing calculations\n const headerRef = React.useRef<HTMLDivElement>(null);\n const [rowsRef, setRowsRef] = React.useState<any>(null);\n const tableDimensions = useBoundingClientRectListener(tableRef);\n const headerDimensions = useBoundingClientRectListener(headerRef);\n const height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null;\n\n // variable row height calculations\n const estimatedRowHeight = rowProps.rowHeight || ROW_HEIGHT;\n const rowHeights = React.useRef<Record<string, number>>({});\n const setRowHeight = React.useCallback((index: number, size: number) => {\n if (rowHeights.current[index] !== size) {\n rowHeights.current = {\n ...rowHeights.current,\n [index]: size,\n };\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }\n }, []);\n const getRowHeight = React.useCallback(index => rowHeights.current[index] || estimatedRowHeight, []);\n\n React.useEffect(() => {\n if (rowsRef && rowProps.activeIndex !== undefined) {\n rowsRef.scrollToItem(rowProps.activeIndex, 'start');\n }\n }, [rowsRef, rowProps.activeIndex]);\n\n // trigger recalculation of variable row heights if the data changes\n React.useEffect(() => {\n rowHeights.current = {};\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }, [rows.length]);\n\n const contentHeight = estimatedRowHeight * props.data.length || 0;\n const isScrollbarVisible = height !== null ? contentHeight > height : false;\n\n const className = cn(tableProps.className, 'yt-table--windowed', { 'table-with-scrollbar': isScrollbarVisible });\n\n let list;\n\n const itemData = {\n rows,\n setRowHeight,\n rowProps,\n tableProps,\n instance,\n prepareRow,\n state,\n rowHeights: rowHeights.current,\n };\n\n if (height && rows.length) {\n const listProps = {\n height,\n itemData,\n estimatedItemSize: getAverageRowHeight(rowHeights.current),\n itemSize: getRowHeight,\n width: '100%',\n };\n\n if (loadMore && length) {\n const isLoaded = (index: number) => !!rows[index];\n\n list = (\n <InfiniteLoader isItemLoaded={isLoaded} itemCount={length} loadMoreItems={loadMore as any}>\n {({ onItemsRendered, ref }: any) => (\n <VariableSizeList\n {...listProps}\n itemCount={length}\n onItemsRendered={onItemsRendered}\n ref={list => {\n ref(list);\n setRowsRef(list);\n }}>\n {VariableRow}\n </VariableSizeList>\n )}\n </InfiniteLoader>\n );\n } else {\n list = (\n <VariableSizeList\n {...listProps}\n itemCount={rows.length}\n ref={ref => {\n setRowsRef(ref);\n }}>\n {VariableRow}\n </VariableSizeList>\n );\n }\n }\n\n return (\n <BaseTable {...tableProps} className={className} headerRef={headerRef} ref={tableRef}>\n {list ? list : emptyStateRenderer()}\n </BaseTable>\n );\n}) as ForwardedGenericTableWithStatics;\n\nWindowedTable.Column = () => null;\nWindowedTable.Group = () => null;\n"],"names":["ROW_HEIGHT","VariableRow","React","memo","data","index","style","height","_","texts","useLocalization","rows","setRowHeight","rowProps","tableProps","instance","prepareRow","rowHeights","row","ref","useRef","useEffect","current","getBoundingClientRect","Row","key","headerGroups","className","role","table","loading","areEqual","getAverageRowHeight","keys","Object","estimatedHeight","reduce","p","i","length","WindowedTable","forwardRef","props","tableRef","useMergedRef","emptyStateRenderer","DefaultEmptyState","loadMore","otherProps","state","useTable","windowed","headerRef","rowsRef","setRowsRef","useState","tableDimensions","useBoundingClientRectListener","headerDimensions","estimatedRowHeight","rowHeight","useCallback","size","resetAfterIndex","getRowHeight","activeIndex","undefined","scrollToItem","contentHeight","isScrollbarVisible","cn","list","itemData","listProps","estimatedItemSize","itemSize","width","isLoaded","InfiniteLoader","isItemLoaded","itemCount","loadMoreItems","onItemsRendered","VariableSizeList","BaseTable","Column","Group"],"mappings":";;;;;;;;;;;AAaA,MAAMA,UAAU,GAAG,EAAE;AAErB,MAAMC,WAAW,gBAAGC,cAAK,CAACC,IAAI,CAAC,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC,KAAK,EAAE;IAAEC,MAAM,EAAEC,CAAC;IAAE,GAAGF;;CAAc;EAChF,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC,IAAI;IAAEC,YAAY;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,UAAU;IAAEC;GAAY,GAAGb,IAAI;EAC3F,MAAMc,GAAG,GAAGP,IAAI,CAACN,KAAK,CAAC;EACvB,MAAMc,GAAG,GAAGjB,cAAK,CAACkB,MAAM,CAAiB,IAAI,CAAC;EAE9ClB,cAAK,CAACmB,SAAS,CAAC;IACZ,IAAIF,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEG,OAAO,EAAE;MACdV,YAAY,CAACP,KAAK,EAAEc,GAAG,CAACG,OAAO,CAACC,qBAAqB,EAAE,CAAChB,MAAM,CAAC;;GAEtE,EAAE,CAACU,UAAU,CAACZ,KAAK,CAAC,CAAC,CAAC;EAEvB,IAAIa,GAAG,EAAE;IACLF,UAAU,CAACE,GAAG,EAAEb,KAAK,CAAC;IAEtB,oBACIH,6BAACsB,GAAG,oBACIX,QAAQ;MACZP,KAAK,EAAEA,KAAK;MACZmB,GAAG,EAAEpB,KAAK;MACVA,KAAK,EAAEA,KAAK;MACZa,GAAG,EAAEA,GAAG;MACRH,QAAQ,EAAEA,QAAQ;MAClBW,YAAY,EAAEZ,UAAU,CAACY,YAAY;MACrCd,YAAY,EAAEA,YAAY;MAC1BO,GAAG,EAAEA;OACP;;EAIV,oBACIjB;IAAKyB,SAAS,EAAC,eAAe;IAACC,IAAI,EAAC,KAAK;IAACtB,KA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,CAEnB;;;EAIT,oBACIC,6BAACkF,SAAS,oBAAKtE,UAAU;IAAEa,SAAS,EAAEA,SAAS;IAAEyB,SAAS,EAAEA,SAAS;IAAEjC,GAAG,EAAEwB;MACvE4B,IAAI,GAAGA,IAAI,GAAG1B,kBAAkB,EAAE,CAC3B;AAEpB,CAAC;AAEDL,aAAa,CAAC6C,MAAM,GAAG,MAAM,IAAI;AACjC7C,aAAa,CAAC8C,KAAK,GAAG,MAAM,IAAI;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderColumn.js","sources":["../../../../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from '
|
1
|
+
{"version":3,"file":"renderColumn.js","sources":["../../../../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon } from '../../Icon/Icon';\n\nexport const Column = ({ cell }: any): any => {\n const props = {\n ...cell.getHeaderProps(),\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\n className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-700 hover:text-black', cell.className, {\n 'yt-table__cell__group': !!cell.columns,\n 'cursor-pointer': !cell.disableSorting,\n 'justify-start text-left': cell.align === 'left',\n 'justify-end text-right': cell.align === 'right',\n 'justify-center text-center': cell.align === 'center' || !cell.align,\n }),\n style: { ...cell.style, flex: cell.flex },\n };\n\n if (cell.isSorted) {\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\n }\n\n return (\n <div {...props} key={cell.id} data-taco=\"table-column\">\n <span className=\"truncate\">{cell.render('Header')}</span>\n {cell.isSorted ? (\n <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} className=\"-mt-0.5\" />\n ) : null}\n </div>\n );\n};\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;MAIaA,MAAM,GAAGA,CAAC;EAAEC;CAAW;EAChC,MAAMC,KAAK,GAAG;IACV,GAAGD,IAAI,CAACE,cAAc,EAAE;IACxB,IAAIF,IAAI,CAACG,oBAAoB,IAAIH,IAAI,CAACG,oBAAoB,CAAC;MAAEC,KAAK,EAAEC;KAAW,CAAC,CAAC;IACjFC,SAAS,EAAEC,EAAE,CAAC,qFAAqF,EAAEP,IAAI,CAACM,SAAS,EAAE;MACjH,uBAAuB,EAAE,CAAC,CAACN,IAAI,CAACQ,OAAO;MACvC,gBAAgB,EAAE,CAACR,IAAI,CAACS,cAAc;MACtC,yBAAyB,EAAET,IAAI,CAACU,KAAK,KAAK,MAAM;MAChD,wBAAwB,EAAEV,IAAI,CAACU,KAAK,KAAK,OAAO;MAChD,4BAA4B,EAAEV,IAAI,CAACU,KAAK,KAAK,QAAQ,IAAI,CAACV,IAAI,CAACU;KAClE,CAAC;IACFC,KAAK,EAAE;MAAE,GAAGX,IAAI,CAACW,KAAK;MAAEC,IAAI,EAAEZ,IAAI,CAACY;;GACtC;EAED,IAAIZ,IAAI,CAACa,QAAQ,EAAE;IACfZ,KAAK,CAAC,WAAW,CAAC,GAAGD,IAAI,CAACc,YAAY,GAAG,YAAY,GAAG,WAAW;;EAGvE,oBACIC,sDAASd,KAAK;IAAEe,GAAG,EAAEhB,IAAI,CAACiB,EAAE;iBAAY;mBACpCF;IAAMT,SAAS,EAAC;KAAYN,IAAI,CAACkB,MAAM,CAAC,QAAQ,CAAC,CAAQ,EACxDlB,IAAI,CAACa,QAAQ,kBACVE,6BAACI,IAAI;IAACC,IAAI,EAAEpB,IAAI,CAACc,YAAY,GAAG,oBAAoB,GAAG,kBAAkB;IAAER,SAAS,EAAC;IAAY,IACjG,IAAI,CACN;AAEd;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderRow.js","sources":["../../../../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from '
|
1
|
+
{"version":3,"file":"renderRow.js","sources":["../../../../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { FocusScope } from '@react-aria/focus';\nimport { InternalTableCell, TableRow } from '../types';\nimport { sanitizeRowProps } from '../util';\n\nconst renderCell = (cell: InternalTableCell, row: TableRow<any>): JSX.Element => {\n const props = {\n ...cell.getCellProps(),\n className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {\n 'justify-start text-left': cell.column.align === 'left',\n 'justify-end text-right': cell.column.align === 'right',\n 'text-center': !cell.column.align,\n }),\n style: {\n ...cell.column.style,\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\n },\n };\n return (\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\n {cell.render('Cell') || null}\n </div>\n );\n};\n\nexport const Row = React.forwardRef(function TableRow({ row, index, instance, headerGroups, ...rowProps }: any, ref: any) {\n const {\n activeIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n setActiveIndex,\n style,\n inlineEditingUniqueId,\n } = rowProps;\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n\n const props = {\n ...row.getRowProps(),\n style: {\n ...style,\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\n },\n className: cn(\n 'yt-table__row border-grey-300 flex border-b min-h-[2.5rem] hover:bg-grey-100',\n {\n 'yt-table__row--active bg-grey-200 hover:bg-grey-200': activeIndex === index,\n 'yt-table__row--clickable': !!onRowClick,\n 'yt-table__row--dragging': !!row.isDragging,\n 'yt-table__row--editing': !!row.isEditing,\n },\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\n ),\n onClick: onRowClick\n ? (event: React.MouseEvent<HTMLElement>) => {\n if (\n event.target === event.currentTarget ||\n (event.target as HTMLElement).classList.contains('yt-table__cell')\n ) {\n event.preventDefault();\n event.persist();\n setActiveIndex(index);\n onRowClick(sanitizedRow);\n }\n }\n : () => {\n setActiveIndex(index);\n },\n };\n\n let cells = row.cells;\n\n if (row.depth > 0) {\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\n }\n\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\n const rowContent = React.useMemo(() => {\n return (\n <>\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\n <div {...props} role=\"row\" ref={ref}>\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n </FocusScope>\n {expandedRow}\n </>\n );\n }, [row.original._createKey]);\n\n if (row.isEditing) {\n return rowContent;\n }\n\n return (\n <>\n <div {...props} role=\"row\" ref={ref}>\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n {expandedRow}\n </>\n );\n});\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","TableRow","index","instance","headerGroups","rowProps","ref","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;AAMA,MAAMA,UAAU,GAAGA,CAACC,IAAuB,EAAEC,GAAkB;EAC3D,MAAMC,KAAK,GAAG;IACV,GAAGF,IAAI,CAACG,YAAY,EAAE;IACtBC,SAAS,EAAEC,EAAE,CAAC,iDAAiD,EAAEL,IAAI,CAACM,MAAM,CAACF,SAAS,EAAE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,eAAe;MAACC,KAAK,EAAE5D,GAAG,CAAC6D;MAAM,eAC3DpD;MAAOiD,IAAI,EAAC,QAAQ;MAACC,IAAI,EAAC,wBAAwB;MAACC,KAAK,EAAE5D,GAAG,CAACqD,QAAQ,CAAC3B,qBAAqB;MAAK,EAChGkB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,CACG,EACZoB,WAAW,CACb;GAEV,EAAE,CAAC/C,GAAG,CAACqD,QAAQ,CAACC,UAAU,CAAC,CAAC;EAE7B,IAAItD,GAAG,CAACmC,SAAS,EAAE;IACf,OAAOc,UAAU;;EAGrB,oBACIxC,yEACIA,sDAASR,KAAK;IAAES,IAAI,EAAC,KAAK;IAACS,GAAG,EAAEA;MAC3ByB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,EACLoB,WAAW,CACb;AAEX,CAAC;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
-
import cn from '
|
2
|
+
import cn from 'clsx';
|
3
3
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
4
4
|
import { FocusScope } from '@react-aria/focus';
|
5
5
|
import { fixedForwardRef, FontSizes } from '../../types.js';
|
@@ -100,10 +100,6 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
100
100
|
const handleFocus = tableMeta.rowActive.rowActiveIndex === undefined ? event => {
|
101
101
|
tableMeta.rowActive.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);
|
102
102
|
} : undefined;
|
103
|
-
// mouse capture fires before focus, so we can prevent propagation and stop double setting of the active row
|
104
|
-
const handleMouseCapture = tableMeta.rowActive.rowActiveIndex === undefined ? event => {
|
105
|
-
tableMeta.rowActive.handleMouseCapture(event, table.getRowModel().rows.length);
|
106
|
-
} : undefined;
|
107
103
|
const handleScroll = function (event) {
|
108
104
|
try {
|
109
105
|
tableMeta.columnFreezing.handleScroll(event);
|
@@ -191,7 +187,6 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
191
187
|
})))))), table.getRowModel().rows.length ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(FocusScope, {
|
192
188
|
autoFocus: tableMeta.editing.isEditing
|
193
189
|
}, /*#__PURE__*/React__default.createElement("div", {
|
194
|
-
onMouseDownCapture: handleMouseCapture,
|
195
190
|
className: "group/body contents",
|
196
191
|
"data-taco": "table2-body",
|
197
192
|
role: "rowgroup",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { flexRender, TableMeta } from '@tanstack/react-table';\nimport { FocusScope } from '@react-aria/focus';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useCssGrid } from './hooks/useCssGrid';\nimport { useTable } from './hooks/useTable';\nimport { useTableRenderStrategy } from './strategies';\nimport { Table3ColumnProps, Table3GroupProps, Table3Props, Table3Ref } from './types';\nimport { Toolbar } from './components/toolbar/Toolbar';\nimport { useColumnFreezingStyle } from './hooks/features/useColumnFreezing';\nimport { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup';\nimport { Summary } from './components/columns/footer/Summary';\nimport { useCssVars } from './hooks/useCssVars';\nimport './style.css';\nimport { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle';\nimport { ErrorAlert } from './components/alert/ErrorAlert';\nimport { fixedForwardRef, FontSizes } from '../../types';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst Table = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const {\n emptyState: EmptyState,\n customSettings,\n toolbarLeft,\n toolbarRight,\n defaultCurrentRowIndex: defaultRowActiveIndex,\n } = props;\n const internalRef = useMergedRef<Table3Ref>(ref);\n\n const { table, length } = useTable<TType>(props, internalRef);\n useTableRefInstanceSetup(table, internalRef);\n\n React.useEffect(() => {\n if (props.autoFocus) {\n internalRef.current?.focus();\n }\n }, []);\n\n const { renderBody, scrollToIndex } = useTableRenderStrategy<TType>(props, table, internalRef);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(() => {\n // On a very first render, the tanstack table rendered without any rows,\n // so we delaying default row scrolling logic with using of requestAnimation frame\n const animationFrameId = requestAnimationFrame(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center' });\n }\n });\n\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, []);\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n // Select2 also have combobox role to align with W3C guidelines\n const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]:not([data-taco=\"Select2\"])');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (\n eventOriginatedFromCombobox ||\n (dialog && !dialog?.contains(internalRef.current)) ||\n tableMeta.shortcutsState.isPaused\n ) {\n return;\n }\n\n const rows = table.getRowModel().rows;\n\n tableMeta.rowActive.handleKeyDown(\n event,\n rows.length,\n scrollToIndex,\n tableMeta.editing.isEditing ? undefined : internalRef\n );\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n tableMeta.rowClick.handleKeyDown(event, rows[tableMeta.rowActive.rowActiveIndex]?.original);\n }\n tableMeta.rowSelection.handleKeyDown(event, table);\n tableMeta.editing.handleKeyDown(event);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [scrollToIndex, tableMeta.editing.isEditing, internalRef.current, tableMeta.rowActive.rowActiveIndex]\n );\n\n const handleBlur = tableMeta.editing.isEnabled\n ? (event: React.FocusEvent) => {\n tableMeta.editing.handleBlur(event);\n }\n : undefined;\n\n const handleFocus =\n tableMeta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n tableMeta.rowActive.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);\n }\n : undefined;\n\n // mouse capture fires before focus, so we can prevent propagation and stop double setting of the active row\n const handleMouseCapture =\n tableMeta.rowActive.rowActiveIndex === undefined\n ? (event: React.MouseEvent) => {\n tableMeta.rowActive.handleMouseCapture(event, table.getRowModel().rows.length);\n }\n : undefined;\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n tableMeta.columnFreezing.handleScroll(event);\n };\n\n const className = cn(\n 'border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none',\n '[&[data-resizing=\"true\"]]:select-none',\n {\n 'text-xs': tableMeta.fontSize.size === FontSizes.small,\n 'text-sm': tableMeta.fontSize.size === FontSizes.medium,\n 'text-base': tableMeta.fontSize.size === FontSizes.large,\n }\n );\n\n // Print tables have \"_print\" as the postfix for the table id, so we can use the it to determine\n // if the table is a print table or not.\n const { style: cssGridStyle } = useCssGrid<TType>(\n table,\n tableMeta.printing.isPrinting,\n tableMeta.rowActions.actionsForRowLength,\n tableMeta.fontSize.size\n );\n const { style: cssVars } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);\n\n const style = {\n ...cssVars,\n ...cssGridStyle,\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n };\n\n const columnFreezingStyle = useColumnFreezingStyle(props.id, table);\n const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);\n const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;\n\n return (\n <>\n {columnFreezingStyle ? <style data-taco=\"table3-column-freezing-styles\">{columnFreezingStyle}</style> : null}\n {headerOffsetStyle && !tableMeta.printing.isPrinting ? (\n <style data-taco=\"table3-column-header-offset-styles\">{headerOffsetStyle}</style>\n ) : null}\n <Toolbar\n table={table}\n tableProps={props}\n total={length}\n left={toolbarLeft}\n right={toolbarRight}\n customSettings={customSettings}\n scrollToIndex={scrollToIndex}\n />\n <ErrorAlert table={table} tableRef={internalRef} scrollToIndex={scrollToIndex} rowIdentifier={props.rowIdentifier} />\n <div\n className={className}\n id={props.id}\n data-font-size={tableMeta.fontSize.size}\n data-editing={tableMeta.editing.isEditing}\n data-horizontally-scrolled={tableMeta.columnFreezing.horizontallyScrolled}\n data-pause-hover={tableMeta?.rowActive.isHoverStatePaused}\n data-resizing={!!state.columnSizingInfo.isResizingColumn}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onFocus={handleFocus}\n onScroll={handleScroll}\n ref={internalRef}\n role=\"table\"\n style={style}\n tabIndex={-1}>\n {isServerLoadingAndNotReady ? null : (\n <div className=\"group/header contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, index) => {\n // We need to render separator if column is not the last in array, if index is not equal to freeze column index,\n // if next element is not placeholder and if column itself is not placeholder.\n const hasSeparator =\n index !== tableMeta.columnFreezing.frozenColumnIndex &&\n index !== headerGroup.headers.length - 1 &&\n (!headerGroup.headers[index + 1]?.isPlaceholder || !header.isPlaceholder);\n return (\n <React.Fragment key={header.id}>\n {flexRender(header.column.columnDef.header, {\n ...header.getContext(),\n scrollToIndex,\n hasSeparator,\n })}\n </React.Fragment>\n );\n })}\n </div>\n ))}\n </div>\n )}\n {table.getRowModel().rows.length ? (\n <>\n <FocusScope autoFocus={tableMeta.editing.isEditing}>\n <div\n onMouseDownCapture={handleMouseCapture}\n className=\"group/body contents\"\n data-taco=\"table2-body\"\n role=\"rowgroup\"\n ref={bodyRef}>\n {renderBody()}\n </div>\n </FocusScope>\n {/* This div makes sure that there is always a free space between the rows and footer when\n table height exceeds the cumulative height of all rows. See useCSSGrid.ts */}\n {/* By vertically translating the div a pixel down, we hide the div border below footer so that\n the footer border doesn't appear an extra pixel thick */}\n <div className=\"border-grey-300 col-span-full translate-y-px border-t\" />\n {tableMeta.enableFooter ? (\n <div className=\"group/footer contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n {\n // Render the footer cell only for individual columns, excluding column groups.\n table\n .getFooterGroups()\n .slice(0, 1)\n .map(footerGroup => (\n <div className=\"contents\" key={footerGroup.id} role=\"row\">\n {footerGroup.headers.map(footer => (\n <React.Fragment key={footer.id}>\n {flexRender(footer.column.columnDef.footer, footer.getContext())}\n </React.Fragment>\n ))}\n </div>\n ))\n }\n {length ? (\n <Summary currentLength={table.getRowModel().rows.length} length={length} table={table} />\n ) : null}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"col-span-full min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n </div>\n </>\n );\n});\n\ntype Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <Table<TType> {...props} key={key} ref={ref} />;\n}) as Table3WithStatics;\nTable3.Column = Column;\nTable3.Group = Group;\n\n// hooks\nexport { useTable3DataLoader } from './hooks/useTableDataLoader';\n\n// types\nexport type {\n useTable3DataFetcher,\n useTable3DataOptions,\n useTable3DataFetcherValues as useTableDataValues,\n} from './hooks/useTableDataLoader';\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3Preset,\n Table3Settings,\n Table3SettingsHandler,\n Table3RowHeight,\n Table3FilterComparator,\n Table3FilterHandler,\n Table3LoadPageHandler,\n Table3LoadAllHandler,\n Table3RowGotoHandler,\n Table3SortHandler,\n Table3Shortcuts,\n Table3ShortcutHandlerFn,\n Table3ShortcutHandlerObject,\n Table3SortDirection,\n Table3SortFn,\n Table3RowActionRenderer,\n Table3RowSelectionHandler,\n Table3RowExpansionRenderer,\n Table3RowDropHandler,\n Table3RowDragHandler,\n Table3RowClickHandler,\n Table3ColumnProps,\n Table3ColumnAlignment,\n Table3ColumnDataType,\n Table3ColumnHeaderMenu,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n Table3ColumnRenderer,\n Table3ColumnControlRenderer,\n Table3ColumnControlProps,\n} from './types';\n"],"names":["Column","_","displayName","Group","Table","fixedForwardRef","Table3","props","ref","emptyState","EmptyState","customSettings","toolbarLeft","toolbarRight","defaultCurrentRowIndex","defaultRowActiveIndex","internalRef","useMergedRef","table","length","useTable","useTableRefInstanceSetup","React","useEffect","autoFocus","_internalRef$current","current","focus","renderBody","scrollToIndex","useTableRenderStrategy","tableMeta","options","meta","state","getState","bodyRef","useRef","animationFrameId","requestAnimationFrame","align","cancelAnimationFrame","handleKeyDown","event","target","dialog","closest","eventOriginatedFromCombobox","contains","shortcutsState","isPaused","rows","getRowModel","rowActive","editing","isEditing","undefined","rowActiveIndex","_rows$tableMeta$rowAc","rowClick","original","rowSelection","document","addEventListener","removeEventListener","handleBlur","isEnabled","handleFocus","handleMouseCapture","handleScroll","columnFreezing","Promise","resolve","e","reject","className","cn","fontSize","size","FontSizes","small","medium","large","style","cssGridStyle","useCssGrid","printing","isPrinting","rowActions","actionsForRowLength","cssVars","useCssVars","rowHeight","height","opacity","columnFreezingStyle","useColumnFreezingStyle","id","headerOffsetStyle","useHeaderOffsetStyle","isServerLoadingAndNotReady","isUsingServer","Toolbar","tableProps","total","left","right","ErrorAlert","tableRef","rowIdentifier","horizontallyScrolled","isHoverStatePaused","columnSizingInfo","isResizingColumn","onBlur","onFocus","onScroll","role","tabIndex","getHeaderGroups","map","headerGroup","key","headers","header","index","hasSeparator","frozenColumnIndex","_headerGroup$headers","isPlaceholder","Fragment","flexRender","column","columnDef","getContext","FocusScope","onMouseDownCapture","enableFooter","getFooterGroups","slice","footerGroup","footer","Summary","currentLength","stringifiedChildren","String","children","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAME,KAAK,gBAAGC,eAAe,CAAC,SAASC,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EAC/G,MAAM;IACFC,UAAU,EAAEC,UAAU;IACtBC,cAAc;IACdC,WAAW;IACXC,YAAY;IACZC,sBAAsB,EAAEC;GAC3B,GAAGR,KAAK;EACT,MAAMS,WAAW,GAAGC,YAAY,CAAYT,GAAG,CAAC;EAEhD,MAAM;IAAEU,KAAK;IAAEC;GAAQ,GAAGC,QAAQ,CAAQb,KAAK,EAAES,WAAW,CAAC;EAC7DK,wBAAwB,CAACH,KAAK,EAAEF,WAAW,CAAC;EAE5CM,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIhB,KAAK,CAACiB,SAAS,EAAE;MAAA,IAAAC,oBAAA;MACjB,CAAAA,oBAAA,GAAAT,WAAW,CAACU,OAAO,cAAAD,oBAAA,uBAAnBA,oBAAA,CAAqBE,KAAK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MAAM,GAAGA,MAAM;AACtBM,MAAM,CAACH,KAAK,GAAGA,KAAK;;;;"}
|
1
|
+
{"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { flexRender, TableMeta } from '@tanstack/react-table';\nimport { FocusScope } from '@react-aria/focus';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useCssGrid } from './hooks/useCssGrid';\nimport { useTable } from './hooks/useTable';\nimport { useTableRenderStrategy } from './strategies';\nimport { Table3ColumnProps, Table3GroupProps, Table3Props, Table3Ref } from './types';\nimport { Toolbar } from './components/toolbar/Toolbar';\nimport { useColumnFreezingStyle } from './hooks/features/useColumnFreezing';\nimport { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup';\nimport { Summary } from './components/columns/footer/Summary';\nimport { useCssVars } from './hooks/useCssVars';\nimport './style.css';\nimport { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle';\nimport { ErrorAlert } from './components/alert/ErrorAlert';\nimport { fixedForwardRef, FontSizes } from '../../types';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst Table = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const {\n emptyState: EmptyState,\n customSettings,\n toolbarLeft,\n toolbarRight,\n defaultCurrentRowIndex: defaultRowActiveIndex,\n } = props;\n const internalRef = useMergedRef<Table3Ref>(ref);\n\n const { table, length } = useTable<TType>(props, internalRef);\n useTableRefInstanceSetup(table, internalRef);\n\n React.useEffect(() => {\n if (props.autoFocus) {\n internalRef.current?.focus();\n }\n }, []);\n\n const { renderBody, scrollToIndex } = useTableRenderStrategy<TType>(props, table, internalRef);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(() => {\n // On a very first render, the tanstack table rendered without any rows,\n // so we delaying default row scrolling logic with using of requestAnimation frame\n const animationFrameId = requestAnimationFrame(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center' });\n }\n });\n\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, []);\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n // Select2 also have combobox role to align with W3C guidelines\n const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]:not([data-taco=\"Select2\"])');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (\n eventOriginatedFromCombobox ||\n (dialog && !dialog?.contains(internalRef.current)) ||\n tableMeta.shortcutsState.isPaused\n ) {\n return;\n }\n\n const rows = table.getRowModel().rows;\n\n tableMeta.rowActive.handleKeyDown(\n event,\n rows.length,\n scrollToIndex,\n tableMeta.editing.isEditing ? undefined : internalRef\n );\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n tableMeta.rowClick.handleKeyDown(event, rows[tableMeta.rowActive.rowActiveIndex]?.original);\n }\n tableMeta.rowSelection.handleKeyDown(event, table);\n tableMeta.editing.handleKeyDown(event);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [scrollToIndex, tableMeta.editing.isEditing, internalRef.current, tableMeta.rowActive.rowActiveIndex]\n );\n\n const handleBlur = tableMeta.editing.isEnabled\n ? (event: React.FocusEvent) => {\n tableMeta.editing.handleBlur(event);\n }\n : undefined;\n\n const handleFocus =\n tableMeta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n tableMeta.rowActive.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);\n }\n : undefined;\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n tableMeta.columnFreezing.handleScroll(event);\n };\n\n const className = cn(\n 'border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none',\n '[&[data-resizing=\"true\"]]:select-none',\n {\n 'text-xs': tableMeta.fontSize.size === FontSizes.small,\n 'text-sm': tableMeta.fontSize.size === FontSizes.medium,\n 'text-base': tableMeta.fontSize.size === FontSizes.large,\n }\n );\n\n // Print tables have \"_print\" as the postfix for the table id, so we can use the it to determine\n // if the table is a print table or not.\n const { style: cssGridStyle } = useCssGrid<TType>(\n table,\n tableMeta.printing.isPrinting,\n tableMeta.rowActions.actionsForRowLength,\n tableMeta.fontSize.size\n );\n const { style: cssVars } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);\n\n const style = {\n ...cssVars,\n ...cssGridStyle,\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n };\n\n const columnFreezingStyle = useColumnFreezingStyle(props.id, table);\n const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);\n const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;\n\n return (\n <>\n {columnFreezingStyle ? <style data-taco=\"table3-column-freezing-styles\">{columnFreezingStyle}</style> : null}\n {headerOffsetStyle && !tableMeta.printing.isPrinting ? (\n <style data-taco=\"table3-column-header-offset-styles\">{headerOffsetStyle}</style>\n ) : null}\n <Toolbar\n table={table}\n tableProps={props}\n total={length}\n left={toolbarLeft}\n right={toolbarRight}\n customSettings={customSettings}\n scrollToIndex={scrollToIndex}\n />\n <ErrorAlert table={table} tableRef={internalRef} scrollToIndex={scrollToIndex} rowIdentifier={props.rowIdentifier} />\n <div\n className={className}\n id={props.id}\n data-font-size={tableMeta.fontSize.size}\n data-editing={tableMeta.editing.isEditing}\n data-horizontally-scrolled={tableMeta.columnFreezing.horizontallyScrolled}\n data-pause-hover={tableMeta?.rowActive.isHoverStatePaused}\n data-resizing={!!state.columnSizingInfo.isResizingColumn}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onFocus={handleFocus}\n onScroll={handleScroll}\n ref={internalRef}\n role=\"table\"\n style={style}\n tabIndex={-1}>\n {isServerLoadingAndNotReady ? null : (\n <div className=\"group/header contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, index) => {\n // We need to render separator if column is not the last in array, if index is not equal to freeze column index,\n // if next element is not placeholder and if column itself is not placeholder.\n const hasSeparator =\n index !== tableMeta.columnFreezing.frozenColumnIndex &&\n index !== headerGroup.headers.length - 1 &&\n (!headerGroup.headers[index + 1]?.isPlaceholder || !header.isPlaceholder);\n return (\n <React.Fragment key={header.id}>\n {flexRender(header.column.columnDef.header, {\n ...header.getContext(),\n scrollToIndex,\n hasSeparator,\n })}\n </React.Fragment>\n );\n })}\n </div>\n ))}\n </div>\n )}\n {table.getRowModel().rows.length ? (\n <>\n <FocusScope autoFocus={tableMeta.editing.isEditing}>\n <div className=\"group/body contents\" data-taco=\"table2-body\" role=\"rowgroup\" ref={bodyRef}>\n {renderBody()}\n </div>\n </FocusScope>\n {/* This div makes sure that there is always a free space between the rows and footer when\n table height exceeds the cumulative height of all rows. See useCSSGrid.ts */}\n {/* By vertically translating the div a pixel down, we hide the div border below footer so that\n the footer border doesn't appear an extra pixel thick */}\n <div className=\"border-grey-300 col-span-full translate-y-px border-t\" />\n {tableMeta.enableFooter ? (\n <div className=\"group/footer contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n {\n // Render the footer cell only for individual columns, excluding column groups.\n table\n .getFooterGroups()\n .slice(0, 1)\n .map(footerGroup => (\n <div className=\"contents\" key={footerGroup.id} role=\"row\">\n {footerGroup.headers.map(footer => (\n <React.Fragment key={footer.id}>\n {flexRender(footer.column.columnDef.footer, footer.getContext())}\n </React.Fragment>\n ))}\n </div>\n ))\n }\n {length ? (\n <Summary currentLength={table.getRowModel().rows.length} length={length} table={table} />\n ) : null}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"col-span-full min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n </div>\n </>\n );\n});\n\ntype Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <Table<TType> {...props} key={key} ref={ref} />;\n}) as Table3WithStatics;\nTable3.Column = Column;\nTable3.Group = Group;\n\n// hooks\nexport { useTable3DataLoader } from './hooks/useTableDataLoader';\n\n// types\nexport type {\n useTable3DataFetcher,\n useTable3DataOptions,\n useTable3DataFetcherValues as useTableDataValues,\n} from './hooks/useTableDataLoader';\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3Preset,\n Table3Settings,\n Table3SettingsHandler,\n Table3RowHeight,\n Table3FilterComparator,\n Table3FilterHandler,\n Table3LoadPageHandler,\n Table3LoadAllHandler,\n Table3RowGotoHandler,\n Table3SortHandler,\n Table3Shortcuts,\n Table3ShortcutHandlerFn,\n Table3ShortcutHandlerObject,\n Table3SortDirection,\n Table3SortFn,\n Table3RowActionRenderer,\n Table3RowSelectionHandler,\n Table3RowExpansionRenderer,\n Table3RowDropHandler,\n Table3RowDragHandler,\n Table3RowClickHandler,\n Table3ColumnProps,\n Table3ColumnAlignment,\n Table3ColumnDataType,\n Table3ColumnHeaderMenu,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n Table3ColumnRenderer,\n Table3ColumnControlRenderer,\n Table3ColumnControlProps,\n} from './types';\n"],"names":["Column","_","displayName","Group","Table","fixedForwardRef","Table3","props","ref","emptyState","EmptyState","customSettings","toolbarLeft","toolbarRight","defaultCurrentRowIndex","defaultRowActiveIndex","internalRef","useMergedRef","table","length","useTable","useTableRefInstanceSetup","React","useEffect","autoFocus","_internalRef$current","current","focus","renderBody","scrollToIndex","useTableRenderStrategy","tableMeta","options","meta","state","getState","bodyRef","useRef","animationFrameId","requestAnimationFrame","align","cancelAnimationFrame","handleKeyDown","event","target","dialog","closest","eventOriginatedFromCombobox","contains","shortcutsState","isPaused","rows","getRowModel","rowActive","editing","isEditing","undefined","rowActiveIndex","_rows$tableMeta$rowAc","rowClick","original","rowSelection","document","addEventListener","removeEventListener","handleBlur","isEnabled","handleFocus","handleScroll","columnFreezing","Promise","resolve","e","reject","className","cn","fontSize","size","FontSizes","small","medium","large","style","cssGridStyle","useCssGrid","printing","isPrinting","rowActions","actionsForRowLength","cssVars","useCssVars","rowHeight","height","opacity","columnFreezingStyle","useColumnFreezingStyle","id","headerOffsetStyle","useHeaderOffsetStyle","isServerLoadingAndNotReady","isUsingServer","Toolbar","tableProps","total","left","right","ErrorAlert","tableRef","rowIdentifier","horizontallyScrolled","isHoverStatePaused","columnSizingInfo","isResizingColumn","onBlur","onFocus","onScroll","role","tabIndex","getHeaderGroups","map","headerGroup","key","headers","header","index","hasSeparator","frozenColumnIndex","_headerGroup$headers","isPlaceholder","Fragment","flexRender","column","columnDef","getContext","FocusScope","enableFooter","getFooterGroups","slice","footerGroup","footer","Summary","currentLength","stringifiedChildren","String","children","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,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