@lindle/linoardo 1.0.3 → 1.0.5

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.cjs CHANGED
@@ -1,8 +1,29 @@
1
1
  'use strict';
2
2
 
3
+ var React6 = require('react');
3
4
  var tailwindMerge = require('tailwind-merge');
4
5
  var jsxRuntime = require('react/jsx-runtime');
5
6
 
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
26
+
6
27
  // src/Containment/Button/index.tsx
7
28
 
8
29
  // src/globals.ts
@@ -12,48 +33,56 @@ var iconBaseClasses = {
12
33
 
13
34
  // src/Containment/Button/states.button.ts
14
35
  var base = "btn-base focus-visible:outline-none focus-visible:ring-2 rounded-md transition-colors duration-200 font-medium disabled:opacity-50 disabled:cursor-not-allowed";
36
+ var blackAndWhiteVariantClass = "bg-white hover:bg-black hover:text-white text-black border border-black focus-visible:ring-black/40 focus-visible:ring-offset-white";
15
37
  var paletteVariantClasses = {
16
38
  primary: {
17
39
  solid: "bg-primary text-white hover:bg-primary/90 focus-visible:ring-primary",
18
40
  outline: "border border-primary text-primary bg-white hover:bg-primary hover:text-white focus-visible:ring-primary",
19
41
  ghost: "text-primary bg-primary/10 hover:bg-primary/20 focus-visible:ring-primary/40",
20
- text: "bg-transparent text-primary hover:bg-primary/10 focus-visible:ring-primary/30 underline-offset-2"
42
+ text: "bg-transparent text-primary hover:bg-primary/10 focus-visible:ring-primary/30 underline-offset-2",
43
+ bw: blackAndWhiteVariantClass
21
44
  },
22
45
  neutral: {
23
46
  solid: "bg-gray-600 text-white hover:bg-gray-700 focus-visible:ring-gray-500",
24
47
  outline: "border border-gray-400 text-gray-700 bg-white hover:bg-gray-700 hover:text-white focus-visible:ring-gray-400",
25
48
  ghost: "text-gray-700 bg-gray-100 hover:bg-gray-200 focus-visible:ring-gray-300",
26
- text: "bg-transparent text-gray-700 hover:bg-gray-100 focus-visible:ring-gray-200 underline-offset-2"
49
+ text: "bg-transparent text-gray-700 hover:bg-gray-100 focus-visible:ring-gray-200 underline-offset-2",
50
+ bw: blackAndWhiteVariantClass
27
51
  },
28
52
  info: {
29
53
  solid: "bg-sky-500 text-white hover:bg-sky-600 focus-visible:ring-sky-400",
30
54
  outline: "border border-sky-500 text-sky-600 bg-white hover:bg-sky-500 hover:text-white focus-visible:ring-sky-400",
31
55
  ghost: "text-sky-600 bg-sky-100 hover:bg-sky-200 focus-visible:ring-sky-300",
32
- text: "bg-transparent text-sky-600 hover:bg-sky-100 focus-visible:ring-sky-200 underline-offset-2"
56
+ text: "bg-transparent text-sky-600 hover:bg-sky-100 focus-visible:ring-sky-200 underline-offset-2",
57
+ bw: blackAndWhiteVariantClass
33
58
  },
34
59
  success: {
35
60
  solid: "bg-emerald-500 text-white hover:bg-emerald-600 focus-visible:ring-emerald-400",
36
61
  outline: "border border-emerald-500 text-emerald-600 bg-white hover:bg-emerald-500 hover:text-white focus-visible:ring-emerald-400",
37
62
  ghost: "text-emerald-600 bg-emerald-100 hover:bg-emerald-200 focus-visible:ring-emerald-300",
38
- text: "bg-transparent text-emerald-600 hover:bg-emerald-100 focus-visible:ring-emerald-200 underline-offset-2"
63
+ text: "bg-transparent text-emerald-600 hover:bg-emerald-100 focus-visible:ring-emerald-200 underline-offset-2",
64
+ bw: blackAndWhiteVariantClass
39
65
  },
40
66
  warning: {
41
67
  solid: "bg-amber-500 text-white hover:bg-amber-600 focus-visible:ring-amber-400",
42
68
  outline: "border border-amber-500 text-amber-600 bg-white hover:bg-amber-500 hover:text-white focus-visible:ring-amber-400",
43
69
  ghost: "text-amber-600 bg-amber-100 hover:bg-amber-200 focus-visible:ring-amber-300",
44
- text: "bg-transparent text-amber-600 hover:bg-amber-100 focus-visible:ring-amber-200 underline-offset-2"
70
+ text: "bg-transparent text-amber-600 hover:bg-amber-100 focus-visible:ring-amber-200 underline-offset-2",
71
+ bw: blackAndWhiteVariantClass
45
72
  },
46
73
  danger: {
47
74
  solid: "bg-red-500 text-white hover:bg-red-600 focus-visible:ring-red-400",
48
75
  outline: "border border-red-500 text-red-600 bg-white hover:bg-red-500 hover:text-white focus-visible:ring-red-400",
49
76
  ghost: "text-red-600 bg-red-100 hover:bg-red-200 focus-visible:ring-red-300",
50
- text: "bg-transparent text-red-600 hover:bg-red-100 focus-visible:ring-red-200 underline-offset-2"
77
+ text: "bg-transparent text-red-600 hover:bg-red-100 focus-visible:ring-red-200 underline-offset-2",
78
+ bw: blackAndWhiteVariantClass
51
79
  },
52
80
  surface: {
53
81
  solid: "bg-white text-gray-900 border border-gray-200 hover:bg-gray-50 focus-visible:ring-gray-200",
54
82
  outline: "border border-gray-300 text-gray-900 bg-white hover:bg-gray-100 focus-visible:ring-gray-200",
55
83
  ghost: "text-gray-900 bg-gray-100 hover:bg-gray-200 focus-visible:ring-gray-200",
56
- text: "bg-transparent text-gray-900 hover:bg-gray-100 focus-visible:ring-gray-200 underline-offset-2"
84
+ text: "bg-transparent text-gray-900 hover:bg-gray-100 focus-visible:ring-gray-200 underline-offset-2",
85
+ bw: blackAndWhiteVariantClass
57
86
  }
58
87
  };
59
88
  var resolveVariantClass = (variant, palette) => {
@@ -92,51 +121,813 @@ var sizeClasses = {
92
121
  large: "px-6 py-3 text-lg",
93
122
  "x-large": "px-7 py-3.5 text-xl"
94
123
  };
95
- var Button = ({
96
- variant = "solid",
97
- color = "primary",
98
- size = "medium",
99
- block = false,
100
- loading = false,
101
- icon,
102
- className,
103
- children,
104
- disabled,
105
- onClick,
106
- ...rest
107
- }) => {
108
- const variantClass = resolveVariantClass(variant, color);
109
- const sizeClass = sizeClasses[size] ?? sizeClasses.medium;
110
- const blockClass = block ? "w-full" : null;
111
- const isDisabled = disabled || loading;
112
- const cursor = onClick && !isDisabled ? "cursor-pointer" : "cursor-default";
113
- const resolvedIconClass = resolveIconClassName(icon);
114
- const shouldRenderIcon = Boolean(resolvedIconClass && !loading);
115
- const hasDecorators = (loading || shouldRenderIcon) && Boolean(children);
116
- const gapClass = hasDecorators ? "gap-2" : void 0;
117
- const loadingIconClass = loading ? tailwindMerge.twMerge("mdi mdi-loading mdi-spin", "leading-none") : void 0;
118
- const iconClassName = shouldRenderIcon ? tailwindMerge.twMerge("leading-none", resolvedIconClass) : void 0;
124
+ var Button = React6__namespace.forwardRef(
125
+ ({
126
+ variant = "solid",
127
+ color = "primary",
128
+ size = "medium",
129
+ block = false,
130
+ loading = false,
131
+ loadingText,
132
+ icon,
133
+ className,
134
+ children,
135
+ disabled,
136
+ onClick,
137
+ ...rest
138
+ }, ref) => {
139
+ const variantClass = resolveVariantClass(variant, color);
140
+ const sizeClass = sizeClasses[size] ?? sizeClasses.medium;
141
+ const blockClass = block ? "w-full" : null;
142
+ const isDisabled = disabled || loading;
143
+ const cursor = onClick && !isDisabled ? "cursor-pointer" : "cursor-default";
144
+ const resolvedIconClass = resolveIconClassName(icon);
145
+ const shouldRenderIcon = Boolean(resolvedIconClass && !loading);
146
+ const isLoadingTextProvided = loadingText !== void 0 && loadingText !== null;
147
+ const content = loading && isLoadingTextProvided ? loadingText : children;
148
+ const hasDecorators = (loading || shouldRenderIcon) && Boolean(content);
149
+ const gapClass = hasDecorators ? "gap-2" : void 0;
150
+ const loadingIconClass = loading ? tailwindMerge.twMerge("mdi mdi-loading mdi-spin", "leading-none") : void 0;
151
+ const iconClassName = shouldRenderIcon ? tailwindMerge.twMerge("leading-none", resolvedIconClass) : void 0;
152
+ return /* @__PURE__ */ jsxRuntime.jsxs(
153
+ "button",
154
+ {
155
+ ...rest,
156
+ ref,
157
+ onClick,
158
+ disabled: isDisabled,
159
+ className: tailwindMerge.twMerge(base, cursor, variantClass, sizeClass, blockClass, gapClass, className),
160
+ "data-loading": loading || void 0,
161
+ "aria-busy": loading || void 0,
162
+ children: [
163
+ loading && /* @__PURE__ */ jsxRuntime.jsx("i", { className: loadingIconClass, "aria-hidden": true }),
164
+ iconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: iconClassName, "aria-hidden": true }),
165
+ content
166
+ ]
167
+ }
168
+ );
169
+ }
170
+ );
171
+ Button.displayName = "Button";
172
+ var Button_default = Button;
173
+
174
+ // src/Containment/Chip/states.chip.ts
175
+ var chipBaseClasses = "inline-flex items-center gap-1.5 border font-medium leading-tight transition-all duration-200 select-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2";
176
+ var chipSizeClasses = {
177
+ small: "text-xs px-3 py-1 min-h-[1.5rem]",
178
+ medium: "text-sm px-4 py-1.5 min-h-[2rem]",
179
+ large: "text-base px-5 py-2 min-h-[2.5rem]"
180
+ };
181
+ var closeButtonClasses = "ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-transparent text-current/70 transition-colors duration-200 hover:bg-current/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/30 focus-visible:ring-offset-2";
182
+ var blackAndWhiteChipVariantClass = "bg-white text-black border border-black hover:bg-white focus-visible:ring-black/40 focus-visible:ring-offset-white";
183
+ var paletteVariantClasses2 = {
184
+ primary: {
185
+ solid: "bg-primary text-white border border-primary hover:bg-primary/90",
186
+ outline: "bg-transparent text-primary border border-primary hover:bg-primary/10",
187
+ ghost: "bg-primary/15 text-primary border border-transparent hover:bg-primary/25",
188
+ text: "bg-transparent text-primary border border-transparent hover:text-primary/80",
189
+ bw: blackAndWhiteChipVariantClass
190
+ },
191
+ neutral: {
192
+ solid: "bg-gray-900 text-white border border-gray-900 hover:bg-gray-800",
193
+ outline: "bg-transparent text-gray-900 border border-gray-500 hover:bg-gray-100",
194
+ ghost: "bg-gray-100 text-gray-900 border border-transparent hover:bg-gray-200",
195
+ text: "bg-transparent text-gray-900 border border-transparent hover:text-gray-700",
196
+ bw: blackAndWhiteChipVariantClass
197
+ },
198
+ info: {
199
+ solid: "bg-sky-500 text-white border border-sky-500 hover:bg-sky-600",
200
+ outline: "bg-transparent text-sky-600 border border-sky-500 hover:bg-sky-50",
201
+ ghost: "bg-sky-100 text-sky-700 border border-transparent hover:bg-sky-200",
202
+ text: "bg-transparent text-sky-600 border border-transparent hover:text-sky-700",
203
+ bw: blackAndWhiteChipVariantClass
204
+ },
205
+ success: {
206
+ solid: "bg-emerald-500 text-white border border-emerald-500 hover:bg-emerald-600",
207
+ outline: "bg-transparent text-emerald-600 border border-emerald-500 hover:bg-emerald-50",
208
+ ghost: "bg-emerald-100 text-emerald-700 border border-transparent hover:bg-emerald-200",
209
+ text: "bg-transparent text-emerald-600 border border-transparent hover:text-emerald-700",
210
+ bw: blackAndWhiteChipVariantClass
211
+ },
212
+ warning: {
213
+ solid: "bg-amber-500 text-white border border-amber-500 hover:bg-amber-600",
214
+ outline: "bg-transparent text-amber-700 border border-amber-500 hover:bg-amber-50",
215
+ ghost: "bg-amber-100 text-amber-800 border border-transparent hover:bg-amber-200",
216
+ text: "bg-transparent text-amber-700 border border-transparent hover:text-amber-800",
217
+ bw: blackAndWhiteChipVariantClass
218
+ },
219
+ danger: {
220
+ solid: "bg-red-500 text-white border border-red-500 hover:bg-red-600",
221
+ outline: "bg-transparent text-red-600 border border-red-500 hover:bg-red-50",
222
+ ghost: "bg-red-100 text-red-700 border border-transparent hover:bg-red-200",
223
+ text: "bg-transparent text-red-600 border border-transparent hover:text-red-700",
224
+ bw: blackAndWhiteChipVariantClass
225
+ },
226
+ surface: {
227
+ solid: "bg-white text-gray-900 border border-gray-200 hover:bg-gray-50",
228
+ outline: "bg-transparent text-gray-900 border border-gray-300 hover:bg-gray-50",
229
+ ghost: "bg-gray-100 text-gray-900 border border-transparent hover:bg-gray-200",
230
+ text: "bg-transparent text-gray-900 border border-transparent hover:text-gray-600",
231
+ bw: blackAndWhiteChipVariantClass
232
+ }
233
+ };
234
+ var resolveVariantClass2 = (variant, palette) => {
235
+ const variants = paletteVariantClasses2[palette] ?? paletteVariantClasses2.primary;
236
+ return variants[variant] ?? variants.solid;
237
+ };
238
+ var resolveIconClassName2 = (icon) => {
239
+ if (!icon) {
240
+ return void 0;
241
+ }
242
+ if (typeof icon === "string") {
243
+ const trimmed = icon.trim();
244
+ if (!trimmed) {
245
+ return void 0;
246
+ }
247
+ if (trimmed.includes(" ")) {
248
+ return trimmed;
249
+ }
250
+ const normalized2 = trimmed.startsWith("mdi-") ? trimmed : `mdi-${trimmed}`;
251
+ return ["mdi", normalized2].join(" ");
252
+ }
253
+ const [library, providedName] = icon;
254
+ const normalizedLibrary = library.trim();
255
+ const baseClasses = iconBaseClasses[normalizedLibrary] ?? [normalizedLibrary];
256
+ const iconName = providedName.trim();
257
+ if (!iconName) {
258
+ return baseClasses.join(" ");
259
+ }
260
+ const normalized = iconName.startsWith("mdi-") ? iconName : `mdi-${iconName}`;
261
+ return Array.from(/* @__PURE__ */ new Set([...baseClasses, normalized])).join(" ");
262
+ };
263
+ var Chip = React6__namespace.forwardRef(
264
+ ({
265
+ variant = "solid",
266
+ color = "primary",
267
+ size = "medium",
268
+ pill = true,
269
+ selected = false,
270
+ closable = false,
271
+ closeIcon = "mdi-close",
272
+ onClose,
273
+ filter = false,
274
+ filterIcon = "mdi-check-bold",
275
+ prependIcon,
276
+ appendIcon,
277
+ disabled = false,
278
+ className,
279
+ children,
280
+ ...rest
281
+ }, ref) => {
282
+ const { onClick, onKeyDown, role, tabIndex, ...nativeProps } = rest;
283
+ const interactive = typeof onClick === "function";
284
+ const variantClass = resolveVariantClass2(variant, color);
285
+ const sizeClass = chipSizeClasses[size] ?? chipSizeClasses.medium;
286
+ const pillClass = pill ? "rounded-full" : "rounded-lg";
287
+ const cursorClass = disabled ? "pointer-events-none opacity-50" : interactive ? "cursor-pointer" : "cursor-default";
288
+ const selectedClass = selected ? "ring-2 ring-current/50 ring-offset-2 ring-offset-white" : void 0;
289
+ const resolvedRole = disabled ? role : role ?? (interactive ? "button" : void 0);
290
+ const resolvedTabIndex = disabled ? -1 : tabIndex ?? (interactive ? 0 : void 0);
291
+ const prependIconClassName = resolveIconClassName2(prependIcon);
292
+ const appendIconClassName = resolveIconClassName2(appendIcon);
293
+ const closeIconClassName = resolveIconClassName2(closeIcon);
294
+ const filterIconClassName = filter && selected ? resolveIconClassName2(filterIcon) : void 0;
295
+ const handleClick = React6__namespace.useCallback(
296
+ (event) => {
297
+ if (disabled) {
298
+ event.preventDefault();
299
+ event.stopPropagation();
300
+ return;
301
+ }
302
+ onClick?.(event);
303
+ },
304
+ [disabled, onClick]
305
+ );
306
+ const handleKeyDown = React6__namespace.useCallback(
307
+ (event) => {
308
+ onKeyDown?.(event);
309
+ if (event.defaultPrevented || disabled || !interactive) {
310
+ return;
311
+ }
312
+ if (event.key === "Enter" || event.key === " ") {
313
+ event.preventDefault();
314
+ event.currentTarget.click();
315
+ }
316
+ },
317
+ [disabled, interactive, onKeyDown]
318
+ );
319
+ const handleCloseClick = React6__namespace.useCallback(
320
+ (event) => {
321
+ event.stopPropagation();
322
+ if (disabled) {
323
+ event.preventDefault();
324
+ return;
325
+ }
326
+ onClose?.(event);
327
+ },
328
+ [disabled, onClose]
329
+ );
330
+ const handleCloseKeyDown = React6__namespace.useCallback((event) => {
331
+ if (event.key === " " || event.key === "Enter") {
332
+ event.stopPropagation();
333
+ }
334
+ }, []);
335
+ const renderableChildren = typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children }) : children;
336
+ const filterAdornment = filter ? /* @__PURE__ */ jsxRuntime.jsx(
337
+ "span",
338
+ {
339
+ className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-current/30 text-[0.55rem]",
340
+ "aria-hidden": true,
341
+ children: filterIconClassName ? /* @__PURE__ */ jsxRuntime.jsx("i", { className: filterIconClassName, "aria-hidden": true }) : null
342
+ }
343
+ ) : null;
344
+ return /* @__PURE__ */ jsxRuntime.jsxs(
345
+ "span",
346
+ {
347
+ ...nativeProps,
348
+ ref,
349
+ role: resolvedRole,
350
+ tabIndex: resolvedTabIndex,
351
+ "aria-disabled": disabled || void 0,
352
+ "aria-pressed": filter ? selected : void 0,
353
+ "data-selected": selected || void 0,
354
+ className: tailwindMerge.twMerge(chipBaseClasses, sizeClass, pillClass, variantClass, cursorClass, selectedClass, className),
355
+ onClick: interactive ? handleClick : void 0,
356
+ onKeyDown: interactive ? handleKeyDown : onKeyDown,
357
+ children: [
358
+ filterAdornment,
359
+ prependIconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge("text-[1em] leading-none", prependIconClassName), "aria-hidden": true }),
360
+ renderableChildren,
361
+ appendIconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: tailwindMerge.twMerge("text-[1em] leading-none", appendIconClassName), "aria-hidden": true }),
362
+ closable && /* @__PURE__ */ jsxRuntime.jsx(
363
+ "button",
364
+ {
365
+ type: "button",
366
+ disabled,
367
+ "aria-label": "Remove chip",
368
+ className: tailwindMerge.twMerge(closeButtonClasses),
369
+ onClick: handleCloseClick,
370
+ onKeyDown: handleCloseKeyDown,
371
+ children: closeIconClassName ? /* @__PURE__ */ jsxRuntime.jsx("i", { className: closeIconClassName, "aria-hidden": true }) : /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, children: "\xD7" })
372
+ }
373
+ )
374
+ ]
375
+ }
376
+ );
377
+ }
378
+ );
379
+ Chip.displayName = "Chip";
380
+ var Chip_default = Chip;
381
+ var defaultListContext = {
382
+ density: "default",
383
+ lines: "one",
384
+ nav: false,
385
+ divided: false,
386
+ color: "primary"
387
+ };
388
+ var ListContext = React6__namespace.createContext(defaultListContext);
389
+ var useListContext = () => React6__namespace.useContext(ListContext);
390
+ var listItemBaseClasses = "relative flex w-full items-center gap-4 bg-transparent text-left text-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-white hover:bg-neutral-200";
391
+ var densityClasses = {
392
+ default: "px-4 py-3 text-base",
393
+ comfortable: "px-4 py-2.5 text-sm",
394
+ compact: "px-3 py-2 text-sm"
395
+ };
396
+ var lineClasses = {
397
+ one: "min-h-[3rem]",
398
+ two: "min-h-[3.75rem]",
399
+ three: "min-h-[4.5rem]"
400
+ };
401
+ var accentClasses = {
402
+ primary: { text: "text-primary", bg: "bg-primary/10", indicator: "bg-primary" },
403
+ neutral: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" },
404
+ info: { text: "text-sky-600", bg: "bg-sky-50", indicator: "bg-sky-500" },
405
+ success: { text: "text-emerald-600", bg: "bg-emerald-50", indicator: "bg-emerald-500" },
406
+ warning: { text: "text-amber-700", bg: "bg-amber-50", indicator: "bg-amber-500" },
407
+ danger: { text: "text-red-600", bg: "bg-red-50", indicator: "bg-red-500" },
408
+ surface: { text: "text-gray-900", bg: "bg-gray-100", indicator: "bg-gray-900" }
409
+ };
410
+ var ListItem = React6__namespace.forwardRef((props, ref) => {
411
+ const {
412
+ component,
413
+ href,
414
+ target,
415
+ rel,
416
+ type,
417
+ title,
418
+ subtitle,
419
+ overline,
420
+ prepend,
421
+ append,
422
+ active = false,
423
+ disabled = false,
424
+ inset = false,
425
+ density: densityOverride,
426
+ lines: linesOverride,
427
+ className,
428
+ children,
429
+ tabIndex,
430
+ role,
431
+ ...rest
432
+ } = props;
433
+ const listContext = useListContext();
434
+ const density = densityOverride ?? listContext.density;
435
+ const lines = linesOverride ?? listContext.lines;
436
+ const nav = listContext.nav;
437
+ const accent = accentClasses[listContext.color] ?? accentClasses.primary;
438
+ const shapeClass = listContext.divided ? "rounded-none" : "rounded-lg";
439
+ const Component = component ?? (href ? "a" : "div");
440
+ const interactive = typeof rest.onClick === "function" || Component === "a" || Component === "button";
441
+ const resolvedRole = role ?? "listitem";
442
+ const resolvedTabIndex = disabled ? -1 : tabIndex ?? (interactive && Component === "div" ? 0 : void 0);
443
+ const resolvedRel = Component === "a" ? rel : void 0;
444
+ const resolvedTarget = Component === "a" ? target : void 0;
445
+ const resolvedHref = Component === "a" ? href : void 0;
446
+ const resolvedType = Component === "button" ? type ?? "button" : void 0;
447
+ const disabledClass = disabled ? "pointer-events-none opacity-60" : "cursor-pointer";
448
+ const navPaddingClass = nav ? "pl-5" : void 0;
449
+ const insetClass = inset ? "pl-12" : void 0;
450
+ const activeClasses = active ? accent.bg : void 0;
119
451
  return /* @__PURE__ */ jsxRuntime.jsxs(
120
- "button",
452
+ Component,
121
453
  {
122
454
  ...rest,
123
- onClick,
124
- disabled: isDisabled,
125
- className: tailwindMerge.twMerge(base, cursor, variantClass, sizeClass, blockClass, gapClass, className),
126
- "data-loading": loading || void 0,
127
- "aria-busy": loading || void 0,
455
+ ref,
456
+ role: resolvedRole,
457
+ tabIndex: resolvedTabIndex,
458
+ "aria-disabled": disabled || void 0,
459
+ "aria-current": active ? "true" : void 0,
460
+ className: tailwindMerge.twMerge(
461
+ listItemBaseClasses,
462
+ densityClasses[density],
463
+ lineClasses[lines],
464
+ shapeClass,
465
+ navPaddingClass,
466
+ insetClass,
467
+ disabledClass,
468
+ activeClasses,
469
+ className
470
+ ),
471
+ href: resolvedHref,
472
+ target: resolvedTarget,
473
+ rel: resolvedRel,
474
+ type: resolvedType,
475
+ "data-active": active || void 0,
128
476
  children: [
129
- loading && /* @__PURE__ */ jsxRuntime.jsx("i", { className: loadingIconClass, "aria-hidden": true }),
130
- iconClassName && /* @__PURE__ */ jsxRuntime.jsx("i", { className: iconClassName, "aria-hidden": true }),
131
- children
477
+ nav && /* @__PURE__ */ jsxRuntime.jsx(
478
+ "span",
479
+ {
480
+ "aria-hidden": true,
481
+ className: tailwindMerge.twMerge(
482
+ "absolute left-1 top-2 bottom-2 w-0.5 rounded-full bg-transparent transition-colors duration-150",
483
+ active ? accent.indicator : void 0
484
+ )
485
+ }
486
+ ),
487
+ prepend && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center text-base text-gray-500", children: prepend }),
488
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col gap-0.5 text-left", children: [
489
+ overline && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.65rem] font-semibold uppercase tracking-wide text-gray-500", children: overline }),
490
+ title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge("truncate font-medium text-gray-900", active ? accent.text : void 0), children: title }),
491
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-500", children: subtitle }),
492
+ children
493
+ ] }),
494
+ append && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex items-center gap-2 whitespace-nowrap text-sm text-gray-500", children: append })
132
495
  ]
