@cube-dev/ui-kit 0.129.0 → 0.131.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 +34 -0
- 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 +2 -2
- package/dist/components/actions/Button/Button.js.map +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +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/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 +55 -7
- package/dist/components/content/Tree/Tree.js.map +1 -1
- package/dist/components/content/Tree/TreeNode.js +33 -8
- package/dist/components/content/Tree/TreeNode.js.map +1 -1
- package/dist/components/content/Tree/styled.js +12 -6
- package/dist/components/content/Tree/styled.js.map +1 -1
- package/dist/components/content/Tree/tree-index.js +1 -1
- package/dist/components/content/Tree/types.d.ts +38 -0
- 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 +2 -8
- package/dist/components/fields/ComboBox/ComboBox.js.map +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 +2 -11
- package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/ListBox.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 +2 -11
- package/dist/components/fields/Picker/Picker.js.map +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.d.ts +0 -2
- package/dist/components/fields/Select/Select.js +3 -11
- 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/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 +5 -4
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js.map +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/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/EditableTitle.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +28 -14
- 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 +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/styled.js +1 -1
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
- package/dist/components/organisms/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 +4 -18
- package/dist/components/overlays/Dialog/Dialog.js.map +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +1 -2
- package/dist/components/overlays/Dialog/DialogTrigger.js.map +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 +7 -7
- package/dist/components/overlays/Modal/Modal.js.map +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +12 -0
- package/dist/components/overlays/Modal/OpenTransitionContext.js.map +1 -0
- package/dist/components/overlays/Modal/Overlay.js +48 -21
- package/dist/components/overlays/Modal/Overlay.js.map +1 -1
- package/dist/components/overlays/Modal/Popover.js +10 -14
- package/dist/components/overlays/Modal/Popover.js.map +1 -1
- package/dist/components/overlays/Modal/Tray.js +7 -7
- package/dist/components/overlays/Modal/Tray.js.map +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Modal/types.d.ts +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/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/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 +1 -1
- package/dist/index.js +2 -2
- 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.d.ts +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.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/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/package.json +1 -3
- package/dist/components/overlays/Modal/OpenTransition.js +0 -39
- package/dist/components/overlays/Modal/OpenTransition.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../utils/styles.js";
|
|
3
3
|
import { useCombinedRefs } from "../../utils/react/useCombinedRefs.js";
|
|
4
4
|
import { CONTAINER_STYLES, filterBaseProps, parseStyle, tasty } from "@tenphi/tasty";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
3
3
|
import { useCallback, useMemo } from "react";
|
|
4
4
|
import { ListDropTargetDelegate, ListKeyboardDelegate, useDraggableCollection, useDroppableCollection } from "react-aria";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
3
3
|
import { EditableTitleInputElement, HiddenMeasure } from "./styled.js";
|
|
4
4
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
3
3
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
4
4
|
import { ItemActionProvider } from "../../actions/ItemActionContext.js";
|
|
@@ -42,22 +42,36 @@ function getRawKey(element) {
|
|
|
42
42
|
* Auto-adds labels and disables items when requirements aren't met.
|
|
43
43
|
*/
|
|
44
44
|
function processMenuItems(children, effectiveIsEditable, isDeletable) {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const result = [];
|
|
46
|
+
Children.forEach(children, (child) => {
|
|
47
|
+
if (!isValidElement(child)) {
|
|
48
|
+
result.push(child);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
47
51
|
const childKey = getRawKey(child);
|
|
48
52
|
const childProps = child.props;
|
|
49
|
-
if (childKey === "rename")
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
if (childKey === "rename") {
|
|
54
|
+
result.push(cloneElement(child, {
|
|
55
|
+
children: childProps.children ?? "Rename",
|
|
56
|
+
isDisabled: childProps.isDisabled ?? !effectiveIsEditable
|
|
57
|
+
}));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (childKey === "delete") {
|
|
61
|
+
result.push(cloneElement(child, {
|
|
62
|
+
children: childProps.children ?? "Delete",
|
|
63
|
+
theme: childProps.theme ?? "danger",
|
|
64
|
+
isDisabled: childProps.isDisabled ?? !isDeletable
|
|
65
|
+
}));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (childProps.children && typeof childProps.children !== "string") {
|
|
69
|
+
result.push(cloneElement(child, { children: processMenuItems(childProps.children, effectiveIsEditable, isDeletable) }));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
result.push(child);
|
|
60
73
|
});
|
|
74
|
+
return result;
|
|
61
75
|
}
|
|
62
76
|
/**
|
|
63
77
|
* Check if menu children is empty (null, undefined, or empty fragment)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabButton.js","names":["Menu","MenuTrigger","mergeProps"],"sources":["../../../../src/components/navigation/Tabs/TabButton.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n isValidElement,\n ReactElement,\n ReactNode,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n useDraggableItem,\n useFocus,\n useFocusVisible,\n useHover,\n useTab,\n} from 'react-aria';\n\nimport { useEvent } from '../../../_internal/hooks';\nimport { CloseIcon, MoreIcon } from '../../../icons';\nimport { mergeProps } from '../../../utils/react';\nimport { CubeItemActionProps, ItemAction } from '../../actions/ItemAction';\nimport { ItemActionProvider } from '../../actions/ItemActionContext';\nimport { CubeMenuProps, Menu, MenuTrigger } from '../../actions/Menu';\nimport { useContextMenu } from '../../actions/use-context-menu';\n\nimport { EditableTitle } from './EditableTitle';\nimport { TabContainer, TabElement } from './styled';\nimport { TabDropIndicator } from './TabDropIndicator';\nimport { useTabsContext } from './TabsContext';\nimport { ParsedTab, RADIO_SIZE_MAP } from './types';\n\nimport type { Key, Node } from '@react-types/shared';\nimport type { KeyboardEvent, MouseEvent, PointerEvent } from 'react';\nimport type { DraggableCollectionState } from 'react-stately';\n\n// =============================================================================\n// Event handlers for actions to prevent event propagation to tab button\n// =============================================================================\n\nconst ACTIONS_EVENT_HANDLERS = {\n onClick: (e: MouseEvent) => e.stopPropagation(),\n onPointerDown: (e: PointerEvent) => e.stopPropagation(),\n onPointerUp: (e: PointerEvent) => e.stopPropagation(),\n onMouseDown: (e: MouseEvent) => e.stopPropagation(),\n onMouseUp: (e: MouseEvent) => e.stopPropagation(),\n onKeyDown: (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.stopPropagation();\n }\n },\n};\n\n// =============================================================================\n// Menu Processing Utilities\n// =============================================================================\n\ninterface MenuItemLikeProps {\n children?: ReactNode;\n isDisabled?: boolean;\n theme?: string;\n}\n\n/**\n * Extracts the raw key from a React element, stripping the \".$\" prefix\n * that React adds via Children.map/toArray.\n */\nfunction getRawKey(element: ReactElement): string | null {\n if (element.key == null) return null;\n const keyStr = String(element.key);\n return keyStr.startsWith('.$') ? keyStr.slice(2) : keyStr;\n}\n\n/**\n * Process menu items for predefined action keys (rename, delete).\n * Auto-adds labels and disables items when requirements aren't met.\n */\nfunction processMenuItems(\n children: ReactNode,\n effectiveIsEditable: boolean,\n isDeletable: boolean,\n): ReactNode {\n return Children.toArray(children).map((child) => {\n if (!isValidElement(child)) return child;\n\n const childKey = getRawKey(child);\n const childProps = child.props as MenuItemLikeProps;\n\n // Handle predefined action keys\n if (childKey === 'rename') {\n return cloneElement(child as ReactElement<MenuItemLikeProps>, {\n children: childProps.children ?? 'Rename',\n isDisabled: childProps.isDisabled ?? !effectiveIsEditable,\n });\n }\n if (childKey === 'delete') {\n return cloneElement(child as ReactElement<MenuItemLikeProps>, {\n children: childProps.children ?? 'Delete',\n theme: childProps.theme ?? 'danger',\n isDisabled: childProps.isDisabled ?? !isDeletable,\n });\n }\n\n // Recursively process Menu.Section children\n if (childProps.children && typeof childProps.children !== 'string') {\n return cloneElement(child as ReactElement<MenuItemLikeProps>, {\n children: processMenuItems(\n childProps.children,\n effectiveIsEditable,\n isDeletable,\n ),\n });\n }\n\n return child;\n });\n}\n\n/**\n * Check if menu children is empty (null, undefined, or empty fragment)\n */\nfunction isMenuEmpty(menu: ReactNode): boolean {\n if (menu === null || menu === undefined) return true;\n const children = Children.toArray(menu);\n return children.length === 0;\n}\n\n// =============================================================================\n// TabButton Props\n// =============================================================================\n\nexport interface TabButtonProps {\n /** React Aria collection item */\n item: Node<object>;\n /** Parsed tab data */\n tabData: ParsedTab;\n /** Whether this is the last tab (for drop indicator) */\n isLastTab?: boolean;\n}\n\n// =============================================================================\n// TabButton Component\n// =============================================================================\n\n/**\n * Individual tab button component.\n *\n * Uses TabsContext to access shared props, dramatically reducing prop drilling.\n * Handles:\n * - Tab selection and keyboard navigation\n * - Inline title editing\n * - Menu and context menu\n * - Drag-and-drop reordering\n * - Focus and hover states\n */\nexport function TabButton({ item, tabData, isLastTab }: TabButtonProps) {\n // Get shared context\n const {\n state,\n type,\n size,\n autoHideActions: parentAutoHideActions,\n isEditable: parentIsEditable,\n menu: parentMenu,\n menuTriggerProps: parentMenuTriggerProps,\n menuProps: parentMenuProps,\n contextMenu: parentContextMenu,\n onAction: parentOnAction,\n onDelete,\n dragState,\n dropState,\n editingKey,\n editValue,\n setEditValue,\n startEditing,\n submitEditing,\n cancelEditing,\n } = useTabsContext();\n\n const ref = useRef<HTMLButtonElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const actionsRef = useRef<HTMLDivElement>(null);\n const { tabProps } = useTab({ key: item.key }, state, ref);\n\n // Measure actions width for proper space allocation in Item\n const [actionsWidth, setActionsWidth] = useState(0);\n\n // Drag-and-drop support - only enable when both states are provided\n const isDraggable = !!dragState && !!dropState;\n\n // useDraggableItem must be called unconditionally (Rules of Hooks)\n // When dragState is undefined, we pass a minimal mock state to satisfy the hook\n const mockDragState = useMemo(\n () =>\n ({\n collection: state.collection,\n selectionManager: state.selectionManager,\n isDragging: () => false,\n getKeysForDrag: () => new Set<Key>(),\n isDisabled: false,\n startDrag: () => {},\n endDrag: () => {},\n }) as DraggableCollectionState,\n [state.collection, state.selectionManager],\n );\n\n const dragResult = useDraggableItem(\n { key: item.key },\n dragState ?? mockDragState,\n );\n const effectiveDragProps = isDraggable ? dragResult.dragProps : {};\n const isDragging = isDraggable && dragResult.isDragging;\n\n // Controlled state for menu trigger (enables keyboard opening with Shift+F10)\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n\n // Hover, focus, and focus-visible state handling\n const { hoverProps, isHovered } = useHover({});\n const [isFocused, setIsFocused] = useState(false);\n const { focusProps } = useFocus({ onFocusChange: setIsFocused });\n const { isFocusVisible } = useFocusVisible();\n\n // Suppress focus-visible when restoring focus after editing\n const [suppressFocusVisible, setSuppressFocusVisible] = useState(false);\n const effectiveFocusVisible = isFocusVisible && !suppressFocusVisible;\n\n const isActive = state.selectedKey === item.key;\n const isDisabled = state.disabledKeys.has(item.key);\n const isDeletable = !!onDelete;\n const isEditing = editingKey === item.key;\n\n // Compute effective values - Tab-level overrides Tabs-level\n const effectiveIsEditable = tabData.isEditable ?? parentIsEditable ?? false;\n const effectiveMenu =\n tabData.menu === null ? null : tabData.menu ?? parentMenu;\n const effectiveMenuTriggerProps: Partial<CubeItemActionProps> = {\n ...parentMenuTriggerProps,\n ...tabData.menuTriggerProps,\n };\n const effectiveMenuProps: Partial<CubeMenuProps<object>> = {\n ...parentMenuProps,\n ...tabData.menuProps,\n };\n const effectiveContextMenu =\n tabData.contextMenu ?? parentContextMenu ?? false;\n const effectiveType = tabData.type ?? type ?? 'default';\n\n const contextMenuEnabled =\n effectiveContextMenu === true || effectiveContextMenu === 'context-only';\n const contextMenuOnly = effectiveContextMenu === 'context-only';\n\n // Inline close when no menu, or context-only (no overflow trigger)\n const showDeleteButton =\n isDeletable && (isMenuEmpty(effectiveMenu) || contextMenuOnly);\n\n // Process menu items for auto-labels and disabled states\n const processedMenu =\n effectiveMenu && !isMenuEmpty(effectiveMenu)\n ? processMenuItems(effectiveMenu, effectiveIsEditable, isDeletable)\n : null;\n\n const itemKeyStr = String(item.key);\n\n const handleDelete = useEvent(() => {\n onDelete?.(itemKeyStr);\n });\n\n const handleStartEditing = useEvent(() => {\n if (!effectiveIsEditable || isDisabled) return;\n\n const titleText =\n typeof tabData.title === 'string' ? tabData.title : itemKeyStr;\n\n startEditing(itemKeyStr, titleText);\n });\n\n const handleSubmitEditing = useEvent(() => {\n submitEditing(itemKeyStr, editValue, tabData.onTitleChange);\n // Suppress focus-visible and restore focus to the tab button after editing\n setSuppressFocusVisible(true);\n requestAnimationFrame(() => {\n ref.current?.focus();\n });\n });\n\n const handleCancelEditing = useEvent(() => {\n cancelEditing();\n // Suppress focus-visible and restore focus to the tab button after editing\n setSuppressFocusVisible(true);\n requestAnimationFrame(() => {\n ref.current?.focus();\n });\n });\n\n const handleEditValueChange = useEvent((value: string) => {\n setEditValue(value);\n });\n\n // Handle menu actions - predefined actions first, then callbacks\n const handleMenuAction = useEvent((action: Key) => {\n // Strip the \".$\" prefix that React adds via Children.toArray/map\n const actionStr = String(action);\n const normalizedAction = actionStr.startsWith('.$')\n ? actionStr.slice(2)\n : actionStr;\n\n // Handle predefined actions first (only if requirements are met)\n if (normalizedAction === 'rename' && effectiveIsEditable) {\n handleStartEditing();\n }\n if (normalizedAction === 'delete' && isDeletable) {\n onDelete?.(itemKeyStr);\n }\n // Call Tab-level onAction first (with normalized action)\n tabData.onAction?.(normalizedAction);\n // Then call Tabs-level onAction with tab key (with normalized action)\n parentOnAction?.(normalizedAction, itemKeyStr);\n });\n\n const menuElement = processedMenu ? (\n <Menu {...effectiveMenuProps} onAction={handleMenuAction}>\n {processedMenu}\n </Menu>\n ) : null;\n\n const contextMenu = useContextMenu<HTMLDivElement, CubeMenuProps<object>>(\n Menu,\n { placement: 'bottom start' },\n {\n ...effectiveMenuProps,\n onAction: handleMenuAction,\n children: processedMenu,\n },\n );\n\n // Keyboard handler for accessibility shortcuts (WAI-ARIA Tabs Pattern)\n const handleKeyDown = useEvent((e: KeyboardEvent) => {\n // Reset focus-visible suppression on any keyboard interaction\n if (suppressFocusVisible) {\n setSuppressFocusVisible(false);\n }\n\n // F2 to start editing (standard rename shortcut)\n if (e.key === 'F2' && effectiveIsEditable && !isDisabled) {\n e.preventDefault();\n e.stopPropagation();\n handleStartEditing();\n }\n\n // Shift+F10 opens the menu (standard context menu shortcut)\n if (e.key === 'F10' && e.shiftKey && processedMenu) {\n e.preventDefault();\n e.stopPropagation();\n if (contextMenuOnly) {\n contextMenu.open();\n } else {\n setIsMenuOpen(true);\n }\n }\n\n // Delete key for direct tab deletion (ARIA Tabs pattern optional feature)\n // Skip when editing to allow normal text editing operations\n if (\n (e.key === 'Delete' || e.key === 'Backspace') &&\n isDeletable &&\n !isEditing\n ) {\n e.preventDefault();\n onDelete?.(itemKeyStr);\n }\n });\n\n const mods = useMemo(\n () => ({\n type: effectiveType,\n active: isActive,\n deletable: isDeletable,\n disabled: isDisabled,\n editing: isEditing,\n hovered: isHovered,\n focused: isFocused,\n 'focus-visible': effectiveFocusVisible,\n draggable: isDraggable,\n dragging: isDragging,\n }),\n [\n effectiveType,\n isActive,\n isDeletable,\n isDisabled,\n isEditing,\n isHovered,\n isFocused,\n effectiveFocusVisible,\n isDraggable,\n isDragging,\n ],\n );\n\n // Scroll active tab into view\n useEffect(() => {\n if (ref.current && isActive) {\n ref.current.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });\n }\n }, [isActive]);\n\n // Overflow trigger (hidden in context-only mode)\n const menuAction =\n menuElement && !contextMenuOnly ? (\n <MenuTrigger isOpen={isMenuOpen} onOpenChange={setIsMenuOpen}>\n <ItemAction\n tabIndex={-1}\n icon={<MoreIcon />}\n {...effectiveMenuTriggerProps}\n />\n {menuElement}\n </MenuTrigger>\n ) : null;\n\n // Build delete button (only shown when no menu)\n const deleteAction = showDeleteButton ? (\n <ItemAction\n tabIndex={-1}\n icon={<CloseIcon />}\n tooltip=\"Close\"\n onPress={handleDelete}\n />\n ) : null;\n\n // Order: custom actions → menu trigger → delete button\n const actions =\n tabData.actions || menuAction || deleteAction ? (\n <>\n {tabData.actions}\n {menuAction}\n {deleteAction}\n </>\n ) : undefined;\n\n // Measure actions width to pass to Item for proper space allocation\n useLayoutEffect(() => {\n if (actions && actionsRef.current) {\n setActionsWidth(Math.round(actionsRef.current.offsetWidth));\n }\n }, [actions]);\n\n // Determine effective size\n const effectiveSize = tabData.size ?? size ?? 'medium';\n const itemSize =\n effectiveType === 'radio'\n ? RADIO_SIZE_MAP[effectiveSize === 'large' ? 'large' : 'medium']\n : effectiveSize;\n\n // Determine Item type prop\n const itemType =\n effectiveType === 'default' ? (isActive ? 'clear' : 'neutral') : 'neutral';\n\n // Determine shape - file type uses sharp edges\n const isFileType = effectiveType === 'file';\n const itemShape = isFileType ? 'sharp' : undefined;\n\n // Determine autoHideActions - tab-level overrides parent-level\n const effectiveAutoHideActions =\n tabData.autoHideActions ?? parentAutoHideActions;\n\n // Render title with editing support if editable\n const titleContent = effectiveIsEditable ? (\n <EditableTitle\n title={tabData.title}\n isEditing={isEditing}\n editValue={isEditing ? editValue : ''}\n onEditValueChange={handleEditValueChange}\n onStartEditing={handleStartEditing}\n onSubmit={handleSubmitEditing}\n onCancel={handleCancelEditing}\n />\n ) : (\n tabData.title\n );\n\n // Extract tab-specific props and pass through the rest (style props) to the Item\n const {\n title: _title,\n content: _content,\n key: _key,\n isDisabled: _isDisabled,\n prerender: _prerender,\n keepMounted: _keepMounted,\n size: _size,\n type: _type,\n actions: _actions,\n autoHideActions: _autoHideActions,\n isEditable: _isEditable,\n onTitleChange: _onTitleChange,\n menu: _menu,\n menuTriggerProps: _menuTriggerProps,\n menuProps: _menuProps,\n contextMenu: _contextMenu,\n onAction: _onAction,\n qa,\n qaVal,\n styles,\n ...itemStyleProps\n } = tabData;\n\n // Use the hook's targetRef when context menu is enabled\n const effectiveContainerRef =\n contextMenuEnabled && processedMenu ? contextMenu.targetRef : containerRef;\n\n // ARIA: indicate popup menu presence\n const ariaProps = processedMenu ? { 'aria-haspopup': 'menu' as const } : {};\n\n // Mods for TabContainer\n const containerMods = {\n ...mods,\n 'auto-hide-actions': effectiveAutoHideActions,\n };\n\n return (\n <TabContainer\n ref={effectiveContainerRef}\n data-size={itemSize}\n mods={containerMods}\n tokens={{ '$actions-width': `${actionsWidth}px` }}\n {...effectiveDragProps}\n >\n {/* Drop indicator before this tab */}\n {isDraggable && dropState && (\n <TabDropIndicator\n target={{ type: 'item', key: item.key, dropPosition: 'before' }}\n dropState={dropState}\n position=\"before\"\n />\n )}\n <TabElement\n preserveActionsSpace\n autoHideActions={effectiveAutoHideActions}\n as=\"button\"\n {...mergeProps(tabProps, hoverProps, focusProps, {\n onKeyDown: handleKeyDown,\n })}\n {...ariaProps}\n {...itemStyleProps}\n ref={ref}\n qa={qa ?? `Tab-${String(item.key)}`}\n qaVal={qaVal}\n styles={styles}\n mods={mods}\n isSelected={isActive}\n isDisabled={isDisabled}\n size={itemSize}\n type={itemType}\n shape={itemShape}\n actions={actions ? true : undefined}\n >\n {titleContent}\n </TabElement>\n {/* Actions rendered outside the button for accessibility */}\n {actions && (\n <div\n ref={actionsRef}\n data-element=\"Actions\"\n {...ACTIONS_EVENT_HANDLERS}\n >\n <ItemActionProvider\n type={itemType}\n theme=\"default\"\n isDisabled={isDisabled}\n >\n {actions}\n </ItemActionProvider>\n </div>\n )}\n {contextMenuEnabled && processedMenu && contextMenu.rendered}\n {/* Drop indicator after the last tab */}\n {isDraggable && dropState && isLastTab && (\n <TabDropIndicator\n target={{ type: 'item', key: item.key, dropPosition: 'after' }}\n dropState={dropState}\n position=\"after\"\n />\n )}\n </TabContainer>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,yBAAyB;CAC7B,UAAU,MAAkB,EAAE,iBAAiB;CAC/C,gBAAgB,MAAoB,EAAE,iBAAiB;CACvD,cAAc,MAAoB,EAAE,iBAAiB;CACrD,cAAc,MAAkB,EAAE,iBAAiB;CACnD,YAAY,MAAkB,EAAE,iBAAiB;CACjD,YAAY,MAAqB;AAC/B,MAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,IACjC,GAAE,iBAAiB;;CAGxB;;;;;AAgBD,SAAS,UAAU,SAAsC;AAC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AEJ,oBAAC;KACC,MAAM;KACN,OAAM;KACM;eAEX;MACkB;KACjB;GAEP,sBAAsB,iBAAiB,YAAY;GAEnD,eAAe,aAAa,aAC3B,oBAAC;IACC,QAAQ;KAAE,MAAM;KAAQ,KAAK,KAAK;KAAK,cAAc;KAAS;IACnD;IACX,UAAS;KACT;;GAES"}
|
|
1
|
+
{"version":3,"file":"TabButton.js","names":["Menu","MenuTrigger","mergeProps"],"sources":["../../../../src/components/navigation/Tabs/TabButton.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n isValidElement,\n ReactElement,\n ReactNode,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n useDraggableItem,\n useFocus,\n useFocusVisible,\n useHover,\n useTab,\n} from 'react-aria';\n\nimport { useEvent } from '../../../_internal/hooks';\nimport { CloseIcon, MoreIcon } from '../../../icons';\nimport { mergeProps } from '../../../utils/react';\nimport { CubeItemActionProps, ItemAction } from '../../actions/ItemAction';\nimport { ItemActionProvider } from '../../actions/ItemActionContext';\nimport { CubeMenuProps, Menu, MenuTrigger } from '../../actions/Menu';\nimport { useContextMenu } from '../../actions/use-context-menu';\n\nimport { EditableTitle } from './EditableTitle';\nimport { TabContainer, TabElement } from './styled';\nimport { TabDropIndicator } from './TabDropIndicator';\nimport { useTabsContext } from './TabsContext';\nimport { ParsedTab, RADIO_SIZE_MAP } from './types';\n\nimport type { Key, Node } from '@react-types/shared';\nimport type { KeyboardEvent, MouseEvent, PointerEvent } from 'react';\nimport type { DraggableCollectionState } from 'react-stately';\n\n// =============================================================================\n// Event handlers for actions to prevent event propagation to tab button\n// =============================================================================\n\nconst ACTIONS_EVENT_HANDLERS = {\n onClick: (e: MouseEvent) => e.stopPropagation(),\n onPointerDown: (e: PointerEvent) => e.stopPropagation(),\n onPointerUp: (e: PointerEvent) => e.stopPropagation(),\n onMouseDown: (e: MouseEvent) => e.stopPropagation(),\n onMouseUp: (e: MouseEvent) => e.stopPropagation(),\n onKeyDown: (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.stopPropagation();\n }\n },\n};\n\n// =============================================================================\n// Menu Processing Utilities\n// =============================================================================\n\ninterface MenuItemLikeProps {\n children?: ReactNode;\n isDisabled?: boolean;\n theme?: string;\n}\n\n/**\n * Extracts the raw key from a React element, stripping the \".$\" prefix\n * that React adds via Children.map/toArray.\n */\nfunction getRawKey(element: ReactElement): string | null {\n if (element.key == null) return null;\n const keyStr = String(element.key);\n return keyStr.startsWith('.$') ? keyStr.slice(2) : keyStr;\n}\n\n/**\n * Process menu items for predefined action keys (rename, delete).\n * Auto-adds labels and disables items when requirements aren't met.\n */\nfunction processMenuItems(\n children: ReactNode,\n effectiveIsEditable: boolean,\n isDeletable: boolean,\n): ReactNode {\n // Use Children.forEach instead of Children.toArray to avoid React prepending\n // \".$\" to element keys, which breaks selectedKeys matching in Menu.\n const result: ReactNode[] = [];\n\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) {\n result.push(child);\n return;\n }\n\n const childKey = getRawKey(child);\n const childProps = child.props as MenuItemLikeProps;\n\n // Handle predefined action keys\n if (childKey === 'rename') {\n result.push(\n cloneElement(child as ReactElement<MenuItemLikeProps>, {\n children: childProps.children ?? 'Rename',\n isDisabled: childProps.isDisabled ?? !effectiveIsEditable,\n }),\n );\n return;\n }\n if (childKey === 'delete') {\n result.push(\n cloneElement(child as ReactElement<MenuItemLikeProps>, {\n children: childProps.children ?? 'Delete',\n theme: childProps.theme ?? 'danger',\n isDisabled: childProps.isDisabled ?? !isDeletable,\n }),\n );\n return;\n }\n\n // Recursively process Menu.Section children\n if (childProps.children && typeof childProps.children !== 'string') {\n result.push(\n cloneElement(child as ReactElement<MenuItemLikeProps>, {\n children: processMenuItems(\n childProps.children,\n effectiveIsEditable,\n isDeletable,\n ),\n }),\n );\n return;\n }\n\n result.push(child);\n });\n\n return result;\n}\n\n/**\n * Check if menu children is empty (null, undefined, or empty fragment)\n */\nfunction isMenuEmpty(menu: ReactNode): boolean {\n if (menu === null || menu === undefined) return true;\n const children = Children.toArray(menu);\n return children.length === 0;\n}\n\n// =============================================================================\n// TabButton Props\n// =============================================================================\n\nexport interface TabButtonProps {\n /** React Aria collection item */\n item: Node<object>;\n /** Parsed tab data */\n tabData: ParsedTab;\n /** Whether this is the last tab (for drop indicator) */\n isLastTab?: boolean;\n}\n\n// =============================================================================\n// TabButton Component\n// =============================================================================\n\n/**\n * Individual tab button component.\n *\n * Uses TabsContext to access shared props, dramatically reducing prop drilling.\n * Handles:\n * - Tab selection and keyboard navigation\n * - Inline title editing\n * - Menu and context menu\n * - Drag-and-drop reordering\n * - Focus and hover states\n */\nexport function TabButton({ item, tabData, isLastTab }: TabButtonProps) {\n // Get shared context\n const {\n state,\n type,\n size,\n autoHideActions: parentAutoHideActions,\n isEditable: parentIsEditable,\n menu: parentMenu,\n menuTriggerProps: parentMenuTriggerProps,\n menuProps: parentMenuProps,\n contextMenu: parentContextMenu,\n onAction: parentOnAction,\n onDelete,\n dragState,\n dropState,\n editingKey,\n editValue,\n setEditValue,\n startEditing,\n submitEditing,\n cancelEditing,\n } = useTabsContext();\n\n const ref = useRef<HTMLButtonElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const actionsRef = useRef<HTMLDivElement>(null);\n const { tabProps } = useTab({ key: item.key }, state, ref);\n\n // Measure actions width for proper space allocation in Item\n const [actionsWidth, setActionsWidth] = useState(0);\n\n // Drag-and-drop support - only enable when both states are provided\n const isDraggable = !!dragState && !!dropState;\n\n // useDraggableItem must be called unconditionally (Rules of Hooks)\n // When dragState is undefined, we pass a minimal mock state to satisfy the hook\n const mockDragState = useMemo(\n () =>\n ({\n collection: state.collection,\n selectionManager: state.selectionManager,\n isDragging: () => false,\n getKeysForDrag: () => new Set<Key>(),\n isDisabled: false,\n startDrag: () => {},\n endDrag: () => {},\n }) as DraggableCollectionState,\n [state.collection, state.selectionManager],\n );\n\n const dragResult = useDraggableItem(\n { key: item.key },\n dragState ?? mockDragState,\n );\n const effectiveDragProps = isDraggable ? dragResult.dragProps : {};\n const isDragging = isDraggable && dragResult.isDragging;\n\n // Controlled state for menu trigger (enables keyboard opening with Shift+F10)\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n\n // Hover, focus, and focus-visible state handling\n const { hoverProps, isHovered } = useHover({});\n const [isFocused, setIsFocused] = useState(false);\n const { focusProps } = useFocus({ onFocusChange: setIsFocused });\n const { isFocusVisible } = useFocusVisible();\n\n // Suppress focus-visible when restoring focus after editing\n const [suppressFocusVisible, setSuppressFocusVisible] = useState(false);\n const effectiveFocusVisible = isFocusVisible && !suppressFocusVisible;\n\n const isActive = state.selectedKey === item.key;\n const isDisabled = state.disabledKeys.has(item.key);\n const isDeletable = !!onDelete;\n const isEditing = editingKey === item.key;\n\n // Compute effective values - Tab-level overrides Tabs-level\n const effectiveIsEditable = tabData.isEditable ?? parentIsEditable ?? false;\n const effectiveMenu =\n tabData.menu === null ? null : tabData.menu ?? parentMenu;\n const effectiveMenuTriggerProps: Partial<CubeItemActionProps> = {\n ...parentMenuTriggerProps,\n ...tabData.menuTriggerProps,\n };\n const effectiveMenuProps: Partial<CubeMenuProps<object>> = {\n ...parentMenuProps,\n ...tabData.menuProps,\n };\n const effectiveContextMenu =\n tabData.contextMenu ?? parentContextMenu ?? false;\n const effectiveType = tabData.type ?? type ?? 'default';\n\n const contextMenuEnabled =\n effectiveContextMenu === true || effectiveContextMenu === 'context-only';\n const contextMenuOnly = effectiveContextMenu === 'context-only';\n\n // Inline close when no menu, or context-only (no overflow trigger)\n const showDeleteButton =\n isDeletable && (isMenuEmpty(effectiveMenu) || contextMenuOnly);\n\n // Process menu items for auto-labels and disabled states\n const processedMenu =\n effectiveMenu && !isMenuEmpty(effectiveMenu)\n ? processMenuItems(effectiveMenu, effectiveIsEditable, isDeletable)\n : null;\n\n const itemKeyStr = String(item.key);\n\n const handleDelete = useEvent(() => {\n onDelete?.(itemKeyStr);\n });\n\n const handleStartEditing = useEvent(() => {\n if (!effectiveIsEditable || isDisabled) return;\n\n const titleText =\n typeof tabData.title === 'string' ? tabData.title : itemKeyStr;\n\n startEditing(itemKeyStr, titleText);\n });\n\n const handleSubmitEditing = useEvent(() => {\n submitEditing(itemKeyStr, editValue, tabData.onTitleChange);\n // Suppress focus-visible and restore focus to the tab button after editing\n setSuppressFocusVisible(true);\n requestAnimationFrame(() => {\n ref.current?.focus();\n });\n });\n\n const handleCancelEditing = useEvent(() => {\n cancelEditing();\n // Suppress focus-visible and restore focus to the tab button after editing\n setSuppressFocusVisible(true);\n requestAnimationFrame(() => {\n ref.current?.focus();\n });\n });\n\n const handleEditValueChange = useEvent((value: string) => {\n setEditValue(value);\n });\n\n // Handle menu actions - predefined actions first, then callbacks\n const handleMenuAction = useEvent((action: Key) => {\n // Strip the \".$\" prefix that React adds via Children.toArray/map\n const actionStr = String(action);\n const normalizedAction = actionStr.startsWith('.$')\n ? actionStr.slice(2)\n : actionStr;\n\n // Handle predefined actions first (only if requirements are met)\n if (normalizedAction === 'rename' && effectiveIsEditable) {\n handleStartEditing();\n }\n if (normalizedAction === 'delete' && isDeletable) {\n onDelete?.(itemKeyStr);\n }\n // Call Tab-level onAction first (with normalized action)\n tabData.onAction?.(normalizedAction);\n // Then call Tabs-level onAction with tab key (with normalized action)\n parentOnAction?.(normalizedAction, itemKeyStr);\n });\n\n const menuElement = processedMenu ? (\n <Menu {...effectiveMenuProps} onAction={handleMenuAction}>\n {processedMenu}\n </Menu>\n ) : null;\n\n const contextMenu = useContextMenu<HTMLDivElement, CubeMenuProps<object>>(\n Menu,\n { placement: 'bottom start' },\n {\n ...effectiveMenuProps,\n onAction: handleMenuAction,\n children: processedMenu,\n },\n );\n\n // Keyboard handler for accessibility shortcuts (WAI-ARIA Tabs Pattern)\n const handleKeyDown = useEvent((e: KeyboardEvent) => {\n // Reset focus-visible suppression on any keyboard interaction\n if (suppressFocusVisible) {\n setSuppressFocusVisible(false);\n }\n\n // F2 to start editing (standard rename shortcut)\n if (e.key === 'F2' && effectiveIsEditable && !isDisabled) {\n e.preventDefault();\n e.stopPropagation();\n handleStartEditing();\n }\n\n // Shift+F10 opens the menu (standard context menu shortcut)\n if (e.key === 'F10' && e.shiftKey && processedMenu) {\n e.preventDefault();\n e.stopPropagation();\n if (contextMenuOnly) {\n contextMenu.open();\n } else {\n setIsMenuOpen(true);\n }\n }\n\n // Delete key for direct tab deletion (ARIA Tabs pattern optional feature)\n // Skip when editing to allow normal text editing operations\n if (\n (e.key === 'Delete' || e.key === 'Backspace') &&\n isDeletable &&\n !isEditing\n ) {\n e.preventDefault();\n onDelete?.(itemKeyStr);\n }\n });\n\n const mods = useMemo(\n () => ({\n type: effectiveType,\n active: isActive,\n deletable: isDeletable,\n disabled: isDisabled,\n editing: isEditing,\n hovered: isHovered,\n focused: isFocused,\n 'focus-visible': effectiveFocusVisible,\n draggable: isDraggable,\n dragging: isDragging,\n }),\n [\n effectiveType,\n isActive,\n isDeletable,\n isDisabled,\n isEditing,\n isHovered,\n isFocused,\n effectiveFocusVisible,\n isDraggable,\n isDragging,\n ],\n );\n\n // Scroll active tab into view\n useEffect(() => {\n if (ref.current && isActive) {\n ref.current.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });\n }\n }, [isActive]);\n\n // Overflow trigger (hidden in context-only mode)\n const menuAction =\n menuElement && !contextMenuOnly ? (\n <MenuTrigger isOpen={isMenuOpen} onOpenChange={setIsMenuOpen}>\n <ItemAction\n tabIndex={-1}\n icon={<MoreIcon />}\n {...effectiveMenuTriggerProps}\n />\n {menuElement}\n </MenuTrigger>\n ) : null;\n\n // Build delete button (only shown when no menu)\n const deleteAction = showDeleteButton ? (\n <ItemAction\n tabIndex={-1}\n icon={<CloseIcon />}\n tooltip=\"Close\"\n onPress={handleDelete}\n />\n ) : null;\n\n // Order: custom actions → menu trigger → delete button\n const actions =\n tabData.actions || menuAction || deleteAction ? (\n <>\n {tabData.actions}\n {menuAction}\n {deleteAction}\n </>\n ) : undefined;\n\n // Measure actions width to pass to Item for proper space allocation\n useLayoutEffect(() => {\n if (actions && actionsRef.current) {\n setActionsWidth(Math.round(actionsRef.current.offsetWidth));\n }\n }, [actions]);\n\n // Determine effective size\n const effectiveSize = tabData.size ?? size ?? 'medium';\n const itemSize =\n effectiveType === 'radio'\n ? RADIO_SIZE_MAP[effectiveSize === 'large' ? 'large' : 'medium']\n : effectiveSize;\n\n // Determine Item type prop\n const itemType =\n effectiveType === 'default' ? (isActive ? 'clear' : 'neutral') : 'neutral';\n\n // Determine shape - file type uses sharp edges\n const isFileType = effectiveType === 'file';\n const itemShape = isFileType ? 'sharp' : undefined;\n\n // Determine autoHideActions - tab-level overrides parent-level\n const effectiveAutoHideActions =\n tabData.autoHideActions ?? parentAutoHideActions;\n\n // Render title with editing support if editable\n const titleContent = effectiveIsEditable ? (\n <EditableTitle\n title={tabData.title}\n isEditing={isEditing}\n editValue={isEditing ? editValue : ''}\n onEditValueChange={handleEditValueChange}\n onStartEditing={handleStartEditing}\n onSubmit={handleSubmitEditing}\n onCancel={handleCancelEditing}\n />\n ) : (\n tabData.title\n );\n\n // Extract tab-specific props and pass through the rest (style props) to the Item\n const {\n title: _title,\n content: _content,\n key: _key,\n isDisabled: _isDisabled,\n prerender: _prerender,\n keepMounted: _keepMounted,\n size: _size,\n type: _type,\n actions: _actions,\n autoHideActions: _autoHideActions,\n isEditable: _isEditable,\n onTitleChange: _onTitleChange,\n menu: _menu,\n menuTriggerProps: _menuTriggerProps,\n menuProps: _menuProps,\n contextMenu: _contextMenu,\n onAction: _onAction,\n qa,\n qaVal,\n styles,\n ...itemStyleProps\n } = tabData;\n\n // Use the hook's targetRef when context menu is enabled\n const effectiveContainerRef =\n contextMenuEnabled && processedMenu ? contextMenu.targetRef : containerRef;\n\n // ARIA: indicate popup menu presence\n const ariaProps = processedMenu ? { 'aria-haspopup': 'menu' as const } : {};\n\n // Mods for TabContainer\n const containerMods = {\n ...mods,\n 'auto-hide-actions': effectiveAutoHideActions,\n };\n\n return (\n <TabContainer\n ref={effectiveContainerRef}\n data-size={itemSize}\n mods={containerMods}\n tokens={{ '$actions-width': `${actionsWidth}px` }}\n {...effectiveDragProps}\n >\n {/* Drop indicator before this tab */}\n {isDraggable && dropState && (\n <TabDropIndicator\n target={{ type: 'item', key: item.key, dropPosition: 'before' }}\n dropState={dropState}\n position=\"before\"\n />\n )}\n <TabElement\n preserveActionsSpace\n autoHideActions={effectiveAutoHideActions}\n as=\"button\"\n {...mergeProps(tabProps, hoverProps, focusProps, {\n onKeyDown: handleKeyDown,\n })}\n {...ariaProps}\n {...itemStyleProps}\n ref={ref}\n qa={qa ?? `Tab-${String(item.key)}`}\n qaVal={qaVal}\n styles={styles}\n mods={mods}\n isSelected={isActive}\n isDisabled={isDisabled}\n size={itemSize}\n type={itemType}\n shape={itemShape}\n actions={actions ? true : undefined}\n >\n {titleContent}\n </TabElement>\n {/* Actions rendered outside the button for accessibility */}\n {actions && (\n <div\n ref={actionsRef}\n data-element=\"Actions\"\n {...ACTIONS_EVENT_HANDLERS}\n >\n <ItemActionProvider\n type={itemType}\n theme=\"default\"\n isDisabled={isDisabled}\n >\n {actions}\n </ItemActionProvider>\n </div>\n )}\n {contextMenuEnabled && processedMenu && contextMenu.rendered}\n {/* Drop indicator after the last tab */}\n {isDraggable && dropState && isLastTab && (\n <TabDropIndicator\n target={{ type: 'item', key: item.key, dropPosition: 'after' }}\n dropState={dropState}\n position=\"after\"\n />\n )}\n </TabContainer>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,yBAAyB;CAC7B,UAAU,MAAkB,EAAE,iBAAiB;CAC/C,gBAAgB,MAAoB,EAAE,iBAAiB;CACvD,cAAc,MAAoB,EAAE,iBAAiB;CACrD,cAAc,MAAkB,EAAE,iBAAiB;CACnD,YAAY,MAAkB,EAAE,iBAAiB;CACjD,YAAY,MAAqB;AAC/B,MAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,IACjC,GAAE,iBAAiB;;CAGxB;;;;;AAg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IACF;IACN,YAAY;IACA;IACZ,MAAM;IACN,MAAM;IACN,OAAO;IACP,SAAS,UAAU,OAAO;cAEzB;KACU;GAEZ,WACC,oBAAC;IACC,KAAK;IACL,gBAAa;IACb,GAAI;cAEJ,oBAAC;KACC,MAAM;KACN,OAAM;KACM;eAEX;MACkB;KACjB;GAEP,sBAAsB,iBAAiB,YAAY;GAEnD,eAAe,aAAa,aAC3B,oBAAC;IACC,QAAQ;KAAE,MAAM;KAAQ,KAAK,KAAK;KAAK,cAAc;KAAS;IACnD;IACX,UAAS;KACT;;GAES"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { DropIndicatorElement } from "./styled.js";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
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.131.0 | Cube Dev Team */
|
|
2
2
|
import { TabPanelElement } from "./styled.js";
|
|
3
3
|
import { useEffect, useMemo, useRef } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, 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.131.0 | Cube Dev Team */
|
|
2
2
|
import { ItemAction } from "../../actions/ItemAction/ItemAction.js";
|
|
3
3
|
import { CloseIcon } from "../../../icons/CloseIcon.js";
|
|
4
4
|
import { MoreIcon } from "../../../icons/MoreIcon.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { useEvent } from "../../../_internal/hooks/use-event.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { _ItemButton } from "../../actions/ItemButton/ItemButton.js";
|
|
3
3
|
import { useOptionalTabsContext } from "./TabsContext.js";
|
|
4
4
|
import { tasty } from "@tenphi/tasty";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { useLayoutEffect as useLayoutEffect$1 } from "../../../utils/react/useLayoutEffect.js";
|
|
3
3
|
import { Block } from "../../Block.js";
|
|
4
4
|
import { Space } from "../../layout/Space.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { _Text } from "../../content/Text.js";
|
|
3
3
|
import { _Title } from "../../content/Title.js";
|
|
4
4
|
import { Card } from "../../content/Card/Card.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { _Title } from "../../content/Title.js";
|
|
3
3
|
import { useProviderProps } from "../../../provider.js";
|
|
4
4
|
import { Space } from "../../layout/Space.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { _Title } from "../../content/Title.js";
|
|
3
3
|
import { useProviderProps } from "../../../provider.js";
|
|
4
4
|
import { Space } from "../../layout/Space.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { chain } from "../../../utils/react/chain.js";
|
|
3
3
|
import { Paragraph } from "../../content/Paragraph.js";
|
|
4
4
|
import { _Title } from "../../content/Title.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { AlertDialogZone } from "./AlertDialogZone.js";
|
|
3
3
|
import { createContext, useContext, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { Portal } from "../../portal/Portal.js";
|
|
3
3
|
import { DialogContainer } from "../Dialog/DialogContainer.js";
|
|
4
4
|
import { _AlertDialog } from "./AlertDialog.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { extractStyles } from "../../../utils/styles.js";
|
|
3
3
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
4
4
|
import { SlotProvider } from "../../../utils/react/Slots.js";
|
|
5
5
|
import { CloseIcon } from "../../../icons/CloseIcon.js";
|
|
6
|
-
import { useOpenTransitionContext } from "../Modal/
|
|
6
|
+
import { useOpenTransitionContext } from "../Modal/OpenTransitionContext.js";
|
|
7
7
|
import { _ItemButton } from "../../actions/ItemButton/ItemButton.js";
|
|
8
8
|
import { useDialogContext } from "./context.js";
|
|
9
9
|
import { BASE_STYLES, BLOCK_STYLES, DIMENSION_STYLES, FLOW_STYLES, tasty } from "@tenphi/tasty";
|
|
10
|
-
import { forwardRef, useEffect, useMemo
|
|
10
|
+
import { forwardRef, useEffect, useMemo } from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { DismissButton, FocusScope, useDialog, useMessageFormatter } from "react-aria";
|
|
13
13
|
import { useDOMRef } from "@react-spectrum/utils";
|
|
@@ -121,23 +121,9 @@ const Dialog = forwardRef(function Dialog(props, ref) {
|
|
|
121
121
|
ref
|
|
122
122
|
}, "content");
|
|
123
123
|
}, [props, ref]);
|
|
124
|
-
const shouldContainFocus = isEntered && context.type !== "panel";
|
|
125
|
-
const previouslyFocusedRef = useRef(null);
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
if (context.isOpen) previouslyFocusedRef.current = document.activeElement;
|
|
128
|
-
}, [context.isOpen]);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
if (!context.isOpen && previouslyFocusedRef.current) {
|
|
131
|
-
const elementToFocus = previouslyFocusedRef.current;
|
|
132
|
-
setTimeout(() => {
|
|
133
|
-
elementToFocus?.focus?.();
|
|
134
|
-
});
|
|
135
|
-
previouslyFocusedRef.current = null;
|
|
136
|
-
}
|
|
137
|
-
}, [context.isOpen]);
|
|
138
124
|
return /* @__PURE__ */ jsx(FocusScope, {
|
|
139
125
|
restoreFocus: true,
|
|
140
|
-
contain:
|
|
126
|
+
contain: isEntered && !!context.isOpen && context.type !== "panel",
|
|
141
127
|
children: content
|
|
142
128
|
});
|
|
143
129
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","names":["ItemButton","mergeProps"],"sources":["../../../../src/components/overlays/Dialog/Dialog.tsx"],"sourcesContent":["import { createFocusManager } from '@react-aria/focus';\nimport { useDOMRef } from '@react-spectrum/utils';\nimport { DOMRef } from '@react-types/shared';\nimport {\n BASE_STYLES,\n BaseProps,\n BaseStyleProps,\n BLOCK_STYLES,\n BlockStyleProps,\n DIMENSION_STYLES,\n DimensionStyleProps,\n FLOW_STYLES,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport { forwardRef, ReactElement, useEffect, useMemo, useRef } from 'react';\nimport {\n AriaDialogProps,\n DismissButton,\n FocusScope,\n useDialog,\n useMessageFormatter,\n} from 'react-aria';\n\nimport { CloseIcon } from '../../../icons';\nimport { mergeProps, SlotProvider } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { ItemButton } from '../../actions';\nimport { useOpenTransitionContext } from '../Modal/OpenTransition';\n\nimport { useDialogContext } from './context';\n\nconst STYLES_LIST = [\n ...BASE_STYLES,\n ...DIMENSION_STYLES,\n ...BLOCK_STYLES,\n ...FLOW_STYLES,\n];\n\nconst DialogElement = tasty({\n as: 'section',\n styles: {\n display: 'flex',\n flow: 'column',\n fill: '#white',\n pointerEvents: 'auto',\n outline: 0,\n position: {\n '': 'relative',\n 'type=panel': 'absolute',\n },\n width: {\n '': '$min-dialog-size $dialog-size (100dvw - 8x)',\n 'type=fullscreen': '(100dvw - 8x) (100dvw - 8x)',\n 'type=fullscreenTakeover': '100dvw 100dvw',\n 'type=panel': 'auto',\n },\n height: {\n '': 'auto (100dvh - 8x)',\n 'type=fullscreen': '(100dvh - 8x) (100dvh - 8x)',\n 'type=fullscreenTakeover | type=panel': '100dvh 100dvh',\n 'type=popover': 'initial initial (50dvh - 5x)',\n },\n gap: 0,\n border: {\n '': false,\n 'type=popover': true,\n },\n radius: {\n '': '1cr',\n 'type=tray': '1cr top',\n 'type=fullscreenTakeover': '0r',\n },\n shadow: {\n '': '$dialog-shadow',\n 'type=popover | type=panel': '$shadow',\n },\n top: {\n '': false,\n 'type=modal': '((50vh - 50%) / -3)',\n 'type=panel': 'auto',\n },\n '$dialog-title-padding-v': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n '$dialog-content-padding-v': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n '$dialog-padding-h': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n '$dialog-footer-v': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n '$dialog-content-gap': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n },\n});\n\nconst CloseButton = tasty(ItemButton, {\n qa: 'ModalCloseButton',\n type: 'neutral',\n styles: {\n position: 'absolute',\n top: '1x',\n right: '1x',\n },\n});\n\nconst sizeMap = {\n S: 'small',\n M: 'medium',\n L: 'large',\n};\nconst sizePxMap = {\n small: 360,\n medium: 479,\n large: 798,\n};\n\nconst intlMessages = {\n 'en-US': {\n dismiss: 'Dismiss',\n alert: 'Alert',\n },\n};\n\nexport interface CubeDialogProps\n extends Omit<BaseProps, 'role'>,\n AriaDialogProps,\n BaseStyleProps,\n BlockStyleProps,\n DimensionStyleProps {\n /** The size of the dialog */\n size?: 'S' | 'M' | 'L' | 'small' | 'medium' | 'large';\n /** Whether the dialog is dismissable */\n isDismissable?: boolean;\n /** Trigger when the dialog is dismissed */\n onDismiss?: (arg?: any) => void;\n /** That you can replace the close icon with */\n closeIcon?: ReactElement;\n closeButtonStyles?: Styles;\n role?: 'dialog' | 'alertdialog';\n}\n\n/**\n * Dialogs are windows containing contextual information, tasks, or workflows that appear over the user interface.\n * Depending on the kind of Dialog, further interactions may be blocked until the Dialog is acknowledged.\n */\nexport const Dialog = forwardRef(function Dialog(\n props: CubeDialogProps,\n ref: DOMRef<HTMLDivElement>,\n) {\n const transitionContext = useOpenTransitionContext();\n\n const isEntered = transitionContext?.transitionState === 'entered';\n\n const context = useDialogContext();\n\n const content = useMemo(() => {\n return <DialogContent key=\"content\" {...props} ref={ref} />;\n }, [props, ref]);\n\n const shouldContainFocus = isEntered && context.type !== 'panel';\n\n // Track the element that was focused before the dialog opened\n // This handles hideOnClose case where FocusScope doesn't unmount\n const previouslyFocusedRef = useRef<Element | null>(null);\n\n // Capture the focused element when dialog opens\n useEffect(() => {\n if (context.isOpen) {\n previouslyFocusedRef.current = document.activeElement;\n }\n }, [context.isOpen]);\n\n // Restore focus when dialog closes (for hideOnClose case where component stays mounted)\n useEffect(() => {\n if (!context.isOpen && previouslyFocusedRef.current) {\n const elementToFocus = previouslyFocusedRef.current as HTMLElement;\n\n // Use setTimeout to ensure this runs after the close transition\n setTimeout(() => {\n elementToFocus?.focus?.();\n });\n previouslyFocusedRef.current = null;\n }\n }, [context.isOpen]);\n\n return (\n // This component traps the focus inside the dialog and restores it on close.\n <FocusScope restoreFocus contain={shouldContainFocus}>\n {content}\n </FocusScope>\n );\n});\n\nconst DialogContent = forwardRef(function DialogContent(\n props: CubeDialogProps,\n ref: DOMRef<HTMLDivElement>,\n) {\n let { type = 'modal', ...contextProps } = useDialogContext();\n\n let {\n qa,\n children,\n size = 'M',\n isDismissable = contextProps.isDismissable,\n onDismiss = contextProps.onClose,\n closeIcon,\n closeButtonStyles,\n style,\n ...otherProps\n } = props;\n\n size = sizeMap[size.toUpperCase()] || size;\n\n const styles: Styles = extractStyles(otherProps, STYLES_LIST);\n\n let formatMessage = useMessageFormatter(intlMessages);\n\n let domRef = useDOMRef(ref);\n let { dialogProps, titleProps } = useDialog(\n mergeProps(contextProps, props),\n domRef,\n );\n\n // If rendered in a popover or tray there won't be a visible dismiss button,\n // so we render a hidden one for screen readers.\n let dismissButton;\n if (type === 'popover' || type === 'tray') {\n dismissButton = <DismissButton onDismiss={onDismiss} />;\n }\n\n // Focus the first focusable element in the dialog when it opens\n useEffect(() => {\n if (contextProps.isOpen) {\n setTimeout(() => {\n if (\n domRef.current &&\n !domRef.current.contains(document.activeElement)\n ) {\n // Priority 1: autofocus input or primary button\n const priorityElement = domRef.current.querySelector(\n 'input[data-autofocus], button[type=\"submit\"], button[data-type=\"primary\"]',\n ) as HTMLElement | null;\n\n if (priorityElement) {\n priorityElement.focus();\n } else {\n // Fallback: focus first tabbable element, or dialog itself\n const focusManager = createFocusManager(domRef);\n\n if (!focusManager.focusFirst({ tabbable: true })) {\n domRef.current.focus();\n }\n }\n }\n });\n }\n }, [contextProps.isOpen]);\n\n // let hasHeader = useHasChild('[data-id=\"Header\"]', domRef);\n // let hasFooter = useHasChild('[data-id=\"Footer\"]', domRef);\n\n let slots = {\n title: {\n level: 2,\n preset: 'h4',\n ...titleProps,\n },\n content: {\n styles: {\n flexGrow: 1,\n padding: '$dialog-content-padding-v $dialog-padding-h',\n gap: '$dialog-content-gap',\n height: {\n '': 'max (100% - (2 * $dialog-content-padding-v))',\n ':last-child': 'max (100% - $dialog-content-padding-v)',\n },\n },\n },\n header: {\n ellipsis: true,\n styles: {\n display: 'flex',\n flow: 'row',\n gap: '1x',\n placeItems: 'center stretch',\n placeContent: 'space-between',\n padding: `$dialog-title-padding-v ${\n isDismissable ? '($dialog-padding-h + 4x)' : '$dialog-padding-h'\n } $dialog-title-padding-v $dialog-padding-h`,\n border: 'bottom',\n },\n },\n footer: {\n styles: {\n display: 'flex',\n gap: '1x',\n flow: 'row-reverse',\n placeItems: 'baseline stretch',\n placeContent: 'space-between',\n padding: '$dialog-footer-v $dialog-padding-h',\n },\n },\n buttonGroup: {\n styles: {\n flow: 'row-reverse',\n },\n },\n };\n\n return (\n <DialogElement\n ref={domRef}\n data-id=\"Dialog\"\n data-qa={qa || 'Dialog'}\n styles={styles}\n as=\"section\"\n {...dialogProps}\n mods={{ dismissable: isDismissable }}\n style={{\n '--dialog-size': `${sizePxMap[size] || sizePxMap.small}px`,\n ...style,\n }}\n data-type={type}\n data-size={size}\n >\n {dismissButton}\n\n <SlotProvider slots={slots}>\n {isDismissable && (\n <CloseButton\n icon={closeIcon || <CloseIcon size={20} />}\n label={formatMessage('dismiss')}\n onPress={() => onDismiss && onDismiss()}\n />\n )}\n {children}\n </SlotProvider>\n </DialogElement>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,MAAM,cAAc;CAClB,GAAG;CACH,GAAG;CACH,GAAG;CACH,GA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AAa,OAAO,CAAC;CAKzB,IAAI,QAAQ;EACV,OAAO;GACL,OAAO;GACP,QAAQ;GACR,GAAG;GACJ;EACD,SAAS,EACP,QAAQ;GACN,UAAU;GACV,SAAS;GACT,KAAK;GACL,QAAQ;IACN,IAAI;IACJ,eAAe;IAChB;GACF,EACF;EACD,QAAQ;GACN,UAAU;GACV,QAAQ;IACN,SAAS;IACT,MAAM;IACN,KAAK;IACL,YAAY;IACZ,cAAc;IACd,SAAS,2BACP,gBAAgB,6BAA6B,oBAC9C;IACD,QAAQ;IACT;GACF;EACD,QAAQ,EACN,QAAQ;GACN,SAAS;GACT,KAAK;GACL,MAAM;GACN,YAAY;GACZ,cAAc;GACd,SAAS;GACV,EACF;EACD,aAAa,EACX,QAAQ,EACN,MAAM,eACP,EACF;EACF;AAED,QACE,qBAAC;EACC,KAAK;EACL,WAAQ;EACR,WAAS,MAAM;EACP;EACR,IAAG;EACH,GAAI;EACJ,MAAM,EAAE,aAAa,eAAe;EACpC,OAAO;GACL,iBAAiB,GAAG,UAAU,SAAS,UAAU,MAAM;GACvD,GAAG;GACJ;EACD,aAAW;EACX,aAAW;aAEV,eAED,qBAAC;GAAoB;cAClB,iBACC,oBAAC;IACC,MAAM,aAAa,oBAAC,aAAU,MAAM,KAAM;IAC1C,OAAO,cAAc,UAAU;IAC/B,eAAe,aAAa,WAAW;KACvC,EAEH;IACY;GACD;EAElB"}
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["ItemButton","mergeProps"],"sources":["../../../../src/components/overlays/Dialog/Dialog.tsx"],"sourcesContent":["import { createFocusManager } from '@react-aria/focus';\nimport { useDOMRef } from '@react-spectrum/utils';\nimport { DOMRef } from '@react-types/shared';\nimport {\n BASE_STYLES,\n BaseProps,\n BaseStyleProps,\n BLOCK_STYLES,\n BlockStyleProps,\n DIMENSION_STYLES,\n DimensionStyleProps,\n FLOW_STYLES,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport { forwardRef, ReactElement, useEffect, useMemo } from 'react';\nimport {\n AriaDialogProps,\n DismissButton,\n FocusScope,\n useDialog,\n useMessageFormatter,\n} from 'react-aria';\n\nimport { CloseIcon } from '../../../icons';\nimport { mergeProps, SlotProvider } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { ItemButton } from '../../actions';\nimport { useOpenTransitionContext } from '../Modal/OpenTransitionContext';\n\nimport { useDialogContext } from './context';\n\nconst STYLES_LIST = [\n ...BASE_STYLES,\n ...DIMENSION_STYLES,\n ...BLOCK_STYLES,\n ...FLOW_STYLES,\n];\n\nconst DialogElement = tasty({\n as: 'section',\n styles: {\n display: 'flex',\n flow: 'column',\n fill: '#white',\n pointerEvents: 'auto',\n outline: 0,\n position: {\n '': 'relative',\n 'type=panel': 'absolute',\n },\n width: {\n '': '$min-dialog-size $dialog-size (100dvw - 8x)',\n 'type=fullscreen': '(100dvw - 8x) (100dvw - 8x)',\n 'type=fullscreenTakeover': '100dvw 100dvw',\n 'type=panel': 'auto',\n },\n height: {\n '': 'auto (100dvh - 8x)',\n 'type=fullscreen': '(100dvh - 8x) (100dvh - 8x)',\n 'type=fullscreenTakeover | type=panel': '100dvh 100dvh',\n 'type=popover': 'initial initial (50dvh - 5x)',\n },\n gap: 0,\n border: {\n '': false,\n 'type=popover': true,\n },\n radius: {\n '': '1cr',\n 'type=tray': '1cr top',\n 'type=fullscreenTakeover': '0r',\n },\n shadow: {\n '': '$dialog-shadow',\n 'type=popover | type=panel': '$shadow',\n },\n top: {\n '': false,\n 'type=modal': '((50vh - 50%) / -3)',\n 'type=panel': 'auto',\n },\n '$dialog-title-padding-v': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n '$dialog-content-padding-v': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n '$dialog-padding-h': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n '$dialog-footer-v': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n '$dialog-content-gap': {\n '': '1.5x',\n 'type=popover': '1x',\n },\n },\n});\n\nconst CloseButton = tasty(ItemButton, {\n qa: 'ModalCloseButton',\n type: 'neutral',\n styles: {\n position: 'absolute',\n top: '1x',\n right: '1x',\n },\n});\n\nconst sizeMap = {\n S: 'small',\n M: 'medium',\n L: 'large',\n};\nconst sizePxMap = {\n small: 360,\n medium: 479,\n large: 798,\n};\n\nconst intlMessages = {\n 'en-US': {\n dismiss: 'Dismiss',\n alert: 'Alert',\n },\n};\n\nexport interface CubeDialogProps\n extends Omit<BaseProps, 'role'>,\n AriaDialogProps,\n BaseStyleProps,\n BlockStyleProps,\n DimensionStyleProps {\n /** The size of the dialog */\n size?: 'S' | 'M' | 'L' | 'small' | 'medium' | 'large';\n /** Whether the dialog is dismissable */\n isDismissable?: boolean;\n /** Trigger when the dialog is dismissed */\n onDismiss?: (arg?: any) => void;\n /** That you can replace the close icon with */\n closeIcon?: ReactElement;\n closeButtonStyles?: Styles;\n role?: 'dialog' | 'alertdialog';\n}\n\n/**\n * Dialogs are windows containing contextual information, tasks, or workflows that appear over the user interface.\n * Depending on the kind of Dialog, further interactions may be blocked until the Dialog is acknowledged.\n */\nexport const Dialog = forwardRef(function Dialog(\n props: CubeDialogProps,\n ref: DOMRef<HTMLDivElement>,\n) {\n const transitionContext = useOpenTransitionContext();\n\n const isEntered = transitionContext?.transitionState === 'entered';\n\n const context = useDialogContext();\n\n const content = useMemo(() => {\n return <DialogContent key=\"content\" {...props} ref={ref} />;\n }, [props, ref]);\n\n const shouldContainFocus =\n isEntered && !!context.isOpen && context.type !== 'panel';\n\n return (\n // This component traps the focus inside the dialog and restores it on close.\n <FocusScope restoreFocus contain={shouldContainFocus}>\n {content}\n </FocusScope>\n );\n});\n\nconst DialogContent = forwardRef(function DialogContent(\n props: CubeDialogProps,\n ref: DOMRef<HTMLDivElement>,\n) {\n let { type = 'modal', ...contextProps } = useDialogContext();\n\n let {\n qa,\n children,\n size = 'M',\n isDismissable = contextProps.isDismissable,\n onDismiss = contextProps.onClose,\n closeIcon,\n closeButtonStyles,\n style,\n ...otherProps\n } = props;\n\n size = sizeMap[size.toUpperCase()] || size;\n\n const styles: Styles = extractStyles(otherProps, STYLES_LIST);\n\n let formatMessage = useMessageFormatter(intlMessages);\n\n let domRef = useDOMRef(ref);\n let { dialogProps, titleProps } = useDialog(\n mergeProps(contextProps, props),\n domRef,\n );\n\n // If rendered in a popover or tray there won't be a visible dismiss button,\n // so we render a hidden one for screen readers.\n let dismissButton;\n if (type === 'popover' || type === 'tray') {\n dismissButton = <DismissButton onDismiss={onDismiss} />;\n }\n\n // Focus the first focusable element in the dialog when it opens\n useEffect(() => {\n if (contextProps.isOpen) {\n setTimeout(() => {\n if (\n domRef.current &&\n !domRef.current.contains(document.activeElement)\n ) {\n // Priority 1: autofocus input or primary button\n const priorityElement = domRef.current.querySelector(\n 'input[data-autofocus], button[type=\"submit\"], button[data-type=\"primary\"]',\n ) as HTMLElement | null;\n\n if (priorityElement) {\n priorityElement.focus();\n } else {\n // Fallback: focus first tabbable element, or dialog itself\n const focusManager = createFocusManager(domRef);\n\n if (!focusManager.focusFirst({ tabbable: true })) {\n domRef.current.focus();\n }\n }\n }\n });\n }\n }, [contextProps.isOpen]);\n\n // let hasHeader = useHasChild('[data-id=\"Header\"]', domRef);\n // let hasFooter = useHasChild('[data-id=\"Footer\"]', domRef);\n\n let slots = {\n title: {\n level: 2,\n preset: 'h4',\n ...titleProps,\n },\n content: {\n styles: {\n flexGrow: 1,\n padding: '$dialog-content-padding-v $dialog-padding-h',\n gap: '$dialog-content-gap',\n height: {\n '': 'max (100% - (2 * $dialog-content-padding-v))',\n ':last-child': 'max (100% - $dialog-content-padding-v)',\n },\n },\n },\n header: {\n ellipsis: true,\n styles: {\n display: 'flex',\n flow: 'row',\n gap: '1x',\n placeItems: 'center stretch',\n placeContent: 'space-between',\n padding: `$dialog-title-padding-v ${\n isDismissable ? '($dialog-padding-h + 4x)' : '$dialog-padding-h'\n } $dialog-title-padding-v $dialog-padding-h`,\n border: 'bottom',\n },\n },\n footer: {\n styles: {\n display: 'flex',\n gap: '1x',\n flow: 'row-reverse',\n placeItems: 'baseline stretch',\n placeContent: 'space-between',\n padding: '$dialog-footer-v $dialog-padding-h',\n },\n },\n buttonGroup: {\n styles: {\n flow: 'row-reverse',\n },\n },\n };\n\n return (\n <DialogElement\n ref={domRef}\n data-id=\"Dialog\"\n data-qa={qa || 'Dialog'}\n styles={styles}\n as=\"section\"\n {...dialogProps}\n mods={{ dismissable: isDismissable }}\n style={{\n '--dialog-size': `${sizePxMap[size] || sizePxMap.small}px`,\n ...style,\n }}\n data-type={type}\n data-size={size}\n >\n {dismissButton}\n\n <SlotProvider slots={slots}>\n {isDismissable && (\n <CloseButton\n icon={closeIcon || <CloseIcon size={20} />}\n label={formatMessage('dismiss')}\n onPress={() => onDismiss && onDismiss()}\n />\n )}\n {children}\n </SlotProvider>\n </DialogElement>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,MAAM,cAAc;CAClB,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACJ;AAED,MAAM,gBAAgB,MAAM;CAC1B,IAAI;CACJ,QAAQ;EACN,SAAS;EACT,MAAM;EACN,MAAM;EACN,eAAe;EACf,SAAS;EACT,UAAU;GACR,IAAI;GACJ,cAAc;GACf;EACD,OAAO;GACL,IAAI;GACJ,mBAAmB;GACnB,2BAA2B;GAC3B,cAAc;GACf;EACD,QAAQ;GACN,IAAI;GACJ,mBAAmB;GACnB,wCAAwC;GACxC,gBAAgB;GACjB;EACD,KAAK;EACL,QAAQ;GACN,IAAI;GACJ,gBAAgB;GACjB;EACD,QAAQ;GACN,IAAI;GACJ,aAAa;GACb,2BAA2B;GAC5B;EACD,QAAQ;GACN,IAAI;GACJ,6BAA6B;GAC9B;EACD,KAAK;GACH,IAAI;GACJ,cAAc;GACd,cAAc;GACf;EACD,2BAA2B;GACzB,IAAI;GACJ,gBAAgB;GACjB;EACD,6BAA6B;GAC3B,IAAI;GACJ,gBAAgB;GACjB;EACD,qBAAqB;GACnB,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MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { _Modal } from "../Modal/Modal.js";
|
|
3
3
|
import { DialogContext } from "./context.js";
|
|
4
4
|
import { Children, isValidElement, useRef } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { _Title } from "../../content/Title.js";
|
|
3
3
|
import { ButtonGroup } from "../../actions/ButtonGroup/ButtonGroup.js";
|
|
4
4
|
import { Button } from "../../actions/index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
|
|
3
3
|
import { _Modal } from "../Modal/Modal.js";
|
|
4
4
|
import { _Tray } from "../Modal/Tray.js";
|
|
@@ -134,7 +134,6 @@ function PopoverTrigger(allProps) {
|
|
|
134
134
|
arrowProps,
|
|
135
135
|
isKeyboardDismissDisabled,
|
|
136
136
|
hideArrow,
|
|
137
|
-
updatePosition,
|
|
138
137
|
shouldCloseOnInteractOutside,
|
|
139
138
|
onClose,
|
|
140
139
|
children: typeof content === "function" ? content(state.close) : content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogTrigger.js","names":["Modal","Tray","Popover"],"sources":["../../../../src/components/overlays/Dialog/DialogTrigger.tsx"],"sourcesContent":["import { PressResponder } from '@react-aria/interactions';\nimport { useMediaQuery } from '@react-spectrum/utils';\nimport { Styles } from '@tenphi/tasty';\nimport { Fragment, ReactElement, RefObject, useEffect, useRef } from 'react';\nimport {\n OverlayTriggerProps,\n Placement,\n PositionProps,\n useOverlayPosition,\n useOverlayTrigger,\n} from 'react-aria';\nimport { OverlayTriggerState, useOverlayTriggerState } from 'react-stately';\n\nimport { useCombinedRefs } from '../../../utils/react/index';\nimport { Modal, Popover, Tray, WithCloseBehavior } from '../Modal';\n\nimport { DialogContext } from './context';\n\nexport type CubeDialogClose = (close: () => void) => ReactElement;\n\nexport interface CubeDialogTriggerProps\n extends OverlayTriggerProps,\n PositionProps,\n WithCloseBehavior {\n /** The Dialog and its trigger element. See the DialogTrigger [Content section](#content) for more information on what to provide as children. */\n children: [\n ReactElement | ((state: OverlayTriggerState) => ReactElement),\n CubeDialogClose | ReactElement,\n ];\n /**\n * The type of Dialog that should be rendered. See the DialogTrigger [types section](#dialog-types) for an explanation on each.\n * @default 'modal'\n */\n type?:\n | 'modal'\n | 'popover'\n | 'tray'\n | 'fullscreen'\n | 'fullscreenTakeover'\n | 'panel';\n /** The type of Dialog that should be rendered when on a mobile device. See DialogTrigger [types section](#dialog-types) for an explanation on each. */\n mobileType?:\n | 'modal'\n | 'tray'\n | 'fullscreen'\n | 'fullscreenTakeover'\n | 'panel'\n | 'popover';\n placement?: Placement;\n /**\n * Whether a popover type Dialog's arrow should be hidden.\n */\n hideArrow?: boolean;\n /** The ref of the element the Dialog should visually attach itself to. Defaults to the trigger button if not defined. */\n targetRef?: RefObject<HTMLElement | null>;\n /** Whether a modal type Dialog should be dismissable. */\n isDismissable?: boolean;\n /** Whether pressing the escape key to close the dialog should be disabled. */\n isKeyboardDismissDisabled?: boolean;\n /** The screen breakpoint for the mobile type */\n mobileViewport?: number;\n /** The style map for the overlay **/\n styles?: Styles;\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n onDismiss?: (action?: string) => void;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n defaultOpen?: boolean;\n shouldFlip?: boolean;\n shouldUpdatePosition?: boolean;\n /** Minimum padding in pixels between the popover and viewport edges */\n containerPadding?: number;\n}\n\n/**\n * DialogTrigger serves as a wrapper around a Dialog and its associated trigger, linking the Dialog's\n * open state with the trigger's press state. Additionally, it allows you to customize the type and\n * positioning of the Dialog.\n */\nexport function DialogTrigger(props: CubeDialogTriggerProps) {\n let {\n children,\n type = 'modal',\n mobileType = type === 'popover' ? 'modal' : type,\n hideArrow,\n targetRef,\n onDismiss,\n isDismissable = true,\n isKeyboardDismissDisabled,\n styles,\n mobileViewport = 700,\n hideOnClose,\n shouldCloseOnInteractOutside,\n ...positionProps\n } = props;\n\n if (!Array.isArray(children) || children.length > 2) {\n throw new Error('DialogTrigger must have exactly 2 children');\n }\n // if a function is passed as the second child, it won't appear in toArray\n let [trigger, content] = children;\n\n // On small devices, show a modal or tray instead of a popover.\n let isMobile = useMediaQuery(`(max-width: ${mobileViewport}px)`);\n if (isMobile) {\n // handle cases where desktop popovers need a close button for the mobile modal view\n if (type !== 'modal' && mobileType === 'modal') {\n isDismissable = true;\n }\n\n type = mobileType;\n }\n\n let state = useOverlayTriggerState(props);\n\n if (typeof trigger === 'function') {\n trigger = trigger(state);\n }\n\n let wasOpen = useRef(false);\n let isExiting = useRef(false);\n let onExiting = () => (isExiting.current = true);\n let onExited = () => (isExiting.current = false);\n\n wasOpen.current = state.isOpen;\n\n useEffect(() => {\n return () => {\n if (\n (wasOpen.current || isExiting.current) &&\n type !== 'popover' &&\n type !== 'tray'\n ) {\n console.warn(\n 'CubeUIKit: A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.',\n );\n }\n };\n }, []);\n\n function onClose(action) {\n if (isDismissable) {\n onDismiss && onDismiss(action);\n state.close();\n }\n }\n\n if (type === 'popover') {\n return (\n <PopoverTrigger\n {...positionProps}\n hideOnClose={hideOnClose}\n state={state}\n styles={styles}\n targetRef={targetRef}\n trigger={trigger}\n content={content}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n hideArrow={hideArrow}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}\n onClose={onClose}\n />\n );\n }\n\n let renderOverlay = () => {\n switch (type) {\n case 'panel':\n case 'fullscreen':\n case 'fullscreenTakeover':\n case 'modal':\n return (\n <Modal\n hideOnClose={hideOnClose}\n isOpen={state.isOpen}\n isDismissable={isDismissable}\n type={type}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n styles={styles}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}\n onClose={onClose}\n onExiting={onExiting}\n onExited={onExited}\n >\n {typeof content === 'function' ? content(state.close) : content}\n </Modal>\n );\n case 'tray':\n return (\n <Tray\n hideOnClose={hideOnClose}\n isOpen={state.isOpen}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n styles={styles}\n onClose={onClose}\n >\n {typeof content === 'function' ? content(state.close) : content}\n </Tray>\n );\n }\n };\n\n return (\n <DialogTriggerBase\n type={type}\n state={state}\n isDismissable={isDismissable}\n trigger={trigger}\n overlay={renderOverlay()}\n hideOnClose={hideOnClose}\n onClose={onClose}\n />\n );\n}\n\nfunction PopoverTrigger(allProps) {\n let {\n state,\n styles,\n targetRef,\n trigger,\n content,\n hideArrow,\n onClose,\n isKeyboardDismissDisabled,\n hideOnClose,\n shouldCloseOnInteractOutside,\n keepOpenOnScroll,\n ...props\n } = allProps;\n\n let triggerRef = useRef<HTMLButtonElement>(null);\n let overlayRef = useRef<HTMLDivElement>(null);\n\n let {\n overlayProps: popoverProps,\n placement,\n arrowProps,\n updatePosition,\n } = useOverlayPosition({\n targetRef: targetRef || triggerRef,\n overlayRef: overlayRef,\n placement: props.placement,\n containerPadding: props.containerPadding,\n offset: props.offset || 8,\n crossOffset: props.crossOffset,\n shouldFlip: props.shouldFlip,\n shouldUpdatePosition: props.shouldUpdatePosition,\n isOpen: state.isOpen,\n });\n\n let overlayTriggerState = state;\n\n if (keepOpenOnScroll) {\n overlayTriggerState = { ...state, close: updatePosition };\n }\n\n let { triggerProps, overlayProps } = useOverlayTrigger(\n { type: 'dialog' },\n overlayTriggerState,\n triggerRef,\n );\n\n let triggerPropsWithRef = {\n ...triggerProps,\n ref: targetRef ? undefined : triggerRef,\n };\n\n let overlay = (\n <Popover\n ref={overlayRef}\n styles={styles}\n hideOnClose={hideOnClose}\n isOpen={state.isOpen}\n style={popoverProps.style}\n placement={placement}\n arrowProps={arrowProps}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n hideArrow={hideArrow}\n updatePosition={updatePosition}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}\n onClose={onClose}\n >\n {typeof content === 'function' ? content(state.close) : content}\n </Popover>\n );\n\n return (\n <DialogTriggerBase\n type=\"popover\"\n state={state}\n triggerProps={triggerPropsWithRef}\n dialogProps={overlayProps}\n trigger={trigger}\n overlay={overlay}\n onClose={onClose}\n />\n );\n}\n\nfunction DialogTriggerBase(props: any) {\n const ref = useCombinedRefs<HTMLElement>(props.ref);\n const wasOpenRef = useRef(false);\n\n let {\n type,\n state,\n onClose,\n isDismissable,\n dialogProps = {},\n triggerProps = {},\n overlay,\n trigger,\n } = props;\n\n let context = {\n type,\n onClose,\n isDismissable,\n isOpen: state.isOpen,\n ...dialogProps,\n };\n\n // Restore focus manually when the dialog closes\n useEffect(() => {\n if (!state.isOpen && wasOpenRef.current) {\n wasOpenRef.current = false;\n ref.current?.focus();\n } else if (state.isOpen) {\n wasOpenRef.current = true;\n }\n }, [state.isOpen]);\n\n return (\n <Fragment>\n <PressResponder\n ref={ref}\n {...triggerProps}\n isPressed={\n state.isOpen &&\n type !== 'modal' &&\n type !== 'fullscreen' &&\n type !== 'fullscreenTakeover'\n }\n onPress={state.toggle}\n >\n {trigger}\n </PressResponder>\n <DialogContext.Provider value={context}>{overlay}</DialogContext.Provider>\n </Fragment>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,cAAc,OAA+B;CAC3D,IAAI,EACF,UACA,OAAO,SACP,aAAa,SAAS,YAAY,UAAU,MAC5C,WACA,WACA,WACA,gBAAgB,MAChB,2BACA,QACA,iBAAiB,KACjB,aACA,8BACA,GAAG,kBACD;AAEJ,KAAI,C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M;EACL,GAAI;EACJ,WACE,MAAM,UACN,SAAS,WACT,SAAS,gBACT,SAAS;EAEX,SAAS,MAAM;YAEd;GACc,EACjB,oBAAC,cAAc;EAAS,OAAO;YAAU;GAAiC,IACjE"}
|
|
1
|
+
{"version":3,"file":"DialogTrigger.js","names":["Modal","Tray","Popover"],"sources":["../../../../src/components/overlays/Dialog/DialogTrigger.tsx"],"sourcesContent":["import { PressResponder } from '@react-aria/interactions';\nimport { useMediaQuery } from '@react-spectrum/utils';\nimport { Styles } from '@tenphi/tasty';\nimport { Fragment, ReactElement, RefObject, useEffect, useRef } from 'react';\nimport {\n OverlayTriggerProps,\n Placement,\n PositionProps,\n useOverlayPosition,\n useOverlayTrigger,\n} from 'react-aria';\nimport { OverlayTriggerState, useOverlayTriggerState } from 'react-stately';\n\nimport { useCombinedRefs } from '../../../utils/react/index';\nimport { Modal, Popover, Tray, WithCloseBehavior } from '../Modal';\n\nimport { DialogContext } from './context';\n\nexport type CubeDialogClose = (close: () => void) => ReactElement;\n\nexport interface CubeDialogTriggerProps\n extends OverlayTriggerProps,\n PositionProps,\n WithCloseBehavior {\n /** The Dialog and its trigger element. See the DialogTrigger [Content section](#content) for more information on what to provide as children. */\n children: [\n ReactElement | ((state: OverlayTriggerState) => ReactElement),\n CubeDialogClose | ReactElement,\n ];\n /**\n * The type of Dialog that should be rendered. See the DialogTrigger [types section](#dialog-types) for an explanation on each.\n * @default 'modal'\n */\n type?:\n | 'modal'\n | 'popover'\n | 'tray'\n | 'fullscreen'\n | 'fullscreenTakeover'\n | 'panel';\n /** The type of Dialog that should be rendered when on a mobile device. See DialogTrigger [types section](#dialog-types) for an explanation on each. */\n mobileType?:\n | 'modal'\n | 'tray'\n | 'fullscreen'\n | 'fullscreenTakeover'\n | 'panel'\n | 'popover';\n placement?: Placement;\n /**\n * Whether a popover type Dialog's arrow should be hidden.\n */\n hideArrow?: boolean;\n /** The ref of the element the Dialog should visually attach itself to. Defaults to the trigger button if not defined. */\n targetRef?: RefObject<HTMLElement | null>;\n /** Whether a modal type Dialog should be dismissable. */\n isDismissable?: boolean;\n /** Whether pressing the escape key to close the dialog should be disabled. */\n isKeyboardDismissDisabled?: boolean;\n /** The screen breakpoint for the mobile type */\n mobileViewport?: number;\n /** The style map for the overlay **/\n styles?: Styles;\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n onDismiss?: (action?: string) => void;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n defaultOpen?: boolean;\n shouldFlip?: boolean;\n shouldUpdatePosition?: boolean;\n /** Minimum padding in pixels between the popover and viewport edges */\n containerPadding?: number;\n}\n\n/**\n * DialogTrigger serves as a wrapper around a Dialog and its associated trigger, linking the Dialog's\n * open state with the trigger's press state. Additionally, it allows you to customize the type and\n * positioning of the Dialog.\n */\nexport function DialogTrigger(props: CubeDialogTriggerProps) {\n let {\n children,\n type = 'modal',\n mobileType = type === 'popover' ? 'modal' : type,\n hideArrow,\n targetRef,\n onDismiss,\n isDismissable = true,\n isKeyboardDismissDisabled,\n styles,\n mobileViewport = 700,\n hideOnClose,\n shouldCloseOnInteractOutside,\n ...positionProps\n } = props;\n\n if (!Array.isArray(children) || children.length > 2) {\n throw new Error('DialogTrigger must have exactly 2 children');\n }\n // if a function is passed as the second child, it won't appear in toArray\n let [trigger, content] = children;\n\n // On small devices, show a modal or tray instead of a popover.\n let isMobile = useMediaQuery(`(max-width: ${mobileViewport}px)`);\n if (isMobile) {\n // handle cases where desktop popovers need a close button for the mobile modal view\n if (type !== 'modal' && mobileType === 'modal') {\n isDismissable = true;\n }\n\n type = mobileType;\n }\n\n let state = useOverlayTriggerState(props);\n\n if (typeof trigger === 'function') {\n trigger = trigger(state);\n }\n\n let wasOpen = useRef(false);\n let isExiting = useRef(false);\n let onExiting = () => (isExiting.current = true);\n let onExited = () => (isExiting.current = false);\n\n wasOpen.current = state.isOpen;\n\n useEffect(() => {\n return () => {\n if (\n (wasOpen.current || isExiting.current) &&\n type !== 'popover' &&\n type !== 'tray'\n ) {\n console.warn(\n 'CubeUIKit: A DialogTrigger unmounted while open. This is likely due to being placed within a trigger that unmounts or inside a conditional. Consider using a DialogContainer instead.',\n );\n }\n };\n }, []);\n\n function onClose(action) {\n if (isDismissable) {\n onDismiss && onDismiss(action);\n state.close();\n }\n }\n\n if (type === 'popover') {\n return (\n <PopoverTrigger\n {...positionProps}\n hideOnClose={hideOnClose}\n state={state}\n styles={styles}\n targetRef={targetRef}\n trigger={trigger}\n content={content}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n hideArrow={hideArrow}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}\n onClose={onClose}\n />\n );\n }\n\n let renderOverlay = () => {\n switch (type) {\n case 'panel':\n case 'fullscreen':\n case 'fullscreenTakeover':\n case 'modal':\n return (\n <Modal\n hideOnClose={hideOnClose}\n isOpen={state.isOpen}\n isDismissable={isDismissable}\n type={type}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n styles={styles}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}\n onClose={onClose}\n onExiting={onExiting}\n onExited={onExited}\n >\n {typeof content === 'function' ? content(state.close) : content}\n </Modal>\n );\n case 'tray':\n return (\n <Tray\n hideOnClose={hideOnClose}\n isOpen={state.isOpen}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n styles={styles}\n onClose={onClose}\n >\n {typeof content === 'function' ? content(state.close) : content}\n </Tray>\n );\n }\n };\n\n return (\n <DialogTriggerBase\n type={type}\n state={state}\n isDismissable={isDismissable}\n trigger={trigger}\n overlay={renderOverlay()}\n hideOnClose={hideOnClose}\n onClose={onClose}\n />\n );\n}\n\nfunction PopoverTrigger(allProps) {\n let {\n state,\n styles,\n targetRef,\n trigger,\n content,\n hideArrow,\n onClose,\n isKeyboardDismissDisabled,\n hideOnClose,\n shouldCloseOnInteractOutside,\n keepOpenOnScroll,\n ...props\n } = allProps;\n\n let triggerRef = useRef<HTMLButtonElement>(null);\n let overlayRef = useRef<HTMLDivElement>(null);\n\n let {\n overlayProps: popoverProps,\n placement,\n arrowProps,\n updatePosition,\n } = useOverlayPosition({\n targetRef: targetRef || triggerRef,\n overlayRef: overlayRef,\n placement: props.placement,\n containerPadding: props.containerPadding,\n offset: props.offset || 8,\n crossOffset: props.crossOffset,\n shouldFlip: props.shouldFlip,\n shouldUpdatePosition: props.shouldUpdatePosition,\n isOpen: state.isOpen,\n });\n\n let overlayTriggerState = state;\n\n if (keepOpenOnScroll) {\n overlayTriggerState = { ...state, close: updatePosition };\n }\n\n let { triggerProps, overlayProps } = useOverlayTrigger(\n { type: 'dialog' },\n overlayTriggerState,\n triggerRef,\n );\n\n let triggerPropsWithRef = {\n ...triggerProps,\n ref: targetRef ? undefined : triggerRef,\n };\n\n let overlay = (\n <Popover\n ref={overlayRef}\n styles={styles}\n hideOnClose={hideOnClose}\n isOpen={state.isOpen}\n style={popoverProps.style}\n placement={placement}\n arrowProps={arrowProps}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n hideArrow={hideArrow}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}\n onClose={onClose}\n >\n {typeof content === 'function' ? content(state.close) : content}\n </Popover>\n );\n\n return (\n <DialogTriggerBase\n type=\"popover\"\n state={state}\n triggerProps={triggerPropsWithRef}\n dialogProps={overlayProps}\n trigger={trigger}\n overlay={overlay}\n onClose={onClose}\n />\n );\n}\n\nfunction DialogTriggerBase(props: any) {\n const ref = useCombinedRefs<HTMLElement>(props.ref);\n const wasOpenRef = useRef(false);\n\n let {\n type,\n state,\n onClose,\n isDismissable,\n dialogProps = {},\n triggerProps = {},\n overlay,\n trigger,\n } = props;\n\n let context = {\n type,\n onClose,\n isDismissable,\n isOpen: state.isOpen,\n ...dialogProps,\n };\n\n // Restore focus manually when the dialog closes\n useEffect(() => {\n if (!state.isOpen && wasOpenRef.current) {\n wasOpenRef.current = false;\n ref.current?.focus();\n } else if (state.isOpen) {\n wasOpenRef.current = true;\n }\n }, [state.isOpen]);\n\n return (\n <Fragment>\n <PressResponder\n ref={ref}\n {...triggerProps}\n isPressed={\n state.isOpen &&\n type !== 'modal' &&\n type !== 'fullscreen' &&\n type !== 'fullscreenTakeover'\n }\n onPress={state.toggle}\n >\n {trigger}\n </PressResponder>\n <DialogContext.Provider value={context}>{overlay}</DialogContext.Provider>\n </Fragment>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,cAAc,OAA+B;CAC3D,IAAI,EACF,UACA,OAAO,SACP,aAAa,SAAS,YAAY,UAAU,MAC5C,WACA,WACA,WACA,gBAAgB,MAChB,2BACA,QACA,iBAAiB,KACjB,aACA,8BACA,GAAG,kBACD;AAEJ,KAAI,CAAC,MAAM,QAAQ,SAAS,IAAI,SAAS,SAAS,EAChD,OAAM,IAAI,MAAM,6CAA6C;CAG/D,IAAI,CAAC,SAAS,WAAW;AAIzB,KADe,cAAc,eAAe,eAAe,KAAK,EAClD;AAEZ,MAAI,SAAS,WAAW,eAAe,QACrC,iBAAgB;AAGlB,SAAO;;CAGT,IAAI,QAAQ,uBAAuB,MAAM;AAEzC,KAAI,OAAO,YAAY,WACrB,WAAU,QAAQ,MAAM;CAG1B,IAAI,UAAU,OAAO,MAAM;CAC3B,IAAI,YAAY,OAAO,MAAM;CAC7B,IAAI,kBAAmB,UAAU,UAAU;CAC3C,IAAI,iBAAkB,UAAU,UAAU;AAE1C,SAAQ,UAAU,MAAM;AAExB,iBAAgB;AACd,eAAa;AACX,QACG,QAAQ,WAAW,UAAU,YAC9B,SAAS,aACT,SAAS,OAET,SAAQ,KACN,wLACD;;IAGJ,EAAE,CAAC;CAEN,SAAS,QAAQ,QAAQ;AACvB,MAAI,eAAe;AACjB,gBAAa,UAAU,OAAO;AAC9B,SAAM,OAAO;;;AAIjB,KAAI,SAAS,UACX,QACE,oBAAC;EACC,GAAI;EACS;EACN;EACC;EACG;EACF;EACA;EACkB;EAChB;EACmB;EACrB;GACT;CAIN,IAAI,sBAAsB;AACxB,UAAQ,M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,kBAAkB,OAAY;CACrC,MAAM,MAAM,gBAA6B,MAAM,IAAI;CACnD,MAAM,aAAa,OAAO,MAAM;CAEhC,IAAI,EACF,MACA,OACA,SACA,eACA,cAAc,EAAE,EAChB,eAAe,EAAE,EACjB,SACA,YACE;CAEJ,IAAI,UAAU;EACZ;EACA;EACA;EACA,QAAQ,MAAM;EACd,GAAG;EACJ;AAGD,iBAAgB;AACd,MAAI,CAAC,MAAM,UAAU,WAAW,SAAS;AACvC,cAAW,UAAU;AACrB,OAAI,SAAS,OAAO;aACX,MAAM,OACf,YAAW,UAAU;IAEtB,CAAC,MAAM,OAAO,CAAC;AAElB,QACE,qBAAC,uBACC,oBAAC;EACM;EACL,GAAI;EACJ,WACE,MAAM,UACN,SAAS,WACT,SAAS,gBACT,SAAS;EAEX,SAAS,MAAM;YAEd;GACc,EACjB,oBAAC,cAAc;EAAS,OAAO;YAAU;GAAiC,IACjE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.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 { DialogContainer } from "./DialogContainer.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MIT | @cube-dev/ui-kit v0.
|
|
1
|
+
/** @license MIT | @cube-dev/ui-kit v0.131.0 | Cube Dev Team */
|
|
2
2
|
import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
|
|
3
3
|
import { _Overlay } from "./Overlay.js";
|
|
4
4
|
import { _Underlay } from "./Underlay.js";
|
|
@@ -36,9 +36,9 @@ const ModalWrapperElement = tasty({
|
|
|
36
36
|
const ModalElement = tasty({ styles: {
|
|
37
37
|
display: {
|
|
38
38
|
"": "none",
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
"enter | entered": "grid",
|
|
40
|
+
exit: "grid",
|
|
41
|
+
unmounted: "none"
|
|
42
42
|
},
|
|
43
43
|
zIndex: 10,
|
|
44
44
|
height: {
|
|
@@ -92,9 +92,9 @@ let ModalWrapper = forwardRef(function ModalWrapper(props, ref) {
|
|
|
92
92
|
styles,
|
|
93
93
|
mods: {
|
|
94
94
|
open: isOpen,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
enter: transitionState === "enter",
|
|
96
|
+
exit: transitionState === "exit",
|
|
97
|
+
unmounted: transitionState === "unmounted",
|
|
98
98
|
entered: transitionState === "entered"
|
|
99
99
|
},
|
|
100
100
|
"data-type": type,
|