@epilot/zenith-react 0.1.0-next.1 → 0.2.0-next.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 +79 -10
- package/dist/components/alert-dialog/alert-dialog.js +48 -47
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- 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/callout/callout.js +42 -40
- package/dist/components/callout/callout.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/command/command.js +6 -6
- 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 +196 -179
- 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/date-time-picker-input.js +127 -114
- package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker.js +91 -88
- package/dist/components/date-time-picker/date-time-picker.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/dialog/dialog.js +74 -72
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.js +69 -67
- 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 +207 -176
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/list/list.js +40 -40
- 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/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/tabs/tabs.js +131 -76
- package/dist/components/tabs/tabs.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 +26 -26
- 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/index.d.ts +1940 -1867
- package/dist/index.js +133 -121
- package/dist/index.js.map +1 -1
- package/dist/packages/tokens/dist/generated/core.generated.js +13 -22
- package/dist/packages/tokens/dist/generated/core.generated.js.map +1 -1
- 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 +5 -5
- package/dist/packages/tokens/dist/install.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.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 -3
|
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as x } from "react/jsx-runtime";
|
|
|
2
2
|
import * as o from "react";
|
|
3
3
|
import { SLOT_ATTR as c, mergeClasses as u, shorthands as b } from "@epilot/zenith-runtime/v1";
|
|
4
4
|
import { makeZenithStyles as B } from "../../styles/make-styles.js";
|
|
5
|
-
import {
|
|
5
|
+
import { grayDefault as p, fontWeightSemibold as f, accentA8 as L, grayLight as g, leadingBase as R, textBase as S, spacingElement1 as I, spacingElement2 as N } from "../../tokens/index.js";
|
|
6
6
|
import { Root as T } from "../../vendor/.bun/@radix-ui_react-slot@1.2.4_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js";
|
|
7
7
|
const h = B({
|
|
8
8
|
list: {
|
|
@@ -45,24 +45,24 @@ const h = B({
|
|
|
45
45
|
color: p
|
|
46
46
|
}
|
|
47
47
|
}), w = o.forwardRef(
|
|
48
|
-
function({ separator: t = "/", className: a, children: i, ...n },
|
|
49
|
-
const
|
|
48
|
+
function({ separator: t = "/", className: a, children: i, ...n }, l) {
|
|
49
|
+
const s = h(), m = o.Children.toArray(i).filter(o.isValidElement);
|
|
50
50
|
return /* @__PURE__ */ e(
|
|
51
51
|
"nav",
|
|
52
52
|
{
|
|
53
|
-
ref:
|
|
53
|
+
ref: l,
|
|
54
54
|
"data-slot": "breadcrumb",
|
|
55
55
|
[c]: "breadcrumb",
|
|
56
56
|
"aria-label": "Breadcrumb",
|
|
57
57
|
className: a,
|
|
58
58
|
...n,
|
|
59
|
-
children: /* @__PURE__ */ e("ol", { className:
|
|
59
|
+
children: /* @__PURE__ */ e("ol", { className: s.list, children: m.map((r, d) => /* @__PURE__ */ x(o.Fragment, { children: [
|
|
60
60
|
d > 0 && /* @__PURE__ */ e(
|
|
61
61
|
"li",
|
|
62
62
|
{
|
|
63
63
|
role: "presentation",
|
|
64
64
|
"aria-hidden": "true",
|
|
65
|
-
className:
|
|
65
|
+
className: s.separator,
|
|
66
66
|
children: t
|
|
67
67
|
}
|
|
68
68
|
),
|
|
@@ -71,16 +71,16 @@ const h = B({
|
|
|
71
71
|
}
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
|
-
), z = o.forwardRef(function({ href: t, isCurrent: a = !1, className: i, children: n, asChild:
|
|
75
|
-
const r = h(), y = !!t ||
|
|
76
|
-
|
|
74
|
+
), z = o.forwardRef(function({ href: t, isCurrent: a = !1, className: i, children: n, asChild: l = !1, ...s }, m) {
|
|
75
|
+
const r = h(), y = !!t || l ? /* @__PURE__ */ e(
|
|
76
|
+
l ? T : "a",
|
|
77
77
|
{
|
|
78
78
|
"data-slot": "breadcrumb-link",
|
|
79
79
|
[c]: "breadcrumb-link",
|
|
80
80
|
...t ? { href: t } : {},
|
|
81
81
|
className: u(r.link, i),
|
|
82
82
|
...a ? { "aria-current": "page" } : {},
|
|
83
|
-
...
|
|
83
|
+
...s,
|
|
84
84
|
children: n
|
|
85
85
|
}
|
|
86
86
|
) : /* @__PURE__ */ e(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","sources":["../../../src/components/breadcrumb/breadcrumb.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 { Slot } from \"@radix-ui/react-slot\"\n\n/** Breadcrumb — Card's compound pattern applied to the nav / ol / li structure. */\n\nexport type BreadcrumbProps = React.ComponentProps<\"nav\"> & {\n separator?: React.ReactNode\n}\n\nconst useStyles = makeZenithStyles({\n list: {\n display: \"flex\",\n alignItems: \"center\",\n // gap-2\n ...shorthands.gap(tokens.spacingElement2),\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n },\n separator: {\n color: tokens.
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","sources":["../../../src/components/breadcrumb/breadcrumb.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 { Slot } from \"@radix-ui/react-slot\"\n\n/** Breadcrumb — Card's compound pattern applied to the nav / ol / li structure. */\n\nexport type BreadcrumbProps = React.ComponentProps<\"nav\"> & {\n separator?: React.ReactNode\n}\n\nconst useStyles = makeZenithStyles({\n list: {\n display: \"flex\",\n alignItems: \"center\",\n // gap-2\n ...shorthands.gap(tokens.spacingElement2),\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n },\n separator: {\n color: tokens.grayLight,\n },\n item: {\n display: \"inline-flex\",\n alignItems: \"center\",\n // gap-1\n ...shorthands.gap(tokens.spacingElement1),\n },\n link: {\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.grayLight,\n transitionProperty:\n \"color, background-color, border-color, text-decoration-color, fill, stroke\",\n transitionDuration: \"150ms\",\n transitionTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n cursor: \"pointer\",\n \":hover\": {\n color: tokens.grayDefault,\n textDecorationLine: \"underline\",\n },\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: tokens.accentA8,\n },\n },\n page: {\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.grayDefault,\n },\n})\n\nexport const Breadcrumb = React.forwardRef<HTMLElement, BreadcrumbProps>(\n function Breadcrumb({ separator = \"/\", className, children, ...props }, ref) {\n const styles = useStyles()\n const items = React.Children.toArray(children).filter(React.isValidElement)\n\n return (\n <nav\n ref={ref}\n data-slot=\"breadcrumb\"\n {...{ [SLOT_ATTR]: \"breadcrumb\" }}\n aria-label=\"Breadcrumb\"\n className={className}\n {...props}\n >\n <ol className={styles.list}>\n {items.map((child, index) => (\n <React.Fragment key={index}>\n {index > 0 && (\n <li\n role=\"presentation\"\n aria-hidden=\"true\"\n className={styles.separator}\n >\n {separator}\n </li>\n )}\n {child}\n </React.Fragment>\n ))}\n </ol>\n </nav>\n )\n }\n)\n\nexport type BreadcrumbItemProps = Omit<React.ComponentProps<\"a\">, \"href\"> & {\n href?: string\n isCurrent?: boolean\n /**\n * Render the child instead of the built-in `a`, keeping the link styling and slot markers. This\n * is how a consumer supplies a router link. v1 supports it; it was dropped here while the package\n * was on Base UI and restored once it moved back to Radix.\n */\n asChild?: boolean\n}\n\nexport const BreadcrumbItem = React.forwardRef<\n HTMLLIElement,\n BreadcrumbItemProps\n>(function BreadcrumbItem(\n { href, isCurrent = false, className, children, asChild = false, ...props },\n ref\n) {\n const styles = useStyles()\n const isLink = !!href\n\n const LinkRoot = asChild ? Slot : \"a\"\n\n const content =\n isLink || asChild ? (\n <LinkRoot\n data-slot=\"breadcrumb-link\"\n {...{ [SLOT_ATTR]: \"breadcrumb-link\" }}\n {...(href ? { href } : {})}\n className={mergeClasses(styles.link, className)}\n {...(isCurrent ? { \"aria-current\": \"page\" as const } : {})}\n {...props}\n >\n {children}\n </LinkRoot>\n ) : (\n <span\n data-slot=\"breadcrumb-page\"\n {...{ [SLOT_ATTR]: \"breadcrumb-page\" }}\n className={mergeClasses(styles.page, className)}\n {...(isCurrent ? { \"aria-current\": \"page\" as const } : {})}\n >\n {children}\n </span>\n )\n\n return (\n <li\n ref={ref}\n data-slot=\"breadcrumb-item\"\n {...{ [SLOT_ATTR]: \"breadcrumb-item\" }}\n className={styles.item}\n >\n {content}\n </li>\n )\n})\n"],"names":["useStyles","makeZenithStyles","shorthands","tokens.spacingElement2","tokens.textBase","tokens.leadingBase","tokens.grayLight","tokens.spacingElement1","tokens.fontWeightSemibold","tokens.grayDefault","tokens.accentA8","Breadcrumb","React","separator","className","children","props","ref","styles","items","jsx","SLOT_ATTR","child","index","jsxs","BreadcrumbItem","href","isCurrent","asChild","content","Slot","mergeClasses"],"mappings":";;;;;;AAeA,MAAMA,IAAYC,EAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,IAEZ,GAAGC,EAAW,IAAIC,CAAsB;AAAA,IACxC,UAAUC;AAAAA,IACV,YAAYC;AAAAA,EAAO;AAAA,EAErB,WAAW;AAAA,IACT,OAAOC;AAAAA,EAAO;AAAA,EAEhB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,IAEZ,GAAGJ,EAAW,IAAIK,CAAsB;AAAA,EAAA;AAAA,EAE1C,MAAM;AAAA,IACJ,YAAYC;AAAAA,IACZ,OAAOF;AAAAA,IACP,oBACE;AAAA,IACF,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B,QAAQ;AAAA,IACR,UAAU;AAAA,MACR,OAAOG;AAAAA,MACP,oBAAoB;A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IAAO;AAAA,IAI7B;AAAA,MACC,aAAU;AAAA,MACJ,CAACT,CAAS,GAAG;AAAA,MAClB,GAAIK,IAAO,EAAE,MAAAA,EAAA,IAAS,CAAA;AAAA,MACvB,WAAWK,EAAab,EAAO,MAAMJ,CAAS;AAAA,MAC7C,GAAIa,IAAY,EAAE,gBAAgB,OAAA,IAAoB,CAAA;AAAA,MACtD,GAAGX;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EAAA,IAGH,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACJ,CAACC,CAAS,GAAG;AAAA,MACnB,WAAWU,EAAab,EAAO,MAAMJ,CAAS;AAAA,MAC7C,GAAIa,IAAY,EAAE,gBAAgB,OAAA,IAAoB,CAAA;AAAA,MAEtD,UAAAZ;AAAA,IAAA;AAAA,EAAA;AAIP,SACE,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAH;AAAA,MACA,aAAU;AAAA,MACJ,CAACI,CAAS,GAAG;AAAA,MACnB,WAAWH,EAAO;AAAA,MAEjB,UAAAW;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as b } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as a from "react";
|
|
3
3
|
import { mergeClasses as w, SLOT_ATTR as B, shorthands as n } from "@epilot/zenith-runtime/v1";
|
|
4
4
|
import { makeZenithStyles as H } from "../../styles/make-styles.js";
|
|
5
|
-
import { capTrim as
|
|
6
|
-
import { radiusLg as
|
|
5
|
+
import { capTrim as R } from "../../styles/text-box.js";
|
|
6
|
+
import { radiusLg as I, buttonIconSize as m, leadingLg as z, textLg as E, leadingBase as L, textBase as O, buttonBaseMinHeight as T, leadingSm as A, textSm as D, leadingXs as P, textXs as X, errorSoft as h, errorA11 as $, errorSoftHover as V, errorOnSoft as W, errorSolidHover as u, errorContrast as j, errorSolid as M, accentSoft as d, grayA12 as N, accentA11 as F, accentSoftHover as K, accentOnSoft as Z, accentSolidHover as p, accentContrast as _, accentSolid as q, focusRing as G, fontWeightSemibold as J, buttonBasePaddingInline as Q, spacingElement3 as U } from "../../tokens/index.js";
|
|
7
7
|
import { Root as Y } from "../../vendor/.bun/@radix-ui_react-slot@1.2.4_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js";
|
|
8
8
|
const ee = "button", oe = H({
|
|
9
9
|
root: {
|
|
@@ -33,7 +33,7 @@ const ee = "button", oe = H({
|
|
|
33
33
|
color: "currentColor"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
label:
|
|
36
|
+
label: R,
|
|
37
37
|
primary: {
|
|
38
38
|
backgroundColor: q,
|
|
39
39
|
color: _,
|
|
@@ -47,16 +47,16 @@ const ee = "button", oe = H({
|
|
|
47
47
|
},
|
|
48
48
|
tertiary: {
|
|
49
49
|
backgroundColor: "transparent",
|
|
50
|
-
color:
|
|
50
|
+
color: F,
|
|
51
51
|
":hover:not(:disabled)": { backgroundColor: d }
|
|
52
52
|
},
|
|
53
53
|
ghost: {
|
|
54
54
|
backgroundColor: "transparent",
|
|
55
|
-
color:
|
|
55
|
+
color: N,
|
|
56
56
|
":hover:not(:disabled)": { backgroundColor: d }
|
|
57
57
|
},
|
|
58
58
|
primaryDestructive: {
|
|
59
|
-
backgroundColor:
|
|
59
|
+
backgroundColor: M,
|
|
60
60
|
color: j,
|
|
61
61
|
":hover:not(:disabled)": { backgroundColor: u },
|
|
62
62
|
":active:not(:disabled)": { backgroundColor: u }
|
|
@@ -88,7 +88,7 @@ const ee = "button", oe = H({
|
|
|
88
88
|
// As above, the fixed 28px size is part of Button's contract, independent of its label box.
|
|
89
89
|
minHeight: "1.75rem",
|
|
90
90
|
fontSize: D,
|
|
91
|
-
lineHeight:
|
|
91
|
+
lineHeight: A,
|
|
92
92
|
gap: "0.375rem",
|
|
93
93
|
"& svg": { width: "0.875rem", height: "0.875rem" }
|
|
94
94
|
},
|
|
@@ -99,9 +99,9 @@ const ee = "button", oe = H({
|
|
|
99
99
|
// explicit minHeight above the natural content box, same mechanism `lg` already uses).
|
|
100
100
|
...n.paddingInline(Q),
|
|
101
101
|
...n.paddingBlock("0.25rem"),
|
|
102
|
-
minHeight:
|
|
103
|
-
fontSize:
|
|
104
|
-
lineHeight:
|
|
102
|
+
minHeight: T,
|
|
103
|
+
fontSize: O,
|
|
104
|
+
lineHeight: L,
|
|
105
105
|
gap: "0.5rem",
|
|
106
106
|
"& svg": { width: "1rem", height: "1rem" }
|
|
107
107
|
},
|
|
@@ -109,8 +109,8 @@ const ee = "button", oe = H({
|
|
|
109
109
|
...n.paddingInline("1.25rem"),
|
|
110
110
|
...n.paddingBlock("0.25rem"),
|
|
111
111
|
minHeight: "2.5rem",
|
|
112
|
-
fontSize:
|
|
113
|
-
lineHeight:
|
|
112
|
+
fontSize: E,
|
|
113
|
+
lineHeight: z,
|
|
114
114
|
gap: "0.5rem",
|
|
115
115
|
"& svg": { width: "1rem", height: "1rem" }
|
|
116
116
|
},
|
|
@@ -127,8 +127,8 @@ const ee = "button", oe = H({
|
|
|
127
127
|
icon: {
|
|
128
128
|
// Density-bound: a fixed square, no line-height floor (unlike `base`), so compact/comfortable
|
|
129
129
|
// both move freely (DENSITY-SPEC.md §2.4).
|
|
130
|
-
width:
|
|
131
|
-
height:
|
|
130
|
+
width: m,
|
|
131
|
+
height: m,
|
|
132
132
|
"& svg": { width: "1.125rem", height: "1.125rem" }
|
|
133
133
|
},
|
|
134
134
|
iconLg: {
|
|
@@ -136,13 +136,13 @@ const ee = "button", oe = H({
|
|
|
136
136
|
height: "2.5rem",
|
|
137
137
|
"& svg": { width: "1.5rem", height: "1.5rem" }
|
|
138
138
|
},
|
|
139
|
-
normal: { borderRadius:
|
|
139
|
+
normal: { borderRadius: I },
|
|
140
140
|
rounded: { borderRadius: "9999px" }
|
|
141
141
|
});
|
|
142
142
|
function f(c, i = "button") {
|
|
143
|
-
return
|
|
144
|
-
const l =
|
|
145
|
-
return
|
|
143
|
+
return a.Children.toArray(c).flatMap((e, t) => {
|
|
144
|
+
const l = a.isValidElement(e) && e.key !== null ? String(e.key) : String(t), o = `${i}/${l}`;
|
|
145
|
+
return a.isValidElement(e) && e.type === a.Fragment ? f(e.props.children, o) : [{ node: e, keyPath: o }];
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
function te(c, i) {
|
|
@@ -170,12 +170,12 @@ function te(c, i) {
|
|
|
170
170
|
continue;
|
|
171
171
|
}
|
|
172
172
|
l(), e.push(
|
|
173
|
-
|
|
173
|
+
a.isValidElement(o.node) ? a.cloneElement(o.node, { key: o.keyPath }) : o.node
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
176
|
return l(), e;
|
|
177
177
|
}
|
|
178
|
-
const ce =
|
|
178
|
+
const ce = a.forwardRef(
|
|
179
179
|
function({
|
|
180
180
|
variant: i = "primary",
|
|
181
181
|
size: e = "base",
|
|
@@ -183,10 +183,10 @@ const ce = s.forwardRef(
|
|
|
183
183
|
destructive: l = !1,
|
|
184
184
|
className: o,
|
|
185
185
|
asChild: r = !1,
|
|
186
|
-
children:
|
|
186
|
+
children: g,
|
|
187
187
|
...S
|
|
188
188
|
}, y) {
|
|
189
|
-
const
|
|
189
|
+
const s = oe(), k = l && i !== "ghost" ? `${i}Destructive` : i, v = {
|
|
190
190
|
xs: "xs",
|
|
191
191
|
sm: "sm",
|
|
192
192
|
base: "base",
|
|
@@ -195,7 +195,7 @@ const ce = s.forwardRef(
|
|
|
195
195
|
"icon-sm": "iconSm",
|
|
196
196
|
icon: "icon",
|
|
197
197
|
"icon-lg": "iconLg"
|
|
198
|
-
}[e], C = r ? Y : ee, x = r ?
|
|
198
|
+
}[e], C = r ? Y : ee, x = r ? g : te(g, s.label);
|
|
199
199
|
return /* @__PURE__ */ b(
|
|
200
200
|
C,
|
|
201
201
|
{
|
|
@@ -203,10 +203,10 @@ const ce = s.forwardRef(
|
|
|
203
203
|
"data-slot": "button",
|
|
204
204
|
[B]: "button",
|
|
205
205
|
className: w(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
s.root,
|
|
207
|
+
s[k],
|
|
208
|
+
s[v],
|
|
209
|
+
s[t],
|
|
210
210
|
o
|
|
211
211
|
),
|
|
212
212
|
...S,
|
|
@@ -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;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EAC1B,SACE;AAAA,IACE,SAAAa,IAAU;AAAA,IACV,MAAAC,IAAO;AAAA,IACP,OAAAC,IAAQ;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;A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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,12 +1,12 @@
|
|
|
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 C, shorthands as
|
|
3
|
+
import { mergeClasses as m, SLOT_ATTR as C, shorthands as w } from "@epilot/zenith-runtime/v1";
|
|
4
4
|
import { makeZenithStyles as V } from "../../styles/make-styles.js";
|
|
5
|
-
import { spacingGroup2 as
|
|
6
|
-
import { ClearButton as
|
|
7
|
-
import { CloseIcon as
|
|
8
|
-
import { NS as
|
|
9
|
-
const
|
|
5
|
+
import { spacingGroup2 as v, spacingLayout1 as y, spacingElement2 as x, spacingLayout2 as E, leadingSm as S, textSm as R, fontWeightSemibold as N, leadingBase as $, textBase as j, spacingElement3 as c, spacingElement1 as z, radiusXl as G } from "../../tokens/index.js";
|
|
6
|
+
import { ClearButton as H } from "../../lib/clear-button.js";
|
|
7
|
+
import { CloseIcon as W } from "../../lib/icons.js";
|
|
8
|
+
import { NS as A } from "../../tokens/core.meta.generated.js";
|
|
9
|
+
const O = a.forwardRef(
|
|
10
10
|
function(o, t) {
|
|
11
11
|
return /* @__PURE__ */ n(
|
|
12
12
|
"svg",
|
|
@@ -20,7 +20,7 @@ const A = a.forwardRef(
|
|
|
20
20
|
}
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
-
),
|
|
23
|
+
), _ = a.forwardRef(function(o, t) {
|
|
24
24
|
return /* @__PURE__ */ n(
|
|
25
25
|
"svg",
|
|
26
26
|
{
|
|
@@ -32,7 +32,7 @@ const A = a.forwardRef(
|
|
|
32
32
|
children: /* @__PURE__ */ 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" })
|
|
33
33
|
}
|
|
34
34
|
);
|
|
35
|
-
}),
|
|
35
|
+
}), F = a.forwardRef(
|
|
36
36
|
function(o, t) {
|
|
37
37
|
return /* @__PURE__ */ n(
|
|
38
38
|
"svg",
|
|
@@ -46,7 +46,7 @@ const A = a.forwardRef(
|
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
),
|
|
49
|
+
), P = a.forwardRef(
|
|
50
50
|
function(o, t) {
|
|
51
51
|
return /* @__PURE__ */ n(
|
|
52
52
|
"svg",
|
|
@@ -60,10 +60,10 @@ const A = a.forwardRef(
|
|
|
60
60
|
}
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
|
-
),
|
|
63
|
+
), I = a.createContext({
|
|
64
64
|
variant: "info",
|
|
65
65
|
hideIcon: !1
|
|
66
|
-
}), u = "--zenith-callout-bg", d = "--zenith-callout-fg", l = (i, o) => `var(--zenith-${
|
|
66
|
+
}), u = "--zenith-callout-bg", d = "--zenith-callout-fg", l = (i, o) => `var(--zenith-${A}-${i}-${o})`, X = {
|
|
67
67
|
info: () => ({
|
|
68
68
|
[u]: l("accent", "soft"),
|
|
69
69
|
[d]: l("accent", "default")
|
|
@@ -88,6 +88,8 @@ const A = a.forwardRef(
|
|
|
88
88
|
root: {
|
|
89
89
|
position: "relative",
|
|
90
90
|
width: "100%",
|
|
91
|
+
// v1 `rounded-xl`, the same radius as Card so the two agree side by side.
|
|
92
|
+
...w.borderRadius(G),
|
|
91
93
|
// p-3 — no token for 0.75rem.
|
|
92
94
|
paddingTop: c,
|
|
93
95
|
paddingRight: c,
|
|
@@ -130,12 +132,12 @@ const A = a.forwardRef(
|
|
|
130
132
|
},
|
|
131
133
|
title: {
|
|
132
134
|
gridColumnStart: 2,
|
|
133
|
-
...
|
|
135
|
+
...w.overflow("hidden"),
|
|
134
136
|
display: "-webkit-box",
|
|
135
137
|
WebkitBoxOrient: "vertical",
|
|
136
138
|
WebkitLineClamp: 1,
|
|
137
139
|
// min-h-4
|
|
138
|
-
minHeight:
|
|
140
|
+
minHeight: v,
|
|
139
141
|
fontSize: j,
|
|
140
142
|
lineHeight: $,
|
|
141
143
|
fontWeight: N
|
|
@@ -144,7 +146,7 @@ const A = a.forwardRef(
|
|
|
144
146
|
gridColumnStart: 2,
|
|
145
147
|
display: "grid",
|
|
146
148
|
justifyItems: "start",
|
|
147
|
-
...
|
|
149
|
+
...w.gap(z),
|
|
148
150
|
fontSize: R,
|
|
149
151
|
lineHeight: S,
|
|
150
152
|
"& p": {
|
|
@@ -157,7 +159,7 @@ const A = a.forwardRef(
|
|
|
157
159
|
width: "100%",
|
|
158
160
|
gridColumnEnd: "span 3",
|
|
159
161
|
// mt-2
|
|
160
|
-
marginTop:
|
|
162
|
+
marginTop: x
|
|
161
163
|
},
|
|
162
164
|
actionStart: {
|
|
163
165
|
justifyContent: "flex-start"
|
|
@@ -173,18 +175,18 @@ const A = a.forwardRef(
|
|
|
173
175
|
dismiss: {
|
|
174
176
|
position: "absolute",
|
|
175
177
|
// top-2 right-2
|
|
176
|
-
top:
|
|
177
|
-
right:
|
|
178
|
+
top: x,
|
|
179
|
+
right: x,
|
|
178
180
|
// size-6 — the ClearButton itself supplies centering, rounding, hover and focus.
|
|
179
181
|
width: y,
|
|
180
182
|
height: y
|
|
181
183
|
},
|
|
182
184
|
dismissIcon: {
|
|
183
185
|
// size-4
|
|
184
|
-
width:
|
|
185
|
-
height:
|
|
186
|
+
width: v,
|
|
187
|
+
height: v
|
|
186
188
|
}
|
|
187
|
-
}),
|
|
189
|
+
}), n1 = a.forwardRef(
|
|
188
190
|
function({
|
|
189
191
|
className: o,
|
|
190
192
|
variant: t = "info",
|
|
@@ -196,13 +198,13 @@ const A = a.forwardRef(
|
|
|
196
198
|
children: L,
|
|
197
199
|
...T
|
|
198
200
|
}, Z) {
|
|
199
|
-
const [
|
|
200
|
-
if (!
|
|
201
|
+
const [b, M] = a.useState(!0), g = h();
|
|
202
|
+
if (!b)
|
|
201
203
|
return null;
|
|
202
204
|
const B = () => {
|
|
203
|
-
|
|
205
|
+
M(!1), s == null || s();
|
|
204
206
|
};
|
|
205
|
-
return /* @__PURE__ */ n(
|
|
207
|
+
return /* @__PURE__ */ n(I.Provider, { value: { variant: t, hideIcon: e }, children: /* @__PURE__ */ k(
|
|
206
208
|
"div",
|
|
207
209
|
{
|
|
208
210
|
ref: Z,
|
|
@@ -217,25 +219,25 @@ const A = a.forwardRef(
|
|
|
217
219
|
f && g.dismissible,
|
|
218
220
|
o
|
|
219
221
|
),
|
|
220
|
-
style: { ...
|
|
222
|
+
style: { ...X[t](), ...p },
|
|
221
223
|
...T,
|
|
222
224
|
children: [
|
|
223
225
|
!e && /* @__PURE__ */ n(D, { customIcon: r }),
|
|
224
226
|
L,
|
|
225
227
|
f && /* @__PURE__ */ n(
|
|
226
|
-
|
|
228
|
+
H,
|
|
227
229
|
{
|
|
228
230
|
label: "Dismiss",
|
|
229
231
|
onClick: B,
|
|
230
232
|
className: g.dismiss,
|
|
231
|
-
children: /* @__PURE__ */ n(
|
|
233
|
+
children: /* @__PURE__ */ n(W, { className: g.dismissIcon })
|
|
232
234
|
}
|
|
233
235
|
)
|
|
234
236
|
]
|
|
235
237
|
}
|
|
236
238
|
) });
|
|
237
239
|
}
|
|
238
|
-
),
|
|
240
|
+
), e1 = a.forwardRef(
|
|
239
241
|
function({ className: o, ...t }, e) {
|
|
240
242
|
const r = h();
|
|
241
243
|
return /* @__PURE__ */ n(
|
|
@@ -249,7 +251,7 @@ const A = a.forwardRef(
|
|
|
249
251
|
}
|
|
250
252
|
);
|
|
251
253
|
}
|
|
252
|
-
),
|
|
254
|
+
), a1 = a.forwardRef(function({ className: o, ...t }, e) {
|
|
253
255
|
const r = h();
|
|
254
256
|
return /* @__PURE__ */ n(
|
|
255
257
|
"div",
|
|
@@ -261,8 +263,8 @@ const A = a.forwardRef(
|
|
|
261
263
|
...t
|
|
262
264
|
}
|
|
263
265
|
);
|
|
264
|
-
}),
|
|
265
|
-
const { hideIcon: f } = a.useContext(
|
|
266
|
+
}), i1 = a.forwardRef(function({ className: o, align: t = "start", ...e }, r) {
|
|
267
|
+
const { hideIcon: f } = a.useContext(I), s = h(), p = t === "end" ? s.actionEnd : f ? s.actionStart : s.actionStartIcon;
|
|
266
268
|
return /* @__PURE__ */ n(
|
|
267
269
|
"div",
|
|
268
270
|
{
|
|
@@ -275,18 +277,18 @@ const A = a.forwardRef(
|
|
|
275
277
|
}
|
|
276
278
|
);
|
|
277
279
|
}), q = a.forwardRef(function({ customIcon: o, ...t }, e) {
|
|
278
|
-
const { variant: r } = a.useContext(
|
|
280
|
+
const { variant: r } = a.useContext(I);
|
|
279
281
|
if (o)
|
|
280
282
|
return o;
|
|
281
283
|
switch (r) {
|
|
282
284
|
case "info":
|
|
283
|
-
return /* @__PURE__ */ n(
|
|
285
|
+
return /* @__PURE__ */ n(O, { ref: e, ...t });
|
|
284
286
|
case "success":
|
|
285
|
-
return /* @__PURE__ */ n(
|
|
287
|
+
return /* @__PURE__ */ n(F, { ref: e, ...t });
|
|
286
288
|
case "warning":
|
|
287
|
-
return /* @__PURE__ */ n(
|
|
289
|
+
return /* @__PURE__ */ n(_, { ref: e, ...t });
|
|
288
290
|
case "destructive":
|
|
289
|
-
return /* @__PURE__ */ n(
|
|
291
|
+
return /* @__PURE__ */ n(P, { ref: e, ...t });
|
|
290
292
|
}
|
|
291
293
|
return null;
|
|
292
294
|
}), D = a.forwardRef(
|
|
@@ -305,9 +307,9 @@ const A = a.forwardRef(
|
|
|
305
307
|
}
|
|
306
308
|
);
|
|
307
309
|
export {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
310
|
+
n1 as Callout,
|
|
311
|
+
i1 as CalloutAction,
|
|
312
|
+
a1 as CalloutDescription,
|
|
313
|
+
e1 as CalloutTitle
|
|
312
314
|
};
|
|
313
315
|
//# sourceMappingURL=callout.js.map
|