coatx 0.0.0-stage → 0.1.0-beta.1

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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +8 -0
  3. package/README.md +281 -2
  4. package/dist/accordion.d.ts +91 -0
  5. package/dist/accordion.js +114 -0
  6. package/dist/alert.d.ts +55 -0
  7. package/dist/alert.js +64 -0
  8. package/dist/aspect-ratio.d.ts +44 -0
  9. package/dist/aspect-ratio.js +64 -0
  10. package/dist/attrs.d.ts +43 -0
  11. package/dist/attrs.js +195 -0
  12. package/dist/avatar.d.ts +60 -0
  13. package/dist/avatar.js +76 -0
  14. package/dist/badge.d.ts +52 -0
  15. package/dist/badge.js +68 -0
  16. package/dist/breadcrumb.d.ts +70 -0
  17. package/dist/breadcrumb.js +87 -0
  18. package/dist/button-group.d.ts +56 -0
  19. package/dist/button-group.js +72 -0
  20. package/dist/button.d.ts +133 -0
  21. package/dist/button.js +175 -0
  22. package/dist/calendar.d.ts +185 -0
  23. package/dist/calendar.js +220 -0
  24. package/dist/card.d.ts +73 -0
  25. package/dist/card.js +88 -0
  26. package/dist/carousel.d.ts +134 -0
  27. package/dist/carousel.js +172 -0
  28. package/dist/chart.d.ts +135 -0
  29. package/dist/chart.js +174 -0
  30. package/dist/checkbox.d.ts +87 -0
  31. package/dist/checkbox.js +113 -0
  32. package/dist/collapsible.d.ts +76 -0
  33. package/dist/collapsible.js +96 -0
  34. package/dist/combobox.d.ts +190 -0
  35. package/dist/combobox.js +225 -0
  36. package/dist/command.d.ts +150 -0
  37. package/dist/command.js +179 -0
  38. package/dist/dialog.d.ts +132 -0
  39. package/dist/dialog.js +164 -0
  40. package/dist/drawer.d.ts +140 -0
  41. package/dist/drawer.js +171 -0
  42. package/dist/empty.d.ts +85 -0
  43. package/dist/empty.js +100 -0
  44. package/dist/field.d.ts +35 -0
  45. package/dist/field.js +43 -0
  46. package/dist/hover-card.d.ts +30 -0
  47. package/dist/hover-card.js +35 -0
  48. package/dist/index.d.ts +55 -0
  49. package/dist/index.js +54 -0
  50. package/dist/input-otp.d.ts +88 -0
  51. package/dist/input-otp.js +110 -0
  52. package/dist/input.d.ts +90 -0
  53. package/dist/input.js +112 -0
  54. package/dist/item.d.ts +147 -0
  55. package/dist/item.js +187 -0
  56. package/dist/kbd.d.ts +37 -0
  57. package/dist/kbd.js +42 -0
  58. package/dist/label.d.ts +29 -0
  59. package/dist/label.js +37 -0
  60. package/dist/menu.d.ts +203 -0
  61. package/dist/menu.js +247 -0
  62. package/dist/native-select.d.ts +75 -0
  63. package/dist/native-select.js +91 -0
  64. package/dist/navigation-menu.d.ts +173 -0
  65. package/dist/navigation-menu.js +203 -0
  66. package/dist/pagination.d.ts +94 -0
  67. package/dist/pagination.js +113 -0
  68. package/dist/popover.d.ts +58 -0
  69. package/dist/popover.js +69 -0
  70. package/dist/progress.d.ts +52 -0
  71. package/dist/progress.js +65 -0
  72. package/dist/radio.d.ts +89 -0
  73. package/dist/radio.js +114 -0
  74. package/dist/react.d.ts +16 -0
  75. package/dist/react.js +26 -0
  76. package/dist/resizable.d.ts +85 -0
  77. package/dist/resizable.js +109 -0
  78. package/dist/scroll-area.d.ts +66 -0
  79. package/dist/scroll-area.js +81 -0
  80. package/dist/segmented-control.d.ts +107 -0
  81. package/dist/segmented-control.js +128 -0
  82. package/dist/select.d.ts +164 -0
  83. package/dist/select.js +199 -0
  84. package/dist/separator.d.ts +27 -0
  85. package/dist/separator.js +34 -0
  86. package/dist/sheet.d.ts +151 -0
  87. package/dist/sheet.js +185 -0
  88. package/dist/sidebar.d.ts +317 -0
  89. package/dist/sidebar.js +371 -0
  90. package/dist/skeleton.d.ts +16 -0
  91. package/dist/skeleton.js +21 -0
  92. package/dist/slider.d.ts +88 -0
  93. package/dist/slider.js +116 -0
  94. package/dist/spinner.d.ts +40 -0
  95. package/dist/spinner.js +55 -0
  96. package/dist/styles.css +669 -0
  97. package/dist/switch.d.ts +79 -0
  98. package/dist/switch.js +100 -0
  99. package/dist/table.d.ts +87 -0
  100. package/dist/table.js +112 -0
  101. package/dist/tabs.d.ts +129 -0
  102. package/dist/tabs.js +153 -0
  103. package/dist/textarea.d.ts +49 -0
  104. package/dist/textarea.js +60 -0
  105. package/dist/themes.stylex.d.ts +106 -0
  106. package/dist/themes.stylex.js +115 -0
  107. package/dist/toast.d.ts +190 -0
  108. package/dist/toast.js +230 -0
  109. package/dist/toggle.d.ts +88 -0
  110. package/dist/toggle.js +113 -0
  111. package/dist/tokens.stylex.d.ts +59 -0
  112. package/dist/tokens.stylex.js +69 -0
  113. package/dist/tooltip.d.ts +37 -0
  114. package/dist/tooltip.js +44 -0
  115. package/dist/typography.d.ts +141 -0
  116. package/dist/typography.js +166 -0
  117. package/package.json +313 -4
