@cube-dev/ui-kit 0.181.0 → 0.183.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +34 -0
- package/dist/_internal/hooks/use-debounced-value.js +48 -31
- package/dist/_internal/hooks/use-debounced-value.js.map +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +22 -7
- package/dist/_internal/hooks/use-deprecation-warning.js.map +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-event.js.map +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js.map +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +12 -4
- package/dist/_internal/hooks/use-sync-ref.js.map +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js.map +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +90 -20
- package/dist/_internal/hooks/use-timer/use-timer.js.map +1 -1
- package/dist/_internal/hooks/use-warn.js +4 -4
- package/dist/_internal/hooks/use-warn.js.map +1 -1
- package/dist/components/Block.js +29 -7
- package/dist/components/Block.js.map +1 -1
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/CollectionItem.js.map +1 -1
- package/dist/components/GlobalStyles.js +33 -9
- package/dist/components/GlobalStyles.js.map +1 -1
- package/dist/components/GridProvider.js +4 -4
- package/dist/components/GridProvider.js.map +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/HiddenInput.js.map +1 -1
- package/dist/components/Root.js +137 -42
- package/dist/components/Root.js.map +1 -1
- package/dist/components/actions/Action/Action.js +20 -8
- package/dist/components/actions/Action/Action.js.map +1 -1
- package/dist/components/actions/Banner/Banner.js +91 -22
- package/dist/components/actions/Banner/Banner.js.map +1 -1
- package/dist/components/actions/Button/Button.js +7 -5
- package/dist/components/actions/Button/Button.js.map +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +15 -5
- package/dist/components/actions/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +6 -4
- package/dist/components/actions/ButtonSplit/ButtonSplit.js.map +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/ButtonSplit/context.js.map +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +76 -76
- package/dist/components/actions/CommandMenu/CommandMenu.js.map +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/CommandMenu/styled.js.map +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +205 -68
- package/dist/components/actions/ItemAction/ItemAction.js.map +1 -1
- package/dist/components/actions/ItemActionContext.js +26 -7
- package/dist/components/actions/ItemActionContext.js.map +1 -1
- package/dist/components/actions/ItemActionsWrapper.js +215 -84
- package/dist/components/actions/ItemActionsWrapper.js.map +1 -1
- package/dist/components/actions/ItemButton/ItemButton.js +2 -2
- package/dist/components/actions/ItemButton/ItemButton.js.map +1 -1
- package/dist/components/actions/Link/Link.js +16 -7
- package/dist/components/actions/Link/Link.js.map +1 -1
- package/dist/components/actions/Menu/Menu.js +127 -72
- package/dist/components/actions/Menu/Menu.js.map +1 -1
- package/dist/components/actions/Menu/MenuItem.js +116 -43
- package/dist/components/actions/Menu/MenuItem.js.map +1 -1
- package/dist/components/actions/Menu/MenuSection.js +85 -30
- package/dist/components/actions/Menu/MenuSection.js.map +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +316 -112
- package/dist/components/actions/Menu/MenuTrigger.js.map +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +6 -6
- package/dist/components/actions/Menu/SubMenuTrigger.js.map +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js.map +1 -1
- package/dist/components/actions/Menu/context.js +1 -1
- package/dist/components/actions/Menu/context.js.map +1 -1
- package/dist/components/actions/Menu/styled.js +1 -1
- package/dist/components/actions/Menu/styled.js.map +1 -1
- package/dist/components/actions/actions-run.js +1 -1
- package/dist/components/actions/actions-run.js.map +1 -1
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/index.js.map +1 -1
- package/dist/components/actions/use-action.js +3 -3
- package/dist/components/actions/use-action.js.map +1 -1
- package/dist/components/actions/use-anchored-menu.js +6 -6
- package/dist/components/actions/use-anchored-menu.js.map +1 -1
- package/dist/components/actions/use-context-menu.js +12 -12
- package/dist/components/actions/use-context-menu.js.map +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +84 -18
- package/dist/components/content/ActiveZone/ActiveZone.js.map +1 -1
- package/dist/components/content/Alert/Alert.js +18 -7
- package/dist/components/content/Alert/Alert.js.map +1 -1
- package/dist/components/content/Alert/use-alert.js +53 -15
- package/dist/components/content/Alert/use-alert.js.map +1 -1
- package/dist/components/content/Avatar/Avatar.js +51 -13
- package/dist/components/content/Avatar/Avatar.js.map +1 -1
- package/dist/components/content/Badge/Badge.js +43 -10
- package/dist/components/content/Badge/Badge.js.map +1 -1
- package/dist/components/content/Card/Card.js +29 -7
- package/dist/components/content/Card/Card.js.map +1 -1
- package/dist/components/content/Content.js +29 -7
- package/dist/components/content/Content.js.map +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +2 -2
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js.map +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.js +220 -60
- package/dist/components/content/CopySnippet/CopySnippet.js.map +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +453 -194
- package/dist/components/content/Disclosure/Disclosure.js.map +1 -1
- package/dist/components/content/Divider.js +52 -14
- package/dist/components/content/Divider.js.map +1 -1
- package/dist/components/content/Footer.js +29 -7
- package/dist/components/content/Footer.js.map +1 -1
- package/dist/components/content/Header.js +29 -7
- package/dist/components/content/Header.js.map +1 -1
- package/dist/components/content/HotKeys/HotKeys.js +55 -27
- package/dist/components/content/HotKeys/HotKeys.js.map +1 -1
- package/dist/components/content/InfoBadge/InfoBadge.js +8 -8
- package/dist/components/content/InfoBadge/InfoBadge.js.map +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +429 -188
- package/dist/components/content/InlineInput/InlineInput.js.map +1 -1
- package/dist/components/content/Item/Item.js +414 -155
- package/dist/components/content/Item/Item.js.map +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +173 -59
- package/dist/components/content/ItemBadge/ItemBadge.js.map +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +34 -9
- package/dist/components/content/ItemCard/ItemCard.js.map +1 -1
- package/dist/components/content/Layout/GridLayout.js +38 -10
- package/dist/components/content/Layout/GridLayout.js.map +1 -1
- package/dist/components/content/Layout/Layout.js +30 -13
- package/dist/components/content/Layout/Layout.js.map +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +33 -8
- package/dist/components/content/Layout/LayoutBlock.js.map +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +48 -11
- package/dist/components/content/Layout/LayoutCenter.js.map +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js.map +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js.map +1 -1
- package/dist/components/content/Layout/LayoutContext.js +30 -21
- package/dist/components/content/Layout/LayoutContext.js.map +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +33 -8
- package/dist/components/content/Layout/LayoutFlex.js.map +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +53 -14
- package/dist/components/content/Layout/LayoutFooter.js.map +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +48 -11
- package/dist/components/content/Layout/LayoutGrid.js.map +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +211 -57
- package/dist/components/content/Layout/LayoutHeader.js.map +1 -1
- package/dist/components/content/Layout/LayoutPane.js +60 -14
- package/dist/components/content/Layout/LayoutPane.js.map +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +59 -17
- package/dist/components/content/Layout/LayoutPanel.js.map +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +89 -27
- package/dist/components/content/Layout/LayoutPanelHeader.js.map +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +33 -8
- package/dist/components/content/Layout/LayoutToolbar.js.map +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +206 -119
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js.map +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/index.js.map +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Layout/utils.js.map +1 -1
- package/dist/components/content/Paragraph.js +25 -9
- package/dist/components/content/Paragraph.js.map +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +52 -14
- package/dist/components/content/Placeholder/Placeholder.js.map +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/PrismCode.js.map +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js.map +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +52 -17
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js.map +1 -1
- package/dist/components/content/Result/Result.js +117 -38
- package/dist/components/content/Result/Result.js.map +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +26 -17
- package/dist/components/content/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/content/Tag/Tag.js +68 -13
- package/dist/components/content/Tag/Tag.js.map +1 -1
- package/dist/components/content/Text.d.ts +14 -14
- package/dist/components/content/Text.js +61 -14
- package/dist/components/content/Text.js.map +1 -1
- package/dist/components/content/TextItem/TextItem.js +37 -16
- package/dist/components/content/TextItem/TextItem.js.map +1 -1
- package/dist/components/content/Title.js +98 -23
- package/dist/components/content/Title.js.map +1 -1
- package/dist/components/content/Tree/Tree.js +32 -32
- package/dist/components/content/Tree/Tree.js.map +1 -1
- package/dist/components/content/Tree/TreeNode.js +10 -10
- package/dist/components/content/Tree/TreeNode.js.map +1 -1
- package/dist/components/content/Tree/styled.js +1 -1
- package/dist/components/content/Tree/styled.js.map +1 -1
- package/dist/components/content/Tree/tree-index.js +1 -1
- package/dist/components/content/Tree/tree-index.js.map +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +123 -89
- package/dist/components/content/Tree/use-checkbox-tree.js.map +1 -1
- package/dist/components/content/Tree/use-load-data.js +52 -21
- package/dist/components/content/Tree/use-load-data.js.map +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/highlightText.js.map +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/content/use-auto-tooltip.js.map +1 -1
- package/dist/components/data/DataTable/DataTable.js +31 -31
- package/dist/components/data/DataTable/DataTable.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTable.js +41 -41
- package/dist/components/data/ItemTable/ItemTable.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableBulkBar.js +11 -11
- package/dist/components/data/ItemTable/ItemTableBulkBar.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableDragPreview.js +41 -4
- package/dist/components/data/ItemTable/ItemTableDragPreview.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableFooter.js +67 -30
- package/dist/components/data/ItemTable/ItemTableFooter.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableToolbar.js +95 -28
- package/dist/components/data/ItemTable/ItemTableToolbar.js.map +1 -1
- package/dist/components/data/TableBase/ColumnResizer.js +90 -41
- package/dist/components/data/TableBase/ColumnResizer.js.map +1 -1
- package/dist/components/data/TableBase/RowCollection.js +1 -1
- package/dist/components/data/TableBase/RowCollection.js.map +1 -1
- package/dist/components/data/TableBase/TableHeaderCell.js +154 -64
- package/dist/components/data/TableBase/TableHeaderCell.js.map +1 -1
- package/dist/components/data/TableBase/TableRow.js +211 -69
- package/dist/components/data/TableBase/TableRow.js.map +1 -1
- package/dist/components/data/TableBase/TableView.js +119 -80
- package/dist/components/data/TableBase/TableView.js.map +1 -1
- package/dist/components/data/TableBase/column-menu.js +1 -1
- package/dist/components/data/TableBase/column-menu.js.map +1 -1
- package/dist/components/data/TableBase/column-tint.js +1 -1
- package/dist/components/data/TableBase/column-tint.js.map +1 -1
- package/dist/components/data/TableBase/row-menu.js +1 -1
- package/dist/components/data/TableBase/row-menu.js.map +1 -1
- package/dist/components/data/TableBase/styled.js +1 -1
- package/dist/components/data/TableBase/styled.js.map +1 -1
- package/dist/components/data/TableBase/table-tree.js +1 -1
- package/dist/components/data/TableBase/table-tree.js.map +1 -1
- package/dist/components/data/TableBase/types.js +1 -1
- package/dist/components/data/TableBase/types.js.map +1 -1
- package/dist/components/data/TableBase/use-cell-selection.js +0 -0
- package/dist/components/data/TableBase/use-cell-selection.js.map +1 -1
- package/dist/components/data/TableBase/use-column-order.js +56 -12
- package/dist/components/data/TableBase/use-column-order.js.map +1 -1
- package/dist/components/data/TableBase/use-container-width.js +24 -10
- package/dist/components/data/TableBase/use-container-width.js.map +1 -1
- package/dist/components/data/TableBase/use-row-move-animation.js +68 -49
- package/dist/components/data/TableBase/use-row-move-animation.js.map +1 -1
- package/dist/components/data/TableBase/use-scrollability.js +32 -18
- package/dist/components/data/TableBase/use-scrollability.js.map +1 -1
- package/dist/components/data/TableBase/use-table-columns.js +130 -60
- package/dist/components/data/TableBase/use-table-columns.js.map +1 -1
- package/dist/components/data/TableBase/use-table-search.js +1 -1
- package/dist/components/data/TableBase/use-table-search.js.map +1 -1
- package/dist/components/data/TableBase/use-table-selection.js +39 -39
- package/dist/components/data/TableBase/use-table-selection.js.map +1 -1
- package/dist/components/data/TableBase/use-table-sort.js +132 -68
- package/dist/components/data/TableBase/use-table-sort.js.map +1 -1
- package/dist/components/data/TableBase/use-table-sorts.js +168 -101
- package/dist/components/data/TableBase/use-table-sorts.js.map +1 -1
- package/dist/components/data/TableBase/use-table-storage.js +2 -2
- package/dist/components/data/TableBase/use-table-storage.js.map +1 -1
- package/dist/components/data/TableBase/use-table-tree-state.js +181 -86
- package/dist/components/data/TableBase/use-table-tree-state.js.map +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +13 -6
- package/dist/components/fields/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +101 -33
- package/dist/components/fields/Checkbox/CheckboxGroup.js.map +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/Checkbox/context.js.map +1 -1
- package/dist/components/fields/ColorInput/ColorInput.js +329 -150
- package/dist/components/fields/ColorInput/ColorInput.js.map +1 -1
- package/dist/components/fields/ColorPicker/ColorPicker.js +16 -16
- package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/components/fields/ColorSwatch/ColorSwatch.js +52 -13
- package/dist/components/fields/ColorSwatch/ColorSwatch.js.map +1 -1
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +90 -28
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -1
- package/dist/components/fields/ComboBox/ComboBox.js +216 -134
- package/dist/components/fields/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/fields/CommandTextArea/CommandTextArea.d.ts +21 -1
- package/dist/components/fields/CommandTextArea/CommandTextArea.js +26 -7
- package/dist/components/fields/CommandTextArea/CommandTextArea.js.map +1 -1
- package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
- package/dist/components/fields/CommandTextArea/caretPosition.js.map +1 -1
- package/dist/components/fields/CommandTextArea/useCaretAnchor.js +88 -49
- package/dist/components/fields/CommandTextArea/useCaretAnchor.js.map +1 -1
- package/dist/components/fields/DatePicker/DateInput.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.js.map +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +129 -34
- package/dist/components/fields/DatePicker/DateInputBase.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +194 -66
- package/dist/components/fields/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +39 -8
- package/dist/components/fields/DatePicker/DatePickerButton.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePickerSegment.js +109 -29
- package/dist/components/fields/DatePicker/DatePickerSegment.js.map +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +224 -85
- package/dist/components/fields/DatePicker/DateRangePicker.js.map +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +473 -177
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/MonthPicker.js +15 -6
- package/dist/components/fields/DatePicker/MonthPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/PeriodPicker.js +288 -91
- package/dist/components/fields/DatePicker/PeriodPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/QuarterPicker.js +15 -6
- package/dist/components/fields/DatePicker/QuarterPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +15 -7
- package/dist/components/fields/DatePicker/TimeInput.js.map +1 -1
- package/dist/components/fields/DatePicker/WeekPicker.js +15 -6
- package/dist/components/fields/DatePicker/WeekPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/YearPicker.js +15 -6
- package/dist/components/fields/DatePicker/YearPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js.map +1 -1
- package/dist/components/fields/DatePicker/period.js +1 -1
- package/dist/components/fields/DatePicker/period.js.map +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/props.js.map +1 -1
- package/dist/components/fields/DatePicker/utils.js +15 -8
- package/dist/components/fields/DatePicker/utils.js.map +1 -1
- package/dist/components/fields/FileInput/FileInput.js +3 -3
- package/dist/components/fields/FileInput/FileInput.js.map +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +87 -87
- package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.d.ts +2 -0
- package/dist/components/fields/FilterPicker/FilterPicker.js +24 -23
- package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/Input/Input.js.map +1 -1
- package/dist/components/fields/ListBox/DraggableListBox.js +23 -10
- package/dist/components/fields/ListBox/DraggableListBox.js.map +1 -1
- package/dist/components/fields/ListBox/ListBox.js +138 -53
- package/dist/components/fields/ListBox/ListBox.js.map +1 -1
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +156 -37
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js.map +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js.map +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +61 -33
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js.map +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +123 -33
- package/dist/components/fields/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +53 -15
- package/dist/components/fields/NumberInput/StepButton.js.map +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +149 -45
- package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/fields/Picker/Picker.d.ts +2 -0
- package/dist/components/fields/Picker/Picker.js +10 -9
- package/dist/components/fields/Picker/Picker.js.map +1 -1
- package/dist/components/fields/RadioGroup/Radio.js +273 -104
- package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +149 -48
- package/dist/components/fields/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/RadioGroup/context.js.map +1 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.js +80 -65
- package/dist/components/fields/SearchComboBox/SearchComboBox.js.map +1 -1
- package/dist/components/fields/SearchInput/SearchInput.js +91 -28
- package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
- package/dist/components/fields/Select/Select.d.ts +2 -0
- package/dist/components/fields/Select/Select.js +373 -118
- package/dist/components/fields/Select/Select.js.map +1 -1
- package/dist/components/fields/Slider/Gradation.js +45 -10
- package/dist/components/fields/Slider/Gradation.js.map +1 -1
- package/dist/components/fields/Slider/HueSlider.js +121 -32
- package/dist/components/fields/Slider/HueSlider.js.map +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +46 -10
- package/dist/components/fields/Slider/RangeSlider.js.map +1 -1
- package/dist/components/fields/Slider/Slider.js +108 -23
- package/dist/components/fields/Slider/Slider.js.map +1 -1
- package/dist/components/fields/Slider/SliderBase.js +2 -2
- package/dist/components/fields/Slider/SliderBase.js.map +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +96 -37
- package/dist/components/fields/Slider/SliderThumb.js.map +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +64 -23
- package/dist/components/fields/Slider/SliderTrack.js.map +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/elements.js.map +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Switch/Switch.js +190 -66
- package/dist/components/fields/Switch/Switch.js.map +1 -1
- package/dist/components/fields/TextArea/TextArea.js +137 -47
- package/dist/components/fields/TextArea/TextArea.js.map +1 -1
- package/dist/components/fields/TextInput/TextInput.js +80 -27
- package/dist/components/fields/TextInput/TextInput.js.map +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js.map +1 -1
- package/dist/components/fields/TextInput/useAutoSizeTextArea.js +1 -1
- package/dist/components/fields/TextInput/useAutoSizeTextArea.js.map +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +156 -83
- package/dist/components/fields/TextInputMapper/TextInputMapper.js.map +1 -1
- package/dist/components/fields/TriggerActions.js +11 -2
- package/dist/components/fields/TriggerActions.js.map +1 -1
- package/dist/components/fields/color/ColorPanel.js +237 -59
- package/dist/components/fields/color/ColorPanel.js.map +1 -1
- package/dist/components/fields/color/channels.js +1 -1
- package/dist/components/fields/color/channels.js.map +1 -1
- package/dist/components/fields/color/color.js +1 -1
- package/dist/components/fields/color/color.js.map +1 -1
- package/dist/components/fields/color/context.js +1 -1
- package/dist/components/fields/color/context.js.map +1 -1
- package/dist/components/form/FieldWrapper/FieldWrapper.js +195 -72
- package/dist/components/form/FieldWrapper/FieldWrapper.js.map +1 -1
- package/dist/components/form/Form/Field.js +23 -9
- package/dist/components/form/Form/Field.js.map +1 -1
- package/dist/components/form/Form/Form.js +76 -30
- package/dist/components/form/Form/Form.js.map +1 -1
- package/dist/components/form/Form/ModernFormRoot.js +294 -81
- package/dist/components/form/Form/ModernFormRoot.js.map +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +32 -10
- package/dist/components/form/Form/ResetButton/ResetButton.js.map +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +32 -10
- package/dist/components/form/Form/SubmitButton/SubmitButton.js.map +1 -1
- package/dist/components/form/Form/SubmitError.js +130 -32
- package/dist/components/form/Form/SubmitError.js.map +1 -1
- package/dist/components/form/Form/backend.js +1 -1
- package/dist/components/form/Form/backend.js.map +1 -1
- package/dist/components/form/Form/index.js +1 -1
- package/dist/components/form/Form/index.js.map +1 -1
- package/dist/components/form/Form/modern/actions.js +140 -45
- package/dist/components/form/Form/modern/actions.js.map +1 -1
- package/dist/components/form/Form/modern/context.js +1 -1
- package/dist/components/form/Form/modern/context.js.map +1 -1
- package/dist/components/form/Form/modern/controller.js +1 -1
- package/dist/components/form/Form/modern/controller.js.map +1 -1
- package/dist/components/form/Form/modern/field-binding.js +1 -1
- package/dist/components/form/Form/modern/field-binding.js.map +1 -1
- package/dist/components/form/Form/modern/field.js +1 -1
- package/dist/components/form/Form/modern/field.js.map +1 -1
- package/dist/components/form/Form/modern/react.js +102 -19
- package/dist/components/form/Form/modern/react.js.map +1 -1
- package/dist/components/form/Form/modern/store.js +13 -3
- package/dist/components/form/Form/modern/store.js.map +1 -1
- package/dist/components/form/Form/modern/types.d.ts +3 -1
- package/dist/components/form/Form/modern/validation.js +1 -1
- package/dist/components/form/Form/modern/validation.js.map +1 -1
- package/dist/components/form/Form/modern/values.js +1 -1
- package/dist/components/form/Form/modern/values.js.map +1 -1
- package/dist/components/form/Form/use-field/use-field-binding.js +236 -63
- package/dist/components/form/Form/use-field/use-field-binding.js.map +1 -1
- package/dist/components/form/Form/use-field/use-field-props.js +106 -61
- package/dist/components/form/Form/use-field/use-field-props.js.map +1 -1
- package/dist/components/form/Form/use-field/use-field.js +5 -4
- package/dist/components/form/Form/use-field/use-field.js.map +1 -1
- package/dist/components/form/Form/use-form.js +2 -1
- package/dist/components/form/Form/use-form.js.map +1 -1
- package/dist/components/form/Form/validation.js +1 -1
- package/dist/components/form/Form/validation.js.map +1 -1
- package/dist/components/form/Label.js +127 -37
- package/dist/components/form/Label.js.map +1 -1
- package/dist/components/form/validation/ValidationIndicator.js +20 -5
- package/dist/components/form/validation/ValidationIndicator.js.map +1 -1
- package/dist/components/form/validation/resolve-validation-props.js +1 -1
- package/dist/components/form/validation/resolve-validation-props.js.map +1 -1
- package/dist/components/form/validation/use-validation-props.js +36 -10
- package/dist/components/form/validation/use-validation-props.js.map +1 -1
- package/dist/components/form/wrapper.js +1 -1
- package/dist/components/form/wrapper.js.map +1 -1
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js +49 -29
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js.map +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.js +8 -8
- package/dist/components/helpers/IconSwitch/IconSwitch.js.map +1 -1
- package/dist/components/layout/Board/Board.js +27 -9
- package/dist/components/layout/Board/Board.js.map +1 -1
- package/dist/components/layout/Board/BoardProvider.js +1 -1
- package/dist/components/layout/Board/BoardProvider.js.map +1 -1
- package/dist/components/layout/Board/BoardResponsive.js +1 -1
- package/dist/components/layout/Board/BoardResponsive.js.map +1 -1
- package/dist/components/layout/Board/Widget.js +1 -1
- package/dist/components/layout/Board/Widget.js.map +1 -1
- package/dist/components/layout/Board/WidgetHost.js +159 -121
- package/dist/components/layout/Board/WidgetHost.js.map +1 -1
- package/dist/components/layout/Board/board-context.js +14 -5
- package/dist/components/layout/Board/board-context.js.map +1 -1
- package/dist/components/layout/Board/board-store.js +1 -1
- package/dist/components/layout/Board/board-store.js.map +1 -1
- package/dist/components/layout/Board/grid-core/calculate.js +1 -1
- package/dist/components/layout/Board/grid-core/calculate.js.map +1 -1
- package/dist/components/layout/Board/grid-core/collision-modes.js +1 -1
- package/dist/components/layout/Board/grid-core/collision-modes.js.map +1 -1
- package/dist/components/layout/Board/grid-core/collision.js +1 -1
- package/dist/components/layout/Board/grid-core/collision.js.map +1 -1
- package/dist/components/layout/Board/grid-core/compactors.js +1 -1
- package/dist/components/layout/Board/grid-core/compactors.js.map +1 -1
- package/dist/components/layout/Board/grid-core/constraints.js +1 -1
- package/dist/components/layout/Board/grid-core/constraints.js.map +1 -1
- package/dist/components/layout/Board/grid-core/group-move.js +1 -1
- package/dist/components/layout/Board/grid-core/group-move.js.map +1 -1
- package/dist/components/layout/Board/grid-core/layout.js +1 -1
- package/dist/components/layout/Board/grid-core/layout.js.map +1 -1
- package/dist/components/layout/Board/grid-core/placement.js +1 -1
- package/dist/components/layout/Board/grid-core/placement.js.map +1 -1
- package/dist/components/layout/Board/grid-core/sort.js +1 -1
- package/dist/components/layout/Board/grid-core/sort.js.map +1 -1
- package/dist/components/layout/Board/index.js +1 -1
- package/dist/components/layout/Board/index.js.map +1 -1
- package/dist/components/layout/Board/responsive-utils.js +1 -1
- package/dist/components/layout/Board/responsive-utils.js.map +1 -1
- package/dist/components/layout/Board/use-board-layout.js +8 -8
- package/dist/components/layout/Board/use-board-layout.js.map +1 -1
- package/dist/components/layout/Board/use-board-registry.js +257 -257
- package/dist/components/layout/Board/use-board-registry.js.map +1 -1
- package/dist/components/layout/Board/use-board-select-modifier-key.js +1 -1
- package/dist/components/layout/Board/use-board-select-modifier-key.js.map +1 -1
- package/dist/components/layout/Board/use-board-selection.js +16 -16
- package/dist/components/layout/Board/use-board-selection.js.map +1 -1
- package/dist/components/layout/Flex.js +29 -7
- package/dist/components/layout/Flex.js.map +1 -1
- package/dist/components/layout/Flow.js +29 -7
- package/dist/components/layout/Flow.js.map +1 -1
- package/dist/components/layout/Grid.js +30 -7
- package/dist/components/layout/Grid.js.map +1 -1
- package/dist/components/layout/Panel.js +9 -9
- package/dist/components/layout/Panel.js.map +1 -1
- package/dist/components/layout/Prefix.js +59 -16
- package/dist/components/layout/Prefix.js.map +1 -1
- package/dist/components/layout/ResizablePanel.js +62 -32
- package/dist/components/layout/ResizablePanel.js.map +1 -1
- package/dist/components/layout/Space.js +55 -11
- package/dist/components/layout/Space.js.map +1 -1
- package/dist/components/layout/Suffix.js +59 -16
- package/dist/components/layout/Suffix.js.map +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +394 -164
- package/dist/components/navigation/Pagination/Pagination.js.map +1 -1
- package/dist/components/navigation/Pagination/use-pagination.js +69 -26
- package/dist/components/navigation/Pagination/use-pagination.js.map +1 -1
- package/dist/components/navigation/Tabs/DraggableTabList.js +25 -10
- package/dist/components/navigation/Tabs/DraggableTabList.js.map +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +604 -235
- package/dist/components/navigation/Tabs/TabButton.js.map +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +65 -23
- package/dist/components/navigation/Tabs/TabDropIndicator.js.map +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +47 -19
- package/dist/components/navigation/Tabs/TabPanel.js.map +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +105 -33
- package/dist/components/navigation/Tabs/TabPicker.js.map +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +45 -45
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/navigation/Tabs/TabsAction.js +53 -19
- package/dist/components/navigation/Tabs/TabsAction.js.map +1 -1
- package/dist/components/navigation/Tabs/TabsContext.js +16 -6
- package/dist/components/navigation/Tabs/TabsContext.js.map +1 -1
- package/dist/components/navigation/Tabs/popover-placement.js +1 -1
- package/dist/components/navigation/Tabs/popover-placement.js.map +1 -1
- package/dist/components/navigation/Tabs/styled.js +1 -1
- package/dist/components/navigation/Tabs/styled.js.map +1 -1
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/types.js.map +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +50 -13
- package/dist/components/navigation/Tabs/use-tab-editing.js.map +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +111 -63
- package/dist/components/navigation/Tabs/use-tab-indicator.js.map +1 -1
- package/dist/components/organisms/StatsCard/StatsCard.js +54 -14
- package/dist/components/organisms/StatsCard/StatsCard.js.map +1 -1
- package/dist/components/other/Calendar/Calendar.js +79 -31
- package/dist/components/other/Calendar/Calendar.js.map +1 -1
- package/dist/components/other/Calendar/CalendarCell.js +66 -20
- package/dist/components/other/Calendar/CalendarCell.js.map +1 -1
- package/dist/components/other/Calendar/CalendarGrid.js +90 -40
- package/dist/components/other/Calendar/CalendarGrid.js.map +1 -1
- package/dist/components/other/Calendar/CalendarHeader.js +80 -17
- package/dist/components/other/Calendar/CalendarHeader.js.map +1 -1
- package/dist/components/other/Calendar/CalendarPanel.js +568 -144
- package/dist/components/other/Calendar/CalendarPanel.js.map +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js +425 -134
- package/dist/components/other/Calendar/PeriodCalendar.js.map +1 -1
- package/dist/components/other/Calendar/PeriodGrid.js +6 -6
- package/dist/components/other/Calendar/PeriodGrid.js.map +1 -1
- package/dist/components/other/Calendar/RangeCalendar.js +50 -24
- package/dist/components/other/Calendar/RangeCalendar.js.map +1 -1
- package/dist/components/other/Calendar/styled.js +1 -1
- package/dist/components/other/Calendar/styled.js.map +1 -1
- package/dist/components/other/CubeLogo/CubeLogo.js +95 -34
- package/dist/components/other/CubeLogo/CubeLogo.js.map +1 -1
- package/dist/components/other/NoDataIcon/NoDataIcon.js +1 -1
- package/dist/components/other/NoDataIcon/NoDataIcon.js.map +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialog.js +153 -42
- package/dist/components/overlays/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +76 -54
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js.map +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +146 -39
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js.map +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +26 -10
- package/dist/components/overlays/Dialog/Dialog.js.map +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +13 -13
- package/dist/components/overlays/Dialog/DialogContainer.js.map +1 -1
- package/dist/components/overlays/Dialog/DialogForm.d.ts +12 -7
- package/dist/components/overlays/Dialog/DialogForm.js +18 -7
- package/dist/components/overlays/Dialog/DialogForm.js.map +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.d.ts +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +214 -59
- package/dist/components/overlays/Dialog/DialogTrigger.js.map +1 -1
- package/dist/components/overlays/Dialog/ModernDialogForm.js +350 -0
- package/dist/components/overlays/Dialog/ModernDialogForm.js.map +1 -0
- package/dist/components/overlays/Dialog/context.js +1 -1
- package/dist/components/overlays/Dialog/context.js.map +1 -1
- package/dist/components/overlays/Dialog/index.d.ts +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +6 -6
- package/dist/components/overlays/Dialog/use-dialog-container.js.map +1 -1
- package/dist/components/overlays/Modal/Modal.js +140 -27
- package/dist/components/overlays/Modal/Modal.js.map +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js.map +1 -1
- package/dist/components/overlays/Modal/Overlay.js +4 -4
- package/dist/components/overlays/Modal/Overlay.js.map +1 -1
- package/dist/components/overlays/Modal/Popover.js +131 -29
- package/dist/components/overlays/Modal/Popover.js.map +1 -1
- package/dist/components/overlays/Modal/Tray.js +142 -30
- package/dist/components/overlays/Modal/Tray.js.map +1 -1
- package/dist/components/overlays/Modal/Underlay.js +36 -7
- package/dist/components/overlays/Modal/Underlay.js.map +1 -1
- package/dist/components/overlays/Notifications/Notification.js +69 -32
- package/dist/components/overlays/Notifications/Notification.js.map +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js +79 -26
- package/dist/components/overlays/Notifications/NotificationAction.js.map +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js +138 -33
- package/dist/components/overlays/Notifications/NotificationCard.js.map +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js.map +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js +63 -16
- package/dist/components/overlays/Notifications/NotificationItem.js.map +1 -1
- package/dist/components/overlays/Notifications/OverlayContainer.js +312 -151
- package/dist/components/overlays/Notifications/OverlayContainer.js.map +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js.map +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +210 -58
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js.map +1 -1
- package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
- package/dist/components/overlays/Notifications/dismissed-storage.js.map +1 -1
- package/dist/components/overlays/Notifications/format-relative-time.d.ts +1 -1
- package/dist/components/overlays/Notifications/format-relative-time.js +3 -3
- package/dist/components/overlays/Notifications/format-relative-time.js.map +1 -1
- package/dist/components/overlays/Notifications/index.js +1 -1
- package/dist/components/overlays/Notifications/index.js.map +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js +51 -51
- package/dist/components/overlays/Notifications/use-notification-state.js.map +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js +12 -12
- package/dist/components/overlays/Notifications/use-notifications.js.map +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +10 -10
- package/dist/components/overlays/Notifications/use-overlay-timers.js.map +1 -1
- package/dist/components/overlays/Notifications/use-persistent-notifications.js +24 -5
- package/dist/components/overlays/Notifications/use-persistent-notifications.js.map +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js +145 -43
- package/dist/components/overlays/Notifications/use-persistent-state.js.map +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js +25 -25
- package/dist/components/overlays/Notifications/use-toast-state.js.map +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +68 -15
- package/dist/components/overlays/Toast/ToastItem.js.map +1 -1
- package/dist/components/overlays/Toast/index.js +100 -34
- package/dist/components/overlays/Toast/index.js.map +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js.map +1 -1
- package/dist/components/overlays/Toast/useToast.js +9 -9
- package/dist/components/overlays/Toast/useToast.js.map +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +88 -31
- package/dist/components/overlays/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +75 -10
- package/dist/components/overlays/Tooltip/TooltipProvider.js.map +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +186 -77
- package/dist/components/overlays/Tooltip/TooltipTrigger.js.map +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/overlays/Tooltip/context.js.map +1 -1
- package/dist/components/portal/Portal.js +18 -3
- package/dist/components/portal/Portal.js.map +1 -1
- package/dist/components/portal/PortalProvider.js +11 -2
- package/dist/components/portal/PortalProvider.js.map +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/portal/usePortal.js.map +1 -1
- package/dist/components/shared/DraggableCollection.js +23 -23
- package/dist/components/shared/DraggableCollection.js.map +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/InvalidIcon.js.map +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js.map +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +156 -48
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js.map +1 -1
- package/dist/components/status/Spin/Cube.js +12 -3
- package/dist/components/status/Spin/Cube.js.map +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +21 -6
- package/dist/components/status/Spin/InternalSpinner.js.map +1 -1
- package/dist/components/status/Spin/Spin.js +31 -7
- package/dist/components/status/Spin/Spin.js.map +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +23 -6
- package/dist/components/status/Spin/SpinsContainer.js.map +1 -1
- package/dist/data/item-themes.js +1 -1
- package/dist/data/item-themes.js.map +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/data/themes.js.map +1 -1
- package/dist/eslint-plugin/defaults.generated.js +18 -7
- package/dist/eslint-plugin/defaults.generated.js.map +1 -1
- package/dist/eslint-plugin/index.js +1 -1
- package/dist/eslint-plugin/index.js.map +1 -1
- package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
- package/dist/eslint-plugin/rules/no-redundant-default-prop.js.map +1 -1
- package/dist/i18n/I18nProvider.js +54 -13
- package/dist/i18n/I18nProvider.js.map +1 -1
- package/dist/i18n/createFormatter.js +1 -1
- package/dist/i18n/createFormatter.js.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/instance.js +1 -1
- package/dist/i18n/instance.js.map +1 -1
- package/dist/i18n/locales/de-DE/uikit.js +5 -2
- package/dist/i18n/locales/en-US/uikit.js +5 -2
- package/dist/i18n/locales/en-US/uikit.json.d.ts +15 -5
- package/dist/i18n/locales/es-ES/uikit.js +5 -2
- package/dist/i18n/locales/es-MX/uikit.js +5 -2
- package/dist/i18n/locales/fr-FR/uikit.js +5 -2
- package/dist/i18n/locales/it-IT/uikit.js +5 -2
- package/dist/i18n/locales/ja-JP/uikit.js +5 -2
- package/dist/i18n/locales/nb-NO/uikit.js +5 -2
- package/dist/i18n/locales/pt-BR/uikit.js +5 -2
- package/dist/i18n/locales/pt-PT/uikit.js +5 -2
- package/dist/i18n/locales/sv-SE/uikit.js +5 -2
- package/dist/i18n/locales/vi-VN/uikit.js +5 -2
- package/dist/i18n/locales.js +1 -1
- package/dist/i18n/locales.js.map +1 -1
- package/dist/i18n/useFormatter.js +10 -3
- package/dist/i18n/useFormatter.js.map +1 -1
- package/dist/i18n/useI18n.js +1 -1
- package/dist/i18n/useI18n.js.map +1 -1
- package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
- package/dist/icons/AdjustmentsHorizontalIcon.js.map +1 -1
- package/dist/icons/AdjustmentsIcon.js +1 -1
- package/dist/icons/AdjustmentsIcon.js.map +1 -1
- package/dist/icons/AiIcon.js +1 -1
- package/dist/icons/AiIcon.js.map +1 -1
- package/dist/icons/AreaChartIcon.js +1 -1
- package/dist/icons/AreaChartIcon.js.map +1 -1
- package/dist/icons/ArrowNarrowDownIcon.js +1 -1
- package/dist/icons/ArrowNarrowDownIcon.js.map +1 -1
- package/dist/icons/ArrowNarrowUpIcon.js +1 -1
- package/dist/icons/ArrowNarrowUpIcon.js.map +1 -1
- package/dist/icons/BackwardIcon.js +1 -1
- package/dist/icons/BackwardIcon.js.map +1 -1
- package/dist/icons/BarChartIcon.js +1 -1
- package/dist/icons/BarChartIcon.js.map +1 -1
- package/dist/icons/BellFilledIcon.js +1 -1
- package/dist/icons/BellFilledIcon.js.map +1 -1
- package/dist/icons/BellIcon.js +1 -1
- package/dist/icons/BellIcon.js.map +1 -1
- package/dist/icons/BooleanIcon.js +1 -1
- package/dist/icons/BooleanIcon.js.map +1 -1
- package/dist/icons/CalendarEditIcon.js +1 -1
- package/dist/icons/CalendarEditIcon.js.map +1 -1
- package/dist/icons/CalendarIcon.js +1 -1
- package/dist/icons/CalendarIcon.js.map +1 -1
- package/dist/icons/CaretDownIcon.js +1 -1
- package/dist/icons/CaretDownIcon.js.map +1 -1
- package/dist/icons/CaretUpIcon.js +1 -1
- package/dist/icons/CaretUpIcon.js.map +1 -1
- package/dist/icons/ChartAreaStackedIcon.js +1 -1
- package/dist/icons/ChartAreaStackedIcon.js.map +1 -1
- package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartAreaStackedPercentageIcon.js.map +1 -1
- package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarGroupedHorizontalIcon.js.map +1 -1
- package/dist/icons/ChartBarGroupedIcon.js +1 -1
- package/dist/icons/ChartBarGroupedIcon.js.map +1 -1
- package/dist/icons/ChartBarHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarHorizontalIcon.js.map +1 -1
- package/dist/icons/ChartBarLineIcon.js +1 -1
- package/dist/icons/ChartBarLineIcon.js.map +1 -1
- package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedHorizontalIcon.js.map +1 -1
- package/dist/icons/ChartBarStackedIcon.js +1 -1
- package/dist/icons/ChartBarStackedIcon.js.map +1 -1
- package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js.map +1 -1
- package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageIcon.js.map +1 -1
- package/dist/icons/ChartBoxPlot2Icon.js +1 -1
- package/dist/icons/ChartBoxPlot2Icon.js.map +1 -1
- package/dist/icons/ChartBoxPlotIcon.js +1 -1
- package/dist/icons/ChartBoxPlotIcon.js.map +1 -1
- package/dist/icons/ChartBubbleIcon.js +1 -1
- package/dist/icons/ChartBubbleIcon.js.map +1 -1
- package/dist/icons/ChartDonut2Icon.js +1 -1
- package/dist/icons/ChartDonut2Icon.js.map +1 -1
- package/dist/icons/ChartFunnelIcon.js +1 -1
- package/dist/icons/ChartFunnelIcon.js.map +1 -1
- package/dist/icons/ChartHeatmapIcon.js +1 -1
- package/dist/icons/ChartHeatmapIcon.js.map +1 -1
- package/dist/icons/ChartKPIIcon.js +1 -1
- package/dist/icons/ChartKPIIcon.js.map +1 -1
- package/dist/icons/ChartPie2Icon.js +1 -1
- package/dist/icons/ChartPie2Icon.js.map +1 -1
- package/dist/icons/ChartScatterIcon.js +1 -1
- package/dist/icons/ChartScatterIcon.js.map +1 -1
- package/dist/icons/CheckCircleFilledIcon.js +1 -1
- package/dist/icons/CheckCircleFilledIcon.js.map +1 -1
- package/dist/icons/CheckCircleIcon.js +1 -1
- package/dist/icons/CheckCircleIcon.js.map +1 -1
- package/dist/icons/CheckIcon.js +1 -1
- package/dist/icons/CheckIcon.js.map +1 -1
- package/dist/icons/CircleFilledIcon.js +1 -1
- package/dist/icons/CircleFilledIcon.js.map +1 -1
- package/dist/icons/ClearIcon.js +1 -1
- package/dist/icons/ClearIcon.js.map +1 -1
- package/dist/icons/CloseCircleFilledIcon.js +1 -1
- package/dist/icons/CloseCircleFilledIcon.js.map +1 -1
- package/dist/icons/CloseCircleIcon.js +1 -1
- package/dist/icons/CloseCircleIcon.js.map +1 -1
- package/dist/icons/CloseIcon.js +1 -1
- package/dist/icons/CloseIcon.js.map +1 -1
- package/dist/icons/CodeIcon.js +1 -1
- package/dist/icons/CodeIcon.js.map +1 -1
- package/dist/icons/ColumnTotalIcon.js +1 -1
- package/dist/icons/ColumnTotalIcon.js.map +1 -1
- package/dist/icons/CopyIcon.js +1 -1
- package/dist/icons/CopyIcon.js.map +1 -1
- package/dist/icons/CountIcon.js +1 -1
- package/dist/icons/CountIcon.js.map +1 -1
- package/dist/icons/CubeIcon.js +1 -1
- package/dist/icons/CubeIcon.js.map +1 -1
- package/dist/icons/CubePauseIcon.js +1 -1
- package/dist/icons/CubePauseIcon.js.map +1 -1
- package/dist/icons/CubePlayIcon.js +1 -1
- package/dist/icons/CubePlayIcon.js.map +1 -1
- package/dist/icons/CurrencyDollarIcon.js +1 -1
- package/dist/icons/CurrencyDollarIcon.js.map +1 -1
- package/dist/icons/DangerIcon.js +1 -1
- package/dist/icons/DangerIcon.js.map +1 -1
- package/dist/icons/DashboardIcon.js +1 -1
- package/dist/icons/DashboardIcon.js.map +1 -1
- package/dist/icons/DatabaseIcon.js +1 -1
- package/dist/icons/DatabaseIcon.js.map +1 -1
- package/dist/icons/DecimalDecreaseIcon.js +1 -1
- package/dist/icons/DecimalDecreaseIcon.js.map +1 -1
- package/dist/icons/DecimalIncreaseIcon.js +1 -1
- package/dist/icons/DecimalIncreaseIcon.js.map +1 -1
- package/dist/icons/DirectionIcon.js +67 -22
- package/dist/icons/DirectionIcon.js.map +1 -1
- package/dist/icons/DonutIcon.js +1 -1
- package/dist/icons/DonutIcon.js.map +1 -1
- package/dist/icons/DownIcon.js +1 -1
- package/dist/icons/DownIcon.js.map +1 -1
- package/dist/icons/EditIcon.js +1 -1
- package/dist/icons/EditIcon.js.map +1 -1
- package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
- package/dist/icons/ExclamationCircleFilledIcon.js.map +1 -1
- package/dist/icons/ExclamationCircleIcon.js +1 -1
- package/dist/icons/ExclamationCircleIcon.js.map +1 -1
- package/dist/icons/ExclamationIcon.js +1 -1
- package/dist/icons/ExclamationIcon.js.map +1 -1
- package/dist/icons/EyeIcon.js +1 -1
- package/dist/icons/EyeIcon.js.map +1 -1
- package/dist/icons/EyeInvisibleIcon.js +1 -1
- package/dist/icons/EyeInvisibleIcon.js.map +1 -1
- package/dist/icons/FilterIcon.js +1 -1
- package/dist/icons/FilterIcon.js.map +1 -1
- package/dist/icons/FolderFilledIcon.js +1 -1
- package/dist/icons/FolderFilledIcon.js.map +1 -1
- package/dist/icons/FolderIcon.js +1 -1
- package/dist/icons/FolderIcon.js.map +1 -1
- package/dist/icons/FolderOpenFilledIcon.js +1 -1
- package/dist/icons/FolderOpenFilledIcon.js.map +1 -1
- package/dist/icons/FolderOpenIcon.js +1 -1
- package/dist/icons/FolderOpenIcon.js.map +1 -1
- package/dist/icons/ForwardIcon.js +1 -1
- package/dist/icons/ForwardIcon.js.map +1 -1
- package/dist/icons/GripVerticalIcon.js +1 -1
- package/dist/icons/GripVerticalIcon.js.map +1 -1
- package/dist/icons/HierarchyIcon.js +1 -1
- package/dist/icons/HierarchyIcon.js.map +1 -1
- package/dist/icons/HierarchyOpenIcon.js +1 -1
- package/dist/icons/HierarchyOpenIcon.js.map +1 -1
- package/dist/icons/Icon.js +60 -16
- package/dist/icons/Icon.js.map +1 -1
- package/dist/icons/InfoCircleIcon.js +1 -1
- package/dist/icons/InfoCircleIcon.js.map +1 -1
- package/dist/icons/InfoIcon.js +1 -1
- package/dist/icons/InfoIcon.js.map +1 -1
- package/dist/icons/KeyIcon.js +1 -1
- package/dist/icons/KeyIcon.js.map +1 -1
- package/dist/icons/LeftIcon.js +1 -1
- package/dist/icons/LeftIcon.js.map +1 -1
- package/dist/icons/LineChartIcon.js +1 -1
- package/dist/icons/LineChartIcon.js.map +1 -1
- package/dist/icons/LoadingIcon.js +1 -1
- package/dist/icons/LoadingIcon.js.map +1 -1
- package/dist/icons/LockFilledIcon.js +1 -1
- package/dist/icons/LockFilledIcon.js.map +1 -1
- package/dist/icons/LockIcon.js +1 -1
- package/dist/icons/LockIcon.js.map +1 -1
- package/dist/icons/MoreIcon.js +1 -1
- package/dist/icons/MoreIcon.js.map +1 -1
- package/dist/icons/NotAllowedIcon.js +1 -1
- package/dist/icons/NotAllowedIcon.js.map +1 -1
- package/dist/icons/Number123Icon.js +1 -1
- package/dist/icons/Number123Icon.js.map +1 -1
- package/dist/icons/NumberIcon.js +1 -1
- package/dist/icons/NumberIcon.js.map +1 -1
- package/dist/icons/PauseCircleFilledIcon.js +1 -1
- package/dist/icons/PauseCircleFilledIcon.js.map +1 -1
- package/dist/icons/PauseCircleIcon.js +1 -1
- package/dist/icons/PauseCircleIcon.js.map +1 -1
- package/dist/icons/PauseIcon.js +1 -1
- package/dist/icons/PauseIcon.js.map +1 -1
- package/dist/icons/PercentageIcon.js +1 -1
- package/dist/icons/PercentageIcon.js.map +1 -1
- package/dist/icons/PieChartIcon.js +1 -1
- package/dist/icons/PieChartIcon.js.map +1 -1
- package/dist/icons/PipetteIcon.js +1 -1
- package/dist/icons/PipetteIcon.js.map +1 -1
- package/dist/icons/PlayCircleIcon.js +1 -1
- package/dist/icons/PlayCircleIcon.js.map +1 -1
- package/dist/icons/PlayIcon.js +1 -1
- package/dist/icons/PlayIcon.js.map +1 -1
- package/dist/icons/PlusIcon.js +1 -1
- package/dist/icons/PlusIcon.js.map +1 -1
- package/dist/icons/ProgressBarIcon.js +1 -1
- package/dist/icons/ProgressBarIcon.js.map +1 -1
- package/dist/icons/ReloadIcon.js +1 -1
- package/dist/icons/ReloadIcon.js.map +1 -1
- package/dist/icons/ReportIcon.js +1 -1
- package/dist/icons/ReportIcon.js.map +1 -1
- package/dist/icons/ReturnIcon.js +1 -1
- package/dist/icons/ReturnIcon.js.map +1 -1
- package/dist/icons/RightIcon.js +1 -1
- package/dist/icons/RightIcon.js.map +1 -1
- package/dist/icons/RowTotalsIcon.js +1 -1
- package/dist/icons/RowTotalsIcon.js.map +1 -1
- package/dist/icons/SchemeIcon.js +1 -1
- package/dist/icons/SchemeIcon.js.map +1 -1
- package/dist/icons/SearchIcon.js +1 -1
- package/dist/icons/SearchIcon.js.map +1 -1
- package/dist/icons/SemanticQueryIcon.js +1 -1
- package/dist/icons/SemanticQueryIcon.js.map +1 -1
- package/dist/icons/SettingsIcon.js +1 -1
- package/dist/icons/SettingsIcon.js.map +1 -1
- package/dist/icons/ShieldFilledIcon.js +1 -1
- package/dist/icons/ShieldFilledIcon.js.map +1 -1
- package/dist/icons/ShieldIcon.js +1 -1
- package/dist/icons/ShieldIcon.js.map +1 -1
- package/dist/icons/SlashIcon.js +1 -1
- package/dist/icons/SlashIcon.js.map +1 -1
- package/dist/icons/SparklesIcon.js +1 -1
- package/dist/icons/SparklesIcon.js.map +1 -1
- package/dist/icons/SqlIcon.js +1 -1
- package/dist/icons/SqlIcon.js.map +1 -1
- package/dist/icons/StatsIcon.js +1 -1
- package/dist/icons/StatsIcon.js.map +1 -1
- package/dist/icons/StopIcon.js +1 -1
- package/dist/icons/StopIcon.js.map +1 -1
- package/dist/icons/StringIcon.js +1 -1
- package/dist/icons/StringIcon.js.map +1 -1
- package/dist/icons/SubtotalsIcon.js +1 -1
- package/dist/icons/SubtotalsIcon.js.map +1 -1
- package/dist/icons/SwitchIcon.js +1 -1
- package/dist/icons/SwitchIcon.js.map +1 -1
- package/dist/icons/TableIcon.js +1 -1
- package/dist/icons/TableIcon.js.map +1 -1
- package/dist/icons/ThumbsDownIcon.js +1 -1
- package/dist/icons/ThumbsDownIcon.js.map +1 -1
- package/dist/icons/ThumbsUpIcon.js +1 -1
- package/dist/icons/ThumbsUpIcon.js.map +1 -1
- package/dist/icons/ThunderboltCrossedIcon.js +1 -1
- package/dist/icons/ThunderboltCrossedIcon.js.map +1 -1
- package/dist/icons/ThunderboltFilledIcon.js +1 -1
- package/dist/icons/ThunderboltFilledIcon.js.map +1 -1
- package/dist/icons/ThunderboltIcon.js +1 -1
- package/dist/icons/ThunderboltIcon.js.map +1 -1
- package/dist/icons/TimeIcon.js +1 -1
- package/dist/icons/TimeIcon.js.map +1 -1
- package/dist/icons/TrashIcon.js +1 -1
- package/dist/icons/TrashIcon.js.map +1 -1
- package/dist/icons/UnlockIcon.js +1 -1
- package/dist/icons/UnlockIcon.js.map +1 -1
- package/dist/icons/UpIcon.js +1 -1
- package/dist/icons/UpIcon.js.map +1 -1
- package/dist/icons/UserGroupIcon.js +1 -1
- package/dist/icons/UserGroupIcon.js.map +1 -1
- package/dist/icons/UserIcon.js +1 -1
- package/dist/icons/UserIcon.js.map +1 -1
- package/dist/icons/UserLockIcon.js +1 -1
- package/dist/icons/UserLockIcon.js.map +1 -1
- package/dist/icons/ViewIcon.js +1 -1
- package/dist/icons/ViewIcon.js.map +1 -1
- package/dist/icons/WarningFilledIcon.js +1 -1
- package/dist/icons/WarningFilledIcon.js.map +1 -1
- package/dist/icons/WarningIcon.js +1 -1
- package/dist/icons/WarningIcon.js.map +1 -1
- package/dist/icons/wrap-icon.js +15 -7
- package/dist/icons/wrap-icon.js.map +1 -1
- package/dist/index.d.ts +22 -22
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/probe/canonicalize.js +2 -2
- package/dist/probe/canonicalize.js.map +1 -1
- package/dist/probe/css.js +1 -1
- package/dist/probe/css.js.map +1 -1
- package/dist/probe/index.js +1 -1
- package/dist/provider.js +17 -7
- package/dist/provider.js.map +1 -1
- package/dist/providers/TrackingProvider.js +33 -9
- package/dist/providers/TrackingProvider.js.map +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/providers/navigationAdapter.default.js.map +1 -1
- package/dist/tokens/all-tokens.js +1 -1
- package/dist/tokens/all-tokens.js.map +1 -1
- package/dist/tokens/base.js +2 -2
- package/dist/tokens/base.js.map +1 -1
- package/dist/tokens/color-seed.js +1 -1
- package/dist/tokens/color-seed.js.map +1 -1
- package/dist/tokens/color-theme.js +18 -3
- package/dist/tokens/color-theme.js.map +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/colors.js.map +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/layout.js.map +1 -1
- package/dist/tokens/lazy-styles.js +1 -1
- package/dist/tokens/lazy-styles.js.map +1 -1
- package/dist/tokens/legacy-color.js +1 -1
- package/dist/tokens/legacy-color.js.map +1 -1
- package/dist/tokens/palette-config.js +9 -2
- package/dist/tokens/palette-config.js.map +1 -1
- package/dist/tokens/palette.js +1 -1
- package/dist/tokens/palette.js.map +1 -1
- package/dist/tokens/resolve.js +85 -21
- package/dist/tokens/resolve.js.map +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/shadows.js.map +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/sizes.js.map +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/tokens/spacing.js.map +1 -1
- package/dist/tokens/typography.js +1 -1
- package/dist/tokens/typography.js.map +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- package/dist/utils/ResizeSensor.js.map +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/colors.js.map +1 -1
- package/dist/utils/dotize.js +1 -1
- package/dist/utils/dotize.js.map +1 -1
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/is-dev-env.js.map +1 -1
- package/dist/utils/modules.js +1 -1
- package/dist/utils/modules.js.map +1 -1
- package/dist/utils/promise.js +1 -1
- package/dist/utils/promise.js.map +1 -1
- package/dist/utils/raf.js +1 -1
- package/dist/utils/raf.js.map +1 -1
- package/dist/utils/random.js +1 -1
- package/dist/utils/random.js.map +1 -1
- package/dist/utils/range.js +1 -1
- package/dist/utils/range.js.map +1 -1
- package/dist/utils/react/RenderCache.js +2 -2
- package/dist/utils/react/RenderCache.js.map +1 -1
- package/dist/utils/react/Slots.js +67 -24
- package/dist/utils/react/Slots.js.map +1 -1
- package/dist/utils/react/chain.js +1 -1
- package/dist/utils/react/chain.js.map +1 -1
- package/dist/utils/react/disabledProps.js +1 -1
- package/dist/utils/react/disabledProps.js.map +1 -1
- package/dist/utils/react/escapePropagation.js +1 -1
- package/dist/utils/react/escapePropagation.js.map +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js.map +1 -1
- package/dist/utils/react/index.js +1 -1
- package/dist/utils/react/interactions.js +35 -12
- package/dist/utils/react/interactions.js.map +1 -1
- package/dist/utils/react/isTextOnly.js +1 -1
- package/dist/utils/react/isTextOnly.js.map +1 -1
- package/dist/utils/react/mapProps.js +1 -1
- package/dist/utils/react/mapProps.js.map +1 -1
- package/dist/utils/react/mergeProps.js +1 -1
- package/dist/utils/react/mergeProps.js.map +1 -1
- package/dist/utils/react/nullableValue.js +1 -1
- package/dist/utils/react/nullableValue.js.map +1 -1
- package/dist/utils/react/programmaticFocus.js +1 -1
- package/dist/utils/react/programmaticFocus.js.map +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/resolveIcon.js.map +1 -1
- package/dist/utils/react/sharedStore.js +13 -2
- package/dist/utils/react/sharedStore.js.map +1 -1
- package/dist/utils/react/useBufferedValue.js +5 -5
- package/dist/utils/react/useBufferedValue.js.map +1 -1
- package/dist/utils/react/useCombinedRefs.js +20 -5
- package/dist/utils/react/useCombinedRefs.js.map +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +53 -17
- package/dist/utils/react/useControlledFocusVisible.js.map +1 -1
- package/dist/utils/react/useEventBus.js +43 -18
- package/dist/utils/react/useEventBus.js.map +1 -1
- package/dist/utils/react/useId.js +2 -1
- package/dist/utils/react/useId.js.map +1 -1
- package/dist/utils/react/useIsDarwin.js +29 -16
- package/dist/utils/react/useIsDarwin.js.map +1 -1
- package/dist/utils/react/useKeySymbols.js +23 -9
- package/dist/utils/react/useKeySymbols.js.map +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLayoutEffect.js.map +1 -1
- package/dist/utils/react/useLocalStorage.js +75 -30
- package/dist/utils/react/useLocalStorage.js.map +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/useMergeStyles.js.map +1 -1
- package/dist/utils/react/useOverlayEscapeGuard.js +25 -9
- package/dist/utils/react/useOverlayEscapeGuard.js.map +1 -1
- package/dist/utils/react/usePopoverSync.js +175 -73
- package/dist/utils/react/usePopoverSync.js.map +1 -1
- package/dist/utils/react/useQaProps.js +1 -1
- package/dist/utils/react/useQaProps.js.map +1 -1
- package/dist/utils/react/useScheme.js +1 -1
- package/dist/utils/react/useScheme.js.map +1 -1
- package/dist/utils/react/useViewportSize.js +43 -19
- package/dist/utils/react/useViewportSize.js.map +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js.map +1 -1
- package/dist/utils/selection.js +1 -1
- package/dist/utils/selection.js.map +1 -1
- package/dist/utils/styles.js +1 -1
- package/dist/utils/styles.js.map +1 -1
- package/dist/utils/tree.js +1 -1
- package/dist/utils/tree.js.map +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/utils/warnings.js.map +1 -1
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/docs/Usage.md +9 -1
- package/docs/components/actions/Button.md +1 -1
- package/docs/components/content/InlineInput.md +1 -1
- package/docs/components/content/Item.md +19 -0
- package/docs/components/fields/ColorInput.md +13 -8
- package/docs/components/fields/ColorPicker.md +13 -8
- package/docs/components/fields/ComboBox.md +16 -12
- package/docs/components/fields/CommandTextArea.md +3 -1
- package/docs/components/fields/FilterListBox.md +24 -19
- package/docs/components/fields/FilterPicker.md +25 -19
- package/docs/components/fields/ListBox.md +36 -26
- package/docs/components/fields/Picker.md +28 -21
- package/docs/components/fields/Select.md +17 -12
- package/docs/components/form/Field.md +2 -2
- package/docs/components/form/Form.md +60 -579
- package/docs/components/form/ModernForm.md +22 -1
- package/docs/components/overlays/Dialog.md +26 -0
- package/docs/components/overlays/DialogForm.md +121 -263
- package/docs/components/overlays/DialogTrigger.md +1 -1
- package/docs/components/overlays/UseDialogContainer.md +11 -13
- package/docs/modern-form-guide.md +22 -1
- package/docs/modern-form-migration.md +1 -1
- package/package.json +7 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandTextArea.js","names":["mergeProps","BaseSection"],"sources":["../../../../src/components/fields/CommandTextArea/CommandTextArea.tsx"],"sourcesContent":["import { Collection, Key, Node } from '@react-types/shared';\nimport { Styles } from '@tenphi/tasty';\nimport React, {\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFilter, useTextField } from 'react-aria';\nimport { Section as BaseSection, useListState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal';\nimport { generateRandomId } from '../../../utils/random';\nimport { chain, mergeProps, useCombinedRefs } from '../../../utils/react';\nimport {\n castNullableStringValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { CollectionItem as Item } from '../../CollectionItem';\nimport { useFieldProps } from '../../form';\nimport {\n collectVisibleKeys,\n filterCollectionNodes,\n getEdgeVisibleKey,\n getNextVisibleKey,\n ListBoxPopover,\n ListStateLike,\n markKeyboardFocus,\n TextFilterFn,\n useCompositeFocus,\n} from '../ListBoxPopover';\nimport {\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\nimport { useAutoSizeTextArea } from '../TextInput/useAutoSizeTextArea';\n\nimport { useCaretAnchor } from './useCaretAnchor';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** A single trigger character with optional placement constraint. */\nexport interface CommandTrigger {\n /** The character that opens the autocomplete (e.g. `/` or `@`). */\n char: string;\n /**\n * When true, the trigger token must start at the beginning of the line the\n * caret is on (right after a newline, or at the very start of the input) —\n * i.e. line-scoped slash commands. When false, the token may appear after\n * any whitespace, anywhere in the text (Slack/Notion-style).\n */\n atLineStart?: boolean;\n}\n\n/** Result of scanning the textarea for an active trigger token. */\nexport interface ActiveToken {\n /** The matched trigger descriptor. */\n trigger: CommandTrigger;\n /** The active token text, INCLUDING the trigger char (e.g. `/cle`). */\n token: string;\n /** Inclusive start index of the token in the textarea value. */\n start: number;\n /** Exclusive end index of the token (caret position while typing). */\n end: number;\n}\n\nexport type CommandTextAreaFilterFn = TextFilterFn;\n\nexport interface CubeCommandTextAreaProps<T>\n extends Omit<CubeTextInputBaseProps, 'children' | 'multiLine'> {\n /** Whether the textarea should resize to fit its content. */\n autoSize?: boolean;\n /** Max visible rows when `autoSize` is true. Defaults to 10. */\n maxRows?: number;\n /** Number of visible rows. Defaults to 3. */\n rows?: number;\n\n /** Command/option source (alternative to JSX children). */\n items?: Iterable<T>;\n /** Static items or a render function (same shape as ComboBox/ListBox). */\n children?: ReactNode | ((item: T) => ReactElement);\n /**\n * Triggers that open the autocomplete. Defaults to a single slash command\n * that must start at the beginning of the input.\n */\n triggers?: CommandTrigger[];\n /**\n * Custom filter. Pass `false` to disable internal filtering (server-side).\n */\n filter?: CommandTextAreaFilterFn | false;\n /**\n * Fired when the user picks a command (Enter/Tab/click). The option's\n * `textValue` is also inserted into the textarea regardless.\n */\n onCommand?: (key: Key, item: { textValue: string; [k: string]: any }) => void;\n /** Insert a trailing space after the chosen command. Defaults to true. */\n insertSpaceAfter?: boolean;\n /** Keys of disabled options. */\n disabledKeys?: Iterable<Key>;\n /** Popover placement. Chat inputs usually want `top`. Defaults to `top`. */\n direction?: 'bottom' | 'top';\n /** Whether the popover should flip when overflowing. Defaults to true. */\n shouldFlip?: boolean;\n /** Offset between the textarea and the popover. */\n overlayOffset?: number;\n /** Padding between the popover and the viewport edge. */\n containerPadding?: number;\n\n // Refs\n /** Ref for the textarea element. */\n inputRef?: RefObject<HTMLTextAreaElement>;\n /** Ref for the wrapper element (popover anchor). */\n wrapperRef?: RefObject<HTMLDivElement>;\n /** Ref for the popover overlay element. */\n popoverRef?: RefObject<HTMLDivElement>;\n /** Ref for the listbox element. */\n listBoxRef?: RefObject<HTMLDivElement>;\n /** Ref through which the internal list state is exposed. */\n listStateRef?: RefObject<ListStateLike | null>;\n\n // Style props\n overlayStyles?: any;\n listBoxStyles?: any;\n optionStyles?: any;\n sectionStyles?: any;\n headingStyles?: any;\n}\n\nconst DEFAULT_TRIGGERS: CommandTrigger[] = [{ char: '/', atLineStart: true }];\n\n// ---------------------------------------------------------------------------\n// Trigger parsing\n// ---------------------------------------------------------------------------\n\n/**\n * Inspect the textarea contents up to the caret and find the active trigger\n * token, if any. The token includes the trigger character and ends at the\n * caret (so it grows as the user types). A token ends at whitespace or the end\n * of the input.\n */\nexport function parseActiveToken(\n value: string,\n caret: number,\n triggers: CommandTrigger[],\n): ActiveToken | null {\n if (!triggers.length) return null;\n const before = value.slice(0, caret);\n const after = value.slice(caret);\n\n for (const trigger of triggers) {\n const ch = trigger.char;\n if (trigger.atLineStart) {\n // Line-start command: the trigger char must sit at the start of the line\n // the caret is on (right after a newline, or at index 0), with no\n // whitespace between it and the caret. On a single-line input with no\n // newlines this is equivalent to \"index 0 of the whole input\".\n const lineStart = before.lastIndexOf('\\n') + 1;\n const linePrefix = before.slice(lineStart);\n if (linePrefix[0] !== ch) continue;\n // No whitespace allowed within the token (after the trigger char).\n const wsIndex = linePrefix.slice(1).search(/\\s/);\n if (wsIndex !== -1) continue;\n if (!linePrefix) continue;\n return { trigger, token: linePrefix, start: lineStart, end: caret };\n }\n\n // Caret-token mode: find the last trigger char that begins a token at or\n // after a line start / whitespace boundary, with no whitespace between it\n // and the caret.\n const match = /(?:^|\\s)([\\S]+)$/.exec(before);\n if (!match) continue;\n const candidate = match[1];\n if (candidate[0] !== ch) continue;\n // Ensure the token hasn't already been closed by whitespace after caret.\n // (If there's non-whitespace after the caret, the user is mid-token.)\n const start = caret - candidate.length;\n // If immediately after the caret there's whitespace (or end), the token is\n // \"complete\" — still offer completions as long as the caret sits on the\n // token. We accept it.\n void after;\n return { trigger, token: candidate, start, end: caret };\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nfunction CommandTextArea<T extends object>(\n props: WithNullableValue<CubeCommandTextAreaProps<T>>,\n ref: ForwardedRef<HTMLElement>,\n) {\n props = castNullableStringValue(props);\n props = useFieldProps(props, {\n defaultValidationTrigger: 'onBlur',\n valuePropsMapper: ({ value, onChange }) => ({\n onChange,\n value: value?.toString() ?? '',\n }),\n });\n\n let {\n qa,\n autoSize = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n maxRows = 10,\n rows = 3,\n labelProps: userLabelProps,\n inputProps: userInputProps,\n inputRef: propsInputRef,\n value,\n defaultValue,\n placeholder,\n // command props\n items,\n children: renderChildren,\n triggers = DEFAULT_TRIGGERS,\n filter,\n onCommand,\n insertSpaceAfter = true,\n disabledKeys,\n direction = 'top',\n shouldFlip = true,\n overlayOffset = 8,\n containerPadding = 8,\n overlayStyles,\n listBoxStyles,\n optionStyles,\n sectionStyles,\n headingStyles,\n wrapperRef: propsWrapperRef,\n popoverRef: propsPopoverRef,\n listBoxRef: propsListBoxRef,\n listStateRef: propsListStateRef,\n onKeyDown,\n onFocus,\n onBlur,\n ...otherProps\n } = props;\n\n rows = Math.max(rows, 1);\n maxRows = Math.max(maxRows, rows);\n\n // ---- refs -------------------------------------------------------------\n const localInputRef = useRef<HTMLTextAreaElement>(null);\n const inputRef = (propsInputRef ??\n localInputRef) as RefObject<HTMLTextAreaElement>;\n const wrapperRef = useCombinedRefs<HTMLDivElement>(propsWrapperRef);\n const popoverRef = useCombinedRefs<HTMLDivElement>(propsPopoverRef);\n const listBoxRef = useCombinedRefs<HTMLDivElement>(propsListBoxRef);\n const localListStateRef = useRef<ListStateLike | null>(null);\n const listStateRef = (propsListStateRef ??\n localListStateRef) as RefObject<ListStateLike | null>;\n\n const commandTextAreaId = useMemo(() => generateRandomId(), []);\n\n // ---- controlled / uncontrolled value ----------------------------------\n // When no `value` is provided (standalone, no form), track the text\n // internally so trigger detection and commit still work.\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(\n (value as string) ?? (defaultValue as string) ?? '',\n );\n const effectiveValue: string = isControlled\n ? (value as string)\n : internalValue;\n const handleChange = useEvent((next: string) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n });\n\n // ---- children / items normalization -----------------------------------\n let children: ReactNode = renderChildren as ReactNode;\n const renderFn = renderChildren as unknown;\n if (items && typeof renderFn === 'function') {\n const itemsArray = Array.from(items as Iterable<any>);\n children = itemsArray.map((item, idx) => {\n const rendered = (renderFn as (it: any) => ReactNode)(item);\n if (\n React.isValidElement(rendered) &&\n (rendered as ReactElement).key == null\n ) {\n return React.cloneElement(rendered as ReactElement, {\n key: (rendered as any)?.key ?? item?.key ?? idx,\n });\n }\n return rendered as ReactNode;\n });\n }\n\n // ---- caret tracking ---------------------------------------------------\n // The caret drives trigger detection. We keep it in state so a caret move\n // (arrow keys without typing) re-renders and recomputes the active token.\n const [caret, setCaret] = useState(() => effectiveValue.length);\n const syncCaret = useEvent(() => {\n const el = inputRef.current;\n if (!el) return;\n setCaret(el.selectionStart ?? el.value.length);\n });\n\n // ---- trigger detection ------------------------------------------------\n const activeToken = useMemo(\n () =>\n parseActiveToken(\n effectiveValue,\n Math.min(caret, effectiveValue.length),\n triggers,\n ),\n [effectiveValue, caret, triggers],\n );\n\n // The active token includes the trigger char (e.g. `/co`). Strip it before\n // filtering so the query is matched against the meaningful text — this lets\n // options match by their label/description (which don't contain the trigger\n // char) as well as by their `textValue`.\n const term = useMemo(() => {\n if (!activeToken) return '';\n const { token, trigger } = activeToken;\n return token.startsWith(trigger.char)\n ? token.slice(trigger.char.length)\n : token;\n }, [activeToken]);\n\n // ---- filtering --------------------------------------------------------\n const { contains } = useFilter({ sensitivity: 'base' });\n const textFilterFn = useMemo<CommandTextAreaFilterFn>(\n () => (filter === false ? () => true : filter || contains),\n [filter, contains],\n );\n\n // Local collection used to read option textValues and to count matches.\n const localCollectionState = useListState({\n children: children as any,\n items: items as any,\n selectionMode: 'none',\n });\n\n const filterFn = useCallback(\n (nodes: Iterable<any>) =>\n filterCollectionNodes(nodes, term, textFilterFn, {\n matchExtraFields: true,\n }),\n [term, textFilterFn],\n );\n\n // Keys of the currently visible (filtered) options, in display order.\n // Derived from our own local collection + filter (rather than the ListBox's\n // exposed state ref) so it is always in sync with the current token — the\n // ListBox's `stateRef.collection` can momentarily lag by a render right after\n // the token narrows, which would otherwise leave virtual focus on (and commit)\n // an option that is no longer visible.\n const visibleFilteredKeys = useMemo<Key[]>(() => {\n if (!activeToken) return [];\n const keys: Key[] = [];\n const disabled = disabledKeys ? new Set<Key>(disabledKeys) : undefined;\n collectVisibleKeys(\n filterFn(localCollectionState.collection),\n keys,\n disabled,\n );\n return keys;\n }, [activeToken, filterFn, localCollectionState.collection, disabledKeys]);\n\n const filteredCount = visibleFilteredKeys.length;\n\n // ---- dismiss handling (Escape keeps the text but hides the popover) ---\n const [dismissedToken, setDismissedToken] = useState<string | null>(null);\n // Bumped whenever we move the virtual focus so the textarea's\n // `aria-activedescendant` (read from the ListBox's stateRef at render time)\n // stays in sync — the ListBox's own state update does not re-render us.\n const [, setFocusTick] = useState(0);\n const bumpFocus = useEvent(() => setFocusTick((t) => t + 1));\n // Reset dismissal whenever the active token changes (user typed/backspaced).\n useEffect(() => {\n setDismissedToken((prev) =>\n prev != null && activeToken?.token !== prev ? null : prev,\n );\n }, [activeToken?.token]);\n\n const isCommandMode = !!activeToken && activeToken.token !== dismissedToken;\n const shouldShowPopover = isCommandMode && filteredCount > 0;\n\n // ---- caret-anchored popover ------------------------------------------\n // A zero-size element positioned at the caret (both axes) drives the\n // popover's geometry; the wrapper remains the dismiss/outside-click trigger.\n const { anchorRef: caretAnchorRef, positionApiRef } = useCaretAnchor({\n inputRef: inputRef as RefObject<HTMLTextAreaElement>,\n wrapperRef: wrapperRef as RefObject<HTMLElement>,\n caret,\n value: effectiveValue,\n isActive: shouldShowPopover,\n });\n\n // ---- height autosize (shared with TextArea) ---------------------------\n const adjustHeight = useAutoSizeTextArea({\n inputRef,\n autoSize,\n rows,\n maxRows,\n value: effectiveValue,\n });\n\n // ---- useTextField (ARIA wiring for the textarea) ----------------------\n let { labelProps, inputProps } = useTextField(\n {\n ...otherProps,\n value: effectiveValue,\n placeholder,\n isDisabled,\n isReadOnly,\n isRequired,\n onChange: chain(handleChange, adjustHeight),\n inputElementType: 'textarea',\n } as any,\n inputRef as any,\n );\n\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n const useEnvironmentalEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n // ---- caret restore after commit --------------------------------------\n const pendingCaretRef = useRef<number | null>(null);\n useEnvironmentalEffect(() => {\n const el = inputRef.current;\n if (!el) return;\n\n if (pendingCaretRef.current != null) {\n // Restore caret after we programmatically inserted a command.\n const pos = pendingCaretRef.current;\n pendingCaretRef.current = null;\n el.focus();\n el.setSelectionRange(pos, pos);\n setCaret(pos);\n return;\n }\n\n // The value changed without our own commit (controlled update from\n // outside, form reset, or defaultValue seeding). Resync the caret from\n // the DOM selection so trigger parsing works off a valid index instead of\n // a stale one. We intentionally do not steal focus here.\n const domCaret = el.selectionStart ?? el.value.length;\n setCaret((prev) => (prev === domCaret ? prev : domCaret));\n }, [effectiveValue]);\n\n // ---- helpers ----------------------------------------------------------\n const getItemTextValue = useCallback(\n (key: Key): string => {\n const item = localCollectionState?.collection?.getItem(key);\n return item?.textValue || String(key);\n },\n [localCollectionState?.collection],\n );\n\n // ---- commit (insert the chosen option's literal value) ---------------\n const commit = useEvent((key: Key) => {\n const listState = listStateRef.current;\n // Guard against committing a stale key that has been filtered out of the\n // visible list (e.g. the token was narrowed after focus landed on it).\n // Fall back to the first still-visible option so the inserted command\n // always matches what the user can see.\n if (visibleFilteredKeys.length > 0 && !visibleFilteredKeys.includes(key)) {\n key = visibleFilteredKeys[0];\n }\n const textValue = getItemTextValue(key);\n const token = activeToken;\n const el = inputRef.current;\n\n if (token) {\n const next =\n effectiveValue.slice(0, token.start) +\n textValue +\n (insertSpaceAfter ? ' ' : '') +\n effectiveValue.slice(token.end);\n const caretPos =\n token.start + textValue.length + (insertSpaceAfter ? 1 : 0);\n pendingCaretRef.current = caretPos;\n handleChange(next);\n // If controlled, caret is restored by the effect above; if not, set now.\n if (el) {\n el.focus();\n try {\n el.setSelectionRange(caretPos, caretPos);\n } catch {\n /* noop */\n }\n }\n } else if (el) {\n // Fallback: insert at caret.\n const start = el.selectionStart ?? effectiveValue.length;\n const end = el.selectionEnd ?? effectiveValue.length;\n const next =\n effectiveValue.slice(0, start) +\n textValue +\n (insertSpaceAfter ? ' ' : '') +\n effectiveValue.slice(end);\n const caretPos = start + textValue.length + (insertSpaceAfter ? 1 : 0);\n pendingCaretRef.current = caretPos;\n handleChange(next);\n }\n\n setDismissedToken(null);\n onCommand?.(key, {\n textValue,\n ...((\n listState?.collection as Collection<Node<unknown>> | undefined\n )?.getItem(key)?.props ?? {}),\n });\n });\n\n // ---- keyboard navigation (only while the popover is open) -------------\n const onKeyDownHandler = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n\n if (!shouldShowPopover) {\n // While not in command mode, the textarea behaves normally; but clear\n // any dismissal when the user edits.\n return;\n }\n\n const listState = listStateRef.current;\n\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n if (!listState) return;\n e.preventDefault();\n const nextKey = getNextVisibleKey(\n listState,\n e.key === 'ArrowDown' ? 1 : -1,\n );\n if (nextKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(nextKey);\n bumpFocus();\n }\n } else if (e.key === 'Home' || e.key === 'End') {\n if (!listState) return;\n e.preventDefault();\n const edgeKey = getEdgeVisibleKey(\n listState,\n e.key === 'Home' ? 'first' : 'last',\n );\n if (edgeKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(edgeKey);\n bumpFocus();\n }\n } else if (e.key === 'Enter' || e.key === 'Tab') {\n if (!listState) return;\n const focused = listState.selectionManager.focusedKey;\n if (focused != null) {\n e.preventDefault();\n commit(focused);\n }\n // Otherwise pass through (newline / form submit / tab navigation).\n } else if (e.key === 'Escape') {\n e.preventDefault();\n if (activeToken) {\n setDismissedToken(activeToken.token);\n }\n }\n },\n [shouldShowPopover, activeToken, commit, onKeyDown, listStateRef],\n );\n\n // ---- initial focus on the first option when the popover opens ---------\n const focusInitAttemptsRef = useRef(0);\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n focusInitAttemptsRef.current = 0;\n\n const tick = () => {\n if (!shouldShowPopover) return;\n const listState = listStateRef.current;\n if (!listState) {\n focusInitAttemptsRef.current += 1;\n if (focusInitAttemptsRef.current < 8) {\n requestAnimationFrame(tick);\n }\n return;\n }\n if (listState.selectionManager.focusedKey == null) {\n const first = getEdgeVisibleKey(listState, 'first');\n if (first != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(first);\n bumpFocus();\n }\n }\n };\n\n requestAnimationFrame(() => requestAnimationFrame(tick));\n }, [shouldShowPopover]);\n\n // ---- keep virtual focus valid as the filtered list narrows -----------\n // When the user narrows the token, the previously focused option may drop\n // out of the filtered list. Move focus to the first still-visible option so\n // the highlight and any Enter/Tab commit stay in sync with what's shown.\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n const listState = listStateRef.current;\n if (!listState) return;\n\n if (visibleFilteredKeys.length === 0) return;\n\n const focused = listState.selectionManager.focusedKey;\n if (focused == null || !visibleFilteredKeys.includes(focused)) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(visibleFilteredKeys[0]);\n bumpFocus();\n }\n }, [visibleFilteredKeys, shouldShowPopover]);\n\n // ---- composite focus (wrapper + portaled popover) ---------------------\n const { compositeFocusProps } = useCompositeFocus({\n wrapperRef: wrapperRef as RefObject<HTMLElement>,\n popoverRef: popoverRef as RefObject<HTMLElement>,\n onFocus,\n onBlur,\n isDisabled,\n });\n\n // ---- aria-activedescendant -------------------------------------------\n const focusedKey = listStateRef.current?.selectionManager.focusedKey ?? null;\n const listBoxId = `CommandTextAreaListBox-${commandTextAreaId}`;\n\n // ---- popover width ----------------------------------------------------\n // The popover is anchored to the caret (a point), so it must not be sized to\n // the textarea. We use the same default as the shared `ListBoxPopover` /\n // `Picker` popovers: a `30x` floor (240px), `max-content` preferred, `50vw`\n // cap. The concrete floor keeps the virtualized ListBox from collapsing to a\n // sliver (it has no intrinsic width), and `max-content` lets short option\n // lists size to their content. The user's `overlayStyles` still win on top.\n const popoverOverlayStyles: Styles = {\n width: '30x max-content 50vw',\n ...overlayStyles,\n };\n\n // ---- assemble input props ---------------------------------------------\n const commandInputProps = mergeProps(\n inputProps,\n {\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': shouldShowPopover,\n 'aria-haspopup': 'listbox',\n 'aria-controls': shouldShowPopover ? listBoxId : undefined,\n 'aria-activedescendant':\n shouldShowPopover && focusedKey != null\n ? `ListBoxItem-${focusedKey}`\n : undefined,\n onKeyDown: onKeyDownHandler,\n onSelect: syncCaret,\n onKeyUp: syncCaret,\n onClick: syncCaret,\n 'data-input-type': 'command-textarea',\n },\n userInputProps,\n );\n\n // ---- render -----------------------------------------------------------\n const field = (\n <TextInputBase\n ref={ref as any}\n {...otherProps}\n multiLine\n qa={qa}\n inputRef={inputRef}\n wrapperRef={wrapperRef}\n wrapperProps={compositeFocusProps}\n labelProps={mergedLabelProps}\n inputProps={commandInputProps}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n rows={rows}\n />\n );\n\n return (\n <>\n {field}\n <ListBoxPopover\n isOpen={shouldShowPopover}\n triggerRef={wrapperRef as RefObject<HTMLElement>}\n positionTargetRef={caretAnchorRef as RefObject<Element | null>}\n positionApiRef={positionApiRef}\n popoverRef={popoverRef}\n listBoxRef={listBoxRef}\n direction={direction}\n shouldFlip={shouldFlip}\n overlayOffset={overlayOffset}\n containerPadding={containerPadding}\n listBoxId={listBoxId}\n overlayStyles={popoverOverlayStyles}\n listBoxStyles={listBoxStyles}\n optionStyles={optionStyles}\n optionHighlight={term}\n sectionStyles={sectionStyles}\n headingStyles={headingStyles}\n isDisabled={isDisabled}\n disabledKeys={disabledKeys}\n items={items as any}\n listStateRef={listStateRef}\n ariaLabel={\n (props as any)['aria-label'] ||\n (typeof otherProps.label === 'string' ? otherProps.label : 'Commands')\n }\n compositeFocusProps={compositeFocusProps}\n filter={filterFn}\n onClose={() => {\n if (activeToken) setDismissedToken(activeToken.token);\n }}\n onSelectionChange={(selection) => {\n const key = Array.isArray(selection) ? selection[0] : selection;\n if (key != null) commit(key);\n }}\n >\n {children as any}\n </ListBoxPopover>\n </>\n );\n}\n\nconst _CommandTextArea = forwardRef(CommandTextArea) as unknown as (<T>(\n props: CubeCommandTextAreaProps<T> & {\n ref?: ForwardedRef<HTMLElement>;\n },\n) => ReactElement) & {\n Item: typeof Item;\n Section: typeof BaseSection;\n};\n\nObject.assign(_CommandTextArea, {\n Item,\n Section: BaseSection,\n displayName: 'CommandTextArea',\n});\n\nObject.defineProperty(_CommandTextArea, 'cubeInputType', {\n value: 'CommandTextArea',\n enumerable: false,\n configurable: false,\n});\n\nexport { _CommandTextArea as CommandTextArea };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyIA,MAAM,mBAAqC,CAAC;CAAE,MAAM;CAAK,aAAa;CAAM,CAAC;;;;;;;AAY7E,SAAgB,iBACd,OACA,OACA,UACoB;AACpB,KAAI,CAAC,SAAS,OAAQ,QAAO;CAC7B,MAAM,SAAS,MAAM,MAAM,GAAG,MAAM;AACtB,OAAM,MAAM,MAAM;AAEhC,MAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,KAAK,QAAQ;AACnB,MAAI,QAAQ,aAAa;GAKvB,MAAM,YAAY,OAAO,YAAY,KAAK,GAAG;GAC7C,MAAM,aAAa,OAAO,MAAM,UAAU;AAC1C,OAAI,WAAW,OAAO,GAAI;AAG1B,OADgB,WAAW,MAAM,EAAE,CAAC,OAAO,KAAK,KAChC,GAAI;AACpB,OAAI,CAAC,WAAY;AACjB,UAAO;IAAE;IAAS,OAAO;IAAY,OAAO;IAAW,KAAK;IAAO;;EAMrE,MAAM,QAAQ,mBAAmB,KAAK,OAAO;AAC7C,MAAI,CAAC,MAAO;EACZ,MAAM,YAAY,MAAM;AACxB,MAAI,UAAU,OAAO,GAAI;AAQzB,SAAO;GAAE;GAAS,OAAO;GAAW,OALtB,QAAQ,UAAU;GAKW,KAAK;GAAO;;AAGzD,QAAO;;AAOT,SAA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F,OAAO,eAAe,kBAAkB,iBAAiB;CACvD,OAAO;CACP,YAAY;CACZ,cAAc;CACf,CAAC"}
|
|
1
|
+
{"version":3,"file":"CommandTextArea.js","names":["Collection","Key","Node","Styles","React","ForwardedRef","forwardRef","ReactElement","ReactNode","RefObject","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","useFilter","useTextField","Section","BaseSection","useListState","useEvent","generateRandomId","chain","mergeProps","useCombinedRefs","castNullableStringValue","WithNullableValue","CollectionItem","Item","useFieldProps","collectVisibleKeys","filterCollectionNodes","getEdgeVisibleKey","getNextVisibleKey","ListBoxPopover","ListStateLike","markKeyboardFocus","TextFilterFn","useCompositeFocus","CubeTextInputBaseProps","TextInputBase","useAutoSizeTextArea","useCaretAnchor","CommandTrigger","char","atLineStart","ActiveToken","trigger","token","start","end","CommandTextAreaFilterFn","CubeCommandTextAreaProps","Omit","autoSize","maxRows","rows","items","Iterable","T","children","item","triggers","filter","onCommand","key","textValue","k","onOpenChange","isOpen","onActiveTokenChange","insertSpaceAfter","disabledKeys","direction","shouldFlip","overlayOffset","containerPadding","inputRef","HTMLTextAreaElement","wrapperRef","HTMLDivElement","popoverRef","listBoxRef","listStateRef","overlayStyles","listBoxStyles","optionStyles","sectionStyles","headingStyles","DEFAULT_TRIGGERS","parseActiveToken","value","caret","length","before","slice","after","ch","lineStart","lastIndexOf","linePrefix","wsIndex","search","match","exec","candidate","CommandTextArea","props","ref","HTMLElement","defaultValidationTrigger","valuePropsMapper","onChange","toString","qa","isDisabled","isReadOnly","isRequired","labelProps","userLabelProps","inputProps","userInputProps","propsInputRef","defaultValue","placeholder","renderChildren","propsWrapperRef","propsPopoverRef","propsListBoxRef","propsListStateRef","onKeyDown","onFocus","onBlur","otherProps","Math","max","localInputRef","localListStateRef","commandTextAreaId","isControlled","undefined","internalValue","setInternalValue","effectiveValue","handleChange","next","renderFn","itemsArray","Array","from","map","idx","rendered","it","isValidElement","cloneElement","setCaret","syncCaret","el","current","selectionStart","activeToken","min","term","startsWith","contains","sensitivity","textFilterFn","localCollectionState","selectionMode","filterFn","nodes","matchExtraFields","visibleFilteredKeys","keys","disabled","Set","collection","filteredCount","dismissedToken","setDismissedToken","setFocusTick","bumpFocus","t","prev","isCommandMode","shouldShowPopover","notifiedOpenRef","activeTokenSignature","notifiedTokenRef","anchorRef","caretAnchorRef","positionApiRef","isActive","adjustHeight","inputElementType","mergedLabelProps","useEnvironmentalEffect","window","pendingCaretRef","pos","focus","setSelectionRange","domCaret","getItemTextValue","getItem","String","commit","listState","includes","caretPos","selectionEnd","onKeyDownHandler","e","KeyboardEvent","defaultPrevented","preventDefault","nextKey","selectionManager","setFocusedKey","edgeKey","focused","focusedKey","focusInitAttemptsRef","tick","requestAnimationFrame","first","compositeFocusProps","listBoxId","popoverOverlayStyles","width","commandInputProps","role","onSelect","onKeyUp","onClick","field","Element","label","selection","isArray","_CommandTextArea","Object","assign","displayName","defineProperty","enumerable","configurable"],"sources":["../../../../src/components/fields/CommandTextArea/CommandTextArea.tsx"],"sourcesContent":["import { Collection, Key, Node } from '@react-types/shared';\nimport { Styles } from '@tenphi/tasty';\nimport React, {\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFilter, useTextField } from 'react-aria';\nimport { Section as BaseSection, useListState } from 'react-stately';\n\nimport { useEvent } from '../../../_internal';\nimport { generateRandomId } from '../../../utils/random';\nimport { chain, mergeProps, useCombinedRefs } from '../../../utils/react';\nimport {\n castNullableStringValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { CollectionItem as Item } from '../../CollectionItem';\nimport { useFieldProps } from '../../form';\nimport {\n collectVisibleKeys,\n filterCollectionNodes,\n getEdgeVisibleKey,\n getNextVisibleKey,\n ListBoxPopover,\n ListStateLike,\n markKeyboardFocus,\n TextFilterFn,\n useCompositeFocus,\n} from '../ListBoxPopover';\nimport {\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\nimport { useAutoSizeTextArea } from '../TextInput/useAutoSizeTextArea';\n\nimport { useCaretAnchor } from './useCaretAnchor';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** A single trigger character with optional placement constraint. */\nexport interface CommandTrigger {\n /** The character that opens the autocomplete (e.g. `/` or `@`). */\n char: string;\n /**\n * When true, the trigger token must start at the beginning of the line the\n * caret is on (right after a newline, or at the very start of the input) —\n * i.e. line-scoped slash commands. When false, the token may appear after\n * any whitespace, anywhere in the text (Slack/Notion-style).\n */\n atLineStart?: boolean;\n}\n\n/** Result of scanning the textarea for an active trigger token. */\nexport interface ActiveToken {\n /** The matched trigger descriptor. */\n trigger: CommandTrigger;\n /** The active token text, INCLUDING the trigger char (e.g. `/cle`). */\n token: string;\n /** Inclusive start index of the token in the textarea value. */\n start: number;\n /** Exclusive end index of the token (caret position while typing). */\n end: number;\n}\n\nexport type CommandTextAreaFilterFn = TextFilterFn;\n\nexport interface CubeCommandTextAreaProps<T>\n extends Omit<CubeTextInputBaseProps, 'children' | 'multiLine'> {\n /** Whether the textarea should resize to fit its content. */\n autoSize?: boolean;\n /** Max visible rows when `autoSize` is true. Defaults to 10. */\n maxRows?: number;\n /** Number of visible rows. Defaults to 3. */\n rows?: number;\n\n /** Command/option source (alternative to JSX children). */\n items?: Iterable<T>;\n /** Static items or a render function (same shape as ComboBox/ListBox). */\n children?: ReactNode | ((item: T) => ReactElement);\n /**\n * Triggers that open the autocomplete. Defaults to a single slash command\n * that must start at the beginning of the input.\n */\n triggers?: CommandTrigger[];\n /**\n * Custom filter. Pass `false` to disable internal filtering (server-side).\n */\n filter?: CommandTextAreaFilterFn | false;\n /**\n * Fired when the user picks a command (Enter/Tab/click). The option's\n * `textValue` is also inserted into the textarea regardless.\n *\n * `start` / `end` locate that insertion in the value handed to `onChange`, so\n * a consumer can anchor its own record to the picked item rather than\n * re-deriving the offset by searching the new value for the inserted text —\n * a search that cannot tell two occurrences apart when one option's text is a\n * prefix of another's.\n */\n onCommand?: (\n key: Key,\n item: {\n textValue: string;\n /** Index in the new value where the inserted text starts. */\n start: number;\n /** Index where it ends, excluding any inserted trailing space. */\n end: number;\n [k: string]: any;\n },\n ) => void;\n /**\n * Fired when the command popover opens or closes. Lets a consumer with its own\n * `Enter` behaviour tell \"pick the focused option\" from \"submit\" without\n * reading `aria-expanded` off the DOM.\n */\n onOpenChange?: (isOpen: boolean) => void;\n /**\n * Fired when the active trigger token changes, with the component's own\n * caret-aware scan result — `null` once the caret leaves a token. Saves a\n * consumer running a second, approximate scan of the same value.\n */\n onActiveTokenChange?: (token: ActiveToken | null) => void;\n /** Insert a trailing space after the chosen command. Defaults to true. */\n insertSpaceAfter?: boolean;\n /** Keys of disabled options. */\n disabledKeys?: Iterable<Key>;\n /** Popover placement. Chat inputs usually want `top`. Defaults to `top`. */\n direction?: 'bottom' | 'top';\n /** Whether the popover should flip when overflowing. Defaults to true. */\n shouldFlip?: boolean;\n /** Offset between the textarea and the popover. */\n overlayOffset?: number;\n /** Padding between the popover and the viewport edge. */\n containerPadding?: number;\n\n // Refs\n /** Ref for the textarea element. */\n inputRef?: RefObject<HTMLTextAreaElement>;\n /** Ref for the wrapper element (popover anchor). */\n wrapperRef?: RefObject<HTMLDivElement>;\n /** Ref for the popover overlay element. */\n popoverRef?: RefObject<HTMLDivElement>;\n /** Ref for the listbox element. */\n listBoxRef?: RefObject<HTMLDivElement>;\n /** Ref through which the internal list state is exposed. */\n listStateRef?: RefObject<ListStateLike | null>;\n\n // Style props\n overlayStyles?: any;\n listBoxStyles?: any;\n optionStyles?: any;\n sectionStyles?: any;\n headingStyles?: any;\n}\n\nconst DEFAULT_TRIGGERS: CommandTrigger[] = [{ char: '/', atLineStart: true }];\n\n// ---------------------------------------------------------------------------\n// Trigger parsing\n// ---------------------------------------------------------------------------\n\n/**\n * Inspect the textarea contents up to the caret and find the active trigger\n * token, if any. The token includes the trigger character and ends at the\n * caret (so it grows as the user types). A token ends at whitespace or the end\n * of the input.\n */\nexport function parseActiveToken(\n value: string,\n caret: number,\n triggers: CommandTrigger[],\n): ActiveToken | null {\n if (!triggers.length) return null;\n const before = value.slice(0, caret);\n const after = value.slice(caret);\n\n for (const trigger of triggers) {\n const ch = trigger.char;\n if (trigger.atLineStart) {\n // Line-start command: the trigger char must sit at the start of the line\n // the caret is on (right after a newline, or at index 0), with no\n // whitespace between it and the caret. On a single-line input with no\n // newlines this is equivalent to \"index 0 of the whole input\".\n const lineStart = before.lastIndexOf('\\n') + 1;\n const linePrefix = before.slice(lineStart);\n if (linePrefix[0] !== ch) continue;\n // No whitespace allowed within the token (after the trigger char).\n const wsIndex = linePrefix.slice(1).search(/\\s/);\n if (wsIndex !== -1) continue;\n if (!linePrefix) continue;\n return { trigger, token: linePrefix, start: lineStart, end: caret };\n }\n\n // Caret-token mode: find the last trigger char that begins a token at or\n // after a line start / whitespace boundary, with no whitespace between it\n // and the caret.\n const match = /(?:^|\\s)([\\S]+)$/.exec(before);\n if (!match) continue;\n const candidate = match[1];\n if (candidate[0] !== ch) continue;\n // Ensure the token hasn't already been closed by whitespace after caret.\n // (If there's non-whitespace after the caret, the user is mid-token.)\n const start = caret - candidate.length;\n // If immediately after the caret there's whitespace (or end), the token is\n // \"complete\" — still offer completions as long as the caret sits on the\n // token. We accept it.\n void after;\n return { trigger, token: candidate, start, end: caret };\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nfunction CommandTextArea<T extends object>(\n props: WithNullableValue<CubeCommandTextAreaProps<T>>,\n ref: ForwardedRef<HTMLElement>,\n) {\n props = castNullableStringValue(props);\n props = useFieldProps(props, {\n defaultValidationTrigger: 'onBlur',\n valuePropsMapper: ({ value, onChange }) => ({\n onChange,\n value: value?.toString() ?? '',\n }),\n });\n\n let {\n qa,\n autoSize = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n maxRows = 10,\n rows = 3,\n labelProps: userLabelProps,\n inputProps: userInputProps,\n inputRef: propsInputRef,\n value,\n defaultValue,\n placeholder,\n // command props\n items,\n children: renderChildren,\n triggers = DEFAULT_TRIGGERS,\n filter,\n onCommand,\n onOpenChange,\n onActiveTokenChange,\n insertSpaceAfter = true,\n disabledKeys,\n direction = 'top',\n shouldFlip = true,\n overlayOffset = 8,\n containerPadding = 8,\n overlayStyles,\n listBoxStyles,\n optionStyles,\n sectionStyles,\n headingStyles,\n wrapperRef: propsWrapperRef,\n popoverRef: propsPopoverRef,\n listBoxRef: propsListBoxRef,\n listStateRef: propsListStateRef,\n onKeyDown,\n onFocus,\n onBlur,\n ...otherProps\n } = props;\n\n rows = Math.max(rows, 1);\n maxRows = Math.max(maxRows, rows);\n\n // ---- refs -------------------------------------------------------------\n const localInputRef = useRef<HTMLTextAreaElement>(null);\n const inputRef = (propsInputRef ??\n localInputRef) as RefObject<HTMLTextAreaElement>;\n const wrapperRef = useCombinedRefs<HTMLDivElement>(propsWrapperRef);\n const popoverRef = useCombinedRefs<HTMLDivElement>(propsPopoverRef);\n const listBoxRef = useCombinedRefs<HTMLDivElement>(propsListBoxRef);\n const localListStateRef = useRef<ListStateLike | null>(null);\n const listStateRef = (propsListStateRef ??\n localListStateRef) as RefObject<ListStateLike | null>;\n\n const commandTextAreaId = useMemo(() => generateRandomId(), []);\n\n // ---- controlled / uncontrolled value ----------------------------------\n // When no `value` is provided (standalone, no form), track the text\n // internally so trigger detection and commit still work.\n const isControlled = value !== undefined;\n const [internalValue, setInternalValue] = useState<string>(\n (value as string) ?? (defaultValue as string) ?? '',\n );\n const effectiveValue: string = isControlled\n ? (value as string)\n : internalValue;\n const handleChange = useEvent((next: string) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n });\n\n // ---- children / items normalization -----------------------------------\n let children: ReactNode = renderChildren as ReactNode;\n const renderFn = renderChildren as unknown;\n if (items && typeof renderFn === 'function') {\n const itemsArray = Array.from(items as Iterable<any>);\n children = itemsArray.map((item, idx) => {\n const rendered = (renderFn as (it: any) => ReactNode)(item);\n if (\n React.isValidElement(rendered) &&\n (rendered as ReactElement).key == null\n ) {\n return React.cloneElement(rendered as ReactElement, {\n key: (rendered as any)?.key ?? item?.key ?? idx,\n });\n }\n return rendered as ReactNode;\n });\n }\n\n // ---- caret tracking ---------------------------------------------------\n // The caret drives trigger detection. We keep it in state so a caret move\n // (arrow keys without typing) re-renders and recomputes the active token.\n const [caret, setCaret] = useState(() => effectiveValue.length);\n const syncCaret = useEvent(() => {\n const el = inputRef.current;\n if (!el) return;\n setCaret(el.selectionStart ?? el.value.length);\n });\n\n // ---- trigger detection ------------------------------------------------\n const activeToken = useMemo(\n () =>\n parseActiveToken(\n effectiveValue,\n Math.min(caret, effectiveValue.length),\n triggers,\n ),\n [effectiveValue, caret, triggers],\n );\n\n // The active token includes the trigger char (e.g. `/co`). Strip it before\n // filtering so the query is matched against the meaningful text — this lets\n // options match by their label/description (which don't contain the trigger\n // char) as well as by their `textValue`.\n const term = useMemo(() => {\n if (!activeToken) return '';\n const { token, trigger } = activeToken;\n return token.startsWith(trigger.char)\n ? token.slice(trigger.char.length)\n : token;\n }, [activeToken]);\n\n // ---- filtering --------------------------------------------------------\n const { contains } = useFilter({ sensitivity: 'base' });\n const textFilterFn = useMemo<CommandTextAreaFilterFn>(\n () => (filter === false ? () => true : filter || contains),\n [filter, contains],\n );\n\n // Local collection used to read option textValues and to count matches.\n const localCollectionState = useListState({\n children: children as any,\n items: items as any,\n selectionMode: 'none',\n });\n\n const filterFn = useCallback(\n (nodes: Iterable<any>) =>\n filterCollectionNodes(nodes, term, textFilterFn, {\n matchExtraFields: true,\n }),\n [term, textFilterFn],\n );\n\n // Keys of the currently visible (filtered) options, in display order.\n // Derived from our own local collection + filter (rather than the ListBox's\n // exposed state ref) so it is always in sync with the current token — the\n // ListBox's `stateRef.collection` can momentarily lag by a render right after\n // the token narrows, which would otherwise leave virtual focus on (and commit)\n // an option that is no longer visible.\n const visibleFilteredKeys = useMemo<Key[]>(() => {\n if (!activeToken) return [];\n const keys: Key[] = [];\n const disabled = disabledKeys ? new Set<Key>(disabledKeys) : undefined;\n collectVisibleKeys(\n filterFn(localCollectionState.collection),\n keys,\n disabled,\n );\n return keys;\n }, [activeToken, filterFn, localCollectionState.collection, disabledKeys]);\n\n const filteredCount = visibleFilteredKeys.length;\n\n // ---- dismiss handling (Escape keeps the text but hides the popover) ---\n const [dismissedToken, setDismissedToken] = useState<string | null>(null);\n // Bumped whenever we move the virtual focus so the textarea's\n // `aria-activedescendant` (read from the ListBox's stateRef at render time)\n // stays in sync — the ListBox's own state update does not re-render us.\n const [, setFocusTick] = useState(0);\n const bumpFocus = useEvent(() => setFocusTick((t) => t + 1));\n // Reset dismissal whenever the active token changes (user typed/backspaced).\n useEffect(() => {\n setDismissedToken((prev) =>\n prev != null && activeToken?.token !== prev ? null : prev,\n );\n }, [activeToken?.token]);\n\n const isCommandMode = !!activeToken && activeToken.token !== dismissedToken;\n const shouldShowPopover = isCommandMode && filteredCount > 0;\n\n // ---- reporting open state / active token to the consumer --------------\n // Both are already computed here; without these a consumer with its own\n // `Enter` handling has to read `aria-expanded` off the DOM and run a second,\n // approximate copy of the scan above — neither of which is a contract.\n // Seeded with the closed / no-token defaults so mounting in that state is not\n // reported as a change, while mounting with a `value` that already holds a\n // token is.\n const notifiedOpenRef = useRef(false);\n\n useEffect(() => {\n if (notifiedOpenRef.current === shouldShowPopover) return;\n\n notifiedOpenRef.current = shouldShowPopover;\n onOpenChange?.(shouldShowPopover);\n }, [shouldShowPopover, onOpenChange]);\n\n // `activeToken` is a fresh object on every value/caret change, so compare the\n // content rather than the identity — otherwise a consumer is re-notified for\n // a token that has not actually moved.\n const activeTokenSignature = activeToken\n ? `${activeToken.trigger.char}\\u0000${activeToken.token}\\u0000${activeToken.start}\\u0000${activeToken.end}`\n : null;\n const notifiedTokenRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (notifiedTokenRef.current === activeTokenSignature) return;\n\n notifiedTokenRef.current = activeTokenSignature;\n onActiveTokenChange?.(activeToken ?? null);\n // `activeToken` is intentionally not a dependency: the signature above is\n // its value-identity, and depending on the object would re-run this on every\n // keystroke that leaves the token unchanged.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeTokenSignature, onActiveTokenChange]);\n\n // ---- caret-anchored popover ------------------------------------------\n // A zero-size element positioned at the caret (both axes) drives the\n // popover's geometry; the wrapper remains the dismiss/outside-click trigger.\n const { anchorRef: caretAnchorRef, positionApiRef } = useCaretAnchor({\n inputRef: inputRef as RefObject<HTMLTextAreaElement>,\n wrapperRef: wrapperRef as RefObject<HTMLElement>,\n caret,\n value: effectiveValue,\n isActive: shouldShowPopover,\n });\n\n // ---- height autosize (shared with TextArea) ---------------------------\n const adjustHeight = useAutoSizeTextArea({\n inputRef,\n autoSize,\n rows,\n maxRows,\n value: effectiveValue,\n });\n\n // ---- useTextField (ARIA wiring for the textarea) ----------------------\n let { labelProps, inputProps } = useTextField(\n {\n ...otherProps,\n value: effectiveValue,\n placeholder,\n isDisabled,\n isReadOnly,\n isRequired,\n onChange: chain(handleChange, adjustHeight),\n inputElementType: 'textarea',\n } as any,\n inputRef as any,\n );\n\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n const useEnvironmentalEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\n // ---- caret restore after commit --------------------------------------\n const pendingCaretRef = useRef<number | null>(null);\n useEnvironmentalEffect(() => {\n const el = inputRef.current;\n if (!el) return;\n\n if (pendingCaretRef.current != null) {\n // Restore caret after we programmatically inserted a command.\n const pos = pendingCaretRef.current;\n pendingCaretRef.current = null;\n el.focus();\n el.setSelectionRange(pos, pos);\n setCaret(pos);\n return;\n }\n\n // The value changed without our own commit (controlled update from\n // outside, form reset, or defaultValue seeding). Resync the caret from\n // the DOM selection so trigger parsing works off a valid index instead of\n // a stale one. We intentionally do not steal focus here.\n const domCaret = el.selectionStart ?? el.value.length;\n setCaret((prev) => (prev === domCaret ? prev : domCaret));\n }, [effectiveValue]);\n\n // ---- helpers ----------------------------------------------------------\n const getItemTextValue = useCallback(\n (key: Key): string => {\n const item = localCollectionState?.collection?.getItem(key);\n return item?.textValue || String(key);\n },\n [localCollectionState?.collection],\n );\n\n // ---- commit (insert the chosen option's literal value) ---------------\n const commit = useEvent((key: Key) => {\n const listState = listStateRef.current;\n // Guard against committing a stale key that has been filtered out of the\n // visible list (e.g. the token was narrowed after focus landed on it).\n // Fall back to the first still-visible option so the inserted command\n // always matches what the user can see.\n if (visibleFilteredKeys.length > 0 && !visibleFilteredKeys.includes(key)) {\n key = visibleFilteredKeys[0];\n }\n const textValue = getItemTextValue(key);\n const token = activeToken;\n const el = inputRef.current;\n\n // Where the inserted text lands in the new value. Both branches below\n // already compute this to place the caret; it is reported through\n // `onCommand` instead of being thrown away. `end` excludes the trailing\n // space, which is padding around the insertion rather than part of it.\n let start = Math.min(caret, effectiveValue.length);\n\n if (token) {\n const next =\n effectiveValue.slice(0, token.start) +\n textValue +\n (insertSpaceAfter ? ' ' : '') +\n effectiveValue.slice(token.end);\n const caretPos =\n token.start + textValue.length + (insertSpaceAfter ? 1 : 0);\n start = token.start;\n pendingCaretRef.current = caretPos;\n handleChange(next);\n // If controlled, caret is restored by the effect above; if not, set now.\n if (el) {\n el.focus();\n try {\n el.setSelectionRange(caretPos, caretPos);\n } catch {\n /* noop */\n }\n }\n } else if (el) {\n // Fallback: insert at caret.\n const selectionStart = el.selectionStart ?? effectiveValue.length;\n const selectionEnd = el.selectionEnd ?? effectiveValue.length;\n const next =\n effectiveValue.slice(0, selectionStart) +\n textValue +\n (insertSpaceAfter ? ' ' : '') +\n effectiveValue.slice(selectionEnd);\n const caretPos =\n selectionStart + textValue.length + (insertSpaceAfter ? 1 : 0);\n start = selectionStart;\n pendingCaretRef.current = caretPos;\n handleChange(next);\n }\n\n setDismissedToken(null);\n onCommand?.(key, {\n textValue,\n ...((\n listState?.collection as Collection<Node<unknown>> | undefined\n )?.getItem(key)?.props ?? {}),\n // After the item's own props: the range is the component's measurement of\n // what it just did, so an item that happens to carry a `start`/`end` prop\n // must not shadow it.\n start,\n end: start + textValue.length,\n });\n });\n\n // ---- keyboard navigation (only while the popover is open) -------------\n const onKeyDownHandler = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(e);\n if (e.defaultPrevented) return;\n\n if (!shouldShowPopover) {\n // While not in command mode, the textarea behaves normally; but clear\n // any dismissal when the user edits.\n return;\n }\n\n const listState = listStateRef.current;\n\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n if (!listState) return;\n e.preventDefault();\n const nextKey = getNextVisibleKey(\n listState,\n e.key === 'ArrowDown' ? 1 : -1,\n );\n if (nextKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(nextKey);\n bumpFocus();\n }\n } else if (e.key === 'Home' || e.key === 'End') {\n if (!listState) return;\n e.preventDefault();\n const edgeKey = getEdgeVisibleKey(\n listState,\n e.key === 'Home' ? 'first' : 'last',\n );\n if (edgeKey != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(edgeKey);\n bumpFocus();\n }\n } else if (e.key === 'Enter' || e.key === 'Tab') {\n if (!listState) return;\n const focused = listState.selectionManager.focusedKey;\n if (focused != null) {\n e.preventDefault();\n commit(focused);\n }\n // Otherwise pass through (newline / form submit / tab navigation).\n } else if (e.key === 'Escape') {\n e.preventDefault();\n if (activeToken) {\n setDismissedToken(activeToken.token);\n }\n }\n },\n [shouldShowPopover, activeToken, commit, onKeyDown, listStateRef],\n );\n\n // ---- initial focus on the first option when the popover opens ---------\n const focusInitAttemptsRef = useRef(0);\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n focusInitAttemptsRef.current = 0;\n\n const tick = () => {\n if (!shouldShowPopover) return;\n const listState = listStateRef.current;\n if (!listState) {\n focusInitAttemptsRef.current += 1;\n if (focusInitAttemptsRef.current < 8) {\n requestAnimationFrame(tick);\n }\n return;\n }\n if (listState.selectionManager.focusedKey == null) {\n const first = getEdgeVisibleKey(listState, 'first');\n if (first != null) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(first);\n bumpFocus();\n }\n }\n };\n\n requestAnimationFrame(() => requestAnimationFrame(tick));\n }, [shouldShowPopover]);\n\n // ---- keep virtual focus valid as the filtered list narrows -----------\n // When the user narrows the token, the previously focused option may drop\n // out of the filtered list. Move focus to the first still-visible option so\n // the highlight and any Enter/Tab commit stay in sync with what's shown.\n useLayoutEffect(() => {\n if (!shouldShowPopover) return;\n const listState = listStateRef.current;\n if (!listState) return;\n\n if (visibleFilteredKeys.length === 0) return;\n\n const focused = listState.selectionManager.focusedKey;\n if (focused == null || !visibleFilteredKeys.includes(focused)) {\n markKeyboardFocus(listState);\n listState.selectionManager.setFocusedKey(visibleFilteredKeys[0]);\n bumpFocus();\n }\n }, [visibleFilteredKeys, shouldShowPopover]);\n\n // ---- composite focus (wrapper + portaled popover) ---------------------\n const { compositeFocusProps } = useCompositeFocus({\n wrapperRef: wrapperRef as RefObject<HTMLElement>,\n popoverRef: popoverRef as RefObject<HTMLElement>,\n onFocus,\n onBlur,\n isDisabled,\n });\n\n // ---- aria-activedescendant -------------------------------------------\n const focusedKey = listStateRef.current?.selectionManager.focusedKey ?? null;\n const listBoxId = `CommandTextAreaListBox-${commandTextAreaId}`;\n\n // ---- popover width ----------------------------------------------------\n // The popover is anchored to the caret (a point), so it must not be sized to\n // the textarea. We use the same default as the shared `ListBoxPopover` /\n // `Picker` popovers: a `30x` floor (240px), `max-content` preferred, `50vw`\n // cap. The concrete floor keeps the virtualized ListBox from collapsing to a\n // sliver (it has no intrinsic width), and `max-content` lets short option\n // lists size to their content. The user's `overlayStyles` still win on top.\n const popoverOverlayStyles: Styles = {\n width: '30x max-content 50vw',\n ...overlayStyles,\n };\n\n // ---- assemble input props ---------------------------------------------\n const commandInputProps = mergeProps(\n inputProps,\n {\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': shouldShowPopover,\n 'aria-haspopup': 'listbox',\n 'aria-controls': shouldShowPopover ? listBoxId : undefined,\n 'aria-activedescendant':\n shouldShowPopover && focusedKey != null\n ? `ListBoxItem-${focusedKey}`\n : undefined,\n onKeyDown: onKeyDownHandler,\n onSelect: syncCaret,\n onKeyUp: syncCaret,\n onClick: syncCaret,\n 'data-input-type': 'command-textarea',\n },\n userInputProps,\n );\n\n // ---- render -----------------------------------------------------------\n const field = (\n <TextInputBase\n ref={ref as any}\n {...otherProps}\n multiLine\n qa={qa}\n inputRef={inputRef}\n wrapperRef={wrapperRef}\n wrapperProps={compositeFocusProps}\n labelProps={mergedLabelProps}\n inputProps={commandInputProps}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n rows={rows}\n />\n );\n\n return (\n <>\n {field}\n <ListBoxPopover\n isOpen={shouldShowPopover}\n triggerRef={wrapperRef as RefObject<HTMLElement>}\n positionTargetRef={caretAnchorRef as RefObject<Element | null>}\n positionApiRef={positionApiRef}\n popoverRef={popoverRef}\n listBoxRef={listBoxRef}\n direction={direction}\n shouldFlip={shouldFlip}\n overlayOffset={overlayOffset}\n containerPadding={containerPadding}\n listBoxId={listBoxId}\n overlayStyles={popoverOverlayStyles}\n listBoxStyles={listBoxStyles}\n optionStyles={optionStyles}\n optionHighlight={term}\n sectionStyles={sectionStyles}\n headingStyles={headingStyles}\n isDisabled={isDisabled}\n disabledKeys={disabledKeys}\n items={items as any}\n listStateRef={listStateRef}\n ariaLabel={\n (props as any)['aria-label'] ||\n (typeof otherProps.label === 'string' ? otherProps.label : 'Commands')\n }\n compositeFocusProps={compositeFocusProps}\n filter={filterFn}\n onClose={() => {\n if (activeToken) setDismissedToken(activeToken.token);\n }}\n onSelectionChange={(selection) => {\n const key = Array.isArray(selection) ? selection[0] : selection;\n if (key != null) commit(key);\n }}\n >\n {children as any}\n </ListBoxPopover>\n </>\n );\n}\n\nconst _CommandTextArea = forwardRef(CommandTextArea) as unknown as (<T>(\n props: CubeCommandTextAreaProps<T> & {\n ref?: ForwardedRef<HTMLElement>;\n },\n) => ReactElement) & {\n Item: typeof Item;\n Section: typeof BaseSection;\n};\n\nObject.assign(_CommandTextArea, {\n Item,\n Section: BaseSection,\n displayName: 'CommandTextArea',\n});\n\nObject.defineProperty(_CommandTextArea, 'cubeInputType', {\n value: 'CommandTextArea',\n enumerable: false,\n configurable: false,\n});\n\nexport { _CommandTextArea as CommandTextArea };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqKA,MAAM0F,mBAAqC,CAAC;CAAE7C,MAAM;CAAKC,aAAa;CAAM,CAAC;;;;;;;AAY7E,SAAgB6C,iBACdC,OACAC,OACA9B,UACoB;AACpB,KAAI,CAACA,SAAS+B,OAAQ,QAAO;CAC7B,MAAMC,SAASH,MAAMI,MAAM,GAAGH,MAAM;AACtBD,OAAMI,MAAMH,MAAM;AAEhC,MAAK,MAAM7C,WAAWe,UAAU;EAC9B,MAAMmC,KAAKlD,QAAQH;AACnB,MAAIG,QAAQF,aAAa;GAKvB,MAAMqD,YAAYJ,OAAOK,YAAY,KAAK,GAAG;GAC7C,MAAMC,aAAaN,OAAOC,MAAMG,UAAU;AAC1C,OAAIE,WAAW,OAAOH,GAAI;AAG1B,OADgBG,WAAWL,MAAM,EAAE,CAACO,OAAO,KAAK,KAChC,GAAI;AACpB,OAAI,CAACF,WAAY;AACjB,UAAO;IAAErD;IAASC,OAAOoD;IAAYnD,OAAOiD;IAAWhD,KAAK0C;IAAO;;EAMrE,MAAMW,QAAQ,mBAAmBC,KAAKV,OAAO;AAC7C,MAAI,CAACS,MAAO;EACZ,MAAME,YAAYF,MAAM;AACxB,MAAIE,UAAU,OAAOR,GAAI;AAQzB,SAAO;GAAElD;GAASC,OAAOyD;GAAWxD,OALtB2C,QAAQa,UAAUZ;GAKW3C,KAAK0C;GAAO;;AAGzD,QAAO;;AAOT,SAASc,gBACPC,OACAC,KACA;AACAD,SAAQlF,wBAAwBkF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;EACInB;EACMrC;EACEE;EACZ,cAAcoJ;EACd,YAAY/B;EACZ,YAAYmC;EACApH;EACAC;EACAC;EACN7D;GAET,EAKG,oBAAC;EACC,QAAQkI;EACR,YAAY3G;EACZ,mBAAmBgH;EACHC;EACJ/G;EACAC;EACDT;EACCC;EACGC;EACGC;EACPwJ;EACX,eAAeC;EACAhJ;EACDC;EACd,iBAAiB6E;EACF5E;EACAC;EACH2B;EACE3C;EACPf;EACO0B;EACd,WACGwB,MAAc,kBACd,OAAO0B,WAAWyG,UAAU,WAAWzG,WAAWyG,QAAQ;EAExCX;EACrB,QAAQzD;EACR,eAAe;AACb,OAAIT,YAAamB,mBAAkBnB,YAAYjH,MAAM;;EAEvD,oBAAoB+L,cAAc;GAChC,MAAM9K,MAAMmF,MAAM4F,QAAQD,UAAU,GAAGA,UAAU,KAAKA;AACtD,OAAI9K,OAAO,KAAM8I,QAAO9I,IAAI;;EAG7BL;GACa,IACf;;AAIP,MAAMqL,mBAAmB5O,WAAWqG,gBAAgB;AASpDwI,OAAOC,OAAOF,kBAAkB;CAC9BrN;CACSV;CACTkO,aAAa;CACd,CAAC;AAEFF,OAAOG,eAAeJ,kBAAkB,iBAAiB;CACvDtJ,OAAO;CACP2J,YAAY;CACZC,cAAc;CACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caretPosition.js","names":[],"sources":["../../../../src/components/fields/CommandTextArea/caretPosition.ts"],"sourcesContent":["/**\n * Computes the caret's position for a `<textarea>` using a mirror-element\n * technique. jsdom returns zeros (no layout), but in a real browser this gives\n * the caret's viewport coordinates and its line height, so a popover can be\n * anchored to it.\n */\n\nexport interface CaretRect {\n /** Caret left edge, in viewport coordinates (px). */\n left: number;\n /** Caret top edge, in viewport coordinates (px). */\n top: number;\n /** Caret height (the textarea's line height), in px. */\n height: number;\n}\n\n// Computed styles that affect text wrapping / caret placement inside a textarea.\nconst MIRROR_STYLES = [\n 'boxSizing',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'whiteSpace',\n 'wordWrap',\n 'wordBreak',\n 'overflowWrap',\n] as const satisfies ReadonlyArray<keyof CSSStyleDeclaration>;\n\n/**\n * Returns the viewport-space rect of the caret at `index` within `textarea`,\n * or `null` if it can't be measured (e.g. jsdom, no layout, detached node).\n */\nexport function getCaretRect(\n textarea: HTMLTextAreaElement,\n index: number,\n): CaretRect | null {\n if (typeof document === 'undefined') return null;\n\n const doc = textarea.ownerDocument;\n const style = doc.defaultView?.getComputedStyle(textarea);\n if (!style) return null;\n\n // Bail out in environments without real layout (jsdom reports 0x0).\n const box = textarea.getBoundingClientRect();\n if (box.width === 0 && box.height === 0) return null;\n\n const mirror = doc.createElement('div');\n mirror.setAttribute('data-caret-mirror', '');\n mirror.style.position = 'absolute';\n mirror.style.visibility = 'hidden';\n mirror.style.whiteSpace = 'pre-wrap';\n mirror.style.wordWrap = 'break-word';\n mirror.style.top = '0';\n mirror.style.left = '0';\n // Prevent the mirror from affecting scroll/anchor lookups.\n mirror.style.overflow = 'hidden';\n\n for (const prop of MIRROR_STYLES) {\n const value = style[prop];\n if (value != null) {\n mirror.style.setProperty(\n prop.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase()),\n value,\n );\n }\n }\n\n // Match the textarea's content width, not its border-box scroll width.\n mirror.style.width = style.width;\n\n const value = textarea.value;\n const before = value.slice(0, index);\n const after = value.slice(index) || '.';\n\n mirror.textContent = before;\n\n const marker = doc.createElement('span');\n marker.textContent = after;\n marker.style.display = 'inline-block';\n mirror.appendChild(marker);\n\n // The mirror must be attached to the same document to inherit fonts.\n doc.body.appendChild(mirror);\n\n let rect: CaretRect | null = null;\n try {\n const mirrorRect = mirror.getBoundingClientRect();\n const markerRect = marker.getBoundingClientRect();\n // The mirror is not scrolled, so subtract the textarea's scroll to map the\n // unscrolled caret offset back into viewport space.\n const { scrollTop, scrollLeft } = textarea;\n rect = {\n left: box.left - scrollLeft + (markerRect.left - mirrorRect.left),\n top: box.top - scrollTop + (markerRect.top - mirrorRect.top),\n height: markerRect.height || parseFloat(style.lineHeight) || 0,\n };\n } finally {\n mirror.remove();\n }\n\n return rect.height > 0 ? rect : null;\n}\n"],"mappings":";;AAiBA,
|
|
1
|
+
{"version":3,"file":"caretPosition.js","names":["CaretRect","left","top","height","MIRROR_STYLES","const","ReadonlyArray","CSSStyleDeclaration","getCaretRect","textarea","HTMLTextAreaElement","index","document","doc","ownerDocument","style","defaultView","getComputedStyle","box","getBoundingClientRect","width","mirror","createElement","setAttribute","position","visibility","whiteSpace","wordWrap","overflow","prop","value","setProperty","replace","m","toLowerCase","before","slice","after","textContent","marker","display","appendChild","body","rect","mirrorRect","markerRect","scrollTop","scrollLeft","parseFloat","lineHeight","remove"],"sources":["../../../../src/components/fields/CommandTextArea/caretPosition.ts"],"sourcesContent":["/**\n * Computes the caret's position for a `<textarea>` using a mirror-element\n * technique. jsdom returns zeros (no layout), but in a real browser this gives\n * the caret's viewport coordinates and its line height, so a popover can be\n * anchored to it.\n */\n\nexport interface CaretRect {\n /** Caret left edge, in viewport coordinates (px). */\n left: number;\n /** Caret top edge, in viewport coordinates (px). */\n top: number;\n /** Caret height (the textarea's line height), in px. */\n height: number;\n}\n\n// Computed styles that affect text wrapping / caret placement inside a textarea.\nconst MIRROR_STYLES = [\n 'boxSizing',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'whiteSpace',\n 'wordWrap',\n 'wordBreak',\n 'overflowWrap',\n] as const satisfies ReadonlyArray<keyof CSSStyleDeclaration>;\n\n/**\n * Returns the viewport-space rect of the caret at `index` within `textarea`,\n * or `null` if it can't be measured (e.g. jsdom, no layout, detached node).\n */\nexport function getCaretRect(\n textarea: HTMLTextAreaElement,\n index: number,\n): CaretRect | null {\n if (typeof document === 'undefined') return null;\n\n const doc = textarea.ownerDocument;\n const style = doc.defaultView?.getComputedStyle(textarea);\n if (!style) return null;\n\n // Bail out in environments without real layout (jsdom reports 0x0).\n const box = textarea.getBoundingClientRect();\n if (box.width === 0 && box.height === 0) return null;\n\n const mirror = doc.createElement('div');\n mirror.setAttribute('data-caret-mirror', '');\n mirror.style.position = 'absolute';\n mirror.style.visibility = 'hidden';\n mirror.style.whiteSpace = 'pre-wrap';\n mirror.style.wordWrap = 'break-word';\n mirror.style.top = '0';\n mirror.style.left = '0';\n // Prevent the mirror from affecting scroll/anchor lookups.\n mirror.style.overflow = 'hidden';\n\n for (const prop of MIRROR_STYLES) {\n const value = style[prop];\n if (value != null) {\n mirror.style.setProperty(\n prop.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase()),\n value,\n );\n }\n }\n\n // Match the textarea's content width, not its border-box scroll width.\n mirror.style.width = style.width;\n\n const value = textarea.value;\n const before = value.slice(0, index);\n const after = value.slice(index) || '.';\n\n mirror.textContent = before;\n\n const marker = doc.createElement('span');\n marker.textContent = after;\n marker.style.display = 'inline-block';\n mirror.appendChild(marker);\n\n // The mirror must be attached to the same document to inherit fonts.\n doc.body.appendChild(mirror);\n\n let rect: CaretRect | null = null;\n try {\n const mirrorRect = mirror.getBoundingClientRect();\n const markerRect = marker.getBoundingClientRect();\n // The mirror is not scrolled, so subtract the textarea's scroll to map the\n // unscrolled caret offset back into viewport space.\n const { scrollTop, scrollLeft } = textarea;\n rect = {\n left: box.left - scrollLeft + (markerRect.left - mirrorRect.left),\n top: box.top - scrollTop + (markerRect.top - mirrorRect.top),\n height: markerRect.height || parseFloat(style.lineHeight) || 0,\n };\n } finally {\n mirror.remove();\n }\n\n return rect.height > 0 ? rect : null;\n}\n"],"mappings":";;AAiBA,MAAMI,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;AAMD,SAAgBI,aACdC,UACAE,OACkB;AAClB,KAAI,OAAOC,aAAa,YAAa,QAAO;CAE5C,MAAMC,MAAMJ,SAASK;CACrB,MAAMC,QAAQF,IAAIG,aAAaC,iBAAiBR,SAAS;AACzD,KAAI,CAACM,MAAO,QAAO;CAGnB,MAAMG,MAAMT,SAASU,uBAAuB;AAC5C,KAAID,IAAIE,UAAU,KAAKF,IAAIf,WAAW,EAAG,QAAO;CAEhD,MAAMkB,SAASR,IAAIS,cAAc,MAAM;AACvCD,QAAOE,aAAa,qBAAqB,GAAG;AAC5CF,QAAON,MAAMS,WAAW;AACxBH,QAAON,MAAMU,aAAa;AAC1BJ,QAAON,MAAMW,aAAa;AAC1BL,QAAON,MAAMY,WAAW;AACxBN,QAAON,MAAMb,MAAM;AACnBmB,QAAON,MAAMd,OAAO;AAEpBoB,QAAON,MAAMa,WAAW;AAExB,MAAK,MAAMC,QAAQzB,eAAe;EAChC,MAAM0B,QAAQf,MAAMc;AACpB,MAAIC,SAAS,KACXT,QAAON,MAAMgB,YACXF,KAAKG,QAAQ,WAAWC,MAAM,MAAMA,EAAEC,aAAa,CAAC,EACpDJ,MACD;;AAKLT,QAAON,MAAMK,QAAQL,MAAMK;CAE3B,MAAMU,QAAQrB,SAASqB;CACvB,MAAMK,SAASL,MAAMM,MAAM,GAAGzB,MAAM;CACpC,MAAM0B,QAAQP,MAAMM,MAAMzB,MAAM,IAAI;AAEpCU,QAAOiB,cAAcH;CAErB,MAAMI,SAAS1B,IAAIS,cAAc,OAAO;AACxCiB,QAAOD,cAAcD;AACrBE,QAAOxB,MAAMyB,UAAU;AACvBnB,QAAOoB,YAAYF,OAAO;AAG1B1B,KAAI6B,KAAKD,YAAYpB,OAAO;CAE5B,IAAIsB,OAAyB;AAC7B,KAAI;EACF,MAAMC,aAAavB,OAAOF,uBAAuB;EACjD,MAAM0B,aAAaN,OAAOpB,uBAAuB;EAGjD,MAAM,EAAE2B,WAAWC,eAAetC;AAClCkC,SAAO;GACL1C,MAAMiB,IAAIjB,OAAO8C,cAAcF,WAAW5C,OAAO2C,WAAW3C;GAC5DC,KAAKgB,IAAIhB,MAAM4C,aAAaD,WAAW3C,MAAM0C,WAAW1C;GACxDC,QAAQ0C,WAAW1C,UAAU6C,WAAWjC,MAAMkC,WAAW,IAAI;GAC9D;WACO;AACR5B,SAAO6B,QAAQ;;AAGjB,QAAOP,KAAKxC,SAAS,IAAIwC,OAAO"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.183.0 | Cube Dev Team */
|
|
2
2
|
import { getCaretRect } from "./caretPosition.js";
|
|
3
|
+
import { c } from "react-compiler-runtime";
|
|
3
4
|
import { useEffect, useLayoutEffect, useRef } from "react";
|
|
4
5
|
|
|
5
6
|
//#region src/components/fields/CommandTextArea/useCaretAnchor.ts
|
|
@@ -10,57 +11,95 @@ import { useEffect, useLayoutEffect, useRef } from "react";
|
|
|
10
11
|
* `getBoundingClientRect`, while interaction/outside-click stays on the
|
|
11
12
|
* wrapper via a separate `triggerRef`.
|
|
12
13
|
*/
|
|
13
|
-
function useCaretAnchor(
|
|
14
|
+
function useCaretAnchor(t0) {
|
|
15
|
+
const $ = c(15);
|
|
16
|
+
const { inputRef, wrapperRef, caret, value, isActive } = t0;
|
|
14
17
|
const anchorRef = useRef(null);
|
|
15
18
|
const positionApiRef = useRef(null);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
anchorRef.current =
|
|
19
|
+
let t1;
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[0] !== wrapperRef) {
|
|
22
|
+
t1 = () => {
|
|
23
|
+
const wrapper = wrapperRef.current;
|
|
24
|
+
if (!wrapper) return;
|
|
25
|
+
const anchor = document.createElement("span");
|
|
26
|
+
anchor.setAttribute("data-caret-anchor", "");
|
|
27
|
+
anchor.style.position = "absolute";
|
|
28
|
+
anchor.style.top = "0";
|
|
29
|
+
anchor.style.left = "0";
|
|
30
|
+
anchor.style.width = "0";
|
|
31
|
+
anchor.style.height = "0";
|
|
32
|
+
anchor.style.pointerEvents = "none";
|
|
33
|
+
anchor.style.overflow = "hidden";
|
|
34
|
+
anchor.style.opacity = "0";
|
|
35
|
+
wrapper.appendChild(anchor);
|
|
36
|
+
anchorRef.current = anchor;
|
|
37
|
+
return () => {
|
|
38
|
+
anchor.remove();
|
|
39
|
+
anchorRef.current = null;
|
|
40
|
+
};
|
|
34
41
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
42
|
+
t2 = [wrapperRef];
|
|
43
|
+
$[0] = wrapperRef;
|
|
44
|
+
$[1] = t1;
|
|
45
|
+
$[2] = t2;
|
|
46
|
+
} else {
|
|
47
|
+
t1 = $[1];
|
|
48
|
+
t2 = $[2];
|
|
49
|
+
}
|
|
50
|
+
useEffect(t1, t2);
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[3] !== caret || $[4] !== inputRef || $[5] !== isActive || $[6] !== wrapperRef) {
|
|
53
|
+
t3 = () => {
|
|
54
|
+
const anchor_0 = anchorRef.current;
|
|
55
|
+
const wrapper_0 = wrapperRef.current;
|
|
56
|
+
const input = inputRef.current;
|
|
57
|
+
if (!anchor_0 || !wrapper_0 || !input) return;
|
|
58
|
+
if (!isActive) {
|
|
59
|
+
anchor_0.style.transform = "translate(0px, 0px)";
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const rect = getCaretRect(input, caret);
|
|
63
|
+
if (!rect) return;
|
|
64
|
+
const wrapperRect = wrapper_0.getBoundingClientRect();
|
|
65
|
+
const x = rect.left - wrapperRect.left;
|
|
66
|
+
const y = rect.top - wrapperRect.top;
|
|
67
|
+
anchor_0.style.transform = `translate(${x}px, ${y}px)`;
|
|
68
|
+
anchor_0.style.height = `${rect.height}px`;
|
|
69
|
+
positionApiRef.current?.updatePosition();
|
|
70
|
+
};
|
|
71
|
+
$[3] = caret;
|
|
72
|
+
$[4] = inputRef;
|
|
73
|
+
$[5] = isActive;
|
|
74
|
+
$[6] = wrapperRef;
|
|
75
|
+
$[7] = t3;
|
|
76
|
+
} else t3 = $[7];
|
|
77
|
+
let t4;
|
|
78
|
+
if ($[8] !== caret || $[9] !== inputRef || $[10] !== isActive || $[11] !== value || $[12] !== wrapperRef) {
|
|
79
|
+
t4 = [
|
|
80
|
+
caret,
|
|
81
|
+
value,
|
|
82
|
+
isActive,
|
|
83
|
+
inputRef,
|
|
84
|
+
wrapperRef
|
|
85
|
+
];
|
|
86
|
+
$[8] = caret;
|
|
87
|
+
$[9] = inputRef;
|
|
88
|
+
$[10] = isActive;
|
|
89
|
+
$[11] = value;
|
|
90
|
+
$[12] = wrapperRef;
|
|
91
|
+
$[13] = t4;
|
|
92
|
+
} else t4 = $[13];
|
|
93
|
+
useLayoutEffect(t3, t4);
|
|
94
|
+
let t5;
|
|
95
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
96
|
+
t5 = {
|
|
97
|
+
anchorRef,
|
|
98
|
+
positionApiRef
|
|
99
|
+
};
|
|
100
|
+
$[14] = t5;
|
|
101
|
+
} else t5 = $[14];
|
|
102
|
+
return t5;
|
|
64
103
|
}
|
|
65
104
|
|
|
66
105
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaretAnchor.js","names":[],"sources":["../../../../src/components/fields/CommandTextArea/useCaretAnchor.ts"],"sourcesContent":["import { RefObject, useEffect, useLayoutEffect, useRef } from 'react';\n\nimport { CaretRect, getCaretRect } from './caretPosition';\n\nexport interface CaretAnchorApi {\n updatePosition: () => void;\n}\n\nexport interface UseCaretAnchorOptions {\n inputRef: RefObject<HTMLTextAreaElement>;\n wrapperRef: RefObject<HTMLElement>;\n caret: number;\n value: string;\n isActive: boolean;\n}\n\nexport interface UseCaretAnchorResult {\n /** A real (zero-size) element positioned at the caret; used as the popover's\n * geometric anchor. `null` until the wrapper mounts. */\n anchorRef: RefObject<HTMLElement | null>;\n /** Imperative handle to force the popover to re-position. */\n positionApiRef: RefObject<CaretAnchorApi | null>;\n}\n\n/**\n * Keeps a zero-size \"caret anchor\" element positioned at the textarea's caret\n * (both axes), inside the (position: relative) input wrapper. The anchor is a\n * real DOM node so react-aria's `useOverlayPosition` can measure it with\n * `getBoundingClientRect`, while interaction/outside-click stays on the\n * wrapper via a separate `triggerRef`.\n */\nexport function useCaretAnchor({\n inputRef,\n wrapperRef,\n caret,\n value,\n isActive,\n}: UseCaretAnchorOptions): UseCaretAnchorResult {\n const anchorRef = useRef<HTMLElement | null>(null);\n const positionApiRef = useRef<CaretAnchorApi | null>(null);\n\n // Lazily create the anchor element inside the wrapper and clean it up on\n // unmount. It is not managed by React so the shared TextInputBase structure\n // stays untouched.\n useEffect(() => {\n const wrapper = wrapperRef.current;\n if (!wrapper) return;\n\n const anchor = document.createElement('span');\n anchor.setAttribute('data-caret-anchor', '');\n anchor.style.position = 'absolute';\n anchor.style.top = '0';\n anchor.style.left = '0';\n anchor.style.width = '0';\n anchor.style.height = '0';\n anchor.style.pointerEvents = 'none';\n // Off the flow so it never affects layout or a11y.\n anchor.style.overflow = 'hidden';\n anchor.style.opacity = '0';\n wrapper.appendChild(anchor);\n anchorRef.current = anchor;\n\n return () => {\n anchor.remove();\n anchorRef.current = null;\n };\n }, [wrapperRef]);\n\n // Position the anchor at the caret whenever the caret/value/active state\n // changes, then nudge the popover to re-anchor.\n useLayoutEffect(() => {\n const anchor = anchorRef.current;\n const wrapper = wrapperRef.current;\n const input = inputRef.current;\n if (!anchor || !wrapper || !input) return;\n\n if (!isActive) {\n // Reset to the wrapper's origin when not active so a stale position is\n // never measured if the popover reopens without a caret move.\n anchor.style.transform = 'translate(0px, 0px)';\n return;\n }\n\n const rect = getCaretRect(input, caret);\n if (!rect) return;\n\n const wrapperRect = wrapper.getBoundingClientRect();\n // Position relative to the wrapper's border-box (it's position: relative).\n const x = rect.left - wrapperRect.left;\n const y = rect.top - wrapperRect.top;\n anchor.style.transform = `translate(${x}px, ${y}px)`;\n // Give it a real height so cross-axis centering uses the caret line.\n anchor.style.height = `${rect.height}px`;\n\n positionApiRef.current?.updatePosition();\n }, [caret, value, isActive, inputRef, wrapperRef]);\n\n return { anchorRef, positionApiRef };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCaretAnchor.js","names":["RefObject","useEffect","useLayoutEffect","useRef","CaretRect","getCaretRect","CaretAnchorApi","updatePosition","UseCaretAnchorOptions","inputRef","HTMLTextAreaElement","wrapperRef","HTMLElement","caret","value","isActive","UseCaretAnchorResult","anchorRef","positionApiRef","useCaretAnchor","t0","$","_c","t1","t2","wrapper","current","anchor","document","createElement","setAttribute","style","position","top","left","width","height","pointerEvents","overflow","opacity","appendChild","remove","t3","anchor_0","wrapper_0","input","transform","rect","wrapperRect","getBoundingClientRect","x","y","t4","t5","Symbol","for"],"sources":["../../../../src/components/fields/CommandTextArea/useCaretAnchor.ts"],"sourcesContent":["import { RefObject, useEffect, useLayoutEffect, useRef } from 'react';\n\nimport { CaretRect, getCaretRect } from './caretPosition';\n\nexport interface CaretAnchorApi {\n updatePosition: () => void;\n}\n\nexport interface UseCaretAnchorOptions {\n inputRef: RefObject<HTMLTextAreaElement>;\n wrapperRef: RefObject<HTMLElement>;\n caret: number;\n value: string;\n isActive: boolean;\n}\n\nexport interface UseCaretAnchorResult {\n /** A real (zero-size) element positioned at the caret; used as the popover's\n * geometric anchor. `null` until the wrapper mounts. */\n anchorRef: RefObject<HTMLElement | null>;\n /** Imperative handle to force the popover to re-position. */\n positionApiRef: RefObject<CaretAnchorApi | null>;\n}\n\n/**\n * Keeps a zero-size \"caret anchor\" element positioned at the textarea's caret\n * (both axes), inside the (position: relative) input wrapper. The anchor is a\n * real DOM node so react-aria's `useOverlayPosition` can measure it with\n * `getBoundingClientRect`, while interaction/outside-click stays on the\n * wrapper via a separate `triggerRef`.\n */\nexport function useCaretAnchor({\n inputRef,\n wrapperRef,\n caret,\n value,\n isActive,\n}: UseCaretAnchorOptions): UseCaretAnchorResult {\n const anchorRef = useRef<HTMLElement | null>(null);\n const positionApiRef = useRef<CaretAnchorApi | null>(null);\n\n // Lazily create the anchor element inside the wrapper and clean it up on\n // unmount. It is not managed by React so the shared TextInputBase structure\n // stays untouched.\n useEffect(() => {\n const wrapper = wrapperRef.current;\n if (!wrapper) return;\n\n const anchor = document.createElement('span');\n anchor.setAttribute('data-caret-anchor', '');\n anchor.style.position = 'absolute';\n anchor.style.top = '0';\n anchor.style.left = '0';\n anchor.style.width = '0';\n anchor.style.height = '0';\n anchor.style.pointerEvents = 'none';\n // Off the flow so it never affects layout or a11y.\n anchor.style.overflow = 'hidden';\n anchor.style.opacity = '0';\n wrapper.appendChild(anchor);\n anchorRef.current = anchor;\n\n return () => {\n anchor.remove();\n anchorRef.current = null;\n };\n }, [wrapperRef]);\n\n // Position the anchor at the caret whenever the caret/value/active state\n // changes, then nudge the popover to re-anchor.\n useLayoutEffect(() => {\n const anchor = anchorRef.current;\n const wrapper = wrapperRef.current;\n const input = inputRef.current;\n if (!anchor || !wrapper || !input) return;\n\n if (!isActive) {\n // Reset to the wrapper's origin when not active so a stale position is\n // never measured if the popover reopens without a caret move.\n anchor.style.transform = 'translate(0px, 0px)';\n return;\n }\n\n const rect = getCaretRect(input, caret);\n if (!rect) return;\n\n const wrapperRect = wrapper.getBoundingClientRect();\n // Position relative to the wrapper's border-box (it's position: relative).\n const x = rect.left - wrapperRect.left;\n const y = rect.top - wrapperRect.top;\n anchor.style.transform = `translate(${x}px, ${y}px)`;\n // Give it a real height so cross-axis centering uses the caret line.\n anchor.style.height = `${rect.height}px`;\n\n positionApiRef.current?.updatePosition();\n }, [caret, value, isActive, inputRef, wrapperRef]);\n\n return { anchorRef, positionApiRef };\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,SAAOmB,eAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAwB,MAAA,EAAAb,UAAAE,YAAAE,OAAAC,OAAAC,aAAAK;CAO7B,MAAAH,YAAkBd,OAA2B,KAAK;CAClD,MAAAe,iBAAuBf,OAA8B,KAAK;CAAC,IAAAoB;CAAA,IAAAC;AAAA,KAAAH,EAAA,OAAAV,YAAA;AAKjDY,aAAA;GACR,MAAAE,UAAgBd,WAAUe;AAC1B,OAAI,CAACD,QAAO;GAEZ,MAAAE,SAAeC,SAAQC,cAAe,OAAO;AAC7CF,UA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;AAAAY,IAAA,KAAAN;AAAAM,IAAA,KAAAV;AAAAU,IAAA,KAAAqB;OAAAA,MAAArB,EAAA;CAAA,IAAA+B;AAAA,KAAA/B,EAAA,OAAAR,SAAAQ,EAAA,OAAAZ,YAAAY,EAAA,QAAAN,YAAAM,EAAA,QAAAP,SAAAO,EAAA,QAAAV,YAAA;AAAEyC,OAAA;GAACvC;GAAOC;GAAOC;GAAUN;GAAUE;GAAW;AAAAU,IAAA,KAAAR;AAAAQ,IAAA,KAAAZ;AAAAY,IAAA,MAAAN;AAAAM,IAAA,MAAAP;AAAAO,IAAA,MAAAV;AAAAU,IAAA,MAAA+B;OAAAA,MAAA/B,EAAA;AAzBjDnB,iBAAgBwC,IAyBbU,GAA+C;CAAA,IAAAC;AAAA,KAAAhC,EAAA,QAAAiC,OAAAC,IAAA,4BAAA,EAAA;AAE3CF,OAAA;GAAApC;GAAAC;GAA6B;AAAAG,IAAA,MAAAgC;OAAAA,MAAAhC,EAAA;AAAA,QAA7BgC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.183.0 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.js","names":["
|
|
1
|
+
{"version":3,"file":"DateInput.js","names":["createCalendar","FocusableRef","BaseProps","CONTAINER_STYLES","ContainerStyleProps","Styles","forwardRef","useRef","AriaDateFieldProps","DateValue","useDateField","useLocale","useDateFieldState","FieldBaseProps","mergeProps","extractStyles","useFieldProps","wrapWithField","DateInputBase","DatePickerSegment","parseAbsoluteDate","DEFAULT_DATE_PROPS","formatSegments","useFocusManagerRef","ReactElement","Ref","CubeDateInputProps","Omit","T","wrapperStyles","inputStyles","styles","size","DateInput","props","ref","HTMLElement","defaultValidationTrigger","valuePropsMapper","value","onChange","Object","assign","qa","autoFocus","isDisabled","isReadOnly","isRequired","isValid","useLocaleProp","domRef","locale","state","segments","fieldRef","labelProps","fieldProps","component","isInvalid","map","segment","i","_DateInput","displayName"],"sources":["../../../../src/components/fields/DatePicker/DateInput.tsx"],"sourcesContent":["import { createCalendar } from '@internationalized/date';\nimport { FocusableRef } from '@react-types/shared';\nimport {\n BaseProps,\n CONTAINER_STYLES,\n ContainerStyleProps,\n Styles,\n} from '@tenphi/tasty';\nimport { forwardRef, useRef } from 'react';\nimport {\n AriaDateFieldProps,\n DateValue,\n useDateField,\n useLocale,\n} from 'react-aria';\nimport { useDateFieldState } from 'react-stately';\n\nimport { FieldBaseProps } from '../../../shared';\nimport { mergeProps } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { useFieldProps, wrapWithField } from '../../form';\n\nimport { DateInputBase } from './DateInputBase';\nimport { DatePickerSegment } from './DatePickerSegment';\nimport { parseAbsoluteDate } from './parseDate';\nimport { DEFAULT_DATE_PROPS } from './props';\nimport { formatSegments, useFocusManagerRef } from './utils';\n\nimport type { ReactElement, Ref } from 'react';\n\nexport interface CubeDateInputProps<T extends DateValue = DateValue>\n extends Omit<AriaDateFieldProps<T>, 'errorMessage' | 'form' | 'name'>,\n BaseProps,\n ContainerStyleProps,\n FieldBaseProps<T | null | undefined> {\n wrapperStyles?: Styles;\n inputStyles?: Styles;\n styles?: Styles;\n size?: 'small' | 'medium' | 'large' | (string & {});\n useLocale?: boolean;\n}\n\nfunction DateInput<T extends DateValue>(\n props: CubeDateInputProps<T>,\n ref: FocusableRef<HTMLElement>,\n) {\n props = useFieldProps(props, {\n defaultValidationTrigger: 'onBlur',\n valuePropsMapper: ({ value, onChange }) => ({\n value: typeof value === 'string' ? parseAbsoluteDate(value) : value,\n onChange,\n }),\n });\n props = Object.assign({}, DEFAULT_DATE_PROPS, props);\n\n let {\n qa,\n autoFocus,\n isDisabled,\n inputStyles,\n wrapperStyles,\n isReadOnly,\n isRequired,\n isValid,\n size = 'medium',\n useLocale: useLocaleProp,\n } = props;\n\n let styles = extractStyles(props, CONTAINER_STYLES, wrapperStyles);\n\n let domRef = useFocusManagerRef(ref);\n let { locale } = useLocale();\n let state = useDateFieldState({\n ...props,\n locale: useLocaleProp ? locale : 'en-US',\n createCalendar,\n });\n\n if (useLocaleProp == null) {\n state.segments = formatSegments(state.segments);\n }\n\n let fieldRef = useRef(null);\n let { labelProps, fieldProps } = useDateField(props, state, fieldRef);\n\n const component = (\n <DateInputBase\n ref={fieldRef}\n qa={qa || 'DateInput'}\n inputType=\"dateinput\"\n size={size}\n fieldProps={fieldProps}\n isDisabled={isDisabled}\n autoFocus={autoFocus}\n isInvalid={state.isInvalid}\n isValid={isValid}\n styles={wrapperStyles}\n inputStyles={inputStyles}\n >\n {state.segments.map((segment, i) => (\n <DatePickerSegment\n key={i}\n segment={segment}\n state={state}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n />\n ))}\n </DateInputBase>\n );\n\n return wrapWithField(component, domRef, {\n ...props,\n labelProps: mergeProps(props.labelProps, labelProps),\n });\n}\n\n/**\n * DateInputs allow users to enter and edit date and time values using a keyboard.\n * Each part of a date value is displayed in an individually editable segment.\n */\nconst _DateInput = forwardRef(DateInput) as <T extends DateValue = DateValue>(\n props: CubeDateInputProps<T> & { ref?: Ref<HTMLElement> },\n) => ReactElement | null;\n\n(_DateInput as any).displayName = 'DateInput';\n\nexport { _DateInput as DateInput };\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,SAASiC,UACPC,OACAC,KACA;AACAD,SAAQlB,cAAckB,OAAO;EAC3BG,0BAA0B;EAC1BC,mBAAmB,EAAEC,OAAOC,gBAAgB;GAC1CD,OAAO,OAAOA,UAAU,WAAWnB,kBAAkBmB,MAAM,GAAGA;GAC9DC;GACD;EACF,CAAC;AACFN,SAAQO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