@cube-dev/ui-kit 0.193.1 → 0.194.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +28 -0
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.d.ts +25 -12
- package/dist/components/CollectionItem.js +59 -4
- package/dist/components/CollectionItem.js.map +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 +2 -2
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.d.ts +1 -1
- package/dist/components/actions/Banner/Banner.js +6 -6
- package/dist/components/actions/Banner/Banner.js.map +1 -1
- package/dist/components/actions/Button/Button.js +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +28 -25
- package/dist/components/actions/ButtonSplit/ButtonSplit.js.map +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.d.ts +7 -7
- package/dist/components/actions/CommandMenu/CommandMenu.js +232 -239
- package/dist/components/actions/CommandMenu/CommandMenu.js.map +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +26 -22
- package/dist/components/actions/ItemAction/ItemAction.js.map +1 -1
- package/dist/components/actions/ItemActionContext.d.ts +3 -0
- package/dist/components/actions/ItemActionContext.js +15 -13
- package/dist/components/actions/ItemActionContext.js.map +1 -1
- package/dist/components/actions/ItemActionsWrapper.js +1 -1
- package/dist/components/actions/ItemButton/ItemButton.d.ts +2 -2
- package/dist/components/actions/ItemButton/ItemButton.js +1 -1
- package/dist/components/actions/Link/Link.js +1 -1
- package/dist/components/actions/Menu/Menu.d.ts +9 -9
- package/dist/components/actions/Menu/Menu.js +88 -64
- package/dist/components/actions/Menu/Menu.js.map +1 -1
- package/dist/components/actions/Menu/MenuCollectionItem.d.ts +18 -0
- package/dist/components/actions/Menu/MenuCollectionItem.js +36 -0
- package/dist/components/actions/Menu/MenuCollectionItem.js.map +1 -0
- package/dist/components/actions/Menu/MenuItem.d.ts +5 -0
- package/dist/components/actions/Menu/MenuItem.js +402 -116
- package/dist/components/actions/Menu/MenuItem.js.map +1 -1
- package/dist/components/actions/Menu/MenuSection.d.ts +3 -1
- package/dist/components/actions/Menu/MenuSection.js +31 -33
- package/dist/components/actions/Menu/MenuSection.js.map +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.d.ts +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +2 -2
- package/dist/components/actions/Menu/SubMenuTrigger.js.map +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/dist/components/actions/Menu/context.js +1 -1
- package/dist/components/actions/Menu/index.d.ts +1 -0
- package/dist/components/actions/Menu/styled.js +1 -1
- package/dist/components/actions/actions-run.js +1 -1
- package/dist/components/actions/index.d.ts +3 -2
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/use-action.js +60 -36
- package/dist/components/actions/use-action.js.map +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 +19 -19
- 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 +44 -33
- package/dist/components/content/HotKeys/HotKeys.js.map +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.d.ts +7 -7
- package/dist/components/content/Item/Item.js +205 -67
- package/dist/components/content/Item/Item.js.map +1 -1
- package/dist/components/content/Item/ItemWithNativeLinks.js +314 -0
- package/dist/components/content/Item/ItemWithNativeLinks.js.map +1 -0
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- package/dist/components/content/ItemCard/ItemCard.d.ts +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPane.js +18 -15
- package/dist/components/content/Layout/LayoutPane.js.map +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +41 -46
- package/dist/components/content/Layout/LayoutPanel.js.map +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +2 -2
- 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 +77 -70
- package/dist/components/content/Placeholder/Placeholder.js.map +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +5 -5
- package/dist/components/content/Result/Result.js.map +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +18 -19
- package/dist/components/content/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/content/Tag/Tag.js +2 -2
- 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 +66 -48
- package/dist/components/content/Title.js.map +1 -1
- package/dist/components/content/Tree/Tree.js +6 -3
- package/dist/components/content/Tree/Tree.js.map +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/types.d.ts +2 -2
- 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 +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 +39 -19
- package/dist/components/data/TableBase/TableView.js.map +1 -1
- package/dist/components/data/TableBase/TreeGridTable.js +1 -1
- package/dist/components/data/TableBase/column-header.js +1 -1
- package/dist/components/data/TableBase/column-menu.js +1 -1
- package/dist/components/data/TableBase/column-styles.js +1 -1
- package/dist/components/data/TableBase/column-tint.js +1 -1
- package/dist/components/data/TableBase/row-menu.js +1 -1
- package/dist/components/data/TableBase/styled.d.ts +1 -1
- package/dist/components/data/TableBase/styled.js +14 -1
- package/dist/components/data/TableBase/styled.js.map +1 -1
- package/dist/components/data/TableBase/table-tree.js +1 -1
- package/dist/components/data/TableBase/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 +219 -0
- package/dist/components/data/TableBase/use-column-window.js.map +1 -0
- 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 +32 -19
- package/dist/components/data/TableBase/use-table-tooltip-refresh.js.map +1 -1
- package/dist/components/data/TableBase/use-table-tree-state.js +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +3 -1
- package/dist/components/fields/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +13 -13
- 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 +32 -29
- package/dist/components/fields/ColorInput/ColorInput.js.map +1 -1
- package/dist/components/fields/ColorPicker/ColorPicker.d.ts +2 -0
- package/dist/components/fields/ColorPicker/ColorPicker.js +8 -5
- package/dist/components/fields/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/components/fields/ColorSwatch/ColorSwatch.js +1 -1
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js +6 -3
- package/dist/components/fields/ColorSwatchGroup/ColorSwatchGroup.js.map +1 -1
- package/dist/components/fields/ComboBox/ComboBox.js +41 -30
- package/dist/components/fields/ComboBox/ComboBox.js.map +1 -1
- 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 +2 -2
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +246 -238
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js.map +1 -1
- package/dist/components/fields/DatePicker/MonthPicker.js +1 -1
- package/dist/components/fields/DatePicker/PeriodPicker.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 +22 -2
- package/dist/components/fields/FileInput/FileInput.js.map +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +5 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.d.ts +4 -2
- package/dist/components/fields/FilterPicker/FilterPicker.js +3 -2
- package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.js +8 -7
- 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 +36 -32
- 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.js +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/fields/Picker/Picker.d.ts +4 -2
- package/dist/components/fields/Picker/Picker.js +3 -2
- package/dist/components/fields/Picker/Picker.js.map +1 -1
- package/dist/components/fields/RadioGroup/Radio.d.ts +24 -24
- package/dist/components/fields/RadioGroup/Radio.js +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +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.js +1 -1
- package/dist/components/fields/Select/Select.d.ts +4 -4
- package/dist/components/fields/Select/Select.js +35 -32
- package/dist/components/fields/Select/Select.js.map +1 -1
- package/dist/components/fields/Slider/Gradation.js +1 -1
- package/dist/components/fields/Slider/HueSlider.js +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- package/dist/components/fields/Slider/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.js +1 -1
- package/dist/components/fields/TextInput/TextInput.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInput/useAutoSizeTextArea.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +13 -5
- package/dist/components/fields/TextInputMapper/TextInputMapper.js.map +1 -1
- package/dist/components/fields/TriggerActions.js +1 -1
- package/dist/components/fields/color/ColorPanel.js +62 -53
- package/dist/components/fields/color/ColorPanel.js.map +1 -1
- package/dist/components/fields/color/channels.js +1 -1
- package/dist/components/fields/color/color.js +1 -1
- package/dist/components/fields/color/context.js +1 -1
- package/dist/components/form/FieldWrapper/FieldWrapper.d.ts +1 -0
- package/dist/components/form/FieldWrapper/FieldWrapper.js +133 -109
- package/dist/components/form/FieldWrapper/FieldWrapper.js.map +1 -1
- package/dist/components/form/FieldWrapper/field-description.js +102 -0
- package/dist/components/form/FieldWrapper/field-description.js.map +1 -0
- package/dist/components/form/FieldWrapper/types.d.ts +6 -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 +17 -4
- package/dist/components/form/Form/use-field/use-field-props.js.map +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 +27 -24
- package/dist/components/form/Label.js.map +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 +2 -1
- package/dist/components/form/wrapper.js.map +1 -1
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
- package/dist/components/layout/Flex.js +1 -1
- package/dist/components/layout/Flow.js +1 -1
- package/dist/components/layout/Grid.js +1 -1
- package/dist/components/layout/Panel.js +1 -1
- package/dist/components/layout/Prefix.js +1 -1
- package/dist/components/layout/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.d.ts +3 -3
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
- package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
- package/dist/components/other/Calendar/Calendar.js +1 -1
- package/dist/components/other/Calendar/CalendarCell.js +1 -1
- package/dist/components/other/Calendar/CalendarGrid.js +1 -1
- package/dist/components/other/Calendar/CalendarHeader.js +1 -1
- package/dist/components/other/Calendar/CalendarPanel.js +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js +1 -1
- package/dist/components/other/Calendar/PeriodGrid.js +1 -1
- package/dist/components/other/Calendar/RangeCalendar.js +1 -1
- package/dist/components/other/Calendar/styled.js +1 -1
- package/dist/components/other/CubeLogo/CubeLogo.js +1 -1
- package/dist/components/other/NoDataIcon/NoDataIcon.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/dist/components/overlays/Dialog/ModernDialogForm.js +1 -1
- package/dist/components/overlays/Dialog/context.js +1 -1
- package/dist/components/overlays/Dialog/default-button-text.js +1 -1
- package/dist/components/overlays/Dialog/use-content-overflow.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +44 -24
- package/dist/components/overlays/Modal/Modal.js.map +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +34 -24
- package/dist/components/overlays/Modal/Popover.js.map +1 -1
- package/dist/components/overlays/Modal/Tray.js +45 -25
- package/dist/components/overlays/Modal/Tray.js.map +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Modal/modal-containment.js +145 -0
- package/dist/components/overlays/Modal/modal-containment.js.map +1 -0
- 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 +2 -2
- 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.js +50 -47
- 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.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/overlays/Tooltip/split-trigger-props.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/portal/PortalProvider.js +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/shared/DraggableCollection.js +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/dist/components/status/Spin/Cube.js +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +1 -1
- package/dist/components/status/Spin/Spin.js +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +1 -1
- package/dist/data/item-themes.js +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/eslint-plugin/defaults.generated.js +2 -2
- 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 +3 -2
- package/dist/i18n/I18nProvider.js.map +1 -1
- package/dist/i18n/createFormatter.js +1 -1
- package/dist/i18n/index.d.ts +2 -1
- package/dist/i18n/index.js +3 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/instance.d.ts +2 -3
- package/dist/i18n/instance.js +3 -4
- package/dist/i18n/instance.js.map +1 -1
- package/dist/i18n/locales/de-DE/uikit.js +36 -5
- package/dist/i18n/locales/en-US/uikit.js +36 -5
- package/dist/i18n/locales/en-US/uikit.json.d.ts +41 -4
- package/dist/i18n/locales/es-ES/uikit.js +36 -5
- package/dist/i18n/locales/es-MX/uikit.js +36 -5
- package/dist/i18n/locales/fr-FR/uikit.js +36 -5
- package/dist/i18n/locales/it-IT/uikit.js +36 -5
- package/dist/i18n/locales/ja-JP/uikit.js +36 -5
- package/dist/i18n/locales/nb-NO/uikit.js +36 -5
- package/dist/i18n/locales/pt-BR/uikit.js +36 -5
- package/dist/i18n/locales/pt-PT/uikit.js +36 -5
- package/dist/i18n/locales/sv-SE/uikit.js +36 -5
- package/dist/i18n/locales/vi-VN/uikit.js +36 -5
- package/dist/i18n/locales.js +1 -1
- package/dist/i18n/namespace.d.ts +11 -0
- package/dist/i18n/namespace.js +12 -0
- package/dist/i18n/namespace.js.map +1 -0
- package/dist/i18n/useFormatter.js +1 -1
- package/dist/i18n/useI18n.js +5 -3
- package/dist/i18n/useI18n.js.map +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 +9 -7
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/probe/canonicalize.js +1 -1
- package/dist/probe/css.js +1 -1
- package/dist/probe/index.js +1 -1
- package/dist/provider.js +2 -2
- package/dist/provider.js.map +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigation-url.js +11 -0
- package/dist/providers/navigation-url.js.map +1 -0
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/providers/use-navigation.js +19 -0
- package/dist/providers/use-navigation.js.map +1 -0
- 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 +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/Usage.md +4 -0
- package/docs/components/CollectionItem.md +5 -1
- package/docs/components/actions/CommandMenu.md +46 -18
- package/docs/components/actions/Menu.md +124 -19
- package/docs/components/content/Placeholder.md +2 -0
- package/docs/components/content/Skeleton.md +2 -0
- package/docs/components/data/DataTable.md +3 -0
- package/docs/components/data/ItemTable.md +11 -1
- package/docs/components/overlays/Dialog.md +1 -1
- package/docs/components/overlays/DialogContainer.md +1 -2
- package/docs/components/overlays/DialogTrigger.md +1 -0
- package/package.json +3 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.194.0 | Cube Dev Team */
|
|
2
2
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
3
|
+
import { useI18n } from "../../../i18n/useI18n.js";
|
|
3
4
|
import { formatColor, getContrastingColor, toHex } from "./color.js";
|
|
4
5
|
import { CHANNELS, COLOR_SPACES, COLOR_SPACE_HINTS, COLOR_SPACE_LABELS } from "./channels.js";
|
|
5
6
|
import { __Radio } from "../RadioGroup/Radio.js";
|
|
@@ -195,8 +196,9 @@ function ChannelRow(t0) {
|
|
|
195
196
|
* of the active one.
|
|
196
197
|
*/
|
|
197
198
|
function ColorPanel(props) {
|
|
198
|
-
const $ = c(
|
|
199
|
+
const $ = c(42);
|
|
199
200
|
const { color, space, isDisabled, previewFormat, swatches, input, onChange, onSpaceChange } = props;
|
|
201
|
+
const { t } = useI18n();
|
|
200
202
|
let t0;
|
|
201
203
|
if ($[0] !== color) {
|
|
202
204
|
t0 = toHex(color);
|
|
@@ -243,77 +245,84 @@ function ColorPanel(props) {
|
|
|
243
245
|
$[13] = t5;
|
|
244
246
|
} else t5 = $[13];
|
|
245
247
|
let t6;
|
|
246
|
-
if ($[14]
|
|
247
|
-
t6 =
|
|
248
|
-
$[14] =
|
|
249
|
-
|
|
248
|
+
if ($[14] !== t) {
|
|
249
|
+
t6 = t("colorPicker.colorSpace", "Color space");
|
|
250
|
+
$[14] = t;
|
|
251
|
+
$[15] = t6;
|
|
252
|
+
} else t6 = $[15];
|
|
250
253
|
let t7;
|
|
251
|
-
if ($[
|
|
252
|
-
t7 =
|
|
253
|
-
|
|
254
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
255
|
+
t7 = COLOR_SPACES.map(_temp);
|
|
256
|
+
$[16] = t7;
|
|
257
|
+
} else t7 = $[16];
|
|
258
|
+
let t8;
|
|
259
|
+
if ($[17] !== handleSpaceChange || $[18] !== isDisabled || $[19] !== space || $[20] !== t6) {
|
|
260
|
+
t8 = /* @__PURE__ */ jsx(__Radio.Tabs, {
|
|
261
|
+
"aria-label": t6,
|
|
254
262
|
value: space,
|
|
255
263
|
isDisabled,
|
|
256
264
|
styles: SPACE_STYLES,
|
|
257
265
|
onChange: handleSpaceChange,
|
|
258
|
-
children:
|
|
266
|
+
children: t7
|
|
259
267
|
});
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
$[17] = handleSpaceChange;
|
|
269
|
+
$[18] = isDisabled;
|
|
270
|
+
$[19] = space;
|
|
271
|
+
$[20] = t6;
|
|
272
|
+
$[21] = t8;
|
|
273
|
+
} else t8 = $[21];
|
|
274
|
+
const t9 = CHANNELS[space];
|
|
275
|
+
let t10;
|
|
276
|
+
if ($[22] !== color || $[23] !== isDisabled || $[24] !== onChange || $[25] !== space || $[26] !== t9) {
|
|
277
|
+
let t11;
|
|
278
|
+
if ($[28] !== color || $[29] !== isDisabled || $[30] !== onChange || $[31] !== space) {
|
|
279
|
+
t11 = (channel) => /* @__PURE__ */ jsx(ChannelRow, {
|
|
271
280
|
channel,
|
|
272
281
|
color,
|
|
273
282
|
isDisabled,
|
|
274
283
|
onChange
|
|
275
284
|
}, `${space}-${channel.label}`);
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
} else
|
|
282
|
-
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
} else
|
|
290
|
-
let t10;
|
|
291
|
-
if ($[30] !== t9) {
|
|
292
|
-
t10 = /* @__PURE__ */ jsx(ChannelsElement, { children: t9 });
|
|
293
|
-
$[30] = t9;
|
|
294
|
-
$[31] = t10;
|
|
295
|
-
} else t10 = $[31];
|
|
285
|
+
$[28] = color;
|
|
286
|
+
$[29] = isDisabled;
|
|
287
|
+
$[30] = onChange;
|
|
288
|
+
$[31] = space;
|
|
289
|
+
$[32] = t11;
|
|
290
|
+
} else t11 = $[32];
|
|
291
|
+
t10 = t9.map(t11);
|
|
292
|
+
$[22] = color;
|
|
293
|
+
$[23] = isDisabled;
|
|
294
|
+
$[24] = onChange;
|
|
295
|
+
$[25] = space;
|
|
296
|
+
$[26] = t9;
|
|
297
|
+
$[27] = t10;
|
|
298
|
+
} else t10 = $[27];
|
|
296
299
|
let t11;
|
|
297
|
-
if ($[
|
|
298
|
-
t11 = /* @__PURE__ */
|
|
300
|
+
if ($[33] !== t10) {
|
|
301
|
+
t11 = /* @__PURE__ */ jsx(ChannelsElement, { children: t10 });
|
|
302
|
+
$[33] = t10;
|
|
303
|
+
$[34] = t11;
|
|
304
|
+
} else t11 = $[34];
|
|
305
|
+
let t12;
|
|
306
|
+
if ($[35] !== colorTokens || $[36] !== input || $[37] !== swatches || $[38] !== t11 || $[39] !== t5 || $[40] !== t8) {
|
|
307
|
+
t12 = /* @__PURE__ */ jsxs(PanelElement, {
|
|
299
308
|
style: colorTokens,
|
|
300
309
|
children: [
|
|
301
310
|
input,
|
|
302
311
|
t5,
|
|
303
|
-
|
|
304
|
-
|
|
312
|
+
t8,
|
|
313
|
+
t11,
|
|
305
314
|
swatches
|
|
306
315
|
]
|
|
307
316
|
});
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[35] = t10;
|
|
312
|
-
$[36] = t5;
|
|
313
|
-
$[37] = t7;
|
|
317
|
+
$[35] = colorTokens;
|
|
318
|
+
$[36] = input;
|
|
319
|
+
$[37] = swatches;
|
|
314
320
|
$[38] = t11;
|
|
315
|
-
|
|
316
|
-
|
|
321
|
+
$[39] = t5;
|
|
322
|
+
$[40] = t8;
|
|
323
|
+
$[41] = t12;
|
|
324
|
+
} else t12 = $[41];
|
|
325
|
+
return t12;
|
|
317
326
|
}
|
|
318
327
|
function _temp(item) {
|
|
319
328
|
return /* @__PURE__ */ jsx(__Radio, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPanel.js","names":["Styles","tasty","ReactNode","useEvent","Radio","Slider","CHANNELS","COLOR_SPACE_HINTS","COLOR_SPACE_LABELS","COLOR_SPACES","ColorChannel","ColorSpace","ColorFormat","ColorValue","formatColor","getContrastingColor","toHex","PanelElement","qa","styles","display","flow","gap","padding","width","PreviewElement","placeItems","height","radius","preset","fill","color","shadow","ChannelsElement","gridColumns","ChannelLabelElement","textAlign","ChannelTrackElement","ChannelValueElement","whiteSpace","TRACK_STYLES","top","image","Fill","THUMB_STYLES","THUMB_TOKENS","SPACE_STYLES","TAB_STYLES","flexGrow","ColorPanelProps","space","isDisabled","previewFormat","swatches","input","onChange","onSpaceChange","ChannelRowProps","channel","ChannelRow","t0","$","_c","t1","max","t2","value","apply","handleChange","t3","label","t4","stops","t5","t6","t7","title","t8","t9","Math","min","t10","step","t11","t12","t13","t14","ColorPanel","props","colorTokens","handleSpaceChange","Symbol","for","map","_temp","item"],"sources":["../../../../src/components/fields/color/ColorPanel.tsx"],"sourcesContent":["import { Styles, tasty } from '@tenphi/tasty';\nimport { ReactNode } from 'react';\n\nimport { useEvent } from '../../../_internal';\nimport { Radio } from '../RadioGroup';\nimport { Slider } from '../Slider';\n\nimport {\n CHANNELS,\n COLOR_SPACE_HINTS,\n COLOR_SPACE_LABELS,\n COLOR_SPACES,\n ColorChannel,\n ColorSpace,\n} from './channels';\nimport {\n ColorFormat,\n ColorValue,\n formatColor,\n getContrastingColor,\n toHex,\n} from './color';\n\nconst PanelElement = tasty({\n qa: 'ColorPanel',\n styles: {\n display: 'grid',\n flow: 'row',\n gap: '1x',\n padding: '1x',\n width: '34x',\n },\n});\n\nconst PreviewElement = tasty({\n qa: 'ColorPreview',\n styles: {\n display: 'grid',\n placeItems: 'center',\n height: '6x',\n radius: true,\n preset: 's4',\n fill: '(#color-picker, #clear)',\n color: '(#color-picker-contrast, #dark)',\n shadow: 'inset 0 0 0 1bw #dark.1',\n },\n});\n\nconst ChannelsElement = tasty({\n styles: {\n display: 'grid',\n gridColumns: 'max-content 1sf max-content',\n placeItems: 'center stretch',\n gap: '1x',\n },\n});\n\nconst ChannelLabelElement = tasty({\n styles: {\n preset: 'c2',\n color: '#dark-03',\n textAlign: 'center',\n width: '2x',\n },\n});\n\nconst ChannelTrackElement = tasty({\n styles: {\n display: 'grid',\n placeItems: 'center stretch',\n },\n});\n\nconst ChannelValueElement = tasty({\n styles: {\n preset: 's4',\n color: '#dark-02',\n textAlign: 'right',\n whiteSpace: 'nowrap',\n width: '5.5x',\n },\n});\n\n/**\n * The gradient reaches the track through a plain custom property so the track\n * keeps a single cached style rule. A color picker moves its channels\n * continuously, and a fresh `styles` object per frame would emit a fresh CSS\n * rule per frame.\n */\nconst TRACK_STYLES: Styles = {\n height: '1x',\n top: '.5x',\n radius: '1r',\n fill: '#clear',\n image: '$channel-gradient',\n shadow: 'inset 0 0 0 1bw #dark.1',\n Fill: false,\n};\n\n/** A ring keeps the thumb visible wherever it sits on its own gradient. */\nconst THUMB_STYLES: Styles = {\n shadow: '0 0 0 2bw #surface, 0 0 0 3bw #dark.2',\n};\n\nconst THUMB_TOKENS = { '#slider-thumb': '(#color-picker, #surface)' };\n\nconst SPACE_STYLES: Styles = { width: '100%' };\nconst TAB_STYLES: Styles = { flexGrow: 1 };\n\nexport interface ColorPanelProps {\n color: ColorValue;\n space: ColorSpace;\n isDisabled?: boolean;\n /** Notation used for the preview caption. */\n previewFormat: ColorFormat;\n /** Optional palette rendered under the channels. */\n swatches?: ReactNode;\n /** Optional value field rendered above the preview. */\n input?: ReactNode;\n onChange: (color: ColorValue) => void;\n onSpaceChange: (space: ColorSpace) => void;\n}\n\ninterface ChannelRowProps {\n channel: ColorChannel;\n color: ColorValue;\n isDisabled?: boolean;\n onChange: (color: ColorValue) => void;\n}\n\nfunction ChannelRow({ channel, color, isDisabled, onChange }: ChannelRowProps) {\n const max = channel.max(color);\n\n const handleChange = useEvent((value: number) => {\n onChange(channel.apply(color, value));\n });\n\n return (\n <>\n <ChannelLabelElement aria-hidden=\"true\">\n {channel.label}\n </ChannelLabelElement>\n <ChannelTrackElement\n style={{\n '--channel-gradient': `linear-gradient(to right, ${channel.stops(\n color,\n )})`,\n }}\n >\n <Slider\n aria-label={channel.title}\n value={Math.min(channel.value(color), max)}\n minValue={channel.min}\n maxValue={max}\n step={channel.step}\n isDisabled={isDisabled}\n trackStyles={TRACK_STYLES}\n thumbStyles={THUMB_STYLES}\n thumbTokens={THUMB_TOKENS}\n onChange={handleChange}\n />\n </ChannelTrackElement>\n <ChannelValueElement>{channel.display(color)}</ChannelValueElement>\n </>\n );\n}\n\n/**\n * The popover body shared by `ColorInput` and `ColorPicker`: a preview, a\n * switch between the three color concepts, and one gradient slider per channel\n * of the active one.\n */\nexport function ColorPanel(props: ColorPanelProps) {\n const {\n color,\n space,\n isDisabled,\n previewFormat,\n swatches,\n input,\n onChange,\n onSpaceChange,\n } = props;\n\n const colorTokens = {\n '--color-picker-color': toHex(color),\n '--color-picker-contrast-color': getContrastingColor(color),\n };\n\n const handleSpaceChange = useEvent((value: string) => {\n onSpaceChange(value as ColorSpace);\n });\n\n return (\n <PanelElement style={colorTokens}>\n {input}\n <PreviewElement>{formatColor(color, previewFormat)}</PreviewElement>\n <Radio.Tabs\n aria-label=\"Color space\"\n value={space}\n isDisabled={isDisabled}\n styles={SPACE_STYLES}\n onChange={handleSpaceChange}\n >\n {COLOR_SPACES.map((item) => (\n <Radio\n key={item}\n value={item}\n aria-label={COLOR_SPACE_LABELS[item]}\n tooltip={COLOR_SPACE_HINTS[item]}\n styles={TAB_STYLES}\n >\n {COLOR_SPACE_LABELS[item]}\n </Radio>\n ))}\n </Radio.Tabs>\n <ChannelsElement>\n {CHANNELS[space].map((channel) => (\n <ChannelRow\n key={`${space}-${channel.label}`}\n channel={channel}\n color={color}\n isDisabled={isDisabled}\n onChange={onChange}\n />\n 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;AAAA8B,IAAA,MAAAV;AAAAU,IAAA,MAAAN;AAAAM,IAAA,MAAAX;AAAAW,IAAA,MAAAgB;AAAAhB,IAAA,MAAAiB;OAAAA,MAAAjB,EAAA;CAAA,IAAAoB;AAAA,KAAApB,EAAA,QAAAiB,IAAA;AATJG,QAAA,oBAAC,6BACEH,KASe;AAAAjB,IAAA,MAAAiB;AAAAjB,IAAA,MAAAoB;OAAAA,OAAApB,EAAA;CAAA,IAAAsB;AAAA,KAAAtB,EAAA,QAAA4B,eAAA5B,EAAA,QAAAP,SAAAO,EAAA,QAAAR,YAAAQ,EAAA,QAAAoB,OAAApB,EAAA,QAAAY,MAAAZ,EAAA,QAAAc,IAAA;AAhCpBQ,QAAA,qBAAC;GAAoBM,OAAAA;;IAClBnC;IACDmB;IACAE;IAmBAM;IAWC5B;;IACY;AAAAQ,IAAA,MAAA4B;AAAA5B,IAAA,MAAAP;AAAAO,IAAA,MAAAR;AAAAQ,IAAA,MAAAoB;AAAApB,IAAA,MAAAY;AAAAZ,IAAA,MAAAc;AAAAd,IAAA,MAAAsB;OAAAA,OAAAtB,EAAA;AAAA,QAlCfsB;;AAtBG,SAAAW,MAAAC,MAAA;AAAA,QAiCG,oBAAC;EAEQA,OAAAA;EACK,cAAAvF,mBAAmBuF;EACtB,SAAAxF,kBAAkBwF;EACnBhD,QAAAA;YAEPvC,mBAAmBuF;IANfA,KAOC"}
|
|
1
|
+
{"version":3,"file":"ColorPanel.js","names":["Styles","tasty","ReactNode","useEvent","useI18n","Radio","Slider","CHANNELS","COLOR_SPACE_HINTS","COLOR_SPACE_LABELS","COLOR_SPACES","ColorChannel","ColorSpace","ColorFormat","ColorValue","formatColor","getContrastingColor","toHex","PanelElement","qa","styles","display","flow","gap","padding","width","PreviewElement","placeItems","height","radius","preset","fill","color","shadow","ChannelsElement","gridColumns","ChannelLabelElement","textAlign","ChannelTrackElement","ChannelValueElement","whiteSpace","TRACK_STYLES","top","image","Fill","THUMB_STYLES","THUMB_TOKENS","SPACE_STYLES","TAB_STYLES","flexGrow","ColorPanelProps","space","isDisabled","previewFormat","swatches","input","onChange","onSpaceChange","ChannelRowProps","channel","ChannelRow","t0","$","_c","t1","max","t2","value","apply","handleChange","t3","label","t4","stops","t5","t6","t7","title","t8","t9","Math","min","t10","step","t11","t12","t13","t14","ColorPanel","props","t","colorTokens","handleSpaceChange","Symbol","for","map","_temp","item"],"sources":["../../../../src/components/fields/color/ColorPanel.tsx"],"sourcesContent":["import { Styles, tasty } from '@tenphi/tasty';\nimport { ReactNode } from 'react';\n\nimport { useEvent } from '../../../_internal';\nimport { useI18n } from '../../../i18n';\nimport { Radio } from '../RadioGroup';\nimport { Slider } from '../Slider';\n\nimport {\n CHANNELS,\n COLOR_SPACE_HINTS,\n COLOR_SPACE_LABELS,\n COLOR_SPACES,\n ColorChannel,\n ColorSpace,\n} from './channels';\nimport {\n ColorFormat,\n ColorValue,\n formatColor,\n getContrastingColor,\n toHex,\n} from './color';\n\nconst PanelElement = tasty({\n qa: 'ColorPanel',\n styles: {\n display: 'grid',\n flow: 'row',\n gap: '1x',\n padding: '1x',\n width: '34x',\n },\n});\n\nconst PreviewElement = tasty({\n qa: 'ColorPreview',\n styles: {\n display: 'grid',\n placeItems: 'center',\n height: '6x',\n radius: true,\n preset: 's4',\n fill: '(#color-picker, #clear)',\n color: '(#color-picker-contrast, #dark)',\n shadow: 'inset 0 0 0 1bw #dark.1',\n },\n});\n\nconst ChannelsElement = tasty({\n styles: {\n display: 'grid',\n gridColumns: 'max-content 1sf max-content',\n placeItems: 'center stretch',\n gap: '1x',\n },\n});\n\nconst ChannelLabelElement = tasty({\n styles: {\n preset: 'c2',\n color: '#dark-03',\n textAlign: 'center',\n width: '2x',\n },\n});\n\nconst ChannelTrackElement = tasty({\n styles: {\n display: 'grid',\n placeItems: 'center stretch',\n },\n});\n\nconst ChannelValueElement = tasty({\n styles: {\n preset: 's4',\n color: '#dark-02',\n textAlign: 'right',\n whiteSpace: 'nowrap',\n width: '5.5x',\n },\n});\n\n/**\n * The gradient reaches the track through a plain custom property so the track\n * keeps a single cached style rule. A color picker moves its channels\n * continuously, and a fresh `styles` object per frame would emit a fresh CSS\n * rule per frame.\n */\nconst TRACK_STYLES: Styles = {\n height: '1x',\n top: '.5x',\n radius: '1r',\n fill: '#clear',\n image: '$channel-gradient',\n shadow: 'inset 0 0 0 1bw #dark.1',\n Fill: false,\n};\n\n/** A ring keeps the thumb visible wherever it sits on its own gradient. */\nconst THUMB_STYLES: Styles = {\n shadow: '0 0 0 2bw #surface, 0 0 0 3bw #dark.2',\n};\n\nconst THUMB_TOKENS = { '#slider-thumb': '(#color-picker, #surface)' };\n\nconst SPACE_STYLES: Styles = { width: '100%' };\nconst TAB_STYLES: Styles = { flexGrow: 1 };\n\nexport interface ColorPanelProps {\n color: ColorValue;\n space: ColorSpace;\n isDisabled?: boolean;\n /** Notation used for the preview caption. */\n previewFormat: ColorFormat;\n /** Optional palette rendered under the channels. */\n swatches?: ReactNode;\n /** Optional value field rendered above the preview. */\n input?: ReactNode;\n onChange: (color: ColorValue) => void;\n onSpaceChange: (space: ColorSpace) => void;\n}\n\ninterface ChannelRowProps {\n channel: ColorChannel;\n color: ColorValue;\n isDisabled?: boolean;\n onChange: (color: ColorValue) => void;\n}\n\nfunction ChannelRow({ channel, color, isDisabled, onChange }: ChannelRowProps) {\n const max = channel.max(color);\n\n const handleChange = useEvent((value: number) => {\n onChange(channel.apply(color, value));\n });\n\n return (\n <>\n <ChannelLabelElement aria-hidden=\"true\">\n {channel.label}\n </ChannelLabelElement>\n <ChannelTrackElement\n style={{\n '--channel-gradient': `linear-gradient(to right, ${channel.stops(\n color,\n )})`,\n }}\n >\n <Slider\n aria-label={channel.title}\n value={Math.min(channel.value(color), max)}\n minValue={channel.min}\n maxValue={max}\n step={channel.step}\n isDisabled={isDisabled}\n trackStyles={TRACK_STYLES}\n thumbStyles={THUMB_STYLES}\n thumbTokens={THUMB_TOKENS}\n onChange={handleChange}\n />\n </ChannelTrackElement>\n <ChannelValueElement>{channel.display(color)}</ChannelValueElement>\n </>\n );\n}\n\n/**\n * The popover body shared by `ColorInput` and `ColorPicker`: a preview, a\n * switch between the three color concepts, and one gradient slider per channel\n * of the active one.\n */\nexport function ColorPanel(props: ColorPanelProps) {\n const {\n color,\n space,\n isDisabled,\n previewFormat,\n swatches,\n input,\n onChange,\n onSpaceChange,\n } = props;\n const { t } = useI18n();\n\n const colorTokens = {\n '--color-picker-color': toHex(color),\n '--color-picker-contrast-color': getContrastingColor(color),\n };\n\n const handleSpaceChange = useEvent((value: string) => {\n onSpaceChange(value as ColorSpace);\n });\n\n return (\n <PanelElement style={colorTokens}>\n {input}\n <PreviewElement>{formatColor(color, previewFormat)}</PreviewElement>\n <Radio.Tabs\n aria-label={t('colorPicker.colorSpace', 'Color space')}\n value={space}\n isDisabled={isDisabled}\n styles={SPACE_STYLES}\n onChange={handleSpaceChange}\n >\n {COLOR_SPACES.map((item) => (\n <Radio\n key={item}\n value={item}\n aria-label={COLOR_SPACE_LABELS[item]}\n tooltip={COLOR_SPACE_HINTS[item]}\n styles={TAB_STYLES}\n >\n {COLOR_SPACE_LABELS[item]}\n </Radio>\n ))}\n </Radio.Tabs>\n <ChannelsElement>\n {CHANNELS[space].map((channel) => (\n <ChannelRow\n key={`${space}-${channel.label}`}\n channel={channel}\n color={color}\n isDisabled={isDisabled}\n onChange={onChange}\n />\n ))}\n </ChannelsElement>\n {swatches}\n </PanelElement>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAMkB,eAAejB,MAAM;CACzBkB,IAAI;CACJC,QAAQ;EACNC,SAAS;EACTC,MAAM;EACNC,KAAK;EACLC,SAAS;EACTC,OAAO;EACT;CACD,CAAC;AAEF,MAAMC,iBAAiBzB,MAAM;CAC3BkB,IAAI;CACJC,QAAQ;EACNC,SAAS;EACTM,YAAY;EACZC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,MAAM;EACNC,OAAO;EACPC,QAAQ;EACV;CACD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B;AAAA,KAAAtB,EAAA,QAAAoB,KAAA;AATJE,QAAA,oBAAC,6BACEF,MASe;AAAApB,IAAA,MAAAoB;AAAApB,IAAA,MAAAsB;OAAAA,OAAAtB,EAAA;CAAA,IAAAuB;AAAA,KAAAvB,EAAA,QAAA6B,eAAA7B,EAAA,QAAAP,SAAAO,EAAA,QAAAR,YAAAQ,EAAA,QAAAsB,OAAAtB,EAAA,QAAAY,MAAAZ,EAAA,QAAAgB,IAAA;AAhCpBO,QAAA,qBAAC;GAAoBM,OAAAA;;IAClBpC;IACDmB;IACAI;IAmBAM;IAWC9B;;IACY;AAAAQ,IAAA,MAAA6B;AAAA7B,IAAA,MAAAP;AAAAO,IAAA,MAAAR;AAAAQ,IAAA,MAAAsB;AAAAtB,IAAA,MAAAY;AAAAZ,IAAA,MAAAgB;AAAAhB,IAAA,MAAAuB;OAAAA,OAAAvB,EAAA;AAAA,QAlCfuB;;AAvBG,SAAAW,MAAAC,MAAA;AAAA,QAkCG,oBAAC;EAEQA,OAAAA;EACK,cAAAxF,mBAAmBwF;EACtB,SAAAzF,kBAAkByF;EACnBjD,QAAAA;YAEPvC,mBAAmBwF;IANfA,KAOC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.194.0 | Cube Dev Team */
|
|
2
2
|
import { maxChroma, normalizeHue, oklchToOkhsl } from "../../../utils/colors.js";
|
|
3
3
|
import { fromOkhst, fromRgb, isAchromatic, toHex, toOkhst, toOklch, toRgb } from "./color.js";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.194.0 | Cube Dev Team */
|
|
2
2
|
import { anyNaN, clamp, maxChroma, normalizeHue, oklchToOkhsl, parseColorFunction, readComponent, readHue, rgbFromSrgb } from "../../../utils/colors.js";
|
|
3
3
|
import { contrastRatioFromLuminance, formatHsl, formatOkhsl, formatOkhst, formatOklch, formatRgb, hslToSrgb, okhslToLinearSrgb, okhslToOkhst, okhslToOklch, okhslToSrgb, okhstToOkhsl, parseHexAlpha, relativeLuminanceFromLinearRgb, srgbToHex, srgbToOkhsl } from "@tenphi/glaze";
|
|
4
4
|
|
|
@@ -34,6 +34,7 @@ declare const FieldWrapper: react.ForwardRefExoticComponent<ValidationProps & {
|
|
|
34
34
|
messageStyles?: _tenphi_tasty0.Styles;
|
|
35
35
|
errorMessage?: string | react.ReactNode;
|
|
36
36
|
Component?: react.ReactElement;
|
|
37
|
+
controlId?: string;
|
|
37
38
|
children?: react.ReactNode;
|
|
38
39
|
} & react.RefAttributes<unknown>>;
|
|
39
40
|
//#endregion
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.194.0 | Cube Dev Team */
|
|
2
2
|
import { mergeProps } from "../../../utils/react/mergeProps.js";
|
|
3
3
|
import { wrapNodeIfPlain } from "../../../utils/react/wrapNodeIfPlain.js";
|
|
4
4
|
import { isDevEnv } from "../../../utils/is-dev-env.js";
|
|
5
5
|
import { _Text } from "../../content/Text.js";
|
|
6
|
-
import { Space } from "../../layout/Space.js";
|
|
7
6
|
import { useI18n } from "../../../i18n/useI18n.js";
|
|
7
|
+
import { Space } from "../../layout/Space.js";
|
|
8
8
|
import { InfoBadge } from "../../content/InfoBadge/InfoBadge.js";
|
|
9
9
|
import { Flex } from "../../layout/Flex.js";
|
|
10
10
|
import { getValidationMods } from "../validation/resolve-validation-props.js";
|
|
11
11
|
import { NecessityIndicatorMark, _Label } from "../Label.js";
|
|
12
12
|
import { warnAboutLegacyTooltip } from "../legacy-tooltip.js";
|
|
13
|
+
import { getFieldDescriptionId, getFieldMessageId, useFieldTextId } from "./field-description.js";
|
|
13
14
|
import { c } from "react/compiler-runtime";
|
|
14
15
|
import { tasty } from "@tenphi/tasty";
|
|
15
16
|
import { forwardRef } from "react";
|
|
@@ -101,8 +102,8 @@ const LabelSuffixElement = tasty({ styles: {
|
|
|
101
102
|
* @internal Do not use this component directly.
|
|
102
103
|
*/
|
|
103
104
|
const FieldWrapper = forwardRef(function FieldWrapper(props, ref) {
|
|
104
|
-
const $ = c(
|
|
105
|
-
const { as, labelPosition: t0, label, extra, styles, isRequired, isOptional, isDisabled, labelStyles, necessityIndicator, labelProps, fieldProps, message, messageStyles, description, errorMessage, Component, isInvalid, isValid, requiredMark: t1, labelTooltip, isHidden, labelSuffix, children } = props;
|
|
105
|
+
const $ = c(71);
|
|
106
|
+
const { as, labelPosition: t0, label, extra, styles, isRequired, isOptional, isDisabled, labelStyles, necessityIndicator, labelProps, fieldProps, message, messageStyles, description, errorMessage, Component, controlId, isInvalid, isValid, requiredMark: t1, labelTooltip, isHidden, labelSuffix, children } = props;
|
|
106
107
|
const labelPosition = t0 === void 0 ? "top" : t0;
|
|
107
108
|
const requiredMark = t1 === void 0 ? true : t1;
|
|
108
109
|
const { t } = useI18n();
|
|
@@ -170,87 +171,109 @@ const FieldWrapper = forwardRef(function FieldWrapper(props, ref) {
|
|
|
170
171
|
$[18] = t3;
|
|
171
172
|
} else t3 = $[18];
|
|
172
173
|
const labelComponent = t3;
|
|
174
|
+
const displayMessage = errorMessage || message;
|
|
175
|
+
const isErrorMessage = !!errorMessage;
|
|
176
|
+
const isMessageShown = !!displayMessage && !isDisabled;
|
|
173
177
|
let t4;
|
|
174
|
-
if ($[19] !== description) {
|
|
175
|
-
t4 = ()
|
|
178
|
+
if ($[19] !== controlId || $[20] !== description) {
|
|
179
|
+
t4 = controlId && description ? getFieldDescriptionId(controlId) : void 0;
|
|
180
|
+
$[19] = controlId;
|
|
181
|
+
$[20] = description;
|
|
182
|
+
$[21] = t4;
|
|
183
|
+
} else t4 = $[21];
|
|
184
|
+
const descriptionId = t4;
|
|
185
|
+
let t5;
|
|
186
|
+
if ($[22] !== controlId || $[23] !== isMessageShown) {
|
|
187
|
+
t5 = controlId && isMessageShown ? getFieldMessageId(controlId) : void 0;
|
|
188
|
+
$[22] = controlId;
|
|
189
|
+
$[23] = isMessageShown;
|
|
190
|
+
$[24] = t5;
|
|
191
|
+
} else t5 = $[24];
|
|
192
|
+
const messageId = t5;
|
|
193
|
+
useFieldTextId(descriptionId);
|
|
194
|
+
useFieldTextId(messageId);
|
|
195
|
+
let t6;
|
|
196
|
+
if ($[25] !== description || $[26] !== descriptionId) {
|
|
197
|
+
t6 = () => {
|
|
176
198
|
if (!description) return null;
|
|
177
199
|
return /* @__PURE__ */ jsx(DescriptionElement, {
|
|
200
|
+
id: descriptionId,
|
|
178
201
|
"data-element": "Description",
|
|
179
202
|
children: wrapNodeIfPlain(description, () => /* @__PURE__ */ jsx("span", { children: description }))
|
|
180
203
|
});
|
|
181
204
|
};
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
$[25] = description;
|
|
206
|
+
$[26] = descriptionId;
|
|
207
|
+
$[27] = t6;
|
|
208
|
+
} else t6 = $[27];
|
|
209
|
+
const createDescriptionComponent = t6;
|
|
210
|
+
let t7;
|
|
211
|
+
if ($[28] !== createDescriptionComponent || $[29] !== labelPosition) {
|
|
212
|
+
t7 = labelPosition === "side" || labelPosition === "split" ? createDescriptionComponent() : null;
|
|
213
|
+
$[28] = createDescriptionComponent;
|
|
214
|
+
$[29] = labelPosition;
|
|
215
|
+
$[30] = t7;
|
|
216
|
+
} else t7 = $[30];
|
|
217
|
+
const descriptionForLabel = t7;
|
|
218
|
+
let t8;
|
|
219
|
+
if ($[31] !== createDescriptionComponent || $[32] !== labelPosition) {
|
|
220
|
+
t8 = labelPosition === "top" ? createDescriptionComponent() : null;
|
|
221
|
+
$[31] = createDescriptionComponent;
|
|
222
|
+
$[32] = labelPosition;
|
|
223
|
+
$[33] = t8;
|
|
224
|
+
} else t8 = $[33];
|
|
225
|
+
const descriptionForInput = t8;
|
|
226
|
+
const t9 = labelPosition === "side";
|
|
227
|
+
const t10 = labelPosition === "split";
|
|
228
|
+
const t11 = !!description;
|
|
229
|
+
let t12;
|
|
230
|
+
if ($[34] !== isInvalid || $[35] !== isValid) {
|
|
231
|
+
t12 = getValidationMods({
|
|
208
232
|
isInvalid,
|
|
209
233
|
isValid
|
|
210
234
|
});
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
} else
|
|
215
|
-
let
|
|
216
|
-
if ($[
|
|
217
|
-
|
|
218
|
-
"has-sider":
|
|
219
|
-
"has-split":
|
|
220
|
-
"has-description":
|
|
221
|
-
...
|
|
235
|
+
$[34] = isInvalid;
|
|
236
|
+
$[35] = isValid;
|
|
237
|
+
$[36] = t12;
|
|
238
|
+
} else t12 = $[36];
|
|
239
|
+
let t13;
|
|
240
|
+
if ($[37] !== t10 || $[38] !== t11 || $[39] !== t12 || $[40] !== t9) {
|
|
241
|
+
t13 = {
|
|
242
|
+
"has-sider": t9,
|
|
243
|
+
"has-split": t10,
|
|
244
|
+
"has-description": t11,
|
|
245
|
+
...t12
|
|
222
246
|
};
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
} else
|
|
229
|
-
const mods =
|
|
230
|
-
const displayMessage = errorMessage || message;
|
|
231
|
-
const isErrorMessage = !!errorMessage;
|
|
232
|
-
let t12;
|
|
233
|
-
if ($[35] !== fieldProps || $[36] !== styles) {
|
|
234
|
-
t12 = styles ? mergeProps(fieldProps, { styles }) : fieldProps;
|
|
235
|
-
$[35] = fieldProps;
|
|
236
|
-
$[36] = styles;
|
|
237
|
-
$[37] = t12;
|
|
238
|
-
} else t12 = $[37];
|
|
239
|
-
const mergedFieldProps = t12;
|
|
240
|
-
const t13 = as ?? "div";
|
|
247
|
+
$[37] = t10;
|
|
248
|
+
$[38] = t11;
|
|
249
|
+
$[39] = t12;
|
|
250
|
+
$[40] = t9;
|
|
251
|
+
$[41] = t13;
|
|
252
|
+
} else t13 = $[41];
|
|
253
|
+
const mods = t13;
|
|
241
254
|
let t14;
|
|
242
|
-
if ($[
|
|
243
|
-
t14 =
|
|
255
|
+
if ($[42] !== fieldProps || $[43] !== styles) {
|
|
256
|
+
t14 = styles ? mergeProps(fieldProps, { styles }) : fieldProps;
|
|
257
|
+
$[42] = fieldProps;
|
|
258
|
+
$[43] = styles;
|
|
259
|
+
$[44] = t14;
|
|
260
|
+
} else t14 = $[44];
|
|
261
|
+
const mergedFieldProps = t14;
|
|
262
|
+
const t15 = as ?? "div";
|
|
263
|
+
let t16;
|
|
264
|
+
if ($[45] !== descriptionForLabel || $[46] !== labelComponent) {
|
|
265
|
+
t16 = labelComponent || descriptionForLabel ? /* @__PURE__ */ jsxs("div", {
|
|
244
266
|
"data-element": "LabelArea",
|
|
245
267
|
children: [labelComponent, descriptionForLabel]
|
|
246
268
|
}) : null;
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
} else
|
|
251
|
-
let
|
|
252
|
-
if ($[
|
|
253
|
-
|
|
269
|
+
$[45] = descriptionForLabel;
|
|
270
|
+
$[46] = labelComponent;
|
|
271
|
+
$[47] = t16;
|
|
272
|
+
} else t16 = $[47];
|
|
273
|
+
let t17;
|
|
274
|
+
if ($[48] !== displayMessage || $[49] !== isErrorMessage || $[50] !== isInvalid || $[51] !== isMessageShown || $[52] !== messageId || $[53] !== messageStyles || $[54] !== mods) {
|
|
275
|
+
t17 = isMessageShown && /* @__PURE__ */ jsx(MessageElement, {
|
|
276
|
+
id: messageId,
|
|
254
277
|
mods: {
|
|
255
278
|
...mods,
|
|
256
279
|
invalid: isErrorMessage || !!isInvalid
|
|
@@ -259,56 +282,57 @@ const FieldWrapper = forwardRef(function FieldWrapper(props, ref) {
|
|
|
259
282
|
role: isErrorMessage || isInvalid ? "alert" : void 0,
|
|
260
283
|
children: displayMessage
|
|
261
284
|
});
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
285
|
+
$[48] = displayMessage;
|
|
286
|
+
$[49] = isErrorMessage;
|
|
287
|
+
$[50] = isInvalid;
|
|
288
|
+
$[51] = isMessageShown;
|
|
289
|
+
$[52] = messageId;
|
|
290
|
+
$[53] = messageStyles;
|
|
291
|
+
$[54] = mods;
|
|
292
|
+
$[55] = t17;
|
|
293
|
+
} else t17 = $[55];
|
|
294
|
+
let t18;
|
|
295
|
+
if ($[56] !== Component || $[57] !== descriptionForInput || $[58] !== t17) {
|
|
296
|
+
t18 = /* @__PURE__ */ jsxs("div", {
|
|
273
297
|
"data-element": "InputArea",
|
|
274
298
|
children: [
|
|
275
299
|
Component,
|
|
276
300
|
descriptionForInput,
|
|
277
|
-
|
|
301
|
+
t17
|
|
278
302
|
]
|
|
279
303
|
});
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
} else
|
|
285
|
-
let
|
|
286
|
-
if ($[
|
|
287
|
-
|
|
304
|
+
$[56] = Component;
|
|
305
|
+
$[57] = descriptionForInput;
|
|
306
|
+
$[58] = t17;
|
|
307
|
+
$[59] = t18;
|
|
308
|
+
} else t18 = $[59];
|
|
309
|
+
let t19;
|
|
310
|
+
if ($[60] !== isHidden || $[61] !== mergedFieldProps || $[62] !== mods || $[63] !== ref || $[64] !== t15 || $[65] !== t16 || $[66] !== t18) {
|
|
311
|
+
t19 = /* @__PURE__ */ jsxs(FieldElement, {
|
|
288
312
|
ref,
|
|
289
|
-
as:
|
|
313
|
+
as: t15,
|
|
290
314
|
mods,
|
|
291
315
|
isHidden,
|
|
292
316
|
...mergedFieldProps,
|
|
293
|
-
children: [
|
|
317
|
+
children: [t16, t18]
|
|
294
318
|
});
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
} else
|
|
304
|
-
let
|
|
305
|
-
if ($[
|
|
306
|
-
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
} else
|
|
311
|
-
return
|
|
319
|
+
$[60] = isHidden;
|
|
320
|
+
$[61] = mergedFieldProps;
|
|
321
|
+
$[62] = mods;
|
|
322
|
+
$[63] = ref;
|
|
323
|
+
$[64] = t15;
|
|
324
|
+
$[65] = t16;
|
|
325
|
+
$[66] = t18;
|
|
326
|
+
$[67] = t19;
|
|
327
|
+
} else t19 = $[67];
|
|
328
|
+
let t20;
|
|
329
|
+
if ($[68] !== children || $[69] !== t19) {
|
|
330
|
+
t20 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t19, children] });
|
|
331
|
+
$[68] = children;
|
|
332
|
+
$[69] = t19;
|
|
333
|
+
$[70] = t20;
|
|
334
|
+
} else t20 = $[70];
|
|
335
|
+
return t20;
|
|
312
336
|
});
|
|
313
337
|
|
|
314
338
|
//#endregion
|