@@ -0,0 +1,44 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ import type { CoatxAttrs, CoatxExtraOptions } from "./attrs.js";
3
+ export type AspectRatioPreset = "16/9" | "4/3" | "1/1" | "21/9" | "3/2" | "9/16";
4
+ export interface AspectRatioOptions extends CoatxExtraOptions {
5
+ ratio?: AspectRatioPreset;
6
+ }
7
+ export type AspectRatioPartOptions = CoatxExtraOptions;
8
+ export declare const aspectRatioStyles: Readonly<{
9
+ readonly content: Readonly<{
10
+ readonly height: stylex.StyleXClassNameFor<"height", "100%">;
11
+ readonly inset: stylex.StyleXClassNameFor<"inset", 0>;
12
+ readonly objectFit: stylex.StyleXClassNameFor<"objectFit", "cover">;
13
+ readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
14
+ readonly width: stylex.StyleXClassNameFor<"width", "100%">;
15
+ }>;
16
+ readonly ratio16x9: Readonly<{
17
+ readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "16 / 9">;
18
+ }>;
19
+ readonly ratio1x1: Readonly<{
20
+ readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "1 / 1">;
21
+ }>;
22
+ readonly ratio21x9: Readonly<{
23
+ readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "21 / 9">;
24
+ }>;
25
+ readonly ratio3x2: Readonly<{
26
+ readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "3 / 2">;
27
+ }>;
28
+ readonly ratio4x3: Readonly<{
29
+ readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "4 / 3">;
30
+ }>;
31
+ readonly ratio9x16: Readonly<{
32
+ readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "9 / 16">;
33
+ }>;
34
+ readonly root: Readonly<{
35
+ readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
36
+ readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
37
+ readonly position: stylex.StyleXClassNameFor<"position", "relative">;
38
+ readonly width: stylex.StyleXClassNameFor<"width", "100%">;
39
+ }>;
40
+ }>;
41
+ /** Fixed-ratio media wrapper (`16/9`, `4/3`, `1/1`, `21/9`, `3/2`, `9/16`). */
42
+ export declare const aspectRatio: (options?: AspectRatioOptions) => CoatxAttrs;
43
+ /** Stretched inner media slot (`<img>`, `<video>`, or `<iframe>`) inside `aspectRatio()`. */
44
+ export declare const aspectRatioContent: (options?: AspectRatioPartOptions) => CoatxAttrs;
@@ -0,0 +1,64 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ import { toAttrs } from "./attrs.js";
3
+ import "./tokens.stylex.js";
4
+ import { radii } from "./tokens.stylex.js";
5
+ export const aspectRatioStyles = {
6
+ content: {
7
+ kZKoxP: "x5yr21d",
8
+ kpwlN0: "x10a8y8t",
9
+ kVIFPx: "xl1xv1r",
10
+ kVAEAm: "x10l6tqk",
11
+ kzqmXN: "xh8yej3",
12
+ $$css: true
13
+ },
14
+ ratio16x9: {
15
+ kOBAk4: "x186iv6y",
16
+ $$css: true
17
+ },
18
+ ratio1x1: {
19
+ kOBAk4: "x1y5e3q9",
20
+ $$css: true
21
+ },
22
+ ratio21x9: {
23
+ kOBAk4: "xg6t43p",
24
+ $$css: true
25
+ },
26
+ ratio3x2: {
27
+ kOBAk4: "xoob0kj",
28
+ $$css: true
29
+ },
30
+ ratio4x3: {
31
+ kOBAk4: "x1dltgaz",
32
+ $$css: true
33
+ },
34
+ ratio9x16: {
35
+ kOBAk4: "x15jox0q",
36
+ $$css: true
37
+ },
38
+ root: {
39
+ kaIpWk: "xf2zneb",
40
+ kVQacm: "xb3r6kr",
41
+ kVAEAm: "x1n2onr6",
42
+ kzqmXN: "xh8yej3",
43
+ $$css: true
44
+ }
45
+ };
46
+ const ratioMap = {
47
+ "1/1": aspectRatioStyles.ratio1x1,
48
+ "16/9": aspectRatioStyles.ratio16x9,
49
+ "21/9": aspectRatioStyles.ratio21x9,
50
+ "3/2": aspectRatioStyles.ratio3x2,
51
+ "4/3": aspectRatioStyles.ratio4x3,
52
+ "9/16": aspectRatioStyles.ratio9x16
53
+ };
54
+
55
+ /** Fixed-ratio media wrapper (`16/9`, `4/3`, `1/1`, `21/9`, `3/2`, `9/16`). */
56
+ export const aspectRatio = (options = {}) => {
57
+ const {
58
+ ratio = "16/9"
59
+ } = options;
60
+ return toAttrs([aspectRatioStyles.root, ratioMap[ratio]], options);
61
+ };
62
+
63
+ /** Stretched inner media slot (`<img>`, `<video>`, or `<iframe>`) inside `aspectRatio()`. */
64
+ export const aspectRatioContent = (options = {}) => toAttrs([aspectRatioStyles.content], options);
@@ -0,0 +1,43 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ export type CoatxStyleObject = Record<string, string | number>;
3
+ export type CoatxStyleValue = string | Readonly<CoatxStyleObject>;
4
+ export interface CoatxExtraOptions {
5
+ class?: string;
6
+ style?: CoatxStyleValue;
7
+ }
8
+ export interface CoatxAttrs {
9
+ class?: string;
10
+ style?: string;
11
+ }
12
+ export type StyleArg = stylex.StyleXStyles | false | null | undefined;
13
+ /**
14
+ * Convert a kebab-case CSS property to its JS/React camelCase form.
15
+ * Custom properties (`--*`) pass through verbatim; `-ms-` maps to the React
16
+ * `ms` prefix while other vendor prefixes keep a capitalized prefix
17
+ * (`-webkit-` → `Webkit`).
18
+ */
19
+ export declare const toCamelProperty: (prop: string) => string;
20
+ /**
21
+ * Convert a camelCase (or vendor-prefixed React-style) property back to
22
+ * kebab-case CSS. Custom properties (`--*`) pass through verbatim.
23
+ */
24
+ export declare const toKebabProperty: (prop: string) => string;
25
+ /** Split a CSS declaration block on top-level `;`, ignoring quotes/parens. */
26
+ export declare const splitDeclarations: (cssText: string) => string[];
27
+ /**
28
+ * Parse an inline style string into `target` with camelCase keys (custom
29
+ * properties pass through verbatim). Later declarations win per property.
30
+ */
31
+ export declare const parseStyleString: (cssText: string, target: CoatxStyleObject) => void;
32
+ export declare const serializeStyleObject: (obj: Readonly<CoatxStyleObject>) => string;
33
+ /**
34
+ * Merge a pre-resolved class/style pair with caller `extra` options into
35
+ * framework-neutral `{ class, style }` attributes.
36
+ */
37
+ export declare const formatAttrs: (baseClass: string | undefined, baseStyle: string | undefined, extra?: CoatxExtraOptions) => CoatxAttrs;
38
+ /**
39
+ * Compile-free StyleX attribute composer: merges compiled StyleX style objects
40
+ * into framework-agnostic `{ class, style }` attributes. Adapt to React with
41
+ * `reactProps()` from `coatx/react`.
42
+ */
43
+ export declare const toAttrs: (styles: readonly StyleArg[], extra?: CoatxExtraOptions) => CoatxAttrs;
package/dist/attrs.js ADDED
@@ -0,0 +1,195 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ const KEBAB_PATTERN = /-(?<char>[a-z])/gu;
3
+ const CAMEL_PATTERN = /[A-Z]/gu;
4
+ const isString = value => typeof value === "string";
5
+
6
+ /**
7
+ * Convert a kebab-case CSS property to its JS/React camelCase form.
8
+ * Custom properties (`--*`) pass through verbatim; `-ms-` maps to the React
9
+ * `ms` prefix while other vendor prefixes keep a capitalized prefix
10
+ * (`-webkit-` → `Webkit`).
11
+ */
12
+ export const toCamelProperty = prop => {
13
+ if (prop.startsWith("--")) {
14
+ return prop;
15
+ }
16
+ const camel = prop.replace(/^-/u, "").replaceAll(KEBAB_PATTERN, (_match, char) => char.toUpperCase());
17
+ if (prop.startsWith("-ms-")) {
18
+ return camel;
19
+ }
20
+ if (prop.startsWith("-")) {
21
+ return camel.charAt(0).toUpperCase() + camel.slice(1);
22
+ }
23
+ return camel;
24
+ };
25
+
26
+ /**
27
+ * Convert a camelCase (or vendor-prefixed React-style) property back to
28
+ * kebab-case CSS. Custom properties (`--*`) pass through verbatim.
29
+ */
30
+ export const toKebabProperty = prop => {
31
+ if (prop.startsWith("--")) {
32
+ return prop;
33
+ }
34
+ if (/^ms[A-Z]/u.test(prop)) {
35
+ return `-${prop.replaceAll(CAMEL_PATTERN, char => `-${char.toLowerCase()}`)}`;
36
+ }
37
+ return prop.replaceAll(CAMEL_PATTERN, char => `-${char.toLowerCase()}`);
38
+ };
39
+
40
+ /** Split a CSS declaration block on top-level `;`, ignoring quotes/parens. */
41
+ export const splitDeclarations = cssText => {
42
+ const parts = [];
43
+ let depth = 0;
44
+ let quote = null;
45
+ let current = "";
46
+ for (let i = 0; i < cssText.length; i += 1) {
47
+ const char = cssText[i];
48
+ if (quote) {
49
+ current += char;
50
+ if (char === "\\" && i + 1 < cssText.length) {
51
+ current += cssText[i + 1];
52
+ i += 1;
53
+ } else if (char === quote) {
54
+ quote = null;
55
+ }
56
+ continue;
57
+ }
58
+ if (char === '"' || char === "'") {
59
+ quote = char;
60
+ current += char;
61
+ continue;
62
+ }
63
+ if (char === "(") {
64
+ depth += 1;
65
+ current += char;
66
+ continue;
67
+ }
68
+ if (char === ")") {
69
+ if (depth > 0) {
70
+ depth -= 1;
71
+ }
72
+ current += char;
73
+ continue;
74
+ }
75
+ if (char === ";" && depth === 0) {
76
+ parts.push(current);
77
+ current = "";
78
+ continue;
79
+ }
80
+ current += char;
81
+ }
82
+ parts.push(current);
83
+ return parts;
84
+ };
85
+
86
+ /** Find the `:` separating a declaration's property from its value. */
87
+ const findDeclarationColon = declaration => {
88
+ let depth = 0;
89
+ let quote = null;
90
+ for (let i = 0; i < declaration.length; i += 1) {
91
+ const char = declaration[i];
92
+ if (quote) {
93
+ if (char === "\\" && i + 1 < declaration.length) {
94
+ i += 1;
95
+ } else if (char === quote) {
96
+ quote = null;
97
+ }
98
+ continue;
99
+ }
100
+ if (char === '"' || char === "'") {
101
+ quote = char;
102
+ } else if (char === "(") {
103
+ depth += 1;
104
+ } else if (char === ")") {
105
+ if (depth > 0) {
106
+ depth -= 1;
107
+ }
108
+ } else if (char === ":" && depth === 0) {
109
+ return i;
110
+ }
111
+ }
112
+ return -1;
113
+ };
114
+
115
+ /**
116
+ * Parse an inline style string into `target` with camelCase keys (custom
117
+ * properties pass through verbatim). Later declarations win per property.
118
+ */
119
+ export const parseStyleString = (cssText, target) => {
120
+ for (const part of splitDeclarations(cssText)) {
121
+ const trimmed = part.trim();
122
+ if (!trimmed) {
123
+ continue;
124
+ }
125
+ const colonIdx = findDeclarationColon(trimmed);
126
+ if (colonIdx === -1) {
127
+ continue;
128
+ }
129
+ const rawKey = trimmed.slice(0, colonIdx).trim();
130
+ const rawVal = trimmed.slice(colonIdx + 1).trim();
131
+ if (rawKey && rawVal) {
132
+ target[toCamelProperty(rawKey)] = rawVal;
133
+ }
134
+ }
135
+ };
136
+ export const serializeStyleObject = obj => {
137
+ const parts = [];
138
+ for (const [key, val] of Object.entries(obj)) {
139
+ if (val === undefined) {
140
+ continue;
141
+ }
142
+ parts.push(`${toKebabProperty(key)}:${String(val)}`);
143
+ }
144
+ return parts.join(";");
145
+ };
146
+ const mergeStylesToString = (base, extra) => {
147
+ if (base === undefined && extra === undefined) {
148
+ return undefined;
149
+ }
150
+
151
+ // Parse-then-serialize so `extra` overrides `base` per property and the
152
+ // output never has `;;` or leading/trailing `;`.
153
+ const merged = {};
154
+ if (base) {
155
+ parseStyleString(base, merged);
156
+ }
157
+ if (isString(extra)) {
158
+ parseStyleString(extra, merged);
159
+ } else if (extra) {
160
+ for (const [key, value] of Object.entries(extra)) {
161
+ if (value !== undefined) {
162
+ merged[toCamelProperty(key)] = value;
163
+ }
164
+ }
165
+ }
166
+ const serialized = serializeStyleObject(merged);
167
+ return serialized || undefined;
168
+ };
169
+
170
+ /**
171
+ * Merge a pre-resolved class/style pair with caller `extra` options into
172
+ * framework-neutral `{ class, style }` attributes.
173
+ */
174
+ export const formatAttrs = (baseClass, baseStyle, extra) => {
175
+ const mergedClass = [baseClass, extra?.class].filter(Boolean).join(" ");
176
+ const mergedStyle = mergeStylesToString(baseStyle, extra?.style);
177
+ const out = {};
178
+ if (mergedClass) {
179
+ out.class = mergedClass;
180
+ }
181
+ if (mergedStyle !== undefined) {
182
+ out.style = mergedStyle;
183
+ }
184
+ return out;
185
+ };
186
+
187
+ /**
188
+ * Compile-free StyleX attribute composer: merges compiled StyleX style objects
189
+ * into framework-agnostic `{ class, style }` attributes. Adapt to React with
190
+ * `reactProps()` from `coatx/react`.
191
+ */
192
+ export const toAttrs = (styles, extra) => {
193
+ const result = stylex.attrs(...styles);
194
+ return formatAttrs(result.class, result.style, extra);
195
+ };
@@ -0,0 +1,60 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ import type { CoatxAttrs, CoatxExtraOptions } from "./attrs.js";
3
+ export type AvatarSize = "sm" | "default" | "lg";
4
+ export interface AvatarRecipeOptions extends CoatxExtraOptions {
5
+ size?: AvatarSize;
6
+ }
7
+ export type AvatarPartOptions = CoatxExtraOptions;
8
+ export declare const avatarStyles: Readonly<{
9
+ readonly fallback: Readonly<{
10
+ readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
11
+ readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
12
+ readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
13
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
14
+ readonly display: stylex.StyleXClassNameFor<"display", "flex">;
15
+ readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
16
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", "0.875rem">;
17
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", 500>;
18
+ readonly height: stylex.StyleXClassNameFor<"height", "100%">;
19
+ readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
20
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1>;
21
+ readonly userSelect: stylex.StyleXClassNameFor<"userSelect", "none">;
22
+ readonly width: stylex.StyleXClassNameFor<"width", "100%">;
23
+ }>;
24
+ readonly image: Readonly<{
25
+ readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "1 / 1">;
26
+ readonly display: stylex.StyleXClassNameFor<"display", "block">;
27
+ readonly height: stylex.StyleXClassNameFor<"height", "100%">;
28
+ readonly objectFit: stylex.StyleXClassNameFor<"objectFit", "cover">;
29
+ readonly width: stylex.StyleXClassNameFor<"width", "100%">;
30
+ }>;
31
+ readonly root: Readonly<{
32
+ readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
33
+ readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
34
+ readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
35
+ readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
36
+ readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
37
+ readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
38
+ readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
39
+ readonly position: stylex.StyleXClassNameFor<"position", "relative">;
40
+ readonly verticalAlign: stylex.StyleXClassNameFor<"verticalAlign", "middle">;
41
+ }>;
42
+ readonly sizeDefault: Readonly<{
43
+ readonly height: stylex.StyleXClassNameFor<"height", "2rem">;
44
+ readonly width: stylex.StyleXClassNameFor<"width", "2rem">;
45
+ }>;
46
+ readonly sizeLg: Readonly<{
47
+ readonly height: stylex.StyleXClassNameFor<"height", "2.5rem">;
48
+ readonly width: stylex.StyleXClassNameFor<"width", "2.5rem">;
49
+ }>;
50
+ readonly sizeSm: Readonly<{
51
+ readonly height: stylex.StyleXClassNameFor<"height", "1.5rem">;
52
+ readonly width: stylex.StyleXClassNameFor<"width", "1.5rem">;
53
+ }>;
54
+ }>;
55
+ /** shadcn/ui circular avatar frame recipe. */
56
+ export declare const avatar: (options?: AvatarRecipeOptions) => CoatxAttrs;
57
+ /** Avatar `<img>` element recipe. */
58
+ export declare const avatarImage: (options?: AvatarPartOptions) => CoatxAttrs;
59
+ /** Fallback initials / icon slot inside `avatar()`. */
60
+ export declare const avatarFallback: (options?: AvatarPartOptions) => CoatxAttrs;
package/dist/avatar.js ADDED
@@ -0,0 +1,76 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ import { toAttrs } from "./attrs.js";
3
+ import "./tokens.stylex.js";
4
+ import { colors, fonts, radii } from "./tokens.stylex.js";
5
+ export const avatarStyles = {
6
+ fallback: {
7
+ kGNEyG: "x6s0dn4",
8
+ kWkggS: "x1rwvmlf",
9
+ kaIpWk: "xhai6r8",
10
+ kMwMTN: "x19o77cb",
11
+ k1xSpc: "x78zum5",
12
+ kMv6JI: "x1afzh1k",
13
+ kGuDYH: "xkpwil5",
14
+ k63SB2: "xk50ysn",
15
+ kZKoxP: "x5yr21d",
16
+ kjj79g: "xl56j7k",
17
+ kLWn49: "xo5v014",
18
+ kfSwDN: "x87ps6o",
19
+ kzqmXN: "xh8yej3",
20
+ $$css: true
21
+ },
22
+ image: {
23
+ kOBAk4: "x1y5e3q9",
24
+ k1xSpc: "x1lliihq",
25
+ kZKoxP: "x5yr21d",
26
+ kVIFPx: "xl1xv1r",
27
+ kzqmXN: "xh8yej3",
28
+ $$css: true
29
+ },
30
+ root: {
31
+ kGNEyG: "x6s0dn4",
32
+ kaIpWk: "xhai6r8",
33
+ kB7OPa: "x9f619",
34
+ k1xSpc: "x3nfvp2",
35
+ kmuXW: "x2lah0s",
36
+ kjj79g: "xl56j7k",
37
+ kVQacm: "xb3r6kr",
38
+ kVAEAm: "x1n2onr6",
39
+ kXLuUW: "xxymvpz",
40
+ $$css: true
41
+ },
42
+ sizeDefault: {
43
+ kZKoxP: "xettwda",
44
+ kzqmXN: "xs5h3dt",
45
+ $$css: true
46
+ },
47
+ sizeLg: {
48
+ kZKoxP: "xwaiz5r",
49
+ kzqmXN: "xvm51jw",
50
+ $$css: true
51
+ },
52
+ sizeSm: {
53
+ kZKoxP: "xam5rvr",
54
+ kzqmXN: "xp8d6y2",
55
+ $$css: true
56
+ }
57
+ };
58
+ const sizeMap = {
59
+ default: avatarStyles.sizeDefault,
60
+ lg: avatarStyles.sizeLg,
61
+ sm: avatarStyles.sizeSm
62
+ };
63
+
64
+ /** shadcn/ui circular avatar frame recipe. */
65
+ export const avatar = (options = {}) => {
66
+ const {
67
+ size = "default"
68
+ } = options;
69
+ return toAttrs([avatarStyles.root, sizeMap[size]], options);
70
+ };
71
+
72
+ /** Avatar `<img>` element recipe. */
73
+ export const avatarImage = (options = {}) => toAttrs([avatarStyles.image], options);
74
+
75
+ /** Fallback initials / icon slot inside `avatar()`. */
76
+ export const avatarFallback = (options = {}) => toAttrs([avatarStyles.fallback], options);
@@ -0,0 +1,52 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ import type { CoatxAttrs, CoatxExtraOptions } from "./attrs.js";
3
+ export type BadgeVariant = "default" | "secondary" | "destructive" | "outline";
4
+ export interface BadgeRecipeOptions extends CoatxExtraOptions {
5
+ variant?: BadgeVariant;
6
+ }
7
+ export declare const badgeStyles: Readonly<{
8
+ readonly base: Readonly<{
9
+ readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
10
+ readonly borderColor: stylex.StyleXClassNameFor<"borderColor", "transparent">;
11
+ readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
12
+ readonly borderStyle: stylex.StyleXClassNameFor<"borderStyle", "solid">;
13
+ readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", 1>;
14
+ readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", string>;
15
+ readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
16
+ readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
17
+ readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
18
+ readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
19
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", "0.75rem">;
20
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", 500>;
21
+ readonly gap: stylex.StyleXClassNameFor<"gap", "0.25rem">;
22
+ readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
23
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.25>;
24
+ readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none">;
25
+ readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", "0.125rem">;
26
+ readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", "0.5rem">;
27
+ readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", "150ms">;
28
+ readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "background-color, border-color, color, box-shadow">;
29
+ readonly transitionTimingFunction: stylex.StyleXClassNameFor<"transitionTimingFunction", string>;
30
+ readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
31
+ readonly width: stylex.StyleXClassNameFor<"width", "fit-content">;
32
+ }>;
33
+ readonly variantDefault: Readonly<{
34
+ readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
35
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
36
+ }>;
37
+ readonly variantDestructive: Readonly<{
38
+ readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
39
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
40
+ }>;
41
+ readonly variantOutline: Readonly<{
42
+ readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "transparent">;
43
+ readonly borderColor: stylex.StyleXClassNameFor<"borderColor", string>;
44
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
45
+ }>;
46
+ readonly variantSecondary: Readonly<{
47
+ readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
48
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
49
+ }>;
50
+ }>;
51
+ /** shadcn/ui badge pill recipe returning `{ class, style }`. */
52
+ export declare const badge: (options?: BadgeRecipeOptions) => CoatxAttrs;
package/dist/badge.js ADDED
@@ -0,0 +1,68 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ import { toAttrs } from "./attrs.js";
3
+ import "./tokens.stylex.js";
4
+ import { colors, fonts, motion, radii } from "./tokens.stylex.js";
5
+ const FOCUS_RING = `0 0 0 3px color-mix(in oklab, ${colors.ring} 50%, transparent)`;
6
+ export const badgeStyles = {
7
+ base: {
8
+ kGNEyG: "x6s0dn4",
9
+ kVAM5u: "x9r1u3d",
10
+ kaIpWk: "xhai6r8",
11
+ ksu8eU: "x1y0btm7",
12
+ kMzoRj: "xmkeg23",
13
+ kGVxlE: "x1gnnqk1 x1qezvrj",
14
+ kB7OPa: "x9f619",
15
+ k1xSpc: "x3nfvp2",
16
+ kmuXW: "x2lah0s",
17
+ kMv6JI: "x1afzh1k",
18
+ kGuDYH: "xboafo0",
19
+ k63SB2: "xk50ysn",
20
+ kOIVth: "xvh977a",
21
+ kjj79g: "xl56j7k",
22
+ kLWn49: "x132q4wb",
23
+ k3XXqK: "x1t137rt",
24
+ k8WAf4: "x1dus959",
25
+ kg3NbH: "x97vtpp",
26
+ kIyJzY: "xx6bhzk",
27
+ k1ekBW: "xgzoi8n",
28
+ kAMwcw: "x1kktvmy",
29
+ khDVqt: "xuxw1ft",
30
+ kzqmXN: "xeq5yr9",
31
+ $$css: true
32
+ },
33
+ variantDefault: {
34
+ kWkggS: "x1ii36zw",
35
+ kMwMTN: "xvk9bjm",
36
+ $$css: true
37
+ },
38
+ variantDestructive: {
39
+ kWkggS: "xjfbety",
40
+ kMwMTN: "x17vy23b",
41
+ $$css: true
42
+ },
43
+ variantOutline: {
44
+ kWkggS: "xjbqb8w",
45
+ kVAM5u: "x7j6xd0",
46
+ kMwMTN: "x1ngb8q1",
47
+ $$css: true
48
+ },
49
+ variantSecondary: {
50
+ kWkggS: "x1i480mi",
51
+ kMwMTN: "xq5iyju",
52
+ $$css: true
53
+ }
54
+ };
55
+ const variantMap = {
56
+ default: badgeStyles.variantDefault,
57
+ destructive: badgeStyles.variantDestructive,
58
+ outline: badgeStyles.variantOutline,
59
+ secondary: badgeStyles.variantSecondary
60
+ };
61
+
62
+ /** shadcn/ui badge pill recipe returning `{ class, style }`. */
63
+ export const badge = (options = {}) => {
64
+ const {
65
+ variant = "default"
66
+ } = options;
67
+ return toAttrs([badgeStyles.base, variantMap[variant]], options);
68
+ };
@@ -0,0 +1,70 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ import type { CoatxAttrs, CoatxExtraOptions } from "./attrs.js";
3
+ export type BreadcrumbPartOptions = CoatxExtraOptions;
4
+ export declare const breadcrumbStyles: Readonly<{
5
+ readonly ellipsis: Readonly<{
6
+ readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
7
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
8
+ readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
9
+ readonly height: stylex.StyleXClassNameFor<"height", "1.5rem">;
10
+ readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
11
+ readonly width: stylex.StyleXClassNameFor<"width", "1.5rem">;
12
+ }>;
13
+ readonly item: Readonly<{
14
+ readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
15
+ readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
16
+ readonly gap: stylex.StyleXClassNameFor<"gap", "0.375rem">;
17
+ }>;
18
+ readonly link: Readonly<{
19
+ readonly color: stylex.StyleXClassNameFor<"color", string | null>;
20
+ readonly textDecoration: stylex.StyleXClassNameFor<"textDecoration", "none">;
21
+ readonly touchAction: stylex.StyleXClassNameFor<"touchAction", "manipulation">;
22
+ readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", "150ms">;
23
+ readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "color">;
24
+ readonly WebkitTapHighlightColor: stylex.StyleXClassNameFor<"WebkitTapHighlightColor", "transparent">;
25
+ }>;
26
+ readonly list: Readonly<{
27
+ readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
28
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
29
+ readonly display: stylex.StyleXClassNameFor<"display", "flex">;
30
+ readonly flexWrap: stylex.StyleXClassNameFor<"flexWrap", "wrap">;
31
+ readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
32
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", "0.875rem">;
33
+ readonly gap: stylex.StyleXClassNameFor<"gap", "0.5rem">;
34
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.4>;
35
+ readonly listStyleType: stylex.StyleXClassNameFor<"listStyleType", "none">;
36
+ readonly marginBlock: stylex.StyleXClassNameFor<"marginBlock", 0>;
37
+ readonly marginInline: stylex.StyleXClassNameFor<"marginInline", 0>;
38
+ readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "break-word">;
39
+ readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", 0>;
40
+ readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", 0>;
41
+ }>;
42
+ readonly page: Readonly<{
43
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
44
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", 400>;
45
+ }>;
46
+ readonly root: Readonly<{
47
+ readonly display: stylex.StyleXClassNameFor<"display", "block">;
48
+ }>;
49
+ readonly separator: Readonly<{
50
+ readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
51
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
52
+ readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
53
+ readonly transform: stylex.StyleXClassNameFor<"transform", "none" | "scaleX(-1)">;
54
+ readonly userSelect: stylex.StyleXClassNameFor<"userSelect", "none">;
55
+ }>;
56
+ }>;
57
+ /** Root `<nav aria-label="breadcrumb">` wrapper. */
58
+ export declare const breadcrumb: (options?: BreadcrumbPartOptions) => CoatxAttrs;
59
+ /** Ordered `<ol>` list of breadcrumb crumbs. */
60
+ export declare const breadcrumbList: (options?: BreadcrumbPartOptions) => CoatxAttrs;
61
+ /** Individual `<li>` crumb wrapper. */
62
+ export declare const breadcrumbItem: (options?: BreadcrumbPartOptions) => CoatxAttrs;
63
+ /** Ancestor navigation link inside `breadcrumbItem()`. */
64
+ export declare const breadcrumbLink: (options?: BreadcrumbPartOptions) => CoatxAttrs;
65
+ /** Current page crumb label (`aria-current="page"`). */
66
+ export declare const breadcrumbPage: (options?: BreadcrumbPartOptions) => CoatxAttrs;
67
+ /** Separator chevron / slash between crumbs. */
68
+ export declare const breadcrumbSeparator: (options?: BreadcrumbPartOptions) => CoatxAttrs;
69
+ /** Collapsed breadcrumb ellipsis indicator. */
70
+ export declare const breadcrumbEllipsis: (options?: BreadcrumbPartOptions) => CoatxAttrs;