@akanaka-design/components 0.6.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/dist/index.js ADDED
@@ -0,0 +1,827 @@
1
+ // src/Alert/Alert.tsx
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ var variantStyles = {
4
+ info: {
5
+ container: "bg-background-info text-foreground-info border border-border-info",
6
+ icon: "text-foreground-info"
7
+ },
8
+ success: {
9
+ container: "bg-background-success text-foreground-success border border-border-success",
10
+ icon: "text-foreground-success"
11
+ },
12
+ warning: {
13
+ container: "bg-background-warning text-foreground-warning border border-border-warning",
14
+ icon: "text-foreground-warning"
15
+ },
16
+ error: {
17
+ container: "bg-background-error text-foreground-error border border-border-error-subtle",
18
+ icon: "text-foreground-error"
19
+ }
20
+ };
21
+ var icons = {
22
+ info: /* @__PURE__ */ jsx("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }),
23
+ success: /* @__PURE__ */ jsx("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z", clipRule: "evenodd" }) }),
24
+ warning: /* @__PURE__ */ jsx("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) }),
25
+ error: /* @__PURE__ */ jsx("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) })
26
+ };
27
+ function Alert({
28
+ variant = "info",
29
+ title,
30
+ children,
31
+ onDismiss,
32
+ className = "",
33
+ ...props
34
+ }) {
35
+ const baseStyles = "flex gap-3 p-4 rounded-lg border";
36
+ const styles = variantStyles[variant];
37
+ const classes = [baseStyles, styles.container, className].filter(Boolean).join(" ");
38
+ return /* @__PURE__ */ jsxs("div", { role: "alert", className: classes, ...props, children: [
39
+ /* @__PURE__ */ jsx("span", { className: `flex-shrink-0 ${styles.icon}`, children: icons[variant] }),
40
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
41
+ title && /* @__PURE__ */ jsx("p", { className: "font-semibold mb-1", children: title }),
42
+ /* @__PURE__ */ jsx("div", { className: "text-body-sm", children })
43
+ ] }),
44
+ onDismiss && /* @__PURE__ */ jsx(
45
+ "button",
46
+ {
47
+ onClick: onDismiss,
48
+ className: "flex-shrink-0 opacity-70 hover:opacity-100 transition-opacity",
49
+ "aria-label": "Dismiss",
50
+ children: /* @__PURE__ */ jsx("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" }) })
51
+ }
52
+ )
53
+ ] });
54
+ }
55
+
56
+ // src/Avatar/Avatar.tsx
57
+ import { jsx as jsx2 } from "react/jsx-runtime";
58
+ var sizeStyles = {
59
+ sm: "w-8 h-8 text-caption",
60
+ md: "w-10 h-10 text-body-sm",
61
+ lg: "w-12 h-12 text-body",
62
+ xl: "w-16 h-16 text-h3"
63
+ };
64
+ function Avatar({
65
+ size = "md",
66
+ initials,
67
+ src,
68
+ alt = "",
69
+ className = "",
70
+ ...props
71
+ }) {
72
+ const baseStyles = [
73
+ "inline-flex items-center justify-center",
74
+ "rounded-full",
75
+ "bg-background-primary-subtle text-foreground-primary",
76
+ "font-semibold",
77
+ "overflow-hidden",
78
+ "flex-shrink-0"
79
+ ].join(" ");
80
+ const classes = [baseStyles, sizeStyles[size], className].filter(Boolean).join(" ");
81
+ if (src) {
82
+ return /* @__PURE__ */ jsx2(
83
+ "img",
84
+ {
85
+ src,
86
+ alt,
87
+ className: `${sizeStyles[size]} rounded-full object-cover ${className}`,
88
+ ...props
89
+ }
90
+ );
91
+ }
92
+ return /* @__PURE__ */ jsx2("span", { className: classes, role: "img", "aria-label": alt || initials, children: initials?.slice(0, 2).toUpperCase() });
93
+ }
94
+
95
+ // src/Badge/Badge.tsx
96
+ import { jsx as jsx3 } from "react/jsx-runtime";
97
+ var variantStyles2 = {
98
+ default: "bg-background-muted text-foreground",
99
+ primary: "bg-background-primary-subtle text-foreground-primary",
100
+ success: "bg-background-success text-foreground-success",
101
+ warning: "bg-background-warning text-foreground-warning",
102
+ error: "bg-background-error text-foreground-error",
103
+ info: "bg-background-info text-foreground-info"
104
+ };
105
+ function Badge({
106
+ variant = "default",
107
+ children,
108
+ className = "",
109
+ ...props
110
+ }) {
111
+ const baseStyles = [
112
+ "inline-flex items-center",
113
+ "px-2 py-0.5",
114
+ "text-caption font-medium",
115
+ "rounded-full"
116
+ ].join(" ");
117
+ const classes = [baseStyles, variantStyles2[variant], className].filter(Boolean).join(" ");
118
+ return /* @__PURE__ */ jsx3("span", { className: classes, ...props, children });
119
+ }
120
+
121
+ // src/Button/Button.tsx
122
+ import { forwardRef } from "react";
123
+ import { jsx as jsx4 } from "react/jsx-runtime";
124
+ var variantStyles3 = {
125
+ primary: [
126
+ "bg-primary-500 text-foreground-on-primary",
127
+ "hover:bg-primary-600",
128
+ "active:bg-primary-700",
129
+ "focus-visible:shadow-focus focus-visible:outline-none",
130
+ "disabled:bg-background-subtle disabled:text-foreground-muted"
131
+ ].join(" "),
132
+ default: [
133
+ "bg-primary-500 text-foreground-on-primary",
134
+ "hover:bg-primary-600",
135
+ "active:bg-primary-700",
136
+ "focus-visible:shadow-focus focus-visible:outline-none",
137
+ "disabled:bg-background-subtle disabled:text-foreground-muted"
138
+ ].join(" "),
139
+ secondary: [
140
+ "bg-background-muted text-foreground",
141
+ "border border-border",
142
+ "hover:bg-background-subtle",
143
+ "active:bg-background-subtle",
144
+ "focus-visible:shadow-focus focus-visible:outline-none",
145
+ "disabled:bg-background-muted disabled:text-foreground-muted disabled:border-border-muted"
146
+ ].join(" "),
147
+ outline: [
148
+ "bg-transparent text-foreground",
149
+ "border border-border",
150
+ "hover:bg-background-muted",
151
+ "active:bg-background-subtle",
152
+ "focus-visible:shadow-focus focus-visible:outline-none",
153
+ "disabled:text-foreground-muted disabled:border-border-muted"
154
+ ].join(" "),
155
+ ghost: [
156
+ "bg-transparent text-foreground",
157
+ "hover:bg-background-muted",
158
+ "active:bg-background-subtle",
159
+ "focus-visible:shadow-focus focus-visible:outline-none",
160
+ "disabled:text-foreground-muted disabled:bg-transparent"
161
+ ].join(" "),
162
+ danger: [
163
+ "bg-error text-foreground-on-primary",
164
+ "hover:bg-red-600",
165
+ "active:bg-red-700",
166
+ "focus-visible:shadow-focus focus-visible:outline-none",
167
+ "disabled:bg-background-subtle disabled:text-foreground-muted"
168
+ ].join(" "),
169
+ destructive: [
170
+ "bg-error text-foreground-on-primary",
171
+ "hover:bg-red-600",
172
+ "active:bg-red-700",
173
+ "focus-visible:shadow-focus focus-visible:outline-none",
174
+ "disabled:bg-background-subtle disabled:text-foreground-muted"
175
+ ].join(" "),
176
+ link: [
177
+ "bg-transparent text-primary-500 underline-offset-4",
178
+ "hover:underline",
179
+ "active:text-primary-700",
180
+ "focus-visible:outline-none focus-visible:underline",
181
+ "disabled:text-foreground-muted disabled:no-underline"
182
+ ].join(" ")
183
+ };
184
+ var sizeStyles2 = {
185
+ sm: "px-3 py-1.5 text-body-sm rounded-sm",
186
+ md: "px-4 py-2 text-body rounded-md",
187
+ lg: "px-6 py-3 text-h3 rounded-lg"
188
+ };
189
+ var Button = forwardRef(
190
+ ({
191
+ variant = "primary",
192
+ size = "md",
193
+ fullWidth = false,
194
+ className = "",
195
+ disabled,
196
+ children,
197
+ ...props
198
+ }, ref) => {
199
+ const baseStyles = [
200
+ "inline-flex items-center justify-center",
201
+ "font-semibold",
202
+ "transition-colors duration-fast",
203
+ "cursor-pointer",
204
+ "disabled:cursor-not-allowed"
205
+ ].join(" ");
206
+ const classes = [
207
+ baseStyles,
208
+ variantStyles3[variant],
209
+ sizeStyles2[size],
210
+ fullWidth ? "w-full" : "",
211
+ className
212
+ ].filter(Boolean).join(" ");
213
+ return /* @__PURE__ */ jsx4(
214
+ "button",
215
+ {
216
+ ref,
217
+ className: classes,
218
+ disabled,
219
+ ...props,
220
+ children
221
+ }
222
+ );
223
+ }
224
+ );
225
+ Button.displayName = "Button";
226
+
227
+ // src/Card/Card.tsx
228
+ import { jsx as jsx5 } from "react/jsx-runtime";
229
+ var variantStyles4 = {
230
+ elevated: "bg-background-elevated shadow-md border border-border",
231
+ flat: "bg-background-muted border border-border"
232
+ };
233
+ function Card({
234
+ variant = "elevated",
235
+ children,
236
+ className = "",
237
+ ...props
238
+ }) {
239
+ const baseStyles = "rounded-lg overflow-hidden";
240
+ const classes = [baseStyles, variantStyles4[variant], className].filter(Boolean).join(" ");
241
+ return /* @__PURE__ */ jsx5("div", { className: classes, ...props, children });
242
+ }
243
+ function CardHeader({ children, className = "", ...props }) {
244
+ return /* @__PURE__ */ jsx5("div", { className: `px-4 py-3 border-b border-border ${className}`, ...props, children });
245
+ }
246
+ function CardTitle({ children, className = "", ...props }) {
247
+ return /* @__PURE__ */ jsx5("h3", { className: `text-lg font-semibold text-foreground ${className}`, ...props, children });
248
+ }
249
+ function CardDescription({ children, className = "", ...props }) {
250
+ return /* @__PURE__ */ jsx5("p", { className: `text-sm text-foreground-muted mt-1 ${className}`, ...props, children });
251
+ }
252
+ function CardContent({ children, className = "", ...props }) {
253
+ return /* @__PURE__ */ jsx5("div", { className: `px-4 py-4 ${className}`, ...props, children });
254
+ }
255
+ var CardBody = CardContent;
256
+ function CardFooter({ children, className = "", ...props }) {
257
+ return /* @__PURE__ */ jsx5("div", { className: `px-4 py-3 border-t border-border bg-background-muted ${className}`, ...props, children });
258
+ }
259
+
260
+ // src/Card/StatCard.tsx
261
+ import { useId } from "react";
262
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
263
+ var accentTopStyles = {
264
+ primary: "border-t-primary-500",
265
+ secondary: "border-t-border-strong",
266
+ success: "border-t-success",
267
+ warning: "border-t-warning",
268
+ destructive: "border-t-error"
269
+ };
270
+ function StatCard({
271
+ label,
272
+ value,
273
+ accent = "primary",
274
+ className = "",
275
+ ...props
276
+ }) {
277
+ const labelId = useId();
278
+ const root = [
279
+ "overflow-hidden rounded-b-lg rounded-t-none",
280
+ "border border-border border-t-4 bg-background-elevated shadow-md",
281
+ accentTopStyles[accent],
282
+ className
283
+ ].filter(Boolean).join(" ");
284
+ return /* @__PURE__ */ jsx6("section", { className: root, "aria-labelledby": labelId, ...props, children: /* @__PURE__ */ jsxs2("div", { className: "space-y-1 px-4 py-4", children: [
285
+ /* @__PURE__ */ jsx6("p", { id: labelId, className: "text-body-sm text-foreground-muted", children: label }),
286
+ /* @__PURE__ */ jsx6("div", { className: "text-[1.75rem] font-medium leading-tight text-foreground", children: value })
287
+ ] }) });
288
+ }
289
+
290
+ // src/Checkbox/Checkbox.tsx
291
+ import { forwardRef as forwardRef2 } from "react";
292
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
293
+ var Checkbox = forwardRef2(
294
+ ({ label, disabled, className = "", id, ...props }, ref) => {
295
+ const checkboxId = id || props.name;
296
+ const checkboxStyles = [
297
+ "w-4 h-4",
298
+ "rounded-sm",
299
+ "border border-border",
300
+ "text-primary-500",
301
+ "bg-background-default",
302
+ "transition-colors duration-fast",
303
+ "focus:outline-none focus:shadow-focus",
304
+ "checked:bg-primary-500 checked:border-primary-500",
305
+ "hover:border-border-strong",
306
+ "disabled:bg-background-muted disabled:border-border disabled:cursor-not-allowed",
307
+ "cursor-pointer",
308
+ "accent-primary-500"
309
+ ].join(" ");
310
+ return /* @__PURE__ */ jsxs3("div", { className: `flex items-center gap-2 ${className}`, children: [
311
+ /* @__PURE__ */ jsx7(
312
+ "input",
313
+ {
314
+ ref,
315
+ type: "checkbox",
316
+ id: checkboxId,
317
+ disabled,
318
+ className: checkboxStyles,
319
+ ...props
320
+ }
321
+ ),
322
+ label && /* @__PURE__ */ jsx7(
323
+ "label",
324
+ {
325
+ htmlFor: checkboxId,
326
+ className: `text-body text-foreground select-none ${disabled ? "text-foreground-muted cursor-not-allowed" : "cursor-pointer"}`,
327
+ children: label
328
+ }
329
+ )
330
+ ] });
331
+ }
332
+ );
333
+ Checkbox.displayName = "Checkbox";
334
+
335
+ // src/Input/Input.tsx
336
+ import { forwardRef as forwardRef3, useId as useId2 } from "react";
337
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
338
+ var sizeStyles3 = {
339
+ sm: "px-2 py-1 text-body-sm rounded-sm",
340
+ md: "px-3 py-2 text-body rounded-md",
341
+ lg: "px-4 py-3 text-body rounded-lg"
342
+ };
343
+ var Input = forwardRef3(
344
+ ({ size = "md", error, label, helperText, disabled, className = "", id, ...props }, ref) => {
345
+ const generatedId = useId2();
346
+ const inputId = id ?? generatedId;
347
+ const baseStyles = [
348
+ "w-full",
349
+ "text-foreground",
350
+ "bg-background-muted",
351
+ "border border-border",
352
+ "transition-colors duration-fast",
353
+ "placeholder:text-foreground-muted",
354
+ "focus:outline-none focus:shadow-focus"
355
+ ].join(" ");
356
+ const stateStyles = error ? "border-error focus:border-error" : "border-border hover:border-border-strong focus:border-primary-500";
357
+ const disabledStyles = disabled ? "bg-background-muted text-foreground-muted cursor-not-allowed hover:border-border" : "";
358
+ const classes = [baseStyles, sizeStyles3[size], stateStyles, disabledStyles, className].filter(Boolean).join(" ");
359
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1", children: [
360
+ label && /* @__PURE__ */ jsx8(
361
+ "label",
362
+ {
363
+ htmlFor: inputId,
364
+ className: "text-body-sm font-medium text-foreground",
365
+ children: label
366
+ }
367
+ ),
368
+ /* @__PURE__ */ jsx8(
369
+ "input",
370
+ {
371
+ ref,
372
+ id: inputId,
373
+ disabled,
374
+ className: classes,
375
+ "aria-invalid": !!error,
376
+ "aria-describedby": error ? `${inputId}-error` : helperText ? `${inputId}-helper` : void 0,
377
+ ...props
378
+ }
379
+ ),
380
+ error && /* @__PURE__ */ jsx8("p", { id: `${inputId}-error`, className: "text-body-sm text-error", children: error }),
381
+ !error && helperText && /* @__PURE__ */ jsx8("p", { id: `${inputId}-helper`, className: "text-body-sm text-foreground-muted", children: helperText })
382
+ ] });
383
+ }
384
+ );
385
+ Input.displayName = "Input";
386
+
387
+ // src/Label/Label.tsx
388
+ import { forwardRef as forwardRef4 } from "react";
389
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
390
+ var sizeStyles4 = {
391
+ sm: "text-caption",
392
+ md: "text-body-sm",
393
+ lg: "text-body"
394
+ };
395
+ var Label = forwardRef4(
396
+ ({
397
+ size = "md",
398
+ error = false,
399
+ required = false,
400
+ className = "",
401
+ children,
402
+ ...props
403
+ }, ref) => {
404
+ const baseStyles = "font-medium";
405
+ const colorStyles = error ? "text-error" : "text-foreground";
406
+ const classes = [baseStyles, sizeStyles4[size], colorStyles, className].filter(Boolean).join(" ");
407
+ return /* @__PURE__ */ jsxs5("label", { ref, className: classes, ...props, children: [
408
+ children,
409
+ required && /* @__PURE__ */ jsx9("span", { className: "text-error ml-1", children: "*" })
410
+ ] });
411
+ }
412
+ );
413
+ Label.displayName = "Label";
414
+
415
+ // src/Progress/Progress.tsx
416
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
417
+ function Progress({
418
+ value,
419
+ max = 100,
420
+ showLabel = false,
421
+ className = "",
422
+ ...props
423
+ }) {
424
+ const percentage = Math.min(Math.max(value / max * 100, 0), 100);
425
+ return /* @__PURE__ */ jsxs6("div", { className: `flex items-center gap-3 ${className}`, ...props, children: [
426
+ /* @__PURE__ */ jsx10(
427
+ "div",
428
+ {
429
+ role: "progressbar",
430
+ "aria-valuenow": value,
431
+ "aria-valuemin": 0,
432
+ "aria-valuemax": max,
433
+ className: "flex-1 h-2 bg-background-subtle rounded-full overflow-hidden",
434
+ children: /* @__PURE__ */ jsx10(
435
+ "div",
436
+ {
437
+ className: "h-full bg-primary-500 rounded-full transition-all duration-base",
438
+ style: { width: `${percentage}%` }
439
+ }
440
+ )
441
+ }
442
+ ),
443
+ showLabel && /* @__PURE__ */ jsxs6("span", { className: "text-body-sm text-foreground-muted min-w-[3ch]", children: [
444
+ Math.round(percentage),
445
+ "%"
446
+ ] })
447
+ ] });
448
+ }
449
+
450
+ // src/Select/Select.tsx
451
+ import * as SelectPrimitive from "@radix-ui/react-select";
452
+ import {
453
+ createContext,
454
+ forwardRef as forwardRef5,
455
+ useContext
456
+ } from "react";
457
+ import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
458
+ var SelectPlaceholderContext = createContext(void 0);
459
+ function Select({ placeholder, children, ...props }) {
460
+ return /* @__PURE__ */ jsx11(SelectPlaceholderContext.Provider, { value: placeholder, children: /* @__PURE__ */ jsx11(SelectPrimitive.Root, { ...props, children }) });
461
+ }
462
+ var triggerBaseStyles = [
463
+ "group inline-flex h-10 w-full shrink-0 items-center justify-between gap-2",
464
+ "rounded-md border px-3 py-2 text-left text-body",
465
+ "text-foreground bg-background-muted border-border",
466
+ "transition-colors duration-fast",
467
+ "focus:outline-none focus:shadow-focus focus:border-primary-500",
468
+ "hover:border-border-strong",
469
+ "disabled:cursor-not-allowed disabled:text-foreground-muted disabled:hover:border-border",
470
+ "[&>span]:line-clamp-1"
471
+ ].join(" ");
472
+ var SelectTrigger = forwardRef5(
473
+ ({ className = "", children, ...props }, ref) => {
474
+ return /* @__PURE__ */ jsx11(
475
+ SelectPrimitive.Trigger,
476
+ {
477
+ ref,
478
+ className: [triggerBaseStyles, className].filter(Boolean).join(" "),
479
+ ...props,
480
+ children: children ?? /* @__PURE__ */ jsxs7(Fragment, { children: [
481
+ /* @__PURE__ */ jsx11(SelectValue, {}),
482
+ /* @__PURE__ */ jsx11(SelectChevronIcon, {})
483
+ ] })
484
+ }
485
+ );
486
+ }
487
+ );
488
+ SelectTrigger.displayName = "SelectTrigger";
489
+ var SelectValue = forwardRef5(
490
+ ({ placeholder, className = "", ...props }, ref) => {
491
+ const rootPlaceholder = useContext(SelectPlaceholderContext);
492
+ return /* @__PURE__ */ jsx11(
493
+ SelectPrimitive.Value,
494
+ {
495
+ ref,
496
+ placeholder: placeholder ?? rootPlaceholder,
497
+ className: ["data-[placeholder]:text-foreground-muted", className].filter(Boolean).join(" "),
498
+ ...props
499
+ }
500
+ );
501
+ }
502
+ );
503
+ SelectValue.displayName = "SelectValue";
504
+ function SelectChevronIcon() {
505
+ return /* @__PURE__ */ jsx11(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx11("span", { className: "pointer-events-none flex size-4 shrink-0 items-center justify-center text-foreground-muted", children: /* @__PURE__ */ jsx11(
506
+ "svg",
507
+ {
508
+ width: "12",
509
+ height: "12",
510
+ viewBox: "0 0 12 12",
511
+ fill: "none",
512
+ xmlns: "http://www.w3.org/2000/svg",
513
+ "aria-hidden": true,
514
+ className: "transition-transform duration-200 group-data-[state=open]:rotate-180",
515
+ children: /* @__PURE__ */ jsx11(
516
+ "path",
517
+ {
518
+ d: "M3 4.5L6 7.5L9 4.5",
519
+ stroke: "currentColor",
520
+ strokeWidth: "1.5",
521
+ strokeLinecap: "round",
522
+ strokeLinejoin: "round"
523
+ }
524
+ )
525
+ }
526
+ ) }) });
527
+ }
528
+ var contentStyles = [
529
+ "relative z-50 max-h-96 min-w-[var(--radix-select-trigger-width)] overflow-hidden",
530
+ "rounded-md border border-border bg-background-default text-foreground shadow-md"
531
+ ].join(" ");
532
+ var viewportStyles = "p-1";
533
+ var SelectContent = forwardRef5(
534
+ ({ className = "", children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx11(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx11(
535
+ SelectPrimitive.Content,
536
+ {
537
+ ref,
538
+ className: [contentStyles, className].filter(Boolean).join(" "),
539
+ position,
540
+ sideOffset: 4,
541
+ ...props,
542
+ children: /* @__PURE__ */ jsx11(
543
+ SelectPrimitive.Viewport,
544
+ {
545
+ className: [
546
+ viewportStyles,
547
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
548
+ ].filter(Boolean).join(" "),
549
+ children
550
+ }
551
+ )
552
+ }
553
+ ) })
554
+ );
555
+ SelectContent.displayName = "SelectContent";
556
+ var itemStyles = [
557
+ "relative flex w-full cursor-pointer select-none items-center rounded-sm py-2 pl-3 pr-8",
558
+ "text-body text-foreground outline-none",
559
+ "data-[disabled]:pointer-events-none data-[disabled]:text-foreground-muted",
560
+ "data-[highlighted]:bg-background-subtle"
561
+ ].join(" ");
562
+ var SelectItem = forwardRef5(
563
+ ({ className = "", children, ...props }, ref) => /* @__PURE__ */ jsx11(
564
+ SelectPrimitive.Item,
565
+ {
566
+ ref,
567
+ className: [itemStyles, className].filter(Boolean).join(" "),
568
+ ...props,
569
+ children: /* @__PURE__ */ jsx11(SelectPrimitive.ItemText, { children })
570
+ }
571
+ )
572
+ );
573
+ SelectItem.displayName = "SelectItem";
574
+
575
+ // src/Table/Table.tsx
576
+ import {
577
+ createContext as createContext2,
578
+ useContext as useContext2
579
+ } from "react";
580
+ import { jsx as jsx12 } from "react/jsx-runtime";
581
+ var TableHeaderVariantContext = createContext2(null);
582
+ function Table({ className = "", children, ...props }) {
583
+ return /* @__PURE__ */ jsx12("div", { className: "w-full overflow-auto", children: /* @__PURE__ */ jsx12(
584
+ "table",
585
+ {
586
+ className: `w-full border-collapse text-body ${className}`,
587
+ ...props,
588
+ children
589
+ }
590
+ ) });
591
+ }
592
+ var headerTheadClasses = {
593
+ default: "bg-background-muted",
594
+ /* primary-700 (#A8503A) + white text ≥4.5:1 for small semibold header copy (primary-500 fails AA) */
595
+ primary: "bg-primary-700",
596
+ secondary: "bg-background-subtle",
597
+ muted: "bg-background-page"
598
+ };
599
+ var headerHeadTextClasses = {
600
+ default: "text-foreground",
601
+ primary: "text-foreground-on-primary",
602
+ secondary: "text-foreground",
603
+ muted: "text-foreground-muted"
604
+ };
605
+ var headerRowClasses = {
606
+ default: "border-border hover:bg-background-subtle",
607
+ /* Avoid lightening into primary-600 on hover — white text would drop below AA */
608
+ primary: "border-white/20 hover:ring-1 hover:ring-inset hover:ring-white/35",
609
+ secondary: "border-border hover:bg-background-muted",
610
+ muted: "border-border-muted hover:bg-background-muted"
611
+ };
612
+ function TableHeader({
613
+ className = "",
614
+ children,
615
+ variant = "default",
616
+ ...props
617
+ }) {
618
+ const theadBase = headerTheadClasses[variant];
619
+ return /* @__PURE__ */ jsx12("thead", { className: `${theadBase} ${className}`.trim(), ...props, children: /* @__PURE__ */ jsx12(TableHeaderVariantContext.Provider, { value: variant, children }) });
620
+ }
621
+ function TableBody({ className = "", children, ...props }) {
622
+ return /* @__PURE__ */ jsx12("tbody", { className: `divide-y divide-border ${className}`, ...props, children });
623
+ }
624
+ function TableRow({ className = "", children, ...props }) {
625
+ const headerVariant = useContext2(TableHeaderVariantContext);
626
+ const rowStyles = headerVariant ? `border-b ${headerRowClasses[headerVariant]}` : "border-b border-border hover:bg-background-muted";
627
+ return /* @__PURE__ */ jsx12("tr", { className: `${rowStyles} transition-colors ${className}`.trim(), ...props, children });
628
+ }
629
+ function TableHead({ className = "", children, ...props }) {
630
+ const headerVariant = useContext2(TableHeaderVariantContext);
631
+ const textColor = headerVariant ? headerHeadTextClasses[headerVariant] : "text-foreground";
632
+ return /* @__PURE__ */ jsx12(
633
+ "th",
634
+ {
635
+ className: `px-4 py-3 text-left text-body-sm font-semibold ${textColor} ${className}`.trim(),
636
+ ...props,
637
+ children
638
+ }
639
+ );
640
+ }
641
+ function TableCell({ className = "", children, ...props }) {
642
+ return /* @__PURE__ */ jsx12(
643
+ "td",
644
+ {
645
+ className: `px-4 py-3 text-foreground ${className}`,
646
+ ...props,
647
+ children
648
+ }
649
+ );
650
+ }
651
+
652
+ // src/Tabs/Tabs.tsx
653
+ import {
654
+ createContext as createContext3,
655
+ useContext as useContext3,
656
+ useState
657
+ } from "react";
658
+ import { jsx as jsx13 } from "react/jsx-runtime";
659
+ var TabsContext = createContext3(null);
660
+ function useTabsContext() {
661
+ const context = useContext3(TabsContext);
662
+ if (!context) {
663
+ throw new Error("Tabs components must be used within a Tabs provider");
664
+ }
665
+ return context;
666
+ }
667
+ function Tabs({
668
+ defaultValue,
669
+ value,
670
+ onValueChange,
671
+ children,
672
+ className = "",
673
+ ...props
674
+ }) {
675
+ const [internalValue, setInternalValue] = useState(defaultValue);
676
+ const activeTab = value ?? internalValue;
677
+ const setActiveTab = (newValue) => {
678
+ if (!value) {
679
+ setInternalValue(newValue);
680
+ }
681
+ onValueChange?.(newValue);
682
+ };
683
+ return /* @__PURE__ */ jsx13(TabsContext.Provider, { value: { activeTab, setActiveTab }, children: /* @__PURE__ */ jsx13("div", { className, ...props, children }) });
684
+ }
685
+ function TabsList({ children, className = "", ...props }) {
686
+ return /* @__PURE__ */ jsx13(
687
+ "div",
688
+ {
689
+ role: "tablist",
690
+ className: `flex border-b border-border ${className}`,
691
+ ...props,
692
+ children
693
+ }
694
+ );
695
+ }
696
+ function TabsTrigger({
697
+ value,
698
+ children,
699
+ className = "",
700
+ ...props
701
+ }) {
702
+ const { activeTab, setActiveTab } = useTabsContext();
703
+ const isActive = activeTab === value;
704
+ const baseStyles = [
705
+ "px-4 py-2",
706
+ "text-body font-medium",
707
+ "border-b-2 -mb-px",
708
+ "transition-colors duration-fast",
709
+ "focus:outline-none focus-visible:shadow-focus"
710
+ ].join(" ");
711
+ const stateStyles = isActive ? "border-primary-500 text-primary-600" : "border-transparent text-foreground-muted hover:text-foreground hover:border-border-strong";
712
+ return /* @__PURE__ */ jsx13(
713
+ "button",
714
+ {
715
+ role: "tab",
716
+ "aria-selected": isActive,
717
+ onClick: () => setActiveTab(value),
718
+ className: `${baseStyles} ${stateStyles} ${className}`,
719
+ ...props,
720
+ children
721
+ }
722
+ );
723
+ }
724
+ function TabsContent({
725
+ value,
726
+ children,
727
+ className = "",
728
+ ...props
729
+ }) {
730
+ const { activeTab } = useTabsContext();
731
+ if (activeTab !== value) {
732
+ return null;
733
+ }
734
+ return /* @__PURE__ */ jsx13("div", { role: "tabpanel", className: `py-4 ${className}`, ...props, children });
735
+ }
736
+
737
+ // src/Toggle/Toggle.tsx
738
+ import { forwardRef as forwardRef6 } from "react";
739
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
740
+ var Toggle = forwardRef6(
741
+ ({ label, disabled, checked, className = "", id, ...props }, ref) => {
742
+ const toggleId = id || props.name;
743
+ const trackStyles = [
744
+ "relative inline-flex",
745
+ "w-10 h-6",
746
+ "rounded-full",
747
+ "transition-colors duration-fast",
748
+ "cursor-pointer",
749
+ checked ? "bg-primary-500" : "bg-background-subtle",
750
+ disabled ? "opacity-50 cursor-not-allowed" : ""
751
+ ].join(" ");
752
+ const thumbStyles = [
753
+ "absolute top-1 left-1",
754
+ "w-4 h-4",
755
+ "bg-background-elevated rounded-full",
756
+ "shadow-sm",
757
+ "transition-transform duration-fast",
758
+ checked ? "translate-x-4" : "translate-x-0"
759
+ ].join(" ");
760
+ return /* @__PURE__ */ jsxs8("div", { className: `flex items-center gap-2 ${className}`, children: [
761
+ /* @__PURE__ */ jsxs8("label", { htmlFor: toggleId, className: trackStyles, children: [
762
+ /* @__PURE__ */ jsx14(
763
+ "input",
764
+ {
765
+ ref,
766
+ type: "checkbox",
767
+ role: "switch",
768
+ id: toggleId,
769
+ disabled,
770
+ checked,
771
+ className: "sr-only",
772
+ "aria-checked": checked,
773
+ ...props
774
+ }
775
+ ),
776
+ /* @__PURE__ */ jsx14("span", { className: thumbStyles })
777
+ ] }),
778
+ label && /* @__PURE__ */ jsx14(
779
+ "label",
780
+ {
781
+ htmlFor: toggleId,
782
+ className: `text-body text-foreground select-none ${disabled ? "text-foreground-muted cursor-not-allowed" : "cursor-pointer"}`,
783
+ children: label
784
+ }
785
+ )
786
+ ] });
787
+ }
788
+ );
789
+ Toggle.displayName = "Toggle";
790
+
791
+ // src/index.ts
792
+ export * from "@akanaka-design/tokens";
793
+ export {
794
+ Alert,
795
+ Avatar,
796
+ Badge,
797
+ Button,
798
+ Card,
799
+ CardBody,
800
+ CardContent,
801
+ CardDescription,
802
+ CardFooter,
803
+ CardHeader,
804
+ CardTitle,
805
+ Checkbox,
806
+ Input,
807
+ Label,
808
+ Progress,
809
+ Select,
810
+ SelectContent,
811
+ SelectItem,
812
+ SelectTrigger,
813
+ SelectValue,
814
+ StatCard,
815
+ Table,
816
+ TableBody,
817
+ TableCell,
818
+ TableHead,
819
+ TableHeader,
820
+ TableRow,
821
+ Tabs,
822
+ TabsContent,
823
+ TabsList,
824
+ TabsTrigger,
825
+ Toggle
826
+ };
827
+ //# sourceMappingURL=index.js.map