@cube-dev/ui-kit 0.201.0 → 0.203.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/README.md +1 -1
- package/dist/CHANGELOG.md +56 -0
- package/dist/README.md +1 -1
- 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-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.js +1 -1
- package/dist/components/GlobalStyles.js +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/HiddenInput.js +2 -1
- package/dist/components/HiddenInput.js.map +1 -1
- package/dist/components/Root.js +1 -1
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.js +1 -1
- package/dist/components/actions/Button/Button.js +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +1 -1
- package/dist/components/actions/ItemActionContext.js +1 -1
- package/dist/components/actions/ItemActionsWrapper.js +1 -1
- package/dist/components/actions/ItemButton/ItemButton.js +1 -1
- package/dist/components/actions/Link/Link.js +1 -1
- package/dist/components/actions/Menu/Menu.js +1 -1
- package/dist/components/actions/Menu/MenuCollectionItem.js +1 -1
- package/dist/components/actions/Menu/MenuItem.js +1 -1
- package/dist/components/actions/Menu/MenuSection.js +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +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/styled.js +1 -1
- package/dist/components/actions/actions-run.js +1 -1
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/use-action.js +1 -1
- package/dist/components/actions/use-anchored-menu.js +1 -1
- package/dist/components/actions/use-context-menu.js +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +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/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.js +1 -1
- package/dist/components/content/Card/Card.js +1 -1
- package/dist/components/content/Content.js +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +1 -1
- package/dist/components/content/Divider/Divider.d.ts +22 -0
- package/dist/components/content/Divider/Divider.js +159 -0
- package/dist/components/content/Divider/Divider.js.map +1 -0
- package/dist/components/content/Footer.js +1 -1
- package/dist/components/content/Header.js +1 -1
- package/dist/components/content/HotKeys/HotKeys.js +1 -1
- package/dist/components/content/InfoBadge/InfoBadge.js +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +1 -1
- package/dist/components/content/Item/Item.js +1 -1
- package/dist/components/content/Item/ItemWithNativeLinks.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- 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/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/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +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/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +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/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 +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Tag/Tag.js +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/Tree/Tree.js +39 -14
- package/dist/components/content/Tree/Tree.js.map +1 -1
- package/dist/components/content/Tree/TreeNode.js +8 -7
- package/dist/components/content/Tree/TreeNode.js.map +1 -1
- package/dist/components/content/Tree/checked-keys.js +158 -0
- package/dist/components/content/Tree/checked-keys.js.map +1 -0
- package/dist/components/content/Tree/rowId.js +16 -0
- package/dist/components/content/Tree/rowId.js.map +1 -0
- package/dist/components/content/Tree/styled.js +1 -1
- package/dist/components/content/Tree/tree-index.js +10 -2
- package/dist/components/content/Tree/tree-index.js.map +1 -1
- package/dist/components/content/Tree/types.d.ts +21 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +17 -123
- 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/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/data/DataTable/DataTable.js +1 -1
- package/dist/components/data/ItemTable/ItemTable.js +233 -178
- package/dist/components/data/ItemTable/ItemTable.js.map +1 -1
- package/dist/components/data/ItemTable/ItemTableBulkBar.js +1 -1
- package/dist/components/data/ItemTable/ItemTableDragPreview.js +1 -1
- package/dist/components/data/ItemTable/ItemTableFooter.js +1 -1
- package/dist/components/data/ItemTable/ItemTableToolbar.js +1 -1
- package/dist/components/data/ItemTable/index.d.ts +2 -2
- package/dist/components/data/ItemTable/item-table-sections.js +68 -0
- package/dist/components/data/ItemTable/item-table-sections.js.map +1 -0
- package/dist/components/data/ItemTable/types.d.ts +12 -0
- 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 +31 -27
- package/dist/components/data/ItemTable/use-item-table-selection.js.map +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/RowCollection.js +1 -1
- package/dist/components/data/TableBase/TableHeaderCell.js +1 -1
- package/dist/components/data/TableBase/TableRow.js +1 -1
- package/dist/components/data/TableBase/TableRowLink.js +1 -1
- package/dist/components/data/TableBase/TableView.d.ts +1 -0
- package/dist/components/data/TableBase/TableView.js +86 -21
- 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-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 +25 -1
- package/dist/components/data/TableBase/styled.js.map +1 -1
- package/dist/components/data/TableBase/table-body-sections.d.ts +3 -0
- package/dist/components/data/TableBase/table-body-sections.js +30 -0
- package/dist/components/data/TableBase/table-body-sections.js.map +1 -0
- 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-column-menu.js +1 -1
- package/dist/components/data/TableBase/use-column-order.js +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-sort.js +1 -1
- package/dist/components/data/TableBase/use-table-sorts.js +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/index.d.ts +2 -2
- package/dist/components/fields/Checkbox/Checkbox.d.ts +3 -2
- package/dist/components/fields/Checkbox/Checkbox.js +21 -10
- package/dist/components/fields/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.d.ts +3 -2
- package/dist/components/fields/Checkbox/CheckboxGroup.js +36 -42
- 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 +3 -2
- package/dist/components/fields/ColorInput/ColorInput.js +5 -3
- package/dist/components/fields/ColorInput/ColorInput.js.map +1 -1
- package/dist/components/fields/ColorPicker/ColorPicker.d.ts +9 -3
- package/dist/components/fields/ColorPicker/ColorPicker.js +182 -200
- 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 +3 -2
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +143 -171
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -1
- package/dist/components/fields/ComboBox/ComboBox.d.ts +7 -5
- package/dist/components/fields/ComboBox/ComboBox.js +704 -639
- 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.js +5 -4
- 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/DateInput.d.ts +3 -2
- package/dist/components/fields/DatePicker/DateInput.js +6 -5
- package/dist/components/fields/DatePicker/DateInput.js.map +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +79 -76
- package/dist/components/fields/DatePicker/DateInputBase.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePicker.d.ts +3 -2
- package/dist/components/fields/DatePicker/DatePicker.js +84 -173
- package/dist/components/fields/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +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/DatePickerSegment.js +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.d.ts +3 -2
- package/dist/components/fields/DatePicker/DateRangePicker.js +116 -204
- package/dist/components/fields/DatePicker/DateRangePicker.js.map +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.d.ts +3 -2
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +288 -434
- 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 +3 -2
- package/dist/components/fields/DatePicker/PeriodPicker.js +87 -113
- 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 +3 -2
- package/dist/components/fields/DatePicker/TimeInput.js +7 -6
- 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 +3 -2
- package/dist/components/fields/FileInput/FileInput.js +71 -100
- package/dist/components/fields/FileInput/FileInput.js.map +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +10 -65
- package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
- package/dist/components/fields/FilterListBox/styled.js +66 -0
- package/dist/components/fields/FilterListBox/styled.js.map +1 -0
- package/dist/components/fields/FilterPicker/FilterPicker.d.ts +35 -3
- package/dist/components/fields/FilterPicker/FilterPicker.js +76 -15
- package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
- package/dist/components/fields/FilterPicker/FilterTree.js +413 -0
- package/dist/components/fields/FilterPicker/FilterTree.js.map +1 -0
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.d.ts +3 -2
- package/dist/components/fields/ListBox/ListBox.js +7 -10
- 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 +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +40 -21
- package/dist/components/fields/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +52 -37
- package/dist/components/fields/NumberInput/StepButton.js.map +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +5 -3
- package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/fields/Picker/Picker.d.ts +9 -3
- package/dist/components/fields/Picker/Picker.js +12 -11
- package/dist/components/fields/Picker/Picker.js.map +1 -1
- package/dist/components/fields/RadioGroup/Radio.js +152 -154
- package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.d.ts +3 -2
- package/dist/components/fields/RadioGroup/RadioGroup.js +85 -111
- 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.d.ts +9 -4
- package/dist/components/fields/SearchComboBox/SearchComboBox.js +16 -23
- package/dist/components/fields/SearchComboBox/SearchComboBox.js.map +1 -1
- package/dist/components/fields/SearchInput/SearchInput.js +52 -48
- package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
- package/dist/components/fields/Select/Select.d.ts +3 -2
- package/dist/components/fields/Select/Select.js +8 -10
- 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 +19 -26
- package/dist/components/fields/Slider/RangeSlider.js.map +1 -1
- package/dist/components/fields/Slider/Slider.js +51 -58
- package/dist/components/fields/Slider/Slider.js.map +1 -1
- package/dist/components/fields/Slider/SliderBase.js +61 -60
- package/dist/components/fields/Slider/SliderBase.js.map +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Slider/types.d.ts +3 -3
- package/dist/components/fields/Switch/Switch.d.ts +12 -2
- package/dist/components/fields/Switch/Switch.js +97 -165
- package/dist/components/fields/Switch/Switch.js.map +1 -1
- package/dist/components/fields/TagInput/TagInput.d.ts +5 -2
- package/dist/components/fields/TagInput/TagInput.js +18 -13
- package/dist/components/fields/TagInput/TagInput.js.map +1 -1
- package/dist/components/fields/TagInput/TagList.js +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 +5 -3
- package/dist/components/fields/TextArea/TextArea.js.map +1 -1
- package/dist/components/fields/TextInput/TextInput.js +5 -3
- package/dist/components/fields/TextInput/TextInput.js.map +1 -1
- package/dist/components/fields/TextInput/TextInputBase.d.ts +25 -4
- package/dist/components/fields/TextInput/TextInputBase.js +214 -106
- 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/index.d.ts +2 -2
- package/dist/components/fields/TextInput/useAutoSizeTextArea.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/fields/TriggerActions.js +1 -1
- package/dist/components/fields/color/ColorPanel.js +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 +120 -57
- package/dist/components/form/FieldWrapper/FieldWrapper.js.map +1 -1
- package/dist/components/form/FieldWrapper/field-description.js +1 -1
- package/dist/components/form/Form/Field.js +1 -1
- package/dist/components/form/Form/Form.js +1 -1
- package/dist/components/form/Form/ModernFormRoot.js +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
- package/dist/components/form/Form/SubmitError.js +1 -1
- package/dist/components/form/Form/backend.js +1 -1
- package/dist/components/form/Form/index.js +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/use-field-binding.js +1 -1
- package/dist/components/form/Form/use-field/use-field-props.js +1 -1
- package/dist/components/form/Form/use-field/use-field.js +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.js +1 -1
- package/dist/components/form/field-chrome.js +1 -1
- package/dist/components/form/field-chrome.js.map +1 -1
- package/dist/components/form/field-layout.d.ts +20 -0
- package/dist/components/form/field-layout.js +114 -0
- package/dist/components/form/field-layout.js.map +1 -0
- package/dist/components/form/index.d.ts +2 -1
- package/dist/components/form/legacy-tooltip.js +15 -2
- package/dist/components/form/legacy-tooltip.js.map +1 -1
- package/dist/components/form/validation/ValidationIndicator.js +1 -1
- package/dist/components/form/validation/resolve-validation-props.js +1 -1
- package/dist/components/form/validation/use-validation-props.js +1 -1
- package/dist/components/form/wrapper.js +6 -2
- 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/ResizablePanel.js +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +1 -1
- package/dist/components/navigation/Pagination/use-pagination.js +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 +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/Tabs.js +7 -3
- 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/styled.js +18 -18
- package/dist/components/navigation/Tabs/styled.js.map +1 -1
- 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 +1 -1
- package/dist/components/other/Calendar/CalendarPanel.js +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js +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 +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/dist/components/overlays/Dialog/ModernDialogForm.js +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-open-sync.js +1 -1
- package/dist/components/overlays/Dialog/use-retained-dialog-focus.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Tray.js +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/NotificationCard.js +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/OverlayContainer.js +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +2 -2
- 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-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +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-toast-state.js +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +1 -1
- package/dist/components/overlays/Toast/index.js +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js +1 -1
- package/dist/components/overlays/Toast/useToast.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +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/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 +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/eslint-plugin/defaults.generated.js +25 -1
- package/dist/eslint-plugin/defaults.generated.js.map +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 +1 -1
- package/dist/i18n/instance.js +1 -1
- 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 +5 -4
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/probe/canonicalize.js +1 -1
- package/dist/probe/css.js +1 -1
- package/dist/probe/index.js +1 -1
- package/dist/provider.d.ts +5 -0
- package/dist/provider.js +19 -7
- package/dist/provider.js.map +1 -1
- 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/shared/form.d.ts +3 -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 +1 -1
- package/dist/tokens/resolve.js +1 -1
- 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/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 +29 -2
- package/dist/utils/react/disabledProps.js.map +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/index.js +1 -1
- 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 +44 -7
- package/dist/utils/react/overlayKeyPropagation.js.map +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/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 +2 -2
- package/docs/CreateComponent.md +1 -1
- package/docs/FieldProperties.md +29 -7
- package/docs/Usage.md +3 -0
- package/docs/components/content/Divider.md +103 -21
- package/docs/components/content/Tree.md +5 -4
- package/docs/components/data/ItemTable.md +25 -0
- package/docs/components/fields/Checkbox.md +7 -8
- package/docs/components/fields/ColorInput.md +11 -13
- package/docs/components/fields/ColorPicker.md +2 -2
- package/docs/components/fields/ColorSwatchGroup.md +2 -3
- package/docs/components/fields/ComboBox.md +9 -7
- package/docs/components/fields/CommandTextArea.md +4 -5
- package/docs/components/fields/DatePicker.md +1 -4
- package/docs/components/fields/FileInput.md +1 -5
- package/docs/components/fields/FilterListBox.md +0 -3
- package/docs/components/fields/FilterPicker.md +68 -5
- package/docs/components/fields/HueSlider.md +1 -3
- package/docs/components/fields/ListBox.md +0 -3
- package/docs/components/fields/NumberInput.md +9 -6
- package/docs/components/fields/PasswordInput.md +9 -8
- package/docs/components/fields/PeriodPicker.md +0 -4
- package/docs/components/fields/Picker.md +2 -4
- package/docs/components/fields/RadioGroup.md +4 -5
- package/docs/components/fields/SearchComboBox.md +2 -4
- package/docs/components/fields/SearchInput.md +16 -4
- package/docs/components/fields/Select.md +0 -3
- package/docs/components/fields/Slider.md +0 -2
- package/docs/components/fields/Switch.md +16 -3
- package/docs/components/fields/TagInput.md +3 -6
- package/docs/components/fields/TextArea.md +10 -8
- package/docs/components/fields/TextInput.md +52 -10
- package/docs/components/navigation/Tabs.md +47 -0
- package/docs/components/overlays/Tooltip.md +1 -1
- package/package.json +4 -2
- package/dist/components/content/Divider.d.ts +0 -7
- package/dist/components/content/Divider.js +0 -105
- package/dist/components/content/Divider.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.203.0 | Cube Dev Team */
|
|
2
2
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
3
3
|
import { useI18n } from "../../../i18n/useI18n.js";
|
|
4
|
+
import { settleOverlayKey } from "../../../utils/react/overlayKeyPropagation.js";
|
|
4
5
|
import { castNullableNumberValue } from "../../../utils/react/nullableValue.js";
|
|
5
6
|
import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
|
|
6
|
-
import { TextInputBase } from "../TextInput/TextInputBase.js";
|
|
7
|
+
import { TextInputBase as _TextInputBase } from "../TextInput/TextInputBase.js";
|
|
7
8
|
import { useDisplayedValidation } from "../TextInput/displayed-validation.js";
|
|
8
9
|
import { StepButton } from "./StepButton.js";
|
|
9
10
|
import { c } from "react/compiler-runtime";
|
|
@@ -13,7 +14,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
13
14
|
import { mergeProps, useKeyboard, useLocale, useNumberField } from "react-aria";
|
|
14
15
|
import { useNumberFieldState } from "react-stately";
|
|
15
16
|
//#region src/components/fields/NumberInput/NumberInput.tsx
|
|
16
|
-
const StyledTextInputBase = tasty(
|
|
17
|
+
const StyledTextInputBase = tasty(_TextInputBase, { inputStyles: { textAlign: "right" } });
|
|
17
18
|
const StepperContainer = tasty({ styles: {
|
|
18
19
|
display: "grid",
|
|
19
20
|
gridColumns: "1sf",
|
|
@@ -23,7 +24,7 @@ const StepperContainer = tasty({ styles: {
|
|
|
23
24
|
margin: "(.5x - 1bw) left"
|
|
24
25
|
} });
|
|
25
26
|
function NumberInput(rawProps, ref) {
|
|
26
|
-
const $ = c(
|
|
27
|
+
const $ = c(57);
|
|
27
28
|
const { t } = useI18n();
|
|
28
29
|
let t0;
|
|
29
30
|
if ($[0] !== rawProps) {
|
|
@@ -108,6 +109,7 @@ function NumberInput(rawProps, ref) {
|
|
|
108
109
|
event.defaultPrevented = event.isDefaultPrevented();
|
|
109
110
|
if (event.key !== "Enter") event.continuePropagation();
|
|
110
111
|
props.onKeyDown?.(event);
|
|
112
|
+
if (event.isDefaultPrevented()) settleOverlayKey(event);
|
|
111
113
|
};
|
|
112
114
|
$[22] = inputProps;
|
|
113
115
|
$[23] = props;
|
|
@@ -139,13 +141,15 @@ function NumberInput(rawProps, ref) {
|
|
|
139
141
|
direction: "up",
|
|
140
142
|
...incrementButtonProps,
|
|
141
143
|
"aria-label": stepUpLabel,
|
|
142
|
-
size: otherProps.size
|
|
144
|
+
size: otherProps.size,
|
|
145
|
+
isPlain: otherProps.shape === "plain"
|
|
143
146
|
}), /* @__PURE__ */ jsx(StepButton, {
|
|
144
147
|
isDisabled: props.isDisabled,
|
|
145
148
|
direction: "down",
|
|
146
149
|
...decrementButtonProps,
|
|
147
150
|
"aria-label": stepDownLabel,
|
|
148
|
-
size: otherProps.size
|
|
151
|
+
size: otherProps.size,
|
|
152
|
+
isPlain: otherProps.shape === "plain"
|
|
149
153
|
})] }) : void 0;
|
|
150
154
|
const T0 = StyledTextInputBase;
|
|
151
155
|
const t11 = otherProps;
|
|
@@ -172,8 +176,21 @@ function NumberInput(rawProps, ref) {
|
|
|
172
176
|
$[41] = t14;
|
|
173
177
|
} else t14 = $[41];
|
|
174
178
|
let t15;
|
|
175
|
-
if ($[42] !==
|
|
176
|
-
t15 = /* @__PURE__ */ jsx(
|
|
179
|
+
if ($[42] !== props.isDisabled || $[43] !== props.name || $[44] !== state) {
|
|
180
|
+
t15 = props.name ? /* @__PURE__ */ jsx("input", {
|
|
181
|
+
type: "hidden",
|
|
182
|
+
name: props.name,
|
|
183
|
+
value: isNaN(state.numberValue) ? "" : state.numberValue,
|
|
184
|
+
disabled: props.isDisabled
|
|
185
|
+
}) : null;
|
|
186
|
+
$[42] = props.isDisabled;
|
|
187
|
+
$[43] = props.name;
|
|
188
|
+
$[44] = state;
|
|
189
|
+
$[45] = t15;
|
|
190
|
+
} else t15 = $[45];
|
|
191
|
+
let t16;
|
|
192
|
+
if ($[46] !== T0 || $[47] !== groupProps || $[48] !== inputRef || $[49] !== mergedLabelProps || $[50] !== otherProps || $[51] !== ref || $[52] !== t12 || $[53] !== t13 || $[54] !== t14 || $[55] !== t15) {
|
|
193
|
+
t16 = /* @__PURE__ */ jsx(T0, {
|
|
177
194
|
...t11,
|
|
178
195
|
...t12,
|
|
179
196
|
ref,
|
|
@@ -182,20 +199,22 @@ function NumberInput(rawProps, ref) {
|
|
|
182
199
|
inputRef,
|
|
183
200
|
wrapperProps: groupProps,
|
|
184
201
|
suffixPosition: "after",
|
|
185
|
-
suffix: t14
|
|
202
|
+
suffix: t14,
|
|
203
|
+
children: t15
|
|
186
204
|
});
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
|
|
198
|
-
|
|
205
|
+
$[46] = T0;
|
|
206
|
+
$[47] = groupProps;
|
|
207
|
+
$[48] = inputRef;
|
|
208
|
+
$[49] = mergedLabelProps;
|
|
209
|
+
$[50] = otherProps;
|
|
210
|
+
$[51] = ref;
|
|
211
|
+
$[52] = t12;
|
|
212
|
+
$[53] = t13;
|
|
213
|
+
$[54] = t14;
|
|
214
|
+
$[55] = t15;
|
|
215
|
+
$[56] = t16;
|
|
216
|
+
} else t16 = $[56];
|
|
217
|
+
return t16;
|
|
199
218
|
}
|
|
200
219
|
/**
|
|
201
220
|
* NumberFields allow users to enter a number and increment or decrement the value using stepper buttons.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","names":["tasty","ForwardedRef","forwardRef","KeyboardEvent","RefObject","useRef","AriaNumberFieldProps","mergeProps","mergeAriaProps","useKeyboard","useLocale","useNumberField","useNumberFieldState","useI18n","castNullableNumberValue","WithNullableValue","useFieldProps","useDisplayedValidation","CubeTextInputBaseProps","TextInputBase","StepButton","TextInputDOMEvents","FieldBaseProps","TextFieldKeyboardProps","CubeNumberInputProps","Omit","field","hideStepper","suffixPosition","StyledTextInputBase","inputStyles","textAlign","StepperContainer","styles","display","gridColumns","gridRows","flow","placeSelf","margin","NumberInput","rawProps","ref","$","_c","t","t0","t1","Symbol","for","showsValidateErrors","props","suffix","value","defaultValue","onChange","inputRef","labelProps","userLabelProps","inputProps","userInputProps","wrapperProps","otherProps","showStepper","locale","displayedValidation","t2","trackTouched","ariaProps","t3","state","localInputRef","t4","onKeyDown","undefined","onKeyUp","groupProps","ariaGroupProps","incrementButtonProps","decrementButtonProps","validation","HTMLInputElement","t5","fieldLabel","label","t6","incrementAriaLabel","stepUpLabel","t7","decrementAriaLabel","stepDownLabel","t8","event","defaultPrevented","isDefaultPrevented","key","continuePropagation","t9","isDisabled","keyboardProps","t10","mergedLabelProps","steppers","size","T0","t12","getDisplayedValidation","t13","id","t14","t15","_NumberInput","cubeInputType","displayName","_c","mergeProps","mergeAriaProps"],"sources":["../../../../src/components/fields/NumberInput/NumberInput.tsx"],"sourcesContent":["import { tasty } from '@tenphi/tasty';\nimport {\n ForwardedRef,\n forwardRef,\n KeyboardEvent,\n RefObject,\n useRef,\n} from 'react';\nimport {\n AriaNumberFieldProps,\n mergeProps as mergeAriaProps,\n useKeyboard,\n useLocale,\n useNumberField,\n} from 'react-aria';\nimport { useNumberFieldState } from 'react-stately';\n\nimport { useI18n } from '../../../i18n';\nimport { mergeProps } from '../../../utils/react';\nimport {\n castNullableNumberValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { useFieldProps } from '../../form';\nimport { useDisplayedValidation } from '../TextInput/displayed-validation';\nimport {\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\n\nimport { StepButton } from './StepButton';\n\nimport type { TextInputDOMEvents } from '@react-types/shared';\nimport type {\n FieldBaseProps,\n TextFieldKeyboardProps,\n} from '../../../shared/form';\n\nexport interface CubeNumberInputProps\n extends\n Omit<\n CubeTextInputBaseProps,\n | 'defaultValue'\n | 'value'\n | 'onChange'\n | 'field'\n | 'validate'\n | 'onFocus'\n | 'onBlur'\n | keyof TextInputDOMEvents\n >,\n Omit<\n AriaNumberFieldProps,\n 'form' | 'name' | 'errorMessage' | 'onKeyDown' | 'onKeyUp'\n >,\n TextFieldKeyboardProps {\n field?: FieldBaseProps<number | null | undefined>['field'];\n /** Whether or to hide stepper */\n hideStepper?: boolean;\n /**\n * Whether the suffix goes before or after the stepper buttons. Defaults to\n * `before`, so a unit sits next to the number. The validation and loading\n * icons always come before both.\n */\n suffixPosition?: 'before' | 'after';\n}\n\nconst StyledTextInputBase = tasty(TextInputBase, {\n inputStyles: {\n textAlign: 'right',\n },\n});\n\nconst StepperContainer = tasty({\n styles: {\n display: 'grid',\n gridColumns: '1sf',\n gridRows: '1sf 1sf',\n flow: 'column',\n placeSelf: 'stretch',\n margin: '(.5x - 1bw) left',\n },\n});\n\nfunction NumberInput(\n rawProps: WithNullableValue<CubeNumberInputProps>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { t } = useI18n();\n\n // `NaN` is the number field's own empty value.\n rawProps = castNullableNumberValue(rawProps);\n let props = useFieldProps(rawProps, { showsValidateErrors: true });\n\n let {\n hideStepper,\n suffix,\n value,\n defaultValue,\n onChange,\n inputRef,\n labelProps: userLabelProps,\n inputProps: userInputProps,\n wrapperProps,\n ...otherProps\n } = props;\n let showStepper = !hideStepper;\n let { locale } = useLocale();\n // The state commits typed text on blur and Enter, so its `onChange` is the\n // change `validate` sees.\n let displayedValidation = useDisplayedValidation();\n let ariaProps = displayedValidation.trackTouched(props);\n let state = useNumberFieldState({ ...ariaProps, locale });\n let localInputRef = useRef<HTMLInputElement>(null);\n\n inputRef = inputRef ?? localInputRef;\n\n let {\n groupProps: ariaGroupProps,\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n ...validation\n } = useNumberField(\n { ...ariaProps, onKeyDown: undefined, onKeyUp: undefined },\n state,\n inputRef as RefObject<HTMLInputElement>,\n );\n let groupProps = mergeProps(ariaGroupProps, wrapperProps);\n\n // React Aria names each stepper after the field: a text label goes into the\n // name, any other label is composed in through the `aria-labelledby` it sets.\n // The UI Kit strings take the label the same way, so they replace React\n // Aria's own without losing the field name. Without a text label the name\n // has to read on its own, so it has strings of its own rather than an\n // empty `{{label}}` slot.\n let fieldLabel =\n props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let stepUpLabel =\n props.incrementAriaLabel ??\n (fieldLabel\n ? t('numberInput.stepUp', 'Increase {{label}}', { label: fieldLabel })\n : t('numberInput.increase', 'Increase'));\n let stepDownLabel =\n props.decrementAriaLabel ??\n (fieldLabel\n ? t('numberInput.stepDown', 'Decrease {{label}}', { label: fieldLabel })\n : t('numberInput.decrease', 'Decrease'));\n // Keep native commits and user callbacks inside one Aria event wrapper so\n // continuePropagation can still undo the native shortcut's propagation stop.\n let { keyboardProps } = useKeyboard({\n isDisabled: props.isDisabled,\n onKeyDown: (event) => {\n inputProps.onKeyDown?.(event as KeyboardEvent<HTMLInputElement>);\n event.defaultPrevented = event.isDefaultPrevented();\n // NumberInput historically lets every key except Enter reach ancestors.\n if (event.key !== 'Enter') event.continuePropagation();\n props.onKeyDown?.(event);\n },\n onKeyUp: props.onKeyUp,\n });\n\n // Merge user-provided labelProps with aria labelProps\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n const steppers = showStepper ? (\n <StepperContainer>\n <StepButton\n isDisabled={props.isDisabled}\n direction=\"up\"\n {...incrementButtonProps}\n aria-label={stepUpLabel}\n size={otherProps.size}\n />\n <StepButton\n isDisabled={props.isDisabled}\n direction=\"down\"\n {...decrementButtonProps}\n aria-label={stepDownLabel}\n size={otherProps.size}\n />\n </StepperContainer>\n ) : undefined;\n\n return (\n <StyledTextInputBase\n {...otherProps}\n {...displayedValidation.getDisplayedValidation(otherProps, validation)}\n ref={ref}\n labelProps={mergedLabelProps}\n inputProps={mergeProps(\n // `useNumberField` seeds its input id once. Merging the current id\n // through react-aria's own `mergeProps` updates that seed, so the\n // input, its label and the steppers' `aria-controls` follow the id\n // when the form binding changes after mount.\n mergeAriaProps({ ...inputProps, ...keyboardProps }, { id: props.id }),\n { 'data-input-type': 'numberinput' },\n userInputProps,\n )}\n inputRef={inputRef}\n wrapperProps={groupProps}\n // The validation/loading icon always comes first; `suffixPosition`\n // places the suffix against the steppers instead.\n suffixPosition=\"after\"\n suffix={\n showStepper ? (\n props.suffixPosition === 'after' ? (\n <>\n {steppers}\n {suffix}\n </>\n ) : (\n <>\n {suffix}\n {steppers}\n </>\n )\n ) : (\n suffix\n )\n }\n />\n );\n}\n\n/**\n * NumberFields allow users to enter a number and increment or decrement the value using stepper buttons.\n */\nconst _NumberInput = forwardRef(NumberInput);\n\n(_NumberInput as any).cubeInputType = 'Number';\n\n_NumberInput.displayName = 'NumberInput';\n\nexport { _NumberInput as NumberInput };\nexport type { AriaNumberFieldProps };\n"],"mappings":";;;;;;;;;;;;;;;AAmEA,MAAM6B,sBAAsB7B,MAAMmB,eAAe,EAC/CW,aAAa,EACXC,WAAW,QACb,EACF,CAAC;AAED,MAAMC,mBAAmBhC,MAAM,EAC7BiC,QAAQ;CACNC,SAAS;CACTC,aAAa;CACbC,UAAU;CACVC,MAAM;CACNC,WAAW;CACXC,QAAQ;AACV,EAC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A,QAAAmB,cAAAnB,EAAA,QAAAD,OAAAC,EAAA,QAAA8D,OAAA9D,EAAA,QAAAgE,OAAAhE,EAAA,QAAAkE,KAAA;EAlCLC,MAAA,oBAAC,IAAD;GAAoB,GACdhD;GAAU,GACV2C;GACC/D;GACO2D,YAAAA;GACA,YAAAM;GASFnD;GACIoB,cAAAA;GAGC,gBAAA;GAEb,QAAAiC;EAcC,CAAA;EAEHlE,EAAA,MAAA6D;EAAA7D,EAAA,MAAAiC;EAAAjC,EAAA,MAAAa;EAAAb,EAAA,MAAA0D;EAAA1D,EAAA,MAAAmB;EAAAnB,EAAA,MAAAD;EAAAC,EAAA,MAAA8D;EAAA9D,EAAA,MAAAgE;EAAAhE,EAAA,MAAAkE;EAAAlE,EAAA,MAAAmE;CAAA,OAAAA,MAAAnE,EAAA;CAAA,OApCFmE;AAoCE;;;;AAON,MAAMC,eAAe7G,WAAWsC,WAAW;AAE3C,aAAsBwE,gBAAgB;AAEtCD,aAAaE,cAAc"}
|
|
1
|
+
{"version":3,"file":"NumberInput.js","names":["tasty","ForwardedRef","forwardRef","KeyboardEvent","RefObject","useRef","AriaNumberFieldProps","mergeProps","mergeAriaProps","useKeyboard","useLocale","useNumberField","useNumberFieldState","useI18n","castNullableNumberValue","WithNullableValue","settleOverlayKey","useFieldProps","useDisplayedValidation","CubeTextInputBaseProps","TextInputBase","StepButton","TextInputDOMEvents","FieldBaseProps","TextFieldKeyboardProps","CubeNumberInputProps","Omit","field","hideStepper","suffixPosition","StyledTextInputBase","inputStyles","textAlign","StepperContainer","styles","display","gridColumns","gridRows","flow","placeSelf","margin","NumberInput","rawProps","ref","$","_c","t","t0","t1","Symbol","for","showsValidateErrors","props","suffix","value","defaultValue","onChange","inputRef","labelProps","userLabelProps","inputProps","userInputProps","wrapperProps","otherProps","showStepper","locale","displayedValidation","t2","trackTouched","ariaProps","t3","state","localInputRef","t4","onKeyDown","undefined","onKeyUp","groupProps","ariaGroupProps","incrementButtonProps","decrementButtonProps","validation","HTMLInputElement","t5","fieldLabel","label","t6","incrementAriaLabel","stepUpLabel","t7","decrementAriaLabel","stepDownLabel","t8","event","defaultPrevented","isDefaultPrevented","key","continuePropagation","t9","isDisabled","keyboardProps","t10","mergedLabelProps","steppers","size","shape","T0","t12","getDisplayedValidation","t13","id","t14","t15","name","isNaN","numberValue","t16","_NumberInput","cubeInputType","displayName","TextInputBase","_c","mergeProps","mergeAriaProps"],"sources":["../../../../src/components/fields/NumberInput/NumberInput.tsx"],"sourcesContent":["import { tasty } from '@tenphi/tasty';\nimport {\n ForwardedRef,\n forwardRef,\n KeyboardEvent,\n RefObject,\n useRef,\n} from 'react';\nimport {\n AriaNumberFieldProps,\n mergeProps as mergeAriaProps,\n useKeyboard,\n useLocale,\n useNumberField,\n} from 'react-aria';\nimport { useNumberFieldState } from 'react-stately';\n\nimport { useI18n } from '../../../i18n';\nimport { mergeProps } from '../../../utils/react';\nimport {\n castNullableNumberValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { settleOverlayKey } from '../../../utils/react/overlayKeyPropagation';\nimport { useFieldProps } from '../../form';\nimport { useDisplayedValidation } from '../TextInput/displayed-validation';\nimport {\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\n\nimport { StepButton } from './StepButton';\n\nimport type { TextInputDOMEvents } from '@react-types/shared';\nimport type {\n FieldBaseProps,\n TextFieldKeyboardProps,\n} from '../../../shared/form';\n\nexport interface CubeNumberInputProps\n extends\n Omit<\n CubeTextInputBaseProps,\n | 'defaultValue'\n | 'value'\n | 'onChange'\n | 'field'\n | 'validate'\n | 'onFocus'\n | 'onBlur'\n | keyof TextInputDOMEvents\n >,\n Omit<\n AriaNumberFieldProps,\n 'form' | 'name' | 'errorMessage' | 'onKeyDown' | 'onKeyUp'\n >,\n TextFieldKeyboardProps {\n field?: FieldBaseProps<number | null | undefined>['field'];\n /** Whether or to hide stepper */\n hideStepper?: boolean;\n /**\n * Whether the suffix goes before or after the stepper buttons. Defaults to\n * `before`, so a unit sits next to the number. The validation and loading\n * icons always come before both.\n */\n suffixPosition?: 'before' | 'after';\n}\n\nconst StyledTextInputBase = tasty(TextInputBase, {\n inputStyles: {\n textAlign: 'right',\n },\n});\n\nconst StepperContainer = tasty({\n styles: {\n display: 'grid',\n gridColumns: '1sf',\n gridRows: '1sf 1sf',\n flow: 'column',\n placeSelf: 'stretch',\n margin: '(.5x - 1bw) left',\n },\n});\n\nfunction NumberInput(\n rawProps: WithNullableValue<CubeNumberInputProps>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { t } = useI18n();\n\n // `NaN` is the number field's own empty value.\n rawProps = castNullableNumberValue(rawProps);\n let props = useFieldProps(rawProps, { showsValidateErrors: true });\n\n let {\n hideStepper,\n suffix,\n value,\n defaultValue,\n onChange,\n inputRef,\n labelProps: userLabelProps,\n inputProps: userInputProps,\n wrapperProps,\n ...otherProps\n } = props;\n let showStepper = !hideStepper;\n let { locale } = useLocale();\n // The state commits typed text on blur and Enter, so its `onChange` is the\n // change `validate` sees.\n let displayedValidation = useDisplayedValidation();\n let ariaProps = displayedValidation.trackTouched(props);\n let state = useNumberFieldState({ ...ariaProps, locale });\n let localInputRef = useRef<HTMLInputElement>(null);\n\n inputRef = inputRef ?? localInputRef;\n\n let {\n groupProps: ariaGroupProps,\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n ...validation\n } = useNumberField(\n { ...ariaProps, onKeyDown: undefined, onKeyUp: undefined },\n state,\n inputRef as RefObject<HTMLInputElement>,\n );\n let groupProps = mergeProps(ariaGroupProps, wrapperProps);\n\n // React Aria names each stepper after the field: a text label goes into the\n // name, any other label is composed in through the `aria-labelledby` it sets.\n // The UI Kit strings take the label the same way, so they replace React\n // Aria's own without losing the field name. Without a text label the name\n // has to read on its own, so it has strings of its own rather than an\n // empty `{{label}}` slot.\n let fieldLabel =\n props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let stepUpLabel =\n props.incrementAriaLabel ??\n (fieldLabel\n ? t('numberInput.stepUp', 'Increase {{label}}', { label: fieldLabel })\n : t('numberInput.increase', 'Increase'));\n let stepDownLabel =\n props.decrementAriaLabel ??\n (fieldLabel\n ? t('numberInput.stepDown', 'Decrease {{label}}', { label: fieldLabel })\n : t('numberInput.decrease', 'Decrease'));\n // Keep native commits and user callbacks inside one Aria event wrapper so\n // continuePropagation can still undo the native shortcut's propagation stop.\n let { keyboardProps } = useKeyboard({\n isDisabled: props.isDisabled,\n onKeyDown: (event) => {\n inputProps.onKeyDown?.(event as KeyboardEvent<HTMLInputElement>);\n event.defaultPrevented = event.isDefaultPrevented();\n // NumberInput historically lets every key except Enter reach ancestors.\n if (event.key !== 'Enter') event.continuePropagation();\n props.onKeyDown?.(event);\n // Number handling never prevents `Escape` or `Tab`, so a prevented one\n // is the caller's and stops here, as in every other field. An\n // unprevented one already goes on, unless the caller stopped it.\n if (event.isDefaultPrevented()) settleOverlayKey(event);\n },\n onKeyUp: props.onKeyUp,\n });\n\n // Merge user-provided labelProps with aria labelProps\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n const steppers = showStepper ? (\n <StepperContainer>\n <StepButton\n isDisabled={props.isDisabled}\n direction=\"up\"\n {...incrementButtonProps}\n aria-label={stepUpLabel}\n size={otherProps.size}\n isPlain={otherProps.shape === 'plain'}\n />\n <StepButton\n isDisabled={props.isDisabled}\n direction=\"down\"\n {...decrementButtonProps}\n aria-label={stepDownLabel}\n size={otherProps.size}\n isPlain={otherProps.shape === 'plain'}\n />\n </StepperContainer>\n ) : undefined;\n\n return (\n <StyledTextInputBase\n {...otherProps}\n {...displayedValidation.getDisplayedValidation(otherProps, validation)}\n ref={ref}\n labelProps={mergedLabelProps}\n inputProps={mergeProps(\n // `useNumberField` seeds its input id once. Merging the current id\n // through react-aria's own `mergeProps` updates that seed, so the\n // input, its label and the steppers' `aria-controls` follow the id\n // when the form binding changes after mount.\n mergeAriaProps({ ...inputProps, ...keyboardProps }, { id: props.id }),\n { 'data-input-type': 'numberinput' },\n userInputProps,\n )}\n inputRef={inputRef}\n wrapperProps={groupProps}\n // The validation/loading icon always comes first; `suffixPosition`\n // places the suffix against the steppers instead.\n suffixPosition=\"after\"\n suffix={\n showStepper ? (\n props.suffixPosition === 'after' ? (\n <>\n {steppers}\n {suffix}\n </>\n ) : (\n <>\n {suffix}\n {steppers}\n </>\n )\n ) : (\n suffix\n )\n }\n >\n {/* `useNumberField` keeps `name` off the input, whose text is formatted, so a native `<form>` submits the number from here. */}\n {props.name ? (\n <input\n type=\"hidden\"\n name={props.name}\n value={isNaN(state.numberValue) ? '' : state.numberValue}\n disabled={props.isDisabled}\n />\n ) : null}\n </StyledTextInputBase>\n );\n}\n\n/**\n * NumberFields allow users to enter a number and increment or decrement the value using stepper buttons.\n */\nconst _NumberInput = forwardRef(NumberInput);\n\n(_NumberInput as any).cubeInputType = 'Number';\n\n_NumberInput.displayName = 'NumberInput';\n\nexport { _NumberInput as NumberInput };\nexport type { AriaNumberFieldProps };\n"],"mappings":";;;;;;;;;;;;;;;;AAoEA,MAAM8B,sBAAsB9B,MAAMoB,gBAAe,EAC/CW,aAAa,EACXC,WAAW,QACb,EACF,CAAC;AAED,MAAMC,mBAAmBjC,MAAM,EAC7BkC,QAAQ;CACNC,SAAS;CACTC,aAAa;CACbC,UAAU;CACVC,MAAM;CACNC,WAAW;CACXC,QAAQ;AACV,EACF,CAAC;AAED,SAAAC,YAAAC,UAAAC,KAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAIE,MAAA,EAAAC,MAAcjC,QAAQ;CAAE,IAAAkC;CAAA,IAAAH,EAAA,OAAAF,UAAA;EAGbK,KAAAjC,wBAAwB4B,QAAQ;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAA5CF,WAAWA;CAAH,IAAAM;CAAA,IAAAJ,EAAA,OAAAK,OAAAC,IAAA,2BAAA,GAAA;EAC4BF,KAAA,EAAAG,qBAAuB,KAAK;EAACP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EAAA,MAAAoE;CAAA,OAAAA,MAAApE,EAAA;CAAA,IAAAwE;CAAA,IAAAxE,EAAA,QAAA8D,MAAA9D,EAAA,QAAAiC,cAAAjC,EAAA,QAAAa,YAAAb,EAAA,QAAA0D,oBAAA1D,EAAA,QAAAmB,cAAAnB,EAAA,QAAAD,OAAAC,EAAA,QAAA+D,OAAA/D,EAAA,QAAAiE,OAAAjE,EAAA,QAAAmE,OAAAnE,EAAA,QAAAoE,KAAA;EA7CVI,MAAA,oBAAC,IAAD;GAAoB,GACdrD;GAAU,GACV4C;GACChE;GACO2D,YAAAA;GACA,YAAAO;GASFpD;GACIoB,cAAAA;GAGC,gBAAA;GAEb,QAAAkC;GAkBDC,UAAAA;EAtCiB,CAAA;EA8CEpE,EAAA,MAAA8D;EAAA9D,EAAA,MAAAiC;EAAAjC,EAAA,MAAAa;EAAAb,EAAA,MAAA0D;EAAA1D,EAAA,MAAAmB;EAAAnB,EAAA,MAAAD;EAAAC,EAAA,MAAA+D;EAAA/D,EAAA,MAAAiE;EAAAjE,EAAA,MAAAmE;EAAAnE,EAAA,MAAAoE;EAAApE,EAAA,MAAAwE;CAAA,OAAAA,MAAAxE,EAAA;CAAA,OA9CtBwE;AA8CsB;;;;AAO1B,MAAMC,eAAenH,WAAWuC,WAAW;AAE3C,aAAsB6E,gBAAgB;AAEtCD,aAAaE,cAAc"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.203.0 | Cube Dev Team */
|
|
2
2
|
import { Button } from "../../actions/Button/Button.js";
|
|
3
3
|
import { DirectionIcon } from "../../../icons/DirectionIcon.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
@@ -12,7 +12,8 @@ const StepButtonElement = tasty(Button, {
|
|
|
12
12
|
height: "auto",
|
|
13
13
|
radius: {
|
|
14
14
|
"": "0 (1r - 1bw) 0 0",
|
|
15
|
-
down: "0 0 (1r - 1bw) 0"
|
|
15
|
+
down: "0 0 (1r - 1bw) 0",
|
|
16
|
+
plain: 0
|
|
16
17
|
},
|
|
17
18
|
padding: 0,
|
|
18
19
|
$size: "inherit",
|
|
@@ -27,49 +28,63 @@ const StepButtonElement = tasty(Button, {
|
|
|
27
28
|
* Buttons for NumberField. Their names come from `useNumberField`, which
|
|
28
29
|
* `NumberInput` gives the translated labels.
|
|
29
30
|
*/
|
|
30
|
-
function StepButton(
|
|
31
|
-
const $ = c(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
t2 = {
|
|
37
|
-
up: t0,
|
|
38
|
-
down: t1
|
|
39
|
-
};
|
|
31
|
+
function StepButton(t0) {
|
|
32
|
+
const $ = c(14);
|
|
33
|
+
let isPlain;
|
|
34
|
+
let props;
|
|
35
|
+
if ($[0] !== t0) {
|
|
36
|
+
({isPlain, ...props} = t0);
|
|
40
37
|
$[0] = t0;
|
|
41
|
-
$[1] =
|
|
42
|
-
$[2] =
|
|
43
|
-
} else
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
$[1] = isPlain;
|
|
39
|
+
$[2] = props;
|
|
40
|
+
} else {
|
|
41
|
+
isPlain = $[1];
|
|
42
|
+
props = $[2];
|
|
43
|
+
}
|
|
44
|
+
const t1 = props.direction === "up";
|
|
45
|
+
const t2 = props.direction === "down";
|
|
46
|
+
const t3 = !!isPlain;
|
|
49
47
|
let t4;
|
|
50
|
-
if ($[4] !==
|
|
51
|
-
t4 =
|
|
48
|
+
if ($[3] !== t1 || $[4] !== t2 || $[5] !== t3) {
|
|
49
|
+
t4 = {
|
|
50
|
+
up: t1,
|
|
51
|
+
down: t2,
|
|
52
|
+
plain: t3
|
|
53
|
+
};
|
|
54
|
+
$[3] = t1;
|
|
55
|
+
$[4] = t2;
|
|
56
|
+
$[5] = t3;
|
|
57
|
+
$[6] = t4;
|
|
58
|
+
} else t4 = $[6];
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
61
|
+
t5 = { fontSize: "$local-size" };
|
|
62
|
+
$[7] = t5;
|
|
63
|
+
} else t5 = $[7];
|
|
64
|
+
let t6;
|
|
65
|
+
if ($[8] !== props.direction) {
|
|
66
|
+
t6 = /* @__PURE__ */ jsx(DirectionIcon, {
|
|
52
67
|
to: props.direction,
|
|
53
|
-
styles:
|
|
68
|
+
styles: t5
|
|
54
69
|
});
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
57
|
-
} else
|
|
58
|
-
let
|
|
59
|
-
if ($[
|
|
60
|
-
|
|
70
|
+
$[8] = props.direction;
|
|
71
|
+
$[9] = t6;
|
|
72
|
+
} else t6 = $[9];
|
|
73
|
+
let t7;
|
|
74
|
+
if ($[10] !== props || $[11] !== t4 || $[12] !== t6) {
|
|
75
|
+
t7 = /* @__PURE__ */ jsx(StepButtonElement, {
|
|
61
76
|
type: "clear",
|
|
62
|
-
mods:
|
|
77
|
+
mods: t4,
|
|
63
78
|
"data-popover-keep-on-press": true,
|
|
64
79
|
...props,
|
|
65
|
-
children:
|
|
80
|
+
children: t6
|
|
66
81
|
});
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
} else
|
|
72
|
-
return
|
|
82
|
+
$[10] = props;
|
|
83
|
+
$[11] = t4;
|
|
84
|
+
$[12] = t6;
|
|
85
|
+
$[13] = t7;
|
|
86
|
+
} else t7 = $[13];
|
|
87
|
+
return t7;
|
|
73
88
|
}
|
|
74
89
|
//#endregion
|
|
75
90
|
export { StepButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepButton.js","names":["tasty","DirectionIcon","Button","StepButtonElement","type","styles","width","height","radius","down","padding","$size","Icon","StepButton","
|
|
1
|
+
{"version":3,"file":"StepButton.js","names":["tasty","DirectionIcon","Button","StepButtonElement","type","styles","width","height","radius","down","plain","padding","$size","Icon","StepButton","t0","$","_c","isPlain","props","t1","direction","t2","t3","t4","up","t5","Symbol","for","fontSize","t6","t7","_c"],"sources":["../../../../src/components/fields/NumberInput/StepButton.tsx"],"sourcesContent":["import { tasty } from '@tenphi/tasty';\n\nimport { DirectionIcon } from '../../../icons/DirectionIcon';\nimport { Button } from '../../actions/Button/Button';\n\nconst StepButtonElement = tasty(Button, {\n type: 'clear',\n styles: {\n width: '($local-size * 1.25)',\n height: 'auto',\n radius: {\n '': '0 (1r - 1bw) 0 0',\n down: '0 0 (1r - 1bw) 0',\n // A plain field box is square.\n plain: 0,\n },\n padding: 0,\n\n $size: 'inherit',\n '$local-size': '(($size - 2bw) / 2)',\n\n Icon: {\n width: 'auto',\n height: 'auto',\n },\n },\n});\n\n/**\n * Buttons for NumberField. Their names come from `useNumberField`, which\n * `NumberInput` gives the translated labels.\n */\nexport function StepButton({ isPlain, ...props }) {\n return (\n <StepButtonElement\n type=\"clear\"\n mods={{\n up: props.direction === 'up',\n down: props.direction === 'down',\n plain: !!isPlain,\n }}\n // Stepping is an edit, not a choice: a press must not close a popover\n // the field sits in.\n data-popover-keep-on-press\n {...props}\n >\n <DirectionIcon\n to={props.direction}\n styles={{ fontSize: '$local-size' }}\n />\n </StepButtonElement>\n );\n}\n"],"mappings":";;;;;;;AAKA,MAAMG,oBAAoBH,MAAME,QAAQ;CACtCE,MAAM;CACNC,QAAQ;EACNC,OAAO;EACPC,QAAQ;EACRC,QAAQ;GACN,IAAI;GACJC,MAAM;GAENC,OAAO;EACT;EACAC,SAAS;EAETC,OAAO;EACP,eAAe;EAEfC,MAAM;GACJP,OAAO;GACPC,QAAQ;EACV;CACF;AACF,CAAC;;;;;AAMD,SAAOO,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAoB,CAAA,CAAAG,SAAA,GAAAC,SAAAJ;EAAqBC,EAAA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@cube-dev/ui-kit v0.203.0 | Cube Dev Team */
|
|
2
2
|
import { chain } from "../../../utils/react/chain.js";
|
|
3
3
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { useBufferedValue } from "../../../utils/react/useBufferedValue.js";
|
|
@@ -7,9 +7,10 @@ import { ItemAction } from "../../actions/ItemAction/ItemAction.js";
|
|
|
7
7
|
import { useI18n } from "../../../i18n/useI18n.js";
|
|
8
8
|
import { EyeIcon } from "../../../icons/EyeIcon.js";
|
|
9
9
|
import { EyeInvisibleIcon } from "../../../icons/EyeInvisibleIcon.js";
|
|
10
|
+
import { withOverlayKeys } from "../../../utils/react/overlayKeyPropagation.js";
|
|
10
11
|
import { castNullableStringValue } from "../../../utils/react/nullableValue.js";
|
|
11
12
|
import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
|
|
12
|
-
import { TextInputBase } from "../TextInput/TextInputBase.js";
|
|
13
|
+
import { TextInputBase as _TextInputBase } from "../TextInput/TextInputBase.js";
|
|
13
14
|
import { useDisplayedValidation } from "../TextInput/displayed-validation.js";
|
|
14
15
|
import { c } from "react/compiler-runtime";
|
|
15
16
|
import { forwardRef, useRef, useState } from "react";
|
|
@@ -51,6 +52,7 @@ function PasswordInput(rawProps, ref) {
|
|
|
51
52
|
value: buffered.value,
|
|
52
53
|
onChange: buffered.onChange,
|
|
53
54
|
onBlur: chain(rest.onBlur, buffered.reset),
|
|
55
|
+
onKeyDown: withOverlayKeys(rest.onKeyDown),
|
|
54
56
|
type
|
|
55
57
|
}), inputRef);
|
|
56
58
|
let t2;
|
|
@@ -112,7 +114,7 @@ function PasswordInput(rawProps, ref) {
|
|
|
112
114
|
t10 = { paddingRight: "4x" };
|
|
113
115
|
$[18] = t10;
|
|
114
116
|
} else t10 = $[18];
|
|
115
|
-
return /* @__PURE__ */ jsx(
|
|
117
|
+
return /* @__PURE__ */ jsx(_TextInputBase, {
|
|
116
118
|
ref,
|
|
117
119
|
labelProps: mergedLabelProps,
|
|
118
120
|
inputProps: t9,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordInput.js","names":["ForwardedRef","forwardRef","RefObject","useRef","useState","AriaTextFieldProps","useTextField","useI18n","EyeIcon","EyeInvisibleIcon","chain","mergeProps","useBufferedValue","castNullableStringValue","WithNullableValue","ItemAction","ItemActionProvider","useFieldProps","useDisplayedValidation","CubeBufferedValueProps","CubeTextInputBaseProps","TextInputBase","TextFieldKeyboardProps","CubePasswordInputProps","Omit","validate","PasswordInput","rawProps","ref","$","_c","t","t0","t1","Symbol","for","defaultValidationTrigger","showsValidateErrors","valuePropsMapper","_temp","props","type","setType","labelProps","userLabelProps","inputProps","userInputProps","suffix","multiLine","inputRef","propsInputRef","form","isBuffered","rest","localInputRef","buffered","value","onChange","isDisabled","isReadOnly","displayedValidation","validation","trackTouched","onBlur","reset","HTMLInputElement","t2","mergedLabelProps","t3","_temp2","toggleType","t4","t5","t6","t7","t8","wrappedSuffix","t9","t10","paddingRight","getDisplayedValidation","type_0","toString","_PasswordInput","cubeInputType","displayName","_c","mergeProps"],"sources":["../../../../src/components/fields/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, RefObject, useRef, useState } from 'react';\nimport { AriaTextFieldProps, useTextField } from 'react-aria';\n\nimport { useI18n } from '../../../i18n';\nimport { EyeIcon } from '../../../icons/EyeIcon';\nimport { EyeInvisibleIcon } from '../../../icons/EyeInvisibleIcon';\nimport { chain, mergeProps, useBufferedValue } from '../../../utils/react';\nimport {\n castNullableStringValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { ItemAction } from '../../actions/ItemAction/ItemAction';\nimport { ItemActionProvider } from '../../actions/ItemActionContext';\nimport { useFieldProps } from '../../form';\nimport { useDisplayedValidation } from '../TextInput/displayed-validation';\nimport {\n CubeBufferedValueProps,\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\n\nimport type { TextFieldKeyboardProps } from '../../../shared/form';\n\nexport interface CubePasswordInputProps\n extends\n WithNullableValue<Omit<CubeTextInputBaseProps, 'validate'>>,\n CubeBufferedValueProps,\n TextFieldKeyboardProps {\n validate?: AriaTextFieldProps['validate'];\n}\n\nfunction PasswordInput(\n rawProps: CubePasswordInputProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { t } = useI18n();\n\n rawProps = castNullableStringValue(rawProps);\n let props = useFieldProps(rawProps, {\n defaultValidationTrigger: 'onBlur',\n showsValidateErrors: true,\n valuePropsMapper: ({ value, onChange }) => ({\n value: value?.toString() ?? '',\n onChange,\n }),\n });\n\n let [type, setType] = useState('password');\n let {\n labelProps: userLabelProps,\n inputProps: userInputProps,\n suffix,\n multiLine,\n inputRef: propsInputRef,\n // The form instance, not the DOM `form` id `useTextField` forwards.\n form,\n isBuffered,\n ...rest\n } = props;\n let localInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n let inputRef = propsInputRef ?? localInputRef;\n\n // Hold the typed text locally until the controlled value catches up — see `useBufferedValue`.\n let buffered = useBufferedValue(rest.value, rest.onChange, {\n isBuffered,\n isDisabled: rest.isDisabled,\n isReadOnly: rest.isReadOnly,\n });\n\n let displayedValidation = useDisplayedValidation();\n let { labelProps, inputProps, ...validation } = useTextField(\n displayedValidation.trackTouched({\n ...rest,\n value: buffered.value,\n onChange: buffered.onChange,\n onBlur: chain(rest.onBlur, buffered.reset),\n type,\n }),\n inputRef as RefObject<HTMLInputElement | null>,\n );\n\n // Merge user-provided labelProps with aria labelProps\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n const toggleType = () => {\n setType((type) => (type === 'password' ? 'text' : 'password'));\n };\n\n const wrappedSuffix = (\n <>\n {suffix}\n {/*\n The disabled state travels through the provider rather than as a prop on\n the action. Both disable it, but the provider marks the state as\n INHERITED from the field, and `current` paints from the colour it\n inherits — which a disabled field has already faded — so a second fade\n would multiply the two down to roughly a tenth opacity. No `type` is\n passed, so the `context` mod stays off and the toggle keeps its margins.\n */}\n <ItemActionProvider isDisabled={rest.isDisabled}>\n <ItemAction\n // No `type` — the default `current` type inherits the input's own text\n // color, so the toggle follows the field's theme, validation state and\n // disabled state rather than staying opaque against faded text.\n // A toggle button keeps one name and reports its state with\n // `aria-pressed`: pressed means the password is shown.\n tooltip={t('passwordInput.showPassword', 'Show password')}\n aria-pressed={type === 'text'}\n icon={type === 'password' ? <EyeInvisibleIcon /> : <EyeIcon />}\n onPress={toggleType}\n />\n </ItemActionProvider>\n </>\n );\n\n return (\n <TextInputBase\n ref={ref}\n labelProps={mergedLabelProps}\n inputProps={mergeProps(\n inputProps,\n { 'data-input-type': 'passwordinput' },\n userInputProps,\n )}\n inputRef={inputRef}\n inputStyles={{ paddingRight: '4x' }}\n type={type}\n suffixPosition=\"after\"\n suffix={wrappedSuffix}\n multiLine={multiLine}\n {...rest}\n {...displayedValidation.getDisplayedValidation(rest, validation)}\n />\n );\n}\n\n/**\n * PasswordInputs are password inputs that allow users to input passwords or code entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _PasswordInput = forwardRef(PasswordInput);\n\n(_PasswordInput as any).cubeInputType = 'Text';\n_PasswordInput.displayName = 'PasswordInput';\n\nexport { _PasswordInput as PasswordInput };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PasswordInput.js","names":["ForwardedRef","forwardRef","RefObject","useRef","useState","AriaTextFieldProps","useTextField","useI18n","EyeIcon","EyeInvisibleIcon","chain","mergeProps","useBufferedValue","castNullableStringValue","WithNullableValue","withOverlayKeys","ItemAction","ItemActionProvider","useFieldProps","useDisplayedValidation","CubeBufferedValueProps","CubeTextInputBaseProps","TextInputBase","TextFieldKeyboardProps","CubePasswordInputProps","Omit","validate","PasswordInput","rawProps","ref","$","_c","t","t0","t1","Symbol","for","defaultValidationTrigger","showsValidateErrors","valuePropsMapper","_temp","props","type","setType","labelProps","userLabelProps","inputProps","userInputProps","suffix","multiLine","inputRef","propsInputRef","form","isBuffered","rest","localInputRef","buffered","value","onChange","isDisabled","isReadOnly","displayedValidation","validation","trackTouched","onBlur","reset","onKeyDown","HTMLInputElement","t2","mergedLabelProps","t3","_temp2","toggleType","t4","t5","t6","t7","t8","wrappedSuffix","t9","t10","paddingRight","getDisplayedValidation","type_0","toString","_PasswordInput","cubeInputType","displayName","_c","mergeProps","TextInputBase"],"sources":["../../../../src/components/fields/PasswordInput/PasswordInput.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, RefObject, useRef, useState } from 'react';\nimport { AriaTextFieldProps, useTextField } from 'react-aria';\n\nimport { useI18n } from '../../../i18n';\nimport { EyeIcon } from '../../../icons/EyeIcon';\nimport { EyeInvisibleIcon } from '../../../icons/EyeInvisibleIcon';\nimport { chain, mergeProps, useBufferedValue } from '../../../utils/react';\nimport {\n castNullableStringValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { withOverlayKeys } from '../../../utils/react/overlayKeyPropagation';\nimport { ItemAction } from '../../actions/ItemAction/ItemAction';\nimport { ItemActionProvider } from '../../actions/ItemActionContext';\nimport { useFieldProps } from '../../form';\nimport { useDisplayedValidation } from '../TextInput/displayed-validation';\nimport {\n CubeBufferedValueProps,\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\n\nimport type { TextFieldKeyboardProps } from '../../../shared/form';\n\nexport interface CubePasswordInputProps\n extends\n WithNullableValue<Omit<CubeTextInputBaseProps, 'validate'>>,\n CubeBufferedValueProps,\n TextFieldKeyboardProps {\n validate?: AriaTextFieldProps['validate'];\n}\n\nfunction PasswordInput(\n rawProps: CubePasswordInputProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { t } = useI18n();\n\n rawProps = castNullableStringValue(rawProps);\n let props = useFieldProps(rawProps, {\n defaultValidationTrigger: 'onBlur',\n showsValidateErrors: true,\n valuePropsMapper: ({ value, onChange }) => ({\n value: value?.toString() ?? '',\n onChange,\n }),\n });\n\n let [type, setType] = useState('password');\n let {\n labelProps: userLabelProps,\n inputProps: userInputProps,\n suffix,\n multiLine,\n inputRef: propsInputRef,\n // The form instance, not the DOM `form` id `useTextField` forwards.\n form,\n isBuffered,\n ...rest\n } = props;\n let localInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n let inputRef = propsInputRef ?? localInputRef;\n\n // Hold the typed text locally until the controlled value catches up — see `useBufferedValue`.\n let buffered = useBufferedValue(rest.value, rest.onChange, {\n isBuffered,\n isDisabled: rest.isDisabled,\n isReadOnly: rest.isReadOnly,\n });\n\n let displayedValidation = useDisplayedValidation();\n let { labelProps, inputProps, ...validation } = useTextField(\n displayedValidation.trackTouched({\n ...rest,\n value: buffered.value,\n onChange: buffered.onChange,\n onBlur: chain(rest.onBlur, buffered.reset),\n onKeyDown: withOverlayKeys(rest.onKeyDown),\n type,\n }),\n inputRef as RefObject<HTMLInputElement | null>,\n );\n\n // Merge user-provided labelProps with aria labelProps\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n const toggleType = () => {\n setType((type) => (type === 'password' ? 'text' : 'password'));\n };\n\n const wrappedSuffix = (\n <>\n {suffix}\n {/*\n The disabled state travels through the provider rather than as a prop on\n the action. Both disable it, but the provider marks the state as\n INHERITED from the field, and `current` paints from the colour it\n inherits — which a disabled field has already faded — so a second fade\n would multiply the two down to roughly a tenth opacity. No `type` is\n passed, so the `context` mod stays off and the toggle keeps its margins.\n */}\n <ItemActionProvider isDisabled={rest.isDisabled}>\n <ItemAction\n // No `type` — the default `current` type inherits the input's own text\n // color, so the toggle follows the field's theme, validation state and\n // disabled state rather than staying opaque against faded text.\n // A toggle button keeps one name and reports its state with\n // `aria-pressed`: pressed means the password is shown.\n tooltip={t('passwordInput.showPassword', 'Show password')}\n aria-pressed={type === 'text'}\n icon={type === 'password' ? <EyeInvisibleIcon /> : <EyeIcon />}\n onPress={toggleType}\n />\n </ItemActionProvider>\n </>\n );\n\n return (\n <TextInputBase\n ref={ref}\n labelProps={mergedLabelProps}\n inputProps={mergeProps(\n inputProps,\n { 'data-input-type': 'passwordinput' },\n userInputProps,\n )}\n inputRef={inputRef}\n inputStyles={{ paddingRight: '4x' }}\n type={type}\n suffixPosition=\"after\"\n suffix={wrappedSuffix}\n multiLine={multiLine}\n {...rest}\n {...displayedValidation.getDisplayedValidation(rest, validation)}\n />\n );\n}\n\n/**\n * PasswordInputs are password inputs that allow users to input passwords or code entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _PasswordInput = forwardRef(PasswordInput);\n\n(_PasswordInput as any).cubeInputType = 'Text';\n_PasswordInput.displayName = 'PasswordInput';\n\nexport { _PasswordInput as PasswordInput };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCA,SAAA2B,cAAAC,UAAAC,KAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAIE,MAAA,EAAAC,MAAczB,QAAQ;CAAE,IAAA0B;CAAA,IAAAH,EAAA,OAAAF,UAAA;EAEbK,KAAApB,wBAAwBe,QAAQ;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAA5CF,WAAWA;CAAH,IAAAM;CAAA,IAAAJ,EAAA,OAAAK,OAAAC,IAAA,2BAAA,GAAA;EAC4BF,KAAA;GAAAG,0BACR;GAAQC,qBACb;GAAIC,kBACPC;EAIpB;EAACV,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAPD,MAAAW,QAAYvB,cAAcU,UAAUM,EAOnC;CAED,MAAA,CAAAQ,MAAAC,WAAsBvC,SAAS,UAAU;CACzC,MAAA,EAAAwC,YAAAC,gBAAAC,YAAAC,gBAAAC,QAAAC,WAAAC,UAAAC,eAAAC,MAAAC,YAAA,GAAAC,SAUIb;CACJ,MAAAc,gBAAoBpD,OAA+C,IAAI;CACvE,MAAA+C,WAAeC,iBAAAI;CAGf,MAAAC,WAAe5C,iBAAiB0C,KAAIG,OAAQH,KAAII,UAAW;EAAAL;EAAAM,YAE7CL,KAAIK;EAA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ACxCD,eAAeE,cAAc"}
|
|
@@ -6,13 +6,14 @@ import "../../content/Item/index.js";
|
|
|
6
6
|
import { CubeItemButtonProps } from "../../actions/ItemButton/ItemButton.js";
|
|
7
7
|
import "../../actions/index.js";
|
|
8
8
|
import { CubeItemBaseProps as CubeItemProps } from "../../content/Item/Item.js";
|
|
9
|
+
import { FieldLayoutStyleProps } from "../../form/field-layout.js";
|
|
9
10
|
import { CubeListBoxProps, ListBox } from "../ListBox/ListBox.js";
|
|
10
|
-
import { BasePropsWithoutChildren,
|
|
11
|
+
import { BasePropsWithoutChildren, ContainerStyleProps, Styles } from "@tenphi/tasty";
|
|
11
12
|
import { ForwardedRef, MutableRefObject, ReactElement, ReactNode, RefObject } from "react";
|
|
12
13
|
import { Placement } from "react-aria";
|
|
13
14
|
import { ListState, Section } from "react-stately";
|
|
14
15
|
//#region src/components/fields/Picker/Picker.d.ts
|
|
15
|
-
export interface CubePickerProps<T> extends Omit<CubeListBoxProps<T>, 'size' | 'shape' | 'emptyLabel' | 'isFocusWithin'>, Omit<CubeItemProps, 'children' | 'size' | 'tooltip'>, BasePropsWithoutChildren,
|
|
16
|
+
export interface CubePickerProps<T> extends Omit<CubeListBoxProps<T>, 'size' | 'shape' | 'emptyLabel' | 'isFocusWithin'>, Omit<CubeItemProps, 'children' | 'size' | 'tooltip' | keyof ContainerStyleProps>, BasePropsWithoutChildren, FieldLayoutStyleProps, FieldBaseProps<string | number | readonly (string | number)[] | null | undefined>, Pick<CubeItemButtonProps, 'type' | 'theme' | 'icon' | 'rightIcon' | 'prefix' | 'suffix' | 'hotkeys' | 'shape'> {
|
|
16
17
|
/** Accessible name for the picker trigger when there is no visible label. */
|
|
17
18
|
'aria-label'?: string;
|
|
18
19
|
/** Ids of elements that also describe the trigger, beside the displayed value and the field's own description and message. */
|
|
@@ -49,7 +50,12 @@ export interface CubePickerProps<T> extends Omit<CubeListBoxProps<T>, 'size' | '
|
|
|
49
50
|
placement?: Placement;
|
|
50
51
|
/** Minimum padding in pixels between the popover and viewport edges */
|
|
51
52
|
containerPadding?: number;
|
|
52
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Tooltip for the trigger. The info badge next to the field's label is
|
|
55
|
+
* `labelTooltip`.
|
|
56
|
+
*/
|
|
57
|
+
tooltip?: CubeItemProps['tooltip'];
|
|
58
|
+
/** @deprecated Use `tooltip`. */
|
|
53
59
|
triggerTooltip?: CubeItemProps['tooltip'];
|
|
54
60
|
/** Description for the trigger button (separate from field description) */
|
|
55
61
|
triggerDescription?: CubeItemProps['description'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
2
|
-
import {
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.203.0 | Cube Dev Team */
|
|
2
|
+
import { mergeStyleLayers } from "../../../utils/styles.js";
|
|
3
3
|
import { Text as _Text } from "../../content/Text.js";
|
|
4
4
|
import { isTextOnly } from "../../../utils/react/isTextOnly.js";
|
|
5
5
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
@@ -15,23 +15,20 @@ import { Dialog } from "../../overlays/Dialog/Dialog.js";
|
|
|
15
15
|
import { allowOverlayKeysToPropagate } from "../../../utils/react/overlayKeyPropagation.js";
|
|
16
16
|
import { getValidationTheme } from "../../form/validation/resolve-validation-props.js";
|
|
17
17
|
import { getValidationIcon } from "../../form/validation/ValidationIndicator.js";
|
|
18
|
+
import { TRIGGER_TOOLTIP_WARNING } from "../../form/legacy-tooltip.js";
|
|
18
19
|
import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
|
|
19
20
|
import { wrapWithField } from "../../form/wrapper.js";
|
|
21
|
+
import { splitFieldLayout } from "../../form/field-layout.js";
|
|
20
22
|
import { DialogTrigger } from "../../overlays/Dialog/DialogTrigger.js";
|
|
21
23
|
import { ListBox } from "../ListBox/ListBox.js";
|
|
22
24
|
import { TriggerActions } from "../TriggerActions.js";
|
|
23
25
|
import { processSelectionArray } from "../../../utils/selection.js";
|
|
24
|
-
import {
|
|
26
|
+
import { filterBaseProps, tasty } from "@tenphi/tasty";
|
|
25
27
|
import { forwardRef, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
26
28
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
27
29
|
import { FocusScope, mergeProps, useLabel } from "react-aria";
|
|
28
30
|
import { Section, useListState } from "react-stately";
|
|
29
31
|
//#region src/components/fields/Picker/Picker.tsx
|
|
30
|
-
const PROP_STYLES = [
|
|
31
|
-
...BASE_STYLES,
|
|
32
|
-
...OUTER_STYLES,
|
|
33
|
-
...COLOR_STYLES
|
|
34
|
-
];
|
|
35
32
|
const PickerWrapper = tasty({
|
|
36
33
|
qa: "PickerWrapper",
|
|
37
34
|
styles: {
|
|
@@ -56,8 +53,10 @@ const Picker = forwardRef(function Picker(props, ref) {
|
|
|
56
53
|
};
|
|
57
54
|
return fieldProps;
|
|
58
55
|
} });
|
|
59
|
-
let { id, qa, label, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, extra, icon, rightIcon, prefix, suffix, actions, hotkeys, triggerTooltip, triggerDescription, labelStyles, isRequired, necessityIndicator, isInvalid, isValid, isDisabled, isLoading, message, mods: externalMods, description, descriptionPlacement, placeholder, size = "medium", styles, listBoxStyles, popoverStyles, type = "outline", theme = "default", shape, labelSuffix, shouldFocusWrap, children, shouldFlip = true, targetRef, placement = "bottom start", containerPadding = 8, selectedKey, defaultSelectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, onSelectionChange, selectionMode = "single", listStateRef, focusOnHover, showSelectAll, selectAllLabel = t("picker.all", "All"), items, header, footer, headerStyles, footerStyles, triggerStyles, renderSummary, isCheckable, allValueProps, listStyles, optionStyles, sectionStyles, headingStyles, listGap, listRef, disallowEmptySelection, shouldUseVirtualFocus, onEscape, onOptionClick, isClearable, clearLabel, onClear, sortSelectedToTop, onOpenChange, listStateRef: externalListStateRef, ...otherProps } = props;
|
|
60
|
-
|
|
56
|
+
let { id, qa, label, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, extra, icon, rightIcon, prefix, suffix, actions, hotkeys, tooltip, triggerTooltip, triggerDescription, labelStyles, isRequired, necessityIndicator, isInvalid, isValid, isDisabled, isLoading, message, mods: externalMods, description, descriptionPlacement, placeholder, size = "medium", styles, listBoxStyles, popoverStyles, type = "outline", theme = "default", shape, labelSuffix, shouldFocusWrap, children, shouldFlip = true, targetRef, placement = "bottom start", containerPadding = 8, selectedKey, defaultSelectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, onSelectionChange, selectionMode = "single", listStateRef, focusOnHover, showSelectAll, selectAllLabel = t("picker.all", "All"), items, header, footer, headerStyles, footerStyles, triggerStyles, renderSummary, isCheckable, allValueProps, listStyles, optionStyles, sectionStyles, headingStyles, listGap, listRef, disallowEmptySelection, shouldUseVirtualFocus, onEscape, onOptionClick, isClearable, clearLabel, onClear, sortSelectedToTop, onOpenChange, listStateRef: externalListStateRef, ...otherProps } = props;
|
|
57
|
+
const fieldLayout = splitFieldLayout(props);
|
|
58
|
+
styles = fieldLayout.styles;
|
|
59
|
+
useWarn(triggerTooltip !== void 0, TRIGGER_TOOLTIP_WARNING);
|
|
61
60
|
useWarn(isCheckable === false && selectionMode === "single", {
|
|
62
61
|
key: ["picker-checkable-single-mode"],
|
|
63
62
|
args: ["CubeUIKit: isCheckable=false is not recommended in single selection mode as it may confuse users about selection behavior."]
|
|
@@ -279,7 +278,7 @@ const Picker = forwardRef(function Picker(props, ref) {
|
|
|
279
278
|
prefix,
|
|
280
279
|
suffix,
|
|
281
280
|
hotkeys,
|
|
282
|
-
tooltip: triggerTooltip,
|
|
281
|
+
tooltip: tooltip ?? triggerTooltip,
|
|
283
282
|
description: triggerDescription,
|
|
284
283
|
descriptionPlacement,
|
|
285
284
|
styles: triggerStyles,
|
|
@@ -387,6 +386,8 @@ const Picker = forwardRef(function Picker(props, ref) {
|
|
|
387
386
|
});
|
|
388
387
|
return wrapWithField(pickerField, {
|
|
389
388
|
...props,
|
|
389
|
+
...fieldLayout.field,
|
|
390
|
+
tooltip: void 0,
|
|
390
391
|
labelProps: mergeProps(labelProps, props.labelProps)
|
|
391
392
|
});
|
|
392
393
|
});
|