@ctrl-ui/react 0.8.6 → 0.8.8
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/action-bar.d.ts +15 -7
- package/dist/action-bar.js +39 -19
- package/dist/activity.js +7 -15
- package/dist/audio-recorder.d.ts +14 -4
- package/dist/audio-recorder.js +82 -29
- package/dist/audio-visualizer.js +1 -1
- package/dist/blocks/coding-agent.js +54 -57
- package/dist/blocks/design-canvas-data.d.ts +32 -0
- package/dist/blocks/design-canvas-data.js +100 -0
- package/dist/blocks/design-canvas-inspector.d.ts +8 -0
- package/dist/blocks/design-canvas-inspector.js +238 -0
- package/dist/blocks/design-canvas.d.ts +21 -0
- package/dist/blocks/design-canvas.js +452 -0
- package/dist/blocks/discussion.d.ts +28 -0
- package/dist/blocks/discussion.js +67 -0
- package/dist/blocks/file-explorer-data.d.ts +1 -0
- package/dist/blocks/file-explorer-data.js +4 -1
- package/dist/blocks/file-explorer.d.ts +9 -1
- package/dist/blocks/file-explorer.js +461 -192
- package/dist/blocks/settings.d.ts +2 -1
- package/dist/blocks/settings.js +101 -79
- package/dist/blocks/team-chat.d.ts +12 -0
- package/dist/blocks/team-chat.js +26 -0
- package/dist/blocks/theme-toggle.js +23 -31
- package/dist/chat-composer-attachment.d.ts +12 -3
- package/dist/chat-composer-attachment.js +61 -19
- package/dist/chat-composer-editor/extensions/mention.d.ts +5 -1
- package/dist/chat-composer-editor/extensions/mention.js +58 -27
- package/dist/chat-composer-editor/ghost.js +2 -4
- package/dist/chat-composer-editor/types.d.ts +5 -0
- package/dist/chat-composer-editor.d.ts +1 -1
- package/dist/chat-composer-editor.js +71 -28
- package/dist/chat-composer.d.ts +13 -32
- package/dist/chat-composer.js +54 -13
- package/dist/chat-layout.d.ts +19 -0
- package/dist/chat-layout.js +96 -32
- package/dist/chat-message/social.d.ts +26 -0
- package/dist/chat-message/social.js +122 -0
- package/dist/chat-message.d.ts +28 -29
- package/dist/chat-message.js +106 -25
- package/dist/context.d.ts +2 -2
- package/dist/context.js +38 -23
- package/dist/dynamic-notification-canvas-loop.d.ts +24 -0
- package/dist/dynamic-notification-canvas-loop.js +113 -0
- package/dist/dynamic-notification-glass.js +23 -114
- package/dist/dynamic-notification-liquid.js +14 -118
- package/dist/dynamic-notification.d.ts +16 -8
- package/dist/dynamic-notification.js +85 -22
- package/dist/email/email-brand.d.ts +7 -4
- package/dist/email/email-brand.js +9 -6
- package/dist/email/email-code.d.ts +3 -2
- package/dist/email/email-code.js +11 -9
- package/dist/email/email-footer.d.ts +5 -3
- package/dist/email/email-footer.js +11 -5
- package/dist/email/email.d.ts +31 -9
- package/dist/email/email.js +50 -26
- package/dist/email/templates.d.ts +10 -9
- package/dist/email/templates.js +102 -38
- package/dist/email/theme.js +1 -1
- package/dist/environment-variables.d.ts +4 -2
- package/dist/environment-variables.js +52 -32
- package/dist/filter-bar/context.d.ts +32 -0
- package/dist/filter-bar/context.js +11 -0
- package/dist/filter-bar/editor.d.ts +14 -0
- package/dist/filter-bar/editor.js +216 -0
- package/dist/filter-bar/model.d.ts +10 -0
- package/dist/filter-bar/model.js +57 -0
- package/dist/filter-bar/motion.d.ts +10 -0
- package/dist/filter-bar/motion.js +84 -0
- package/dist/filter-bar/parts.d.ts +19 -0
- package/dist/filter-bar/parts.js +244 -0
- package/dist/filter-bar/types.d.ts +54 -0
- package/dist/filter-bar/types.js +0 -0
- package/dist/filter-bar.d.ts +27 -0
- package/dist/filter-bar.js +310 -0
- package/dist/hooks/use-audio-recorder.js +12 -6
- package/dist/hooks/use-chat-composer.d.ts +21 -7
- package/dist/hooks/use-chat-composer.js +32 -5
- package/dist/hooks/use-chat-message.d.ts +28 -2
- package/dist/hooks/use-chat-message.js +41 -10
- package/dist/hooks/use-chat-thread-scroll.js +43 -7
- package/dist/hooks/use-color-area.d.ts +3 -3
- package/dist/hooks/use-color-area.js +13 -12
- package/dist/hooks/use-copy-to-clipboard.d.ts +2 -1
- package/dist/hooks/use-copy-to-clipboard.js +20 -20
- package/dist/hooks/use-dropzone.d.ts +7 -4
- package/dist/hooks/use-dropzone.js +34 -3
- package/dist/hooks/use-dynamic-notification.d.ts +6 -2
- package/dist/hooks/use-dynamic-notification.js +26 -10
- package/dist/hooks/use-mobile.d.ts +3 -2
- package/dist/hooks/use-mobile.js +8 -4
- package/dist/hooks/use-textarea-trigger-menu.js +2 -1
- package/dist/hooks/use-trigger-menu.d.ts +54 -0
- package/dist/hooks/use-trigger-menu.js +102 -47
- package/dist/hooks/use-user-ask.d.ts +2 -0
- package/dist/hooks/use-user-ask.js +35 -41
- package/dist/inline-attachment.d.ts +6 -2
- package/dist/inline-attachment.js +44 -29
- package/dist/inline-citation.d.ts +12 -5
- package/dist/inline-citation.js +25 -16
- package/dist/knob-contracts/audio-recorder-knobs.d.ts +1 -1
- package/dist/knob-contracts/audio-recorder-knobs.js +2 -1
- package/dist/knob-contracts/audio-visualizer-knobs.d.ts +1 -1
- package/dist/knob-contracts/audio-visualizer-knobs.js +2 -1
- package/dist/knob-contracts/avatar-knobs.d.ts +1 -1
- package/dist/knob-contracts/avatar-knobs.js +6 -1
- package/dist/knob-contracts/badge-knobs.d.ts +1 -1
- package/dist/knob-contracts/badge-knobs.js +2 -1
- package/dist/knob-contracts/breadcrumb-knobs.d.ts +4 -0
- package/dist/knob-contracts/breadcrumb-knobs.js +8 -0
- package/dist/knob-contracts/button-knobs.d.ts +1 -1
- package/dist/knob-contracts/button-knobs.js +1 -0
- package/dist/knob-contracts/chat-layout-knobs.d.ts +1 -1
- package/dist/knob-contracts/chat-layout-knobs.js +2 -1
- package/dist/knob-contracts/chat-message-knobs.d.ts +1 -1
- package/dist/knob-contracts/chat-message-knobs.js +8 -1
- package/dist/knob-contracts/choice-knobs.d.ts +1 -1
- package/dist/knob-contracts/choice-knobs.js +1 -0
- package/dist/knob-contracts/code-diff-knobs.d.ts +1 -1
- package/dist/knob-contracts/code-diff-knobs.js +2 -0
- package/dist/knob-contracts/code-knobs.d.ts +1 -1
- package/dist/knob-contracts/code-knobs.js +2 -1
- package/dist/knob-contracts/collapsible-knobs.d.ts +1 -1
- package/dist/knob-contracts/collapsible-knobs.js +1 -1
- package/dist/knob-contracts/dynamic-notification-knobs.d.ts +1 -1
- package/dist/knob-contracts/dynamic-notification-knobs.js +2 -0
- package/dist/knob-contracts/emoji-picker-knobs.d.ts +4 -0
- package/dist/knob-contracts/emoji-picker-knobs.js +10 -0
- package/dist/knob-contracts/field-knobs.d.ts +1 -1
- package/dist/knob-contracts/field-knobs.js +5 -1
- package/dist/knob-contracts/filter-bar-knobs.d.ts +4 -0
- package/dist/knob-contracts/filter-bar-knobs.js +15 -0
- package/dist/knob-contracts/infinite-canvas-knobs.d.ts +1 -1
- package/dist/knob-contracts/infinite-canvas-knobs.js +3 -0
- package/dist/knob-contracts/markdown-knobs.d.ts +1 -1
- package/dist/knob-contracts/markdown-knobs.js +3 -1
- package/dist/knob-contracts/page-layout-knobs.d.ts +1 -1
- package/dist/knob-contracts/page-layout-knobs.js +4 -1
- package/dist/knob-contracts/popup-knobs.d.ts +1 -1
- package/dist/knob-contracts/popup-knobs.js +28 -0
- package/dist/knob-contracts/range-knobs.d.ts +1 -1
- package/dist/knob-contracts/range-knobs.js +1 -0
- package/dist/knob-contracts/rich-tooltip-knobs.d.ts +1 -1
- package/dist/knob-contracts/rich-tooltip-knobs.js +2 -1
- package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
- package/dist/knob-contracts/sidebar-knobs.js +27 -2
- package/dist/knob-contracts/spinner-knobs.d.ts +1 -1
- package/dist/knob-contracts/spinner-knobs.js +1 -1
- package/dist/knob-contracts/stepper-knobs.d.ts +1 -1
- package/dist/knob-contracts/stepper-knobs.js +4 -1
- package/dist/knob-contracts/switch-knobs.d.ts +1 -1
- package/dist/knob-contracts/switch-knobs.js +5 -0
- package/dist/knob-contracts/table-of-contents-knobs.d.ts +1 -1
- package/dist/knob-contracts/table-of-contents-knobs.js +4 -5
- package/dist/knob-contracts/tabs-knobs.d.ts +1 -1
- package/dist/knob-contracts/tabs-knobs.js +1 -0
- package/dist/knob-contracts/tree-knobs.d.ts +1 -1
- package/dist/knob-contracts/tree-knobs.js +2 -1
- package/dist/lib/cn.js +0 -4
- package/dist/lib/contrast.d.ts +1 -0
- package/dist/lib/contrast.js +17 -5
- package/dist/lib/dropzone-validation.js +41 -28
- package/dist/lib/env-file.d.ts +1 -1
- package/dist/lib/env-file.js +5 -5
- package/dist/lib/motion.d.ts +4 -0
- package/dist/lib/motion.js +15 -0
- package/dist/lib/trigger-detect.js +6 -8
- package/dist/markdown-block.js +13 -8
- package/dist/popup-parts.d.ts +8 -0
- package/dist/popup-parts.js +43 -0
- package/dist/scripts/contrast-eval.js +5 -4
- package/dist/source-badge.js +3 -1
- package/dist/styles/code.css +0 -2
- package/dist/styles/effects.css +6 -32
- package/dist/styles/index.css +14 -8
- package/dist/styles/recipes/accordion.css +9 -6
- package/dist/styles/recipes/action-bar.css +0 -15
- package/dist/styles/recipes/activity.css +5 -11
- package/dist/styles/recipes/alert.css +4 -4
- package/dist/styles/recipes/audio-recorder.css +15 -3
- package/dist/styles/recipes/audio-visualizer.css +13 -2
- package/dist/styles/recipes/avatar.css +78 -1
- package/dist/styles/recipes/badge.css +14 -4
- package/dist/styles/recipes/breadcrumb.css +77 -0
- package/dist/styles/recipes/button-group.css +6 -8
- package/dist/styles/recipes/button-states.css +66 -0
- package/dist/styles/recipes/button.css +26 -85
- package/dist/styles/recipes/calendar.css +17 -23
- package/dist/styles/recipes/card.css +2 -2
- package/dist/styles/recipes/chat-composer-attachment.css +9 -3
- package/dist/styles/recipes/chat-composer.css +21 -16
- package/dist/styles/recipes/chat-layout.css +64 -2
- package/dist/styles/recipes/chat-message-social.css +123 -0
- package/dist/styles/recipes/chat-message.css +157 -37
- package/dist/styles/recipes/choice.css +25 -21
- package/dist/styles/recipes/code-diff.css +51 -26
- package/dist/styles/recipes/code.css +44 -18
- package/dist/styles/recipes/collapsible.css +43 -1
- package/dist/styles/recipes/color-picker-details.css +3 -4
- package/dist/styles/recipes/color-picker-values.css +9 -8
- package/dist/styles/recipes/color-picker.css +23 -4
- package/dist/styles/recipes/context.css +3 -3
- package/dist/styles/recipes/dockable-panel.css +18 -7
- package/dist/styles/recipes/dropzone.css +7 -8
- package/dist/styles/recipes/dynamic-notification-input.css +8 -5
- package/dist/styles/recipes/dynamic-notification-motion.css +12 -21
- package/dist/styles/recipes/dynamic-notification.css +40 -26
- package/dist/styles/recipes/emoji-picker.css +132 -0
- package/dist/styles/recipes/empty.css +5 -4
- package/dist/styles/recipes/environment-variables.css +4 -15
- package/dist/styles/recipes/field-parts.css +89 -21
- package/dist/styles/recipes/field.css +83 -26
- package/dist/styles/recipes/filter-bar.css +161 -0
- package/dist/styles/recipes/gradient-editor.css +18 -7
- package/dist/styles/recipes/infinite-canvas.css +51 -4
- package/dist/styles/recipes/inline-attachment.css +9 -4
- package/dist/styles/recipes/inline-citation.css +10 -4
- package/dist/styles/recipes/item.css +23 -9
- package/dist/styles/recipes/markdown-block.css +5 -4
- package/dist/styles/recipes/markdown.css +68 -26
- package/dist/styles/recipes/morphing-panel.css +8 -8
- package/dist/styles/recipes/page-layout.css +36 -10
- package/dist/styles/recipes/pagination.css +5 -6
- package/dist/styles/recipes/phone-input.css +12 -8
- package/dist/styles/recipes/popup-controls.css +175 -26
- package/dist/styles/recipes/popup-drawer.css +35 -44
- package/dist/styles/recipes/popup-lists.css +139 -29
- package/dist/styles/recipes/popup-motion.css +4 -45
- package/dist/styles/recipes/popup-toast.css +55 -26
- package/dist/styles/recipes/popup.css +149 -153
- package/dist/styles/recipes/range.css +55 -19
- package/dist/styles/recipes/resizable.css +36 -7
- package/dist/styles/recipes/rich-tooltip.css +24 -34
- package/dist/styles/recipes/scroll-area.css +8 -1
- package/dist/styles/recipes/sidebar-menu.css +149 -34
- package/dist/styles/recipes/sidebar-parts.css +154 -0
- package/dist/styles/recipes/sidebar.css +187 -128
- package/dist/styles/recipes/source-badge.css +1 -1
- package/dist/styles/recipes/spinner.css +12 -1
- package/dist/styles/recipes/stepper.css +31 -13
- package/dist/styles/recipes/switch.css +68 -23
- package/dist/styles/recipes/table-of-contents.css +49 -41
- package/dist/styles/recipes/table.css +14 -10
- package/dist/styles/recipes/tabs.css +38 -12
- package/dist/styles/recipes/task-list.css +7 -14
- package/dist/styles/recipes/thread-rail.css +42 -19
- package/dist/styles/recipes/timeline.css +2 -0
- package/dist/styles/recipes/toolbar.css +27 -25
- package/dist/styles/recipes/track-highlight.css +12 -8
- package/dist/styles/recipes/transcript-divider.css +2 -2
- package/dist/styles/recipes/tree.css +31 -4
- package/dist/styles/recipes/user-ask-details.css +0 -1
- package/dist/styles/recipes/user-ask.css +4 -4
- package/dist/styles/theme.css +287 -107
- package/dist/task-list.d.ts +4 -1
- package/dist/task-list.js +24 -8
- package/dist/thread-rail.d.ts +1 -1
- package/dist/thread-rail.js +61 -19
- package/dist/transcript-divider.js +2 -1
- package/dist/ui/alert.d.ts +3 -1
- package/dist/ui/alert.js +14 -8
- package/dist/ui/autocomplete.js +7 -1
- package/dist/ui/avatar.d.ts +8 -0
- package/dist/ui/avatar.js +23 -3
- package/dist/ui/badge.js +1 -1
- package/dist/ui/breadcrumb.d.ts +27 -0
- package/dist/ui/breadcrumb.js +88 -0
- package/dist/ui/button.d.ts +2 -1
- package/dist/ui/button.js +1 -1
- package/dist/ui/calendar.js +2 -2
- package/dist/ui/card.d.ts +3 -1
- package/dist/ui/card.js +12 -7
- package/dist/ui/checkbox-group.js +1 -1
- package/dist/ui/checkbox.d.ts +2 -0
- package/dist/ui/code-diff.d.ts +1 -1
- package/dist/ui/code-diff.js +71 -27
- package/dist/ui/code.d.ts +5 -3
- package/dist/ui/code.js +27 -28
- package/dist/ui/color-picker.d.ts +5 -2
- package/dist/ui/color-picker.js +84 -36
- package/dist/ui/combobox-disabled-selection.d.ts +1 -2
- package/dist/ui/combobox-disabled-selection.js +7 -8
- package/dist/ui/combobox.d.ts +5 -23
- package/dist/ui/combobox.js +36 -16
- package/dist/ui/command.d.ts +8 -2
- package/dist/ui/command.js +39 -15
- package/dist/ui/context-menu.js +3 -0
- package/dist/ui/dialog.d.ts +2 -1
- package/dist/ui/dialog.js +3 -22
- package/dist/ui/dockable-panel-geometry.d.ts +1 -0
- package/dist/ui/dockable-panel-geometry.js +7 -1
- package/dist/ui/dockable-panel.d.ts +9 -6
- package/dist/ui/dockable-panel.js +81 -33
- package/dist/ui/drawer.d.ts +7 -4
- package/dist/ui/drawer.js +35 -22
- package/dist/ui/dropdown-menu.js +4 -3
- package/dist/ui/dropzone.d.ts +5 -3
- package/dist/ui/dropzone.js +78 -17
- package/dist/ui/emoji-picker.d.ts +18 -0
- package/dist/ui/emoji-picker.js +136 -0
- package/dist/ui/empty.d.ts +3 -1
- package/dist/ui/empty.js +12 -7
- package/dist/ui/field.js +1 -1
- package/dist/ui/gradient-editor.d.ts +1 -1
- package/dist/ui/gradient-editor.js +37 -21
- package/dist/ui/infinite-canvas.d.ts +13 -1
- package/dist/ui/infinite-canvas.js +139 -20
- package/dist/ui/input-group.d.ts +2 -4
- package/dist/ui/input-group.js +13 -14
- package/dist/ui/input-otp.d.ts +1 -1
- package/dist/ui/input-otp.js +32 -15
- package/dist/ui/input.js +11 -2
- package/dist/ui/item.d.ts +2 -1
- package/dist/ui/item.js +11 -7
- package/dist/ui/live-status.d.ts +7 -0
- package/dist/ui/live-status.js +17 -0
- package/dist/ui/markdown-elements.d.ts +6 -0
- package/dist/ui/markdown-elements.js +42 -9
- package/dist/ui/menubar.js +2 -2
- package/dist/ui/morphing-panel.js +2 -1
- package/dist/ui/native-select.d.ts +1 -1
- package/dist/ui/native-select.js +24 -11
- package/dist/ui/number-field.d.ts +1 -1
- package/dist/ui/number-field.js +13 -2
- package/dist/ui/page-layout.d.ts +2 -2
- package/dist/ui/page-layout.js +2 -4
- package/dist/ui/pagination.d.ts +7 -5
- package/dist/ui/pagination.js +19 -13
- package/dist/ui/phone-input.d.ts +1 -0
- package/dist/ui/phone-input.js +56 -58
- package/dist/ui/radio-group.d.ts +3 -0
- package/dist/ui/radio-group.js +11 -1
- package/dist/ui/resizable.d.ts +20 -2
- package/dist/ui/resizable.js +130 -8
- package/dist/ui/responsive-dialog.d.ts +1 -1
- package/dist/ui/responsive-dialog.js +9 -23
- package/dist/ui/rich-tooltip.d.ts +10 -4
- package/dist/ui/rich-tooltip.js +81 -33
- package/dist/ui/scroll-area.d.ts +4 -1
- package/dist/ui/scroll-area.js +44 -28
- package/dist/ui/select.d.ts +2 -1
- package/dist/ui/select.js +57 -32
- package/dist/ui/sidebar-menu.d.ts +5 -1
- package/dist/ui/sidebar-menu.js +31 -33
- package/dist/ui/sidebar-provider.d.ts +10 -1
- package/dist/ui/sidebar-provider.js +38 -13
- package/dist/ui/sidebar-resize-rail.js +7 -3
- package/dist/ui/sidebar.d.ts +11 -6
- package/dist/ui/sidebar.js +46 -23
- package/dist/ui/slider.js +31 -22
- package/dist/ui/spinner.d.ts +3 -2
- package/dist/ui/spinner.js +3 -2
- package/dist/ui/stepper.d.ts +8 -1
- package/dist/ui/stepper.js +74 -25
- package/dist/ui/switch.d.ts +1 -0
- package/dist/ui/table-of-contents.d.ts +5 -4
- package/dist/ui/table-of-contents.js +143 -52
- package/dist/ui/table.js +15 -9
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/textarea.js +20 -9
- package/dist/ui/timeline.d.ts +3 -1
- package/dist/ui/timeline.js +17 -9
- package/dist/ui/toast.d.ts +11 -5
- package/dist/ui/toast.js +100 -54
- package/dist/ui/toggle.d.ts +1 -1
- package/dist/ui/toggle.js +2 -1
- package/dist/ui/toolbar.d.ts +3 -2
- package/dist/ui/toolbar.js +4 -2
- package/dist/ui/tooltip.js +3 -20
- package/dist/ui/tree.js +120 -80
- package/dist/ui/trigger-menu.js +7 -2
- package/dist/user-ask.d.ts +10 -5
- package/dist/user-ask.js +31 -11
- package/package.json +5 -1
- package/dist/hooks/use-keyboard-navigation.d.ts +0 -3
- package/dist/hooks/use-keyboard-navigation.js +0 -22
package/dist/ui/resizable.js
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
-
import { createContext, useContext } from "react";
|
|
3
|
+
import { createContext, useContext, useRef, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Group, Panel, Separator } from "react-resizable-panels";
|
|
6
6
|
//#region src/ui/resizable.tsx
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const ResizableGroupContext = createContext({
|
|
8
|
+
orientation: "horizontal",
|
|
9
|
+
disableCursor: false
|
|
10
|
+
});
|
|
11
|
+
const FLOATING_KEYBOARD_STEP_PX = 10;
|
|
12
|
+
const FLOATING_ARROW_DIRECTIONS = {
|
|
13
|
+
ArrowLeft: -1,
|
|
14
|
+
ArrowRight: 1
|
|
15
|
+
};
|
|
16
|
+
function ResizablePanelGroup({ className, orientation = "horizontal", variant = "framed", disableCursor = false, children, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(ResizableGroupContext.Provider, {
|
|
18
|
+
value: {
|
|
19
|
+
orientation,
|
|
20
|
+
disableCursor
|
|
21
|
+
},
|
|
11
22
|
children: /* @__PURE__ */ jsx(Group, {
|
|
12
23
|
"data-control-ui": "resizable",
|
|
13
24
|
"data-control-family": "resizable",
|
|
@@ -15,6 +26,7 @@ function ResizablePanelGroup({ className, orientation = "horizontal", variant =
|
|
|
15
26
|
"data-surface": "panel",
|
|
16
27
|
"data-variant": variant,
|
|
17
28
|
orientation,
|
|
29
|
+
disableCursor: true,
|
|
18
30
|
className: cn("flex h-full w-full", className),
|
|
19
31
|
...props,
|
|
20
32
|
children
|
|
@@ -30,15 +42,18 @@ function ResizablePanel({ className, ...props }) {
|
|
|
30
42
|
...props
|
|
31
43
|
});
|
|
32
44
|
}
|
|
33
|
-
function ResizableHandle({ className, variant = "solid", withHandle, children, ...props }) {
|
|
34
|
-
const
|
|
45
|
+
function ResizableHandle({ className, variant = "solid", withHandle, children, "aria-label": ariaLabel = "Resize panel", ...props }) {
|
|
46
|
+
const { orientation, disableCursor } = useContext(ResizableGroupContext);
|
|
47
|
+
const axis = orientation === "horizontal" ? "vertical" : "horizontal";
|
|
35
48
|
return /* @__PURE__ */ jsxs(Separator, {
|
|
36
49
|
"data-control-ui": "resizable",
|
|
37
50
|
"data-control-family": "resizable",
|
|
38
51
|
"data-slot": "handle",
|
|
39
52
|
"data-variant": variant,
|
|
40
53
|
"data-axis": axis,
|
|
54
|
+
"data-cursor": disableCursor ? "none" : void 0,
|
|
41
55
|
className: cn("relative flex items-center justify-center", axis === "vertical" ? "w-px touch-pan-y" : "h-px touch-pan-x", className),
|
|
56
|
+
"aria-label": ariaLabel,
|
|
42
57
|
...props,
|
|
43
58
|
children: [withHandle ? /* @__PURE__ */ jsx("span", {
|
|
44
59
|
"data-control-ui": "resizable",
|
|
@@ -51,6 +66,113 @@ function ResizableHandle({ className, variant = "solid", withHandle, children, .
|
|
|
51
66
|
}) : null, children]
|
|
52
67
|
});
|
|
53
68
|
}
|
|
69
|
+
function ResizableFloatingPanel({ side = "right", size: controlledSize, defaultSize = 280, onSizeChange, minSize = 160, maxSize = 640, handleVariant = "hover", handleLabel = "Resize panel", getAriaValueText = (value) => `${value} pixels`, className, style, children, ...props }) {
|
|
70
|
+
const [uncontrolledSize, setUncontrolledSize] = useState(defaultSize);
|
|
71
|
+
const [hovered, setHovered] = useState(false);
|
|
72
|
+
const [focused, setFocused] = useState(false);
|
|
73
|
+
const [resizing, setResizing] = useState(false);
|
|
74
|
+
const panelRef = useRef(null);
|
|
75
|
+
const resizeRef = useRef(null);
|
|
76
|
+
const size = controlledSize ?? uncontrolledSize;
|
|
77
|
+
const growthPerPointerPx = side === "right" ? -1 : 1;
|
|
78
|
+
function changeSize(next) {
|
|
79
|
+
const clamped = Math.round(Math.min(Math.max(next, minSize), maxSize));
|
|
80
|
+
if (clamped === size) return;
|
|
81
|
+
if (controlledSize === void 0) setUncontrolledSize(clamped);
|
|
82
|
+
onSizeChange?.(clamped);
|
|
83
|
+
}
|
|
84
|
+
function beginResize(event) {
|
|
85
|
+
const panel = panelRef.current;
|
|
86
|
+
if (!panel || !event.isPrimary || event.button !== 0) return;
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
89
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
90
|
+
resizeRef.current = {
|
|
91
|
+
pointerId: event.pointerId,
|
|
92
|
+
startX: event.clientX,
|
|
93
|
+
startSize: panel.getBoundingClientRect().width
|
|
94
|
+
};
|
|
95
|
+
setResizing(true);
|
|
96
|
+
}
|
|
97
|
+
function updateResize(event) {
|
|
98
|
+
const session = resizeRef.current;
|
|
99
|
+
if (session?.pointerId !== event.pointerId) return;
|
|
100
|
+
changeSize(session.startSize + (event.clientX - session.startX) * growthPerPointerPx);
|
|
101
|
+
}
|
|
102
|
+
function endResize(event) {
|
|
103
|
+
if (resizeRef.current?.pointerId !== event.pointerId) return;
|
|
104
|
+
resizeRef.current = null;
|
|
105
|
+
setResizing(false);
|
|
106
|
+
}
|
|
107
|
+
function resizeWithKeyboard(event) {
|
|
108
|
+
const arrowDirection = FLOATING_ARROW_DIRECTIONS[event.key];
|
|
109
|
+
const step = event.shiftKey ? 50 : FLOATING_KEYBOARD_STEP_PX;
|
|
110
|
+
if (arrowDirection) changeSize(size + arrowDirection * step * growthPerPointerPx);
|
|
111
|
+
else if (event.key === "Home") changeSize(minSize);
|
|
112
|
+
else if (event.key === "End") changeSize(maxSize);
|
|
113
|
+
else return;
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
}
|
|
116
|
+
let separatorState = "inactive";
|
|
117
|
+
if (resizing) separatorState = "active";
|
|
118
|
+
else if (focused) separatorState = "focus";
|
|
119
|
+
else if (hovered) separatorState = "hover";
|
|
120
|
+
const panelStyle = {
|
|
121
|
+
...style,
|
|
122
|
+
"--resizable-floating-width": `${size}px`
|
|
123
|
+
};
|
|
124
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
125
|
+
ref: panelRef,
|
|
126
|
+
...props,
|
|
127
|
+
"data-control-ui": "resizable",
|
|
128
|
+
"data-control-family": "resizable",
|
|
129
|
+
"data-slot": "floating",
|
|
130
|
+
"data-side": side,
|
|
131
|
+
className: cn("absolute inset-y-2 isolate flex w-(--resizable-floating-width) max-w-[calc(100%-1rem)] flex-col", side === "right" ? "right-2" : "left-2", className),
|
|
132
|
+
style: panelStyle,
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx("div", {
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
"data-control-ui": "resizable",
|
|
137
|
+
"data-control-family": "popup",
|
|
138
|
+
"data-popup-kind": "resizable",
|
|
139
|
+
"data-popup-part": "surface",
|
|
140
|
+
"data-popup-static": "",
|
|
141
|
+
"data-surface": "floating",
|
|
142
|
+
"data-slot": "surface",
|
|
143
|
+
className: "pointer-events-none absolute inset-0 -z-1"
|
|
144
|
+
}),
|
|
145
|
+
children,
|
|
146
|
+
/* @__PURE__ */ jsx("div", {
|
|
147
|
+
role: "separator",
|
|
148
|
+
tabIndex: 0,
|
|
149
|
+
"aria-label": handleLabel,
|
|
150
|
+
"aria-orientation": "vertical",
|
|
151
|
+
"aria-valuenow": size,
|
|
152
|
+
"aria-valuemin": minSize,
|
|
153
|
+
"aria-valuemax": maxSize,
|
|
154
|
+
"aria-valuetext": getAriaValueText(size),
|
|
155
|
+
"data-control-ui": "resizable",
|
|
156
|
+
"data-control-family": "resizable",
|
|
157
|
+
"data-slot": "handle",
|
|
158
|
+
"data-variant": handleVariant,
|
|
159
|
+
"data-axis": "vertical",
|
|
160
|
+
"data-separator": separatorState,
|
|
161
|
+
className: cn("absolute inset-y-0 w-px touch-none after:absolute after:inset-y-0 after:inset-x-[calc((1px_-_var(--target-min))/2)] after:content-['']", side === "right" ? "left-0" : "right-0"),
|
|
162
|
+
onPointerDown: beginResize,
|
|
163
|
+
onPointerMove: updateResize,
|
|
164
|
+
onPointerUp: endResize,
|
|
165
|
+
onPointerCancel: endResize,
|
|
166
|
+
onPointerEnter: () => setHovered(true),
|
|
167
|
+
onPointerLeave: () => setHovered(false),
|
|
168
|
+
onFocus: () => setFocused(true),
|
|
169
|
+
onBlur: () => setFocused(false),
|
|
170
|
+
onKeyDown: resizeWithKeyboard,
|
|
171
|
+
onDoubleClick: () => changeSize(defaultSize)
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
54
176
|
function GripIcon({ className }) {
|
|
55
177
|
return /* @__PURE__ */ jsxs("svg", {
|
|
56
178
|
viewBox: "0 0 4 16",
|
|
@@ -79,4 +201,4 @@ function GripIcon({ className }) {
|
|
|
79
201
|
});
|
|
80
202
|
}
|
|
81
203
|
//#endregion
|
|
82
|
-
export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
204
|
+
export { ResizableFloatingPanel, ResizableHandle, ResizablePanel, ResizablePanelGroup };
|
|
@@ -9,7 +9,7 @@ export type ResponsiveDialogContentProps = DialogContentProps & {
|
|
|
9
9
|
export declare function ResponsiveDialog({ open: controlledOpen, defaultOpen, onOpenChange, children }: ResponsiveDialogProps): import("react").JSX.Element;
|
|
10
10
|
export declare function ResponsiveDialogTrigger(props: Omit<ComponentProps<typeof DialogTrigger>, "handle">): import("react").JSX.Element;
|
|
11
11
|
export declare function ResponsiveDialogClose({ className, children, variant, size, tone, iconOnly, ...props }: DialogCloseProps): import("react").JSX.Element;
|
|
12
|
-
export declare function ResponsiveDialogContent({ className, dialogClassName, drawerClassName, children, showCloseButton, ...props }: ResponsiveDialogContentProps): import("react").JSX.Element;
|
|
12
|
+
export declare function ResponsiveDialogContent({ className, dialogClassName, drawerClassName, children, showCloseButton, closeLabel, ...props }: ResponsiveDialogContentProps): import("react").JSX.Element;
|
|
13
13
|
export declare function ResponsiveDialogHeader(props: ComponentProps<typeof DialogHeader>): import("react").JSX.Element;
|
|
14
14
|
export declare function ResponsiveDialogFooter(props: ComponentProps<typeof DialogFooter>): import("react").JSX.Element;
|
|
15
15
|
export declare function ResponsiveDialogTitle(props: ComponentProps<typeof DialogTitle>): import("react").JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
+
import { PopupCloseButton } from "../popup-parts.js";
|
|
5
|
+
import { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "./drawer.js";
|
|
4
6
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./dialog.js";
|
|
5
|
-
import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "./drawer.js";
|
|
6
7
|
import { createContext, useContext, useState, useSyncExternalStore } from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
//#region src/ui/responsive-dialog.tsx
|
|
@@ -73,36 +74,21 @@ function ResponsiveDialogClose({ className, children, variant = "surface", size
|
|
|
73
74
|
})
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
|
-
function ResponsiveDialogContent({ className, dialogClassName, drawerClassName, children, showCloseButton = true, ...props }) {
|
|
77
|
+
function ResponsiveDialogContent({ className, dialogClassName, drawerClassName, children, showCloseButton = true, closeLabel = "Close", ...props }) {
|
|
77
78
|
if (!useResponsiveDialogContext()) return /* @__PURE__ */ jsx(DialogContent, {
|
|
78
79
|
className: cn(className, dialogClassName),
|
|
79
80
|
showCloseButton,
|
|
81
|
+
closeLabel,
|
|
80
82
|
...props,
|
|
81
83
|
children
|
|
82
84
|
});
|
|
83
85
|
return /* @__PURE__ */ jsxs(DrawerContent, {
|
|
84
|
-
className: cn("relative
|
|
86
|
+
className: cn("relative", className, drawerClassName),
|
|
85
87
|
...props,
|
|
86
|
-
children: [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
children: [/* @__PURE__ */ jsx("svg", {
|
|
91
|
-
viewBox: "0 0 16 16",
|
|
92
|
-
className: "size-4",
|
|
93
|
-
"aria-hidden": "true",
|
|
94
|
-
fill: "none",
|
|
95
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
96
|
-
d: "M4 4 12 12M12 4 4 12",
|
|
97
|
-
stroke: "currentColor",
|
|
98
|
-
strokeWidth: "1.4",
|
|
99
|
-
strokeLinecap: "round"
|
|
100
|
-
})
|
|
101
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
102
|
-
className: "sr-only",
|
|
103
|
-
children: "Close"
|
|
104
|
-
})]
|
|
105
|
-
}) : null]
|
|
88
|
+
children: [/* @__PURE__ */ jsx(DrawerBody, {
|
|
89
|
+
padding: "none",
|
|
90
|
+
children
|
|
91
|
+
}), showCloseButton ? /* @__PURE__ */ jsx(DrawerClose, { render: /* @__PURE__ */ jsx(PopupCloseButton, { label: closeLabel }) }) : null]
|
|
106
92
|
});
|
|
107
93
|
}
|
|
108
94
|
function ResponsiveDialogHeader(props) {
|
|
@@ -30,9 +30,10 @@ export type RichTooltipProps = Omit<ComponentProps<typeof Popover.Root>, "modal"
|
|
|
30
30
|
tone?: RichTooltipTone;
|
|
31
31
|
storageKey?: string;
|
|
32
32
|
dismissOnOutsidePress?: boolean;
|
|
33
|
+
dismissOnFocusOut?: boolean;
|
|
33
34
|
trapFocus?: boolean;
|
|
34
35
|
};
|
|
35
|
-
export declare function RichTooltip({ step, tone, storageKey, dismissOnOutsidePress, trapFocus, open, defaultOpen, onOpenChange, children, ...props }: RichTooltipProps): import("react").JSX.Element;
|
|
36
|
+
export declare function RichTooltip({ step, tone, storageKey, dismissOnOutsidePress, dismissOnFocusOut, trapFocus, open, defaultOpen, onOpenChange, children, ...props }: RichTooltipProps): import("react").JSX.Element;
|
|
36
37
|
export declare function RichTooltipTrigger({ className, ...props }: ComponentProps<typeof Popover.Trigger> & {
|
|
37
38
|
style?: CSSProperties & PopupKnobStyle;
|
|
38
39
|
}): import("react").JSX.Element;
|
|
@@ -69,13 +70,18 @@ export type RichTooltipProgressProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
69
70
|
style?: CSSProperties & RichTooltipKnobStyle & PopupKnobStyle;
|
|
70
71
|
};
|
|
71
72
|
export declare function RichTooltipProgress({ className, variant, children, ...props }: RichTooltipProgressProps): import("react").JSX.Element | null;
|
|
72
|
-
export declare function RichTooltipPrevious({ className, children, onClick, ...props }: Omit<ComponentProps<"button">, "style"> & {
|
|
73
|
+
export declare function RichTooltipPrevious({ className, children, label, onClick, ...props }: Omit<ComponentProps<"button">, "style"> & {
|
|
73
74
|
style?: CSSProperties & RichTooltipKnobStyle & PopupKnobStyle;
|
|
75
|
+
label?: string;
|
|
74
76
|
}): import("react").JSX.Element | null;
|
|
75
|
-
export declare function RichTooltipNext({ className, children, onClick, ...props }: Omit<ComponentProps<"button">, "style"> & {
|
|
77
|
+
export declare function RichTooltipNext({ className, children, nextLabel, finishLabel, gotItLabel, onClick, ref, ...props }: Omit<ComponentProps<"button">, "style"> & {
|
|
76
78
|
style?: CSSProperties & RichTooltipKnobStyle & PopupKnobStyle;
|
|
79
|
+
nextLabel?: string;
|
|
80
|
+
finishLabel?: string;
|
|
81
|
+
gotItLabel?: string;
|
|
77
82
|
}): import("react").JSX.Element;
|
|
78
|
-
export declare function RichTooltipClose({ className, children, ...props }: Omit<ComponentProps<typeof Popover.Close>, "style"> & {
|
|
83
|
+
export declare function RichTooltipClose({ className, children, label, ...props }: Omit<ComponentProps<typeof Popover.Close>, "style"> & {
|
|
79
84
|
style?: CSSProperties & RichTooltipKnobStyle & PopupKnobStyle;
|
|
85
|
+
label?: string;
|
|
80
86
|
}): import("react").JSX.Element;
|
|
81
87
|
//#endregion
|
package/dist/ui/rich-tooltip.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
import { controlEffectsAttribute } from "../skin.js";
|
|
4
4
|
import { useSkin } from "../skin-provider.js";
|
|
5
|
+
import { prefersReducedMotion } from "../lib/motion.js";
|
|
6
|
+
import { PopupArrowShape } from "../popup-parts.js";
|
|
5
7
|
import { stepAfter, stepBefore, tourPosition } from "./rich-tooltip-tour.js";
|
|
6
|
-
import { createContext, useContext, useEffect, useState } from "react";
|
|
8
|
+
import { createContext, useContext, useEffect, useId, useRef, useState } from "react";
|
|
7
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { ChevronLeftIcon, ChevronRightIcon, XIcon } from "lucide-react";
|
|
10
|
+
import { CheckIcon, ChevronLeftIcon, ChevronRightIcon, XIcon } from "lucide-react";
|
|
9
11
|
import { Popover } from "@base-ui/react/popover";
|
|
10
12
|
//#region src/ui/rich-tooltip.tsx
|
|
11
13
|
const TourContext = createContext(null);
|
|
@@ -66,11 +68,14 @@ function useRichTooltipContext() {
|
|
|
66
68
|
if (!context) throw new Error("RichTooltip parts must be rendered inside <RichTooltip>.");
|
|
67
69
|
return context;
|
|
68
70
|
}
|
|
69
|
-
function RichTooltip({ step, tone = "accent", storageKey, dismissOnOutsidePress = false, trapFocus = false, open, defaultOpen = true, onOpenChange, children, ...props }) {
|
|
71
|
+
function RichTooltip({ step, tone = "accent", storageKey, dismissOnOutsidePress = false, dismissOnFocusOut = false, trapFocus = false, open, defaultOpen = true, onOpenChange, children, ...props }) {
|
|
70
72
|
const tour = useTour();
|
|
71
73
|
const inTour = tour !== null && step !== void 0;
|
|
72
74
|
const [standaloneOpen, setStandaloneOpen] = useState(defaultOpen);
|
|
73
75
|
const standaloneAllowed = useSeenGate(storageKey, open === void 0 && !inTour);
|
|
76
|
+
const nextRef = useRef(null);
|
|
77
|
+
const [descriptionId, setDescriptionId] = useState();
|
|
78
|
+
const [progressId, setProgressId] = useState();
|
|
74
79
|
const resolvedOpen = open ?? (inTour ? tour.activeStep === step : standaloneOpen && standaloneAllowed);
|
|
75
80
|
function dismiss() {
|
|
76
81
|
if (inTour) {
|
|
@@ -82,12 +87,19 @@ function RichTooltip({ step, tone = "accent", storageKey, dismissOnOutsidePress
|
|
|
82
87
|
}
|
|
83
88
|
const handleOpenChange = (nextOpen, details) => {
|
|
84
89
|
if (!dismissOnOutsidePress && details.reason === "outside-press") return;
|
|
90
|
+
if (!dismissOnFocusOut && details.reason === "focus-out") return;
|
|
85
91
|
onOpenChange?.(nextOpen, details);
|
|
86
92
|
if (!nextOpen) dismiss();
|
|
87
93
|
};
|
|
88
94
|
const context = {
|
|
89
95
|
tone,
|
|
90
|
-
|
|
96
|
+
inTour,
|
|
97
|
+
dismiss,
|
|
98
|
+
nextRef,
|
|
99
|
+
descriptionId,
|
|
100
|
+
setDescriptionId,
|
|
101
|
+
progressId,
|
|
102
|
+
setProgressId
|
|
91
103
|
};
|
|
92
104
|
return /* @__PURE__ */ jsx(RichTooltipContext.Provider, {
|
|
93
105
|
value: context,
|
|
@@ -122,11 +134,10 @@ function useAnchorScroll(anchor, open, enabled) {
|
|
|
122
134
|
if (!(open && enabled)) return;
|
|
123
135
|
const element = resolveAnchorElement(anchor);
|
|
124
136
|
if (!element) return;
|
|
125
|
-
const reduced = globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
126
137
|
element.scrollIntoView({
|
|
127
138
|
block: "center",
|
|
128
139
|
inline: "nearest",
|
|
129
|
-
behavior:
|
|
140
|
+
behavior: prefersReducedMotion(element) ? "auto" : "smooth"
|
|
130
141
|
});
|
|
131
142
|
}, [
|
|
132
143
|
anchor,
|
|
@@ -134,11 +145,20 @@ function useAnchorScroll(anchor, open, enabled) {
|
|
|
134
145
|
open
|
|
135
146
|
]);
|
|
136
147
|
}
|
|
148
|
+
const richTooltipContentSelector = "[data-control-ui=\"rich-tooltip\"][data-slot=\"content\"]";
|
|
137
149
|
function RichTooltipContent({ className, children, side = "bottom", align = "center", sideOffset = 10, anchor, collisionPadding = 12, arrow = true, scrollAnchorIntoView = true, ...props }) {
|
|
138
150
|
const skin = useSkin();
|
|
139
|
-
const { tone } = useRichTooltipContext();
|
|
151
|
+
const { tone, inTour, nextRef, descriptionId, progressId } = useRichTooltipContext();
|
|
140
152
|
const isSurface = tone === "surface";
|
|
141
153
|
useAnchorScroll(anchor, true, scrollAnchorIntoView);
|
|
154
|
+
const describedBy = [descriptionId, progressId].filter(Boolean).join(" ") || void 0;
|
|
155
|
+
const initialFocus = (openType) => {
|
|
156
|
+
const active = document.activeElement;
|
|
157
|
+
const openedWithoutInteraction = !openType;
|
|
158
|
+
const focusIsElsewhere = active !== null && active !== document.body && active.closest(richTooltipContentSelector) === null;
|
|
159
|
+
if (openedWithoutInteraction && focusIsElsewhere) return false;
|
|
160
|
+
return inTour && nextRef.current ? nextRef.current : true;
|
|
161
|
+
};
|
|
142
162
|
return /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
143
163
|
"data-control-ui": "rich-tooltip",
|
|
144
164
|
"data-popup-kind": "rich-tooltip",
|
|
@@ -161,6 +181,8 @@ function RichTooltipContent({ className, children, side = "bottom", align = "cen
|
|
|
161
181
|
"data-surface": isSurface ? "floating" : void 0,
|
|
162
182
|
"data-popup-part": isSurface ? "surface" : void 0,
|
|
163
183
|
className: cn("relative grid w-80 max-w-[calc(100vw-2rem)]", className),
|
|
184
|
+
initialFocus,
|
|
185
|
+
"aria-describedby": describedBy,
|
|
164
186
|
...props,
|
|
165
187
|
children: [children, arrow ? /* @__PURE__ */ jsx(Popover.Arrow, {
|
|
166
188
|
"data-control-ui": "rich-tooltip",
|
|
@@ -168,24 +190,12 @@ function RichTooltipContent({ className, children, side = "bottom", align = "cen
|
|
|
168
190
|
"data-control-family": "popup",
|
|
169
191
|
"data-slot": "arrow",
|
|
170
192
|
"data-tone": tone,
|
|
171
|
-
className:
|
|
172
|
-
children: /* @__PURE__ */ jsx(
|
|
193
|
+
className: "flex",
|
|
194
|
+
children: /* @__PURE__ */ jsx(PopupArrowShape, {})
|
|
173
195
|
}) : null]
|
|
174
196
|
})
|
|
175
197
|
}) });
|
|
176
198
|
}
|
|
177
|
-
function RichTooltipArrowSvg() {
|
|
178
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
179
|
-
"aria-hidden": "true",
|
|
180
|
-
focusable: "false",
|
|
181
|
-
width: "12",
|
|
182
|
-
height: "8",
|
|
183
|
-
viewBox: "0 0 12 8",
|
|
184
|
-
fill: "none",
|
|
185
|
-
overflow: "visible",
|
|
186
|
-
children: /* @__PURE__ */ jsx("path", { d: "M0 7L4 2Q6 0 8 2L12 7L12 8L0 8Z" })
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
199
|
function RichTooltipMedia({ className, ...props }) {
|
|
190
200
|
return /* @__PURE__ */ jsx("div", {
|
|
191
201
|
"data-control-ui": "rich-tooltip",
|
|
@@ -217,8 +227,15 @@ function RichTooltipTitle({ className, ...props }) {
|
|
|
217
227
|
});
|
|
218
228
|
}
|
|
219
229
|
function RichTooltipDescription({ className, ...props }) {
|
|
220
|
-
const { tone } = useRichTooltipContext();
|
|
230
|
+
const { tone, setDescriptionId } = useRichTooltipContext();
|
|
231
|
+
const generatedId = useId();
|
|
232
|
+
const id = props.id ?? generatedId;
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
setDescriptionId(id);
|
|
235
|
+
return () => setDescriptionId(void 0);
|
|
236
|
+
}, [id, setDescriptionId]);
|
|
221
237
|
return /* @__PURE__ */ jsx(Popover.Description, {
|
|
238
|
+
id,
|
|
222
239
|
"data-control-ui": "rich-tooltip",
|
|
223
240
|
"data-control-family": "popup",
|
|
224
241
|
"data-popup-kind": "rich-tooltip",
|
|
@@ -239,9 +256,20 @@ function RichTooltipFooter({ className, ...props }) {
|
|
|
239
256
|
});
|
|
240
257
|
}
|
|
241
258
|
function RichTooltipProgress({ className, variant = "count", children, ...props }) {
|
|
242
|
-
const { tone } = useRichTooltipContext();
|
|
259
|
+
const { tone, setProgressId } = useRichTooltipContext();
|
|
243
260
|
const tour = useTour();
|
|
244
|
-
|
|
261
|
+
const statusId = useId();
|
|
262
|
+
const rendered = tour !== null && tour.total >= 2 && tour.index >= 0;
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (!rendered) return;
|
|
265
|
+
setProgressId(statusId);
|
|
266
|
+
return () => setProgressId(void 0);
|
|
267
|
+
}, [
|
|
268
|
+
rendered,
|
|
269
|
+
statusId,
|
|
270
|
+
setProgressId
|
|
271
|
+
]);
|
|
272
|
+
if (!tour || !rendered) return null;
|
|
245
273
|
return /* @__PURE__ */ jsxs("div", {
|
|
246
274
|
"data-control-ui": "rich-tooltip",
|
|
247
275
|
"data-control-family": "popup",
|
|
@@ -252,6 +280,7 @@ function RichTooltipProgress({ className, variant = "count", children, ...props
|
|
|
252
280
|
className: cn("flex items-center", className),
|
|
253
281
|
...props,
|
|
254
282
|
children: [/* @__PURE__ */ jsx("span", {
|
|
283
|
+
id: statusId,
|
|
255
284
|
className: "sr-only",
|
|
256
285
|
children: `Step ${tour.index + 1} of ${tour.total}`
|
|
257
286
|
}), children ?? (variant === "dots" ? Array.from({ length: tour.total }, (_, dot) => /* @__PURE__ */ jsx("span", {
|
|
@@ -267,8 +296,12 @@ function RichTooltipProgress({ className, variant = "count", children, ...props
|
|
|
267
296
|
}))]
|
|
268
297
|
});
|
|
269
298
|
}
|
|
299
|
+
function assignRef(ref, node) {
|
|
300
|
+
if (typeof ref === "function") ref(node);
|
|
301
|
+
else if (ref) ref.current = node;
|
|
302
|
+
}
|
|
270
303
|
const actionClasses = "inline-flex shrink-0 cursor-pointer items-center justify-center disabled:pointer-events-none [&_svg]:size-4";
|
|
271
|
-
function RichTooltipPrevious({ className, children, onClick, ...props }) {
|
|
304
|
+
function RichTooltipPrevious({ className, children, label = "Previous step", onClick, ...props }) {
|
|
272
305
|
const tour = useTour();
|
|
273
306
|
if (!tour || tour.total < 2) return null;
|
|
274
307
|
return /* @__PURE__ */ jsx("button", {
|
|
@@ -277,6 +310,7 @@ function RichTooltipPrevious({ className, children, onClick, ...props }) {
|
|
|
277
310
|
"data-control-family": "popup",
|
|
278
311
|
"data-popup-kind": "rich-tooltip",
|
|
279
312
|
"data-slot": "previous",
|
|
313
|
+
"data-icon-only": children === void 0 ? "true" : void 0,
|
|
280
314
|
disabled: tour.isFirst,
|
|
281
315
|
onClick: (event) => {
|
|
282
316
|
onClick?.(event);
|
|
@@ -284,21 +318,30 @@ function RichTooltipPrevious({ className, children, onClick, ...props }) {
|
|
|
284
318
|
},
|
|
285
319
|
className: cn(actionClasses, className),
|
|
286
320
|
...props,
|
|
287
|
-
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
321
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
322
|
+
"aria-hidden": "true",
|
|
323
|
+
"data-icon-dir": "inline"
|
|
324
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
288
325
|
className: "sr-only",
|
|
289
|
-
children:
|
|
326
|
+
children: label
|
|
290
327
|
})] })
|
|
291
328
|
});
|
|
292
329
|
}
|
|
293
|
-
function RichTooltipNext({ className, children, onClick, ...props }) {
|
|
294
|
-
const { dismiss } = useRichTooltipContext();
|
|
330
|
+
function RichTooltipNext({ className, children, nextLabel = "Next step", finishLabel = "Finish", gotItLabel = "Got it", onClick, ref, ...props }) {
|
|
331
|
+
const { dismiss, nextRef } = useRichTooltipContext();
|
|
295
332
|
const tour = useTour();
|
|
333
|
+
const setRef = (node) => {
|
|
334
|
+
nextRef.current = node;
|
|
335
|
+
assignRef(ref, node);
|
|
336
|
+
};
|
|
296
337
|
return /* @__PURE__ */ jsx("button", {
|
|
297
338
|
type: "button",
|
|
298
339
|
"data-control-ui": "rich-tooltip",
|
|
299
340
|
"data-control-family": "popup",
|
|
300
341
|
"data-popup-kind": "rich-tooltip",
|
|
301
342
|
"data-slot": "next",
|
|
343
|
+
"data-icon-only": children === void 0 && tour ? "true" : void 0,
|
|
344
|
+
ref: setRef,
|
|
302
345
|
onClick: (event) => {
|
|
303
346
|
onClick?.(event);
|
|
304
347
|
if (event.defaultPrevented) return;
|
|
@@ -309,21 +352,26 @@ function RichTooltipNext({ className, children, onClick, ...props }) {
|
|
|
309
352
|
...props,
|
|
310
353
|
children: children ?? (tour ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
311
354
|
className: "sr-only",
|
|
312
|
-
children: tour.isLast ?
|
|
313
|
-
}), /* @__PURE__ */ jsx(
|
|
355
|
+
children: tour.isLast ? finishLabel : nextLabel
|
|
356
|
+
}), tour.isLast ? /* @__PURE__ */ jsx(CheckIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
357
|
+
"aria-hidden": "true",
|
|
358
|
+
"data-icon-dir": "inline"
|
|
359
|
+
})] }) : gotItLabel)
|
|
314
360
|
});
|
|
315
361
|
}
|
|
316
|
-
function RichTooltipClose({ className, children, ...props }) {
|
|
362
|
+
function RichTooltipClose({ className, children, label, ...props }) {
|
|
363
|
+
const { inTour } = useRichTooltipContext();
|
|
317
364
|
return /* @__PURE__ */ jsx(Popover.Close, {
|
|
318
365
|
"data-control-ui": "rich-tooltip",
|
|
319
366
|
"data-control-family": "popup",
|
|
320
367
|
"data-popup-kind": "rich-tooltip",
|
|
321
368
|
"data-slot": "close",
|
|
369
|
+
"data-icon-only": children === void 0 ? "true" : void 0,
|
|
322
370
|
className: cn(actionClasses, className),
|
|
323
371
|
...props,
|
|
324
372
|
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", {
|
|
325
373
|
className: "sr-only",
|
|
326
|
-
children: "Dismiss"
|
|
374
|
+
children: label ?? (inTour ? "End tour" : "Dismiss")
|
|
327
375
|
})] })
|
|
328
376
|
});
|
|
329
377
|
}
|
package/dist/ui/scroll-area.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ScrollAreaKnobStyle } from "../knob-contracts/scroll-area-knobs.js";
|
|
2
2
|
import { ProgressiveBlurProps } from "./progressive-blur.js";
|
|
3
3
|
import { CSSProperties, ComponentProps, Ref } from "react";
|
|
4
|
+
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
4
5
|
//#region src/ui/scroll-area.d.ts
|
|
5
6
|
export declare const scrollAreaScrollbarVisibilities: readonly ["scroll", "hover", "always"];
|
|
6
7
|
export type ScrollAreaScrollbarVisibility = (typeof scrollAreaScrollbarVisibilities)[number];
|
|
@@ -9,11 +10,13 @@ export type ScrollAreaViewportProps = Omit<ComponentProps<"div">, "children" | "
|
|
|
9
10
|
"data-control-ui"?: string;
|
|
10
11
|
"data-control-family"?: string;
|
|
11
12
|
"data-slot"?: string;
|
|
13
|
+
render?: ComponentProps<typeof ScrollArea$1.Viewport>["render"];
|
|
12
14
|
};
|
|
13
15
|
export type ScrollAreaProps = Omit<ComponentProps<"div">, "style"> & {
|
|
14
16
|
style?: CSSProperties & ScrollAreaKnobStyle;
|
|
15
17
|
} & {
|
|
16
18
|
viewportClassName?: string;
|
|
19
|
+
contentClassName?: string;
|
|
17
20
|
viewportProps?: ScrollAreaViewportProps;
|
|
18
21
|
viewportRef?: Ref<HTMLDivElement>;
|
|
19
22
|
maxHeight?: string;
|
|
@@ -23,5 +26,5 @@ export type ScrollAreaProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
23
26
|
lockAxis?: ScrollAreaLockAxis;
|
|
24
27
|
scrollbarVisibility?: ScrollAreaScrollbarVisibility;
|
|
25
28
|
};
|
|
26
|
-
export declare function ScrollArea({ className, viewportClassName, viewportProps, viewportRef, maxHeight, mask, blur, blurProps, lockAxis, scrollbarVisibility, children, style, ...props }: ScrollAreaProps): import("react").JSX.Element;
|
|
29
|
+
export declare function ScrollArea({ className, viewportClassName, contentClassName, viewportProps, viewportRef, maxHeight, mask, blur, blurProps, lockAxis, scrollbarVisibility, children, style, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ...props }: ScrollAreaProps): import("react").JSX.Element;
|
|
27
30
|
//#endregion
|