@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/dialog.js
CHANGED
|
@@ -3,6 +3,7 @@ import { cn } from "../lib/cn.js";
|
|
|
3
3
|
import { controlEffectsAttribute, skinAdornment } from "../skin.js";
|
|
4
4
|
import { useSkin } from "../skin-provider.js";
|
|
5
5
|
import { Button } from "./button.js";
|
|
6
|
+
import { PopupCloseButton } from "../popup-parts.js";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
8
9
|
//#region src/ui/dialog.tsx
|
|
@@ -33,7 +34,7 @@ function DialogClose({ className, children, variant = "surface", size = "sm", to
|
|
|
33
34
|
})
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
37
|
+
function DialogContent({ className, children, showCloseButton = true, closeLabel = "Close", ...props }) {
|
|
37
38
|
const skin = useSkin();
|
|
38
39
|
return /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [/* @__PURE__ */ jsx(Dialog$1.Backdrop, {
|
|
39
40
|
"data-control-ui": "dialog",
|
|
@@ -58,27 +59,7 @@ function DialogContent({ className, children, showCloseButton = true, ...props }
|
|
|
58
59
|
children: [
|
|
59
60
|
skinAdornment(skin, "dialog", "titlebar", {}),
|
|
60
61
|
children,
|
|
61
|
-
showCloseButton ? /* @__PURE__ */
|
|
62
|
-
variant: "ghost",
|
|
63
|
-
size: "xs",
|
|
64
|
-
iconOnly: true,
|
|
65
|
-
className: "absolute",
|
|
66
|
-
children: [/* @__PURE__ */ jsx("svg", {
|
|
67
|
-
viewBox: "0 0 16 16",
|
|
68
|
-
className: "size-4",
|
|
69
|
-
"aria-hidden": "true",
|
|
70
|
-
fill: "none",
|
|
71
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
72
|
-
d: "M4 4 12 12M12 4 4 12",
|
|
73
|
-
stroke: "currentColor",
|
|
74
|
-
strokeWidth: "1.4",
|
|
75
|
-
strokeLinecap: "round"
|
|
76
|
-
})
|
|
77
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
78
|
-
className: "sr-only",
|
|
79
|
-
children: "Close"
|
|
80
|
-
})]
|
|
81
|
-
}) : null
|
|
62
|
+
showCloseButton ? /* @__PURE__ */ jsx(Dialog$1.Close, { render: /* @__PURE__ */ jsx(PopupCloseButton, { label: closeLabel }) }) : null
|
|
82
63
|
]
|
|
83
64
|
})] });
|
|
84
65
|
}
|
|
@@ -14,4 +14,5 @@ export type DockablePanelPosition = {
|
|
|
14
14
|
export declare function clampDockablePanelPosition(position: DockablePanelPosition, bounds: DockablePanelBounds, panel: DockablePanelSize, inset?: number): DockablePanelPosition;
|
|
15
15
|
export declare function dockablePanelSideAt(pointerX: number, width: number): "left" | "right";
|
|
16
16
|
export declare function oppositeDockablePanelSide(placement: "left" | "right"): "left" | "right";
|
|
17
|
+
export declare function dockablePanelSideForKey(key: string, placement: "left" | "right"): "left" | "right" | null;
|
|
17
18
|
//#endregion
|
|
@@ -13,5 +13,11 @@ function dockablePanelSideAt(pointerX, width) {
|
|
|
13
13
|
function oppositeDockablePanelSide(placement) {
|
|
14
14
|
return placement === "left" ? "right" : "left";
|
|
15
15
|
}
|
|
16
|
+
function dockablePanelSideForKey(key, placement) {
|
|
17
|
+
if (key === "ArrowLeft") return "left";
|
|
18
|
+
if (key === "ArrowRight") return "right";
|
|
19
|
+
if (key === "Enter" || key === " ") return oppositeDockablePanelSide(placement);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
16
22
|
//#endregion
|
|
17
|
-
export { clampDockablePanelPosition, dockablePanelSideAt, oppositeDockablePanelSide };
|
|
23
|
+
export { clampDockablePanelPosition, dockablePanelSideAt, dockablePanelSideForKey, oppositeDockablePanelSide };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonKnobStyle } from "../knob-contracts/button-knobs.js";
|
|
2
2
|
import { DockablePanelKnobStyle } from "../knob-contracts/dockable-panel-knobs.js";
|
|
3
|
-
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
3
|
+
import { CSSProperties, ComponentProps, ReactNode, RefObject } from "react";
|
|
4
4
|
//#region src/ui/dockable-panel.d.ts
|
|
5
5
|
export type DockablePanelPlacement = "left" | "right";
|
|
6
6
|
export type DockablePanelProps = Omit<ComponentProps<"aside">, "onChange" | "ref" | "style"> & {
|
|
@@ -10,15 +10,18 @@ export type DockablePanelProps = Omit<ComponentProps<"aside">, "onChange" | "ref
|
|
|
10
10
|
placement?: DockablePanelPlacement;
|
|
11
11
|
defaultPlacement?: DockablePanelPlacement;
|
|
12
12
|
onPlacementChange?: (placement: DockablePanelPlacement) => void;
|
|
13
|
+
finalFocus?: RefObject<HTMLElement | null>;
|
|
13
14
|
style?: CSSProperties & DockablePanelKnobStyle;
|
|
14
15
|
};
|
|
15
16
|
export type DockablePanelHeaderProps = Omit<ComponentProps<"div">, "style"> & {
|
|
16
17
|
style?: CSSProperties & DockablePanelKnobStyle;
|
|
17
18
|
};
|
|
18
|
-
export type DockablePanelDragHandleProps = Omit<ComponentProps<"
|
|
19
|
+
export type DockablePanelDragHandleProps = Omit<ComponentProps<"div">, "style"> & {
|
|
20
|
+
dragLabel?: string;
|
|
21
|
+
dockHintLabel?: string;
|
|
19
22
|
style?: CSSProperties & DockablePanelKnobStyle;
|
|
20
23
|
};
|
|
21
|
-
export type DockablePanelTitleProps = Omit<ComponentProps<"h2">, "style"> & {
|
|
24
|
+
export type DockablePanelTitleProps = Omit<ComponentProps<"h2">, "style" | "id"> & {
|
|
22
25
|
style?: CSSProperties & DockablePanelKnobStyle;
|
|
23
26
|
};
|
|
24
27
|
export type DockablePanelActionsProps = ComponentProps<"div"> & {
|
|
@@ -45,10 +48,10 @@ export type DockablePanelContentProps = ComponentProps<"div"> & {
|
|
|
45
48
|
padding?: DockablePanelContentPadding;
|
|
46
49
|
style?: CSSProperties & DockablePanelKnobStyle;
|
|
47
50
|
};
|
|
48
|
-
export declare function DockablePanel({ open: openProp, defaultOpen, onOpenChange, placement: placementProp, defaultPlacement, onPlacementChange, className, style, children, "aria-label": ariaLabel, ...props }: DockablePanelProps): import("react").JSX.Element | null;
|
|
51
|
+
export declare function DockablePanel({ open: openProp, defaultOpen, onOpenChange, placement: placementProp, defaultPlacement, onPlacementChange, finalFocus, className, style, children, "aria-label": ariaLabel, ...props }: DockablePanelProps): import("react").JSX.Element | null;
|
|
49
52
|
export declare function DockablePanelHeader({ className, ...props }: DockablePanelHeaderProps): import("react").JSX.Element;
|
|
50
|
-
export declare function DockablePanelDragHandle({ className, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, children, ...props }: DockablePanelDragHandleProps): import("react").JSX.Element;
|
|
51
|
-
export declare function DockablePanelTitle({ className, ...props }: DockablePanelTitleProps): import("react").JSX.Element;
|
|
53
|
+
export declare function DockablePanelDragHandle({ className, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, children, dragLabel, dockHintLabel, ...props }: DockablePanelDragHandleProps): import("react").JSX.Element;
|
|
54
|
+
export declare function DockablePanelTitle({ className, children, ...props }: DockablePanelTitleProps): import("react").JSX.Element;
|
|
52
55
|
export declare function DockablePanelActions({ className, ...props }: DockablePanelActionsProps): import("react").JSX.Element;
|
|
53
56
|
export declare function DockablePanelToggle({ className, children, "aria-label": ariaLabel, onClick, ...props }: DockablePanelToggleProps): import("react").JSX.Element | null;
|
|
54
57
|
export declare function DockablePanelDock({ placement: nextPlacement, className, children, "aria-label": ariaLabel, onClick, ...props }: DockablePanelDockProps): import("react").JSX.Element | null;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
+
import { LiveStatus } from "./live-status.js";
|
|
5
|
+
import { ScrollArea } from "./scroll-area.js";
|
|
4
6
|
import { useIsMobile } from "../hooks/use-mobile.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { createContext, use, useRef, useState } from "react";
|
|
7
|
+
import { Drawer, DrawerBody, DrawerContent } from "./drawer.js";
|
|
8
|
+
import { clampDockablePanelPosition, dockablePanelSideAt, dockablePanelSideForKey, oppositeDockablePanelSide } from "./dockable-panel-geometry.js";
|
|
9
|
+
import { createContext, use, useEffect, useEffectEvent, useId, useRef, useState } from "react";
|
|
8
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
11
|
//#region src/ui/dockable-panel.tsx
|
|
10
12
|
const DockablePanelContext = createContext(null);
|
|
@@ -22,24 +24,43 @@ function useControllableState(controlled, defaultValue, onChange) {
|
|
|
22
24
|
}
|
|
23
25
|
return [value, setValue];
|
|
24
26
|
}
|
|
25
|
-
function DockablePanel({ open: openProp, defaultOpen = true, onOpenChange, placement: placementProp, defaultPlacement = "right", onPlacementChange, className, style, children, "aria-label": ariaLabel = "Dockable panel", ...props }) {
|
|
27
|
+
function DockablePanel({ open: openProp, defaultOpen = true, onOpenChange, placement: placementProp, defaultPlacement = "right", onPlacementChange, finalFocus, className, style, children, "aria-label": ariaLabel = "Dockable panel", ...props }) {
|
|
26
28
|
const [open, setOpen] = useControllableState(openProp, defaultOpen, onOpenChange);
|
|
27
29
|
const [placement, setPlacementState] = useControllableState(placementProp, defaultPlacement, onPlacementChange);
|
|
28
30
|
const [dragging, setDragging] = useState(false);
|
|
29
31
|
const [potentialDock, setPotentialDock] = useState(placement);
|
|
30
32
|
const [dragPosition, setDragPosition] = useState(null);
|
|
31
33
|
const [dragHeight, setDragHeight] = useState(0);
|
|
34
|
+
const [announcement, setAnnouncement] = useState("");
|
|
32
35
|
const isMobile = useIsMobile();
|
|
36
|
+
const titleId = useId();
|
|
33
37
|
const panelRef = useRef(null);
|
|
34
38
|
const potentialDockRef = useRef(placement);
|
|
35
39
|
const dragRef = useRef(null);
|
|
40
|
+
const returnFocusRef = useRef(null);
|
|
41
|
+
const restoreFocusRef = useRef(false);
|
|
42
|
+
const restoreFocus = useEffectEvent(() => {
|
|
43
|
+
const target = finalFocus?.current ?? returnFocusRef.current;
|
|
44
|
+
if (target instanceof HTMLElement && target.isConnected) target.focus();
|
|
45
|
+
});
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (open) {
|
|
48
|
+
returnFocusRef.current = document.activeElement;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (!restoreFocusRef.current) return;
|
|
52
|
+
restoreFocusRef.current = false;
|
|
53
|
+
restoreFocus();
|
|
54
|
+
}, [open]);
|
|
36
55
|
function setPlacement(next) {
|
|
37
56
|
setPlacementState(next);
|
|
57
|
+
setAnnouncement(`Panel docked ${next}.`);
|
|
38
58
|
}
|
|
39
59
|
function togglePlacement() {
|
|
40
60
|
setPlacement(oppositeDockablePanelSide(placement));
|
|
41
61
|
}
|
|
42
62
|
function close() {
|
|
63
|
+
restoreFocusRef.current = panelRef.current?.contains(document.activeElement) ?? false;
|
|
43
64
|
setOpen(false);
|
|
44
65
|
}
|
|
45
66
|
function finishDrag(event, shouldDock) {
|
|
@@ -102,11 +123,11 @@ function DockablePanel({ open: openProp, defaultOpen = true, onOpenChange, place
|
|
|
102
123
|
}
|
|
103
124
|
const context = {
|
|
104
125
|
close,
|
|
105
|
-
dragging,
|
|
106
126
|
isMobile,
|
|
107
127
|
placement,
|
|
108
128
|
setPlacement,
|
|
109
129
|
togglePlacement,
|
|
130
|
+
titleId,
|
|
110
131
|
dragHandleProps: {
|
|
111
132
|
onPointerDown,
|
|
112
133
|
onPointerMove,
|
|
@@ -128,14 +149,16 @@ function DockablePanel({ open: openProp, defaultOpen = true, onOpenChange, place
|
|
|
128
149
|
children: /* @__PURE__ */ jsx(DrawerContent, {
|
|
129
150
|
"data-dockable-panel-root": "",
|
|
130
151
|
"data-placement": placement,
|
|
131
|
-
padding: "none",
|
|
132
152
|
variant: "floating",
|
|
133
153
|
surface: "card",
|
|
134
154
|
"aria-label": ariaLabel,
|
|
135
155
|
className: cn("max-h-[min(82vh,42rem)] gap-0 overflow-hidden", className),
|
|
136
156
|
style,
|
|
137
157
|
...props,
|
|
138
|
-
children
|
|
158
|
+
children: /* @__PURE__ */ jsx(DrawerBody, {
|
|
159
|
+
padding: "none",
|
|
160
|
+
children
|
|
161
|
+
})
|
|
139
162
|
})
|
|
140
163
|
})
|
|
141
164
|
});
|
|
@@ -165,15 +188,7 @@ function DockablePanel({ open: openProp, defaultOpen = true, onOpenChange, place
|
|
|
165
188
|
transform: `translate3d(${dragPosition.x}px, ${dragPosition.y}px, 0)`
|
|
166
189
|
} : style,
|
|
167
190
|
...props,
|
|
168
|
-
children: [children, /* @__PURE__ */
|
|
169
|
-
className: "sr-only",
|
|
170
|
-
"aria-live": "polite",
|
|
171
|
-
children: [
|
|
172
|
-
"Panel docked ",
|
|
173
|
-
placement,
|
|
174
|
-
"."
|
|
175
|
-
]
|
|
176
|
-
})]
|
|
191
|
+
children: [children, /* @__PURE__ */ jsx(LiveStatus, { message: announcement })]
|
|
177
192
|
})]
|
|
178
193
|
});
|
|
179
194
|
}
|
|
@@ -186,23 +201,28 @@ function DockablePanelHeader({ className, ...props }) {
|
|
|
186
201
|
...props
|
|
187
202
|
});
|
|
188
203
|
}
|
|
189
|
-
function DockablePanelDragHandle({ className, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, children, ...props }) {
|
|
204
|
+
function DockablePanelDragHandle({ className, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, children, dragLabel = "Drag panel", dockHintLabel = "Drag, or use arrow keys to dock", ...props }) {
|
|
190
205
|
const context = useDockablePanelContext();
|
|
206
|
+
const hintId = useId();
|
|
191
207
|
if (context.isMobile) return /* @__PURE__ */ jsx("div", {
|
|
192
208
|
"data-control-ui": "dockable-panel",
|
|
193
209
|
"data-control-family": "dockable-panel",
|
|
194
210
|
"data-slot": "drag-handle",
|
|
195
211
|
className: cn("flex min-w-0 flex-1 items-center self-stretch", className),
|
|
212
|
+
...props,
|
|
196
213
|
children
|
|
197
214
|
});
|
|
198
|
-
|
|
199
|
-
|
|
215
|
+
function dockWithKeyboard(event) {
|
|
216
|
+
const next = dockablePanelSideForKey(event.key, context.placement);
|
|
217
|
+
if (!next) return;
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
if (!event.repeat) context.setPlacement(next);
|
|
220
|
+
}
|
|
221
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
200
222
|
"data-control-ui": "dockable-panel",
|
|
201
223
|
"data-control-family": "dockable-panel",
|
|
202
224
|
"data-slot": "drag-handle",
|
|
203
|
-
|
|
204
|
-
"aria-pressed": context.dragging,
|
|
205
|
-
className: cn("flex min-w-0 flex-1 cursor-grab touch-none items-center self-stretch active:cursor-grabbing", className),
|
|
225
|
+
className: cn("relative flex min-w-0 flex-1 cursor-grab touch-none items-center self-stretch active:cursor-grabbing", className),
|
|
206
226
|
onPointerDown: (event) => {
|
|
207
227
|
onPointerDown?.(event);
|
|
208
228
|
if (!event.defaultPrevented) context.dragHandleProps.onPointerDown(event);
|
|
@@ -220,16 +240,39 @@ function DockablePanelDragHandle({ className, onPointerDown, onPointerMove, onPo
|
|
|
220
240
|
if (!event.defaultPrevented) context.dragHandleProps.onPointerCancel(event);
|
|
221
241
|
},
|
|
222
242
|
...props,
|
|
223
|
-
children
|
|
243
|
+
children: [
|
|
244
|
+
children,
|
|
245
|
+
/* @__PURE__ */ jsx("button", {
|
|
246
|
+
type: "button",
|
|
247
|
+
"data-control-ui": "dockable-panel",
|
|
248
|
+
"data-control-family": "dockable-panel",
|
|
249
|
+
"data-slot": "drag-button",
|
|
250
|
+
"aria-label": dragLabel,
|
|
251
|
+
"aria-labelledby": context.titleId,
|
|
252
|
+
"aria-describedby": hintId,
|
|
253
|
+
"aria-keyshortcuts": "ArrowLeft ArrowRight Enter Space",
|
|
254
|
+
className: "pointer-events-none absolute inset-0",
|
|
255
|
+
onKeyDown: dockWithKeyboard
|
|
256
|
+
}),
|
|
257
|
+
/* @__PURE__ */ jsx("span", {
|
|
258
|
+
id: hintId,
|
|
259
|
+
hidden: true,
|
|
260
|
+
children: dockHintLabel
|
|
261
|
+
})
|
|
262
|
+
]
|
|
224
263
|
});
|
|
225
264
|
}
|
|
226
|
-
function DockablePanelTitle({ className, ...props }) {
|
|
265
|
+
function DockablePanelTitle({ className, children, ...props }) {
|
|
266
|
+
const { titleId } = useDockablePanelContext();
|
|
227
267
|
return /* @__PURE__ */ jsx("h2", {
|
|
228
268
|
"data-control-ui": "dockable-panel",
|
|
229
269
|
"data-control-family": "dockable-panel",
|
|
230
270
|
"data-slot": "title",
|
|
231
271
|
className: cn("truncate", className),
|
|
232
|
-
|
|
272
|
+
title: typeof children === "string" ? children : void 0,
|
|
273
|
+
...props,
|
|
274
|
+
id: titleId,
|
|
275
|
+
children
|
|
233
276
|
});
|
|
234
277
|
}
|
|
235
278
|
function DockablePanelActions({ className, ...props }) {
|
|
@@ -237,7 +280,7 @@ function DockablePanelActions({ className, ...props }) {
|
|
|
237
280
|
"data-control-ui": "dockable-panel",
|
|
238
281
|
"data-control-family": "dockable-panel",
|
|
239
282
|
"data-slot": "actions",
|
|
240
|
-
className: cn("
|
|
283
|
+
className: cn("ms-auto flex shrink-0 items-center", className),
|
|
241
284
|
...props
|
|
242
285
|
});
|
|
243
286
|
}
|
|
@@ -303,13 +346,18 @@ function DockablePanelClose({ className, children, "aria-label": ariaLabel = "Cl
|
|
|
303
346
|
});
|
|
304
347
|
}
|
|
305
348
|
function DockablePanelContent({ padding = "default", className, ...props }) {
|
|
306
|
-
return /* @__PURE__ */ jsx(
|
|
307
|
-
"
|
|
308
|
-
"
|
|
309
|
-
|
|
310
|
-
"
|
|
311
|
-
|
|
312
|
-
|
|
349
|
+
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
350
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
351
|
+
viewportClassName: "min-h-0 flex-1",
|
|
352
|
+
lockAxis: "x",
|
|
353
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
354
|
+
"data-control-ui": "dockable-panel",
|
|
355
|
+
"data-control-family": "dockable-panel",
|
|
356
|
+
"data-slot": "content",
|
|
357
|
+
"data-padding": padding,
|
|
358
|
+
className,
|
|
359
|
+
...props
|
|
360
|
+
})
|
|
313
361
|
});
|
|
314
362
|
}
|
|
315
363
|
function DockablePanelDropZone({ side, active, style }) {
|
package/dist/ui/drawer.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { Drawer as Drawer$1 } from "@base-ui/react/drawer";
|
|
|
4
4
|
//#region src/ui/drawer.d.ts
|
|
5
5
|
export declare const drawerSides: readonly ["bottom", "top", "right", "left"];
|
|
6
6
|
export type DrawerSide = (typeof drawerSides)[number];
|
|
7
|
-
export declare const
|
|
8
|
-
export type
|
|
7
|
+
export declare const drawerBodyPaddings: readonly ["default", "none"];
|
|
8
|
+
export type DrawerBodyPadding = (typeof drawerBodyPaddings)[number];
|
|
9
9
|
export declare const drawerContentSurfaces: readonly ["background", "card"];
|
|
10
10
|
export type DrawerContentSurface = (typeof drawerContentSurfaces)[number];
|
|
11
11
|
export declare const drawerContentVariants: readonly ["edge", "floating"];
|
|
@@ -19,9 +19,8 @@ export declare function DrawerTrigger({ className, ...props }: ComponentProps<ty
|
|
|
19
19
|
export declare function DrawerClose({ className, ...props }: ComponentProps<typeof Drawer$1.Close> & {
|
|
20
20
|
style?: CSSProperties & PopupKnobStyle;
|
|
21
21
|
}): import("react").JSX.Element;
|
|
22
|
-
export declare function DrawerContent({ className, children, side,
|
|
22
|
+
export declare function DrawerContent({ className, children, side, surface, variant, style, ...props }: Omit<ComponentProps<typeof Drawer$1.Popup>, "style"> & {
|
|
23
23
|
side?: DrawerSide;
|
|
24
|
-
padding?: DrawerContentPadding;
|
|
25
24
|
surface?: DrawerContentSurface;
|
|
26
25
|
variant?: DrawerContentVariant;
|
|
27
26
|
style?: CSSProperties & PopupKnobStyle;
|
|
@@ -29,6 +28,10 @@ export declare function DrawerContent({ className, children, side, padding, surf
|
|
|
29
28
|
export declare function DrawerHeader({ className, ...props }: ComponentProps<"div"> & {
|
|
30
29
|
style?: CSSProperties & PopupKnobStyle;
|
|
31
30
|
}): import("react").JSX.Element;
|
|
31
|
+
export declare function DrawerBody({ className, padding, ...props }: Omit<ComponentProps<typeof Drawer$1.Content>, "style"> & {
|
|
32
|
+
padding?: DrawerBodyPadding;
|
|
33
|
+
style?: CSSProperties & PopupKnobStyle;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
32
35
|
export declare function DrawerFooter({ className, ...props }: ComponentProps<"div"> & {
|
|
33
36
|
style?: CSSProperties & PopupKnobStyle;
|
|
34
37
|
}): import("react").JSX.Element;
|
package/dist/ui/drawer.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
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 { createContext, useContext } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { Drawer as Drawer$1 } from "@base-ui/react/drawer";
|
|
7
8
|
//#region src/ui/drawer.tsx
|
|
@@ -11,7 +12,7 @@ const drawerSides = [
|
|
|
11
12
|
"right",
|
|
12
13
|
"left"
|
|
13
14
|
];
|
|
14
|
-
const
|
|
15
|
+
const drawerBodyPaddings = ["default", "none"];
|
|
15
16
|
const drawerContentSurfaces = ["background", "card"];
|
|
16
17
|
const drawerContentVariants = ["edge", "floating"];
|
|
17
18
|
const swipeFor = {
|
|
@@ -58,11 +59,16 @@ const placement = {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
};
|
|
62
|
+
const DrawerModalContext = createContext(true);
|
|
61
63
|
function Drawer(props) {
|
|
62
|
-
const { side = "bottom", swipeDirection, ...rest } = props;
|
|
63
|
-
return /* @__PURE__ */ jsx(
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const { side = "bottom", swipeDirection, modal = true, ...rest } = props;
|
|
65
|
+
return /* @__PURE__ */ jsx(DrawerModalContext, {
|
|
66
|
+
value: modal === true,
|
|
67
|
+
children: /* @__PURE__ */ jsx(Drawer$1.Root, {
|
|
68
|
+
swipeDirection: swipeDirection ?? swipeFor[side],
|
|
69
|
+
modal,
|
|
70
|
+
...rest
|
|
71
|
+
})
|
|
66
72
|
});
|
|
67
73
|
}
|
|
68
74
|
function DrawerTrigger({ className, ...props }) {
|
|
@@ -83,11 +89,15 @@ function DrawerClose({ className, ...props }) {
|
|
|
83
89
|
...props
|
|
84
90
|
});
|
|
85
91
|
}
|
|
86
|
-
function DrawerContent({ className, children, side = "bottom",
|
|
92
|
+
function DrawerContent({ className, children, side = "bottom", surface = "background", variant = "edge", style, ...props }) {
|
|
87
93
|
const skin = useSkin();
|
|
94
|
+
const modal = useContext(DrawerModalContext);
|
|
88
95
|
const place = placement[variant][side];
|
|
89
96
|
const grabbable = side === "bottom" || side === "top";
|
|
90
|
-
const backdropStyle = style ? {
|
|
97
|
+
const backdropStyle = style ? {
|
|
98
|
+
"--cui-popup-backdrop-background": style["--cui-popup-backdrop-background"],
|
|
99
|
+
"--cui-popup-backdrop-blur": style["--cui-popup-backdrop-blur"]
|
|
100
|
+
} : void 0;
|
|
91
101
|
return /* @__PURE__ */ jsxs(Drawer$1.Portal, { children: [/* @__PURE__ */ jsx(Drawer$1.Backdrop, {
|
|
92
102
|
"data-control-ui": "drawer",
|
|
93
103
|
"data-control-family": "popup",
|
|
@@ -96,7 +106,7 @@ function DrawerContent({ className, children, side = "bottom", padding = "defaul
|
|
|
96
106
|
"data-slot": "backdrop",
|
|
97
107
|
"data-skin": skin.id,
|
|
98
108
|
"data-effects": controlEffectsAttribute(skin.effects),
|
|
99
|
-
className: "fixed inset-0 z-(--z-overlay)",
|
|
109
|
+
className: cn("fixed inset-0 z-(--z-overlay)", !modal && "pointer-events-none"),
|
|
100
110
|
style: backdropStyle
|
|
101
111
|
}), /* @__PURE__ */ jsx(Drawer$1.Viewport, {
|
|
102
112
|
"data-control-ui": "drawer",
|
|
@@ -107,7 +117,7 @@ function DrawerContent({ className, children, side = "bottom", padding = "defaul
|
|
|
107
117
|
"data-variant": variant,
|
|
108
118
|
"data-skin": skin.id,
|
|
109
119
|
"data-effects": controlEffectsAttribute(skin.effects),
|
|
110
|
-
className: cn("fixed inset-0 z-(--z-modal) flex", place.viewport),
|
|
120
|
+
className: cn("fixed inset-0 z-(--z-modal) flex", place.viewport, !modal && "pointer-events-none"),
|
|
111
121
|
children: /* @__PURE__ */ jsxs(Drawer$1.Popup, {
|
|
112
122
|
"data-control-ui": "drawer",
|
|
113
123
|
"data-control-family": "popup",
|
|
@@ -116,10 +126,9 @@ function DrawerContent({ className, children, side = "bottom", padding = "defaul
|
|
|
116
126
|
"data-slot": "content",
|
|
117
127
|
"data-side": side,
|
|
118
128
|
"data-surface": "modal",
|
|
119
|
-
"data-padding": padding,
|
|
120
129
|
"data-surface-variant": surface,
|
|
121
130
|
"data-variant": variant,
|
|
122
|
-
className: cn("flex flex-col", place.popup, className),
|
|
131
|
+
className: cn("flex flex-col", place.popup, !modal && "pointer-events-auto", className),
|
|
123
132
|
style,
|
|
124
133
|
...props,
|
|
125
134
|
children: [grabbable ? /* @__PURE__ */ jsx("div", {
|
|
@@ -128,14 +137,7 @@ function DrawerContent({ className, children, side = "bottom", padding = "defaul
|
|
|
128
137
|
"data-popup-kind": "drawer",
|
|
129
138
|
"data-slot": "handle",
|
|
130
139
|
className: "shrink-0"
|
|
131
|
-
}) : null,
|
|
132
|
-
"data-control-ui": "drawer",
|
|
133
|
-
"data-control-family": "popup",
|
|
134
|
-
"data-popup-kind": "drawer",
|
|
135
|
-
"data-slot": "scroll",
|
|
136
|
-
className: "flex min-h-0 flex-1 flex-col overflow-y-auto",
|
|
137
|
-
children
|
|
138
|
-
})]
|
|
140
|
+
}) : null, children]
|
|
139
141
|
})
|
|
140
142
|
})] });
|
|
141
143
|
}
|
|
@@ -145,7 +147,18 @@ function DrawerHeader({ className, ...props }) {
|
|
|
145
147
|
"data-control-family": "popup",
|
|
146
148
|
"data-popup-kind": "drawer",
|
|
147
149
|
"data-slot": "header",
|
|
148
|
-
className: cn("flex flex-col", className),
|
|
150
|
+
className: cn("flex shrink-0 flex-col", className),
|
|
151
|
+
...props
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function DrawerBody({ className, padding = "default", ...props }) {
|
|
155
|
+
return /* @__PURE__ */ jsx(Drawer$1.Content, {
|
|
156
|
+
"data-control-ui": "drawer",
|
|
157
|
+
"data-control-family": "popup",
|
|
158
|
+
"data-popup-kind": "drawer",
|
|
159
|
+
"data-slot": "body",
|
|
160
|
+
"data-padding": padding,
|
|
161
|
+
className: cn("flex min-h-0 flex-1 flex-col overflow-y-auto", className),
|
|
149
162
|
...props
|
|
150
163
|
});
|
|
151
164
|
}
|
|
@@ -155,7 +168,7 @@ function DrawerFooter({ className, ...props }) {
|
|
|
155
168
|
"data-control-family": "popup",
|
|
156
169
|
"data-popup-kind": "drawer",
|
|
157
170
|
"data-slot": "footer",
|
|
158
|
-
className: cn("mt-auto flex flex-col", className),
|
|
171
|
+
className: cn("mt-auto flex shrink-0 flex-col sm:flex-row sm:justify-end", className),
|
|
159
172
|
...props
|
|
160
173
|
});
|
|
161
174
|
}
|
|
@@ -180,4 +193,4 @@ function DrawerDescription({ className, ...props }) {
|
|
|
180
193
|
});
|
|
181
194
|
}
|
|
182
195
|
//#endregion
|
|
183
|
-
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger,
|
|
196
|
+
export { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, drawerBodyPaddings, drawerContentSurfaces, drawerContentVariants, drawerSides };
|
package/dist/ui/dropdown-menu.js
CHANGED
|
@@ -30,7 +30,7 @@ function DropdownMenuTrigger({ size = "sm", iconOnly = false, variant = "surface
|
|
|
30
30
|
children
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function DropdownMenuContent({ className, children, side
|
|
33
|
+
function DropdownMenuContent({ className, children, side, sideOffset = 6, align = "start", alignOffset, collisionBoundary, collisionPadding, collisionAvoidance, ...props }) {
|
|
34
34
|
const skin = useSkin();
|
|
35
35
|
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
36
36
|
"data-skin": skin.id,
|
|
@@ -76,7 +76,7 @@ function DropdownMenuSeparator({ className, ...props }) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
function DropdownMenuLabel({ className, ...props }) {
|
|
79
|
-
return /* @__PURE__ */ jsx(
|
|
79
|
+
return /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
80
80
|
"data-control-ui": "dropdown-menu",
|
|
81
81
|
"data-slot": "label",
|
|
82
82
|
"data-control-family": "popup",
|
|
@@ -162,6 +162,7 @@ function DropdownMenuSubTrigger({ className, children, ...props }) {
|
|
|
162
162
|
"data-control-ui": "dropdown-menu",
|
|
163
163
|
"data-control-family": "popup",
|
|
164
164
|
"data-slot": "sub-trigger-indicator",
|
|
165
|
+
"data-icon-dir": "inline",
|
|
165
166
|
"aria-hidden": "true",
|
|
166
167
|
children: "›"
|
|
167
168
|
})]
|
|
@@ -171,7 +172,6 @@ function DropdownMenuSubContent(props) {
|
|
|
171
172
|
return /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
172
173
|
"data-control-ui": "dropdown-menu",
|
|
173
174
|
"data-slot": "sub-content",
|
|
174
|
-
side: "right",
|
|
175
175
|
sideOffset: 0,
|
|
176
176
|
alignOffset: -3,
|
|
177
177
|
...props
|
|
@@ -183,6 +183,7 @@ function DropdownMenuShortcut(props) {
|
|
|
183
183
|
"data-control-family": "popup",
|
|
184
184
|
"data-popup-part": "shortcut",
|
|
185
185
|
"data-slot": "shortcut",
|
|
186
|
+
"aria-hidden": "true",
|
|
186
187
|
...props
|
|
187
188
|
});
|
|
188
189
|
}
|
package/dist/ui/dropzone.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type DropzoneProps = Omit<ComponentProps<"div">, "defaultValue" | "onChan
|
|
|
11
11
|
onValueChange?: (value: readonly File[], details: DropzoneValueChangeDetails) => void;
|
|
12
12
|
policy?: DropzonePolicy;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
drag?: boolean;
|
|
15
|
+
paste?: boolean;
|
|
14
16
|
getFilesFromEvent?: DropzoneGetFilesFromEvent;
|
|
15
17
|
onDrop?: (details: DropzoneDropDetails) => void;
|
|
16
18
|
onError?: (error: Error) => void;
|
|
@@ -52,15 +54,15 @@ export type DropzoneRemoveProps = ComponentProps<typeof Button> & {
|
|
|
52
54
|
};
|
|
53
55
|
export type DropzoneClearProps = ComponentProps<typeof Button>;
|
|
54
56
|
export declare function useDropzoneContext(): DropzoneContextValue;
|
|
55
|
-
export declare function Dropzone({ value, defaultValue, onValueChange, policy, disabled, getFilesFromEvent, onDrop, onError, className, children, ...props }: DropzoneProps): import("react").JSX.Element;
|
|
57
|
+
export declare function Dropzone({ value, defaultValue, onValueChange, policy, disabled, drag, paste, getFilesFromEvent, onDrop, onError, className, children, ...props }: DropzoneProps): import("react").JSX.Element;
|
|
56
58
|
export declare function DropzoneArea({ className, ...props }: DropzoneAreaProps): import("react").JSX.Element;
|
|
57
59
|
export declare function DropzoneInput({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: DropzoneInputProps): import("react").JSX.Element;
|
|
58
|
-
export declare function DropzoneTrigger({ className, children, onClick, disabled, ...props }: DropzoneTriggerProps): import("react").JSX.Element;
|
|
60
|
+
export declare function DropzoneTrigger({ className, children, onClick, disabled, ref, ...props }: DropzoneTriggerProps): import("react").JSX.Element;
|
|
59
61
|
export declare function DropzoneOverlay({ scope, className, children, ...props }: DropzoneOverlayProps): import("react").JSX.Element;
|
|
60
62
|
export declare function DropzoneFileList({ className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: DropzoneFileListProps): import("react").JSX.Element;
|
|
61
63
|
export declare function DropzoneRejectionList({ className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: DropzoneRejectionListProps): import("react").JSX.Element;
|
|
62
64
|
export declare function DropzoneStatus({ className, children, role, "aria-live": ariaLive, ...props }: DropzoneStatusProps): import("react").JSX.Element;
|
|
63
|
-
export declare function DropzoneRemove({ file, children, onClick, disabled, ...props }: DropzoneRemoveProps): import("react").JSX.Element;
|
|
65
|
+
export declare function DropzoneRemove({ file, children, onClick, disabled, ref, ...props }: DropzoneRemoveProps): import("react").JSX.Element;
|
|
64
66
|
export declare function DropzoneClear({ children, onClick, disabled, ...props }: DropzoneClearProps): import("react").JSX.Element;
|
|
65
67
|
//#endregion
|
|
66
68
|
export { type DropzoneAccept, type DropzoneDropDetails, DropzoneErrorCode, type DropzoneErrorCodeValue, type DropzoneEvent, type DropzoneFileError, type DropzoneFileRejection, type DropzoneGetFilesFromEvent, type DropzonePolicy, type DropzoneSelectionMode, type DropzoneValidator, type DropzoneValidatorResult, type DropzoneValueChangeDetails, type DropzoneValueChangeReason, type DropzoneVisualState, type UseDropzoneOptions, type UseDropzoneReturn, formatDropzoneFileSize, useDropzone };
|