@cube-dev/ui-kit 0.143.1 → 0.144.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/CHANGELOG.md +6 -0
- package/dist/README.md +1 -1
- package/dist/_internal/hooks/use-chained-callback.js +1 -1
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/GlobalStyles.js +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/Root.js +1 -1
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.js +1 -1
- package/dist/components/actions/Button/Button.js +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +1 -1
- package/dist/components/actions/ItemActionContext.js +1 -1
- package/dist/components/actions/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/MenuItem.js +1 -1
- package/dist/components/actions/Menu/MenuSection.js +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/dist/components/actions/Menu/context.js +1 -1
- package/dist/components/actions/Menu/styled.js +1 -1
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/use-action.js +1 -1
- package/dist/components/actions/use-anchored-menu.js +1 -1
- package/dist/components/actions/use-context-menu.js +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
- package/dist/components/content/Alert/Alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js +1 -1
- package/dist/components/content/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.js +1 -1
- package/dist/components/content/Card/Card.js +1 -1
- package/dist/components/content/Content.js +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +1 -1
- package/dist/components/content/Divider.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/InlineInput/InlineInput.js +1 -1
- package/dist/components/content/Item/Item.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Paragraph.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Tag/Tag.js +1 -1
- package/dist/components/content/Text.js +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/Tree/Tree.js +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 +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ComboBox/ComboBox.js +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 +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/intl.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.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.js +1 -1
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.js +1 -1
- package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +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.js +1 -1
- 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/SearchInput/SearchInput.js +1 -1
- package/dist/components/fields/Select/Select.js +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/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/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
- package/dist/components/form/FieldWrapper/extract-field-wrapper-props.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/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/index.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/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/Board/Board.d.ts +110 -0
- package/dist/components/layout/Board/Board.js +455 -0
- package/dist/components/layout/Board/Board.js.map +1 -0
- package/dist/components/layout/Board/BoardProvider.d.ts +28 -0
- package/dist/components/layout/Board/BoardProvider.js +47 -0
- package/dist/components/layout/Board/BoardProvider.js.map +1 -0
- package/dist/components/layout/Board/BoardResponsive.d.ts +52 -0
- package/dist/components/layout/Board/BoardResponsive.js +101 -0
- package/dist/components/layout/Board/BoardResponsive.js.map +1 -0
- package/dist/components/layout/Board/Widget.d.ts +49 -0
- package/dist/components/layout/Board/Widget.js +42 -0
- package/dist/components/layout/Board/Widget.js.map +1 -0
- package/dist/components/layout/Board/WidgetHost.js +423 -0
- package/dist/components/layout/Board/WidgetHost.js.map +1 -0
- package/dist/components/layout/Board/board-context.d.ts +16 -0
- package/dist/components/layout/Board/board-context.js +32 -0
- package/dist/components/layout/Board/board-context.js.map +1 -0
- package/dist/components/layout/Board/board-store.d.ts +3 -0
- package/dist/components/layout/Board/board-store.js +49 -0
- package/dist/components/layout/Board/board-store.js.map +1 -0
- package/dist/components/layout/Board/grid-core/calculate.js +90 -0
- package/dist/components/layout/Board/grid-core/calculate.js.map +1 -0
- package/dist/components/layout/Board/grid-core/collision.js +35 -0
- package/dist/components/layout/Board/grid-core/collision.js.map +1 -0
- package/dist/components/layout/Board/grid-core/compactors.d.ts +23 -0
- package/dist/components/layout/Board/grid-core/compactors.js +166 -0
- package/dist/components/layout/Board/grid-core/compactors.js.map +1 -0
- package/dist/components/layout/Board/grid-core/constraints.d.ts +35 -0
- package/dist/components/layout/Board/grid-core/constraints.js +155 -0
- package/dist/components/layout/Board/grid-core/constraints.js.map +1 -0
- package/dist/components/layout/Board/grid-core/layout.js +176 -0
- package/dist/components/layout/Board/grid-core/layout.js.map +1 -0
- package/dist/components/layout/Board/grid-core/sort.js +37 -0
- package/dist/components/layout/Board/grid-core/sort.js.map +1 -0
- package/dist/components/layout/Board/grid-core/types.d.ts +168 -0
- package/dist/components/layout/Board/index.d.ts +21 -0
- package/dist/components/layout/Board/index.js +18 -0
- package/dist/components/layout/Board/index.js.map +1 -0
- package/dist/components/layout/Board/responsive-utils.d.ts +13 -0
- package/dist/components/layout/Board/responsive-utils.js +55 -0
- package/dist/components/layout/Board/responsive-utils.js.map +1 -0
- package/dist/components/layout/Board/use-board-layout.js +52 -0
- package/dist/components/layout/Board/use-board-layout.js.map +1 -0
- package/dist/components/layout/Board/use-board-registry.js +372 -0
- package/dist/components/layout/Board/use-board-registry.js.map +1 -0
- 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/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +36 -4
- package/dist/components/navigation/Tabs/TabButton.js.map +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +6 -3
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/navigation/Tabs/TabsAction.js +1 -1
- package/dist/components/navigation/Tabs/TabsContext.js +1 -1
- package/dist/components/navigation/Tabs/popover-placement.js +1 -1
- package/dist/components/navigation/Tabs/styled.js +3 -2
- package/dist/components/navigation/Tabs/styled.js.map +1 -1
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
- package/dist/components/organisms/FileTabs/FileTabs.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/RangeCalendar.js +1 -1
- package/dist/components/other/CloudLogo/CloudLogo.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/context.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Tray.js +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/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.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/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/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/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/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 +12 -2
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/palette.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/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/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/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.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/usePopoverSync.js +1 -1
- package/dist/utils/react/useQaProps.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/layout/Board.md +224 -0
- package/docs/components/navigation/Tabs.md +18 -2
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.144.0 | Cube Dev Team */
|
|
2
2
|
import { useForm } from "./use-form.js";
|
|
3
3
|
import { FormContext, _Form, useFormProps } from "./Form.js";
|
|
4
4
|
import { useField } from "./use-field/use-field.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.144.0 | Cube Dev Team */
|
|
2
2
|
import { mergeProps } from "../../../../utils/react/mergeProps.js";
|
|
3
3
|
import { useEvent } from "../../../../_internal/hooks/use-event.js";
|
|
4
4
|
import { warn } from "../../../../utils/warnings.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.144.0 | Cube Dev Team */
|
|
2
2
|
import { useEvent } from "../../../../_internal/hooks/use-event.js";
|
|
3
3
|
import { useIsFirstRender } from "../../../../_internal/hooks/use-is-first-render.js";
|
|
4
4
|
import { delayValidationRule } from "../validation.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.144.0 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../utils/styles.js";
|
|
3
3
|
import { useProviderProps } from "../../provider.js";
|
|
4
4
|
import { CONTAINER_STYLES, filterBaseProps, tasty } from "@tenphi/tasty";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.144.0 | Cube Dev Team */
|
|
2
2
|
import { mergeProps } from "../../utils/react/mergeProps.js";
|
|
3
3
|
import { FieldWrapper } from "./FieldWrapper/FieldWrapper.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.144.0 | Cube Dev Team */
|
|
2
2
|
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/helpers/DisplayTransition/DisplayTransition.tsx
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.144.0 | Cube Dev Team */
|
|
2
2
|
import { DisplayTransition } from "../DisplayTransition/DisplayTransition.js";
|
|
3
3
|
import { tasty } from "@tenphi/tasty";
|
|
4
4
|
import { isValidElement, useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
|
|
2
|
+
import { LayoutConstraint, LayoutItem, ResizeHandleAxis } from "./grid-core/types.js";
|
|
3
|
+
import { AllBaseProps, ContainerStyleProps } from "@tenphi/tasty";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/layout/Board/Board.d.ts
|
|
7
|
+
type BoardCompactType = 'vertical' | 'horizontal' | 'free' | null;
|
|
8
|
+
/**
|
|
9
|
+
* Payload passed to the drag/resize lifecycle callbacks. `layout` is the board's
|
|
10
|
+
* current layout at the moment the callback fires, `item` is the affected item
|
|
11
|
+
* (falls back to `oldItem` if the item just left this board via a cross-board
|
|
12
|
+
* transfer), `oldItem` is that item as it was when the gesture started, and
|
|
13
|
+
* `placeholder` is the current drop-slot preview (if any).
|
|
14
|
+
*/
|
|
15
|
+
interface BoardInteractionInfo {
|
|
16
|
+
layout: LayoutItem[];
|
|
17
|
+
item: LayoutItem;
|
|
18
|
+
oldItem: LayoutItem;
|
|
19
|
+
placeholder: LayoutItem | null;
|
|
20
|
+
}
|
|
21
|
+
/** Visibility of the internal grid-line overlay. */
|
|
22
|
+
type BoardGridLines = boolean | 'drag';
|
|
23
|
+
interface CubeBoardProps extends Omit<AllBaseProps, 'children' | 'onDragStart' | 'onDrag' | 'onResize'>, Omit<ContainerStyleProps, 'margin'> {
|
|
24
|
+
/** Stable board id (used for cross-board drag). Auto-generated if omitted. */
|
|
25
|
+
id?: string;
|
|
26
|
+
/** Controlled layout. */
|
|
27
|
+
layout?: LayoutItem[];
|
|
28
|
+
/** Initial layout for uncontrolled usage. */
|
|
29
|
+
defaultLayout?: LayoutItem[];
|
|
30
|
+
onLayoutChange?: (layout: LayoutItem[]) => void;
|
|
31
|
+
/** Called when a drag gesture starts. */
|
|
32
|
+
onDragStart?: (info: BoardInteractionInfo) => void;
|
|
33
|
+
/** Called on every step of a drag gesture. */
|
|
34
|
+
onDrag?: (info: BoardInteractionInfo) => void;
|
|
35
|
+
/** Called when a drag gesture ends (after the layout is committed). */
|
|
36
|
+
onDragStop?: (info: BoardInteractionInfo) => void;
|
|
37
|
+
/** Called when a resize gesture starts. */
|
|
38
|
+
onResizeStart?: (info: BoardInteractionInfo) => void;
|
|
39
|
+
/** Called on every step of a resize gesture. */
|
|
40
|
+
onResize?: (info: BoardInteractionInfo) => void;
|
|
41
|
+
/** Called when a resize gesture ends (after the layout is committed). */
|
|
42
|
+
onResizeStop?: (info: BoardInteractionInfo) => void;
|
|
43
|
+
/** Number of columns. @default 12 */
|
|
44
|
+
cols?: number;
|
|
45
|
+
/** Row height in pixels. @default 100 */
|
|
46
|
+
rowHeight?: number;
|
|
47
|
+
/** [horizontal, vertical] margin between widgets in pixels. @default [8, 8] */
|
|
48
|
+
margin?: [number, number];
|
|
49
|
+
/** [horizontal, vertical] padding inside the board. Defaults to `margin`. */
|
|
50
|
+
containerPadding?: [number, number];
|
|
51
|
+
/** Maximum number of rows. @default Infinity */
|
|
52
|
+
maxRows?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Compaction behavior. `'vertical'` / `'horizontal'` reflow widgets to remove
|
|
55
|
+
* gaps; `'free'` places each widget exactly where dropped and never pushes its
|
|
56
|
+
* neighbours (pair with `allowOverlap` to let widgets stack, otherwise moving
|
|
57
|
+
* onto an occupied cell is blocked); `null` disables compaction but still
|
|
58
|
+
* resolves collisions the legacy react-grid-layout way. @default 'vertical'
|
|
59
|
+
*/
|
|
60
|
+
compact?: BoardCompactType;
|
|
61
|
+
/** Allow widgets to overlap. @default false */
|
|
62
|
+
allowOverlap?: boolean;
|
|
63
|
+
/** Block movement into occupied cells instead of pushing. @default false */
|
|
64
|
+
preventCollision?: boolean;
|
|
65
|
+
/** Enable dragging for all widgets. @default true */
|
|
66
|
+
isDraggable?: boolean;
|
|
67
|
+
/** Enable resizing for all widgets. @default true */
|
|
68
|
+
isResizable?: boolean;
|
|
69
|
+
/** Whether this board accepts widgets dropped from other boards. @default true */
|
|
70
|
+
isDroppable?: boolean;
|
|
71
|
+
/** Which resize handles to show. @default ['se'] */
|
|
72
|
+
resizeHandles?: ResizeHandleAxis[];
|
|
73
|
+
/**
|
|
74
|
+
* CSS selector for elements that must not start a pointer drag (e.g. form
|
|
75
|
+
* controls inside a widget: `"input,textarea,button,a,.no-drag"`). Keyboard
|
|
76
|
+
* moves are unaffected. Can be overridden per widget on `Board.Widget`.
|
|
77
|
+
*/
|
|
78
|
+
dragCancel?: string;
|
|
79
|
+
/**
|
|
80
|
+
* CSS selector for the only elements from which a pointer drag may start.
|
|
81
|
+
* Can be overridden per widget on `Board.Widget`.
|
|
82
|
+
*/
|
|
83
|
+
dragHandle?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Show grid lines behind the widgets. `true` always shows them, `'drag'`
|
|
86
|
+
* shows them only while a widget is being dragged or resized, `false` never.
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
showGridLines?: BoardGridLines;
|
|
90
|
+
/**
|
|
91
|
+
* Align this board's grid with an ancestor `Board`'s layout. Only takes
|
|
92
|
+
* effect when the board is nested inside another `Board`'s widget. When set,
|
|
93
|
+
* the board inherits the parent's column pitch (deriving its own column count
|
|
94
|
+
* from its measured width so cells stay parent-sized) and inherits the
|
|
95
|
+
* parent's row height as a target, shrinking rows slightly when needed to fit
|
|
96
|
+
* the height the container widget grants it. @default false
|
|
97
|
+
*/
|
|
98
|
+
isAligned?: boolean;
|
|
99
|
+
/** Grid/item layout constraints. */
|
|
100
|
+
constraints?: LayoutConstraint[];
|
|
101
|
+
/**
|
|
102
|
+
* Explicit container width in pixels. When provided, disables automatic width
|
|
103
|
+
* measurement (useful for SSR and tests).
|
|
104
|
+
*/
|
|
105
|
+
width?: number;
|
|
106
|
+
children?: ReactNode;
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { BoardCompactType, BoardGridLines, BoardInteractionInfo, CubeBoardProps };
|
|
110
|
+
//# sourceMappingURL=Board.d.ts.map
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.144.0 | Cube Dev Team */
|
|
2
|
+
import { extractStyles } from "../../../utils/styles.js";
|
|
3
|
+
import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
4
|
+
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
5
|
+
import { BoardMetricsContext, useBoardHost, useBoardMetrics, useBoardRegistry } from "./board-context.js";
|
|
6
|
+
import { getAllCollisions } from "./grid-core/collision.js";
|
|
7
|
+
import { bottom, cloneLayout, correctBounds, getLayoutItem, modifyLayout } from "./grid-core/layout.js";
|
|
8
|
+
import { getCompactor } from "./grid-core/compactors.js";
|
|
9
|
+
import { calcGridColWidth, calcGridItemPosition, calcWH, clamp } from "./grid-core/calculate.js";
|
|
10
|
+
import { applySizeConstraints, defaultConstraints } from "./grid-core/constraints.js";
|
|
11
|
+
import { BoardProvider } from "./BoardProvider.js";
|
|
12
|
+
import { useBoardLayout } from "./use-board-layout.js";
|
|
13
|
+
import { WidgetHost } from "./WidgetHost.js";
|
|
14
|
+
import { CONTAINER_STYLES, filterBaseProps, tasty } from "@tenphi/tasty";
|
|
15
|
+
import { forwardRef, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { useResizeObserver } from "@react-aria/utils";
|
|
18
|
+
|
|
19
|
+
//#region src/components/layout/Board/Board.tsx
|
|
20
|
+
const BoardElement = tasty({
|
|
21
|
+
qa: "Board",
|
|
22
|
+
styles: {
|
|
23
|
+
position: "relative",
|
|
24
|
+
display: "block",
|
|
25
|
+
width: "100%",
|
|
26
|
+
flexGrow: 1,
|
|
27
|
+
minHeight: "0",
|
|
28
|
+
fill: "#clear",
|
|
29
|
+
boxSizing: "border-box"
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const ContentLayer = tasty({ styles: {
|
|
33
|
+
position: "absolute",
|
|
34
|
+
inset: 0
|
|
35
|
+
} });
|
|
36
|
+
const PlaceholderElement = tasty({
|
|
37
|
+
qa: "BoardPlaceholder",
|
|
38
|
+
styles: {
|
|
39
|
+
position: "absolute",
|
|
40
|
+
top: 0,
|
|
41
|
+
left: 0,
|
|
42
|
+
fill: "#purple.10",
|
|
43
|
+
radius: "1cr",
|
|
44
|
+
border: "#purple.40",
|
|
45
|
+
zIndex: 2,
|
|
46
|
+
pointerEvents: "none",
|
|
47
|
+
transition: "transform 80ms linear, width 80ms linear, height 80ms linear",
|
|
48
|
+
boxSizing: "border-box"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const GridOverlayElement = tasty({
|
|
52
|
+
qa: "BoardGridOverlay",
|
|
53
|
+
styles: {
|
|
54
|
+
position: "absolute",
|
|
55
|
+
zIndex: 0,
|
|
56
|
+
pointerEvents: "none",
|
|
57
|
+
boxSizing: "border-box",
|
|
58
|
+
opacity: ".5"
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Lower bound for the reduced row height used by an aligned nested board, so a
|
|
63
|
+
* very short container can never collapse its rows to zero.
|
|
64
|
+
*/
|
|
65
|
+
const MIN_ALIGNED_ROW_HEIGHT = 24;
|
|
66
|
+
function compactTypeToCore(compact) {
|
|
67
|
+
if (compact === "free") return null;
|
|
68
|
+
return compact;
|
|
69
|
+
}
|
|
70
|
+
function BoardInner(props, ref) {
|
|
71
|
+
const { id: providedId, layout: controlledLayout, defaultLayout, onLayoutChange, onDragStart, onDrag, onDragStop, onResizeStart, onResize: onResizeProp, onResizeStop, cols = 12, rowHeight = 100, margin = [8, 8], containerPadding, maxRows = Infinity, compact = "vertical", allowOverlap = false, preventCollision = false, isDraggable = true, isResizable = true, isDroppable = true, resizeHandles = ["se"], dragCancel, dragHandle, showGridLines = false, isAligned = false, constraints, width: providedWidth, children, ...otherProps } = props;
|
|
72
|
+
const registry = useBoardRegistry();
|
|
73
|
+
const parentMetrics = useBoardMetrics();
|
|
74
|
+
const host = useBoardHost();
|
|
75
|
+
const aligned = isAligned && !!parentMetrics;
|
|
76
|
+
const generatedId = useId();
|
|
77
|
+
const boardId = providedId ?? generatedId;
|
|
78
|
+
const containerRef = useCombinedRefs(ref);
|
|
79
|
+
const contentRef = useRef(null);
|
|
80
|
+
const [measuredWidth, setMeasuredWidth] = useState(0);
|
|
81
|
+
const [measuredHeight, setMeasuredHeight] = useState(0);
|
|
82
|
+
const width = providedWidth ?? measuredWidth;
|
|
83
|
+
const onResizeContainer = useEvent(() => {
|
|
84
|
+
const el = containerRef.current;
|
|
85
|
+
if (!el) return;
|
|
86
|
+
const nextWidth = el.offsetWidth;
|
|
87
|
+
const nextHeight = el.offsetHeight;
|
|
88
|
+
if (nextWidth > 0) setMeasuredWidth(nextWidth);
|
|
89
|
+
if (nextHeight > 0) setMeasuredHeight(nextHeight);
|
|
90
|
+
});
|
|
91
|
+
useResizeObserver({
|
|
92
|
+
ref: containerRef,
|
|
93
|
+
onResize: onResizeContainer
|
|
94
|
+
});
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (providedWidth == null) onResizeContainer();
|
|
97
|
+
}, [providedWidth]);
|
|
98
|
+
const { layout, layoutRef, placeholder, placeholderRef, setPlaceholder, applyLayout } = useBoardLayout({
|
|
99
|
+
layout: controlledLayout,
|
|
100
|
+
defaultLayout,
|
|
101
|
+
onLayoutChange
|
|
102
|
+
});
|
|
103
|
+
useSyncExternalStore(registry.store.subscribe, registry.store.getVersion);
|
|
104
|
+
const effectiveMargin = aligned ? parentMetrics.margin : margin;
|
|
105
|
+
const resolvedPadding = containerPadding ?? effectiveMargin;
|
|
106
|
+
const rows = Math.max(bottom(layout), placeholder ? placeholder.y + placeholder.h : 0);
|
|
107
|
+
const parentColWidth = aligned ? parentMetrics.colWidth : 0;
|
|
108
|
+
const alignedCols = aligned && width > 0 ? Math.max(1, Math.floor((width - resolvedPadding[0] * 2 + effectiveMargin[0]) / (parentColWidth + effectiveMargin[0]))) : cols;
|
|
109
|
+
const effectiveCols = aligned ? alignedCols : cols;
|
|
110
|
+
const effectiveContainerWidth = aligned ? parentColWidth * effectiveCols + effectiveMargin[0] * Math.max(0, effectiveCols - 1) + resolvedPadding[0] * 2 : width;
|
|
111
|
+
const parentRowHeight = aligned ? parentMetrics.rowHeight : rowHeight;
|
|
112
|
+
const effectiveRowHeight = aligned && rows > 0 && measuredHeight > 0 ? clamp((measuredHeight - Math.max(0, rows - 1) * effectiveMargin[1] - resolvedPadding[1] * 2) / rows, MIN_ALIGNED_ROW_HEIGHT, parentRowHeight) : parentRowHeight;
|
|
113
|
+
const positionParams = useMemo(() => ({
|
|
114
|
+
margin: effectiveMargin,
|
|
115
|
+
containerPadding: resolvedPadding,
|
|
116
|
+
containerWidth: effectiveContainerWidth,
|
|
117
|
+
cols: effectiveCols,
|
|
118
|
+
rowHeight: effectiveRowHeight,
|
|
119
|
+
maxRows
|
|
120
|
+
}), [
|
|
121
|
+
effectiveMargin[0],
|
|
122
|
+
effectiveMargin[1],
|
|
123
|
+
resolvedPadding[0],
|
|
124
|
+
resolvedPadding[1],
|
|
125
|
+
effectiveContainerWidth,
|
|
126
|
+
effectiveCols,
|
|
127
|
+
effectiveRowHeight,
|
|
128
|
+
maxRows
|
|
129
|
+
]);
|
|
130
|
+
const compactor = useMemo(() => getCompactor(compactTypeToCore(compact), allowOverlap, compact === "free" ? !allowOverlap : preventCollision), [
|
|
131
|
+
compact,
|
|
132
|
+
allowOverlap,
|
|
133
|
+
preventCollision
|
|
134
|
+
]);
|
|
135
|
+
const resolvedConstraints = constraints ?? defaultConstraints;
|
|
136
|
+
const computedHeight = rows > 0 ? rows * effectiveRowHeight + Math.max(0, rows - 1) * effectiveMargin[1] + resolvedPadding[1] * 2 : effectiveRowHeight;
|
|
137
|
+
const containerHeight = aligned && measuredHeight > 0 ? measuredHeight : computedHeight;
|
|
138
|
+
const liveRef = useRef({
|
|
139
|
+
positionParams,
|
|
140
|
+
compactor,
|
|
141
|
+
constraints: resolvedConstraints,
|
|
142
|
+
maxRows,
|
|
143
|
+
containerHeight,
|
|
144
|
+
isDroppable
|
|
145
|
+
});
|
|
146
|
+
liveRef.current = {
|
|
147
|
+
positionParams,
|
|
148
|
+
compactor,
|
|
149
|
+
constraints: resolvedConstraints,
|
|
150
|
+
maxRows,
|
|
151
|
+
containerHeight,
|
|
152
|
+
isDroppable
|
|
153
|
+
};
|
|
154
|
+
const applyLayoutEvent = useEvent(applyLayout);
|
|
155
|
+
const setPlaceholderEvent = useEvent(setPlaceholder);
|
|
156
|
+
const entryRef = useRef(null);
|
|
157
|
+
if (!entryRef.current) entryRef.current = {
|
|
158
|
+
id: boardId,
|
|
159
|
+
getContentRect: () => contentRef.current?.getBoundingClientRect() ?? null,
|
|
160
|
+
getContentNode: () => contentRef.current,
|
|
161
|
+
getPositionParams: () => liveRef.current.positionParams,
|
|
162
|
+
getConstraints: () => liveRef.current.constraints,
|
|
163
|
+
getCompactor: () => liveRef.current.compactor,
|
|
164
|
+
getMaxRows: () => liveRef.current.maxRows,
|
|
165
|
+
getContainerHeight: () => liveRef.current.containerHeight,
|
|
166
|
+
getLayout: () => layoutRef.current,
|
|
167
|
+
applyLayout: (next, commit) => applyLayoutEvent(next, commit),
|
|
168
|
+
setPlaceholder: (item) => setPlaceholderEvent(item),
|
|
169
|
+
isDroppable: () => liveRef.current.isDroppable
|
|
170
|
+
};
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
const entry = entryRef.current;
|
|
173
|
+
entry.id = boardId;
|
|
174
|
+
return registry.registerBoard(entry);
|
|
175
|
+
}, [boardId]);
|
|
176
|
+
const recompactForCols = useEvent((nextCols) => {
|
|
177
|
+
const corrected = correctBounds(cloneLayout(layoutRef.current), { cols: nextCols });
|
|
178
|
+
applyLayoutEvent([...liveRef.current.compactor.compact(corrected, nextCols)], true);
|
|
179
|
+
});
|
|
180
|
+
const prevAlignedColsRef = useRef(null);
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (!aligned) {
|
|
183
|
+
prevAlignedColsRef.current = null;
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (width <= 0) return;
|
|
187
|
+
if (prevAlignedColsRef.current === null) {
|
|
188
|
+
prevAlignedColsRef.current = effectiveCols;
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (prevAlignedColsRef.current === effectiveCols) return;
|
|
192
|
+
prevAlignedColsRef.current = effectiveCols;
|
|
193
|
+
recompactForCols(effectiveCols);
|
|
194
|
+
}, [
|
|
195
|
+
aligned,
|
|
196
|
+
width,
|
|
197
|
+
effectiveCols,
|
|
198
|
+
recompactForCols
|
|
199
|
+
]);
|
|
200
|
+
const naturalHeight = rows > 0 ? rows * parentRowHeight + Math.max(0, rows - 1) * effectiveMargin[1] + resolvedPadding[1] * 2 : parentRowHeight;
|
|
201
|
+
const requestHeightDeficit = host?.requestHeightDeficit;
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
if (!aligned || !host?.isAutoHeight || !requestHeightDeficit) return;
|
|
204
|
+
if (measuredHeight <= 0) return;
|
|
205
|
+
requestHeightDeficit(naturalHeight - measuredHeight);
|
|
206
|
+
}, [
|
|
207
|
+
aligned,
|
|
208
|
+
host?.isAutoHeight,
|
|
209
|
+
requestHeightDeficit,
|
|
210
|
+
naturalHeight,
|
|
211
|
+
measuredHeight
|
|
212
|
+
]);
|
|
213
|
+
const resizeStateRef = useRef(null);
|
|
214
|
+
const autoHeightMinRowsRef = useRef({});
|
|
215
|
+
const handleResize = useEvent((id, axis, phase, dx, dy) => {
|
|
216
|
+
const pp = liveRef.current.positionParams;
|
|
217
|
+
if (phase === "start") {
|
|
218
|
+
const rawItem = getLayoutItem(layoutRef.current, id);
|
|
219
|
+
if (!rawItem) return;
|
|
220
|
+
const item = {
|
|
221
|
+
...rawItem,
|
|
222
|
+
constraints: rawItem.constraints ?? registry.store.get(id)?.constraints
|
|
223
|
+
};
|
|
224
|
+
resizeStateRef.current = {
|
|
225
|
+
id,
|
|
226
|
+
axis,
|
|
227
|
+
item: { ...item },
|
|
228
|
+
origin: calcGridItemPosition(pp, item.x, item.y, item.w, item.h),
|
|
229
|
+
accX: 0,
|
|
230
|
+
accY: 0
|
|
231
|
+
};
|
|
232
|
+
setPlaceholder({ ...item });
|
|
233
|
+
onResizeStart?.({
|
|
234
|
+
layout: layoutRef.current,
|
|
235
|
+
item: { ...item },
|
|
236
|
+
oldItem: { ...item },
|
|
237
|
+
placeholder: { ...item }
|
|
238
|
+
});
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const rs = resizeStateRef.current;
|
|
242
|
+
if (!rs) return;
|
|
243
|
+
if (phase === "end") {
|
|
244
|
+
const finalLayout = [...layoutRef.current];
|
|
245
|
+
applyLayout(finalLayout, true);
|
|
246
|
+
setPlaceholder(null);
|
|
247
|
+
onResizeStop?.({
|
|
248
|
+
layout: finalLayout,
|
|
249
|
+
item: getLayoutItem(finalLayout, id) ?? rs.item,
|
|
250
|
+
oldItem: rs.item,
|
|
251
|
+
placeholder: null
|
|
252
|
+
});
|
|
253
|
+
resizeStateRef.current = null;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
rs.accX += dx;
|
|
257
|
+
rs.accY += dy;
|
|
258
|
+
const { origin, item, axis: handle } = rs;
|
|
259
|
+
let newW = origin.width;
|
|
260
|
+
let newH = origin.height;
|
|
261
|
+
if (handle.includes("e")) newW = origin.width + rs.accX;
|
|
262
|
+
if (handle.includes("w")) newW = origin.width - rs.accX;
|
|
263
|
+
if (handle.includes("s")) newH = origin.height + rs.accY;
|
|
264
|
+
if (handle.includes("n")) newH = origin.height - rs.accY;
|
|
265
|
+
newW = Math.max(newW, 8);
|
|
266
|
+
newH = Math.max(newH, 8);
|
|
267
|
+
const raw = calcWH(pp, newW, newH, item.x, item.y, handle);
|
|
268
|
+
const constrained = applySizeConstraints(liveRef.current.constraints, item, raw.w, raw.h, handle, {
|
|
269
|
+
cols: pp.cols,
|
|
270
|
+
maxRows: liveRef.current.maxRows,
|
|
271
|
+
containerWidth: pp.containerWidth,
|
|
272
|
+
containerHeight: liveRef.current.containerHeight,
|
|
273
|
+
rowHeight: pp.rowHeight,
|
|
274
|
+
margin: pp.margin,
|
|
275
|
+
layout: layoutRef.current
|
|
276
|
+
});
|
|
277
|
+
const floorRows = autoHeightMinRowsRef.current[id] ?? 0;
|
|
278
|
+
const finalW = constrained.w;
|
|
279
|
+
const finalH = Math.max(constrained.h, floorRows);
|
|
280
|
+
let x = item.x;
|
|
281
|
+
let y = item.y;
|
|
282
|
+
if (handle.includes("w")) x = item.x + item.w - finalW;
|
|
283
|
+
if (handle.includes("n")) y = item.y + item.h - finalH;
|
|
284
|
+
x = Math.max(0, x);
|
|
285
|
+
y = Math.max(0, y);
|
|
286
|
+
let newItem = {
|
|
287
|
+
...item,
|
|
288
|
+
x,
|
|
289
|
+
y,
|
|
290
|
+
w: finalW,
|
|
291
|
+
h: finalH
|
|
292
|
+
};
|
|
293
|
+
const compactor = liveRef.current.compactor;
|
|
294
|
+
if (compactor.preventCollision && !compactor.allowOverlap) {
|
|
295
|
+
if (getAllCollisions(layoutRef.current, newItem).some((other) => other.i !== id)) {
|
|
296
|
+
const lastValid = getLayoutItem(layoutRef.current, id);
|
|
297
|
+
if (lastValid) newItem = { ...lastValid };
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const working = modifyLayout(layoutRef.current, newItem);
|
|
301
|
+
const compacted = [...compactor.compact(working, pp.cols)];
|
|
302
|
+
applyLayout(compacted, false);
|
|
303
|
+
const nextPlaceholder = getLayoutItem(compacted, id) ?? newItem;
|
|
304
|
+
setPlaceholder(nextPlaceholder);
|
|
305
|
+
onResizeProp?.({
|
|
306
|
+
layout: compacted,
|
|
307
|
+
item: getLayoutItem(compacted, id) ?? newItem,
|
|
308
|
+
oldItem: rs.item,
|
|
309
|
+
placeholder: nextPlaceholder
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
const handleAutoHeight = useEvent((id, neededRows) => {
|
|
313
|
+
autoHeightMinRowsRef.current[id] = neededRows;
|
|
314
|
+
const current = getLayoutItem(layoutRef.current, id);
|
|
315
|
+
if (!current || neededRows <= current.h) return;
|
|
316
|
+
if (registry.dragState || resizeStateRef.current) return;
|
|
317
|
+
const pp = liveRef.current.positionParams;
|
|
318
|
+
const working = modifyLayout(layoutRef.current, {
|
|
319
|
+
...current,
|
|
320
|
+
h: neededRows
|
|
321
|
+
});
|
|
322
|
+
applyLayout([...liveRef.current.compactor.compact(working, pp.cols)], true);
|
|
323
|
+
});
|
|
324
|
+
const dragOldItemRef = useRef(null);
|
|
325
|
+
const handleDragLifecycle = useEvent((id, phase) => {
|
|
326
|
+
const currentLayout = layoutRef.current;
|
|
327
|
+
const liveItem = getLayoutItem(currentLayout, id);
|
|
328
|
+
if (phase === "start") dragOldItemRef.current = liveItem ? { ...liveItem } : null;
|
|
329
|
+
const oldItem = dragOldItemRef.current ?? liveItem;
|
|
330
|
+
if (!oldItem) return;
|
|
331
|
+
const info = {
|
|
332
|
+
layout: currentLayout,
|
|
333
|
+
item: liveItem ?? oldItem,
|
|
334
|
+
oldItem,
|
|
335
|
+
placeholder: placeholderRef.current
|
|
336
|
+
};
|
|
337
|
+
if (phase === "start") onDragStart?.(info);
|
|
338
|
+
else if (phase === "move") onDrag?.(info);
|
|
339
|
+
else {
|
|
340
|
+
onDragStop?.(info);
|
|
341
|
+
dragOldItemRef.current = null;
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
const styles = extractStyles(otherProps, CONTAINER_STYLES);
|
|
345
|
+
const dragState = registry.dragState;
|
|
346
|
+
const ready = width > 0;
|
|
347
|
+
const placeholderStyle = placeholder ? (() => {
|
|
348
|
+
const pos = calcGridItemPosition(positionParams, placeholder.x, placeholder.y, placeholder.w, placeholder.h);
|
|
349
|
+
return {
|
|
350
|
+
transform: `translate(${pos.left}px, ${pos.top}px)`,
|
|
351
|
+
width: `${pos.width}px`,
|
|
352
|
+
height: `${pos.height}px`
|
|
353
|
+
};
|
|
354
|
+
})() : null;
|
|
355
|
+
const showPlaceholder = placeholder && placeholderStyle;
|
|
356
|
+
const gridOverlayStyle = showGridLines === true || showGridLines === "drag" && (!!dragState || !!placeholder) ? (() => {
|
|
357
|
+
const colWidth = calcGridColWidth(positionParams);
|
|
358
|
+
const rowHeightPx = positionParams.rowHeight;
|
|
359
|
+
const pitchX = colWidth + effectiveMargin[0];
|
|
360
|
+
const pitchY = rowHeightPx + effectiveMargin[1];
|
|
361
|
+
const padX = resolvedPadding[0];
|
|
362
|
+
const padY = resolvedPadding[1];
|
|
363
|
+
const gridWidth = Math.max(0, effectiveContainerWidth - padX * 2);
|
|
364
|
+
const gridHeight = rows > 0 ? rows * rowHeightPx + (rows - 1) * effectiveMargin[1] : 0;
|
|
365
|
+
const fill = "var(--border-color)";
|
|
366
|
+
const columns = `repeating-linear-gradient(to right, ${fill} 0, ${fill} ${colWidth}px, transparent ${colWidth}px, transparent ${pitchX}px)`;
|
|
367
|
+
const rowsGrad = `repeating-linear-gradient(to bottom, #000 0, #000 ${rowHeightPx}px, transparent ${rowHeightPx}px, transparent ${pitchY}px)`;
|
|
368
|
+
return {
|
|
369
|
+
left: `${padX}px`,
|
|
370
|
+
top: `${padY}px`,
|
|
371
|
+
width: `${gridWidth}px`,
|
|
372
|
+
height: `${gridHeight}px`,
|
|
373
|
+
backgroundImage: columns,
|
|
374
|
+
backgroundPosition: "0 0",
|
|
375
|
+
backgroundRepeat: "repeat",
|
|
376
|
+
maskImage: rowsGrad,
|
|
377
|
+
WebkitMaskImage: rowsGrad,
|
|
378
|
+
maskPosition: "0 0",
|
|
379
|
+
WebkitMaskPosition: "0 0",
|
|
380
|
+
maskRepeat: "repeat",
|
|
381
|
+
WebkitMaskRepeat: "repeat"
|
|
382
|
+
};
|
|
383
|
+
})() : null;
|
|
384
|
+
const boardMetrics = useMemo(() => ({
|
|
385
|
+
colWidth: calcGridColWidth(positionParams),
|
|
386
|
+
rowHeight: positionParams.rowHeight,
|
|
387
|
+
margin: positionParams.margin,
|
|
388
|
+
containerPadding: positionParams.containerPadding
|
|
389
|
+
}), [positionParams]);
|
|
390
|
+
return /* @__PURE__ */ jsx(BoardMetricsContext.Provider, {
|
|
391
|
+
value: boardMetrics,
|
|
392
|
+
children: /* @__PURE__ */ jsxs(BoardElement, {
|
|
393
|
+
...filterBaseProps(otherProps, { eventProps: true }),
|
|
394
|
+
ref: containerRef,
|
|
395
|
+
styles,
|
|
396
|
+
style: aligned ? void 0 : { minHeight: `${containerHeight}px` },
|
|
397
|
+
mods: {
|
|
398
|
+
dragging: !!dragState,
|
|
399
|
+
"drop-target": dragState?.currentBoardId === boardId
|
|
400
|
+
},
|
|
401
|
+
children: [/* @__PURE__ */ jsxs(ContentLayer, {
|
|
402
|
+
ref: contentRef,
|
|
403
|
+
children: [
|
|
404
|
+
ready && gridOverlayStyle ? /* @__PURE__ */ jsx(GridOverlayElement, {
|
|
405
|
+
"aria-hidden": "true",
|
|
406
|
+
style: gridOverlayStyle
|
|
407
|
+
}) : null,
|
|
408
|
+
ready ? layout.map((item) => {
|
|
409
|
+
const registration = registry.store.get(item.i);
|
|
410
|
+
return /* @__PURE__ */ jsx(WidgetHost, {
|
|
411
|
+
boardId,
|
|
412
|
+
item,
|
|
413
|
+
positionParams,
|
|
414
|
+
registration,
|
|
415
|
+
isDraggable: isDraggable && registration?.isDraggable !== false && item.isDraggable !== false && !item.static,
|
|
416
|
+
isResizable: isResizable && registration?.isResizable !== false && item.isResizable !== false && !item.static,
|
|
417
|
+
resizeHandles: item.resizeHandles ?? registration?.resizeHandles ?? resizeHandles,
|
|
418
|
+
dragCancel: registration?.dragCancel ?? dragCancel,
|
|
419
|
+
dragHandle: registration?.dragHandle ?? dragHandle,
|
|
420
|
+
registry,
|
|
421
|
+
dragState,
|
|
422
|
+
onResize: handleResize,
|
|
423
|
+
onAutoHeight: handleAutoHeight,
|
|
424
|
+
onDragLifecycle: handleDragLifecycle
|
|
425
|
+
}, item.i);
|
|
426
|
+
}) : null,
|
|
427
|
+
showPlaceholder ? /* @__PURE__ */ jsx(PlaceholderElement, {
|
|
428
|
+
"aria-hidden": "true",
|
|
429
|
+
style: placeholderStyle
|
|
430
|
+
}) : null
|
|
431
|
+
]
|
|
432
|
+
}), children]
|
|
433
|
+
})
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
const BoardInnerForwarded = forwardRef(BoardInner);
|
|
437
|
+
/**
|
|
438
|
+
* A draggable and resizable widget grid. Widgets are declared with
|
|
439
|
+
* `Board.Widget` and positioned via a `layout`. Wrap multiple boards in a
|
|
440
|
+
* `BoardProvider` to enable dragging widgets between them.
|
|
441
|
+
*/
|
|
442
|
+
const Board = forwardRef(function Board(props, ref) {
|
|
443
|
+
if (useBoardRegistry()) return /* @__PURE__ */ jsx(BoardInnerForwarded, {
|
|
444
|
+
...props,
|
|
445
|
+
ref
|
|
446
|
+
});
|
|
447
|
+
return /* @__PURE__ */ jsx(BoardProvider, { children: /* @__PURE__ */ jsx(BoardInnerForwarded, {
|
|
448
|
+
...props,
|
|
449
|
+
ref
|
|
450
|
+
}) });
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
//#endregion
|
|
454
|
+
export { Board };
|
|
455
|
+
//# sourceMappingURL=Board.js.map
|