@epilot/zenith-react 0.1.0-next.0 → 0.1.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/README.md +95 -15
- package/dist/components/appearance-boundary/appearance-boundary.js +32 -34
- package/dist/components/appearance-boundary/appearance-boundary.js.map +1 -1
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +10 -10
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/button/button.js +28 -28
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button-group/button-group.js.map +1 -1
- package/dist/components/callout/callout.js +13 -13
- package/dist/components/callout/callout.js.map +1 -1
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +13 -13
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/code-block/code-block.js +6 -6
- package/dist/components/code-block/code-block.js.map +1 -1
- package/dist/components/code-editor/code-editor.js +1 -1
- package/dist/components/code-editor/code-editor.js.map +1 -1
- package/dist/components/code-editor/indent.js.map +1 -1
- package/dist/components/command/command.js +7 -13
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/data-table/data-table-body.js +120 -66
- package/dist/components/data-table/data-table-body.js.map +1 -1
- package/dist/components/data-table/data-table-column-header.js +7 -7
- package/dist/components/data-table/data-table-column-header.js.map +1 -1
- package/dist/components/data-table/data-table-column-order.js +277 -0
- package/dist/components/data-table/data-table-column-order.js.map +1 -0
- package/dist/components/data-table/data-table-content.js +72 -58
- package/dist/components/data-table/data-table-content.js.map +1 -1
- package/dist/components/data-table/data-table-context.js +8 -4
- package/dist/components/data-table/data-table-context.js.map +1 -1
- package/dist/components/data-table/data-table-footer.js +31 -0
- package/dist/components/data-table/data-table-footer.js.map +1 -0
- package/dist/components/data-table/data-table-header-draggable.js +151 -0
- package/dist/components/data-table/data-table-header-draggable.js.map +1 -0
- package/dist/components/data-table/data-table-header.js +130 -57
- package/dist/components/data-table/data-table-header.js.map +1 -1
- package/dist/components/data-table/data-table-resize-handle.js +137 -0
- package/dist/components/data-table/data-table-resize-handle.js.map +1 -0
- package/dist/components/data-table/data-table.js +184 -156
- package/dist/components/data-table/data-table.js.map +1 -1
- package/dist/components/data-table/hooks/use-data-table-virtualizer.js +9 -0
- package/dist/components/data-table/hooks/use-data-table-virtualizer.js.map +1 -0
- package/dist/components/date-range-picker/date-range-picker.js +197 -195
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-time-picker/calendar.js +29 -29
- package/dist/components/date-time-picker/calendar.js.map +1 -1
- package/dist/components/date-time-picker/time-picker.js +55 -55
- package/dist/components/date-time-picker/time-picker.js.map +1 -1
- package/dist/components/density-provider/density-provider.js.map +1 -1
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.js +5 -5
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +36 -36
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/field/field-combobox.js +4 -4
- package/dist/components/field/field-combobox.js.map +1 -1
- package/dist/components/field/field.js +40 -40
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/label/label.js +0 -28
- package/dist/components/label/label.js.map +1 -1
- package/dist/components/list/list.js +42 -52
- package/dist/components/list/list.js.map +1 -1
- package/dist/components/option-card/option-card.js +27 -25
- package/dist/components/option-card/option-card.js.map +1 -1
- package/dist/components/pill/pill.js +9 -9
- package/dist/components/pill/pill.js.map +1 -1
- package/dist/components/radio/radio.js +14 -14
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/scroll-area/scroll-area.js +9 -9
- package/dist/components/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/segmented-control/segmented-control.js +1 -1
- package/dist/components/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/select/select.js +11 -11
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/separator/separator.js.map +1 -1
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/slot/compose-as-child.js.map +1 -1
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/switch/switch.js +11 -11
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table-pagination.js +1 -1
- package/dist/components/table/table-pagination.js.map +1 -1
- package/dist/components/table/table.js +15 -15
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/text/text.js +10 -1
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/toast/toast.js +30 -32
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toggle/toggle.js +20 -20
- package/dist/components/toggle/toggle.js.map +1 -1
- package/dist/delivery/index.d.ts +10 -44
- package/dist/delivery/index.js +5 -9
- package/dist/index.d.ts +1994 -2272
- package/dist/index.js +133 -121
- package/dist/index.js.map +1 -1
- package/dist/lib/clear-button.js.map +1 -1
- package/dist/lib/code-highlight.js.map +1 -1
- package/dist/lib/code-tokens.js.map +1 -1
- package/dist/lib/pagination.js.map +1 -1
- package/dist/packages/tokens/dist/delivery/index.js +18 -48
- package/dist/packages/tokens/dist/delivery/index.js.map +1 -1
- package/dist/packages/tokens/dist/generated/core.generated.js +18 -0
- package/dist/packages/tokens/dist/generated/core.generated.js.map +1 -0
- package/dist/packages/tokens/dist/generated/palette.generated.js +5 -5
- package/dist/packages/tokens/dist/generated/palette.generated.js.map +1 -1
- package/dist/packages/tokens/dist/install.js +9 -9
- package/dist/packages/tokens/dist/install.js.map +1 -1
- package/dist/styles/document-context.js.map +1 -1
- package/dist/styles/make-styles.js.map +1 -1
- package/dist/tokens/core.meta.generated.js +2 -2
- package/dist/tokens/core.meta.generated.js.map +1 -1
- package/dist/tokens/index.d.ts +1029 -1104
- package/dist/tokens/index.js +1031 -1106
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/palette.generated.js +2 -2
- package/dist/tokens/palette.generated.js.map +1 -1
- package/dist/tokens/use-palette-tokens.js.map +1 -1
- package/dist/tokens.json +605 -755
- package/dist/vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js +385 -340
- package/dist/vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js.map +1 -1
- package/dist/vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js +344 -229
- package/dist/vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js.map +1 -1
- package/dist/vendor/.bun/@dnd-kit_utilities@3.2.2_62547eec5a2188e3/vendor/@dnd-kit/utilities/dist/utilities.esm.js +1 -1
- package/dist/vendor/.bun/@tanstack_react-virtual@3.11.2_6f4b9a1cfb20c0ae/vendor/@tanstack/react-virtual/dist/esm/index.js +36 -0
- package/dist/vendor/.bun/@tanstack_react-virtual@3.11.2_6f4b9a1cfb20c0ae/vendor/@tanstack/react-virtual/dist/esm/index.js.map +1 -0
- package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/index.js +450 -0
- package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/index.js.map +1 -0
- package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/utils.js +50 -0
- package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/utils.js.map +1 -0
- package/package.json +5 -4
- package/scripts/migration-diagnostics-core.mjs +19 -90
- package/scripts/migration-diagnostics.mjs +1 -16
- package/scripts/migration-sweep.mjs +2 -12
- package/ADOPTING.md +0 -73
- package/dist/packages/tokens/dist/delivery/internal.js +0 -181
- package/dist/packages/tokens/dist/delivery/internal.js.map +0 -1
- package/dist/packages/tokens/dist/generated/core.meta.generated.js +0 -10
- package/dist/packages/tokens/dist/generated/core.meta.generated.js.map +0 -1
- package/dist/token-assets/core/5cd4072decf5df2a664f0b1d5f2ec250a3309101ded3056c1f87c8bbe3738d50.css +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { capTrim } from \"../../styles/text-box\"\nimport * as tokens from \"../../tokens\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\n/**\n * Base UI's type declarations resolve `react` from the hoisted root's `@types/react` (v19), while\n * this package pins `@types/react` 18 in its own node_modules. Re-typing the primitive onto OUR\n * `React` keeps the button's pass-through props and ref on one React type for this package.\n */\n/**\n * A native `<button>`, no primitive.\n *\n * v1's only Radix use here is `Slot`, purely to implement `asChild`, and this does the same. Base\n * UI's button primitive supplied nothing v1 had: it added a dependency, and with it the\n * `@types/react` 19 requirement, for a plain element.\n */\nconst ButtonBase = \"button\" as const\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontWeight: tokens.fontWeightSemibold,\n whiteSpace: \"nowrap\",\n transitionProperty: \"all\",\n cursor: \"pointer\",\n flexShrink: 0,\n // Disabled keeps pointer events so a Tooltip can still explain why, but shows none of the\n // hover or press feedback (every variant guards those with `:not(:disabled)`) and no pointer.\n \":disabled\": { opacity: 0.5, cursor: \"not-allowed\" },\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: tokens.semFocusRing,\n },\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n \"& svg\": {\n flexShrink: 0,\n pointerEvents: \"none\",\n color: \"currentColor\",\n },\n },\n label: capTrim,\n primary: {\n backgroundColor: tokens.semAccentSolid,\n color: tokens.semAccentContrast,\n \":hover:not(:disabled)\": { backgroundColor: tokens.semAccentSolidHover },\n \":active:not(:disabled)\": { backgroundColor: tokens.semAccentSolidHover },\n },\n secondary: {\n backgroundColor: tokens.semAccentSoft,\n color: tokens.semAccentOnSoft,\n \":hover:not(:disabled)\": { backgroundColor: tokens.semAccentSoftHover },\n },\n tertiary: {\n backgroundColor: \"transparent\",\n color: tokens.accentA11,\n \":hover:not(:disabled)\": { backgroundColor: tokens.semAccentSoft },\n },\n ghost: {\n backgroundColor: \"transparent\",\n color: tokens.grayA12,\n \":hover:not(:disabled)\": { backgroundColor: tokens.semAccentSoft },\n },\n primaryDestructive: {\n backgroundColor: tokens.semErrorSolid,\n color: tokens.semErrorContrast,\n \":hover:not(:disabled)\": { backgroundColor: tokens.semErrorSolidHover },\n \":active:not(:disabled)\": { backgroundColor: tokens.semErrorSolidHover },\n },\n secondaryDestructive: {\n backgroundColor: tokens.semErrorSoft,\n color: tokens.semErrorOnSoft,\n \":hover:not(:disabled)\": { backgroundColor: tokens.semErrorSoftHover },\n },\n tertiaryDestructive: {\n backgroundColor: \"transparent\",\n color: tokens.errorA11,\n \":hover:not(:disabled)\": { backgroundColor: tokens.semErrorSoft },\n },\n xs: {\n ...shorthands.paddingInline(\"0.5rem\"),\n ...shorthands.paddingBlock(\"0.25rem\"),\n // Cap trimming removes the line-height's leading from direct text. Keep the established\n // 24px control geometry explicitly instead of relying on that incidental text height.\n minHeight: \"1.5rem\",\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n gap: \"4px\",\n \"& svg\": { width: \"0.75rem\", height: \"0.75rem\" },\n },\n sm: {\n ...shorthands.paddingInline(tokens.spacingElement3),\n ...shorthands.paddingBlock(\"0.25rem\"),\n // As above, the fixed 28px size is part of Button's contract, independent of its label box.\n minHeight: \"1.75rem\",\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n gap: \"0.375rem\",\n \"& svg\": { width: \"0.875rem\", height: \"0.875rem\" },\n },\n base: {\n // Density-bound (DENSITY-SPEC.md §2.4, WP9B1-ACCEPTANCE-WP9B2A): padding-inline is the\n // compact/comfortable lever; min-height is floored by the fixed line-height + padding-block\n // below and cannot shrink, so it is bound too (compact === normal, comfortable raised via an\n // explicit minHeight above the natural content box, same mechanism `lg` already uses).\n ...shorthands.paddingInline(tokens.buttonBasePaddingInline),\n ...shorthands.paddingBlock(\"0.25rem\"),\n minHeight: tokens.buttonBaseMinHeight,\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n gap: \"0.5rem\",\n \"& svg\": { width: \"1rem\", height: \"1rem\" },\n },\n lg: {\n ...shorthands.paddingInline(\"1.25rem\"),\n ...shorthands.paddingBlock(\"0.25rem\"),\n minHeight: \"2.5rem\",\n fontSize: tokens.textLg,\n lineHeight: tokens.leadingLg,\n gap: \"0.5rem\",\n \"& svg\": { width: \"1rem\", height: \"1rem\" },\n },\n iconXs: {\n width: \"1.5rem\",\n height: \"1.5rem\",\n \"& svg\": { width: \"0.75rem\", height: \"0.75rem\" },\n },\n iconSm: {\n width: \"1.75rem\",\n height: \"1.75rem\",\n \"& svg\": { width: \"0.875rem\", height: \"0.875rem\" },\n },\n icon: {\n // Density-bound: a fixed square, no line-height floor (unlike `base`), so compact/comfortable\n // both move freely (DENSITY-SPEC.md §2.4).\n width: tokens.buttonIconSize,\n height: tokens.buttonIconSize,\n \"& svg\": { width: \"1.125rem\", height: \"1.125rem\" },\n },\n iconLg: {\n width: \"2.5rem\",\n height: \"2.5rem\",\n \"& svg\": { width: \"1.5rem\", height: \"1.5rem\" },\n },\n normal: { borderRadius: tokens.radiusLg },\n rounded: { borderRadius: \"9999px\" },\n})\n\ntype FlatButtonChild = {\n node: React.ReactNode\n keyPath: string\n}\n\n/**\n * Fragments do not create boxes, so flatten them to the same leaf order the flex container sees.\n * React.Children.toArray handles nested arrays and gives keyed elements a stable local key; the\n * parent fragment path keeps equal keys from separate fragment scopes distinct.\n */\nfunction flattenButtonChildren(\n children: React.ReactNode,\n parentPath = \"button\"\n): FlatButtonChild[] {\n return React.Children.toArray(children).flatMap((node, index) => {\n const localKey =\n React.isValidElement(node) && node.key !== null\n ? String(node.key)\n : String(index)\n const keyPath = `${parentPath}/${localKey}`\n\n if (\n React.isValidElement<{ children?: React.ReactNode }>(node) &&\n node.type === React.Fragment\n ) {\n return flattenButtonChildren(node.props.children, keyPath)\n }\n\n return [{ node, keyPath }]\n })\n}\n\n/**\n * A flex container's direct text becomes an anonymous flex item, which `text-box` cannot select.\n * Recreate exactly those contiguous text runs as real label boxes. Consumer elements stay direct\n * children and whitespace-only runs stay raw, preserving today's element order and flex gaps.\n */\nfunction wrapButtonTextRuns(\n children: React.ReactNode,\n labelClassName: string\n): React.ReactNode[] {\n const output: React.ReactNode[] = []\n let textRun: FlatButtonChild[] = []\n\n const flushTextRun = () => {\n if (!textRun.length) return\n\n const whitespaceOnly = textRun.every(\n ({ node }) => typeof node === \"string\" && node.trim() === \"\"\n )\n if (whitespaceOnly) {\n output.push(...textRun.map(({ node }) => node))\n } else {\n output.push(\n <span\n key={`button-label:${textRun[0].keyPath}`}\n data-slot=\"button-label\"\n className={labelClassName}\n >\n {textRun.map(({ node }) => node)}\n </span>\n )\n }\n textRun = []\n }\n\n for (const child of flattenButtonChildren(children)) {\n if (typeof child.node === \"string\" || typeof child.node === \"number\") {\n textRun.push(child)\n continue\n }\n\n flushTextRun()\n output.push(\n React.isValidElement(child.node)\n ? React.cloneElement(child.node, { key: child.keyPath })\n : child.node\n )\n }\n flushTextRun()\n\n return output\n}\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"tertiary\" | \"ghost\"\nexport type ButtonSize =\n \"xs\" | \"sm\" | \"base\" | \"lg\" | \"icon-xs\" | \"icon-sm\" | \"icon\" | \"icon-lg\"\nexport type ButtonShape = \"normal\" | \"rounded\"\n\nexport type ButtonProps = Omit<\n React.ComponentProps<\"button\">,\n \"variant\" | \"size\" | \"shape\" | \"destructive\" | \"className\" | \"render\"\n> & {\n variant?: ButtonVariant\n size?: ButtonSize\n shape?: ButtonShape\n destructive?: boolean\n className?: string\n /**\n * Render the child element instead of a `button`, keeping Button's styling and slot markers.\n * v1 supports this and consumers rely on it to wrap links; it was dropped here while the package\n * was briefly on Base UI, and restored once it moved back to Radix.\n */\n asChild?: boolean\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n {\n variant = \"primary\",\n size = \"base\",\n shape = \"rounded\",\n destructive = false,\n className,\n asChild = false,\n children,\n ...props\n },\n ref\n ) {\n const styles = useStyles()\n const variantSlot:\n | ButtonVariant\n | \"primaryDestructive\"\n | \"secondaryDestructive\"\n | \"tertiaryDestructive\" =\n destructive && variant !== \"ghost\"\n ? (`${variant}Destructive` as\n | \"primaryDestructive\"\n | \"secondaryDestructive\"\n | \"tertiaryDestructive\")\n : variant\n const sizeSlot:\n \"xs\" | \"sm\" | \"base\" | \"lg\" | \"iconXs\" | \"iconSm\" | \"icon\" | \"iconLg\" = (\n {\n xs: \"xs\",\n sm: \"sm\",\n base: \"base\",\n lg: \"lg\",\n \"icon-xs\": \"iconXs\",\n \"icon-sm\": \"iconSm\",\n icon: \"icon\",\n \"icon-lg\": \"iconLg\",\n } as const\n )[size]\n\n const Root = asChild ? Slot : ButtonBase\n const content = asChild\n ? children\n : wrapButtonTextRuns(children, styles.label)\n\n return (\n <Root\n ref={ref}\n data-slot=\"button\"\n {...{ [SLOT_ATTR]: \"button\" }}\n className={mergeClasses(\n styles.root,\n styles[variantSlot],\n styles[sizeSlot],\n styles[shape],\n className\n )}\n {...props}\n >\n {content}\n </Root>\n )\n }\n)\n"],"names":["ButtonBase","useStyles","makeZenithStyles","tokens.fontWeightSemibold","tokens.semFocusRing","capTrim","tokens.semAccentSolid","tokens.semAccentContrast","tokens.semAccentSolidHover","tokens.semAccentSoft","tokens.semAccentOnSoft","tokens.semAccentSoftHover","tokens.accentA11","tokens.grayA12","tokens.semErrorSolid","tokens.semErrorContrast","tokens.semErrorSolidHover","tokens.semErrorSoft","tokens.semErrorOnSoft","tokens.semErrorSoftHover","tokens.errorA11","shorthands","tokens.textXs","tokens.leadingXs","tokens.spacingElement3","tokens.textSm","tokens.leadingSm","tokens.buttonBasePaddingInline","tokens.buttonBaseMinHeight","tokens.textBase","tokens.leadingBase","tokens.textLg","tokens.leadingLg","tokens.buttonIconSize","tokens.radiusLg","flattenButtonChildren","children","parentPath","React","node","index","localKey","keyPath","wrapButtonTextRuns","labelClassName","output","textRun","flushTextRun","jsx","child","Button","variant","size","shape","destructive","className","asChild","props","ref","styles","variantSlot","sizeSlot","Root","Slot","content","SLOT_ATTR","mergeClasses"],"mappings":";;;;;;;AAsBA,MAAMA,KAAa,UAEbC,KAAYC,EAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,YAAYC;AAAAA,IACZ,YAAY;AAAA,IACZ,oBAAoB;AAAA,IACpB,QAAQ;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,IAGZ,aAAa,EAAE,SAAS,KAAK,QAAQ,cAAA;AAAA,IACrC,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,cAAc;AAAA,MACd,eAAe;AAAA,MACf,cAAcC;AAAAA,IAAO;AAAA,IAEvB,2CAA2C;AAAA,MACzC,oBAAoB;AAAA,IAAA;AAAA,IAEtB,SAAS;AAAA,MACP,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,OAAO;AAAA,IAAA;AAAA,EACT;AAAA,EAEF,OAAOC;AAAA,EACP,SAAS;AAAA,IACP,iBAAiBC;AAAAA,IACjB,OAAOC;AAAAA,IACP,yBAAyB,EAAE,iBAAiBC,EAAO;AAAA,IACnD,0BAA0B,EAAE,iBAAiBA,EAAO;AAAA,EAAoB;AAAA,EAE1E,WAAW;AAAA,IACT,iBAAiBC;AAAAA,IACjB,OAAOC;AAAAA,IACP,yBAAyB,EA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;AAAA,IACR,aAAAC,IAAc;AAAA,IACd,WAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,UAAApB;AAAA,IACA,GAAGqB;AAAA,EAAA,GAELC,GACA;AACA,UAAMC,IAAS1D,GAAA,GACT2D,IAKJN,KAAeH,MAAY,UACtB,GAAGA,CAAO,gBAIXA,GACAU,IAEJ;AAAA,MACE,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,WAAW;AAAA,MACX,WAAW;AAAA,MACX,MAAM;AAAA,MACN,WAAW;AAAA,IAAA,EAEbT,CAAI,GAEAU,IAAON,IAAUO,IAAO/D,IACxBgE,IAAUR,IACZpB,IACAO,GAAmBP,GAAUuB,EAAO,KAAK;AAE7C,WACE,gBAAAX;AAAA,MAACc;AAAA,MAAA;AAAA,QACC,KAAAJ;AAAA,QACA,aAAU;AAAA,QACJ,CAACO,CAAS,GAAG;AAAA,QACnB,WAAWC;AAAA,UACTP,EAAO;AAAA,UACPA,EAAOC,CAAW;AAAA,UAClBD,EAAOE,CAAQ;AAAA,UACfF,EAAON,CAAK;AAAA,UACZE;AAAA,QAAA;AAAA,QAED,GAAGE;AAAA,QAEH,UAAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { capTrim } from \"../../styles/text-box\"\nimport * as tokens from \"../../tokens\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\n/**\n * Base UI's type declarations resolve `react` from the hoisted root's `@types/react` (v19), while\n * this package pins `@types/react` 18 in its own node_modules. Re-typing the primitive onto OUR\n * `React` keeps the button's pass-through props and ref on one React type for this package.\n */\n/**\n * A native `<button>`, no primitive.\n *\n * v1's only Radix use here is `Slot`, purely to implement `asChild`, and this does the same. Base\n * UI's button primitive supplied nothing v1 had: it added a dependency, and with it the\n * `@types/react` 19 requirement, for a plain element.\n */\nconst ButtonBase = \"button\" as const\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontWeight: tokens.fontWeightSemibold,\n whiteSpace: \"nowrap\",\n transitionProperty: \"all\",\n cursor: \"pointer\",\n flexShrink: 0,\n // Disabled keeps pointer events so a Tooltip can still explain why, but shows none of the\n // hover or press feedback (every variant guards those with `:not(:disabled)`) and no pointer.\n \":disabled\": { opacity: 0.5, cursor: \"not-allowed\" },\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: tokens.focusRing,\n },\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n \"& svg\": {\n flexShrink: 0,\n pointerEvents: \"none\",\n color: \"currentColor\",\n },\n },\n label: capTrim,\n primary: {\n backgroundColor: tokens.accentSolid,\n color: tokens.accentContrast,\n \":hover:not(:disabled)\": { backgroundColor: tokens.accentSolidHover },\n \":active:not(:disabled)\": { backgroundColor: tokens.accentSolidHover },\n },\n secondary: {\n backgroundColor: tokens.accentSoft,\n color: tokens.accentOnSoft,\n \":hover:not(:disabled)\": { backgroundColor: tokens.accentSoftHover },\n },\n tertiary: {\n backgroundColor: \"transparent\",\n color: tokens.accentA11,\n \":hover:not(:disabled)\": { backgroundColor: tokens.accentSoft },\n },\n ghost: {\n backgroundColor: \"transparent\",\n color: tokens.grayA12,\n \":hover:not(:disabled)\": { backgroundColor: tokens.accentSoft },\n },\n primaryDestructive: {\n backgroundColor: tokens.errorSolid,\n color: tokens.errorContrast,\n \":hover:not(:disabled)\": { backgroundColor: tokens.errorSolidHover },\n \":active:not(:disabled)\": { backgroundColor: tokens.errorSolidHover },\n },\n secondaryDestructive: {\n backgroundColor: tokens.errorSoft,\n color: tokens.errorOnSoft,\n \":hover:not(:disabled)\": { backgroundColor: tokens.errorSoftHover },\n },\n tertiaryDestructive: {\n backgroundColor: \"transparent\",\n color: tokens.errorA11,\n \":hover:not(:disabled)\": { backgroundColor: tokens.errorSoft },\n },\n xs: {\n ...shorthands.paddingInline(\"0.5rem\"),\n ...shorthands.paddingBlock(\"0.25rem\"),\n // Cap trimming removes the line-height's leading from direct text. Keep the established\n // 24px control geometry explicitly instead of relying on that incidental text height.\n minHeight: \"1.5rem\",\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n gap: \"4px\",\n \"& svg\": { width: \"0.75rem\", height: \"0.75rem\" },\n },\n sm: {\n ...shorthands.paddingInline(tokens.spacingElement3),\n ...shorthands.paddingBlock(\"0.25rem\"),\n // As above, the fixed 28px size is part of Button's contract, independent of its label box.\n minHeight: \"1.75rem\",\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n gap: \"0.375rem\",\n \"& svg\": { width: \"0.875rem\", height: \"0.875rem\" },\n },\n base: {\n // Density-bound (DENSITY-SPEC.md §2.4, WP9B1-ACCEPTANCE-WP9B2A): padding-inline is the\n // compact/comfortable lever; min-height is floored by the fixed line-height + padding-block\n // below and cannot shrink, so it is bound too (compact === normal, comfortable raised via an\n // explicit minHeight above the natural content box, same mechanism `lg` already uses).\n ...shorthands.paddingInline(tokens.buttonBasePaddingInline),\n ...shorthands.paddingBlock(\"0.25rem\"),\n minHeight: tokens.buttonBaseMinHeight,\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n gap: \"0.5rem\",\n \"& svg\": { width: \"1rem\", height: \"1rem\" },\n },\n lg: {\n ...shorthands.paddingInline(\"1.25rem\"),\n ...shorthands.paddingBlock(\"0.25rem\"),\n minHeight: \"2.5rem\",\n fontSize: tokens.textLg,\n lineHeight: tokens.leadingLg,\n gap: \"0.5rem\",\n \"& svg\": { width: \"1rem\", height: \"1rem\" },\n },\n iconXs: {\n width: \"1.5rem\",\n height: \"1.5rem\",\n \"& svg\": { width: \"0.75rem\", height: \"0.75rem\" },\n },\n iconSm: {\n width: \"1.75rem\",\n height: \"1.75rem\",\n \"& svg\": { width: \"0.875rem\", height: \"0.875rem\" },\n },\n icon: {\n // Density-bound: a fixed square, no line-height floor (unlike `base`), so compact/comfortable\n // both move freely (DENSITY-SPEC.md §2.4).\n width: tokens.buttonIconSize,\n height: tokens.buttonIconSize,\n \"& svg\": { width: \"1.125rem\", height: \"1.125rem\" },\n },\n iconLg: {\n width: \"2.5rem\",\n height: \"2.5rem\",\n \"& svg\": { width: \"1.5rem\", height: \"1.5rem\" },\n },\n normal: { borderRadius: tokens.radiusLg },\n rounded: { borderRadius: \"9999px\" },\n})\n\ntype FlatButtonChild = {\n node: React.ReactNode\n keyPath: string\n}\n\n/**\n * Fragments do not create boxes, so flatten them to the same leaf order the flex container sees.\n * React.Children.toArray handles nested arrays and gives keyed elements a stable local key; the\n * parent fragment path keeps equal keys from separate fragment scopes distinct.\n */\nfunction flattenButtonChildren(\n children: React.ReactNode,\n parentPath = \"button\"\n): FlatButtonChild[] {\n return React.Children.toArray(children).flatMap((node, index) => {\n const localKey =\n React.isValidElement(node) && node.key !== null\n ? String(node.key)\n : String(index)\n const keyPath = `${parentPath}/${localKey}`\n\n if (\n React.isValidElement<{ children?: React.ReactNode }>(node) &&\n node.type === React.Fragment\n ) {\n return flattenButtonChildren(node.props.children, keyPath)\n }\n\n return [{ node, keyPath }]\n })\n}\n\n/**\n * A flex container's direct text becomes an anonymous flex item, which `text-box` cannot select.\n * Recreate exactly those contiguous text runs as real label boxes. Consumer elements stay direct\n * children and whitespace-only runs stay raw, preserving today's element order and flex gaps.\n */\nfunction wrapButtonTextRuns(\n children: React.ReactNode,\n labelClassName: string\n): React.ReactNode[] {\n const output: React.ReactNode[] = []\n let textRun: FlatButtonChild[] = []\n\n const flushTextRun = () => {\n if (!textRun.length) return\n\n const whitespaceOnly = textRun.every(\n ({ node }) => typeof node === \"string\" && node.trim() === \"\"\n )\n if (whitespaceOnly) {\n output.push(...textRun.map(({ node }) => node))\n } else {\n output.push(\n <span\n key={`button-label:${textRun[0].keyPath}`}\n data-slot=\"button-label\"\n className={labelClassName}\n >\n {textRun.map(({ node }) => node)}\n </span>\n )\n }\n textRun = []\n }\n\n for (const child of flattenButtonChildren(children)) {\n if (typeof child.node === \"string\" || typeof child.node === \"number\") {\n textRun.push(child)\n continue\n }\n\n flushTextRun()\n output.push(\n React.isValidElement(child.node)\n ? React.cloneElement(child.node, { key: child.keyPath })\n : child.node\n )\n }\n flushTextRun()\n\n return output\n}\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"tertiary\" | \"ghost\"\nexport type ButtonSize =\n \"xs\" | \"sm\" | \"base\" | \"lg\" | \"icon-xs\" | \"icon-sm\" | \"icon\" | \"icon-lg\"\nexport type ButtonShape = \"normal\" | \"rounded\"\n\nexport type ButtonProps = Omit<\n React.ComponentProps<\"button\">,\n \"variant\" | \"size\" | \"shape\" | \"destructive\" | \"className\" | \"render\"\n> & {\n variant?: ButtonVariant\n size?: ButtonSize\n shape?: ButtonShape\n destructive?: boolean\n className?: string\n /**\n * Render the child element instead of a `button`, keeping Button's styling and slot markers.\n * v1 supports this and consumers rely on it to wrap links; it was dropped here while the package\n * was briefly on Base UI, and restored once it moved back to Radix.\n */\n asChild?: boolean\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n {\n variant = \"primary\",\n size = \"base\",\n shape = \"rounded\",\n destructive = false,\n className,\n asChild = false,\n children,\n ...props\n },\n ref\n ) {\n const styles = useStyles()\n const variantSlot:\n | ButtonVariant\n | \"primaryDestructive\"\n | \"secondaryDestructive\"\n | \"tertiaryDestructive\" =\n destructive && variant !== \"ghost\"\n ? (`${variant}Destructive` as\n | \"primaryDestructive\"\n | \"secondaryDestructive\"\n | \"tertiaryDestructive\")\n : variant\n const sizeSlot:\n \"xs\" | \"sm\" | \"base\" | \"lg\" | \"iconXs\" | \"iconSm\" | \"icon\" | \"iconLg\" = (\n {\n xs: \"xs\",\n sm: \"sm\",\n base: \"base\",\n lg: \"lg\",\n \"icon-xs\": \"iconXs\",\n \"icon-sm\": \"iconSm\",\n icon: \"icon\",\n \"icon-lg\": \"iconLg\",\n } as const\n )[size]\n\n const Root = asChild ? Slot : ButtonBase\n const content = asChild\n ? children\n : wrapButtonTextRuns(children, styles.label)\n\n return (\n <Root\n ref={ref}\n data-slot=\"button\"\n {...{ [SLOT_ATTR]: \"button\" }}\n className={mergeClasses(\n styles.root,\n styles[variantSlot],\n styles[sizeSlot],\n styles[shape],\n className\n )}\n {...props}\n >\n {content}\n </Root>\n )\n }\n)\n"],"names":["ButtonBase","useStyles","makeZenithStyles","tokens.fontWeightSemibold","tokens.focusRing","capTrim","tokens.accentSolid","tokens.accentContrast","tokens.accentSolidHover","tokens.accentSoft","tokens.accentOnSoft","tokens.accentSoftHover","tokens.accentA11","tokens.grayA12","tokens.errorSolid","tokens.errorContrast","tokens.errorSolidHover","tokens.errorSoft","tokens.errorOnSoft","tokens.errorSoftHover","tokens.errorA11","shorthands","tokens.textXs","tokens.leadingXs","tokens.spacingElement3","tokens.textSm","tokens.leadingSm","tokens.buttonBasePaddingInline","tokens.buttonBaseMinHeight","tokens.textBase","tokens.leadingBase","tokens.textLg","tokens.leadingLg","tokens.buttonIconSize","tokens.radiusLg","flattenButtonChildren","children","parentPath","React","node","index","localKey","keyPath","wrapButtonTextRuns","labelClassName","output","textRun","flushTextRun","jsx","child","Button","variant","size","shape","destructive","className","asChild","props","ref","styles","variantSlot","sizeSlot","Root","Slot","content","SLOT_ATTR","mergeClasses"],"mappings":";;;;;;;AAsBA,MAAMA,KAAa,UAEbC,KAAYC,EAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,YAAYC;AAAAA,IACZ,YAAY;AAAA,IACZ,oBAAoB;AAAA,IACpB,QAAQ;AAAA,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AA,UAClBD,EAAOE,CAAQ;AAAA,UACfF,EAAON,CAAK;AAAA,UACZE;AAAA,QAAA;AAAA,QAED,GAAGE;AAAA,QAEH,UAAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","sources":["../../../src/components/button-group/button-group.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Separator, type SeparatorProps } from \"../separator/separator\"\n\n/**\n * ButtonGroup — compound component family for grouping buttons, text, and separators
|
|
1
|
+
{"version":3,"file":"button-group.js","sources":["../../../src/components/button-group/button-group.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Separator, type SeparatorProps } from \"../separator/separator\"\n\n/**\n * ButtonGroup — compound component family for grouping buttons, text, and separators. One\n * `makeZenithStyles` call for the whole family, one slot per sub-component (following `card.tsx`).\n */\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\"\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"flex\",\n width: \"fit-content\",\n alignItems: \"stretch\",\n \"& > *:focus-visible\": {\n zIndex: 10,\n position: \"relative\",\n },\n [`&:has(> [${SLOT_ATTR}=\"button-group\"])`]: {\n ...shorthands.gap(tokens.spacingElement2),\n },\n },\n horizontal: {\n \"& > *:not(:first-child)\": {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n borderLeftWidth: 0,\n },\n \"& > *:not(:last-child)\": {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n },\n vertical: {\n flexDirection: \"column\",\n \"& > *:not(:first-child)\": {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTopWidth: 0,\n },\n \"& > *:not(:last-child)\": {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n },\n },\n text: {\n backgroundColor: tokens.grayA4,\n display: \"flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement2),\n ...shorthands.borderRadius(tokens.radiusMd),\n ...shorthands.border(\"1px\", \"solid\", tokens.grayA5),\n ...shorthands.padding(tokens.spacingElement3, tokens.spacingGroup2),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n fontWeight: tokens.fontWeightMedium,\n // Tailwind `shadow-xs` — literal per CONVENTIONS B7\n boxShadow: \"0 1px 2px 0 #0000000d\",\n \"& svg\": {\n pointerEvents: \"none\",\n width: \"1rem\",\n height: \"1rem\",\n },\n },\n separator: {\n ...shorthands.margin(0),\n position: \"relative\",\n alignSelf: \"stretch\",\n backgroundColor: \"transparent\",\n },\n separatorVertical: {\n height: \"1px\",\n },\n})\n\nexport type ButtonGroupProps = React.ComponentProps<\"div\"> & {\n orientation?: ButtonGroupOrientation\n}\n\nexport const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(\n function ButtonGroup(\n { className, orientation = \"horizontal\", ...props },\n ref\n ) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"button-group\"\n {...{ [SLOT_ATTR]: \"button-group\" }}\n data-orientation={orientation}\n className={mergeClasses(styles.root, styles[orientation], className)}\n {...props}\n />\n )\n }\n)\n\nexport type ButtonGroupTextProps = React.ComponentProps<\"div\">\n\nexport const ButtonGroupText = React.forwardRef<\n HTMLDivElement,\n ButtonGroupTextProps\n>(function ButtonGroupText({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"button-group-text\"\n {...{ [SLOT_ATTR]: \"button-group-text\" }}\n className={mergeClasses(styles.text, className)}\n {...props}\n />\n )\n})\n\nexport type ButtonGroupSeparatorProps = SeparatorProps\n\nexport const ButtonGroupSeparator = React.forwardRef<\n HTMLDivElement,\n ButtonGroupSeparatorProps\n>(function ButtonGroupSeparator(\n { className, orientation = \"vertical\", ...props },\n ref\n) {\n const styles = useStyles()\n\n return (\n <Separator\n ref={ref}\n data-slot=\"button-group-separator\"\n {...{ [SLOT_ATTR]: \"button-group-separator\" }}\n orientation={orientation}\n className={mergeClasses(\n styles.separator,\n orientation === \"vertical\" && styles.separatorVertical,\n className\n )}\n {...props}\n />\n )\n})\n"],"names":["useStyles","makeZenithStyles","SLOT_ATTR","shorthands","tokens.spacingElement2","tokens.grayA4","tokens.radiusMd","tokens.grayA5","tokens.spacingElement3","tokens.spacingGroup2","tokens.textSm","tokens.leadingSm","tokens.fontWeightMedium","ButtonGroup","React","className","orientation","props","ref","styles","jsx","mergeClasses","ButtonGroupText","ButtonGroupSeparator","Separator"],"mappings":";;;;;;AAgBA,MAAMA,IAAYC,EAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,uBAAuB;AAAA,MACrB,QAAQ;AAAA,MACR,UAAU;AAAA,IAAA;AAAA,IAEZ,CAAC,YAAYC,CAAS,mBAAmB,GAAG;AAAA,MAC1C,GAAGC,EAAW,IAAIC,CAAsB;AAAA,IAAA;AAAA,EAC1C;AAAA,EAEF,YAAY;AAAA,IACV,2BAA2B;AAAA,MACzB,qBAAqB;AAAA,MACrB,wBAAwB;AAAA,MACxB,iBAAiB;AAAA,IAAA;AAAA,IAEnB,0BAA0B;AAAA,MACxB,sBAAsB;AAAA,MACtB,yBAAyB;AAAA,IAAA;AAAA,EAC3B;AAAA,EAEF,UAAU;AAAA,IACR,eAAe;AAAA,IACf,2BAA2B;AAAA,MACzB,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MACtB,gBAAgB;AAAA,IAAA;AAAA,IAElB,0BAA0B;AAAA,MACx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AAA,MACC,KAAAF;AAAA,MACA,aAAU;AAAA,MACJ,CAAChB,CAAS,GAAG;AAAA,MACnB,WAAWmB,EAAaF,EAAO,MAAMJ,CAAS;AAAA,MAC7C,GAAGE;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC,GAIYM,IAAuBT,EAAM,WAGxC,SACA,EAAE,WAAAC,GAAW,aAAAC,IAAc,YAAY,GAAGC,EAAA,GAC1CC,GACA;AACA,QAAMC,IAASnB,EAAA;AAEf,SACE,gBAAAoB;AAAA,IAACI;AAAA,IAAA;AAAA,MACC,KAAAN;AAAA,MACA,aAAU;AAAA,MACJ,CAAChB,CAAS,GAAG;AAAA,MACnB,aAAAc;AAAA,MACA,WAAWK;AAAA,QACTF,EAAO;AAAA,QACPH,MAAgB,cAAcG,EAAO;AAAA,QACrCJ;AAAA,MAAA;AAAA,MAED,GAAGE;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as n, jsxs as k } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { mergeClasses as m, SLOT_ATTR as
|
|
3
|
+
import { mergeClasses as m, SLOT_ATTR as s, shorthands as I } from "@epilot/zenith-runtime/v1";
|
|
4
4
|
import { makeZenithStyles as V } from "../../styles/make-styles.js";
|
|
5
5
|
import { spacingGroup2 as w, spacingLayout1 as y, spacingElement2 as v, spacingLayout2 as E, leadingSm as S, textSm as R, fontWeightSemibold as N, leadingBase as $, textBase as j, spacingElement3 as c, spacingElement1 as z } from "../../tokens/index.js";
|
|
6
6
|
import { ClearButton as G } from "../../lib/clear-button.js";
|
|
@@ -63,7 +63,7 @@ const A = a.forwardRef(
|
|
|
63
63
|
), x = a.createContext({
|
|
64
64
|
variant: "info",
|
|
65
65
|
hideIcon: !1
|
|
66
|
-
}), u = "--zenith-callout-bg", d = "--zenith-callout-fg", l = (i, o) => `var(--zenith-${W}
|
|
66
|
+
}), u = "--zenith-callout-bg", d = "--zenith-callout-fg", l = (i, o) => `var(--zenith-${W}-${i}-${o})`, P = {
|
|
67
67
|
info: () => ({
|
|
68
68
|
[u]: l("accent", "soft"),
|
|
69
69
|
[d]: l("accent", "default")
|
|
@@ -111,13 +111,13 @@ const A = a.forwardRef(
|
|
|
111
111
|
// gap-x-3 — no token for 0.75rem.
|
|
112
112
|
columnGap: c
|
|
113
113
|
},
|
|
114
|
-
[`&:has([${
|
|
114
|
+
[`&:has([${s}="callout-icon"])`]: {
|
|
115
115
|
gridTemplateColumns: "1rem 1fr",
|
|
116
116
|
columnGap: c
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
// v1 `[&>[data-slot=callout-icon]]` — SLOT_ATTR, never data-slot (CONVENTIONS rule 4).
|
|
120
|
-
[`& > [${
|
|
120
|
+
[`& > [${s}="callout-icon"]`]: {
|
|
121
121
|
// size-5 — no token for 1.25rem.
|
|
122
122
|
width: "1.25rem",
|
|
123
123
|
height: "1.25rem",
|
|
@@ -191,7 +191,7 @@ const A = a.forwardRef(
|
|
|
191
191
|
hideIcon: e = !1,
|
|
192
192
|
customIcon: r,
|
|
193
193
|
dismissible: f = !1,
|
|
194
|
-
onDismiss:
|
|
194
|
+
onDismiss: C,
|
|
195
195
|
style: p,
|
|
196
196
|
children: L,
|
|
197
197
|
...T
|
|
@@ -200,7 +200,7 @@ const A = a.forwardRef(
|
|
|
200
200
|
if (!M)
|
|
201
201
|
return null;
|
|
202
202
|
const B = () => {
|
|
203
|
-
b(!1),
|
|
203
|
+
b(!1), C == null || C();
|
|
204
204
|
};
|
|
205
205
|
return /* @__PURE__ */ n(x.Provider, { value: { variant: t, hideIcon: e }, children: /* @__PURE__ */ k(
|
|
206
206
|
"div",
|
|
@@ -211,7 +211,7 @@ const A = a.forwardRef(
|
|
|
211
211
|
"data-hide-icon": e ? "true" : "false",
|
|
212
212
|
"data-dismissible": f ? "true" : "false",
|
|
213
213
|
role: "alert",
|
|
214
|
-
[
|
|
214
|
+
[s]: "callout",
|
|
215
215
|
className: m(
|
|
216
216
|
g.root,
|
|
217
217
|
f && g.dismissible,
|
|
@@ -243,7 +243,7 @@ const A = a.forwardRef(
|
|
|
243
243
|
{
|
|
244
244
|
ref: e,
|
|
245
245
|
"data-slot": "callout-title",
|
|
246
|
-
[
|
|
246
|
+
[s]: "callout-title",
|
|
247
247
|
className: m(r.title, o),
|
|
248
248
|
...t
|
|
249
249
|
}
|
|
@@ -256,21 +256,21 @@ const A = a.forwardRef(
|
|
|
256
256
|
{
|
|
257
257
|
ref: e,
|
|
258
258
|
"data-slot": "callout-description",
|
|
259
|
-
[
|
|
259
|
+
[s]: "callout-description",
|
|
260
260
|
className: m(r.description, o),
|
|
261
261
|
...t
|
|
262
262
|
}
|
|
263
263
|
);
|
|
264
264
|
}), a1 = a.forwardRef(function({ className: o, align: t = "start", ...e }, r) {
|
|
265
|
-
const { hideIcon: f } = a.useContext(x),
|
|
265
|
+
const { hideIcon: f } = a.useContext(x), C = h(), p = t === "end" ? C.actionEnd : f ? C.actionStart : C.actionStartIcon;
|
|
266
266
|
return /* @__PURE__ */ n(
|
|
267
267
|
"div",
|
|
268
268
|
{
|
|
269
269
|
ref: r,
|
|
270
270
|
"data-slot": "callout-action",
|
|
271
271
|
"data-align": t,
|
|
272
|
-
[
|
|
273
|
-
className: m(
|
|
272
|
+
[s]: "callout-action",
|
|
273
|
+
className: m(C.action, p, o),
|
|
274
274
|
...e
|
|
275
275
|
}
|
|
276
276
|
);
|
|
@@ -296,7 +296,7 @@ const A = a.forwardRef(
|
|
|
296
296
|
{
|
|
297
297
|
ref: r,
|
|
298
298
|
"data-slot": "callout-icon",
|
|
299
|
-
[
|
|
299
|
+
[s]: "callout-icon",
|
|
300
300
|
customIcon: t,
|
|
301
301
|
className: o,
|
|
302
302
|
...e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callout.js","sources":["../../../src/components/callout/callout.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { NS } from \"../../tokens\"\nimport * as tokens from \"../../tokens\"\nimport { ClearButton } from \"../../lib/clear-button\"\nimport { CloseIcon } from \"../../lib/icons\"\n\n/**\n * Callout — Badge's colour collapse applied to Card's compound pattern, in one makeZenithStyles call.\n *\n * v1 hardcodes two variants per family as class strings (`bg-accent-soft text-accent-a12`, ...).\n * Every variant is the same style shape — soft background, default-graded text — so the family is a\n * VALUE, not a class: two atoms read two inline custom properties that the component sets from the\n * `variant` prop. Adding a family costs zero rules, which the rule-count test asserts.\n *\n * Only five families appear — accent, gray, success, warning, error — and all five are core\n * families (accent / gray / error / warning / success / info ship in the core sheet), so no\n * `ensurePaletteTokens()` install is needed (CONVENTIONS rule 3).\n *\n * The icon/copy grid is gated on the `data-hide-icon` attribute exactly as v1 gates it with the\n * `data-[hide-icon=false]:` variants: when an icon is shown the root becomes a grid whose columns\n * reflow from `0 1fr auto` to `1rem 1fr` whenever an icon child is present. Selectors key on\n * SLOT_ATTR, never on `data-slot` (CONVENTIONS rule 4): v1's `[&>[data-slot=callout-icon]]` and\n * `has-data-[slot=callout-icon]` become a direct-child and a `:has()` rule over SLOT_ATTR.\n *\n * Values ported as literals because no token fits: `p-3` (0.75rem) padding, the icon gap (0.75rem),\n * `size-5` (1.25rem), `pr-10` (2.5rem), `gap-y-0.5` (0.125rem), and `leading-relaxed` (1.625).\n * `leading-none`-style numbers and Tailwind's `calc(var(--spacing)*4)` are resolved to real values.\n *\n * The dismiss button is the shared `ClearButton` from `lib/clear-button.tsx`, exactly as v1\n * composes it — the root keeps only the positioning (`absolute top-2 right-2 size-6`) and passes a\n * size-4 `CloseIcon` child (`lib/icons.tsx`), so hover tint, focus ring and the icon are identical\n * to v1's. `text-current` on the button is a no-op here (the root's `color: var(--FG)` inherits),\n * so it is not passed.\n */\n\nconst InfoIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function InfoIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5345 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V11.75C12.75 11.5375 12.6781 11.3593 12.5343 11.2155C12.3904 11.0718 12.2122 11 11.9997 11C11.7871 11 11.609 11.0718 11.4655 11.2155C11.3218 11.3593 11.25 11.5375 11.25 11.75V16C11.25 16.2125 11.3219 16.3906 11.4658 16.5343C11.6096 16.6781 11.7878 16.75 12.0003 16.75ZM12 9.2885C12.2288 9.2885 12.4207 9.21108 12.5755 9.05625C12.7303 8.90142 12.8077 8.70958 12.8077 8.48075C12.8077 8.25192 12.7303 8.06008 12.5755 7.90525C12.4207 7.75058 12.2288 7.67325 12 7.67325C11.7712 7.67325 11.5793 7.75058 11.4245 7.90525C11.2697 8.06008 11.1923 8.25192 11.1923 8.48075C11.1923 8.70958 11.2697 8.90142 11.4245 9.05625C11.5793 9.21108 11.7712 9.2885 12 9.2885ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nconst WarningIcon = React.forwardRef<\n SVGSVGElement,\n React.ComponentProps<\"svg\">\n>(function WarningIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M3.4255 20.5C3.256 20.5 3.10375 20.4586 2.96875 20.3757C2.83375 20.2929 2.72883 20.1837 2.654 20.048C2.576 19.9133 2.53308 19.7675 2.52525 19.6105C2.51742 19.4535 2.55975 19.298 2.65225 19.144L11.213 4.356C11.3057 4.202 11.4215 4.08817 11.5605 4.0145C11.6997 3.94083 11.8462 3.904 12 3.904C12.1538 3.904 12.3003 3.94083 12.4395 4.0145C12.5785 4.08817 12.6943 4.202 12.787 4.356L21.3477 19.144C21.4402 19.298 21.4826 19.4535 21.4747 19.6105C21.4669 19.7675 21.424 19.9133 21.346 20.048C21.2712 20.1837 21.1663 20.2929 21.0313 20.3757C20.8963 20.4586 20.744 20.5 20.5745 20.5H3.4255ZM12 17.8077C12.2288 17.8077 12.4207 17.7303 12.5755 17.5755C12.7303 17.4207 12.8078 17.2288 12.8078 17C12.8078 16.7712 12.7303 16.5793 12.5755 16.4245C12.4207 16.2697 12.2288 16.1923 12 16.1923C11.7712 16.1923 11.5793 16.2697 11.4245 16.4245C11.2697 16.5793 11.1923 16.7712 11.1923 17C11.1923 17.2288 11.2697 17.4207 11.4245 17.5755C11.5793 17.7303 11.7712 17.8077 12 17.8077ZM12.0003 15.1923C12.2129 15.1923 12.391 15.1204 12.5345 14.9768C12.6782 14.8329 12.75 14.6548 12.75 14.4423V10.9423C12.75 10.7298 12.6781 10.5517 12.5342 10.408C12.3904 10.2642 12.2122 10.1923 11.9997 10.1923C11.7871 10.1923 11.609 10.2642 11.4655 10.408C11.3218 10.5517 11.25 10.7298 11.25 10.9423V14.4423C11.25 14.6548 11.3219 14.8329 11.4658 14.9768C11.6096 15.1204 11.7878 15.1923 12.0003 15.1923Z\" />\n </svg>\n )\n})\n\nconst CheckIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M10.5808 14.1463L8.25775 11.823C8.11925 11.6847 7.94517 11.6138 7.7355 11.6105C7.526 11.6073 7.34875 11.6782 7.20375 11.823C7.05892 11.968 6.9865 12.1437 6.9865 12.35C6.9865 12.5563 7.05892 12.732 7.20375 12.877L9.948 15.6212C10.1288 15.8019 10.3398 15.8922 10.5808 15.8922C10.8218 15.8922 11.0327 15.8019 11.2135 15.6212L16.777 10.0577C16.9153 9.91925 16.9862 9.74517 16.9895 9.5355C16.9927 9.326 16.9218 9.14875 16.777 9.00375C16.632 8.85892 16.4563 8.7865 16.25 8.7865C16.0437 8.7865 15.868 8.85892 15.723 9.00375L10.5808 14.1463ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nconst ErrorIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function ErrorIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12 16.7307C12.2288 16.7307 12.4207 16.6533 12.5755 16.4985C12.7303 16.3437 12.8077 16.1518 12.8077 15.923C12.8077 15.6942 12.7303 15.5023 12.5755 15.3475C12.4207 15.1928 12.2288 15.1155 12 15.1155C11.7712 15.1155 11.5793 15.1928 11.4245 15.3475C11.2697 15.5023 11.1923 15.6942 11.1923 15.923C11.1923 16.1518 11.2697 16.3437 11.4245 16.4985C11.5793 16.6533 11.7712 16.7307 12 16.7307ZM12.0003 13.077C12.2129 13.077 12.391 13.0051 12.5345 12.8613C12.6782 12.7176 12.75 12.5395 12.75 12.327V7.827C12.75 7.6145 12.6781 7.43633 12.5343 7.2925C12.3904 7.14883 12.2122 7.077 11.9997 7.077C11.7871 7.077 11.609 7.14883 11.4655 7.2925C11.3218 7.43633 11.25 7.6145 11.25 7.827V12.327C11.25 12.5395 11.3219 12.7176 11.4658 12.8613C11.6096 13.0051 11.7878 13.077 12.0003 13.077ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nexport type CalloutVariant =\n \"info\" | \"gray\" | \"success\" | \"warning\" | \"destructive\"\n\ntype CalloutContextValue = {\n variant: CalloutVariant\n hideIcon: boolean\n}\n\nconst CalloutContext = React.createContext<CalloutContextValue>({\n variant: \"info\",\n hideIcon: false,\n})\n\n/**\n * The two slots a variant paints. Set inline; read by the root's atoms. Every variant is the same\n * style shape (soft background, default-graded text), so the five entries are data about five\n * families, not five class strings.\n */\nconst BG = \"--zenith-callout-bg\"\nconst FG = \"--zenith-callout-fg\"\n\nconst semantic = (family: string, slot: string): string =>\n `var(--zenith-${NS}-sem-${family}-${slot})`\n\nconst VARIANT_SLOTS: Record<CalloutVariant, () => Record<string, string>> = {\n info: () => ({\n [BG]: semantic(\"accent\", \"soft\"),\n [FG]: semantic(\"accent\", \"default\"),\n }),\n gray: () => ({\n [BG]: semantic(\"gray\", \"soft\"),\n [FG]: semantic(\"gray\", \"default\"),\n }),\n success: () => ({\n [BG]: semantic(\"success\", \"soft\"),\n [FG]: semantic(\"success\", \"default\"),\n }),\n warning: () => ({\n [BG]: semantic(\"warning\", \"soft\"),\n [FG]: semantic(\"warning\", \"default\"),\n }),\n destructive: () => ({\n [BG]: semantic(\"error\", \"soft\"),\n [FG]: semantic(\"error\", \"default\"),\n }),\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n position: \"relative\",\n width: \"100%\",\n // p-3 — no token for 0.75rem.\n paddingTop: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n paddingBottom: tokens.spacingElement3,\n paddingLeft: tokens.spacingElement3,\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n backgroundColor: `var(${BG})`,\n color: `var(${FG})`,\n // `items-center`: present in every state, like v1's base string.\n alignItems: \"center\",\n // v1's `data-[hide-icon=false]:` block — the icon grid kicks in only when an icon renders.\n \"&[data-hide-icon='false']\": {\n display: \"grid\",\n gridTemplateColumns: \"0 1fr auto\",\n // gap-y-0.5 — no token for 0.125rem.\n rowGap: \"0.125rem\",\n // `has-[>svg]` and `has-data-[slot=callout-icon]` collapse to the same re-laid-out grid.\n \"&:has(>svg)\": {\n gridTemplateColumns: \"1rem 1fr\",\n // gap-x-3 — no token for 0.75rem.\n columnGap: tokens.spacingElement3,\n },\n [`&:has([${SLOT_ATTR}=\"callout-icon\"])`]: {\n gridTemplateColumns: \"1rem 1fr\",\n columnGap: tokens.spacingElement3,\n },\n },\n // v1 `[&>[data-slot=callout-icon]]` — SLOT_ATTR, never data-slot (CONVENTIONS rule 4).\n [`& > [${SLOT_ATTR}=\"callout-icon\"]`]: {\n // size-5 — no token for 1.25rem.\n width: \"1.25rem\",\n height: \"1.25rem\",\n flexShrink: 0,\n },\n },\n dismissible: {\n // pr-10 — no token for 2.5rem.\n paddingRight: \"2.5rem\",\n },\n title: {\n gridColumnStart: 2,\n ...shorthands.overflow(\"hidden\"),\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 1,\n // min-h-4\n minHeight: tokens.spacingGroup2,\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n fontWeight: tokens.fontWeightSemibold,\n },\n description: {\n gridColumnStart: 2,\n display: \"grid\",\n justifyItems: \"start\",\n ...shorthands.gap(tokens.spacingElement1),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n \"& p\": {\n // leading-relaxed — no token for a 1.625 line-height.\n lineHeight: 1.625,\n },\n },\n action: {\n display: \"flex\",\n width: \"100%\",\n gridColumnEnd: \"span 3\",\n // mt-2\n marginTop: tokens.spacingElement2,\n },\n actionStart: {\n justifyContent: \"flex-start\",\n },\n actionStartIcon: {\n justifyContent: \"flex-start\",\n // ml-8\n marginLeft: tokens.spacingLayout2,\n },\n actionEnd: {\n justifyContent: \"flex-end\",\n },\n dismiss: {\n position: \"absolute\",\n // top-2 right-2\n top: tokens.spacingElement2,\n right: tokens.spacingElement2,\n // size-6 — the ClearButton itself supplies centering, rounding, hover and focus.\n width: tokens.spacingLayout1,\n height: tokens.spacingLayout1,\n },\n dismissIcon: {\n // size-4\n width: tokens.spacingGroup2,\n height: tokens.spacingGroup2,\n },\n})\n\nexport type CalloutProps = React.ComponentProps<\"div\"> & {\n variant?: CalloutVariant\n hideIcon?: boolean\n customIcon?: React.ReactNode\n /** Shows a top-right close button that dismisses the callout. */\n dismissible?: boolean\n /** Called when the close button is clicked, after the callout hides itself. */\n onDismiss?: () => void\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n function Callout(\n {\n className,\n variant = \"info\",\n hideIcon = false,\n customIcon,\n dismissible = false,\n onDismiss,\n style,\n children,\n ...props\n },\n ref\n ) {\n const [open, setOpen] = React.useState(true)\n const styles = useStyles()\n\n if (!open) {\n return null\n }\n\n const handleDismiss = () => {\n setOpen(false)\n onDismiss?.()\n }\n\n return (\n <CalloutContext.Provider value={{ variant, hideIcon }}>\n <div\n ref={ref}\n data-callout-variant={variant}\n data-slot=\"callout\"\n data-hide-icon={hideIcon ? \"true\" : \"false\"}\n data-dismissible={dismissible ? \"true\" : \"false\"}\n role=\"alert\"\n {...{ [SLOT_ATTR]: \"callout\" }}\n className={mergeClasses(\n styles.root,\n dismissible && styles.dismissible,\n className\n )}\n style={\n { ...VARIANT_SLOTS[variant](), ...style } as React.CSSProperties\n }\n {...props}\n >\n {!hideIcon && <CalloutIcon customIcon={customIcon} />}\n {children}\n {dismissible && (\n <ClearButton\n label=\"Dismiss\"\n onClick={handleDismiss}\n className={styles.dismiss}\n >\n <CloseIcon className={styles.dismissIcon} />\n </ClearButton>\n )}\n </div>\n </CalloutContext.Provider>\n )\n }\n)\n\nexport type CalloutTitleProps = React.ComponentProps<\"div\">\n\nexport const CalloutTitle = React.forwardRef<HTMLDivElement, CalloutTitleProps>(\n function CalloutTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-title\"\n {...{ [SLOT_ATTR]: \"callout-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n }\n)\n\nexport type CalloutDescriptionProps = React.ComponentProps<\"div\">\n\nexport const CalloutDescription = React.forwardRef<\n HTMLDivElement,\n CalloutDescriptionProps\n>(function CalloutDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-description\"\n {...{ [SLOT_ATTR]: \"callout-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n})\n\nexport type CalloutActionProps = React.ComponentProps<\"div\"> & {\n align?: \"start\" | \"end\"\n}\n\nexport const CalloutAction = React.forwardRef<\n HTMLDivElement,\n CalloutActionProps\n>(function CalloutAction({ className, align = \"start\", ...props }, ref) {\n const { hideIcon } = React.useContext(CalloutContext)\n const styles = useStyles()\n\n const alignment =\n align === \"end\"\n ? styles.actionEnd\n : hideIcon\n ? styles.actionStart\n : styles.actionStartIcon\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-action\"\n data-align={align}\n {...{ [SLOT_ATTR]: \"callout-action\" }}\n className={mergeClasses(styles.action, alignment, className)}\n {...props}\n />\n )\n})\n\ntype CalloutVariantIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutVariantIcon = React.forwardRef<\n SVGSVGElement,\n CalloutVariantIconProps\n>(function CalloutVariantIcon({ customIcon, ...props }, ref) {\n const { variant } = React.useContext(CalloutContext)\n\n if (customIcon) {\n return customIcon\n }\n\n switch (variant) {\n case \"info\":\n return <InfoIcon ref={ref} {...props} />\n case \"success\":\n return <CheckIcon ref={ref} {...props} />\n case \"warning\":\n return <WarningIcon ref={ref} {...props} />\n case \"destructive\":\n return <ErrorIcon ref={ref} {...props} />\n }\n\n // gray has no default icon; v1 renders nothing for it.\n return null\n})\n\nexport type CalloutIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutIcon = React.forwardRef<SVGSVGElement, CalloutIconProps>(\n function CalloutIcon({ className, customIcon, ...props }, ref) {\n return (\n <CalloutVariantIcon\n ref={ref}\n data-slot=\"callout-icon\"\n {...{ [SLOT_ATTR]: \"callout-icon\" }}\n customIcon={customIcon}\n className={className}\n {...props}\n />\n )\n }\n)\n"],"names":["InfoIcon","React","props","ref","jsx","WarningIcon","CheckIcon","ErrorIcon","CalloutContext","BG","FG","semantic","family","slot","NS","VARIANT_SLOTS","useStyles","makeZenithStyles","tokens.spacingElement3","tokens.textSm","tokens.leadingSm","SLOT_ATTR","shorthands","tokens.spacingGroup2","tokens.textBase","tokens.leadingBase","tokens.fontWeightSemibold","tokens.spacingElement1","tokens.spacingElement2","tokens.spacingLayout2","tokens.spacingLayout1","Callout","className","variant","hideIcon","customIcon","dismissible","onDismiss","style","children","open","setOpen","styles","handleDismiss","jsxs","mergeClasses","CalloutIcon","ClearButton","CloseIcon","CalloutTitle","CalloutDescription","CalloutAction","align","alignment","CalloutVariantIcon"],"mappings":";;;;;;;;AAwCA,MAAMA,IAAWC,EAAM;AAAA,EACrB,SAAkBC,GAAOC,GAAK;AAC5B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,MAAK;AAAA,QACJ,GAAGD;AAAA,QAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,m8CAAA,CAAm8C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGj9C;AACF,GAEMC,IAAcJ,EAAM,WAGxB,SAAqBC,GAAOC,GAAK;AACjC,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,OAAM;AAAA,MACN,SAAQ;AAAA,MACR,MAAK;AAAA,MACJ,GAAGD;AAAA,MAEJ,UAAA,g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E,EAACC,GAAA,EAAY,KAAAF,GAAW,GAAGD,EAAA,CAAO;AAAA,IAC3C,KAAK;AACH,aAAO,gBAAAE,EAACG,GAAA,EAAU,KAAAJ,GAAW,GAAGD,EAAA,CAAO;AAAA,EAAA;AAI3C,SAAO;AACT,CAAC,GAMK4C,IAAc7C,EAAM;AAAA,EACxB,SAAqB,EAAE,WAAA+B,GAAW,YAAAG,GAAY,GAAGjC,EAAA,GAASC,GAAK;AAC7D,WACE,gBAAAC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,KAAAnD;AAAA,QACA,aAAU;AAAA,QACJ,CAACkB,CAAS,GAAG;AAAA,QACnB,YAAAc;AAAA,QACA,WAAAH;AAAA,QACC,GAAG9B;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
1
|
+
{"version":3,"file":"callout.js","sources":["../../../src/components/callout/callout.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { NS } from \"../../tokens\"\nimport * as tokens from \"../../tokens\"\nimport { ClearButton } from \"../../lib/clear-button\"\nimport { CloseIcon } from \"../../lib/icons\"\n\n/**\n * Callout — Badge's colour collapse applied to Card's compound pattern, in one makeZenithStyles\n * call. v1 hardcodes two variants per family as class strings (`bg-accent-soft text-accent-a12`,\n * ...).\n */\n\nconst InfoIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function InfoIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5345 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V11.75C12.75 11.5375 12.6781 11.3593 12.5343 11.2155C12.3904 11.0718 12.2122 11 11.9997 11C11.7871 11 11.609 11.0718 11.4655 11.2155C11.3218 11.3593 11.25 11.5375 11.25 11.75V16C11.25 16.2125 11.3219 16.3906 11.4658 16.5343C11.6096 16.6781 11.7878 16.75 12.0003 16.75ZM12 9.2885C12.2288 9.2885 12.4207 9.21108 12.5755 9.05625C12.7303 8.90142 12.8077 8.70958 12.8077 8.48075C12.8077 8.25192 12.7303 8.06008 12.5755 7.90525C12.4207 7.75058 12.2288 7.67325 12 7.67325C11.7712 7.67325 11.5793 7.75058 11.4245 7.90525C11.2697 8.06008 11.1923 8.25192 11.1923 8.48075C11.1923 8.70958 11.2697 8.90142 11.4245 9.05625C11.5793 9.21108 11.7712 9.2885 12 9.2885ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nconst WarningIcon = React.forwardRef<\n SVGSVGElement,\n React.ComponentProps<\"svg\">\n>(function WarningIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M3.4255 20.5C3.256 20.5 3.10375 20.4586 2.96875 20.3757C2.83375 20.2929 2.72883 20.1837 2.654 20.048C2.576 19.9133 2.53308 19.7675 2.52525 19.6105C2.51742 19.4535 2.55975 19.298 2.65225 19.144L11.213 4.356C11.3057 4.202 11.4215 4.08817 11.5605 4.0145C11.6997 3.94083 11.8462 3.904 12 3.904C12.1538 3.904 12.3003 3.94083 12.4395 4.0145C12.5785 4.08817 12.6943 4.202 12.787 4.356L21.3477 19.144C21.4402 19.298 21.4826 19.4535 21.4747 19.6105C21.4669 19.7675 21.424 19.9133 21.346 20.048C21.2712 20.1837 21.1663 20.2929 21.0313 20.3757C20.8963 20.4586 20.744 20.5 20.5745 20.5H3.4255ZM12 17.8077C12.2288 17.8077 12.4207 17.7303 12.5755 17.5755C12.7303 17.4207 12.8078 17.2288 12.8078 17C12.8078 16.7712 12.7303 16.5793 12.5755 16.4245C12.4207 16.2697 12.2288 16.1923 12 16.1923C11.7712 16.1923 11.5793 16.2697 11.4245 16.4245C11.2697 16.5793 11.1923 16.7712 11.1923 17C11.1923 17.2288 11.2697 17.4207 11.4245 17.5755C11.5793 17.7303 11.7712 17.8077 12 17.8077ZM12.0003 15.1923C12.2129 15.1923 12.391 15.1204 12.5345 14.9768C12.6782 14.8329 12.75 14.6548 12.75 14.4423V10.9423C12.75 10.7298 12.6781 10.5517 12.5342 10.408C12.3904 10.2642 12.2122 10.1923 11.9997 10.1923C11.7871 10.1923 11.609 10.2642 11.4655 10.408C11.3218 10.5517 11.25 10.7298 11.25 10.9423V14.4423C11.25 14.6548 11.3219 14.8329 11.4658 14.9768C11.6096 15.1204 11.7878 15.1923 12.0003 15.1923Z\" />\n </svg>\n )\n})\n\nconst CheckIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M10.5808 14.1463L8.25775 11.823C8.11925 11.6847 7.94517 11.6138 7.7355 11.6105C7.526 11.6073 7.34875 11.6782 7.20375 11.823C7.05892 11.968 6.9865 12.1437 6.9865 12.35C6.9865 12.5563 7.05892 12.732 7.20375 12.877L9.948 15.6212C10.1288 15.8019 10.3398 15.8922 10.5808 15.8922C10.8218 15.8922 11.0327 15.8019 11.2135 15.6212L16.777 10.0577C16.9153 9.91925 16.9862 9.74517 16.9895 9.5355C16.9927 9.326 16.9218 9.14875 16.777 9.00375C16.632 8.85892 16.4563 8.7865 16.25 8.7865C16.0437 8.7865 15.868 8.85892 15.723 9.00375L10.5808 14.1463ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nconst ErrorIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function ErrorIcon(props, ref) {\n return (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12 16.7307C12.2288 16.7307 12.4207 16.6533 12.5755 16.4985C12.7303 16.3437 12.8077 16.1518 12.8077 15.923C12.8077 15.6942 12.7303 15.5023 12.5755 15.3475C12.4207 15.1928 12.2288 15.1155 12 15.1155C11.7712 15.1155 11.5793 15.1928 11.4245 15.3475C11.2697 15.5023 11.1923 15.6942 11.1923 15.923C11.1923 16.1518 11.2697 16.3437 11.4245 16.4985C11.5793 16.6533 11.7712 16.7307 12 16.7307ZM12.0003 13.077C12.2129 13.077 12.391 13.0051 12.5345 12.8613C12.6782 12.7176 12.75 12.5395 12.75 12.327V7.827C12.75 7.6145 12.6781 7.43633 12.5343 7.2925C12.3904 7.14883 12.2122 7.077 11.9997 7.077C11.7871 7.077 11.609 7.14883 11.4655 7.2925C11.3218 7.43633 11.25 7.6145 11.25 7.827V12.327C11.25 12.5395 11.3219 12.7176 11.4658 12.8613C11.6096 13.0051 11.7878 13.077 12.0003 13.077ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n )\n }\n)\n\nexport type CalloutVariant =\n \"info\" | \"gray\" | \"success\" | \"warning\" | \"destructive\"\n\ntype CalloutContextValue = {\n variant: CalloutVariant\n hideIcon: boolean\n}\n\nconst CalloutContext = React.createContext<CalloutContextValue>({\n variant: \"info\",\n hideIcon: false,\n})\n\n/**\n * The two slots a variant paints. Set inline; read by the root's atoms. Every variant is the same\n * style shape (soft background, default-graded text), so the five entries are data about five\n * families, not five class strings.\n */\nconst BG = \"--zenith-callout-bg\"\nconst FG = \"--zenith-callout-fg\"\n\nconst semantic = (family: string, slot: string): string =>\n `var(--zenith-${NS}-${family}-${slot})`\n\nconst VARIANT_SLOTS: Record<CalloutVariant, () => Record<string, string>> = {\n info: () => ({\n [BG]: semantic(\"accent\", \"soft\"),\n [FG]: semantic(\"accent\", \"default\"),\n }),\n gray: () => ({\n [BG]: semantic(\"gray\", \"soft\"),\n [FG]: semantic(\"gray\", \"default\"),\n }),\n success: () => ({\n [BG]: semantic(\"success\", \"soft\"),\n [FG]: semantic(\"success\", \"default\"),\n }),\n warning: () => ({\n [BG]: semantic(\"warning\", \"soft\"),\n [FG]: semantic(\"warning\", \"default\"),\n }),\n destructive: () => ({\n [BG]: semantic(\"error\", \"soft\"),\n [FG]: semantic(\"error\", \"default\"),\n }),\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n position: \"relative\",\n width: \"100%\",\n // p-3 — no token for 0.75rem.\n paddingTop: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n paddingBottom: tokens.spacingElement3,\n paddingLeft: tokens.spacingElement3,\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n backgroundColor: `var(${BG})`,\n color: `var(${FG})`,\n // `items-center`: present in every state, like v1's base string.\n alignItems: \"center\",\n // v1's `data-[hide-icon=false]:` block — the icon grid kicks in only when an icon renders.\n \"&[data-hide-icon='false']\": {\n display: \"grid\",\n gridTemplateColumns: \"0 1fr auto\",\n // gap-y-0.5 — no token for 0.125rem.\n rowGap: \"0.125rem\",\n // `has-[>svg]` and `has-data-[slot=callout-icon]` collapse to the same re-laid-out grid.\n \"&:has(>svg)\": {\n gridTemplateColumns: \"1rem 1fr\",\n // gap-x-3 — no token for 0.75rem.\n columnGap: tokens.spacingElement3,\n },\n [`&:has([${SLOT_ATTR}=\"callout-icon\"])`]: {\n gridTemplateColumns: \"1rem 1fr\",\n columnGap: tokens.spacingElement3,\n },\n },\n // v1 `[&>[data-slot=callout-icon]]` — SLOT_ATTR, never data-slot (CONVENTIONS rule 4).\n [`& > [${SLOT_ATTR}=\"callout-icon\"]`]: {\n // size-5 — no token for 1.25rem.\n width: \"1.25rem\",\n height: \"1.25rem\",\n flexShrink: 0,\n },\n },\n dismissible: {\n // pr-10 — no token for 2.5rem.\n paddingRight: \"2.5rem\",\n },\n title: {\n gridColumnStart: 2,\n ...shorthands.overflow(\"hidden\"),\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 1,\n // min-h-4\n minHeight: tokens.spacingGroup2,\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n fontWeight: tokens.fontWeightSemibold,\n },\n description: {\n gridColumnStart: 2,\n display: \"grid\",\n justifyItems: \"start\",\n ...shorthands.gap(tokens.spacingElement1),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n \"& p\": {\n // leading-relaxed — no token for a 1.625 line-height.\n lineHeight: 1.625,\n },\n },\n action: {\n display: \"flex\",\n width: \"100%\",\n gridColumnEnd: \"span 3\",\n // mt-2\n marginTop: tokens.spacingElement2,\n },\n actionStart: {\n justifyContent: \"flex-start\",\n },\n actionStartIcon: {\n justifyContent: \"flex-start\",\n // ml-8\n marginLeft: tokens.spacingLayout2,\n },\n actionEnd: {\n justifyContent: \"flex-end\",\n },\n dismiss: {\n position: \"absolute\",\n // top-2 right-2\n top: tokens.spacingElement2,\n right: tokens.spacingElement2,\n // size-6 — the ClearButton itself supplies centering, rounding, hover and focus.\n width: tokens.spacingLayout1,\n height: tokens.spacingLayout1,\n },\n dismissIcon: {\n // size-4\n width: tokens.spacingGroup2,\n height: tokens.spacingGroup2,\n },\n})\n\nexport type CalloutProps = React.ComponentProps<\"div\"> & {\n variant?: CalloutVariant\n hideIcon?: boolean\n customIcon?: React.ReactNode\n /** Shows a top-right close button that dismisses the callout. */\n dismissible?: boolean\n /** Called when the close button is clicked, after the callout hides itself. */\n onDismiss?: () => void\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n function Callout(\n {\n className,\n variant = \"info\",\n hideIcon = false,\n customIcon,\n dismissible = false,\n onDismiss,\n style,\n children,\n ...props\n },\n ref\n ) {\n const [open, setOpen] = React.useState(true)\n const styles = useStyles()\n\n if (!open) {\n return null\n }\n\n const handleDismiss = () => {\n setOpen(false)\n onDismiss?.()\n }\n\n return (\n <CalloutContext.Provider value={{ variant, hideIcon }}>\n <div\n ref={ref}\n data-callout-variant={variant}\n data-slot=\"callout\"\n data-hide-icon={hideIcon ? \"true\" : \"false\"}\n data-dismissible={dismissible ? \"true\" : \"false\"}\n role=\"alert\"\n {...{ [SLOT_ATTR]: \"callout\" }}\n className={mergeClasses(\n styles.root,\n dismissible && styles.dismissible,\n className\n )}\n style={\n { ...VARIANT_SLOTS[variant](), ...style } as React.CSSProperties\n }\n {...props}\n >\n {!hideIcon && <CalloutIcon customIcon={customIcon} />}\n {children}\n {dismissible && (\n <ClearButton\n label=\"Dismiss\"\n onClick={handleDismiss}\n className={styles.dismiss}\n >\n <CloseIcon className={styles.dismissIcon} />\n </ClearButton>\n )}\n </div>\n </CalloutContext.Provider>\n )\n }\n)\n\nexport type CalloutTitleProps = React.ComponentProps<\"div\">\n\nexport const CalloutTitle = React.forwardRef<HTMLDivElement, CalloutTitleProps>(\n function CalloutTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-title\"\n {...{ [SLOT_ATTR]: \"callout-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n }\n)\n\nexport type CalloutDescriptionProps = React.ComponentProps<\"div\">\n\nexport const CalloutDescription = React.forwardRef<\n HTMLDivElement,\n CalloutDescriptionProps\n>(function CalloutDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-description\"\n {...{ [SLOT_ATTR]: \"callout-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n})\n\nexport type CalloutActionProps = React.ComponentProps<\"div\"> & {\n align?: \"start\" | \"end\"\n}\n\nexport const CalloutAction = React.forwardRef<\n HTMLDivElement,\n CalloutActionProps\n>(function CalloutAction({ className, align = \"start\", ...props }, ref) {\n const { hideIcon } = React.useContext(CalloutContext)\n const styles = useStyles()\n\n const alignment =\n align === \"end\"\n ? styles.actionEnd\n : hideIcon\n ? styles.actionStart\n : styles.actionStartIcon\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-action\"\n data-align={align}\n {...{ [SLOT_ATTR]: \"callout-action\" }}\n className={mergeClasses(styles.action, alignment, className)}\n {...props}\n />\n )\n})\n\ntype CalloutVariantIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutVariantIcon = React.forwardRef<\n SVGSVGElement,\n CalloutVariantIconProps\n>(function CalloutVariantIcon({ customIcon, ...props }, ref) {\n const { variant } = React.useContext(CalloutContext)\n\n if (customIcon) {\n return customIcon\n }\n\n switch (variant) {\n case \"info\":\n return <InfoIcon ref={ref} {...props} />\n case \"success\":\n return <CheckIcon ref={ref} {...props} />\n case \"warning\":\n return <WarningIcon ref={ref} {...props} />\n case \"destructive\":\n return <ErrorIcon ref={ref} {...props} />\n }\n\n // gray has no default icon; v1 renders nothing for it.\n return null\n})\n\nexport type CalloutIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutIcon = React.forwardRef<SVGSVGElement, CalloutIconProps>(\n function CalloutIcon({ className, customIcon, ...props }, ref) {\n return (\n <CalloutVariantIcon\n ref={ref}\n data-slot=\"callout-icon\"\n {...{ [SLOT_ATTR]: \"callout-icon\" }}\n customIcon={customIcon}\n className={className}\n {...props}\n />\n )\n }\n)\n"],"names":["InfoIcon","React","props","ref","jsx","WarningIcon","CheckIcon","ErrorIcon","CalloutContext","BG","FG","semantic","family","slot","NS","VARIANT_SLOTS","useStyles","makeZenithStyles","tokens.spacingElement3","tokens.textSm","tokens.leadingSm","SLOT_ATTR","shorthands","tokens.spacingGroup2","tokens.textBase","tokens.leadingBase","tokens.fontWeightSemibold","tokens.spacingElement1","tokens.spacingElement2","tokens.spacingLayout2","tokens.spacingLayout1","Callout","className","variant","hideIcon","customIcon","dismissible","onDismiss","style","children","open","setOpen","styles","handleDismiss","jsxs","mergeClasses","CalloutIcon","ClearButton","CloseIcon","CalloutTitle","CalloutDescription","CalloutAction","align","alignment","CalloutVariantIcon"],"mappings":";;;;;;;;AAiBA,MAAMA,IAAWC,EAAM;AAAA,EACrB,SAAkBC,GAAOC,GAAK;AAC5B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,MAAK;AAAA,QACJ,GAAGD;AAAA,QAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,m8CAAA,CAAm8C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGj9C;AACF,GAEMC,IAAcJ,EAAM,WAGxB,SAAqBC,GAAOC,GAAK;AACjC,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,OAAM;AAAA,MACN,SAAQ;AAAA,MACR,MAAK;AAAA,MACJ,GAAGD;AAAA,MAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,i1CAAA,CAAi1C;AAAA,IAAA;AAAA,EAAA;AAG/1C,CAAC,GAEKE,IAAYL,EAAM;AAAA,EACtB,SAAmBC,GAAOC,GAAK;AAC7B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,MAAK;AAAA,QACJ,GAAGD;AAAA,QAEJ,UAAA,gBAAAE,EAAC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,MAACkD;AAAA,MAAA;AAAA,QACC,KAAAnD;AAAA,QACA,aAAU;AAAA,QACJ,CAACkB,CAAS,GAAG;AAAA,QACnB,YAAAc;AAAA,QACA,WAAAH;AAAA,QACC,GAAG9B;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sources":["../../../src/components/card/card.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * Card — the first compound component: ONE `makeZenithStyles` call for the whole family, one slot
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../../../src/components/card/card.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * Card — the first compound component: ONE `makeZenithStyles` call for the whole family, one slot\n * per sub-component, and each sub-component reads its own slot. Callout, Breadcrumb and Table copy\n * this pattern.\n */\n\nconst useStyles = makeZenithStyles({\n root: {\n backgroundColor: tokens.body,\n display: \"flex\",\n flexDirection: \"column\",\n ...shorthands.gap(tokens.spacingGroup2),\n ...shorthands.borderRadius(tokens.radiusXl),\n ...shorthands.border(\"1px\", \"solid\", \"transparent\"),\n paddingTop: tokens.spacingGroup2,\n paddingBottom: tokens.spacingGroup2,\n boxShadow: \"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)\",\n },\n header: {\n containerType: \"inline-size\",\n containerName: \"card-header\",\n display: \"grid\",\n gridAutoRows: \"min-content\",\n gridTemplateRows: \"auto auto\",\n alignItems: \"start\",\n ...shorthands.gap(tokens.spacingElement2),\n paddingLeft: tokens.spacingGroup2,\n paddingRight: tokens.spacingGroup2,\n \"&:is(.border-b)\": {\n paddingBottom: tokens.spacingGroup2,\n },\n [`&:has([${SLOT_ATTR}=\"card-action\"])`]: {\n gridTemplateColumns: \"1fr auto\",\n },\n },\n title: {\n // v1 `leading-none` — a literal 1 because no token exists for it.\n lineHeight: 1,\n fontWeight: tokens.fontWeightSemibold,\n },\n description: {\n color: tokens.grayA11,\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n },\n action: {\n gridColumnStart: 2,\n gridRowStart: 1,\n gridRowEnd: \"span 2\",\n alignSelf: \"start\",\n justifySelf: \"end\",\n },\n content: {\n paddingLeft: tokens.spacingGroup2,\n paddingRight: tokens.spacingGroup2,\n },\n footer: {\n display: \"flex\",\n alignItems: \"center\",\n paddingLeft: tokens.spacingGroup2,\n paddingRight: tokens.spacingGroup2,\n \"&:is(.border-t)\": {\n paddingTop: tokens.spacingGroup2,\n },\n },\n})\n\nexport type CardProps = React.ComponentProps<\"div\">\n\nexport const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(\n { className, ...props },\n ref\n) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card\"\n {...{ [SLOT_ATTR]: \"card\" }}\n className={mergeClasses(styles.root, className)}\n {...props}\n />\n )\n})\n\nexport const CardHeader = React.forwardRef<HTMLDivElement, CardProps>(\n function CardHeader({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-header\"\n {...{ [SLOT_ATTR]: \"card-header\" }}\n className={mergeClasses(styles.header, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardTitle = React.forwardRef<HTMLDivElement, CardProps>(\n function CardTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-title\"\n {...{ [SLOT_ATTR]: \"card-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardDescription = React.forwardRef<HTMLDivElement, CardProps>(\n function CardDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-description\"\n {...{ [SLOT_ATTR]: \"card-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardAction = React.forwardRef<HTMLDivElement, CardProps>(\n function CardAction({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-action\"\n {...{ [SLOT_ATTR]: \"card-action\" }}\n className={mergeClasses(styles.action, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardContent = React.forwardRef<HTMLDivElement, CardProps>(\n function CardContent({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-content\"\n {...{ [SLOT_ATTR]: \"card-content\" }}\n className={mergeClasses(styles.content, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardFooter = React.forwardRef<HTMLDivElement, CardProps>(\n function CardFooter({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-footer\"\n {...{ [SLOT_ATTR]: \"card-footer\" }}\n className={mergeClasses(styles.footer, className)}\n {...props}\n />\n )\n }\n)\n"],"names":["useStyles","makeZenithStyles","tokens.body","shorthands","tokens.spacingGroup2","tokens.radiusXl","tokens.spacingElement2","SLOT_ATTR","tokens.fontWeightSemibold","tokens.grayA11","tokens.textSm","tokens.leadingSm","Card","React","className","props","ref","styles","jsx","mergeClasses","CardHeader","CardTitle","CardDescription","CardAction","CardContent","CardFooter"],"mappings":";;;;;AAcA,MAAMA,IAAYC,EAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,iBAAiBC;AAAAA,IACjB,SAAS;AAAA,IACT,eAAe;AAAA,IACf,GAAGC,EAAW,IAAIC,CAAoB;AAAA,IACtC,GAAGD,EAAW,aAAaE,CAAe;AAAA,IAC1C,GAAGF,EAAW,OAAO,OAAO,SAAS,aAA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;AAAA,QACnB,WAAWY,EAAaF,EAAO,QAAQH,CAAS;AAAA,QAC/C,GAAGC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF,GAEaS,IAAcX,EAAM;AAAA,EAC/B,SAAqB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,GAAK;AACjD,UAAMC,IAASjB,EAAA;AAEf,WACE,gBAAAkB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAF;AAAA,QACA,aAAU;AAAA,QACJ,CAACT,CAAS,GAAG;AAAA,QACnB,WAAWY,EAAaF,EAAO,SAASH,CAAS;AAAA,QAChD,GAAGC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF,GAEaU,IAAaZ,EAAM;AAAA,EAC9B,SAAoB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,GAAK;AAChD,UAAMC,IAASjB,EAAA;AAEf,WACE,gBAAAkB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAF;AAAA,QACA,aAAU;AAAA,QACJ,CAACT,CAAS,GAAG;AAAA,QACnB,WAAWY,EAAaF,EAAO,QAAQH,CAAS;AAAA,QAC/C,GAAGC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import { Checkbox as m, CheckboxIndicator as u } from "../../vendor/.bun/@radix-ui_react-checkbox@1.3.3_2b23df507bdda662/vendor/@radix-ui/react-checkbox/dist/index.js";
|
|
4
|
-
import { SLOT_ATTR as i, mergeClasses as x, shorthands as
|
|
4
|
+
import { SLOT_ATTR as i, mergeClasses as x, shorthands as e } from "@epilot/zenith-runtime/v1";
|
|
5
5
|
import { makeZenithStyles as b } from "../../styles/make-styles.js";
|
|
6
|
-
import {
|
|
7
|
-
const S = n.forwardRef(function(
|
|
6
|
+
import { accentContrast as p, accentSolid as f, accentOnSoft as g, accentA7 as s, focusRing as d, radiusSm as k, accentSoft as w, errorA8 as C, grayA4 as v } from "../../tokens/index.js";
|
|
7
|
+
const S = n.forwardRef(function(r, t) {
|
|
8
8
|
return /* @__PURE__ */ o(
|
|
9
9
|
"svg",
|
|
10
10
|
{
|
|
@@ -16,11 +16,11 @@ const S = n.forwardRef(function(e, t) {
|
|
|
16
16
|
viewBox: "0 -960 960 960",
|
|
17
17
|
width: "24px",
|
|
18
18
|
fill: "currentColor",
|
|
19
|
-
...
|
|
19
|
+
...r,
|
|
20
20
|
children: /* @__PURE__ */ o("path", { d: "m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z" })
|
|
21
21
|
}
|
|
22
22
|
);
|
|
23
|
-
}), y = n.forwardRef(function(
|
|
23
|
+
}), y = n.forwardRef(function(r, t) {
|
|
24
24
|
return /* @__PURE__ */ o(
|
|
25
25
|
"svg",
|
|
26
26
|
{
|
|
@@ -32,13 +32,13 @@ const S = n.forwardRef(function(e, t) {
|
|
|
32
32
|
viewBox: "0 -960 960 960",
|
|
33
33
|
width: "24px",
|
|
34
34
|
fill: "currentColor",
|
|
35
|
-
...
|
|
35
|
+
...r,
|
|
36
36
|
children: /* @__PURE__ */ o("path", { d: "M280-440q-17 0-28.5-11.5T240-480q0-17 11.5-28.5T280-520h400q17 0 28.5 11.5T720-480q0 17-11.5 28.5T680-440H280Z" })
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
}), T = b({
|
|
40
40
|
root: {
|
|
41
|
-
...
|
|
41
|
+
...e.border("1px", "solid", s),
|
|
42
42
|
backgroundColor: w,
|
|
43
43
|
display: "inline-block",
|
|
44
44
|
boxSizing: "border-box",
|
|
@@ -63,20 +63,20 @@ const S = n.forwardRef(function(e, t) {
|
|
|
63
63
|
"&[data-disabled]": {
|
|
64
64
|
cursor: "not-allowed",
|
|
65
65
|
opacity: 0.5,
|
|
66
|
-
...
|
|
66
|
+
...e.borderColor(v)
|
|
67
67
|
},
|
|
68
68
|
"&[aria-invalid='true']": {
|
|
69
69
|
outlineColor: d,
|
|
70
|
-
...
|
|
70
|
+
...e.borderColor(C)
|
|
71
71
|
},
|
|
72
72
|
"&[data-state='indeterminate']": {
|
|
73
73
|
backgroundColor: s,
|
|
74
|
-
...
|
|
74
|
+
...e.borderColor("transparent"),
|
|
75
75
|
color: g
|
|
76
76
|
},
|
|
77
77
|
"&[data-state='checked']": {
|
|
78
78
|
backgroundColor: f,
|
|
79
|
-
...
|
|
79
|
+
...e.borderWidth("0px"),
|
|
80
80
|
color: p
|
|
81
81
|
},
|
|
82
82
|
"&[data-state='checked'] svg, &[data-state='indeterminate'] svg": {
|
|
@@ -95,7 +95,7 @@ const S = n.forwardRef(function(e, t) {
|
|
|
95
95
|
height: "0.875rem"
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
}), M = n.forwardRef(function({ className:
|
|
98
|
+
}), M = n.forwardRef(function({ className: r, checked: t, ...l }, h) {
|
|
99
99
|
const a = T();
|
|
100
100
|
return /* @__PURE__ */ o(
|
|
101
101
|
m,
|
|
@@ -104,7 +104,7 @@ const S = n.forwardRef(function(e, t) {
|
|
|
104
104
|
checked: t,
|
|
105
105
|
"data-slot": "checkbox",
|
|
106
106
|
[i]: "checkbox",
|
|
107
|
-
className: x(a.root,
|
|
107
|
+
className: x(a.root, r),
|
|
108
108
|
...l,
|
|
109
109
|
children: /* @__PURE__ */ o(
|
|
110
110
|
u,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\nconst CheckIcon = React.forwardRef<\n SVGSVGElement,\n React.SVGProps<SVGSVGElement>\n>(function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\n data-slot=\"checkbox-check-icon\"\n {...{ [SLOT_ATTR]: \"checkbox-check-icon\" }}\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 -960 960 960\"\n width=\"24px\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z\" />\n </svg>\n )\n})\n\nconst MinusIcon = React.forwardRef<\n SVGSVGElement,\n React.SVGProps<SVGSVGElement>\n>(function MinusIcon(props, ref) {\n return (\n <svg\n ref={ref}\n data-slot=\"checkbox-minus-icon\"\n {...{ [SLOT_ATTR]: \"checkbox-minus-icon\" }}\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 -960 960 960\"\n width=\"24px\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M280-440q-17 0-28.5-11.5T240-480q0-17 11.5-28.5T280-520h400q17 0 28.5 11.5T720-480q0 17-11.5 28.5T680-440H280Z\" />\n </svg>\n )\n})\n\nconst useStyles = makeZenithStyles({\n root: {\n ...shorthands.border(\"1px\", \"solid\", tokens.accentA7),\n backgroundColor: tokens.
|
|
1
|
+
{"version":3,"file":"checkbox.js","sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\nconst CheckIcon = React.forwardRef<\n SVGSVGElement,\n React.SVGProps<SVGSVGElement>\n>(function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\n data-slot=\"checkbox-check-icon\"\n {...{ [SLOT_ATTR]: \"checkbox-check-icon\" }}\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 -960 960 960\"\n width=\"24px\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"m382-354 339-339q12-12 28-12t28 12q12 12 12 28.5T777-636L410-268q-12 12-28 12t-28-12L182-440q-12-12-11.5-28.5T183-497q12-12 28.5-12t28.5 12l142 143Z\" />\n </svg>\n )\n})\n\nconst MinusIcon = React.forwardRef<\n SVGSVGElement,\n React.SVGProps<SVGSVGElement>\n>(function MinusIcon(props, ref) {\n return (\n <svg\n ref={ref}\n data-slot=\"checkbox-minus-icon\"\n {...{ [SLOT_ATTR]: \"checkbox-minus-icon\" }}\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"24px\"\n viewBox=\"0 -960 960 960\"\n width=\"24px\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M280-440q-17 0-28.5-11.5T240-480q0-17 11.5-28.5T280-520h400q17 0 28.5 11.5T720-480q0 17-11.5 28.5T680-440H280Z\" />\n </svg>\n )\n})\n\nconst useStyles = makeZenithStyles({\n root: {\n ...shorthands.border(\"1px\", \"solid\", tokens.accentA7),\n backgroundColor: tokens.accentSoft,\n display: \"inline-block\",\n boxSizing: \"border-box\",\n width: \"1rem\",\n height: \"1rem\",\n flexShrink: 0,\n borderRadius: tokens.radiusSm,\n // v1 `shadow-xs` — elevation comes from Tailwind's shadow scale, which has no token (B7).\n boxShadow: \"0 1px 2px 0 #0000000d\",\n transitionProperty: \"box-shadow\",\n transitionTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n transitionDuration: \"150ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n \":focus-visible\": {\n outlineOffset: \"2px\",\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineColor: tokens.focusRing,\n },\n \"&[data-disabled]\": {\n cursor: \"not-allowed\",\n opacity: 0.5,\n ...shorthands.borderColor(tokens.grayA4),\n },\n \"&[aria-invalid='true']\": {\n outlineColor: tokens.focusRing,\n ...shorthands.borderColor(tokens.errorA8),\n },\n \"&[data-state='indeterminate']\": {\n backgroundColor: tokens.accentA7,\n ...shorthands.borderColor(\"transparent\"),\n color: tokens.accentOnSoft,\n },\n \"&[data-state='checked']\": {\n backgroundColor: tokens.accentSolid,\n ...shorthands.borderWidth(\"0px\"),\n color: tokens.accentContrast,\n },\n \"&[data-state='checked'] svg, &[data-state='indeterminate'] svg\": {\n width: \"0.875rem\",\n height: \"0.875rem\",\n },\n },\n indicator: {\n display: \"grid\",\n placeContent: \"center\",\n height: \"100%\",\n color: \"currentColor\",\n transitionProperty: \"none\",\n \"& svg\": {\n width: \"0.875rem\",\n height: \"0.875rem\",\n },\n },\n})\n\nexport type CheckboxProps = React.ComponentProps<typeof CheckboxPrimitive.Root>\n\nexport const Checkbox = React.forwardRef<\n React.ComponentRef<typeof CheckboxPrimitive.Root>,\n CheckboxProps\n>(function Checkbox({ className, checked, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <CheckboxPrimitive.Root\n ref={ref}\n checked={checked}\n data-slot=\"checkbox\"\n {...{ [SLOT_ATTR]: \"checkbox\" }}\n className={mergeClasses(styles.root, className)}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n {...{ [SLOT_ATTR]: \"checkbox-indicator\" }}\n className={styles.indicator}\n >\n {checked === \"indeterminate\" ? <MinusIcon /> : <CheckIcon />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n )\n})\n"],"names":["CheckIcon","React","props","ref","jsx","SLOT_ATTR","MinusIcon","useStyles","makeZenithStyles","shorthands","tokens.accentA7","tokens.accentSoft","tokens.radiusSm","tokens.focusRing","tokens.grayA4","tokens.errorA8","tokens.accentOnSoft","tokens.accentSolid","tokens.accentContrast","Checkbox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gBAAAlB,EAACE,GAAA,EAAU,sBAAMN,GAAA,CAAA,CAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IAC5D;AAAA,EAAA;AAGN,CAAC;"}
|
|
@@ -2,12 +2,12 @@ import { jsxs as g, jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import * as a from "react";
|
|
3
3
|
import { SLOT_ATTR as t, mergeClasses as m, shorthands as l } from "@epilot/zenith-runtime/v1";
|
|
4
4
|
import { makeZenithStyles as oe } from "../../styles/make-styles.js";
|
|
5
|
-
import { surfaceContainer as T, spacingElement3 as X, spacingElement2 as p, grayA8 as te, grayA2 as j,
|
|
5
|
+
import { surfaceContainer as T, spacingElement3 as X, spacingElement2 as p, grayA8 as te, grayA2 as j, focusRing as ie, grayA12 as D, leadingXs as R, textXs as $, fontMono as E, spacingElement05 as b, grayA11 as le, fontWeightMedium as ae, surfaceRadiusContainer as ne, borderWidthContainer as Y, surfaceSep as re, spacingElement1 as ce, borderContainer as de } from "../../tokens/index.js";
|
|
6
6
|
import { Button as se } from "../button/button.js";
|
|
7
7
|
import { highlightCode as pe, splitTokenLines as he } from "../../lib/code-highlight.js";
|
|
8
8
|
import { useCodeTokenRenderer as ue } from "../../lib/code-tokens.js";
|
|
9
9
|
import { gutterDigits as fe } from "../../lib/code-lines.js";
|
|
10
|
-
const me = 2e3,
|
|
10
|
+
const me = 2e3, F = "--zenith-code-gutter", be = oe({
|
|
11
11
|
root: {
|
|
12
12
|
display: "flex",
|
|
13
13
|
flexDirection: "column",
|
|
@@ -16,7 +16,7 @@ const me = 2e3, Y = "--zenith-code-gutter", be = oe({
|
|
|
16
16
|
// The same role recipe Surface's `section` uses, and the same property shapes, so a caller's
|
|
17
17
|
// own border or radius replaces these through `mergeClasses` without a wrapper.
|
|
18
18
|
backgroundColor: T,
|
|
19
|
-
...l.borderWidth(
|
|
19
|
+
...l.borderWidth(Y),
|
|
20
20
|
...l.borderStyle("solid"),
|
|
21
21
|
...l.borderColor(de),
|
|
22
22
|
borderRadius: ne,
|
|
@@ -38,7 +38,7 @@ const me = 2e3, Y = "--zenith-code-gutter", be = oe({
|
|
|
38
38
|
// helper, and a bare `borderBottomWidth: …` alongside a neighbour's `borderWidth` shorthand
|
|
39
39
|
// is exactly the property-shape mismatch AGENTS.md rule 3 warns about.
|
|
40
40
|
...l.borderBottom(
|
|
41
|
-
|
|
41
|
+
Y,
|
|
42
42
|
"solid",
|
|
43
43
|
re
|
|
44
44
|
)
|
|
@@ -158,7 +158,7 @@ const me = 2e3, Y = "--zenith-code-gutter", be = oe({
|
|
|
158
158
|
flexShrink: 0,
|
|
159
159
|
color: te,
|
|
160
160
|
boxSizing: "border-box",
|
|
161
|
-
width: `calc(var(${
|
|
161
|
+
width: `calc(var(${F}) + ${p} + ${X})`,
|
|
162
162
|
paddingLeft: p,
|
|
163
163
|
paddingRight: X,
|
|
164
164
|
// Opaque because horizontally scrolled code passes beneath the sticky gutter.
|
|
@@ -266,7 +266,7 @@ const me = 2e3, Y = "--zenith-code-gutter", be = oe({
|
|
|
266
266
|
() => v && f !== null ? he(f) : null,
|
|
267
267
|
[f, v]
|
|
268
268
|
), N = S !== void 0 && S !== "", M = c !== void 0 && c !== "", G = W["aria-label"], q = W["aria-labelledby"], H = N ? I : q, J = H !== void 0 || G !== void 0, O = h === "copied" ? _ : h === "error" ? K : P, Q = N || M, ee = s === null ? B : {
|
|
269
|
-
[
|
|
269
|
+
[F]: `${fe(s.length)}ch`,
|
|
270
270
|
...B
|
|
271
271
|
};
|
|
272
272
|
return /* @__PURE__ */ g(
|