133
496
  }
134
497
  );
498
+ });
499
+ ListItem.displayName = "ListItem";
500
+ var Item_default = ListItem;
501
+ var listBaseClasses = "flex w-full min-w-0 flex-col text-gray-900 transition-colors duration-150";
502
+ var listVariantClasses = {
503
+ solid: "bg-white border border-gray-200 shadow-sm shadow-gray-900/5",
504
+ outline: "bg-transparent border border-gray-300",
505
+ ghost: "bg-gray-50 border border-transparent",
506
+ text: "bg-transparent border border-transparent",
507
+ bw: "bg-white text-black border border-black shadow-none"
135
508
  };
136
- var Button_default = Button;
509
+ var listRoundedClasses = {
510
+ none: "rounded-none",
511
+ sm: "rounded-sm",
512
+ md: "rounded-md",
513
+ lg: "rounded-lg",
514
+ xl: "rounded-xl",
515
+ pill: "rounded-full"
516
+ };
517
+ var List = React6__namespace.forwardRef((props, ref) => {
518
+ const {
519
+ variant = "solid",
520
+ density = "default",
521
+ lines = "one",
522
+ nav = false,
523
+ divided = false,
524
+ rounded = "lg",
525
+ color = "primary",
526
+ className,
527
+ role,
528
+ children,
529
+ ...rest
530
+ } = props;
531
+ const variantClass = listVariantClasses[variant] ?? listVariantClasses.solid;
532
+ const roundedClass = listRoundedClasses[rounded] ?? listRoundedClasses.lg;
533
+ const dividerClass = divided ? "divide-y divide-gray-100" : void 0;
534
+ const gapClass = divided ? "p-0" : "gap-1 p-1";
535
+ const navClass = nav ? "py-1" : void 0;
536
+ const accentColor = variant === "bw" ? "surface" : color;
537
+ const contextValue = React6__namespace.useMemo(
538
+ () => ({
539
+ density,
540
+ lines,
541
+ nav,
542
+ divided,
543
+ color: accentColor
544
+ }),
545
+ [accentColor, density, lines, nav, divided]
546
+ );
547
+ return /* @__PURE__ */ jsxRuntime.jsx(ListContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
548
+ "div",
549
+ {
550
+ ...rest,
551
+ ref,
552
+ role: role ?? "list",
553
+ className: tailwindMerge.twMerge(listBaseClasses, variantClass, roundedClass, dividerClass, gapClass, navClass, className),
554
+ children
555
+ }
556
+ ) });
557
+ });
558
+ List.displayName = "List";
559
+ var List_default = List;
560
+ var isBrowser = typeof window !== "undefined";
561
+ var useIsomorphicLayoutEffect = isBrowser ? React6__namespace.useLayoutEffect : React6__namespace.useEffect;
562
+ var placementClasses = {
563
+ "bottom-start": "left-0 top-full origin-top-left",
564
+ bottom: "left-1/2 top-full -translate-x-1/2 origin-top",
565
+ "bottom-end": "right-0 top-full origin-top-right",
566
+ "top-start": "left-0 bottom-full origin-bottom-left",
567
+ top: "left-1/2 bottom-full -translate-x-1/2 origin-bottom",
568
+ "top-end": "right-0 bottom-full origin-bottom-right"
569
+ };
570
+ var offsetClasses = {
571
+ top: "mb-2",
572
+ bottom: "mt-2"
573
+ };
574
+ var menuBaseClasses = "absolute z-50 min-w-[10rem] rounded-xl border border-gray-200/80 bg-white/95 p-2 text-sm text-gray-700 shadow-lg shadow-gray-900/10 ring-1 ring-black/5 backdrop-blur-md transition-all duration-150 data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0 data-[state=closed]:scale-95 data-[state=open]:opacity-100 data-[state=open]:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2";
575
+ var overlayBaseClasses = "fixed inset-0 z-40 bg-gray-900/30 backdrop-blur-[1px]";
576
+ var Menu = React6__namespace.forwardRef((props, ref) => {
577
+ const {
578
+ activator,
579
+ children,
580
+ open: openProp,
581
+ defaultOpen = false,
582
+ onOpenChange,
583
+ placement = "bottom-start",
584
+ openOnHover = false,
585
+ closeOnContentClick = true,
586
+ matchActivatorWidth = false,
587
+ keepMounted = false,
588
+ disabled = false,
589
+ scrim = false,
590
+ contentClassName,
591
+ contentProps,
592
+ overlayClassName,
593
+ className,
594
+ onMouseEnter: rootMouseEnter,
595
+ onMouseLeave: rootMouseLeave,
596
+ ...rest
597
+ } = props;
598
+ const baseId = React6__namespace.useId();
599
+ const menuId = `${baseId}-menu`;
600
+ const activatorId = `${baseId}-activator`;
601
+ const isControlled = typeof openProp === "boolean";
602
+ const [internalOpen, setInternalOpen] = React6__namespace.useState(defaultOpen);
603
+ const open = isControlled ? Boolean(openProp) : internalOpen;
604
+ const localRootRef = React6__namespace.useRef(null);
605
+ const menuRef = React6__namespace.useRef(null);
606
+ const activatorRef = React6__namespace.useRef(null);
607
+ const closeTimeoutRef = React6__namespace.useRef(null);
608
+ const mergedRootRef = React6__namespace.useCallback(
609
+ (node) => {
610
+ localRootRef.current = node;
611
+ if (typeof ref === "function") {
612
+ ref(node);
613
+ } else if (ref) {
614
+ ref.current = node;
615
+ }
616
+ },
617
+ [ref]
618
+ );
619
+ const [activatorWidth, setActivatorWidth] = React6__namespace.useState();
620
+ const updateActivatorWidth = React6__namespace.useCallback(() => {
621
+ if (!matchActivatorWidth) {
622
+ setActivatorWidth(void 0);
623
+ return;
624
+ }
625
+ const node = activatorRef.current;
626
+ if (!node) {
627
+ return;
628
+ }
629
+ setActivatorWidth(node.getBoundingClientRect().width);
630
+ }, [matchActivatorWidth]);
631
+ useIsomorphicLayoutEffect(() => {
632
+ if (!matchActivatorWidth) {
633
+ return;
634
+ }
635
+ updateActivatorWidth();
636
+ if (!activatorRef.current || typeof ResizeObserver === "undefined") {
637
+ return;
638
+ }
639
+ const observer = new ResizeObserver(() => updateActivatorWidth());
640
+ observer.observe(activatorRef.current);
641
+ return () => observer.disconnect();
642
+ }, [matchActivatorWidth, updateActivatorWidth]);
643
+ const setOpen = React6__namespace.useCallback(
644
+ (nextOpen) => {
645
+ if (disabled || open === nextOpen) {
646
+ return;
647
+ }
648
+ if (!isControlled) {
649
+ setInternalOpen(nextOpen);
650
+ }
651
+ onOpenChange?.(nextOpen);
652
+ },
653
+ [disabled, isControlled, onOpenChange, open]
654
+ );
655
+ React6__namespace.useEffect(() => {
656
+ if (!disabled || !open) {
657
+ return;
658
+ }
659
+ if (!isControlled) {
660
+ setInternalOpen(false);
661
+ }
662
+ onOpenChange?.(false);
663
+ }, [disabled, open, isControlled, onOpenChange]);
664
+ React6__namespace.useEffect(() => {
665
+ if (!open) {
666
+ return;
667
+ }
668
+ const handlePointerDown = (event) => {
669
+ const target = event.target;
670
+ if (!target) {
671
+ return;
672
+ }
673
+ if (localRootRef.current?.contains(target)) {
674
+ return;
675
+ }
676
+ setOpen(false);
677
+ };
678
+ const handleKeyDown = (event) => {
679
+ if (event.key === "Escape") {
680
+ event.stopPropagation();
681
+ setOpen(false);
682
+ activatorRef.current?.focus();
683
+ }
684
+ };
685
+ document.addEventListener("pointerdown", handlePointerDown);
686
+ document.addEventListener("keydown", handleKeyDown);
687
+ return () => {
688
+ document.removeEventListener("pointerdown", handlePointerDown);
689
+ document.removeEventListener("keydown", handleKeyDown);
690
+ };
691
+ }, [open, setOpen]);
692
+ React6__namespace.useEffect(() => {
693
+ if (!open) {
694
+ return;
695
+ }
696
+ const node = menuRef.current;
697
+ if (!node) {
698
+ return;
699
+ }
700
+ const id = window.requestAnimationFrame(() => {
701
+ node.focus({ preventScroll: true });
702
+ });
703
+ return () => window.cancelAnimationFrame(id);
704
+ }, [open]);
705
+ const setActivatorNode = React6__namespace.useCallback(
706
+ (node) => {
707
+ activatorRef.current = node;
708
+ if (node && matchActivatorWidth) {
709
+ setActivatorWidth(node.getBoundingClientRect().width);
710
+ }
711
+ },
712
+ [matchActivatorWidth]
713
+ );
714
+ const handleActivatorClick = React6__namespace.useCallback(
715
+ (event) => {
716
+ event.preventDefault();
717
+ if (disabled) {
718
+ return;
719
+ }
720
+ setOpen(!open);
721
+ },
722
+ [disabled, open, setOpen]
723
+ );
724
+ const handleActivatorKeyDown = React6__namespace.useCallback(
725
+ (event) => {
726
+ if (event.key === "Enter" || event.key === " ") {
727
+ event.preventDefault();
728
+ setOpen(!open);
729
+ }
730
+ if (event.key === "ArrowDown") {
731
+ event.preventDefault();
732
+ setOpen(true);
733
+ }
734
+ },
735
+ [open, setOpen]
736
+ );
737
+ const clearCloseTimeout = React6__namespace.useCallback(() => {
738
+ if (closeTimeoutRef.current !== null) {
739
+ if (isBrowser) {
740
+ window.clearTimeout(closeTimeoutRef.current);
741
+ }
742
+ closeTimeoutRef.current = null;
743
+ }
744
+ }, []);
745
+ const scheduleClose = React6__namespace.useCallback(() => {
746
+ if (!isBrowser) {
747
+ setOpen(false);
748
+ return;
749
+ }
750
+ clearCloseTimeout();
751
+ closeTimeoutRef.current = window.setTimeout(() => {
752
+ setOpen(false);
753
+ closeTimeoutRef.current = null;
754
+ }, 150);
755
+ }, [clearCloseTimeout, setOpen]);
756
+ React6__namespace.useEffect(() => {
757
+ return () => clearCloseTimeout();
758
+ }, [clearCloseTimeout]);
759
+ const isMovingWithinMenu = React6__namespace.useCallback(
760
+ (event) => {
761
+ const nextTarget = event.relatedTarget;
762
+ if (!nextTarget || !localRootRef.current) {
763
+ return false;
764
+ }
765
+ return localRootRef.current.contains(nextTarget);
766
+ },
767
+ [localRootRef]
768
+ );
769
+ const handleRootMouseEnter = React6__namespace.useCallback(
770
+ (event) => {
771
+ rootMouseEnter?.(event);
772
+ if (event.defaultPrevented) {
773
+ return;
774
+ }
775
+ if (openOnHover) {
776
+ clearCloseTimeout();
777
+ setOpen(true);
778
+ }
779
+ },
780
+ [clearCloseTimeout, openOnHover, rootMouseEnter, setOpen]
781
+ );
782
+ const handleRootMouseLeave = React6__namespace.useCallback(
783
+ (event) => {
784
+ rootMouseLeave?.(event);
785
+ if (event.defaultPrevented) {
786
+ return;
787
+ }
788
+ if (openOnHover) {
789
+ if (isMovingWithinMenu(event)) {
790
+ return;
791
+ }
792
+ scheduleClose();
793
+ }
794
+ },
795
+ [isMovingWithinMenu, openOnHover, rootMouseLeave, scheduleClose]
796
+ );
797
+ const handleActivatorMouseEnter = React6__namespace.useCallback(
798
+ (_event) => {
799
+ if (disabled) {
800
+ return;
801
+ }
802
+ clearCloseTimeout();
803
+ setOpen(true);
804
+ },
805
+ [clearCloseTimeout, disabled, setOpen]
806
+ );
807
+ const handleActivatorMouseLeave = React6__namespace.useCallback(
808
+ (event) => {
809
+ if (disabled || !openOnHover) {
810
+ return;
811
+ }
812
+ if (isMovingWithinMenu(event)) {
813
+ return;
814
+ }
815
+ scheduleClose();
816
+ },
817
+ [disabled, isMovingWithinMenu, openOnHover, scheduleClose]
818
+ );
819
+ const {
820
+ className: contentClass,
821
+ style: contentStyle,
822
+ onClick: contentOnClick,
823
+ onMouseEnter: contentOnMouseEnter,
824
+ onMouseLeave: contentOnMouseLeave,
825
+ role: contentRole,
826
+ tabIndex: contentTabIndex,
827
+ ["aria-labelledby"]: ariaLabelledBy,
828
+ ...restContentProps
829
+ } = contentProps ?? {};
830
+ const shouldRenderContent = open || keepMounted;
831
+ const verticalPlacement = placement.startsWith("top") ? "top" : "bottom";
832
+ const activatorElement = activator({
833
+ ref: setActivatorNode,
834
+ id: activatorId,
835
+ "aria-haspopup": "menu",
836
+ "aria-expanded": open,
837
+ "aria-controls": menuId,
838
+ onClick: handleActivatorClick,
839
+ onKeyDown: handleActivatorKeyDown,
840
+ onMouseEnter: openOnHover ? handleActivatorMouseEnter : void 0,
841
+ onMouseLeave: openOnHover ? handleActivatorMouseLeave : void 0,
842
+ disabled,
843
+ open
844
+ });
845
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
846
+ scrim && open ? /* @__PURE__ */ jsxRuntime.jsx(
847
+ "div",
848
+ {
849
+ className: tailwindMerge.twMerge(overlayBaseClasses, overlayClassName),
850
+ "aria-hidden": true,
851
+ onClick: () => setOpen(false),
852
+ onMouseDown: (event) => event.preventDefault()
853
+ }
854
+ ) : null,
855
+ /* @__PURE__ */ jsxRuntime.jsxs(
856
+ "div",
857
+ {
858
+ ...rest,
859
+ ref: mergedRootRef,
860
+ className: tailwindMerge.twMerge("relative inline-flex min-w-0", className),
861
+ "data-open": open || void 0,
862
+ onMouseEnter: openOnHover ? handleRootMouseEnter : rootMouseEnter,
863
+ onMouseLeave: openOnHover ? handleRootMouseLeave : rootMouseLeave,
864
+ children: [
865
+ activatorElement,
866
+ shouldRenderContent ? /* @__PURE__ */ jsxRuntime.jsx(
867
+ "div",
868
+ {
869
+ ...restContentProps,
870
+ ref: menuRef,
871
+ id: menuId,
872
+ role: contentRole ?? "menu",
873
+ tabIndex: contentTabIndex ?? -1,
874
+ "aria-labelledby": ariaLabelledBy ?? activatorId,
875
+ "data-state": open ? "open" : "closed",
876
+ className: tailwindMerge.twMerge(
877
+ menuBaseClasses,
878
+ placementClasses[placement],
879
+ offsetClasses[verticalPlacement],
880
+ contentClassName,
881
+ contentClass
882
+ ),
883
+ style: {
884
+ ...contentStyle,
885
+ ...matchActivatorWidth && activatorWidth ? { minWidth: activatorWidth, width: activatorWidth } : void 0
886
+ },
887
+ onMouseEnter: (event) => {
888
+ contentOnMouseEnter?.(event);
889
+ if (event.defaultPrevented) {
890
+ return;
891
+ }
892
+ if (openOnHover) {
893
+ clearCloseTimeout();
894
+ setOpen(true);
895
+ }
896
+ },
897
+ onMouseLeave: (event) => {
898
+ contentOnMouseLeave?.(event);
899
+ if (event.defaultPrevented) {
900
+ return;
901
+ }
902
+ if (openOnHover) {
903
+ if (isMovingWithinMenu(event)) {
904
+ return;
905
+ }
906
+ scheduleClose();
907
+ }
908
+ },
909
+ onClick: (event) => {
910
+ contentOnClick?.(event);
911
+ if (event.defaultPrevented) {
912
+ return;
913
+ }
914
+ if (closeOnContentClick) {
915
+ setOpen(false);
916
+ }
917
+ },
918
+ children
919
+ }
920
+ ) : null
921
+ ]
922
+ }
923
+ )
924
+ ] });
925
+ });
926
+ Menu.displayName = "Menu";
927
+ var Menu_default = Menu;
137
928
 
