@ctrl-ui/react 0.9.5 → 0.9.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/README.md +38 -2
- package/dist/action-bar.js +16 -8
- package/dist/activity.d.ts +4 -2
- package/dist/activity.js +5 -2
- package/dist/audio-visualizer.js +1 -1
- package/dist/blocks/agent-run-clock.d.ts +5 -0
- package/dist/blocks/agent-run-clock.js +52 -0
- package/dist/blocks/agent-run-sidebar.d.ts +13 -0
- package/dist/blocks/agent-run-sidebar.js +101 -0
- package/dist/blocks/agent-run-status.d.ts +32 -0
- package/dist/blocks/agent-run-status.js +27 -0
- package/dist/blocks/agent-run.d.ts +82 -0
- package/dist/blocks/agent-run.js +262 -0
- package/dist/blocks/coding-agent.d.ts +1 -1
- package/dist/blocks/coding-agent.js +50 -69
- package/dist/blocks/design-canvas-data.d.ts +1 -1
- package/dist/blocks/design-canvas-inspector.js +1 -1
- package/dist/blocks/design-canvas.d.ts +2 -1
- package/dist/blocks/design-canvas.js +56 -42
- package/dist/blocks/discussion.js +1 -1
- package/dist/blocks/file-explorer.js +66 -47
- package/dist/blocks/settings.js +37 -41
- package/dist/blocks/team-chat.js +2 -1
- package/dist/blocks/theme-toggle.d.ts +2 -1
- package/dist/blocks/theme-toggle.js +13 -4
- package/dist/chat-message.js +33 -39
- package/dist/hooks/use-mobile.d.ts +1 -1
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/knob-contracts/badge-knobs.d.ts +1 -1
- package/dist/knob-contracts/badge-knobs.js +3 -1
- package/dist/knob-contracts/button-knobs.d.ts +1 -1
- package/dist/knob-contracts/button-knobs.js +1 -0
- package/dist/knob-contracts/calendar-knobs.d.ts +1 -1
- package/dist/knob-contracts/calendar-knobs.js +9 -1
- package/dist/knob-contracts/card-knobs.d.ts +1 -1
- package/dist/knob-contracts/card-knobs.js +5 -1
- package/dist/knob-contracts/choice-knobs.d.ts +1 -1
- package/dist/knob-contracts/choice-knobs.js +1 -0
- package/dist/knob-contracts/collapsible-knobs.d.ts +1 -1
- package/dist/knob-contracts/collapsible-knobs.js +5 -1
- package/dist/knob-contracts/emoji-picker-knobs.d.ts +1 -1
- package/dist/knob-contracts/emoji-picker-knobs.js +3 -1
- package/dist/knob-contracts/field-knobs.d.ts +1 -1
- package/dist/knob-contracts/field-knobs.js +17 -1
- package/dist/knob-contracts/infinite-canvas-knobs.d.ts +1 -1
- package/dist/knob-contracts/infinite-canvas-knobs.js +1 -7
- package/dist/knob-contracts/item-knobs.d.ts +1 -1
- package/dist/knob-contracts/item-knobs.js +5 -1
- package/dist/knob-contracts/kbd-knobs.d.ts +1 -1
- package/dist/knob-contracts/kbd-knobs.js +4 -1
- package/dist/knob-contracts/page-layout-knobs.d.ts +1 -1
- package/dist/knob-contracts/page-layout-knobs.js +1 -0
- package/dist/knob-contracts/pagination-knobs.d.ts +1 -1
- package/dist/knob-contracts/pagination-knobs.js +2 -1
- package/dist/knob-contracts/popup-knobs.d.ts +1 -1
- package/dist/knob-contracts/popup-knobs.js +9 -0
- package/dist/knob-contracts/range-knobs.d.ts +1 -1
- package/dist/knob-contracts/range-knobs.js +2 -0
- package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
- package/dist/knob-contracts/sidebar-knobs.js +2 -0
- package/dist/knob-contracts/swap-knobs.d.ts +4 -0
- package/dist/knob-contracts/swap-knobs.js +9 -0
- package/dist/knob-contracts/tabs-knobs.d.ts +1 -1
- package/dist/knob-contracts/tabs-knobs.js +3 -0
- package/dist/knob-contracts/timeline-knobs.d.ts +1 -1
- package/dist/knob-contracts/timeline-knobs.js +5 -1
- package/dist/knob-contracts/tool-approval-knobs.d.ts +4 -0
- package/dist/knob-contracts/tool-approval-knobs.js +32 -0
- package/dist/knob-contracts/tree-knobs.d.ts +1 -1
- package/dist/knob-contracts/tree-knobs.js +3 -1
- package/dist/lib/infinite-canvas-camera-store.d.ts +65 -0
- package/dist/lib/infinite-canvas-camera-store.js +233 -0
- package/dist/lib/infinite-canvas-camera.d.ts +33 -0
- package/dist/lib/infinite-canvas-camera.js +98 -0
- package/dist/lib/infinite-canvas-navigation.d.ts +19 -0
- package/dist/lib/infinite-canvas-navigation.js +395 -0
- package/dist/markdown-editor/bubble-menu.d.ts +6 -0
- package/dist/markdown-editor/bubble-menu.js +45 -0
- package/dist/markdown-editor/toolbar.d.ts +17 -1
- package/dist/markdown-editor/toolbar.js +103 -81
- package/dist/skin.d.ts +2 -0
- package/dist/styles/index.css +11 -10
- package/dist/styles/recipes/activity.css +12 -0
- package/dist/styles/recipes/avatar.css +1 -1
- package/dist/styles/recipes/badge.css +17 -0
- package/dist/styles/recipes/button-group.css +12 -6
- package/dist/styles/recipes/button.css +20 -3
- package/dist/styles/recipes/calendar.css +82 -6
- package/dist/styles/recipes/card.css +40 -5
- package/dist/styles/recipes/chat-message-edit.css +6 -21
- package/dist/styles/recipes/choice.css +9 -2
- package/dist/styles/recipes/collapsible.css +8 -1
- package/dist/styles/recipes/color-picker-values.css +4 -0
- package/dist/styles/recipes/emoji-picker.css +29 -8
- package/dist/styles/recipes/field-parts.css +80 -5
- package/dist/styles/recipes/field.css +113 -40
- package/dist/styles/recipes/infinite-canvas.css +17 -57
- package/dist/styles/recipes/item.css +33 -5
- package/dist/styles/recipes/kbd.css +26 -6
- package/dist/styles/recipes/markdown-editor.css +12 -0
- package/dist/styles/recipes/morphing-panel.css +1 -1
- package/dist/styles/recipes/page-layout.css +18 -2
- package/dist/styles/recipes/pagination.css +8 -0
- package/dist/styles/recipes/popup-controls.css +9 -0
- package/dist/styles/recipes/popup-drawer.css +1 -0
- package/dist/styles/recipes/popup-lists.css +55 -6
- package/dist/styles/recipes/popup-motion.css +7 -1
- package/dist/styles/recipes/popup.css +10 -0
- package/dist/styles/recipes/range.css +16 -2
- package/dist/styles/recipes/sidebar-mobile.css +1 -1
- package/dist/styles/recipes/sidebar-parts.css +17 -1
- package/dist/styles/recipes/sidebar.css +11 -0
- package/dist/styles/recipes/swap.css +143 -0
- package/dist/styles/recipes/tabs.css +41 -8
- package/dist/styles/recipes/timeline.css +36 -2
- package/dist/styles/recipes/tool-approval.css +267 -0
- package/dist/styles/recipes/track-highlight.css +19 -6
- package/dist/styles/recipes/tree.css +33 -0
- package/dist/styles/theme.css +17 -6
- package/dist/tool-approval.d.ts +49 -0
- package/dist/tool-approval.js +260 -0
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/calendar.js +9 -4
- package/dist/ui/card.d.ts +3 -1
- package/dist/ui/card.js +2 -1
- package/dist/ui/code.js +13 -3
- package/dist/ui/command.js +1 -0
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dropdown-menu.d.ts +1 -1
- package/dist/ui/dropdown-menu.js +23 -6
- package/dist/ui/dropzone.js +10 -11
- package/dist/ui/field.d.ts +6 -2
- package/dist/ui/field.js +4 -2
- package/dist/ui/infinite-canvas.d.ts +19 -22
- package/dist/ui/infinite-canvas.js +264 -325
- package/dist/ui/morphing-panel.d.ts +5 -1
- package/dist/ui/morphing-panel.js +4 -2
- package/dist/ui/rich-tooltip.d.ts +2 -1
- package/dist/ui/rich-tooltip.js +32 -29
- package/dist/ui/select.js +2 -2
- package/dist/ui/sidebar-mobile.js +1 -1
- package/dist/ui/sidebar-provider.d.ts +3 -1
- package/dist/ui/sidebar-provider.js +3 -2
- package/dist/ui/sidebar-resize-rail.js +1 -1
- package/dist/ui/sidebar.d.ts +6 -5
- package/dist/ui/sidebar.js +10 -9
- package/dist/ui/swap.d.ts +14 -0
- package/dist/ui/swap.js +69 -0
- package/dist/ui/tabs.d.ts +1 -1
- package/dist/ui/tabs.js +2 -13
- package/dist/ui/timeline.d.ts +1 -1
- package/dist/ui/timeline.js +2 -2
- package/dist/ui/typography.d.ts +11 -5
- package/dist/ui/typography.js +18 -6
- package/dist/user-ask.js +1 -1
- package/lint/biome-preset.json +3 -0
- package/lint/class-policy.mjs +17 -0
- package/lint/eslint-plugin.mjs +87 -0
- package/lint/grit-rules.mjs +40 -0
- package/lint/no-component-style-classes.grit +16 -0
- package/lint/no-raw-type-classes.grit +3 -4
- package/lint/write-grit-rules.mjs +19 -0
- package/package.json +12 -3
- package/dist/styles/type-scale.css +0 -72
|
@@ -182,12 +182,14 @@ function MorphingPanelHeader({ className, ...props }) {
|
|
|
182
182
|
className: cn("flex shrink-0 items-center", className)
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
const morphingPanelBodyPaddings = ["default", "none"];
|
|
186
|
+
function MorphingPanelBody({ className, padding = "default", ...props }) {
|
|
186
187
|
return /* @__PURE__ */ jsx("div", {
|
|
187
188
|
...props,
|
|
188
189
|
"data-control-ui": "morphing-panel",
|
|
189
190
|
"data-control-family": "morphing-panel",
|
|
190
191
|
"data-slot": "body",
|
|
192
|
+
"data-padding": padding,
|
|
191
193
|
className: cn("min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain", className)
|
|
192
194
|
});
|
|
193
195
|
}
|
|
@@ -201,4 +203,4 @@ function MorphingPanelFooter({ className, ...props }) {
|
|
|
201
203
|
});
|
|
202
204
|
}
|
|
203
205
|
//#endregion
|
|
204
|
-
export { MorphingPanel, MorphingPanelBody, MorphingPanelClose, MorphingPanelContent, MorphingPanelFooter, MorphingPanelHeader, MorphingPanelPositioner, MorphingPanelTrigger };
|
|
206
|
+
export { MorphingPanel, MorphingPanelBody, MorphingPanelClose, MorphingPanelContent, MorphingPanelFooter, MorphingPanelHeader, MorphingPanelPositioner, MorphingPanelTrigger, morphingPanelBodyPaddings };
|
|
@@ -48,8 +48,9 @@ export type RichTooltipContentProps = Omit<ComponentProps<typeof Popover.Popup>,
|
|
|
48
48
|
collisionPadding?: ComponentProps<typeof Popover.Positioner>["collisionPadding"];
|
|
49
49
|
arrow?: boolean;
|
|
50
50
|
scrollAnchorIntoView?: boolean;
|
|
51
|
+
container?: ComponentProps<typeof Popover.Portal>["container"];
|
|
51
52
|
};
|
|
52
|
-
export declare function RichTooltipContent({ className, children, side, align, sideOffset, anchor, collisionPadding, arrow, scrollAnchorIntoView, ...props }: RichTooltipContentProps): import("react").JSX.Element;
|
|
53
|
+
export declare function RichTooltipContent({ className, children, side, align, sideOffset, anchor, collisionPadding, arrow, scrollAnchorIntoView, container, ...props }: RichTooltipContentProps): import("react").JSX.Element;
|
|
53
54
|
export declare function RichTooltipMedia({ className, ...props }: ComponentProps<"div"> & {
|
|
54
55
|
style?: CSSProperties & PopupKnobStyle;
|
|
55
56
|
}): import("react").JSX.Element;
|
package/dist/ui/rich-tooltip.js
CHANGED
|
@@ -146,7 +146,7 @@ function useAnchorScroll(anchor, open, enabled) {
|
|
|
146
146
|
]);
|
|
147
147
|
}
|
|
148
148
|
const richTooltipContentSelector = "[data-control-ui=\"rich-tooltip\"][data-slot=\"content\"]";
|
|
149
|
-
function RichTooltipContent({ className, children, side = "bottom", align = "center", sideOffset = 10, anchor, collisionPadding = 12, arrow = true, scrollAnchorIntoView = true, ...props }) {
|
|
149
|
+
function RichTooltipContent({ className, children, side = "bottom", align = "center", sideOffset = 10, anchor, collisionPadding = 12, arrow = true, scrollAnchorIntoView = true, container, ...props }) {
|
|
150
150
|
const skin = useSkin();
|
|
151
151
|
const { tone, inTour, nextRef, descriptionId, progressId } = useRichTooltipContext();
|
|
152
152
|
const isSurface = tone === "surface";
|
|
@@ -159,42 +159,45 @@ function RichTooltipContent({ className, children, side = "bottom", align = "cen
|
|
|
159
159
|
if (openedWithoutInteraction && focusIsElsewhere) return false;
|
|
160
160
|
return inTour && nextRef.current ? nextRef.current : true;
|
|
161
161
|
};
|
|
162
|
-
return /* @__PURE__ */ jsx(Popover.Portal, {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"data-control-family": "popup",
|
|
166
|
-
"data-slot": "positioner",
|
|
167
|
-
"data-skin": skin.id,
|
|
168
|
-
"data-effects": controlEffectsAttribute(skin.effects),
|
|
169
|
-
side,
|
|
170
|
-
align,
|
|
171
|
-
sideOffset,
|
|
172
|
-
anchor,
|
|
173
|
-
collisionPadding,
|
|
174
|
-
className: "z-(--z-popup)",
|
|
175
|
-
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
162
|
+
return /* @__PURE__ */ jsx(Popover.Portal, {
|
|
163
|
+
container,
|
|
164
|
+
children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
176
165
|
"data-control-ui": "rich-tooltip",
|
|
177
166
|
"data-popup-kind": "rich-tooltip",
|
|
178
167
|
"data-control-family": "popup",
|
|
179
|
-
"data-slot": "
|
|
180
|
-
"data-
|
|
181
|
-
"data-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
168
|
+
"data-slot": "positioner",
|
|
169
|
+
"data-skin": skin.id,
|
|
170
|
+
"data-effects": controlEffectsAttribute(skin.effects),
|
|
171
|
+
side,
|
|
172
|
+
align,
|
|
173
|
+
sideOffset,
|
|
174
|
+
anchor,
|
|
175
|
+
collisionPadding,
|
|
176
|
+
className: "z-(--z-popup)",
|
|
177
|
+
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
188
178
|
"data-control-ui": "rich-tooltip",
|
|
189
179
|
"data-popup-kind": "rich-tooltip",
|
|
190
180
|
"data-control-family": "popup",
|
|
191
|
-
"data-slot": "
|
|
181
|
+
"data-slot": "content",
|
|
192
182
|
"data-tone": tone,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
183
|
+
"data-surface": isSurface ? "floating" : void 0,
|
|
184
|
+
"data-popup-part": isSurface ? "surface" : void 0,
|
|
185
|
+
className: cn("relative grid w-80 max-w-[calc(100vw-2rem)]", className),
|
|
186
|
+
initialFocus,
|
|
187
|
+
"aria-describedby": describedBy,
|
|
188
|
+
...props,
|
|
189
|
+
children: [children, arrow ? /* @__PURE__ */ jsx(Popover.Arrow, {
|
|
190
|
+
"data-control-ui": "rich-tooltip",
|
|
191
|
+
"data-popup-kind": "rich-tooltip",
|
|
192
|
+
"data-control-family": "popup",
|
|
193
|
+
"data-slot": "arrow",
|
|
194
|
+
"data-tone": tone,
|
|
195
|
+
className: "flex",
|
|
196
|
+
children: /* @__PURE__ */ jsx(PopupArrowShape, {})
|
|
197
|
+
}) : null]
|
|
198
|
+
})
|
|
196
199
|
})
|
|
197
|
-
})
|
|
200
|
+
});
|
|
198
201
|
}
|
|
199
202
|
function RichTooltipMedia({ className, ...props }) {
|
|
200
203
|
return /* @__PURE__ */ jsx("div", {
|
package/dist/ui/select.js
CHANGED
|
@@ -81,7 +81,7 @@ function SelectValue({ children, ...props }) {
|
|
|
81
81
|
children
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
function SelectContent({ className, children, alignItemWithTrigger
|
|
84
|
+
function SelectContent({ className, children, alignItemWithTrigger, ...props }) {
|
|
85
85
|
const skin = useSkin();
|
|
86
86
|
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
87
87
|
"data-skin": skin.id,
|
|
@@ -89,7 +89,7 @@ function SelectContent({ className, children, alignItemWithTrigger = false, ...p
|
|
|
89
89
|
side: "bottom",
|
|
90
90
|
align: "start",
|
|
91
91
|
sideOffset: 6,
|
|
92
|
-
alignItemWithTrigger,
|
|
92
|
+
alignItemWithTrigger: alignItemWithTrigger ?? skin.selectAlignItemWithTrigger ?? false,
|
|
93
93
|
className: "z-(--z-popup)",
|
|
94
94
|
children: /* @__PURE__ */ jsx(Select$1.Popup, {
|
|
95
95
|
"data-control-ui": "select",
|
|
@@ -14,7 +14,7 @@ function SidebarMobileNav({ variant = "bar", "aria-label": label = "Mobile navig
|
|
|
14
14
|
"data-slot": "mobile-nav-container",
|
|
15
15
|
"data-layout": layout,
|
|
16
16
|
"data-variant": variant,
|
|
17
|
-
className: "shrink-0
|
|
17
|
+
className: "shrink-0 sidebar:hidden",
|
|
18
18
|
style,
|
|
19
19
|
children: /* @__PURE__ */ jsx("nav", {
|
|
20
20
|
...props,
|
|
@@ -6,6 +6,7 @@ export type SidebarStyle = CSSProperties & SidebarKnobStyle & {
|
|
|
6
6
|
"--sidebar-width-icon"?: string;
|
|
7
7
|
};
|
|
8
8
|
export type SidebarLayoutMode = "viewport" | "contained";
|
|
9
|
+
export type SidebarWrapperSurface = "transparent" | "background";
|
|
9
10
|
type SidebarContextProps = {
|
|
10
11
|
state: "expanded" | "collapsed";
|
|
11
12
|
open: boolean;
|
|
@@ -55,9 +56,10 @@ export type SidebarProviderProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
55
56
|
persistOpen?: boolean;
|
|
56
57
|
keyboardShortcut?: string | null;
|
|
57
58
|
layout?: SidebarLayoutMode;
|
|
59
|
+
surface?: SidebarWrapperSurface;
|
|
58
60
|
skipLinkLabel?: string;
|
|
59
61
|
contentId?: string;
|
|
60
62
|
style?: SidebarStyle;
|
|
61
63
|
};
|
|
62
|
-
export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange, defaultWidth, minWidth, maxWidth, width: widthProp, onWidthChange, persistOpen, keyboardShortcut, layout, skipLinkLabel, contentId: contentIdProp, ref, className, style, children, ...props }: SidebarProviderProps): import("react").JSX.Element;
|
|
64
|
+
export declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange, defaultWidth, minWidth, maxWidth, width: widthProp, onWidthChange, persistOpen, keyboardShortcut, layout, surface, skipLinkLabel, contentId: contentIdProp, ref, className, style, children, ...props }: SidebarProviderProps): import("react").JSX.Element;
|
|
63
65
|
//#endregion
|
|
@@ -9,7 +9,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
//#region src/ui/sidebar-provider.tsx
|
|
10
10
|
const SIDEBAR_COOKIE_MAX_AGE = 604800;
|
|
11
11
|
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
12
|
-
const SIDEBAR_MOBILE_BREAKPOINT = "--breakpoint-
|
|
12
|
+
const SIDEBAR_MOBILE_BREAKPOINT = "--breakpoint-sidebar";
|
|
13
13
|
const SidebarElementsContext = createContext(null);
|
|
14
14
|
const SidebarSurfaceContext = createContext(null);
|
|
15
15
|
function useSidebarElements() {
|
|
@@ -35,7 +35,7 @@ function useSidebar() {
|
|
|
35
35
|
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
36
36
|
return context;
|
|
37
37
|
}
|
|
38
|
-
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange, defaultWidth, minWidth = 224, maxWidth = 420, width: widthProp, onWidthChange, persistOpen = true, keyboardShortcut = SIDEBAR_KEYBOARD_SHORTCUT, layout = "viewport", skipLinkLabel = "Skip to content", contentId: contentIdProp, ref, className, style, children, ...props }) {
|
|
38
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange, defaultWidth, minWidth = 224, maxWidth = 420, width: widthProp, onWidthChange, persistOpen = true, keyboardShortcut = SIDEBAR_KEYBOARD_SHORTCUT, layout = "viewport", surface = "transparent", skipLinkLabel = "Skip to content", contentId: contentIdProp, ref, className, style, children, ...props }) {
|
|
39
39
|
const isMobile = useIsMobile(SIDEBAR_MOBILE_BREAKPOINT);
|
|
40
40
|
const [openMobile, setOpenMobile] = useState(false);
|
|
41
41
|
if (!isMobile && openMobile) setOpenMobile(false);
|
|
@@ -135,6 +135,7 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange, def
|
|
|
135
135
|
"data-control-family": "sidebar",
|
|
136
136
|
"data-slot": "wrapper",
|
|
137
137
|
"data-layout": layout,
|
|
138
|
+
"data-surface": surface,
|
|
138
139
|
style: wrapperStyle,
|
|
139
140
|
className: cn("group/sidebar-wrapper relative flex w-full", layout === "contained" ? "h-full min-h-0 overflow-hidden" : "min-h-svh", className),
|
|
140
141
|
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("a", {
|
|
@@ -183,7 +183,7 @@ function SidebarResizeRail({ className, ref, onPointerDown, onClick, onKeyDown,
|
|
|
183
183
|
onPointerDown: handlePointerDown,
|
|
184
184
|
onClick: handleClick,
|
|
185
185
|
onKeyDown: handleKeyDown,
|
|
186
|
-
className: cn("absolute inset-y-0 z-20 hidden cursor-col-resize touch-pan-y group-data-[side=left]:-end-1 group-data-[side=right]:-start-1 group-data-[side=left]:group-data-[collapsible=offcanvas]:-end-2 group-data-[side=right]:group-data-[collapsible=offcanvas]:-start-2
|
|
186
|
+
className: cn("absolute inset-y-0 z-20 hidden cursor-col-resize touch-pan-y group-data-[side=left]:-end-1 group-data-[side=right]:-start-1 group-data-[side=left]:group-data-[collapsible=offcanvas]:-end-2 group-data-[side=right]:group-data-[collapsible=offcanvas]:-start-2 sidebar:block", className),
|
|
187
187
|
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
188
188
|
ref: widthMeasureRef,
|
|
189
189
|
"aria-hidden": true,
|
package/dist/ui/sidebar.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ import { SidebarMobileNav, SidebarMobileNavItem, SidebarMobileNavProps, SidebarM
|
|
|
8
8
|
import { SidebarLayoutMode, SidebarProvider, SidebarProviderProps, SidebarStyle, useSidebar } from "./sidebar-provider.js";
|
|
9
9
|
import { CSSProperties, ComponentProps } from "react";
|
|
10
10
|
//#region src/ui/sidebar.d.ts
|
|
11
|
-
export type SidebarRailProps = (
|
|
12
|
-
resizable?:
|
|
11
|
+
export type SidebarRailProps = (SidebarResizeRailProps & {
|
|
12
|
+
resizable?: true;
|
|
13
|
+
}) | (Omit<ComponentProps<"button">, "style"> & {
|
|
14
|
+
resizable: false;
|
|
13
15
|
style?: CSSProperties & SidebarKnobStyle;
|
|
14
|
-
}) | (SidebarResizeRailProps & {
|
|
15
|
-
resizable: true;
|
|
16
16
|
});
|
|
17
17
|
export type SidebarInsetProps = Omit<ComponentProps<"main">, "style" | "id"> & {
|
|
18
18
|
render?: RenderProp<ComponentProps<"main">>;
|
|
@@ -33,7 +33,8 @@ export declare function SidebarTrigger({ className, onClick, size, label, ref, .
|
|
|
33
33
|
}): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
34
34
|
export declare function SidebarRail(props: SidebarRailProps): any;
|
|
35
35
|
export declare function SidebarInset({ className, render, ref, ...props }: SidebarInsetProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
36
|
-
export declare function SidebarHeader({ className, ...props }: ComponentProps<"div"> & {
|
|
36
|
+
export declare function SidebarHeader({ className, divider, ...props }: ComponentProps<"div"> & {
|
|
37
|
+
divider?: boolean;
|
|
37
38
|
style?: CSSProperties & SidebarKnobStyle;
|
|
38
39
|
}): import("react").JSX.Element;
|
|
39
40
|
export declare function SidebarFooter({ className, ...props }: ComponentProps<"div"> & {
|
package/dist/ui/sidebar.js
CHANGED
|
@@ -53,7 +53,7 @@ function SidebarSurface({ variant, mobileVariant = "sheet", label = "Navigation"
|
|
|
53
53
|
"data-control-family": "sidebar",
|
|
54
54
|
"data-slot": "container",
|
|
55
55
|
tabIndex: -1,
|
|
56
|
-
className: cn(layout === "contained" ? "absolute h-full" : "fixed h-svh", "inset-y-0 z-10 hidden w-(--sidebar-width)
|
|
56
|
+
className: cn(layout === "contained" ? "absolute h-full" : "fixed h-svh", "inset-y-0 z-10 hidden w-(--sidebar-width) sidebar:flex", side === "left" ? "start-0" : "end-0", padded ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)", className),
|
|
57
57
|
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
58
58
|
"data-control-ui": "sidebar",
|
|
59
59
|
"data-control-family": "sidebar",
|
|
@@ -94,7 +94,7 @@ function SidebarSurface({ variant, mobileVariant = "sheet", label = "Navigation"
|
|
|
94
94
|
})]
|
|
95
95
|
});
|
|
96
96
|
return /* @__PURE__ */ jsxs("div", {
|
|
97
|
-
className: cn("group peer hidden
|
|
97
|
+
className: cn("group peer hidden sidebar:block", side === "right" && "order-last"),
|
|
98
98
|
"data-control-ui": "sidebar",
|
|
99
99
|
"data-control-family": "sidebar",
|
|
100
100
|
"data-slot": "root",
|
|
@@ -232,12 +232,12 @@ function SidebarRail(props) {
|
|
|
232
232
|
const { isMobile } = useSidebar();
|
|
233
233
|
const { railContainer } = useSidebarSurface();
|
|
234
234
|
if (isMobile || !railContainer) return null;
|
|
235
|
-
if (props.resizable) {
|
|
236
|
-
const { resizable, ...
|
|
237
|
-
return createPortal(/* @__PURE__ */ jsx(
|
|
235
|
+
if (props.resizable === false) {
|
|
236
|
+
const { resizable, ...toggleProps } = props;
|
|
237
|
+
return createPortal(/* @__PURE__ */ jsx(SidebarToggleRail, { ...toggleProps }), railContainer);
|
|
238
238
|
}
|
|
239
|
-
const { resizable, ...
|
|
240
|
-
return createPortal(/* @__PURE__ */ jsx(
|
|
239
|
+
const { resizable, ...resizeProps } = props;
|
|
240
|
+
return createPortal(/* @__PURE__ */ jsx(SidebarResizeRail, { ...resizeProps }), railContainer);
|
|
241
241
|
}
|
|
242
242
|
function SidebarToggleRail({ className, ref, onClick, ...props }) {
|
|
243
243
|
const { toggleSidebar, open } = useSidebar();
|
|
@@ -259,7 +259,7 @@ function SidebarToggleRail({ className, ref, onClick, ...props }) {
|
|
|
259
259
|
if (!event.defaultPrevented) toggleSidebar();
|
|
260
260
|
},
|
|
261
261
|
title: props.title ?? "Toggle sidebar",
|
|
262
|
-
className: cn("absolute inset-y-0 z-20 hidden -translate-x-1/2 rtl:translate-x-1/2 group-data-[side=left]:-end-4 group-data-[side=right]:start-0
|
|
262
|
+
className: cn("absolute inset-y-0 z-20 hidden -translate-x-1/2 rtl:translate-x-1/2 group-data-[side=left]:-end-4 group-data-[side=right]:start-0 sidebar:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0", className)
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
}
|
|
@@ -281,11 +281,12 @@ function SidebarInset({ className, render, ref, ...props }) {
|
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
|
-
function SidebarHeader({ className, ...props }) {
|
|
284
|
+
function SidebarHeader({ className, divider = false, ...props }) {
|
|
285
285
|
return /* @__PURE__ */ jsx("div", {
|
|
286
286
|
"data-control-ui": "sidebar",
|
|
287
287
|
"data-control-family": "sidebar",
|
|
288
288
|
"data-slot": "header",
|
|
289
|
+
"data-divider": divider ? "" : void 0,
|
|
289
290
|
className: cn("flex flex-col", className),
|
|
290
291
|
...props
|
|
291
292
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SwapKnobStyle } from "../knob-contracts/swap-knobs.js";
|
|
2
|
+
import { CSSProperties, ComponentProps } from "react";
|
|
3
|
+
//#region src/ui/swap.d.ts
|
|
4
|
+
export type SwapItemState = "active" | "exiting" | "inactive";
|
|
5
|
+
export type SwapProps = Omit<ComponentProps<"span">, "style"> & {
|
|
6
|
+
value: string;
|
|
7
|
+
style?: CSSProperties & SwapKnobStyle;
|
|
8
|
+
};
|
|
9
|
+
export declare function Swap({ value, children, ...props }: SwapProps): import("react").JSX.Element;
|
|
10
|
+
export type SwapItemProps = Omit<ComponentProps<"span">, "ref"> & {
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function SwapItem({ value, children, ...props }: SwapItemProps): import("react").JSX.Element;
|
|
14
|
+
//#endregion
|
package/dist/ui/swap.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Children, createContext, useContext, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/ui/swap.tsx
|
|
5
|
+
const SwapContext = createContext(null);
|
|
6
|
+
function useSwap() {
|
|
7
|
+
const context = useContext(SwapContext);
|
|
8
|
+
if (!context) throw new Error("SwapItem must be rendered inside <Swap>.");
|
|
9
|
+
return context;
|
|
10
|
+
}
|
|
11
|
+
function fitRootToItem(item) {
|
|
12
|
+
const root = item.parentElement;
|
|
13
|
+
if (!root) return;
|
|
14
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
15
|
+
const [borderBox] = entry.borderBoxSize;
|
|
16
|
+
root.style.setProperty("--_swap-inline-size", `${borderBox.inlineSize}px`);
|
|
17
|
+
});
|
|
18
|
+
observer.observe(item);
|
|
19
|
+
return () => observer.disconnect();
|
|
20
|
+
}
|
|
21
|
+
function Swap({ value, children, ...props }) {
|
|
22
|
+
const [transition, setTransition] = useState({
|
|
23
|
+
value,
|
|
24
|
+
previous: null
|
|
25
|
+
});
|
|
26
|
+
if (transition.value !== value) setTransition({
|
|
27
|
+
value,
|
|
28
|
+
previous: transition.value
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ jsx(SwapContext.Provider, {
|
|
31
|
+
value: transition,
|
|
32
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
33
|
+
"data-control-ui": "swap",
|
|
34
|
+
"data-control-family": "swap",
|
|
35
|
+
"data-slot": "root",
|
|
36
|
+
"data-swapped": transition.previous === null ? void 0 : "",
|
|
37
|
+
...props,
|
|
38
|
+
children
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function itemState({ value, previous }, itemValue) {
|
|
43
|
+
if (itemValue === value) return "active";
|
|
44
|
+
if (itemValue === previous) return "exiting";
|
|
45
|
+
return "inactive";
|
|
46
|
+
}
|
|
47
|
+
function wrapLabelText(children) {
|
|
48
|
+
return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */ jsx("span", {
|
|
49
|
+
"data-control-ui": "swap",
|
|
50
|
+
"data-control-family": "swap",
|
|
51
|
+
"data-slot": "label",
|
|
52
|
+
children: child
|
|
53
|
+
}) : child);
|
|
54
|
+
}
|
|
55
|
+
function SwapItem({ value, children, ...props }) {
|
|
56
|
+
const state = itemState(useSwap(), value);
|
|
57
|
+
return /* @__PURE__ */ jsx("span", {
|
|
58
|
+
"data-control-ui": "swap",
|
|
59
|
+
"data-control-family": "swap",
|
|
60
|
+
"data-slot": "item",
|
|
61
|
+
"data-state": state,
|
|
62
|
+
"aria-hidden": state === "active" ? void 0 : true,
|
|
63
|
+
...props,
|
|
64
|
+
ref: state === "active" ? fitRootToItem : void 0,
|
|
65
|
+
children: wrapLabelText(children)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { Swap, SwapItem };
|
package/dist/ui/tabs.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export type TabsSurfaceProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
37
37
|
};
|
|
38
38
|
export declare function TabsSurface({ className, ...props }: TabsSurfaceProps): import("react").JSX.Element;
|
|
39
39
|
export declare function Tabs<TValue extends string = string>({ className, onValueChange, children, ...props }: TabsProps<TValue>): import("react").JSX.Element;
|
|
40
|
-
export declare function TabsList({ size, variant, className, children,
|
|
40
|
+
export declare function TabsList({ size, variant, className, children, ...props }: TabsListProps): import("react").JSX.Element;
|
|
41
41
|
export declare function TabsTab({ className, ...props }: TabsTabProps): import("react").JSX.Element;
|
|
42
42
|
export declare function TabsPanel({ className, value, ref, ...props }: TabsPanelProps): import("react").JSX.Element;
|
|
43
43
|
//#endregion
|
package/dist/ui/tabs.js
CHANGED
|
@@ -109,12 +109,6 @@ function Tabs({ className, onValueChange, children, ...props }) {
|
|
|
109
109
|
})
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
const controlHeights = {
|
|
113
|
-
xs: "var(--control-h-xs)",
|
|
114
|
-
sm: "var(--control-h-sm)",
|
|
115
|
-
md: "var(--control-h-md)",
|
|
116
|
-
lg: "var(--control-h-lg)"
|
|
117
|
-
};
|
|
118
112
|
function countTabs(children) {
|
|
119
113
|
return Children.toArray(children).reduce((count, child) => {
|
|
120
114
|
if (!isValidElement(child)) return count;
|
|
@@ -123,12 +117,8 @@ function countTabs(children) {
|
|
|
123
117
|
return count;
|
|
124
118
|
}, 0);
|
|
125
119
|
}
|
|
126
|
-
function TabsList({ size = "sm", variant = "default", className, children,
|
|
120
|
+
function TabsList({ size = "sm", variant = "default", className, children, ...props }) {
|
|
127
121
|
const isSingle = countTabs(children) === 1;
|
|
128
|
-
const controlStyle = {
|
|
129
|
-
"--_tabs-trigger-h": controlHeights[size],
|
|
130
|
-
...style
|
|
131
|
-
};
|
|
132
122
|
return /* @__PURE__ */ jsxs(Tabs$1.List, {
|
|
133
123
|
"data-control-ui": "tabs",
|
|
134
124
|
"data-control-family": "tabs",
|
|
@@ -137,13 +127,12 @@ function TabsList({ size = "sm", variant = "default", className, children, style
|
|
|
137
127
|
"data-variant": variant,
|
|
138
128
|
"data-single": isSingle ? "true" : void 0,
|
|
139
129
|
className: cn(variant === "browser" && "gap-0 p-0 px-(--_tabs-browser-inset) pt-(--cui-tabs-list-padding)", className),
|
|
140
|
-
style: controlStyle,
|
|
141
130
|
...props,
|
|
142
131
|
children: [children, isSingle ? null : /* @__PURE__ */ jsx(Tabs$1.Indicator, {
|
|
143
132
|
"data-control-ui": "tabs",
|
|
144
133
|
"data-control-family": "tabs",
|
|
145
134
|
"data-slot": "indicator",
|
|
146
|
-
className: variant === "browser" ? "top-auto bottom-0 left-(--_tabs-browser-indicator-x) z-0 h-(--
|
|
135
|
+
className: variant === "browser" ? "top-auto bottom-0 left-(--_tabs-browser-indicator-x) z-0 h-(--cui-tabs-trigger-height) w-(--_tabs-browser-indicator-width) transform-none" : void 0
|
|
147
136
|
})]
|
|
148
137
|
});
|
|
149
138
|
}
|
package/dist/ui/timeline.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { RenderProp } from "../control-props.js";
|
|
|
2
2
|
import { TimelineKnobStyle } from "../knob-contracts/timeline-knobs.js";
|
|
3
3
|
import { CSSProperties, ComponentProps } from "react";
|
|
4
4
|
//#region src/ui/timeline.d.ts
|
|
5
|
-
export type TimelineState = "neutral" | "pending" | "running" | "success" | "error";
|
|
5
|
+
export type TimelineState = "neutral" | "pending" | "running" | "waiting" | "success" | "error";
|
|
6
6
|
export type TimelineProps = ComponentProps<"ol"> & {
|
|
7
7
|
style?: CSSProperties & TimelineKnobStyle;
|
|
8
8
|
};
|
package/dist/ui/timeline.js
CHANGED
|
@@ -18,7 +18,7 @@ function TimelineItem({ state = "neutral", className, ...props }) {
|
|
|
18
18
|
"data-control-family": "timeline",
|
|
19
19
|
"data-slot": "item",
|
|
20
20
|
"data-state": state,
|
|
21
|
-
"aria-current": state === "running" ? "step" : void 0,
|
|
21
|
+
"aria-current": state === "running" || state === "waiting" ? "step" : void 0,
|
|
22
22
|
...props,
|
|
23
23
|
className: cn("group/timeline-item relative grid min-w-0 grid-cols-[1rem_minmax(0,1fr)]", className)
|
|
24
24
|
});
|
|
@@ -41,7 +41,7 @@ function TimelineSeparator({ className, ...props }) {
|
|
|
41
41
|
"data-control-family": "timeline",
|
|
42
42
|
"data-slot": "separator",
|
|
43
43
|
...props,
|
|
44
|
-
className: cn("absolute top-5 bottom-0
|
|
44
|
+
className: cn("absolute top-5 bottom-0 col-start-1 group-last/timeline-item:hidden", className)
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
function TimelineContent({ className, ...props }) {
|
package/dist/ui/typography.d.ts
CHANGED
|
@@ -30,21 +30,27 @@ export type TypeSize = keyof typeof sizeClassNames;
|
|
|
30
30
|
export type TypeTone = keyof typeof toneClassNames;
|
|
31
31
|
export type TextWeight = keyof typeof weightClassNames;
|
|
32
32
|
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
33
|
-
|
|
33
|
+
type TypeFace = {
|
|
34
|
+
/** Sets the text in the monospace face, for code, paths, and identifiers. */
|
|
35
|
+
mono?: boolean;
|
|
36
|
+
/** Uses tabular figures so changing numbers keep their width. */
|
|
37
|
+
numeric?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type HeadingProps = ComponentProps<"h1"> & TypeFace & {
|
|
34
40
|
level: HeadingLevel;
|
|
35
41
|
size?: TypeSize;
|
|
36
42
|
weight?: TextWeight;
|
|
37
43
|
tone?: TypeTone;
|
|
38
44
|
};
|
|
39
|
-
export declare function headingClassName({ level, size, weight, tone, className }: HeadingProps): string;
|
|
40
|
-
export declare function Heading({ level, size, weight, tone, className, ...props }: HeadingProps): import("react").JSX.Element;
|
|
45
|
+
export declare function headingClassName({ level, size, weight, tone, mono, numeric, className }: HeadingProps): string;
|
|
46
|
+
export declare function Heading({ level, size, weight, tone, mono, numeric, className, ...props }: HeadingProps): import("react").JSX.Element;
|
|
41
47
|
export type TextTag = "p" | "span" | "div" | "small" | "strong" | "em" | "code" | "li" | "dt" | "dd" | "figcaption" | "legend" | "blockquote";
|
|
42
|
-
export type TextProps = HTMLAttributes<HTMLElement> & {
|
|
48
|
+
export type TextProps = HTMLAttributes<HTMLElement> & TypeFace & {
|
|
43
49
|
ref?: Ref<HTMLElement>;
|
|
44
50
|
as?: TextTag;
|
|
45
51
|
size?: TypeSize;
|
|
46
52
|
weight?: TextWeight;
|
|
47
53
|
tone?: TypeTone;
|
|
48
54
|
};
|
|
49
|
-
export declare function Text({ as: Tag, size, weight, tone, className, ref, ...props }: TextProps): import("react").JSX.Element;
|
|
55
|
+
export declare function Text({ as: Tag, size, weight, tone, mono, numeric, className, ref, ...props }: TextProps): import("react").JSX.Element;
|
|
50
56
|
//#endregion
|
package/dist/ui/typography.js
CHANGED
|
@@ -35,10 +35,17 @@ const headingSizeByLevel = {
|
|
|
35
35
|
5: "heading-4",
|
|
36
36
|
6: "heading-4"
|
|
37
37
|
};
|
|
38
|
-
function
|
|
39
|
-
return cn(
|
|
38
|
+
function faceClassNames({ mono, numeric }) {
|
|
39
|
+
return cn(mono && "font-mono", numeric && "tabular-nums");
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function headingClassName({ level, size = headingSizeByLevel[level], weight, tone = "default", mono, numeric, className }) {
|
|
42
|
+
return cn(sizeClassNames[size], weight ? weightClassNames[weight] : void 0, toneClassNames[tone], faceClassNames({
|
|
43
|
+
mono,
|
|
44
|
+
numeric
|
|
45
|
+
}), className);
|
|
46
|
+
}
|
|
47
|
+
const programmaticFocusTarget = "[&[tabindex='-1']]:outline-none";
|
|
48
|
+
function Heading({ level, size, weight, tone, mono, numeric, className, ...props }) {
|
|
42
49
|
const Tag = `h${level}`;
|
|
43
50
|
return /* @__PURE__ */ jsx(Tag, {
|
|
44
51
|
"data-control-ui": "typography",
|
|
@@ -49,7 +56,9 @@ function Heading({ level, size, weight, tone, className, ...props }) {
|
|
|
49
56
|
size,
|
|
50
57
|
weight,
|
|
51
58
|
tone,
|
|
52
|
-
|
|
59
|
+
mono,
|
|
60
|
+
numeric,
|
|
61
|
+
className: cn(programmaticFocusTarget, className)
|
|
53
62
|
}),
|
|
54
63
|
...props
|
|
55
64
|
});
|
|
@@ -58,13 +67,16 @@ function attachRef(ref, node) {
|
|
|
58
67
|
if (typeof ref === "function") return ref(node);
|
|
59
68
|
if (ref) ref.current = node;
|
|
60
69
|
}
|
|
61
|
-
function Text({ as: Tag = "span", size = "body", weight, tone = "default", className, ref, ...props }) {
|
|
70
|
+
function Text({ as: Tag = "span", size = "body", weight, tone = "default", mono, numeric, className, ref, ...props }) {
|
|
62
71
|
return /* @__PURE__ */ jsx(Tag, {
|
|
63
72
|
ref: ref ? (node) => attachRef(ref, node) : void 0,
|
|
64
73
|
"data-control-ui": "typography",
|
|
65
74
|
"data-control-family": "typography",
|
|
66
75
|
"data-slot": "text",
|
|
67
|
-
className: cn(sizeClassNames[size], weight ? weightClassNames[weight] : void 0, toneClassNames[tone],
|
|
76
|
+
className: cn(sizeClassNames[size], weight ? weightClassNames[weight] : void 0, toneClassNames[tone], faceClassNames({
|
|
77
|
+
mono,
|
|
78
|
+
numeric
|
|
79
|
+
}), className),
|
|
68
80
|
...props
|
|
69
81
|
});
|
|
70
82
|
}
|
package/dist/user-ask.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { cn } from "./lib/cn.js";
|
|
3
3
|
import { Button } from "./ui/button.js";
|
|
4
4
|
import { LiveStatus } from "./ui/live-status.js";
|
|
5
|
-
import { useUserAsk } from "./hooks/use-user-ask.js";
|
|
6
5
|
import { Kbd } from "./ui/kbd.js";
|
|
6
|
+
import { useUserAsk } from "./hooks/use-user-ask.js";
|
|
7
7
|
import { createContext, useContext, useEffect, useId, useRef } from "react";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Check, ChevronLeft, ChevronRight, PencilLine } from "lucide-react";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const controlUiImportPath = `(?:@ctrl-ui/react|[^'"]*components/control-ui)/`;
|
|
2
|
+
|
|
3
|
+
const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4
|
+
|
|
5
|
+
export function controlUiImportPattern(importSources = []) {
|
|
6
|
+
return `(?:${[controlUiImportPath, ...importSources.map(escapeRegExp)].join("|")})`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const componentStyleClass = String.raw`[^\s"'\x60]!(?:[\s"'\x60]|$)|(?:^|[\s"'\x60])![\w\[-]|(?:^|[^\w-])(?:p[xytrblse]?-|bg-[\w\[]|text-(?:foreground|muted|primary|secondary|accent|destructive|success|warning|info|card|popover|sidebar|background|canvas|current|inherit|transparent|white|black|[a-z]+-\d{2,3}|\[(?:#|oklch|rgb|hsl|lab|lch|color|var))|font-|leading-|tracking-|border|divide-|rounded|shadow|ring\b|ring-|outline|opacity-|backdrop-|fill-|stroke-|decoration-|underline|line-through|italic|uppercase|lowercase|capitalize|tabular-nums|(?:hover|focus|focus-visible|focus-within|active|disabled|open|checked|dark|placeholder|aria-[^:\s]*|data-[^:\s]*|group-[^:\s]*|peer-[^:\s]*|has-[^:\s]*|\*|\[&[^\s]*?\]):)`;
|
|
10
|
+
|
|
11
|
+
export const rawTypeClass = String.raw`(?:^|[^\w-])text-(?:micro|caption|label|body|body-lg|heading-[1-4]|display|xs|sm|base|lg|xl|[2-9]xl)\b|(?:^|[^\w-])text-\[\d[^\]]*\]`;
|
|
12
|
+
|
|
13
|
+
export const componentStyleMessage =
|
|
14
|
+
"Control UI component styled through className: color, type, padding, borders, radius, shadows, state styles and !important belong to the component. Use its props or a --cui-* knob; keep className for layout (flex, gap, width, margin, placement).";
|
|
15
|
+
|
|
16
|
+
export const rawTypeMessage =
|
|
17
|
+
"Text size in className: render text through <Text>/<Heading> on the type scale, or size the control with its size prop or --cui-*-font-size knob.";
|