@cube-dev/ui-kit 0.0.0-canary-bef9600 → 0.0.0-canary-e3f8a1a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_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 +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 +11 -5
- package/dist/components/actions/Button/Button.js.map +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 +27 -25
- package/dist/components/actions/ItemAction/ItemAction.js.map +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 -4
- package/dist/components/actions/Menu/styled.js.map +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.d.ts +4 -4
- package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +1 -1
- package/dist/components/content/Divider.js +1 -1
- 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 +3 -3
- package/dist/components/content/Item/Item.js.map +1 -1
- package/dist/components/content/Item/ItemWithNativeLinks.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +7 -3
- package/dist/components/content/ItemBadge/ItemBadge.js.map +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 +28 -15
- package/dist/components/content/Layout/Layout.js.map +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +20 -10
- package/dist/components/content/Layout/LayoutContext.js.map +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +12 -9
- package/dist/components/content/Layout/LayoutFooter.js.map +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.d.ts +14 -14
- 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 +1 -1
- package/dist/components/content/Tree/TreeNode.js +1 -1
- package/dist/components/content/Tree/styled.js +1 -1
- package/dist/components/content/Tree/tree-index.js +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +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 +3 -3
- package/dist/components/content/use-auto-tooltip.js.map +1 -1
- package/dist/components/data/DataTable/DataTable.js +1 -1
- package/dist/components/data/ItemTable/ItemTable.js +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/use-item-table-column-widths.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-drag-drop.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-pagination.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-selection.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-sort.js +1 -1
- package/dist/components/data/ItemTable/use-item-table-tree-model.js +1 -1
- package/dist/components/data/TableBase/ColumnResizer.js +1 -1
- package/dist/components/data/TableBase/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/TableView.js +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 +1 -1
- package/dist/components/data/TableBase/table-tree.js +1 -1
- package/dist/components/data/TableBase/types.js +1 -1
- package/dist/components/data/TableBase/use-cell-selection.js +0 -0
- package/dist/components/data/TableBase/use-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/fields/Checkbox/Checkbox.js +2 -2
- package/dist/components/fields/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +5 -5
- 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.js +1 -1
- package/dist/components/fields/ColorPicker/ColorPicker.js +1 -1
- package/dist/components/fields/ColorSwatch/ColorSwatch.js +1 -1
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +1 -1
- package/dist/components/fields/ComboBox/ComboBox.d.ts +26 -6
- package/dist/components/fields/ComboBox/ComboBox.js +1095 -619
- package/dist/components/fields/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/fields/ComboBox/comboBoxOptions.js +84 -0
- package/dist/components/fields/ComboBox/comboBoxOptions.js.map +1 -0
- package/dist/components/fields/CommandTextArea/CommandTextArea.js +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.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +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.js +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
- package/dist/components/fields/DatePicker/PeriodPicker.js +1 -1
- package/dist/components/fields/DatePicker/QuarterPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +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.js +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
- package/dist/components/fields/Input/Input.d.ts +2 -2
- package/dist/components/fields/Input/Input.js +2 -2
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.d.ts +10 -4
- package/dist/components/fields/ListBox/ListBox.js +293 -143
- 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 +15 -12
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js.map +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.d.ts +0 -1
- package/dist/components/fields/NumberInput/NumberInput.js +136 -128
- package/dist/components/fields/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +38 -48
- package/dist/components/fields/NumberInput/StepButton.js.map +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.d.ts +1 -2
- package/dist/components/fields/PasswordInput/PasswordInput.js +77 -111
- package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/components/fields/Picker/Picker.d.ts +1 -1
- package/dist/components/fields/Picker/Picker.js +8 -3
- package/dist/components/fields/Picker/Picker.js.map +1 -1
- package/dist/components/fields/RadioGroup/Radio.d.ts +8 -8
- package/dist/components/fields/RadioGroup/Radio.js +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/fields/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.js +1 -1
- package/dist/components/fields/SearchInput/SearchInput.d.ts +8 -3
- package/dist/components/fields/SearchInput/SearchInput.js +22 -29
- package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
- package/dist/components/fields/Select/Select.d.ts +12 -1
- package/dist/components/fields/Select/Select.js +365 -207
- 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 +3 -4
- package/dist/components/fields/Slider/RangeSlider.js.map +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- package/dist/components/fields/Slider/SliderBase.js +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/Switch/Switch.js +1 -1
- package/dist/components/fields/TagInput/TagInput.js +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.d.ts +0 -1
- package/dist/components/fields/TextArea/TextArea.js +49 -63
- package/dist/components/fields/TextArea/TextArea.js.map +1 -1
- package/dist/components/fields/TextInput/TextInput.d.ts +1 -1
- package/dist/components/fields/TextInput/TextInput.js +42 -46
- package/dist/components/fields/TextInput/TextInput.js.map +1 -1
- package/dist/components/fields/TextInput/TextInputBase.d.ts +6 -2
- package/dist/components/fields/TextInput/TextInputBase.js +32 -10
- package/dist/components/fields/TextInput/TextInputBase.js.map +1 -1
- package/dist/components/fields/TextInput/displayed-validation.js +50 -0
- package/dist/components/fields/TextInput/displayed-validation.js.map +1 -0
- package/dist/components/fields/TextInput/useAutoSizeTextArea.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +2 -2
- 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 +78 -0
- package/dist/components/fields/option-origin-press.js.map +1 -0
- package/dist/components/form/FieldWrapper/FieldWrapper.js +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/legacy-tooltip.js +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 +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 +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 +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.d.ts +6 -1
- package/dist/components/overlays/AlertDialog/AlertDialog.js +3 -2
- package/dist/components/overlays/AlertDialog/AlertDialog.js.map +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +3 -2
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js.map +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +28 -14
- package/dist/components/overlays/Dialog/Dialog.js.map +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.d.ts +7 -3
- package/dist/components/overlays/Dialog/DialogTrigger.js +149 -132
- package/dist/components/overlays/Dialog/DialogTrigger.js.map +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 +83 -0
- package/dist/components/overlays/Dialog/use-dialog-open-sync.js.map +1 -0
- 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 +3 -2
- package/dist/components/overlays/Modal/Overlay.js.map +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Popover.js.map +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 +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.d.ts +8 -0
- package/dist/components/overlays/Tooltip/Tooltip.js +16 -22
- package/dist/components/overlays/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.d.ts +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +163 -113
- package/dist/components/overlays/Tooltip/TooltipTrigger.js.map +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/overlays/Tooltip/context.js.map +1 -1
- package/dist/components/overlays/Tooltip/split-trigger-props.js +6 -5
- package/dist/components/overlays/Tooltip/split-trigger-props.js.map +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 +11 -17
- 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 +6 -4
- package/dist/i18n/locales/en-US/uikit.js +6 -4
- package/dist/i18n/locales/en-US/uikit.json.d.ts +3 -1
- package/dist/i18n/locales/es-ES/uikit.js +6 -4
- package/dist/i18n/locales/es-MX/uikit.js +6 -4
- package/dist/i18n/locales/fr-FR/uikit.js +6 -4
- package/dist/i18n/locales/it-IT/uikit.js +6 -4
- package/dist/i18n/locales/ja-JP/uikit.js +6 -4
- package/dist/i18n/locales/nb-NO/uikit.js +6 -4
- package/dist/i18n/locales/pt-BR/uikit.js +6 -4
- package/dist/i18n/locales/pt-PT/uikit.js +6 -4
- package/dist/i18n/locales/sv-SE/uikit.js +6 -4
- package/dist/i18n/locales/vi-VN/uikit.js +6 -4
- 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 +1 -1
- package/dist/index.js +2 -2
- package/dist/probe/canonicalize.js +1 -1
- package/dist/probe/css.js +1 -1
- package/dist/probe/index.js +1 -1
- package/dist/provider.js +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/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 +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 +18 -9
- package/dist/utils/react/nullableValue.js.map +1 -1
- package/dist/utils/react/overlayKeyPropagation.js +1 -1
- package/dist/utils/react/programmaticFocus.js +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.js +1 -1
- package/dist/utils/react/useBufferedValue.js +1 -1
- package/dist/utils/react/useCombinedRefs.js +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +1 -1
- package/dist/utils/react/useEventBus.js +1 -1
- package/dist/utils/react/useId.js +1 -1
- package/dist/utils/react/useIsDarwin.js +1 -1
- package/dist/utils/react/useKeySymbols.js +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLocalStorage.js +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/useOverlayEscapeGuard.js +1 -1
- package/dist/utils/react/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/components/actions/Button.md +8 -2
- package/docs/components/content/InfoBadge.md +2 -0
- package/docs/components/content/ItemBadge.md +4 -0
- package/docs/components/content/Layout.md +2 -1
- package/docs/components/fields/ComboBox.md +25 -18
- package/docs/components/fields/FilterListBox.md +2 -2
- package/docs/components/fields/FilterPicker.md +2 -2
- package/docs/components/fields/ListBox.md +14 -10
- package/docs/components/fields/NumberInput.md +10 -10
- package/docs/components/fields/PasswordInput.md +6 -7
- package/docs/components/fields/Picker.md +6 -5
- package/docs/components/fields/RadioGroup.md +1 -1
- package/docs/components/fields/SearchInput.md +7 -6
- package/docs/components/fields/Select.md +14 -8
- package/docs/components/fields/TextArea.md +4 -3
- package/docs/components/fields/TextInput.md +13 -6
- package/docs/components/overlays/AlertDialog.md +7 -1
- package/docs/components/overlays/Dialog.md +5 -5
- package/docs/components/overlays/DialogTrigger.md +6 -6
- package/docs/components/overlays/Tooltip.md +17 -6
- package/docs/components/overlays/TooltipTrigger.md +2 -0
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-e3f8a1a | 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";
|
|
5
5
|
import { castNullableStringValue } from "../../../utils/react/nullableValue.js";
|
|
6
6
|
import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
|
|
7
7
|
import { TextInputBase } from "../TextInput/TextInputBase.js";
|
|
8
|
+
import { useDisplayedValidation } from "../TextInput/displayed-validation.js";
|
|
8
9
|
import { useAutoSizeTextArea } from "../TextInput/useAutoSizeTextArea.js";
|
|
9
10
|
import { c } from "react/compiler-runtime";
|
|
10
11
|
import { forwardRef, useRef } from "react";
|
|
@@ -13,7 +14,7 @@ import { useTextField } from "react-aria";
|
|
|
13
14
|
|
|
14
15
|
//#region src/components/fields/TextArea/TextArea.tsx
|
|
15
16
|
function TextArea(rawProps, ref) {
|
|
16
|
-
const $ = c(
|
|
17
|
+
const $ = c(31);
|
|
17
18
|
let t0;
|
|
18
19
|
if ($[0] !== rawProps) {
|
|
19
20
|
t0 = castNullableStringValue(rawProps);
|
|
@@ -70,78 +71,63 @@ function TextArea(rawProps, ref) {
|
|
|
70
71
|
$[12] = t9;
|
|
71
72
|
} else t9 = $[12];
|
|
72
73
|
const adjustHeight = useAutoSizeTextArea(t9);
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
const displayedValidation = useDisplayedValidation();
|
|
75
|
+
const { labelProps, inputProps, ...validation } = useTextField(displayedValidation.trackTouched({
|
|
76
|
+
...otherProps,
|
|
77
|
+
value: buffered.value,
|
|
78
|
+
isDisabled,
|
|
79
|
+
isReadOnly,
|
|
80
|
+
isRequired,
|
|
81
|
+
onChange: chain(buffered.onChange, adjustHeight),
|
|
82
|
+
onBlur: chain(otherProps.onBlur, buffered.reset),
|
|
83
|
+
inputElementType: "textarea"
|
|
84
|
+
}), inputRef);
|
|
85
|
+
let t10;
|
|
86
|
+
if ($[13] !== labelProps || $[14] !== userLabelProps) {
|
|
87
|
+
t10 = mergeProps$1(labelProps, userLabelProps);
|
|
88
|
+
$[13] = labelProps;
|
|
89
|
+
$[14] = userLabelProps;
|
|
90
|
+
$[15] = t10;
|
|
91
|
+
} else t10 = $[15];
|
|
92
|
+
const mergedLabelProps = t10;
|
|
93
|
+
const T0 = TextInputBase;
|
|
94
|
+
const t11 = displayedValidation.getDisplayedValidation(otherProps, validation);
|
|
95
|
+
let t12;
|
|
96
|
+
if ($[16] !== inputProps || $[17] !== userInputProps) {
|
|
97
|
+
t12 = mergeProps$1(inputProps, { "data-input-type": "textarea" }, userInputProps);
|
|
98
|
+
$[16] = inputProps;
|
|
99
|
+
$[17] = userInputProps;
|
|
100
|
+
$[18] = t12;
|
|
101
|
+
} else t12 = $[18];
|
|
82
102
|
let t13;
|
|
83
|
-
if ($[
|
|
84
|
-
t13 = {
|
|
85
|
-
...otherProps,
|
|
86
|
-
value: t10,
|
|
87
|
-
isDisabled,
|
|
88
|
-
isReadOnly,
|
|
89
|
-
isRequired,
|
|
90
|
-
onChange: t11,
|
|
91
|
-
onBlur: t12,
|
|
92
|
-
inputElementType: "textarea"
|
|
93
|
-
};
|
|
94
|
-
$[16] = buffered.value;
|
|
95
|
-
$[17] = isDisabled;
|
|
96
|
-
$[18] = isReadOnly;
|
|
97
|
-
$[19] = isRequired;
|
|
98
|
-
$[20] = otherProps;
|
|
99
|
-
$[21] = t11;
|
|
100
|
-
$[22] = t12;
|
|
101
|
-
$[23] = t13;
|
|
102
|
-
} else t13 = $[23];
|
|
103
|
-
const { labelProps, inputProps } = useTextField(t13, inputRef);
|
|
104
|
-
let t14;
|
|
105
|
-
if ($[24] !== labelProps || $[25] !== userLabelProps) {
|
|
106
|
-
t14 = mergeProps$1(labelProps, userLabelProps);
|
|
107
|
-
$[24] = labelProps;
|
|
108
|
-
$[25] = userLabelProps;
|
|
109
|
-
$[26] = t14;
|
|
110
|
-
} else t14 = $[26];
|
|
111
|
-
const mergedLabelProps = t14;
|
|
112
|
-
let t15;
|
|
113
|
-
if ($[27] !== inputProps || $[28] !== userInputProps) {
|
|
114
|
-
t15 = mergeProps$1(inputProps, { "data-input-type": "textarea" }, userInputProps);
|
|
115
|
-
$[27] = inputProps;
|
|
116
|
-
$[28] = userInputProps;
|
|
117
|
-
$[29] = t15;
|
|
118
|
-
} else t15 = $[29];
|
|
119
|
-
let t16;
|
|
120
|
-
if ($[30] !== inputRef || $[31] !== isDisabled || $[32] !== isReadOnly || $[33] !== isRequired || $[34] !== mergedLabelProps || $[35] !== otherProps || $[36] !== ref || $[37] !== rows || $[38] !== t15) {
|
|
121
|
-
t16 = /* @__PURE__ */ jsx(TextInputBase, {
|
|
103
|
+
if ($[19] !== T0 || $[20] !== inputRef || $[21] !== isDisabled || $[22] !== isReadOnly || $[23] !== isRequired || $[24] !== mergedLabelProps || $[25] !== otherProps || $[26] !== ref || $[27] !== rows || $[28] !== t11 || $[29] !== t12) {
|
|
104
|
+
t13 = /* @__PURE__ */ jsx(T0, {
|
|
122
105
|
ref,
|
|
123
106
|
...otherProps,
|
|
107
|
+
...t11,
|
|
124
108
|
multiLine: true,
|
|
125
109
|
inputRef,
|
|
126
110
|
labelProps: mergedLabelProps,
|
|
127
|
-
inputProps:
|
|
111
|
+
inputProps: t12,
|
|
128
112
|
isDisabled,
|
|
129
113
|
isReadOnly,
|
|
130
114
|
isRequired,
|
|
131
115
|
rows
|
|
132
116
|
});
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
|
|
144
|
-
|
|
117
|
+
$[19] = T0;
|
|
118
|
+
$[20] = inputRef;
|
|
119
|
+
$[21] = isDisabled;
|
|
120
|
+
$[22] = isReadOnly;
|
|
121
|
+
$[23] = isRequired;
|
|
122
|
+
$[24] = mergedLabelProps;
|
|
123
|
+
$[25] = otherProps;
|
|
124
|
+
$[26] = ref;
|
|
125
|
+
$[27] = rows;
|
|
126
|
+
$[28] = t11;
|
|
127
|
+
$[29] = t12;
|
|
128
|
+
$[30] = t13;
|
|
129
|
+
} else t13 = $[30];
|
|
130
|
+
return t13;
|
|
145
131
|
}
|
|
146
132
|
/**
|
|
147
133
|
* TextInputs are text inputs that allow users to input custom text entries
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","names":["ForwardedRef","forwardRef","RefObject","useRef","AriaTextFieldProps","useTextField","chain","mergeProps","useBufferedValue","castNullableStringValue","WithNullableValue","useFieldProps","CubeBufferedValueProps","CubeTextInputBaseProps","TextInputBase","useAutoSizeTextArea","FieldBaseProps","CubeTextAreaProps","Omit","field","inputRef","HTMLTextAreaElement","validate","onFocus","onBlur","autoSize","maxRows","rows","TextArea","rawProps","ref","$","_c","t0","t1","Symbol","for","defaultValidationTrigger","valuePropsMapper","_temp","props","t2","isDisabled","t3","isReadOnly","t4","isRequired","t5","onChange","onChange_0","t6","t7","labelProps","userLabelProps","inputProps","userInputProps","propsInputRef","value","value_0","form","isBuffered","otherProps","undefined","Math","max","localInputRef","t8","buffered","t9","adjustHeight","
|
|
1
|
+
{"version":3,"file":"TextArea.js","names":["ForwardedRef","forwardRef","RefObject","useRef","AriaTextFieldProps","useTextField","chain","mergeProps","useBufferedValue","castNullableStringValue","WithNullableValue","useFieldProps","useDisplayedValidation","CubeBufferedValueProps","CubeTextInputBaseProps","TextInputBase","useAutoSizeTextArea","FieldBaseProps","CubeTextAreaProps","Omit","field","inputRef","HTMLTextAreaElement","validate","onFocus","onBlur","autoSize","maxRows","rows","TextArea","rawProps","ref","$","_c","t0","t1","Symbol","for","defaultValidationTrigger","valuePropsMapper","_temp","props","t2","isDisabled","t3","isReadOnly","t4","isRequired","t5","onChange","onChange_0","t6","t7","labelProps","userLabelProps","inputProps","userInputProps","propsInputRef","value","value_0","form","isBuffered","otherProps","undefined","Math","max","localInputRef","t8","buffered","t9","adjustHeight","displayedValidation","validation","trackTouched","reset","inputElementType","t10","mergedLabelProps","T0","t11","getDisplayedValidation","t12","t13","toString","_TextArea","cubeInputType","displayName"],"sources":["../../../../src/components/fields/TextArea/TextArea.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, RefObject, useRef } from 'react';\nimport { AriaTextFieldProps, useTextField } from 'react-aria';\n\nimport { chain, mergeProps, useBufferedValue } from '../../../utils/react';\nimport {\n castNullableStringValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { useFieldProps } from '../../form';\nimport { useDisplayedValidation } from '../TextInput/displayed-validation';\nimport {\n CubeBufferedValueProps,\n CubeTextInputBaseProps,\n TextInputBase,\n} from '../TextInput/TextInputBase';\nimport { useAutoSizeTextArea } from '../TextInput/useAutoSizeTextArea';\n\nimport type { FieldBaseProps } from '../../../shared/form';\n\nexport interface CubeTextAreaProps\n extends Omit<\n CubeTextInputBaseProps,\n 'validate' | 'inputRef' | 'onFocus' | 'onBlur'\n >,\n CubeBufferedValueProps {\n field?: FieldBaseProps<string | null | undefined>['field'];\n inputRef?: RefObject<HTMLTextAreaElement | null>;\n validate?: AriaTextFieldProps<HTMLTextAreaElement>['validate'];\n onFocus?: AriaTextFieldProps<HTMLTextAreaElement>['onFocus'];\n onBlur?: AriaTextFieldProps<HTMLTextAreaElement>['onBlur'];\n /** Whether the textarea should change its size depends on the content */\n autoSize?: boolean;\n /** Max number of visible rows when autoSize is `true`. Defaults to 10 */\n maxRows?: number;\n /** The `rows` attribute in HTML is used to specify the number of visible text lines for the\n * control i.e. the number of rows to display. Defaults to 3 */\n rows?: number;\n}\n\nfunction TextArea(\n rawProps: WithNullableValue<CubeTextAreaProps>,\n ref: ForwardedRef<HTMLElement>,\n) {\n rawProps = castNullableStringValue(rawProps);\n let props = useFieldProps(rawProps, {\n defaultValidationTrigger: 'onBlur',\n valuePropsMapper: ({ value, onChange }) => ({\n onChange,\n value: value?.toString() ?? '',\n }),\n });\n let {\n autoSize = false,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n maxRows = 10,\n rows = 3,\n labelProps: userLabelProps,\n inputProps: userInputProps,\n inputRef: propsInputRef,\n value,\n // The form instance, not the DOM `form` id `useTextField` forwards.\n form,\n isBuffered,\n ...otherProps\n } = props;\n\n rows = Math.max(rows, 1);\n maxRows = Math.max(maxRows, rows);\n\n let localInputRef = useRef<HTMLTextAreaElement>(null);\n let inputRef = propsInputRef ?? localInputRef;\n\n // Hold the typed text locally until the controlled value catches up — see `useBufferedValue`.\n const buffered = useBufferedValue(value, onChange, {\n isBuffered,\n isDisabled,\n isReadOnly,\n });\n\n const adjustHeight = useAutoSizeTextArea({\n inputRef,\n autoSize,\n rows,\n maxRows,\n // Keyed on the rendered value, not the prop, so a buffered draft is measured.\n value: buffered.value,\n });\n\n let displayedValidation = useDisplayedValidation();\n let { labelProps, inputProps, ...validation } = useTextField(\n displayedValidation.trackTouched({\n ...otherProps,\n value: buffered.value,\n isDisabled,\n isReadOnly,\n isRequired,\n onChange: chain(buffered.onChange, adjustHeight),\n onBlur: chain(otherProps.onBlur, buffered.reset),\n inputElementType: 'textarea',\n }),\n inputRef,\n );\n\n // Merge user-provided labelProps with aria labelProps\n const mergedLabelProps = mergeProps(labelProps, userLabelProps);\n\n return (\n <TextInputBase\n ref={ref}\n {...otherProps}\n {...displayedValidation.getDisplayedValidation(otherProps, validation)}\n multiLine\n inputRef={inputRef}\n labelProps={mergedLabelProps}\n inputProps={mergeProps(\n inputProps,\n { 'data-input-type': 'textarea' },\n userInputProps,\n )}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n isRequired={isRequired}\n rows={rows}\n />\n );\n}\n\n/**\n * TextInputs are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _TextArea = forwardRef(TextArea);\n\n(_TextArea as any).cubeInputType = 'Text';\n_TextArea.displayName = 'TextArea';\n\nexport { _TextArea as TextArea };\n"],"mappings":";;;;;;;;;;;;;;;AAuCA,SAAA6B,SAAAC,UAAAC,KAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAC;AAAA,KAAAF,EAAA,OAAAF,UAAA;AAIaI,OAAAzB,wBAAwBqB,SAAS;AAAAE,IAAA,KAAAF;AAAAE,IAAA,KAAAE;OAAAA,MAAAF,EAAA;AAA5CF,YAAWA;CAAH,IAAAK;AAAA,KAAAH,EAAA,OAAAI,OAAAC,IAAA,4BAAA,EAAA;AAC4BF,OAAA;GA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AAD,OAAAC,EAAA,QAAAJ,QAAAI,EAAA,QAAA+C,OAAA/C,EAAA,QAAAiD,KAAA;AAXHC,QAAA,oBAAC;GACMnD;GAAG,GACJ+B;GAAU,GACViB;GACJ,WAAA;GACU1D;GACEwD,YAAAA;GACA,YAAAI;GAKAtC;GACAE;GACAE;GACNnB;IACN;AAAAI,IAAA,MAAA8C;AAAA9C,IAAA,MAAAX;AAAAW,IAAA,MAAAW;AAAAX,IAAA,MAAAa;AAAAb,IAAA,MAAAe;AAAAf,IAAA,MAAA6C;AAAA7C,IAAA,MAAA8B;AAAA9B,IAAA,MAAAD;AAAAC,IAAA,MAAAJ;AAAAI,IAAA,MAAA+C;AAAA/C,IAAA,MAAAiD;AAAAjD,IAAA,MAAAkD;OAAAA,OAAAlD,EAAA;AAAA,QAhBFkD;;;;;;;AAvEJ,SAAA1C,MAAAN,IAAA;CAOuB,MAAA,EAAAwB,OAAAT,aAAAf;AAAmB,QAAM;EAAAe;EAAAS,OAEnCA,OAAKyB,UAAkB,IAAvB;EACR;;AAsFL,MAAMC,YAAYnF,WAAW4B,SAAS;AAEtC,AAACuD,UAAkBC,gBAAgB;AACnCD,UAAUE,cAAc"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { FieldBaseProps, TextFieldKeyboardProps } from "../../../shared/form.js";
|
|
3
|
-
import { WithNullableValue } from "../../../utils/react/nullableValue.js";
|
|
4
3
|
import { CubeBufferedValueProps, CubeTextInputBaseProps } from "./TextInputBase.js";
|
|
4
|
+
import { WithNullableValue } from "../../../utils/react/nullableValue.js";
|
|
5
5
|
import * as react from "react";
|
|
6
6
|
import { AriaTextFieldProps, useTextField as useTextField$1 } from "react-aria";
|
|
7
7
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-e3f8a1a | 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";
|
|
5
5
|
import { castNullableStringValue } from "../../../utils/react/nullableValue.js";
|
|
6
6
|
import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
|
|
7
7
|
import { TextInputBase } from "./TextInputBase.js";
|
|
8
|
+
import { useDisplayedValidation } from "./displayed-validation.js";
|
|
8
9
|
import { c } from "react/compiler-runtime";
|
|
9
10
|
import { forwardRef, useRef } from "react";
|
|
10
11
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -12,7 +13,7 @@ import { useTextField as useTextField$1 } from "react-aria";
|
|
|
12
13
|
|
|
13
14
|
//#region src/components/fields/TextInput/TextInput.tsx
|
|
14
15
|
const TextInput = forwardRef(function TextInput(rawProps, ref) {
|
|
15
|
-
const $ = c(
|
|
16
|
+
const $ = c(17);
|
|
16
17
|
let t0;
|
|
17
18
|
if ($[0] !== rawProps) {
|
|
18
19
|
t0 = castNullableStringValue(rawProps);
|
|
@@ -36,56 +37,51 @@ const TextInput = forwardRef(function TextInput(rawProps, ref) {
|
|
|
36
37
|
isDisabled: restProps.isDisabled,
|
|
37
38
|
isReadOnly: restProps.isReadOnly
|
|
38
39
|
});
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const displayedValidation = useDisplayedValidation();
|
|
41
|
+
const { labelProps, inputProps, ...validation } = useTextField$1(displayedValidation.trackTouched({
|
|
42
|
+
...restProps,
|
|
43
|
+
value: buffered.value,
|
|
44
|
+
onChange: buffered.onChange,
|
|
45
|
+
onBlur: chain(restProps.onBlur, buffered.reset),
|
|
46
|
+
inputElementType: restProps.multiLine ? "textarea" : "input"
|
|
47
|
+
}), inputRef);
|
|
48
|
+
let t2;
|
|
49
|
+
if ($[3] !== labelProps || $[4] !== userLabelProps) {
|
|
50
|
+
t2 = mergeProps$1(labelProps, userLabelProps);
|
|
51
|
+
$[3] = labelProps;
|
|
52
|
+
$[4] = userLabelProps;
|
|
53
|
+
$[5] = t2;
|
|
54
|
+
} else t2 = $[5];
|
|
55
|
+
const mergedLabelProps = t2;
|
|
56
|
+
const T0 = TextInputBase;
|
|
57
|
+
const t3 = displayedValidation.getDisplayedValidation(restProps, validation);
|
|
58
|
+
let t4;
|
|
59
|
+
if ($[6] !== inputProps || $[7] !== userInputProps) {
|
|
60
|
+
t4 = mergeProps$1(inputProps, userInputProps);
|
|
61
|
+
$[6] = inputProps;
|
|
62
|
+
$[7] = userInputProps;
|
|
63
|
+
$[8] = t4;
|
|
64
|
+
} else t4 = $[8];
|
|
42
65
|
let t5;
|
|
43
|
-
if ($[
|
|
44
|
-
t5 = {
|
|
45
|
-
...restProps,
|
|
46
|
-
value: t2,
|
|
47
|
-
onChange: t3,
|
|
48
|
-
onBlur: t4
|
|
49
|
-
};
|
|
50
|
-
$[3] = buffered.onChange;
|
|
51
|
-
$[4] = buffered.value;
|
|
52
|
-
$[5] = restProps;
|
|
53
|
-
$[6] = t4;
|
|
54
|
-
$[7] = t5;
|
|
55
|
-
} else t5 = $[7];
|
|
56
|
-
const { labelProps, inputProps } = useTextField$1(t5, inputRef);
|
|
57
|
-
let t6;
|
|
58
|
-
if ($[8] !== labelProps || $[9] !== userLabelProps) {
|
|
59
|
-
t6 = mergeProps$1(labelProps, userLabelProps);
|
|
60
|
-
$[8] = labelProps;
|
|
61
|
-
$[9] = userLabelProps;
|
|
62
|
-
$[10] = t6;
|
|
63
|
-
} else t6 = $[10];
|
|
64
|
-
const mergedLabelProps = t6;
|
|
65
|
-
let t7;
|
|
66
|
-
if ($[11] !== inputProps || $[12] !== userInputProps) {
|
|
67
|
-
t7 = mergeProps$1(inputProps, userInputProps);
|
|
68
|
-
$[11] = inputProps;
|
|
69
|
-
$[12] = userInputProps;
|
|
70
|
-
$[13] = t7;
|
|
71
|
-
} else t7 = $[13];
|
|
72
|
-
let t8;
|
|
73
|
-
if ($[14] !== inputRef || $[15] !== mergedLabelProps || $[16] !== ref || $[17] !== restProps || $[18] !== t7) {
|
|
74
|
-
t8 = /* @__PURE__ */ jsx(TextInputBase, {
|
|
66
|
+
if ($[9] !== T0 || $[10] !== inputRef || $[11] !== mergedLabelProps || $[12] !== ref || $[13] !== restProps || $[14] !== t3 || $[15] !== t4) {
|
|
67
|
+
t5 = /* @__PURE__ */ jsx(T0, {
|
|
75
68
|
...restProps,
|
|
69
|
+
...t3,
|
|
76
70
|
ref,
|
|
77
71
|
labelProps: mergedLabelProps,
|
|
78
|
-
inputProps:
|
|
72
|
+
inputProps: t4,
|
|
79
73
|
inputRef
|
|
80
74
|
});
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
|
|
88
|
-
|
|
75
|
+
$[9] = T0;
|
|
76
|
+
$[10] = inputRef;
|
|
77
|
+
$[11] = mergedLabelProps;
|
|
78
|
+
$[12] = ref;
|
|
79
|
+
$[13] = restProps;
|
|
80
|
+
$[14] = t3;
|
|
81
|
+
$[15] = t4;
|
|
82
|
+
$[16] = t5;
|
|
83
|
+
} else t5 = $[16];
|
|
84
|
+
return t5;
|
|
89
85
|
});
|
|
90
86
|
/**
|
|
91
87
|
* TextInputs are text inputs that allow users to input custom text entries
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","names":["ForwardedRef","forwardRef","RefObject","useRef","AriaTextFieldProps","useTextField","chain","mergeProps","useBufferedValue","castNullableStringValue","WithNullableValue","useFieldProps","CubeBufferedValueProps","CubeTextInputBaseProps","TextInputBase","FieldBaseProps","TextFieldKeyboardProps","CubeTextInputProps","Omit","field","validate","TextInput","rawProps","ref","$","_c","t0","t1","Symbol","for","defaultValidationTrigger","valuePropsMapper","_temp","props","labelProps","userLabelProps","inputProps","userInputProps","inputRef","propsInputRef","form","isBuffered","restProps","localInputRef","buffered","value","onChange","isDisabled","isReadOnly","
|
|
1
|
+
{"version":3,"file":"TextInput.js","names":["ForwardedRef","forwardRef","RefObject","useRef","AriaTextFieldProps","useTextField","chain","mergeProps","useBufferedValue","castNullableStringValue","WithNullableValue","useFieldProps","useDisplayedValidation","CubeBufferedValueProps","CubeTextInputBaseProps","TextInputBase","FieldBaseProps","TextFieldKeyboardProps","CubeTextInputProps","Omit","field","validate","TextInput","rawProps","ref","$","_c","t0","t1","Symbol","for","defaultValidationTrigger","valuePropsMapper","_temp","props","labelProps","userLabelProps","inputProps","userInputProps","inputRef","propsInputRef","form","isBuffered","restProps","localInputRef","buffered","value","onChange","isDisabled","isReadOnly","displayedValidation","validation","trackTouched","onBlur","reset","inputElementType","multiLine","HTMLInputElement","t2","mergedLabelProps","T0","t3","getDisplayedValidation","t4","t5","cubeInputType","toString"],"sources":["../../../../src/components/fields/TextInput/TextInput.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef, RefObject, useRef } from 'react';\nimport { AriaTextFieldProps, useTextField } from 'react-aria';\n\nimport { chain, mergeProps, useBufferedValue } from '../../../utils/react';\nimport {\n castNullableStringValue,\n WithNullableValue,\n} from '../../../utils/react/nullableValue';\nimport { useFieldProps } from '../../form';\n\nimport { useDisplayedValidation } from './displayed-validation';\nimport {\n CubeBufferedValueProps,\n CubeTextInputBaseProps,\n TextInputBase,\n} from './TextInputBase';\n\nimport type {\n FieldBaseProps,\n TextFieldKeyboardProps,\n} from '../../../shared/form';\n\nexport type CubeTextInputProps = WithNullableValue<\n Omit<CubeTextInputBaseProps, 'validate'>\n> &\n CubeBufferedValueProps &\n TextFieldKeyboardProps & {\n field?: FieldBaseProps<string | null | undefined>['field'];\n validate?: AriaTextFieldProps['validate'];\n };\n\nexport { useTextField };\n\nexport const TextInput = forwardRef(function TextInput(\n rawProps: CubeTextInputProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n rawProps = castNullableStringValue(rawProps);\n let props = useFieldProps(rawProps, {\n defaultValidationTrigger: 'onBlur',\n valuePropsMapper: ({ value, onChange }) => ({\n onChange,\n value: value?.toString() ?? '',\n }),\n });\n\n let {\n labelProps: userLabelProps,\n inputProps: userInputProps,\n inputRef: propsInputRef,\n form,\n isBuffered,\n ...restProps\n } = props;\n let localInputRef = useRef<HTMLTextAreaElement | HTMLInputElement>(null);\n let inputRef = propsInputRef ?? localInputRef;\n\n // Hold the typed text locally until the controlled value catches up, so a parent that echoes it\n // back a render late can't overwrite the DOM node and throw the caret to the end.\n let buffered = useBufferedValue(restProps.value, restProps.onChange, {\n isBuffered,\n isDisabled: restProps.isDisabled,\n isReadOnly: restProps.isReadOnly,\n });\n\n let displayedValidation = useDisplayedValidation();\n let { labelProps, inputProps, ...validation } = useTextField(\n displayedValidation.trackTouched({\n ...restProps,\n value: buffered.value,\n onChange: buffered.onChange,\n onBlur: chain(restProps.onBlur, buffered.reset),\n inputElementType: restProps.multiLine ? 'textarea' : 'input',\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 return (\n <TextInputBase\n {...restProps}\n {...displayedValidation.getDisplayedValidation(restProps, validation)}\n ref={ref}\n labelProps={mergedLabelProps}\n inputProps={mergeProps(inputProps, userInputProps)}\n inputRef={inputRef}\n />\n );\n});\n\n/**\n * TextInputs are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\n\n(TextInput as any).cubeInputType = 'Text';\n"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAasB,YAAYrB,WAAW,SAAAqB,UAAAC,UAAAC,KAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAC;AAAA,KAAAF,EAAA,OAAAF,UAAA;AAIvBI,OAAAlB,wBAAwBc,SAAS;AAAAE,IAAA,KAAAF;AAAAE,IAAA,KAAAE;OAAAA,MAAAF,EAAA;AAA5CF,YAAWA;CAAH,IAAAK;AAAA,KA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,OAAAmC,MAAAnC,EAAA,QAAAc,YAAAd,EAAA,QAAAkC,oBAAAlC,EAAA,QAAAD,OAAAC,EAAA,QAAAkB,aAAAlB,EAAA,QAAAoC,MAAApC,EAAA,QAAAsC,IAAA;AALpDC,OAAA,oBAAC;GAAa,GACRrB;GAAS,GACTkB;GACCrC;GACOmC,YAAAA;GACA,YAAAI;GACFxB;IACV;AAAAd,IAAA,KAAAmC;AAAAnC,IAAA,MAAAc;AAAAd,IAAA,MAAAkC;AAAAlC,IAAA,MAAAD;AAAAC,IAAA,MAAAkB;AAAAlB,IAAA,MAAAoC;AAAApC,IAAA,MAAAsC;AAAAtC,IAAA,MAAAuC;OAAAA,MAAAvC,EAAA;AAAA,QAPFuC;EASF;;;;;;AAQF,AAAC1C,UAAkB2C,gBAAgB;AAjEC,SAAAhC,MAAAN,IAAA;CAOb,MAAA,EAAAmB,OAAAC,aAAApB;AAAmB,QAAM;EAAAoB;EAAAD,OAEnCA,OAAKoB,UAAkB,IAAvB;EACR"}
|
|
@@ -32,7 +32,11 @@ interface CubeTextInputBaseProps extends BaseProps, OuterStyleProps, BlockStyleP
|
|
|
32
32
|
multiLine?: boolean;
|
|
33
33
|
/** Whether the input should have autofocus */
|
|
34
34
|
autoFocus?: boolean;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Direct input props. The explicit props above (`isDisabled`, `maxLength`, `minLength`,
|
|
37
|
+
* `autoFocus`, `rows`, `autoComplete`) win over the same attributes here when they are set; an
|
|
38
|
+
* unset one leaves the value given here in place.
|
|
39
|
+
*/
|
|
36
40
|
inputProps?: Props;
|
|
37
41
|
/** Direct input wrapper props */
|
|
38
42
|
wrapperProps?: Props;
|
|
@@ -42,7 +46,7 @@ interface CubeTextInputBaseProps extends BaseProps, OuterStyleProps, BlockStyleP
|
|
|
42
46
|
wrapperRef?: RefObject<HTMLDivElement | null>;
|
|
43
47
|
/** Whether the input has the loading status */
|
|
44
48
|
isLoading?: boolean;
|
|
45
|
-
/**
|
|
49
|
+
/** Rendered in place of the default loading icon while `isLoading` is set */
|
|
46
50
|
loadingIndicator?: ReactNode;
|
|
47
51
|
/** Style map for the input */
|
|
48
52
|
inputStyles?: Styles;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-e3f8a1a | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
@@ -155,13 +155,31 @@ const InputElement = tasty({
|
|
|
155
155
|
qa: "Input",
|
|
156
156
|
styles: DEFAULT_INPUT_STYLES
|
|
157
157
|
});
|
|
158
|
+
const INTERACTIVE_ELEMENTS = "a[href], button, input, select, textarea, [tabindex], [contenteditable]";
|
|
159
|
+
/**
|
|
160
|
+
* A press inside the field box but outside the input — the prefix or suffix area, an icon, a
|
|
161
|
+
* textarea's margins — focuses the input, as a press anywhere in a native field does. Presses on
|
|
162
|
+
* the input itself and on interactive children, such as a clear button or the steppers, stay
|
|
163
|
+
* theirs.
|
|
164
|
+
*/
|
|
165
|
+
function focusInputOnBoxPress(event, input) {
|
|
166
|
+
if (event.button !== 0 || event.defaultPrevented) return;
|
|
167
|
+
if (!input || input.disabled) return;
|
|
168
|
+
const box = event.currentTarget;
|
|
169
|
+
const target = event.target;
|
|
170
|
+
if (!box.contains(target)) return;
|
|
171
|
+
const interactive = target.closest(INTERACTIVE_ELEMENTS);
|
|
172
|
+
if (interactive && box.contains(interactive)) return;
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
input.focus();
|
|
175
|
+
}
|
|
158
176
|
/**
|
|
159
177
|
* The presentational base for text-like inputs. It renders the input chrome and the field wrapper, but
|
|
160
178
|
* never wires form state — that is the job of the component rendering it (`TextInput`, `TextArea`,
|
|
161
179
|
* `PasswordInput`, `NumberInput`, `SearchInput`, `CommandTextArea`).
|
|
162
180
|
*/
|
|
163
181
|
function _TextInputBase(props, ref) {
|
|
164
|
-
let { qa, mods, isInvalid, isValid, prefix, isDisabled, multiLine, autoFocus, inputProps, wrapperProps, inputRef, isLoading, loadingIndicator, value, inputStyles = {}, suffix, suffixPosition = "before", actions, wrapperRef, rows
|
|
182
|
+
let { qa, mods, isInvalid, isValid, prefix, isDisabled, multiLine, autoFocus, inputProps, wrapperProps, inputRef, isLoading, loadingIndicator, value, inputStyles = {}, suffix, suffixPosition = "before", actions, wrapperRef, rows, size = "medium", autoComplete, autocomplete, icon, maxLength, minLength, form, resize, ...otherProps } = props;
|
|
165
183
|
let styles = extractStyles(otherProps, PROP_STYLES);
|
|
166
184
|
let type = otherProps.type;
|
|
167
185
|
if (resize) inputStyles = {
|
|
@@ -227,13 +245,14 @@ function _TextInputBase(props, ref) {
|
|
|
227
245
|
actions
|
|
228
246
|
]);
|
|
229
247
|
const resolvedAutoComplete = autoComplete ?? autocomplete ?? inputProps.autoComplete;
|
|
248
|
+
const resolvedAutoFocus = autoFocus ?? inputProps.autoFocus;
|
|
230
249
|
const textSecurityStyles = multiLine && type === "password" && inputProps.value?.length ? { fontFamily: "text-security-disc" } : {};
|
|
231
250
|
return wrapWithField(/* @__PURE__ */ jsxs(InputWrapperElement, {
|
|
232
251
|
ref: wrapperRef,
|
|
233
252
|
mods: modifiers,
|
|
234
253
|
"data-size": size,
|
|
235
254
|
styles,
|
|
236
|
-
...wrapperProps,
|
|
255
|
+
...mergeProps$1(wrapperProps, { onMouseDown: (event) => focusInputOnBoxPress(event, inputRef?.current) }),
|
|
237
256
|
children: [
|
|
238
257
|
prefix ? /* @__PURE__ */ jsx("div", {
|
|
239
258
|
"data-element": "Prefix",
|
|
@@ -245,23 +264,26 @@ function _TextInputBase(props, ref) {
|
|
|
245
264
|
"data-input-type": "textinput",
|
|
246
265
|
...mergeProps$1(inputProps, focusProps, hoverProps),
|
|
247
266
|
ref: inputRef,
|
|
248
|
-
rows: multiLine ? rows :
|
|
267
|
+
rows: multiLine ? rows ?? inputProps.rows ?? 1 : inputProps.rows,
|
|
249
268
|
mods: modifiers,
|
|
250
269
|
style: textSecurityStyles,
|
|
251
|
-
"data-autofocus":
|
|
252
|
-
autoFocus,
|
|
270
|
+
"data-autofocus": resolvedAutoFocus ? "" : void 0,
|
|
271
|
+
autoFocus: resolvedAutoFocus,
|
|
253
272
|
"data-size": size,
|
|
254
273
|
autoComplete: resolvedAutoComplete,
|
|
255
274
|
styles: inputStyles,
|
|
256
|
-
disabled: !!isDisabled,
|
|
257
|
-
maxLength,
|
|
258
|
-
minLength
|
|
275
|
+
disabled: !!(isDisabled ?? inputProps.disabled),
|
|
276
|
+
maxLength: maxLength ?? inputProps.maxLength,
|
|
277
|
+
minLength: minLength ?? inputProps.minLength
|
|
259
278
|
}),
|
|
260
279
|
showValidationIndicator || suffix || actions ? /* @__PURE__ */ jsxs("div", {
|
|
261
280
|
"data-element": "Suffix",
|
|
262
281
|
children: [
|
|
263
282
|
suffixPosition === "before" ? suffix : null,
|
|
264
|
-
/* @__PURE__ */ jsx(
|
|
283
|
+
isLoading && loadingIndicator ? /* @__PURE__ */ jsx("div", {
|
|
284
|
+
"data-element": "State",
|
|
285
|
+
children: loadingIndicator
|
|
286
|
+
}) : /* @__PURE__ */ jsx(ValidationIndicator, {
|
|
265
287
|
isInvalid,
|
|
266
288
|
isValid,
|
|
267
289
|
isLoading
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputBase.js","names":["createFocusableRef","BASE_STYLES","BaseProps","BaseStyleProps","BLOCK_STYLES","BlockStyleProps","COLOR_STYLES","ColorStyleProps","OUTER_STYLES","OuterStyleProps","Styles","tasty","FocusEventHandler","forwardRef","ReactElement","ReactNode","RefObject","useImperativeHandle","useMemo","useRef","AriaNumberFieldProps","AriaTextFieldProps","useHover","FieldBaseProps","TextFieldKeyboardProps","mergeProps","useCombinedRefs","useFocus","extractStyles","getValidationMods","hasValidationIndicator","ValidationIndicator","wrapWithField","Props","ADD_STYLES","$","display","placeContent","placeItems","gridRows","flow","gap","cursor","opacity","disabled","INPUT_WRAPPER_STYLES","position","gridColumns","prefix","suffix","fill","border","valid","invalid","focused","preset","radius","color","zIndex","boxSizing","transition","backgroundClip","height","multiline","$size","Prefix","Suffix","State","InputIcon","width","fontSize","ValidationIcon","InputWrapperElement","qa","styles","PROP_STYLES","DEFAULT_INPUT_STYLES","recipe","placeSelf","padding","textAlign","flexGrow","margin","resize","userSelect","Placeholder","InputElement","CubeTextInputBaseProps","Omit","HTMLInputElement","HTMLTextAreaElement","validate","onFocus","onBlur","icon","suffixPosition","actions","multiLine","autoFocus","inputProps","wrapperProps","inputRef","wrapperRef","HTMLDivElement","isLoading","loadingIndicator","inputStyles","rows","size","autoComplete","autocomplete","CubeBufferedValueProps","isBuffered","_TextInputBase","props","ref","mods","isInvalid","isValid","isDisabled","value","maxLength","minLength","form","otherProps","type","ElementType","isFocused","focusProps","hoverProps","isHovered","domRef","select","current","getInputElement","showValidationIndicator","placeholder","modifiers","loadable","hovered","resolvedAutoComplete","hasTextSecurity","textSecurityStyles","length","fontFamily","textField","undefined","TextInputBase"],"sources":["../../../../src/components/fields/TextInput/TextInputBase.tsx"],"sourcesContent":["import { createFocusableRef } from '@react-spectrum/utils';\nimport {\n BASE_STYLES,\n BaseProps,\n BaseStyleProps,\n BLOCK_STYLES,\n BlockStyleProps,\n COLOR_STYLES,\n ColorStyleProps,\n OUTER_STYLES,\n OuterStyleProps,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport {\n FocusEventHandler,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { AriaNumberFieldProps, AriaTextFieldProps, useHover } from 'react-aria';\n\nimport { FieldBaseProps, TextFieldKeyboardProps } from '../../../shared';\nimport { mergeProps, useCombinedRefs } from '../../../utils/react';\nimport { useFocus } from '../../../utils/react/interactions';\nimport { extractStyles } from '../../../utils/styles';\nimport {\n getValidationMods,\n hasValidationIndicator,\n ValidationIndicator,\n wrapWithField,\n} from '../../form';\n\nimport type { Props } from '../../../props';\n\nconst ADD_STYLES = {\n $: '>',\n display: 'grid',\n placeContent: 'stretch',\n placeItems: 'center',\n gridRows: '1sf',\n flow: 'column',\n gap: 0,\n cursor: 'inherit',\n opacity: {\n '': 1,\n disabled: '$disabled-opacity',\n },\n};\n\nexport const INPUT_WRAPPER_STYLES: Styles = {\n display: 'grid',\n flow: 'row',\n position: 'relative',\n gridColumns: {\n '': '1sf',\n prefix: 'max-content 1sf',\n suffix: '1sf max-content',\n 'prefix & suffix': 'max-content 1sf max-content',\n },\n gridRows: '1sf',\n placeItems: 'stretch',\n fill: {\n '': '#surface',\n disabled: '#disabled-surface',\n },\n border: {\n '': true,\n valid: '#success-text.50',\n invalid: '#danger-text.50',\n focused: '#primary-text',\n 'valid & focused': '#success-text',\n 'invalid & focused': '#danger-text',\n disabled: true,\n },\n preset: 't3',\n radius: true,\n cursor: 'text',\n color: {\n '': '#dark-02',\n focused: '#dark-02',\n invalid: '#danger-text',\n disabled: '#dark.30',\n },\n zIndex: {\n '': 'initial',\n focused: 1,\n },\n boxSizing: 'border-box',\n transition: 'theme',\n backgroundClip: 'content-box',\n height: {\n '': '$size $size',\n multiline: 'min $size',\n },\n\n $size: {\n '': '$size-md',\n 'size=small': '$size-sm',\n 'size=medium': '$size-md',\n 'size=large': '$size-lg',\n },\n\n Prefix: ADD_STYLES,\n\n Suffix: ADD_STYLES,\n\n State: {\n $: '> Suffix >',\n display: 'flex',\n },\n\n InputIcon: {\n display: 'grid',\n placeItems: 'center',\n width: 'min $size-sm',\n color: 'inherit',\n fontSize: '$icon-size',\n },\n\n ValidationIcon: {\n $: '> Suffix > State >',\n display: 'grid',\n placeItems: 'center',\n width: {\n '': 'min $size-sm',\n suffix: 'min $size-xs',\n },\n fontSize: '$icon-size',\n },\n};\n\nconst InputWrapperElement = tasty({\n qa: 'InputWrapper',\n styles: INPUT_WRAPPER_STYLES,\n});\n\nconst PROP_STYLES = [\n ...BASE_STYLES,\n ...OUTER_STYLES,\n ...BLOCK_STYLES,\n ...COLOR_STYLES,\n];\n\nexport const DEFAULT_INPUT_STYLES: Styles = {\n recipe: 'reset input / input-autofill',\n placeSelf: 'stretch',\n width: 'initial 100% 100%',\n transition: 'theme',\n radius: true,\n padding: '$vertical-padding $right-padding $vertical-padding $left-padding',\n textAlign: 'left',\n preset: 't3',\n flexGrow: 1,\n margin: {\n '': 0,\n multiline: '((($size-md - 1lh) / 2) - 1bw) 0',\n 'multiline & size=small': '((($size-sm - 1lh) / 2) - 1bw) 0',\n 'multiline & size=large': '((($size-lg - 1lh) / 2) - 1bw) 0',\n },\n resize: 'none',\n userSelect: 'auto',\n\n Placeholder: {\n $: '&::placeholder',\n recipe: 'input-placeholder',\n },\n '&::-webkit-search-cancel-button': {\n recipe: 'input-search-cancel-button',\n },\n\n '$vertical-padding': 0,\n '$left-padding': {\n '': '(1x - 1bw)',\n 'size=small': '(1x - 1bw)',\n 'size=large': '(1.25x - 1bw)',\n 'size=xlarge': '(1.5x - 1bw)',\n prefix: '0',\n },\n '$right-padding': {\n '': '(1x - 1bw)',\n 'size=small': '(1x - 1bw)',\n 'size=large': '(1.25x - 1bw)',\n 'size=xlarge': '(1.5x - 1bw)',\n suffix: '0',\n },\n};\n\nconst InputElement = tasty({ qa: 'Input', styles: DEFAULT_INPUT_STYLES });\n\nexport interface CubeTextInputBaseProps\n extends BaseProps,\n OuterStyleProps,\n BlockStyleProps,\n BaseStyleProps,\n ColorStyleProps,\n Omit<\n AriaTextFieldProps<HTMLInputElement | HTMLTextAreaElement>,\n | 'validate'\n | 'form'\n | 'name'\n | 'errorMessage'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onFocus'\n | 'onBlur'\n >,\n TextFieldKeyboardProps,\n FieldBaseProps {\n validate?: AriaTextFieldProps['validate'] | AriaNumberFieldProps['validate'];\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /** Left input icon */\n icon?: ReactElement | null;\n /** Input decoration before the main input */\n prefix?: ReactNode;\n /** Input decoration after the main input */\n suffix?: ReactNode;\n /** Suffix position goes before or after the validation and loading statuses */\n suffixPosition?: 'before' | 'after';\n /**\n * Controls placed last in the suffix, after the validation and loading\n * statuses and after `suffix` whatever its position, such as a popover\n * trigger.\n */\n actions?: ReactNode;\n /** Whether the input is multiline */\n multiLine?: boolean;\n /** Whether the input should have autofocus */\n autoFocus?: boolean;\n /** Direct input props */\n inputProps?: Props;\n /** Direct input wrapper props */\n wrapperProps?: Props;\n /** The input ref */\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;\n /** The wrapper ref */\n wrapperRef?: RefObject<HTMLDivElement | null>;\n /** Whether the input has the loading status */\n isLoading?: boolean;\n /** The loading status indicator */\n loadingIndicator?: ReactNode;\n /** Style map for the input */\n inputStyles?: Styles;\n /** The number of rows for the input. Only applies to textarea. */\n rows?: number;\n /** The resize CSS property sets whether an element is resizable, and if so, in which directions. */\n resize?: Styles['resize'];\n /** The size of the input */\n size?: 'small' | 'medium' | 'large' | (string & {});\n /**\n * What kind of autofill the browser may offer for the input, as the HTML `autocomplete` token\n * (`email`, `current-password`, `off`, …). See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete).\n */\n autoComplete?: string;\n /**\n * @deprecated Use `autoComplete` instead. Kept as an alias so existing callers keep working;\n * `autoComplete` wins when both are set.\n */\n autocomplete?: string;\n}\n\n/**\n * Mixed into the fields that actually buffer their value — `TextInput`, `TextArea`,\n * `PasswordInput`, `SearchInput` — rather than declared on `CubeTextInputBaseProps`. Every field\n * built on that base would otherwise inherit the prop, including `NumberInput` and\n * `CommandTextArea`, which keep their own text and ignore it: a public API that accepts a flag and\n * does nothing with it.\n */\nexport interface CubeBufferedValueProps {\n /**\n * Whether the typed text is held locally until the controlled `value` catches up. On by default,\n * which is what keeps the caret in place when the value round-trips through a store that\n * re-renders a pass late. Set to `false` for a caller that must see the value snap back to its\n * own `value` prop the instant it declines a keystroke. See `useBufferedValue`.\n */\n isBuffered?: boolean;\n}\n\n/**\n * The presentational base for text-like inputs. It renders the input chrome and the field wrapper, but\n * never wires form state — that is the job of the component rendering it (`TextInput`, `TextArea`,\n * `PasswordInput`, `NumberInput`, `SearchInput`, `CommandTextArea`).\n */\nfunction _TextInputBase(props: CubeTextInputBaseProps, ref) {\n let {\n qa,\n mods,\n isInvalid,\n isValid,\n prefix,\n isDisabled,\n multiLine,\n autoFocus,\n inputProps,\n wrapperProps,\n inputRef,\n isLoading,\n loadingIndicator,\n value,\n inputStyles = {},\n suffix,\n suffixPosition = 'before',\n actions,\n wrapperRef,\n rows = 1,\n size = 'medium',\n autoComplete,\n autocomplete,\n icon,\n maxLength,\n minLength,\n form,\n resize,\n ...otherProps\n } = props;\n\n let styles = extractStyles(otherProps, PROP_STYLES);\n let type = otherProps.type;\n\n if (resize) {\n inputStyles = { ...inputStyles, resize };\n }\n\n let ElementType: 'textarea' | 'input' = multiLine ? 'textarea' : 'input';\n let { isFocused, focusProps } = useFocus();\n let { hoverProps, isHovered } = useHover({ isDisabled });\n let domRef = useRef(null);\n\n inputRef = useCombinedRefs(inputRef);\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef?.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef?.current;\n },\n }));\n\n const showValidationIndicator = hasValidationIndicator({\n isInvalid,\n isValid,\n isLoading,\n });\n\n // Fix safari bug: https://github.com/philipwalton/flexbugs/issues/270\n if (!inputProps?.placeholder) {\n if (!inputProps) {\n inputProps = {};\n }\n\n inputProps.placeholder = ' ';\n }\n\n if (icon) {\n icon = <div data-element=\"InputIcon\">{icon}</div>;\n\n if (prefix) {\n prefix = (\n <>\n {icon}\n {prefix}\n </>\n );\n } else {\n prefix = icon;\n }\n }\n\n const modifiers = useMemo(\n () => ({\n ...getValidationMods({ isInvalid, isValid }),\n loadable: !!loadingIndicator,\n focused: isFocused,\n hovered: isHovered,\n disabled: isDisabled,\n multiline: multiLine,\n prefix: !!prefix,\n suffix: showValidationIndicator || !!suffix || !!actions,\n ...mods,\n }),\n [\n mods,\n isInvalid,\n isValid,\n showValidationIndicator,\n loadingIndicator,\n isFocused,\n isDisabled,\n isHovered,\n multiLine,\n prefix,\n suffix,\n actions,\n ],\n );\n\n // `autoComplete` is the prop; `autocomplete` is the deprecated alias. Falling back to\n // `inputProps` matters as much as the aliasing: this attribute is applied after the merge, so a\n // bare `autoComplete={resolved}` would overwrite whatever the React Aria hook put there —\n // `useNumberField`'s own `off`, or an `inputProps={{ autoComplete }}` passed by the caller — with\n // `undefined` whenever neither prop is set.\n const resolvedAutoComplete =\n autoComplete ?? autocomplete ?? inputProps.autoComplete;\n\n const hasTextSecurity = multiLine && type === 'password';\n const textSecurityStyles =\n hasTextSecurity && inputProps.value?.length\n ? {\n fontFamily: 'text-security-disc',\n }\n : {};\n\n const textField = (\n <InputWrapperElement\n ref={wrapperRef}\n mods={modifiers}\n data-size={size}\n styles={styles}\n {...wrapperProps}\n >\n {prefix ? <div data-element=\"Prefix\">{prefix}</div> : null}\n <InputElement\n qa={qa || 'Input'}\n as={ElementType}\n data-input-type=\"textinput\"\n {...mergeProps(inputProps, focusProps, hoverProps)}\n ref={inputRef}\n rows={multiLine ? rows : undefined}\n mods={modifiers}\n style={textSecurityStyles}\n data-autofocus={autoFocus ? '' : undefined}\n autoFocus={autoFocus}\n data-size={size}\n autoComplete={resolvedAutoComplete}\n styles={inputStyles}\n disabled={!!isDisabled}\n maxLength={maxLength}\n minLength={minLength}\n />\n {showValidationIndicator || suffix || actions ? (\n <div data-element=\"Suffix\">\n {suffixPosition === 'before' ? suffix : null}\n <ValidationIndicator\n isInvalid={isInvalid}\n isValid={isValid}\n isLoading={isLoading}\n />\n {suffixPosition === 'after' ? suffix : null}\n {actions}\n </div>\n ) : null}\n </InputWrapperElement>\n );\n\n return wrapWithField(textField, domRef, props);\n}\n\nconst TextInputBase = forwardRef(_TextInputBase);\n\nexport { TextInputBase };\nexport type { AriaTextFieldProps };\n"],"mappings":";;;;;;;;;;;;;;;AAuCA,MAAMkC,aAAa;CACjBC,GAAG;CACHC,SAAS;CACTC,cAAc;CACdC,YAAY;CACZC,UAAU;CACVC,MAAM;CACNC,KAAK;CACLC,QAAQ;CACRC,SAAS;EACP,IAAI;EACJC,UAAU;EACZ;CACD;AAED,MAAaC,uBAA+B;CAC1CT,SAAS;CACTI,MAAM;CACNM,UAAU;CACVC,aAAa;EACX,IAAI;EACJC,QAAQ;EACRC,QAAQ;EACR,mBAAmB;EACpB;CACDV,UAAU;CACVD,YAAY;CACZY,MAAM;EACJ,IAAI;EACJN,UAAU;EACX;CACDO,QAAQ;EACN,IAAI;EACJC,OAAO;EACPC,SAAS;EACTC,SAAS;EACT,mBAAmB;EACnB,qBAAqB;EACrBV,UAAU;EACX;CACDW,QAAQ;CACRC,QAAQ;CACRd,QAAQ;CACRe,OAAO;EACL,IAAI;EACJH,SAAS;EACTD,SAAS;EACTT,UAAU;EACX;CACDc,QAAQ;EACN,IAAI;EACJJ,SAAS;EACV;CACDK,WAAW;CACXC,YAAY;CACZC,gBAAgB;CAChBC,QAAQ;EACN,IAAI;EACJC,WAAW;EACZ;CAEDC,OAAO;EACL,IAAI;EACJ,cAAc;EACd,eAAe;EACf,cAAc;EACf;CAEDC,QAAQ/B;CAERgC,QAAQhC;CAERiC,OAAO;EACLhC,GAAG;EACHC,SAAS;EACV;CAEDgC,WAAW;EACThC,SAAS;EACTE,YAAY;EACZ+B,OAAO;EACPZ,OAAO;EACPa,UAAU;EACX;CAEDC,gBAAgB;EACdpC,GAAG;EACHC,SAAS;EACTE,YAAY;EACZ+B,OAAO;GACL,IAAI;GACJpB,QAAQ;GAC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AAS,oBAAC;IAAI,gBAAa;cAAUA;KAAa,GAAG;GACtD,oBAAC;IACC,IAAIyB,MAAM;IACV,IAAIqD;IACJ,mBAAgB;IAChB,GAAIrG,aAAW0E,YAAY6B,YAAYC,WAAW;IAClD,KAAK5B;IACL,MAAMJ,YAAYU,OAAOuC;IACzB,MAAMT;IACN,OAAOK;IACP,kBAAgB5C,YAAY,KAAKgD;IACtBhD;IACX,aAAWU;IACX,cAAcgC;IACd,QAAQlC;IACR,UAAU,CAAC,CAACa;IACDE;IACAC;KAAU;GAEtBa,2BAA2BtF,UAAU+C,UACpC,qBAAC;IAAI,gBAAa;;KACfD,mBAAmB,WAAW9C,SAAS;KACxC,oBAAC;MACYoE;MACFC;MACEd;OAAU;KAEtBT,mBAAmB,UAAU9C,SAAS;KACtC+C;;KACG,GACJ;;GAEP,EAE+BmC,QAAQjB,MAAM;;AAGhD,MAAMiC,gBAAgBtI,WAAWoG,eAAe"}
|
|
1
|
+
{"version":3,"file":"TextInputBase.js","names":["createFocusableRef","BASE_STYLES","BaseProps","BaseStyleProps","BLOCK_STYLES","BlockStyleProps","COLOR_STYLES","ColorStyleProps","OUTER_STYLES","OuterStyleProps","Styles","tasty","FocusEventHandler","forwardRef","MouseEvent","ReactElement","ReactNode","RefObject","useImperativeHandle","useMemo","useRef","AriaNumberFieldProps","AriaTextFieldProps","useHover","FieldBaseProps","TextFieldKeyboardProps","mergeProps","useCombinedRefs","useFocus","extractStyles","getValidationMods","hasValidationIndicator","ValidationIndicator","wrapWithField","Props","ADD_STYLES","$","display","placeContent","placeItems","gridRows","flow","gap","cursor","opacity","disabled","INPUT_WRAPPER_STYLES","position","gridColumns","prefix","suffix","fill","border","valid","invalid","focused","preset","radius","color","zIndex","boxSizing","transition","backgroundClip","height","multiline","$size","Prefix","Suffix","State","InputIcon","width","fontSize","ValidationIcon","InputWrapperElement","qa","styles","PROP_STYLES","DEFAULT_INPUT_STYLES","recipe","placeSelf","padding","textAlign","flexGrow","margin","resize","userSelect","Placeholder","InputElement","INTERACTIVE_ELEMENTS","focusInputOnBoxPress","event","HTMLElement","input","HTMLInputElement","HTMLTextAreaElement","button","defaultPrevented","box","currentTarget","target","Element","contains","interactive","closest","preventDefault","focus","CubeTextInputBaseProps","Omit","validate","onFocus","onBlur","icon","suffixPosition","actions","multiLine","autoFocus","inputProps","wrapperProps","inputRef","wrapperRef","HTMLDivElement","isLoading","loadingIndicator","inputStyles","rows","size","autoComplete","autocomplete","CubeBufferedValueProps","isBuffered","_TextInputBase","props","ref","mods","isInvalid","isValid","isDisabled","value","maxLength","minLength","form","otherProps","type","ElementType","isFocused","focusProps","hoverProps","isHovered","domRef","select","current","getInputElement","showValidationIndicator","placeholder","modifiers","loadable","hovered","resolvedAutoComplete","resolvedAutoFocus","hasTextSecurity","textSecurityStyles","length","fontFamily","textField","onMouseDown","undefined","TextInputBase"],"sources":["../../../../src/components/fields/TextInput/TextInputBase.tsx"],"sourcesContent":["import { createFocusableRef } from '@react-spectrum/utils';\nimport {\n BASE_STYLES,\n BaseProps,\n BaseStyleProps,\n BLOCK_STYLES,\n BlockStyleProps,\n COLOR_STYLES,\n ColorStyleProps,\n OUTER_STYLES,\n OuterStyleProps,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport {\n FocusEventHandler,\n forwardRef,\n MouseEvent,\n ReactElement,\n ReactNode,\n RefObject,\n useImperativeHandle,\n useMemo,\n useRef,\n} from 'react';\nimport { AriaNumberFieldProps, AriaTextFieldProps, useHover } from 'react-aria';\n\nimport { FieldBaseProps, TextFieldKeyboardProps } from '../../../shared';\nimport { mergeProps, useCombinedRefs } from '../../../utils/react';\nimport { useFocus } from '../../../utils/react/interactions';\nimport { extractStyles } from '../../../utils/styles';\nimport {\n getValidationMods,\n hasValidationIndicator,\n ValidationIndicator,\n wrapWithField,\n} from '../../form';\n\nimport type { Props } from '../../../props';\n\nconst ADD_STYLES = {\n $: '>',\n display: 'grid',\n placeContent: 'stretch',\n placeItems: 'center',\n gridRows: '1sf',\n flow: 'column',\n gap: 0,\n cursor: 'inherit',\n opacity: {\n '': 1,\n disabled: '$disabled-opacity',\n },\n};\n\nexport const INPUT_WRAPPER_STYLES: Styles = {\n display: 'grid',\n flow: 'row',\n position: 'relative',\n gridColumns: {\n '': '1sf',\n prefix: 'max-content 1sf',\n suffix: '1sf max-content',\n 'prefix & suffix': 'max-content 1sf max-content',\n },\n gridRows: '1sf',\n placeItems: 'stretch',\n fill: {\n '': '#surface',\n disabled: '#disabled-surface',\n },\n border: {\n '': true,\n valid: '#success-text.50',\n invalid: '#danger-text.50',\n focused: '#primary-text',\n 'valid & focused': '#success-text',\n 'invalid & focused': '#danger-text',\n disabled: true,\n },\n preset: 't3',\n radius: true,\n cursor: 'text',\n color: {\n '': '#dark-02',\n focused: '#dark-02',\n invalid: '#danger-text',\n disabled: '#dark.30',\n },\n zIndex: {\n '': 'initial',\n focused: 1,\n },\n boxSizing: 'border-box',\n transition: 'theme',\n backgroundClip: 'content-box',\n height: {\n '': '$size $size',\n multiline: 'min $size',\n },\n\n $size: {\n '': '$size-md',\n 'size=small': '$size-sm',\n 'size=medium': '$size-md',\n 'size=large': '$size-lg',\n },\n\n Prefix: ADD_STYLES,\n\n Suffix: ADD_STYLES,\n\n State: {\n $: '> Suffix >',\n display: 'flex',\n },\n\n InputIcon: {\n display: 'grid',\n placeItems: 'center',\n width: 'min $size-sm',\n color: 'inherit',\n fontSize: '$icon-size',\n },\n\n ValidationIcon: {\n $: '> Suffix > State >',\n display: 'grid',\n placeItems: 'center',\n width: {\n '': 'min $size-sm',\n suffix: 'min $size-xs',\n },\n fontSize: '$icon-size',\n },\n};\n\nconst InputWrapperElement = tasty({\n qa: 'InputWrapper',\n styles: INPUT_WRAPPER_STYLES,\n});\n\nconst PROP_STYLES = [\n ...BASE_STYLES,\n ...OUTER_STYLES,\n ...BLOCK_STYLES,\n ...COLOR_STYLES,\n];\n\nexport const DEFAULT_INPUT_STYLES: Styles = {\n recipe: 'reset input / input-autofill',\n placeSelf: 'stretch',\n width: 'initial 100% 100%',\n transition: 'theme',\n radius: true,\n padding: '$vertical-padding $right-padding $vertical-padding $left-padding',\n textAlign: 'left',\n preset: 't3',\n flexGrow: 1,\n margin: {\n '': 0,\n multiline: '((($size-md - 1lh) / 2) - 1bw) 0',\n 'multiline & size=small': '((($size-sm - 1lh) / 2) - 1bw) 0',\n 'multiline & size=large': '((($size-lg - 1lh) / 2) - 1bw) 0',\n },\n resize: 'none',\n userSelect: 'auto',\n\n Placeholder: {\n $: '&::placeholder',\n recipe: 'input-placeholder',\n },\n '&::-webkit-search-cancel-button': {\n recipe: 'input-search-cancel-button',\n },\n\n '$vertical-padding': 0,\n '$left-padding': {\n '': '(1x - 1bw)',\n 'size=small': '(1x - 1bw)',\n 'size=large': '(1.25x - 1bw)',\n 'size=xlarge': '(1.5x - 1bw)',\n prefix: '0',\n },\n '$right-padding': {\n '': '(1x - 1bw)',\n 'size=small': '(1x - 1bw)',\n 'size=large': '(1.25x - 1bw)',\n 'size=xlarge': '(1.5x - 1bw)',\n suffix: '0',\n },\n};\n\nconst InputElement = tasty({ qa: 'Input', styles: DEFAULT_INPUT_STYLES });\n\nconst INTERACTIVE_ELEMENTS =\n 'a[href], button, input, select, textarea, [tabindex], [contenteditable]';\n\n/**\n * A press inside the field box but outside the input — the prefix or suffix area, an icon, a\n * textarea's margins — focuses the input, as a press anywhere in a native field does. Presses on\n * the input itself and on interactive children, such as a clear button or the steppers, stay\n * theirs.\n */\nfunction focusInputOnBoxPress(\n event: MouseEvent<HTMLElement>,\n input: HTMLInputElement | HTMLTextAreaElement | null | undefined,\n) {\n if (event.button !== 0 || event.defaultPrevented) return;\n if (!input || input.disabled) return;\n\n const box = event.currentTarget;\n const target = event.target as Element;\n\n // React bubbles presses from a portal (a popover opened from a field action)\n // through the box; those belong to the portal.\n if (!box.contains(target)) return;\n\n const interactive = target.closest(INTERACTIVE_ELEMENTS);\n\n if (interactive && box.contains(interactive)) return;\n\n // The default action would move focus to the press target first, blurring the input.\n event.preventDefault();\n input.focus();\n}\n\nexport interface CubeTextInputBaseProps\n extends BaseProps,\n OuterStyleProps,\n BlockStyleProps,\n BaseStyleProps,\n ColorStyleProps,\n Omit<\n AriaTextFieldProps<HTMLInputElement | HTMLTextAreaElement>,\n | 'validate'\n | 'form'\n | 'name'\n | 'errorMessage'\n | 'onKeyDown'\n | 'onKeyUp'\n | 'onFocus'\n | 'onBlur'\n >,\n TextFieldKeyboardProps,\n FieldBaseProps {\n validate?: AriaTextFieldProps['validate'] | AriaNumberFieldProps['validate'];\n onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;\n /** Left input icon */\n icon?: ReactElement | null;\n /** Input decoration before the main input */\n prefix?: ReactNode;\n /** Input decoration after the main input */\n suffix?: ReactNode;\n /** Suffix position goes before or after the validation and loading statuses */\n suffixPosition?: 'before' | 'after';\n /**\n * Controls placed last in the suffix, after the validation and loading\n * statuses and after `suffix` whatever its position, such as a popover\n * trigger.\n */\n actions?: ReactNode;\n /** Whether the input is multiline */\n multiLine?: boolean;\n /** Whether the input should have autofocus */\n autoFocus?: boolean;\n /**\n * Direct input props. The explicit props above (`isDisabled`, `maxLength`, `minLength`,\n * `autoFocus`, `rows`, `autoComplete`) win over the same attributes here when they are set; an\n * unset one leaves the value given here in place.\n */\n inputProps?: Props;\n /** Direct input wrapper props */\n wrapperProps?: Props;\n /** The input ref */\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;\n /** The wrapper ref */\n wrapperRef?: RefObject<HTMLDivElement | null>;\n /** Whether the input has the loading status */\n isLoading?: boolean;\n /** Rendered in place of the default loading icon while `isLoading` is set */\n loadingIndicator?: ReactNode;\n /** Style map for the input */\n inputStyles?: Styles;\n /** The number of rows for the input. Only applies to textarea. */\n rows?: number;\n /** The resize CSS property sets whether an element is resizable, and if so, in which directions. */\n resize?: Styles['resize'];\n /** The size of the input */\n size?: 'small' | 'medium' | 'large' | (string & {});\n /**\n * What kind of autofill the browser may offer for the input, as the HTML `autocomplete` token\n * (`email`, `current-password`, `off`, …). See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete).\n */\n autoComplete?: string;\n /**\n * @deprecated Use `autoComplete` instead. Kept as an alias so existing callers keep working;\n * `autoComplete` wins when both are set.\n */\n autocomplete?: string;\n}\n\n/**\n * Mixed into the fields that actually buffer their value — `TextInput`, `TextArea`,\n * `PasswordInput`, `SearchInput` — rather than declared on `CubeTextInputBaseProps`. Every field\n * built on that base would otherwise inherit the prop, including `NumberInput` and\n * `CommandTextArea`, which keep their own text and ignore it: a public API that accepts a flag and\n * does nothing with it.\n */\nexport interface CubeBufferedValueProps {\n /**\n * Whether the typed text is held locally until the controlled `value` catches up. On by default,\n * which is what keeps the caret in place when the value round-trips through a store that\n * re-renders a pass late. Set to `false` for a caller that must see the value snap back to its\n * own `value` prop the instant it declines a keystroke. See `useBufferedValue`.\n */\n isBuffered?: boolean;\n}\n\n/**\n * The presentational base for text-like inputs. It renders the input chrome and the field wrapper, but\n * never wires form state — that is the job of the component rendering it (`TextInput`, `TextArea`,\n * `PasswordInput`, `NumberInput`, `SearchInput`, `CommandTextArea`).\n */\nfunction _TextInputBase(props: CubeTextInputBaseProps, ref) {\n let {\n qa,\n mods,\n isInvalid,\n isValid,\n prefix,\n isDisabled,\n multiLine,\n autoFocus,\n inputProps,\n wrapperProps,\n inputRef,\n isLoading,\n loadingIndicator,\n value,\n inputStyles = {},\n suffix,\n suffixPosition = 'before',\n actions,\n wrapperRef,\n rows,\n size = 'medium',\n autoComplete,\n autocomplete,\n icon,\n maxLength,\n minLength,\n form,\n resize,\n ...otherProps\n } = props;\n\n let styles = extractStyles(otherProps, PROP_STYLES);\n let type = otherProps.type;\n\n if (resize) {\n inputStyles = { ...inputStyles, resize };\n }\n\n let ElementType: 'textarea' | 'input' = multiLine ? 'textarea' : 'input';\n let { isFocused, focusProps } = useFocus();\n let { hoverProps, isHovered } = useHover({ isDisabled });\n let domRef = useRef(null);\n\n inputRef = useCombinedRefs(inputRef);\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef?.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef?.current;\n },\n }));\n\n const showValidationIndicator = hasValidationIndicator({\n isInvalid,\n isValid,\n isLoading,\n });\n\n // Fix safari bug: https://github.com/philipwalton/flexbugs/issues/270\n if (!inputProps?.placeholder) {\n if (!inputProps) {\n inputProps = {};\n }\n\n inputProps.placeholder = ' ';\n }\n\n if (icon) {\n icon = <div data-element=\"InputIcon\">{icon}</div>;\n\n if (prefix) {\n prefix = (\n <>\n {icon}\n {prefix}\n </>\n );\n } else {\n prefix = icon;\n }\n }\n\n const modifiers = useMemo(\n () => ({\n ...getValidationMods({ isInvalid, isValid }),\n loadable: !!loadingIndicator,\n focused: isFocused,\n hovered: isHovered,\n disabled: isDisabled,\n multiline: multiLine,\n prefix: !!prefix,\n suffix: showValidationIndicator || !!suffix || !!actions,\n ...mods,\n }),\n [\n mods,\n isInvalid,\n isValid,\n showValidationIndicator,\n loadingIndicator,\n isFocused,\n isDisabled,\n isHovered,\n multiLine,\n prefix,\n suffix,\n actions,\n ],\n );\n\n // The explicit props win when they are set; an unset one falls back to the merged `inputProps`\n // instead of overwriting it with `undefined`. For `autoComplete` that keeps both a caller's\n // `inputProps={{ autoComplete }}` and `useNumberField`'s own `off`. `autocomplete` is the\n // deprecated alias.\n const resolvedAutoComplete =\n autoComplete ?? autocomplete ?? inputProps.autoComplete;\n const resolvedAutoFocus = autoFocus ?? inputProps.autoFocus;\n\n const hasTextSecurity = multiLine && type === 'password';\n const textSecurityStyles =\n hasTextSecurity && inputProps.value?.length\n ? {\n fontFamily: 'text-security-disc',\n }\n : {};\n\n const textField = (\n <InputWrapperElement\n ref={wrapperRef}\n mods={modifiers}\n data-size={size}\n styles={styles}\n {...mergeProps(wrapperProps, {\n onMouseDown: (event: MouseEvent<HTMLElement>) =>\n focusInputOnBoxPress(event, inputRef?.current),\n })}\n >\n {prefix ? <div data-element=\"Prefix\">{prefix}</div> : null}\n <InputElement\n qa={qa || 'Input'}\n as={ElementType}\n data-input-type=\"textinput\"\n {...mergeProps(inputProps, focusProps, hoverProps)}\n ref={inputRef}\n rows={multiLine ? rows ?? inputProps.rows ?? 1 : inputProps.rows}\n mods={modifiers}\n style={textSecurityStyles}\n data-autofocus={resolvedAutoFocus ? '' : undefined}\n autoFocus={resolvedAutoFocus}\n data-size={size}\n autoComplete={resolvedAutoComplete}\n styles={inputStyles}\n disabled={!!(isDisabled ?? inputProps.disabled)}\n maxLength={maxLength ?? inputProps.maxLength}\n minLength={minLength ?? inputProps.minLength}\n />\n {showValidationIndicator || suffix || actions ? (\n <div data-element=\"Suffix\">\n {suffixPosition === 'before' ? suffix : null}\n {isLoading && loadingIndicator ? (\n <div data-element=\"State\">{loadingIndicator}</div>\n ) : (\n <ValidationIndicator\n isInvalid={isInvalid}\n isValid={isValid}\n isLoading={isLoading}\n />\n )}\n {suffixPosition === 'after' ? suffix : null}\n {actions}\n </div>\n ) : null}\n </InputWrapperElement>\n );\n\n return wrapWithField(textField, domRef, props);\n}\n\nconst TextInputBase = forwardRef(_TextInputBase);\n\nexport { TextInputBase };\nexport type { AriaTextFieldProps };\n"],"mappings":";;;;;;;;;;;;;;;AAwCA,MAAMmC,aAAa;CACjBC,GAAG;CACHC,SAAS;CACTC,cAAc;CACdC,YAAY;CACZC,UAAU;CACVC,MAAM;CACNC,KAAK;CACLC,QAAQ;CACRC,SAAS;EACP,IAAI;EACJC,UAAU;EACZ;CACD;AAED,MAAaC,uBAA+B;CAC1CT,SAAS;CACTI,MAAM;CACNM,UAAU;CACVC,aAAa;EACX,IAAI;EACJC,QAAQ;EACRC,QAAQ;EACR,mBAAmB;EACpB;CACDV,UAAU;CACVD,YAAY;CACZY,MAAM;EACJ,IAAI;EACJN,UAAU;EACX;CACDO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AIqE;IACJ,mBAAgB;IAChB,GAAIrH,aAAW0F,YAAY6B,YAAYC,WAAW;IAClD,KAAK5B;IACL,MAAMJ,YAAYU,QAAQR,WAAWQ,QAAQ,IAAIR,WAAWQ;IAC5D,MAAM8B;IACN,OAAOM;IACP,kBAAgBF,oBAAoB,KAAKO;IACzC,WAAWP;IACX,aAAWjC;IACX,cAAcgC;IACd,QAAQlC;IACR,UAAU,CAAC,EAAEa,cAAcpB,WAAWvE;IACtC,WAAW6F,aAAatB,WAAWsB;IACnC,WAAWC,aAAavB,WAAWuB;KAAU;GAE9Ca,2BAA2BtG,UAAU+D,UACpC,qBAAC;IAAI,gBAAa;;KACfD,mBAAmB,WAAW9D,SAAS;KACvCuE,aAAaC,mBACZ,oBAAC;MAAI,gBAAa;gBAASA;OAAuB,GAElD,oBAAC;MACYY;MACFC;MACEd;OAEd;KACAT,mBAAmB,UAAU9D,SAAS;KACtC+D;;KACG,GACJ;;GAEP,EAE+BmC,QAAQjB,MAAM;;AAGhD,MAAMmC,gBAAgBzJ,WAAWqH,eAAe"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-e3f8a1a | Cube Dev Team */
|
|
2
|
+
import { chain } from "../../../utils/react/chain.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/fields/TextInput/displayed-validation.ts
|
|
7
|
+
/**
|
|
8
|
+
* The validation the field chrome shows. React Aria runs `validate` from the first render and sets
|
|
9
|
+
* `aria-invalid` from it, so an untouched field would open with the invalid style and the message
|
|
10
|
+
* for its empty value. Both wait until the user has changed the value or left the field. An explicit
|
|
11
|
+
* `isInvalid`, which a form's validation also sets, shows at once, and a caller's `errorMessage`
|
|
12
|
+
* still wins over the errors `validate` returns.
|
|
13
|
+
*/
|
|
14
|
+
function useDisplayedValidation() {
|
|
15
|
+
const $ = c(3);
|
|
16
|
+
const [isTouched, setIsTouched] = useState(false);
|
|
17
|
+
let t0;
|
|
18
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
19
|
+
t0 = () => setIsTouched(true);
|
|
20
|
+
$[0] = t0;
|
|
21
|
+
} else t0 = $[0];
|
|
22
|
+
const touch = t0;
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[1] !== isTouched) {
|
|
25
|
+
t1 = {
|
|
26
|
+
trackTouched(props) {
|
|
27
|
+
return {
|
|
28
|
+
...props,
|
|
29
|
+
onChange: chain(props.onChange, touch),
|
|
30
|
+
onBlur: chain(props.onBlur, touch)
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
getDisplayedValidation(t2, validation) {
|
|
34
|
+
const { isInvalid, errorMessage } = t2;
|
|
35
|
+
const isShown = isTouched || isInvalid !== void 0;
|
|
36
|
+
return {
|
|
37
|
+
isInvalid: isShown && validation.isInvalid,
|
|
38
|
+
errorMessage: errorMessage === void 0 && isShown && validation.validationErrors.length ? validation.validationErrors.join(" ") : errorMessage
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
$[1] = isTouched;
|
|
43
|
+
$[2] = t1;
|
|
44
|
+
} else t1 = $[2];
|
|
45
|
+
return t1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { useDisplayedValidation };
|
|
50
|
+
//# sourceMappingURL=displayed-validation.js.map
|