138
929
  // src/Form/Input/states.input.ts
139
- var resolveIconClassName2 = (icon) => {
930
+ var resolveIconClassName3 = (icon) => {
140
931
  if (!icon) {
141
932
  return void 0;
142
933
  }
@@ -162,7 +953,7 @@ var resolveIconClassName2 = (icon) => {
162
953
  return Array.from(new Set(classes)).join(" ");
163
954
  };
164
955
  var Input = ({ variant = "outline", success, error, warn, icon, className, ...props }) => {
165
- const classBase = "input-base px-3 py-2 focus-visible:outline-none focus-visible:ring-primary transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed";
956
+ const classBase = "input-base px-3 py-2 focus-visible:outline-none focus-visible:ring-primary transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed w-full";
166
957
  const variantClasses = {
167
958
  outline: "rounded border border-gray-300 focus:border-primary focus:ring-1 focus:ring-primary",
168
959
  filled: "rounded bg-gray-100 border border-gray-300 focus:border-primary focus:ring-1 focus:ring-primary",
@@ -181,7 +972,7 @@ var Input = ({ variant = "outline", success, error, warn, icon, className, ...pr
181
972
  };
182
973
  const variantClass = variantClasses[variant] ?? variantClasses.outline;
183
974
  const toneClass = status ? statusClasses[status.tone] : void 0;
184
- const prependIconClass = resolveIconClassName2(icon);
975
+ const prependIconClass = resolveIconClassName3(icon);
185
976
  const prependPadding = prependIconClass ? "pl-10" : void 0;
186
977
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
187
978
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
@@ -194,6 +985,10 @@ var Input = ({ variant = "outline", success, error, warn, icon, className, ...pr
194
985
  var Input_default = Input;
195
986
 
196
987
  exports.Button = Button_default;
988
+ exports.Chip = Chip_default;
197
989
  exports.Input = Input_default;
990
+ exports.List = List_default;
991
+ exports.ListItem = Item_default;
992
+ exports.Menu = Menu_default;
198
993
  //# sourceMappingURL=index.cjs.map
199
994
  //# sourceMappingURL=index.cjs.map