@cube-dev/ui-kit 0.207.0 → 0.209.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 +26 -0
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- 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/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.d.ts +0 -2
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/CollectionItem.js.map +1 -1
- package/dist/components/GlobalStyles.js +1 -1
- package/dist/components/GlobalStyles.js.map +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/GridProvider.js.map +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/Root.js +7 -4
- package/dist/components/Root.js.map +1 -1
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.js +1 -1
- package/dist/components/actions/Banner/Banner.js.map +1 -1
- package/dist/components/actions/Button/AutoCollapseObserver.js +215 -0
- package/dist/components/actions/Button/AutoCollapseObserver.js.map +1 -0
- package/dist/components/actions/Button/Button.d.ts +38 -1
- package/dist/components/actions/Button/Button.js +80 -19
- package/dist/components/actions/Button/Button.js.map +1 -1
- package/dist/components/actions/Button/index.d.ts +16 -1
- package/dist/components/actions/Button/index.js +13 -0
- package/dist/components/actions/Button/index.js.map +1 -0
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js.map +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.d.ts +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js.map +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +2 -2
- package/dist/components/actions/ItemAction/ItemAction.js.map +1 -1
- package/dist/components/actions/ItemActionContext.js +1 -1
- package/dist/components/actions/ItemActionsWrapper.js +2 -2
- package/dist/components/actions/ItemButton/ItemButton.d.ts +0 -2
- 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 +1 -1
- package/dist/components/actions/Menu/Menu.d.ts +1 -1
- package/dist/components/actions/Menu/Menu.js +1 -1
- package/dist/components/actions/Menu/Menu.js.map +1 -1
- package/dist/components/actions/Menu/MenuCollectionItem.js +1 -1
- package/dist/components/actions/Menu/MenuItem.js +2 -2
- package/dist/components/actions/Menu/MenuItem.js.map +1 -1
- package/dist/components/actions/Menu/MenuSection.js +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +3 -3
- package/dist/components/actions/Menu/MenuTrigger.js.map +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +2 -2
- package/dist/components/actions/Menu/SubMenuTrigger.js.map +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/dist/components/actions/Menu/context.js +1 -1
- package/dist/components/actions/Menu/index.d.ts +1 -1
- package/dist/components/actions/Menu/styled.js +1 -1
- package/dist/components/actions/actions-run.js +1 -1
- package/dist/components/actions/index.d.ts +6 -18
- package/dist/components/actions/use-action.js +2 -2
- package/dist/components/actions/use-action.js.map +1 -1
- package/dist/components/actions/use-anchored-menu.d.ts +0 -1
- package/dist/components/actions/use-anchored-menu.js +2 -2
- package/dist/components/actions/use-anchored-menu.js.map +1 -1
- package/dist/components/actions/use-context-menu.d.ts +0 -1
- package/dist/components/actions/use-context-menu.js +3 -3
- package/dist/components/actions/use-context-menu.js.map +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js.map +1 -1
- package/dist/components/content/Alert/Alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js.map +1 -1
- package/dist/components/content/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.d.ts +0 -1
- package/dist/components/content/Badge/Badge.js +1 -1
- package/dist/components/content/Badge/Badge.js.map +1 -1
- package/dist/components/content/Card/Card.js +1 -1
- package/dist/components/content/Content.js +1 -1
- package/dist/components/content/Content.js.map +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +3 -3
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js.map +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.d.ts +2 -18
- package/dist/components/content/CopySnippet/CopySnippet.js +2 -2
- package/dist/components/content/CopySnippet/CopySnippet.js.map +1 -1
- package/dist/components/content/Disclosure/Disclosure.d.ts +0 -1
- package/dist/components/content/Disclosure/Disclosure.js +2 -2
- package/dist/components/content/Disclosure/Disclosure.js.map +1 -1
- package/dist/components/content/Divider/Divider.js +1 -1
- package/dist/components/content/Divider/Divider.js.map +1 -1
- package/dist/components/content/Footer.js +1 -1
- package/dist/components/content/Footer.js.map +1 -1
- package/dist/components/content/Header.js +1 -1
- package/dist/components/content/Header.js.map +1 -1
- package/dist/components/content/HotKeys/HotKeys.js +1 -1
- package/dist/components/content/HotKeys/HotKeys.js.map +1 -1
- package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
- package/dist/components/content/InfoBadge/InfoBadge.js.map +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +1 -1
- package/dist/components/content/InlineInput/InlineInput.js.map +1 -1
- package/dist/components/content/Item/Item.d.ts +1 -11
- package/dist/components/content/Item/Item.js +111 -115
- package/dist/components/content/Item/Item.js.map +1 -1
- package/dist/components/content/Item/ItemWithNativeLinks.js +2 -2
- package/dist/components/content/Item/index.d.ts +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- package/dist/components/content/ItemBadge/index.d.ts +1 -2
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/Layout.js.map +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +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 +1 -1
- package/dist/components/content/Layout/LayoutContext.js.map +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js.map +1 -1
- package/dist/components/content/Layout/LayoutPane.js +2 -2
- package/dist/components/content/Layout/LayoutPane.js.map +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +4 -4
- package/dist/components/content/Layout/LayoutPanel.js.map +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js.map +1 -1
- package/dist/components/content/Layout/LayoutPanelTransition.js +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Paragraph.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js.map +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +2 -2
- package/dist/components/content/Result/Result.js.map +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/content/Tag/Tag.d.ts +0 -1
- package/dist/components/content/Tag/Tag.js +1 -1
- package/dist/components/content/Tag/Tag.js.map +1 -1
- package/dist/components/content/Text.js +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/Title.js.map +1 -1
- package/dist/components/content/Tree/Tree.js +1 -1
- package/dist/components/content/Tree/Tree.js.map +1 -1
- package/dist/components/content/Tree/TreeNode.js +5 -5
- package/dist/components/content/Tree/TreeNode.js.map +1 -1
- package/dist/components/content/Tree/checked-keys.js +1 -1
- package/dist/components/content/Tree/rowId.js +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/types.d.ts +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js.map +1 -1
- package/dist/components/content/Tree/use-load-data.js +1 -1
- package/dist/components/content/Tree/use-load-data.js.map +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +233 -111
- package/dist/components/content/use-auto-tooltip.js.map +1 -1
- package/dist/components/data/DataTable/DataTable.js +1 -1
- package/dist/components/data/DataTable/DataTable.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTable.js +1 -1
- package/dist/components/data/ItemTable/ItemTable.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableBulkBar.js +2 -2
- package/dist/components/data/ItemTable/ItemTableBulkBar.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableDragPreview.js +1 -1
- package/dist/components/data/ItemTable/ItemTableDragPreview.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableFooter.js +1 -1
- package/dist/components/data/ItemTable/ItemTableFooter.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableToolbar.js +2 -2
- package/dist/components/data/ItemTable/ItemTableToolbar.js.map +1 -1
- package/dist/components/data/ItemTable/item-table-sections.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-column-widths.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-drag-drop.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-pagination.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-selection.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-sort.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-tree-model.js +1 -1
- package/dist/components/data/TableBase/ColumnResizer.js +1 -1
- package/dist/components/data/TableBase/ColumnResizer.js.map +1 -1
- package/dist/components/data/TableBase/RowCollection.js +1 -1
- package/dist/components/data/TableBase/TableHeaderCell.js +1 -1
- package/dist/components/data/TableBase/TableHeaderCell.js.map +1 -1
- package/dist/components/data/TableBase/TableRow.js +1 -1
- package/dist/components/data/TableBase/TableRow.js.map +1 -1
- package/dist/components/data/TableBase/TableRowLink.js +1 -1
- package/dist/components/data/TableBase/TableView.js +6 -6
- package/dist/components/data/TableBase/TableView.js.map +1 -1
- package/dist/components/data/TableBase/TreeGridTable.js +1 -1
- package/dist/components/data/TableBase/column-header.js +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-styles.js +1 -1
- package/dist/components/data/TableBase/column-tint.js +1 -1
- package/dist/components/data/TableBase/row-menu.js +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-body-sections.js +1 -1
- package/dist/components/data/TableBase/table-tree.js +1 -1
- package/dist/components/data/TableBase/types.js +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-menu.js +2 -2
- package/dist/components/data/TableBase/use-column-order.js +1 -1
- package/dist/components/data/TableBase/use-column-order.js.map +1 -1
- package/dist/components/data/TableBase/use-column-window.js +1 -1
- package/dist/components/data/TableBase/use-container-width.js +1 -1
- package/dist/components/data/TableBase/use-row-move-animation.js +1 -1
- package/dist/components/data/TableBase/use-scrollability.js +1 -1
- package/dist/components/data/TableBase/use-table-columns.js +1 -1
- package/dist/components/data/TableBase/use-table-search.js +1 -1
- package/dist/components/data/TableBase/use-table-selection.js +1 -1
- package/dist/components/data/TableBase/use-table-selection.js.map +1 -1
- package/dist/components/data/TableBase/use-table-sort.js +1 -1
- package/dist/components/data/TableBase/use-table-sort.js.map +1 -1
- package/dist/components/data/TableBase/use-table-sorts.js +1 -1
- package/dist/components/data/TableBase/use-table-sorts.js.map +1 -1
- package/dist/components/data/TableBase/use-table-storage.js +1 -1
- package/dist/components/data/TableBase/use-table-tooltip-refresh.js +1 -1
- package/dist/components/data/TableBase/use-table-tree-state.js +1 -1
- package/dist/components/data/TableBase/use-table-tree-state.js.map +1 -1
- package/dist/components/fields/Checkbox/Checkbox.d.ts +0 -1
- package/dist/components/fields/Checkbox/Checkbox.js +3 -3
- package/dist/components/fields/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.d.ts +0 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +3 -3
- package/dist/components/fields/Checkbox/CheckboxGroup.js.map +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ColorInput/ColorInput.d.ts +0 -1
- package/dist/components/fields/ColorInput/ColorInput.js +1 -1
- package/dist/components/fields/ColorInput/ColorInput.js.map +1 -1
- package/dist/components/fields/ColorPicker/ColorPicker.d.ts +0 -3
- package/dist/components/fields/ColorPicker/ColorPicker.js +3 -3
- package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/components/fields/ColorSwatch/ColorSwatch.js +1 -1
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.d.ts +0 -1
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +2 -2
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -1
- package/dist/components/fields/ComboBox/ComboBox.d.ts +0 -1
- package/dist/components/fields/ComboBox/ComboBox.js +6 -6
- package/dist/components/fields/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/fields/ComboBox/comboBoxOptions.js +1 -1
- package/dist/components/fields/CommandTextArea/CommandTextArea.d.ts +1 -2
- package/dist/components/fields/CommandTextArea/CommandTextArea.js +2 -2
- package/dist/components/fields/CommandTextArea/CommandTextArea.js.map +1 -1
- package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
- package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
- package/dist/components/fields/DatePicker/CalendarPopover.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.d.ts +0 -1
- package/dist/components/fields/DatePicker/DateInput.js +2 -2
- package/dist/components/fields/DatePicker/DateInput.js.map +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePicker.d.ts +0 -1
- package/dist/components/fields/DatePicker/DatePicker.js +2 -2
- package/dist/components/fields/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +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 +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.d.ts +0 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +2 -2
- package/dist/components/fields/DatePicker/DateRangePicker.js.map +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.d.ts +0 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +2 -2
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
- package/dist/components/fields/DatePicker/PeriodPicker.d.ts +0 -1
- package/dist/components/fields/DatePicker/PeriodPicker.js +2 -2
- package/dist/components/fields/DatePicker/PeriodPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.d.ts +0 -1
- package/dist/components/fields/DatePicker/TimeInput.js +2 -2
- package/dist/components/fields/DatePicker/TimeInput.js.map +1 -1
- package/dist/components/fields/DatePicker/WeekPicker.js +1 -1
- package/dist/components/fields/DatePicker/YearPicker.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/period.js +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/utils.js +1 -1
- package/dist/components/fields/FileInput/FileInput.d.ts +0 -1
- package/dist/components/fields/FileInput/FileInput.js +207 -185
- package/dist/components/fields/FileInput/FileInput.js.map +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +3 -3
- package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
- package/dist/components/fields/FilterListBox/styled.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.d.ts +0 -3
- package/dist/components/fields/FilterPicker/FilterPicker.js +8 -8
- package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
- package/dist/components/fields/FilterPicker/FilterTree.js +2 -2
- package/dist/components/fields/FilterPicker/FilterTree.js.map +1 -1
- package/dist/components/fields/Input/Input.d.ts +0 -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 +1 -1
- package/dist/components/fields/ListBox/ListBox.js +4 -4
- package/dist/components/fields/ListBox/ListBox.js.map +1 -1
- package/dist/components/fields/ListBox/optionId.js +1 -1
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +2 -2
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js.map +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js.map +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +2 -2
- package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/fields/Picker/Picker.d.ts +0 -2
- package/dist/components/fields/Picker/Picker.js +8 -8
- package/dist/components/fields/Picker/Picker.js.map +1 -1
- package/dist/components/fields/RadioGroup/Radio.d.ts +0 -1
- package/dist/components/fields/RadioGroup/Radio.js +3 -5
- package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.d.ts +0 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +3 -3
- package/dist/components/fields/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.d.ts +0 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.js +6 -6
- package/dist/components/fields/SearchComboBox/SearchComboBox.js.map +1 -1
- package/dist/components/fields/SearchInput/SearchInput.js +2 -2
- package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
- package/dist/components/fields/Select/Select.d.ts +1 -2
- package/dist/components/fields/Select/Select.js +7 -7
- package/dist/components/fields/Select/Select.js.map +1 -1
- package/dist/components/fields/Slider/Gradation.js +1 -1
- package/dist/components/fields/Slider/HueSlider.js +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- 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 +1 -1
- package/dist/components/fields/Slider/SliderThumb.js.map +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +1 -1
- package/dist/components/fields/Slider/SliderTrack.js.map +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/index.js +2 -2
- package/dist/components/fields/Slider/types.d.ts +0 -1
- package/dist/components/fields/Switch/Switch.d.ts +0 -1
- package/dist/components/fields/Switch/Switch.js +3 -3
- package/dist/components/fields/Switch/Switch.js.map +1 -1
- package/dist/components/fields/TagInput/TagInput.js +5 -5
- package/dist/components/fields/TagInput/TagInput.js.map +1 -1
- package/dist/components/fields/TagInput/TagList.js +1 -1
- package/dist/components/fields/TagInput/TagList.js.map +1 -1
- package/dist/components/fields/TagInput/useActiveOption.js +1 -1
- package/dist/components/fields/TagInput/useTagError.js +1 -1
- package/dist/components/fields/TextArea/TextArea.js +2 -2
- package/dist/components/fields/TextArea/TextArea.js.map +1 -1
- package/dist/components/fields/TextInput/TextInput.js +2 -2
- package/dist/components/fields/TextInput/TextInput.js.map +1 -1
- package/dist/components/fields/TextInput/TextInputBase.d.ts +0 -1
- package/dist/components/fields/TextInput/TextInputBase.js +3 -3
- package/dist/components/fields/TextInput/TextInputBase.js.map +1 -1
- package/dist/components/fields/TextInput/displayed-validation.js +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.d.ts +0 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +3 -3
- package/dist/components/fields/TextInputMapper/TextInputMapper.js.map +1 -1
- package/dist/components/fields/TriggerActions.js +1 -1
- package/dist/components/fields/color/ColorPanel.js +1 -1
- package/dist/components/fields/color/ColorPanel.js.map +1 -1
- package/dist/components/fields/color/channels.js +1 -1
- package/dist/components/fields/color/color.js +1 -1
- package/dist/components/fields/color/context.js +1 -1
- package/dist/components/fields/index.d.ts +2 -2
- package/dist/components/fields/option-origin-press.js +1 -1
- package/dist/components/form/FieldWrapper/FieldWrapper.js +2 -2
- package/dist/components/form/FieldWrapper/FieldWrapper.js.map +1 -1
- package/dist/components/form/FieldWrapper/field-description.js +1 -1
- package/dist/components/form/FieldWrapper/types.d.ts +0 -1
- package/dist/components/form/Form/Field.d.ts +0 -1
- package/dist/components/form/Form/Field.js +3 -3
- package/dist/components/form/Form/Field.js.map +1 -1
- package/dist/components/form/Form/Form.d.ts +1 -26
- package/dist/components/form/Form/Form.js +7 -116
- package/dist/components/form/Form/Form.js.map +1 -1
- package/dist/components/form/Form/FormContext.d.ts +30 -0
- package/dist/components/form/Form/FormContext.js +79 -0
- package/dist/components/form/Form/FormContext.js.map +1 -0
- package/dist/components/form/Form/FormElement.js +49 -0
- package/dist/components/form/Form/FormElement.js.map +1 -0
- package/dist/components/form/Form/ModernFormRoot.js +3 -2
- package/dist/components/form/Form/ModernFormRoot.js.map +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +2 -2
- package/dist/components/form/Form/ResetButton/ResetButton.js.map +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +2 -2
- package/dist/components/form/Form/SubmitButton/SubmitButton.js.map +1 -1
- package/dist/components/form/Form/SubmitError.d.ts +0 -1
- package/dist/components/form/Form/SubmitError.js +3 -3
- package/dist/components/form/Form/SubmitError.js.map +1 -1
- package/dist/components/form/Form/backend.js +1 -1
- package/dist/components/form/Form/index.d.ts +2 -1
- package/dist/components/form/Form/index.js +6 -5
- package/dist/components/form/Form/index.js.map +1 -1
- package/dist/components/form/Form/modern/actions.js +1 -1
- package/dist/components/form/Form/modern/context.js +1 -1
- package/dist/components/form/Form/modern/controller.js +1 -1
- package/dist/components/form/Form/modern/field-binding.js +1 -1
- package/dist/components/form/Form/modern/field.js +1 -1
- package/dist/components/form/Form/modern/react.js +1 -1
- package/dist/components/form/Form/modern/store.js +1 -1
- package/dist/components/form/Form/modern/validation.js +1 -1
- package/dist/components/form/Form/modern/values.js +1 -1
- package/dist/components/form/Form/reset-unbound-controls.js +1 -1
- package/dist/components/form/Form/use-field/types.d.ts +0 -1
- package/dist/components/form/Form/use-field/use-field-binding.js +2 -2
- package/dist/components/form/Form/use-field/use-field-props.js +4 -4
- package/dist/components/form/Form/use-field/use-field-props.js.map +1 -1
- package/dist/components/form/Form/use-field/use-field.d.ts +0 -1
- package/dist/components/form/Form/use-field/use-field.js +2 -2
- package/dist/components/form/Form/use-field/use-field.js.map +1 -1
- package/dist/components/form/Form/use-form.js +1 -1
- package/dist/components/form/Form/validation.js +1 -1
- package/dist/components/form/Label.d.ts +0 -1
- package/dist/components/form/Label.js +1 -1
- package/dist/components/form/Label.js.map +1 -1
- package/dist/components/form/field-chrome.js +1 -1
- package/dist/components/form/field-layout.js +1 -1
- package/dist/components/form/field-layout.js.map +1 -1
- package/dist/components/form/index.d.ts +2 -1
- package/dist/components/form/legacy-tooltip.js +1 -1
- package/dist/components/form/validation/ValidationIndicator.d.ts +0 -1
- package/dist/components/form/validation/ValidationIndicator.js +1 -1
- package/dist/components/form/validation/ValidationIndicator.js.map +1 -1
- package/dist/components/form/validation/resolve-validation-props.d.ts +0 -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 +1 -1
- package/dist/components/form/validation/use-validation-props.js.map +1 -1
- package/dist/components/form/wrapper.d.ts +0 -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 +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
- package/dist/components/layout/Flex.js +1 -1
- package/dist/components/layout/Flow.js +1 -1
- package/dist/components/layout/Grid.js +1 -1
- package/dist/components/layout/Panel.js +1 -1
- package/dist/components/layout/Prefix.js +1 -1
- package/dist/components/layout/Prefix.js.map +1 -1
- package/dist/components/layout/ResizablePanel.js +2 -2
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/layout/Suffix.js.map +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +3 -3
- package/dist/components/navigation/Pagination/Pagination.js.map +1 -1
- package/dist/components/navigation/Pagination/use-pagination.js +1 -1
- package/dist/components/navigation/Pagination/use-pagination.js.map +1 -1
- package/dist/components/navigation/Tabs/BoardDragActiveProvider.js +1 -1
- package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +4 -4
- package/dist/components/navigation/Tabs/TabButton.js.map +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js.map +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +2 -2
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/navigation/Tabs/TabsAction.js +1 -1
- package/dist/components/navigation/Tabs/TabsContext.js +1 -1
- package/dist/components/navigation/Tabs/popover-placement.js +1 -1
- package/dist/components/navigation/Tabs/segmented-styles.js +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.d.ts +2 -2
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
- package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
- package/dist/components/other/Calendar/Calendar.js +1 -1
- package/dist/components/other/Calendar/CalendarCell.js +1 -1
- package/dist/components/other/Calendar/CalendarGrid.js +1 -1
- package/dist/components/other/Calendar/CalendarHeader.js +2 -2
- package/dist/components/other/Calendar/CalendarHeader.js.map +1 -1
- package/dist/components/other/Calendar/CalendarPanel.js +1 -1
- package/dist/components/other/Calendar/CalendarPanel.js.map +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js.map +1 -1
- package/dist/components/other/Calendar/PeriodGrid.js +1 -1
- package/dist/components/other/Calendar/RangeCalendar.js +1 -1
- package/dist/components/other/Calendar/styled.js +1 -1
- package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
- package/dist/components/other/NoDataIcon/NoDataIcon.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialog.js +2 -2
- package/dist/components/overlays/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js.map +1 -1
- package/dist/components/overlays/AlertDialog/types.d.ts +0 -1
- package/dist/components/overlays/Dialog/Dialog.js +2 -2
- package/dist/components/overlays/Dialog/Dialog.js.map +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +2 -2
- package/dist/components/overlays/Dialog/DialogForm.js.map +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.d.ts +0 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +5 -5
- package/dist/components/overlays/Dialog/DialogTrigger.js.map +1 -1
- package/dist/components/overlays/Dialog/ModernDialogForm.js +2 -2
- package/dist/components/overlays/Dialog/ModernDialogForm.js.map +1 -1
- package/dist/components/overlays/Dialog/context.js +1 -1
- package/dist/components/overlays/Dialog/default-button-text.js +1 -1
- package/dist/components/overlays/Dialog/use-content-overflow.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js.map +1 -1
- package/dist/components/overlays/Dialog/use-dialog-open-sync.js +1 -1
- package/dist/components/overlays/Dialog/use-dismiss-confirmation.js +1 -1
- package/dist/components/overlays/Dialog/use-dismiss-confirmation.js.map +1 -1
- package/dist/components/overlays/Dialog/use-retained-dialog-focus.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +2 -2
- 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 +1 -1
- package/dist/components/overlays/Modal/Overlay.js.map +1 -1
- package/dist/components/overlays/Modal/Popover.js +2 -2
- package/dist/components/overlays/Modal/Popover.js.map +1 -1
- package/dist/components/overlays/Modal/Tray.js +2 -2
- package/dist/components/overlays/Modal/Tray.js.map +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Modal/modal-containment.js +1 -1
- package/dist/components/overlays/Notifications/Notification.js +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js.map +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js.map +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js.map +1 -1
- package/dist/components/overlays/Notifications/OverlayContainer.js +2 -2
- package/dist/components/overlays/Notifications/OverlayContainer.js.map +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
- 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/format-relative-time.js +1 -1
- package/dist/components/overlays/Notifications/index.js +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js.map +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js.map +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js.map +1 -1
- package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js.map +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js.map +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +1 -1
- package/dist/components/overlays/Toast/index.js +2 -2
- 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 +2 -2
- package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +20 -7
- package/dist/components/overlays/Tooltip/TooltipProvider.js.map +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.d.ts +1 -0
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +225 -103
- 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/overlays/Tooltip/split-trigger-props.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/portal/PortalProvider.js +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/shared/DraggableCollection.js +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js.map +1 -1
- package/dist/components/status/Spin/Cube.js +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +1 -1
- package/dist/components/status/Spin/Spin.js +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +1 -1
- package/dist/data/item-themes.js +8 -32
- package/dist/data/item-themes.js.map +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/eslint-plugin/defaults.generated.js +1 -1
- package/dist/eslint-plugin/index.js +1 -1
- package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
- package/dist/i18n/I18nProvider.js +1 -1
- package/dist/i18n/createFormatter.js +1 -1
- package/dist/i18n/index.js +4 -4
- package/dist/i18n/instance.js +3 -3
- package/dist/i18n/locales/de-DE/uikit.js +1 -1
- package/dist/i18n/locales/en-US/uikit.js +1 -1
- package/dist/i18n/locales/es-ES/uikit.js +1 -1
- package/dist/i18n/locales/es-MX/uikit.js +1 -1
- package/dist/i18n/locales/fr-FR/uikit.js +1 -1
- package/dist/i18n/locales/it-IT/uikit.js +1 -1
- package/dist/i18n/locales/ja-JP/uikit.js +1 -1
- package/dist/i18n/locales/nb-NO/uikit.js +1 -1
- package/dist/i18n/locales/pt-BR/uikit.js +1 -1
- package/dist/i18n/locales/pt-PT/uikit.js +1 -1
- package/dist/i18n/locales/sv-SE/uikit.js +1 -1
- package/dist/i18n/locales/vi-VN/uikit.js +1 -1
- package/dist/i18n/locales.js +1 -1
- package/dist/i18n/namespace.js +1 -1
- package/dist/i18n/useFormatter.js +1 -1
- package/dist/i18n/useI18n.js +1 -1
- package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
- package/dist/icons/AdjustmentsIcon.js +1 -1
- package/dist/icons/AiIcon.js +1 -1
- package/dist/icons/AreaChartIcon.js +1 -1
- package/dist/icons/ArrowNarrowDownIcon.js +1 -1
- package/dist/icons/ArrowNarrowUpIcon.js +1 -1
- package/dist/icons/BackwardIcon.js +1 -1
- package/dist/icons/BarChartIcon.js +1 -1
- package/dist/icons/BellFilledIcon.js +1 -1
- package/dist/icons/BellIcon.js +1 -1
- package/dist/icons/BooleanIcon.js +1 -1
- package/dist/icons/CalendarEditIcon.js +1 -1
- package/dist/icons/CalendarIcon.js +1 -1
- package/dist/icons/CaretDownIcon.js +1 -1
- package/dist/icons/CaretUpIcon.js +1 -1
- package/dist/icons/ChartAreaStackedIcon.js +1 -1
- package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarGroupedIcon.js +1 -1
- package/dist/icons/ChartBarHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarLineIcon.js +1 -1
- package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBoxPlot2Icon.js +1 -1
- package/dist/icons/ChartBoxPlotIcon.js +1 -1
- package/dist/icons/ChartBubbleIcon.js +1 -1
- package/dist/icons/ChartDonut2Icon.js +1 -1
- package/dist/icons/ChartFunnelIcon.js +1 -1
- package/dist/icons/ChartHeatmapIcon.js +1 -1
- package/dist/icons/ChartKPIIcon.js +1 -1
- package/dist/icons/ChartPie2Icon.js +1 -1
- package/dist/icons/ChartScatterIcon.js +1 -1
- package/dist/icons/CheckCircleFilledIcon.js +1 -1
- package/dist/icons/CheckCircleIcon.js +1 -1
- package/dist/icons/CheckIcon.js +1 -1
- package/dist/icons/CircleFilledIcon.js +1 -1
- package/dist/icons/ClearIcon.js +1 -1
- package/dist/icons/CloseCircleFilledIcon.js +1 -1
- package/dist/icons/CloseCircleIcon.js +1 -1
- package/dist/icons/CloseIcon.js +1 -1
- package/dist/icons/CodeIcon.js +1 -1
- package/dist/icons/ColumnTotalIcon.js +1 -1
- package/dist/icons/CopyIcon.js +1 -1
- package/dist/icons/CountIcon.js +1 -1
- package/dist/icons/CubeIcon.js +1 -1
- package/dist/icons/CubePauseIcon.js +1 -1
- package/dist/icons/CubePlayIcon.js +1 -1
- package/dist/icons/CurrencyDollarIcon.js +1 -1
- package/dist/icons/DangerIcon.js +1 -1
- package/dist/icons/DashboardIcon.js +1 -1
- package/dist/icons/DatabaseIcon.js +1 -1
- package/dist/icons/DecimalDecreaseIcon.js +1 -1
- package/dist/icons/DecimalIncreaseIcon.js +1 -1
- package/dist/icons/DirectionIcon.js +1 -1
- package/dist/icons/DonutIcon.js +1 -1
- package/dist/icons/DownIcon.js +1 -1
- package/dist/icons/EditIcon.js +1 -1
- package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
- package/dist/icons/ExclamationCircleIcon.js +1 -1
- package/dist/icons/ExclamationIcon.js +1 -1
- package/dist/icons/EyeIcon.js +1 -1
- package/dist/icons/EyeInvisibleIcon.js +1 -1
- package/dist/icons/FilterIcon.js +1 -1
- package/dist/icons/FolderFilledIcon.js +1 -1
- package/dist/icons/FolderIcon.js +1 -1
- package/dist/icons/FolderOpenFilledIcon.js +1 -1
- package/dist/icons/FolderOpenIcon.js +1 -1
- package/dist/icons/ForwardIcon.js +1 -1
- package/dist/icons/GripVerticalIcon.js +1 -1
- package/dist/icons/HierarchyIcon.js +1 -1
- package/dist/icons/HierarchyOpenIcon.js +1 -1
- package/dist/icons/Icon.js +1 -1
- package/dist/icons/InfoCircleIcon.js +1 -1
- package/dist/icons/InfoIcon.js +1 -1
- package/dist/icons/KeyIcon.js +1 -1
- package/dist/icons/LeftIcon.js +1 -1
- package/dist/icons/LineChartIcon.js +1 -1
- package/dist/icons/LoadingIcon.js +1 -1
- package/dist/icons/LockFilledIcon.js +1 -1
- package/dist/icons/LockIcon.js +1 -1
- package/dist/icons/MoreIcon.js +1 -1
- package/dist/icons/NotAllowedIcon.js +1 -1
- package/dist/icons/Number123Icon.js +1 -1
- package/dist/icons/NumberIcon.js +1 -1
- package/dist/icons/PauseCircleFilledIcon.js +1 -1
- package/dist/icons/PauseCircleIcon.js +1 -1
- package/dist/icons/PauseIcon.js +1 -1
- package/dist/icons/PercentageIcon.js +1 -1
- package/dist/icons/PieChartIcon.js +1 -1
- package/dist/icons/PipetteIcon.js +1 -1
- package/dist/icons/PlayCircleIcon.js +1 -1
- package/dist/icons/PlayIcon.js +1 -1
- package/dist/icons/PlusIcon.js +1 -1
- package/dist/icons/ProgressBarIcon.js +1 -1
- package/dist/icons/ReloadIcon.js +1 -1
- package/dist/icons/ReportIcon.js +1 -1
- package/dist/icons/ReturnIcon.js +1 -1
- package/dist/icons/RightIcon.js +1 -1
- package/dist/icons/RowTotalsIcon.js +1 -1
- package/dist/icons/SchemeIcon.js +1 -1
- package/dist/icons/SearchIcon.js +1 -1
- package/dist/icons/SemanticQueryIcon.js +1 -1
- package/dist/icons/SettingsIcon.js +1 -1
- package/dist/icons/ShieldFilledIcon.js +1 -1
- package/dist/icons/ShieldIcon.js +1 -1
- package/dist/icons/SlashIcon.js +1 -1
- package/dist/icons/SparklesIcon.js +1 -1
- package/dist/icons/SqlIcon.js +1 -1
- package/dist/icons/StatsIcon.js +1 -1
- package/dist/icons/StopIcon.js +1 -1
- package/dist/icons/StringIcon.js +1 -1
- package/dist/icons/SubtotalsIcon.js +1 -1
- package/dist/icons/SwitchIcon.js +1 -1
- package/dist/icons/TableIcon.js +1 -1
- package/dist/icons/ThumbsDownIcon.js +1 -1
- package/dist/icons/ThumbsUpIcon.js +1 -1
- package/dist/icons/ThunderboltCrossedIcon.js +1 -1
- package/dist/icons/ThunderboltFilledIcon.js +1 -1
- package/dist/icons/ThunderboltIcon.js +1 -1
- package/dist/icons/TimeIcon.js +1 -1
- package/dist/icons/TrashIcon.js +1 -1
- package/dist/icons/UnlockIcon.js +1 -1
- package/dist/icons/UpIcon.js +1 -1
- package/dist/icons/UserGroupIcon.js +1 -1
- package/dist/icons/UserIcon.js +1 -1
- package/dist/icons/UserLockIcon.js +1 -1
- package/dist/icons/ViewIcon.js +1 -1
- package/dist/icons/WarningFilledIcon.js +1 -1
- package/dist/icons/WarningIcon.js +1 -1
- package/dist/icons/wrap-icon.js +1 -1
- package/dist/index.d.ts +29 -27
- package/dist/index.js +69 -69
- package/dist/probe/canonicalize.js +1 -1
- package/dist/probe/css.js +1 -1
- package/dist/probe/index.js +1 -1
- package/dist/provider.js +2 -2
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigation-url.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/providers/use-navigation.js +1 -1
- package/dist/tokens/all-tokens.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/color-seed.js +1 -1
- package/dist/tokens/color-theme.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/lazy-styles.js +1 -1
- package/dist/tokens/legacy-color.js +1 -1
- package/dist/tokens/palette-config.js +1 -1
- package/dist/tokens/palette.js +23 -11
- package/dist/tokens/palette.js.map +1 -1
- package/dist/tokens/resolve.js +2 -2
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/tokens/typography.js +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/dotize.js +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/modules.js +1 -1
- package/dist/utils/promise.js +1 -1
- package/dist/utils/raf.js +1 -1
- package/dist/utils/random.js +1 -1
- package/dist/utils/range.js +1 -1
- package/dist/utils/react/RenderCache.js +1 -1
- package/dist/utils/react/Slots.js +1 -1
- package/dist/utils/react/chain.js +1 -1
- package/dist/utils/react/disabledProps.js +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/index.d.ts +3 -3
- package/dist/utils/react/index.js +13 -13
- package/dist/utils/react/interactions.js +1 -1
- package/dist/utils/react/isTextOnly.js +1 -1
- package/dist/utils/react/mapProps.js +1 -1
- package/dist/utils/react/mergeProps.js +1 -1
- package/dist/utils/react/nullableValue.js +1 -1
- package/dist/utils/react/overlayKeyPropagation.js +1 -1
- package/dist/utils/react/programmaticFocus.js +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.js +1 -1
- package/dist/utils/react/useBufferedValue.js +1 -1
- package/dist/utils/react/useCombinedRefs.js +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +1 -1
- package/dist/utils/react/useEventBus.js +1 -1
- package/dist/utils/react/useId.js +1 -1
- package/dist/utils/react/useIsDarwin.js +1 -1
- package/dist/utils/react/useKeySymbols.js +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLocalStorage.js +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/useOverlayEscapeGuard.js +1 -1
- package/dist/utils/react/useOverlayEscapeGuard.js.map +1 -1
- package/dist/utils/react/usePopoverSync.js +1 -1
- package/dist/utils/react/useQaProps.js +1 -1
- package/dist/utils/react/useScheme.js +1 -1
- package/dist/utils/react/useViewportSize.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js +1 -1
- package/dist/utils/selection.js +1 -1
- package/dist/utils/styles.js +1 -1
- package/dist/utils/tree.js +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/version.js +3 -3
- package/docs/Usage.md +15 -1
- package/docs/components/actions/Button.md +45 -0
- package/docs/components/actions/ButtonSplit.md +1 -1
- package/docs/components/fields/FileInput.md +18 -5
- package/docs/glaze/contrast.mdx +751 -0
- package/docs/glaze/exporting.mdx +635 -0
- package/docs/glaze/getting-started.mdx +487 -0
- package/docs/glaze/hdr.mdx +523 -0
- package/docs/glaze/methodology.mdx +979 -0
- package/docs/glaze/migration.md +476 -285
- package/docs/glaze/mixes.mdx +348 -0
- package/docs/glaze/okhst.mdx +692 -0
- package/docs/glaze/reference/color-definitions.md +552 -0
- package/docs/glaze/reference/color-tokens.md +421 -0
- package/docs/glaze/reference/configuration.md +532 -0
- package/docs/glaze/reference/contrast.md +279 -0
- package/docs/glaze/reference/index.md +225 -0
- package/docs/glaze/reference/output.md +714 -0
- package/docs/glaze/reference/palette.md +435 -0
- package/docs/glaze/reference/theme.md +332 -0
- package/docs/glaze/reference/utilities.md +646 -0
- package/docs/glaze/schemes.mdx +644 -0
- package/docs/glaze/shadows-and-glows.mdx +550 -0
- package/docs/tasty/ai-agents.md +1 -1
- package/docs/tasty/design-system.md +12 -0
- package/docs/tasty/dsl.md +20 -0
- package/docs/tasty/pipeline.md +1 -1
- package/package.json +5 -5
- package/tasty.config.generated.ts +1 -1
- package/dist/components/actions/index.js +0 -29
- package/dist/components/actions/index.js.map +0 -1
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.d.ts +0 -4
- package/dist/components/fields/ListBoxPopover/index.d.ts +0 -5
- package/dist/components/overlays/Modal/Modal.d.ts +0 -3
- package/dist/components/overlays/Modal/Popover.d.ts +0 -7
- package/dist/components/overlays/Modal/Tray.d.ts +0 -5
- package/dist/components/overlays/Modal/Underlay.d.ts +0 -3
- package/dist/components/overlays/Modal/index.d.ts +0 -8
- package/docs/glaze/api.md +0 -2021
- package/docs/glaze/methodology.md +0 -686
- package/docs/glaze/okhst.md +0 -207
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.209.0 | Cube Dev Team */
|
|
2
|
+
import { useLayoutEffect as useLayoutEffect$1 } from "../../../utils/react/useLayoutEffect.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { useEffectEvent, useRef } from "react";
|
|
5
|
+
import { flushSync } from "react-dom";
|
|
6
|
+
//#region src/components/actions/Button/AutoCollapseObserver.tsx
|
|
7
|
+
const rows = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
const pendingRows = /* @__PURE__ */ new Set();
|
|
9
|
+
/**
|
|
10
|
+
* One observer for every row. It watches the rows alone: collapsing changes
|
|
11
|
+
* the buttons' widths but not their row's, so it never reports its own
|
|
12
|
+
* decision back.
|
|
13
|
+
*/
|
|
14
|
+
let rowObserver = null;
|
|
15
|
+
function getRowObserver() {
|
|
16
|
+
rowObserver ??= new ResizeObserver((records) => {
|
|
17
|
+
for (const record of records) scheduleRowCheck(record.target);
|
|
18
|
+
});
|
|
19
|
+
return rowObserver;
|
|
20
|
+
}
|
|
21
|
+
function px(value) {
|
|
22
|
+
return parseFloat(value) || 0;
|
|
23
|
+
}
|
|
24
|
+
function getContentWidth(row) {
|
|
25
|
+
const style = getComputedStyle(row);
|
|
26
|
+
return row.clientWidth - px(style.paddingLeft) - px(style.paddingRight);
|
|
27
|
+
}
|
|
28
|
+
function getLabel(element) {
|
|
29
|
+
return element.querySelector(":scope > [data-element=\"Label\"]");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether a button shows its collapsed form, whichever trigger collapsed it.
|
|
33
|
+
* Read from the styles the collapse applies rather than from widths: a label
|
|
34
|
+
* squeezed to nothing is not collapsed.
|
|
35
|
+
*/
|
|
36
|
+
function isShownCollapsed(element, label) {
|
|
37
|
+
if (element.dataset.collapse === "label") {
|
|
38
|
+
const full = label.querySelector(":scope > [data-element=\"FullLabel\"]");
|
|
39
|
+
return !!full && getComputedStyle(full).display === "none";
|
|
40
|
+
}
|
|
41
|
+
return getComputedStyle(label).maxWidth === "0px";
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* How much wider the row has to be for its expanded buttons to show their
|
|
45
|
+
* labels whole: what their labels cut off, plus what overflows the row. A
|
|
46
|
+
* button another trigger collapsed has no label on show, so it adds nothing.
|
|
47
|
+
*/
|
|
48
|
+
function getShortfall(row, state) {
|
|
49
|
+
let shortfall = Math.max(0, row.scrollWidth - row.clientWidth);
|
|
50
|
+
for (const { element } of state.entries) {
|
|
51
|
+
const label = getLabel(element);
|
|
52
|
+
if (!label || isShownCollapsed(element, label)) continue;
|
|
53
|
+
shortfall += Math.max(0, label.scrollWidth - label.clientWidth);
|
|
54
|
+
}
|
|
55
|
+
return shortfall;
|
|
56
|
+
}
|
|
57
|
+
/** Whether the row's buttons should be collapsed now. */
|
|
58
|
+
function decide(row, state) {
|
|
59
|
+
const width = getContentWidth(row);
|
|
60
|
+
if (state.isStale) state.neededWidth = void 0;
|
|
61
|
+
if (state.isCollapsed) return state.neededWidth !== void 0 && width + .5 < state.neededWidth;
|
|
62
|
+
const shortfall = getShortfall(row, state);
|
|
63
|
+
if (shortfall <= 0) return false;
|
|
64
|
+
state.neededWidth = Math.max(state.neededWidth ?? 0, width + shortfall);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Checks every queued row and applies the decisions in one synchronous render,
|
|
69
|
+
* before paint, as `useAutoTooltip` applies its overflow verdicts. A row that
|
|
70
|
+
* expanded is checked once more, which can only collapse it again.
|
|
71
|
+
*/
|
|
72
|
+
function runRowChecks() {
|
|
73
|
+
const queued = Array.from(pendingRows);
|
|
74
|
+
pendingRows.clear();
|
|
75
|
+
const changes = [];
|
|
76
|
+
const expanded = [];
|
|
77
|
+
for (const row of queued) {
|
|
78
|
+
const state = rows.get(row);
|
|
79
|
+
if (!state || !state.entries.size || !row.isConnected) continue;
|
|
80
|
+
const wasCollapsed = state.isCollapsed;
|
|
81
|
+
const isCollapsed = decide(row, state);
|
|
82
|
+
state.isCollapsed = isCollapsed;
|
|
83
|
+
state.isStale = false;
|
|
84
|
+
if (wasCollapsed && !isCollapsed) expanded.push(row);
|
|
85
|
+
for (const entry of state.entries) if (entry.isCollapsed !== isCollapsed) changes.push([entry, isCollapsed]);
|
|
86
|
+
}
|
|
87
|
+
if (changes.length) flushSync(() => {
|
|
88
|
+
for (const [entry, isCollapsed] of changes) {
|
|
89
|
+
entry.isCollapsed = isCollapsed;
|
|
90
|
+
entry.notify(isCollapsed);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
for (const row of expanded) scheduleRowCheck(row);
|
|
94
|
+
}
|
|
95
|
+
function scheduleRowCheck(row, isStale = false) {
|
|
96
|
+
const state = rows.get(row);
|
|
97
|
+
if (!state) return;
|
|
98
|
+
if (isStale) state.isStale = true;
|
|
99
|
+
if (!pendingRows.size) queueMicrotask(runRowChecks);
|
|
100
|
+
pendingRows.add(row);
|
|
101
|
+
}
|
|
102
|
+
function joinRow(row, element, notify) {
|
|
103
|
+
let state = rows.get(row);
|
|
104
|
+
if (!state) {
|
|
105
|
+
const childObserver = new MutationObserver(() => scheduleRowCheck(row, true));
|
|
106
|
+
state = {
|
|
107
|
+
entries: /* @__PURE__ */ new Set(),
|
|
108
|
+
isCollapsed: false,
|
|
109
|
+
neededWidth: void 0,
|
|
110
|
+
isStale: false,
|
|
111
|
+
childObserver
|
|
112
|
+
};
|
|
113
|
+
rows.set(row, state);
|
|
114
|
+
getRowObserver().observe(row);
|
|
115
|
+
childObserver.observe(row, { childList: true });
|
|
116
|
+
}
|
|
117
|
+
const entry = {
|
|
118
|
+
element,
|
|
119
|
+
notify,
|
|
120
|
+
isCollapsed: false
|
|
121
|
+
};
|
|
122
|
+
const joined = state;
|
|
123
|
+
joined.entries.add(entry);
|
|
124
|
+
scheduleRowCheck(row, true);
|
|
125
|
+
return () => {
|
|
126
|
+
joined.entries.delete(entry);
|
|
127
|
+
if (joined.entries.size) scheduleRowCheck(row, true);
|
|
128
|
+
else {
|
|
129
|
+
rows.delete(row);
|
|
130
|
+
rowObserver?.unobserve(row);
|
|
131
|
+
joined.childObserver.disconnect();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Renders nothing. `Button` mounts it only with `autoCollapse`, so a button
|
|
137
|
+
* without the prop runs none of this.
|
|
138
|
+
*/
|
|
139
|
+
function AutoCollapseObserver(t0) {
|
|
140
|
+
const $ = c(13);
|
|
141
|
+
const { targetRef, contentKey, isLabelCut, onChange } = t0;
|
|
142
|
+
let t1;
|
|
143
|
+
if ($[0] !== onChange) {
|
|
144
|
+
t1 = (isCollapsed) => {
|
|
145
|
+
onChange(isCollapsed);
|
|
146
|
+
};
|
|
147
|
+
$[0] = onChange;
|
|
148
|
+
$[1] = t1;
|
|
149
|
+
} else t1 = $[1];
|
|
150
|
+
const notify = useEffectEvent(t1);
|
|
151
|
+
const rowRef = useRef(null);
|
|
152
|
+
let t2;
|
|
153
|
+
if ($[2] !== notify || $[3] !== targetRef) {
|
|
154
|
+
t2 = () => {
|
|
155
|
+
let leave;
|
|
156
|
+
let isActive = true;
|
|
157
|
+
queueMicrotask(() => {
|
|
158
|
+
const element = targetRef.current;
|
|
159
|
+
const row = element?.parentElement;
|
|
160
|
+
if (!isActive || !element || !row) return;
|
|
161
|
+
rowRef.current = row;
|
|
162
|
+
leave = joinRow(row, element, (isCollapsed_0) => notify(isCollapsed_0));
|
|
163
|
+
});
|
|
164
|
+
return () => {
|
|
165
|
+
isActive = false;
|
|
166
|
+
rowRef.current = null;
|
|
167
|
+
leave?.();
|
|
168
|
+
notify(false);
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
$[2] = notify;
|
|
172
|
+
$[3] = targetRef;
|
|
173
|
+
$[4] = t2;
|
|
174
|
+
} else t2 = $[4];
|
|
175
|
+
let t3;
|
|
176
|
+
if ($[5] !== targetRef) {
|
|
177
|
+
t3 = [targetRef];
|
|
178
|
+
$[5] = targetRef;
|
|
179
|
+
$[6] = t3;
|
|
180
|
+
} else t3 = $[6];
|
|
181
|
+
useLayoutEffect$1(t2, t3);
|
|
182
|
+
let t4;
|
|
183
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
184
|
+
t4 = () => {
|
|
185
|
+
if (rowRef.current) scheduleRowCheck(rowRef.current, true);
|
|
186
|
+
};
|
|
187
|
+
$[7] = t4;
|
|
188
|
+
} else t4 = $[7];
|
|
189
|
+
let t5;
|
|
190
|
+
if ($[8] !== contentKey) {
|
|
191
|
+
t5 = [contentKey];
|
|
192
|
+
$[8] = contentKey;
|
|
193
|
+
$[9] = t5;
|
|
194
|
+
} else t5 = $[9];
|
|
195
|
+
useLayoutEffect$1(t4, t5);
|
|
196
|
+
let t6;
|
|
197
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
198
|
+
t6 = () => {
|
|
199
|
+
if (rowRef.current) scheduleRowCheck(rowRef.current);
|
|
200
|
+
};
|
|
201
|
+
$[10] = t6;
|
|
202
|
+
} else t6 = $[10];
|
|
203
|
+
let t7;
|
|
204
|
+
if ($[11] !== isLabelCut) {
|
|
205
|
+
t7 = [isLabelCut];
|
|
206
|
+
$[11] = isLabelCut;
|
|
207
|
+
$[12] = t7;
|
|
208
|
+
} else t7 = $[12];
|
|
209
|
+
useLayoutEffect$1(t6, t7);
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
213
|
+
export { AutoCollapseObserver };
|
|
214
|
+
|
|
215
|
+
//# sourceMappingURL=AutoCollapseObserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoCollapseObserver.js","names":["RefObject","useEffectEvent","useRef","flushSync","useLayoutEffect","RowEntry","element","HTMLElement","notify","isCollapsed","RowState","entries","Set","neededWidth","isStale","childObserver","MutationObserver","rows","WeakMap","pendingRows","rowObserver","ResizeObserver","getRowObserver","records","record","scheduleRowCheck","target","px","value","parseFloat","getContentWidth","row","style","getComputedStyle","clientWidth","paddingLeft","paddingRight","getLabel","querySelector","isShownCollapsed","label","dataset","collapse","full","display","maxWidth","getShortfall","state","shortfall","Math","max","scrollWidth","decide","width","undefined","runRowChecks","queued","Array","from","clear","changes","expanded","get","size","isConnected","wasCollapsed","push","entry","length","queueMicrotask","add","joinRow","set","observe","childList","joined","delete","unobserve","disconnect","AutoCollapseObserverProps","targetRef","contentKey","isLabelCut","onChange","AutoCollapseObserver","t0","$","_c","t1","rowRef","t2","leave","isActive","current","parentElement","isCollapsed_0","t3","t4","Symbol","for","t5","t6","t7","_c"],"sources":["../../../../src/components/actions/Button/AutoCollapseObserver.tsx"],"sourcesContent":["import { RefObject, useEffectEvent, useRef } from 'react';\nimport { flushSync } from 'react-dom';\n\nimport { useLayoutEffect } from '../../../utils/react/useLayoutEffect';\n\n/**\n * Collapses the `Button`s with `autoCollapse` in a row while the row can't fit\n * them expanded, and expands them once it can. The row is the button's parent\n * element, and its buttons collapse together.\n *\n * The decision reads the buttons, not their siblings:\n *\n * - **Expanded**, the row is too narrow when one of its buttons' labels is cut\n * off, or the row overflows. The row then collapses its buttons, and\n * remembers how wide it would have had to be: its width plus everything that\n * was cut off.\n * - **Collapsed**, the row expands its buttons once it is that wide. The freed\n * width may have gone to a sibling that grows or to an auto margin, so\n * adding up the siblings' widths would never show the row fitting again.\n * - **After expanding**, the row checks again, before paint. If the buttons\n * are cut off after all, they collapse again with the larger width\n * remembered, so the estimate only grows and the decision settles.\n *\n * When something the needed width depends on changes while collapsed (a\n * button's content, a child added or removed), the remembered width is stale:\n * the row expands, checks and collapses again if it has to, all before paint.\n *\n * A row as wide as its content always fits, so its buttons never collapse: its\n * width has to come from its container (a block, `flex: 1`, a fixed width).\n * Wrapping and vertical rows give their buttons room by wrapping or stacking,\n * so their buttons never collapse either.\n */\n\ninterface RowEntry {\n element: HTMLElement;\n notify: (isCollapsed: boolean) => void;\n isCollapsed: boolean;\n}\n\ninterface RowState {\n entries: Set<RowEntry>;\n isCollapsed: boolean;\n /** The row's content width at which its buttons fit expanded. */\n neededWidth: number | undefined;\n /** The needed width may be wrong: try expanded, then check. */\n isStale: boolean;\n /** Children added or removed change what the row needs. */\n childObserver: MutationObserver;\n}\n\nconst rows = new WeakMap<HTMLElement, RowState>();\nconst pendingRows = new Set<HTMLElement>();\n\n/**\n * One observer for every row. It watches the rows alone: collapsing changes\n * the buttons' widths but not their row's, so it never reports its own\n * decision back.\n */\nlet rowObserver: ResizeObserver | null = null;\n\nfunction getRowObserver() {\n rowObserver ??= new ResizeObserver((records) => {\n for (const record of records) {\n scheduleRowCheck(record.target as HTMLElement);\n }\n });\n\n return rowObserver;\n}\n\nfunction px(value: string) {\n return parseFloat(value) || 0;\n}\n\nfunction getContentWidth(row: HTMLElement) {\n const style = getComputedStyle(row);\n\n return row.clientWidth - px(style.paddingLeft) - px(style.paddingRight);\n}\n\nfunction getLabel(element: HTMLElement) {\n return element.querySelector<HTMLElement>(':scope > [data-element=\"Label\"]');\n}\n\n/**\n * Whether a button shows its collapsed form, whichever trigger collapsed it.\n * Read from the styles the collapse applies rather than from widths: a label\n * squeezed to nothing is not collapsed.\n */\nfunction isShownCollapsed(element: HTMLElement, label: HTMLElement) {\n if (element.dataset.collapse === 'label') {\n const full = label.querySelector<HTMLElement>(\n ':scope > [data-element=\"FullLabel\"]',\n );\n\n return !!full && getComputedStyle(full).display === 'none';\n }\n\n return getComputedStyle(label).maxWidth === '0px';\n}\n\n/**\n * How much wider the row has to be for its expanded buttons to show their\n * labels whole: what their labels cut off, plus what overflows the row. A\n * button another trigger collapsed has no label on show, so it adds nothing.\n */\nfunction getShortfall(row: HTMLElement, state: RowState) {\n let shortfall = Math.max(0, row.scrollWidth - row.clientWidth);\n\n for (const { element } of state.entries) {\n const label = getLabel(element);\n\n if (!label || isShownCollapsed(element, label)) continue;\n\n shortfall += Math.max(0, label.scrollWidth - label.clientWidth);\n }\n\n return shortfall;\n}\n\n/** Whether the row's buttons should be collapsed now. */\nfunction decide(row: HTMLElement, state: RowState) {\n const width = getContentWidth(row);\n\n // What the row remembered was measured on content that has since changed.\n if (state.isStale) state.neededWidth = undefined;\n\n if (state.isCollapsed) {\n // Half a pixel of slack for sub-pixel widths, so an exact fit expands.\n return state.neededWidth !== undefined && width + 0.5 < state.neededWidth;\n }\n\n const shortfall = getShortfall(row, state);\n\n if (shortfall <= 0) return false;\n\n state.neededWidth = Math.max(state.neededWidth ?? 0, width + shortfall);\n\n return true;\n}\n\n/**\n * Checks every queued row and applies the decisions in one synchronous render,\n * before paint, as `useAutoTooltip` applies its overflow verdicts. A row that\n * expanded is checked once more, which can only collapse it again.\n */\nfunction runRowChecks() {\n const queued = Array.from(pendingRows);\n\n pendingRows.clear();\n\n const changes: [RowEntry, boolean][] = [];\n const expanded: HTMLElement[] = [];\n\n for (const row of queued) {\n const state = rows.get(row);\n\n if (!state || !state.entries.size || !row.isConnected) continue;\n\n const wasCollapsed = state.isCollapsed;\n const isCollapsed = decide(row, state);\n\n state.isCollapsed = isCollapsed;\n state.isStale = false;\n if (wasCollapsed && !isCollapsed) expanded.push(row);\n\n for (const entry of state.entries) {\n if (entry.isCollapsed !== isCollapsed) changes.push([entry, isCollapsed]);\n }\n }\n\n if (changes.length) {\n flushSync(() => {\n for (const [entry, isCollapsed] of changes) {\n entry.isCollapsed = isCollapsed;\n entry.notify(isCollapsed);\n }\n });\n }\n\n for (const row of expanded) scheduleRowCheck(row);\n}\n\nfunction scheduleRowCheck(row: HTMLElement, isStale = false) {\n const state = rows.get(row);\n\n if (!state) return;\n if (isStale) state.isStale = true;\n if (!pendingRows.size) queueMicrotask(runRowChecks);\n\n pendingRows.add(row);\n}\n\nfunction joinRow(\n row: HTMLElement,\n element: HTMLElement,\n notify: RowEntry['notify'],\n) {\n let state = rows.get(row);\n\n if (!state) {\n const childObserver = new MutationObserver(() =>\n scheduleRowCheck(row, true),\n );\n\n state = {\n entries: new Set(),\n isCollapsed: false,\n neededWidth: undefined,\n isStale: false,\n childObserver,\n };\n rows.set(row, state);\n getRowObserver().observe(row);\n childObserver.observe(row, { childList: true });\n }\n\n const entry: RowEntry = { element, notify, isCollapsed: false };\n const joined = state;\n\n joined.entries.add(entry);\n scheduleRowCheck(row, true);\n\n return () => {\n joined.entries.delete(entry);\n\n if (joined.entries.size) {\n // The row may fit its remaining buttons now.\n scheduleRowCheck(row, true);\n } else {\n rows.delete(row);\n rowObserver?.unobserve(row);\n joined.childObserver.disconnect();\n }\n };\n}\n\nexport interface AutoCollapseObserverProps {\n /** The button element; its parent is the measured row. */\n targetRef: RefObject<HTMLElement | null>;\n /**\n * Changes whenever the button's full width can: its label, short label,\n * icons, size, and whether another trigger collapses it.\n */\n contentKey: string;\n /**\n * Whether the button's label is cut off, from its automatic tooltip. A\n * sibling that grows squeezes the button without resizing the row.\n */\n isLabelCut: boolean;\n onChange: (isCollapsed: boolean) => void;\n}\n\n/**\n * Renders nothing. `Button` mounts it only with `autoCollapse`, so a button\n * without the prop runs none of this.\n */\nexport function AutoCollapseObserver({\n targetRef,\n contentKey,\n isLabelCut,\n onChange,\n}: AutoCollapseObserverProps) {\n const notify = useEffectEvent((isCollapsed: boolean) => {\n onChange(isCollapsed);\n });\n // The row joined. The button's ref can't be read from this child's layout\n // effects: on every update React detaches the button's callback ref before\n // they run and attaches it again only after them.\n const rowRef = useRef<HTMLElement | null>(null);\n\n useLayoutEffect(() => {\n let leave: (() => void) | undefined;\n let isActive = true;\n\n // The button's ref is attached after this child's layout effect, so the\n // row is joined once the commit has finished, still before paint.\n queueMicrotask(() => {\n const element = targetRef.current;\n const row = element?.parentElement;\n\n if (!isActive || !element || !row) return;\n\n rowRef.current = row;\n leave = joinRow(row, element, (isCollapsed) => notify(isCollapsed));\n });\n\n return () => {\n isActive = false;\n rowRef.current = null;\n leave?.();\n notify(false);\n };\n }, [targetRef]);\n\n // What the button needs changed, so what the row remembers may be wrong.\n // Joining checks the row anyway, so before that there is nothing to do.\n useLayoutEffect(() => {\n if (rowRef.current) scheduleRowCheck(rowRef.current, true);\n }, [contentKey]);\n\n // The row didn't resize, but the button may no longer fit it.\n useLayoutEffect(() => {\n if (rowRef.current) scheduleRowCheck(rowRef.current);\n }, [isLabelCut]);\n\n return null;\n}\n"],"mappings":"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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { CubeTooltipProviderProps } from "../../overlays/Tooltip/TooltipProvider.js";
|
|
3
3
|
import { DynamicIcon } from "../../../utils/react/resolveIcon.js";
|
|
4
|
-
import "../../../utils/react/index.js";
|
|
5
4
|
import { CubeActionProps } from "../Action/Action.js";
|
|
6
5
|
import { Mods, Styles } from "@tenphi/tasty";
|
|
6
|
+
import { ReactNode } from "react";
|
|
7
7
|
import { Placement } from "react-aria";
|
|
8
8
|
//#region src/components/actions/Button/Button.d.ts
|
|
9
9
|
/** Known modifiers for Button component */
|
|
@@ -17,6 +17,13 @@ export type ButtonMods = Mods<{
|
|
|
17
17
|
'single-icon'?: boolean;
|
|
18
18
|
'text-only'?: boolean;
|
|
19
19
|
'raw-children'?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Collapsed by `isCollapsed` or `autoCollapse`; `collapseState` collapses
|
|
22
|
+
* through CSS instead.
|
|
23
|
+
*/
|
|
24
|
+
collapsed?: boolean;
|
|
25
|
+
/** What a collapsing button collapses to: its icon, or its `shortLabel`. */
|
|
26
|
+
collapse?: 'icon' | 'label';
|
|
20
27
|
}>;
|
|
21
28
|
export interface CubeButtonProps extends CubeActionProps {
|
|
22
29
|
icon?: DynamicIcon<ButtonMods>;
|
|
@@ -36,6 +43,36 @@ export interface CubeButtonProps extends CubeActionProps {
|
|
|
36
43
|
* A `link` button and the joined edges inside a `Button.Split` keep their own radius.
|
|
37
44
|
*/
|
|
38
45
|
shape?: 'button' | 'card' | 'sharp' | 'pill';
|
|
46
|
+
/**
|
|
47
|
+
* When the button collapses, so it fits a narrow window or container:
|
|
48
|
+
* - `true` - On `@mobile`, a viewport narrower than 920px
|
|
49
|
+
* - a string - Any state or condition, such as `'@compact'`,
|
|
50
|
+
* `'@(page, w < 864px)'` or `'@media(w < 600px)'`. A container condition
|
|
51
|
+
* needs that container around the button.
|
|
52
|
+
*
|
|
53
|
+
* Collapsed, a button with an icon shows only the icon: its label stays its
|
|
54
|
+
* accessible name and shows as its tooltip. A `shortLabel` replaces the label
|
|
55
|
+
* instead. The button collapses when any of `collapseState`, `isCollapsed`
|
|
56
|
+
* and `autoCollapse` says so.
|
|
57
|
+
*/
|
|
58
|
+
collapseState?: boolean | string;
|
|
59
|
+
/**
|
|
60
|
+
* Collapses the button from JavaScript, as `collapseState` does from CSS.
|
|
61
|
+
*/
|
|
62
|
+
isCollapsed?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Collapses the button when the row it sits in, its parent element, can't
|
|
65
|
+
* fit every child at full width, and expands it when the row can. It
|
|
66
|
+
* follows the real width of the labels, so it holds in every locale. The
|
|
67
|
+
* row's width has to come from its own container: a row as wide as its
|
|
68
|
+
* content always fits.
|
|
69
|
+
*/
|
|
70
|
+
autoCollapse?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The label shown while the button is collapsed, beside its icon if it has
|
|
73
|
+
* one. Without it, a collapsed button shows only its icon.
|
|
74
|
+
*/
|
|
75
|
+
shortLabel?: ReactNode;
|
|
39
76
|
/**
|
|
40
77
|
* Tooltip content and configuration:
|
|
41
78
|
* - string: simple tooltip text
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.209.0 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps } from "../../../utils/react/mergeProps.js";
|
|
4
|
-
import { getDisabledElementProps, omitActivationEventProps } from "../../../utils/react/disabledProps.js";
|
|
5
|
-
import { useDismissParentPopover } from "../../../utils/react/usePopoverSync.js";
|
|
6
4
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
7
|
-
import { resolveIcon } from "../../../utils/react/resolveIcon.js";
|
|
8
|
-
import { useWarn } from "../../../_internal/hooks/use-warn.js";
|
|
9
|
-
import { useIsFirstRender } from "../../../_internal/hooks/use-is-first-render.js";
|
|
10
5
|
import { DisplayTransition } from "../../helpers/DisplayTransition/DisplayTransition.js";
|
|
11
6
|
import { useAutoTooltip } from "../../content/use-auto-tooltip.js";
|
|
12
7
|
import { CURRENT_CLEAR_STYLES, CURRENT_LINK_STYLES, CURRENT_OUTLINE_2_STYLES, CURRENT_OUTLINE_STYLES, CURRENT_PRIMARY_STYLES, DANGER_CLEAR_STYLES, DANGER_LINK_STYLES, DANGER_OUTLINE_2_STYLES, DANGER_OUTLINE_STYLES, DANGER_PRIMARY_STYLES, DEFAULT_CLEAR_STYLES, DEFAULT_LINK_STYLES, DEFAULT_OUTLINE_2_STYLES, DEFAULT_OUTLINE_STYLES, DEFAULT_PRIMARY_STYLES, NOTE_CLEAR_STYLES, NOTE_LINK_STYLES, NOTE_OUTLINE_2_STYLES, NOTE_OUTLINE_STYLES, NOTE_PRIMARY_STYLES, SPECIAL_CLEAR_STYLES, SPECIAL_LINK_STYLES, SPECIAL_OUTLINE_STYLES, SPECIAL_PRIMARY_STYLES, SUCCESS_CLEAR_STYLES, SUCCESS_LINK_STYLES, SUCCESS_OUTLINE_2_STYLES, SUCCESS_OUTLINE_STYLES, SUCCESS_PRIMARY_STYLES, WARNING_CLEAR_STYLES, WARNING_LINK_STYLES, WARNING_OUTLINE_2_STYLES, WARNING_OUTLINE_STYLES, WARNING_PRIMARY_STYLES } from "../../../data/item-themes.js";
|
|
13
8
|
import { LoadingIcon } from "../../../icons/LoadingIcon.js";
|
|
9
|
+
import { getDisabledElementProps, omitActivationEventProps } from "../../../utils/react/disabledProps.js";
|
|
14
10
|
import { mergeTooltipFocusProps } from "../../overlays/Tooltip/split-trigger-props.js";
|
|
11
|
+
import { useWarn } from "../../../_internal/hooks/use-warn.js";
|
|
15
12
|
import { useAction } from "../use-action.js";
|
|
13
|
+
import { resolveIcon } from "../../../utils/react/resolveIcon.js";
|
|
16
14
|
import { IconSwitch } from "../../helpers/IconSwitch/IconSwitch.js";
|
|
15
|
+
import { useIsFirstRender } from "../../../_internal/hooks/use-is-first-render.js";
|
|
16
|
+
import { useDismissParentPopover } from "../../../utils/react/usePopoverSync.js";
|
|
17
17
|
import { useButtonSplitContext } from "../ButtonSplit/context.js";
|
|
18
|
+
import { AutoCollapseObserver } from "./AutoCollapseObserver.js";
|
|
18
19
|
import { CONTAINER_STYLES, TEXT_STYLES, mergeStyles, tasty } from "@tenphi/tasty";
|
|
19
20
|
import { Children, forwardRef, isValidElement, useMemo, useRef, useState } from "react";
|
|
20
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
21
22
|
//#region src/components/actions/Button/Button.tsx
|
|
22
23
|
const BUTTON_SIZE_VALUES = [
|
|
23
24
|
"xsmall",
|
|
@@ -63,10 +64,12 @@ const DEFAULT_BUTTON_STYLES = {
|
|
|
63
64
|
"raw-children & !has-icons": "$block-padding $inline-padding $block-padding $inline-padding",
|
|
64
65
|
"type=link": "0"
|
|
65
66
|
},
|
|
67
|
+
"@collapsed": "collapsed",
|
|
66
68
|
width: {
|
|
67
|
-
|
|
69
|
+
_: "min $size",
|
|
68
70
|
"has-icon & has-right-icon": "min ($size * 2 - 2bw)",
|
|
69
71
|
"single-icon": "fixed $size",
|
|
72
|
+
"collapse=icon & @collapsed & !has-right-icon": "fixed $size",
|
|
70
73
|
"type=link": "min 1ch"
|
|
71
74
|
},
|
|
72
75
|
height: {
|
|
@@ -86,7 +89,8 @@ const DEFAULT_BUTTON_STYLES = {
|
|
|
86
89
|
},
|
|
87
90
|
margin: {
|
|
88
91
|
"": 0,
|
|
89
|
-
"@parent(button-split, >) & !:first-child & (type=outline | type=outline-2
|
|
92
|
+
"@parent(button-split, >) & !:first-child & (type=outline | type=outline-2)": "-1bw left",
|
|
93
|
+
"@parent(button-split, >) & !:first-child & type=primary": "1bw left"
|
|
90
94
|
},
|
|
91
95
|
zIndex: {
|
|
92
96
|
"@parent(button-split, >) & :hover": 1,
|
|
@@ -154,12 +158,30 @@ const DEFAULT_BUTTON_STYLES = {
|
|
|
154
158
|
whiteSpace: "nowrap",
|
|
155
159
|
overflow: "hidden",
|
|
156
160
|
textOverflow: "ellipsis",
|
|
157
|
-
width:
|
|
161
|
+
width: {
|
|
162
|
+
_: "0 100%",
|
|
163
|
+
"collapse=icon & @collapsed": "fixed 0px"
|
|
164
|
+
},
|
|
158
165
|
textAlign: "center",
|
|
159
166
|
transition: "theme, padding",
|
|
160
167
|
padding: {
|
|
161
|
-
|
|
162
|
-
"type=link": "0"
|
|
168
|
+
_: "$block-padding $right-padding $block-padding $left-padding",
|
|
169
|
+
"type=link": "0",
|
|
170
|
+
"collapse=icon & @collapsed": 0
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
FullLabel: {
|
|
174
|
+
$: "> Label >",
|
|
175
|
+
hide: {
|
|
176
|
+
"": false,
|
|
177
|
+
"@collapsed": true
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
ShortLabel: {
|
|
181
|
+
$: "> Label >",
|
|
182
|
+
display: {
|
|
183
|
+
_: "none",
|
|
184
|
+
"@collapsed": "inline"
|
|
163
185
|
}
|
|
164
186
|
}
|
|
165
187
|
};
|
|
@@ -205,7 +227,7 @@ const ButtonElement = tasty({
|
|
|
205
227
|
});
|
|
206
228
|
const Button = forwardRef(function Button(allProps, ref) {
|
|
207
229
|
const splitContext = useButtonSplitContext();
|
|
208
|
-
let { type, size: sizeProp, shape, label, children, theme = splitContext?.theme ?? "default", icon: iconProp, rightIcon: rightIconProp, mods, download, tooltip = true, defaultTooltipPlacement = "top", onPress: userOnPress, tokens, ...props } = allProps;
|
|
230
|
+
let { type, size: sizeProp, shape, label, children, theme = splitContext?.theme ?? "default", icon: iconProp, rightIcon: rightIconProp, mods, download, tooltip = true, defaultTooltipPlacement = "top", onPress: userOnPress, tokens, collapseState, isCollapsed, autoCollapse, shortLabel, ...props } = allProps;
|
|
209
231
|
type = type ?? splitContext?.type;
|
|
210
232
|
const size = sizeProp ?? splitContext?.size ?? (type === "link" ? "inline" : "medium");
|
|
211
233
|
const isExplicitlyDisabled = splitContext?.isDisabled || props.isDisabled;
|
|
@@ -228,7 +250,12 @@ const Button = forwardRef(function Button(allProps, ref) {
|
|
|
228
250
|
onPress: wrappedOnPress,
|
|
229
251
|
...label ? { label } : {}
|
|
230
252
|
}, ref);
|
|
231
|
-
const
|
|
253
|
+
const collapseCondition = collapseState === true ? "@mobile" : collapseState || void 0;
|
|
254
|
+
const ownStyles = extractStyles(props, STYLE_PROPS);
|
|
255
|
+
const styles = collapseCondition ? {
|
|
256
|
+
"@collapsed": `collapsed | (${collapseCondition})`,
|
|
257
|
+
...ownStyles
|
|
258
|
+
} : ownStyles;
|
|
232
259
|
const isDisabledElement = actionProps.isDisabled;
|
|
233
260
|
delete actionProps.isDisabled;
|
|
234
261
|
const baseMods = useMemo(() => ({
|
|
@@ -267,6 +294,14 @@ const Button = forwardRef(function Button(allProps, ref) {
|
|
|
267
294
|
const singleIcon = !!((hasLeftIcon && !hasRightSlot || hasRightSlot && !hasLeftIcon) && !hasChildren);
|
|
268
295
|
const hasIcons = hasLeftIcon || hasRightSlot;
|
|
269
296
|
const rawChildren = !!(hasChildren && typeof children !== "string" && !Children.toArray(children).some((child) => typeof child === "string"));
|
|
297
|
+
const isCollapsible = !!collapseCondition || isCollapsed != null || !!autoCollapse;
|
|
298
|
+
const [isAutoCollapsed, setIsAutoCollapsed] = useState(false);
|
|
299
|
+
const isCollapsedByJs = !!isCollapsed || !!autoCollapse && isAutoCollapsed;
|
|
300
|
+
const collapse = !isCollapsible || !hasChildren || rawChildren ? void 0 : shortLabel != null ? "label" : hasLeftSlot ? "icon" : void 0;
|
|
301
|
+
useWarn(isCollapsible && hasChildren && !collapse, {
|
|
302
|
+
key: ["button-nothing-to-collapse", rawChildren],
|
|
303
|
+
args: ["Button:", rawChildren ? "`collapseState`, `isCollapsed` and `autoCollapse` collapse only a text label; this button renders raw children." : "`collapseState`, `isCollapsed` or `autoCollapse` has nothing to collapse. Give the button an `icon` to collapse to, or a `shortLabel`."]
|
|
304
|
+
});
|
|
270
305
|
const [isIconShown, setIsIconShown] = useState(hasLeftIcon);
|
|
271
306
|
const [isRightIconShown, setIsRightIconShown] = useState(hasRightSlot);
|
|
272
307
|
const isFirstRender = useIsFirstRender();
|
|
@@ -280,7 +315,9 @@ const Button = forwardRef(function Button(allProps, ref) {
|
|
|
280
315
|
"single-icon": singleIcon,
|
|
281
316
|
"text-only": !!(hasChildren && typeof children === "string" && !hasIcons),
|
|
282
317
|
"raw-children": rawChildren,
|
|
283
|
-
"has-content": children != null
|
|
318
|
+
"has-content": children != null,
|
|
319
|
+
collapsed: isCollapsedByJs,
|
|
320
|
+
collapse
|
|
284
321
|
}), [
|
|
285
322
|
baseMods,
|
|
286
323
|
children,
|
|
@@ -291,9 +328,11 @@ const Button = forwardRef(function Button(allProps, ref) {
|
|
|
291
328
|
hasChildren,
|
|
292
329
|
rawChildren,
|
|
293
330
|
isIconShown,
|
|
294
|
-
isRightIconShown
|
|
331
|
+
isRightIconShown,
|
|
332
|
+
isCollapsedByJs,
|
|
333
|
+
collapse
|
|
295
334
|
]);
|
|
296
|
-
const { labelProps: finalLabelProps, labelRef, renderWithTooltip, isTooltipActive, isAutoTooltipEnabled } = useAutoTooltip({
|
|
335
|
+
const { labelProps: finalLabelProps, labelRef, renderWithTooltip, isTooltipActive, isAutoTooltipEnabled, isOverflowed } = useAutoTooltip({
|
|
297
336
|
tooltip,
|
|
298
337
|
children,
|
|
299
338
|
labelProps: void 0
|
|
@@ -361,7 +400,13 @@ const Button = forwardRef(function Button(allProps, ref) {
|
|
|
361
400
|
"data-element": "Label",
|
|
362
401
|
...finalLabelProps,
|
|
363
402
|
ref: labelRef,
|
|
364
|
-
children
|
|
403
|
+
children: collapse === "label" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
404
|
+
"data-element": "FullLabel",
|
|
405
|
+
children
|
|
406
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
407
|
+
"data-element": "ShortLabel",
|
|
408
|
+
children: shortLabel
|
|
409
|
+
})] }) : children
|
|
365
410
|
})),
|
|
366
411
|
/* @__PURE__ */ jsx(DisplayTransition, {
|
|
367
412
|
isShown: hasRightSlot,
|
|
@@ -377,7 +422,23 @@ const Button = forwardRef(function Button(allProps, ref) {
|
|
|
377
422
|
children: rightIcon
|
|
378
423
|
})
|
|
379
424
|
})
|
|
380
|
-
})
|
|
425
|
+
}),
|
|
426
|
+
autoCollapse ? /* @__PURE__ */ jsx(AutoCollapseObserver, {
|
|
427
|
+
targetRef: buttonElementRef,
|
|
428
|
+
contentKey: [
|
|
429
|
+
typeof children === "string" ? children : "",
|
|
430
|
+
typeof shortLabel === "string" ? shortLabel : "",
|
|
431
|
+
size,
|
|
432
|
+
collapse,
|
|
433
|
+
hasLeftSlot,
|
|
434
|
+
hasRightSlot,
|
|
435
|
+
isLoading,
|
|
436
|
+
isCollapsed,
|
|
437
|
+
collapseCondition
|
|
438
|
+
].join("|"),
|
|
439
|
+
isLabelCut: isOverflowed,
|
|
440
|
+
onChange: setIsAutoCollapsed
|
|
441
|
+
}) : null
|
|
381
442
|
]
|
|
382
443
|
});
|
|
383
444
|
};
|