@cube-dev/ui-kit 0.120.1 → 0.121.1
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 +20 -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.d.ts +1 -0
- package/dist/components/actions/Button/Button.js +34 -14
- 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.d.ts +47 -0
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +105 -0
- package/dist/components/actions/ButtonSplit/ButtonSplit.js.map +1 -0
- package/dist/components/actions/ButtonSplit/context.d.ts +18 -0
- package/dist/components/actions/ButtonSplit/context.js +12 -0
- package/dist/components/actions/ButtonSplit/context.js.map +1 -0
- package/dist/components/actions/ButtonSplit/index.d.ts +3 -0
- 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.d.ts +2 -2
- 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.d.ts +8 -3
- package/dist/components/actions/index.js +10 -5
- package/dist/components/actions/index.js.map +1 -1
- package/dist/components/actions/use-action.d.ts +1 -0
- package/dist/components/actions/use-action.js +21 -18
- package/dist/components/actions/use-action.js.map +1 -1
- package/dist/components/actions/use-anchored-menu.js +1 -1
- package/dist/components/actions/use-context-menu.js +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
- package/dist/components/content/Alert/Alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js +1 -1
- package/dist/components/content/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.js +2 -1
- package/dist/components/content/Badge/Badge.js.map +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 +5 -2
- package/dist/components/content/Disclosure/Disclosure.js.map +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 +3 -2
- package/dist/components/content/ItemBadge/ItemBadge.js.map +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +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 +2 -1
- package/dist/components/content/Tag/Tag.js.map +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/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ComboBox/ComboBox.js +1 -1
- package/dist/components/fields/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 -2
- 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 -2
- package/dist/components/fields/RadioGroup/Radio.js +3 -1
- package/dist/components/fields/RadioGroup/Radio.js.map +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 +8 -2
- package/dist/components/fields/Select/Select.js +1 -1
- 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 +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 +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 +2 -1
- package/dist/components/navigation/Tabs/TabPicker.js.map +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 +3 -1
- package/dist/components/navigation/Tabs/styled.js.map +1 -1
- package/dist/components/navigation/Tabs/types.d.ts +2 -2
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/types.js.map +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 +2 -2
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/dist/components/overlays/Dialog/context.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +1 -1
- package/dist/components/overlays/Modal/OpenTransition.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Tray.js +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Notifications/Notification.js +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
- package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
- package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
- package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
- package/dist/components/overlays/Notifications/index.js +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +1 -1
- package/dist/components/overlays/Toast/index.js +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js +1 -1
- package/dist/components/overlays/Toast/useToast.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/portal/PortalProvider.js +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/shared/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 +6 -6
- package/dist/data/item-themes.js.map +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 +6 -4
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.js +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.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/tree.js +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/version.js +2 -2
- package/docs/BaseProperties.md +78 -0
- package/docs/ComplexLayout.md +459 -0
- package/docs/CreateComponent.md +410 -0
- package/docs/FieldProperties.md +117 -0
- package/docs/Introduction.md +122 -0
- package/docs/RenderCache.md +177 -0
- package/docs/Result.md +42 -0
- package/docs/SimpleLayout.md +26 -0
- package/docs/Typography.md +38 -0
- package/docs/components/Block.md +33 -0
- package/docs/components/CollectionItem.md +293 -0
- package/docs/components/GridProvider.md +38 -0
- package/docs/components/Root.md +50 -0
- package/docs/components/actions/Action.md +47 -0
- package/docs/components/actions/Banner.md +195 -0
- package/docs/components/actions/Button.md +209 -0
- package/docs/components/actions/ButtonGroup.md +46 -0
- package/docs/components/actions/ButtonSplit.md +199 -0
- package/docs/components/actions/CommandMenu.md +422 -0
- package/docs/components/actions/ItemAction.md +60 -0
- package/docs/components/actions/ItemButton.md +316 -0
- package/docs/components/actions/Link.md +325 -0
- package/docs/components/actions/Menu.md +485 -0
- package/docs/components/actions/MenuTrigger.md +47 -0
- package/docs/components/actions/SubMenuTrigger.md +38 -0
- package/docs/components/actions/use-anchored-menu.md +209 -0
- package/docs/components/actions/use-context-menu.md +218 -0
- package/docs/components/content/ActiveZone.md +37 -0
- package/docs/components/content/Alert.md +40 -0
- package/docs/components/content/Avatar.md +37 -0
- package/docs/components/content/Badge.md +194 -0
- package/docs/components/content/Card.md +40 -0
- package/docs/components/content/Content.md +44 -0
- package/docs/components/content/CopyPasteBlock.md +36 -0
- package/docs/components/content/CopySnippet.md +43 -0
- package/docs/components/content/Disclosure.md +181 -0
- package/docs/components/content/Divider.md +39 -0
- package/docs/components/content/Footer.md +35 -0
- package/docs/components/content/Header.md +35 -0
- package/docs/components/content/HotKeys.md +352 -0
- package/docs/components/content/Item.md +499 -0
- package/docs/components/content/ItemBadge.md +31 -0
- package/docs/components/content/ItemCard.md +131 -0
- package/docs/components/content/Layout.md +843 -0
- package/docs/components/content/Paragraph.md +32 -0
- package/docs/components/content/Placeholder.md +37 -0
- package/docs/components/content/PrismCode.md +36 -0
- package/docs/components/content/PrismDiffCode.md +29 -0
- package/docs/components/content/Result.md +46 -0
- package/docs/components/content/Skeleton.md +35 -0
- package/docs/components/content/Tag.md +165 -0
- package/docs/components/content/Text.md +54 -0
- package/docs/components/content/TextItem.md +217 -0
- package/docs/components/content/Title.md +45 -0
- package/docs/components/fields/Checkbox.md +176 -0
- package/docs/components/fields/ComboBox.md +651 -0
- package/docs/components/fields/DatePicker.md +227 -0
- package/docs/components/fields/FileInput.md +194 -0
- package/docs/components/fields/FilterListBox.md +726 -0
- package/docs/components/fields/FilterPicker.md +776 -0
- package/docs/components/fields/HueSlider.md +175 -0
- package/docs/components/fields/ListBox.md +714 -0
- package/docs/components/fields/NumberInput.md +180 -0
- package/docs/components/fields/PasswordInput.md +214 -0
- package/docs/components/fields/Picker.md +906 -0
- package/docs/components/fields/RadioGroup.md +310 -0
- package/docs/components/fields/SearchInput.md +224 -0
- package/docs/components/fields/Select.md +576 -0
- package/docs/components/fields/Slider.md +53 -0
- package/docs/components/fields/Switch.md +169 -0
- package/docs/components/fields/TextArea.md +61 -0
- package/docs/components/fields/TextInput.md +205 -0
- package/docs/components/fields/TextInputMapper.md +34 -0
- package/docs/components/form/Field.md +333 -0
- package/docs/components/form/Form.md +644 -0
- package/docs/components/form/FormInstance.md +307 -0
- package/docs/components/helpers/DisplayTransition.md +268 -0
- package/docs/components/helpers/IconSwitch.md +160 -0
- package/docs/components/layout/Flex.md +51 -0
- package/docs/components/layout/Flow.md +32 -0
- package/docs/components/layout/Grid.md +46 -0
- package/docs/components/layout/Panel.md +65 -0
- package/docs/components/layout/Prefix.md +37 -0
- package/docs/components/layout/ResizablePanel.md +69 -0
- package/docs/components/layout/Space.md +44 -0
- package/docs/components/layout/Suffix.md +39 -0
- package/docs/components/navigation/Tabs.md +726 -0
- package/docs/components/organisms/FileTabs.md +39 -0
- package/docs/components/organisms/StatsCard.md +40 -0
- package/docs/components/other/CloudLogo.md +33 -0
- package/docs/components/overlays/AlertDialog.md +51 -0
- package/docs/components/overlays/Dialog.md +200 -0
- package/docs/components/overlays/DialogContainer.md +201 -0
- package/docs/components/overlays/DialogForm.md +295 -0
- package/docs/components/overlays/DialogTrigger.md +191 -0
- package/docs/components/overlays/Notifications.md +402 -0
- package/docs/components/overlays/Toast.md +289 -0
- package/docs/components/overlays/Tooltip.md +400 -0
- package/docs/components/overlays/TooltipProvider.md +42 -0
- package/docs/components/overlays/TooltipTrigger.md +42 -0
- package/docs/components/overlays/UseDialogContainer.md +597 -0
- package/docs/components/portal/Portal.md +29 -0
- package/docs/components/status/LoadingAnimation.md +27 -0
- package/docs/components/status/Spin.md +35 -0
- package/docs/tasty/configuration.md +211 -0
- package/docs/tasty/debug.md +505 -0
- package/docs/tasty/injector.md +528 -0
- package/docs/tasty/styles.md +567 -0
- package/docs/tasty/tasty-static.md +376 -0
- package/docs/tasty/usage.md +643 -0
- package/package.json +5 -9
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
# useDialogContainer
|
|
2
|
+
|
|
3
|
+
A generic React hook for managing dialog components programmatically. This hook provides a declarative way to control dialog state, including opening, updating, and closing dialogs, while handling all the necessary state management internally.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- When you need programmatic control over dialog display without trigger elements
|
|
8
|
+
- For complex dialog flows that require external state management
|
|
9
|
+
- When you want to create reusable dialog patterns across your application
|
|
10
|
+
- For displaying dynamic dialogs based on application state or user actions
|
|
11
|
+
- When you need to update dialog content while it's open
|
|
12
|
+
- For dialogs that need to persist across component re-renders or navigation
|
|
13
|
+
|
|
14
|
+
## Hook Signature
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
function useDialogContainer<P, E = ComponentProps<typeof DialogContainer>>(
|
|
18
|
+
Component: ComponentType<P>,
|
|
19
|
+
defaultContainerProps?: ComponentProps<typeof DialogContainer>
|
|
20
|
+
): {
|
|
21
|
+
open: (props: P, containerProps?: E) => void;
|
|
22
|
+
update: (props: P, containerProps?: E) => void;
|
|
23
|
+
close: () => void;
|
|
24
|
+
rendered: ReactElement | null;
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Parameters
|
|
29
|
+
|
|
30
|
+
- **`Component`** `ComponentType<P>` — **Required.** A React component that represents the dialog content. Must accept props of type P.
|
|
31
|
+
- **`defaultContainerProps`** `ComponentProps<typeof DialogContainer>` — **Optional.** Default props to pass to the DialogContainer wrapper.
|
|
32
|
+
|
|
33
|
+
## Return Value
|
|
34
|
+
|
|
35
|
+
- **`open`** `(props: P, containerProps?: E) => void` — Function to open the dialog with provided component props and optional container props.
|
|
36
|
+
- **`update`** `(props: P, containerProps?: E) => void` — Function to update dialog content while it's open.
|
|
37
|
+
- **`close`** `() => void` — Function to close the dialog.
|
|
38
|
+
- **`rendered`** `ReactElement \| null` — **Required.** JSX element that must be included in your component tree for the dialog to work.
|
|
39
|
+
|
|
40
|
+
## Generic Type Parameters
|
|
41
|
+
|
|
42
|
+
- **`P`** — The props type for your dialog component
|
|
43
|
+
- **`E`** — The container props type (defaults to `ComponentProps<typeof DialogContainer>`)
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
### Basic Usage
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { useDialogContainer, Dialog, Header, Title, Content, Paragraph, Button } from '@cube-dev/ui-kit';
|
|
51
|
+
|
|
52
|
+
function MyDialog({ message, onConfirm }) {
|
|
53
|
+
return (
|
|
54
|
+
<Dialog>
|
|
55
|
+
<Header>
|
|
56
|
+
<Title>Confirmation</Title>
|
|
57
|
+
</Header>
|
|
58
|
+
<Content>
|
|
59
|
+
<Paragraph>{message}</Paragraph>
|
|
60
|
+
<Button onPress={onConfirm}>Confirm</Button>
|
|
61
|
+
</Content>
|
|
62
|
+
</Dialog>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function App() {
|
|
67
|
+
const dialog = useDialogContainer(MyDialog);
|
|
68
|
+
|
|
69
|
+
const handleClick = () => {
|
|
70
|
+
dialog.open({
|
|
71
|
+
message: 'Are you sure you want to continue?',
|
|
72
|
+
onConfirm: () => {
|
|
73
|
+
console.log('Confirmed!');
|
|
74
|
+
dialog.close();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div>
|
|
81
|
+
<Button onPress={handleClick}>Open Dialog</Button>
|
|
82
|
+
{dialog.rendered}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### With Default Container Props
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import { useDialogContainer, Dialog } from '@cube-dev/ui-kit';
|
|
92
|
+
|
|
93
|
+
function CustomDialog({ title, children }) {
|
|
94
|
+
return (
|
|
95
|
+
<Dialog>
|
|
96
|
+
<Header>
|
|
97
|
+
<Title>{title}</Title>
|
|
98
|
+
</Header>
|
|
99
|
+
<Content>
|
|
100
|
+
{children}
|
|
101
|
+
</Content>
|
|
102
|
+
</Dialog>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function App() {
|
|
107
|
+
const dialog = useDialogContainer(CustomDialog, {
|
|
108
|
+
type: 'fullscreen',
|
|
109
|
+
isDismissable: true
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const openDialog = () => {
|
|
113
|
+
dialog.open({
|
|
114
|
+
title: 'Settings',
|
|
115
|
+
children: <Paragraph>Configure your preferences here.</Paragraph>
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<div>
|
|
121
|
+
<Button onPress={openDialog}>Open Settings</Button>
|
|
122
|
+
{dialog.rendered}
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Dynamic Container Props
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { useDialogContainer, Dialog } from '@cube-dev/ui-kit';
|
|
132
|
+
|
|
133
|
+
function InfoDialog({ content, isUrgent }) {
|
|
134
|
+
return (
|
|
135
|
+
<Dialog>
|
|
136
|
+
<Header>
|
|
137
|
+
<Title>{isUrgent ? 'Urgent Notice' : 'Information'}</Title>
|
|
138
|
+
</Header>
|
|
139
|
+
<Content>
|
|
140
|
+
<Paragraph>{content}</Paragraph>
|
|
141
|
+
</Content>
|
|
142
|
+
</Dialog>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function App() {
|
|
147
|
+
const dialog = useDialogContainer(InfoDialog);
|
|
148
|
+
|
|
149
|
+
const showInfo = (content, isUrgent = false) => {
|
|
150
|
+
dialog.open(
|
|
151
|
+
{ content, isUrgent },
|
|
152
|
+
{
|
|
153
|
+
type: isUrgent ? 'modal' : 'popover',
|
|
154
|
+
isDismissable: !isUrgent
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<div>
|
|
161
|
+
<Button onPress={() => showInfo('This is normal info')}>
|
|
162
|
+
Show Info
|
|
163
|
+
</Button>
|
|
164
|
+
<Button onPress={() => showInfo('This is urgent!', true)}>
|
|
165
|
+
Show Urgent
|
|
166
|
+
</Button>
|
|
167
|
+
{dialog.rendered}
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Form Dialog with Validation
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { useDialogContainer, DialogForm } from '@cube-dev/ui-kit';
|
|
177
|
+
|
|
178
|
+
function UserFormDialog({ onSubmit, initialData, onCancel }) {
|
|
179
|
+
return (
|
|
180
|
+
<DialogForm
|
|
181
|
+
title="User Information"
|
|
182
|
+
defaultValues={initialData}
|
|
183
|
+
onSubmit={onSubmit}
|
|
184
|
+
onDismiss={onCancel}
|
|
185
|
+
submitProps={{
|
|
186
|
+
label: 'Save User'
|
|
187
|
+
}}
|
|
188
|
+
cancelProps={{
|
|
189
|
+
label: 'Cancel'
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
<Form.Item
|
|
193
|
+
name="name"
|
|
194
|
+
rules={[{ required: true, message: 'Name is required' }]}
|
|
195
|
+
>
|
|
196
|
+
<TextInput label="Name" />
|
|
197
|
+
</Form.Item>
|
|
198
|
+
<Form.Item
|
|
199
|
+
name="email"
|
|
200
|
+
rules={[
|
|
201
|
+
{ required: true, message: 'Email is required' },
|
|
202
|
+
{ type: 'email', message: 'Please enter a valid email' }
|
|
203
|
+
]}
|
|
204
|
+
>
|
|
205
|
+
<TextInput label="Email" />
|
|
206
|
+
</Form.Item>
|
|
207
|
+
</DialogForm>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function App() {
|
|
212
|
+
const userDialog = useDialogContainer(UserFormDialog, {
|
|
213
|
+
isDismissable: true
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const editUser = (userData) => {
|
|
217
|
+
userDialog.open({
|
|
218
|
+
initialData: userData,
|
|
219
|
+
onSubmit: async (values) => {
|
|
220
|
+
try {
|
|
221
|
+
await saveUser(values);
|
|
222
|
+
userDialog.close();
|
|
223
|
+
// Show success message
|
|
224
|
+
} catch (error) {
|
|
225
|
+
console.error('Failed to save user:', error);
|
|
226
|
+
// Handle error - form will stay open
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
onCancel: () => userDialog.close()
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const addUser = () => {
|
|
234
|
+
userDialog.open({
|
|
235
|
+
initialData: {},
|
|
236
|
+
onSubmit: async (values) => {
|
|
237
|
+
try {
|
|
238
|
+
await createUser(values);
|
|
239
|
+
userDialog.close();
|
|
240
|
+
} catch (error) {
|
|
241
|
+
console.error('Failed to create user:', error);
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
onCancel: () => userDialog.close()
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
return (
|
|
249
|
+
<div>
|
|
250
|
+
<Button onPress={() => editUser({ name: 'John', email: 'john@example.com' })}>
|
|
251
|
+
Edit User
|
|
252
|
+
</Button>
|
|
253
|
+
<Button onPress={addUser}>
|
|
254
|
+
Add User
|
|
255
|
+
</Button>
|
|
256
|
+
{userDialog.rendered}
|
|
257
|
+
</div>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Multiple Dialog Types
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
import { useDialogContainer, Dialog, AlertDialog } from '@cube-dev/ui-kit';
|
|
266
|
+
|
|
267
|
+
function ConfirmDialog({ message, onConfirm, onCancel, danger }) {
|
|
268
|
+
return (
|
|
269
|
+
<AlertDialog
|
|
270
|
+
title="Confirm Action"
|
|
271
|
+
content={message}
|
|
272
|
+
danger={danger}
|
|
273
|
+
actions={{
|
|
274
|
+
confirm: {
|
|
275
|
+
label: 'Confirm',
|
|
276
|
+
onPress: onConfirm
|
|
277
|
+
},
|
|
278
|
+
cancel: {
|
|
279
|
+
label: 'Cancel',
|
|
280
|
+
onPress: onCancel
|
|
281
|
+
}
|
|
282
|
+
}}
|
|
283
|
+
/>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function InfoDialog({ title, content }) {
|
|
288
|
+
return (
|
|
289
|
+
<AlertDialog
|
|
290
|
+
title={title}
|
|
291
|
+
content={content}
|
|
292
|
+
actions={{
|
|
293
|
+
confirm: {
|
|
294
|
+
label: 'OK'
|
|
295
|
+
},
|
|
296
|
+
cancel: false
|
|
297
|
+
}}
|
|
298
|
+
/>
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function App() {
|
|
303
|
+
const confirmDialog = useDialogContainer(ConfirmDialog);
|
|
304
|
+
const infoDialog = useDialogContainer(InfoDialog, { isDismissable: true });
|
|
305
|
+
|
|
306
|
+
const deleteItem = () => {
|
|
307
|
+
confirmDialog.open({
|
|
308
|
+
message: 'This action cannot be undone. Continue?',
|
|
309
|
+
danger: true,
|
|
310
|
+
onConfirm: () => {
|
|
311
|
+
// Perform deletion
|
|
312
|
+
confirmDialog.close();
|
|
313
|
+
infoDialog.open({
|
|
314
|
+
title: 'Success',
|
|
315
|
+
content: 'Item has been deleted successfully.'
|
|
316
|
+
});
|
|
317
|
+
},
|
|
318
|
+
onCancel: () => confirmDialog.close()
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<div>
|
|
324
|
+
<Button onPress={deleteItem}>Delete Item</Button>
|
|
325
|
+
{confirmDialog.rendered}
|
|
326
|
+
{infoDialog.rendered}
|
|
327
|
+
</div>
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Error Boundary Integration
|
|
333
|
+
|
|
334
|
+
```tsx
|
|
335
|
+
import { useDialogContainer, Dialog } from '@cube-dev/ui-kit';
|
|
336
|
+
|
|
337
|
+
function ErrorDialog({ error, onRetry, onDismiss }) {
|
|
338
|
+
return (
|
|
339
|
+
<Dialog>
|
|
340
|
+
<Header>
|
|
341
|
+
<Title>Error Occurred</Title>
|
|
342
|
+
</Header>
|
|
343
|
+
<Content>
|
|
344
|
+
<Paragraph>An error occurred: {error.message}</Paragraph>
|
|
345
|
+
</Content>
|
|
346
|
+
<Footer>
|
|
347
|
+
<Button type="primary" onPress={onRetry}>Retry</Button>
|
|
348
|
+
<Button onPress={onDismiss}>Dismiss</Button>
|
|
349
|
+
</Footer>
|
|
350
|
+
</Dialog>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function App() {
|
|
355
|
+
const errorDialog = useDialogContainer(ErrorDialog);
|
|
356
|
+
|
|
357
|
+
const handleError = (error, retryAction) => {
|
|
358
|
+
errorDialog.open({
|
|
359
|
+
error,
|
|
360
|
+
onRetry: () => {
|
|
361
|
+
errorDialog.close();
|
|
362
|
+
retryAction();
|
|
363
|
+
},
|
|
364
|
+
onDismiss: () => errorDialog.close()
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const riskyOperation = async () => {
|
|
369
|
+
try {
|
|
370
|
+
await someApiCall();
|
|
371
|
+
} catch (error) {
|
|
372
|
+
handleError(error, riskyOperation);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
return (
|
|
377
|
+
<div>
|
|
378
|
+
<Button onPress={riskyOperation}>Perform Operation</Button>
|
|
379
|
+
{errorDialog.rendered}
|
|
380
|
+
</div>
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Important Notes
|
|
386
|
+
|
|
387
|
+
### Setup Requirement
|
|
388
|
+
|
|
389
|
+
The `rendered` property **must** be included in your component tree, or the hook will throw an error when `open`, `update`, or `close` functions are called.
|
|
390
|
+
|
|
391
|
+
```tsx
|
|
392
|
+
// ✅ Correct usage
|
|
393
|
+
function App() {
|
|
394
|
+
const dialog = useDialogContainer(MyDialog);
|
|
395
|
+
|
|
396
|
+
return (
|
|
397
|
+
<div>
|
|
398
|
+
<Button onPress={() => dialog.open({ message: 'Hello' })}>Open</Button>
|
|
399
|
+
{dialog.rendered} {/* Required! */}
|
|
400
|
+
</div>
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// ❌ Incorrect usage - will throw error
|
|
405
|
+
function App() {
|
|
406
|
+
const dialog = useDialogContainer(MyDialog);
|
|
407
|
+
|
|
408
|
+
return (
|
|
409
|
+
<div>
|
|
410
|
+
<Button onPress={() => dialog.open({ message: 'Hello' })}>Open</Button>
|
|
411
|
+
{/* Missing dialog.rendered - will cause error */}
|
|
412
|
+
</div>
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### State Management
|
|
418
|
+
|
|
419
|
+
- The hook manages all dialog state internally
|
|
420
|
+
- Dialog state persists until the component using the hook unmounts
|
|
421
|
+
- Multiple calls to `open` will replace the current dialog content
|
|
422
|
+
- Calling `update` while dialog is closed has no effect but won't cause errors
|
|
423
|
+
|
|
424
|
+
### Container Props Priority
|
|
425
|
+
|
|
426
|
+
When both `defaultContainerProps` and runtime `containerProps` are provided:
|
|
427
|
+
- Runtime `containerProps` override `defaultContainerProps`
|
|
428
|
+
- Deep merging is performed for nested objects
|
|
429
|
+
- Arrays are replaced entirely (no merging)
|
|
430
|
+
|
|
431
|
+
## Best Practices
|
|
432
|
+
|
|
433
|
+
1. **Always include `rendered`**: Place `{dialog.rendered}` in your component tree
|
|
434
|
+
```tsx
|
|
435
|
+
return (
|
|
436
|
+
<div>
|
|
437
|
+
{/* Your UI */}
|
|
438
|
+
{dialog.rendered}
|
|
439
|
+
</div>
|
|
440
|
+
);
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
2. **Use TypeScript for type safety**: The hook automatically infers prop types from your dialog component
|
|
444
|
+
```tsx
|
|
445
|
+
interface MyDialogProps {
|
|
446
|
+
title: string;
|
|
447
|
+
onConfirm: () => void;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function MyDialog(props: MyDialogProps) {
|
|
451
|
+
return <Dialog>{/* ... */}</Dialog>;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const dialog = useDialogContainer(MyDialog); // Props type is automatically inferred
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
3. **Handle cleanup in dialog components**: Ensure your dialog components handle their own cleanup
|
|
458
|
+
```tsx
|
|
459
|
+
function MyDialog({ onClose, onSubmit }) {
|
|
460
|
+
const handleSubmit = async (data) => {
|
|
461
|
+
await onSubmit(data);
|
|
462
|
+
onClose(); // Close dialog after successful submission
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
return <Dialog>{/* ... */}</Dialog>;
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
4. **Use default container props for common patterns**: Set common dialog behaviors once
|
|
470
|
+
```tsx
|
|
471
|
+
const dialog = useDialogContainer(MyDialog, {
|
|
472
|
+
isDismissable: true,
|
|
473
|
+
type: 'modal'
|
|
474
|
+
});
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
5. **Separate concerns**: Keep dialog content components focused and reusable
|
|
478
|
+
```tsx
|
|
479
|
+
// Good: Focused dialog component
|
|
480
|
+
function ConfirmDialog({ message, onConfirm }) {
|
|
481
|
+
return <Dialog>{/* Simple confirmation UI */}</Dialog>;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// Avoid: Dialog component with complex business logic
|
|
485
|
+
function OverlyComplexDialog({ userId, permissions, settings }) {
|
|
486
|
+
// Too much business logic here
|
|
487
|
+
}
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
## Error Handling
|
|
491
|
+
|
|
492
|
+
The hook will throw an error if you attempt to call `open`, `update`, or `close` before the `rendered` element has been included in the component tree:
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
Error: useDialogContainer: DialogContainer must be rendered. Use `rendered` property to include it in your component tree.
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
To avoid this error, always ensure `dialog.rendered` is included in your JSX before calling dialog methods.
|
|
499
|
+
|
|
500
|
+
## Performance Considerations
|
|
501
|
+
|
|
502
|
+
- The dialog content is only rendered when props are provided via `open` or `update`
|
|
503
|
+
- Dialog state is preserved during re-renders but reset when the component unmounts
|
|
504
|
+
- Use `React.memo` on dialog components if they receive complex props that change frequently
|
|
505
|
+
- Consider using `useMemo` for expensive dialog prop calculations
|
|
506
|
+
|
|
507
|
+
## Related Components
|
|
508
|
+
|
|
509
|
+
- [DialogContainer](./DialogContainer.md) - The underlying container component
|
|
510
|
+
- [Dialog](./Dialog.md) - The dialog content component
|
|
511
|
+
- [DialogTrigger](./DialogTrigger.md) - Alternative for trigger-based dialogs
|
|
512
|
+
|
|
513
|
+
## Migration from DialogContainer
|
|
514
|
+
|
|
515
|
+
If you're currently using `DialogContainer` with manual state management:
|
|
516
|
+
|
|
517
|
+
```tsx
|
|
518
|
+
// Before (manual state management)
|
|
519
|
+
function App() {
|
|
520
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
521
|
+
const [dialogProps, setDialogProps] = useState(null);
|
|
522
|
+
|
|
523
|
+
const openDialog = (props) => {
|
|
524
|
+
setDialogProps(props);
|
|
525
|
+
setIsOpen(true);
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
return (
|
|
529
|
+
<div>
|
|
530
|
+
<Button onPress={() => openDialog({ message: 'Hello' })}>Open</Button>
|
|
531
|
+
<DialogContainer isOpen={isOpen} onDismiss={() => setIsOpen(false)}>
|
|
532
|
+
{dialogProps && <MyDialog {...dialogProps} />}
|
|
533
|
+
</DialogContainer>
|
|
534
|
+
</div>
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// After (using useDialogContainer)
|
|
539
|
+
function App() {
|
|
540
|
+
const dialog = useDialogContainer(MyDialog);
|
|
541
|
+
|
|
542
|
+
return (
|
|
543
|
+
<div>
|
|
544
|
+
<Button onPress={() => dialog.open({ message: 'Hello' })}>Open</Button>
|
|
545
|
+
{dialog.rendered}
|
|
546
|
+
</div>
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
## TypeScript Examples
|
|
552
|
+
|
|
553
|
+
### Strict Typing
|
|
554
|
+
|
|
555
|
+
```tsx
|
|
556
|
+
interface UserData {
|
|
557
|
+
id: string;
|
|
558
|
+
name: string;
|
|
559
|
+
email: string;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
interface UserDialogProps {
|
|
563
|
+
user: UserData;
|
|
564
|
+
onSave: (user: UserData) => Promise<void>;
|
|
565
|
+
onCancel: () => void;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function UserDialog(props: UserDialogProps) {
|
|
569
|
+
return <Dialog>{/* ... */}</Dialog>;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const userDialog = useDialogContainer(UserDialog); // Props type automatically inferred
|
|
573
|
+
|
|
574
|
+
// TypeScript will enforce correct prop types
|
|
575
|
+
userDialog.open({
|
|
576
|
+
user: { id: '1', name: 'John', email: 'john@example.com' },
|
|
577
|
+
onSave: async (user) => { /* ... */ },
|
|
578
|
+
onCancel: () => userDialog.close()
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Custom Container Props Type
|
|
583
|
+
|
|
584
|
+
```tsx
|
|
585
|
+
interface CustomContainerProps extends ComponentProps<typeof DialogContainer> {
|
|
586
|
+
customBehavior?: boolean;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function MyDialog(props: MyDialogProps) {
|
|
590
|
+
return <Dialog>{/* ... */}</Dialog>;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
const dialog = useDialogContainer<MyDialogProps, CustomContainerProps>(
|
|
594
|
+
MyDialog,
|
|
595
|
+
{ customBehavior: true }
|
|
596
|
+
);
|
|
597
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Portal
|
|
2
|
+
|
|
3
|
+
Renders children outside the current DOM hierarchy using React portals. By default, portals mount under the `Root` component's portal container.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Modals and overlays
|
|
8
|
+
- Tooltips and popovers
|
|
9
|
+
- Content that should escape parent overflow/stacking context
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- **`root`** `RefObject<HTMLElement>` — Custom mount target ref (default: Root's portal container)
|
|
14
|
+
- **`isDisabled`** `boolean` (default: `false`) — Disable portaling and render inline
|
|
15
|
+
- **`onMount`** `() => void` — Callback when portal mounts
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
<Portal>
|
|
21
|
+
<div>Rendered outside parent DOM</div>
|
|
22
|
+
</Portal>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
<Portal isDisabled={typeof window === 'undefined'}>
|
|
27
|
+
<Modal>Content</Modal>
|
|
28
|
+
</Portal>
|
|
29
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# LoadingAnimation
|
|
2
|
+
|
|
3
|
+
An animated loading indicator with a rotating cube graphic. Used for full-page or section loading states.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Full-page loading
|
|
8
|
+
- Section loading overlays
|
|
9
|
+
- Branded loading experience
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- **`size`** `'small' | 'medium' | 'large' | number` (default: `'medium'`) — Animation size (small=32px, medium=64px, large=96px, or custom pixel value)
|
|
14
|
+
|
|
15
|
+
### Base Properties
|
|
16
|
+
|
|
17
|
+
Supports [Base properties](../../BaseProperties.md).
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
<LoadingAnimation />
|
|
23
|
+
|
|
24
|
+
<LoadingAnimation size="small" />
|
|
25
|
+
|
|
26
|
+
<LoadingAnimation size="large" />
|
|
27
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Spin
|
|
2
|
+
|
|
3
|
+
A loading spinner wrapper. Shows a spinner overlay when `spinning` is true, otherwise renders children normally.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Loading states for buttons or sections
|
|
8
|
+
- Blocking content while data loads
|
|
9
|
+
- Inline loading indicators
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
- **`spinning`** `boolean` (default: `true`) — Whether to show the spinner
|
|
14
|
+
- **`size`** `'small' | 'default' | 'large'` (default: `'default'`) — Spinner size (small=24px, default=32px, large=48px)
|
|
15
|
+
- **`styles`** `Styles` — Custom styles for the spinner container
|
|
16
|
+
|
|
17
|
+
### Base Properties
|
|
18
|
+
|
|
19
|
+
Supports [Base properties](../../BaseProperties.md).
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<Spin>
|
|
25
|
+
<Button>Loading...</Button>
|
|
26
|
+
</Spin>
|
|
27
|
+
|
|
28
|
+
<Spin spinning={isLoading} size="large">
|
|
29
|
+
<Card>Content</Card>
|
|
30
|
+
</Spin>
|
|
31
|
+
|
|
32
|
+
<Spin spinning={false}>
|
|
33
|
+
<Text>Content is loaded</Text>
|
|
34
|
+
</Spin>
|
|
35
|
+
```
|