@x-green/components 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,523 @@
1
+ import './index.css'
2
+ import { tv as e } from "tailwind-variants";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ //#region src/components/button-variants.ts
5
+ var n = ["disabled:pointer-events-none disabled:cursor-not-allowed", "disabled:border-neutral-500 disabled:bg-neutral-50 disabled:text-neutral-500"].join(" "), r = ["disabled:pointer-events-none disabled:cursor-not-allowed", "disabled:border-transparent disabled:bg-transparent disabled:text-neutral-500"].join(" "), i = ["focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", "data-[status=focus]:isolate data-[status=focus]:outline-2 data-[status=focus]:outline-offset-2 data-[status=focus]:outline-primary"].join(" "), a = e({
6
+ base: [
7
+ "box-border inline-flex flex-row items-center justify-center gap-2",
8
+ "h-[44px] px-3",
9
+ "rounded-lg border border-solid",
10
+ "body-md-semibold",
11
+ "cursor-pointer transition-colors",
12
+ "focus-visible:isolate",
13
+ i
14
+ ].join(" "),
15
+ variants: { variant: {
16
+ primary: [
17
+ "border-primary bg-primary text-white",
18
+ "hover:border-primary-hover hover:bg-primary-hover",
19
+ "focus-visible:border-primary focus-visible:bg-primary",
20
+ "data-[status=hover]:border-primary-hover data-[status=hover]:bg-primary-hover",
21
+ "data-[status=focus]:border-primary data-[status=focus]:bg-primary",
22
+ n
23
+ ].join(" "),
24
+ outline: [
25
+ "border-primary bg-outline text-primary",
26
+ "hover:border-primary-hover hover:bg-outline hover:text-primary-hover",
27
+ "focus-visible:border-primary focus-visible:bg-outline focus-visible:text-primary",
28
+ "data-[status=hover]:border-primary-hover data-[status=hover]:bg-outline data-[status=hover]:text-primary-hover",
29
+ "data-[status=focus]:border-primary data-[status=focus]:bg-outline data-[status=focus]:text-primary",
30
+ n
31
+ ].join(" "),
32
+ transparent: [
33
+ "border-transparent bg-transparent text-primary",
34
+ "hover:border-transparent hover:bg-transparent hover:text-primary-hover",
35
+ "focus-visible:border-transparent focus-visible:bg-transparent focus-visible:text-primary",
36
+ "data-[status=hover]:border-transparent data-[status=hover]:bg-transparent data-[status=hover]:text-primary-hover",
37
+ "data-[status=focus]:border-transparent data-[status=focus]:bg-transparent data-[status=focus]:text-primary",
38
+ r
39
+ ].join(" "),
40
+ error: [
41
+ "border-error bg-error text-white",
42
+ "hover:border-error-hover hover:bg-error-hover",
43
+ "focus-visible:border-error focus-visible:bg-error",
44
+ "focus-visible:outline-error",
45
+ "data-[status=hover]:border-error-hover data-[status=hover]:bg-error-hover",
46
+ "data-[status=focus]:border-error data-[status=focus]:bg-error data-[status=focus]:outline-error",
47
+ n
48
+ ].join(" "),
49
+ "outline-error": [
50
+ "border-error bg-outline text-error",
51
+ "hover:border-error-hover hover:bg-outline hover:text-error-hover",
52
+ "focus-visible:border-error focus-visible:bg-outline focus-visible:text-error",
53
+ "focus-visible:outline-error",
54
+ "data-[status=hover]:border-error-hover data-[status=hover]:bg-outline data-[status=hover]:text-error-hover",
55
+ "data-[status=focus]:border-error data-[status=focus]:bg-outline data-[status=focus]:text-error data-[status=focus]:outline-error",
56
+ n
57
+ ].join(" "),
58
+ "transparent-error": [
59
+ "border-transparent bg-transparent text-error",
60
+ "hover:border-transparent hover:bg-transparent hover:text-error-hover",
61
+ "focus-visible:border-transparent focus-visible:bg-transparent focus-visible:text-error",
62
+ "focus-visible:outline-error",
63
+ "data-[status=hover]:border-transparent data-[status=hover]:bg-transparent data-[status=hover]:text-error-hover",
64
+ "data-[status=focus]:border-transparent data-[status=focus]:bg-transparent data-[status=focus]:text-error data-[status=focus]:outline-error",
65
+ r
66
+ ].join(" "),
67
+ neutral: [
68
+ "border-neutral-200 bg-outline text-neutral-800",
69
+ "hover:border-neutral-300 hover:bg-neutral-50 hover:text-neutral-800",
70
+ "focus-visible:border-neutral-200 focus-visible:bg-outline focus-visible:text-neutral-800",
71
+ "data-[status=hover]:border-neutral-300 data-[status=hover]:bg-neutral-50 data-[status=hover]:text-neutral-800",
72
+ "data-[status=focus]:border-neutral-200 data-[status=focus]:bg-outline data-[status=focus]:text-neutral-800",
73
+ n
74
+ ].join(" "),
75
+ "outline-neutral": [
76
+ "border-neutral-200 bg-outline text-neutral-800",
77
+ "hover:border-neutral-300 hover:bg-outline hover:text-neutral-800",
78
+ "focus-visible:border-neutral-200 focus-visible:bg-outline focus-visible:text-neutral-800",
79
+ "data-[status=hover]:border-neutral-300 data-[status=hover]:bg-outline data-[status=hover]:text-neutral-800",
80
+ "data-[status=focus]:border-neutral-200 data-[status=focus]:bg-outline data-[status=focus]:text-neutral-800",
81
+ n
82
+ ].join(" "),
83
+ "transparent-neutral": [
84
+ "border-transparent bg-transparent text-neutral-800",
85
+ "hover:border-transparent hover:bg-transparent hover:text-neutral-900",
86
+ "focus-visible:border-transparent focus-visible:bg-transparent focus-visible:text-neutral-800",
87
+ "data-[status=hover]:border-transparent data-[status=hover]:bg-transparent data-[status=hover]:text-neutral-900",
88
+ "data-[status=focus]:border-transparent data-[status=focus]:bg-transparent data-[status=focus]:text-neutral-800",
89
+ r
90
+ ].join(" ")
91
+ } },
92
+ defaultVariants: { variant: "primary" }
93
+ });
94
+ //#endregion
95
+ //#region src/components/button.tsx
96
+ function o({ variant: e, className: n, type: r = "button", children: i, ...o }) {
97
+ return /* @__PURE__ */ t("button", {
98
+ type: r,
99
+ className: a({
100
+ variant: e,
101
+ className: n
102
+ }),
103
+ ...o,
104
+ children: i
105
+ });
106
+ }
107
+ //#endregion
108
+ //#region src/tokens/primitives/colors.ts
109
+ var s = {
110
+ 25: "5%",
111
+ 50: "10%",
112
+ 100: "20%",
113
+ 200: "40%",
114
+ 300: "60%",
115
+ 400: "80%",
116
+ 500: "100%",
117
+ 600: "80%",
118
+ 700: "60%",
119
+ 800: "40%",
120
+ 900: "20%",
121
+ 950: "10%"
122
+ }, c = {
123
+ neutral: {
124
+ 25: "#EBF0F6",
125
+ 50: "#E5EAF1",
126
+ 100: "#DAE0E7",
127
+ 200: "#C5CAD3",
128
+ 300: "#AFB5C0",
129
+ 400: "#9A9FAC",
130
+ 500: "#848A98",
131
+ 600: "#6A6E7A",
132
+ 700: "#4F535B",
133
+ 800: "#35373D",
134
+ 900: "#1A1C1E",
135
+ 950: "#0D0E0F"
136
+ },
137
+ green: {
138
+ 50: "#E6F6EF",
139
+ 100: "#CCECCC",
140
+ 200: "#99D999",
141
+ 300: "#66C766",
142
+ 400: "#33B433",
143
+ 500: "#00A000",
144
+ 600: "#008100",
145
+ 700: "#006100",
146
+ 800: "#004000",
147
+ 900: "#002000",
148
+ 950: "#001000"
149
+ },
150
+ blue: {
151
+ 50: "#E6ECF6",
152
+ 100: "#CCD9EC",
153
+ 200: "#99B3D9",
154
+ 300: "#668CC6",
155
+ 400: "#3366B3",
156
+ 500: "#0040A0",
157
+ 600: "#003380",
158
+ 700: "#002660",
159
+ 800: "#001A40",
160
+ 900: "#000D20",
161
+ 950: "#000610"
162
+ },
163
+ purple: {
164
+ 50: "#EDE6F6",
165
+ 100: "#DBCCEC",
166
+ 200: "#B899D9",
167
+ 300: "#9466C6",
168
+ 400: "#7133B3",
169
+ 500: "#4D00A0",
170
+ 600: "#3E0080",
171
+ 700: "#2E0060",
172
+ 800: "#1F0040",
173
+ 900: "#0F0020",
174
+ 950: "#080010"
175
+ },
176
+ red: {
177
+ 50: "#FDECEC",
178
+ 100: "#FBD8D8",
179
+ 200: "#F7B1B1",
180
+ 300: "#F28A8A",
181
+ 400: "#EE6363",
182
+ 500: "#EA3C3C",
183
+ 600: "#BB3030",
184
+ 700: "#8C2424",
185
+ 800: "#5E1818",
186
+ 900: "#2F0C0C",
187
+ 950: "#170606"
188
+ },
189
+ orange: {
190
+ 50: "#FFF1E8",
191
+ 100: "#FFE4D0",
192
+ 200: "#FFC8A1",
193
+ 300: "#FFAD73",
194
+ 400: "#FF9144",
195
+ 500: "#FF7615",
196
+ 600: "#CC5E11",
197
+ 700: "#99470D",
198
+ 800: "#662F08",
199
+ 900: "#331804",
200
+ 950: "#190C02"
201
+ },
202
+ yellow: {
203
+ 50: "#FFF8E8",
204
+ 100: "#FFF2D0",
205
+ 200: "#FFE5A1",
206
+ 300: "#FFD773",
207
+ 400: "#FFCA44",
208
+ 500: "#FFBD15",
209
+ 600: "#CC9711",
210
+ 700: "#99710D",
211
+ 800: "#664C08",
212
+ 900: "#332604",
213
+ 950: "#191302"
214
+ },
215
+ cyan: {
216
+ 50: "#E8FFFC",
217
+ 100: "#D0FFFA",
218
+ 200: "#A1FFF4",
219
+ 300: "#73FFEF",
220
+ 400: "#44FFE9",
221
+ 500: "#15FFE4",
222
+ 600: "#11CCB6",
223
+ 700: "#0D9989",
224
+ 800: "#08665B",
225
+ 900: "#04332E",
226
+ 950: "#021917"
227
+ }
228
+ };
229
+ function l(e) {
230
+ return s[Number(e)];
231
+ }
232
+ function u(e) {
233
+ let t = c[e];
234
+ return Object.fromEntries(Object.keys(t).map((t) => [t, `var(--color-${e}-${t})`]));
235
+ }
236
+ var d = Object.fromEntries(Object.entries(c).flatMap(([e, t]) => Object.entries(t).flatMap(([t, n]) => [[`--color-${e}-${t}`, n], [`--color-${e}-${t}-opacity`, l(t)]]))), f = {
237
+ neutral: u("neutral"),
238
+ green: u("green"),
239
+ blue: u("blue"),
240
+ purple: u("purple"),
241
+ red: u("red"),
242
+ orange: u("orange"),
243
+ yellow: u("yellow"),
244
+ cyan: u("cyan")
245
+ }, p = { sans: "var(--default-font-family)" }, m = {
246
+ regular: 400,
247
+ semibold: 600
248
+ }, h = {
249
+ xs: "12px",
250
+ sm: "14px",
251
+ md: "16px",
252
+ lg: "20px",
253
+ xl: "24px",
254
+ "2xl": "32px",
255
+ "3xl": "40px",
256
+ "4xl": "48px",
257
+ "5xl": "60px"
258
+ }, g = {
259
+ 16: h.md,
260
+ 20: h.lg,
261
+ 24: h.xl,
262
+ 28: "28px",
263
+ 40: h["3xl"],
264
+ 48: h["4xl"],
265
+ 56: "56px",
266
+ 72: "72px"
267
+ }, _ = {
268
+ primary: "#008149",
269
+ "primary-hover": "#006137",
270
+ outline: "#F0F5FB",
271
+ error: "#BB3030",
272
+ "error-hover": "#8C2424"
273
+ }, v = {
274
+ "--color-primary": _.primary,
275
+ "--color-primary-hover": _["primary-hover"],
276
+ "--color-outline": _.outline,
277
+ "--color-error": _.error,
278
+ "--color-error-hover": _["error-hover"]
279
+ }, y = {
280
+ background: c.neutral[50],
281
+ border: c.neutral[500],
282
+ text: c.neutral[500]
283
+ }, b = {
284
+ primary: {
285
+ default: {
286
+ background: _.primary,
287
+ border: _.primary
288
+ },
289
+ hover: {
290
+ background: _["primary-hover"],
291
+ border: _["primary-hover"]
292
+ },
293
+ focus: {
294
+ background: _.primary,
295
+ border: _.primary
296
+ },
297
+ disabled: y
298
+ },
299
+ outline: {
300
+ default: {
301
+ background: _.outline,
302
+ border: _.primary
303
+ },
304
+ hover: {
305
+ background: _.outline,
306
+ border: _["primary-hover"]
307
+ },
308
+ focus: {
309
+ background: _.outline,
310
+ border: _.primary
311
+ },
312
+ disabled: y
313
+ },
314
+ transparent: {
315
+ default: {
316
+ background: "transparent",
317
+ border: "transparent",
318
+ text: _.primary
319
+ },
320
+ hover: {
321
+ background: "transparent",
322
+ border: "transparent",
323
+ text: _["primary-hover"]
324
+ },
325
+ focus: {
326
+ background: "transparent",
327
+ border: "transparent",
328
+ text: _.primary
329
+ },
330
+ disabled: {
331
+ background: "transparent",
332
+ border: "transparent",
333
+ text: c.neutral[500]
334
+ }
335
+ },
336
+ error: {
337
+ default: {
338
+ background: _.error,
339
+ border: _.error
340
+ },
341
+ hover: {
342
+ background: _["error-hover"],
343
+ border: _["error-hover"]
344
+ },
345
+ focus: {
346
+ background: _.error,
347
+ border: _.error
348
+ },
349
+ disabled: y
350
+ },
351
+ "outline-error": {
352
+ default: {
353
+ background: _.outline,
354
+ border: _.error,
355
+ text: _.error
356
+ },
357
+ hover: {
358
+ background: _.outline,
359
+ border: _["error-hover"],
360
+ text: _["error-hover"]
361
+ },
362
+ focus: {
363
+ background: _.outline,
364
+ border: _.error,
365
+ text: _.error
366
+ },
367
+ disabled: y
368
+ },
369
+ "transparent-error": {
370
+ default: {
371
+ background: "transparent",
372
+ border: "transparent",
373
+ text: _.error
374
+ },
375
+ hover: {
376
+ background: "transparent",
377
+ border: "transparent",
378
+ text: _["error-hover"]
379
+ },
380
+ focus: {
381
+ background: "transparent",
382
+ border: "transparent",
383
+ text: _.error
384
+ },
385
+ disabled: {
386
+ background: "transparent",
387
+ border: "transparent",
388
+ text: c.neutral[500]
389
+ }
390
+ },
391
+ neutral: {
392
+ default: {
393
+ background: _.outline,
394
+ border: c.neutral[200],
395
+ text: c.neutral[800]
396
+ },
397
+ hover: {
398
+ background: c.neutral[50],
399
+ border: c.neutral[300],
400
+ text: c.neutral[800]
401
+ },
402
+ focus: {
403
+ background: _.outline,
404
+ border: c.neutral[200],
405
+ text: c.neutral[800]
406
+ },
407
+ disabled: y
408
+ },
409
+ "outline-neutral": {
410
+ default: {
411
+ background: _.outline,
412
+ border: c.neutral[200],
413
+ text: c.neutral[800]
414
+ },
415
+ hover: {
416
+ background: _.outline,
417
+ border: c.neutral[300],
418
+ text: c.neutral[800]
419
+ },
420
+ focus: {
421
+ background: _.outline,
422
+ border: c.neutral[200],
423
+ text: c.neutral[800]
424
+ },
425
+ disabled: y
426
+ },
427
+ "transparent-neutral": {
428
+ default: {
429
+ background: "transparent",
430
+ border: "transparent",
431
+ text: c.neutral[800]
432
+ },
433
+ hover: {
434
+ background: "transparent",
435
+ border: "transparent",
436
+ text: c.neutral[900]
437
+ },
438
+ focus: {
439
+ background: "transparent",
440
+ border: "transparent",
441
+ text: c.neutral[800]
442
+ },
443
+ disabled: {
444
+ background: "transparent",
445
+ border: "transparent",
446
+ text: c.neutral[500]
447
+ }
448
+ }
449
+ }, x = {
450
+ fontFamily: p.sans,
451
+ fontWeight: m.regular
452
+ }, S = {
453
+ ...x,
454
+ fontWeight: m.semibold
455
+ }, C = {
456
+ ...x,
457
+ fontSize: h.sm,
458
+ lineHeight: g[16]
459
+ }, w = {
460
+ ...x,
461
+ fontSize: h.md,
462
+ lineHeight: g[20]
463
+ }, T = {
464
+ ...x,
465
+ fontSize: h.lg,
466
+ lineHeight: g[24]
467
+ }, E = {
468
+ "heading-h1": {
469
+ ...S,
470
+ fontSize: h["5xl"],
471
+ lineHeight: g[72]
472
+ },
473
+ "heading-h2": {
474
+ ...S,
475
+ fontSize: h["4xl"],
476
+ lineHeight: g[56]
477
+ },
478
+ "heading-h3": {
479
+ ...S,
480
+ fontSize: h["3xl"],
481
+ lineHeight: g[48]
482
+ },
483
+ "heading-h4": {
484
+ ...S,
485
+ fontSize: h["2xl"],
486
+ lineHeight: g[40]
487
+ },
488
+ "heading-h5": {
489
+ ...S,
490
+ fontSize: h.xl,
491
+ lineHeight: g[28]
492
+ },
493
+ "heading-h6": {
494
+ ...S,
495
+ fontSize: h.lg,
496
+ lineHeight: g[24]
497
+ },
498
+ "body-sm": C,
499
+ "body-sm-semibold": {
500
+ ...C,
501
+ fontWeight: m.semibold
502
+ },
503
+ "body-sm-link": C,
504
+ "body-md": w,
505
+ "body-md-link": w,
506
+ "body-md-semibold": {
507
+ ...w,
508
+ fontWeight: m.semibold
509
+ },
510
+ "body-lg": T,
511
+ "body-lg-link": T,
512
+ "body-lg-semibold": {
513
+ ...T,
514
+ fontWeight: m.semibold
515
+ },
516
+ caption: {
517
+ ...x,
518
+ fontSize: h.xs,
519
+ lineHeight: g[16]
520
+ }
521
+ };
522
+ //#endregion
523
+ export { o as Button, b as button, a as buttonVariants, d as colorCssVariables, f as colorCssVars, s as colorShadeOpacity, c as colors, p as fontFamily, h as fontSize, m as fontWeight, g as lineHeight, v as semanticColorCssVariables, _ as semanticColors, E as typography };
@@ -0,0 +1,8 @@
1
+ export { colorCssVariables, colorCssVars, colors, colorShadeOpacity, } from './primitives/colors';
2
+ export type { ColorCssVars, ColorFamily, ColorFamilyName, Colors, ColorShade, } from './primitives/colors';
3
+ export { fontFamily, fontSize, fontWeight, lineHeight, } from './primitives/typography';
4
+ export type { FontFamily, FontSize, FontWeight, LineHeight, } from './primitives/typography';
5
+ export { button, semanticColorCssVariables, semanticColors } from './semantic/colors';
6
+ export type { ButtonTokens, SemanticColors } from './semantic/colors';
7
+ export { typography } from './semantic/typography';
8
+ export type { TypographyToken, TypographyTokenName, } from './semantic/typography';