@mastra/playground-ui 69.0.0-alpha.6 → 69.0.0-alpha.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/{CodeEditor-BqAM9L7t.js → CodeEditor-CYpS_TLB.js} +14 -3
- package/dist/{CodeEditor-BqAM9L7t.js.map → CodeEditor-CYpS_TLB.js.map} +1 -1
- package/dist/{CodeEditor-zMSUzPdX.cjs → CodeEditor-ydLG_B6Z.cjs} +14 -3
- package/dist/{CodeEditor-zMSUzPdX.cjs.map → CodeEditor-ydLG_B6Z.cjs.map} +1 -1
- package/dist/{DataCodeSection-DQ86nArx.js → DataCodeSection-CYfRjmHg.js} +2 -2
- package/dist/{DataCodeSection-DQ86nArx.js.map → DataCodeSection-CYfRjmHg.js.map} +1 -1
- package/dist/{DataCodeSection-vz1SFcEc.cjs → DataCodeSection-DAUINx3A.cjs} +2 -2
- package/dist/{DataCodeSection-vz1SFcEc.cjs.map → DataCodeSection-DAUINx3A.cjs.map} +1 -1
- package/dist/{DataDetailsPanel-mTfbbQho.js → DataDetailsPanel-Bbe0LzH-.js} +2 -2
- package/dist/{DataDetailsPanel-mTfbbQho.js.map → DataDetailsPanel-Bbe0LzH-.js.map} +1 -1
- package/dist/{DataDetailsPanel-DCMlaG7j.cjs → DataDetailsPanel-BuXf9fTh.cjs} +2 -2
- package/dist/{DataDetailsPanel-DCMlaG7j.cjs.map → DataDetailsPanel-BuXf9fTh.cjs.map} +1 -1
- package/dist/{DataPanel-Bf7a92ew.cjs → DataPanel-Bcn4oWNe.cjs} +2 -2
- package/dist/{DataPanel-Bf7a92ew.cjs.map → DataPanel-Bcn4oWNe.cjs.map} +1 -1
- package/dist/{DataPanel-CJsmZjPk.js → DataPanel-DN4Ecvjm.js} +2 -2
- package/dist/{DataPanel-CJsmZjPk.js.map → DataPanel-DN4Ecvjm.js.map} +1 -1
- package/dist/Switch.css +51 -0
- package/dist/{Workflow-BZ93cAzH.cjs → Workflow-CjRQqVIK.cjs} +2 -2
- package/dist/{Workflow-BZ93cAzH.cjs.map → Workflow-CjRQqVIK.cjs.map} +1 -1
- package/dist/{Workflow-DZINlzVS.js → Workflow-DhMn2YRg.js} +2 -2
- package/dist/{Workflow-DZINlzVS.js.map → Workflow-DhMn2YRg.js.map} +1 -1
- package/dist/components/CodeEditor.cjs.js +1 -1
- package/dist/components/CodeEditor.es.js +1 -1
- package/dist/components/DataCodeSection.cjs.js +1 -1
- package/dist/components/DataCodeSection.es.js +1 -1
- package/dist/components/DataDetailsPanel.cjs.js +1 -1
- package/dist/components/DataDetailsPanel.es.js +1 -1
- package/dist/components/DataPanel.cjs.js +1 -1
- package/dist/components/DataPanel.es.js +1 -1
- package/dist/components/RuleCard.cjs.js +102 -0
- package/dist/components/RuleCard.cjs.js.map +1 -0
- package/dist/components/RuleCard.d.ts +1 -0
- package/dist/components/RuleCard.es.js +94 -0
- package/dist/components/RuleCard.es.js.map +1 -0
- package/dist/components/RuleLines.cjs.js +142 -0
- package/dist/components/RuleLines.cjs.js.map +1 -0
- package/dist/components/RuleLines.d.ts +1 -0
- package/dist/components/RuleLines.es.js +132 -0
- package/dist/components/RuleLines.es.js.map +1 -0
- package/dist/components/SideDialog.cjs.js +1 -1
- package/dist/components/SideDialog.es.js +1 -1
- package/dist/components/Sidebar.cjs.js +38 -4
- package/dist/components/Sidebar.cjs.js.map +1 -1
- package/dist/components/Sidebar.es.js +38 -5
- package/dist/components/Sidebar.es.js.map +1 -1
- package/dist/components/Switch.cjs.js +4 -4
- package/dist/components/Switch.cjs.js.map +1 -1
- package/dist/components/Switch.es.js +4 -4
- package/dist/components/Switch.es.js.map +1 -1
- package/dist/components/Workflow.cjs.js +1 -1
- package/dist/components/Workflow.es.js +1 -1
- package/dist/domains/chat/components/network-choice-metadata-dialog.cjs.js +1 -1
- package/dist/domains/chat/components/network-choice-metadata-dialog.es.js +1 -1
- package/dist/domains/chat/messages/dataset-save-action.cjs.js +1 -1
- package/dist/domains/chat/messages/dataset-save-action.es.js +1 -1
- package/dist/domains/chat/messages/message-row.cjs.js +1 -1
- package/dist/domains/chat/messages/message-row.es.js +1 -1
- package/dist/domains/chat/messages/skill-activation.cjs.js +15 -15
- package/dist/domains/chat/messages/skill-activation.cjs.js.map +1 -1
- package/dist/domains/chat/messages/skill-activation.es.js +15 -15
- package/dist/domains/chat/messages/skill-activation.es.js.map +1 -1
- package/dist/domains/chat/messages/skill-message.cjs.js +4 -4
- package/dist/domains/chat/messages/skill-message.cjs.js.map +1 -1
- package/dist/domains/chat/messages/skill-message.es.js +4 -4
- package/dist/domains/chat/messages/skill-message.es.js.map +1 -1
- package/dist/domains/chat/tools/badges/agent-badge-wrapper.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/agent-badge-wrapper.es.js +1 -1
- package/dist/domains/chat/tools/badges/agent-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/agent-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/background-task-metadata-dialog.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/background-task-metadata-dialog.es.js +1 -1
- package/dist/domains/chat/tools/badges/code-mode-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/code-mode-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/tool-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/tool-badge.es.js +1 -1
- package/dist/domains/chat/tools/badges/workflow-badge.cjs.js +1 -1
- package/dist/domains/chat/tools/badges/workflow-badge.es.js +1 -1
- package/dist/domains/chat/tools/mcp-input-request-tool.cjs.js +1 -1
- package/dist/domains/chat/tools/mcp-input-request-tool.es.js +1 -1
- package/dist/domains/chat/tools/tool-card.cjs.js +1 -1
- package/dist/domains/chat/tools/tool-card.es.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.cjs.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/add-dataset-item-dialog.es.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/trajectory-editor.cjs.js +1 -1
- package/dist/domains/datasets/components/add-dataset-item-dialog/trajectory-editor.es.js +1 -1
- package/dist/domains/datasets/components/save-as-dataset-item-dialog.cjs.js +2 -2
- package/dist/domains/datasets/components/save-as-dataset-item-dialog.es.js +2 -2
- package/dist/domains/knowledge/components/KnowledgePageExplorer.cjs.js +1 -1
- package/dist/domains/knowledge/components/KnowledgePageExplorer.es.js +1 -1
- package/dist/domains/logs/components/log-data-panel.cjs.js +1 -1
- package/dist/domains/logs/components/log-data-panel.es.js +1 -1
- package/dist/domains/scores/components/score-data-panel.cjs.js +1 -1
- package/dist/domains/scores/components/score-data-panel.es.js +1 -1
- package/dist/domains/skills/skill-simple-form.cjs.js +1 -1
- package/dist/domains/skills/skill-simple-form.es.js +1 -1
- package/dist/domains/traces/components/span-data-panel-view.cjs.js +1 -1
- package/dist/domains/traces/components/span-data-panel-view.es.js +1 -1
- package/dist/domains/traces/components/span-details-view.cjs.js +1 -1
- package/dist/domains/traces/components/span-details-view.es.js +1 -1
- package/dist/domains/traces/components/span-payload/span-payload-json.cjs.js +1 -1
- package/dist/domains/traces/components/span-payload/span-payload-json.es.js +1 -1
- package/dist/domains/traces/components/span-summary-description.cjs.js +1 -1
- package/dist/domains/traces/components/span-summary-description.es.js +1 -1
- package/dist/domains/traces/components/thread-trace/thread-trace-details.cjs.js +1 -1
- package/dist/domains/traces/components/thread-trace/thread-trace-details.es.js +1 -1
- package/dist/domains/traces/components/trace-data-panel-view.cjs.js +1 -1
- package/dist/domains/traces/components/trace-data-panel-view.es.js +1 -1
- package/dist/domains/traces/components/trace-details-view.cjs.js +1 -1
- package/dist/domains/traces/components/trace-details-view.es.js +1 -1
- package/dist/domains/traces/components/trace-id-button.cjs.js +1 -1
- package/dist/domains/traces/components/trace-id-button.es.js +1 -1
- package/dist/domains/traces/components/trace-summary-description.cjs.js +1 -1
- package/dist/domains/traces/components/trace-summary-description.es.js +1 -1
- package/dist/domains/traces/components/trace-thread-panel.cjs.js +1 -1
- package/dist/domains/traces/components/trace-thread-panel.es.js +1 -1
- package/dist/domains/workflows/components/workflow-layout.cjs.js +1 -1
- package/dist/domains/workflows/components/workflow-layout.es.js +1 -1
- package/dist/domains/workflows/components/workflow-step-detail.cjs.js +2 -2
- package/dist/domains/workflows/components/workflow-step-detail.es.js +2 -2
- package/dist/domains/workflows/workflow/data/workflow-data-button.cjs.js +1 -1
- package/dist/domains/workflows/workflow/data/workflow-data-button.es.js +1 -1
- package/dist/domains/workflows/workflow/data/workflow-data-inspector.cjs.js +1 -1
- package/dist/domains/workflows/workflow/data/workflow-data-inspector.es.js +1 -1
- package/dist/domains/workflows/workflow/input/workflow-json-input.cjs.js +1 -1
- package/dist/domains/workflows/workflow/input/workflow-json-input.es.js +1 -1
- package/dist/domains/workflows/workflow/use-workflow-graph-runtime.cjs.js +1 -1
- package/dist/domains/workflows/workflow/use-workflow-graph-runtime.es.js +1 -1
- package/dist/domains/workflows/workflow/utils.cjs.js +1 -1
- package/dist/domains/workflows/workflow/utils.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-body-graph.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-body-graph.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-data-edge.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-data-edge.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-debug-step-controls.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-debug-step-controls.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph-inner.cjs.js +2 -2
- package/dist/domains/workflows/workflow/workflow-graph-inner.es.js +2 -2
- package/dist/domains/workflows/workflow/workflow-graph-layout.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph-layout.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph-node.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph-node.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-graph.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-map-config-dialog.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-map-config-dialog.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-nested-graph.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-nested-graph.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-run-data.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-run-data.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-status.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-status.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-step-action-bar.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-step-action-bar.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-step-node-utils.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-step-node-utils.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-suspended-steps.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-suspended-steps.es.js +1 -1
- package/dist/domains/workflows/workflow/workflow-time-travel-form.cjs.js +1 -1
- package/dist/domains/workflows/workflow/workflow-time-travel-form.es.js +1 -1
- package/dist/ee/signals/settings/trace-signal-settings.cjs.js +1 -1
- package/dist/ee/signals/settings/trace-signal-settings.es.js +1 -1
- package/dist/src/domains/chat/messages/skill-activation.d.ts +5 -5
- package/dist/src/ds/components/CodeEditor/code-editor.d.ts +2 -2
- package/dist/src/ds/components/RuleCard/index.d.ts +1 -0
- package/dist/src/ds/components/RuleCard/rule-card.d.ts +28 -0
- package/dist/src/ds/components/RuleLines/index.d.ts +1 -0
- package/dist/src/ds/components/RuleLines/rule-lines.d.ts +43 -0
- package/dist/src/ds/components/Sidebar/index.d.ts +1 -1
- package/dist/src/ds/components/Sidebar/nav/sidebar-nav-label.d.ts +7 -2
- package/dist/src/ds/components/Sidebar/nav/sidebar-nav-link.d.ts +9 -0
- package/dist/src/ds/components/Sidebar/sidebar.d.ts +2 -1
- package/dist/style.css +125 -41
- package/dist/{tool-card-DgPsO-en.cjs → tool-card-B1RM2oPP.cjs} +2 -2
- package/dist/{tool-card-DgPsO-en.cjs.map → tool-card-B1RM2oPP.cjs.map} +1 -1
- package/dist/{tool-card-MY96BEys.js → tool-card-ClXJakdY.js} +2 -2
- package/dist/{tool-card-MY96BEys.js.map → tool-card-ClXJakdY.js.map} +1 -1
- package/dist/{use-workflow-graph-runtime-RGwgMzqP.js → use-workflow-graph-runtime-BL1GTfFA.js} +2 -2
- package/dist/{use-workflow-graph-runtime-RGwgMzqP.js.map → use-workflow-graph-runtime-BL1GTfFA.js.map} +1 -1
- package/dist/{use-workflow-graph-runtime-Dm3DVQzm.cjs → use-workflow-graph-runtime-D8yhI6RZ.cjs} +2 -2
- package/dist/{use-workflow-graph-runtime-Dm3DVQzm.cjs.map → use-workflow-graph-runtime-D8yhI6RZ.cjs.map} +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { t as Input } from "../input-DqReKX0A.js";
|
|
2
|
+
import { raisedSurfaceStyle } from "../primitives/raised-surface.es.js";
|
|
3
|
+
import { textStyle } from "../primitives/text.es.js";
|
|
4
|
+
import { focusRing } from "../primitives/transitions.es.js";
|
|
5
|
+
import { t as cn } from "../utils-DQx8TpNT.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { CornerDownRight, GripVertical } from "lucide-react";
|
|
8
|
+
// src/ds/components/RuleCard/rule-card.tsx
|
|
9
|
+
function RuleCard({ inactive, className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
"data-slot": "rule-card",
|
|
12
|
+
"data-inactive": inactive || void 0,
|
|
13
|
+
className: cn("group/rule-card flex min-w-0 flex-col gap-1.5", inactive && "opacity-70", className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function RuleCardHeader({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
"data-slot": "rule-card-header",
|
|
20
|
+
className: cn("relative flex items-center gap-2 pr-2 pl-4", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/** Sits in the header's inset, before the step or name; shows on hover, on focus, and always on touch. */
|
|
25
|
+
function RuleCardDragHandle({ className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
"data-slot": "rule-card-drag-handle",
|
|
29
|
+
className: cn("absolute top-1/2 left-0 flex h-control-sm w-4 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded-sm text-muted-foreground hover:text-foreground active:cursor-grabbing", "opacity-0 group-hover/rule-card:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100", focusRing, className),
|
|
30
|
+
...props,
|
|
31
|
+
children: /* @__PURE__ */ jsx(GripVertical, {
|
|
32
|
+
"aria-hidden": true,
|
|
33
|
+
className: "size-4"
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** The rule's place in a chain ("If", "Else if", "Otherwise"), before its name. */
|
|
38
|
+
function RuleCardStep({ className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx("span", {
|
|
40
|
+
"data-slot": "rule-card-step",
|
|
41
|
+
className: cn(textStyle({
|
|
42
|
+
variant: "caption",
|
|
43
|
+
tone: "ink"
|
|
44
|
+
}), "inline-flex h-5 shrink-0 items-center rounded-sm border border-border bg-fill-subtle px-1.5", className),
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** The rule's name, read-only. */
|
|
49
|
+
function RuleCardTitle({ className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx("span", {
|
|
51
|
+
"data-slot": "rule-card-title",
|
|
52
|
+
className: cn(textStyle({ variant: "label" }), "min-w-0 flex-1 truncate", className),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** The rule's name, edited in place: it reads as the title until hovered or focused. */
|
|
57
|
+
function RuleCardTitleInput({ className, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
59
|
+
variant: "unstyled",
|
|
60
|
+
size: "sm",
|
|
61
|
+
"data-slot": "rule-card-title-input",
|
|
62
|
+
className: cn("min-w-0 flex-1 rounded-md hover:bg-fill-subtle focus:bg-fill-subtle", className),
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/** The box that holds the rule's conditions. */
|
|
67
|
+
function RuleCardBody({ className, ...props }) {
|
|
68
|
+
return /* @__PURE__ */ jsx("div", {
|
|
69
|
+
"data-slot": "rule-card-body",
|
|
70
|
+
className: cn(raisedSurfaceStyle, "flex flex-col gap-2 rounded-xl px-4 py-3", className),
|
|
71
|
+
...props
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** "↪ Send to [Board] › [Phase]": where the rule leads, under its conditions. */
|
|
75
|
+
function RuleCardOutcome({ label, className, children, ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
77
|
+
"data-slot": "rule-card-outcome",
|
|
78
|
+
className: cn("flex flex-wrap items-center gap-1 pr-2 pl-4", className),
|
|
79
|
+
...props,
|
|
80
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
81
|
+
className: cn(textStyle({
|
|
82
|
+
variant: "caption",
|
|
83
|
+
tone: "muted"
|
|
84
|
+
}), "mr-2 flex h-control-sm items-center gap-1.5"),
|
|
85
|
+
children: [/* @__PURE__ */ jsx(CornerDownRight, {
|
|
86
|
+
"aria-hidden": true,
|
|
87
|
+
className: "size-3.5 shrink-0"
|
|
88
|
+
}), label]
|
|
89
|
+
}), children]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export { RuleCard, RuleCardBody, RuleCardDragHandle, RuleCardHeader, RuleCardOutcome, RuleCardStep, RuleCardTitle, RuleCardTitleInput };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=RuleCard.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleCard.es.js","names":[],"sources":["../../src/ds/components/RuleCard/rule-card.tsx"],"sourcesContent":["import { CornerDownRight, GripVertical } from 'lucide-react';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { Input } from '@/ds/components/Input';\nimport type { InputProps } from '@/ds/components/Input';\nimport { raisedSurfaceStyle } from '@/ds/primitives/raised-surface';\nimport { textStyle } from '@/ds/primitives/text';\nimport { focusRing } from '@/ds/primitives/transitions';\nimport { cn } from '@/lib/utils';\n\n// A rule reads top to bottom as a sentence: a header line (step, name, controls), its conditions in a box\n// (`RuleCardBody`), then where it leads (`RuleCardOutcome`). Header and outcome sit outside the box, inset by\n// the same `pl-4` as the box's content, so every line starts on one edge. The inset also holds the drag handle.\n\nexport type RuleCardProps = ComponentProps<'div'> & {\n /** A rule switched off: still editable, shown faded. */\n inactive?: boolean;\n};\n\nexport function RuleCard({ inactive, className, ...props }: RuleCardProps) {\n return (\n <div\n data-slot=\"rule-card\"\n data-inactive={inactive || undefined}\n className={cn('group/rule-card flex min-w-0 flex-col gap-1.5', inactive && 'opacity-70', className)}\n {...props}\n />\n );\n}\n\nexport function RuleCardHeader({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"rule-card-header\"\n className={cn('relative flex items-center gap-2 pr-2 pl-4', className)}\n {...props}\n />\n );\n}\n\nexport type RuleCardDragHandleProps = Omit<ComponentProps<'button'>, 'children'> & {\n /** Names the rule it moves: \"Reorder Bugs\". */\n 'aria-label': string;\n};\n\n/** Sits in the header's inset, before the step or name; shows on hover, on focus, and always on touch. */\nexport function RuleCardDragHandle({ className, ...props }: RuleCardDragHandleProps) {\n return (\n <button\n type=\"button\"\n data-slot=\"rule-card-drag-handle\"\n className={cn(\n 'absolute top-1/2 left-0 flex h-control-sm w-4 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded-sm text-muted-foreground hover:text-foreground active:cursor-grabbing',\n 'opacity-0 group-hover/rule-card:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100',\n focusRing,\n className,\n )}\n {...props}\n >\n <GripVertical aria-hidden className=\"size-4\" />\n </button>\n );\n}\n\n/** The rule's place in a chain (\"If\", \"Else if\", \"Otherwise\"), before its name. */\nexport function RuleCardStep({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"rule-card-step\"\n className={cn(\n textStyle({ variant: 'caption', tone: 'ink' }),\n 'inline-flex h-5 shrink-0 items-center rounded-sm border border-border bg-fill-subtle px-1.5',\n className,\n )}\n {...props}\n />\n );\n}\n\n/** The rule's name, read-only. */\nexport function RuleCardTitle({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"rule-card-title\"\n className={cn(textStyle({ variant: 'label' }), 'min-w-0 flex-1 truncate', className)}\n {...props}\n />\n );\n}\n\n/** The rule's name, edited in place: it reads as the title until hovered or focused. */\nexport function RuleCardTitleInput({ className, ...props }: Omit<InputProps, 'variant' | 'size'>) {\n return (\n <Input\n variant=\"unstyled\"\n size=\"sm\"\n data-slot=\"rule-card-title-input\"\n className={cn('min-w-0 flex-1 rounded-md hover:bg-fill-subtle focus:bg-fill-subtle', className)}\n {...props}\n />\n );\n}\n\n/** The box that holds the rule's conditions. */\nexport function RuleCardBody({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"rule-card-body\"\n className={cn(raisedSurfaceStyle, 'flex flex-col gap-2 rounded-xl px-4 py-3', className)}\n {...props}\n />\n );\n}\n\nexport type RuleCardOutcomeProps = ComponentProps<'div'> & {\n /** What happens, before the pickers that say where: \"Send to\", \"Move to\". */\n label: ReactNode;\n};\n\n/** \"↪ Send to [Board] › [Phase]\": where the rule leads, under its conditions. */\nexport function RuleCardOutcome({ label, className, children, ...props }: RuleCardOutcomeProps) {\n return (\n <div\n data-slot=\"rule-card-outcome\"\n className={cn('flex flex-wrap items-center gap-1 pr-2 pl-4', className)}\n {...props}\n >\n <span\n className={cn(textStyle({ variant: 'caption', tone: 'muted' }), 'mr-2 flex h-control-sm items-center gap-1.5')}\n >\n <CornerDownRight aria-hidden className=\"size-3.5 shrink-0\" />\n {label}\n </span>\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgB,SAAS,EAAE,UAAU,WAAW,GAAG,SAAwB;CACzE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,iBAAe,YAAY,KAAA;EAC3B,WAAW,GAAG,iDAAiD,YAAY,cAAc,SAAS;EAClG,GAAI;CACL,CAAA;AAEL;AAEA,SAAgB,eAAe,EAAE,WAAW,GAAG,SAAgC;CAC7E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,8CAA8C,SAAS;EACrE,GAAI;CACL,CAAA;AAEL;;AAQA,SAAgB,mBAAmB,EAAE,WAAW,GAAG,SAAkC;CACnF,OACE,oBAAC,UAAD;EACE,MAAK;EACL,aAAU;EACV,WAAW,GACT,mMACA,0GACA,WACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,cAAD;GAAc,eAAA;GAAY,WAAU;EAAU,CAAA;CACxC,CAAA;AAEZ;;AAGA,SAAgB,aAAa,EAAE,WAAW,GAAG,SAAiC;CAC5E,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,UAAU;GAAE,SAAS;GAAW,MAAM;EAAM,CAAC,GAC7C,+FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,SAAgB,cAAc,EAAE,WAAW,GAAG,SAAiC;CAC7E,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GAAG,UAAU,EAAE,SAAS,QAAQ,CAAC,GAAG,2BAA2B,SAAS;EACnF,GAAI;CACL,CAAA;AAEL;;AAGA,SAAgB,mBAAmB,EAAE,WAAW,GAAG,SAA+C;CAChG,OACE,oBAAC,OAAD;EACE,SAAQ;EACR,MAAK;EACL,aAAU;EACV,WAAW,GAAG,uEAAuE,SAAS;EAC9F,GAAI;CACL,CAAA;AAEL;;AAGA,SAAgB,aAAa,EAAE,WAAW,GAAG,SAAgC;CAC3E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,oBAAoB,4CAA4C,SAAS;EACvF,GAAI;CACL,CAAA;AAEL;;AAQA,SAAgB,gBAAgB,EAAE,OAAO,WAAW,UAAU,GAAG,SAA+B;CAC9F,OACE,qBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,+CAA+C,SAAS;EACtE,GAAI;EAHN,UAAA,CAKE,qBAAC,QAAD;GACE,WAAW,GAAG,UAAU;IAAE,SAAS;IAAW,MAAM;GAAQ,CAAC,GAAG,6CAA6C;GAD/G,UAAA,CAGE,oBAAC,iBAAD;IAAiB,eAAA;IAAY,WAAU;GAAqB,CAAA,GAC3D,KACG;EACL,CAAA,GAAA,QACE;;AAET"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_Button = require("../Button-BfICfyxD.cjs");
|
|
3
|
+
const require_select = require("../select-CeukeSn_.cjs");
|
|
4
|
+
const require_primitives_text = require("../primitives/text.cjs.js");
|
|
5
|
+
const require_primitives_transitions = require("../primitives/transitions.cjs.js");
|
|
6
|
+
const require_utils = require("../utils-uDc1ofX1.cjs");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let lucide_react = require("lucide-react");
|
|
9
|
+
// src/ds/components/RuleLines/rule-lines.tsx
|
|
10
|
+
var keywordColumn = "flex h-control-sm w-14 shrink-0 items-center";
|
|
11
|
+
/** The lines, top to bottom. Give the outer list `role="group"` and a name. */
|
|
12
|
+
function RuleLines({ className, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14
|
+
"data-slot": "rule-lines",
|
|
15
|
+
className: require_utils.cn("flex flex-col gap-2", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** One line: a `RuleLineKeyword` or `RuleLineLogic`, then a `RuleLineContent` or a `RuleLineGroup`. */
|
|
20
|
+
function RuleLine({ className, ...props }) {
|
|
21
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
22
|
+
"data-slot": "rule-line",
|
|
23
|
+
className: require_utils.cn("flex items-start gap-2", className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** The word that joins a line to the ones above. Left empty, it keeps the column so the line lines up. */
|
|
28
|
+
function RuleLineKeyword({ className, children, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
30
|
+
"data-slot": "rule-line-keyword",
|
|
31
|
+
"aria-hidden": children === void 0 || void 0,
|
|
32
|
+
className: require_utils.cn(keywordColumn, require_primitives_text.textStyle({
|
|
33
|
+
variant: "caption",
|
|
34
|
+
tone: "muted"
|
|
35
|
+
}), className),
|
|
36
|
+
...props,
|
|
37
|
+
children
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** The keyword that also picks how a group's lines combine: "and" or "or". */
|
|
41
|
+
function RuleLineLogic({ value, onValueChange, "aria-label": label = "Match all or any" }) {
|
|
42
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
43
|
+
"data-slot": "rule-line-logic",
|
|
44
|
+
className: keywordColumn,
|
|
45
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_select.Select, {
|
|
46
|
+
value,
|
|
47
|
+
onValueChange: (next) => next && onValueChange(next),
|
|
48
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_select.SelectTrigger, {
|
|
49
|
+
size: "sm",
|
|
50
|
+
variant: "ghost",
|
|
51
|
+
"aria-label": label,
|
|
52
|
+
className: "-ml-2 w-fit px-2",
|
|
53
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
54
|
+
className: require_primitives_text.textStyle({
|
|
55
|
+
variant: "caption",
|
|
56
|
+
tone: "ink"
|
|
57
|
+
}),
|
|
58
|
+
children: value === "AND" ? "and" : "or"
|
|
59
|
+
})
|
|
60
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_select.SelectContent, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_select.SelectItem, {
|
|
61
|
+
value: "AND",
|
|
62
|
+
children: "and"
|
|
63
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_select.SelectItem, {
|
|
64
|
+
value: "OR",
|
|
65
|
+
children: "or"
|
|
66
|
+
})] })]
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** A line's pickers, wrapping onto more rows when narrow. */
|
|
71
|
+
function RuleLineContent({ className, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
73
|
+
"data-slot": "rule-line-content",
|
|
74
|
+
className: require_utils.cn("flex min-h-control-sm min-w-0 flex-1 flex-wrap items-center gap-1.5", className),
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** A nested set of lines in its own box: put a `RuleLines` in it, with a `RuleLineGroupRemove` on its last line. Name it. */
|
|
79
|
+
function RuleLineGroup({ depth, className, ...props }) {
|
|
80
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
81
|
+
role: "group",
|
|
82
|
+
"data-slot": "rule-line-group",
|
|
83
|
+
className: require_utils.cn("flex min-w-0 flex-1 items-start gap-2 rounded-lg border border-border p-2", depth % 2 === 0 ? "bg-fill-subtle" : "bg-card", "[&>[data-slot=rule-lines]]:min-w-0 [&>[data-slot=rule-lines]]:flex-1", className),
|
|
84
|
+
...props
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** Removes one line; ends it. A whole group uses `RuleLineGroupRemove`. */
|
|
88
|
+
function RuleLineRemove({ className, ...props }) {
|
|
89
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
90
|
+
variant: "ghost",
|
|
91
|
+
size: "icon-sm",
|
|
92
|
+
className: require_utils.cn("ml-auto", className),
|
|
93
|
+
...props,
|
|
94
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {})
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/** Removes a whole group. Spelled out and set apart from the lines' X buttons, so it can't be taken for one of them. */
|
|
98
|
+
function RuleLineGroupRemove({ className, children, ...props }) {
|
|
99
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Button.Button, {
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
size: "sm",
|
|
102
|
+
className: require_utils.cn("ml-auto", className),
|
|
103
|
+
...props,
|
|
104
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Trash2, {}), children]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/** A quiet note on a line, such as what an empty rule matches. */
|
|
108
|
+
function RuleLineHint({ className, ...props }) {
|
|
109
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
110
|
+
"data-slot": "rule-line-hint",
|
|
111
|
+
className: require_utils.cn(require_primitives_text.textStyle({
|
|
112
|
+
variant: "caption",
|
|
113
|
+
tone: "muted"
|
|
114
|
+
}), "px-1", className),
|
|
115
|
+
...props
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/** Adds a line, a group or a whole rule: dashed, the outline of something not written yet. */
|
|
119
|
+
function RuleAddButton({ icon, className, children, ...props }) {
|
|
120
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
"data-slot": "rule-add-button",
|
|
123
|
+
className: require_utils.cn(require_primitives_text.textStyle({
|
|
124
|
+
variant: "caption",
|
|
125
|
+
tone: "muted"
|
|
126
|
+
}), "inline-flex h-control-sm items-center gap-1.5 rounded-full border border-dashed border-border px-3 hover:border-border-strong hover:text-foreground [&_svg]:size-3.5", require_primitives_transitions.focusRing, className),
|
|
127
|
+
...props,
|
|
128
|
+
children: [icon, children]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
exports.RuleAddButton = RuleAddButton;
|
|
132
|
+
exports.RuleLine = RuleLine;
|
|
133
|
+
exports.RuleLineContent = RuleLineContent;
|
|
134
|
+
exports.RuleLineGroup = RuleLineGroup;
|
|
135
|
+
exports.RuleLineGroupRemove = RuleLineGroupRemove;
|
|
136
|
+
exports.RuleLineHint = RuleLineHint;
|
|
137
|
+
exports.RuleLineKeyword = RuleLineKeyword;
|
|
138
|
+
exports.RuleLineLogic = RuleLineLogic;
|
|
139
|
+
exports.RuleLineRemove = RuleLineRemove;
|
|
140
|
+
exports.RuleLines = RuleLines;
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=RuleLines.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleLines.cjs.js","names":["cn","textStyle","Select","SelectTrigger","SelectContent","SelectItem","Button","X","Trash2","focusRing"],"sources":["../../src/ds/components/RuleLines/rule-lines.tsx"],"sourcesContent":["import { Trash2, X } from 'lucide-react';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { Button } from '@/ds/components/Button';\nimport type { ButtonProps } from '@/ds/components/Button';\nimport { Select, SelectContent, SelectItem, SelectTrigger } from '@/ds/components/Select';\nimport { textStyle } from '@/ds/primitives/text';\nimport { focusRing } from '@/ds/primitives/transitions';\nimport { cn } from '@/lib/utils';\n\n// Conditions read as a sentence, one line each: a keyword column (\"Where\", \"and\", \"or\") then the line's pickers.\n// The keyword column has one width, so every picker starts on the same edge, and so do the add buttons under them.\n\nconst keywordColumn = 'flex h-control-sm w-14 shrink-0 items-center';\n\n/** The lines, top to bottom. Give the outer list `role=\"group\"` and a name. */\nexport function RuleLines({ className, ...props }: ComponentProps<'div'>) {\n return <div data-slot=\"rule-lines\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** One line: a `RuleLineKeyword` or `RuleLineLogic`, then a `RuleLineContent` or a `RuleLineGroup`. */\nexport function RuleLine({ className, ...props }: ComponentProps<'div'>) {\n return <div data-slot=\"rule-line\" className={cn('flex items-start gap-2', className)} {...props} />;\n}\n\n/** The word that joins a line to the ones above. Left empty, it keeps the column so the line lines up. */\nexport function RuleLineKeyword({ className, children, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"rule-line-keyword\"\n aria-hidden={children === undefined || undefined}\n className={cn(keywordColumn, textStyle({ variant: 'caption', tone: 'muted' }), className)}\n {...props}\n >\n {children}\n </span>\n );\n}\n\nexport type RuleLogic = 'AND' | 'OR';\n\nexport type RuleLineLogicProps = {\n value: RuleLogic;\n onValueChange: (value: RuleLogic) => void;\n /** Defaults to \"Match all or any\". */\n 'aria-label'?: string;\n};\n\n/** The keyword that also picks how a group's lines combine: \"and\" or \"or\". */\nexport function RuleLineLogic({ value, onValueChange, 'aria-label': label = 'Match all or any' }: RuleLineLogicProps) {\n return (\n <div data-slot=\"rule-line-logic\" className={keywordColumn}>\n <Select value={value} onValueChange={next => next && onValueChange(next)}>\n <SelectTrigger size=\"sm\" variant=\"ghost\" aria-label={label} className=\"-ml-2 w-fit px-2\">\n <span className={textStyle({ variant: 'caption', tone: 'ink' })}>{value === 'AND' ? 'and' : 'or'}</span>\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"AND\">and</SelectItem>\n <SelectItem value=\"OR\">or</SelectItem>\n </SelectContent>\n </Select>\n </div>\n );\n}\n\n/** A line's pickers, wrapping onto more rows when narrow. */\nexport function RuleLineContent({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"rule-line-content\"\n className={cn('flex min-h-control-sm min-w-0 flex-1 flex-wrap items-center gap-1.5', className)}\n {...props}\n />\n );\n}\n\nexport type RuleLineGroupProps = ComponentProps<'div'> & {\n /** Nesting level, from 0: each level alternates the fill so it stands apart from the one around it. */\n depth: number;\n};\n\n/** A nested set of lines in its own box: put a `RuleLines` in it, with a `RuleLineGroupRemove` on its last line. Name it. */\nexport function RuleLineGroup({ depth, className, ...props }: RuleLineGroupProps) {\n return (\n <div\n role=\"group\"\n data-slot=\"rule-line-group\"\n className={cn(\n 'flex min-w-0 flex-1 items-start gap-2 rounded-lg border border-border p-2',\n depth % 2 === 0 ? 'bg-fill-subtle' : 'bg-card',\n '[&>[data-slot=rule-lines]]:min-w-0 [&>[data-slot=rule-lines]]:flex-1',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type RuleLineRemoveProps = Omit<ButtonProps, 'children' | 'variant' | 'size'> & {\n /** What it removes, such as \"Remove condition\". */\n 'aria-label': string;\n};\n\n/** Removes one line; ends it. A whole group uses `RuleLineGroupRemove`. */\nexport function RuleLineRemove({ className, ...props }: RuleLineRemoveProps) {\n return (\n <Button variant=\"ghost\" size=\"icon-sm\" className={cn('ml-auto', className)} {...props}>\n <X />\n </Button>\n );\n}\n\n/** Removes a whole group. Spelled out and set apart from the lines' X buttons, so it can't be taken for one of them. */\nexport function RuleLineGroupRemove({\n className,\n children,\n ...props\n}: Omit<ButtonProps, 'variant' | 'size'> & { children: ReactNode }) {\n return (\n <Button variant=\"ghost\" size=\"sm\" className={cn('ml-auto', className)} {...props}>\n <Trash2 />\n {children}\n </Button>\n );\n}\n\n/** A quiet note on a line, such as what an empty rule matches. */\nexport function RuleLineHint({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"rule-line-hint\"\n className={cn(textStyle({ variant: 'caption', tone: 'muted' }), 'px-1', className)}\n {...props}\n />\n );\n}\n\nexport type RuleAddButtonProps = Omit<ComponentProps<'button'>, 'children'> & {\n icon?: ReactNode;\n children: ReactNode;\n};\n\n/** Adds a line, a group or a whole rule: dashed, the outline of something not written yet. */\nexport function RuleAddButton({ icon, className, children, ...props }: RuleAddButtonProps) {\n return (\n <button\n type=\"button\"\n data-slot=\"rule-add-button\"\n className={cn(\n textStyle({ variant: 'caption', tone: 'muted' }),\n 'inline-flex h-control-sm items-center gap-1.5 rounded-full border border-dashed border-border px-3 hover:border-border-strong hover:text-foreground [&_svg]:size-3.5',\n focusRing,\n className,\n )}\n {...props}\n >\n {icon}\n {children}\n </button>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../src/ds/components/RuleLines/index';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { t as Button } from "../Button-Bi7aXd_G.js";
|
|
2
|
+
import { i as SelectItem, n as SelectContent, o as SelectTrigger, t as Select } from "../select-dNX9If-s.js";
|
|
3
|
+
import { textStyle } from "../primitives/text.es.js";
|
|
4
|
+
import { focusRing } from "../primitives/transitions.es.js";
|
|
5
|
+
import { t as cn } from "../utils-DQx8TpNT.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Trash2, X } from "lucide-react";
|
|
8
|
+
// src/ds/components/RuleLines/rule-lines.tsx
|
|
9
|
+
var keywordColumn = "flex h-control-sm w-14 shrink-0 items-center";
|
|
10
|
+
/** The lines, top to bottom. Give the outer list `role="group"` and a name. */
|
|
11
|
+
function RuleLines({ className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx("div", {
|
|
13
|
+
"data-slot": "rule-lines",
|
|
14
|
+
className: cn("flex flex-col gap-2", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** One line: a `RuleLineKeyword` or `RuleLineLogic`, then a `RuleLineContent` or a `RuleLineGroup`. */
|
|
19
|
+
function RuleLine({ className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
"data-slot": "rule-line",
|
|
22
|
+
className: cn("flex items-start gap-2", className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** The word that joins a line to the ones above. Left empty, it keeps the column so the line lines up. */
|
|
27
|
+
function RuleLineKeyword({ className, children, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("span", {
|
|
29
|
+
"data-slot": "rule-line-keyword",
|
|
30
|
+
"aria-hidden": children === void 0 || void 0,
|
|
31
|
+
className: cn(keywordColumn, textStyle({
|
|
32
|
+
variant: "caption",
|
|
33
|
+
tone: "muted"
|
|
34
|
+
}), className),
|
|
35
|
+
...props,
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** The keyword that also picks how a group's lines combine: "and" or "or". */
|
|
40
|
+
function RuleLineLogic({ value, onValueChange, "aria-label": label = "Match all or any" }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
"data-slot": "rule-line-logic",
|
|
43
|
+
className: keywordColumn,
|
|
44
|
+
children: /* @__PURE__ */ jsxs(Select, {
|
|
45
|
+
value,
|
|
46
|
+
onValueChange: (next) => next && onValueChange(next),
|
|
47
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
48
|
+
size: "sm",
|
|
49
|
+
variant: "ghost",
|
|
50
|
+
"aria-label": label,
|
|
51
|
+
className: "-ml-2 w-fit px-2",
|
|
52
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: textStyle({
|
|
54
|
+
variant: "caption",
|
|
55
|
+
tone: "ink"
|
|
56
|
+
}),
|
|
57
|
+
children: value === "AND" ? "and" : "or"
|
|
58
|
+
})
|
|
59
|
+
}), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
60
|
+
value: "AND",
|
|
61
|
+
children: "and"
|
|
62
|
+
}), /* @__PURE__ */ jsx(SelectItem, {
|
|
63
|
+
value: "OR",
|
|
64
|
+
children: "or"
|
|
65
|
+
})] })]
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** A line's pickers, wrapping onto more rows when narrow. */
|
|
70
|
+
function RuleLineContent({ className, ...props }) {
|
|
71
|
+
return /* @__PURE__ */ jsx("div", {
|
|
72
|
+
"data-slot": "rule-line-content",
|
|
73
|
+
className: cn("flex min-h-control-sm min-w-0 flex-1 flex-wrap items-center gap-1.5", className),
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** A nested set of lines in its own box: put a `RuleLines` in it, with a `RuleLineGroupRemove` on its last line. Name it. */
|
|
78
|
+
function RuleLineGroup({ depth, className, ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx("div", {
|
|
80
|
+
role: "group",
|
|
81
|
+
"data-slot": "rule-line-group",
|
|
82
|
+
className: cn("flex min-w-0 flex-1 items-start gap-2 rounded-lg border border-border p-2", depth % 2 === 0 ? "bg-fill-subtle" : "bg-card", "[&>[data-slot=rule-lines]]:min-w-0 [&>[data-slot=rule-lines]]:flex-1", className),
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** Removes one line; ends it. A whole group uses `RuleLineGroupRemove`. */
|
|
87
|
+
function RuleLineRemove({ className, ...props }) {
|
|
88
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
89
|
+
variant: "ghost",
|
|
90
|
+
size: "icon-sm",
|
|
91
|
+
className: cn("ml-auto", className),
|
|
92
|
+
...props,
|
|
93
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/** Removes a whole group. Spelled out and set apart from the lines' X buttons, so it can't be taken for one of them. */
|
|
97
|
+
function RuleLineGroupRemove({ className, children, ...props }) {
|
|
98
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
99
|
+
variant: "ghost",
|
|
100
|
+
size: "sm",
|
|
101
|
+
className: cn("ml-auto", className),
|
|
102
|
+
...props,
|
|
103
|
+
children: [/* @__PURE__ */ jsx(Trash2, {}), children]
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** A quiet note on a line, such as what an empty rule matches. */
|
|
107
|
+
function RuleLineHint({ className, ...props }) {
|
|
108
|
+
return /* @__PURE__ */ jsx("span", {
|
|
109
|
+
"data-slot": "rule-line-hint",
|
|
110
|
+
className: cn(textStyle({
|
|
111
|
+
variant: "caption",
|
|
112
|
+
tone: "muted"
|
|
113
|
+
}), "px-1", className),
|
|
114
|
+
...props
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/** Adds a line, a group or a whole rule: dashed, the outline of something not written yet. */
|
|
118
|
+
function RuleAddButton({ icon, className, children, ...props }) {
|
|
119
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
"data-slot": "rule-add-button",
|
|
122
|
+
className: cn(textStyle({
|
|
123
|
+
variant: "caption",
|
|
124
|
+
tone: "muted"
|
|
125
|
+
}), "inline-flex h-control-sm items-center gap-1.5 rounded-full border border-dashed border-border px-3 hover:border-border-strong hover:text-foreground [&_svg]:size-3.5", focusRing, className),
|
|
126
|
+
...props,
|
|
127
|
+
children: [icon, children]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
export { RuleAddButton, RuleLine, RuleLineContent, RuleLineGroup, RuleLineGroupRemove, RuleLineHint, RuleLineKeyword, RuleLineLogic, RuleLineRemove, RuleLines };
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=RuleLines.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleLines.es.js","names":[],"sources":["../../src/ds/components/RuleLines/rule-lines.tsx"],"sourcesContent":["import { Trash2, X } from 'lucide-react';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { Button } from '@/ds/components/Button';\nimport type { ButtonProps } from '@/ds/components/Button';\nimport { Select, SelectContent, SelectItem, SelectTrigger } from '@/ds/components/Select';\nimport { textStyle } from '@/ds/primitives/text';\nimport { focusRing } from '@/ds/primitives/transitions';\nimport { cn } from '@/lib/utils';\n\n// Conditions read as a sentence, one line each: a keyword column (\"Where\", \"and\", \"or\") then the line's pickers.\n// The keyword column has one width, so every picker starts on the same edge, and so do the add buttons under them.\n\nconst keywordColumn = 'flex h-control-sm w-14 shrink-0 items-center';\n\n/** The lines, top to bottom. Give the outer list `role=\"group\"` and a name. */\nexport function RuleLines({ className, ...props }: ComponentProps<'div'>) {\n return <div data-slot=\"rule-lines\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** One line: a `RuleLineKeyword` or `RuleLineLogic`, then a `RuleLineContent` or a `RuleLineGroup`. */\nexport function RuleLine({ className, ...props }: ComponentProps<'div'>) {\n return <div data-slot=\"rule-line\" className={cn('flex items-start gap-2', className)} {...props} />;\n}\n\n/** The word that joins a line to the ones above. Left empty, it keeps the column so the line lines up. */\nexport function RuleLineKeyword({ className, children, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"rule-line-keyword\"\n aria-hidden={children === undefined || undefined}\n className={cn(keywordColumn, textStyle({ variant: 'caption', tone: 'muted' }), className)}\n {...props}\n >\n {children}\n </span>\n );\n}\n\nexport type RuleLogic = 'AND' | 'OR';\n\nexport type RuleLineLogicProps = {\n value: RuleLogic;\n onValueChange: (value: RuleLogic) => void;\n /** Defaults to \"Match all or any\". */\n 'aria-label'?: string;\n};\n\n/** The keyword that also picks how a group's lines combine: \"and\" or \"or\". */\nexport function RuleLineLogic({ value, onValueChange, 'aria-label': label = 'Match all or any' }: RuleLineLogicProps) {\n return (\n <div data-slot=\"rule-line-logic\" className={keywordColumn}>\n <Select value={value} onValueChange={next => next && onValueChange(next)}>\n <SelectTrigger size=\"sm\" variant=\"ghost\" aria-label={label} className=\"-ml-2 w-fit px-2\">\n <span className={textStyle({ variant: 'caption', tone: 'ink' })}>{value === 'AND' ? 'and' : 'or'}</span>\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"AND\">and</SelectItem>\n <SelectItem value=\"OR\">or</SelectItem>\n </SelectContent>\n </Select>\n </div>\n );\n}\n\n/** A line's pickers, wrapping onto more rows when narrow. */\nexport function RuleLineContent({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"rule-line-content\"\n className={cn('flex min-h-control-sm min-w-0 flex-1 flex-wrap items-center gap-1.5', className)}\n {...props}\n />\n );\n}\n\nexport type RuleLineGroupProps = ComponentProps<'div'> & {\n /** Nesting level, from 0: each level alternates the fill so it stands apart from the one around it. */\n depth: number;\n};\n\n/** A nested set of lines in its own box: put a `RuleLines` in it, with a `RuleLineGroupRemove` on its last line. Name it. */\nexport function RuleLineGroup({ depth, className, ...props }: RuleLineGroupProps) {\n return (\n <div\n role=\"group\"\n data-slot=\"rule-line-group\"\n className={cn(\n 'flex min-w-0 flex-1 items-start gap-2 rounded-lg border border-border p-2',\n depth % 2 === 0 ? 'bg-fill-subtle' : 'bg-card',\n '[&>[data-slot=rule-lines]]:min-w-0 [&>[data-slot=rule-lines]]:flex-1',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type RuleLineRemoveProps = Omit<ButtonProps, 'children' | 'variant' | 'size'> & {\n /** What it removes, such as \"Remove condition\". */\n 'aria-label': string;\n};\n\n/** Removes one line; ends it. A whole group uses `RuleLineGroupRemove`. */\nexport function RuleLineRemove({ className, ...props }: RuleLineRemoveProps) {\n return (\n <Button variant=\"ghost\" size=\"icon-sm\" className={cn('ml-auto', className)} {...props}>\n <X />\n </Button>\n );\n}\n\n/** Removes a whole group. Spelled out and set apart from the lines' X buttons, so it can't be taken for one of them. */\nexport function RuleLineGroupRemove({\n className,\n children,\n ...props\n}: Omit<ButtonProps, 'variant' | 'size'> & { children: ReactNode }) {\n return (\n <Button variant=\"ghost\" size=\"sm\" className={cn('ml-auto', className)} {...props}>\n <Trash2 />\n {children}\n </Button>\n );\n}\n\n/** A quiet note on a line, such as what an empty rule matches. */\nexport function RuleLineHint({ className, ...props }: ComponentProps<'span'>) {\n return (\n <span\n data-slot=\"rule-line-hint\"\n className={cn(textStyle({ variant: 'caption', tone: 'muted' }), 'px-1', className)}\n {...props}\n />\n );\n}\n\nexport type RuleAddButtonProps = Omit<ComponentProps<'button'>, 'children'> & {\n icon?: ReactNode;\n children: ReactNode;\n};\n\n/** Adds a line, a group or a whole rule: dashed, the outline of something not written yet. */\nexport function RuleAddButton({ icon, className, children, ...props }: RuleAddButtonProps) {\n return (\n <button\n type=\"button\"\n data-slot=\"rule-add-button\"\n className={cn(\n textStyle({ variant: 'caption', tone: 'muted' }),\n 'inline-flex h-control-sm items-center gap-1.5 rounded-full border border-dashed border-border px-3 hover:border-border-strong hover:text-foreground [&_svg]:size-3.5',\n focusRing,\n className,\n )}\n {...props}\n >\n {icon}\n {children}\n </button>\n );\n}\n"],"mappings":";;;;;;;;AAaA,IAAM,gBAAgB;;AAGtB,SAAgB,UAAU,EAAE,WAAW,GAAG,SAAgC;CACxE,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAa,WAAW,GAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ,CAAA;AAClG;;AAGA,SAAgB,SAAS,EAAE,WAAW,GAAG,SAAgC;CACvE,OAAO,oBAAC,OAAD;EAAK,aAAU;EAAY,WAAW,GAAG,0BAA0B,SAAS;EAAG,GAAI;CAAQ,CAAA;AACpG;;AAGA,SAAgB,gBAAgB,EAAE,WAAW,UAAU,GAAG,SAAiC;CACzF,OACE,oBAAC,QAAD;EACE,aAAU;EACV,eAAa,aAAa,KAAA,KAAa,KAAA;EACvC,WAAW,GAAG,eAAe,UAAU;GAAE,SAAS;GAAW,MAAM;EAAQ,CAAC,GAAG,SAAS;EACxF,GAAI;EAEH;CACG,CAAA;AAEV;;AAYA,SAAgB,cAAc,EAAE,OAAO,eAAe,cAAc,QAAQ,sBAA0C;CACpH,OACE,oBAAC,OAAD;EAAK,aAAU;EAAkB,WAAW;EAC1C,UAAA,qBAAC,QAAD;GAAe;GAAO,gBAAe,SAAQ,QAAQ,cAAc,IAAI;GAAvE,UAAA,CACE,oBAAC,eAAD;IAAe,MAAK;IAAK,SAAQ;IAAQ,cAAY;IAAO,WAAU;IACpE,UAAA,oBAAC,QAAD;KAAM,WAAW,UAAU;MAAE,SAAS;MAAW,MAAM;KAAM,CAAC;KAAI,UAAA,UAAU,QAAQ,QAAQ;IAAW,CAAA;GAC1F,CAAA,GACf,qBAAC,eAAD,EAAA,UAAA,CACE,oBAAC,YAAD;IAAY,OAAM;IAAM,UAAA;GAAe,CAAA,GACvC,oBAAC,YAAD;IAAY,OAAM;IAAK,UAAA;GAAc,CAAA,CACxB,EAAA,CAAA,CACT;;CACL,CAAA;AAET;;AAGA,SAAgB,gBAAgB,EAAE,WAAW,GAAG,SAAgC;CAC9E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,uEAAuE,SAAS;EAC9F,GAAI;CACL,CAAA;AAEL;;AAQA,SAAgB,cAAc,EAAE,OAAO,WAAW,GAAG,SAA6B;CAChF,OACE,oBAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,WAAW,GACT,6EACA,QAAQ,MAAM,IAAI,mBAAmB,WACrC,wEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAQA,SAAgB,eAAe,EAAE,WAAW,GAAG,SAA8B;CAC3E,OACE,oBAAC,QAAD;EAAQ,SAAQ;EAAQ,MAAK;EAAU,WAAW,GAAG,WAAW,SAAS;EAAG,GAAI;EAC9E,UAAA,oBAAC,GAAD,CAAI,CAAA;CACE,CAAA;AAEZ;;AAGA,SAAgB,oBAAoB,EAClC,WACA,UACA,GAAG,SAC+D;CAClE,OACE,qBAAC,QAAD;EAAQ,SAAQ;EAAQ,MAAK;EAAK,WAAW,GAAG,WAAW,SAAS;EAAG,GAAI;EAA3E,UAAA,CACE,oBAAC,QAAD,CAAS,CAAA,GACR,QACK;;AAEZ;;AAGA,SAAgB,aAAa,EAAE,WAAW,GAAG,SAAiC;CAC5E,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GAAG,UAAU;GAAE,SAAS;GAAW,MAAM;EAAQ,CAAC,GAAG,QAAQ,SAAS;EACjF,GAAI;CACL,CAAA;AAEL;;AAQA,SAAgB,cAAc,EAAE,MAAM,WAAW,UAAU,GAAG,SAA6B;CACzF,OACE,qBAAC,UAAD;EACE,MAAK;EACL,aAAU;EACV,WAAW,GACT,UAAU;GAAE,SAAS;GAAW,MAAM;EAAQ,CAAC,GAC/C,wKACA,WACA,SACF;EACA,GAAI;EATN,UAAA,CAWG,MACA,QACK;;AAEZ"}
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_rolldown_runtime = require("../rolldown-runtime-CmQyd0Gu.cjs");
|
|
3
3
|
const require_Button = require("../Button-BfICfyxD.cjs");
|
|
4
4
|
const require_buttons_group = require("../buttons-group-DM6_Kohs.cjs");
|
|
5
|
-
const require_CodeEditor = require("../CodeEditor-
|
|
5
|
+
const require_CodeEditor = require("../CodeEditor-ydLG_B6Z.cjs");
|
|
6
6
|
const require_copy_button = require("../copy-button-DuEUYvS2.cjs");
|
|
7
7
|
const require_Section = require("../Section-B8MIbDDs.cjs");
|
|
8
8
|
require("../primitives/raised-surface.cjs.js");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Button } from "../Button-Bi7aXd_G.js";
|
|
2
2
|
import { t as ButtonsGroup } from "../buttons-group-DA_wORqQ.js";
|
|
3
|
-
import { n as useCodemirrorTheme, s as codeFoldGutter } from "../CodeEditor-
|
|
3
|
+
import { n as useCodemirrorTheme, s as codeFoldGutter } from "../CodeEditor-CYpS_TLB.js";
|
|
4
4
|
import { t as CopyButton } from "../copy-button-B-_Z6N6y.js";
|
|
5
5
|
import { t as Section } from "../Section-C9Fgv-IF.js";
|
|
6
6
|
import "../primitives/raised-surface.es.js";
|
|
@@ -447,9 +447,21 @@ function SidebarNavHeader({ children, icon, action, className, state: stateProp,
|
|
|
447
447
|
* `link={...}` path wraps the name internally, but custom elements bring their
|
|
448
448
|
* own children, so the label needs to opt into the collapse-aware rendering.
|
|
449
449
|
*/
|
|
450
|
-
function SidebarNavLabel({ children, className, state: stateProp, ...rest }) {
|
|
450
|
+
function SidebarNavLabel({ children, className, description, state: stateProp, ...rest }) {
|
|
451
451
|
const ctx = useMaybeSidebarState();
|
|
452
452
|
if ((stateProp ?? ctx?.state ?? "default") === "collapsed") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_visually_hidden.VisuallyHidden, { children });
|
|
453
|
+
if (description != null && description !== false) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
454
|
+
...rest,
|
|
455
|
+
className: require_utils.cn("flex min-w-0 flex-1 flex-col text-left", className),
|
|
456
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
457
|
+
className: "truncate",
|
|
458
|
+
children
|
|
459
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
460
|
+
"data-slot": "sidebar-nav-description",
|
|
461
|
+
className: "flex min-w-0 items-center gap-1.5 truncate text-meta text-muted-foreground data-[slot=sidebar-nav-description]:[&_svg]:size-3",
|
|
462
|
+
children: description
|
|
463
|
+
})]
|
|
464
|
+
});
|
|
453
465
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
454
466
|
...rest,
|
|
455
467
|
className: require_utils.cn("min-w-0 flex-1 truncate text-left", className),
|
|
@@ -471,6 +483,7 @@ var nestedExpandedItemClasses = (level) => {
|
|
|
471
483
|
if (level === 2) return `gap-2 py-1 pr-3 pl-10 ${require_primitives_control_size.controlHeight.md}`;
|
|
472
484
|
return `gap-2 py-1 pr-3 pl-12 ${require_primitives_control_size.controlHeight.md}`;
|
|
473
485
|
};
|
|
486
|
+
var withDescriptionClasses = "has-[[data-slot=sidebar-nav-description]]:h-auto has-[[data-slot=sidebar-nav-description]]:min-h-control-lg has-[[data-slot=sidebar-nav-description]]:items-start has-[[data-slot=sidebar-nav-description]]:py-1.5 has-[[data-slot=sidebar-nav-description]]:[&>svg]:h-lh";
|
|
474
487
|
var idleSurface = "rounded-lg text-muted-foreground hover:bg-fill-subtle hover:text-foreground";
|
|
475
488
|
var activeSurface = "rounded-lg bg-fill text-foreground";
|
|
476
489
|
var featuredSurface = "my-2 rounded-lg border border-transparent bg-brand-green text-black hover:brightness-95";
|
|
@@ -479,7 +492,7 @@ var navRowSurfaceClasses = ({ isActive, isFeatured }) => {
|
|
|
479
492
|
if (isActive) return activeSurface;
|
|
480
493
|
return idleSurface;
|
|
481
494
|
};
|
|
482
|
-
var navItemLayoutClasses = ({ isCollapsed, level = 0, size }) => require_utils.cn(navItemVariants({ size }), "w-full justify-start", "[&_svg]:size-4 [&_svg]:shrink-0", require_primitives_transitions.focusRing, !isCollapsed && nestedExpandedItemClasses(level), isCollapsed && "gap-0 px-[13.5px] py-0");
|
|
495
|
+
var navItemLayoutClasses = ({ isCollapsed, level = 0, size }) => require_utils.cn(navItemVariants({ size }), "w-full justify-start", "[&_svg]:size-4 [&_svg]:shrink-0", require_primitives_transitions.focusRing, !isCollapsed && nestedExpandedItemClasses(level), !isCollapsed && withDescriptionClasses, isCollapsed && "gap-0 px-[13.5px] py-0");
|
|
483
496
|
var navItemClasses = ({ isActive, isCollapsed, isFeatured, level, size } = {}) => require_utils.cn(navItemLayoutClasses({
|
|
484
497
|
isCollapsed,
|
|
485
498
|
level,
|
|
@@ -589,8 +602,27 @@ function NavRowTooltip({ label, children }) {
|
|
|
589
602
|
function NavRowBody({ action, surfaceClassName, children }) {
|
|
590
603
|
if (!action) return children;
|
|
591
604
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
592
|
-
className: require_utils.cn("flex min-w-0 items-center pr-
|
|
593
|
-
children: [children,
|
|
605
|
+
className: require_utils.cn("group/nav-row relative flex min-w-0 items-center pr-0.75 has-[[data-slot=sidebar-nav-description]]:items-start", surfaceClassName),
|
|
606
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
607
|
+
className: "flex shrink-0 items-center group-has-[[data-slot=sidebar-nav-description]]/nav-row:pt-0.75",
|
|
608
|
+
children: action
|
|
609
|
+
})]
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* An icon button for a row's `action` slot: 24px, so it keeps 3px from the row's top and
|
|
614
|
+
* right edges on a 30px row, with corners inset from the row's `rounded-lg` by those 3px.
|
|
615
|
+
*
|
|
616
|
+
* A row with actions is `group/nav-row` and `relative`, so hover-only actions reveal with
|
|
617
|
+
* `group-hover/nav-row:` without lighting up while a nested row in `subItems` is hovered.
|
|
618
|
+
*/
|
|
619
|
+
function SidebarNavAction({ className, ...props }) {
|
|
620
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
621
|
+
type: "button",
|
|
622
|
+
...props,
|
|
623
|
+
variant: "ghost",
|
|
624
|
+
size: "icon-sm",
|
|
625
|
+
className: require_utils.cn("size-6 rounded-[calc(var(--radius-lg)-3px)]", className)
|
|
594
626
|
});
|
|
595
627
|
}
|
|
596
628
|
// src/ds/components/Sidebar/nav/sidebar-nav-list.tsx
|
|
@@ -1497,6 +1529,7 @@ var Sidebar = Object.assign(SidebarRoot, {
|
|
|
1497
1529
|
MobileTrigger: SidebarMobileTrigger,
|
|
1498
1530
|
Nav: SidebarNav,
|
|
1499
1531
|
NavHeader: SidebarNavHeader,
|
|
1532
|
+
NavAction: SidebarNavAction,
|
|
1500
1533
|
NavLabel: SidebarNavLabel,
|
|
1501
1534
|
NavLink: SidebarNavLink,
|
|
1502
1535
|
NavList: SidebarNavList,
|
|
@@ -1531,6 +1564,7 @@ exports.SidebarHeader = SidebarHeader;
|
|
|
1531
1564
|
exports.SidebarMeter = SidebarMeter;
|
|
1532
1565
|
exports.SidebarMobileTrigger = SidebarMobileTrigger;
|
|
1533
1566
|
exports.SidebarNav = SidebarNav;
|
|
1567
|
+
exports.SidebarNavAction = SidebarNavAction;
|
|
1534
1568
|
exports.SidebarNavHeader = SidebarNavHeader;
|
|
1535
1569
|
exports.SidebarNavLink = SidebarNavLink;
|
|
1536
1570
|
exports.SidebarNavShowMore = SidebarNavShowMore;
|