@epilot/volt-ui-experimental-griffel 0.1.0-experiment.1 → 0.1.2
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 +23 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +6 -0
- package/dist/components/breadcrumb/breadcrumb.js +29 -28
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/button/button.d.ts +6 -0
- package/dist/components/button/button.js +30 -28
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/command/command.d.ts +6 -6
- package/dist/components/field/field-combobox.d.ts +6 -6
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +63 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -0
- package/dist/tokens.json +1 -1
- package/package.json +20 -3
- package/tokens.d.ts +3 -0
- package/tokens.js +13 -0
package/README.md
CHANGED
|
@@ -59,6 +59,29 @@ last-one-wins collision.
|
|
|
59
59
|
Tree-shaking is real and worth relying on — `Text` alone is 15.5k gzip against 172.4k for every
|
|
60
60
|
export, an 11× spread. v1 has no such spread; it ships everything either way.
|
|
61
61
|
|
|
62
|
+
## Importing tokens in React
|
|
63
|
+
|
|
64
|
+
Import token bindings from the `/tokens` subpath, not the `tokens` namespace on the package root:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { accent9, gray11 } from "@epilot/volt-ui-experimental-griffel/tokens" // shakes
|
|
68
|
+
import { tokens } from "@epilot/volt-ui-experimental-griffel" // does not
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
A namespace object cannot be tree-shaken, so the second form pulls all 950 bindings. Measured on the
|
|
72
|
+
sixteen a real consumer needed: **9,138 bytes gzip through the namespace against 207 through the
|
|
73
|
+
subpath.**
|
|
74
|
+
|
|
75
|
+
Two caveats, both measured rather than assumed. The saving only materialises for a consumer that
|
|
76
|
+
wants tokens and little else — any component you import brings the core token _sheet_, which is a
|
|
77
|
+
single string of every declaration and does not shake. A real micro-frontend that swapped the
|
|
78
|
+
namespace for the subpath saw **no change at all**, because its components had already pulled the
|
|
79
|
+
sheet in.
|
|
80
|
+
|
|
81
|
+
And `typesVersions` is what makes the subpath visible to TypeScript on `moduleResolution: node`.
|
|
82
|
+
Without it the bundler resolves the import and `tsc` does not, which is how it first surfaced — as a
|
|
83
|
+
build failure in a consumer, not here.
|
|
84
|
+
|
|
62
85
|
## Tokens outside React
|
|
63
86
|
|
|
64
87
|
The runtime custom properties this package emits carry a value-derived hash
|
|
@@ -27,5 +27,11 @@ export declare const Breadcrumb: React.ForwardRefExoticComponent<Omit<Breadcrumb
|
|
|
27
27
|
export type BreadcrumbItemProps = Omit<React.ComponentProps<"a">, "href"> & {
|
|
28
28
|
href?: string;
|
|
29
29
|
isCurrent?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Render the child instead of the built-in `a`, keeping the link styling and slot markers. This
|
|
32
|
+
* is how a consumer supplies a router link. v1 supports it; it was dropped here while the package
|
|
33
|
+
* was on Base UI and restored once it moved back to Radix.
|
|
34
|
+
*/
|
|
35
|
+
asChild?: boolean;
|
|
30
36
|
};
|
|
31
37
|
export declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<BreadcrumbItemProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as e, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
3
|
import { shorthands as u } from "../../node_modules/@griffel/core/src/index.js";
|
|
4
4
|
import { SLOT_ATTR as c } from "../../renderer/contract.js";
|
|
5
|
-
import { makeVoltStyles as
|
|
6
|
-
import { semGrayDefault as p, fontWeightSemibold as b, accentA8 as
|
|
5
|
+
import { makeVoltStyles as L } from "../../styles/make-styles.js";
|
|
6
|
+
import { semGrayDefault as p, fontWeightSemibold as b, accentA8 as R, semGrayLight as f, textBase as S, spacingElement1 as B, spacingElement2 as I } from "../../tokens/index.js";
|
|
7
|
+
import { Root as N } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
7
8
|
import { mergeClasses as g } from "../../node_modules/@griffel/core/src/mergeClasses.js";
|
|
8
|
-
const h =
|
|
9
|
+
const h = L({
|
|
9
10
|
list: {
|
|
10
11
|
display: "flex",
|
|
11
12
|
alignItems: "center",
|
|
@@ -20,7 +21,7 @@ const h = x({
|
|
|
20
21
|
display: "inline-flex",
|
|
21
22
|
alignItems: "center",
|
|
22
23
|
// gap-1
|
|
23
|
-
...u.gap(
|
|
24
|
+
...u.gap(B)
|
|
24
25
|
},
|
|
25
26
|
link: {
|
|
26
27
|
fontWeight: b,
|
|
@@ -37,50 +38,50 @@ const h = x({
|
|
|
37
38
|
outlineWidth: "2px",
|
|
38
39
|
outlineStyle: "solid",
|
|
39
40
|
outlineOffset: "2px",
|
|
40
|
-
outlineColor:
|
|
41
|
+
outlineColor: R
|
|
41
42
|
}
|
|
42
43
|
},
|
|
43
44
|
page: {
|
|
44
45
|
fontWeight: b,
|
|
45
46
|
color: p
|
|
46
47
|
}
|
|
47
|
-
}),
|
|
48
|
-
function({ separator:
|
|
49
|
-
const l = h(),
|
|
48
|
+
}), z = o.forwardRef(
|
|
49
|
+
function({ separator: r = "/", className: a, children: i, ...n }, s) {
|
|
50
|
+
const l = h(), m = o.Children.toArray(i).filter(o.isValidElement);
|
|
50
51
|
return /* @__PURE__ */ e(
|
|
51
52
|
"nav",
|
|
52
53
|
{
|
|
53
|
-
ref:
|
|
54
|
+
ref: s,
|
|
54
55
|
"data-slot": "breadcrumb",
|
|
55
56
|
[c]: "breadcrumb",
|
|
56
57
|
"aria-label": "Breadcrumb",
|
|
57
58
|
className: a,
|
|
58
59
|
...n,
|
|
59
|
-
children: /* @__PURE__ */ e("ol", { className: l.list, children:
|
|
60
|
-
|
|
60
|
+
children: /* @__PURE__ */ e("ol", { className: l.list, children: m.map((t, d) => /* @__PURE__ */ x(o.Fragment, { children: [
|
|
61
|
+
d > 0 && /* @__PURE__ */ e(
|
|
61
62
|
"li",
|
|
62
63
|
{
|
|
63
64
|
role: "presentation",
|
|
64
65
|
"aria-hidden": "true",
|
|
65
66
|
className: l.separator,
|
|
66
|
-
children:
|
|
67
|
+
children: r
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
|
-
|
|
70
|
-
] },
|
|
70
|
+
t
|
|
71
|
+
] }, d)) })
|
|
71
72
|
}
|
|
72
73
|
);
|
|
73
74
|
}
|
|
74
|
-
),
|
|
75
|
-
const
|
|
76
|
-
"a",
|
|
75
|
+
), F = o.forwardRef(function({ href: r, isCurrent: a = !1, className: i, children: n, asChild: s = !1, ...l }, m) {
|
|
76
|
+
const t = h(), y = !!r || s ? /* @__PURE__ */ e(
|
|
77
|
+
s ? N : "a",
|
|
77
78
|
{
|
|
78
79
|
"data-slot": "breadcrumb-link",
|
|
79
80
|
[c]: "breadcrumb-link",
|
|
80
|
-
href:
|
|
81
|
-
className: g(
|
|
81
|
+
...r ? { href: r } : {},
|
|
82
|
+
className: g(t.link, i),
|
|
82
83
|
...a ? { "aria-current": "page" } : {},
|
|
83
|
-
...
|
|
84
|
+
...l,
|
|
84
85
|
children: n
|
|
85
86
|
}
|
|
86
87
|
) : /* @__PURE__ */ e(
|
|
@@ -88,7 +89,7 @@ const h = x({
|
|
|
88
89
|
{
|
|
89
90
|
"data-slot": "breadcrumb-page",
|
|
90
91
|
[c]: "breadcrumb-page",
|
|
91
|
-
className: g(
|
|
92
|
+
className: g(t.page, i),
|
|
92
93
|
...a ? { "aria-current": "page" } : {},
|
|
93
94
|
children: n
|
|
94
95
|
}
|
|
@@ -96,16 +97,16 @@ const h = x({
|
|
|
96
97
|
return /* @__PURE__ */ e(
|
|
97
98
|
"li",
|
|
98
99
|
{
|
|
99
|
-
ref:
|
|
100
|
+
ref: m,
|
|
100
101
|
"data-slot": "breadcrumb-item",
|
|
101
102
|
[c]: "breadcrumb-item",
|
|
102
|
-
className:
|
|
103
|
-
children:
|
|
103
|
+
className: t.item,
|
|
104
|
+
children: y
|
|
104
105
|
}
|
|
105
106
|
);
|
|
106
107
|
});
|
|
107
108
|
export {
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
z as Breadcrumb,
|
|
110
|
+
F as BreadcrumbItem
|
|
110
111
|
};
|
|
111
112
|
//# sourceMappingURL=breadcrumb.js.map
|
|
@@ -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 \"@griffel/core\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeVoltStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * Breadcrumb — Card's compound pattern applied to the nav / ol / li structure.\n *\n * v1's `Breadcrumb` walks its children and interleaves a presentational separator `<li>` between\n * them; `BreadcrumbItem` decides between a link and a plain page by whether a `href` exists. The\n * `nav` / `ol` / `li` semantics and the `aria-current=\"page\"` handling are the real value of this\n * component and are reproduced exactly.\n *\n * v1 renders the link branch through Radix `Slot` when `asChild` is set — dropped here per\n * CONVENTIONS rule 6 (no Radix dependency). There is no `asChild` escape hatch; a consumer wanting\n * a non-`<a>` link anchors it themselves.\n *\n * `BreadcrumbItem` with a `href` renders an `<a>` (slot `breadcrumb-link`); without one, a `<span>`\n * (slot `breadcrumb-page`). Either way the item is wrapped in a `breadcrumb-item` `<li>`. The nav\n * itself has no base styles in v1 — it is left to the caller's className — so it carries only the\n * slot attributes.\n *\n * The link's `transition-colors` expands to Tailwind v4's default property list plus the 150ms\n * `cubic-bezier(0.4, 0, 0.2, 1)` easing — literals from the framework's default theme, which is\n * visible motion and cannot be read from the v1 file (Rule 0: flagged, not approximated away).\n */\n\nexport type BreadcrumbProps = React.ComponentProps<\"nav\"> & {\n separator?: React.ReactNode\n}\n\nconst useStyles = makeVoltStyles({\n list: {\n display: \"flex\",\n alignItems: \"center\",\n // gap-2\n ...shorthands.gap(tokens.spacingElement2),\n fontSize: tokens.textBase,\n },\n separator: {\n color: tokens.semGrayLight,\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.semGrayLight,\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.semGrayDefault,\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.semGrayDefault,\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\nexport const BreadcrumbItem = React.forwardRef<\n HTMLLIElement,\n BreadcrumbItemProps\n>(function BreadcrumbItem(\n { href, isCurrent = false, className, children, ...props },\n ref\n) {\n const styles = useStyles()\n const isLink = !!href\n\n const
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","sources":["../../../src/components/breadcrumb/breadcrumb.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@griffel/core\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeVoltStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\n/**\n * Breadcrumb — Card's compound pattern applied to the nav / ol / li structure.\n *\n * v1's `Breadcrumb` walks its children and interleaves a presentational separator `<li>` between\n * them; `BreadcrumbItem` decides between a link and a plain page by whether a `href` exists. The\n * `nav` / `ol` / `li` semantics and the `aria-current=\"page\"` handling are the real value of this\n * component and are reproduced exactly.\n *\n * v1 renders the link branch through Radix `Slot` when `asChild` is set — dropped here per\n * CONVENTIONS rule 6 (no Radix dependency). There is no `asChild` escape hatch; a consumer wanting\n * a non-`<a>` link anchors it themselves.\n *\n * `BreadcrumbItem` with a `href` renders an `<a>` (slot `breadcrumb-link`); without one, a `<span>`\n * (slot `breadcrumb-page`). Either way the item is wrapped in a `breadcrumb-item` `<li>`. The nav\n * itself has no base styles in v1 — it is left to the caller's className — so it carries only the\n * slot attributes.\n *\n * The link's `transition-colors` expands to Tailwind v4's default property list plus the 150ms\n * `cubic-bezier(0.4, 0, 0.2, 1)` easing — literals from the framework's default theme, which is\n * visible motion and cannot be read from the v1 file (Rule 0: flagged, not approximated away).\n */\n\nexport type BreadcrumbProps = React.ComponentProps<\"nav\"> & {\n separator?: React.ReactNode\n}\n\nconst useStyles = makeVoltStyles({\n list: {\n display: \"flex\",\n alignItems: \"center\",\n // gap-2\n ...shorthands.gap(tokens.spacingElement2),\n fontSize: tokens.textBase,\n },\n separator: {\n color: tokens.semGrayLight,\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.semGrayLight,\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.semGrayDefault,\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.semGrayDefault,\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","makeVoltStyles","shorthands","tokens.spacingElement2","tokens.textBase","tokens.semGrayLight","tokens.spacingElement1","tokens.fontWeightSemibold","tokens.semGrayDefault","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":";;;;;;;;AAmCA,MAAMA,IAAYC,EAAe;AAAA,EAC/B,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,IAEZ,GAAGC,EAAW,IAAIC,CAAsB;AAAA,IACxC,UAAUC;AAAAA,EAAO;AAAA,EAEnB,WAAW;AAAA,IACT,OAAOC;AAAAA,EAAO;AAAA,EAEhB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,IAEZ,GAAGH,EAAW,IAAII,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;AAAA,IAAA;AAAA,IAEtB,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,cAAc;AAAA,MACd,eAAe;AAAA,MACf,cAA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AAAA,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;"}
|
|
@@ -8,5 +8,11 @@ export type ButtonProps = Omit<React.ComponentProps<"button">, "variant" | "size
|
|
|
8
8
|
shape?: ButtonShape;
|
|
9
9
|
destructive?: boolean;
|
|
10
10
|
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Render the child element instead of a `button`, keeping Button's styling and slot markers.
|
|
13
|
+
* v1 supports this and consumers rely on it to wrap links; it was dropped here while the package
|
|
14
|
+
* was briefly on Base UI, and restored once it moved back to Radix.
|
|
15
|
+
*/
|
|
16
|
+
asChild?: boolean;
|
|
11
17
|
};
|
|
12
18
|
export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import * as k from "react";
|
|
3
3
|
import { shorthands as o } from "../../node_modules/@griffel/core/src/index.js";
|
|
4
|
-
import { SLOT_ATTR as
|
|
5
|
-
import { makeVoltStyles as
|
|
6
|
-
import { radiusLg as
|
|
7
|
-
import {
|
|
8
|
-
|
|
4
|
+
import { SLOT_ATTR as x } from "../../renderer/contract.js";
|
|
5
|
+
import { makeVoltStyles as y } from "../../styles/make-styles.js";
|
|
6
|
+
import { radiusLg as w, textLg as A, textBase as B, textSm as H, textXs as R, errorA8 as t, semErrorSoft as s, errorA11 as l, semErrorSoftHover as E, semErrorSolidHover as c, semErrorContrast as z, semErrorSolid as I, grayA8 as L, semAccentSoft as i, grayA12 as D, accentA8 as n, accentA11 as m, semAccentSoftHover as T, semAccentSolidHover as a, semAccentContrast as W, semAccentSolid as X, fontWeightSemibold as j, spacingElement3 as O } from "../../tokens/index.js";
|
|
7
|
+
import { Root as N } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
8
|
+
import { mergeClasses as P } from "../../node_modules/@griffel/core/src/mergeClasses.js";
|
|
9
|
+
const V = "button", _ = y({
|
|
9
10
|
root: {
|
|
10
11
|
display: "inline-flex",
|
|
11
12
|
alignItems: "center",
|
|
12
13
|
justifyContent: "center",
|
|
13
|
-
fontWeight:
|
|
14
|
+
fontWeight: j,
|
|
14
15
|
whiteSpace: "nowrap",
|
|
15
16
|
transitionProperty: "all",
|
|
16
17
|
cursor: "pointer",
|
|
@@ -28,8 +29,8 @@ const N = "button", P = x({
|
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
31
|
primary: {
|
|
31
|
-
backgroundColor:
|
|
32
|
-
color:
|
|
32
|
+
backgroundColor: X,
|
|
33
|
+
color: W,
|
|
33
34
|
":hover": { backgroundColor: a },
|
|
34
35
|
":active": { backgroundColor: a },
|
|
35
36
|
":focus-visible": { outlineColor: n }
|
|
@@ -37,7 +38,7 @@ const N = "button", P = x({
|
|
|
37
38
|
secondary: {
|
|
38
39
|
backgroundColor: i,
|
|
39
40
|
color: m,
|
|
40
|
-
":hover": { backgroundColor:
|
|
41
|
+
":hover": { backgroundColor: T },
|
|
41
42
|
":focus-visible": { outlineColor: n }
|
|
42
43
|
},
|
|
43
44
|
tertiary: {
|
|
@@ -48,7 +49,7 @@ const N = "button", P = x({
|
|
|
48
49
|
},
|
|
49
50
|
ghost: {
|
|
50
51
|
backgroundColor: "transparent",
|
|
51
|
-
color:
|
|
52
|
+
color: D,
|
|
52
53
|
":hover": { backgroundColor: i },
|
|
53
54
|
":focus-visible": { outlineColor: L }
|
|
54
55
|
},
|
|
@@ -75,15 +76,15 @@ const N = "button", P = x({
|
|
|
75
76
|
...o.paddingInline("0.5rem"),
|
|
76
77
|
...o.paddingBlock("0.25rem"),
|
|
77
78
|
minHeight: "1.25rem",
|
|
78
|
-
fontSize:
|
|
79
|
+
fontSize: R,
|
|
79
80
|
gap: "4px",
|
|
80
81
|
"& svg": { width: "0.75rem", height: "0.75rem" }
|
|
81
82
|
},
|
|
82
83
|
sm: {
|
|
83
|
-
...o.paddingInline(
|
|
84
|
+
...o.paddingInline(O),
|
|
84
85
|
...o.paddingBlock("0.25rem"),
|
|
85
86
|
minHeight: "1.5rem",
|
|
86
|
-
fontSize:
|
|
87
|
+
fontSize: H,
|
|
87
88
|
gap: "0.375rem",
|
|
88
89
|
"& svg": { width: "0.875rem", height: "0.875rem" }
|
|
89
90
|
},
|
|
@@ -91,7 +92,7 @@ const N = "button", P = x({
|
|
|
91
92
|
...o.paddingInline("1rem"),
|
|
92
93
|
...o.paddingBlock("0.25rem"),
|
|
93
94
|
minHeight: "2rem",
|
|
94
|
-
fontSize:
|
|
95
|
+
fontSize: B,
|
|
95
96
|
gap: "0.5rem",
|
|
96
97
|
"& svg": { width: "1rem", height: "1rem" }
|
|
97
98
|
},
|
|
@@ -99,7 +100,7 @@ const N = "button", P = x({
|
|
|
99
100
|
...o.paddingInline("1.25rem"),
|
|
100
101
|
...o.paddingBlock("0.25rem"),
|
|
101
102
|
minHeight: "2.5rem",
|
|
102
|
-
fontSize:
|
|
103
|
+
fontSize: A,
|
|
103
104
|
gap: "0.5rem",
|
|
104
105
|
"& svg": { width: "1rem", height: "1rem" }
|
|
105
106
|
},
|
|
@@ -123,18 +124,19 @@ const N = "button", P = x({
|
|
|
123
124
|
height: "2.5rem",
|
|
124
125
|
"& svg": { width: "1.5rem", height: "1.5rem" }
|
|
125
126
|
},
|
|
126
|
-
normal: { borderRadius:
|
|
127
|
+
normal: { borderRadius: w },
|
|
127
128
|
rounded: { borderRadius: "9999px" }
|
|
128
|
-
}),
|
|
129
|
+
}), Y = k.forwardRef(
|
|
129
130
|
function({
|
|
130
131
|
variant: e = "primary",
|
|
131
132
|
size: g = "base",
|
|
132
133
|
shape: d = "rounded",
|
|
133
134
|
destructive: h = !1,
|
|
134
135
|
className: u,
|
|
135
|
-
|
|
136
|
+
asChild: p = !1,
|
|
137
|
+
...f
|
|
136
138
|
}, b) {
|
|
137
|
-
const r =
|
|
139
|
+
const r = _(), v = h && e !== "ghost" ? `${e}Destructive` : e, C = {
|
|
138
140
|
xs: "xs",
|
|
139
141
|
sm: "sm",
|
|
140
142
|
base: "base",
|
|
@@ -144,25 +146,25 @@ const N = "button", P = x({
|
|
|
144
146
|
icon: "icon",
|
|
145
147
|
"icon-lg": "iconLg"
|
|
146
148
|
}[g];
|
|
147
|
-
return /* @__PURE__ */
|
|
148
|
-
N,
|
|
149
|
+
return /* @__PURE__ */ S(
|
|
150
|
+
p ? N : V,
|
|
149
151
|
{
|
|
150
152
|
ref: b,
|
|
151
153
|
"data-slot": "button",
|
|
152
|
-
[
|
|
153
|
-
className:
|
|
154
|
+
[x]: "button",
|
|
155
|
+
className: P(
|
|
154
156
|
r.root,
|
|
155
|
-
r[f],
|
|
156
157
|
r[v],
|
|
158
|
+
r[C],
|
|
157
159
|
r[d],
|
|
158
160
|
u
|
|
159
161
|
),
|
|
160
|
-
...
|
|
162
|
+
...f
|
|
161
163
|
}
|
|
162
164
|
);
|
|
163
165
|
}
|
|
164
166
|
);
|
|
165
167
|
export {
|
|
166
|
-
|
|
168
|
+
Y as Button
|
|
167
169
|
};
|
|
168
170
|
//# sourceMappingURL=button.js.map
|
|
@@ -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 \"@griffel/core\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeVoltStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\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 v2 dropped `asChild`\n * deliberately. Base UI's button primitive was therefore supplying nothing v1 had: it added a\n * dependency, and with it the `@types/react` 19 requirement, for a plain element.\n */\nconst ButtonBase = \"button\" as const\n\nconst useStyles = makeVoltStyles({\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\": { opacity: 0.5 },\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n },\n \"& svg\": {\n flexShrink: 0,\n pointerEvents: \"none\",\n color: \"currentColor\",\n },\n },\n primary: {\n backgroundColor: tokens.semAccentSolid,\n color: tokens.semAccentContrast,\n \":hover\": { backgroundColor: tokens.semAccentSolidHover },\n \":active\": { backgroundColor: tokens.semAccentSolidHover },\n \":focus-visible\": { outlineColor: tokens.accentA8 },\n },\n secondary: {\n backgroundColor: tokens.semAccentSoft,\n color: tokens.accentA11,\n \":hover\": { backgroundColor: tokens.semAccentSoftHover },\n \":focus-visible\": { outlineColor: tokens.accentA8 },\n },\n tertiary: {\n backgroundColor: \"transparent\",\n color: tokens.accentA11,\n \":hover\": { backgroundColor: tokens.semAccentSoft },\n \":focus-visible\": { outlineColor: tokens.accentA8 },\n },\n ghost: {\n backgroundColor: \"transparent\",\n color: tokens.grayA12,\n \":hover\": { backgroundColor: tokens.semAccentSoft },\n \":focus-visible\": { outlineColor: tokens.grayA8 },\n },\n primaryDestructive: {\n backgroundColor: tokens.semErrorSolid,\n color: tokens.semErrorContrast,\n \":hover\": { backgroundColor: tokens.semErrorSolidHover },\n \":active\": { backgroundColor: tokens.semErrorSolidHover },\n \":focus-visible\": { outlineColor: tokens.errorA8 },\n },\n secondaryDestructive: {\n backgroundColor: tokens.semErrorSoft,\n color: tokens.errorA11,\n \":hover\": { backgroundColor: tokens.semErrorSoftHover },\n \":focus-visible\": { outlineColor: tokens.errorA8 },\n },\n tertiaryDestructive: {\n backgroundColor: \"transparent\",\n color: tokens.errorA11,\n \":hover\": { backgroundColor: tokens.semErrorSoft },\n \":focus-visible\": { outlineColor: tokens.errorA8 },\n },\n xs: {\n ...shorthands.paddingInline(\"0.5rem\"),\n ...shorthands.paddingBlock(\"0.25rem\"),\n minHeight: \"1.25rem\",\n fontSize: tokens.textXs,\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 minHeight: \"1.5rem\",\n fontSize: tokens.textSm,\n gap: \"0.375rem\",\n \"& svg\": { width: \"0.875rem\", height: \"0.875rem\" },\n },\n base: {\n ...shorthands.paddingInline(\"1rem\"),\n ...shorthands.paddingBlock(\"0.25rem\"),\n minHeight: \"2rem\",\n fontSize: tokens.textBase,\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 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 width: \"2rem\",\n height: \"2rem\",\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\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"tertiary\" | \"ghost\"\nexport type ButtonSize =\n | \"xs\"\n | \"sm\"\n | \"base\"\n | \"lg\"\n | \"icon-xs\"\n | \"icon-sm\"\n | \"icon\"\n | \"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\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 ...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\"\n | \"sm\"\n | \"base\"\n | \"lg\"\n | \"iconXs\"\n | \"iconSm\"\n | \"icon\"\n | \"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 return (\n <ButtonBase\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 )\n }\n)\n"],"names":["ButtonBase","useStyles","makeVoltStyles","tokens.fontWeightSemibold","tokens.semAccentSolid","tokens.semAccentContrast","tokens.semAccentSolidHover","tokens.accentA8","tokens.semAccentSoft","tokens.accentA11","tokens.semAccentSoftHover","tokens.grayA12","tokens.grayA8","tokens.semErrorSolid","tokens.semErrorContrast","tokens.semErrorSolidHover","tokens.errorA8","tokens.semErrorSoft","tokens.errorA11","tokens.semErrorSoftHover","shorthands","tokens.textXs","tokens.spacingElement3","tokens.textSm","tokens.textBase","tokens.textLg","tokens.radiusLg","Button","React","variant","size","shape","destructive","className","props","ref","styles","variantSlot","sizeSlot","jsx","SLOT_ATTR","mergeClasses"],"mappings":";;;;;;;AAoBA,MAAMA,IAAa,UAEbC,IAAYC,EAAe;AAAA,EAC/B,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,IACZ,aAAa,EAAE,SAAS,IAAA;AAAA,IACxB,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,cAAc;AAAA,MACd,eAAe;AAAA,IAAA;AAAA,IAEjB,SAAS;AAAA,MACP,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,OAAO;AAAA,IAAA;AAAA,EACT;AAAA,EAEF,SAAS;AAAA,IACP,iBAAiBC;AAAAA,IACjB,OAAOC;AAAAA,IACP,UAAU,EAAE,iBAAiBC,EA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,EAC1B,SACE;AAAA,IACE,SAAAC,IAAU;AAAA,IACV,MAAAC,IAAO;AAAA,IACP,OAAAC,IAAQ;AAAA,IACR,aAAAC,IAAc;AAAA,IACd,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,GACA;AACA,UAAMC,IAASnC,EAAA,GACToC,IAKJL,KAAeH,MAAY,UACtB,GAAGA,CAAO,gBAIXA,GACAS,IASJ;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,EAEbR,CAAI;AAEN,WACE,gBAAAS;AAAA,MAACvC;AAAA,MAAA;AAAA,QACC,KAAAmC;AAAA,QACA,aAAU;AAAA,QACJ,CAACK,CAAS,GAAG;AAAA,QACnB,WAAWC;AAAA,UACTL,EAAO;AAAA,UACPA,EAAOC,CAAW;AAAA,UAClBD,EAAOE,CAAQ;AAAA,UACfF,EAAOL,CAAK;AAAA,UACZE;AAAA,QAAA;AAAA,QAED,GAAGC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@griffel/core\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeVoltStyles } from \"../../styles/make-styles\"\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 = makeVoltStyles({\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\": { opacity: 0.5 },\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n },\n \"& svg\": {\n flexShrink: 0,\n pointerEvents: \"none\",\n color: \"currentColor\",\n },\n },\n primary: {\n backgroundColor: tokens.semAccentSolid,\n color: tokens.semAccentContrast,\n \":hover\": { backgroundColor: tokens.semAccentSolidHover },\n \":active\": { backgroundColor: tokens.semAccentSolidHover },\n \":focus-visible\": { outlineColor: tokens.accentA8 },\n },\n secondary: {\n backgroundColor: tokens.semAccentSoft,\n color: tokens.accentA11,\n \":hover\": { backgroundColor: tokens.semAccentSoftHover },\n \":focus-visible\": { outlineColor: tokens.accentA8 },\n },\n tertiary: {\n backgroundColor: \"transparent\",\n color: tokens.accentA11,\n \":hover\": { backgroundColor: tokens.semAccentSoft },\n \":focus-visible\": { outlineColor: tokens.accentA8 },\n },\n ghost: {\n backgroundColor: \"transparent\",\n color: tokens.grayA12,\n \":hover\": { backgroundColor: tokens.semAccentSoft },\n \":focus-visible\": { outlineColor: tokens.grayA8 },\n },\n primaryDestructive: {\n backgroundColor: tokens.semErrorSolid,\n color: tokens.semErrorContrast,\n \":hover\": { backgroundColor: tokens.semErrorSolidHover },\n \":active\": { backgroundColor: tokens.semErrorSolidHover },\n \":focus-visible\": { outlineColor: tokens.errorA8 },\n },\n secondaryDestructive: {\n backgroundColor: tokens.semErrorSoft,\n color: tokens.errorA11,\n \":hover\": { backgroundColor: tokens.semErrorSoftHover },\n \":focus-visible\": { outlineColor: tokens.errorA8 },\n },\n tertiaryDestructive: {\n backgroundColor: \"transparent\",\n color: tokens.errorA11,\n \":hover\": { backgroundColor: tokens.semErrorSoft },\n \":focus-visible\": { outlineColor: tokens.errorA8 },\n },\n xs: {\n ...shorthands.paddingInline(\"0.5rem\"),\n ...shorthands.paddingBlock(\"0.25rem\"),\n minHeight: \"1.25rem\",\n fontSize: tokens.textXs,\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 minHeight: \"1.5rem\",\n fontSize: tokens.textSm,\n gap: \"0.375rem\",\n \"& svg\": { width: \"0.875rem\", height: \"0.875rem\" },\n },\n base: {\n ...shorthands.paddingInline(\"1rem\"),\n ...shorthands.paddingBlock(\"0.25rem\"),\n minHeight: \"2rem\",\n fontSize: tokens.textBase,\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 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 width: \"2rem\",\n height: \"2rem\",\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\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"tertiary\" | \"ghost\"\nexport type ButtonSize =\n | \"xs\"\n | \"sm\"\n | \"base\"\n | \"lg\"\n | \"icon-xs\"\n | \"icon-sm\"\n | \"icon\"\n | \"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 ...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\"\n | \"sm\"\n | \"base\"\n | \"lg\"\n | \"iconXs\"\n | \"iconSm\"\n | \"icon\"\n | \"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\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 )\n }\n)\n"],"names":["ButtonBase","useStyles","makeVoltStyles","tokens.fontWeightSemibold","tokens.semAccentSolid","tokens.semAccentContrast","tokens.semAccentSolidHover","tokens.accentA8","tokens.semAccentSoft","tokens.accentA11","tokens.semAccentSoftHover","tokens.grayA12","tokens.grayA8","tokens.semErrorSolid","tokens.semErrorContrast","tokens.semErrorSolidHover","tokens.errorA8","tokens.semErrorSoft","tokens.errorA11","tokens.semErrorSoftHover","shorthands","tokens.textXs","tokens.spacingElement3","tokens.textSm","tokens.textBase","tokens.textLg","tokens.radiusLg","Button","React","variant","size","shape","destructive","className","asChild","props","ref","styles","variantSlot","sizeSlot","jsx","Slot","SLOT_ATTR","mergeClasses"],"mappings":";;;;;;;;AAqBA,MAAMA,IAAa,UAEbC,IAAYC,EAAe;AAAA,EAC/B,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,IACZ,aAAa,EAAE,SAAS,IAAA;AAAA,IACxB,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,cAAc;AAAA,MACd,eAAe;AAAA,IAAA;AAAA,IAEjB,SAAS;AAAA,MACP,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,OAAO;AAAA,IAAA;AAAA,EACT;AAAA,EAEF,SAAS;AAAA,IACP,iBAAiBC;AAAAA,IACjB,OAAOC;AAAAA,IACP,UAAU,EAAE,iBAAiBC,EAAO;AAAA,IACpC,WAAW,EAAE,iBAAiBA,EAAO;AAAA,IACrC,kBAAkB,EAAE,cAAcC,EAAO;AAAA,EAAS;AAAA,EAEpD,WAAW;AAAA,IACT,iBAAiBC;AAAAA,IACjB,OAAOC;AAAAA,IACP,UAAU,EAAE,iBAAiBC,EAAO;AAAA,IACpC,kBAAkB,EAAE,cAAcH,EAAO;AAAA,EAAS;AAAA,EAEpD,UAAU;AAAA,IACR,iBAAiB;AAAA,IACjB,OAAOE;AAAAA,IACP,UAAU,EAAE,iBAAiBD,EAAO;AAAA,IACpC,kBAAkB,EAAE,cAAcD,EAAO;A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WAAW;AAAA,MACX,MAAM;AAAA,MACN,WAAW;AAAA,IAAA,EAEbT,CAAI;AAIN,WACE,gBAAAU;AAAA,MAHWN,IAAUO,IAAOzC;AAAA,MAG3B;AAAA,QACC,KAAAoC;AAAA,QACA,aAAU;AAAA,QACJ,CAACM,CAAS,GAAG;AAAA,QACnB,WAAWC;AAAA,UACTN,EAAO;AAAA,UACPA,EAAOC,CAAW;AAAA,UAClBD,EAAOE,CAAQ;AAAA,UACfF,EAAON,CAAK;AAAA,UACZE;AAAA,QAAA;AAAA,QAED,GAAGE;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
@@ -24,7 +24,7 @@ export declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
|
24
24
|
ref?: React.Ref<HTMLDivElement>;
|
|
25
25
|
} & {
|
|
26
26
|
asChild?: boolean;
|
|
27
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
27
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
28
28
|
label?: string;
|
|
29
29
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
30
30
|
export type CommandEmptyProps = React.ComponentProps<typeof CommandPrimitive.Empty>;
|
|
@@ -34,7 +34,7 @@ export declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
|
34
34
|
ref?: React.Ref<HTMLDivElement>;
|
|
35
35
|
} & {
|
|
36
36
|
asChild?: boolean;
|
|
37
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
37
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
38
38
|
export type CommandGroupProps = React.ComponentProps<typeof CommandPrimitive.Group>;
|
|
39
39
|
export declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
40
40
|
children?: React.ReactNode;
|
|
@@ -42,7 +42,7 @@ export declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
|
42
42
|
ref?: React.Ref<HTMLDivElement>;
|
|
43
43
|
} & {
|
|
44
44
|
asChild?: boolean;
|
|
45
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
45
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "heading" | "value"> & {
|
|
46
46
|
heading?: React.ReactNode;
|
|
47
47
|
value?: string;
|
|
48
48
|
forceMount?: boolean;
|
|
@@ -52,7 +52,7 @@ export declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick
|
|
|
52
52
|
ref?: React.Ref<HTMLDivElement>;
|
|
53
53
|
} & {
|
|
54
54
|
asChild?: boolean;
|
|
55
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
55
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
56
56
|
alwaysRender?: boolean;
|
|
57
57
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
58
58
|
export type CommandItemProps = React.ComponentProps<typeof CommandPrimitive.Item>;
|
|
@@ -62,7 +62,7 @@ export declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
62
62
|
ref?: React.Ref<HTMLDivElement>;
|
|
63
63
|
} & {
|
|
64
64
|
asChild?: boolean;
|
|
65
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
65
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "onSelect" | "disabled" | "value"> & {
|
|
66
66
|
disabled?: boolean;
|
|
67
67
|
onSelect?: (value: string) => void;
|
|
68
68
|
value?: string;
|
|
@@ -78,7 +78,7 @@ export declare const CommandLoading: React.ForwardRefExoticComponent<Omit<{
|
|
|
78
78
|
ref?: React.Ref<HTMLDivElement>;
|
|
79
79
|
} & {
|
|
80
80
|
asChild?: boolean;
|
|
81
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
81
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
82
82
|
progress?: number;
|
|
83
83
|
label?: string;
|
|
84
84
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -21,7 +21,7 @@ export declare const FieldComboboxList: React.ForwardRefExoticComponent<Omit<{
|
|
|
21
21
|
ref?: React.Ref<HTMLDivElement>;
|
|
22
22
|
} & {
|
|
23
23
|
asChild?: boolean;
|
|
24
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
24
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
25
25
|
label?: string;
|
|
26
26
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
27
27
|
export type FieldComboboxItemProps = CommandItemProps;
|
|
@@ -31,7 +31,7 @@ export declare const FieldComboboxItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
31
31
|
ref?: React.Ref<HTMLDivElement>;
|
|
32
32
|
} & {
|
|
33
33
|
asChild?: boolean;
|
|
34
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
34
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "onSelect" | "disabled" | "value"> & {
|
|
35
35
|
disabled?: boolean;
|
|
36
36
|
onSelect?: (value: string) => void;
|
|
37
37
|
value?: string;
|
|
@@ -47,7 +47,7 @@ export declare const FieldComboboxEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
|
47
47
|
ref?: React.Ref<HTMLDivElement>;
|
|
48
48
|
} & {
|
|
49
49
|
asChild?: boolean;
|
|
50
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
50
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
51
51
|
export type FieldComboboxGroupProps = CommandGroupProps;
|
|
52
52
|
export declare const FieldComboboxGroup: React.ForwardRefExoticComponent<Omit<{
|
|
53
53
|
children?: React.ReactNode;
|
|
@@ -55,7 +55,7 @@ export declare const FieldComboboxGroup: React.ForwardRefExoticComponent<Omit<{
|
|
|
55
55
|
ref?: React.Ref<HTMLDivElement>;
|
|
56
56
|
} & {
|
|
57
57
|
asChild?: boolean;
|
|
58
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
58
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "heading" | "value"> & {
|
|
59
59
|
heading?: React.ReactNode;
|
|
60
60
|
value?: string;
|
|
61
61
|
forceMount?: boolean;
|
|
@@ -67,7 +67,7 @@ export declare const FieldComboboxSeparator: React.ForwardRefExoticComponent<Omi
|
|
|
67
67
|
ref?: React.Ref<HTMLDivElement>;
|
|
68
68
|
} & {
|
|
69
69
|
asChild?: boolean;
|
|
70
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
70
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
71
71
|
alwaysRender?: boolean;
|
|
72
72
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
73
73
|
export type FieldComboboxLoadingProps = CommandLoadingProps;
|
|
@@ -77,7 +77,7 @@ export declare const FieldComboboxLoading: React.ForwardRefExoticComponent<Omit<
|
|
|
77
77
|
ref?: React.Ref<HTMLDivElement>;
|
|
78
78
|
} & {
|
|
79
79
|
asChild?: boolean;
|
|
80
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement
|
|
80
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
81
81
|
progress?: number;
|
|
82
82
|
label?: string;
|
|
83
83
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { composeRefs as S } from "../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
4
|
+
var E = Symbol.for("react.lazy"), p = o[" use ".trim().toString()];
|
|
5
|
+
function g(t) {
|
|
6
|
+
return typeof t == "object" && t !== null && "then" in t;
|
|
7
|
+
}
|
|
8
|
+
function d(t) {
|
|
9
|
+
return t != null && typeof t == "object" && "$$typeof" in t && t.$$typeof === E && "_payload" in t && g(t._payload);
|
|
10
|
+
}
|
|
11
|
+
// @__NO_SIDE_EFFECTS__
|
|
12
|
+
function C(t) {
|
|
13
|
+
const n = /* @__PURE__ */ R(t), i = o.forwardRef((e, r) => {
|
|
14
|
+
let { children: l, ...a } = e;
|
|
15
|
+
d(l) && typeof p == "function" && (l = p(l._payload));
|
|
16
|
+
const s = o.Children.toArray(l), f = s.find(b);
|
|
17
|
+
if (f) {
|
|
18
|
+
const c = f.props.children, m = s.map((u) => u === f ? o.Children.count(c) > 1 ? o.Children.only(null) : o.isValidElement(c) ? c.props.children : null : u);
|
|
19
|
+
return /* @__PURE__ */ y(n, { ...a, ref: r, children: o.isValidElement(c) ? o.cloneElement(c, void 0, m) : null });
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ y(n, { ...a, ref: r, children: l });
|
|
22
|
+
});
|
|
23
|
+
return i.displayName = `${t}.Slot`, i;
|
|
24
|
+
}
|
|
25
|
+
var V = /* @__PURE__ */ C("Slot");
|
|
26
|
+
// @__NO_SIDE_EFFECTS__
|
|
27
|
+
function R(t) {
|
|
28
|
+
const n = o.forwardRef((i, e) => {
|
|
29
|
+
let { children: r, ...l } = i;
|
|
30
|
+
if (d(r) && typeof p == "function" && (r = p(r._payload)), o.isValidElement(r)) {
|
|
31
|
+
const a = P(r), s = h(l, r.props);
|
|
32
|
+
return r.type !== o.Fragment && (s.ref = e ? S(e, a) : a), o.cloneElement(r, s);
|
|
33
|
+
}
|
|
34
|
+
return o.Children.count(r) > 1 ? o.Children.only(null) : null;
|
|
35
|
+
});
|
|
36
|
+
return n.displayName = `${t}.SlotClone`, n;
|
|
37
|
+
}
|
|
38
|
+
var _ = Symbol("radix.slottable");
|
|
39
|
+
function b(t) {
|
|
40
|
+
return o.isValidElement(t) && typeof t.type == "function" && "__radixId" in t.type && t.type.__radixId === _;
|
|
41
|
+
}
|
|
42
|
+
function h(t, n) {
|
|
43
|
+
const i = { ...n };
|
|
44
|
+
for (const e in n) {
|
|
45
|
+
const r = t[e], l = n[e];
|
|
46
|
+
/^on[A-Z]/.test(e) ? r && l ? i[e] = (...s) => {
|
|
47
|
+
const f = l(...s);
|
|
48
|
+
return r(...s), f;
|
|
49
|
+
} : r && (i[e] = r) : e === "style" ? i[e] = { ...r, ...l } : e === "className" && (i[e] = [r, l].filter(Boolean).join(" "));
|
|
50
|
+
}
|
|
51
|
+
return { ...t, ...i };
|
|
52
|
+
}
|
|
53
|
+
function P(t) {
|
|
54
|
+
var e, r;
|
|
55
|
+
let n = (e = Object.getOwnPropertyDescriptor(t.props, "ref")) == null ? void 0 : e.get, i = n && "isReactWarning" in n && n.isReactWarning;
|
|
56
|
+
return i ? t.ref : (n = (r = Object.getOwnPropertyDescriptor(t, "ref")) == null ? void 0 : r.get, i = n && "isReactWarning" in n && n.isReactWarning, i ? t.props.ref : t.props.ref || t.ref);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
V as Root,
|
|
60
|
+
V as Slot,
|
|
61
|
+
C as createSlot
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../node_modules/@radix-ui/react-slot/dist/index.mjs"],"sourcesContent":["// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\nvar REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nvar use = React[\" use \".trim().toString()];\nfunction isPromiseLike(value) {\n return typeof value === \"object\" && value !== null && \"then\" in value;\n}\nfunction isLazyComponent(element) {\n return element != null && typeof element === \"object\" && \"$$typeof\" in element && element.$$typeof === REACT_LAZY_TYPE && \"_payload\" in element && isPromiseLike(element._payload);\n}\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["REACT_LAZY_TYPE","use","React","isPromiseLike","value","isLazyComponent","element","createSlot","ownerName","SlotClone","createSlotClone","Slot2","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","jsx","Slot","childrenRef","getElementRef","props2","mergeProps","composeRefs","SLOTTABLE_IDENTIFIER","childProps","overrideProps","propName","slotPropValue","childPropValue","args","result","getter","_a","mayWarn","_b"],"mappings":";;;AAIA,IAAIA,IAAkB,OAAO,IAAI,YAAY,GACzCC,IAAMC,EAAM,QAAQ,KAAI,EAAG,SAAQ,CAAE;AACzC,SAASC,EAAcC,GAAO;AAC5B,SAAO,OAAOA,KAAU,YAAYA,MAAU,QAAQ,UAAUA;AAClE;AACA,SAASC,EAAgBC,GAAS;AAChC,SAAOA,KAAW,QAAQ,OAAOA,KAAY,YAAY,cAAcA,KAAWA,EAAQ,aAAaN,KAAmB,cAAcM,KAAWH,EAAcG,EAAQ,QAAQ;AACnL;AAAA;AAEA,SAASC,EAAWC,GAAW;AAC7B,QAAMC,IAA4B,gBAAAC,EAAgBF,CAAS,GACrDG,IAAQT,EAAM,WAAW,CAACU,GAAOC,MAAiB;AACtD,QAAI,EAAE,UAAAC,GAAU,GAAGC,EAAS,IAAKH;AACjC,IAAIP,EAAgBS,CAAQ,KAAK,OAAOb,KAAQ,eAC9Ca,IAAWb,EAAIa,EAAS,QAAQ;AAElC,UAAME,IAAgBd,EAAM,SAAS,QAAQY,CAAQ,GAC/CG,IAAYD,EAAc,KAAKE,CAAW;AAChD,QAAID,GAAW;AACb,YAAME,IAAaF,EAAU,MAAM,UAC7BG,IAAcJ,EAAc,IAAI,CAACK,MACjCA,MAAUJ,IACRf,EAAM,SAAS,MAAMiB,CAAU,IAAI,IAAUjB,EAAM,SAAS,KAAK,IAAI,IAClEA,EAAM,eAAeiB,CAAU,IAAIA,EAAW,MAAM,WAAW,OAE/DE,CAEV;AACD,aAAuB,gBAAAC,EAAIb,GAAW,EAAE,GAAGM,GAAW,KAAKF,GAAc,UAAUX,EAAM,eAAeiB,CAAU,IAAIjB,EAAM,aAAaiB,GAAY,QAAQC,CAAW,IAAI,MAAM;A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AcC,CAAQ,IAAI,IAAIG,MAAS;AACrC,YAAMC,IAASF,EAAe,GAAGC,CAAI;AACrC,aAAAF,EAAc,GAAGE,CAAI,GACdC;AAAA,IACT,IACSH,MACTF,EAAcC,CAAQ,IAAIC,KAEnBD,MAAa,UACtBD,EAAcC,CAAQ,IAAI,EAAE,GAAGC,GAAe,GAAGC,EAAc,IACtDF,MAAa,gBACtBD,EAAcC,CAAQ,IAAI,CAACC,GAAeC,CAAc,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,EAEtF;AACA,SAAO,EAAE,GAAGnB,GAAW,GAAGgB,EAAa;AACzC;AACA,SAASN,EAAcnB,GAAS;;AAC9B,MAAI+B,KAASC,IAAA,OAAO,yBAAyBhC,EAAQ,OAAO,KAAK,MAApD,gBAAAgC,EAAuD,KAChEC,IAAUF,KAAU,oBAAoBA,KAAUA,EAAO;AAC7D,SAAIE,IACKjC,EAAQ,OAEjB+B,KAASG,IAAA,OAAO,yBAAyBlC,GAAS,KAAK,MAA9C,gBAAAkC,EAAiD,KAC1DD,IAAUF,KAAU,oBAAoBA,KAAUA,EAAO,gBACrDE,IACKjC,EAAQ,MAAM,MAEhBA,EAAQ,MAAM,OAAOA,EAAQ;AACtC;","x_google_ignoreList":[0]}
|
package/dist/tokens.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "GENERATED. Design token values for consumers that do not render this package's React components. Compile these into your own CSS under your own names at your own build time; do not reference this package's runtime custom properties, whose names are content-hashed and change with their values.",
|
|
3
3
|
"package": "@epilot/volt-ui-experimental-griffel",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"themes": {
|
|
6
6
|
"light": {
|
|
7
7
|
"accent-1": "#fcfdfe",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epilot/volt-ui-experimental-griffel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Experimental Volt UI rebuild: Radix primitives styled with Griffel, bundled per micro-frontend instead of shared as a singleton",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -15,10 +15,17 @@
|
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"import": "./dist/index.js"
|
|
17
17
|
},
|
|
18
|
-
"./tokens
|
|
18
|
+
"./tokens": {
|
|
19
|
+
"types": "./dist/tokens/index.d.ts",
|
|
20
|
+
"import": "./dist/tokens/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./tokens.json": "./dist/tokens.json",
|
|
23
|
+
"./package.json": "./package.json"
|
|
19
24
|
},
|
|
20
25
|
"files": [
|
|
21
26
|
"dist",
|
|
27
|
+
"tokens.js",
|
|
28
|
+
"tokens.d.ts",
|
|
22
29
|
"README.md"
|
|
23
30
|
],
|
|
24
31
|
"sideEffects": false,
|
|
@@ -83,5 +90,15 @@
|
|
|
83
90
|
"vite": "^5.4.9",
|
|
84
91
|
"vitest": "^2.1.4"
|
|
85
92
|
},
|
|
86
|
-
"private": false
|
|
93
|
+
"private": false,
|
|
94
|
+
"typesVersions": {
|
|
95
|
+
"*": {
|
|
96
|
+
"tokens": [
|
|
97
|
+
"./dist/tokens/index.d.ts"
|
|
98
|
+
],
|
|
99
|
+
"tokens.json": [
|
|
100
|
+
"./dist/tokens.json"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
87
104
|
}
|
package/tokens.d.ts
ADDED
package/tokens.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Resolution stub for the `./tokens` subpath.
|
|
2
|
+
//
|
|
3
|
+
// `exports` in package.json already maps it, and webpack, Vite and Node all honour that. Tools
|
|
4
|
+
// that predate `exports` resolve a subpath as a file path instead — `<package>/tokens` becomes
|
|
5
|
+
// `<package>/tokens.js` — and find nothing. ESLint's node import resolver is one of them, so
|
|
6
|
+
// `import/no-unresolved` fires on a specifier that every bundler resolves correctly, and each
|
|
7
|
+
// consumer ends up carrying its own `eslint-disable`.
|
|
8
|
+
//
|
|
9
|
+
// This file is that path. It re-exports the same module the `exports` map points at, so both
|
|
10
|
+
// resolution routes land on one module instance and nothing is duplicated.
|
|
11
|
+
//
|
|
12
|
+
// Same shape as the `typesVersions` entry, which exists for the same reason on the TypeScript side.
|
|
13
|
+
export * from "./dist/tokens/index.js"
|