@loworbitstudio/visor 1.38.0 → 1.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.json +1 -1
- package/dist/index.js +30 -0
- package/dist/registry.json +14 -12
- package/dist/visor-manifest.json +135 -22
- package/package.json +2 -2
package/dist/CHANGELOG.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -9110,6 +9110,36 @@ var FIXTURES = {
|
|
|
9110
9110
|
colors: {
|
|
9111
9111
|
export: "Text",
|
|
9112
9112
|
props: `{ as: "div", children: ["primary", "secondary", "tertiary", "warning"].map(function (c) { return React.createElement(__mod.Text, { key: c, size: "sm", color: c }, "Text " + c) }) }`
|
|
9113
|
+
},
|
|
9114
|
+
// VI-715: a plain line, then the mono face and the success and amber inks.
|
|
9115
|
+
faces: {
|
|
9116
|
+
export: "Text",
|
|
9117
|
+
props: `{ as: "div", children: [
|
|
9118
|
+
React.createElement(__mod.Text, { key: "plain", "data-face": "plain" }, "Total"),
|
|
9119
|
+
React.createElement(__mod.Text, { key: "mono", "data-face": "mono", family: "mono", weight: "bold" }, "$400"),
|
|
9120
|
+
React.createElement(__mod.Text, { key: "success", "data-face": "success", color: "success" }, "Total $400 of $400"),
|
|
9121
|
+
React.createElement(__mod.Text, { key: "amber", "data-face": "amber", color: "amber" }, "Held"),
|
|
9122
|
+
React.createElement(__mod.Text, { key: "warning", "data-face": "warning", color: "warning" }, "Left to Assign")
|
|
9123
|
+
] }`
|
|
9124
|
+
}
|
|
9125
|
+
},
|
|
9126
|
+
// VI-714: the end-of-flow panel with a check list and an action.
|
|
9127
|
+
"success-feedback": {
|
|
9128
|
+
panel: {
|
|
9129
|
+
export: "SuccessPanel",
|
|
9130
|
+
props: `{ style: { width: 420 }, heading: "You\u2019re all set", description: "Your bookings, their fees and your payments live on your dashboard.", items: [{ content: [React.createElement("b", { key: "b" }, "Your info"), " is saved."] }, { content: [React.createElement("b", { key: "b" }, "Your W-9"), " is signed and released to Animal Brooklyn."] }], action: React.createElement("button", { type: "button" }, "Go to Dashboard") }`
|
|
9131
|
+
}
|
|
9132
|
+
},
|
|
9133
|
+
// VI-713: labelled steps, one in every state, at both sizes.
|
|
9134
|
+
"segmented-progress": {
|
|
9135
|
+
default: { export: "SegmentedProgress", props: `{ total: 6, value: 2, current: 2, "aria-label": "Step 3 of 6", style: { width: 360 } }` },
|
|
9136
|
+
steps: {
|
|
9137
|
+
export: "SegmentedProgress",
|
|
9138
|
+
props: `{ style: { width: 360 }, steps: [{ label: "Your Info", state: "done" }, { label: "Bank Details", state: "current" }, { label: "W-9", state: "pending" }, { label: "Paid", state: "failed" }] }`
|
|
9139
|
+
},
|
|
9140
|
+
"steps-md": {
|
|
9141
|
+
export: "SegmentedProgress",
|
|
9142
|
+
props: `{ size: "md", style: { width: 360 }, steps: [{ label: "Your Info", state: "done" }, { label: "Bank Details", state: "current" }, { label: "W-9", state: "pending" }, { label: "Paid", state: "failed" }] }`
|
|
9113
9143
|
}
|
|
9114
9144
|
},
|
|
9115
9145
|
// Form controls (VI-655). Each has a resting fixture plus the states that
|
package/dist/registry.json
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
{
|
|
79
79
|
"name": "text",
|
|
80
80
|
"type": "registry:ui",
|
|
81
|
-
"description": "A body text component with size, weight, color, and line-height variants using CVA.",
|
|
81
|
+
"description": "A body text component with size, weight, family (body or mono), color (including success and amber inks), and line-height variants using CVA.",
|
|
82
82
|
"category": "typography",
|
|
83
83
|
"dependencies": [
|
|
84
84
|
"class-variance-authority",
|
|
@@ -91,12 +91,12 @@
|
|
|
91
91
|
{
|
|
92
92
|
"path": "components/ui/text/text.tsx",
|
|
93
93
|
"type": "registry:ui",
|
|
94
|
-
"content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./text.module.css\"\n\nconst textVariants = cva(styles.base, {\n variants: {\n size: {\n xs: styles.sizeXs,\n sm: styles.sizeSm,\n md: styles.sizeMd,\n lg: styles.sizeLg,\n xl: styles.sizeXl,\n },\n weight: {\n normal: styles.weightNormal,\n medium: styles.weightMedium,\n semibold: styles.weightSemibold,\n bold: styles.weightBold,\n },\n color: {\n primary: styles.colorPrimary,\n secondary: styles.colorSecondary,\n tertiary: styles.colorTertiary,\n warning: styles.colorWarning,\n inherit: styles.colorInherit,\n },\n leading: {\n tight: styles.leadingTight,\n snug: styles.leadingSnug,\n normal: styles.leadingNormal,\n relaxed: styles.leadingRelaxed,\n loose: styles.leadingLoose,\n },\n },\n defaultVariants: {\n size: \"md\",\n weight: \"normal\",\n color: \"primary\",\n leading: \"normal\",\n },\n})\n\nexport interface TextProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"color\">,\n VariantProps<typeof textVariants> {\n as?: \"p\" | \"span\" | \"div\" | \"label\"\n}\n\nconst Text = React.forwardRef<HTMLElement, TextProps>(\n ({ className, as: Tag = \"p\", size, weight, color, leading, ...props }, ref) => {\n return (\n <Tag\n ref={ref as React.Ref<never>}\n data-slot=\"text\"\n className={cn(textVariants({ size, weight, color, leading }), className)}\n {...props}\n />\n )\n }\n)\nText.displayName = \"Text\"\n\nexport { Text, textVariants }\n"
|
|
94
|
+
"content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./text.module.css\"\n\nconst textVariants = cva(styles.base, {\n variants: {\n size: {\n xs: styles.sizeXs,\n sm: styles.sizeSm,\n md: styles.sizeMd,\n lg: styles.sizeLg,\n xl: styles.sizeXl,\n },\n weight: {\n normal: styles.weightNormal,\n medium: styles.weightMedium,\n semibold: styles.weightSemibold,\n bold: styles.weightBold,\n },\n // `body` adds no class: .base already sets the body face, so unset renders as before.\n family: {\n body: \"\",\n mono: styles.familyMono,\n },\n color: {\n primary: styles.colorPrimary,\n secondary: styles.colorSecondary,\n tertiary: styles.colorTertiary,\n warning: styles.colorWarning,\n success: styles.colorSuccess,\n amber: styles.colorAmber,\n inherit: styles.colorInherit,\n },\n leading: {\n tight: styles.leadingTight,\n snug: styles.leadingSnug,\n normal: styles.leadingNormal,\n relaxed: styles.leadingRelaxed,\n loose: styles.leadingLoose,\n },\n },\n defaultVariants: {\n size: \"md\",\n weight: \"normal\",\n family: \"body\",\n color: \"primary\",\n leading: \"normal\",\n },\n})\n\nexport interface TextProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"color\">,\n VariantProps<typeof textVariants> {\n as?: \"p\" | \"span\" | \"div\" | \"label\"\n}\n\nconst Text = React.forwardRef<HTMLElement, TextProps>(\n ({ className, as: Tag = \"p\", size, weight, family, color, leading, ...props }, ref) => {\n return (\n <Tag\n ref={ref as React.Ref<never>}\n data-slot=\"text\"\n className={cn(textVariants({ size, weight, family, color, leading }), className)}\n {...props}\n />\n )\n }\n)\nText.displayName = \"Text\"\n\nexport { Text, textVariants }\n"
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
"path": "components/ui/text/text.module.css",
|
|
98
98
|
"type": "registry:ui",
|
|
99
|
-
"content": "/* Text base styles */\n.base {\n font-family: var(--font-body, inherit);\n margin: 0;\n}\n\n/* Sizes\n * A theme sets each size's type size, case and tracking through\n * --text-<size>-* (VI-656). Case and tracking live in visor-base, below. */\n.sizeXs {\n font-size: var(--text-xs-font-size, var(--font-size-xs, 0.75rem));\n}\n\n.sizeSm {\n font-size: var(--text-sm-font-size, var(--font-size-sm, 0.875rem));\n}\n\n.sizeMd {\n font-size: var(--text-md-font-size, var(--font-size-base, 1rem));\n}\n\n.sizeLg {\n font-size: var(--text-lg-font-size, var(--font-size-lg, 1.125rem));\n}\n\n.sizeXl {\n font-size: var(--text-xl-font-size, var(--font-size-xl, 1.25rem));\n}\n\n/* Case and tracking are inherited properties, so any unlayered fallback would\n override something: `inherit` beats a layered utility, `revert-layer` drops\n an unlayered consumer rule. In visor-base, the lowest Visor layer (the reset's),\n every consumer rule still wins, and when the hook is unset revert-layer\n leaves the element exactly as if these declarations were absent. */\n@layer visor-base {\n .sizeXs {\n text-transform: var(--text-xs-text-transform, revert-layer);\n letter-spacing: var(--text-xs-letter-spacing, revert-layer);\n }\n\n .sizeSm {\n text-transform: var(--text-sm-text-transform, revert-layer);\n letter-spacing: var(--text-sm-letter-spacing, revert-layer);\n }\n\n .sizeMd {\n text-transform: var(--text-md-text-transform, revert-layer);\n letter-spacing: var(--text-md-letter-spacing, revert-layer);\n }\n\n .sizeLg {\n text-transform: var(--text-lg-text-transform, revert-layer);\n letter-spacing: var(--text-lg-letter-spacing, revert-layer);\n }\n\n .sizeXl {\n text-transform: var(--text-xl-text-transform, revert-layer);\n letter-spacing: var(--text-xl-letter-spacing, revert-layer);\n }\n}\n\n/* Weights */\n.weightNormal {\n font-weight: var(--font-weight-normal, 400);\n}\n\n.weightMedium {\n font-weight: var(--font-weight-medium, 500);\n}\n\n.weightSemibold {\n font-weight: var(--font-weight-semibold, 600);\n}\n\n.weightBold {\n font-weight: var(--font-weight-bold, 700);\n}\n\n/* Colors */\n.colorPrimary {\n color: var(--text-primary, #111827);\n}\n\n.colorSecondary {\n color: var(--text-secondary, #6b7280);\n}\n\n.colorTertiary {\n color: var(--text-tertiary, #9ca3af);\n}\n\n.colorWarning {\n color: var(--text-warning, #b45309);\n}\n\n.colorInherit {\n color: inherit;\n}\n\n/* Line height */\n.leadingTight {\n line-height: var(--line-height-tight, 1.25);\n}\n\n.leadingSnug {\n line-height: var(--line-height-snug, 1.375);\n}\n\n.leadingNormal {\n line-height: var(--line-height-normal, 1.5);\n}\n\n.leadingRelaxed {\n line-height: var(--line-height-relaxed, 1.625);\n}\n\n.leadingLoose {\n line-height: var(--line-height-loose, 2);\n}\n"
|
|
99
|
+
"content": "/* Text base styles */\n.base {\n font-family: var(--font-body, inherit);\n margin: 0;\n}\n\n/* Sizes\n * A theme sets each size's type size, case and tracking through\n * --text-<size>-* (VI-656). Case and tracking live in visor-base, below. */\n.sizeXs {\n font-size: var(--text-xs-font-size, var(--font-size-xs, 0.75rem));\n}\n\n.sizeSm {\n font-size: var(--text-sm-font-size, var(--font-size-sm, 0.875rem));\n}\n\n.sizeMd {\n font-size: var(--text-md-font-size, var(--font-size-base, 1rem));\n}\n\n.sizeLg {\n font-size: var(--text-lg-font-size, var(--font-size-lg, 1.125rem));\n}\n\n.sizeXl {\n font-size: var(--text-xl-font-size, var(--font-size-xl, 1.25rem));\n}\n\n/* Case and tracking are inherited properties, so any unlayered fallback would\n override something: `inherit` beats a layered utility, `revert-layer` drops\n an unlayered consumer rule. In visor-base, the lowest Visor layer (the reset's),\n every consumer rule still wins, and when the hook is unset revert-layer\n leaves the element exactly as if these declarations were absent. */\n@layer visor-base {\n .sizeXs {\n text-transform: var(--text-xs-text-transform, revert-layer);\n letter-spacing: var(--text-xs-letter-spacing, revert-layer);\n }\n\n .sizeSm {\n text-transform: var(--text-sm-text-transform, revert-layer);\n letter-spacing: var(--text-sm-letter-spacing, revert-layer);\n }\n\n .sizeMd {\n text-transform: var(--text-md-text-transform, revert-layer);\n letter-spacing: var(--text-md-letter-spacing, revert-layer);\n }\n\n .sizeLg {\n text-transform: var(--text-lg-text-transform, revert-layer);\n letter-spacing: var(--text-lg-letter-spacing, revert-layer);\n }\n\n .sizeXl {\n text-transform: var(--text-xl-text-transform, revert-layer);\n letter-spacing: var(--text-xl-letter-spacing, revert-layer);\n }\n}\n\n/* Weights */\n.weightNormal {\n font-weight: var(--font-weight-normal, 400);\n}\n\n.weightMedium {\n font-weight: var(--font-weight-medium, 500);\n}\n\n.weightSemibold {\n font-weight: var(--font-weight-semibold, 600);\n}\n\n.weightBold {\n font-weight: var(--font-weight-bold, 700);\n}\n\n/* Families. `body` is .base itself; mono swaps the face and composes with\n every size and weight (VI-715). */\n.familyMono {\n font-family: var(--font-mono, ui-monospace, monospace);\n}\n\n/* Colors */\n.colorPrimary {\n color: var(--text-primary, #111827);\n}\n\n.colorSecondary {\n color: var(--text-secondary, #6b7280);\n}\n\n.colorTertiary {\n color: var(--text-tertiary, #9ca3af);\n}\n\n.colorWarning {\n color: var(--text-warning, #b45309);\n}\n\n.colorSuccess {\n color: var(--text-success, #15803d);\n}\n\n/* A second amber a theme can bind without moving `warning` (VI-715). */\n.colorAmber {\n color: var(--text-amber, var(--text-warning, #b45309));\n}\n\n.colorInherit {\n color: inherit;\n}\n\n/* Line height */\n.leadingTight {\n line-height: var(--line-height-tight, 1.25);\n}\n\n.leadingSnug {\n line-height: var(--line-height-snug, 1.375);\n}\n\n.leadingNormal {\n line-height: var(--line-height-normal, 1.5);\n}\n\n.leadingRelaxed {\n line-height: var(--line-height-relaxed, 1.625);\n}\n\n.leadingLoose {\n line-height: var(--line-height-loose, 2);\n}\n"
|
|
100
100
|
}
|
|
101
101
|
]
|
|
102
102
|
},
|
|
@@ -792,10 +792,11 @@
|
|
|
792
792
|
{
|
|
793
793
|
"name": "segmented-progress",
|
|
794
794
|
"type": "registry:ui",
|
|
795
|
-
"description": "Discrete per-step progress meter — N equal pill segments in a row, each individually expressing done, current, or pending state. Designed for multi-step flows where individual step completion matters.",
|
|
795
|
+
"description": "Discrete per-step progress meter — N equal pill segments in a row, each individually expressing done, current, or pending state. With `steps`, a label under each segment, a failed state, a fill-once animation and a visually hidden summary. Designed for multi-step flows where individual step completion matters.",
|
|
796
796
|
"category": "data-display",
|
|
797
797
|
"dependencies": [
|
|
798
798
|
"class-variance-authority",
|
|
799
|
+
"@phosphor-icons/react",
|
|
799
800
|
"@loworbitstudio/visor-core"
|
|
800
801
|
],
|
|
801
802
|
"registryDependencies": [
|
|
@@ -805,12 +806,12 @@
|
|
|
805
806
|
{
|
|
806
807
|
"path": "components/ui/segmented-progress/segmented-progress.tsx",
|
|
807
808
|
"type": "registry:ui",
|
|
808
|
-
"content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./segmented-progress.module.css\"\n\nconst segmentedProgressVariants = cva(styles.root, {\n variants: {\n size: {\n sm: styles.sizeSm,\n md: styles.sizeMd,\n },\n },\n defaultVariants: {\n size: \"sm\",\n },\n})\n\nexport
|
|
809
|
+
"content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { CheckCircle, WarningCircle } from \"@phosphor-icons/react/dist/ssr\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./segmented-progress.module.css\"\n\nconst segmentedProgressVariants = cva(styles.root, {\n variants: {\n size: {\n sm: styles.sizeSm,\n md: styles.sizeMd,\n },\n },\n defaultVariants: {\n size: \"sm\",\n },\n})\n\nexport type SegmentedProgressStepState = \"done\" | \"current\" | \"pending\" | \"failed\"\n\nexport interface SegmentedProgressStep {\n /** The words under the step's segment. */\n label: React.ReactNode\n /**\n * The step's state. When omitted it follows `value` and `current`, as an\n * unlabelled bar does.\n */\n state?: SegmentedProgressStepState\n}\n\ninterface SegmentedProgressBaseProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"aria-label\">,\n VariantProps<typeof segmentedProgressVariants> {\n /**\n * Optional 0-based index of the in-progress segment.\n * Renders with a primary→muted gradient. Typically equals `value`.\n */\n current?: number\n /** Visual size of each segment. @default \"sm\" */\n size?: \"sm\" | \"md\"\n}\n\nexport interface SegmentedProgressCountProps extends SegmentedProgressBaseProps {\n steps?: undefined\n summary?: undefined\n /** Total number of segments. */\n total: number\n /** Count of completed segments (indices 0..value-1 render done). */\n value: number\n /** Accessible name for the progress bar. Required. */\n \"aria-label\": string\n}\n\nexport interface SegmentedProgressStepsProps extends SegmentedProgressBaseProps {\n /**\n * One entry per step: a segment with its label under it. The bar is then\n * hidden from assistive tech and `summary` is what a screen reader hears.\n */\n steps: SegmentedProgressStep[]\n /**\n * The visually hidden line read in place of the bar. Defaults to\n * \"Step 2 of 3: Bank Details\", naming the failed, current or next step.\n */\n summary?: React.ReactNode\n /** Ignored with `steps`: the step count is `steps.length`. */\n total?: number\n /** Count of steps that default to done when a step sets no `state`. */\n value?: number\n /** Not used with `steps`: `summary` carries the words. */\n \"aria-label\"?: undefined\n}\n\nexport type SegmentedProgressProps = SegmentedProgressCountProps | SegmentedProgressStepsProps\n\nfunction stateAt(i: number, value: number, current?: number): SegmentedProgressStepState {\n return i < value ? \"done\" : i === current ? \"current\" : \"pending\"\n}\n\nconst STATE_CLASS: Record<SegmentedProgressStepState, string> = {\n done: styles.segmentDone,\n current: styles.segmentCurrent,\n pending: styles.segmentPending,\n failed: styles.segmentFailed,\n}\n\nfunction defaultSummary(steps: SegmentedProgressStep[], states: SegmentedProgressStepState[]): React.ReactNode {\n const n = steps.length\n const at = [states.indexOf(\"failed\"), states.indexOf(\"current\"), states.indexOf(\"pending\")].find((i) => i >= 0)\n if (at === undefined) return `All ${n} steps done`\n return (\n <>\n {`Step ${at + 1} of ${n}${states[at] === \"failed\" ? \" failed\" : \"\"}: `}\n {steps[at].label}\n </>\n )\n}\n\nconst SegmentedProgress = React.forwardRef<HTMLDivElement, SegmentedProgressProps>(\n (\n {\n className,\n total,\n value,\n current,\n size = \"sm\",\n steps,\n summary,\n \"aria-label\": ariaLabel,\n ...props\n },\n ref\n ) => {\n if (steps) {\n const states = steps.map((s, i) => s.state ?? stateAt(i, value ?? 0, current))\n return (\n <div\n ref={ref}\n data-slot=\"segmented-progress\"\n data-size={size}\n data-labelled=\"\"\n className={cn(segmentedProgressVariants({ size }), styles.labelled, className)}\n {...props}\n >\n <span data-slot=\"segmented-progress-summary\" className={styles.summary}>\n {summary ?? defaultSummary(steps, states)}\n </span>\n {steps.map((step, i) => {\n const state = states[i]\n const Icon = state === \"done\" ? CheckCircle : state === \"failed\" ? WarningCircle : null\n return (\n <div\n key={i}\n data-slot=\"segmented-progress-step\"\n data-state={state}\n aria-hidden=\"true\"\n className={styles.step}\n style={{ \"--segmented-progress-index\": i } as React.CSSProperties}\n >\n <span\n data-slot=\"segmented-progress-segment\"\n data-state={state}\n className={cn(styles.segment, STATE_CLASS[state], styles.fill)}\n />\n <span data-slot=\"segmented-progress-label\" className={styles.label}>\n {Icon && <Icon className={styles.labelIcon} />}\n <span className={styles.labelText}>{step.label}</span>\n </span>\n </div>\n )\n })}\n </div>\n )\n }\n\n const safeTotal = Math.max(total ?? 1, 1)\n const clampedValue = Math.min(Math.max(value ?? 0, 0), safeTotal)\n\n return (\n <div\n ref={ref}\n data-slot=\"segmented-progress\"\n data-size={size}\n role=\"progressbar\"\n aria-valuemin={0}\n aria-valuemax={safeTotal}\n aria-valuenow={clampedValue}\n aria-label={ariaLabel}\n className={cn(segmentedProgressVariants({ size }), className)}\n {...props}\n >\n {Array.from({ length: safeTotal }, (_, i) => {\n const state = stateAt(i, clampedValue, current)\n return (\n <span\n key={i}\n data-slot=\"segmented-progress-segment\"\n data-state={state}\n className={cn(\n styles.segment,\n state === \"done\" && styles.segmentDone,\n state === \"current\" && styles.segmentCurrent,\n state === \"pending\" && styles.segmentPending\n )}\n />\n )\n })}\n </div>\n )\n }\n)\nSegmentedProgress.displayName = \"SegmentedProgress\"\n\nexport { SegmentedProgress, segmentedProgressVariants }\n"
|
|
809
810
|
},
|
|
810
811
|
{
|
|
811
812
|
"path": "components/ui/segmented-progress/segmented-progress.module.css",
|
|
812
813
|
"type": "registry:ui",
|
|
813
|
-
"content": "/* SegmentedProgress\n *\n * Discrete per-step progress meter: N equal segments in a row, each\n * individually expressing done, current, or pending state.\n *\n * Segment heights (6px sm / 8px md) are component-intrinsic dimensions —\n * no spacing token maps to these values (same precedent as status-dot's 6px).\n * All other spacing, radius, color, and motion values use tokens.\n */\n\n.root {\n display: flex;\n gap: var(--spacing-1, 0.25rem);\n width: 100%;\n}\n\n/* Segment — base pill shape */\n.segment {\n flex: 1;\n border-radius: var(--radius-full, 9999px);\n transition: background var(--motion-duration-150, 150ms)\n var(--motion-easing-default, ease-in-out);\n}\n\n/* State: done — solid primary fill */\n.segment.segmentDone {\n background: var(--interactive-primary-bg, var(--primary, #111827));\n}\n\n/* State: current — gradient from
|
|
814
|
+
"content": "/* SegmentedProgress\n *\n * Discrete per-step progress meter: N equal segments in a row, each\n * individually expressing done, current, or pending state.\n *\n * Segment heights (6px sm / 8px md) are component-intrinsic dimensions —\n * no spacing token maps to these values (same precedent as status-dot's 6px).\n * All other spacing, radius, color, and motion values use tokens.\n */\n\n.root {\n display: flex;\n gap: var(--spacing-1, 0.25rem);\n width: 100%;\n}\n\n/* Segment — base pill shape */\n.segment {\n flex: 1;\n border-radius: var(--radius-full, 9999px);\n transition: background var(--motion-duration-150, 150ms)\n var(--motion-easing-default, ease-in-out);\n}\n\n/* State: done — solid primary fill */\n.segment.segmentDone {\n background: var(--interactive-primary-bg, var(--primary, #111827));\n}\n\n/* State: current — gradient from the strong rung into muted (~55%/45% split).\n --button-strong-fill lets a host rebind it; unset it is the primary (VI-713). */\n.segment.segmentCurrent {\n background: linear-gradient(\n 90deg,\n var(--button-strong-fill, var(--interactive-primary-bg, var(--primary, #111827))) 55%,\n var(--surface-muted, #e5e7eb) 55%\n );\n}\n\n/* State: pending — muted surface */\n.segment.segmentPending {\n background: var(--surface-muted, #e5e7eb);\n}\n\n/* Size sm — 6px tall (matches the brand-workbench prototype) */\n.sizeSm .segment {\n height: 6px;\n}\n\n/* Size md — 8px tall */\n.sizeMd .segment {\n height: 8px;\n}\n\n/* ── Labelled steps (VI-713) ────────────────────────────────────────────\n * With `steps`, each segment sits over its label, a step can fail, and the\n * fills draw left to right once on mount. None of this applies to a bar\n * without `steps`, which renders exactly as before. */\n\n.labelled {\n position: relative;\n}\n\n.labelled.sizeMd {\n gap: var(--spacing-2, 0.5rem);\n}\n\n.step {\n display: flex;\n flex: 1;\n flex-direction: column;\n gap: var(--spacing-2, 0.5rem);\n min-width: 0;\n}\n\n/* The track is muted; the fill is a layer clipped to the state's extent, so\n it can draw in from the left. */\n.segment.fill {\n flex: none;\n position: relative;\n overflow: hidden;\n background: var(--surface-muted, #e5e7eb);\n}\n\n.fill::before {\n content: \"\";\n position: absolute;\n inset: 0;\n border-radius: inherit;\n background: var(--interactive-primary-bg, var(--primary, #111827));\n clip-path: inset(0 100% 0 0 round var(--radius-full, 9999px));\n transition: clip-path var(--motion-duration-300, 300ms)\n var(--motion-easing-ease-out, ease-out);\n}\n\n.fill.segmentDone::before {\n clip-path: inset(0 round var(--radius-full, 9999px));\n}\n\n.fill.segmentCurrent::before {\n background: var(--button-strong-fill, var(--interactive-primary-bg, var(--primary, #111827)));\n clip-path: inset(0 45% 0 0 round var(--radius-full, 9999px));\n}\n\n.fill.segmentFailed::before {\n background: var(--interactive-destructive-bg, #dc2626);\n clip-path: inset(0 round var(--radius-full, 9999px));\n}\n\n/* Label: 12px under sm, 14px under md. A host rebinds the size hooks (at\n desktop widths, say) without touching the component. */\n.label {\n display: flex;\n align-items: center;\n gap: var(--spacing-1, 0.25rem);\n min-width: 0;\n font-size: var(--segmented-progress-sm-label-font-size, var(--font-size-xs, 0.75rem));\n line-height: var(--line-height-tight, 1.25);\n color: var(--text-tertiary, #9ca3af);\n}\n\n.sizeMd .label {\n font-size: var(--segmented-progress-md-label-font-size, var(--font-size-sm, 0.875rem));\n}\n\n.labelText {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* Intentional: the glyph draws a touch larger than its label, as in the design. */\n.labelIcon {\n flex: none;\n width: 1.1em;\n height: 1.1em;\n color: var(--interactive-primary-bg, var(--primary, #111827));\n}\n\n.step[data-state=\"current\"] .label {\n color: var(--text-primary, #111827);\n font-weight: var(--font-weight-bold, 700);\n}\n\n.step[data-state=\"done\"] .label {\n color: var(--text-secondary, #6b7280);\n}\n\n.step[data-state=\"failed\"] .label,\n.step[data-state=\"failed\"] .labelIcon {\n color: var(--text-error, #b91c1c);\n}\n\n.step[data-state=\"failed\"] .label {\n font-weight: var(--font-weight-bold, 700);\n}\n\n/* The words a screen reader hears in place of the bar. */\n.summary {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n/* Fill once on mount, each segment ~140ms after the one before it. */\n@media (prefers-reduced-motion: no-preference) {\n .fill::before {\n animation: segmented-progress-fill var(--segmented-progress-fill-duration, 600ms)\n var(--motion-easing-ease-out, ease-out) both;\n animation-delay: calc(\n var(--segmented-progress-index, 0) * var(--segmented-progress-fill-stagger, 140ms)\n );\n }\n}\n\n@keyframes segmented-progress-fill {\n from {\n clip-path: inset(0 100% 0 0 round var(--radius-full, 9999px));\n }\n}\n\n/* Respect reduced motion — disable transitions; the fills draw static */\n@media (prefers-reduced-motion: reduce) {\n .segment {\n transition: none;\n }\n\n .fill::before {\n transition: none;\n }\n}\n"
|
|
814
815
|
}
|
|
815
816
|
]
|
|
816
817
|
},
|
|
@@ -831,7 +832,7 @@
|
|
|
831
832
|
{
|
|
832
833
|
"path": "components/ui/dialog/dialog.tsx",
|
|
833
834
|
"type": "registry:ui",
|
|
834
|
-
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport { ArrowLeftIcon, XIcon } from \"@phosphor-icons/react\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./dialog.module.css\"\n\ntype DialogPresentation = \"dialog\" | \"sheet\" | \"responsive\"\n\ninterface DialogContextValue {\n /** The presentation actually in force: `responsive` has already been resolved. */\n presentation: \"dialog\" | \"sheet\"\n container: HTMLElement | null | undefined\n open: boolean\n}\n\nconst DialogContext = React.createContext<DialogContextValue>({\n presentation: \"dialog\",\n container: undefined,\n open: false,\n})\n\nexport interface DialogProps\n extends React.ComponentProps<typeof DialogPrimitive.Root> {\n /**\n * How the content is presented. `dialog` is a centred modal, `sheet` is a\n * bottom sheet, `responsive` is a dialog from `breakpoint` up and a sheet\n * below it. The content, focus trap and Escape handling are identical.\n */\n presentation?: DialogPresentation\n /**\n * Viewport width at which `responsive` switches from sheet to dialog. A\n * number is px; a string is any CSS length (`\"40rem\"`). Defaults to 640.\n */\n breakpoint?: number | string\n /**\n * Element the overlay and content portal into, covering only that element.\n * A scoped dialog is not modal: it traps focus inside the content and makes\n * the container's other children `inert`, but leaves everything outside the\n * container interactive (Radix modal mode would aria-hide the page and block\n * pointer events on `body`). Pass the element itself (hold it in state), not\n * a ref. The container is given `position: relative` if it is `static`.\n */\n container?: HTMLElement | null\n}\n\nfunction Dialog({\n presentation = \"dialog\",\n breakpoint = 640,\n container,\n modal = true,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n ...props\n}: DialogProps) {\n const minWidth = typeof breakpoint === \"number\" ? `${breakpoint}px` : breakpoint\n const isWide = useMinWidth(minWidth)\n const resolved =\n presentation === \"responsive\" ? (isWide ? \"dialog\" : \"sheet\") : presentation\n\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n const open = openProp ?? uncontrolledOpen\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next)\n onOpenChange?.(next)\n },\n [onOpenChange]\n )\n\n const value = React.useMemo(\n () => ({ presentation: resolved, container, open }),\n [resolved, container, open]\n )\n\n return (\n <DialogContext.Provider value={value}>\n <DialogPrimitive.Root\n data-slot=\"dialog\"\n modal={container ? false : modal}\n open={open}\n onOpenChange={handleOpenChange}\n {...props}\n />\n </DialogContext.Provider>\n )\n}\nDialog.displayName = \"Dialog\"\n\n/** True when the viewport is at least `minWidth` wide. Desktop where matchMedia is absent. */\nfunction useMinWidth(minWidth: string): boolean {\n const query = `(min-width: ${minWidth})`\n const [matches, setMatches] = React.useState<boolean>(() =>\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(query).matches\n : true\n )\n React.useEffect(() => {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return\n const mq = window.matchMedia(query)\n setMatches(mq.matches)\n const onChange = (e: MediaQueryListEvent) => setMatches(e.matches)\n mq.addEventListener(\"change\", onChange)\n return () => mq.removeEventListener(\"change\", onChange)\n }, [query])\n return matches\n}\n\n/**\n * Scoped dialogs: make every other child of the container inert while open, and\n * make sure the container can anchor absolutely positioned content.\n */\nfunction useScopedContainer(container: HTMLElement | null | undefined, node: HTMLElement | null) {\n React.useEffect(() => {\n if (!container || !node) return\n let branch: HTMLElement = node\n while (branch.parentElement && branch.parentElement !== container) {\n branch = branch.parentElement\n }\n if (branch.parentElement !== container) return\n\n const inerted: Element[] = []\n for (const child of Array.from(container.children)) {\n if (child !== branch && !child.hasAttribute(\"inert\")) {\n child.setAttribute(\"inert\", \"\")\n inerted.push(child)\n }\n }\n const anchored = getComputedStyle(container).position === \"static\"\n if (anchored) container.style.position = \"relative\"\n\n return () => {\n for (const child of inerted) child.removeAttribute(\"inert\")\n if (anchored) container.style.position = \"\"\n }\n }, [container, node])\n}\n\n/**\n * Bottom sheet: keep the panel above the on-screen keyboard. The layout\n * viewport does not shrink on iOS, so size to the visual viewport and lift the\n * panel by the keyboard's height; keep the focused field in view.\n */\nfunction useKeyboardAvoidance(enabled: boolean, node: HTMLElement | null) {\n React.useEffect(() => {\n if (!enabled || !node || typeof window === \"undefined\") return\n const vv = window.visualViewport\n if (!vv) return\n const update = () => {\n const inset = Math.max(0, window.innerHeight - vv.height - vv.offsetTop)\n node.style.setProperty(\"--dialog-viewport-height\", `${vv.height}px`)\n node.style.setProperty(\"--dialog-keyboard-inset\", `${inset}px`)\n const active = document.activeElement\n if (inset > 0 && active instanceof HTMLElement && node.contains(active)) {\n active.scrollIntoView?.({ block: \"nearest\" })\n }\n }\n update()\n vv.addEventListener(\"resize\", update)\n vv.addEventListener(\"scroll\", update)\n return () => {\n vv.removeEventListener(\"resize\", update)\n vv.removeEventListener(\"scroll\", update)\n node.style.removeProperty(\"--dialog-viewport-height\")\n node.style.removeProperty(\"--dialog-keyboard-inset\")\n }\n }, [enabled, node])\n}\n\nconst DRAG_DISMISS_DISTANCE = 80\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\nDialogTrigger.displayName = \"DialogTrigger\"\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\nDialogClose.displayName = \"DialogClose\"\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\nDialogPortal.displayName = \"DialogPortal\"\n\nconst DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n React.ComponentProps<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n data-slot=\"dialog-overlay\"\n className={cn(styles.overlay, className)}\n {...props}\n />\n))\nDialogOverlay.displayName = \"DialogOverlay\"\n\n/** Backdrop for a scoped dialog. Radix renders no overlay outside modal mode. */\nconst DialogScrim = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n ({ className, ...props }, ref) => {\n const { open } = React.useContext(DialogContext)\n return (\n <div\n ref={ref}\n data-slot=\"dialog-overlay\"\n data-state={open ? \"open\" : \"closed\"}\n aria-hidden=\"true\"\n className={cn(styles.overlay, styles.scrim, className)}\n {...props}\n />\n )\n }\n)\nDialogScrim.displayName = \"DialogScrim\"\n\nexport interface DialogContentProps\n extends React.ComponentProps<typeof DialogPrimitive.Content> {\n /** Show a drag handle (sheet presentation only). Dragging down dismisses. */\n showHandle?: boolean\n}\n\nconst DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({ className, children, showHandle = false, onInteractOutside, onFocus, ...props }, ref) => {\n const { presentation, container } = React.useContext(DialogContext)\n const scoped = Boolean(container)\n const isSheet = presentation === \"sheet\"\n const [node, setNode] = React.useState<HTMLDivElement | null>(null)\n const closeRef = React.useRef<HTMLButtonElement>(null)\n const dragStart = React.useRef<number | null>(null)\n\n const setRefs = React.useCallback(\n (el: HTMLDivElement | null) => {\n setNode(el)\n if (typeof ref === \"function\") ref(el)\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = el\n },\n [ref]\n )\n\n useScopedContainer(container, node)\n useKeyboardAvoidance(isSheet && !scoped, node)\n\n const handleInteractOutside: typeof onInteractOutside = (event) => {\n onInteractOutside?.(event)\n if (!scoped || event.defaultPrevented) return\n // Only the scrim dismisses. A press on the page outside the container, or on\n // the container's inert siblings, must leave the dialog open.\n const target = event.target\n if (!(target instanceof Element && target.closest('[data-slot=\"dialog-overlay\"]'))) {\n event.preventDefault()\n }\n }\n\n const handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n onFocus?.(event)\n const target = event.target\n if (isSheet && target instanceof HTMLElement && target.matches(\"input, textarea, select, [contenteditable]\")) {\n requestAnimationFrame(() => target.scrollIntoView?.({ block: \"nearest\" }))\n }\n }\n\n const dragTo = (clientY: number, commit: boolean) => {\n if (dragStart.current === null || !node) return\n const dy = Math.max(0, clientY - dragStart.current)\n if (!commit) {\n node.style.transition = \"none\"\n node.style.transform = `translateY(${dy}px)`\n return\n }\n dragStart.current = null\n node.style.transition = \"\"\n node.style.transform = \"\"\n if (dy > DRAG_DISMISS_DISTANCE) closeRef.current?.click()\n }\n\n return (\n <DialogPortal container={container}>\n {scoped ? <DialogScrim /> : <DialogOverlay />}\n <DialogPrimitive.Content\n ref={setRefs}\n data-slot=\"dialog-content\"\n data-presentation={presentation}\n data-scoped={scoped ? \"\" : undefined}\n className={cn(\n styles.content,\n isSheet && styles.presentationSheet,\n scoped && styles.scoped,\n className\n )}\n onInteractOutside={handleInteractOutside}\n onFocus={handleFocus}\n {...props}\n >\n {isSheet && showHandle && (\n <div\n data-slot=\"dialog-handle\"\n aria-hidden=\"true\"\n className={styles.handle}\n onPointerDown={(e) => {\n dragStart.current = e.clientY\n e.currentTarget.setPointerCapture?.(e.pointerId)\n }}\n onPointerMove={(e) => dragTo(e.clientY, false)}\n onPointerUp={(e) => dragTo(e.clientY, true)}\n onPointerCancel={() => dragTo(dragStart.current ?? 0, true)}\n />\n )}\n {children}\n <DialogPrimitive.Close ref={closeRef} className={styles.closeButton}>\n <XIcon className={styles.closeIcon} />\n <span className={styles.srOnly}>Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n})\nDialogContent.displayName = \"DialogContent\"\n\nexport interface DialogHeaderProps extends React.ComponentProps<\"div\"> {\n /** Leading back action, rendered before the title (see `DialogBack`). */\n back?: React.ReactNode\n}\n\nfunction DialogHeader({ className, back, children, ...props }: DialogHeaderProps) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(styles.header, back ? styles.headerWithBack : undefined, className)}\n {...props}\n >\n {back ? (\n <>\n <div data-slot=\"dialog-back-slot\" className={styles.backSlot}>{back}</div>\n <div className={styles.headerBody}>{children}</div>\n </>\n ) : (\n children\n )}\n </div>\n )\n}\nDialogHeader.displayName = \"DialogHeader\"\n\nconst DialogBack = React.forwardRef<HTMLButtonElement, React.ComponentProps<\"button\">>(\n ({ className, children, type = \"button\", \"aria-label\": ariaLabel = \"Back\", ...props }, ref) => (\n <button\n ref={ref}\n type={type}\n data-slot=\"dialog-back\"\n aria-label={ariaLabel}\n className={cn(styles.backButton, className)}\n {...props}\n >\n {children ?? <ArrowLeftIcon className={styles.closeIcon} aria-hidden=\"true\" />}\n </button>\n )\n)\nDialogBack.displayName = \"DialogBack\"\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(styles.footer, className)}\n {...props}\n />\n )\n}\nDialogFooter.displayName = \"DialogFooter\"\n\nconst DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n React.ComponentProps<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n data-slot=\"dialog-title\"\n className={cn(styles.title, className)}\n {...props}\n />\n))\nDialogTitle.displayName = \"DialogTitle\"\n\nconst DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n React.ComponentProps<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n data-slot=\"dialog-description\"\n className={cn(styles.description, className)}\n {...props}\n />\n))\nDialogDescription.displayName = \"DialogDescription\"\n\nexport {\n Dialog,\n DialogTrigger,\n DialogClose,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogHeader,\n DialogBack,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n}\n"
|
|
835
|
+
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport { ArrowLeftIcon, XIcon } from \"@phosphor-icons/react\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./dialog.module.css\"\n\ntype DialogPresentation = \"dialog\" | \"sheet\" | \"responsive\"\n\ninterface DialogContextValue {\n /** The presentation actually in force: `responsive` has already been resolved. */\n presentation: \"dialog\" | \"sheet\"\n container: HTMLElement | null | undefined\n open: boolean\n}\n\nconst DialogContext = React.createContext<DialogContextValue>({\n presentation: \"dialog\",\n container: undefined,\n open: false,\n})\n\nexport interface DialogProps\n extends React.ComponentProps<typeof DialogPrimitive.Root> {\n /**\n * How the content is presented. `dialog` is a centred modal, `sheet` is a\n * bottom sheet, `responsive` is a dialog from `breakpoint` up and a sheet\n * below it. The content, focus trap and Escape handling are identical.\n */\n presentation?: DialogPresentation\n /**\n * Viewport width at which `responsive` switches from sheet to dialog. A\n * number is px; a string is any CSS length (`\"40rem\"`). Defaults to 640.\n */\n breakpoint?: number | string\n /**\n * Element the overlay and content portal into, covering only that element.\n * A scoped dialog is not modal: it traps focus inside the content and makes\n * the container's other children `inert`, but leaves everything outside the\n * container interactive (Radix modal mode would aria-hide the page and block\n * pointer events on `body`). Pass the element itself (hold it in state), not\n * a ref. The container is given `position: relative` if it is `static`.\n */\n container?: HTMLElement | null\n}\n\nfunction Dialog({\n presentation = \"dialog\",\n breakpoint = 640,\n container,\n modal = true,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n ...props\n}: DialogProps) {\n const minWidth = typeof breakpoint === \"number\" ? `${breakpoint}px` : breakpoint\n const isWide = useMinWidth(minWidth)\n const resolved =\n presentation === \"responsive\" ? (isWide ? \"dialog\" : \"sheet\") : presentation\n\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n const open = openProp ?? uncontrolledOpen\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next)\n onOpenChange?.(next)\n },\n [onOpenChange]\n )\n\n const value = React.useMemo(\n () => ({ presentation: resolved, container, open }),\n [resolved, container, open]\n )\n\n return (\n <DialogContext.Provider value={value}>\n <DialogPrimitive.Root\n data-slot=\"dialog\"\n modal={container ? false : modal}\n open={open}\n onOpenChange={handleOpenChange}\n {...props}\n />\n </DialogContext.Provider>\n )\n}\nDialog.displayName = \"Dialog\"\n\n/** True when the viewport is at least `minWidth` wide. Desktop where matchMedia is absent. */\nfunction useMinWidth(minWidth: string): boolean {\n const query = `(min-width: ${minWidth})`\n const [matches, setMatches] = React.useState<boolean>(() =>\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(query).matches\n : true\n )\n React.useEffect(() => {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return\n const mq = window.matchMedia(query)\n setMatches(mq.matches)\n const onChange = (e: MediaQueryListEvent) => setMatches(e.matches)\n mq.addEventListener(\"change\", onChange)\n return () => mq.removeEventListener(\"change\", onChange)\n }, [query])\n return matches\n}\n\n/**\n * Scoped dialogs: make every other child of the container inert while open, and\n * make sure the container can anchor absolutely positioned content.\n */\nfunction useScopedContainer(container: HTMLElement | null | undefined, node: HTMLElement | null) {\n React.useEffect(() => {\n if (!container || !node) return\n let branch: HTMLElement = node\n while (branch.parentElement && branch.parentElement !== container) {\n branch = branch.parentElement\n }\n if (branch.parentElement !== container) return\n\n const inerted: Element[] = []\n for (const child of Array.from(container.children)) {\n if (child !== branch && !child.hasAttribute(\"inert\")) {\n child.setAttribute(\"inert\", \"\")\n inerted.push(child)\n }\n }\n const anchored = getComputedStyle(container).position === \"static\"\n if (anchored) container.style.position = \"relative\"\n\n return () => {\n for (const child of inerted) child.removeAttribute(\"inert\")\n if (anchored) container.style.position = \"\"\n }\n }, [container, node])\n}\n\n/**\n * Bottom sheet: keep the panel above the on-screen keyboard. The layout\n * viewport does not shrink on iOS, so size to the visual viewport and lift the\n * panel by the keyboard's height; keep the focused field in view.\n */\nfunction useKeyboardAvoidance(enabled: boolean, node: HTMLElement | null) {\n React.useEffect(() => {\n if (!enabled || !node || typeof window === \"undefined\") return\n const vv = window.visualViewport\n if (!vv) return\n const update = () => {\n const inset = Math.max(0, window.innerHeight - vv.height - vv.offsetTop)\n node.style.setProperty(\"--dialog-viewport-height\", `${vv.height}px`)\n node.style.setProperty(\"--dialog-keyboard-inset\", `${inset}px`)\n const active = document.activeElement\n if (inset > 0 && active instanceof HTMLElement && node.contains(active)) {\n active.scrollIntoView?.({ block: \"nearest\" })\n }\n }\n update()\n vv.addEventListener(\"resize\", update)\n vv.addEventListener(\"scroll\", update)\n return () => {\n vv.removeEventListener(\"resize\", update)\n vv.removeEventListener(\"scroll\", update)\n node.style.removeProperty(\"--dialog-viewport-height\")\n node.style.removeProperty(\"--dialog-keyboard-inset\")\n }\n }, [enabled, node])\n}\n\nconst DRAG_DISMISS_DISTANCE = 80\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\nDialogTrigger.displayName = \"DialogTrigger\"\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\nDialogClose.displayName = \"DialogClose\"\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\nDialogPortal.displayName = \"DialogPortal\"\n\nconst DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n React.ComponentProps<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n data-slot=\"dialog-overlay\"\n className={cn(styles.overlay, className)}\n {...props}\n />\n))\nDialogOverlay.displayName = \"DialogOverlay\"\n\n/** Backdrop for a scoped dialog. Radix renders no overlay outside modal mode. */\nconst DialogScrim = React.forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n ({ className, ...props }, ref) => {\n const { open } = React.useContext(DialogContext)\n return (\n <div\n ref={ref}\n data-slot=\"dialog-overlay\"\n data-state={open ? \"open\" : \"closed\"}\n aria-hidden=\"true\"\n className={cn(styles.overlay, styles.scrim, className)}\n {...props}\n />\n )\n }\n)\nDialogScrim.displayName = \"DialogScrim\"\n\nexport interface DialogContentProps\n extends React.ComponentProps<typeof DialogPrimitive.Content> {\n /** Show a drag handle (sheet presentation only). Dragging down dismisses. */\n showHandle?: boolean\n /**\n * Render the X close button. Default `true`. Hide it only when the content\n * carries its own dismiss action; Escape still closes. Drag-to-dismiss needs it.\n */\n showCloseButton?: boolean\n}\n\nconst DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({ className, children, showHandle = false, showCloseButton = true, onInteractOutside, onFocus, ...props }, ref) => {\n const { presentation, container } = React.useContext(DialogContext)\n const scoped = Boolean(container)\n const isSheet = presentation === \"sheet\"\n const [node, setNode] = React.useState<HTMLDivElement | null>(null)\n const closeRef = React.useRef<HTMLButtonElement>(null)\n const dragStart = React.useRef<number | null>(null)\n\n const setRefs = React.useCallback(\n (el: HTMLDivElement | null) => {\n setNode(el)\n if (typeof ref === \"function\") ref(el)\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = el\n },\n [ref]\n )\n\n useScopedContainer(container, node)\n useKeyboardAvoidance(isSheet && !scoped, node)\n\n const handleInteractOutside: typeof onInteractOutside = (event) => {\n onInteractOutside?.(event)\n if (!scoped || event.defaultPrevented) return\n // Only the scrim dismisses. A press on the page outside the container, or on\n // the container's inert siblings, must leave the dialog open.\n const target = event.target\n if (!(target instanceof Element && target.closest('[data-slot=\"dialog-overlay\"]'))) {\n event.preventDefault()\n }\n }\n\n const handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n onFocus?.(event)\n const target = event.target\n if (isSheet && target instanceof HTMLElement && target.matches(\"input, textarea, select, [contenteditable]\")) {\n requestAnimationFrame(() => target.scrollIntoView?.({ block: \"nearest\" }))\n }\n }\n\n const dragTo = (clientY: number, commit: boolean) => {\n if (dragStart.current === null || !node) return\n const dy = Math.max(0, clientY - dragStart.current)\n if (!commit) {\n node.style.transition = \"none\"\n node.style.transform = `translateY(${dy}px)`\n return\n }\n dragStart.current = null\n node.style.transition = \"\"\n node.style.transform = \"\"\n if (dy > DRAG_DISMISS_DISTANCE) closeRef.current?.click()\n }\n\n return (\n <DialogPortal container={container}>\n {scoped ? <DialogScrim /> : <DialogOverlay />}\n <DialogPrimitive.Content\n ref={setRefs}\n data-slot=\"dialog-content\"\n data-presentation={presentation}\n data-scoped={scoped ? \"\" : undefined}\n className={cn(\n styles.content,\n isSheet && styles.presentationSheet,\n scoped && styles.scoped,\n className\n )}\n onInteractOutside={handleInteractOutside}\n onFocus={handleFocus}\n {...props}\n >\n {isSheet && showHandle && (\n <div\n data-slot=\"dialog-handle\"\n aria-hidden=\"true\"\n className={styles.handle}\n onPointerDown={(e) => {\n dragStart.current = e.clientY\n e.currentTarget.setPointerCapture?.(e.pointerId)\n }}\n onPointerMove={(e) => dragTo(e.clientY, false)}\n onPointerUp={(e) => dragTo(e.clientY, true)}\n onPointerCancel={() => dragTo(dragStart.current ?? 0, true)}\n />\n )}\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close ref={closeRef} className={styles.closeButton}>\n <XIcon className={styles.closeIcon} />\n <span className={styles.srOnly}>Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n})\nDialogContent.displayName = \"DialogContent\"\n\nexport interface DialogHeaderProps extends React.ComponentProps<\"div\"> {\n /** Leading back action, rendered before the title (see `DialogBack`). */\n back?: React.ReactNode\n}\n\nfunction DialogHeader({ className, back, children, ...props }: DialogHeaderProps) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(styles.header, back ? styles.headerWithBack : undefined, className)}\n {...props}\n >\n {back ? (\n <>\n <div data-slot=\"dialog-back-slot\" className={styles.backSlot}>{back}</div>\n <div className={styles.headerBody}>{children}</div>\n </>\n ) : (\n children\n )}\n </div>\n )\n}\nDialogHeader.displayName = \"DialogHeader\"\n\nconst DialogBack = React.forwardRef<HTMLButtonElement, React.ComponentProps<\"button\">>(\n ({ className, children, type = \"button\", \"aria-label\": ariaLabel = \"Back\", ...props }, ref) => (\n <button\n ref={ref}\n type={type}\n data-slot=\"dialog-back\"\n aria-label={ariaLabel}\n className={cn(styles.backButton, className)}\n {...props}\n >\n {children ?? <ArrowLeftIcon className={styles.closeIcon} aria-hidden=\"true\" />}\n </button>\n )\n)\nDialogBack.displayName = \"DialogBack\"\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(styles.footer, className)}\n {...props}\n />\n )\n}\nDialogFooter.displayName = \"DialogFooter\"\n\nconst DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n React.ComponentProps<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n data-slot=\"dialog-title\"\n className={cn(styles.title, className)}\n {...props}\n />\n))\nDialogTitle.displayName = \"DialogTitle\"\n\nconst DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n React.ComponentProps<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n data-slot=\"dialog-description\"\n className={cn(styles.description, className)}\n {...props}\n />\n))\nDialogDescription.displayName = \"DialogDescription\"\n\nexport {\n Dialog,\n DialogTrigger,\n DialogClose,\n DialogPortal,\n DialogOverlay,\n DialogContent,\n DialogHeader,\n DialogBack,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n}\n"
|
|
835
836
|
},
|
|
836
837
|
{
|
|
837
838
|
"path": "components/ui/dialog/dialog.module.css",
|
|
@@ -2714,7 +2715,7 @@
|
|
|
2714
2715
|
{
|
|
2715
2716
|
"path": "components/ui/confirm-dialog/confirm-dialog.tsx",
|
|
2716
2717
|
"type": "registry:ui",
|
|
2717
|
-
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n InfoIcon,\n WarningIcon,\n WarningOctagonIcon,\n} from \"@phosphor-icons/react\"\nimport { cn } from \"../../../lib/utils\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"../dialog/dialog\"\nimport { Button, type ButtonProps } from \"../button/button\"\nimport styles from \"./confirm-dialog.module.css\"\n\nexport type ConfirmDialogSeverity =\n | \"info\"\n | \"warning\"\n | \"destructive\"\n /**\n * @deprecated Use `\"destructive\"` instead. `\"danger\"` will be removed in the next major version.\n */\n | \"danger\"\n\n/** Internal normalized severity — `\"danger\"` is collapsed to `\"destructive\"`. */\ntype NormalizedSeverity = \"info\" | \"warning\" | \"destructive\"\n\nfunction normalizeSeverity(s: ConfirmDialogSeverity): NormalizedSeverity {\n return s === \"danger\" ? \"destructive\" : s\n}\n\n/** Severity icon visual treatment.\n *\n * Leave unset for the canonical default — a ~2.5rem tinted circular plate\n * (`surface-*-subtle` tint) stacked ABOVE the title. This is the unchanged\n * default rendering of every existing ConfirmDialog consumer.\n *\n * Set explicitly to opt into the blessed editorial treatments:\n * - `\"plated\"` — a 40px circular plate with a `color-mix` severity wash,\n * leading the title column (golden organization-management Feedback screen).\n * - `\"inline\"` — a small leading icon next to the title (no plate). */\nexport type ConfirmDialogIconTreatment = \"inline\" | \"plated\"\n\n/** Rendering mode. `dialog` (default) wraps content in Radix\n * Dialog/Portal/Overlay with an auto X-close. `inline` renders just the\n * content surface in normal flow — no portal, no overlay, no auto X-close —\n * so consumers can stack multiple dialogs inside one shared scrim. Opt-in. */\nexport type ConfirmDialogMode = \"dialog\" | \"inline\"\n\nexport interface ConfirmDialogProps {\n /** Controlled open state. */\n open?: boolean\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean\n /** Called when open state changes. */\n onOpenChange?: (open: boolean) => void\n\n /** Optional trigger — wrapped in DialogTrigger. Omit for fully-controlled usage. */\n trigger?: React.ReactNode\n\n /** Dialog title — rendered in DialogTitle next to the severity icon. */\n title: React.ReactNode\n /** Short body above the action row. Used as DialogDescription. */\n description?: React.ReactNode\n /** Richer body slot — overrides description when provided. */\n children?: React.ReactNode\n\n /** Severity — drives icon color, confirm button variant. Default \"warning\". */\n severity?: ConfirmDialogSeverity\n\n /** Custom severity icon — overrides the severity default. Opt-in; omit to\n * use the built-in icon for the active severity. Sizing/color is handled by\n * the icon container, so pass a bare Phosphor icon (no explicit size). */\n icon?: React.ReactNode\n\n /** Severity-icon treatment. Leave unset for the canonical default (a tinted\n * circular plate stacked above the title). Set \"plated\" for the blessed\n * color-mix plate, or \"inline\" for a small leading icon next to the title.\n * Default rendering (unset) is unchanged. */\n iconTreatment?: ConfirmDialogIconTreatment\n\n /** Rendering mode. \"dialog\" (default) uses Radix Dialog + Portal + Overlay +\n * auto X-close. \"inline\" renders only the content surface (no portal, no\n * overlay, no X-close) so multiple dialogs can stack in one shared scrim.\n * Opt-in — default rendering is unchanged. */\n mode?: ConfirmDialogMode\n\n /** Confirm button label. Defaults: \"Delete\" for danger, \"Confirm\" otherwise. */\n confirmLabel?: React.ReactNode\n /** Cancel button label. Default \"Cancel\". */\n cancelLabel?: React.ReactNode\n /** Cancel button variant. Default \"outline\". Golden screens use \"ghost\". */\n cancelVariant?: ButtonProps[\"variant\"]\n\n /** If set, user must type this exact string to enable the confirm button. */\n confirmText?: string\n /** Label for the confirm-text input. Default: `Type ${confirmText} to confirm`. */\n confirmTextLabel?: React.ReactNode\n\n /** Confirm handler. Async-aware: returning a Promise puts the dialog into pending state. */\n onConfirm?: () => void | Promise<void>\n /** Cancel handler. */\n onCancel?: () => void\n\n /** Externally-controlled busy state — overrides internal async pending detection. */\n busy?: boolean\n\n /** Additional className on DialogContent. */\n className?: string\n}\n\nfunction getSeverityIcon(severity: NormalizedSeverity): React.ReactNode {\n switch (severity) {\n case \"info\":\n return <InfoIcon weight=\"fill\" aria-hidden=\"true\" />\n case \"destructive\":\n return <WarningOctagonIcon weight=\"fill\" aria-hidden=\"true\" />\n case \"warning\":\n default:\n return <WarningIcon weight=\"fill\" aria-hidden=\"true\" />\n }\n}\n\n/** Canonical default plate tint (surface-*-subtle stacked plate). */\nfunction getSeverityPlateClass(severity: NormalizedSeverity): string {\n switch (severity) {\n case \"info\":\n return styles.plateInfo\n case \"destructive\":\n return styles.plateDestructive\n case \"warning\":\n default:\n return styles.plateWarning\n }\n}\n\n/** Inline severity icon color (small leading icon, no plate). */\nfunction getSeverityIconClass(severity: NormalizedSeverity): string {\n switch (severity) {\n case \"info\":\n return styles.iconInfo\n case \"destructive\":\n return styles.iconDanger\n case \"warning\":\n default:\n return styles.iconWarning\n }\n}\n\n/** Blessed plated tint (color-mix wash). */\nfunction getPlatedIconClass(severity: NormalizedSeverity): string {\n switch (severity) {\n case \"info\":\n return styles.iconPlatedInfo\n case \"destructive\":\n return styles.iconPlatedDanger\n case \"warning\":\n default:\n return styles.iconPlatedWarning\n }\n}\n\nfunction getConfirmButtonVariant(\n severity: NormalizedSeverity\n): \"default\" | \"destructive\" {\n return severity === \"destructive\" ? \"destructive\" : \"default\"\n}\n\nfunction getDefaultConfirmLabel(severity: NormalizedSeverity): string {\n return severity === \"destructive\" ? \"Delete\" : \"Confirm\"\n}\n\nconst ConfirmDialog = React.forwardRef<\n React.ComponentRef<typeof DialogContent>,\n ConfirmDialogProps\n>(\n (\n {\n open: openProp,\n defaultOpen,\n onOpenChange,\n trigger,\n title,\n description,\n children,\n severity = \"warning\",\n icon,\n iconTreatment,\n mode = \"dialog\",\n confirmLabel,\n cancelLabel = \"Cancel\",\n cancelVariant = \"outline\",\n confirmText,\n confirmTextLabel,\n onConfirm,\n onCancel,\n busy,\n className,\n },\n ref\n ) => {\n const isControlled = openProp !== undefined\n const [internalOpen, setInternalOpen] = React.useState<boolean>(\n defaultOpen ?? false\n )\n const actualOpen = isControlled ? (openProp as boolean) : internalOpen\n\n const [isPending, setIsPending] = React.useState<boolean>(false)\n const [typed, setTyped] = React.useState<string>(\"\")\n\n const cancelButtonRef = React.useRef<HTMLButtonElement | null>(null)\n\n const normalizedSeverity = normalizeSeverity(severity)\n\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInternalOpen(next)\n }\n onOpenChange?.(next)\n if (!next) {\n // Clear gate typing on close\n setTyped(\"\")\n }\n },\n [isControlled, onOpenChange]\n )\n\n const resolvedConfirmLabel =\n confirmLabel ?? getDefaultConfirmLabel(normalizedSeverity)\n const effectiveBusy = busy ?? isPending\n const gateSatisfied =\n confirmText == null || confirmText.length === 0 || typed === confirmText\n const confirmDisabled = effectiveBusy || !gateSatisfied\n const cancelDisabled = effectiveBusy\n\n const handleConfirmClick = React.useCallback(async () => {\n if (!onConfirm) {\n handleOpenChange(false)\n return\n }\n // Any synchronous throw propagates naturally to React's error boundary.\n const result = onConfirm()\n if (result && typeof (result as Promise<void>).then === \"function\") {\n setIsPending(true)\n try {\n await result\n setIsPending(false)\n handleOpenChange(false)\n } catch (err) {\n // Async rejection — clear pending state, keep dialog open, re-throw\n // so the consumer's error handling (error boundary, onUnhandledRejection)\n // can react to it.\n setIsPending(false)\n throw err\n }\n } else {\n handleOpenChange(false)\n }\n }, [onConfirm, handleOpenChange])\n\n const handleCancelClick = React.useCallback(() => {\n onCancel?.()\n handleOpenChange(false)\n }, [onCancel, handleOpenChange])\n\n const handleOpenAutoFocus = React.useCallback(\n (event: Event) => {\n if (normalizedSeverity === \"destructive\" && cancelButtonRef.current) {\n event.preventDefault()\n cancelButtonRef.current.focus()\n }\n },\n [normalizedSeverity]\n )\n\n const severityIcon = icon ?? getSeverityIcon(normalizedSeverity)\n const confirmVariant = getConfirmButtonVariant(normalizedSeverity)\n const isInline = mode === \"inline\"\n\n // Treatment resolution:\n // - unset → canonical default: tinted plate stacked above title\n // (data-slot=\"confirm-dialog-icon-plate\"). Unchanged.\n // - \"plated\" → blessed plated: 40px color-mix plate leading the\n // title column (data-slot=\"confirm-dialog-icon\").\n // - \"inline\" → blessed inline: small leading icon (no plate).\n const isCanonicalPlate = iconTreatment === undefined\n const isBlessedPlated = iconTreatment === \"plated\"\n\n // Generate stable id for confirm gate input\n const generatedId = React.useId()\n const confirmGateInputId = `${generatedId}-confirm-input`\n\n const hasDescriptionForAria =\n description != null && description !== false && !children\n\n // Canonical default plate — a span carrying the tinted circle, stacked\n // above the title inside .headerStack. Preserved verbatim for backward\n // compatibility (existing consumers + tests query this slot/classes).\n const canonicalPlate = (\n <span\n data-slot=\"confirm-dialog-icon-plate\"\n aria-hidden=\"true\"\n className={cn(styles.iconPlate, getSeverityPlateClass(normalizedSeverity))}\n >\n {severityIcon}\n </span>\n )\n\n // Blessed icon span — used for explicit \"plated\"/\"inline\" treatments.\n const blessedIconClass = isBlessedPlated\n ? cn(styles.iconPlated, getPlatedIconClass(normalizedSeverity))\n : cn(styles.icon, getSeverityIconClass(normalizedSeverity))\n const blessedIconSpan = (\n <span\n data-slot=\"confirm-dialog-icon\"\n aria-hidden=\"true\"\n className={blessedIconClass}\n >\n {severityIcon}\n </span>\n )\n\n // Header layout class per treatment.\n // - canonical default → .headerStack (column: plate above title/description)\n // - blessed plated → .titleRowPlated (column: plate above title)\n // - blessed inline → .titleRow (row: icon next to title)\n const headerLayoutClass = isCanonicalPlate\n ? styles.headerStack\n : isBlessedPlated\n ? styles.titleRowPlated\n : styles.titleRow\n\n const iconElement = isCanonicalPlate ? canonicalPlate : blessedIconSpan\n\n // Dialog-mode header — uses Radix Title/Description (a11y + aria-labelledby).\n // Canonical plate stacks plate + title + description inside one .headerStack;\n // blessed treatments keep description outside the title row.\n const dialogHeader = isCanonicalPlate ? (\n <DialogHeader>\n <div className={headerLayoutClass}>\n {iconElement}\n <DialogTitle>{title}</DialogTitle>\n {hasDescriptionForAria ? (\n <DialogDescription>{description}</DialogDescription>\n ) : null}\n </div>\n </DialogHeader>\n ) : (\n <DialogHeader>\n <div className={headerLayoutClass}>\n {iconElement}\n <DialogTitle>{title}</DialogTitle>\n </div>\n {hasDescriptionForAria ? (\n <DialogDescription>{description}</DialogDescription>\n ) : null}\n </DialogHeader>\n )\n\n // Inline-mode header — no Dialog context, so render a plain heading/paragraph.\n const inlineHeaderEl = (\n <div className={styles.inlineHeader}>\n <div className={headerLayoutClass}>\n {iconElement}\n <h2 className={styles.inlineTitle}>{title}</h2>\n </div>\n {hasDescriptionForAria ? (\n <p className={styles.inlineDescription}>{description}</p>\n ) : null}\n </div>\n )\n\n const header = isInline ? inlineHeaderEl : dialogHeader\n\n const innerContent = (\n <>\n {header}\n\n {children ? (\n <div data-slot=\"confirm-dialog-body\" className={styles.body}>\n {children}\n </div>\n ) : null}\n\n {confirmText ? (\n <div className={styles.confirmGate}>\n <label\n htmlFor={confirmGateInputId}\n className={styles.confirmGateLabel}\n >\n {confirmTextLabel ?? `Type ${confirmText} to confirm`}\n </label>\n <input\n id={confirmGateInputId}\n type=\"text\"\n autoComplete=\"off\"\n spellCheck={false}\n value={typed}\n onChange={(e) => setTyped(e.target.value)}\n disabled={effectiveBusy}\n className={styles.confirmGateInput}\n data-slot=\"confirm-dialog-gate-input\"\n />\n </div>\n ) : null}\n\n <div\n data-slot=\"confirm-dialog-actions\"\n className={styles.actions}\n role=\"group\"\n >\n <div className={styles.action}>\n <Button\n ref={cancelButtonRef}\n type=\"button\"\n variant={cancelVariant}\n onClick={handleCancelClick}\n disabled={cancelDisabled}\n data-slot=\"confirm-dialog-cancel\"\n >\n {cancelLabel}\n </Button>\n </div>\n <div className={styles.action}>\n <Button\n type=\"button\"\n variant={confirmVariant}\n onClick={handleConfirmClick}\n disabled={confirmDisabled}\n aria-busy={effectiveBusy || undefined}\n data-slot=\"confirm-dialog-confirm\"\n >\n {resolvedConfirmLabel}\n </Button>\n </div>\n </div>\n </>\n )\n\n // Inline (non-portal) mode — render only the content surface. No Radix\n // Dialog/Portal/Overlay/X-close, so consumers can stack multiple dialogs\n // inside one shared scrim. Open/close is consumer-driven; respect `open`.\n if (isInline) {\n if (!actualOpen) {\n return null\n }\n return (\n <div\n ref={ref as React.Ref<HTMLDivElement>}\n role=\"alertdialog\"\n aria-modal={false}\n data-slot=\"confirm-dialog\"\n data-mode=\"inline\"\n data-severity={normalizedSeverity}\n className={cn(styles.root, styles.inlineSurface, className)}\n >\n {innerContent}\n </div>\n )\n }\n\n return (\n <Dialog\n open={actualOpen}\n defaultOpen={defaultOpen}\n onOpenChange={handleOpenChange}\n >\n {trigger ? <DialogTrigger asChild>{trigger}</DialogTrigger> : null}\n <DialogContent\n ref={ref}\n data-slot=\"confirm-dialog\"\n data-severity={normalizedSeverity}\n className={cn(styles.root, className)}\n onOpenAutoFocus={handleOpenAutoFocus}\n >\n {innerContent}\n </DialogContent>\n </Dialog>\n )\n }\n)\nConfirmDialog.displayName = \"ConfirmDialog\"\n\nexport { ConfirmDialog }\n"
|
|
2718
|
+
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n InfoIcon,\n WarningIcon,\n WarningOctagonIcon,\n} from \"@phosphor-icons/react\"\nimport { cn } from \"../../../lib/utils\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"../dialog/dialog\"\nimport { Button, type ButtonProps } from \"../button/button\"\nimport styles from \"./confirm-dialog.module.css\"\n\nexport type ConfirmDialogSeverity =\n | \"info\"\n | \"warning\"\n | \"destructive\"\n /**\n * @deprecated Use `\"destructive\"` instead. `\"danger\"` will be removed in the next major version.\n */\n | \"danger\"\n\n/** Internal normalized severity — `\"danger\"` is collapsed to `\"destructive\"`. */\ntype NormalizedSeverity = \"info\" | \"warning\" | \"destructive\"\n\nfunction normalizeSeverity(s: ConfirmDialogSeverity): NormalizedSeverity {\n return s === \"danger\" ? \"destructive\" : s\n}\n\n/** Severity icon visual treatment.\n *\n * Leave unset for the canonical default — a ~2.5rem tinted circular plate\n * (`surface-*-subtle` tint) stacked ABOVE the title. This is the unchanged\n * default rendering of every existing ConfirmDialog consumer.\n *\n * Set explicitly to opt into the blessed editorial treatments:\n * - `\"plated\"` — a 40px circular plate with a `color-mix` severity wash,\n * leading the title column (golden organization-management Feedback screen).\n * - `\"inline\"` — a small leading icon next to the title (no plate).\n * - `\"none\"` — no icon and no icon container. */\nexport type ConfirmDialogIconTreatment = \"inline\" | \"plated\" | \"none\"\n\n/** Rendering mode. `dialog` (default) wraps content in Radix\n * Dialog/Portal/Overlay with an auto X-close. `inline` renders just the\n * content surface in normal flow — no portal, no overlay, no auto X-close —\n * so consumers can stack multiple dialogs inside one shared scrim. Opt-in. */\nexport type ConfirmDialogMode = \"dialog\" | \"inline\"\n\nexport interface ConfirmDialogProps {\n /** Controlled open state. */\n open?: boolean\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean\n /** Called when open state changes. */\n onOpenChange?: (open: boolean) => void\n\n /** Optional trigger — wrapped in DialogTrigger. Omit for fully-controlled usage. */\n trigger?: React.ReactNode\n\n /** Dialog title — rendered in DialogTitle next to the severity icon. */\n title: React.ReactNode\n /** Short body above the action row. Used as DialogDescription. */\n description?: React.ReactNode\n /** Richer body slot — overrides description when provided. */\n children?: React.ReactNode\n\n /** Severity — drives icon color, confirm button variant. Default \"warning\". */\n severity?: ConfirmDialogSeverity\n\n /** Custom severity icon — overrides the severity default. Opt-in; omit to\n * use the built-in icon for the active severity. Sizing/color is handled by\n * the icon container, so pass a bare Phosphor icon (no explicit size). */\n icon?: React.ReactNode\n\n /** Severity-icon treatment. Leave unset for the canonical default (a tinted\n * circular plate stacked above the title). Set \"plated\" for the blessed\n * color-mix plate, \"inline\" for a small leading icon next to the title, or\n * \"none\" for no icon at all. Default rendering (unset) is unchanged. */\n iconTreatment?: ConfirmDialogIconTreatment\n\n /** Rendering mode. \"dialog\" (default) uses Radix Dialog + Portal + Overlay +\n * auto X-close. \"inline\" renders only the content surface (no portal, no\n * overlay, no X-close) so multiple dialogs can stack in one shared scrim.\n * Opt-in — default rendering is unchanged. */\n mode?: ConfirmDialogMode\n\n /** Element the dialog portals into instead of `<body>` — passed straight to\n * Dialog's `container`. Use it to render inside the host app's theme root.\n * Dialog mode only. */\n container?: HTMLElement | null\n\n /** Render the X close button. Default `true`. Escape and the focus trap are\n * kept either way. Dialog mode only (inline mode never has one). */\n showCloseButton?: boolean\n\n /** Confirm button label. Defaults: \"Delete\" for danger, \"Confirm\" otherwise. */\n confirmLabel?: React.ReactNode\n /** Cancel button label. Default \"Cancel\". */\n cancelLabel?: React.ReactNode\n /** Cancel button variant. Default \"outline\". Golden screens use \"ghost\". */\n cancelVariant?: ButtonProps[\"variant\"]\n\n /** If set, user must type this exact string to enable the confirm button. */\n confirmText?: string\n /** Label for the confirm-text input. Default: `Type ${confirmText} to confirm`. */\n confirmTextLabel?: React.ReactNode\n\n /** Confirm handler. Async-aware: returning a Promise puts the dialog into pending state. */\n onConfirm?: () => void | Promise<void>\n /** Cancel handler. */\n onCancel?: () => void\n\n /** Externally-controlled busy state — overrides internal async pending detection. */\n busy?: boolean\n\n /** Additional className on DialogContent. */\n className?: string\n}\n\nfunction getSeverityIcon(severity: NormalizedSeverity): React.ReactNode {\n switch (severity) {\n case \"info\":\n return <InfoIcon weight=\"fill\" aria-hidden=\"true\" />\n case \"destructive\":\n return <WarningOctagonIcon weight=\"fill\" aria-hidden=\"true\" />\n case \"warning\":\n default:\n return <WarningIcon weight=\"fill\" aria-hidden=\"true\" />\n }\n}\n\n/** Canonical default plate tint (surface-*-subtle stacked plate). */\nfunction getSeverityPlateClass(severity: NormalizedSeverity): string {\n switch (severity) {\n case \"info\":\n return styles.plateInfo\n case \"destructive\":\n return styles.plateDestructive\n case \"warning\":\n default:\n return styles.plateWarning\n }\n}\n\n/** Inline severity icon color (small leading icon, no plate). */\nfunction getSeverityIconClass(severity: NormalizedSeverity): string {\n switch (severity) {\n case \"info\":\n return styles.iconInfo\n case \"destructive\":\n return styles.iconDanger\n case \"warning\":\n default:\n return styles.iconWarning\n }\n}\n\n/** Blessed plated tint (color-mix wash). */\nfunction getPlatedIconClass(severity: NormalizedSeverity): string {\n switch (severity) {\n case \"info\":\n return styles.iconPlatedInfo\n case \"destructive\":\n return styles.iconPlatedDanger\n case \"warning\":\n default:\n return styles.iconPlatedWarning\n }\n}\n\nfunction getConfirmButtonVariant(\n severity: NormalizedSeverity\n): \"default\" | \"destructive\" {\n return severity === \"destructive\" ? \"destructive\" : \"default\"\n}\n\nfunction getDefaultConfirmLabel(severity: NormalizedSeverity): string {\n return severity === \"destructive\" ? \"Delete\" : \"Confirm\"\n}\n\nconst ConfirmDialog = React.forwardRef<\n React.ComponentRef<typeof DialogContent>,\n ConfirmDialogProps\n>(\n (\n {\n open: openProp,\n defaultOpen,\n onOpenChange,\n trigger,\n title,\n description,\n children,\n severity = \"warning\",\n icon,\n iconTreatment,\n mode = \"dialog\",\n container,\n showCloseButton = true,\n confirmLabel,\n cancelLabel = \"Cancel\",\n cancelVariant = \"outline\",\n confirmText,\n confirmTextLabel,\n onConfirm,\n onCancel,\n busy,\n className,\n },\n ref\n ) => {\n const isControlled = openProp !== undefined\n const [internalOpen, setInternalOpen] = React.useState<boolean>(\n defaultOpen ?? false\n )\n const actualOpen = isControlled ? (openProp as boolean) : internalOpen\n\n const [isPending, setIsPending] = React.useState<boolean>(false)\n const [typed, setTyped] = React.useState<string>(\"\")\n\n const cancelButtonRef = React.useRef<HTMLButtonElement | null>(null)\n\n const normalizedSeverity = normalizeSeverity(severity)\n\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInternalOpen(next)\n }\n onOpenChange?.(next)\n if (!next) {\n // Clear gate typing on close\n setTyped(\"\")\n }\n },\n [isControlled, onOpenChange]\n )\n\n const resolvedConfirmLabel =\n confirmLabel ?? getDefaultConfirmLabel(normalizedSeverity)\n const effectiveBusy = busy ?? isPending\n const gateSatisfied =\n confirmText == null || confirmText.length === 0 || typed === confirmText\n const confirmDisabled = effectiveBusy || !gateSatisfied\n const cancelDisabled = effectiveBusy\n\n const handleConfirmClick = React.useCallback(async () => {\n if (!onConfirm) {\n handleOpenChange(false)\n return\n }\n // Any synchronous throw propagates naturally to React's error boundary.\n const result = onConfirm()\n if (result && typeof (result as Promise<void>).then === \"function\") {\n setIsPending(true)\n try {\n await result\n setIsPending(false)\n handleOpenChange(false)\n } catch (err) {\n // Async rejection — clear pending state, keep dialog open, re-throw\n // so the consumer's error handling (error boundary, onUnhandledRejection)\n // can react to it.\n setIsPending(false)\n throw err\n }\n } else {\n handleOpenChange(false)\n }\n }, [onConfirm, handleOpenChange])\n\n const handleCancelClick = React.useCallback(() => {\n onCancel?.()\n handleOpenChange(false)\n }, [onCancel, handleOpenChange])\n\n const handleOpenAutoFocus = React.useCallback(\n (event: Event) => {\n if (normalizedSeverity === \"destructive\" && cancelButtonRef.current) {\n event.preventDefault()\n cancelButtonRef.current.focus()\n }\n },\n [normalizedSeverity]\n )\n\n const severityIcon = icon ?? getSeverityIcon(normalizedSeverity)\n const confirmVariant = getConfirmButtonVariant(normalizedSeverity)\n const isInline = mode === \"inline\"\n\n // Treatment resolution:\n // - unset → canonical default: tinted plate stacked above title\n // (data-slot=\"confirm-dialog-icon-plate\"). Unchanged.\n // - \"plated\" → blessed plated: 40px color-mix plate leading the\n // title column (data-slot=\"confirm-dialog-icon\").\n // - \"inline\" → blessed inline: small leading icon (no plate).\n // - \"none\" → no icon element; title row holds the title alone.\n const isCanonicalPlate = iconTreatment === undefined\n const isBlessedPlated = iconTreatment === \"plated\"\n\n // Generate stable id for confirm gate input\n const generatedId = React.useId()\n const confirmGateInputId = `${generatedId}-confirm-input`\n\n const hasDescriptionForAria =\n description != null && description !== false && !children\n\n // Canonical default plate — a span carrying the tinted circle, stacked\n // above the title inside .headerStack. Preserved verbatim for backward\n // compatibility (existing consumers + tests query this slot/classes).\n const canonicalPlate = (\n <span\n data-slot=\"confirm-dialog-icon-plate\"\n aria-hidden=\"true\"\n className={cn(styles.iconPlate, getSeverityPlateClass(normalizedSeverity))}\n >\n {severityIcon}\n </span>\n )\n\n // Blessed icon span — used for explicit \"plated\"/\"inline\" treatments.\n const blessedIconClass = isBlessedPlated\n ? cn(styles.iconPlated, getPlatedIconClass(normalizedSeverity))\n : cn(styles.icon, getSeverityIconClass(normalizedSeverity))\n const blessedIconSpan = (\n <span\n data-slot=\"confirm-dialog-icon\"\n aria-hidden=\"true\"\n className={blessedIconClass}\n >\n {severityIcon}\n </span>\n )\n\n // Header layout class per treatment.\n // - canonical default → .headerStack (column: plate above title/description)\n // - blessed plated → .titleRowPlated (column: plate above title)\n // - blessed inline → .titleRow (row: icon next to title)\n const headerLayoutClass = isCanonicalPlate\n ? styles.headerStack\n : isBlessedPlated\n ? styles.titleRowPlated\n : styles.titleRow\n\n const iconElement = isCanonicalPlate\n ? canonicalPlate\n : iconTreatment === \"none\"\n ? null\n : blessedIconSpan\n\n // Dialog-mode header — uses Radix Title/Description (a11y + aria-labelledby).\n // Canonical plate stacks plate + title + description inside one .headerStack;\n // blessed treatments keep description outside the title row.\n const dialogHeader = isCanonicalPlate ? (\n <DialogHeader>\n <div className={headerLayoutClass}>\n {iconElement}\n <DialogTitle>{title}</DialogTitle>\n {hasDescriptionForAria ? (\n <DialogDescription>{description}</DialogDescription>\n ) : null}\n </div>\n </DialogHeader>\n ) : (\n <DialogHeader>\n <div className={headerLayoutClass}>\n {iconElement}\n <DialogTitle>{title}</DialogTitle>\n </div>\n {hasDescriptionForAria ? (\n <DialogDescription>{description}</DialogDescription>\n ) : null}\n </DialogHeader>\n )\n\n // Inline-mode header — no Dialog context, so render a plain heading/paragraph.\n const inlineHeaderEl = (\n <div className={styles.inlineHeader}>\n <div className={headerLayoutClass}>\n {iconElement}\n <h2 className={styles.inlineTitle}>{title}</h2>\n </div>\n {hasDescriptionForAria ? (\n <p className={styles.inlineDescription}>{description}</p>\n ) : null}\n </div>\n )\n\n const header = isInline ? inlineHeaderEl : dialogHeader\n\n const innerContent = (\n <>\n {header}\n\n {children ? (\n <div data-slot=\"confirm-dialog-body\" className={styles.body}>\n {children}\n </div>\n ) : null}\n\n {confirmText ? (\n <div className={styles.confirmGate}>\n <label\n htmlFor={confirmGateInputId}\n className={styles.confirmGateLabel}\n >\n {confirmTextLabel ?? `Type ${confirmText} to confirm`}\n </label>\n <input\n id={confirmGateInputId}\n type=\"text\"\n autoComplete=\"off\"\n spellCheck={false}\n value={typed}\n onChange={(e) => setTyped(e.target.value)}\n disabled={effectiveBusy}\n className={styles.confirmGateInput}\n data-slot=\"confirm-dialog-gate-input\"\n />\n </div>\n ) : null}\n\n <div\n data-slot=\"confirm-dialog-actions\"\n className={styles.actions}\n role=\"group\"\n >\n <div className={styles.action}>\n <Button\n ref={cancelButtonRef}\n type=\"button\"\n variant={cancelVariant}\n onClick={handleCancelClick}\n disabled={cancelDisabled}\n data-slot=\"confirm-dialog-cancel\"\n >\n {cancelLabel}\n </Button>\n </div>\n <div className={styles.action}>\n <Button\n type=\"button\"\n variant={confirmVariant}\n onClick={handleConfirmClick}\n disabled={confirmDisabled}\n aria-busy={effectiveBusy || undefined}\n data-slot=\"confirm-dialog-confirm\"\n >\n {resolvedConfirmLabel}\n </Button>\n </div>\n </div>\n </>\n )\n\n // Inline (non-portal) mode — render only the content surface. No Radix\n // Dialog/Portal/Overlay/X-close, so consumers can stack multiple dialogs\n // inside one shared scrim. Open/close is consumer-driven; respect `open`.\n if (isInline) {\n if (!actualOpen) {\n return null\n }\n return (\n <div\n ref={ref as React.Ref<HTMLDivElement>}\n role=\"alertdialog\"\n aria-modal={false}\n data-slot=\"confirm-dialog\"\n data-mode=\"inline\"\n data-severity={normalizedSeverity}\n className={cn(styles.root, styles.inlineSurface, className)}\n >\n {innerContent}\n </div>\n )\n }\n\n return (\n <Dialog\n open={actualOpen}\n defaultOpen={defaultOpen}\n onOpenChange={handleOpenChange}\n container={container}\n >\n {trigger ? <DialogTrigger asChild>{trigger}</DialogTrigger> : null}\n <DialogContent\n ref={ref}\n data-slot=\"confirm-dialog\"\n data-severity={normalizedSeverity}\n className={cn(styles.root, className)}\n onOpenAutoFocus={handleOpenAutoFocus}\n showCloseButton={showCloseButton}\n >\n {innerContent}\n </DialogContent>\n </Dialog>\n )\n }\n)\nConfirmDialog.displayName = \"ConfirmDialog\"\n\nexport { ConfirmDialog }\n"
|
|
2718
2719
|
},
|
|
2719
2720
|
{
|
|
2720
2721
|
"path": "components/ui/confirm-dialog/confirm-dialog.module.css",
|
|
@@ -2808,10 +2809,11 @@
|
|
|
2808
2809
|
{
|
|
2809
2810
|
"name": "success-feedback",
|
|
2810
2811
|
"type": "registry:ui",
|
|
2811
|
-
"description": "App-wide success/transition feedback pattern. useSuccessToast() fires an auto-dismissing Sonner toast with Borealis-spec defaults (4s, optional undo action). SuccessLiveRegion provides an explicit aria-live polite node for screen readers.",
|
|
2812
|
+
"description": "App-wide success/transition feedback pattern. useSuccessToast() fires an auto-dismissing Sonner toast with Borealis-spec defaults (4s, optional undo action). SuccessLiveRegion provides an explicit aria-live polite node for screen readers. SuccessPanel is the end-of-flow screen: a success seal, heading, description, check list and action.",
|
|
2812
2813
|
"category": "feedback",
|
|
2813
2814
|
"dependencies": [
|
|
2814
2815
|
"sonner",
|
|
2816
|
+
"@phosphor-icons/react",
|
|
2815
2817
|
"@loworbitstudio/visor-core"
|
|
2816
2818
|
],
|
|
2817
2819
|
"registryDependencies": [
|
|
@@ -2822,12 +2824,12 @@
|
|
|
2822
2824
|
{
|
|
2823
2825
|
"path": "components/ui/success-feedback/success-feedback.tsx",
|
|
2824
2826
|
"type": "registry:ui",
|
|
2825
|
-
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { toast } from \"../toast/toast\"\nimport styles from \"./success-feedback.module.css\"\n\n/* ──────────────────────────────────────────────────────────────────────────\n Success Feedback Pattern (VI-589)\n\n Borealis-recommended wrapper for the app-wide success / transition\n feedback pattern. Builds on the existing Toast primitive (Sonner-backed).\n\n Key behaviours per Borealis spec (06-success-toast.html):\n - Auto-dismiss after 4s (configurable, min 3s, max 8s)\n - Optional \"Undo\" / \"View\" action\n - Deduplication within 500ms window via toast id\n - Explicit a11y live region (`role=status aria-live=polite`) for cases\n where the Toaster is not in the portal\n ────────────────────────────────────────────────────────────────────────── */\n\nexport interface SuccessToastOptions {\n /** Supporting sub-copy beneath the title (optional). */\n description?: string\n /**\n * Optional action affordance rendered as a link-style button.\n * Mapped to Sonner's `action` option.\n */\n action?: {\n label: string\n onClick: () => void\n }\n /**\n * Auto-dismiss duration in milliseconds.\n * Clamped to [3000, 8000] per Borealis spec.\n * Defaults to 4000ms.\n */\n duration?: number\n /**\n * Explicit toast id for deduplication.\n * Sonner merges calls with the same id within its window.\n */\n id?: string | number\n}\n\n/**\n * `useSuccessToast` — imperative hook for the success-feedback pattern.\n *\n * Returns a stable `showSuccess(title, options?)` function that fires\n * a Sonner success toast pre-configured with the Borealis spec defaults:\n * 4s auto-dismiss, polite live region, optional undo action.\n *\n * @example\n * const { showSuccess } = useSuccessToast();\n * await saveProject();\n * showSuccess(\"Project saved\", { description: \"All changes have been saved.\" });\n *\n * // With undo action\n * showSuccess(\"Item deleted\", {\n * action: { label: \"Undo\", onClick: handleUndo },\n * });\n */\nexport function useSuccessToast() {\n const showSuccess = React.useCallback(\n (title: string, options: SuccessToastOptions = {}) => {\n const { description, action, duration = 4000, id } = options\n const clampedDuration = Math.min(8000, Math.max(3000, duration))\n\n toast.success(title, {\n description,\n duration: clampedDuration,\n action: action\n ? { label: action.label, onClick: action.onClick }\n : undefined,\n id,\n })\n },\n []\n )\n\n return { showSuccess }\n}\n\n/* ──────────────────────────────────────────────────────────────────────────\n SuccessLiveRegion\n\n A visually-hidden `role=status aria-live=polite` node that surfaces\n success announcements to assistive technology when the Toaster portal\n is not present (e.g. server-rendered shells, testing environments).\n\n Usage: mount once in the app root alongside `<Toaster />`.\n\n The `message` prop should be set to the latest success title so screen\n readers re-announce on every update. Reset to empty string after\n announcement if needed.\n ────────────────────────────────────────────────────────────────────────── */\n\nexport interface SuccessLiveRegionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The success message to announce. Updates trigger a screen-reader announcement. */\n message?: string\n}\n\nconst SuccessLiveRegion = React.forwardRef<HTMLDivElement, SuccessLiveRegionProps>(\n ({ message = \"\", className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n data-slot=\"success-live-region\"\n className={`${styles.liveRegion}${className ? ` ${className}` : \"\"}`}\n {...props}\n >\n {message}\n </div>\n )\n }\n)\nSuccessLiveRegion.displayName = \"SuccessLiveRegion\"\n\nexport { SuccessLiveRegion }\n"
|
|
2827
|
+
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { CheckCircle } from \"@phosphor-icons/react/dist/ssr\"\nimport { toast } from \"../toast/toast\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./success-feedback.module.css\"\n\n/* ──────────────────────────────────────────────────────────────────────────\n Success Feedback Pattern (VI-589)\n\n Borealis-recommended wrapper for the app-wide success / transition\n feedback pattern. Builds on the existing Toast primitive (Sonner-backed).\n\n Key behaviours per Borealis spec (06-success-toast.html):\n - Auto-dismiss after 4s (configurable, min 3s, max 8s)\n - Optional \"Undo\" / \"View\" action\n - Deduplication within 500ms window via toast id\n - Explicit a11y live region (`role=status aria-live=polite`) for cases\n where the Toaster is not in the portal\n ────────────────────────────────────────────────────────────────────────── */\n\nexport interface SuccessToastOptions {\n /** Supporting sub-copy beneath the title (optional). */\n description?: string\n /**\n * Optional action affordance rendered as a link-style button.\n * Mapped to Sonner's `action` option.\n */\n action?: {\n label: string\n onClick: () => void\n }\n /**\n * Auto-dismiss duration in milliseconds.\n * Clamped to [3000, 8000] per Borealis spec.\n * Defaults to 4000ms.\n */\n duration?: number\n /**\n * Explicit toast id for deduplication.\n * Sonner merges calls with the same id within its window.\n */\n id?: string | number\n}\n\n/**\n * `useSuccessToast` — imperative hook for the success-feedback pattern.\n *\n * Returns a stable `showSuccess(title, options?)` function that fires\n * a Sonner success toast pre-configured with the Borealis spec defaults:\n * 4s auto-dismiss, polite live region, optional undo action.\n *\n * @example\n * const { showSuccess } = useSuccessToast();\n * await saveProject();\n * showSuccess(\"Project saved\", { description: \"All changes have been saved.\" });\n *\n * // With undo action\n * showSuccess(\"Item deleted\", {\n * action: { label: \"Undo\", onClick: handleUndo },\n * });\n */\nexport function useSuccessToast() {\n const showSuccess = React.useCallback(\n (title: string, options: SuccessToastOptions = {}) => {\n const { description, action, duration = 4000, id } = options\n const clampedDuration = Math.min(8000, Math.max(3000, duration))\n\n toast.success(title, {\n description,\n duration: clampedDuration,\n action: action\n ? { label: action.label, onClick: action.onClick }\n : undefined,\n id,\n })\n },\n []\n )\n\n return { showSuccess }\n}\n\n/* ──────────────────────────────────────────────────────────────────────────\n SuccessLiveRegion\n\n A visually-hidden `role=status aria-live=polite` node that surfaces\n success announcements to assistive technology when the Toaster portal\n is not present (e.g. server-rendered shells, testing environments).\n\n Usage: mount once in the app root alongside `<Toaster />`.\n\n The `message` prop should be set to the latest success title so screen\n readers re-announce on every update. Reset to empty string after\n announcement if needed.\n ────────────────────────────────────────────────────────────────────────── */\n\nexport interface SuccessLiveRegionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The success message to announce. Updates trigger a screen-reader announcement. */\n message?: string\n}\n\nconst SuccessLiveRegion = React.forwardRef<HTMLDivElement, SuccessLiveRegionProps>(\n ({ message = \"\", className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n data-slot=\"success-live-region\"\n className={`${styles.liveRegion}${className ? ` ${className}` : \"\"}`}\n {...props}\n >\n {message}\n </div>\n )\n }\n)\nSuccessLiveRegion.displayName = \"SuccessLiveRegion\"\n\nexport { SuccessLiveRegion }\n\n/* ──────────────────────────────────────────────────────────────────────────\n SuccessPanel (VI-714)\n\n The end-of-flow screen: a round success seal, a heading, a description,\n an optional check list and the host's action, centred. Its heading is\n announced once, on mount, through SuccessLiveRegion. Icons are slots;\n each defaults to a check-circle.\n ────────────────────────────────────────────────────────────────────────── */\n\nexport interface SuccessPanelItem {\n /** The row's icon. Defaults to a check-circle in the success ink. */\n icon?: React.ReactNode\n /** The row's text. Bold runs (`<b>`, `<strong>`) read in the primary ink. */\n content: React.ReactNode\n}\n\nexport interface SuccessPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** The panel's heading, announced to screen readers once on mount. */\n heading: string\n /** Supporting copy under the heading. */\n description?: React.ReactNode\n /** The seal's icon. Defaults to a check-circle. */\n icon?: React.ReactNode\n /** Optional check list under the description. */\n items?: SuccessPanelItem[]\n /** The host's action, usually a Button. */\n action?: React.ReactNode\n}\n\nconst SuccessPanel = React.forwardRef<HTMLDivElement, SuccessPanelProps>(\n ({ heading, description, icon, items, action, className, ...props }, ref) => {\n // Set after mount so the live region exists before its text changes.\n const [announced, setAnnounced] = React.useState(\"\")\n const headingOnMount = React.useRef(heading)\n React.useEffect(() => {\n setAnnounced(headingOnMount.current)\n }, [])\n\n return (\n <div ref={ref} data-slot=\"success-panel\" className={cn(styles.panel, className)} {...props}>\n <span data-slot=\"success-panel-seal\" className={styles.seal} aria-hidden=\"true\">\n {icon ?? <CheckCircle />}\n </span>\n <h2 data-slot=\"success-panel-heading\" className={styles.heading}>\n {heading}\n </h2>\n {description && (\n <p data-slot=\"success-panel-description\" className={styles.description}>\n {description}\n </p>\n )}\n {items && items.length > 0 && (\n <ul data-slot=\"success-panel-list\" className={styles.list}>\n {items.map((item, i) => (\n <li key={i} data-slot=\"success-panel-item\" className={styles.item}>\n <span className={styles.itemIcon} aria-hidden=\"true\">\n {item.icon ?? <CheckCircle />}\n </span>\n <span>{item.content}</span>\n </li>\n ))}\n </ul>\n )}\n {action && (\n <div data-slot=\"success-panel-action\" className={styles.action}>\n {action}\n </div>\n )}\n <SuccessLiveRegion message={announced} />\n </div>\n )\n }\n)\nSuccessPanel.displayName = \"SuccessPanel\"\n\nexport { SuccessPanel }\n"
|
|
2826
2828
|
},
|
|
2827
2829
|
{
|
|
2828
2830
|
"path": "components/ui/success-feedback/success-feedback.module.css",
|
|
2829
2831
|
"type": "registry:ui",
|
|
2830
|
-
"content": "/* SuccessLiveRegion — visually hidden, screen-reader only.\n Uses the standard SR-only technique: clip to a 1×1 pixel box,\n position absolute so it does not affect layout flow. */\n.liveRegion {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n"
|
|
2832
|
+
"content": "/* SuccessLiveRegion — visually hidden, screen-reader only.\n Uses the standard SR-only technique: clip to a 1×1 pixel box,\n position absolute so it does not affect layout flow. */\n.liveRegion {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n/* SuccessPanel (VI-714) — the end-of-flow screen, centred.\n Type sizes are hooks so a host can step them down at desktop widths\n (heading 19px, description and rows 14px / 13px in Animal's drawing). */\n.panel {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--spacing-3, 0.75rem);\n padding: var(--spacing-6, 1.5rem) var(--spacing-4, 1rem);\n text-align: center;\n}\n\n/* Intentional: a 56px seal around a 30px icon slot, per the design. */\n.seal {\n display: grid;\n place-items: center;\n width: 3.5rem;\n height: 3.5rem;\n border-radius: var(--radius-full, 9999px);\n background: var(--surface-success-subtle, #f0fdf4);\n color: var(--text-success, #15803d);\n font-size: 1.875rem;\n}\n\n.seal > svg {\n width: 1em;\n height: 1em;\n}\n\n.heading {\n margin: 0;\n font-size: var(--success-panel-heading-font-size, var(--font-size-xl, 1.25rem));\n font-weight: var(--font-weight-bold, 700);\n line-height: var(--line-height-tight, 1.25);\n color: var(--text-primary, #111827);\n}\n\n/* Intentional: 15px and a ~420px measure, per the design. */\n.description {\n margin: 0;\n max-width: 26.25rem;\n font-size: var(--success-panel-description-font-size, 0.9375rem);\n line-height: var(--line-height-normal, 1.5);\n color: var(--text-secondary, #6b7280);\n}\n\n.list {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n gap: var(--spacing-3, 0.75rem);\n margin: 0;\n padding: 0;\n list-style: none;\n text-align: start;\n}\n\n.item {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-3, 0.75rem);\n font-size: var(--success-panel-item-font-size, var(--font-size-sm, 0.875rem));\n line-height: var(--line-height-normal, 1.5);\n color: var(--text-secondary, #6b7280);\n}\n\n.item b,\n.item strong {\n color: var(--text-primary, #111827);\n}\n\n/* One line tall, so the 18px glyph (intentional, per the design) centres on\n the row's first line. */\n.itemIcon {\n display: inline-flex;\n flex: none;\n align-items: center;\n height: 1lh;\n color: var(--text-success, #15803d);\n}\n\n.itemIcon > svg {\n width: 1.125rem;\n height: 1.125rem;\n}\n\n.action {\n margin-top: var(--spacing-1, 0.25rem);\n}\n"
|
|
2831
2833
|
}
|
|
2832
2834
|
]
|
|
2833
2835
|
},
|
|
@@ -5394,7 +5396,7 @@
|
|
|
5394
5396
|
{
|
|
5395
5397
|
"path": "components/devtools/source-inspector/visor-component-names.generated.ts",
|
|
5396
5398
|
"type": "registry:devtool",
|
|
5397
|
-
"content": "// THIS FILE IS GENERATED BY scripts/generate-visor-component-names.ts.\n// Do not edit by hand. Re-run `npm run generate:component-names` after\n// adding, removing, or renaming a Visor component.\n//\n// Source of truth: registry/registry-{ui,blocks,deck,visual,devtools}.ts\n// Used by: components/devtools/source-inspector/* (VI-311)\n\nexport const VISOR_COMPONENT_NAMES: ReadonlySet<string> = new Set([\n \"AccessibilitySection\",\n \"AccessibilitySlide\",\n \"AccessibilitySpecimen\",\n \"Accordion\",\n \"AccordionContent\",\n \"AccordionItem\",\n \"AccordionTrigger\",\n \"ActionRow\",\n \"ActionRowList\",\n \"ActivityFeed\",\n \"ActivityFeedContext\",\n \"ActivityFeedItem\",\n \"ActivityFeedRoot\",\n \"AdminDashboard\",\n \"AdminDetail\",\n \"AdminDetailDrawer\",\n \"AdminListPage\",\n \"AdminListPageInner\",\n \"AdminSettingsPage\",\n \"AdminShell\",\n \"AdminTabbedEditor\",\n \"AdminWizard\",\n \"Alert\",\n \"AlertActions\",\n \"AlertDescription\",\n \"AlertLead\",\n \"AlertTitle\",\n \"AmbientGlow\",\n \"Avatar\",\n \"AvatarFallback\",\n \"AvatarImage\",\n \"AvatarStack\",\n \"Badge\",\n \"Banner\",\n \"BannerAction\",\n \"BannerDescription\",\n \"BannerTitle\",\n \"BentoGrid\",\n \"BentoTile\",\n \"BentoTileBody\",\n \"BentoTileDescription\",\n \"BentoTileFigure\",\n \"BentoTileHeadline\",\n \"BentoTileMedia\",\n \"BentoTileMeta\",\n \"BentoTileTitle\",\n \"BottomNav\",\n \"Box\",\n \"Breadcrumb\",\n \"BreadcrumbEllipsis\",\n \"BreadcrumbItem\",\n \"BreadcrumbLink\",\n \"BreadcrumbList\",\n \"BreadcrumbPage\",\n \"BreadcrumbSeparator\",\n \"BrowserFrame\",\n \"BulkActionBar\",\n \"Button\",\n \"ButtonSpecimenSection\",\n \"ButtonSpecimenSlide\",\n \"Calendar\",\n \"Capture\",\n \"Card\",\n \"CardContent\",\n \"CardDescription\",\n \"CardFooter\",\n \"CardGrid\",\n \"CardHeader\",\n \"CardLift\",\n \"CardTitle\",\n \"Carousel\",\n \"CarouselContent\",\n \"CarouselContext\",\n \"CarouselGallery\",\n \"CarouselItem\",\n \"CarouselNext\",\n \"CarouselPrevious\",\n \"ChallengeCard\",\n \"ChallengeCardAction\",\n \"ChallengeCardActions\",\n \"ChallengeCardBody\",\n \"ChallengeCardGate\",\n \"ChallengeCardHeader\",\n \"ChartContainer\",\n \"ChartContext\",\n \"ChartLegend\",\n \"ChartLegendContent\",\n \"ChartStyle\",\n \"ChartTooltip\",\n \"ChartTooltipContent\",\n \"Checkbox\",\n \"CheckGroup\",\n \"CheckRow\",\n \"Chip\",\n \"ChipGroup\",\n \"ChipGroupContext\",\n \"ChipGroupItem\",\n \"ChoiceChip\",\n \"ChromeButton\",\n \"ClosingSlide\",\n \"CodeBlock\",\n \"Collapsible\",\n \"CollapsibleContent\",\n \"CollapsibleTrigger\",\n \"ColorBar\",\n \"ColorPaletteSection\",\n \"ColorPicker\",\n \"ColorPickerSurface\",\n \"ColorSwatch\",\n \"ColorSwatchGrid\",\n \"Column\",\n \"Combobox\",\n \"ComboboxContent\",\n \"ComboboxContext\",\n \"ComboboxEmpty\",\n \"ComboboxGroup\",\n \"ComboboxInput\",\n \"ComboboxItem\",\n \"ComboboxSeparator\",\n \"Command\",\n \"CommandDialog\",\n \"CommandEmpty\",\n \"CommandGroup\",\n \"CommandInput\",\n \"CommandItem\",\n \"CommandList\",\n \"CommandLoading\",\n \"CommandSeparator\",\n \"CommandShortcut\",\n \"ComponentShowcaseContent\",\n \"ComponentShowcaseSection\",\n \"ComponentShowcaseSlide\",\n \"Composer\",\n \"ComposerContext\",\n \"ComposerField\",\n \"ComposerSend\",\n \"ComposerSpacer\",\n \"ComposerToolbar\",\n \"ComposerToolButton\",\n \"ConceptSlide\",\n \"ConfigurationPanel\",\n \"ConfirmDialog\",\n \"ConflictBanner\",\n \"Container\",\n \"ContextMenu\",\n \"ContextMenuCheckboxItem\",\n \"ContextMenuContent\",\n \"ContextMenuGroup\",\n \"ContextMenuItem\",\n \"ContextMenuLabel\",\n \"ContextMenuPortal\",\n \"ContextMenuRadioGroup\",\n \"ContextMenuRadioItem\",\n \"ContextMenuSeparator\",\n \"ContextMenuShortcut\",\n \"ContextMenuSub\",\n \"ContextMenuSubContent\",\n \"ContextMenuSubTrigger\",\n \"ContextMenuTrigger\",\n \"Controls\",\n \"CtaSection\",\n \"DataTable\",\n \"DataTableInner\",\n \"DatePicker\",\n \"DateRangePicker\",\n \"DeckContext\",\n \"DeckFooter\",\n \"DeckLayout\",\n \"DeckProvider\",\n \"DeckRenderer\",\n \"DesignSystemDeck\",\n \"DesignSystemSpecimen\",\n \"Dialog\",\n \"DialogBack\",\n \"DialogClose\",\n \"DialogContent\",\n \"DialogContext\",\n \"DialogDescription\",\n \"DialogField\",\n \"DialogFieldControl\",\n \"DialogFieldLabel\",\n \"DialogFooter\",\n \"DialogForm\",\n \"DialogFormBody\",\n \"DialogFormClose\",\n \"DialogFormContent\",\n \"DialogFormDescription\",\n \"DialogFormFooter\",\n \"DialogFormHeader\",\n \"DialogFormTitle\",\n \"DialogFormTrigger\",\n \"DialogHeader\",\n \"DialogOverlay\",\n \"DialogPortal\",\n \"DialogScrim\",\n \"DialogTitle\",\n \"DialogTrigger\",\n \"DocFrame\",\n \"DocFrameBrand\",\n \"DocNav\",\n \"DocNavGroup\",\n \"DocNavPill\",\n \"DotNav\",\n \"DropdownMenu\",\n \"DropdownMenuCheckboxItem\",\n \"DropdownMenuContent\",\n \"DropdownMenuGroup\",\n \"DropdownMenuItem\",\n \"DropdownMenuLabel\",\n \"DropdownMenuPortal\",\n \"DropdownMenuRadioGroup\",\n \"DropdownMenuRadioItem\",\n \"DropdownMenuSeparator\",\n \"DropdownMenuShortcut\",\n \"DropdownMenuSub\",\n \"DropdownMenuSubContent\",\n \"DropdownMenuSubTrigger\",\n \"DropdownMenuTrigger\",\n \"EditableBlock\",\n \"ElevationCard\",\n \"ElevationSlide\",\n \"EmptyState\",\n \"ErrorPlacard\",\n \"ExportMenu\",\n \"FeaturesGrid\",\n \"FidelityMirror\",\n \"Field\",\n \"FieldDescription\",\n \"FieldError\",\n \"FieldLabel\",\n \"Fieldset\",\n \"FieldsetLegend\",\n \"FileUpload\",\n \"FilterBar\",\n \"FilterChip\",\n \"FontShowcase\",\n \"FontShowcaseGrid\",\n \"Footer\",\n \"FooterSection\",\n \"Form\",\n \"FormError\",\n \"FormErrorDescription\",\n \"FormErrorTitle\",\n \"FormField\",\n \"FormSpecimenSection\",\n \"FormSpecimenSlide\",\n \"FullscreenOverlay\",\n \"FullscreenOverlayContent\",\n \"FullscreenOverlayTrigger\",\n \"GrainOverlay\",\n \"Grid\",\n \"Header\",\n \"Heading\",\n \"HeroGlow\",\n \"HeroSection\",\n \"HeroSlide\",\n \"HoverCard\",\n \"HoverCardContent\",\n \"HoverCardTrigger\",\n \"IconGrid\",\n \"IconGridSection\",\n \"IconSizeRow\",\n \"IconsSlide\",\n \"Image\",\n \"InfographicBar\",\n \"Inline\",\n \"InlineEdit\",\n \"Input\",\n \"Kbd\",\n \"KeyValueList\",\n \"Label\",\n \"Landing\",\n \"Lightbox\",\n \"LightboxContent\",\n \"LightboxContext\",\n \"LightboxTrigger\",\n \"LoginForm\",\n \"Marquee\",\n \"MarqueeBandRenderer\",\n \"MatrixCell\",\n \"MatrixTable\",\n \"MatrixTableInner\",\n \"Menubar\",\n \"MenubarCheckboxItem\",\n \"MenubarContent\",\n \"MenubarGroup\",\n \"MenubarItem\",\n \"MenubarLabel\",\n \"MenubarMenu\",\n \"MenubarRadioGroup\",\n \"MenubarRadioItem\",\n \"MenubarSeparator\",\n \"MenubarShortcut\",\n \"MenubarSub\",\n \"MenubarSubContent\",\n \"MenubarSubTrigger\",\n \"MenubarTrigger\",\n \"MonthCalendar\",\n \"MotionDuration\",\n \"MotionDurationSection\",\n \"MotionEasing\",\n \"MotionEasingSection\",\n \"MotionSlide\",\n \"NameRoster\",\n \"NameRosterItem\",\n \"Navbar\",\n \"NavbarBrand\",\n \"NavbarContent\",\n \"NavbarItem\",\n \"NavbarLink\",\n \"NavbarToggle\",\n \"NumberInput\",\n \"OfflineBanner\",\n \"OpacityBar\",\n \"OpacitySlide\",\n \"OTPInput\",\n \"PageHeader\",\n \"Pagination\",\n \"PaginationContent\",\n \"PaginationEllipsis\",\n \"PaginationItem\",\n \"PaginationLink\",\n \"PaginationNext\",\n \"PaginationPrevious\",\n \"PasswordInput\",\n \"PhoneInput\",\n \"PlatformChip\",\n \"Popover\",\n \"PopoverAnchor\",\n \"PopoverContent\",\n \"PopoverFooter\",\n \"PopoverSelectionItem\",\n \"PopoverSelectionLabel\",\n \"PopoverSelectionList\",\n \"PopoverTrigger\",\n \"PositionPicker\",\n \"PricingSection\",\n \"ProfileMenu\",\n \"Progress\",\n \"PrototypeReview\",\n \"QuickActions\",\n \"RadioGroup\",\n \"RadioGroupItem\",\n \"RadioGroupVariantContext\",\n \"RadiusScale\",\n \"RadiusSection\",\n \"RadiusSlide\",\n \"RecordSection\",\n \"RightRailList\",\n \"SaveStatus\",\n \"ScoreIndicator\",\n \"ScrollArea\",\n \"ScrollBar\",\n \"SearchInput\",\n \"SectionHeader\",\n \"SectionIntro\",\n \"SectionNav\",\n \"SectionNavItem\",\n \"SegmentedControl\",\n \"SegmentedProgress\",\n \"Select\",\n \"SelectContent\",\n \"SelectGroup\",\n \"SelectionListContext\",\n \"SelectItem\",\n \"SelectLabel\",\n \"SelectScrollDownButton\",\n \"SelectScrollUpButton\",\n \"SelectSeparator\",\n \"SelectTrigger\",\n \"SelectValue\",\n \"SemanticColorGrid\",\n \"SemanticColorItem\",\n \"SemanticTokensSlide\",\n \"SensitivePanel\",\n \"Separator\",\n \"SessionTimeout\",\n \"ShadowSection\",\n \"Sheet\",\n \"SheetClose\",\n \"SheetContent\",\n \"SheetContext\",\n \"SheetDescription\",\n \"SheetFooter\",\n \"SheetHeader\",\n \"SheetOverlay\",\n \"SheetPortal\",\n \"SheetScrim\",\n \"SheetTitle\",\n \"SheetTrigger\",\n \"Sidebar\",\n \"SidebarContent\",\n \"SidebarContext\",\n \"SidebarFooter\",\n \"SidebarGroup\",\n \"SidebarGroupAction\",\n \"SidebarGroupContent\",\n \"SidebarGroupLabel\",\n \"SidebarHeader\",\n \"SidebarInset\",\n \"SidebarMenu\",\n \"SidebarMenuAction\",\n \"SidebarMenuBadge\",\n \"SidebarMenuButton\",\n \"SidebarMenuItem\",\n \"SidebarMenuSub\",\n \"SidebarMenuSubButton\",\n \"SidebarMenuSubItem\",\n \"SidebarProvider\",\n \"SidebarRail\",\n \"SidebarScopeContext\",\n \"SidebarSeparator\",\n \"SidebarTrigger\",\n \"Skeleton\",\n \"SkeletonDetail\",\n \"SkeletonList\",\n \"SkeletonTable\",\n \"Slide\",\n \"SlideHeader\",\n \"Slider\",\n \"SliderControl\",\n \"SlideThemeContext\",\n \"SlideThemeProvider\",\n \"SlowNetworkBar\",\n \"SourceInspector\",\n \"SourceInspectorContext\",\n \"SourceInspectorDevImpl\",\n \"SourceInspectorProvider\",\n \"SourceInspectorRunner\",\n \"SourceInspectorToggle\",\n \"SpacingScale\",\n \"SpacingSection\",\n \"SpacingSlide\",\n \"Sparkline\",\n \"SpecimenCard\",\n \"SpecimenCardFooter\",\n \"Sphere\",\n \"SpherePlayground\",\n \"Spinner\",\n \"SpinnerOrb\",\n \"Stack\",\n \"Stage\",\n \"StatCard\",\n \"StatHero\",\n \"StationSpectrum\",\n \"StatusBadge\",\n \"StatusColorsSlide\",\n \"StatusDot\",\n \"Stepper\",\n \"StepperContext\",\n \"StepperDescription\",\n \"StepperItem\",\n \"StepperSeparator\",\n \"StepperTitle\",\n \"StepperTrigger\",\n \"StepsSection\",\n \"StructuredPrompt\",\n \"StructuredPromptBody\",\n \"StructuredPromptHeader\",\n \"StructuredPromptHint\",\n \"StructuredPromptSlot\",\n \"SuccessLiveRegion\",\n \"SurfaceRow\",\n \"SurfaceScaleStack\",\n \"SurfaceSection\",\n \"Switch\",\n \"Table\",\n \"TableBody\",\n \"TableCaption\",\n \"TableCell\",\n \"TableFooter\",\n \"TableHead\",\n \"TableHeader\",\n \"TableRow\",\n \"Tabs\",\n \"TabsContent\",\n \"TabsList\",\n \"TabsTrigger\",\n \"TagInput\",\n \"TestimonialAttribution\",\n \"TestimonialSection\",\n \"Text\",\n \"Textarea\",\n \"ThemeArchitectureSlide\",\n \"ThemeColorsSlide\",\n \"ThemeSwitcher\",\n \"ThinkingOrb\",\n \"Timeline\",\n \"TimelineContent\",\n \"TimelineDescription\",\n \"TimelineIcon\",\n \"TimelineItem\",\n \"TimelineTimestamp\",\n \"TimelineTitle\",\n \"TimePicker\",\n \"TinInput\",\n \"TitleSlide\",\n \"ToastCard\",\n \"ToastCardStack\",\n \"Toaster\",\n \"TOCSlide\",\n \"ToggleButton\",\n \"ToggleDevImpl\",\n \"ToggleGroup\",\n \"ToggleGroupContext\",\n \"ToggleGroupItem\",\n \"Tooltip\",\n \"TooltipContent\",\n \"TooltipProvider\",\n \"TooltipTrigger\",\n \"TypeBodySlide\",\n \"TypeDisplaySlide\",\n \"TypeScaleStack\",\n \"TypeSpecimen\",\n \"TypographySection\",\n \"Vignette\",\n \"WorkspaceSwitcher\",\n])\n"
|
|
5399
|
+
"content": "// THIS FILE IS GENERATED BY scripts/generate-visor-component-names.ts.\n// Do not edit by hand. Re-run `npm run generate:component-names` after\n// adding, removing, or renaming a Visor component.\n//\n// Source of truth: registry/registry-{ui,blocks,deck,visual,devtools}.ts\n// Used by: components/devtools/source-inspector/* (VI-311)\n\nexport const VISOR_COMPONENT_NAMES: ReadonlySet<string> = new Set([\n \"AccessibilitySection\",\n \"AccessibilitySlide\",\n \"AccessibilitySpecimen\",\n \"Accordion\",\n \"AccordionContent\",\n \"AccordionItem\",\n \"AccordionTrigger\",\n \"ActionRow\",\n \"ActionRowList\",\n \"ActivityFeed\",\n \"ActivityFeedContext\",\n \"ActivityFeedItem\",\n \"ActivityFeedRoot\",\n \"AdminDashboard\",\n \"AdminDetail\",\n \"AdminDetailDrawer\",\n \"AdminListPage\",\n \"AdminListPageInner\",\n \"AdminSettingsPage\",\n \"AdminShell\",\n \"AdminTabbedEditor\",\n \"AdminWizard\",\n \"Alert\",\n \"AlertActions\",\n \"AlertDescription\",\n \"AlertLead\",\n \"AlertTitle\",\n \"AmbientGlow\",\n \"Avatar\",\n \"AvatarFallback\",\n \"AvatarImage\",\n \"AvatarStack\",\n \"Badge\",\n \"Banner\",\n \"BannerAction\",\n \"BannerDescription\",\n \"BannerTitle\",\n \"BentoGrid\",\n \"BentoTile\",\n \"BentoTileBody\",\n \"BentoTileDescription\",\n \"BentoTileFigure\",\n \"BentoTileHeadline\",\n \"BentoTileMedia\",\n \"BentoTileMeta\",\n \"BentoTileTitle\",\n \"BottomNav\",\n \"Box\",\n \"Breadcrumb\",\n \"BreadcrumbEllipsis\",\n \"BreadcrumbItem\",\n \"BreadcrumbLink\",\n \"BreadcrumbList\",\n \"BreadcrumbPage\",\n \"BreadcrumbSeparator\",\n \"BrowserFrame\",\n \"BulkActionBar\",\n \"Button\",\n \"ButtonSpecimenSection\",\n \"ButtonSpecimenSlide\",\n \"Calendar\",\n \"Capture\",\n \"Card\",\n \"CardContent\",\n \"CardDescription\",\n \"CardFooter\",\n \"CardGrid\",\n \"CardHeader\",\n \"CardLift\",\n \"CardTitle\",\n \"Carousel\",\n \"CarouselContent\",\n \"CarouselContext\",\n \"CarouselGallery\",\n \"CarouselItem\",\n \"CarouselNext\",\n \"CarouselPrevious\",\n \"ChallengeCard\",\n \"ChallengeCardAction\",\n \"ChallengeCardActions\",\n \"ChallengeCardBody\",\n \"ChallengeCardGate\",\n \"ChallengeCardHeader\",\n \"ChartContainer\",\n \"ChartContext\",\n \"ChartLegend\",\n \"ChartLegendContent\",\n \"ChartStyle\",\n \"ChartTooltip\",\n \"ChartTooltipContent\",\n \"Checkbox\",\n \"CheckGroup\",\n \"CheckRow\",\n \"Chip\",\n \"ChipGroup\",\n \"ChipGroupContext\",\n \"ChipGroupItem\",\n \"ChoiceChip\",\n \"ChromeButton\",\n \"ClosingSlide\",\n \"CodeBlock\",\n \"Collapsible\",\n \"CollapsibleContent\",\n \"CollapsibleTrigger\",\n \"ColorBar\",\n \"ColorPaletteSection\",\n \"ColorPicker\",\n \"ColorPickerSurface\",\n \"ColorSwatch\",\n \"ColorSwatchGrid\",\n \"Column\",\n \"Combobox\",\n \"ComboboxContent\",\n \"ComboboxContext\",\n \"ComboboxEmpty\",\n \"ComboboxGroup\",\n \"ComboboxInput\",\n \"ComboboxItem\",\n \"ComboboxSeparator\",\n \"Command\",\n \"CommandDialog\",\n \"CommandEmpty\",\n \"CommandGroup\",\n \"CommandInput\",\n \"CommandItem\",\n \"CommandList\",\n \"CommandLoading\",\n \"CommandSeparator\",\n \"CommandShortcut\",\n \"ComponentShowcaseContent\",\n \"ComponentShowcaseSection\",\n \"ComponentShowcaseSlide\",\n \"Composer\",\n \"ComposerContext\",\n \"ComposerField\",\n \"ComposerSend\",\n \"ComposerSpacer\",\n \"ComposerToolbar\",\n \"ComposerToolButton\",\n \"ConceptSlide\",\n \"ConfigurationPanel\",\n \"ConfirmDialog\",\n \"ConflictBanner\",\n \"Container\",\n \"ContextMenu\",\n \"ContextMenuCheckboxItem\",\n \"ContextMenuContent\",\n \"ContextMenuGroup\",\n \"ContextMenuItem\",\n \"ContextMenuLabel\",\n \"ContextMenuPortal\",\n \"ContextMenuRadioGroup\",\n \"ContextMenuRadioItem\",\n \"ContextMenuSeparator\",\n \"ContextMenuShortcut\",\n \"ContextMenuSub\",\n \"ContextMenuSubContent\",\n \"ContextMenuSubTrigger\",\n \"ContextMenuTrigger\",\n \"Controls\",\n \"CtaSection\",\n \"DataTable\",\n \"DataTableInner\",\n \"DatePicker\",\n \"DateRangePicker\",\n \"DeckContext\",\n \"DeckFooter\",\n \"DeckLayout\",\n \"DeckProvider\",\n \"DeckRenderer\",\n \"DesignSystemDeck\",\n \"DesignSystemSpecimen\",\n \"Dialog\",\n \"DialogBack\",\n \"DialogClose\",\n \"DialogContent\",\n \"DialogContext\",\n \"DialogDescription\",\n \"DialogField\",\n \"DialogFieldControl\",\n \"DialogFieldLabel\",\n \"DialogFooter\",\n \"DialogForm\",\n \"DialogFormBody\",\n \"DialogFormClose\",\n \"DialogFormContent\",\n \"DialogFormDescription\",\n \"DialogFormFooter\",\n \"DialogFormHeader\",\n \"DialogFormTitle\",\n \"DialogFormTrigger\",\n \"DialogHeader\",\n \"DialogOverlay\",\n \"DialogPortal\",\n \"DialogScrim\",\n \"DialogTitle\",\n \"DialogTrigger\",\n \"DocFrame\",\n \"DocFrameBrand\",\n \"DocNav\",\n \"DocNavGroup\",\n \"DocNavPill\",\n \"DotNav\",\n \"DropdownMenu\",\n \"DropdownMenuCheckboxItem\",\n \"DropdownMenuContent\",\n \"DropdownMenuGroup\",\n \"DropdownMenuItem\",\n \"DropdownMenuLabel\",\n \"DropdownMenuPortal\",\n \"DropdownMenuRadioGroup\",\n \"DropdownMenuRadioItem\",\n \"DropdownMenuSeparator\",\n \"DropdownMenuShortcut\",\n \"DropdownMenuSub\",\n \"DropdownMenuSubContent\",\n \"DropdownMenuSubTrigger\",\n \"DropdownMenuTrigger\",\n \"EditableBlock\",\n \"ElevationCard\",\n \"ElevationSlide\",\n \"EmptyState\",\n \"ErrorPlacard\",\n \"ExportMenu\",\n \"FeaturesGrid\",\n \"FidelityMirror\",\n \"Field\",\n \"FieldDescription\",\n \"FieldError\",\n \"FieldLabel\",\n \"Fieldset\",\n \"FieldsetLegend\",\n \"FileUpload\",\n \"FilterBar\",\n \"FilterChip\",\n \"FontShowcase\",\n \"FontShowcaseGrid\",\n \"Footer\",\n \"FooterSection\",\n \"Form\",\n \"FormError\",\n \"FormErrorDescription\",\n \"FormErrorTitle\",\n \"FormField\",\n \"FormSpecimenSection\",\n \"FormSpecimenSlide\",\n \"FullscreenOverlay\",\n \"FullscreenOverlayContent\",\n \"FullscreenOverlayTrigger\",\n \"GrainOverlay\",\n \"Grid\",\n \"Header\",\n \"Heading\",\n \"HeroGlow\",\n \"HeroSection\",\n \"HeroSlide\",\n \"HoverCard\",\n \"HoverCardContent\",\n \"HoverCardTrigger\",\n \"IconGrid\",\n \"IconGridSection\",\n \"IconSizeRow\",\n \"IconsSlide\",\n \"Image\",\n \"InfographicBar\",\n \"Inline\",\n \"InlineEdit\",\n \"Input\",\n \"Kbd\",\n \"KeyValueList\",\n \"Label\",\n \"Landing\",\n \"Lightbox\",\n \"LightboxContent\",\n \"LightboxContext\",\n \"LightboxTrigger\",\n \"LoginForm\",\n \"Marquee\",\n \"MarqueeBandRenderer\",\n \"MatrixCell\",\n \"MatrixTable\",\n \"MatrixTableInner\",\n \"Menubar\",\n \"MenubarCheckboxItem\",\n \"MenubarContent\",\n \"MenubarGroup\",\n \"MenubarItem\",\n \"MenubarLabel\",\n \"MenubarMenu\",\n \"MenubarRadioGroup\",\n \"MenubarRadioItem\",\n \"MenubarSeparator\",\n \"MenubarShortcut\",\n \"MenubarSub\",\n \"MenubarSubContent\",\n \"MenubarSubTrigger\",\n \"MenubarTrigger\",\n \"MonthCalendar\",\n \"MotionDuration\",\n \"MotionDurationSection\",\n \"MotionEasing\",\n \"MotionEasingSection\",\n \"MotionSlide\",\n \"NameRoster\",\n \"NameRosterItem\",\n \"Navbar\",\n \"NavbarBrand\",\n \"NavbarContent\",\n \"NavbarItem\",\n \"NavbarLink\",\n \"NavbarToggle\",\n \"NumberInput\",\n \"OfflineBanner\",\n \"OpacityBar\",\n \"OpacitySlide\",\n \"OTPInput\",\n \"PageHeader\",\n \"Pagination\",\n \"PaginationContent\",\n \"PaginationEllipsis\",\n \"PaginationItem\",\n \"PaginationLink\",\n \"PaginationNext\",\n \"PaginationPrevious\",\n \"PasswordInput\",\n \"PhoneInput\",\n \"PlatformChip\",\n \"Popover\",\n \"PopoverAnchor\",\n \"PopoverContent\",\n \"PopoverFooter\",\n \"PopoverSelectionItem\",\n \"PopoverSelectionLabel\",\n \"PopoverSelectionList\",\n \"PopoverTrigger\",\n \"PositionPicker\",\n \"PricingSection\",\n \"ProfileMenu\",\n \"Progress\",\n \"PrototypeReview\",\n \"QuickActions\",\n \"RadioGroup\",\n \"RadioGroupItem\",\n \"RadioGroupVariantContext\",\n \"RadiusScale\",\n \"RadiusSection\",\n \"RadiusSlide\",\n \"RecordSection\",\n \"RightRailList\",\n \"SaveStatus\",\n \"ScoreIndicator\",\n \"ScrollArea\",\n \"ScrollBar\",\n \"SearchInput\",\n \"SectionHeader\",\n \"SectionIntro\",\n \"SectionNav\",\n \"SectionNavItem\",\n \"SegmentedControl\",\n \"SegmentedProgress\",\n \"Select\",\n \"SelectContent\",\n \"SelectGroup\",\n \"SelectionListContext\",\n \"SelectItem\",\n \"SelectLabel\",\n \"SelectScrollDownButton\",\n \"SelectScrollUpButton\",\n \"SelectSeparator\",\n \"SelectTrigger\",\n \"SelectValue\",\n \"SemanticColorGrid\",\n \"SemanticColorItem\",\n \"SemanticTokensSlide\",\n \"SensitivePanel\",\n \"Separator\",\n \"SessionTimeout\",\n \"ShadowSection\",\n \"Sheet\",\n \"SheetClose\",\n \"SheetContent\",\n \"SheetContext\",\n \"SheetDescription\",\n \"SheetFooter\",\n \"SheetHeader\",\n \"SheetOverlay\",\n \"SheetPortal\",\n \"SheetScrim\",\n \"SheetTitle\",\n \"SheetTrigger\",\n \"Sidebar\",\n \"SidebarContent\",\n \"SidebarContext\",\n \"SidebarFooter\",\n \"SidebarGroup\",\n \"SidebarGroupAction\",\n \"SidebarGroupContent\",\n \"SidebarGroupLabel\",\n \"SidebarHeader\",\n \"SidebarInset\",\n \"SidebarMenu\",\n \"SidebarMenuAction\",\n \"SidebarMenuBadge\",\n \"SidebarMenuButton\",\n \"SidebarMenuItem\",\n \"SidebarMenuSub\",\n \"SidebarMenuSubButton\",\n \"SidebarMenuSubItem\",\n \"SidebarProvider\",\n \"SidebarRail\",\n \"SidebarScopeContext\",\n \"SidebarSeparator\",\n \"SidebarTrigger\",\n \"Skeleton\",\n \"SkeletonDetail\",\n \"SkeletonList\",\n \"SkeletonTable\",\n \"Slide\",\n \"SlideHeader\",\n \"Slider\",\n \"SliderControl\",\n \"SlideThemeContext\",\n \"SlideThemeProvider\",\n \"SlowNetworkBar\",\n \"SourceInspector\",\n \"SourceInspectorContext\",\n \"SourceInspectorDevImpl\",\n \"SourceInspectorProvider\",\n \"SourceInspectorRunner\",\n \"SourceInspectorToggle\",\n \"SpacingScale\",\n \"SpacingSection\",\n \"SpacingSlide\",\n \"Sparkline\",\n \"SpecimenCard\",\n \"SpecimenCardFooter\",\n \"Sphere\",\n \"SpherePlayground\",\n \"Spinner\",\n \"SpinnerOrb\",\n \"Stack\",\n \"Stage\",\n \"StatCard\",\n \"StatHero\",\n \"StationSpectrum\",\n \"StatusBadge\",\n \"StatusColorsSlide\",\n \"StatusDot\",\n \"Stepper\",\n \"StepperContext\",\n \"StepperDescription\",\n \"StepperItem\",\n \"StepperSeparator\",\n \"StepperTitle\",\n \"StepperTrigger\",\n \"StepsSection\",\n \"StructuredPrompt\",\n \"StructuredPromptBody\",\n \"StructuredPromptHeader\",\n \"StructuredPromptHint\",\n \"StructuredPromptSlot\",\n \"SuccessLiveRegion\",\n \"SuccessPanel\",\n \"SurfaceRow\",\n \"SurfaceScaleStack\",\n \"SurfaceSection\",\n \"Switch\",\n \"Table\",\n \"TableBody\",\n \"TableCaption\",\n \"TableCell\",\n \"TableFooter\",\n \"TableHead\",\n \"TableHeader\",\n \"TableRow\",\n \"Tabs\",\n \"TabsContent\",\n \"TabsList\",\n \"TabsTrigger\",\n \"TagInput\",\n \"TestimonialAttribution\",\n \"TestimonialSection\",\n \"Text\",\n \"Textarea\",\n \"ThemeArchitectureSlide\",\n \"ThemeColorsSlide\",\n \"ThemeSwitcher\",\n \"ThinkingOrb\",\n \"Timeline\",\n \"TimelineContent\",\n \"TimelineDescription\",\n \"TimelineIcon\",\n \"TimelineItem\",\n \"TimelineTimestamp\",\n \"TimelineTitle\",\n \"TimePicker\",\n \"TinInput\",\n \"TitleSlide\",\n \"ToastCard\",\n \"ToastCardStack\",\n \"Toaster\",\n \"TOCSlide\",\n \"ToggleButton\",\n \"ToggleDevImpl\",\n \"ToggleGroup\",\n \"ToggleGroupContext\",\n \"ToggleGroupItem\",\n \"Tooltip\",\n \"TooltipContent\",\n \"TooltipProvider\",\n \"TooltipTrigger\",\n \"TypeBodySlide\",\n \"TypeDisplaySlide\",\n \"TypeScaleStack\",\n \"TypeSpecimen\",\n \"TypographySection\",\n \"Vignette\",\n \"WorkspaceSwitcher\",\n])\n"
|
|
5398
5400
|
}
|
|
5399
5401
|
]
|
|
5400
5402
|
},
|
package/dist/visor-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.4.0",
|
|
3
|
-
"generated_at": "2026-10-
|
|
3
|
+
"generated_at": "2026-10-26T20:00:31.066Z",
|
|
4
4
|
"components": {
|
|
5
5
|
"accessibility-specimen": {
|
|
6
6
|
"category": "specimen",
|
|
@@ -2915,7 +2915,8 @@
|
|
|
2915
2915
|
],
|
|
2916
2916
|
"iconTreatment": [
|
|
2917
2917
|
"inline",
|
|
2918
|
-
"plated"
|
|
2918
|
+
"plated",
|
|
2919
|
+
"none"
|
|
2919
2920
|
],
|
|
2920
2921
|
"mode": [
|
|
2921
2922
|
"dialog",
|
|
@@ -2952,8 +2953,8 @@
|
|
|
2952
2953
|
},
|
|
2953
2954
|
{
|
|
2954
2955
|
"name": "iconTreatment",
|
|
2955
|
-
"type": "'inline' | 'plated'",
|
|
2956
|
-
"description": "Severity-icon treatment. Leave unset for the canonical default — a tinted circular plate stacked above the title. Set \"plated\" for a 40px color-mix severity plate leading the title column, or \"inline\" for a small leading icon next to the title. Default rendering (unset) is unchanged.\n"
|
|
2956
|
+
"type": "'inline' | 'plated' | 'none'",
|
|
2957
|
+
"description": "Severity-icon treatment. Leave unset for the canonical default — a tinted circular plate stacked above the title. Set \"plated\" for a 40px color-mix severity plate leading the title column, or \"inline\" for a small leading icon next to the title, or \"none\" for no icon and no icon container. Default rendering (unset) is unchanged.\n"
|
|
2957
2958
|
},
|
|
2958
2959
|
{
|
|
2959
2960
|
"name": "mode",
|
|
@@ -2961,6 +2962,17 @@
|
|
|
2961
2962
|
"default": "dialog",
|
|
2962
2963
|
"description": "Rendering mode. \"dialog\" uses Radix Dialog + Portal + Overlay + auto X-close. \"inline\" renders only the content surface (no portal, no overlay, no X-close) so multiple dialogs can stack inside one shared scrim.\n"
|
|
2963
2964
|
},
|
|
2965
|
+
{
|
|
2966
|
+
"name": "container",
|
|
2967
|
+
"type": "HTMLElement | null",
|
|
2968
|
+
"description": "Element the dialog portals into instead of document.body, passed straight to Dialog's container. Use it to render inside the host app's theme root. Dialog mode only.\n"
|
|
2969
|
+
},
|
|
2970
|
+
{
|
|
2971
|
+
"name": "showCloseButton",
|
|
2972
|
+
"type": "boolean",
|
|
2973
|
+
"default": "true",
|
|
2974
|
+
"description": "Render the X close button. Escape and the focus trap are kept when it is hidden. Dialog mode only.\n"
|
|
2975
|
+
},
|
|
2964
2976
|
{
|
|
2965
2977
|
"name": "cancelVariant",
|
|
2966
2978
|
"type": "ButtonProps[\"variant\"]",
|
|
@@ -3733,6 +3745,12 @@
|
|
|
3733
3745
|
"default": false,
|
|
3734
3746
|
"description": "Show a drag handle on the sheet presentation; dragging down dismisses (DialogContent)"
|
|
3735
3747
|
},
|
|
3748
|
+
{
|
|
3749
|
+
"name": "showCloseButton",
|
|
3750
|
+
"type": "boolean",
|
|
3751
|
+
"default": "true",
|
|
3752
|
+
"description": "Render the X close button (DialogContent). Hide it only when the content has its own dismiss action; Escape still closes. Drag-to-dismiss needs it."
|
|
3753
|
+
},
|
|
3736
3754
|
{
|
|
3737
3755
|
"name": "back",
|
|
3738
3756
|
"type": "React.ReactNode",
|
|
@@ -8305,16 +8323,17 @@
|
|
|
8305
8323
|
},
|
|
8306
8324
|
"segmented-progress": {
|
|
8307
8325
|
"category": "data-display",
|
|
8308
|
-
"description": "Discrete per-step progress meter — N equal pill segments in a row, each individually expressing done, current, or pending state. Designed for multi-step flows where individual step completion matters, not just an overall percentage.",
|
|
8326
|
+
"description": "Discrete per-step progress meter — N equal pill segments in a row, each individually expressing done, current, or pending state. With `steps`, each segment carries a label under it, a step can be failed, the fills draw in once on mount, and a visually hidden summary is read in place of the bar. Designed for multi-step flows where individual step completion matters, not just an overall percentage.",
|
|
8309
8327
|
"when_to_use": [
|
|
8310
8328
|
"Multi-step onboarding or wizard flows where each discrete step needs individual visual state",
|
|
8311
8329
|
"Brand elicitation, survey, or questionnaire progress where step-level completion is meaningful",
|
|
8312
8330
|
"Short sequence indicators (≤12 steps) where a pill-per-step treatment reads clearly",
|
|
8313
|
-
"Inline progress in cards or compact surfaces where a stepper is too heavy"
|
|
8331
|
+
"Inline progress in cards or compact surfaces where a stepper is too heavy",
|
|
8332
|
+
"A segmented stepper with a label under each bar, including a failed step (pass `steps`)"
|
|
8314
8333
|
],
|
|
8315
8334
|
"when_not_to_use": [
|
|
8316
8335
|
"Use `progress` for continuous values like upload percentage or loading progress",
|
|
8317
|
-
"Use `stepper` when
|
|
8336
|
+
"Use `stepper` when numbered circles or click-to-navigate behavior is needed",
|
|
8318
8337
|
"Sequences longer than ~15 segments (pills become too narrow to read)"
|
|
8319
8338
|
],
|
|
8320
8339
|
"variants": {
|
|
@@ -8328,13 +8347,23 @@
|
|
|
8328
8347
|
"name": "total",
|
|
8329
8348
|
"type": "number",
|
|
8330
8349
|
"required": true,
|
|
8331
|
-
"description": "Total number of segments to render."
|
|
8350
|
+
"description": "Total number of segments to render. Not used with `steps`."
|
|
8332
8351
|
},
|
|
8333
8352
|
{
|
|
8334
8353
|
"name": "value",
|
|
8335
8354
|
"type": "number",
|
|
8336
8355
|
"required": true,
|
|
8337
|
-
"description": "Count of completed segments. Indices 0..value-1 render as done."
|
|
8356
|
+
"description": "Count of completed segments. Indices 0..value-1 render as done. With `steps`, the default for a step that sets no `state`."
|
|
8357
|
+
},
|
|
8358
|
+
{
|
|
8359
|
+
"name": "steps",
|
|
8360
|
+
"type": "{ label: ReactNode; state?: 'done' | 'current' | 'pending' | 'failed' }[]",
|
|
8361
|
+
"description": "One entry per step, each a segment with its label under it. A step without a `state` follows `value` and `current`. A failed step fills with --interactive-destructive-bg and its label reads in --text-error with a warning icon; a done label carries a check-circle. The bar is aria-hidden and `summary` is read in its place. Labels are 12px (sm) and 14px (md), rebindable through --segmented-progress-sm-label-font-size and --segmented-progress-md-label-font-size."
|
|
8362
|
+
},
|
|
8363
|
+
{
|
|
8364
|
+
"name": "summary",
|
|
8365
|
+
"type": "ReactNode",
|
|
8366
|
+
"description": "With `steps`, the visually hidden line a screen reader hears. Defaults to \"Step 2 of 3: Bank Details\", naming the failed, current or next step."
|
|
8338
8367
|
},
|
|
8339
8368
|
{
|
|
8340
8369
|
"name": "current",
|
|
@@ -8351,23 +8380,42 @@
|
|
|
8351
8380
|
"name": "aria-label",
|
|
8352
8381
|
"type": "string",
|
|
8353
8382
|
"required": true,
|
|
8354
|
-
"description": "Accessible name for the progressbar. Required — describe the current step context (e.g. \"Step 3 of 10\")."
|
|
8383
|
+
"description": "Accessible name for the progressbar. Required without `steps` — describe the current step context (e.g. \"Step 3 of 10\"). Not used with `steps`."
|
|
8355
8384
|
}
|
|
8356
8385
|
],
|
|
8357
8386
|
"dependencies": [
|
|
8358
8387
|
"class-variance-authority",
|
|
8388
|
+
"@phosphor-icons/react",
|
|
8359
8389
|
"@loworbitstudio/visor-core"
|
|
8360
8390
|
],
|
|
8361
8391
|
"tokens_used": [
|
|
8392
|
+
"--button-strong-fill",
|
|
8393
|
+
"--font-size-sm",
|
|
8394
|
+
"--font-size-xs",
|
|
8395
|
+
"--font-weight-bold",
|
|
8396
|
+
"--interactive-destructive-bg",
|
|
8362
8397
|
"--interactive-primary-bg",
|
|
8398
|
+
"--line-height-tight",
|
|
8363
8399
|
"--motion-duration-150",
|
|
8400
|
+
"--motion-duration-300",
|
|
8364
8401
|
"--motion-easing-default",
|
|
8402
|
+
"--motion-easing-ease-out",
|
|
8365
8403
|
"--primary",
|
|
8366
8404
|
"--radius-full",
|
|
8405
|
+
"--segmented-progress-fill-duration",
|
|
8406
|
+
"--segmented-progress-fill-stagger",
|
|
8407
|
+
"--segmented-progress-index",
|
|
8408
|
+
"--segmented-progress-md-label-font-size",
|
|
8409
|
+
"--segmented-progress-sm-label-font-size",
|
|
8367
8410
|
"--spacing-1",
|
|
8368
|
-
"--
|
|
8411
|
+
"--spacing-2",
|
|
8412
|
+
"--surface-muted",
|
|
8413
|
+
"--text-error",
|
|
8414
|
+
"--text-primary",
|
|
8415
|
+
"--text-secondary",
|
|
8416
|
+
"--text-tertiary"
|
|
8369
8417
|
],
|
|
8370
|
-
"example": "<SegmentedProgress total={10} value={2} current={2} aria-label=\"Step 2 of 10\" />\n<SegmentedProgress total={6} value={3} aria-label=\"Step 3 of 6\" size=\"md\" />\n"
|
|
8418
|
+
"example": "<SegmentedProgress total={10} value={2} current={2} aria-label=\"Step 2 of 10\" />\n<SegmentedProgress total={6} value={3} aria-label=\"Step 3 of 6\" size=\"md\" />\n<SegmentedProgress\n steps={[\n { label: \"Your Info\", state: \"done\" },\n { label: \"Bank Details\", state: \"current\" },\n { label: \"W-9\", state: \"pending\" },\n ]}\n/>\n"
|
|
8371
8419
|
},
|
|
8372
8420
|
"select": {
|
|
8373
8421
|
"category": "form",
|
|
@@ -10145,13 +10193,14 @@
|
|
|
10145
10193
|
},
|
|
10146
10194
|
"success-feedback": {
|
|
10147
10195
|
"category": "feedback",
|
|
10148
|
-
"description": "App-wide success/transition feedback pattern. Provides useSuccessToast() hook and SuccessLiveRegion a11y component built on the Toast primitive.",
|
|
10196
|
+
"description": "App-wide success/transition feedback pattern. Provides useSuccessToast() hook and SuccessLiveRegion a11y component built on the Toast primitive, and SuccessPanel, the end-of-flow screen (success seal, heading, description, check list, action).",
|
|
10149
10197
|
"when_to_use": [
|
|
10150
10198
|
"After a CRUD operation completes successfully (create, update, delete, archive)",
|
|
10151
10199
|
"When a file upload or export finishes",
|
|
10152
10200
|
"After settings are saved",
|
|
10153
10201
|
"When an invite is sent or a link is copied",
|
|
10154
|
-
"Any transient confirmation that a user action succeeded"
|
|
10202
|
+
"Any transient confirmation that a user action succeeded",
|
|
10203
|
+
"The end of a multi-step flow, where the whole screen confirms it is done (SuccessPanel)"
|
|
10155
10204
|
],
|
|
10156
10205
|
"when_not_to_use": [
|
|
10157
10206
|
"Error conditions (use inline validation or error Banner)",
|
|
@@ -10165,6 +10214,32 @@
|
|
|
10165
10214
|
"type": "string",
|
|
10166
10215
|
"required": false,
|
|
10167
10216
|
"description": "SuccessLiveRegion only — the success text to announce to screen readers. Updates trigger a re-announcement. Defaults to empty string."
|
|
10217
|
+
},
|
|
10218
|
+
{
|
|
10219
|
+
"name": "heading",
|
|
10220
|
+
"type": "string",
|
|
10221
|
+
"required": true,
|
|
10222
|
+
"description": "SuccessPanel only — the heading, announced to screen readers once on mount."
|
|
10223
|
+
},
|
|
10224
|
+
{
|
|
10225
|
+
"name": "description",
|
|
10226
|
+
"type": "ReactNode",
|
|
10227
|
+
"description": "SuccessPanel only — supporting copy under the heading, in the secondary ink."
|
|
10228
|
+
},
|
|
10229
|
+
{
|
|
10230
|
+
"name": "icon",
|
|
10231
|
+
"type": "ReactNode",
|
|
10232
|
+
"description": "SuccessPanel only — the seal's icon slot (30px). Defaults to a check-circle."
|
|
10233
|
+
},
|
|
10234
|
+
{
|
|
10235
|
+
"name": "items",
|
|
10236
|
+
"type": "{ icon?: ReactNode; content: ReactNode }[]",
|
|
10237
|
+
"description": "SuccessPanel only — an optional check list. Each row is an 18px icon (default a success check-circle) and its text; bold runs read in the primary ink."
|
|
10238
|
+
},
|
|
10239
|
+
{
|
|
10240
|
+
"name": "action",
|
|
10241
|
+
"type": "ReactNode",
|
|
10242
|
+
"description": "SuccessPanel only — the host's action, usually a Button."
|
|
10168
10243
|
}
|
|
10169
10244
|
],
|
|
10170
10245
|
"sub_components": [
|
|
@@ -10175,13 +10250,36 @@
|
|
|
10175
10250
|
{
|
|
10176
10251
|
"name": "SuccessLiveRegion",
|
|
10177
10252
|
"description": "Visually-hidden role=status aria-live=polite node for screen-reader announcements."
|
|
10253
|
+
},
|
|
10254
|
+
{
|
|
10255
|
+
"name": "SuccessPanel",
|
|
10256
|
+
"description": "The end-of-flow screen — a 56px round success seal, a heading announced once on mount through SuccessLiveRegion, a description, an optional check list and the host's action, centred. Icons are slots, each defaulting to a check-circle."
|
|
10178
10257
|
}
|
|
10179
10258
|
],
|
|
10180
10259
|
"dependencies": [
|
|
10181
|
-
"sonner"
|
|
10260
|
+
"sonner",
|
|
10261
|
+
"@phosphor-icons/react"
|
|
10182
10262
|
],
|
|
10183
|
-
"tokens_used": [
|
|
10184
|
-
|
|
10263
|
+
"tokens_used": [
|
|
10264
|
+
"--font-size-sm",
|
|
10265
|
+
"--font-size-xl",
|
|
10266
|
+
"--font-weight-bold",
|
|
10267
|
+
"--line-height-normal",
|
|
10268
|
+
"--line-height-tight",
|
|
10269
|
+
"--radius-full",
|
|
10270
|
+
"--spacing-1",
|
|
10271
|
+
"--spacing-3",
|
|
10272
|
+
"--spacing-4",
|
|
10273
|
+
"--spacing-6",
|
|
10274
|
+
"--success-panel-description-font-size",
|
|
10275
|
+
"--success-panel-heading-font-size",
|
|
10276
|
+
"--success-panel-item-font-size",
|
|
10277
|
+
"--surface-success-subtle",
|
|
10278
|
+
"--text-primary",
|
|
10279
|
+
"--text-secondary",
|
|
10280
|
+
"--text-success"
|
|
10281
|
+
],
|
|
10282
|
+
"example": "import { useSuccessToast, SuccessLiveRegion } from \"@/components/ui/success-feedback/success-feedback\"\nimport { Toaster } from \"@/components/ui/toast/toast\"\n\n{/* Mount both once in your root layout */}\n<Toaster />\n<SuccessLiveRegion message=\"\" />\n\n{/* In any component */}\nconst { showSuccess } = useSuccessToast()\nshowSuccess(\"Project saved\", { description: \"All changes have been saved.\" })\n\n{/* At the end of a flow */}\n<SuccessPanel\n heading=\"You're all set\"\n description=\"Your bookings and payments live on your dashboard.\"\n items={[{ content: <><b>Your info</b> is saved.</> }]}\n action={<Button>Go to Dashboard</Button>}\n/>\n"
|
|
10185
10283
|
},
|
|
10186
10284
|
"surface-row": {
|
|
10187
10285
|
"category": "specimen",
|
|
@@ -10674,7 +10772,7 @@
|
|
|
10674
10772
|
},
|
|
10675
10773
|
"text": {
|
|
10676
10774
|
"category": "typography",
|
|
10677
|
-
"description": "A body text component with size, weight, color, and line-height variants.",
|
|
10775
|
+
"description": "A body text component with size, weight, family (body or mono), color (including success and amber inks), and line-height variants.",
|
|
10678
10776
|
"when_to_use": [
|
|
10679
10777
|
"Body paragraphs and descriptive text",
|
|
10680
10778
|
"Captions, helper text, or secondary descriptions",
|
|
@@ -10684,7 +10782,7 @@
|
|
|
10684
10782
|
"when_not_to_use": [
|
|
10685
10783
|
"Page or section headings (use Heading)",
|
|
10686
10784
|
"Form field labels (use Label or Field)",
|
|
10687
|
-
"Code snippets
|
|
10785
|
+
"Code snippets (use CodeBlock or inline <code>); a mono figure such as a fee or a count is family=\"mono\""
|
|
10688
10786
|
],
|
|
10689
10787
|
"variants": {
|
|
10690
10788
|
"size": [
|
|
@@ -10700,11 +10798,16 @@
|
|
|
10700
10798
|
"semibold",
|
|
10701
10799
|
"bold"
|
|
10702
10800
|
],
|
|
10801
|
+
"family": [
|
|
10802
|
+
"mono"
|
|
10803
|
+
],
|
|
10703
10804
|
"color": [
|
|
10704
10805
|
"primary",
|
|
10705
10806
|
"secondary",
|
|
10706
10807
|
"tertiary",
|
|
10707
10808
|
"warning",
|
|
10809
|
+
"success",
|
|
10810
|
+
"amber",
|
|
10708
10811
|
"inherit"
|
|
10709
10812
|
],
|
|
10710
10813
|
"leading": [
|
|
@@ -10732,10 +10835,17 @@
|
|
|
10732
10835
|
"type": "'normal' | 'medium' | 'semibold' | 'bold'",
|
|
10733
10836
|
"default": "'normal'"
|
|
10734
10837
|
},
|
|
10838
|
+
{
|
|
10839
|
+
"name": "family",
|
|
10840
|
+
"type": "'body' | 'mono'",
|
|
10841
|
+
"default": "'body'",
|
|
10842
|
+
"description": "Type face. `mono` reads `--font-mono` (fallback `ui-monospace, monospace`) and composes with every size and weight."
|
|
10843
|
+
},
|
|
10735
10844
|
{
|
|
10736
10845
|
"name": "color",
|
|
10737
|
-
"type": "'primary' | 'secondary' | 'tertiary' | 'warning' | 'inherit'",
|
|
10738
|
-
"default": "'primary'"
|
|
10846
|
+
"type": "'primary' | 'secondary' | 'tertiary' | 'warning' | 'success' | 'amber' | 'inherit'",
|
|
10847
|
+
"default": "'primary'",
|
|
10848
|
+
"description": "Ink. `success` reads `--text-success`; `amber` reads `--text-amber`, falling back to `--text-warning`."
|
|
10739
10849
|
},
|
|
10740
10850
|
{
|
|
10741
10851
|
"name": "leading",
|
|
@@ -10748,6 +10858,7 @@
|
|
|
10748
10858
|
],
|
|
10749
10859
|
"tokens_used": [
|
|
10750
10860
|
"--font-body",
|
|
10861
|
+
"--font-mono",
|
|
10751
10862
|
"--font-size-base",
|
|
10752
10863
|
"--font-size-lg",
|
|
10753
10864
|
"--font-size-sm",
|
|
@@ -10762,6 +10873,7 @@
|
|
|
10762
10873
|
"--line-height-relaxed",
|
|
10763
10874
|
"--line-height-snug",
|
|
10764
10875
|
"--line-height-tight",
|
|
10876
|
+
"--text-amber",
|
|
10765
10877
|
"--text-lg-font-size",
|
|
10766
10878
|
"--text-lg-letter-spacing",
|
|
10767
10879
|
"--text-lg-text-transform",
|
|
@@ -10773,6 +10885,7 @@
|
|
|
10773
10885
|
"--text-sm-font-size",
|
|
10774
10886
|
"--text-sm-letter-spacing",
|
|
10775
10887
|
"--text-sm-text-transform",
|
|
10888
|
+
"--text-success",
|
|
10776
10889
|
"--text-tertiary",
|
|
10777
10890
|
"--text-warning",
|
|
10778
10891
|
"--text-xl-font-size",
|
|
@@ -10782,7 +10895,7 @@
|
|
|
10782
10895
|
"--text-xs-letter-spacing",
|
|
10783
10896
|
"--text-xs-text-transform"
|
|
10784
10897
|
],
|
|
10785
|
-
"example": "<Text>Default body text paragraph.</Text>\n\n<Text size=\"sm\" color=\"secondary\">\n Helper text or caption.\n</Text>\n\n<Text as=\"span\" weight=\"semibold\" size=\"lg\">\n Inline emphasized text\n</Text>\n"
|
|
10898
|
+
"example": "<Text>Default body text paragraph.</Text>\n\n<Text size=\"sm\" color=\"secondary\">\n Helper text or caption.\n</Text>\n\n<Text as=\"span\" weight=\"semibold\" size=\"lg\">\n Inline emphasized text\n</Text>\n\n<Text as=\"span\" family=\"mono\" weight=\"bold\" color=\"success\">\n $400\n</Text>\n"
|
|
10786
10899
|
},
|
|
10787
10900
|
"textarea": {
|
|
10788
10901
|
"category": "form",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loworbitstudio/visor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.0",
|
|
4
4
|
"description": "CLI for the Visor design system — add components, hooks, and utilities to your project.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@aws-sdk/client-s3": "^3.1021.0",
|
|
48
48
|
"@babel/parser": "^7.26.0",
|
|
49
|
-
"@loworbitstudio/visor-theme-engine": "^0.31.
|
|
49
|
+
"@loworbitstudio/visor-theme-engine": "^0.31.1",
|
|
50
50
|
"commander": "^13.1.0",
|
|
51
51
|
"diff": "^8.0.4",
|
|
52
52
|
"picocolors": "^1.1.1",
|