@economic/taco 2.15.0 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Drawer/Drawer.d.ts +5 -1
- package/dist/components/Provider/Localization.d.ts +19 -0
- package/dist/components/SearchInput2/SearchInput2.d.ts +1 -0
- package/dist/components/Table3/Table3.d.ts +0 -2
- package/dist/components/Table3/components/alert/ErrorAlert.d.ts +10 -0
- package/dist/components/Table3/components/columns/cell/DisplayCell.d.ts +5 -2
- package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +3 -0
- package/dist/components/Table3/components/columns/cell/EditingControl.d.ts +1 -1
- package/dist/components/Table3/components/columns/cell/Highlight.d.ts +2 -0
- package/dist/components/Table3/components/columns/header/Header.d.ts +1 -1
- package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
- package/dist/components/Table3/components/columns/styles.d.ts +2 -2
- package/dist/components/Table3/components/rows/Row.d.ts +5 -1
- package/dist/components/Table3/components/rows/RowContext.d.ts +1 -0
- package/dist/components/Table3/hooks/features/useEditing.d.ts +12 -11
- package/dist/components/Table3/hooks/features/{usePauseHoverState.d.ts → usePauseShortcuts.d.ts} +1 -2
- package/dist/components/Table3/hooks/features/useSearch.d.ts +3 -3
- package/dist/components/Table3/hooks/features/useValidation.d.ts +13 -0
- package/dist/components/Table3/hooks/useTable.d.ts +25 -20
- package/dist/components/Table3/types.d.ts +41 -19
- package/dist/components/Table3/util/editing.d.ts +6 -0
- package/dist/components/Table3/util/scrolling.d.ts +2 -0
- package/dist/esm/index.css +108 -33
- 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/Calendar/Calendar.js +4 -4
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +3 -3
- package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +2 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +6 -6
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
- package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +7 -2
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +7 -7
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Field/Field.js +2 -2
- package/dist/esm/packages/taco/src/components/Field/Field.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/AgreementSelector.js +4 -4
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Link.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js +2 -2
- package/dist/esm/packages/taco/src/components/Icon/Icon.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/ScrollableList.js +6 -6
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js +4 -4
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +2 -2
- package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +3 -3
- 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 +2 -2
- package/dist/esm/packages/taco/src/components/Navigation2/components/Section.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/PageNumbers.js +2 -2
- package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +5 -5
- package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Popover/Popover.js +2 -2
- package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +19 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +2 -2
- package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +12 -8
- package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +2 -2
- package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -7
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +8 -8
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +5 -5
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +10 -10
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +2 -2
- package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +3 -3
- 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 +2 -2
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +10 -10
- package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +2 -2
- package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +37 -30
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +154 -0
- package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +54 -9
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +9 -57
- 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 +72 -41
- 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 +41 -17
- 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 +41 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +23 -14
- 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 +3 -3
- 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 +9 -9
- 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 +37 -6
- 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/internal/Actions.js +12 -12
- 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/Drag.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +63 -23
- 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/Expansion.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +3 -3
- 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 +2 -13
- 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 +67 -57
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +8 -6
- 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 +23 -8
- 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/FilterColumn.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +16 -16
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +53 -4
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +8 -8
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +185 -101
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js +12 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +4 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js +178 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +1 -49
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +0 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +135 -111
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +4 -4
- package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +21 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js +53 -0
- package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Tag/Tag.js +4 -4
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js +2 -2
- package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tour/Tour.js +4 -4
- package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +2 -2
- package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +2 -1
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js +10 -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 +8 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useFontSize.js → primitives/Table/useTable/features/useTableFontSize.js} +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +14 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +100 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js +30 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +9 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js +13 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +32 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +11 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js +15 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useFilteringStateListener.js → primitives/Table/useTable/listeners/useTableFilterListener.js} +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map +1 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js +40 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useRowSelectionListener.js → primitives/Table/useTable/listeners/useTableRowSelectionListener.js} +5 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useServerLoadingListener.js → primitives/Table/useTable/listeners/useTableServerLoadingListener.js} +3 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableServerLoadingListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useShortcutsListener.js → primitives/Table/useTable/listeners/useTableShortcutsListener.js} +7 -7
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableShortcutsListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useSortingStateListener.js → primitives/Table/useTable/listeners/useTableSortingListener.js} +6 -4
- package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSortingListener.js.map +1 -0
- package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useColumnOrdering.js → primitives/Table/useTable/util/columns.js} +24 -15
- package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -0
- package/dist/esm/packages/taco/src/types.js +6 -0
- package/dist/esm/packages/taco/src/types.js.map +1 -0
- package/dist/esm/packages/taco/src/utils/date.js +0 -1
- package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
- package/dist/index.css +108 -33
- package/dist/primitives/Table/types.d.ts +35 -0
- package/dist/primitives/Table/useTable/features/useTableColumnOrdering.d.ts +3 -0
- package/dist/primitives/Table/useTable/features/useTableFontSize.d.ts +7 -0
- package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +7 -0
- package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +12 -0
- package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +7 -0
- package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +5 -0
- package/dist/primitives/Table/useTable/features/useTableRowHeight.d.ts +7 -0
- package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +6 -0
- package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +6 -0
- package/dist/primitives/Table/useTable/listeners/useTableDataListener.d.ts +2 -0
- package/dist/primitives/Table/useTable/listeners/useTableFilterListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableFontSizeListener.d.ts +2 -0
- package/dist/primitives/Table/useTable/listeners/useTableRowSelectionListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableServerLoadingListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableShortcutsListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/listeners/useTableSortingListener.d.ts +3 -0
- package/dist/primitives/Table/useTable/util/columns.d.ts +4 -0
- package/dist/taco.cjs.development.js +2294 -1543
- 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/types.d.ts +5 -0
- package/package.json +3 -3
- package/types.json +13547 -12953
- package/dist/components/Table3/hooks/features/useColumnOrdering.d.ts +0 -6
- package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +0 -11
- package/dist/components/Table3/hooks/features/useFontSize.d.ts +0 -7
- package/dist/components/Table3/hooks/features/usePrinting.d.ts +0 -8
- package/dist/components/Table3/hooks/features/useRowClick.d.ts +0 -6
- package/dist/components/Table3/hooks/features/useRowGoto.d.ts +0 -5
- package/dist/components/Table3/hooks/features/useRowHeight.d.ts +0 -7
- package/dist/components/Table3/hooks/features/useRowSelection.d.ts +0 -6
- package/dist/components/Table3/hooks/listeners/useCurrentRowListener.d.ts +0 -2
- package/dist/components/Table3/hooks/listeners/useFilteringStateListener.d.ts +0 -3
- package/dist/components/Table3/hooks/listeners/useRowSelectionListener.d.ts +0 -3
- package/dist/components/Table3/hooks/listeners/useServerLoadingListener.d.ts +0 -3
- package/dist/components/Table3/hooks/listeners/useShortcutsListener.d.ts +0 -3
- package/dist/components/Table3/hooks/listeners/useSortingStateListener.d.ts +0 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnOrdering.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +0 -93
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useFontSize.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js +0 -22
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js +0 -14
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +0 -25
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js +0 -9
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js +0 -27
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +0 -32
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +0 -15
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useFilteringStateListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useRowSelectionListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useServerLoadingListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +0 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSortingStateListener.js.map +0 -1
package/dist/esm/index.css
CHANGED
@@ -705,94 +705,108 @@
|
|
705
705
|
}
|
706
706
|
|
707
707
|
/* normal rows */
|
708
|
-
[role='row']:not([data-selected='true']):not([data-
|
708
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true']) [role='cell'] {
|
709
709
|
@apply bg-white;
|
710
710
|
}
|
711
|
-
[role='row']:not([data-selected='true']):not([data-
|
711
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true']):hover [role='cell'] {
|
712
712
|
--table3-row-actions-shadow: theme(colors.grey.100);
|
713
713
|
@apply bg-grey-100;
|
714
714
|
}
|
715
|
-
[role='row']:not([data-selected='true']):not([data-
|
715
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true'])[data-current='true'] [role='cell'] {
|
716
716
|
--table3-row-actions-shadow: theme(colors.grey.100);
|
717
717
|
@apply bg-grey-100;
|
718
718
|
}
|
719
|
-
[role='row']:not([data-selected='true']):not([data-
|
719
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true'])[data-current='true']:hover [role='cell'] {
|
720
720
|
--table3-row-actions-shadow: theme(colors.grey.100);
|
721
721
|
@apply bg-grey-100;
|
722
722
|
}
|
723
|
+
/* Fields shouldn’t have white background when not in current row and hovered*/
|
724
|
+
[role='row']:not([data-selected='true']):not([data-invalid='true'])[data-current='false']:hover [role='cell'] .bg-white {
|
725
|
+
@apply !bg-grey-100;
|
726
|
+
}
|
723
727
|
/* normal rows when focus is inside the table */
|
724
728
|
[data-taco='table2']:focus-within
|
725
|
-
[role='row'][data-current='true']:not([data-selected='true']):not([data-
|
729
|
+
[role='row'][data-current='true']:not([data-selected='true']):not([data-invalid='true'])
|
726
730
|
[role='cell'] {
|
727
731
|
--table3-row-actions-shadow: theme(colors.grey.200);
|
728
732
|
@apply bg-grey-200;
|
729
733
|
}
|
730
734
|
/* normal rows when hover is paused */
|
731
|
-
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-
|
735
|
+
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-invalid='true']):hover:not([data-current='true']) [role='cell'] {
|
732
736
|
--table3-row-actions-shadow: theme(colors.white);
|
733
737
|
@apply !bg-white;
|
734
738
|
}
|
735
|
-
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-
|
739
|
+
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-invalid='true']):hover[data-current='true'] [role='cell'] {
|
736
740
|
--table3-row-actions-shadow: theme(colors.grey.200);
|
737
741
|
@apply !bg-grey-200;
|
738
742
|
}
|
739
743
|
|
740
744
|
/* selected rows */
|
741
|
-
[role='row'][data-selected='true']:not([data-
|
745
|
+
[role='row'][data-selected='true']:not([data-invalid='true']) [role='cell'] {
|
742
746
|
@apply bg-blue-100;
|
743
747
|
}
|
744
|
-
[role='row'][data-selected='true']:not([data-
|
748
|
+
[role='row'][data-selected='true']:not([data-invalid='true']):hover [role='cell'] {
|
745
749
|
--table3-row-actions-shadow: #d6e3f6;
|
746
750
|
@apply bg-[#D6E3F6];
|
747
751
|
}
|
748
|
-
[role='row'][data-selected='true']:not([data-
|
752
|
+
[role='row'][data-selected='true']:not([data-invalid='true'])[data-current='true']:hover [role='cell'],
|
749
753
|
|
750
|
-
[role='row'][data-selected='true']:not([data-
|
754
|
+
[role='row'][data-selected='true']:not([data-invalid='true'])[data-current='true'] [role='cell'] {
|
751
755
|
--table3-row-actions-shadow: #d6e3f6;
|
752
756
|
@apply bg-[#D6E3F6];
|
753
757
|
}
|
754
758
|
/* selected rows when focus is inside the table */
|
755
|
-
[data-taco='table2']:focus-within
|
759
|
+
[data-taco='table2']:focus-within
|
760
|
+
[role='row'][data-current='true'][data-selected='true']:not([data-invalid='true'])
|
761
|
+
[role='cell'] {
|
756
762
|
--table3-row-actions-shadow: #ccd8eb;
|
757
763
|
@apply bg-[#CCD8EB];
|
758
764
|
}
|
759
765
|
/* selected rows when hover is paused */
|
760
|
-
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-
|
766
|
+
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-invalid='true']):hover:not([data-current='true']) [role='cell'] {
|
761
767
|
--table3-row-actions-shadow: theme(colors.blue.100);
|
762
768
|
@apply !bg-blue-100;
|
763
769
|
}
|
764
|
-
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-
|
770
|
+
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-invalid='true']):hover[data-current='true'] [role='cell'] {
|
765
771
|
--table3-row-actions-shadow: #ccd8eb;
|
766
772
|
@apply !bg-[#CCD8EB];
|
767
773
|
}
|
768
774
|
|
769
775
|
/* error rows */
|
770
|
-
[role='row'][data-
|
776
|
+
[role='row'][data-invalid='true'] [role='cell'] {
|
771
777
|
@apply bg-[#FFEDE9];
|
772
778
|
}
|
773
|
-
[role='row'][data-
|
779
|
+
[role='row'][data-invalid='true']:hover [role='cell'] {
|
774
780
|
--table3-row-actions-shadow: #ffe4de;
|
775
781
|
@apply bg-[#FFE4DE];
|
776
782
|
}
|
777
|
-
[role='row'][data-
|
783
|
+
[role='row'][data-invalid='true'][data-current='true'] [role='cell'] {
|
778
784
|
--table3-row-actions-shadow: theme(colors.red.100);
|
779
785
|
@apply bg-red-100;
|
780
786
|
}
|
781
|
-
[role='row'][data-
|
787
|
+
[role='row'][data-invalid='true'][data-current='true']:hover [role='cell'] {
|
782
788
|
--table3-row-actions-shadow: #ffe4de;
|
783
789
|
@apply bg-[#FFE4DE];
|
784
790
|
}
|
791
|
+
/* Fields with errors shouldn’t have white background when not in current row */
|
792
|
+
[role='row'][data-invalid='true'][data-current='false'] [role='cell'] .bg-white {
|
793
|
+
@apply !bg-[#FFEDE9];
|
794
|
+
}
|
795
|
+
/* Request from UX: In error state, input backgroud color should be the same as row background color */
|
796
|
+
[role='row'][data-invalid='true'][data-current='false']:hover [role='cell'] .bg-white {
|
797
|
+
@apply !bg-[#FFE4DE];
|
798
|
+
}
|
785
799
|
/* error rows when focus is inside the table */
|
786
|
-
[data-taco='table2']:focus-within [role='row'][data-current='true'][data-
|
800
|
+
[data-taco='table2']:focus-within [role='row'][data-current='true'][data-invalid='true'] [role='cell'] {
|
787
801
|
--table3-row-actions-shadow: theme(colors.red.100);
|
788
802
|
@apply bg-red-100;
|
789
803
|
}
|
790
804
|
/* error rows when hover is paused */
|
791
|
-
[data-pause-hover='true'] [role='row'][data-
|
805
|
+
[data-pause-hover='true'] [role='row'][data-invalid='true']:hover:not([data-current='true']) [role='cell'] {
|
792
806
|
--table3-row-actions-shadow: #ffede9;
|
793
807
|
@apply !bg-[#FFEDE9];
|
794
808
|
}
|
795
|
-
[data-pause-hover='true'] [role='row'][data-
|
809
|
+
[data-pause-hover='true'] [role='row'][data-invalid='true']:hover[data-current='true'] [role='cell'] {
|
796
810
|
--table3-row-actions-shadow: theme(colors.red.100);
|
797
811
|
@apply !bg-red-100;
|
798
812
|
}
|
@@ -806,6 +820,12 @@
|
|
806
820
|
@apply !wcag-blue-500;
|
807
821
|
}
|
808
822
|
|
823
|
+
/* error row */
|
824
|
+
/*!!!!*/
|
825
|
+
[data-taco='table2-body'] [role='row'][data-invalid='true'] [role='cell'] {
|
826
|
+
/*@apply !bg-[#FFF5F2];*/
|
827
|
+
}
|
828
|
+
|
809
829
|
/* cell component overrides */
|
810
830
|
|
811
831
|
/* small font size */
|
@@ -824,7 +844,9 @@
|
|
824
844
|
}
|
825
845
|
|
826
846
|
[data-font-size='small'] [role='cell'] [data-taco='badge'],
|
827
|
-
[data-font-size='small'] [role='cell'] [data-taco='badge-icon']
|
847
|
+
[data-font-size='small'] [role='cell'] [data-taco='badge-icon'],
|
848
|
+
[data-font-size='small'] [role='cell'] [data-taco='icon'],
|
849
|
+
[data-font-size='small'] [role='cell'] [data-taco='spinner'] {
|
828
850
|
@apply !-my-0.5 !text-xs;
|
829
851
|
}
|
830
852
|
|
@@ -832,11 +854,21 @@
|
|
832
854
|
@apply !-my-1;
|
833
855
|
}
|
834
856
|
|
835
|
-
[data-font-size='small'] [role='cell'] [data-taco='
|
836
|
-
[data-font-size='small'] [role='cell'] [data-taco='
|
857
|
+
[data-font-size='small'] [role='cell'] [data-taco='Select2'],
|
858
|
+
[data-font-size='small'] [role='cell'] [data-taco='input-container'] {
|
837
859
|
@apply !-my-[3px];
|
838
860
|
}
|
839
861
|
|
862
|
+
/* from validation */
|
863
|
+
[data-font-size='small'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='Select2'],
|
864
|
+
[data-font-size='small'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='input-container'],
|
865
|
+
[data-font-size='small'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='Select2'],
|
866
|
+
[data-font-size='small'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='input-container'] {
|
867
|
+
@apply !-mt-1;
|
868
|
+
@apply !mb-0;
|
869
|
+
}
|
870
|
+
/*---*/
|
871
|
+
|
840
872
|
[data-font-size='small'] [role='cell'] [data-taco='input'],
|
841
873
|
[data-font-size='small'] [role='cell'] [data-taco='Select2'],
|
842
874
|
[data-font-size='small'] [role='cell'] [data-taco='textarea'] {
|
@@ -863,9 +895,18 @@
|
|
863
895
|
@apply !my-0;
|
864
896
|
}
|
865
897
|
|
866
|
-
|
867
|
-
|
868
|
-
|
898
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
899
|
+
|
900
|
+
[data-font-size='small'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
901
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_6px)];
|
902
|
+
}
|
903
|
+
|
904
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
905
|
+
because it should take all the available space in the cell */
|
906
|
+
|
907
|
+
[data-font-size='small'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
908
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_6px)];
|
909
|
+
}
|
869
910
|
|
870
911
|
[data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox'],
|
871
912
|
[data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
@@ -893,9 +934,18 @@
|
|
893
934
|
@apply !-my-[5px];
|
894
935
|
}
|
895
936
|
|
896
|
-
|
897
|
-
|
898
|
-
|
937
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
938
|
+
|
939
|
+
[data-font-size='medium'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
940
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_8px)];
|
941
|
+
}
|
942
|
+
|
943
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
944
|
+
because it should take all the available space in the cell */
|
945
|
+
|
946
|
+
[data-font-size='medium'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
947
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_8px)];
|
948
|
+
}
|
899
949
|
|
900
950
|
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox'],
|
901
951
|
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
@@ -904,6 +954,14 @@
|
|
904
954
|
@apply !mx-[calc(var(--table3-cell-padding-x)_-_3px)] !mt-px;
|
905
955
|
}
|
906
956
|
|
957
|
+
[data-font-size='medium'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='Select2'],
|
958
|
+
[data-font-size='medium'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='input-container'],
|
959
|
+
[data-font-size='medium'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='Select2'],
|
960
|
+
[data-font-size='medium'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='input-container'] {
|
961
|
+
@apply !-mt-1.5;
|
962
|
+
@apply !mb-0;
|
963
|
+
}
|
964
|
+
|
907
965
|
/* large font size */
|
908
966
|
[data-font-size='large'] [role='cell'] > [data-taco='button'],
|
909
967
|
[data-font-size='large'] [role='cell'] > [data-taco='icon-button'] {
|
@@ -923,6 +981,14 @@
|
|
923
981
|
@apply !-my-[7.5px];
|
924
982
|
}
|
925
983
|
|
984
|
+
[data-font-size='large'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='Select2'],
|
985
|
+
[data-font-size='large'] [role='row'][data-invalid='true'] [role='cell'] [data-taco='input-container'],
|
986
|
+
[data-font-size='large'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='Select2'],
|
987
|
+
[data-font-size='large'] [role='row'] [role='cell'][data-invalid='true'] [data-taco='input-container'] {
|
988
|
+
@apply !-mt-2;
|
989
|
+
@apply !mb-0;
|
990
|
+
}
|
991
|
+
|
926
992
|
[data-font-size='large'] [role='cell'] [data-taco='input'],
|
927
993
|
[data-font-size='large'] [role='cell'] [data-taco='Select2'],
|
928
994
|
[data-font-size='large'] [role='cell'] [data-taco='textarea'] {
|
@@ -937,9 +1003,18 @@
|
|
937
1003
|
@apply !h-6 !w-6;
|
938
1004
|
}
|
939
1005
|
|
940
|
-
|
941
|
-
|
942
|
-
|
1006
|
+
/* When cell is editable, but not highlighted, then we apply cell padding to a cell itself */
|
1007
|
+
|
1008
|
+
[data-font-size='large'] [role='cell'][data-editable]:not([data-highlighted='true']) {
|
1009
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_10px)];
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
/* When cell is editable and highlighted, the padding should apply to highlight wrapper,
|
1013
|
+
because it should take all the available space in the cell */
|
1014
|
+
|
1015
|
+
[data-font-size='large'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
|
1016
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_10px)];
|
1017
|
+
}
|
943
1018
|
|
944
1019
|
[data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox'],
|
945
1020
|
[data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
@@ -18,13 +18,13 @@ const Banner = /*#__PURE__*/forwardRef(function Banner(props, ref) {
|
|
18
18
|
className: className,
|
19
19
|
"data-taco": "banner",
|
20
20
|
ref: ref
|
21
|
-
}, getBannerIcon(state), children, onClose ? /*#__PURE__*/createElement(IconButton, {
|
21
|
+
}, getBannerIcon(state), children, onClose ? ( /*#__PURE__*/createElement(IconButton, {
|
22
22
|
"aria-label": texts.banner.close,
|
23
23
|
className: "ml-auto -mr-2 self-start",
|
24
24
|
icon: "close",
|
25
25
|
appearance: "discrete",
|
26
26
|
onClick: onClose
|
27
|
-
}) : null);
|
27
|
+
})) : null);
|
28
28
|
});
|
29
29
|
|
30
30
|
export { Banner };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Banner.js","sources":["../../../../../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { State } from '../../types';\nimport { getBannerIcon } from './util';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type BannerProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Content can be any react element, for e.g. a `div` */\n children: React.ReactNode;\n /** State will change the icon displayed in banner */\n state: State;\n onClose?: () => void;\n};\n\nexport type BannerTexts = {\n /** Aria-label for the close icon button of banner */\n close: string;\n};\n\nexport const Banner = React.forwardRef(function Banner(props: BannerProps, ref: React.Ref<HTMLDivElement>) {\n const { children, state, onClose } = props;\n const { texts } = useLocalization();\n const className = cn('bg-white relative flex items-center gap-2 py-2 px-4 leading-6 shadow-md z-10', props.className);\n\n return (\n <div className={className} data-taco=\"banner\" ref={ref}>\n {getBannerIcon(state)}\n {children}\n {onClose ? (\n <IconButton\n aria-label={texts.banner.close}\n className=\"ml-auto -mr-2 self-start\"\n icon=\"close\"\n appearance=\"discrete\"\n onClick={onClose}\n />\n ) : null}\n </div>\n );\n});\n"],"names":["Banner","React","props","ref","children","state","onClose","texts","useLocalization","className","cn","getBannerIcon","IconButton","banner","close","icon","appearance","onClick"],"mappings":";;;;;;MAoBaA,MAAM,gBAAGC,UAAgB,CAAC,SAASD,MAAMA,CAACE,KAAkB,EAAEC,GAA8B;EACrG,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC;GAAS,GAAGJ,KAAK;EAC1C,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,8EAA8E,EAAER,KAAK,CAACO,SAAS,CAAC;EAErH,oBACIR;IAAKQ,SAAS,EAAEA,SAAS;iBAAY,QAAQ;IAACN,GAAG,EAAEA;KAC9CQ,aAAa,CAACN,KAAK,CAAC,EACpBD,QAAQ,EACRE,OAAO,
|
1
|
+
{"version":3,"file":"Banner.js","sources":["../../../../../../../src/components/Banner/Banner.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { State } from '../../types';\nimport { getBannerIcon } from './util';\nimport { IconButton } from '../IconButton/IconButton';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type BannerProps = React.HTMLAttributes<HTMLDivElement> & {\n /** Content can be any react element, for e.g. a `div` */\n children: React.ReactNode;\n /** State will change the icon displayed in banner */\n state: State;\n onClose?: () => void;\n};\n\nexport type BannerTexts = {\n /** Aria-label for the close icon button of banner */\n close: string;\n};\n\nexport const Banner = React.forwardRef(function Banner(props: BannerProps, ref: React.Ref<HTMLDivElement>) {\n const { children, state, onClose } = props;\n const { texts } = useLocalization();\n const className = cn('bg-white relative flex items-center gap-2 py-2 px-4 leading-6 shadow-md z-10', props.className);\n\n return (\n <div className={className} data-taco=\"banner\" ref={ref}>\n {getBannerIcon(state)}\n {children}\n {onClose ? (\n <IconButton\n aria-label={texts.banner.close}\n className=\"ml-auto -mr-2 self-start\"\n icon=\"close\"\n appearance=\"discrete\"\n onClick={onClose}\n />\n ) : null}\n </div>\n );\n});\n"],"names":["Banner","React","props","ref","children","state","onClose","texts","useLocalization","className","cn","getBannerIcon","IconButton","banner","close","icon","appearance","onClick"],"mappings":";;;;;;MAoBaA,MAAM,gBAAGC,UAAgB,CAAC,SAASD,MAAMA,CAACE,KAAkB,EAAEC,GAA8B;EACrG,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC;GAAS,GAAGJ,KAAK;EAC1C,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,8EAA8E,EAAER,KAAK,CAACO,SAAS,CAAC;EAErH,oBACIR;IAAKQ,SAAS,EAAEA,SAAS;iBAAY,QAAQ;IAACN,GAAG,EAAEA;KAC9CQ,aAAa,CAACN,KAAK,CAAC,EACpBD,QAAQ,EACRE,OAAO,kBACJL,cAACW,UAAU;kBACKL,KAAK,CAACM,MAAM,CAACC,KAAK;IAC9BL,SAAS,EAAC,0BAA0B;IACpCM,IAAI,EAAC,OAAO;IACZC,UAAU,EAAC,UAAU;IACrBC,OAAO,EAAEX;IACX,IACF,IAAI,CACN;AAEd,CAAC;;;;"}
|
@@ -40,18 +40,18 @@ const Navbar = /*#__PURE__*/memo(({
|
|
40
40
|
name: "month",
|
41
41
|
onChange: handleChange,
|
42
42
|
value: value.getMonth()
|
43
|
-
}, months.map((month, i) => /*#__PURE__*/createElement("option", {
|
43
|
+
}, months.map((month, i) => ( /*#__PURE__*/createElement("option", {
|
44
44
|
key: month,
|
45
45
|
value: i
|
46
|
-
}, month))), /*#__PURE__*/createElement("select", {
|
46
|
+
}, month)))), /*#__PURE__*/createElement("select", {
|
47
47
|
className: "h-8 px-2",
|
48
48
|
name: "year",
|
49
49
|
onChange: handleChange,
|
50
50
|
value: value.getFullYear()
|
51
|
-
}, years.map(year => /*#__PURE__*/createElement("option", {
|
51
|
+
}, years.map(year => ( /*#__PURE__*/createElement("option", {
|
52
52
|
key: year,
|
53
53
|
value: year
|
54
|
-
}, String(year))))), /*#__PURE__*/createElement("div", null, /*#__PURE__*/createElement(Tooltip, {
|
54
|
+
}, String(year)))))), /*#__PURE__*/createElement("div", null, /*#__PURE__*/createElement(Tooltip, {
|
55
55
|
title: actions.previousMonth
|
56
56
|
}, /*#__PURE__*/createElement(IconButton, {
|
57
57
|
appearance: "discrete",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Calendar.js","sources":["../../../../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport ReactDayPicker, { NavbarElementProps, Modifier } from 'react-day-picker';\nimport { useLocalization } from '../Provider/Localization';\nimport './Calendar.css';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport type CalendarTextsActions = {\n /** Aria-label for previous month action button */\n previousMonth: string;\n /** Aria-label for next month action button */\n nextMonth: string;\n /** Aria-label for previous year action button */\n previousYear: string;\n /** Aria-label for next year action button */\n nextYear: string;\n /** Text displayed within today action button */\n today: string;\n};\n\nexport type CalendarTexts = {\n /** Text and aria-label for action buttons in Calendar */\n actions: CalendarTextsActions;\n /** Text abbreviation for months in Calendar's header, starting with January */\n months: string[];\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\n weekdaysShort: string[];\n /** Text for days in Calendar's header, starting with Sunday */\n weekdays: string[];\n};\n\n/** @internal */\ntype CustomNavbarElementProps = NavbarElementProps & {\n onMonthChange: (month: Date) => void;\n value?: Date;\n};\n\nconst thisYear = new Date().getFullYear();\nconst years: number[] = [];\n\nfor (let i = thisYear - 50; i <= thisYear + 10; i += 1) {\n years.push(i);\n}\n\nconst Navbar = React.memo(\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\n const {\n texts: {\n calendar: { actions, months },\n },\n } = useLocalization();\n\n const handleChange = function handleChange(event) {\n const { year, month } = event.target.form;\n onMonthChange(new Date(year.value, month.value));\n };\n\n return (\n <div className=\"mb-1 flex items-center justify-between\">\n <form className=\"inline-flex space-x-1\">\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\n {months.map((month, i) => (\n <option key={month} value={i}>\n {month}\n </option>\n ))}\n </select>\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\n {years.map(year => (\n <option key={year} value={year}>\n {String(year)}\n </option>\n ))}\n </select>\n </form>\n <div>\n <Tooltip title={actions.previousMonth}>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-left\"\n aria-label={actions.previousMonth}\n onClick={() => onPreviousClick()}\n rounded\n />\n </Tooltip>\n <Tooltip title={actions.nextMonth}>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-right\"\n aria-label={actions.nextMonth}\n onClick={() => onNextClick()}\n rounded\n />\n </Tooltip>\n </div>\n </div>\n );\n }\n);\n\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\n /** Handler called when a day is clicked in calendar */\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\n value?: Date;\n disabledDays?: Modifier[];\n};\n\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\n const { onChange: handleChange, value, disabledDays, ...otherProps } = props;\n const { locale, texts } = useLocalization();\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\n\n React.useEffect(() => {\n if (visibleMonth !== value) {\n setVisibleMonth(value ?? new Date());\n }\n // visibleMonth in deps array breaking month switching logic. It should not be in deps array.\n }, [value]);\n\n const handleDayClick = (date, modifiers, event) => {\n if (modifiers.outside || modifiers.disabled) {\n return;\n }\n\n handleChange(date, event);\n };\n\n const handleCalendarClickToday = (): void => {\n const today = new Date();\n\n // set to midday to avoid UTC offset causing dates to be mismatched server side\n today.setHours(12);\n today.setMinutes(0);\n today.setSeconds(0);\n\n handleChange(today);\n };\n\n const className = cn('flex bg-white text-xs p-2', otherProps.className);\n\n return (\n <div data-taco=\"calendar\">\n <ReactDayPicker\n {...otherProps}\n className={className}\n month={visibleMonth}\n selectedDays={value}\n locale={locale.substring(0, 2)}\n firstDayOfWeek={1}\n months={texts.calendar.months}\n weekdaysLong={texts.calendar.weekdays}\n weekdaysShort={texts.calendar.weekdaysShort}\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\n onDayClick={handleDayClick}\n onMonthChange={setVisibleMonth}\n onTodayButtonClick={handleCalendarClickToday}\n captionElement={() => null}\n todayButton={texts.calendar.actions.today}\n numberOfMonths={1}\n ref={ref}\n disabledDays={disabledDays}\n />\n </div>\n );\n});\n"],"names":["thisYear","Date","getFullYear","years","i","push","Navbar","React","onMonthChange","onNextClick","onPreviousClick","value","texts","calendar","actions","months","useLocalization","handleChange","event","year","month","target","form","className","name","onChange","getMonth","map","key","String","Tooltip","title","previousMonth","IconButton","appearance","icon","onClick","rounded","nextMonth","Calendar","props","ref","disabledDays","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","modifiers","outside","disabled","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysLong","weekdays","weekdaysShort","navbarElement","navProps","onDay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AEA,GAAG;IACRC,YAAY,EAAEA;KAChB,CACA;AAEd,CAAC;;;;"}
|
1
|
+
{"version":3,"file":"Calendar.js","sources":["../../../../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport ReactDayPicker, { NavbarElementProps, Modifier } from 'react-day-picker';\nimport { useLocalization } from '../Provider/Localization';\nimport './Calendar.css';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport type CalendarTextsActions = {\n /** Aria-label for previous month action button */\n previousMonth: string;\n /** Aria-label for next month action button */\n nextMonth: string;\n /** Aria-label for previous year action button */\n previousYear: string;\n /** Aria-label for next year action button */\n nextYear: string;\n /** Text displayed within today action button */\n today: string;\n};\n\nexport type CalendarTexts = {\n /** Text and aria-label for action buttons in Calendar */\n actions: CalendarTextsActions;\n /** Text abbreviation for months in Calendar's header, starting with January */\n months: string[];\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\n weekdaysShort: string[];\n /** Text for days in Calendar's header, starting with Sunday */\n weekdays: string[];\n};\n\n/** @internal */\ntype CustomNavbarElementProps = NavbarElementProps & {\n onMonthChange: (month: Date) => void;\n value?: Date;\n};\n\nconst thisYear = new Date().getFullYear();\nconst years: number[] = [];\n\nfor (let i = thisYear - 50; i <= thisYear + 10; i += 1) {\n years.push(i);\n}\n\nconst Navbar = React.memo(\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\n const {\n texts: {\n calendar: { actions, months },\n },\n } = useLocalization();\n\n const handleChange = function handleChange(event) {\n const { year, month } = event.target.form;\n onMonthChange(new Date(year.value, month.value));\n };\n\n return (\n <div className=\"mb-1 flex items-center justify-between\">\n <form className=\"inline-flex space-x-1\">\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\n {months.map((month, i) => (\n <option key={month} value={i}>\n {month}\n </option>\n ))}\n </select>\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\n {years.map(year => (\n <option key={year} value={year}>\n {String(year)}\n </option>\n ))}\n </select>\n </form>\n <div>\n <Tooltip title={actions.previousMonth}>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-left\"\n aria-label={actions.previousMonth}\n onClick={() => onPreviousClick()}\n rounded\n />\n </Tooltip>\n <Tooltip title={actions.nextMonth}>\n <IconButton\n appearance=\"discrete\"\n icon=\"chevron-right\"\n aria-label={actions.nextMonth}\n onClick={() => onNextClick()}\n rounded\n />\n </Tooltip>\n </div>\n </div>\n );\n }\n);\n\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\n /** Handler called when a day is clicked in calendar */\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\n value?: Date;\n disabledDays?: Modifier[];\n};\n\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\n const { onChange: handleChange, value, disabledDays, ...otherProps } = props;\n const { locale, texts } = useLocalization();\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\n\n React.useEffect(() => {\n if (visibleMonth !== value) {\n setVisibleMonth(value ?? new Date());\n }\n // visibleMonth in deps array breaking month switching logic. It should not be in deps array.\n }, [value]);\n\n const handleDayClick = (date, modifiers, event) => {\n if (modifiers.outside || modifiers.disabled) {\n return;\n }\n\n handleChange(date, event);\n };\n\n const handleCalendarClickToday = (): void => {\n const today = new Date();\n\n // set to midday to avoid UTC offset causing dates to be mismatched server side\n today.setHours(12);\n today.setMinutes(0);\n today.setSeconds(0);\n\n handleChange(today);\n };\n\n const className = cn('flex bg-white text-xs p-2', otherProps.className);\n\n return (\n <div data-taco=\"calendar\">\n <ReactDayPicker\n {...otherProps}\n className={className}\n month={visibleMonth}\n selectedDays={value}\n locale={locale.substring(0, 2)}\n firstDayOfWeek={1}\n months={texts.calendar.months}\n weekdaysLong={texts.calendar.weekdays}\n weekdaysShort={texts.calendar.weekdaysShort}\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\n onDayClick={handleDayClick}\n onMonthChange={setVisibleMonth}\n onTodayButtonClick={handleCalendarClickToday}\n captionElement={() => null}\n todayButton={texts.calendar.actions.today}\n numberOfMonths={1}\n ref={ref}\n disabledDays={disabledDays}\n />\n </div>\n );\n});\n"],"names":["thisYear","Date","getFullYear","years","i","push","Navbar","React","onMonthChange","onNextClick","onPreviousClick","value","texts","calendar","actions","months","useLocalization","handleChange","event","year","month","target","form","className","name","onChange","getMonth","map","key","String","Tooltip","title","previousMonth","IconButton","appearance","icon","onClick","rounded","nextMonth","Calendar","props","ref","disabledDays","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","modifiers","outside","disabled","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysLong","weekdays","weekdaysShort","navbarElement","navProps","onDayClick","onTodayButtonClick","captionElement","todayButton","numberOfMonths"],"mappings":";;;;;;;AAsCA,MAAMA,QAAQ,gBAAG,IAAIC,IAAI,EAAE,CAACC,WAAW,EAAE;AACzC,MAAMC,KAAK,GAAa,EAAE;AAE1B,KAAK,IAAIC,CAAC,GAAGJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAIJ,QAAQ,GAAG,EAAE,EAAEI,CAAC,IAAI,CAAC,EAAE;EACpDD,KAAK,CAACE,IAAI,CAACD,CAAC,CAAC;;AAGjB,MAAME,MAAM,gBAAGC,IAAU,CACrB,CAAC;EAAEC,aAAa;EAAEC,WAAW;EAAEC,eAAe;EAAEC,KAAK,GAAG,IAAIV,IAAI;CAA8B;EAC1F,MAAM;IACFW,KAAK,EAAE;MACHC,QAAQ,EAAE;QAAEC,OAAO;QAAEC;;;GAE5B,GAAGC,eAAe,EAAE;EAErB,MAAMC,YAAY,GAAG,SAASA,YAAYA,CAACC,KAAK;IAC5C,MAAM;MAAEC,IAA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,MAAM,EAAEA,MAAM,CAACgB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9BC,cAAc,EAAE,CAAC;IACjB9C,MAAM,EAAEH,KAAK,CAACC,QAAQ,CAACE,MAAM;IAC7B+C,YAAY,EAAElD,KAAK,CAACC,QAAQ,CAACkD,QAAQ;IACrCC,aAAa,EAAEpD,KAAK,CAACC,QAAQ,CAACmD,aAAa;IAC3CC,aAAa,EAAEC,QAAQ,iBAAI3D,cAACD,MAAM,oBAAK4D,QAAQ;MAAE1D,aAAa,EAAEsC,eAAe;MAAEnC,KAAK,EAAEkC;OAAgB;IACxGsB,UAAU,EAAEpB,cAAc;IAC1BvC,aAAa,EAAEsC,eAAe;IAC9BsB,kBAAkB,EAAEhB,wBAAwB;IAC5CiB,cAAc,EAAEA,MAAM,IAAI;IAC1BC,WAAW,EAAE1D,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACuC,KAAK;IACzCkB,cAAc,EAAE,CAAC;IACjB9B,GAAG,EAAEA,GAAG;IACRC,YAAY,EAAEA;KAChB,CACA;AAEd,CAAC;;;;"}
|
@@ -42,7 +42,7 @@ const Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
|
|
42
42
|
ref: ref
|
43
43
|
}), /*#__PURE__*/createElement(Input, Object.assign({}, input, {
|
44
44
|
autoComplete: "off",
|
45
|
-
button: props.inline ? /*#__PURE__*/createElement(IconButton
|
45
|
+
button: props.inline ? ( /*#__PURE__*/createElement(IconButton
|
46
46
|
// In case of inline combobox, this icon button acts only as visual chevron representation,
|
47
47
|
// so should be taken out of screen reader scope.
|
48
48
|
, {
|
@@ -56,7 +56,7 @@ const Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
|
|
56
56
|
(_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
|
57
57
|
},
|
58
58
|
tabIndex: -1
|
59
|
-
}) : dialog ? /*#__PURE__*/createElement(IconButton, {
|
59
|
+
})) : dialog ? ( /*#__PURE__*/createElement(IconButton, {
|
60
60
|
"aria-label": texts.combobox.tooltip,
|
61
61
|
icon: "list-search",
|
62
62
|
disabled: props.readOnly || props.disabled,
|
@@ -70,7 +70,7 @@ const Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
|
|
70
70
|
ref: button.ref,
|
71
71
|
tabIndex: -1,
|
72
72
|
tooltip: texts.combobox.tooltip
|
73
|
-
}) : undefined
|
73
|
+
})) : undefined
|
74
74
|
})))), /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(Content, {
|
75
75
|
align: "start",
|
76
76
|
onOpenAutoFocus: event => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Combobox.js","sources":["../../../../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Input, InputProps } from '../Input/Input';\nimport { useCombobox } from './useCombobox';\nimport { ScrollableList, ScrollableListItem, ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { IconButton } from '../IconButton/IconButton';\nimport './Combobox.css';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type ComboboxTexts = {\n /* Tooltip shown for the dialog button */\n tooltip: string;\n};\n\nexport type ComboboxItem = ScrollableListItem;\nexport type ComboboxValue = ScrollableListItemValue;\n\ntype ComboboxBaseProps = Omit<InputProps, 'defaultValue' | 'button' | 'onChange' | 'value'> & {\n /** Array of options in combobox */\n data?: ComboboxItem[];\n /**\n * Initial value of the input in combobox.\n * This is used when combobox is mounted, if no value is provided.\n * *Note* that combobox is a controlled component, setting this will also trigger the `onChange` event\n */\n defaultValue?: ComboboxValue;\n /** Set what value should have an empty option in combobox */\n emptyValue?: ComboboxValue;\n /** Draws attention to the combobox by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Displays loading state in listbox */\n loading?: boolean;\n /**\n * Handler called when user chooses an option from the provided suggestions.\n * Suggestions will be calculated based on the input value.\n * There are two ways to choose an option: either click on it, or navigate using keyboard and press `enter`\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Handler called when the user enters a query **/\n onSearch?: (query: string) => void | Promise<void>;\n /** Value of the input in combobox */\n value?: ComboboxValue;\n};\n\ninterface InlineComboboxProps extends ComboboxBaseProps {\n dialog?: never;\n /**\n * Combobox will display its data when input is clicked/focused, even if the input is empty.\n * *Note* that default combobox will display matching data only when user starts typing in input.\n */\n inline: boolean; // Example 3 on https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html\n}\n\ninterface DialogComboboxProps extends ComboboxBaseProps {\n dialog: (props: Partial<DialogProps>) => JSX.Element;\n inline?: never;\n}\n\nexport type ComboboxProps = InlineComboboxProps | DialogComboboxProps;\n\nexport const Combobox = React.forwardRef(function Combobox(props: ComboboxProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, dialog, style, ...otherProps } = props;\n const { combobox, button, input, popover, list } = useCombobox(otherProps, ref);\n const internalRef = React.useRef<HTMLDivElement>(null);\n const { texts } = useLocalization();\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn(\n 'inline-flex relative',\n {\n 'yt-combobox--inline': props.inline,\n },\n externalClassName\n );\n\n return (\n <span className={className} data-taco=\"combobox\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Anchor asChild ref={internalRef}>\n <div {...combobox} className=\"inline w-full\" ref={ref}>\n <Input\n {...input}\n autoComplete=\"off\"\n button={\n props.inline ? (\n <IconButton\n // In case of inline combobox, this icon button acts only as visual chevron representation,\n // so should be taken out of screen reader scope.\n aria-hidden\n appearance=\"discrete\"\n className=\"!border-l-0 focus:!border-none focus:!shadow-none active:!border-none\"\n icon={popover.open ? 'chevron-up' : 'chevron-down'}\n onClick={() => {\n popover.onOpenChange(true);\n input.ref.current?.focus();\n }}\n tabIndex={-1}\n />\n ) : dialog ? (\n <IconButton\n aria-label={texts.combobox.tooltip}\n icon=\"list-search\"\n disabled={props.readOnly || props.disabled}\n dialog={dialog}\n onFocus={(event: React.FocusEvent<HTMLButtonElement>) => {\n // Prevents the default focus behaviour of showing the tooltip, on parent tooltip element\n event.preventDefault();\n input.ref.current?.focus();\n }}\n ref={button.ref}\n tabIndex={-1}\n tooltip={texts.combobox.tooltip}\n />\n ) : undefined\n }\n />\n </div>\n </PopoverPrimitive.Anchor>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align=\"start\"\n onOpenAutoFocus={event => {\n event.preventDefault();\n }}\n sideOffset={4}>\n <ScrollableList\n {...list}\n className={cn('max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)] !border-blue-500')}\n style={{ minWidth: selectDimensions?.width }}\n tabIndex={popover.open ? 0 : -1}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </span>\n );\n});\n"],"names":["Combobox","React","props","ref","className","externalClassName","dialog","style","otherProps","combobox","button","input","popover","list","useCombobox","internalRef","texts","useLocalization","selectDimensions","useBoundingClientRectListener","cn","inline","PopoverPrimitive","asChild","Input","autoComplete","IconButton","appearance","icon","open","onClick","onOpenChange","_input$ref$current","current","focus","tabIndex","tooltip","disabled","readOnly","onFocus","event","preventDefault","_input$ref$current2","undefined","align","onOpenAutoFocus","sideOffset","ScrollableList","minWidth","width"],"mappings":";;;;;;;;;;MA+DaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQA,CAACE,KAAoB,EAAEC,GAAgC;EAC7G,MAAM;IAAEC,SAAS,EAAEC,iBAAiB;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC5E,MAAM;IAAEO,QAAQ;IAAEC,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAM,GAAGC,WAAW,CAACN,UAAU,EAAEL,GAAG,CAAC;EAC/E,MAAMY,WAAW,GAAGd,MAAY,CAAiB,IAAI,CAAC;EACtD,MAAM;IAAEe;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,gBAAgB,GAAGC,6BAA6B,CAACJ,WAAW,CAAC;EACnE,MAAMX,SAAS,GAAGgB,EAAE,CAChB,sBAAsB,EACtB;IACI,qBAAqB,EAAElB,KAAK,CAACmB;GAChC,EACDhB,iBAAiB,CACpB;EAED,oBACIJ;IAAMG,SAAS,EAAEA,SAAS;iBAAY,UAAU;IAACG,KAAK,EAAEA;kBACpDN,cAACqB,IAAqB,oBAAKV,OAAO,gBAC9BX,cAACqB,MAAuB;IAACC,OAAO;IAACpB,GAAG,EAAEY;kBAClCd,uCAASQ,QAAQ;IAAEL,SAAS,EAAC,eAAe;IAACD,GAAG,EAAEA;mBAC9CF,cAACuB,KAAK,oBACEb,KAAK;IACTc,YAAY,EAAC,KAAK;IAClBf,MAAM,EACFR,KAAK,CAACmB,MAAM,
|
1
|
+
{"version":3,"file":"Combobox.js","sources":["../../../../../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport { Input, InputProps } from '../Input/Input';\nimport { useCombobox } from './useCombobox';\nimport { ScrollableList, ScrollableListItem, ScrollableListItemValue } from '../Listbox/ScrollableList';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { IconButton } from '../IconButton/IconButton';\nimport './Combobox.css';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type ComboboxTexts = {\n /* Tooltip shown for the dialog button */\n tooltip: string;\n};\n\nexport type ComboboxItem = ScrollableListItem;\nexport type ComboboxValue = ScrollableListItemValue;\n\ntype ComboboxBaseProps = Omit<InputProps, 'defaultValue' | 'button' | 'onChange' | 'value'> & {\n /** Array of options in combobox */\n data?: ComboboxItem[];\n /**\n * Initial value of the input in combobox.\n * This is used when combobox is mounted, if no value is provided.\n * *Note* that combobox is a controlled component, setting this will also trigger the `onChange` event\n */\n defaultValue?: ComboboxValue;\n /** Set what value should have an empty option in combobox */\n emptyValue?: ComboboxValue;\n /** Draws attention to the combobox by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Displays loading state in listbox */\n loading?: boolean;\n /**\n * Handler called when user chooses an option from the provided suggestions.\n * Suggestions will be calculated based on the input value.\n * There are two ways to choose an option: either click on it, or navigate using keyboard and press `enter`\n */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Handler called when the user enters a query **/\n onSearch?: (query: string) => void | Promise<void>;\n /** Value of the input in combobox */\n value?: ComboboxValue;\n};\n\ninterface InlineComboboxProps extends ComboboxBaseProps {\n dialog?: never;\n /**\n * Combobox will display its data when input is clicked/focused, even if the input is empty.\n * *Note* that default combobox will display matching data only when user starts typing in input.\n */\n inline: boolean; // Example 3 on https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html\n}\n\ninterface DialogComboboxProps extends ComboboxBaseProps {\n dialog: (props: Partial<DialogProps>) => JSX.Element;\n inline?: never;\n}\n\nexport type ComboboxProps = InlineComboboxProps | DialogComboboxProps;\n\nexport const Combobox = React.forwardRef(function Combobox(props: ComboboxProps, ref: React.Ref<HTMLInputElement>) {\n const { className: externalClassName, dialog, style, ...otherProps } = props;\n const { combobox, button, input, popover, list } = useCombobox(otherProps, ref);\n const internalRef = React.useRef<HTMLDivElement>(null);\n const { texts } = useLocalization();\n const selectDimensions = useBoundingClientRectListener(internalRef);\n const className = cn(\n 'inline-flex relative',\n {\n 'yt-combobox--inline': props.inline,\n },\n externalClassName\n );\n\n return (\n <span className={className} data-taco=\"combobox\" style={style}>\n <PopoverPrimitive.Root {...popover}>\n <PopoverPrimitive.Anchor asChild ref={internalRef}>\n <div {...combobox} className=\"inline w-full\" ref={ref}>\n <Input\n {...input}\n autoComplete=\"off\"\n button={\n props.inline ? (\n <IconButton\n // In case of inline combobox, this icon button acts only as visual chevron representation,\n // so should be taken out of screen reader scope.\n aria-hidden\n appearance=\"discrete\"\n className=\"!border-l-0 focus:!border-none focus:!shadow-none active:!border-none\"\n icon={popover.open ? 'chevron-up' : 'chevron-down'}\n onClick={() => {\n popover.onOpenChange(true);\n input.ref.current?.focus();\n }}\n tabIndex={-1}\n />\n ) : dialog ? (\n <IconButton\n aria-label={texts.combobox.tooltip}\n icon=\"list-search\"\n disabled={props.readOnly || props.disabled}\n dialog={dialog}\n onFocus={(event: React.FocusEvent<HTMLButtonElement>) => {\n // Prevents the default focus behaviour of showing the tooltip, on parent tooltip element\n event.preventDefault();\n input.ref.current?.focus();\n }}\n ref={button.ref}\n tabIndex={-1}\n tooltip={texts.combobox.tooltip}\n />\n ) : undefined\n }\n />\n </div>\n </PopoverPrimitive.Anchor>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n align=\"start\"\n onOpenAutoFocus={event => {\n event.preventDefault();\n }}\n sideOffset={4}>\n <ScrollableList\n {...list}\n className={cn('max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)] !border-blue-500')}\n style={{ minWidth: selectDimensions?.width }}\n tabIndex={popover.open ? 0 : -1}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n </span>\n );\n});\n"],"names":["Combobox","React","props","ref","className","externalClassName","dialog","style","otherProps","combobox","button","input","popover","list","useCombobox","internalRef","texts","useLocalization","selectDimensions","useBoundingClientRectListener","cn","inline","PopoverPrimitive","asChild","Input","autoComplete","IconButton","appearance","icon","open","onClick","onOpenChange","_input$ref$current","current","focus","tabIndex","tooltip","disabled","readOnly","onFocus","event","preventDefault","_input$ref$current2","undefined","align","onOpenAutoFocus","sideOffset","ScrollableList","minWidth","width"],"mappings":";;;;;;;;;;MA+DaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQA,CAACE,KAAoB,EAAEC,GAAgC;EAC7G,MAAM;IAAEC,SAAS,EAAEC,iBA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AAI,EAAC,aAAa;MAClBS,QAAQ,EAAEnC,KAAK,CAACoC,QAAQ,IAAIpC,KAAK,CAACmC,QAAQ;MAC1C/B,MAAM,EAAEA,MAAM;MACdiC,OAAO,EAAGC,KAA0C;;;QAEhDA,KAAK,CAACC,cAAc,EAAE;QACtB,CAAAC,mBAAA,GAAA/B,KAAK,CAACR,GAAG,CAAC8B,OAAO,cAAAS,mBAAA,uBAAjBA,mBAAA,CAAmBR,KAAK,EAAE;OAC7B;MACD/B,GAAG,EAAEO,MAAM,CAACP,GAAG;MACfgC,QAAQ,EAAE,CAAC,CAAC;MACZC,OAAO,EAAEpB,KAAK,CAACP,QAAQ,CAAC2B;MAC1B,IACFO;KAEV,CACA,CACgB,eAC1B1C,cAACqB,MAAuB,qBACpBrB,cAACqB,OAAwB;IACrBsB,KAAK,EAAC,OAAO;IACbC,eAAe,EAAEL,KAAK;MAClBA,KAAK,CAACC,cAAc,EAAE;KACzB;IACDK,UAAU,EAAE;kBACZ7C,cAAC8C,cAAc,oBACPlC,IAAI;IACRT,SAAS,EAAEgB,EAAE,CAAC,2EAA2E,CAAC;IAC1Fb,KAAK,EAAE;MAAEyC,QAAQ,EAAE9B,gBAAgB,aAAhBA,gBAAgB,uBAAhBA,gBAAgB,CAAE+B;KAAO;IAC5Cd,QAAQ,EAAEvB,OAAO,CAACiB,IAAI,GAAG,CAAC,GAAG,CAAC;KAChC,CACqB,CACL,CACN,CACrB;AAEf,CAAC;;;;"}
|
@@ -104,7 +104,8 @@ const useCombobox = ({
|
|
104
104
|
event.preventDefault();
|
105
105
|
return;
|
106
106
|
}
|
107
|
-
|
107
|
+
// event.target.value is always a string so it is important to cast value to a string before checking the equality
|
108
|
+
if (onChange && event.target.value !== String(value)) {
|
108
109
|
const item = findByValue(flattenedData, event.target.value);
|
109
110
|
event.detail = sanitizeItem(item);
|
110
111
|
const parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useCombobox.js","sources":["../../../../../../../src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport debounce from 'lodash/debounce';\nimport { ComboboxProps } from './Combobox';\nimport {\n setInputValueByRef,\n getIndexFromValue,\n findByValue,\n useFlattenedData,\n sanitizeItem,\n getOptionParents,\n filterData,\n} from '../Listbox/util';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getId, ScrollableListItemValue, ScrollableListPropsWithRef } from '../Listbox/ScrollableList';\nimport { InputProps } from '../Input/Input';\n\nconst debouncer = debounce(f => f(), 200);\n\nconst convertToInputValue = (value: ScrollableListItemValue | undefined) => String(value ?? '');\n\ntype useCombobox = React.HTMLAttributes<HTMLDivElement> & {\n combobox: React.HTMLAttributes<HTMLSpanElement>;\n input: Omit<InputProps, 'defaultValue'> & { ref: React.RefObject<HTMLInputElement> };\n list: ScrollableListPropsWithRef;\n button: { ref: any };\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n};\n\nexport const useCombobox = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data: unfilteredData = [],\n defaultValue,\n disabled,\n id: nativeId,\n inline,\n loading: __,\n onChange,\n onClick,\n onKeyDown,\n onSearch,\n readOnly,\n value,\n ...props\n }: Omit<ComboboxProps, 'dialog'>,\n ref: React.Ref<HTMLInputElement>\n): useCombobox => {\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const [open, setOpen] = React.useState(false);\n const listId = React.useMemo(() => uuid(), []);\n const [inputValue, setInputValue] = React.useState<string>(convertToInputValue(value));\n const shouldFilterData = !onSearch && (!inline || (inline && inputValue !== convertToInputValue(value)));\n const flattenedData = useFlattenedData(unfilteredData);\n const data = React.useMemo(\n () => (shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData),\n [shouldFilterData, inputValue, flattenedData]\n );\n // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state\n const [currentIndex, setCurrentIndex] = React.useState<number | undefined>(\n inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined\n );\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value, 'focusout');\n }\n }\n };\n\n const setCurrentValue = (index: number | undefined) => {\n if (index === undefined) {\n return;\n }\n\n const option = data[index];\n\n // if the selected option is not already selected, trigger blur event\n if (option.value !== value) {\n setInputValueByIndex(index);\n } else {\n // if the selected option is already selected, refill input with its value\n setInputValue(convertToInputValue(value));\n }\n };\n\n // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set\n React.useEffect(() => {\n if (defaultValue && !value) {\n setInputValueByIndex(getIndexFromValue(data, defaultValue));\n }\n }, [data]);\n\n // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc\n React.useEffect(() => {\n if (value !== undefined && value !== inputValue) {\n setInputValue(convertToInputValue(value));\n }\n }, [value]);\n\n React.useEffect(() => {\n if (onSearch) {\n debouncer(() => {\n onSearch(inputValue);\n });\n }\n }, [inputValue]);\n\n // show listbox based on input value\n React.useEffect(() => {\n // don't show the popover if the internal (input) value already is the current value\n // this prevents the popover showing after selecting a value or pressing escape\n const isCurrentValue = value !== undefined && value !== null && inputValue === String(value);\n\n if (inputValue && data.length && !isCurrentValue) {\n setCurrentIndex(0);\n\n if (!open) {\n setOpen(true);\n }\n } else {\n setOpen(false);\n }\n }, [inputValue, data]);\n\n React.useEffect(() => {\n if (open) {\n setCurrentIndex(getIndexFromValue(data, inputValue) || 0);\n } else {\n setCurrentIndex(undefined);\n }\n }, [open]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (listRef.current && event.relatedTarget === listRef.current) {\n event.preventDefault();\n return;\n }\n\n if (onChange && event.target.value !== value) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const parents = getOptionParents(flattenedData, item?.path);\n\n if (parents !== null && parents.length > 0) {\n (event as any).detail.parents = parents;\n }\n\n onChange(event);\n }\n\n if (props.onBlur) {\n props.onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInputValue(event.target.value);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n if (inline || (!open && inputValue && data.length)) {\n setOpen(true);\n }\n\n if (onClick) {\n event.persist();\n onClick(event);\n }\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n event.persist();\n\n switch (event.key) {\n case 'Backspace': {\n return;\n }\n\n case 'Escape': {\n event.preventDefault();\n setInputValue(convertToInputValue(value));\n setOpen(false);\n return;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n\n setCurrentValue(currentIndex);\n setOpen(false);\n return;\n }\n\n case 'ArrowDown':\n if (open) {\n event.preventDefault();\n } else {\n if (!inline && buttonRef.current) {\n buttonRef.current.click();\n }\n }\n break;\n\n case 'ArrowUp':\n case 'Home':\n case 'End': {\n if (open) {\n event.preventDefault();\n }\n break;\n }\n\n default:\n }\n\n // we aren't focused on the list, so manually forward the keydown event to it\n if (listRef.current) {\n listRef.current.dispatchEvent(createCustomKeyboardEvent(event));\n }\n\n if (inline && !open) {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;\n setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);\n setOpen(true);\n }\n }\n\n if (!event.isDefaultPrevented() && onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setCurrentIndex(index);\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>, index: number): void => {\n event.preventDefault();\n setCurrentValue(index);\n setOpen(false);\n };\n\n const combobox = {\n 'aria-expanded': open,\n 'aria-owns': listId,\n 'aria-haspopup': 'listbox' as const,\n role: 'combobox',\n };\n\n const input = {\n ...props,\n 'aria-controls': listId,\n // Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions\n // are related to the string that is present in the textbox\n 'aria-autocomplete': 'list' as const,\n // Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element\n 'aria-activedescendant':\n currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,\n 'aria-labelledby': ariaLabelledBy,\n disabled,\n onBlur: !disabled && !readOnly ? handleInputBlur : undefined,\n onChange: !disabled && !readOnly ? handleInputChange : undefined,\n onClick: !disabled && !readOnly ? handleInputClick : undefined,\n onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,\n readOnly,\n ref: inputRef,\n type: 'text',\n value: inputValue ?? '',\n };\n\n const list: ScrollableListPropsWithRef = {\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n id: listId,\n onChange: handleListboxChange,\n onClick: handleListboxClick,\n ref: listRef,\n scrollOnFocus: false,\n tabIndex: -1,\n value: currentIndex,\n };\n\n const button = {\n ref: buttonRef,\n };\n\n return {\n combobox,\n input,\n list,\n button,\n popover: {\n open,\n onOpenChange: setOpen,\n //visible: !data.length ? false : open,\n },\n };\n};\n"],"names":["debouncer","debounce","f","convertToInputValue","value","String","useCombobox","ariaLabel","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","id","nativeId","inline","loading","__","onChange","onClick","onKeyDown","onSearch","readOnly","props","ref","inputRef","useMergedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","currentIndex","setCurrentIndex","undefined","getIndexFromValue","setInputValueByIndex","index","option","setInputValueByRef","current","setCurrentValue","isCurrentValue","length","handleInputBlur","event","persist","relatedTarget","preventDefault","target","item","findByValue","detail","sanitizeItem","parents","getOptionParents","path","onBlur","handleInputChange","handleInputClick","handleInputKeyDown","key","click","dispatchEvent","createCustomKeyboardEvent","initialIndex","isDefaultPrevented","handleListboxChange","handleListboxClick","combobox","role","input","getId","type","list","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;AAkBA,MAAMA,SAAS,gBAAGC,QAAQ,CAACC,CAAC,IAAIA,CAAC,EAAE,EAAE,GAAG,CAAC;AAEzC,MAAMC,mBAAmB,GAAIC,KAA0C,IAAKC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;MAUlFE,WAAW,GAAGA,CACvB;EACI,YAAY,EAAEC,SAAS;EACvB,iBAAiB,EAAEC,cAAc;EACjCC,IAAI,EAAEC,cAAc,GAAG,EAAE;EACzBC,YAAY;EACZC,QAAQ;EACRC,EAAE,EAAEC,QAAQ;EACZC,MAAM;EACNC,OAAO,EAAEC,EAAE;EACXC,QAAQ;EACRC,OAAO;EACPC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRlB,KAAK;EACL,GAAGmB;CACyB,EAChCC,GAAgC;EAEhC,MAAMC,QAAQ,GAAGC,YAAY,CAAmBF,GAAG,CAAC;EACpD,MAAMG,SAAS,GAAGC,MAAY,CAAoB,IAAI,CAAC;EACvD,MAAMC,OAAO,GAAGD,MAAY,CAAmB,IAAI,CAAC;EACpD,MAAM,CAACE,IAAI,EAAEC,OAAO,CAAC,GAAGH,QAAc,CAAC,KAAK,CAAC;EAC7C,MAAMI,MAAM,GAAGJ,OAAa,CAAC,MAAMK,EAAI,EAAE,EAAE,EAAE,CAAC;EAC9C,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGP,QAAc,CAASzB,mBAAmB,CAACC,KAAK,CAAC,CAAC;EACtF,MAAMgC,gBAAgB,GAAG,CAACf,QAAQ,KAAK,CAACN,MAAM,IAAKA,MAAM,IAAImB,UAAU,KAAK/B,mBAAmB,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KAAK,EAAEoC;GACV;EAED,MAAM6C,MAAM,GAAG;IACX7D,GAAG,EAAEG;GACR;EAED,OAAO;IACHkD,QAAQ;IACRE,KAAK;IACLG,IAAI;IACJG,MAAM;IACNC,OAAO,EAAE;MACLxD,IAAI;MACJyD,YAAY,EAAExD;;GAGrB;AACL;;;;"}
|
1
|
+
{"version":3,"file":"useCombobox.js","sources":["../../../../../../../src/components/Combobox/useCombobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport debounce from 'lodash/debounce';\nimport { ComboboxProps } from './Combobox';\nimport {\n setInputValueByRef,\n getIndexFromValue,\n findByValue,\n useFlattenedData,\n sanitizeItem,\n getOptionParents,\n filterData,\n} from '../Listbox/util';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { getId, ScrollableListItemValue, ScrollableListPropsWithRef } from '../Listbox/ScrollableList';\nimport { InputProps } from '../Input/Input';\n\nconst debouncer = debounce(f => f(), 200);\n\nconst convertToInputValue = (value: ScrollableListItemValue | undefined) => String(value ?? '');\n\ntype useCombobox = React.HTMLAttributes<HTMLDivElement> & {\n combobox: React.HTMLAttributes<HTMLSpanElement>;\n input: Omit<InputProps, 'defaultValue'> & { ref: React.RefObject<HTMLInputElement> };\n list: ScrollableListPropsWithRef;\n button: { ref: any };\n popover: { open: boolean; onOpenChange: (open: boolean) => void };\n};\n\nexport const useCombobox = (\n {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n data: unfilteredData = [],\n defaultValue,\n disabled,\n id: nativeId,\n inline,\n loading: __,\n onChange,\n onClick,\n onKeyDown,\n onSearch,\n readOnly,\n value,\n ...props\n }: Omit<ComboboxProps, 'dialog'>,\n ref: React.Ref<HTMLInputElement>\n): useCombobox => {\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const listRef = React.useRef<HTMLUListElement>(null);\n const [open, setOpen] = React.useState(false);\n const listId = React.useMemo(() => uuid(), []);\n const [inputValue, setInputValue] = React.useState<string>(convertToInputValue(value));\n const shouldFilterData = !onSearch && (!inline || (inline && inputValue !== convertToInputValue(value)));\n const flattenedData = useFlattenedData(unfilteredData);\n const data = React.useMemo(\n () => (shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData),\n [shouldFilterData, inputValue, flattenedData]\n );\n // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state\n const [currentIndex, setCurrentIndex] = React.useState<number | undefined>(\n inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined\n );\n\n const setInputValueByIndex = (index: number | undefined): void => {\n if (index !== undefined) {\n const option = data[index];\n\n if (option && !option.disabled) {\n setInputValueByRef(inputRef.current, option.value, 'focusout');\n }\n }\n };\n\n const setCurrentValue = (index: number | undefined) => {\n if (index === undefined) {\n return;\n }\n\n const option = data[index];\n\n // if the selected option is not already selected, trigger blur event\n if (option.value !== value) {\n setInputValueByIndex(index);\n } else {\n // if the selected option is already selected, refill input with its value\n setInputValue(convertToInputValue(value));\n }\n };\n\n // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set\n React.useEffect(() => {\n if (defaultValue && !value) {\n setInputValueByIndex(getIndexFromValue(data, defaultValue));\n }\n }, [data]);\n\n // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc\n React.useEffect(() => {\n if (value !== undefined && value !== inputValue) {\n setInputValue(convertToInputValue(value));\n }\n }, [value]);\n\n React.useEffect(() => {\n if (onSearch) {\n debouncer(() => {\n onSearch(inputValue);\n });\n }\n }, [inputValue]);\n\n // show listbox based on input value\n React.useEffect(() => {\n // don't show the popover if the internal (input) value already is the current value\n // this prevents the popover showing after selecting a value or pressing escape\n const isCurrentValue = value !== undefined && value !== null && inputValue === String(value);\n\n if (inputValue && data.length && !isCurrentValue) {\n setCurrentIndex(0);\n\n if (!open) {\n setOpen(true);\n }\n } else {\n setOpen(false);\n }\n }, [inputValue, data]);\n\n React.useEffect(() => {\n if (open) {\n setCurrentIndex(getIndexFromValue(data, inputValue) || 0);\n } else {\n setCurrentIndex(undefined);\n }\n }, [open]);\n\n // event handlers\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>): void => {\n event.persist();\n\n if (listRef.current && event.relatedTarget === listRef.current) {\n event.preventDefault();\n return;\n }\n\n // event.target.value is always a string so it is important to cast value to a string before checking the equality\n if (onChange && event.target.value !== String(value)) {\n const item = findByValue(flattenedData, event.target.value);\n (event as any).detail = sanitizeItem(item);\n\n const parents = getOptionParents(flattenedData, item?.path);\n\n if (parents !== null && parents.length > 0) {\n (event as any).detail.parents = parents;\n }\n\n onChange(event);\n }\n\n if (props.onBlur) {\n props.onBlur(event);\n }\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n setInputValue(event.target.value);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n if (inline || (!open && inputValue && data.length)) {\n setOpen(true);\n }\n\n if (onClick) {\n event.persist();\n onClick(event);\n }\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n event.persist();\n\n switch (event.key) {\n case 'Backspace': {\n return;\n }\n\n case 'Escape': {\n event.preventDefault();\n setInputValue(convertToInputValue(value));\n setOpen(false);\n return;\n }\n\n case 'Tab':\n case 'Enter': {\n if (event.key !== 'Tab') {\n event.preventDefault();\n }\n\n setCurrentValue(currentIndex);\n setOpen(false);\n return;\n }\n\n case 'ArrowDown':\n if (open) {\n event.preventDefault();\n } else {\n if (!inline && buttonRef.current) {\n buttonRef.current.click();\n }\n }\n break;\n\n case 'ArrowUp':\n case 'Home':\n case 'End': {\n if (open) {\n event.preventDefault();\n }\n break;\n }\n\n default:\n }\n\n // we aren't focused on the list, so manually forward the keydown event to it\n if (listRef.current) {\n listRef.current.dispatchEvent(createCustomKeyboardEvent(event));\n }\n\n if (inline && !open) {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;\n setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);\n setOpen(true);\n }\n }\n\n if (!event.isDefaultPrevented() && onKeyDown) {\n event.persist();\n onKeyDown(event);\n }\n };\n\n const handleListboxChange = (index: number): void => {\n setCurrentIndex(index);\n };\n\n const handleListboxClick = (event: React.MouseEvent<HTMLLIElement>, index: number): void => {\n event.preventDefault();\n setCurrentValue(index);\n setOpen(false);\n };\n\n const combobox = {\n 'aria-expanded': open,\n 'aria-owns': listId,\n 'aria-haspopup': 'listbox' as const,\n role: 'combobox',\n };\n\n const input = {\n ...props,\n 'aria-controls': listId,\n // Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions\n // are related to the string that is present in the textbox\n 'aria-autocomplete': 'list' as const,\n // Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element\n 'aria-activedescendant':\n currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,\n 'aria-labelledby': ariaLabelledBy,\n disabled,\n onBlur: !disabled && !readOnly ? handleInputBlur : undefined,\n onChange: !disabled && !readOnly ? handleInputChange : undefined,\n onClick: !disabled && !readOnly ? handleInputClick : undefined,\n onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,\n readOnly,\n ref: inputRef,\n type: 'text',\n value: inputValue ?? '',\n };\n\n const list: ScrollableListPropsWithRef = {\n 'aria-labelledby': ariaLabelledBy,\n data,\n disabled,\n id: listId,\n onChange: handleListboxChange,\n onClick: handleListboxClick,\n ref: listRef,\n scrollOnFocus: false,\n tabIndex: -1,\n value: currentIndex,\n };\n\n const button = {\n ref: buttonRef,\n };\n\n return {\n combobox,\n input,\n list,\n button,\n popover: {\n open,\n onOpenChange: setOpen,\n //visible: !data.length ? false : open,\n },\n };\n};\n"],"names":["debouncer","debounce","f","convertToInputValue","value","String","useCombobox","ariaLabel","ariaLabelledBy","data","unfilteredData","defaultValue","disabled","id","nativeId","inline","loading","__","onChange","onClick","onKeyDown","onSearch","readOnly","props","ref","inputRef","useMergedRef","buttonRef","React","listRef","open","setOpen","listId","uuid","inputValue","setInputValue","shouldFilterData","flattenedData","useFlattenedData","filterData","currentIndex","setCurrentIndex","undefined","getIndexFromValue","setInputValueByIndex","index","option","setInputValueByRef","current","setCurrentValue","isCurrentValue","length","handleInputBlur","event","persist","relatedTarget","preventDefault","target","item","findByValue","detail","sanitizeItem","parents","getOptionParents","path","onBlur","handleInputChange","handleInputClick","handleInputKeyDown","key","click","dispatchEvent","createCustomKeyboardEvent","initialIndex","isDefaultPrevented","handleListboxChange","handleListboxClick","combobox","role","input","getId","type","list","scrollOnFocus","tabIndex","button","popover","onOpenChange"],"mappings":";;;;;;;;AAkBA,MAAMA,SAAS,gBAAGC,QAAQ,CAACC,CAAC,IAAIA,CAAC,EAAE,EAAE,GAAG,CAAC;AAEzC,MAAMC,mBAAmB,GAAIC,KAA0C,IAAKC,MAAM,CAACD,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE,CAAC;MAUlFE,WAAW,GAAGA,CACvB;EACI,YAAY,EAAEC,SAAS;EACvB,iBAAiB,EAAEC,cAAc;EACjCC,IAAI,EAAEC,cAAc,GAAG,EAAE;EACzBC,YAAY;EACZC,QAAQ;EACRC,EAAE,EAAEC,QAAQ;EACZC,MAAM;EACNC,OAAO,EAAEC,EAAE;EACXC,QAAQ;EACRC,OAAO;EACPC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRlB,KAAK;EACL,GAAGmB;CACyB,EAChCC,GAAgC;EAEhC,MAAMC,QAAQ,GAAGC,YAAY,CAAmBF,GAAG,CAAC;EACpD,MAAMG,SAAS,GAAGC,MAAY,CAAoB,IAAI,CAAC;EACvD,MAAMC,OAAO,GAAGD,MAAY,CAAmB,IAAI,CAAC;EACpD,MAAM,CAACE,IAAI,EAAEC,OAAO,CAAC,GAAGH,QAAc,CAAC,KAAK,CAAC;EAC7C,MAAMI,MAAM,GA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AI;GACxB;EAED,MAAMgD,IAAI,GAA+B;IACrC,iBAAiB,EAAE1E,cAAc;IACjCC,IAAI;IACJG,QAAQ;IACRC,EAAE,EAAEmB,MAAM;IACVd,QAAQ,EAAEyD,mBAAmB;IAC7BxD,OAAO,EAAEyD,kBAAkB;IAC3BpD,GAAG,EAAEK,OAAO;IACZsD,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,CAAC,CAAC;IACZhF,KAAK,EAAEoC;GACV;EAED,MAAM6C,MAAM,GAAG;IACX7D,GAAG,EAAEG;GACR;EAED,OAAO;IACHkD,QAAQ;IACRE,KAAK;IACLG,IAAI;IACJG,MAAM;IACNC,OAAO,EAAE;MACLxD,IAAI;MACJyD,YAAY,EAAExD;;GAGrB;AACL;;;;"}
|
@@ -34,20 +34,20 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
|
|
34
34
|
disabled: input.disabled || input.readOnly,
|
35
35
|
icon: "calendar",
|
36
36
|
tabIndex: -1,
|
37
|
-
popover: props => /*#__PURE__*/createElement(Popover, Object.assign({}, props), /*#__PURE__*/createElement(Popover.Content, null, ({
|
37
|
+
popover: props => ( /*#__PURE__*/createElement(Popover, Object.assign({}, props), /*#__PURE__*/createElement(Popover.Content, null, ({
|
38
38
|
close
|
39
|
-
}) => /*#__PURE__*/createElement("div", {
|
39
|
+
}) => ( /*#__PURE__*/createElement("div", {
|
40
40
|
className: "-m-3 flex"
|
41
41
|
}, /*#__PURE__*/createElement(Calendar, Object.assign({}, calendar, {
|
42
42
|
onChange: (date, event) => {
|
43
43
|
calendar.onChange(date, event);
|
44
44
|
close();
|
45
45
|
}
|
46
|
-
})), shortcuts && /*#__PURE__*/createElement("div", {
|
46
|
+
})), shortcuts && ( /*#__PURE__*/createElement("div", {
|
47
47
|
className: "border-grey-300 flex flex-col border-l"
|
48
48
|
}, /*#__PURE__*/createElement("span", {
|
49
49
|
className: "m-4 mb-3 flex h-8 w-32 items-center text-xs font-semibold"
|
50
|
-
}, shortcutsText !== null && shortcutsText !== void 0 ? shortcutsText : texts.datepicker.shortcuts), /*#__PURE__*/createElement("ul", null, shortcuts.map(shortcut => /*#__PURE__*/createElement("li", {
|
50
|
+
}, shortcutsText !== null && shortcutsText !== void 0 ? shortcutsText : texts.datepicker.shortcuts), /*#__PURE__*/createElement("ul", null, shortcuts.map(shortcut => ( /*#__PURE__*/createElement("li", {
|
51
51
|
key: shortcut.text
|
52
52
|
}, /*#__PURE__*/createElement("button", {
|
53
53
|
type: "button",
|
@@ -57,7 +57,7 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
|
|
57
57
|
shortcut.onClick(event);
|
58
58
|
close();
|
59
59
|
}
|
60
|
-
}, shortcut.text)))), handleReset && /*#__PURE__*/createElement("button", {
|
60
|
+
}, shortcut.text))))), handleReset && ( /*#__PURE__*/createElement("button", {
|
61
61
|
type: "button",
|
62
62
|
className: "mx-auto my-4 mt-auto inline-flex cursor-pointer border-none bg-transparent text-xs text-blue-500 hover:text-blue-300",
|
63
63
|
onClick: event => {
|
@@ -65,7 +65,7 @@ const Datepicker = /*#__PURE__*/forwardRef(function Datepicker(props, ref) {
|
|
65
65
|
handleReset(event);
|
66
66
|
close();
|
67
67
|
}
|
68
|
-
}, texts.datepicker.clear))))),
|
68
|
+
}, texts.datepicker.clear))))))))),
|
69
69
|
tooltip: texts.datepicker.calendar
|
70
70
|
})
|
71
71
|
})));
|