@loworbitstudio/visor 1.45.1 → 1.49.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 +25 -1
- package/dist/index.js +43 -5
- package/dist/registry.json +143 -7
- package/dist/visor-manifest.json +550 -30
- package/package.json +2 -2
package/dist/registry.json
CHANGED
|
@@ -194,12 +194,12 @@
|
|
|
194
194
|
{
|
|
195
195
|
"path": "components/ui/inline-edit/inline-edit.tsx",
|
|
196
196
|
"type": "registry:ui",
|
|
197
|
-
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { PencilSimple } from \"@phosphor-icons/react\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./inline-edit.module.css\"\n\ntype InlineEditElement = \"span\" | \"div\" | \"p\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"\n\nexport interface InlineEditProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"defaultValue\" | \"children\"> {\n /** The committed text. An empty string means \"no override\": `defaultValue` shows instead. */\n value: string\n /** Shown, muted, while `value` is empty. Committing an empty string brings it back. */\n defaultValue?: string\n
|
|
197
|
+
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { PencilSimple } from \"@phosphor-icons/react\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./inline-edit.module.css\"\n\ntype InlineEditElement = \"span\" | \"div\" | \"p\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"\n\nexport interface InlineEditProps\n extends Omit<React.HTMLAttributes<HTMLElement>, \"defaultValue\" | \"children\"> {\n /** The committed text. An empty string means \"no override\": `defaultValue` shows instead. */\n value: string\n /** Shown, muted, while `value` is empty. Committing an empty string brings it back. */\n defaultValue?: string\n /**\n * Called with the trimmed text on Enter, blur or Tab, only when it differs from `value`.\n * Return a promise to save asynchronously: the field stays open and busy until it settles.\n * If it rejects, or resolves to `{ error: string }`, the message shows under the field,\n * the typed text stays, and Enter retries.\n */\n onCommit: (value: string) => void | Promise<unknown>\n /** The field's name, e.g. \"Section title\". Names the input, and the pencil as \"Edit {label}\". */\n label: string\n /** Accessible name of the pencil. Defaults to `Edit {label}`. */\n editLabel?: string\n /** The element to render. Typography inherits from it, so a title keeps its heading's size. */\n as?: InlineEditElement\n /**\n * Draw the pencil after the text. Default `true`. With `false` the text is the\n * control: a button named \"Edit {label}, {value}\" that opens the field on click,\n * Enter or Space, and takes focus back after Enter or Escape.\n */\n pencil?: boolean\n /** Open in the editing state on mount, without moving focus. */\n defaultEditing?: boolean\n}\n\nconst InlineEdit = React.forwardRef<HTMLElement, InlineEditProps>(\n (\n {\n value,\n defaultValue = \"\",\n onCommit,\n label,\n editLabel,\n as: Comp = \"span\",\n defaultEditing = false,\n pencil = true,\n className,\n ...props\n },\n ref\n ) => {\n const [editing, setEditing] = React.useState(defaultEditing)\n const [draft, setDraft] = React.useState(defaultEditing ? value : \"\")\n const inputRef = React.useRef<HTMLInputElement>(null)\n // The one focusable trigger at rest: the pencil, or the text without it.\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n // Set once Enter or Escape has closed the editor, so the blur that follows\n // the input unmounting does not commit a second time.\n const settled = React.useRef(false)\n // Where focus goes after the next render: into the input when editing\n // starts, back to the trigger after Enter or Escape.\n const pendingFocus = React.useRef<\"input\" | \"trigger\" | null>(null)\n const [saving, setSaving] = React.useState(false)\n const [error, setError] = React.useState<string>()\n const errorId = React.useId()\n\n React.useEffect(() => {\n if (pendingFocus.current === \"input\" && inputRef.current) {\n inputRef.current.focus()\n inputRef.current.select()\n } else if (pendingFocus.current === \"trigger\") {\n triggerRef.current?.focus()\n }\n pendingFocus.current = null\n }, [editing])\n\n const start = () => {\n settled.current = false\n setError(undefined)\n pendingFocus.current = \"input\"\n setDraft(value)\n setEditing(true)\n }\n\n const finish = (commit: boolean, returnFocus: boolean) => {\n if (settled.current) return\n settled.current = true\n const next = draft.trim()\n // After a failed save, Enter retries even if the parent already took the value.\n const result = commit && (next !== value || error !== undefined) ? onCommit(next) : undefined\n if (!(result instanceof Promise)) {\n if (returnFocus) pendingFocus.current = \"trigger\"\n setError(undefined)\n setEditing(false)\n return\n }\n setSaving(true)\n setError(undefined)\n result.then(saveError, (reason) => messageOf(reason) ?? \"Could not save.\").then((message) => {\n setSaving(false)\n if (message) {\n settled.current = false\n setError(message)\n return\n }\n // Enter keeps focus in the input while saving; hand it back to the trigger.\n // A blur or Tab has already moved it on, so leave it there.\n if (document.activeElement === inputRef.current) pendingFocus.current = \"trigger\"\n setEditing(false)\n })\n }\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.nativeEvent.isComposing) return\n if (event.key === \"Enter\") {\n event.preventDefault()\n finish(true, true)\n } else if (event.key === \"Escape\") {\n event.preventDefault()\n finish(false, true)\n }\n }\n\n const isDefault = value === \"\"\n const shown = isDefault ? defaultValue : value\n\n return (\n <Comp\n ref={ref as React.Ref<never>}\n data-slot=\"inline-edit\"\n data-state={editing ? \"editing\" : \"rest\"}\n aria-busy={saving || undefined}\n className={cn(styles.root, className)}\n {...props}\n >\n {editing ? (\n <>\n {/* The field is sized by a hidden copy of the draft (CSS ::after), so\n the input is as wide as the text it replaces, not its container. */}\n <span data-slot=\"inline-edit-field\" className={styles.field} data-value={draft || defaultValue}>\n <input\n ref={inputRef}\n type=\"text\"\n // size={1} drops the input's own ~20-character width, so only the\n // hidden copy of the draft sizes the field.\n size={1}\n data-slot=\"inline-edit-input\"\n className={styles.input}\n aria-label={label}\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? errorId : undefined}\n readOnly={saving}\n value={draft}\n placeholder={defaultValue}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={onKeyDown}\n onBlur={() => finish(true, false)}\n />\n </span>\n {error && (\n // A span, not FieldError's div: the root may be a span, p or heading.\n <span id={errorId} role=\"alert\" data-slot=\"inline-edit-error\" className={styles.error}>\n {error}\n </span>\n )}\n </>\n ) : (\n <>\n {pencil ? (\n <span\n data-slot=\"inline-edit-text\"\n data-default={isDefault || undefined}\n className={cn(styles.text, isDefault && styles.textDefault)}\n onClick={start}\n >\n {shown}\n </span>\n ) : (\n <button\n ref={triggerRef}\n type=\"button\"\n data-slot=\"inline-edit-text\"\n data-default={isDefault || undefined}\n data-control=\"\"\n className={cn(styles.text, styles.textControl, isDefault && styles.textDefault)}\n aria-label={`${editLabel ?? `Edit ${label}`}, ${shown}`}\n onClick={start}\n >\n {shown}\n </button>\n )}\n {pencil && (\n <button\n ref={triggerRef}\n type=\"button\"\n data-slot=\"inline-edit-pencil\"\n className={styles.pencil}\n aria-label={editLabel ?? `Edit ${label}`}\n onClick={start}\n >\n <PencilSimple aria-hidden=\"true\" />\n </button>\n )}\n </>\n )}\n </Comp>\n )\n }\n)\nInlineEdit.displayName = \"InlineEdit\"\n\n/** The message of a save that resolved to `{ error: string }`, else undefined. */\nfunction saveError(result: unknown): string | undefined {\n if (result && typeof result === \"object\" && \"error\" in result) return messageOf(result.error)\n return undefined\n}\n\nfunction messageOf(reason: unknown): string | undefined {\n if (reason instanceof Error) return reason.message || undefined\n return typeof reason === \"string\" && reason ? reason : undefined\n}\n\nexport { InlineEdit }\n"
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
200
|
"path": "components/ui/inline-edit/inline-edit.module.css",
|
|
201
201
|
"type": "registry:ui",
|
|
202
|
-
"content": "/* InlineEdit (VI-658)\n *\n * At rest: the text, then a pencil. No edge. Editing: an input in the same\n * box, so the line box keeps its height. Typography (size, weight, colour,\n * case, tracking) is inherited from the element InlineEdit renders as.\n *\n * The pencil is the editor's mark pattern (VI-659): one size and one ink,\n * read from the same --button-icon-* tokens as an icon-only Button. Its hit\n * target is the Button's too, but drawn on ::before so it adds no height to\n * a 14px line. */\n.root {\n /* A long title wraps; it is never truncated. */\n overflow-wrap: anywhere;\n}\n\n.text {\n cursor: text;\n}\n\n/* The default shows while there is no override, muted. */\n.textDefault {\n color: var(--text-tertiary, #9ca3af);\n}\n\n/* pencil={false}: the text is the control. A native button, reset to read as\n * the text it holds: typography comes from the reset's `font: inherit` and the\n * rest is inherited from the element InlineEdit renders as. No edge at rest. */\n.textControl {\n position: relative;\n display: inline;\n /* Padding is present in every state and cancelled by an equal negative\n * margin, so nothing shifts between rest, hover and focus. It is the room\n * the focus ring clears the glyphs by, on top of --focus-ring-offset. */\n margin: calc(-1 * var(--spacing-1, 0.25rem)) calc(-1 * var(--spacing-2, 0.5rem));\n padding: var(--spacing-1, 0.25rem) var(--spacing-2, 0.5rem);\n border: 0;\n border-radius: var(--radius-sm, 0.125rem);\n background: none;\n color: inherit;\n text-align: inherit;\n letter-spacing: inherit;\n text-transform: inherit;\n overflow-wrap: inherit;\n cursor: text;\n}\n\n/* Centre the ring on the capitals (label-centering doc). The button's line\n * box is trimmed to the capital-to-baseline band, so the padded box, and the\n * ring drawn around it, is symmetric about the caps and not about the font's\n * ascent and descent. The block padding and its cancelling negative margin\n * are the room the ring clears the glyphs by; the margin box is the cap band,\n * so the line box (set by the surrounding text) does not change. Without\n * text-box (Firefox) the padding above stands and the ring centres on the line box. */\n@supports (text-box: trim-both cap alphabetic) {\n .textControl {\n text-box: trim-both cap alphabetic;\n padding-block: var(--spacing-2, 0.5rem);\n margin-block: calc(-1 * var(--spacing-2, 0.5rem));\n }\n}\n\n.textControl.textDefault {\n color: var(--text-tertiary, #9ca3af);\n}\n\n/* WCAG 2.5.8: the hit target is at least 24px tall. Drawn on ::before so it\n * adds no height to the line; it only grows when the line is shorter. */\n.textControl::before {\n content: \"\";\n position: absolute;\n inset-inline: 0;\n inset-block: min(0px, calc((100% - 1.5rem) / 2));\n}\n\n/* Hover reads as editable without an icon: an underline. Solid by default;\n * a theme that wants a dashed one sets --inline-edit-underline-style. Never dotted. */\n@media (hover: hover) {\n .textControl:hover {\n text-decoration-line: underline;\n text-decoration-style: var(--inline-edit-underline-style, solid);\n text-decoration-thickness: var(--stroke-width-thin, 1px);\n text-underline-offset: var(--spacing-1, 0.25rem);\n }\n}\n\n/* Focus shows the ring alone. The underline is the hover cue; under the ring it\n * read as a double line. */\n.textControl:focus-visible {\n outline: var(--focus-ring-width, 2px) solid var(--border-focus, #111827);\n outline-offset: var(--focus-ring-offset, 2px);\n text-decoration-line: none;\n}\n\n.pencil {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n vertical-align: middle;\n width: var(--button-icon-size, 1rem);\n height: var(--button-icon-size, 1rem);\n margin-inline-start: var(--spacing-2, 0.5rem);\n padding: 0;\n border: 0;\n border-radius: var(--radius-sm, 0.125rem);\n background: none;\n color: var(--button-icon-ghost-color, var(--text-secondary, #6b7280));\n cursor: pointer;\n transition: color var(--motion-duration-150, 150ms) var(--motion-easing-default, ease-in-out);\n}\n\n.pencil::before {\n content: \"\";\n position: absolute;\n inset: calc(-1 * var(--button-icon-pad, var(--spacing-2, 0.5rem)));\n}\n\n.pencil > svg {\n width: 100%;\n height: 100%;\n}\n\n@media (hover: hover) {\n .pencil:hover {\n color: var(--text-primary, #111827);\n }\n}\n\n.pencil:focus-visible {\n outline: var(--focus-ring-width, 2px) solid var(--border-focus, #111827);\n outline-offset: var(--focus-ring-offset, 2px);\n}\n\n/* The editing field is the rest box: a one-cell grid sized by a hidden copy\n * of the draft plus the room the pencil took, so it is as wide as the text\n * and pencil were, grows as the user types, and stops at its container. */\n.field {\n display: inline-grid;\n grid-template-columns: minmax(0, 1fr);\n vertical-align: top;\n max-width: 100%;\n}\n\n.field::after {\n content: attr(data-value);\n grid-area: 1 / 1;\n visibility: hidden;\n overflow: hidden;\n white-space: pre;\n padding-inline-end: calc(var(--spacing-2, 0.5rem) + var(--button-icon-size, 1rem));\n}\n\n/* The input sits in the text's place. Its padding is cancelled by an equal\n * negative margin, so the text does not move and the line box keeps its\n * height; the padding only gives the edge room around the glyphs. */\n.input {\n box-sizing: border-box;\n grid-area: 1 / 1;\n width: calc(100% + 2 * var(--spacing-1, 0.25rem));\n min-width: 0;\n margin: calc(-1 * var(--spacing-1, 0.25rem));\n padding: var(--spacing-1, 0.25rem);\n border: 0;\n border-radius: var(--radius-sm, 0.125rem);\n background: transparent;\n /* Size, weight and line-height come from the reset's `font: inherit`;\n case, tracking and colour are not covered there. */\n letter-spacing: inherit;\n text-transform: inherit;\n color: inherit;\n /* VI-655: the resting edge is the shared control edge, so\n --control-edge-width: 0 turns it off with every other control. */\n outline: var(--control-edge-width, 1px) var(--control-edge-style, solid) var(--control-edge-color, var(--border-default, #e5e7eb));\n outline-offset: calc(-1 * var(--control-edge-width, 1px));\n transition: outline-color var(--motion-duration-150, 150ms) var(--motion-easing-default, ease-in-out), box-shadow var(--motion-duration-150, 150ms) var(--motion-easing-default, ease-in-out);\n}\n\n.input::placeholder {\n color: var(--text-tertiary, #9ca3af);\n}\n\n/* Focus draws at --control-state-edge-width, which the edge switch does not\n touch, so it stays visible with edges off. Same ring as Input. */\n.input:focus-visible {\n outline: var(--control-state-edge-width, 1px) solid var(--border-focus, #111827);\n outline-offset: calc(-1 * var(--control-state-edge-width, 1px));\n box-shadow: 0 0 0 var(--focus-ring-width, 2px) color-mix(in srgb, var(--border-focus, #111827) 15%, transparent);\n}\n"
|
|
202
|
+
"content": "/* InlineEdit (VI-658)\n *\n * At rest: the text, then a pencil. No edge. Editing: an input in the same\n * box, so the line box keeps its height. Typography (size, weight, colour,\n * case, tracking) is inherited from the element InlineEdit renders as.\n *\n * The pencil is the editor's mark pattern (VI-659): one size and one ink,\n * read from the same --button-icon-* tokens as an icon-only Button. Its hit\n * target is the Button's too, but drawn on ::before so it adds no height to\n * a 14px line. */\n.root {\n /* A long title wraps; it is never truncated. */\n overflow-wrap: anywhere;\n}\n\n.text {\n cursor: text;\n}\n\n/* The default shows while there is no override, muted. */\n.textDefault {\n color: var(--text-tertiary, #9ca3af);\n}\n\n/* pencil={false}: the text is the control. A native button, reset to read as\n * the text it holds: typography comes from the reset's `font: inherit` and the\n * rest is inherited from the element InlineEdit renders as. No edge at rest. */\n.textControl {\n position: relative;\n display: inline;\n /* Padding is present in every state and cancelled by an equal negative\n * margin, so nothing shifts between rest, hover and focus. It is the room\n * the focus ring clears the glyphs by, on top of --focus-ring-offset. */\n margin: calc(-1 * var(--spacing-1, 0.25rem)) calc(-1 * var(--spacing-2, 0.5rem));\n padding: var(--spacing-1, 0.25rem) var(--spacing-2, 0.5rem);\n border: 0;\n border-radius: var(--radius-sm, 0.125rem);\n background: none;\n color: inherit;\n text-align: inherit;\n letter-spacing: inherit;\n text-transform: inherit;\n overflow-wrap: inherit;\n cursor: text;\n}\n\n/* Centre the ring on the capitals (label-centering doc). The button's line\n * box is trimmed to the capital-to-baseline band, so the padded box, and the\n * ring drawn around it, is symmetric about the caps and not about the font's\n * ascent and descent. The block padding and its cancelling negative margin\n * are the room the ring clears the glyphs by; the margin box is the cap band,\n * so the line box (set by the surrounding text) does not change. Without\n * text-box (Firefox) the padding above stands and the ring centres on the line box. */\n@supports (text-box: trim-both cap alphabetic) {\n .textControl {\n text-box: trim-both cap alphabetic;\n padding-block: var(--spacing-2, 0.5rem);\n margin-block: calc(-1 * var(--spacing-2, 0.5rem));\n }\n}\n\n.textControl.textDefault {\n color: var(--text-tertiary, #9ca3af);\n}\n\n/* WCAG 2.5.8: the hit target is at least 24px tall. Drawn on ::before so it\n * adds no height to the line; it only grows when the line is shorter. */\n.textControl::before {\n content: \"\";\n position: absolute;\n inset-inline: 0;\n inset-block: min(0px, calc((100% - 1.5rem) / 2));\n}\n\n/* Hover reads as editable without an icon: an underline. Solid by default;\n * a theme that wants a dashed one sets --inline-edit-underline-style. Never dotted. */\n@media (hover: hover) {\n .textControl:hover {\n text-decoration-line: underline;\n text-decoration-style: var(--inline-edit-underline-style, solid);\n text-decoration-thickness: var(--stroke-width-thin, 1px);\n text-underline-offset: var(--spacing-1, 0.25rem);\n }\n}\n\n/* Focus shows the ring alone. The underline is the hover cue; under the ring it\n * read as a double line. */\n.textControl:focus-visible {\n outline: var(--focus-ring-width, 2px) solid var(--border-focus, #111827);\n outline-offset: var(--focus-ring-offset, 2px);\n text-decoration-line: none;\n}\n\n.pencil {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n vertical-align: middle;\n width: var(--button-icon-size, 1rem);\n height: var(--button-icon-size, 1rem);\n margin-inline-start: var(--spacing-2, 0.5rem);\n padding: 0;\n border: 0;\n border-radius: var(--radius-sm, 0.125rem);\n background: none;\n color: var(--button-icon-ghost-color, var(--text-secondary, #6b7280));\n cursor: pointer;\n transition: color var(--motion-duration-150, 150ms) var(--motion-easing-default, ease-in-out);\n}\n\n.pencil::before {\n content: \"\";\n position: absolute;\n inset: calc(-1 * var(--button-icon-pad, var(--spacing-2, 0.5rem)));\n}\n\n.pencil > svg {\n width: 100%;\n height: 100%;\n}\n\n@media (hover: hover) {\n .pencil:hover {\n color: var(--text-primary, #111827);\n }\n}\n\n.pencil:focus-visible {\n outline: var(--focus-ring-width, 2px) solid var(--border-focus, #111827);\n outline-offset: var(--focus-ring-offset, 2px);\n}\n\n/* The editing field is the rest box: a one-cell grid sized by a hidden copy\n * of the draft plus the room the pencil took, so it is as wide as the text\n * and pencil were, grows as the user types, and stops at its container. */\n.field {\n display: inline-grid;\n grid-template-columns: minmax(0, 1fr);\n vertical-align: top;\n max-width: 100%;\n}\n\n.field::after {\n content: attr(data-value);\n grid-area: 1 / 1;\n visibility: hidden;\n overflow: hidden;\n white-space: pre;\n padding-inline-end: calc(var(--spacing-2, 0.5rem) + var(--button-icon-size, 1rem));\n}\n\n/* The input sits in the text's place. Its padding is cancelled by an equal\n * negative margin, so the text does not move and the line box keeps its\n * height; the padding only gives the edge room around the glyphs. */\n.input {\n box-sizing: border-box;\n grid-area: 1 / 1;\n width: calc(100% + 2 * var(--spacing-1, 0.25rem));\n min-width: 0;\n margin: calc(-1 * var(--spacing-1, 0.25rem));\n padding: var(--spacing-1, 0.25rem);\n border: 0;\n border-radius: var(--radius-sm, 0.125rem);\n background: transparent;\n /* Size, weight and line-height come from the reset's `font: inherit`;\n case, tracking and colour are not covered there. */\n letter-spacing: inherit;\n text-transform: inherit;\n color: inherit;\n /* VI-655: the resting edge is the shared control edge, so\n --control-edge-width: 0 turns it off with every other control. */\n outline: var(--control-edge-width, 1px) var(--control-edge-style, solid) var(--control-edge-color, var(--border-default, #e5e7eb));\n outline-offset: calc(-1 * var(--control-edge-width, 1px));\n transition: outline-color var(--motion-duration-150, 150ms) var(--motion-easing-default, ease-in-out), box-shadow var(--motion-duration-150, 150ms) var(--motion-easing-default, ease-in-out);\n}\n\n.input::placeholder {\n color: var(--text-tertiary, #9ca3af);\n}\n\n/* Focus draws at --control-state-edge-width, which the edge switch does not\n touch, so it stays visible with edges off. Same ring as Input. */\n.input:focus-visible {\n outline: var(--control-state-edge-width, 1px) solid var(--border-focus, #111827);\n outline-offset: calc(-1 * var(--control-state-edge-width, 1px));\n box-shadow: 0 0 0 var(--focus-ring-width, 2px) color-mix(in srgb, var(--border-focus, #111827) 15%, transparent);\n}\n\n/* Saving (VI-760): onCommit returned a promise that has not settled. The input\n * is read-only and its text drops to the secondary ink until the save lands. */\n.root[aria-busy=\"true\"] .input {\n color: var(--text-secondary, #6b7280);\n cursor: progress;\n}\n\n/* A failed save: the edge turns to the error colour, focused or not. Same\n * specificity as the focus rule above and later, so it wins over the focus\n * edge while the focus halo stays. */\n.input[aria-invalid=\"true\"] {\n outline: var(--control-state-edge-width, 1px) solid var(--control-invalid-ring-color, var(--border-error, #ef4444));\n outline-offset: calc(-1 * var(--control-state-edge-width, 1px));\n}\n\n/* The message under the field, read like FieldError: its own size and weight,\n * not the heading's it may sit in. */\n.error {\n display: block;\n margin-block-start: var(--spacing-1, 0.25rem);\n font-size: var(--font-size-sm, 0.875rem);\n font-weight: var(--font-weight-normal, 400);\n font-style: normal;\n line-height: var(--line-height-normal, 1.5);\n letter-spacing: normal;\n text-transform: none;\n color: var(--text-error, currentColor);\n}\n\n:global([data-density=\"editorial\"]) .error {\n font-size: 13px;\n}\n"
|
|
203
203
|
}
|
|
204
204
|
]
|
|
205
205
|
},
|
|
@@ -765,6 +765,64 @@
|
|
|
765
765
|
}
|
|
766
766
|
]
|
|
767
767
|
},
|
|
768
|
+
{
|
|
769
|
+
"name": "layer-chart",
|
|
770
|
+
"type": "registry:ui",
|
|
771
|
+
"description": "A zoomable icicle that opens a tree layer by layer, with one hue per top-level node, kinds (covered, not billable, unresolved, today), thin blocks folded into a +n block, an optional band, and a day span strip.",
|
|
772
|
+
"category": "data-display",
|
|
773
|
+
"dependencies": [
|
|
774
|
+
"@loworbitstudio/visor-core"
|
|
775
|
+
],
|
|
776
|
+
"registryDependencies": [
|
|
777
|
+
"utils"
|
|
778
|
+
],
|
|
779
|
+
"files": [
|
|
780
|
+
{
|
|
781
|
+
"path": "components/ui/layer-chart/layer-chart.tsx",
|
|
782
|
+
"type": "registry:ui",
|
|
783
|
+
"content": "import * as React from \"react\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./layer-chart.module.css\"\nimport {\n MORE_MIN,\n NARROW_WIDTH,\n BAND_H,\n drawSet,\n foldThin,\n geom,\n layout,\n hueVars,\n rowsFor,\n type Ctx,\n type Geom,\n type LaidNode,\n type LayerNode,\n type RowRole,\n} from \"./layer-chart-layout\"\n\nexport type { LayerHue, LayerKind, LayerNode } from \"./layer-chart-layout\"\nexport { hueVars } from \"./layer-chart-layout\"\n\nexport type LayerFocusReason = \"open\" | \"up\" | \"more\"\n\nexport interface LayerChartBand {\n /** The band's value for a node, or undefined where it is not measured. A row draws the band when any of its blocks has one. */\n value: (node: LayerNode) => number | undefined\n /** The word before the figure on wide band segments. Defaults to `\"Agent\"`. */\n label?: string\n /** Formats the band's figure. Defaults to `\"{n} h\"`. */\n format?: (value: number) => string\n /** The one-line note under the first row below the focus that has no band (\"Agent time · not measured per package yet\"). */\n note?: (layer: string) => React.ReactNode\n}\n\nexport interface LayerChartBlockInfo {\n role: RowRole\n /** The block's drawn width in px. */\n width: number\n}\n\nexport interface LayerChartCardInfo {\n /** The node's value in the current measure. */\n value: number\n /** Its share of its parent, 0 to 100, when it has a parent. */\n share?: number\n /** The nodes a \"+n\" block stands for. */\n more?: LayerNode[]\n}\n\nexport interface LayerChartProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"onChange\"> {\n /** The tree. Its root is the top row. */\n data: LayerNode\n /** Reads a node's value in the current measure. Undefined on a parent sums its children; zero leaves the chart. Defaults to `node.value`. */\n measure?: (node: LayerNode) => number | undefined\n /** The open block (controlled). */\n focusId?: string\n /** The block open at first (uncontrolled). Defaults to the root. */\n defaultFocusId?: string\n /** Called when a block opens: a click, `Enter`, `Esc` (up a layer) or a \"+n\" block (opens its parent). */\n onFocusChange?: (id: string, node: LayerNode, reason: LayerFocusReason) => void\n /** Formats a value. `short` is the number alone, for thin blocks. Defaults to the number, two decimals at most. */\n format?: (value: number, info: { node: LayerNode; short: boolean }) => string\n /** Content drawn at the foot of a wide block one or two layers down (an estimate meter in a package block). */\n renderBlock?: (node: LayerNode, info: LayerChartBlockInfo) => React.ReactNode\n /** The hover card's content. Defaults to the name, the layer, the value and the share of the parent. */\n renderCard?: (node: LayerNode, info: LayerChartCardInfo) => React.ReactNode\n /** An optional paler band under the rows where it is measured (agent time). */\n band?: LayerChartBand\n}\n\nconst defaultMeasure = (n: LayerNode) => n.value\nconst defaultFormat = (v: number) => String(+v.toFixed(2))\nconst defaultBandFormat = (v: number) => `${+v.toFixed(2)} h`\n\nconst share = (n: LaidNode) =>\n n.parent && n.parent.value ? Math.round((n.value / n.parent.value) * 100) : undefined\n\ninterface Drawn {\n n: LaidNode\n g: Geom\n ghost: boolean\n}\n\nconst LayerChart = React.forwardRef<HTMLDivElement, LayerChartProps>(\n (\n {\n className,\n data,\n measure = defaultMeasure,\n focusId,\n defaultFocusId,\n onFocusChange,\n format = defaultFormat,\n renderBlock,\n renderCard,\n band,\n \"aria-label\": ariaLabel = \"Layers\",\n ...props\n },\n ref\n ) => {\n const [innerFocus, setInnerFocus] = React.useState(defaultFocusId ?? data.id)\n const canvasRef = React.useRef<HTMLDivElement>(null)\n const iceRef = React.useRef<HTMLDivElement>(null)\n const [W, setW] = React.useState(0)\n const [card, setCard] = React.useState<{ id: string; left: number; top: number } | null>(null)\n const [, tick] = React.useReducer((x: number) => x + 1, 0)\n\n React.useLayoutEffect(() => {\n const el = canvasRef.current\n if (!el) return\n setW(el.clientWidth)\n if (typeof ResizeObserver === \"undefined\") return\n const ro = new ResizeObserver(() => setW(el.clientWidth))\n ro.observe(el)\n return () => ro.disconnect()\n }, [])\n\n const { root, byId } = React.useMemo(() => layout(data, measure), [data, measure])\n const F = byId.get(focusId ?? innerFocus) ?? root\n const narrow = W > 0 && W < NARROW_WIDTH\n const bandRow = band ? (nodes: LaidNode[]) => nodes.some((n) => band.value(n.node) != null) : undefined\n const { rows, height } = rowsFor(F, narrow, bandRow, !!band?.note)\n const ctx: Ctx = { F, rows, W }\n const { more, folded } = foldThin(F, ctx)\n const fmt = (n: LaidNode, short = false) => format(n.value, { node: n.node, short })\n\n // Animation memory: where every block was last drawn, and the blocks leaving.\n const last = React.useRef<{ ctx: Ctx; xs: Map<string, [number, number]>; geoms: Map<string, Geom>; nodes: Map<string, LaidNode> } | null>(null)\n const leaving = React.useRef(new Map<string, number>())\n const els = React.useRef(new Map<string, HTMLElement>())\n const pendingFocus = React.useRef<string | null>(null)\n // Blocks keep the DOM order they were created in: moving a node would cut its transition short.\n const order = React.useRef(new Map<string, number>())\n\n const drawn: Drawn[] = []\n const ids = new Set<string>()\n if (W > 0) {\n for (const n of [...drawSet(F).filter((n) => !folded.has(n.id)), ...more]) {\n const g = geom(n.x0, n.x1, n.depth, ctx)\n if (!g) continue\n // The fold stays a 24px target.\n if (n.more && g.w < MORE_MIN) {\n g.l -= MORE_MIN - g.w\n g.w = MORE_MIN\n }\n ids.add(n.id)\n drawn.push({ n, g, ghost: false })\n }\n // Blocks that left the draw set slide to where they would sit now, fade, then go.\n const now = Date.now()\n for (const [id, n] of last.current?.nodes ?? []) {\n if (ids.has(id)) continue\n const until = leaving.current.get(id)\n if (until != null && until < now) continue\n const cur = byId.get(id) ?? n\n const g = geom(cur.x0, cur.x1, cur.depth, ctx) ?? last.current!.geoms.get(id)\n if (g) drawn.push({ n: cur, g, ghost: true })\n }\n for (const d of drawn) if (!order.current.has(d.n.id)) order.current.set(d.n.id, order.current.size)\n drawn.sort((x, y) => order.current.get(x.n.id)! - order.current.get(y.n.id)!)\n }\n\n React.useLayoutEffect(() => {\n const prev = last.current\n const rootEl = iceRef.current\n const instant = !prev || prev.ctx.W !== W\n const now = Date.now()\n for (const d of drawn) {\n if (d.ghost) {\n if (!leaving.current.has(d.n.id)) leaving.current.set(d.n.id, now + 520)\n continue\n }\n leaving.current.delete(d.n.id)\n const el = els.current.get(d.n.id)\n if (!el || instant || prev.nodes.has(d.n.id)) continue\n // A block that is new to the view grows out of where it was in the last view.\n const px = prev.xs.get(d.n.id)\n const pg = px ? geom(px[0], px[1], d.n.depth, prev.ctx) : null\n const final = el.style.cssText\n el.style.transition = \"none\"\n if (pg) Object.assign(el.style, { left: `${pg.l}px`, top: `${pg.t}px`, width: `${pg.w}px`, height: `${pg.h}px` })\n else el.style.opacity = \"0\"\n void el.offsetWidth\n el.style.cssText = final\n }\n if (instant && rootEl) {\n rootEl.setAttribute(\"data-instant\", \"\")\n void rootEl.offsetWidth\n rootEl.removeAttribute(\"data-instant\")\n }\n const xs = new Map<string, [number, number]>()\n byId.forEach((n) => xs.set(n.id, [n.x0, n.x1]))\n more.forEach((n) => xs.set(n.id, [n.x0, n.x1]))\n last.current = {\n ctx,\n xs,\n geoms: new Map(drawn.map((d) => [d.n.id, d.g])),\n nodes: new Map(drawn.map((d) => [d.n.id, d.n])),\n }\n if (pendingFocus.current) {\n els.current.get(pendingFocus.current)?.focus({ preventScroll: true })\n pendingFocus.current = null\n }\n if (drawn.some((d) => d.ghost)) {\n const t = setTimeout(tick, 540)\n return () => clearTimeout(t)\n }\n })\n\n const go = (n: LaidNode, reason: LayerFocusReason) => {\n if (focusId === undefined) setInnerFocus(n.id)\n setCard(null)\n pendingFocus.current = n.id\n onFocusChange?.(n.id, n.node, reason)\n }\n\n const click = (n: LaidNode) => {\n if (n.more && n.parent) return go(n.parent, \"more\")\n if (n.id === F.id && n.parent) return go(n.parent, \"up\")\n if (n.id !== F.id) go(n, \"open\")\n }\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === \"Escape\" && F.parent) {\n e.preventDefault()\n go(F.parent, \"up\")\n } else if (e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") {\n const list = drawn\n .filter((d) => !d.ghost && d.g.row.role === \"kids\" && d.g.w > 0.5)\n .sort((a, b) => a.g.l - b.g.l)\n .map((d) => els.current.get(d.n.id))\n .filter((el): el is HTMLElement => !!el)\n if (!list.length) return\n const i = list.indexOf(document.activeElement as HTMLElement)\n const next = i < 0 ? 0 : Math.max(0, Math.min(list.length - 1, i + (e.key === \"ArrowRight\" ? 1 : -1)))\n list[next].focus({ preventScroll: true })\n e.preventDefault()\n }\n props.onKeyDown?.(e)\n }\n\n const hover = (n: LaidNode, el: HTMLElement, clientX: number) => {\n if (narrow || card?.id === n.id) return\n const c = canvasRef.current?.getBoundingClientRect()\n if (!c) return\n const r = el.getBoundingClientRect()\n const left = Math.max(0, Math.min(clientX - c.left + 12, c.width - 300))\n setCard({ id: n.id, left, top: r.top - c.top + Math.min(r.height, 60) })\n }\n\n const label = (n: LaidNode, role: RowRole, w: number): React.ReactNode => {\n if (n.more) return w >= 22 ? <span className={styles.value}>+{n.more.length}</span> : null\n const name = n.node.ref ? `${n.node.ref} ${n.node.name}` : n.node.name\n const v = fmt(n)\n if (role === \"anc\" || role === \"focus\") {\n if (w > 150)\n return (\n <>\n <span className={styles.name}>\n {name}\n {role === \"focus\" && !n.parent && n.node.sub != null && <span className={styles.sub}> · {n.node.sub}</span>}\n </span>\n <span className={styles.value}>{v}</span>\n </>\n )\n return w > 64 ? <span className={styles.value}>{v}</span> : null\n }\n if (role === \"kids\") {\n if (w < 40) return null\n if (w < 64) return <span className={styles.text}><span className={styles.value}>{fmt(n, true)}</span></span>\n if (w < 104)\n return (\n <span className={styles.text}>\n <span className={styles.name}>{name}</span>\n <span className={styles.value}>{v}</span>\n </span>\n )\n const pct = share(n) ?? 100\n const slot = w > 120 ? renderBlock?.(n.node, { role, width: w }) : null\n return (\n <>\n <span className={styles.text}>\n <span className={styles.name}>{name}</span>\n <span className={styles.big}>\n {v}\n {w > 150 && pct < 100 && <small className={styles.pct}>{pct}%</small>}\n </span>\n {n.node.sub != null && <span className={styles.sub}>{n.node.sub}</span>}\n </span>\n {slot != null && <span className={styles.slot}>{slot}</span>}\n </>\n )\n }\n if (role === \"gkids\") {\n if (w < 40) return null\n if (w < 112) return <span className={styles.text}><span className={styles.value}>{fmt(n, true)}</span></span>\n const slot = !narrow && w > 120 ? renderBlock?.(n.node, { role, width: w }) : null\n return (\n <>\n <span className={styles.text}>\n <span className={styles.name}>{name}</span>\n <span className={styles.value}>{v}</span>\n {!narrow && w >= 170 && n.node.sub != null && <span className={styles.sub}>{n.node.sub}</span>}\n </span>\n {slot != null && <span className={styles.slot}>{slot}</span>}\n </>\n )\n }\n return w > 130 ? <span className={styles.text}><span className={styles.name}>{name}</span></span> : null\n }\n\n const cardNode = card ? (drawn.find((d) => d.n.id === card.id && !d.ghost)?.n ?? null) : null\n const bandNodes =\n band && W > 0\n ? drawn.filter((d) => !d.ghost && d.g.row.band && d.g.w >= 1 && band.value(d.n.node) != null)\n : []\n const noteRow = band?.note ? rows.find((r) => r.note) : undefined\n\n return (\n <div\n ref={ref}\n data-slot=\"layer-chart\"\n data-narrow={narrow ? \"\" : undefined}\n className={cn(styles.root, className)}\n {...props}\n onKeyDown={onKeyDown}\n >\n <div data-slot=\"layer-chart-gutter\" className={styles.gutter} aria-hidden=\"true\" style={{ height }}>\n {rows.map((r) => (\n <span key={r.d} className={styles.gutterLabel} style={{ top: r.y, height: r.h }}>\n {r.label}\n </span>\n ))}\n </div>\n <div ref={canvasRef} className={styles.canvas} onPointerLeave={() => setCard(null)}>\n <div\n ref={iceRef}\n role=\"group\"\n aria-label={ariaLabel}\n data-slot=\"layer-chart-rows\"\n className={styles.ice}\n style={{ height }}\n >\n {drawn.map(({ n, g, ghost }) => {\n const visible = !ghost && g.w > 0.5 && g.l < W && g.l + g.w > 0\n return (\n <button\n key={n.id}\n ref={(el) => {\n if (el) els.current.set(n.id, el)\n else els.current.delete(n.id)\n }}\n type=\"button\"\n data-slot=\"layer-chart-block\"\n data-id={n.id}\n data-role={g.row.role}\n data-kind={n.kind}\n data-tone={Math.min(Math.max(0, n.depth - 1), 4)}\n data-hue={n.hue === \"tide\" ? \"tide\" : undefined}\n data-root={n.parent ? undefined : \"\"}\n data-today={n.node.today ? \"\" : undefined}\n data-more={n.more ? \"\" : undefined}\n data-ghost={ghost ? \"\" : undefined}\n className={styles.block}\n tabIndex={visible ? 0 : -1}\n aria-hidden={visible ? undefined : true}\n aria-current={n.id === F.id ? \"true\" : undefined}\n aria-label={`${n.node.ref ? `${n.node.ref} ` : \"\"}${n.node.name}, ${fmt(n)}`}\n style={{\n ...hueVars(n.hue),\n left: g.l,\n top: g.t,\n width: g.w,\n height: g.h,\n opacity: ghost || g.w <= 0.5 ? 0 : 1,\n }}\n onClick={() => click(n)}\n onPointerMove={(e) => hover(n, e.currentTarget, e.clientX)}\n >\n {!ghost && label(n, g.row.role, g.w)}\n </button>\n )\n })}\n {bandNodes.map(({ n, g }) => {\n const v = band!.value(n.node)!\n const f = (band!.format ?? defaultBandFormat)(v)\n return (\n <div\n key={`band:${n.id}`}\n data-slot=\"layer-chart-band\"\n data-hue={n.hue === \"tide\" ? \"tide\" : undefined}\n className={styles.band}\n style={{ ...hueVars(n.hue), left: g.l, top: g.t + g.h + 3, width: g.w, height: BAND_H }}\n >\n {g.w > 96 ? `${band!.label ?? \"Agent\"} ${f}` : g.w > 40 ? f : \"\"}\n </div>\n )\n })}\n {noteRow && (\n <div data-slot=\"layer-chart-note\" className={styles.note} style={{ top: noteRow.noteY }}>\n {band!.note!(noteRow.label)}\n </div>\n )}\n </div>\n {cardNode && card && (\n <div data-slot=\"layer-chart-card\" className={styles.card} style={{ left: card.left, top: card.top }} aria-hidden=\"true\">\n {renderCard\n ? renderCard(cardNode.node, { value: cardNode.value, share: share(cardNode), more: cardNode.more?.map((m) => m.node) })\n : defaultCard(cardNode, fmt(cardNode))}\n </div>\n )}\n </div>\n </div>\n )\n }\n)\nLayerChart.displayName = \"LayerChart\"\n\nfunction defaultCard(n: LaidNode, value: string): React.ReactNode {\n const p = n.parent\n const pct = share(n)\n if (n.more)\n return (\n <>\n <p className={styles.cardTitle}>{n.more.length} more</p>\n <p className={styles.cardSub}>{value} together. Open {p?.node.name} to see each one.</p>\n </>\n )\n return (\n <>\n <p className={styles.cardTitle}>{n.node.ref ? `${n.node.ref} ${n.node.name}` : n.node.name}</p>\n <p className={styles.cardSub}>\n {n.node.layer}\n {p && p.parent ? ` · ${p.node.ref ?? p.node.name}` : \"\"}\n </p>\n <dl className={styles.cardList}>\n <dt>Value</dt>\n <dd>{value}</dd>\n {p && pct != null && (\n <>\n <dt>Share of {p.node.ref ?? p.node.name}</dt>\n <dd>{pct}%</dd>\n </>\n )}\n </dl>\n </>\n )\n}\n\nexport { LayerChart }\nexport { SpanStrip } from \"./span-strip\"\nexport type { SpanStripProps, Span, SpanKind, SpanLane } from \"./span-strip\"\n"
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"path": "components/ui/layer-chart/layer-chart-layout.ts",
|
|
787
|
+
"type": "registry:ui",
|
|
788
|
+
"content": "/*\n * The layer chart's geometry, kept apart from React so it can be tested alone.\n * Ported from the LO-343 Layers frames: partition, rowsFor, geom, foldThin.\n */\n\nimport type { CSSProperties, ReactNode } from \"react\"\n\nexport type LayerKind = \"solid\" | \"covered\" | \"not-billable\" | \"unresolved\"\nexport type LayerHue = number | \"tide\"\nexport type RowRole = \"anc\" | \"focus\" | \"kids\" | \"gkids\" | \"ggkids\"\n\nexport interface LayerNode {\n /** Unique across the whole tree. */\n id: string\n name: string\n /** A short reference drawn before the name (\"LYD-140\"). */\n ref?: string\n /** The layer this node belongs to (\"Clients\", \"Packages\"). Names its row in the gutter. */\n layer?: string\n /** The default measure. Leave it off a parent and the parent sums its children. */\n value?: number\n /** A Paper project-hue angle, or \"tide\" for the studio's own investment. Children inherit it. */\n hue?: LayerHue\n /** How the block is filled. Children inherit it. */\n kind?: LayerKind\n /** Today's block: drawn paler (it counts once the day is over). */\n today?: boolean\n /** The sub line under the big number. */\n sub?: ReactNode\n children?: LayerNode[]\n}\n\nexport interface LaidNode {\n node: LayerNode\n id: string\n depth: number\n value: number\n hue?: LayerHue\n kind: LayerKind\n parent?: LaidNode\n children: LaidNode[]\n /** Position across the whole tree, 0 to 1. */\n x0: number\n x1: number\n /** Set on the \"+n\" block that stands in for folded children. */\n more?: LaidNode[]\n}\n\nexport interface Row {\n d: number\n role: RowRole\n y: number\n h: number\n label: string\n band: boolean\n note: boolean\n noteY: number\n}\n\nexport interface Geom {\n l: number\n w: number\n t: number\n h: number\n row: Row\n}\n\n/** Row heights from the frames, after the operator's first review (layers.md, \"Layout\"). */\nexport const ROW_HEIGHTS = {\n desk: { anc: 34, focus: 64, kids: 198, gkids: 96, ggkids: 40 },\n narrow: { anc: 28, focus: 40, kids: 108, gkids: 52, ggkids: 22 },\n} as const\n\n/** Under this canvas width the chart uses its narrow heights and drops the sub lines and slots one layer down. */\nexport const NARROW_WIDTH = 560\n/** Ground between blocks in a row, and between rows. */\nexport const GAP_X = 3\nexport const GAP_Y = 4\n/** Children thinner than this fold into one \"+n\" block. */\nexport const FOLD_UNDER = 6\n/** The \"+n\" block stays at least this wide. */\nexport const MORE_MIN = 24\nexport const BAND_H = 18\nconst BAND_ROW = 22\nconst NOTE_ROW = 26\n\n/** Lays the tree out across 0..1, each node's span shared by its children in proportion to the measure. */\nexport function layout(\n root: LayerNode,\n measure: (node: LayerNode) => number | undefined\n): { root: LaidNode; byId: Map<string, LaidNode> } {\n const byId = new Map<string, LaidNode>()\n const build = (node: LayerNode, parent: LaidNode | undefined, depth: number): LaidNode => {\n const n: LaidNode = {\n node,\n id: node.id,\n depth,\n value: 0,\n hue: node.hue ?? parent?.hue,\n kind: node.kind ?? parent?.kind ?? \"solid\",\n parent,\n children: [],\n x0: 0,\n x1: 0,\n }\n byId.set(n.id, n)\n n.children = (node.children ?? []).map((c) => build(c, n, depth + 1))\n const own = measure(node)\n n.value = Math.max(0, own ?? n.children.reduce((a, c) => a + c.value, 0))\n return n\n }\n const r = build(root, undefined, 0)\n const partition = (n: LaidNode, x0: number, x1: number) => {\n n.x0 = x0\n n.x1 = x1\n const tot = n.children.reduce((a, c) => a + c.value, 0)\n let x = x0\n for (const c of n.children) {\n const w = tot ? ((x1 - x0) * c.value) / tot : 0\n partition(c, x, x + w)\n x += w\n }\n }\n partition(r, 0, 1)\n return { root: r, byId }\n}\n\nexport const pathOf = (n: LaidNode): LaidNode[] => {\n const out: LaidNode[] = []\n for (let p: LaidNode | undefined = n; p; p = p.parent) out.unshift(p)\n return out\n}\n\nconst maxDepth = (n: LaidNode): number =>\n n.children.length ? 1 + Math.max(...n.children.map(maxDepth)) : 0\n\nexport function atDepth(F: LaidNode, d: number): LaidNode[] {\n const out: LaidNode[] = []\n const walk = (n: LaidNode) => {\n if (n.depth === d) out.push(n)\n else n.children.forEach(walk)\n }\n walk(F)\n return out\n}\n\n/** The layer most of a row's (non-empty) blocks belong to. */\nfunction majority(nodes: LaidNode[]): string {\n const c = new Map<string, number>()\n for (const n of nodes) if (n.value > 0 && n.node.layer) c.set(n.node.layer, (c.get(n.node.layer) ?? 0) + 1)\n return [...c.entries()].sort((a, b) => b[1] - a[1])[0]?.[0] ?? \"\"\n}\n\n/**\n * The rows for a focus: its ancestors as compressed path rows, the focus row,\n * then up to three layers below it. `hasBand(nodes)` says whether a row carries\n * the optional band; the first row below the focus without one carries the note.\n */\nexport function rowsFor(\n F: LaidNode,\n narrow: boolean,\n band?: (nodes: LaidNode[]) => boolean,\n note = false\n): { rows: Row[]; height: number } {\n const H = narrow ? ROW_HEIGHTS.narrow : ROW_HEIGHTS.desk\n const path = pathOf(F)\n const last = F.depth + Math.min(3, maxDepth(F))\n const rows: Row[] = []\n let y = 0\n let noted = false\n for (let d = 0; d <= last; d++) {\n const role: RowRole =\n d < F.depth ? \"anc\" : d === F.depth ? \"focus\" : ([\"kids\", \"gkids\", \"ggkids\"] as const)[d - F.depth - 1]\n const nodes = d <= F.depth ? [path[d]] : atDepth(F, d)\n const label = d <= F.depth ? (path[d].node.layer ?? \"\") : majority(nodes)\n const row: Row = { d, role, y, h: H[role], label, band: false, note: false, noteY: 0 }\n y += row.h + GAP_Y\n if (band?.(nodes)) {\n row.band = true\n y += BAND_ROW\n } else if (band && note && !noted && role !== \"anc\" && role !== \"focus\") {\n row.note = true\n noted = true\n row.noteY = y\n y += NOTE_ROW\n }\n rows.push(row)\n }\n return { rows, height: Math.max(0, y - GAP_Y) }\n}\n\nexport interface Ctx {\n F: { x0: number; x1: number; depth: number }\n rows: Row[]\n W: number\n}\n\n/** A block's box: its span scaled so the focus fills the width. Ancestor rows clamp so their names stay in view. */\nexport function geom(x0: number, x1: number, depth: number, ctx: Ctx): Geom | null {\n const row = ctx.rows[depth]\n if (!row) return null\n const s = ctx.W / (ctx.F.x1 - ctx.F.x0 || 1)\n let a = (x0 - ctx.F.x0) * s\n let b = (x1 - ctx.F.x0) * s\n if (depth < ctx.F.depth) {\n a = Math.max(0, Math.min(ctx.W, a))\n b = Math.max(0, Math.min(ctx.W, b))\n }\n return { l: a + GAP_X / 2, w: Math.max(0, b - a - GAP_X), t: row.y, h: row.h, row }\n}\n\n/** Very thin children fold into one \"+n\" block at the end of their parent, so every block stays clickable. */\nexport function foldThin(F: LaidNode, ctx: Ctx): { more: LaidNode[]; folded: Set<string> } {\n const more: LaidNode[] = []\n const folded = new Set<string>()\n const s = ctx.W / (F.x1 - F.x0 || 1)\n for (const r of ctx.rows) {\n if (r.role !== \"kids\" && r.role !== \"gkids\") continue\n for (const p of atDepth(F, r.d - 1)) {\n const thin = p.children.filter((k) => k.value > 0 && (k.x1 - k.x0) * s < FOLD_UNDER)\n if (thin.length < 2) continue\n thin.forEach((k) => folded.add(k.id))\n more.push({\n node: { id: `${p.id}~more`, name: `${thin.length} more`, layer: thin[0].node.layer },\n id: `${p.id}~more`,\n depth: r.d,\n value: thin.reduce((a, k) => a + k.value, 0),\n hue: p.hue,\n kind: p.kind,\n parent: p,\n children: [],\n x0: Math.min(...thin.map((k) => k.x0)),\n x1: Math.max(...thin.map((k) => k.x1)),\n more: thin,\n })\n }\n }\n return { more, folded }\n}\n\n/** What to draw for a focus: the path, its siblings (they slide away), and the focus's subtree three layers down. */\nexport function drawSet(F: LaidNode): LaidNode[] {\n const set = new Set<LaidNode>()\n for (let p: LaidNode | undefined = F; p; p = p.parent) {\n set.add(p)\n p.parent?.children.forEach((s) => set.add(s))\n }\n const walk = (n: LaidNode) => {\n if (n.depth > F.depth + 3) return\n set.add(n)\n n.children.forEach(walk)\n }\n walk(F)\n return [...set]\n}\n\n/** The hue's four colours, as variables the block's CSS reads. */\nexport function hueVars(hue: LayerHue | undefined): CSSProperties | undefined {\n // \"tide\" is mapped in CSS from the theme's --layer-chart-investment-* tokens (data-hue).\n if (hue == null || hue === \"tide\") return undefined\n const v = (part: string) => `var(--paper-hue-${hue}-${part})`\n return {\n \"--layer-hue-fill\": v(\"fill\"),\n \"--layer-hue-fill-strong\": v(\"fill-strong\"),\n \"--layer-hue-ink\": v(\"ink\"),\n \"--layer-hue-solid\": v(\"solid\"),\n } as CSSProperties\n}\n"
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
"path": "components/ui/layer-chart/span-strip.tsx",
|
|
792
|
+
"type": "registry:ui",
|
|
793
|
+
"content": "import * as React from \"react\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./layer-chart.module.css\"\nimport { hueVars, type LayerHue } from \"./layer-chart-layout\"\n\nexport type SpanKind = \"attended\" | \"call\" | \"agent\"\n\nexport interface Span {\n kind: SpanKind\n /** Minutes after midnight. */\n start: number\n /** Minutes after midnight. */\n end: number\n}\n\nexport interface SpanLane {\n label: string\n kinds: SpanKind[]\n}\n\nexport interface SpanStripProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The day's spans, in minutes after midnight. Each is cut into cells of `cell` minutes. */\n spans: Span[]\n /** One lane per row. Defaults to \"You\" (attended and calls) and, when there are agent spans, \"Agent\". */\n lanes?: SpanLane[]\n /** The project's hue: a Paper project-hue angle, or \"tide\". */\n hue?: LayerHue\n /** Minutes per cell. Defaults to 5. */\n cell?: number\n /** Minutes between axis labels. Defaults to 120. */\n tickEvery?: number\n /** The legend's word for each kind. */\n kindLabels?: Partial<Record<SpanKind, string>>\n /** Formats a total in hours for the legend and the lanes' names. Defaults to `\"{n} h\"`. */\n formatHours?: (hours: number) => string\n}\n\nconst KIND_LABEL: Record<SpanKind, string> = { attended: \"Attended\", call: \"Call\", agent: \"Agent\" }\nconst fmtHours = (h: number) => `${+h.toFixed(2)} h`\nconst clock = (m: number) => `${Math.floor(m / 60) % 12 || 12}${m / 60 < 12 || m / 60 >= 24 ? \"am\" : \"pm\"}`\n\nconst SpanStrip = React.forwardRef<HTMLDivElement, SpanStripProps>(\n (\n { className, style, spans, lanes, hue, cell = 5, tickEvery = 120, kindLabels, formatHours = fmtHours, ...props },\n ref\n ) => {\n const names = { ...KIND_LABEL, ...kindLabels }\n const lanesUsed =\n lanes ??\n [\n { label: \"You\", kinds: [\"attended\", \"call\"] as SpanKind[] },\n ...(spans.some((s) => s.kind === \"agent\") ? [{ label: \"Agent\", kinds: [\"agent\"] as SpanKind[] }] : []),\n ]\n // The axis runs at least 8am to 7pm, widened to whole hours around the spans.\n const a = Math.min(8 * 60, Math.floor(Math.min(...spans.map((s) => s.start), Infinity) / 60) * 60)\n const b = Math.max(19 * 60, Math.ceil(Math.max(...spans.map((s) => s.end), -Infinity) / 60) * 60)\n const pc = (m: number) => ((m - a) / (b - a)) * 100\n const total = (k: SpanKind) => spans.filter((s) => s.kind === k).reduce((t, s) => t + s.end - s.start, 0) / 60\n const kinds = ([\"attended\", \"call\", \"agent\"] as SpanKind[]).filter((k) => spans.some((s) => s.kind === k))\n const ticks: number[] = []\n for (let m = a; m <= b; m += tickEvery) ticks.push(m)\n\n return (\n <div\n ref={ref}\n data-slot=\"span-strip\"\n data-hue={hue === \"tide\" ? \"tide\" : undefined}\n className={cn(styles.strip, className)}\n style={{ ...hueVars(hue), ...style }}\n {...props}\n >\n <div className={styles.lanes}>\n {lanesUsed.map((lane) => {\n const own = spans.filter((s) => lane.kinds.includes(s.kind))\n const name = `${lane.label}: ${lane.kinds.filter((k) => own.some((s) => s.kind === k)).map((k) => `${names[k].toLowerCase()} ${formatHours(total(k))}`).join(\", \") || \"nothing\"}`\n return (\n <React.Fragment key={lane.label}>\n <span className={styles.laneLabel} aria-hidden=\"true\">{lane.label}</span>\n <div\n role=\"img\"\n aria-label={name}\n data-slot=\"span-strip-lane\"\n data-thin={lane.kinds.every((k) => k === \"agent\") ? \"\" : undefined}\n className={styles.lane}\n >\n {own.flatMap((s) => {\n const out: React.ReactNode[] = []\n for (let m = s.start; m < s.end; m += cell)\n out.push(\n <i\n key={`${s.kind}${m}`}\n data-kind={s.kind}\n className={styles.cell}\n style={{ left: `calc(${pc(m)}% + 0.5px)`, width: `calc(${(Math.min(cell, s.end - m) / (b - a)) * 100}% - 1px)` }}\n />\n )\n return out\n })}\n </div>\n </React.Fragment>\n )\n })}\n <span />\n <div className={styles.axis} aria-hidden=\"true\">\n {ticks.map((m) => (\n <span key={m} style={{ left: `${pc(m)}%` }}>{clock(m)}</span>\n ))}\n </div>\n </div>\n <div className={styles.legend} data-slot=\"span-strip-legend\">\n {kinds.map((k) => (\n <span key={k}>\n <i data-kind={k} className={styles.swatch} />\n {names[k]} {formatHours(total(k))}\n </span>\n ))}\n </div>\n </div>\n )\n }\n)\nSpanStrip.displayName = \"SpanStrip\"\n\nexport { SpanStrip }\n"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
"path": "components/ui/layer-chart/layer-chart.module.css",
|
|
797
|
+
"type": "registry:ui",
|
|
798
|
+
"content": "/*\n * LayerChart: a zoomable icicle. Rows are layers; a block opens to full width\n * and its children open below it. Ported from the LO-343 Layers frames.\n * Blocks are separated by ground, never lines. One hue per top-level node\n * (Paper's --paper-hue-<angle>-*), lighter by depth; coral only for unresolved.\n * Pixel sizes, radii and type sizes below are the frames' own (intentional).\n */\n.root {\n --_ground: var(--layer-chart-ground, var(--surface-page, #ffffff));\n --_dur: var(--layer-chart-duration, 480ms);\n --_ease: var(--layer-chart-easing, cubic-bezier(0.2, 0.8, 0.2, 1));\n --_segment: color-mix(in srgb, var(--text-primary, #111827) 7%, transparent);\n container-type: inline-size;\n display: flex;\n gap: calc(var(--spacing-1, 0.25rem) * 2.5);\n position: relative;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .root {\n --_dur: 0ms;\n }\n}\n\n/* The gutter names each row's layer. It goes under 40rem. */\n.gutter {\n position: relative;\n flex: 0 0 108px;\n}\n\n.gutterLabel {\n position: absolute;\n left: 0;\n right: 0;\n display: flex;\n align-items: center;\n font-size: 12px;\n line-height: 16px;\n font-weight: var(--font-weight-bold, 700);\n letter-spacing: var(--paper-track-label, 0.08em);\n text-transform: uppercase;\n color: var(--text-secondary, #4b5563);\n transition: top var(--_dur) var(--_ease), height var(--_dur) var(--_ease);\n}\n\n@container (max-width: 40rem) {\n .gutter {\n display: none;\n }\n}\n\n.canvas {\n position: relative;\n flex: 1 1 0;\n min-width: 0;\n}\n\n.ice {\n position: relative;\n overflow: hidden;\n transition: height var(--_dur) var(--_ease);\n}\n\n.ice[data-instant] *,\n.ice[data-instant] {\n transition: none !important;\n}\n\n/* ---------- blocks ---------- */\n/* The studio's own investment hue (hue=\"tide\") comes from the theme; Paper binds Tide. */\n.block[data-hue=\"tide\"],\n.band[data-hue=\"tide\"],\n.strip[data-hue=\"tide\"] {\n --layer-hue-fill: var(--layer-chart-investment-fill, var(--surface-muted, #f3f4f6));\n --layer-hue-fill-strong: var(--layer-chart-investment-fill-strong, var(--surface-interactive-active, #e5e7eb));\n --layer-hue-ink: var(--layer-chart-investment-ink, var(--text-primary, #111827));\n --layer-hue-solid: var(--layer-chart-investment-solid, var(--text-secondary, #4b5563));\n}\n\n.block {\n --_hf: var(--layer-hue-fill, var(--surface-muted, #f3f4f6));\n --_hfs: var(--layer-hue-fill-strong, var(--surface-interactive-active, #e5e7eb));\n --_hi: var(--layer-hue-ink, var(--text-primary, #111827));\n --_c: var(--_hfs);\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n margin: 0;\n border: 0;\n text-align: left;\n white-space: nowrap;\n cursor: pointer;\n color: var(--_hi);\n background: var(--_c);\n border-radius: 12px;\n padding: calc(var(--spacing-1, 0.25rem) * 2.5) var(--spacing-3, 0.75rem);\n display: flex;\n flex-direction: column;\n gap: calc(var(--spacing-1, 0.25rem) * 0.5);\n transition:\n left var(--_dur) var(--_ease),\n top var(--_dur) var(--_ease),\n width var(--_dur) var(--_ease),\n height var(--_dur) var(--_ease),\n opacity calc(var(--_dur) * 0.7),\n background-color var(--_dur),\n border-radius var(--_dur);\n}\n\n.block:focus-visible {\n outline: var(--focus-ring-width, 2px) solid var(--border-focus, #3b82f6);\n outline-offset: var(--focus-ring-offset, 2px);\n z-index: 2;\n}\n\n.block[data-ghost] {\n pointer-events: none;\n}\n\n/* Lighter by depth, from the hue's strong fill to its pale fill and past it. */\n.block[data-tone=\"1\"] {\n --_c: color-mix(in srgb, var(--_hfs) 68%, var(--_hf));\n}\n.block[data-tone=\"2\"] {\n --_c: color-mix(in srgb, var(--_hfs) 38%, var(--_hf));\n}\n.block[data-tone=\"3\"] {\n --_c: var(--_hf);\n}\n.block[data-tone=\"4\"] {\n --_c: color-mix(in srgb, var(--_hf) 66%, var(--_ground));\n}\n\n.block[data-root] {\n background: var(--surface-card, #f9fafb);\n color: var(--text-primary, #111827);\n}\n\n/* Covered: pale, with a dot grid; the label sits on a plate so it reads. */\n.block[data-kind=\"covered\"] {\n background-color: color-mix(in srgb, var(--_c) 40%, var(--_ground));\n background-image: radial-gradient(circle, color-mix(in srgb, var(--_hfs) 90%, var(--_hi)) 1.1px, transparent 1.6px);\n background-size: 8px 8px;\n}\n.block[data-kind=\"covered\"] .text {\n background: color-mix(in srgb, var(--_c) 40%, var(--_ground));\n}\n\n/* Not billable: hatched, the label on a solid plate. */\n.block[data-kind=\"not-billable\"] {\n background: repeating-linear-gradient(\n 135deg,\n var(--_c) 0 6px,\n color-mix(in srgb, var(--_c) 38%, var(--_ground)) 6px 12px\n );\n}\n.block[data-kind=\"not-billable\"] .text {\n background: var(--_c);\n}\n\n.block[data-kind=\"covered\"] .text,\n.block[data-kind=\"not-billable\"] .text {\n border-radius: 8px;\n padding: calc(var(--spacing-1, 0.25rem) * 0.5) calc(var(--spacing-1, 0.25rem) * 1.5);\n margin: -2px calc(var(--spacing-1, 0.25rem) * -1.5);\n align-self: flex-start;\n max-width: calc(100% + 12px);\n}\n\n/* Unresolved: the only coral. */\n.block[data-kind=\"unresolved\"] {\n background: var(--layer-chart-alert-fill, color-mix(in srgb, var(--color-error-500, #ef4444) 35%, var(--surface-page, #ffffff)));\n color: var(--layer-chart-alert-text, var(--text-error, #b91c1c));\n}\n\n/* Today counts once it is over, so it is drawn paler. */\n.block[data-today] {\n background: color-mix(in srgb, var(--_c) 35%, var(--_ground));\n}\n\n.block[data-more] {\n background: var(--_segment);\n color: var(--text-secondary, #4b5563);\n align-items: center;\n justify-content: center;\n padding: 0;\n}\n\n/* Row shapes: path and focus rows are one line; the rows below fall in height. */\n.block[data-role=\"anc\"],\n.block[data-role=\"focus\"] {\n flex-direction: row;\n align-items: center;\n gap: calc(var(--spacing-1, 0.25rem) * 2.5);\n padding: 0 calc(var(--spacing-1, 0.25rem) * 3.5);\n}\n.block[data-role=\"kids\"] {\n padding: calc(var(--spacing-1, 0.25rem) * 3.5) var(--spacing-4, 1rem);\n border-radius: 16px;\n}\n.block[data-role=\"gkids\"] {\n padding: var(--spacing-2, 0.5rem) calc(var(--spacing-1, 0.25rem) * 2.5);\n border-radius: 10px;\n}\n.block[data-role=\"ggkids\"] {\n padding: 0 var(--spacing-2, 0.5rem);\n border-radius: 6px;\n justify-content: center;\n}\n.block[data-more][data-role] {\n padding: 0;\n}\n\n.text {\n display: flex;\n flex-direction: column;\n gap: calc(var(--spacing-1, 0.25rem) * 0.5);\n min-width: 0;\n}\n\n.name {\n font-size: 15px;\n line-height: 20px;\n font-weight: var(--font-weight-bold, 700);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.block[data-role=\"anc\"] .name,\n.block[data-role=\"gkids\"] .name,\n.block[data-role=\"ggkids\"] .name {\n font-size: 13px;\n line-height: 18px;\n font-weight: var(--font-weight-semibold, 600);\n}\n.block[data-role=\"focus\"] .name {\n font-size: 17px;\n line-height: 22px;\n}\n\n.value {\n font-size: 13px;\n line-height: 18px;\n font-weight: var(--font-weight-semibold, 600);\n font-variant-numeric: tabular-nums;\n}\n.block[data-role=\"anc\"] .value,\n.block[data-role=\"focus\"] .value {\n margin-left: auto;\n}\n.block[data-role=\"focus\"] .value {\n font-size: 15px;\n line-height: 20px;\n font-weight: var(--font-weight-bold, 700);\n}\n\n.big {\n font-size: 24px;\n line-height: 28px;\n font-weight: 900;\n letter-spacing: var(--paper-track-tight, -0.025em);\n font-variant-numeric: tabular-nums;\n margin-top: calc(var(--spacing-1, 0.25rem) * 0.5);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.block[data-role=\"kids\"] .big {\n font-size: 32px;\n line-height: 36px;\n margin-top: var(--spacing-1, 0.25rem);\n}\n\n.pct {\n font-size: 13px;\n line-height: 18px;\n font-weight: var(--font-weight-bold, 700);\n letter-spacing: 0;\n margin-left: calc(var(--spacing-1, 0.25rem) * 1.5);\n}\n\n.sub {\n font-size: 13px;\n line-height: 18px;\n font-weight: var(--font-weight-medium, 500);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.slot {\n display: block;\n margin-top: auto;\n min-width: 0;\n}\n\n/* Narrow: smaller figures, tighter blocks. */\n.root[data-narrow] .block[data-role=\"kids\"],\n.root[data-narrow] .block[data-role=\"gkids\"] {\n padding: var(--spacing-2, 0.5rem) calc(var(--spacing-1, 0.25rem) * 2.5);\n}\n.root[data-narrow] .big,\n.root[data-narrow] .block[data-role=\"kids\"] .big {\n font-size: 20px;\n line-height: 24px;\n}\n.root[data-narrow] .pct {\n display: none;\n}\n\n/* ---------- the band (agent time) and its note ---------- */\n.band {\n position: absolute;\n overflow: hidden;\n border-radius: 8px;\n background: color-mix(in srgb, var(--layer-hue-fill, var(--surface-muted, #f3f4f6)) 50%, var(--_ground));\n color: var(--layer-hue-ink, var(--text-primary, #111827));\n font-size: 12px;\n line-height: 18px;\n font-weight: var(--font-weight-bold, 700);\n letter-spacing: var(--paper-track-label, 0.08em);\n text-transform: uppercase;\n padding: 0 var(--spacing-2, 0.5rem);\n white-space: nowrap;\n transition: left var(--_dur) var(--_ease), top var(--_dur) var(--_ease), width var(--_dur) var(--_ease);\n}\n\n.note {\n position: absolute;\n left: 0;\n right: 0;\n height: 22px;\n border-radius: 8px;\n background: var(--_segment);\n color: var(--text-secondary, #4b5563);\n font-size: 13px;\n line-height: 22px;\n font-weight: var(--font-weight-medium, 500);\n padding: 0 calc(var(--spacing-1, 0.25rem) * 2.5);\n white-space: nowrap;\n overflow: hidden;\n transition: top var(--_dur) var(--_ease);\n}\n\n/* ---------- hover card ---------- */\n.card {\n position: absolute;\n z-index: 20;\n width: 300px;\n background: var(--surface-popover, #ffffff);\n color: var(--text-primary, #111827);\n border-radius: 18px;\n padding: calc(var(--spacing-1, 0.25rem) * 3.5) var(--spacing-4, 1rem);\n box-shadow: var(--shadow-lg);\n pointer-events: none;\n}\n\n.cardTitle {\n margin: 0;\n font-size: 15px;\n line-height: 20px;\n font-weight: var(--font-weight-bold, 700);\n}\n\n.cardSub {\n margin: 0;\n font-size: 13px;\n line-height: 18px;\n font-weight: var(--font-weight-medium, 500);\n color: var(--text-secondary, #4b5563);\n}\n\n.cardList {\n display: grid;\n grid-template-columns: 1fr auto;\n gap: calc(var(--spacing-1, 0.25rem) * 0.5) var(--spacing-3, 0.75rem);\n margin: calc(var(--spacing-1, 0.25rem) * 2.5) 0 var(--spacing-1, 0.25rem);\n font-size: 13px;\n line-height: 20px;\n font-weight: var(--font-weight-medium, 500);\n}\n.cardList dt {\n color: var(--text-secondary, #4b5563);\n}\n.cardList dd {\n margin: 0;\n font-weight: var(--font-weight-bold, 700);\n text-align: right;\n font-variant-numeric: tabular-nums;\n}\n\n/* ---------- SpanStrip: a day's 5-minute cells in lanes on a time axis ---------- */\n.strip {\n --_hf: var(--layer-hue-fill, var(--surface-muted, #f3f4f6));\n --_hi: var(--layer-hue-ink, var(--text-primary, #111827));\n --_hs: var(--layer-hue-solid, var(--text-secondary, #4b5563));\n --_ground: var(--layer-chart-ground, var(--surface-page, #ffffff));\n min-width: 0;\n}\n\n.lanes {\n display: grid;\n grid-template-columns: 64px minmax(0, 1fr);\n gap: var(--spacing-2, 0.5rem) calc(var(--spacing-1, 0.25rem) * 2.5);\n align-items: center;\n}\n\n.laneLabel {\n font-size: 12px;\n line-height: 16px;\n font-weight: var(--font-weight-bold, 700);\n letter-spacing: var(--paper-track-label, 0.08em);\n text-transform: uppercase;\n color: var(--text-secondary, #4b5563);\n}\n\n.lane {\n position: relative;\n height: 30px;\n border-radius: 8px;\n background: var(--_ground);\n overflow: hidden;\n}\n.lane[data-thin] {\n height: 22px;\n}\n\n.cell {\n position: absolute;\n top: 3px;\n bottom: 3px;\n border-radius: 2px;\n}\n\n.cell[data-kind=\"attended\"],\n.swatch[data-kind=\"attended\"] {\n background: color-mix(in srgb, var(--_hs) 60%, var(--_hf));\n}\n.cell[data-kind=\"call\"],\n.swatch[data-kind=\"call\"] {\n background: var(--_hi);\n}\n.cell[data-kind=\"agent\"],\n.swatch[data-kind=\"agent\"] {\n background: color-mix(in srgb, var(--_hs) 38%, var(--_hf));\n}\n\n.axis {\n position: relative;\n height: 18px;\n font-size: 13px;\n line-height: 18px;\n font-weight: var(--font-weight-medium, 500);\n color: var(--text-secondary, #4b5563);\n}\n.axis span {\n position: absolute;\n transform: translateX(-50%);\n white-space: nowrap;\n}\n.axis span:first-child {\n transform: none;\n}\n.axis span:last-child {\n transform: translateX(-100%);\n}\n\n.legend {\n display: flex;\n flex-wrap: wrap;\n gap: calc(var(--spacing-1, 0.25rem) * 1.5) var(--spacing-4, 1rem);\n margin-top: calc(var(--spacing-1, 0.25rem) * 2.5);\n font-size: 13px;\n line-height: 18px;\n font-weight: var(--font-weight-medium, 500);\n color: var(--text-secondary, #4b5563);\n}\n.legend span {\n display: inline-flex;\n gap: calc(var(--spacing-1, 0.25rem) * 1.5);\n align-items: center;\n}\n\n.swatch {\n width: 14px;\n height: 14px;\n border-radius: 4px;\n flex: none;\n}\n"
|
|
799
|
+
}
|
|
800
|
+
]
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
"name": "meter",
|
|
804
|
+
"type": "registry:ui",
|
|
805
|
+
"description": "A thin meter for use against a limit: the track in a hue's tint, the fill in its ink, ticks for a heads-up threshold and a ceiling, a label slot, zones, and striped use past the limit.",
|
|
806
|
+
"category": "data-display",
|
|
807
|
+
"dependencies": [
|
|
808
|
+
"@loworbitstudio/visor-core"
|
|
809
|
+
],
|
|
810
|
+
"registryDependencies": [
|
|
811
|
+
"utils"
|
|
812
|
+
],
|
|
813
|
+
"files": [
|
|
814
|
+
{
|
|
815
|
+
"path": "components/ui/meter/meter.tsx",
|
|
816
|
+
"type": "registry:ui",
|
|
817
|
+
"content": "import * as React from \"react\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./meter.module.css\"\n\nexport interface MeterMark {\n /** Where the mark sits, in the same unit as `value` and `max`. */\n value: number\n /** Bold first line under the tick (\"160 h\"). */\n label?: React.ReactNode\n /** Second line under the tick (\"heads-up\"). */\n caption?: React.ReactNode\n /** How the text hangs off the tick. Defaults to `\"center\"`. */\n align?: \"start\" | \"center\" | \"end\"\n /** `\"tick\"` is a 2px line; `\"limit\"` is a 3px line for a ceiling. Defaults to `\"tick\"`. */\n variant?: \"tick\" | \"limit\"\n /** The heads-up point: once `value` reaches it, the label's `<strong>` turns weight 800. */\n threshold?: boolean\n /** Hide this mark's text when the meter is narrower than 30rem. The tick stays. */\n hideWhenNarrow?: boolean\n}\n\nexport interface MeterZone {\n /** Start of the zone. Defaults to 0. */\n from?: number\n /** End of the zone. */\n to: number\n /** `\"solid\"` fills in the hue's strong fill; `\"hatched\"` stripes it. Defaults to `\"solid\"`. */\n variant?: \"solid\" | \"hatched\"\n}\n\nexport interface MeterProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** What has been used. */\n value: number\n /** The limit (a contract's ceiling, a month's included hours). */\n max: number\n /** Ticks on the track: the heads-up threshold, a ceiling, the low and high totals. */\n marks?: MeterMark[]\n /** Bands drawn behind the fill: up to the low, hatched up to the high. */\n zones?: MeterZone[]\n /** A Paper project-hue angle (75, 99 … 339). Reads `--paper-hue-<angle>-fill`, `-fill-strong` and `-ink`. */\n hue?: number\n /** `\"compact\"` is the 10px row meter; `\"contract\"` is the 30px meter with zones and mark text. */\n size?: \"compact\" | \"contract\"\n /** How use past `max` draws: `\"alert\"` stripes it coral (unresolved), `\"ink\"` stripes it in ink (billable overage). */\n overflow?: \"alert\" | \"ink\"\n /** The value at the track's right edge. Defaults to `max`, or 6% past `value` when it overflows. Pass one scale to line up several meters. */\n scale?: number\n /** The one-line label under the meter. Wrap the figure in `<strong>`. */\n children?: React.ReactNode\n}\n\nconst Meter = React.forwardRef<HTMLDivElement, MeterProps>(\n (\n {\n className,\n style,\n value,\n max,\n marks = [],\n zones = [],\n hue,\n size = \"compact\",\n overflow = \"alert\",\n scale,\n children,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...props\n },\n ref\n ) => {\n const labelId = React.useId()\n // Past the limit the track stretches 6% beyond `value`, so the overflow segment has room (LO-345 frame).\n const domain = scale ?? (value > max ? value * 1.06 : max)\n const pct = (v: number) => (domain > 0 ? (Math.min(Math.max(v, 0), domain) / domain) * 100 : 0)\n const threshold = marks.find((m) => m.threshold)\n const over = threshold !== undefined && value >= threshold.value\n const fillTo = overflow === \"ink\" ? value : Math.min(value, max)\n const markText = marks.filter((m) => m.label != null || m.caption != null)\n\n const hueVars =\n hue === undefined\n ? undefined\n : ({\n \"--meter-hue-fill\": `var(--paper-hue-${hue}-fill)`,\n \"--meter-hue-fill-strong\": `var(--paper-hue-${hue}-fill-strong)`,\n \"--meter-hue-ink\": `var(--paper-hue-${hue}-ink)`,\n } as React.CSSProperties)\n\n return (\n <div\n ref={ref}\n data-slot=\"meter\"\n data-size={size}\n data-over={over ? \"\" : undefined}\n className={cn(styles.root, className)}\n style={{ ...hueVars, ...style }}\n {...props}\n >\n <div\n role=\"meter\"\n aria-valuemin={0}\n aria-valuemax={max}\n aria-valuenow={Math.min(Math.max(value, 0), max)}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy ?? (ariaLabel || children == null ? undefined : labelId)}\n data-slot=\"meter-track\"\n className={styles.track}\n >\n {zones.map((z, i) => (\n <span\n key={i}\n data-slot=\"meter-zone\"\n data-variant={z.variant ?? \"solid\"}\n className={styles.zone}\n style={{ left: `${pct(z.from ?? 0)}%`, width: `${pct(z.to) - pct(z.from ?? 0)}%` }}\n />\n ))}\n {value > max && (\n <span\n data-slot=\"meter-overflow\"\n data-variant={overflow}\n className={styles.overflow}\n style={{ left: `${pct(max)}%`, width: `${pct(value) - pct(max)}%` }}\n />\n )}\n <span\n data-slot=\"meter-fill\"\n className={styles.fill}\n style={{ width: `max(0px, calc(${pct(fillTo)}% - var(--_inset-x) * 2))` }}\n />\n {marks.map((m, i) => (\n <span\n key={i}\n data-slot=\"meter-tick\"\n data-variant={m.variant ?? \"tick\"}\n className={styles.tick}\n style={{ left: `${pct(m.value)}%` }}\n />\n ))}\n </div>\n {markText.length > 0 && (\n <div data-slot=\"meter-marks\" className={styles.marks}>\n {markText.map((m, i) => (\n <div\n key={i}\n data-align={m.align ?? \"center\"}\n data-hide-narrow={m.hideWhenNarrow ? \"\" : undefined}\n className={styles.markText}\n style={{ left: `${pct(m.value)}%` }}\n >\n {m.label != null && <b>{m.label}</b>}\n {m.caption}\n </div>\n ))}\n </div>\n )}\n {children != null && (\n <div id={labelId} data-slot=\"meter-label\" className={styles.label}>\n {children}\n </div>\n )}\n </div>\n )\n }\n)\nMeter.displayName = \"Meter\"\n\nexport { Meter }\n"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
"path": "components/ui/meter/meter.module.css",
|
|
821
|
+
"type": "registry:ui",
|
|
822
|
+
"content": "/*\n * Meter: use against a limit. The track is the hue's tint, the fill is the\n * hue's ink inset inside it, ticks mark the heads-up and the ceiling.\n * `hue` sets --meter-hue-fill / -fill-strong / -ink from Paper's project\n * hues; without them (or on another theme) the meter falls back to neutrals.\n */\n.root {\n --_fill: var(--meter-hue-fill, var(--surface-muted, #f3f4f6));\n --_fill-strong: var(--meter-hue-fill-strong, var(--surface-interactive-active, #e5e7eb));\n --_ink: var(--meter-hue-ink, var(--text-primary, #111827));\n --_tick: var(--meter-tick, var(--text-primary, #111827));\n --_alert: var(--meter-alert, var(--color-error-500, #ef4444));\n --_hatch: var(--meter-hatch-width, 4px);\n /* Compact (row) geometry from the LO-344 frame: a 10px track, the fill inset 2px, ticks 3px proud. */\n --_track-h: 10px;\n --_track-radius: var(--radius-full, 9999px);\n --_inset-x: 2px;\n --_inset-y: 2px;\n --_tick-out: 3px;\n display: block;\n min-width: 0;\n}\n\n/* Contract geometry from the LO-345 frame: a 30px track, a thinner used bar, ticks 6px proud. */\n.root[data-size=\"contract\"] {\n --_track-h: 30px;\n --_track-radius: 10px;\n --_inset-x: 6px;\n --_inset-y: 9px;\n --_tick-out: 6px;\n}\n\n.track {\n position: relative;\n height: var(--_track-h);\n border-radius: var(--_track-radius);\n background: var(--_fill-strong);\n}\n\n/* The contract track is the pale fill; zones carry the strong fill. */\n.root[data-size=\"contract\"] .track {\n background: color-mix(in srgb, var(--_fill) 55%, transparent);\n}\n\n.zone,\n.overflow,\n.fill,\n.tick {\n position: absolute;\n}\n\n.zone {\n top: 0;\n bottom: 0;\n border-radius: var(--_track-radius);\n background: var(--_fill-strong);\n}\n\n.zone[data-variant=\"hatched\"] {\n background: repeating-linear-gradient(\n 135deg,\n var(--_fill-strong) 0 var(--_hatch),\n transparent var(--_hatch) calc(var(--_hatch) * 2)\n );\n}\n\n/* Past the limit: coral stripes for unresolved hours, the one alert case. */\n.overflow {\n top: 0;\n bottom: 0;\n border-radius: 0 var(--_track-radius) var(--_track-radius) 0;\n background: repeating-linear-gradient(\n 135deg,\n var(--_alert) 0 var(--_hatch),\n color-mix(in srgb, var(--_alert) 35%, transparent) var(--_hatch) calc(var(--_hatch) * 2)\n );\n}\n\n/* Billable overage (a retainer past its included hours) stripes in ink, never coral. */\n.overflow[data-variant=\"ink\"] {\n background: repeating-linear-gradient(\n 135deg,\n color-mix(in srgb, var(--_ink) 55%, transparent) 0 var(--_hatch),\n transparent var(--_hatch) calc(var(--_hatch) * 2)\n );\n}\n\n.fill {\n left: var(--_inset-x);\n top: var(--_inset-y);\n bottom: var(--_inset-y);\n border-radius: var(--radius-full, 9999px);\n background: var(--_ink);\n}\n\n.tick {\n top: calc(var(--_tick-out) * -1);\n bottom: calc(var(--_tick-out) * -1);\n width: 2px;\n border-radius: 2px;\n background: var(--_tick);\n}\n\n/* A ceiling: 3px, set back so it ends inside the track. */\n.tick[data-variant=\"limit\"] {\n width: 3px;\n margin-left: -2px;\n}\n\n/* Mark text under the ticks: two 16px lines, positioned by each mark's value. */\n.marks {\n container-type: inline-size;\n position: relative;\n height: 2.5rem;\n margin-top: var(--spacing-2, 0.5rem);\n font-size: var(--font-size-xs, 0.75rem);\n line-height: 1rem;\n font-weight: var(--font-weight-medium, 500);\n color: var(--text-secondary, #4b5563);\n}\n\n.markText {\n position: absolute;\n top: 0;\n transform: translateX(-50%);\n text-align: center;\n white-space: nowrap;\n}\n\n.markText[data-align=\"start\"] {\n transform: none;\n text-align: left;\n}\n\n.markText[data-align=\"end\"] {\n transform: translateX(-100%);\n text-align: right;\n}\n\n.markText b {\n display: block;\n color: var(--text-primary, #111827);\n font-weight: var(--font-weight-bold, 700);\n}\n\n@container (max-width: 30rem) {\n .markText[data-hide-narrow] {\n display: none;\n }\n}\n\n.label {\n margin-top: calc(var(--spacing-1, 0.25rem) * 1.5);\n font-size: var(--font-size-xs, 0.75rem);\n line-height: var(--line-height-snug, 1.375);\n font-weight: var(--font-weight-medium, 500);\n color: var(--text-secondary, #4b5563);\n}\n\n.label strong {\n color: var(--text-primary, #111827);\n font-weight: var(--font-weight-bold, 700);\n}\n\n/* Past the heads-up the figure turns heavier in ink, never the alert colour (intentional 800, no token). */\n.root[data-over] .label strong {\n font-weight: 800;\n}\n"
|
|
823
|
+
}
|
|
824
|
+
]
|
|
825
|
+
},
|
|
768
826
|
{
|
|
769
827
|
"name": "progress",
|
|
770
828
|
"type": "registry:ui",
|
|
@@ -790,6 +848,30 @@
|
|
|
790
848
|
}
|
|
791
849
|
]
|
|
792
850
|
},
|
|
851
|
+
{
|
|
852
|
+
"name": "proportion-bar",
|
|
853
|
+
"type": "registry:ui",
|
|
854
|
+
"description": "One measured total split into named parts, widths proportional to value, with hatched, striped and alert fills, a 30px and an 8px (thin) size, and an optional legend of swatch, label and value.",
|
|
855
|
+
"category": "data-display",
|
|
856
|
+
"dependencies": [
|
|
857
|
+
"@loworbitstudio/visor-core"
|
|
858
|
+
],
|
|
859
|
+
"registryDependencies": [
|
|
860
|
+
"utils"
|
|
861
|
+
],
|
|
862
|
+
"files": [
|
|
863
|
+
{
|
|
864
|
+
"path": "components/ui/proportion-bar/proportion-bar.tsx",
|
|
865
|
+
"type": "registry:ui",
|
|
866
|
+
"content": "import * as React from \"react\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./proportion-bar.module.css\"\n\n/**\n * A part's fill. `\"hatched\"`, `\"striped\"` and `\"alert\"` are built in; any other\n * string is used as the part's CSS `background` (a colour, a `var()`, a gradient).\n */\nexport type ProportionBarFill = \"hatched\" | \"striped\" | \"alert\" | (string & {})\n\nexport interface ProportionBarPart {\n /** The part's name, in the legend and the summary. */\n label: string\n /** The part's share of the total. Zero or less draws nothing in the bar and stays in the legend. */\n value: number\n /** Defaults to `--proportion-bar-fill-1` … `-4` by position. */\n fill?: ProportionBarFill\n}\n\nexport interface ProportionBarProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** The parts, in order, left to right. */\n parts: ProportionBarPart[]\n /** `default` is 30px tall (a main balance); `thin` is 8px (inside a card). */\n size?: \"default\" | \"thin\"\n /** Draw the legend row under the bar: swatch, label, value. */\n legend?: boolean\n /** Formats every value in the legend, the summary and the part tooltips. */\n formatValue?: (value: number) => string\n /** The bar's accessible text. Defaults to \"186.5 h: On a package 92.25 h, …\". */\n summary?: string\n}\n\nconst BUILT_IN = {\n hatched: styles.hatched,\n striped: styles.striped,\n alert: styles.alert,\n}\nconst DEFAULT_FILLS = [styles.fill1, styles.fill2, styles.fill3, styles.fill4]\n\n/** The class and inline background that paint part `i`. */\nfunction paint(part: ProportionBarPart, i: number): { className: string; style?: React.CSSProperties } {\n const { fill } = part\n if (fill === undefined) return { className: DEFAULT_FILLS[i % DEFAULT_FILLS.length] }\n if (fill === \"hatched\" || fill === \"striped\" || fill === \"alert\")\n return { className: BUILT_IN[fill as keyof typeof BUILT_IN] }\n return { className: \"\", style: { background: fill } }\n}\n\nconst ProportionBar = React.forwardRef<HTMLDivElement, ProportionBarProps>(\n ({ className, parts, size = \"default\", legend = false, formatValue = String, summary, ...props }, ref) => {\n const values = parts.map((p) => Math.max(p.value, 0))\n const total = values.reduce((a, b) => a + b, 0)\n const label =\n summary ??\n (parts.length\n ? `${formatValue(total)}: ${parts.map((p, i) => `${p.label} ${formatValue(values[i])}`).join(\", \")}`\n : formatValue(0))\n\n return (\n <div ref={ref} data-slot=\"proportion-bar\" data-size={size} className={cn(styles.root, className)} {...props}>\n <div role=\"img\" aria-label={label} data-slot=\"proportion-bar-track\" className={styles.bar}>\n {total > 0 ? (\n parts.map((part, i) => {\n if (values[i] <= 0) return null\n const { className: fill, style } = paint(part, i)\n return (\n <span\n key={i}\n data-slot=\"proportion-bar-part\"\n title={`${part.label} ${formatValue(values[i])}`}\n className={cn(styles.part, fill)}\n style={{ ...style, flexGrow: values[i] }}\n />\n )\n })\n ) : (\n <span data-slot=\"proportion-bar-empty\" className={styles.empty} />\n )}\n </div>\n {legend && parts.length > 0 && (\n <ul data-slot=\"proportion-bar-legend\" className={styles.legend}>\n {parts.map((part, i) => {\n const { className: fill, style } = paint(part, i)\n return (\n <li key={i} className={cn(styles.legendItem, part.fill === \"alert\" && styles.legendAlert)}>\n <span aria-hidden=\"true\" className={cn(styles.swatch, fill)} style={style} />\n {part.label} <b className={styles.legendValue}>{formatValue(values[i])}</b>\n </li>\n )\n })}\n </ul>\n )}\n </div>\n )\n }\n)\nProportionBar.displayName = \"ProportionBar\"\n\nexport { ProportionBar }\n"
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"path": "components/ui/proportion-bar/proportion-bar.module.css",
|
|
870
|
+
"type": "registry:ui",
|
|
871
|
+
"content": "/* ProportionBar\n *\n * One measured total split into named parts, widths proportional to value.\n * Parts are told apart by the ground showing between them, never by lines.\n *\n * Component-intrinsic dimensions (no spacing token maps to them):\n * - bar height 30px (default) and 8px (thin), the approved sizes;\n * - the 3px (default) and 2px (thin) gap between parts (as fractions of --spacing-1),\n * and the same values as the inner corners, so the ground reads as a cut;\n * - 4px minimum part width, so a sliver can still be hovered;\n * - the 12px legend swatch with a 4px corner;\n * - the hatch (3px stroke in a 7px period) and the stripes (6px bands) at 135deg.\n */\n\n.root {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-2, 0.5rem);\n min-width: 0;\n}\n\n.bar {\n display: flex;\n gap: calc(var(--spacing-1, 0.25rem) * 0.75);\n height: 30px;\n border-radius: var(--radius-sm, 0.375rem);\n overflow: hidden;\n}\n\n.part {\n flex: 1 1 0;\n min-width: 4px;\n border-radius: 3px;\n}\n\n/* Rounded ends on the outer parts only. */\n.part:first-child {\n border-top-left-radius: var(--radius-sm, 0.375rem);\n border-bottom-left-radius: var(--radius-sm, 0.375rem);\n}\n\n.part:last-child {\n border-top-right-radius: var(--radius-sm, 0.375rem);\n border-bottom-right-radius: var(--radius-sm, 0.375rem);\n}\n\n.root[data-size=\"thin\"] .bar {\n gap: calc(var(--spacing-1, 0.25rem) / 2);\n height: 8px;\n border-radius: var(--radius-full, 9999px);\n}\n\n.root[data-size=\"thin\"] .part {\n border-radius: 2px;\n}\n\n.root[data-size=\"thin\"] .part:first-child {\n border-top-left-radius: var(--radius-full, 9999px);\n border-bottom-left-radius: var(--radius-full, 9999px);\n}\n\n.root[data-size=\"thin\"] .part:last-child {\n border-top-right-radius: var(--radius-full, 9999px);\n border-bottom-right-radius: var(--radius-full, 9999px);\n}\n\n/* Nothing measured: one neutral track. */\n.empty {\n flex: 1;\n background: var(--proportion-bar-track-bg, var(--surface-muted, #e5e7eb));\n}\n\n/* Default fills, by position. */\n.fill1 {\n background: var(--proportion-bar-fill-1, var(--chart-1, #2563eb));\n}\n\n.fill2 {\n background: var(--proportion-bar-fill-2, var(--chart-2, #16a34a));\n}\n\n.fill3 {\n background: var(--proportion-bar-fill-3, var(--chart-3, #d97706));\n}\n\n.fill4 {\n background: var(--proportion-bar-fill-4, var(--chart-4, #0891b2));\n}\n\n/* Hatched: not billable, written off. */\n.hatched {\n background: repeating-linear-gradient(\n 135deg,\n var(--proportion-bar-hatch-color, var(--text-tertiary, #9ca3af)) 0 3px,\n var(--proportion-bar-hatch-gap, color-mix(in srgb, var(--surface-card, #ffffff) 70%, transparent)) 3px 7px\n );\n}\n\n/* Striped: two close tones in alternating bands (earned, not yet collected). */\n.striped {\n background: repeating-linear-gradient(\n 135deg,\n var(--proportion-bar-stripe-a, var(--color-success-500, #22c55e)) 0 6px,\n var(--proportion-bar-stripe-b, var(--color-success-600, #16a34a)) 6px 12px\n );\n}\n\n/* Alert: the one part that needs a decision. */\n.alert {\n background: var(--proportion-bar-alert-bg, var(--interactive-destructive-bg, #dc2626));\n}\n\n/* Legend: swatch, label, value. */\n.legend {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-2, 0.5rem) var(--spacing-4, 1rem);\n margin: 0;\n padding: 0;\n list-style: none;\n font-size: var(--font-size-xs, 0.75rem);\n font-weight: var(--font-weight-medium, 500);\n line-height: var(--line-height-snug, 1.375);\n color: var(--text-secondary, #6b7280);\n}\n\n.legendItem {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-2, 0.5rem);\n}\n\n.swatch {\n flex: none;\n width: 12px;\n height: 12px;\n border-radius: 4px;\n}\n\n.legendValue {\n color: var(--text-primary, #111827);\n font-weight: var(--font-weight-bold, 700);\n}\n\n/* The alert part is named in text, not only by its fill. */\n.legendAlert,\n.legendAlert .legendValue {\n color: var(--proportion-bar-alert-text, var(--text-error, #b91c1c));\n}\n"
|
|
872
|
+
}
|
|
873
|
+
]
|
|
874
|
+
},
|
|
793
875
|
{
|
|
794
876
|
"name": "segmented-progress",
|
|
795
877
|
"type": "registry:ui",
|
|
@@ -1338,6 +1420,31 @@
|
|
|
1338
1420
|
}
|
|
1339
1421
|
]
|
|
1340
1422
|
},
|
|
1423
|
+
{
|
|
1424
|
+
"name": "billing-slider",
|
|
1425
|
+
"type": "registry:ui",
|
|
1426
|
+
"description": "A range slider for how many hours a package bills: a floor, marks as notches, stripes past the high, worked, agent and proposed evidence along the foot, a money-at-stake gap and a pill thumb with a value bubble.",
|
|
1427
|
+
"category": "form",
|
|
1428
|
+
"dependencies": [
|
|
1429
|
+
"@radix-ui/react-slider",
|
|
1430
|
+
"@loworbitstudio/visor-core"
|
|
1431
|
+
],
|
|
1432
|
+
"registryDependencies": [
|
|
1433
|
+
"utils"
|
|
1434
|
+
],
|
|
1435
|
+
"files": [
|
|
1436
|
+
{
|
|
1437
|
+
"path": "components/ui/billing-slider/billing-slider.tsx",
|
|
1438
|
+
"type": "registry:ui",
|
|
1439
|
+
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as SliderPrimitive from \"@radix-ui/react-slider\"\nimport { cn } from \"../../../lib/utils\"\nimport styles from \"./billing-slider.module.css\"\n\nexport interface BillingSliderMark {\n /** Where the notch sits. A mark is not a stop: the thumb passes it freely. */\n value: number\n /** Text before the value in the labels row (\"High\"). */\n label?: React.ReactNode\n /** Past this mark the filled range turns to stripes (the \"past the high\" zone). */\n hatchPast?: boolean\n}\n\nexport interface BillingSliderEvidence {\n /** Confirmed hours: a solid strip along the track's foot, and a full-height tick at its end. */\n value: number\n /** Agent hours counted as evidence: a dotted extension that moves the tick. Leave it off when they don't count. */\n agent?: number\n /** Proposed, unconfirmed hours: a pale extension past the tick, and a dashed tick at its end. */\n proposed?: number\n}\n\nexport interface BillingSliderProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"defaultValue\" | \"onChange\"> {\n /** What it bills. Controlled. */\n value: number\n onValueChange: (value: number) => void\n /** Enter, or releasing the thumb after a drag. Arrow keys never commit. */\n onValueCommit?: (value: number) => void\n /** The last saved value. Escape puts the thumb back here. */\n savedValue?: number\n /** The floor. Nothing below it. */\n min: number\n /** The track's end, computed by the caller (as far as the ceiling allows). */\n max: number\n /** Defaults to 0.25 (a quarter hour). Shift + arrows step four times this. */\n step?: number\n /** Notches across the track, with their text in the labels row. */\n marks?: BillingSliderMark[]\n /** What was worked, drawn along the track's foot. */\n evidence?: BillingSliderEvidence\n /** Stripe the gap between the thumb and the evidence tick (money at stake, not decided). */\n gap?: boolean\n /** A Paper project-hue angle (75, 99 … 339). Reads `--paper-hue-<angle>-fill-strong` and `-ink`. */\n hue?: number\n /** `\"md\"` is the 40px row track; `\"lg\"` is the 56px hero track. */\n size?: \"md\" | \"lg\"\n /** `\"saving\"` pulses the thumb. `\"failed\"` is a hook for styling; put `value` back to `savedValue`. */\n status?: \"saving\" | \"failed\"\n disabled?: boolean\n /** Formats a value for the bubble and the labels row. Defaults to the number. */\n formatValue?: (value: number) => string\n /** `aria-valuetext`: the formatted value and its amount (\"Bills 9.5 h, $1,140\"). Defaults to `formatValue`. */\n valueText?: (value: number) => string\n /** Text before the floor's value (\"Low\"). */\n minLabel?: React.ReactNode\n /** Text before the end's value (\"Ceiling allows\"). */\n maxLabel?: React.ReactNode\n}\n\nconst BIG_STEP = 4\n\nconst BillingSlider = React.forwardRef<HTMLDivElement, BillingSliderProps>(\n (\n {\n className,\n style,\n value,\n onValueChange,\n onValueCommit,\n savedValue,\n min,\n max,\n step = 0.25,\n marks = [],\n evidence,\n gap = false,\n hue,\n size = \"md\",\n status,\n disabled = false,\n formatValue = String,\n valueText,\n minLabel,\n maxLabel,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...props\n },\n ref\n ) => {\n const span = max - min\n const pct = (v: number) => (span > 0 ? ((Math.min(Math.max(v, min), max) - min) / span) * 100 : 0)\n const at = (from: number, to: number) => ({ left: `${pct(from)}%`, width: `${Math.max(pct(to) - pct(from), 0)}%` })\n // Round to the step from the floor; the 1e6 round trip drops float noise (0.1 + 0.2).\n const snap = (v: number) =>\n Math.min(Math.max(Math.round(Math.round((v - min) / step) * step * 1e6) / 1e6 + min, min), max)\n\n const hatchAt = marks.find((m) => m.hatchPast)?.value\n const fillTo = hatchAt === undefined ? value : Math.min(value, hatchAt)\n const worked = evidence?.value ?? 0\n const evEnd = worked + (evidence?.agent ?? 0)\n const proposedEnd = evEnd + (evidence?.proposed ?? 0)\n const gapTo = Math.min(evEnd, max)\n const showGap = gap && evidence !== undefined && gapTo - value >= step\n\n const ruler: number[] = []\n for (let h = Math.floor(min) + 1; h < max; h++) ruler.push(h)\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>) => {\n if (disabled) return\n const by = e.shiftKey ? step * BIG_STEP : step\n const next: number | undefined = {\n ArrowRight: value + by,\n ArrowUp: value + by,\n ArrowLeft: value - by,\n ArrowDown: value - by,\n PageUp: value + step * BIG_STEP,\n PageDown: value - step * BIG_STEP,\n Home: min,\n End: max,\n }[e.key]\n // preventDefault also skips Radix's own key handling, which would commit on every step.\n if (next !== undefined) {\n e.preventDefault()\n const v = next === max ? max : snap(next)\n if (v !== value) onValueChange(v)\n } else if (e.key === \"Enter\") {\n e.preventDefault()\n onValueCommit?.(value)\n } else if (e.key === \"Escape\" && savedValue !== undefined) {\n e.preventDefault()\n if (savedValue !== value) onValueChange(savedValue)\n }\n }\n\n const hueVars =\n hue === undefined\n ? undefined\n : ({\n \"--billing-slider-hue-fill-strong\": `var(--paper-hue-${hue}-fill-strong)`,\n \"--billing-slider-hue-ink\": `var(--paper-hue-${hue}-ink)`,\n } as React.CSSProperties)\n\n const markLabels = marks.filter((m) => {\n const p = pct(m.value)\n // shortcut: hides a mark's text near either end so it can't collide with the floor or end text; measure the labels if that ever clips.\n return m.label != null && p > 18 && p < 72\n })\n\n return (\n <div\n ref={ref}\n data-slot=\"billing-slider\"\n data-size={size}\n data-status={status}\n data-disabled={disabled ? \"\" : undefined}\n className={cn(styles.root, className)}\n style={{ ...hueVars, ...style }}\n {...props}\n >\n <SliderPrimitive.Root\n className={styles.slider}\n value={[value]}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n onValueChange={([v]) => onValueChange(v)}\n onValueCommit={([v]) => onValueCommit?.(v)}\n onKeyDown={onKeyDown}\n >\n <SliderPrimitive.Track data-slot=\"billing-slider-track\" className={styles.track}>\n <span className={styles.ruler} aria-hidden>\n {ruler.map((h) => (\n <i key={h} style={{ left: `${pct(h)}%` }} />\n ))}\n </span>\n <span data-slot=\"billing-slider-fill\" className={styles.fill} style={{ width: `${pct(fillTo)}%` }} />\n {hatchAt !== undefined && value > hatchAt && (\n <span data-slot=\"billing-slider-past\" className={styles.past} style={at(hatchAt, value)} />\n )}\n {showGap && <span data-slot=\"billing-slider-gap\" className={styles.gap} style={at(value, gapTo)} />}\n {evidence && worked > min && (\n <span data-slot=\"billing-slider-evidence\" className={styles.evidence} style={{ width: `${pct(worked)}%` }} />\n )}\n {evidence?.agent && evEnd > min ? (\n <span data-slot=\"billing-slider-agent\" className={styles.agent} style={at(Math.max(worked, min), evEnd)} />\n ) : null}\n {evidence?.proposed && proposedEnd > min ? (\n <span data-slot=\"billing-slider-proposed\" className={styles.proposed} style={at(Math.max(evEnd, min), proposedEnd)} />\n ) : null}\n {marks.map((m, i) => (\n <span key={i} data-slot=\"billing-slider-mark\" className={styles.mark} style={{ left: `${pct(m.value)}%` }} />\n ))}\n {evidence && evEnd >= min && (\n <span\n data-slot=\"billing-slider-tick\"\n data-out={evEnd > max ? \"\" : undefined}\n className={styles.tick}\n style={{ left: `${pct(evEnd)}%` }}\n />\n )}\n {evidence?.proposed && proposedEnd >= min && proposedEnd <= max ? (\n <span\n data-slot=\"billing-slider-tick\"\n data-variant=\"proposed\"\n className={styles.tick}\n style={{ left: `${pct(proposedEnd)}%` }}\n />\n ) : null}\n </SliderPrimitive.Track>\n <SliderPrimitive.Thumb\n data-slot=\"billing-slider-thumb\"\n className={styles.thumb}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-valuetext={(valueText ?? formatValue)(value)}\n >\n <span className={styles.bubble} aria-hidden>\n {formatValue(value)}\n </span>\n </SliderPrimitive.Thumb>\n </SliderPrimitive.Root>\n <div data-slot=\"billing-slider-labels\" className={styles.labels}>\n <span style={{ left: 0 }}>\n {minLabel} <b>{formatValue(min)}</b>\n </span>\n {markLabels.map((m, i) => (\n <span key={i} data-align=\"center\" style={{ left: `${pct(m.value)}%` }}>\n {m.label} <b>{formatValue(m.value)}</b>\n </span>\n ))}\n <span style={{ right: 0 }}>\n {maxLabel} <b>{formatValue(max)}</b>\n </span>\n </div>\n </div>\n )\n }\n)\nBillingSlider.displayName = \"BillingSlider\"\n\nexport { BillingSlider }\n"
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
"path": "components/ui/billing-slider/billing-slider.module.css",
|
|
1443
|
+
"type": "registry:ui",
|
|
1444
|
+
"content": "/*\n * BillingSlider: how many hours a package bills. The track starts at the floor,\n * fills in the hue's strong fill to the thumb, stripes past the hatch mark,\n * carries the evidence along its foot and ends at the caller's max.\n * `hue` sets --billing-slider-hue-fill-strong / -ink from Paper's project hues;\n * without them (or on another theme) the slider falls back to neutrals.\n * Geometry is the LO-345 frame (the billing slider in the Client Money frames).\n */\n.root {\n --_fill: var(--billing-slider-hue-fill-strong, var(--surface-interactive-active, #e5e7eb));\n --_ink: var(--billing-slider-hue-ink, var(--text-primary, #111827));\n --_gap: var(--billing-slider-gap-color, var(--color-success-600, #16a34a));\n --_hatch: 4px;\n --_rail-h: 40px;\n --_rail-r: 13px;\n --_thumb-w: 26px;\n --_thumb-h: 52px;\n --_grip-inset: 16px;\n --_foot-h: 5px;\n --_ring: 3px;\n display: block;\n min-width: 0;\n font-variant-numeric: tabular-nums;\n}\n\n.root[data-size=\"lg\"] {\n --_rail-h: 56px;\n --_rail-r: 16px;\n --_thumb-w: 30px;\n --_thumb-h: 70px;\n --_grip-inset: 24px;\n --_foot-h: 7px;\n}\n\n.slider {\n position: relative;\n display: flex;\n align-items: center;\n height: var(--_rail-h);\n touch-action: none;\n user-select: none;\n cursor: pointer;\n}\n\n.root[data-disabled] .slider {\n cursor: not-allowed;\n}\n\n.track {\n position: relative;\n flex-grow: 1;\n height: 100%;\n border-radius: var(--_rail-r);\n background: var(--billing-slider-track-bg, color-mix(in srgb, var(--text-primary, #111827) 7%, transparent));\n}\n\n.track > * {\n position: absolute;\n}\n\n/* One hairline per whole unit along the top edge. */\n.ruler {\n inset: 0;\n border-radius: var(--_rail-r);\n overflow: hidden;\n}\n\n.ruler i {\n position: absolute;\n top: 0;\n width: 1px;\n height: 7px;\n background: color-mix(in srgb, var(--text-primary, #111827) 26%, transparent);\n}\n\n.fill {\n top: 0;\n bottom: 0;\n left: 0;\n border-radius: var(--_rail-r) 0 0 var(--_rail-r);\n background: var(--_fill);\n}\n\n/* Past the hatch mark (the package's high): ink stripes. */\n.past {\n top: 0;\n bottom: 0;\n background: repeating-linear-gradient(\n 135deg,\n color-mix(in srgb, var(--_ink) 55%, transparent) 0 var(--_hatch),\n transparent var(--_hatch) calc(var(--_hatch) * 2)\n );\n}\n\n/* The gap between the thumb and the evidence tick: money at stake. */\n.gap {\n top: 0;\n bottom: 0;\n background: repeating-linear-gradient(\n 135deg,\n var(--_gap) 0 var(--_hatch),\n color-mix(in srgb, var(--_gap) 30%, transparent) var(--_hatch) calc(var(--_hatch) * 2)\n );\n}\n\n/* Evidence along the foot: worked solid, agent dotted, proposed pale. */\n.evidence,\n.agent,\n.proposed {\n bottom: 0;\n height: var(--_foot-h);\n}\n\n.evidence {\n left: 0;\n border-radius: 0 0 0 var(--_rail-r);\n background: var(--_ink);\n}\n\n.agent {\n background: repeating-linear-gradient(90deg, var(--_ink) 0 3px, transparent 3px 5px);\n}\n\n.proposed {\n background: color-mix(in srgb, var(--_ink) 30%, transparent);\n}\n\n/* A mark: a notch across the track, proud of it by 4px. Not a stop. */\n.mark {\n top: -4px;\n bottom: -4px;\n width: 2px;\n margin-left: -1px;\n border-radius: 2px;\n background: color-mix(in srgb, var(--text-primary, #111827) 55%, transparent);\n}\n\n/* The evidence tick, full height. */\n.tick {\n top: 3px;\n bottom: 3px;\n width: 3px;\n margin-left: -1.5px;\n border-radius: 3px;\n background: var(--_ink);\n}\n\n.tick[data-variant=\"proposed\"] {\n width: 0;\n margin-left: -1px;\n border-radius: 0;\n background: none;\n border-left: 2px dashed color-mix(in srgb, var(--_ink) 55%, transparent);\n}\n\n/* Evidence past the end: an arrow at the end instead of a tick. */\n.tick[data-out] {\n top: 50%;\n bottom: auto;\n width: 0;\n height: 0;\n margin: -6px 0 0 -2px;\n border: 6px solid transparent;\n border-left: 8px solid var(--_ink);\n border-radius: 0;\n background: none;\n}\n\n/*\n * The thumb is 2px wide so Radix centres it on the value (it shifts a wide thumb\n * inward by up to half its width to keep it inside the track; at 2px that is 1px).\n * The pill is drawn around it, overhanging the track's ends as the frame does.\n */\n.thumb {\n position: relative;\n display: block;\n width: 2px;\n height: var(--_thumb-h);\n outline: none;\n cursor: grab;\n}\n\n.thumb::before {\n content: \"\";\n position: absolute;\n inset: 0 calc(50% - var(--_thumb-w) / 2);\n border-radius: calc(var(--_thumb-w) / 2);\n background: var(--billing-slider-thumb-bg, var(--surface-popover, #ffffff));\n box-shadow: 0 0 0 var(--_ring) var(--_ink), var(--shadow-md);\n}\n\n/* Two grip lines down the middle of the pill. */\n.thumb::after {\n content: \"\";\n position: absolute;\n top: var(--_grip-inset);\n bottom: var(--_grip-inset);\n left: calc(50% - 4px);\n width: 2px;\n border-radius: 2px;\n background: var(--billing-slider-thumb-grip, color-mix(in srgb, var(--_ink) 45%, transparent));\n box-shadow: 6px 0 0 var(--billing-slider-thumb-grip, color-mix(in srgb, var(--_ink) 45%, transparent));\n}\n\n.slider:active .thumb {\n cursor: grabbing;\n}\n\n.thumb:focus-visible::before {\n box-shadow: 0 0 0 var(--_ring) var(--_ink),\n 0 0 0 calc(var(--_ring) + var(--focus-ring-offset, 2px) + var(--focus-ring-width, 2px)) var(--border-focus, #111827),\n var(--shadow-md);\n}\n\n.root[data-disabled] .thumb {\n cursor: not-allowed;\n}\n\n.root[data-disabled] .thumb::before {\n box-shadow: 0 0 0 var(--_ring) color-mix(in srgb, var(--_ink) 35%, transparent);\n}\n\n.root[data-status=\"saving\"] .thumb::before {\n animation: pulse var(--motion-duration-1000, 1000ms) var(--motion-easing-default, ease-in-out) infinite;\n}\n\n@keyframes pulse {\n 50% {\n box-shadow: 0 0 0 6px color-mix(in srgb, var(--_ink) 30%, transparent), var(--shadow-md);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .root[data-status=\"saving\"] .thumb::before {\n animation: none;\n }\n}\n\n/* The value bubble: shown while the thumb has focus (dragging focuses it). */\n.bubble {\n position: absolute;\n bottom: calc(100% + 8px);\n left: 50%;\n transform: translateX(-50%) scale(0.9);\n opacity: 0;\n padding: calc(var(--spacing-1, 0.25rem) * 1.25) calc(var(--spacing-2, 0.5rem) * 1.25);\n border-radius: 10px;\n background: var(--text-primary, #111827);\n color: var(--surface-page, #ffffff);\n font-size: var(--font-size-xs, 0.75rem);\n line-height: 18px;\n font-weight: var(--font-weight-bold, 700);\n white-space: nowrap;\n pointer-events: none;\n transition: opacity var(--motion-duration-150, 150ms) var(--motion-easing-default, ease-in-out),\n transform var(--motion-duration-150, 150ms) var(--motion-easing-default, ease-in-out);\n}\n\n.thumb:focus .bubble {\n opacity: 1;\n transform: translateX(-50%) scale(1);\n}\n\n/* Labels under the track: the floor at the left, marks at their place, the end at the right. */\n.labels {\n position: relative;\n height: 18px;\n margin-top: calc(var(--spacing-1, 0.25rem) * 2.25);\n font-size: var(--font-size-xs, 0.75rem);\n line-height: 18px;\n font-weight: var(--font-weight-medium, 500);\n color: var(--text-secondary, #4b5563);\n}\n\n.labels span {\n position: absolute;\n top: 0;\n white-space: nowrap;\n}\n\n.labels span[data-align=\"center\"] {\n transform: translateX(-50%);\n}\n\n.labels b {\n color: var(--text-primary, #111827);\n font-weight: var(--font-weight-bold, 700);\n}\n"
|
|
1445
|
+
}
|
|
1446
|
+
]
|
|
1447
|
+
},
|
|
1341
1448
|
{
|
|
1342
1449
|
"name": "slider",
|
|
1343
1450
|
"type": "registry:ui",
|
|
@@ -2733,7 +2840,7 @@
|
|
|
2733
2840
|
"description": "A generic Tanstack-powered data table compound that composes Visor's table primitive. Handles client-side sorting, pagination, row selection, global filter, sticky header, loading skeleton rows, and a pluggable empty state.",
|
|
2734
2841
|
"category": "admin",
|
|
2735
2842
|
"dependencies": [
|
|
2736
|
-
"@tanstack/react-table",
|
|
2843
|
+
"@tanstack/react-table@^8.21.3",
|
|
2737
2844
|
"@phosphor-icons/react",
|
|
2738
2845
|
"class-variance-authority",
|
|
2739
2846
|
"@loworbitstudio/visor-core"
|
|
@@ -4194,12 +4301,12 @@
|
|
|
4194
4301
|
{
|
|
4195
4302
|
"path": "blocks/admin-shell/admin-shell.tsx",
|
|
4196
4303
|
"type": "registry:block",
|
|
4197
|
-
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"../../lib/utils\"\nimport styles from \"./admin-shell.module.css\"\n\nexport interface AdminShellProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Branding slot at the top of the sidebar (logo, wordmark, product switcher). */\n logo?: React.ReactNode\n /** Navigation content rendered in the sidebar body. Consumer provides their own link list. */\n sidebarNav: React.ReactNode\n /** Bottom-of-sidebar slot (user menu, logout, theme toggle, etc.). */\n sidebarFooter?: React.ReactNode\n /** Sidebar width. Number is treated as pixels; strings pass through. Default 256. */\n sidebarWidth?: number | string\n\n /** Breadcrumb component instance rendered at the start of the topbar. */\n breadcrumb?: React.ReactNode\n /** Left side of the topbar, after the breadcrumb. */\n topbarStart?: React.ReactNode\n /** Center slot (status indicators, search, realtime signals). */\n topbarCenter?: React.ReactNode\n /** Right side of the topbar (user menu, theme toggle, quick actions). */\n topbarEnd?: React.ReactNode\n /** When true, the topbar is not rendered. Default false. */\n hideTopbar?: boolean\n\n /** Main content. */\n children: React.ReactNode\n /** Optional max-width for the main content area. Number is treated as pixels. */\n mainMaxWidth?: number | string\n /** Padding scale applied to the main content area. Default \"lg\". */\n mainPadding?: \"none\" | \"sm\" | \"md\" | \"lg\"\n}\n\nfunction resolveSize(value: number | string | undefined, fallback: string): string {\n if (value == null) return fallback\n return typeof value === \"number\" ? `${value}px` : value\n}\n\nexport function AdminShell({\n logo,\n sidebarNav,\n sidebarFooter,\n sidebarWidth = 256,\n breadcrumb,\n topbarStart,\n topbarCenter,\n topbarEnd,\n hideTopbar = false,\n children,\n mainMaxWidth,\n mainPadding = \"lg\",\n className,\n style,\n ...props\n}: AdminShellProps) {\n const resolvedSidebarWidth = resolveSize(sidebarWidth, \"16rem\")\n const resolvedMaxWidth = resolveSize(mainMaxWidth, \"none\")\n\n const shellStyle = {\n ...style,\n [\"--admin-shell-sidebar-width\" as string]: resolvedSidebarWidth,\n [\"--admin-shell-main-max-width\" as string]: resolvedMaxWidth,\n } as React.CSSProperties\n\n return (\n <div\n className={cn(styles.root, className)}\n style={shellStyle}\n data-slot=\"admin-shell\"\n {...props}\n >\n <a href=\"#admin-main-content\" className={styles.skipLink}>\n Skip to main content\n </a>\n\n <aside\n className={styles.sidebar}\n data-slot=\"admin-shell-sidebar\"\n aria-label=\"Primary navigation\"\n >\n {logo ? (\n <div className={styles.sidebarHeader} data-slot=\"admin-shell-sidebar-header\">\n {logo}\n </div>\n ) : null}\n <nav\n className={styles.sidebarNav}\n data-slot=\"admin-shell-sidebar-nav\"\n aria-label=\"Sidebar\"\n >\n {sidebarNav}\n </nav>\n {sidebarFooter ? (\n <div className={styles.sidebarFooter} data-slot=\"admin-shell-sidebar-footer\">\n {sidebarFooter}\n </div>\n ) : null}\n </aside>\n\n <div className={styles.body} data-slot=\"admin-shell-body\">\n {!hideTopbar ? (\n <header\n role=\"banner\"\n className={styles.topbar}\n data-slot=\"admin-shell-topbar\"\n >\n <div className={styles.topbarStart}>\n {breadcrumb}\n {topbarStart}\n </div>\n <div className={styles.topbarCenter}>{topbarCenter}</div>\n <div className={styles.topbarEnd}>{topbarEnd}</div>\n </header>\n ) : null}\n\n <main\n id=\"admin-main-content\"\n role=\"main\"\n className={styles.main}\n data-slot=\"admin-shell-main\"\n data-padding={mainPadding}\n tabIndex={-1}\n >\n <div className={styles.mainInner}>{children}</div>\n </main>\n </div>\n </div>\n )\n}\n"
|
|
4304
|
+
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"../../lib/utils\"\nimport styles from \"./admin-shell.module.css\"\n\nexport interface AdminShellProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Branding slot at the top of the sidebar (logo, wordmark, product switcher). */\n logo?: React.ReactNode\n /** Navigation content rendered in the sidebar body. Consumer provides their own link list. */\n sidebarNav: React.ReactNode\n /** Bottom-of-sidebar slot (user menu, logout, theme toggle, etc.). */\n sidebarFooter?: React.ReactNode\n /** Sidebar width. Number is treated as pixels; strings pass through. Default 256. */\n sidebarWidth?: number | string\n\n /**\n * When true, the sidebar folds to an icon rail and back, from a button beside\n * the logo or the `collapseShortcut` key. The shell and its sidebar carry\n * `data-collapsed`, so a slot can hide its labels. Desk only: below 48rem the\n * sidebar stays open and the button is not drawn. Default false.\n */\n collapsible?: boolean\n /** Uncontrolled initial state, used when nothing is remembered. Default false. */\n defaultCollapsed?: boolean\n /** Controlled state. Pair with `onCollapsedChange`. */\n collapsed?: boolean\n /** Called with the next state when the button or the key folds or opens the sidebar. */\n onCollapsedChange?: (collapsed: boolean) => void\n /** Key pressed with ⌘ (Ctrl off a Mac) that folds and opens the sidebar. `false` turns it off. Default \"\\\\\". */\n collapseShortcut?: string | false\n /** localStorage key that remembers the state per browser. Omit to remember nothing. */\n storageKey?: string\n\n /** Breadcrumb component instance rendered at the start of the topbar. */\n breadcrumb?: React.ReactNode\n /** Left side of the topbar, after the breadcrumb. */\n topbarStart?: React.ReactNode\n /** Center slot (status indicators, search, realtime signals). */\n topbarCenter?: React.ReactNode\n /** Right side of the topbar (user menu, theme toggle, quick actions). */\n topbarEnd?: React.ReactNode\n /** When true, the topbar is not rendered. Default false. */\n hideTopbar?: boolean\n\n /** Main content. */\n children: React.ReactNode\n /** Optional max-width for the main content area. Number is treated as pixels. */\n mainMaxWidth?: number | string\n /** Padding scale applied to the main content area. Default \"lg\". */\n mainPadding?: \"none\" | \"sm\" | \"md\" | \"lg\"\n}\n\n// The rail is desk-only; this matches the shell's narrow container query.\nconst NARROW_QUERY = \"(max-width: 48rem)\"\n\nfunction subscribeNarrow(callback: () => void) {\n const mql = window.matchMedia(NARROW_QUERY)\n mql.addEventListener(\"change\", callback)\n return () => mql.removeEventListener(\"change\", callback)\n}\n\nconst getNarrow = () => window.matchMedia(NARROW_QUERY).matches\nconst getFalse = () => false\n\nfunction subscribeStorage(callback: () => void) {\n window.addEventListener(\"storage\", callback)\n return () => window.removeEventListener(\"storage\", callback)\n}\n\n// A private window or blocked storage throws; the shell then just opens expanded.\nfunction readStored(key: string | undefined): boolean | null {\n if (!key) return null\n try {\n const value = window.localStorage.getItem(key)\n return value === \"rail\" ? true : value === \"open\" ? false : null\n } catch {\n return null\n }\n}\n\nfunction writeStored(key: string | undefined, collapsed: boolean) {\n if (!key) return\n try {\n window.localStorage.setItem(key, collapsed ? \"rail\" : \"open\")\n } catch {\n // Not remembered in a private window.\n }\n}\n\nfunction resolveSize(value: number | string | undefined, fallback: string): string {\n if (value == null) return fallback\n return typeof value === \"number\" ? `${value}px` : value\n}\n\nexport function AdminShell({\n logo,\n sidebarNav,\n sidebarFooter,\n sidebarWidth = 256,\n collapsible = false,\n defaultCollapsed = false,\n collapsed: collapsedProp,\n onCollapsedChange,\n collapseShortcut = \"\\\\\",\n storageKey,\n breadcrumb,\n topbarStart,\n topbarCenter,\n topbarEnd,\n hideTopbar = false,\n children,\n mainMaxWidth,\n mainPadding = \"lg\",\n className,\n style,\n ...props\n}: AdminShellProps) {\n const narrow = React.useSyncExternalStore(subscribeNarrow, getNarrow, getFalse)\n const stored = React.useSyncExternalStore(\n subscribeStorage,\n () => readStored(storageKey),\n () => null\n )\n const [localCollapsed, setLocalCollapsed] = React.useState<boolean | null>(null)\n // Only a toggle animates; restoring the remembered state on load does not.\n const [animate, setAnimate] = React.useState(false)\n const sidebarId = React.useId()\n\n const isCollapsed = collapsedProp ?? localCollapsed ?? stored ?? defaultCollapsed\n const canFold = collapsible && !narrow\n const railed = canFold && isCollapsed\n\n const toggle = React.useCallback(() => {\n const next = !isCollapsed\n setAnimate(true)\n if (collapsedProp === undefined) setLocalCollapsed(next)\n writeStored(storageKey, next)\n onCollapsedChange?.(next)\n }, [isCollapsed, collapsedProp, storageKey, onCollapsedChange])\n\n React.useEffect(() => {\n if (!canFold || collapseShortcut === false) return\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === collapseShortcut && (event.metaKey || event.ctrlKey) && !event.altKey) {\n event.preventDefault()\n toggle()\n }\n }\n window.addEventListener(\"keydown\", onKeyDown)\n return () => window.removeEventListener(\"keydown\", onKeyDown)\n }, [canFold, collapseShortcut, toggle])\n\n const collapsedAttr = collapsible ? String(railed) : undefined\n const toggleLabel = railed ? \"Expand the sidebar\" : \"Collapse the sidebar\"\n\n const resolvedSidebarWidth = resolveSize(sidebarWidth, \"16rem\")\n const resolvedMaxWidth = resolveSize(mainMaxWidth, \"none\")\n\n const shellStyle = {\n ...style,\n [\"--admin-shell-sidebar-width\" as string]: resolvedSidebarWidth,\n [\"--admin-shell-main-max-width\" as string]: resolvedMaxWidth,\n } as React.CSSProperties\n\n return (\n <div\n className={cn(styles.root, className)}\n style={shellStyle}\n data-slot=\"admin-shell\"\n data-collapsed={collapsedAttr}\n data-animate={animate ? \"\" : undefined}\n {...props}\n >\n <a href=\"#admin-main-content\" className={styles.skipLink}>\n Skip to main content\n </a>\n\n <aside\n id={sidebarId}\n className={styles.sidebar}\n data-slot=\"admin-shell-sidebar\"\n data-collapsed={collapsedAttr}\n aria-label=\"Primary navigation\"\n >\n {logo || canFold ? (\n <div className={styles.sidebarHeader} data-slot=\"admin-shell-sidebar-header\">\n {logo}\n {canFold ? (\n <button\n type=\"button\"\n className={styles.collapseButton}\n data-slot=\"admin-shell-collapse\"\n aria-expanded={!railed}\n aria-controls={sidebarId}\n aria-label={toggleLabel}\n aria-keyshortcuts={\n collapseShortcut === false\n ? undefined\n : `Meta+${collapseShortcut} Control+${collapseShortcut}`\n }\n title={toggleLabel}\n onClick={toggle}\n >\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <rect x=\"2\" y=\"2.5\" width=\"12\" height=\"11\" rx=\"2.5\" />\n <path d=\"M6.5 2.5v11M11 6.5 9.5 8l1.5 1.5\" />\n </svg>\n </button>\n ) : null}\n </div>\n ) : null}\n <nav\n className={styles.sidebarNav}\n data-slot=\"admin-shell-sidebar-nav\"\n aria-label=\"Sidebar\"\n >\n {sidebarNav}\n </nav>\n {sidebarFooter ? (\n <div className={styles.sidebarFooter} data-slot=\"admin-shell-sidebar-footer\">\n {sidebarFooter}\n </div>\n ) : null}\n </aside>\n\n <div className={styles.body} data-slot=\"admin-shell-body\">\n {!hideTopbar ? (\n <header\n role=\"banner\"\n className={styles.topbar}\n data-slot=\"admin-shell-topbar\"\n >\n <div className={styles.topbarStart}>\n {breadcrumb}\n {topbarStart}\n </div>\n <div className={styles.topbarCenter}>{topbarCenter}</div>\n <div className={styles.topbarEnd}>{topbarEnd}</div>\n </header>\n ) : null}\n\n <main\n id=\"admin-main-content\"\n role=\"main\"\n className={styles.main}\n data-slot=\"admin-shell-main\"\n data-padding={mainPadding}\n tabIndex={-1}\n >\n <div className={styles.mainInner}>{children}</div>\n </main>\n </div>\n </div>\n )\n}\n"
|
|
4198
4305
|
},
|
|
4199
4306
|
{
|
|
4200
4307
|
"path": "blocks/admin-shell/admin-shell.module.css",
|
|
4201
4308
|
"type": "registry:block",
|
|
4202
|
-
"content": ".root {\n display: flex;\n min-height: 100vh;\n width: 100%;\n background: var(--surface-page, #f9fafb);\n color: var(--text-primary, #111827);\n container-type: inline-size;\n}\n\n/* Accessibility: skip link — visible only on keyboard focus */\n.skipLink {\n position: absolute;\n top: var(--spacing-2, 0.5rem);\n left: var(--spacing-2, 0.5rem);\n z-index: 100;\n padding: var(--spacing-2, 0.5rem) var(--spacing-3, 0.75rem);\n background: var(--surface-card, #ffffff);\n color: var(--text-primary, #111827);\n border: 1px solid var(--border-default, #e5e7eb);\n border-radius: var(--radius-md, 0.5rem);\n box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));\n font-size: var(--font-size-sm, 0.875rem);\n font-weight: 500;\n text-decoration: none;\n transform: translateY(-150%);\n transition:\n transform var(--motion-duration-fast, 150ms)\n var(--motion-easing-standard, ease);\n}\n\n.skipLink:focus-visible {\n transform: translateY(0);\n outline: var(--focus-ring-width, 2px) solid\n var(--focus-ring-color, var(--primary, #3b82f6));\n outline-offset: var(--focus-ring-offset, 2px);\n}\n\n/* Sidebar */\n.sidebar {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n width: var(--admin-shell-sidebar-width, 16rem);\n min-height: 100vh;\n background: var(--surface-card, #ffffff);\n border-right: 1px solid var(--border-default, #e5e7eb);\n position: sticky;\n top: 0;\n max-height: 100vh;\n}\n\n.sidebarHeader {\n display: flex;\n align-items: center;\n padding: var(--spacing-4, 1rem) var(--spacing-5, 1.25rem);\n border-bottom: 1px solid var(--border-muted, #e5e7eb);\n min-height: 3.5rem;\n flex-shrink: 0;\n}\n\n.sidebarNav {\n flex: 1 1 auto;\n overflow-y: auto;\n padding: var(--spacing-4, 1rem) var(--spacing-3, 0.75rem);\n display: flex;\n flex-direction: column;\n gap: var(--spacing-1, 0.25rem);\n}\n\n.sidebarFooter {\n flex-shrink: 0;\n padding: var(--spacing-3, 0.75rem) var(--spacing-4, 1rem);\n border-top: 1px solid var(--border-muted, #e5e7eb);\n}\n\n/* Body = topbar + main */\n.body {\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-width: 0;\n min-height: 100vh;\n}\n\n/* Topbar */\n.topbar {\n display: flex;\n align-items: center;\n gap: var(--spacing-4, 1rem);\n padding: var(--spacing-3, 0.75rem) var(--spacing-6, 1.5rem);\n min-height: 3.5rem;\n background: var(--surface-card, #ffffff);\n border-bottom: 1px solid var(--border-default, #e5e7eb);\n position: sticky;\n top: 0;\n z-index: 10;\n}\n\n.topbarStart {\n display: flex;\n align-items: center;\n gap: var(--spacing-3, 0.75rem);\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.topbarCenter {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-3, 0.75rem);\n flex: 0 1 auto;\n}\n\n.topbarEnd {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--spacing-2, 0.5rem);\n flex: 1 1 auto;\n min-width: 0;\n}\n\n/* Main */\n.main {\n flex: 1 1 auto;\n overflow-y: auto;\n min-width: 0;\n outline: none;\n}\n\n.main:focus-visible {\n outline: var(--focus-ring-width, 2px) solid\n var(--focus-ring-color, var(--primary, #3b82f6));\n outline-offset: calc(var(--focus-ring-offset, 2px) * -1);\n}\n\n.main[data-padding=\"none\"] .mainInner {\n padding: 0;\n}\n\n.main[data-padding=\"sm\"] .mainInner {\n padding: var(--spacing-4, 1rem);\n}\n\n.main[data-padding=\"md\"] .mainInner {\n padding: var(--spacing-6, 1.5rem);\n}\n\n.main[data-padding=\"lg\"] .mainInner {\n padding: var(--spacing-8, 2rem);\n}\n\n.mainInner {\n width: 100%;\n max-width: var(--admin-shell-main-max-width, none);\n margin: 0 auto;\n}\n\n/* Responsive: collapse sidebar on narrow containers */\n@container (max-width: 48rem) {\n .topbar {\n padding-left: var(--spacing-4, 1rem);\n padding-right: var(--spacing-4, 1rem);\n }\n\n .main[data-padding=\"lg\"] .mainInner {\n padding: var(--spacing-5, 1.25rem);\n }\n\n .main[data-padding=\"md\"] .mainInner {\n padding: var(--spacing-4, 1rem);\n }\n}\n"
|
|
4309
|
+
"content": ".root {\n display: flex;\n min-height: 100vh;\n width: 100%;\n background: var(--surface-page, #f9fafb);\n color: var(--text-primary, #111827);\n container-type: inline-size;\n}\n\n/* Accessibility: skip link — visible only on keyboard focus */\n.skipLink {\n position: absolute;\n top: var(--spacing-2, 0.5rem);\n left: var(--spacing-2, 0.5rem);\n z-index: 100;\n padding: var(--spacing-2, 0.5rem) var(--spacing-3, 0.75rem);\n background: var(--surface-card, #ffffff);\n color: var(--text-primary, #111827);\n border: 1px solid var(--border-default, #e5e7eb);\n border-radius: var(--radius-md, 0.5rem);\n box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));\n font-size: var(--font-size-sm, 0.875rem);\n font-weight: 500;\n text-decoration: none;\n transform: translateY(-150%);\n transition:\n transform var(--motion-duration-fast, 150ms)\n var(--motion-easing-standard, ease);\n}\n\n.skipLink:focus-visible {\n transform: translateY(0);\n outline: var(--focus-ring-width, 2px) solid\n var(--focus-ring-color, var(--primary, #3b82f6));\n outline-offset: var(--focus-ring-offset, 2px);\n}\n\n/* Sidebar */\n.sidebar {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n width: var(--admin-shell-sidebar-width, 16rem);\n min-height: 100vh;\n background: var(--surface-card, #ffffff);\n border-right: var(--admin-shell-sidebar-border, 1px solid var(--border-default, #e5e7eb));\n position: sticky;\n top: 0;\n max-height: 100vh;\n}\n\n.sidebarHeader {\n display: flex;\n align-items: center;\n padding: var(--spacing-4, 1rem) var(--spacing-5, 1.25rem);\n border-bottom: var(--admin-shell-sidebar-header-border, 1px solid var(--border-muted, #e5e7eb));\n min-height: 3.5rem;\n flex-shrink: 0;\n}\n\n.sidebarNav {\n flex: 1 1 auto;\n overflow-y: auto;\n padding: var(--spacing-4, 1rem) var(--spacing-3, 0.75rem);\n display: flex;\n flex-direction: column;\n gap: var(--spacing-1, 0.25rem);\n}\n\n.sidebarFooter {\n flex-shrink: 0;\n padding: var(--spacing-3, 0.75rem) var(--spacing-4, 1rem);\n border-top: var(--admin-shell-sidebar-footer-border, 1px solid var(--border-muted, #e5e7eb));\n}\n\n/* Collapsible: the sidebar folds to an icon rail (VI-770) */\n.sidebar[data-collapsed] {\n overflow-x: clip;\n}\n\n.root[data-animate] .sidebar {\n transition: width var(--admin-shell-rail-duration, var(--motion-duration-slow, 500ms))\n var(--admin-shell-rail-easing, var(--motion-easing-default, ease));\n}\n\n.sidebar[data-collapsed=\"true\"] {\n width: var(--admin-shell-rail-width, 4.25rem);\n}\n\n.collapseButton {\n display: inline-grid;\n place-items: center;\n flex: none;\n width: var(--spacing-8, 2rem);\n height: var(--spacing-8, 2rem);\n margin-left: auto;\n padding: 0;\n border: 0;\n border-radius: var(--radius-sm, 0.375rem);\n background: transparent;\n color: var(--text-secondary, #4b5563);\n cursor: pointer;\n}\n\n.collapseButton:hover {\n background: var(--interactive-ghost-bg-hover, var(--surface-muted, #f3f4f6));\n color: var(--text-primary, #111827);\n}\n\n.collapseButton:focus-visible {\n outline: var(--focus-ring-width, 2px) solid\n var(--focus-ring-color, var(--primary, #3b82f6));\n outline-offset: var(--focus-ring-offset, 2px);\n}\n\n.collapseButton svg {\n transition: transform var(--admin-shell-rail-duration, var(--motion-duration-slow, 500ms))\n var(--admin-shell-rail-easing, var(--motion-easing-default, ease));\n}\n\n.sidebar[data-collapsed=\"true\"] .collapseButton {\n margin-left: 0;\n}\n\n.sidebar[data-collapsed=\"true\"] .collapseButton svg {\n transform: scaleX(-1);\n}\n\n.sidebar[data-collapsed=\"true\"] .sidebarHeader {\n flex-direction: column;\n gap: var(--spacing-2, 0.5rem);\n padding-left: var(--spacing-2, 0.5rem);\n padding-right: var(--spacing-2, 0.5rem);\n}\n\n.sidebar[data-collapsed=\"true\"] .sidebarNav {\n align-items: center;\n padding-left: var(--spacing-2, 0.5rem);\n padding-right: var(--spacing-2, 0.5rem);\n}\n\n.sidebar[data-collapsed=\"true\"] .sidebarFooter {\n display: flex;\n justify-content: center;\n padding-left: var(--spacing-2, 0.5rem);\n padding-right: var(--spacing-2, 0.5rem);\n}\n\n/* A slot marks its labels; the rail hides them visually and keeps them as accessible names. */\n.sidebar[data-collapsed=\"true\"] [data-admin-shell-label] {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .root[data-animate] .sidebar,\n .collapseButton svg {\n transition: none;\n }\n}\n\n/* Body = topbar + main */\n.body {\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-width: 0;\n min-height: 100vh;\n}\n\n/* Topbar */\n.topbar {\n display: flex;\n align-items: center;\n gap: var(--spacing-4, 1rem);\n padding: var(--spacing-3, 0.75rem) var(--spacing-6, 1.5rem);\n min-height: 3.5rem;\n background: var(--admin-shell-topbar-bg, var(--surface-card, #ffffff));\n border-bottom: var(--admin-shell-topbar-border, 1px solid var(--border-default, #e5e7eb));\n position: sticky;\n top: 0;\n z-index: 10;\n}\n\n.topbarStart {\n display: flex;\n align-items: center;\n gap: var(--spacing-3, 0.75rem);\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.topbarCenter {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--spacing-3, 0.75rem);\n flex: 0 1 auto;\n}\n\n.topbarEnd {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--spacing-2, 0.5rem);\n flex: 1 1 auto;\n min-width: 0;\n}\n\n/* Main */\n.main {\n flex: 1 1 auto;\n overflow-y: auto;\n min-width: 0;\n outline: none;\n}\n\n.main:focus-visible {\n outline: var(--focus-ring-width, 2px) solid\n var(--focus-ring-color, var(--primary, #3b82f6));\n outline-offset: calc(var(--focus-ring-offset, 2px) * -1);\n}\n\n.main[data-padding=\"none\"] .mainInner {\n padding: 0;\n}\n\n.main[data-padding=\"sm\"] .mainInner {\n padding: var(--spacing-4, 1rem);\n}\n\n.main[data-padding=\"md\"] .mainInner {\n padding: var(--spacing-6, 1.5rem);\n}\n\n.main[data-padding=\"lg\"] .mainInner {\n padding: var(--spacing-8, 2rem);\n}\n\n.mainInner {\n width: 100%;\n max-width: var(--admin-shell-main-max-width, none);\n margin: 0 auto;\n}\n\n/* Responsive: collapse sidebar on narrow containers */\n@container (max-width: 48rem) {\n .topbar {\n padding-left: var(--spacing-4, 1rem);\n padding-right: var(--spacing-4, 1rem);\n }\n\n .main[data-padding=\"lg\"] .mainInner {\n padding: var(--spacing-5, 1.25rem);\n }\n\n .main[data-padding=\"md\"] .mainInner {\n padding: var(--spacing-4, 1rem);\n }\n}\n"
|
|
4203
4310
|
}
|
|
4204
4311
|
]
|
|
4205
4312
|
},
|
|
@@ -4237,7 +4344,7 @@
|
|
|
4237
4344
|
"description": "CRUD list archetype composing PageHeader, FilterBar, DataTable, BulkActionBar, and EmptyState into a single drop-in page. Generic over row data type, with controlled/uncontrolled search, selection, sorting, and pagination.",
|
|
4238
4345
|
"category": "admin",
|
|
4239
4346
|
"dependencies": [
|
|
4240
|
-
"@tanstack/react-table",
|
|
4347
|
+
"@tanstack/react-table@^8.21.3",
|
|
4241
4348
|
"@loworbitstudio/visor-core"
|
|
4242
4349
|
],
|
|
4243
4350
|
"registryDependencies": [
|
|
@@ -4538,6 +4645,35 @@
|
|
|
4538
4645
|
}
|
|
4539
4646
|
]
|
|
4540
4647
|
},
|
|
4648
|
+
{
|
|
4649
|
+
"name": "kanban-board",
|
|
4650
|
+
"type": "registry:block",
|
|
4651
|
+
"description": "Kanban board: stage columns in one row, cards that move between columns by native drag and drop or by keyboard (Space, Left/Right, Space; Escape cancels), arrow-key focus between cards, a count and total in each column header, and collapsed side rails for parked stages that expand on click and accept drops. Owns no data: the consumer renders the card inside and persists moves in onMove.",
|
|
4652
|
+
"category": "data-display",
|
|
4653
|
+
"dependencies": [
|
|
4654
|
+
"@loworbitstudio/visor-core"
|
|
4655
|
+
],
|
|
4656
|
+
"registryDependencies": [
|
|
4657
|
+
"utils",
|
|
4658
|
+
"card"
|
|
4659
|
+
],
|
|
4660
|
+
"suggestedDependencies": [
|
|
4661
|
+
"status-dot",
|
|
4662
|
+
"chip"
|
|
4663
|
+
],
|
|
4664
|
+
"files": [
|
|
4665
|
+
{
|
|
4666
|
+
"path": "blocks/kanban-board/kanban-board.tsx",
|
|
4667
|
+
"type": "registry:block",
|
|
4668
|
+
"content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"../../lib/utils\"\nimport { Card } from \"../../components/ui/card/card\"\nimport styles from \"./kanban-board.module.css\"\n\nexport interface KanbanBoardItem {\n /** Stable id. `onMove` receives it. */\n id: string\n}\n\nexport interface KanbanBoardColumn<T extends KanbanBoardItem = KanbanBoardItem> {\n /** Stable id. `onMove` receives it as the target column. */\n id: string\n /** Column name, shown uppercase in the header and announced on moves. */\n label: string\n /** Right-aligned header figure (a sum, a value). Format it yourself. */\n total?: React.ReactNode\n /** The cards in this column, in display order. */\n items: T[]\n /** Shown when the column has no cards. */\n empty?: React.ReactNode\n}\n\nexport interface KanbanBoardProps<T extends KanbanBoardItem>\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Columns in board order. Keyboard moves step through this order. */\n columns: KanbanBoardColumn<T>[]\n /** Column ids drawn as collapsed side rails until clicked open. */\n rails?: string[]\n /** The inside of a card. The block supplies the card surface, drag and keys. */\n renderCard: (item: T, column: KanbanBoardColumn<T>) => React.ReactNode\n /** Plain-text name of a card, used in screen reader announcements. */\n getItemLabel: (item: T) => string\n /** Called when a card is dropped on another column, by drag or by keyboard. */\n onMove: (itemId: string, toColumn: string) => void\n /** Called on Enter when no card is held (open the record). */\n onCardOpen?: (item: T) => void\n /** Content under an open column's cards (an Add button, a quick-add form). */\n renderColumnFooter?: (column: KanbanBoardColumn<T>) => React.ReactNode\n}\n\n/**\n * The card to focus for an arrow key: up and down within the column, left and\n * right to the nearest row of the next column that has cards. Null when none.\n */\nexport function neighborCard(columns: string[][], id: string, key: string): string | null {\n const col = columns.findIndex((c) => c.includes(id))\n if (col < 0) return null\n const row = columns[col].indexOf(id)\n if (key === \"ArrowUp\") return columns[col][row - 1] ?? null\n if (key === \"ArrowDown\") return columns[col][row + 1] ?? null\n const step = key === \"ArrowLeft\" ? -1 : key === \"ArrowRight\" ? 1 : 0\n if (!step) return null\n for (let i = col + step; i >= 0 && i < columns.length; i += step) {\n if (columns[i].length) return columns[i][Math.min(row, columns[i].length - 1)]\n }\n return null\n}\n\nexport function KanbanBoard<T extends KanbanBoardItem>({\n columns,\n rails = [],\n renderCard,\n getItemLabel,\n onMove,\n onCardOpen,\n renderColumnFooter,\n className,\n ...rest\n}: KanbanBoardProps<T>) {\n const rootRef = React.useRef<HTMLDivElement>(null)\n const hintId = React.useId()\n const [openRails, setOpenRails] = React.useState<string[]>([])\n const [dragId, setDragId] = React.useState<string | null>(null)\n const [over, setOver] = React.useState<string | null>(null)\n const [grab, setGrab] = React.useState<{ id: string; to: string } | null>(null)\n const [focusId, setFocusId] = React.useState<string | null>(null)\n const [live, setLive] = React.useState(\"\")\n\n const homeOf = new Map<string, KanbanBoardColumn<T>>()\n for (const column of columns) for (const item of column.items) homeOf.set(item.id, column)\n const labelOf = (columnId: string) => columns.find((c) => c.id === columnId)?.label ?? columnId\n const isCollapsed = (columnId: string) => rails.includes(columnId) && !openRails.includes(columnId)\n const cardEl = (id: string) =>\n Array.from(rootRef.current?.querySelectorAll<HTMLElement>(\"[data-card-id]\") ?? []).find(\n (el) => el.dataset.cardId === id\n )\n\n // A moved card remounts in its new column; put focus back on it unless the\n // user has already moved focus somewhere outside the board.\n React.useEffect(() => {\n if (!focusId) return\n const active = document.activeElement\n if (active && active !== document.body && !rootRef.current?.contains(active)) return\n const el = cardEl(focusId)\n if (el && el !== active) el.focus()\n }, [focusId, columns, openRails])\n\n function move(itemId: string, to: string) {\n const from = homeOf.get(itemId)\n // Ignore drops that are not one of this board's cards (text dragged in from elsewhere).\n if (!from || from.id === to) return\n const item = from.items.find((i) => i.id === itemId)!\n setLive(`${getItemLabel(item)} moved to ${labelOf(to)}.`)\n onMove(itemId, to)\n }\n\n function onCardKey(e: React.KeyboardEvent<HTMLDivElement>, item: T, column: KanbanBoardColumn<T>) {\n const name = getItemLabel(item)\n if (grab?.id === item.id) {\n e.preventDefault()\n if (e.key === \"ArrowLeft\" || e.key === \"ArrowRight\") {\n const i = columns.findIndex((c) => c.id === grab.to) + (e.key === \"ArrowLeft\" ? -1 : 1)\n const to = columns[Math.max(0, Math.min(columns.length - 1, i))].id\n setGrab({ id: item.id, to })\n setLive(`Over ${labelOf(to)}.`)\n } else if (e.key === \" \" || e.key === \"Enter\") {\n setGrab(null)\n if (grab.to === column.id) setLive(`${name} stays in ${column.label}.`)\n else {\n if (isCollapsed(grab.to)) setOpenRails((r) => [...r, grab.to])\n setFocusId(item.id)\n move(item.id, grab.to)\n }\n } else if (e.key === \"Escape\") {\n setGrab(null)\n setLive(`Move cancelled. ${name} stays in ${column.label}.`)\n }\n return\n }\n if (e.key === \" \") {\n e.preventDefault()\n setGrab({ id: item.id, to: column.id })\n setLive(`Picked up ${name}. Left and right arrows choose a column, Space drops, Escape cancels.`)\n } else if (e.key === \"Enter\" && onCardOpen) {\n e.preventDefault()\n onCardOpen(item)\n } else if (e.key.startsWith(\"Arrow\")) {\n const visible = columns.filter((c) => !isCollapsed(c.id)).map((c) => c.items.map((i) => i.id))\n const next = neighborCard(visible, item.id, e.key)\n if (next) {\n e.preventDefault()\n setFocusId(null)\n cardEl(next)?.focus()\n }\n }\n }\n\n const dropProps = (columnId: string) => ({\n onDragOver: (e: React.DragEvent) => {\n e.preventDefault()\n e.dataTransfer.dropEffect = \"move\"\n if (over !== columnId) setOver(columnId)\n },\n onDrop: (e: React.DragEvent) => {\n e.preventDefault()\n const id = e.dataTransfer.getData(\"text/plain\") || dragId\n setDragId(null)\n setOver(null)\n if (id) move(id, columnId)\n },\n })\n\n const heldFrom = homeOf.get(dragId ?? grab?.id ?? \"\")?.id\n const isTarget = (columnId: string) =>\n heldFrom !== columnId &&\n ((dragId !== null && over === columnId) || (grab !== null && grab.to === columnId))\n\n function renderColumn(column: KanbanBoardColumn<T>) {\n const target = isTarget(column.id)\n const isRail = rails.includes(column.id)\n if (isCollapsed(column.id)) {\n return (\n <button\n key={column.id}\n type=\"button\"\n className={styles.rail}\n data-slot=\"kanban-board-rail\"\n data-target={target || undefined}\n aria-expanded={false}\n aria-label={`${column.label}, ${column.items.length} cards. Show column`}\n onClick={() => setOpenRails((r) => [...r, column.id])}\n {...dropProps(column.id)}\n >\n {column.label} · {column.items.length}\n </button>\n )\n }\n return (\n <section\n key={column.id}\n className={styles.column}\n data-slot=\"kanban-board-column\"\n data-column-id={column.id}\n data-target={target || undefined}\n aria-label={column.label}\n {...dropProps(column.id)}\n >\n <header className={styles.head}>\n {isRail ? (\n <button\n type=\"button\"\n className={styles.label}\n aria-expanded\n aria-label={`${column.label}. Collapse column`}\n onClick={() => setOpenRails((r) => r.filter((id) => id !== column.id))}\n >\n {column.label}\n </button>\n ) : (\n <span className={styles.label}>{column.label}</span>\n )}\n <span className={styles.count}>{column.items.length}</span>\n {column.total != null ? <span className={styles.total}>{column.total}</span> : null}\n </header>\n {target ? (\n <div className={styles.drop} data-slot=\"kanban-board-drop\">\n Drop in {column.label}\n </div>\n ) : null}\n <div role=\"list\" className={styles.cards}>\n {column.items.map((item) => (\n <Card\n key={item.id}\n size=\"sm\"\n role=\"listitem\"\n tabIndex={0}\n draggable\n data-card-id={item.id}\n data-grabbed={grab?.id === item.id || dragId === item.id || undefined}\n aria-describedby={hintId}\n className={styles.card}\n onKeyDown={(e) => onCardKey(e, item, column)}\n onDragStart={(e) => {\n e.dataTransfer.setData(\"text/plain\", item.id)\n e.dataTransfer.effectAllowed = \"move\"\n setDragId(item.id)\n }}\n onDragEnd={() => {\n setDragId(null)\n setOver(null)\n }}\n >\n {renderCard(item, column)}\n </Card>\n ))}\n </div>\n {column.items.length === 0 && !target && column.empty ? (\n <p className={styles.empty}>{column.empty}</p>\n ) : null}\n {renderColumnFooter?.(column)}\n </section>\n )\n }\n\n return (\n <div ref={rootRef} className={cn(styles.board, className)} data-slot=\"kanban-board\" {...rest}>\n {columns.map(renderColumn)}\n <p id={hintId} className={styles.srOnly}>\n Press Space to pick up a card, Left and Right arrows to choose a column, Space to drop, Escape to cancel.\n </p>\n <div aria-live=\"polite\" className={styles.srOnly}>\n {live}\n </div>\n </div>\n )\n}\n"
|
|
4669
|
+
},
|
|
4670
|
+
{
|
|
4671
|
+
"path": "blocks/kanban-board/kanban-board.module.css",
|
|
4672
|
+
"type": "registry:block",
|
|
4673
|
+
"content": "/* Kanban Board\n * Stage columns in one row. Surfaces are told apart by tone, never borders:\n * columns sit on the card tone, cards on the raised popover tone, so a card\n * reads lighter than its column in light and dark alike. Every value binds to\n * a Visor token unless noted.\n */\n\n.board {\n display: flex;\n align-items: flex-start;\n gap: var(--spacing-3, 0.75rem);\n overflow-x: auto;\n padding-bottom: var(--spacing-1, 0.25rem);\n}\n\n.column,\n.rail {\n background: var(--surface-card, #ffffff);\n border-radius: var(--radius-xl, 1rem);\n /* Intentional: lanes keep their height when empty so drops have room. */\n min-height: 26rem;\n transition: background-color var(--motion-duration-150, 150ms) var(--motion-easing-default, ease);\n}\n\n.column {\n flex: 1 1 0;\n /* Intentional: a card stays readable before the board scrolls sideways. */\n min-width: 12.5rem;\n padding: var(--spacing-2, 0.5rem);\n}\n\n.column[data-target],\n.rail[data-target] {\n background: color-mix(in srgb, var(--text-link, #2563eb) 10%, var(--surface-card, #ffffff));\n}\n\n/* ── Header ── */\n\n.head {\n display: flex;\n align-items: baseline;\n gap: var(--spacing-2, 0.5rem);\n padding: var(--spacing-2, 0.5rem) var(--spacing-2, 0.5rem) var(--spacing-3, 0.75rem);\n}\n\n.label {\n font-size: var(--font-size-xs, 0.75rem);\n font-weight: var(--font-weight-bold, 700);\n letter-spacing: var(--letter-spacing-wide, 0.05em);\n text-transform: uppercase;\n color: var(--text-secondary, #6b7280);\n background: none;\n border: 0;\n padding: 0;\n}\n\nbutton.label {\n cursor: pointer;\n}\n\n.count,\n.total {\n font-size: var(--font-size-sm, 0.875rem);\n font-weight: var(--font-weight-bold, 700);\n color: var(--text-secondary, #6b7280);\n}\n\n.total {\n margin-left: auto;\n}\n\n/* ── Collapsed rail ── */\n\n.rail {\n flex: none;\n /* Intentional: a rail is one label wide. */\n width: 3.5rem;\n writing-mode: vertical-rl;\n display: flex;\n align-items: center;\n padding: var(--spacing-4, 1rem) 0;\n border: 0;\n cursor: pointer;\n font-size: var(--font-size-xs, 0.75rem);\n font-weight: var(--font-weight-bold, 700);\n letter-spacing: var(--letter-spacing-wide, 0.05em);\n text-transform: uppercase;\n color: var(--text-secondary, #6b7280);\n}\n\n.rail:hover,\nbutton.label:hover {\n color: var(--text-primary, #111827);\n}\n\n.rail:focus-visible,\nbutton.label:focus-visible,\n.board .card:focus-visible {\n outline: var(--focus-ring-width, 2px) solid var(--border-focus, #2563eb);\n outline-offset: var(--focus-ring-offset, 2px);\n}\n\n/* ── Cards ── */\n\n.cards {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-2, 0.5rem);\n}\n\n.board .card {\n background: var(--surface-popover, #ffffff);\n border-radius: var(--radius-lg, 0.75rem);\n padding: var(--spacing-3, 0.75rem);\n gap: 0;\n box-shadow: var(--shadow-xs);\n cursor: grab;\n}\n\n/* A held card tilts and lifts, as in the approved frame. */\n.board .card[data-grabbed] {\n /* Intentional: the frame's tilt and lift. */\n transform: rotate(-1.5deg) translateY(-0.25rem);\n box-shadow: var(--shadow-lg);\n}\n\n.drop {\n display: grid;\n place-items: center;\n /* Intentional: about one card tall. */\n min-height: 4.5rem;\n margin-bottom: var(--spacing-2, 0.5rem);\n border-radius: var(--radius-lg, 0.75rem);\n background: var(--surface-accent-subtle, #eff6ff);\n color: var(--text-link, #2563eb);\n font-size: var(--font-size-sm, 0.875rem);\n font-weight: var(--font-weight-semibold, 600);\n}\n\n.empty {\n margin: 0;\n padding: var(--spacing-6, 1.5rem) var(--spacing-3, 0.75rem);\n text-align: center;\n color: var(--text-muted, #6b7280);\n font-size: var(--font-size-sm, 0.875rem);\n}\n\n.srOnly {\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: 0;\n}\n"
|
|
4674
|
+
}
|
|
4675
|
+
]
|
|
4676
|
+
},
|
|
4541
4677
|
{
|
|
4542
4678
|
"name": "workspace-switcher",
|
|
4543
4679
|
"type": "registry:block",
|
|
@@ -5427,7 +5563,7 @@
|
|
|
5427
5563
|
{
|
|
5428
5564
|
"path": "components/devtools/source-inspector/visor-component-names.generated.ts",
|
|
5429
5565
|
"type": "registry:devtool",
|
|
5430
|
-
"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 \"CardIndicatorContext\",\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"
|
|
5566
|
+
"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 \"BillingSlider\",\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 \"CardIndicatorContext\",\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 \"KanbanBoard\",\n \"Kbd\",\n \"KeyValueList\",\n \"Label\",\n \"Landing\",\n \"LayerChart\",\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 \"Meter\",\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 \"ProportionBar\",\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 \"SpanStrip\",\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"
|
|
5431
5567
|
}
|
|
5432
5568
|
]
|
|
5433
5569
|
},
|