@takeoff-ui/react-spar 0.1.1 → 0.2.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.mjs CHANGED
@@ -1,7 +1,17 @@
1
- import { createContext, Children, isValidElement, useState, useEffect, useMemo, createElement, useContext } from 'react';
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { Accordion as Accordion$1, AccordionContent as AccordionContent$1, useAccordionItemContext, AccordionTrigger as AccordionTrigger$1, AccordionHeader as AccordionHeader$1, AccordionItem as AccordionItem$1, Checkbox as Checkbox$1, Dialog, DialogClose, DialogDescription, DialogTitle, DialogContent, DialogOverlay, DialogTrigger, Field as Field$1, FieldErrorMessage as FieldErrorMessage$1, FieldDescription as FieldDescription$1, useFieldContext, FieldLabel as FieldLabel$1, Input as Input$1, InputField as InputField$1, useInputContext, Radio as Radio$1, RadioItem as RadioItem$1, Popover as Popover$1, PopoverClose as PopoverClose$1, PopoverArrow as PopoverArrow$1, PopoverContent as PopoverContent$1, PopoverTrigger as PopoverTrigger$1, Select as Select$1, SelectSeparator as SelectSeparator$1, SelectLabel as SelectLabel$1, SelectGroup as SelectGroup$1, SelectItem as SelectItem$1, useSelectContext, SelectContent as SelectContent$1, SelectTrigger as SelectTrigger$1, Switch as Switch$1, Tooltip as Tooltip$1, TooltipArrow as TooltipArrow$1, TooltipContent as TooltipContent$1, TooltipTrigger as TooltipTrigger$1, TooltipProvider as TooltipProvider$1, Button as Button$1 } from '@turkish-technology/spar';
1
+ import { createContext, Children, isValidElement, useMemo, useRef, useState, useCallback, useEffect, createElement, useContext, Fragment as Fragment$1 } from 'react';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { Accordion as Accordion$1, AccordionContent as AccordionContent$1, useAccordionItemContext, AccordionTrigger as AccordionTrigger$1, AccordionHeader as AccordionHeader$1, AccordionItem as AccordionItem$1, Breadcrumb as Breadcrumb$1, BreadcrumbSeparator as BreadcrumbSeparator$1, BreadcrumbPage as BreadcrumbPage$1, BreadcrumbLink as BreadcrumbLink$1, BreadcrumbItem as BreadcrumbItem$1, BreadcrumbList as BreadcrumbList$1, Checkbox as Checkbox$1, Dialog as Dialog$1, DialogClose as DialogClose$1, DialogDescription as DialogDescription$1, DialogTitle as DialogTitle$1, DialogContent, DialogOverlay as DialogOverlay$1, DialogTrigger as DialogTrigger$1, Field as Field$1, FieldErrorMessage as FieldErrorMessage$1, FieldDescription as FieldDescription$1, useFieldContext, FieldLabel as FieldLabel$1, Input as Input$1, useInputContext, InputField as InputField$1, Radio as Radio$1, RadioItem as RadioItem$1, Popover as Popover$1, PopoverClose as PopoverClose$1, PopoverArrow as PopoverArrow$1, PopoverContent as PopoverContent$1, PopoverTrigger as PopoverTrigger$1, Select as Select$1, SelectSeparator as SelectSeparator$1, SelectLabel as SelectLabel$1, SelectGroup as SelectGroup$1, SelectItem as SelectItem$1, useSelectContext, SelectContent as SelectContent$1, SelectTrigger as SelectTrigger$1, Switch as Switch$1, Tabs as Tabs$1, TabsContent as TabsContent$1, TabsTrigger as TabsTrigger$1, TabsList as TabsList$1, Tooltip as Tooltip$1, TooltipArrow as TooltipArrow$1, TooltipContent as TooltipContent$1, TooltipTrigger as TooltipTrigger$1, TooltipProvider as TooltipProvider$1, Button as Button$1, Label as Label$1, Toast as Toast$1, Toaster as Toaster$1 } from '@turkish-technology/spar';
4
+ export { createToaster } from '@turkish-technology/spar';
4
5
  import { clsx } from 'clsx';
6
+ import { ChevronBottomIconOutlinedRounded } from '@takeoff-icons/react/chevron-bottom';
7
+ import { ChevronTopIconOutlinedRounded } from '@takeoff-icons/react/chevron-top';
8
+ import { useReactTable, getPaginationRowModel, getExpandedRowModel, getFilteredRowModel, getSortedRowModel, getCoreRowModel, functionalUpdate, flexRender } from '@tanstack/react-table';
9
+ import { ChevronRightIconOutlinedRounded } from '@takeoff-icons/react/chevron-right';
10
+ import { SwapIconOutlinedRounded } from '@takeoff-icons/react/swap';
11
+ import { SearchIconOutlinedRounded } from '@takeoff-icons/react/search';
12
+ import { ArrowLeftIconOutlinedRounded } from '@takeoff-icons/react/arrow-left';
13
+ import { ArrowRightIconOutlinedRounded } from '@takeoff-icons/react/arrow-right';
14
+ import { ChevronLeftIconOutlinedRounded } from '@takeoff-icons/react/chevron-left';
5
15
 
6
16
  // src/provider.tsx
7
17
 
@@ -52,6 +62,12 @@ var useComponentTheme = (componentName) => {
52
62
  const context = useContext(TakeoffSparContext);
53
63
  return context?.components?.[componentName];
54
64
  };
65
+
66
+ // src/core/blockDismiss.ts
67
+ var blockDismiss = (handler) => (event) => {
68
+ event.preventDefault();
69
+ handler?.(event);
70
+ };
55
71
  var buildSlotAttrs = (canonicalAttrs, slotKey, layers = {}) => {
56
72
  const { themeSlotProps, themeClassNames, themeClassName, instanceSlotProps, instanceClassNames } = layers;
57
73
  const themeForSlot = themeSlotProps?.[slotKey];
@@ -94,6 +110,9 @@ var composeRootAttrs = (base, props, theme, options) => {
94
110
  rest
95
111
  };
96
112
  };
113
+
114
+ // src/core/isRenderableNode.ts
115
+ var isRenderableNode = (node) => node !== null && node !== void 0 && node !== "" && typeof node !== "boolean";
97
116
  var toDataSlotName = (slot) => slot.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
98
117
  var createComponentBase = (config) => {
99
118
  const { name, slots, classes, defaultProps = {} } = config;
@@ -120,6 +139,12 @@ var createComponentBase = (config) => {
120
139
  resolveProps
121
140
  };
122
141
  };
142
+ var DEFAULT_DISCLOSURE_EXPAND_ICON = /* @__PURE__ */ jsx(ChevronBottomIconOutlinedRounded, {});
143
+ var DEFAULT_DISCLOSURE_COLLAPSE_ICON = /* @__PURE__ */ jsx(ChevronTopIconOutlinedRounded, {});
144
+ var resolveDisclosureIndicator = (children, isOpen) => {
145
+ if (typeof children === "function") return children({ isOpen });
146
+ return children ?? (isOpen ? DEFAULT_DISCLOSURE_COLLAPSE_ICON : DEFAULT_DISCLOSURE_EXPAND_ICON);
147
+ };
123
148
 
124
149
  // src/components/accordion/base.ts
125
150
  var AccordionBase = createComponentBase({
@@ -170,6 +195,21 @@ function createSafeContext(displayName) {
170
195
  };
171
196
  return [Provider, useSafeContext];
172
197
  }
198
+ function useControllableState(controlledValue, defaultValue, onChange) {
199
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
200
+ const { current: isControlled } = useRef(controlledValue !== void 0);
201
+ const value = isControlled ? controlledValue : uncontrolledValue;
202
+ const setValue = useCallback(
203
+ (newValue) => {
204
+ if (!isControlled) {
205
+ setUncontrolledValue(newValue);
206
+ }
207
+ onChange?.(newValue);
208
+ },
209
+ [isControlled, onChange]
210
+ );
211
+ return [value, setValue];
212
+ }
173
213
 
174
214
  // src/components/accordion/context.ts
175
215
  var [AccordionProvider, useAccordionOwnContext] = createSafeContext("AccordionProvider");
@@ -222,15 +262,13 @@ var AccordionHeader = (props) => {
222
262
  return /* @__PURE__ */ jsx(AccordionHeader$1, { ...spar, level, ...rootAttrs, ref, children });
223
263
  };
224
264
  AccordionHeader.displayName = "Accordion.Header";
225
- var DEFAULT_EXPAND_ICON = /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx("path", { d: "M4 6L8 10L12 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
226
- var DEFAULT_COLLAPSE_ICON = /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx("path", { d: "M4 10L8 6L12 10", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
227
265
  var AccordionIndicator = (props) => {
228
266
  const theme = useComponentTheme("AccordionIndicator");
229
267
  const { isOpen } = useAccordionItemContext();
230
268
  const Component = props.as ?? "span";
231
269
  const { rootAttrs, rest } = composeRootAttrs(AccordionIndicatorBase, props, theme);
232
270
  const { as: _as, children, ref, ...rendered } = rest;
233
- const resolved = typeof children === "function" ? children({ isOpen }) : children ?? (isOpen ? DEFAULT_COLLAPSE_ICON : DEFAULT_EXPAND_ICON);
271
+ const resolved = resolveDisclosureIndicator(children, isOpen);
234
272
  return /* @__PURE__ */ jsx(Component, { ...rendered, ref, "aria-hidden": "true", ...rootAttrs, children: resolved });
235
273
  };
236
274
  AccordionIndicator.displayName = "Accordion.Indicator";
@@ -287,6 +325,161 @@ var Accordion2 = Object.assign(Accordion, {
287
325
  Content: AccordionContent
288
326
  });
289
327
 
328
+ // src/components/alert/base.ts
329
+ var AlertBase = createComponentBase({
330
+ name: "Alert",
331
+ slots: ["root"],
332
+ classes: { root: "tk-alert" }
333
+ });
334
+ var AlertContentBase = createComponentBase({
335
+ name: "AlertContent",
336
+ slots: ["root"],
337
+ classes: { root: "tk-alert-content" }
338
+ });
339
+ var AlertTitleBase = createComponentBase({
340
+ name: "AlertTitle",
341
+ slots: ["root"],
342
+ classes: { root: "tk-alert-title" }
343
+ });
344
+ var AlertDescriptionBase = createComponentBase({
345
+ name: "AlertDescription",
346
+ slots: ["root"],
347
+ classes: { root: "tk-alert-description" }
348
+ });
349
+ var AlertActionsBase = createComponentBase({
350
+ name: "AlertActions",
351
+ slots: ["root"],
352
+ classes: { root: "tk-alert-actions" }
353
+ });
354
+ var AlertCloseBase = createComponentBase({
355
+ name: "AlertClose",
356
+ slots: ["root"],
357
+ classes: { root: "tk-alert-close" }
358
+ });
359
+
360
+ // src/components/alert/context.ts
361
+ var [AlertProvider, useAlertContext] = createSafeContext("AlertProvider");
362
+
363
+ // src/components/alert/defaults.ts
364
+ var DEFAULT_VARIANT = "neutral";
365
+ var DEFAULT_APPEARANCE = "filled";
366
+ var DEFAULT_CLOSE_LABEL = "Close";
367
+ var Alert = (props) => {
368
+ const theme = useComponentTheme("Alert");
369
+ const { rootAttrs, rest } = composeRootAttrs(AlertBase, props, theme, {
370
+ stateAttrs: ({ variant = DEFAULT_VARIANT, appearance = DEFAULT_APPEARANCE }) => ({
371
+ "data-variant": variant,
372
+ "data-type": appearance
373
+ })
374
+ });
375
+ const { as, variant: _variant, appearance: _appearance, onClose, children, ref, role = "status", ...alertProps } = rest;
376
+ const Component = as ?? "div";
377
+ return /* @__PURE__ */ jsx(AlertProvider, { value: { onClose }, children: /* @__PURE__ */ jsx(Component, { ...alertProps, ref, role, ...rootAttrs, children }) });
378
+ };
379
+ Alert.displayName = "Alert";
380
+ var AlertActions = (props) => {
381
+ const theme = useComponentTheme("AlertActions");
382
+ const { rootAttrs, rest } = composeRootAttrs(AlertActionsBase, props, theme);
383
+ const { as, children, ref, ...actionsProps } = rest;
384
+ const Component = as ?? "div";
385
+ return /* @__PURE__ */ jsx(Component, { ...actionsProps, ref, ...rootAttrs, children });
386
+ };
387
+ AlertActions.displayName = "Alert.Actions";
388
+ var baseSvgProps = {
389
+ "xmlns": "http://www.w3.org/2000/svg",
390
+ "width": "1em",
391
+ "height": "1em",
392
+ "viewBox": "0 0 24 24",
393
+ "fill": "none",
394
+ "stroke": "currentColor",
395
+ "strokeWidth": 2,
396
+ "strokeLinecap": "round",
397
+ "strokeLinejoin": "round",
398
+ "focusable": false,
399
+ "aria-hidden": true
400
+ };
401
+ var filledSvgProps = {
402
+ "xmlns": "http://www.w3.org/2000/svg",
403
+ "width": "1em",
404
+ "height": "1em",
405
+ "viewBox": "0 0 24 24",
406
+ "fill": "currentColor",
407
+ "focusable": false,
408
+ "aria-hidden": true
409
+ };
410
+ var PlaceholderChevronDown = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "chevron-down", ...props, children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) });
411
+ var PlaceholderChevronUp = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "chevron-up", ...props, children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" }) });
412
+ var PlaceholderClose = (props) => /* @__PURE__ */ jsxs("svg", { ...baseSvgProps, "data-placeholder-icon": "close", ...props, children: [
413
+ /* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
414
+ /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
415
+ ] });
416
+ var PlaceholderInfo = (props) => /* @__PURE__ */ jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "info", ...props, children: /* @__PURE__ */ jsx("g", { transform: "translate(2 2) scale(1.714)", children: /* @__PURE__ */ jsx("path", { d: "M5.83333 0C2.61333 0 0 2.61333 0 5.83333C0 9.05333 2.61333 11.6667 5.83333 11.6667C9.05333 11.6667 11.6667 9.05333 11.6667 5.83333C11.6667 2.61333 9.05333 0 5.83333 0ZM5.83333 8.75C5.5125 8.75 5.25 8.4875 5.25 8.16667V5.83333C5.25 5.5125 5.5125 5.25 5.83333 5.25C6.15417 5.25 6.41667 5.5125 6.41667 5.83333V8.16667C6.41667 8.4875 6.15417 8.75 5.83333 8.75ZM6.41667 4.08333H5.25V2.91667H6.41667V4.08333Z" }) }) });
417
+ var PlaceholderError = (props) => /* @__PURE__ */ jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "error", ...props, children: /* @__PURE__ */ jsx("g", { transform: "translate(2 2) scale(1.714)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ jsx("path", { d: "M5.83333 0C2.61333 0 0 2.61333 0 5.83333C0 9.05333 2.61333 11.6667 5.83333 11.6667C9.05333 11.6667 11.6667 9.05333 11.6667 5.83333C11.6667 2.61333 9.05333 0 5.83333 0ZM5.83333 2.91667C6.15417 2.91667 6.41667 3.17917 6.41667 3.5V5.83333C6.41667 6.15417 6.15417 6.41667 5.83333 6.41667C5.5125 6.41667 5.25 6.15417 5.25 5.83333V3.5C5.25 3.17917 5.5125 2.91667 5.83333 2.91667ZM5.25 7.58333H6.41667V8.75H5.25V7.58333Z" }) }) });
418
+ var PlaceholderCheck = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "check", ...props, children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" }) });
419
+ var PlaceholderRemove = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "remove", ...props, children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" }) });
420
+ var PlaceholderEye = (props) => /* @__PURE__ */ jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "eye", ...props, children: /* @__PURE__ */ jsx("g", { transform: "translate(1 4.5) scale(1.2)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ jsx("path", { d: "M9.16667 1.66667C12.325 1.66667 15.1417 3.44167 16.5167 6.25C15.1417 9.05833 12.325 10.8333 9.16667 10.8333C6.00833 10.8333 3.19167 9.05833 1.81667 6.25C3.19167 3.44167 6.00833 1.66667 9.16667 1.66667ZM9.16667 0C5 0 1.44167 2.59167 0 6.25C1.44167 9.90833 5 12.5 9.16667 12.5C13.3333 12.5 16.8917 9.90833 18.3333 6.25C16.8917 2.59167 13.3333 0 9.16667 0ZM9.16667 4.16667C10.3167 4.16667 11.25 5.1 11.25 6.25C11.25 7.4 10.3167 8.33333 9.16667 8.33333C8.01667 8.33333 7.08333 7.4 7.08333 6.25C7.08333 5.1 8.01667 4.16667 9.16667 4.16667ZM9.16667 2.5C7.1 2.5 5.41667 4.18333 5.41667 6.25C5.41667 8.31667 7.1 10 9.16667 10C11.2333 10 12.9167 8.31667 12.9167 6.25C12.9167 4.18333 11.2333 2.5 9.16667 2.5Z" }) }) });
421
+ var PlaceholderEyeOff = (props) => /* @__PURE__ */ jsx("svg", { ...filledSvgProps, "data-placeholder-icon": "eye-off", ...props, children: /* @__PURE__ */ jsx("g", { transform: "translate(1 2.42) scale(1.2)", fillRule: "evenodd", clipRule: "evenodd", children: /* @__PURE__ */ jsx("path", { d: "M9.16667 2.95833C12.325 2.95833 15.1417 4.73333 16.5167 7.54167C16.025 8.55833 15.3333 9.43333 14.5083 10.1417L15.6833 11.3167C16.8417 10.2917 17.7583 9.00833 18.3333 7.54167C16.8917 3.88333 13.3333 1.29167 9.16667 1.29167C8.10833 1.29167 7.09167 1.45833 6.13333 1.76667L7.50833 3.14167C8.05 3.03333 8.6 2.95833 9.16667 2.95833ZM8.275 3.90833L10 5.63333C10.475 5.84167 10.8583 6.225 11.0667 6.7L12.7917 8.425C12.8583 8.14167 12.9083 7.84167 12.9083 7.53333C12.9167 5.46667 11.2333 3.79167 9.16667 3.79167C8.85833 3.79167 8.56667 3.83333 8.275 3.90833ZM0.841667 1.18333L3.075 3.41667C1.71667 4.48333 0.641667 5.9 0 7.54167C1.44167 11.2 5 13.7917 9.16667 13.7917C10.4333 13.7917 11.65 13.55 12.7667 13.1083L15.6167 15.9583L16.7917 14.7833L2.01667 0L0.841667 1.18333ZM7.09167 7.43333L9.26667 9.60833C9.23333 9.61667 9.2 9.625 9.16667 9.625C8.01667 9.625 7.08333 8.69167 7.08333 7.54167C7.08333 7.5 7.09167 7.475 7.09167 7.43333ZM4.25833 4.6L5.71667 6.05833C5.525 6.51667 5.41667 7.01667 5.41667 7.54167C5.41667 9.60833 7.1 11.2917 9.16667 11.2917C9.69167 11.2917 10.1917 11.1833 10.6417 10.9917L11.4583 11.8083C10.725 12.0083 9.95833 12.125 9.16667 12.125C6.00833 12.125 3.19167 10.35 1.81667 7.54167C2.4 6.35 3.25 5.36667 4.25833 4.6Z" }) }) });
422
+ var AlertClose = (props) => {
423
+ const theme = useComponentTheme("AlertClose");
424
+ const { onClose } = useAlertContext("Alert.Close");
425
+ const { rootAttrs, rest } = composeRootAttrs(AlertCloseBase, props, theme);
426
+ const { as, children, onClick, ref, type, "aria-label": ariaLabel, ...closeProps } = rest;
427
+ const { onClick: slotOnClick, ...closeRootAttrs } = rootAttrs;
428
+ const Component = as ?? "button";
429
+ const handleClick = (event) => {
430
+ onClick?.(event);
431
+ slotOnClick?.(event);
432
+ onClose?.();
433
+ };
434
+ const hasCustomChildren = isRenderableNode(children);
435
+ return /* @__PURE__ */ jsx(
436
+ Component,
437
+ {
438
+ ...closeProps,
439
+ ref,
440
+ type: as ? type : type ?? "button",
441
+ "aria-label": ariaLabel ?? (hasCustomChildren ? void 0 : DEFAULT_CLOSE_LABEL),
442
+ onClick: handleClick,
443
+ ...closeRootAttrs,
444
+ children: hasCustomChildren ? children : /* @__PURE__ */ jsx(PlaceholderClose, {})
445
+ }
446
+ );
447
+ };
448
+ AlertClose.displayName = "Alert.Close";
449
+ var AlertContent = (props) => {
450
+ const theme = useComponentTheme("AlertContent");
451
+ const { rootAttrs, rest } = composeRootAttrs(AlertContentBase, props, theme);
452
+ const { as, children, ref, ...contentProps } = rest;
453
+ const Component = as ?? "div";
454
+ return /* @__PURE__ */ jsx(Component, { ...contentProps, ref, ...rootAttrs, children });
455
+ };
456
+ AlertContent.displayName = "Alert.Content";
457
+ var AlertDescription = (props) => {
458
+ const theme = useComponentTheme("AlertDescription");
459
+ const { rootAttrs, rest } = composeRootAttrs(AlertDescriptionBase, props, theme);
460
+ const { as, children, ref, ...descriptionProps } = rest;
461
+ const Component = as ?? "p";
462
+ return /* @__PURE__ */ jsx(Component, { ...descriptionProps, ref, ...rootAttrs, children });
463
+ };
464
+ AlertDescription.displayName = "Alert.Description";
465
+ var AlertTitle = (props) => {
466
+ const theme = useComponentTheme("AlertTitle");
467
+ const { rootAttrs, rest } = composeRootAttrs(AlertTitleBase, props, theme);
468
+ const { as, level = 5, children, ref, ...titleProps } = rest;
469
+ const Component = as ?? `h${level}`;
470
+ return /* @__PURE__ */ jsx(Component, { ...titleProps, ref, ...rootAttrs, children });
471
+ };
472
+ AlertTitle.displayName = "Alert.Title";
473
+
474
+ // src/components/alert/index.ts
475
+ var Alert2 = Object.assign(Alert, {
476
+ Content: AlertContent,
477
+ Title: AlertTitle,
478
+ Description: AlertDescription,
479
+ Actions: AlertActions,
480
+ Close: AlertClose
481
+ });
482
+
290
483
  // src/components/badge/base.ts
291
484
  var BadgeBase = createComponentBase({
292
485
  name: "Badge",
@@ -299,13 +492,13 @@ var BadgeBase = createComponentBase({
299
492
  });
300
493
 
301
494
  // src/components/badge/defaults.ts
302
- var DEFAULT_VARIANT = "primary";
303
- var DEFAULT_APPEARANCE = "filled";
495
+ var DEFAULT_VARIANT2 = "primary";
496
+ var DEFAULT_APPEARANCE2 = "filled";
304
497
  var DEFAULT_SIZE2 = "base";
305
498
  var Badge = (props) => {
306
499
  const theme = useComponentTheme("Badge");
307
500
  const { rootAttrs, rest } = composeRootAttrs(BadgeBase, props, theme, {
308
- stateAttrs: ({ variant = DEFAULT_VARIANT, appearance = DEFAULT_APPEARANCE, size = DEFAULT_SIZE2, rounded, dot: dot2 }) => ({
501
+ stateAttrs: ({ variant = DEFAULT_VARIANT2, appearance = DEFAULT_APPEARANCE2, size = DEFAULT_SIZE2, rounded, dot: dot2 }) => ({
309
502
  "data-variant": variant,
310
503
  "data-type": appearance,
311
504
  "data-size": dot2 ? void 0 : size,
@@ -330,13 +523,116 @@ var Badge = (props) => {
330
523
  return /* @__PURE__ */ jsx("span", { ...nativeProps, ...rootAttrs, ref });
331
524
  }
332
525
  return /* @__PURE__ */ jsxs("span", { ...nativeProps, ...rootAttrs, ref, children: [
333
- startContent && /* @__PURE__ */ jsx("span", { ...iconSlotAttrs, children: startContent }),
334
- children && /* @__PURE__ */ jsx("span", { ...labelSlotAttrs, children }),
335
- endContent && /* @__PURE__ */ jsx("span", { ...iconSlotAttrs, children: endContent })
526
+ isRenderableNode(startContent) && /* @__PURE__ */ jsx("span", { ...iconSlotAttrs, children: startContent }),
527
+ isRenderableNode(children) && /* @__PURE__ */ jsx("span", { ...labelSlotAttrs, children }),
528
+ isRenderableNode(endContent) && /* @__PURE__ */ jsx("span", { ...iconSlotAttrs, children: endContent })
336
529
  ] });
337
530
  };
338
531
  Badge.displayName = "Badge";
339
532
 
533
+ // src/components/breadcrumb/base.ts
534
+ var BreadcrumbBase = createComponentBase({
535
+ name: "Breadcrumb",
536
+ slots: ["root"],
537
+ classes: { root: "tk-breadcrumb" }
538
+ });
539
+ var BreadcrumbListBase = createComponentBase({
540
+ name: "BreadcrumbList",
541
+ slots: ["root"],
542
+ classes: { root: "tk-breadcrumb-list" }
543
+ });
544
+ var BreadcrumbItemBase = createComponentBase({
545
+ name: "BreadcrumbItem",
546
+ slots: ["root"],
547
+ classes: { root: "tk-breadcrumb-item" }
548
+ });
549
+ var BreadcrumbLinkBase = createComponentBase({
550
+ name: "BreadcrumbLink",
551
+ slots: ["root"],
552
+ classes: { root: "tk-breadcrumb-link" }
553
+ });
554
+ var BreadcrumbPageBase = createComponentBase({
555
+ name: "BreadcrumbPage",
556
+ slots: ["root"],
557
+ classes: { root: "tk-breadcrumb-page" }
558
+ });
559
+ var BreadcrumbSeparatorBase = createComponentBase({
560
+ name: "BreadcrumbSeparator",
561
+ slots: ["root"],
562
+ classes: { root: "tk-breadcrumb-separator" }
563
+ });
564
+
565
+ // src/components/breadcrumb/context.ts
566
+ var [BreadcrumbProvider] = createSafeContext("BreadcrumbProvider");
567
+
568
+ // src/components/breadcrumb/defaults.ts
569
+ var DEFAULT_SIZE3 = "base";
570
+ var DEFAULT_TYPE2 = "basic";
571
+ var DEFAULT_SEPARATOR_VARIANT = "chevron";
572
+ var Breadcrumb = (props) => {
573
+ const theme = useComponentTheme("Breadcrumb");
574
+ const { rootAttrs, rest } = composeRootAttrs(BreadcrumbBase, props, theme, {
575
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE3, type: type2 = DEFAULT_TYPE2 }) => ({
576
+ "data-size": size2,
577
+ "data-type": type2
578
+ })
579
+ });
580
+ const { size = DEFAULT_SIZE3, type = DEFAULT_TYPE2, children, ref, ...sparProps } = rest;
581
+ const contextValue = useMemo(() => ({ size, type }), [size, type]);
582
+ return /* @__PURE__ */ jsx(BreadcrumbProvider, { value: contextValue, children: /* @__PURE__ */ jsx(Breadcrumb$1, { ...sparProps, ref, ...rootAttrs, children }) });
583
+ };
584
+ Breadcrumb.displayName = "Breadcrumb";
585
+ var BreadcrumbList = (props) => {
586
+ const theme = useComponentTheme("BreadcrumbList");
587
+ const { rootAttrs, rest } = composeRootAttrs(BreadcrumbListBase, props, theme);
588
+ const { children, ref, ...spar } = rest;
589
+ return /* @__PURE__ */ jsx(BreadcrumbList$1, { ...spar, ref, ...rootAttrs, children });
590
+ };
591
+ BreadcrumbList.displayName = "Breadcrumb.List";
592
+ var BreadcrumbItem = (props) => {
593
+ const theme = useComponentTheme("BreadcrumbItem");
594
+ const { rootAttrs, rest } = composeRootAttrs(BreadcrumbItemBase, props, theme);
595
+ const { children, ref, ...spar } = rest;
596
+ return /* @__PURE__ */ jsx(BreadcrumbItem$1, { ...spar, ref, ...rootAttrs, children });
597
+ };
598
+ BreadcrumbItem.displayName = "Breadcrumb.Item";
599
+ var BreadcrumbLink = (props) => {
600
+ const theme = useComponentTheme("BreadcrumbLink");
601
+ const { rootAttrs, rest } = composeRootAttrs(BreadcrumbLinkBase, props, theme);
602
+ const { children, ref, ...spar } = rest;
603
+ return /* @__PURE__ */ jsx(BreadcrumbLink$1, { ...spar, ref, ...rootAttrs, children });
604
+ };
605
+ BreadcrumbLink.displayName = "Breadcrumb.Link";
606
+ var BreadcrumbPage = (props) => {
607
+ const theme = useComponentTheme("BreadcrumbPage");
608
+ const { rootAttrs, rest } = composeRootAttrs(BreadcrumbPageBase, props, theme);
609
+ const { children, ref, ...spar } = rest;
610
+ return /* @__PURE__ */ jsx(BreadcrumbPage$1, { ...spar, ref, ...rootAttrs, children });
611
+ };
612
+ BreadcrumbPage.displayName = "Breadcrumb.Page";
613
+ var DEFAULT_SEPARATOR_ICON = /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx("path", { d: "M6 4L10 8L6 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
614
+ var BreadcrumbSeparator = (props) => {
615
+ const theme = useComponentTheme("BreadcrumbSeparator");
616
+ const { rootAttrs, rest } = composeRootAttrs(BreadcrumbSeparatorBase, props, theme, {
617
+ stateAttrs: ({ variant: variant2 = DEFAULT_SEPARATOR_VARIANT }) => ({
618
+ "data-variant": variant2
619
+ })
620
+ });
621
+ const { variant = DEFAULT_SEPARATOR_VARIANT, children, ref, ...spar } = rest;
622
+ const fallback = variant === "chevron" ? DEFAULT_SEPARATOR_ICON : null;
623
+ return /* @__PURE__ */ jsx(BreadcrumbSeparator$1, { ...spar, ref, ...rootAttrs, children: children ?? fallback });
624
+ };
625
+ BreadcrumbSeparator.displayName = "Breadcrumb.Separator";
626
+
627
+ // src/components/breadcrumb/index.ts
628
+ var Breadcrumb2 = Object.assign(Breadcrumb, {
629
+ List: BreadcrumbList,
630
+ Item: BreadcrumbItem,
631
+ Link: BreadcrumbLink,
632
+ Page: BreadcrumbPage,
633
+ Separator: BreadcrumbSeparator
634
+ });
635
+
340
636
  // src/components/button/base.ts
341
637
  var ButtonBase = createComponentBase({
342
638
  name: "Button",
@@ -350,9 +646,9 @@ var ButtonBase = createComponentBase({
350
646
  });
351
647
 
352
648
  // src/components/button/defaults.ts
353
- var DEFAULT_VARIANT2 = "primary";
354
- var DEFAULT_APPEARANCE2 = "filled";
355
- var DEFAULT_SIZE3 = "base";
649
+ var DEFAULT_VARIANT3 = "primary";
650
+ var DEFAULT_APPEARANCE3 = "filled";
651
+ var DEFAULT_SIZE4 = "base";
356
652
  var Button = (props) => {
357
653
  const theme = useComponentTheme("Button");
358
654
  const { rootAttrs, rest } = composeRootAttrs(ButtonBase, props, theme, {
@@ -360,9 +656,9 @@ var Button = (props) => {
360
656
  // Spar's Button already emits them (see SparButton dataAttributes), so
361
657
  // setting them again would create two sources of truth that drift the
362
658
  // moment Spar renames or extends its vocabulary.
363
- stateAttrs: ({ variant = DEFAULT_VARIANT2, appearance = DEFAULT_APPEARANCE2, size = DEFAULT_SIZE3, rounded, startContent: startContent2, endContent: endContent2, children: children2 }) => {
364
- const hasIcon = !!(startContent2 || endContent2);
365
- const isIconOnly = hasIcon && !children2;
659
+ stateAttrs: ({ variant = DEFAULT_VARIANT3, appearance = DEFAULT_APPEARANCE3, size = DEFAULT_SIZE4, rounded, startContent: startContent2, endContent: endContent2, children: children2 }) => {
660
+ const hasIcon = isRenderableNode(startContent2) || isRenderableNode(endContent2);
661
+ const isIconOnly = hasIcon && !isRenderableNode(children2);
366
662
  return {
367
663
  "data-variant": variant,
368
664
  "data-type": appearance,
@@ -380,7 +676,8 @@ var Button = (props) => {
380
676
  appearance: _appearance,
381
677
  size: _size,
382
678
  rounded: _rounded,
383
- isLoading = false,
679
+ loading = false,
680
+ pressed,
384
681
  startContent,
385
682
  endContent,
386
683
  disabled = false,
@@ -406,15 +703,122 @@ var Button = (props) => {
406
703
  instanceSlotProps: props.slotProps,
407
704
  instanceClassNames: props.classNames
408
705
  });
409
- return /* @__PURE__ */ jsxs(Button$1, { ...sparProps, disabled, isLoading, ref, ...rootAttrs, children: [
410
- isLoading && /* @__PURE__ */ jsx("span", { ...spinnerSlotAttrs }),
411
- startContent && !isLoading && /* @__PURE__ */ jsx("span", { ...contentSlotAttrs, children: startContent }),
412
- children && /* @__PURE__ */ jsx("span", { ...labelSlotAttrs, children }),
413
- endContent && !isLoading && /* @__PURE__ */ jsx("span", { ...contentSlotAttrs, children: endContent })
706
+ return /* @__PURE__ */ jsxs(Button$1, { ...sparProps, disabled, isLoading: loading, isPressed: pressed, ref, ...rootAttrs, children: [
707
+ loading && /* @__PURE__ */ jsx("span", { ...spinnerSlotAttrs }),
708
+ isRenderableNode(startContent) && !loading && /* @__PURE__ */ jsx("span", { ...contentSlotAttrs, children: startContent }),
709
+ isRenderableNode(children) && /* @__PURE__ */ jsx("span", { ...labelSlotAttrs, children }),
710
+ isRenderableNode(endContent) && !loading && /* @__PURE__ */ jsx("span", { ...contentSlotAttrs, children: endContent })
414
711
  ] });
415
712
  };
416
713
  Button.displayName = "Button";
417
714
 
715
+ // src/components/card/base.ts
716
+ var CardBase = createComponentBase({
717
+ name: "Card",
718
+ slots: ["root"],
719
+ classes: { root: "tk-card" }
720
+ });
721
+ var CardHeaderBase = createComponentBase({
722
+ name: "CardHeader",
723
+ slots: ["root"],
724
+ classes: { root: "tk-card-header" }
725
+ });
726
+ var CardTitleBase = createComponentBase({
727
+ name: "CardTitle",
728
+ slots: ["root"],
729
+ classes: { root: "tk-card-title" }
730
+ });
731
+ var CardDescriptionBase = createComponentBase({
732
+ name: "CardDescription",
733
+ slots: ["root"],
734
+ classes: { root: "tk-card-description" }
735
+ });
736
+ var CardBodyBase = createComponentBase({
737
+ name: "CardBody",
738
+ slots: ["root"],
739
+ classes: { root: "tk-card-body" }
740
+ });
741
+ var CardFooterBase = createComponentBase({
742
+ name: "CardFooter",
743
+ slots: ["root"],
744
+ classes: { root: "tk-card-footer" }
745
+ });
746
+ var Card = (props) => {
747
+ const theme = useComponentTheme("Card");
748
+ const { rootAttrs, rest } = composeRootAttrs(CardBase, props, theme);
749
+ const { as, children, ref, ...cardProps } = rest;
750
+ const Component = as ?? "div";
751
+ return /* @__PURE__ */ jsx(Component, { ...cardProps, ref, ...rootAttrs, children });
752
+ };
753
+ Card.displayName = "Card";
754
+
755
+ // src/components/card/defaults.ts
756
+ var DEFAULT_HEADER_TYPE = "basic";
757
+ var DEFAULT_FOOTER_TYPE = "basic";
758
+ var CardHeader = (props) => {
759
+ const theme = useComponentTheme("CardHeader");
760
+ const { rootAttrs, rest } = composeRootAttrs(CardHeaderBase, props, theme, {
761
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE }) => ({
762
+ "data-header-type": headerType
763
+ })
764
+ });
765
+ const { as, headerType: _headerType, children, ref, ...headerProps } = rest;
766
+ const Component = as ?? "div";
767
+ return /* @__PURE__ */ jsx(Component, { ...headerProps, ref, ...rootAttrs, children });
768
+ };
769
+ CardHeader.displayName = "CardHeader";
770
+ var CardTitle = (props) => {
771
+ const theme = useComponentTheme("CardTitle");
772
+ const { rootAttrs, rest } = composeRootAttrs(CardTitleBase, props, theme, {
773
+ // `data-level` reflects the rendered heading element, so emit it only when
774
+ // `level` actually drives the element — i.e. when `as` is not overriding it.
775
+ stateAttrs: ({ as: as2, level: level2 = 5 }) => ({
776
+ "data-level": as2 ? void 0 : String(level2)
777
+ })
778
+ });
779
+ const { as, level = 5, children, ref, ...titleProps } = rest;
780
+ const Component = as ?? `h${level}`;
781
+ return /* @__PURE__ */ jsx(Component, { ...titleProps, ref, ...rootAttrs, children });
782
+ };
783
+ CardTitle.displayName = "CardTitle";
784
+ var CardDescription = (props) => {
785
+ const theme = useComponentTheme("CardDescription");
786
+ const { rootAttrs, rest } = composeRootAttrs(CardDescriptionBase, props, theme);
787
+ const { as, children, ref, ...descriptionProps } = rest;
788
+ const Component = as ?? "p";
789
+ return /* @__PURE__ */ jsx(Component, { ...descriptionProps, ref, ...rootAttrs, children });
790
+ };
791
+ CardDescription.displayName = "CardDescription";
792
+ var CardBody = (props) => {
793
+ const theme = useComponentTheme("CardBody");
794
+ const { rootAttrs, rest } = composeRootAttrs(CardBodyBase, props, theme);
795
+ const { as, children, ref, ...bodyProps } = rest;
796
+ const Component = as ?? "div";
797
+ return /* @__PURE__ */ jsx(Component, { ...bodyProps, ref, ...rootAttrs, children });
798
+ };
799
+ CardBody.displayName = "CardBody";
800
+ var CardFooter = (props) => {
801
+ const theme = useComponentTheme("CardFooter");
802
+ const { rootAttrs, rest } = composeRootAttrs(CardFooterBase, props, theme, {
803
+ stateAttrs: ({ footerType = DEFAULT_FOOTER_TYPE }) => ({
804
+ "data-footer-type": footerType
805
+ })
806
+ });
807
+ const { as, footerType: _footerType, children, ref, ...footerProps } = rest;
808
+ const Component = as ?? "div";
809
+ return /* @__PURE__ */ jsx(Component, { ...footerProps, ref, ...rootAttrs, children });
810
+ };
811
+ CardFooter.displayName = "CardFooter";
812
+
813
+ // src/components/card/index.ts
814
+ var Card2 = Object.assign(Card, {
815
+ Header: CardHeader,
816
+ Title: CardTitle,
817
+ Description: CardDescription,
818
+ Body: CardBody,
819
+ Footer: CardFooter
820
+ });
821
+
418
822
  // src/components/checkbox/base.ts
419
823
  var CheckboxBase = createComponentBase({
420
824
  name: "Checkbox",
@@ -432,14 +836,12 @@ var CheckboxBase = createComponentBase({
432
836
  var [CheckboxProvider, useCheckboxOwnContext] = createSafeContext("CheckboxProvider");
433
837
 
434
838
  // src/components/checkbox/defaults.ts
435
- var DEFAULT_SIZE4 = "base";
436
- var DEFAULT_TYPE2 = "default";
839
+ var DEFAULT_SIZE5 = "base";
437
840
  var Checkbox = (props) => {
438
841
  const theme = useComponentTheme("Checkbox");
439
842
  const { rootAttrs, rest } = composeRootAttrs(CheckboxBase, props, theme, {
440
- stateAttrs: ({ size = DEFAULT_SIZE4, type = DEFAULT_TYPE2 }) => ({
441
- "data-size": size,
442
- "data-type": type
843
+ stateAttrs: ({ size = DEFAULT_SIZE5 }) => ({
844
+ "data-size": size
443
845
  })
444
846
  });
445
847
  const { classNames, slotProps } = props;
@@ -447,7 +849,6 @@ var Checkbox = (props) => {
447
849
  // Visual props are consumed via `stateAttrs`; destructured to keep them
448
850
  // off the rendered DOM where they would leak as raw HTML attributes.
449
851
  size: _size,
450
- type: _type,
451
852
  // `invalid` is forwarded to Spar as `invalid` (same name).
452
853
  invalid = false,
453
854
  // takeoff-spar tri-state vocabulary; mapped to Spar's `CheckedState` below.
@@ -500,21 +901,6 @@ var Checkbox = (props) => {
500
901
  );
501
902
  };
502
903
  Checkbox.displayName = "Checkbox";
503
- var baseSvgProps = {
504
- "xmlns": "http://www.w3.org/2000/svg",
505
- "width": "1em",
506
- "height": "1em",
507
- "viewBox": "0 0 24 24",
508
- "fill": "none",
509
- "stroke": "currentColor",
510
- "strokeWidth": 2,
511
- "strokeLinecap": "round",
512
- "strokeLinejoin": "round",
513
- "focusable": false,
514
- "aria-hidden": true
515
- };
516
- var PlaceholderCheck = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "check", ...props, children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" }) });
517
- var PlaceholderRemove = (props) => /* @__PURE__ */ jsx("svg", { ...baseSvgProps, "data-placeholder-icon": "remove", ...props, children: /* @__PURE__ */ jsx("path", { d: "M5 12h14" }) });
518
904
  var CheckboxIndicator = (props) => {
519
905
  const theme = useComponentTheme("Checkbox");
520
906
  const { classNames, slotProps, checked, indeterminate } = useCheckboxOwnContext("Checkbox.Indicator");
@@ -541,19 +927,141 @@ var Checkbox2 = Object.assign(Checkbox, {
541
927
  Indicator: CheckboxIndicator
542
928
  });
543
929
 
930
+ // src/components/chip/base.ts
931
+ var ChipBase = createComponentBase({
932
+ name: "Chip",
933
+ slots: ["root", "label", "remove"],
934
+ classes: {
935
+ root: "tk-chip",
936
+ label: "tk-chip-label",
937
+ remove: "tk-chip-remove"
938
+ }
939
+ });
940
+
941
+ // src/components/chip/defaults.ts
942
+ var DEFAULT_VARIANT4 = "primary";
943
+ var DEFAULT_APPEARANCE4 = "filled";
944
+ var DEFAULT_SIZE6 = "base";
945
+ var DEFAULT_REMOVE_LABEL = "Remove";
946
+ var Chip = (props) => {
947
+ const theme = useComponentTheme("Chip");
948
+ const [dismissed, setDismissed] = useState(false);
949
+ const { rootAttrs, rest } = composeRootAttrs(ChipBase, props, theme, {
950
+ stateAttrs: ({ variant = DEFAULT_VARIANT4, appearance = DEFAULT_APPEARANCE4, size = DEFAULT_SIZE6, clickable: clickable2 = false, disabled: disabled2 = false, removable: removable2 = false }) => ({
951
+ "data-variant": variant,
952
+ "data-type": appearance,
953
+ "data-size": size,
954
+ "data-clickable": clickable2 ? "" : void 0,
955
+ "data-disabled": disabled2 ? "" : void 0,
956
+ "data-removable": removable2 ? "" : void 0
957
+ })
958
+ });
959
+ const {
960
+ onClick: rootSlotOnClick,
961
+ onKeyDown: rootSlotOnKeyDown,
962
+ ...chipRootAttrs
963
+ } = rootAttrs;
964
+ const {
965
+ variant: _variant,
966
+ appearance: _appearance,
967
+ size: _size,
968
+ autoDismiss = true,
969
+ clickable = false,
970
+ disabled = false,
971
+ removable = false,
972
+ onRemove,
973
+ children,
974
+ ref,
975
+ role,
976
+ tabIndex,
977
+ onClick,
978
+ ...nativeProps
979
+ } = rest;
980
+ const labelSlotAttrs = buildSlotAttrs(ChipBase.getSlotProps("label"), "label", {
981
+ themeSlotProps: theme?.slotProps,
982
+ themeClassNames: theme?.classNames,
983
+ instanceSlotProps: props.slotProps,
984
+ instanceClassNames: props.classNames
985
+ });
986
+ const removeSlotAttrs = buildSlotAttrs(ChipBase.getSlotProps("remove"), "remove", {
987
+ themeSlotProps: theme?.slotProps,
988
+ themeClassNames: theme?.classNames,
989
+ instanceSlotProps: props.slotProps,
990
+ instanceClassNames: props.classNames
991
+ });
992
+ const { onClick: removeSlotOnClick, ...removeButtonAttrs } = removeSlotAttrs;
993
+ const resolvedTabIndex = clickable ? disabled ? -1 : tabIndex ?? 0 : tabIndex;
994
+ const resolvedRole = role ?? (clickable ? "button" : void 0);
995
+ if (dismissed) {
996
+ return null;
997
+ }
998
+ const remove = () => {
999
+ if (disabled || !removable) return;
1000
+ onRemove?.();
1001
+ if (!autoDismiss) return;
1002
+ setDismissed(true);
1003
+ };
1004
+ const handleRemoveClick = (event) => {
1005
+ if (clickable) event.stopPropagation();
1006
+ removeSlotOnClick?.(event);
1007
+ if (event.defaultPrevented) return;
1008
+ remove();
1009
+ };
1010
+ const handleRootClick = (event) => {
1011
+ if (disabled) return;
1012
+ onClick?.(event);
1013
+ rootSlotOnClick?.(event);
1014
+ };
1015
+ const handleKeyDown = (event) => {
1016
+ if (disabled) return;
1017
+ nativeProps.onKeyDown?.(event);
1018
+ rootSlotOnKeyDown?.(event);
1019
+ if (event.defaultPrevented) return;
1020
+ if (clickable && removable && (event.key === "Backspace" || event.key === "Delete")) {
1021
+ event.preventDefault();
1022
+ remove();
1023
+ return;
1024
+ }
1025
+ if (clickable && (event.key === "Enter" || event.key === " ")) {
1026
+ event.preventDefault();
1027
+ event.currentTarget.click();
1028
+ }
1029
+ };
1030
+ return /* @__PURE__ */ jsxs(
1031
+ "span",
1032
+ {
1033
+ ...nativeProps,
1034
+ ...chipRootAttrs,
1035
+ "aria-disabled": disabled || void 0,
1036
+ onClick: handleRootClick,
1037
+ onKeyDown: handleKeyDown,
1038
+ ref,
1039
+ role: resolvedRole,
1040
+ tabIndex: resolvedTabIndex,
1041
+ children: [
1042
+ isRenderableNode(children) && /* @__PURE__ */ jsx("span", { ...labelSlotAttrs, children }),
1043
+ removable && // The icon-only remove control needs an accessible name. Default it,
1044
+ // but let `slotProps.remove` (spread after) override via `aria-label`.
1045
+ /* @__PURE__ */ jsx("button", { "aria-label": DEFAULT_REMOVE_LABEL, ...removeButtonAttrs, disabled, onClick: handleRemoveClick, type: "button", children: /* @__PURE__ */ jsx(PlaceholderClose, {}) })
1046
+ ]
1047
+ }
1048
+ );
1049
+ };
1050
+ Chip.displayName = "Chip";
1051
+
544
1052
  // src/components/drawer/context.ts
545
1053
  var [DrawerProvider, useDrawerOwnContext] = createSafeContext("DrawerProvider");
546
1054
 
547
1055
  // src/components/drawer/defaults.ts
548
1056
  var DEFAULT_PLACEMENT = "right";
549
- var DEFAULT_HEADER_TYPE = "basic";
550
- var DEFAULT_FOOTER_TYPE = "basic";
1057
+ var DEFAULT_HEADER_TYPE2 = "basic";
1058
+ var DEFAULT_FOOTER_TYPE2 = "basic";
551
1059
  var DEFAULT_INTENSITY = "base";
552
1060
  var Drawer = (props) => {
553
1061
  const theme = useComponentTheme("Drawer");
554
1062
  const merged = { ...theme?.defaultProps, ...props };
555
- const { placement = DEFAULT_PLACEMENT, dismissable = true, disabled = false, children, ...sparProps } = merged;
556
- return /* @__PURE__ */ jsx(DrawerProvider, { value: { placement, dismissable }, children: /* @__PURE__ */ jsx(Dialog, { ...sparProps, disabled, forceMount: true, children }) });
1063
+ const { placement = DEFAULT_PLACEMENT, dismissible = true, disabled = false, children, ...sparProps } = merged;
1064
+ return /* @__PURE__ */ jsx(DrawerProvider, { value: { placement, dismissible }, children: /* @__PURE__ */ jsx(Dialog$1, { ...sparProps, disabled, forceMount: true, children }) });
557
1065
  };
558
1066
  Drawer.displayName = "Drawer";
559
1067
 
@@ -598,10 +1106,10 @@ var DrawerFooterBase = createComponentBase({
598
1106
  slots: ["root"],
599
1107
  classes: { root: "tk-drawer-footer" }
600
1108
  });
601
- var DrawerCloseButtonBase = createComponentBase({
602
- name: "DrawerCloseButton",
1109
+ var DrawerCloseBase = createComponentBase({
1110
+ name: "DrawerClose",
603
1111
  slots: ["root"],
604
- classes: { root: "tk-drawer-close-button" }
1112
+ classes: { root: "tk-drawer-close" }
605
1113
  });
606
1114
  var DrawerTriggerBase = createComponentBase({
607
1115
  name: "DrawerTrigger",
@@ -612,42 +1120,43 @@ var DrawerTrigger = (props) => {
612
1120
  const theme = useComponentTheme("DrawerTrigger");
613
1121
  const { rootAttrs, rest } = composeRootAttrs(DrawerTriggerBase, props, theme);
614
1122
  const { children, ref, ...triggerProps } = rest;
615
- return /* @__PURE__ */ jsx(DialogTrigger, { ...triggerProps, ref, ...rootAttrs, children });
1123
+ return /* @__PURE__ */ jsx(DialogTrigger$1, { ...triggerProps, ref, ...rootAttrs, children });
616
1124
  };
617
- DrawerTrigger.displayName = "DrawerTrigger";
1125
+ DrawerTrigger.displayName = "Drawer.Trigger";
618
1126
  var DrawerOverlay = (props) => {
619
1127
  const theme = useComponentTheme("DrawerOverlay");
620
1128
  const { rootAttrs, rest } = composeRootAttrs(DrawerOverlayBase, props, theme, {
621
- stateAttrs: ({ intensity = DEFAULT_INTENSITY, invisible }) => ({
1129
+ stateAttrs: ({ intensity = DEFAULT_INTENSITY, invisible, blur }) => ({
622
1130
  "data-intensity": intensity,
623
- "data-invisible": invisible ? "" : void 0
1131
+ "data-invisible": invisible ? "" : void 0,
1132
+ "data-blur": blur ? "" : void 0
624
1133
  })
625
1134
  });
626
- const { intensity: _intensity, invisible: _invisible, children, ref, ...overlayProps } = rest;
627
- return /* @__PURE__ */ jsx(DialogOverlay, { ...overlayProps, ref, ...rootAttrs, children });
1135
+ const { intensity: _intensity, invisible: _invisible, blur: _blur, children, ref, ...overlayProps } = rest;
1136
+ return /* @__PURE__ */ jsx(DialogOverlay$1, { ...overlayProps, ref, ...rootAttrs, children });
628
1137
  };
629
- DrawerOverlay.displayName = "DrawerOverlay";
630
- var preventDefault = (e) => e.preventDefault();
1138
+ DrawerOverlay.displayName = "Drawer.Overlay";
631
1139
  var DrawerPanel = (props) => {
632
1140
  const theme = useComponentTheme("DrawerPanel");
633
- const { placement, dismissable } = useDrawerOwnContext();
1141
+ const { placement, dismissible } = useDrawerOwnContext();
634
1142
  const { rootAttrs, rest } = composeRootAttrs(DrawerPanelBase, props, theme, {
635
1143
  stateAttrs: () => ({
636
1144
  "data-placement": placement
637
1145
  })
638
1146
  });
639
1147
  const { container, children, ref, ...panelProps } = rest;
640
- const dismissHandlers = !dismissable && {
641
- onEscapeKeyDown: preventDefault,
642
- onPointerDownOutside: preventDefault
1148
+ const dismissHandlers = !dismissible && {
1149
+ onEscapeKeyDown: blockDismiss(panelProps.onEscapeKeyDown),
1150
+ onPointerDownOutside: blockDismiss(panelProps.onPointerDownOutside),
1151
+ onInteractOutside: blockDismiss(panelProps.onInteractOutside)
643
1152
  };
644
1153
  return /* @__PURE__ */ jsx(DialogContent, { ...panelProps, container, ref, ...rootAttrs, ...dismissHandlers, children });
645
1154
  };
646
- DrawerPanel.displayName = "DrawerPanel";
1155
+ DrawerPanel.displayName = "Drawer.Panel";
647
1156
  var DrawerHeader = (props) => {
648
1157
  const theme = useComponentTheme("DrawerHeader");
649
1158
  const { rootAttrs, rest } = composeRootAttrs(DrawerHeaderBase, props, theme, {
650
- stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE }) => ({
1159
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE2 }) => ({
651
1160
  "data-header-type": headerType
652
1161
  })
653
1162
  });
@@ -655,21 +1164,21 @@ var DrawerHeader = (props) => {
655
1164
  const Component = as ?? "div";
656
1165
  return /* @__PURE__ */ jsx(Component, { ...headerProps, ref, ...rootAttrs, children });
657
1166
  };
658
- DrawerHeader.displayName = "DrawerHeader";
1167
+ DrawerHeader.displayName = "Drawer.Header";
659
1168
  var DrawerTitle = (props) => {
660
1169
  const theme = useComponentTheme("DrawerTitle");
661
1170
  const { rootAttrs, rest } = composeRootAttrs(DrawerTitleBase, props, theme);
662
1171
  const { level = 5, children, ref, ...titleProps } = rest;
663
- return /* @__PURE__ */ jsx(DialogTitle, { ...titleProps, level, ref, ...rootAttrs, children });
1172
+ return /* @__PURE__ */ jsx(DialogTitle$1, { ...titleProps, level, ref, ...rootAttrs, children });
664
1173
  };
665
- DrawerTitle.displayName = "DrawerTitle";
1174
+ DrawerTitle.displayName = "Drawer.Title";
666
1175
  var DrawerDescription = (props) => {
667
1176
  const theme = useComponentTheme("DrawerDescription");
668
1177
  const { rootAttrs, rest } = composeRootAttrs(DrawerDescriptionBase, props, theme);
669
1178
  const { children, ref, ...descProps } = rest;
670
- return /* @__PURE__ */ jsx(DialogDescription, { ...descProps, ref, ...rootAttrs, children });
1179
+ return /* @__PURE__ */ jsx(DialogDescription$1, { ...descProps, ref, ...rootAttrs, children });
671
1180
  };
672
- DrawerDescription.displayName = "DrawerDescription";
1181
+ DrawerDescription.displayName = "Drawer.Description";
673
1182
  var DrawerBody = (props) => {
674
1183
  const theme = useComponentTheme("DrawerBody");
675
1184
  const { rootAttrs, rest } = composeRootAttrs(DrawerBodyBase, props, theme);
@@ -677,11 +1186,11 @@ var DrawerBody = (props) => {
677
1186
  const Component = as ?? "div";
678
1187
  return /* @__PURE__ */ jsx(Component, { ...bodyProps, ref, ...rootAttrs, children });
679
1188
  };
680
- DrawerBody.displayName = "DrawerBody";
1189
+ DrawerBody.displayName = "Drawer.Body";
681
1190
  var DrawerFooter = (props) => {
682
1191
  const theme = useComponentTheme("DrawerFooter");
683
1192
  const { rootAttrs, rest } = composeRootAttrs(DrawerFooterBase, props, theme, {
684
- stateAttrs: ({ footerType = DEFAULT_FOOTER_TYPE }) => ({
1193
+ stateAttrs: ({ footerType = DEFAULT_FOOTER_TYPE2 }) => ({
685
1194
  "data-footer-type": footerType
686
1195
  })
687
1196
  });
@@ -689,14 +1198,14 @@ var DrawerFooter = (props) => {
689
1198
  const Component = as ?? "div";
690
1199
  return /* @__PURE__ */ jsx(Component, { ...footerProps, ref, ...rootAttrs, children });
691
1200
  };
692
- DrawerFooter.displayName = "DrawerFooter";
693
- var DrawerCloseButton = (props) => {
694
- const theme = useComponentTheme("DrawerCloseButton");
695
- const { rootAttrs, rest } = composeRootAttrs(DrawerCloseButtonBase, props, theme);
1201
+ DrawerFooter.displayName = "Drawer.Footer";
1202
+ var DrawerClose = (props) => {
1203
+ const theme = useComponentTheme("DrawerClose");
1204
+ const { rootAttrs, rest } = composeRootAttrs(DrawerCloseBase, props, theme);
696
1205
  const { children, ref, ...closeProps } = rest;
697
- return /* @__PURE__ */ jsx(DialogClose, { ...closeProps, ref, ...rootAttrs, children });
1206
+ return /* @__PURE__ */ jsx(DialogClose$1, { ...closeProps, ref, ...rootAttrs, children });
698
1207
  };
699
- DrawerCloseButton.displayName = "DrawerCloseButton";
1208
+ DrawerClose.displayName = "Drawer.Close";
700
1209
 
701
1210
  // src/components/drawer/index.ts
702
1211
  var Drawer2 = Object.assign(Drawer, {
@@ -708,37 +1217,216 @@ var Drawer2 = Object.assign(Drawer, {
708
1217
  Description: DrawerDescription,
709
1218
  Body: DrawerBody,
710
1219
  Footer: DrawerFooter,
711
- CloseButton: DrawerCloseButton
1220
+ Close: DrawerClose
712
1221
  });
713
1222
 
714
- // src/components/field/base.ts
715
- var FieldBase = createComponentBase({
716
- name: "Field",
1223
+ // src/components/dialog/context.ts
1224
+ var [DialogProvider, useDialogOwnContext] = createSafeContext("DialogProvider");
1225
+ var Dialog = (props) => {
1226
+ const theme = useComponentTheme("Dialog");
1227
+ const merged = { ...theme?.defaultProps, ...props };
1228
+ const { dismissible = true, forceMount = true, children, ...sparProps } = merged;
1229
+ return /* @__PURE__ */ jsx(DialogProvider, { value: { dismissible }, children: /* @__PURE__ */ jsx(Dialog$1, { ...sparProps, forceMount, children }) });
1230
+ };
1231
+ Dialog.displayName = "Dialog";
1232
+
1233
+ // src/components/dialog/base.ts
1234
+ var DialogTriggerBase = createComponentBase({
1235
+ name: "DialogTrigger",
717
1236
  slots: ["root"],
718
- classes: { root: "tk-field" }
1237
+ classes: {
1238
+ root: "tk-dialog-trigger"
1239
+ }
719
1240
  });
720
- var FieldLabelBase = createComponentBase({
721
- name: "FieldLabel",
722
- slots: ["root", "asterisk"],
723
- classes: { root: "tk-field-label", asterisk: "tk-field-asterisk" }
1241
+ var DialogOverlayBase = createComponentBase({
1242
+ name: "DialogOverlay",
1243
+ slots: ["root"],
1244
+ classes: {
1245
+ root: "tk-dialog-overlay"
1246
+ }
724
1247
  });
725
- var FieldDescriptionBase = createComponentBase({
726
- name: "FieldDescription",
1248
+ var DialogPanelBase = createComponentBase({
1249
+ name: "DialogPanel",
727
1250
  slots: ["root"],
728
- classes: { root: "tk-field-description" }
1251
+ classes: {
1252
+ root: "tk-dialog-panel"
1253
+ }
729
1254
  });
730
- var FieldErrorMessageBase = createComponentBase({
731
- name: "FieldErrorMessage",
1255
+ var DialogHeaderBase = createComponentBase({
1256
+ name: "DialogHeader",
732
1257
  slots: ["root"],
733
- classes: { root: "tk-field-error-message" }
1258
+ classes: {
1259
+ root: "tk-dialog-header"
1260
+ }
734
1261
  });
735
- var Field = (props) => {
736
- const theme = useComponentTheme("Field");
737
- const { rootAttrs, rest } = composeRootAttrs(FieldBase, props, theme);
1262
+ var DialogTitleBase = createComponentBase({
1263
+ name: "DialogTitle",
1264
+ slots: ["root"],
1265
+ classes: {
1266
+ root: "tk-dialog-title"
1267
+ }
1268
+ });
1269
+ var DialogDescriptionBase = createComponentBase({
1270
+ name: "DialogDescription",
1271
+ slots: ["root"],
1272
+ classes: {
1273
+ root: "tk-dialog-description"
1274
+ }
1275
+ });
1276
+ var DialogBodyBase = createComponentBase({
1277
+ name: "DialogBody",
1278
+ slots: ["root"],
1279
+ classes: {
1280
+ root: "tk-dialog-body"
1281
+ }
1282
+ });
1283
+ var DialogFooterBase = createComponentBase({
1284
+ name: "DialogFooter",
1285
+ slots: ["root"],
1286
+ classes: {
1287
+ root: "tk-dialog-footer"
1288
+ }
1289
+ });
1290
+ var DialogCloseBase = createComponentBase({
1291
+ name: "DialogClose",
1292
+ slots: ["root"],
1293
+ classes: {
1294
+ root: "tk-dialog-close"
1295
+ }
1296
+ });
1297
+ var DialogTrigger = (props) => {
1298
+ const theme = useComponentTheme("DialogTrigger");
1299
+ const { rootAttrs, rest } = composeRootAttrs(DialogTriggerBase, props, theme);
738
1300
  const { children, ref, ...sparProps } = rest;
739
- return /* @__PURE__ */ jsx(Field$1, { ...sparProps, ref, ...rootAttrs, children });
1301
+ return /* @__PURE__ */ jsx(DialogTrigger$1, { ...sparProps, ...rootAttrs, ref, children });
740
1302
  };
741
- Field.displayName = "Field";
1303
+ DialogTrigger.displayName = "Dialog.Trigger";
1304
+
1305
+ // src/components/dialog/defaults.ts
1306
+ var DEFAULT_INTENSITY2 = "base";
1307
+ var DEFAULT_HEADER_TYPE3 = "basic";
1308
+ var DEFAULT_FOOTER_TYPE3 = "basic";
1309
+ var DialogOverlay = (props) => {
1310
+ const theme = useComponentTheme("DialogOverlay");
1311
+ const { rootAttrs, rest } = composeRootAttrs(DialogOverlayBase, props, theme, {
1312
+ stateAttrs: ({ intensity = DEFAULT_INTENSITY2, invisible, blur }) => ({
1313
+ "data-intensity": intensity,
1314
+ "data-invisible": invisible ? "" : void 0,
1315
+ "data-blur": blur ? "" : void 0
1316
+ })
1317
+ });
1318
+ const { intensity: _intensity, invisible: _invisible, blur: _blur, children, ref, ...sparProps } = rest;
1319
+ return /* @__PURE__ */ jsx(DialogOverlay$1, { ...sparProps, ...rootAttrs, ref, children });
1320
+ };
1321
+ DialogOverlay.displayName = "Dialog.Overlay";
1322
+ var DialogPanel = (props) => {
1323
+ const theme = useComponentTheme("DialogPanel");
1324
+ const { dismissible } = useDialogOwnContext();
1325
+ const { rootAttrs, rest } = composeRootAttrs(DialogPanelBase, props, theme);
1326
+ const { children, ref, ...sparProps } = rest;
1327
+ const dismissHandlers = !dismissible && {
1328
+ onEscapeKeyDown: blockDismiss(sparProps.onEscapeKeyDown),
1329
+ onPointerDownOutside: blockDismiss(sparProps.onPointerDownOutside),
1330
+ onInteractOutside: blockDismiss(sparProps.onInteractOutside)
1331
+ };
1332
+ return /* @__PURE__ */ jsx(DialogContent, { ...sparProps, ...rootAttrs, ref, ...dismissHandlers, children });
1333
+ };
1334
+ DialogPanel.displayName = "Dialog.Panel";
1335
+ var DialogHeader = (props) => {
1336
+ const theme = useComponentTheme("DialogHeader");
1337
+ const { rootAttrs, rest } = composeRootAttrs(DialogHeaderBase, props, theme, {
1338
+ stateAttrs: ({ headerType = DEFAULT_HEADER_TYPE3 }) => ({
1339
+ "data-header-type": headerType
1340
+ })
1341
+ });
1342
+ const { as, headerType: _headerType, children, ref, ...headerProps } = rest;
1343
+ const Component = as ?? "div";
1344
+ return /* @__PURE__ */ jsx(Component, { ...headerProps, ref, ...rootAttrs, children });
1345
+ };
1346
+ DialogHeader.displayName = "Dialog.Header";
1347
+ var DialogTitle = (props) => {
1348
+ const theme = useComponentTheme("DialogTitle");
1349
+ const { rootAttrs, rest } = composeRootAttrs(DialogTitleBase, props, theme);
1350
+ const { level = 5, children, ref, ...titleProps } = rest;
1351
+ return /* @__PURE__ */ jsx(DialogTitle$1, { ...titleProps, level, ref, ...rootAttrs, children });
1352
+ };
1353
+ DialogTitle.displayName = "Dialog.Title";
1354
+ var DialogDescription = (props) => {
1355
+ const theme = useComponentTheme("DialogDescription");
1356
+ const { rootAttrs, rest } = composeRootAttrs(DialogDescriptionBase, props, theme);
1357
+ const { children, ref, ...sparProps } = rest;
1358
+ return /* @__PURE__ */ jsx(DialogDescription$1, { ...sparProps, ...rootAttrs, ref, children });
1359
+ };
1360
+ DialogDescription.displayName = "Dialog.Description";
1361
+ var DialogBody = (props) => {
1362
+ const theme = useComponentTheme("DialogBody");
1363
+ const { rootAttrs, rest } = composeRootAttrs(DialogBodyBase, props, theme);
1364
+ const { as, children, ref, ...bodyProps } = rest;
1365
+ const Component = as ?? "div";
1366
+ return /* @__PURE__ */ jsx(Component, { ...bodyProps, ref, ...rootAttrs, children });
1367
+ };
1368
+ DialogBody.displayName = "Dialog.Body";
1369
+ var DialogFooter = (props) => {
1370
+ const theme = useComponentTheme("DialogFooter");
1371
+ const { rootAttrs, rest } = composeRootAttrs(DialogFooterBase, props, theme, {
1372
+ stateAttrs: ({ footerType = DEFAULT_FOOTER_TYPE3 }) => ({
1373
+ "data-footer-type": footerType
1374
+ })
1375
+ });
1376
+ const { as, footerType: _footerType, children, ref, ...footerProps } = rest;
1377
+ const Component = as ?? "div";
1378
+ return /* @__PURE__ */ jsx(Component, { ...footerProps, ref, ...rootAttrs, children });
1379
+ };
1380
+ DialogFooter.displayName = "Dialog.Footer";
1381
+ var DialogClose = (props) => {
1382
+ const theme = useComponentTheme("DialogClose");
1383
+ const { rootAttrs, rest } = composeRootAttrs(DialogCloseBase, props, theme);
1384
+ const { children, ref, ...sparProps } = rest;
1385
+ return /* @__PURE__ */ jsx(DialogClose$1, { ...sparProps, ...rootAttrs, ref, children });
1386
+ };
1387
+ DialogClose.displayName = "Dialog.Close";
1388
+
1389
+ // src/components/dialog/index.ts
1390
+ var Dialog2 = Object.assign(Dialog, {
1391
+ Trigger: DialogTrigger,
1392
+ Overlay: DialogOverlay,
1393
+ Panel: DialogPanel,
1394
+ Header: DialogHeader,
1395
+ Title: DialogTitle,
1396
+ Description: DialogDescription,
1397
+ Body: DialogBody,
1398
+ Footer: DialogFooter,
1399
+ Close: DialogClose
1400
+ });
1401
+
1402
+ // src/components/field/base.ts
1403
+ var FieldBase = createComponentBase({
1404
+ name: "Field",
1405
+ slots: ["root"],
1406
+ classes: { root: "tk-field" }
1407
+ });
1408
+ var FieldLabelBase = createComponentBase({
1409
+ name: "FieldLabel",
1410
+ slots: ["root", "asterisk"],
1411
+ classes: { root: "tk-field-label", asterisk: "tk-field-asterisk" }
1412
+ });
1413
+ var FieldDescriptionBase = createComponentBase({
1414
+ name: "FieldDescription",
1415
+ slots: ["root", "icon"],
1416
+ classes: { root: "tk-field-description", icon: "tk-field-description-icon" }
1417
+ });
1418
+ var FieldErrorMessageBase = createComponentBase({
1419
+ name: "FieldErrorMessage",
1420
+ slots: ["root", "icon"],
1421
+ classes: { root: "tk-field-error-message", icon: "tk-field-error-message-icon" }
1422
+ });
1423
+ var Field = (props) => {
1424
+ const theme = useComponentTheme("Field");
1425
+ const { rootAttrs, rest } = composeRootAttrs(FieldBase, props, theme);
1426
+ const { children, ref, ...sparProps } = rest;
1427
+ return /* @__PURE__ */ jsx(Field$1, { ...sparProps, ref, ...rootAttrs, children });
1428
+ };
1429
+ Field.displayName = "Field";
742
1430
  var FieldLabel = (props) => {
743
1431
  const theme = useComponentTheme("FieldLabel");
744
1432
  const { required } = useFieldContext();
@@ -760,14 +1448,34 @@ var FieldDescription = (props) => {
760
1448
  const theme = useComponentTheme("FieldDescription");
761
1449
  const { rootAttrs, rest } = composeRootAttrs(FieldDescriptionBase, props, theme);
762
1450
  const { children, ref, ...spar } = rest;
763
- return /* @__PURE__ */ jsx(FieldDescription$1, { ...spar, ref, ...rootAttrs, children });
1451
+ const iconAttrs = buildSlotAttrs(FieldDescriptionBase.getSlotProps("icon"), "icon", {
1452
+ themeSlotProps: theme?.slotProps,
1453
+ themeClassNames: theme?.classNames,
1454
+ instanceSlotProps: props.slotProps,
1455
+ instanceClassNames: props.classNames
1456
+ });
1457
+ const hasContent = children != null && children !== "";
1458
+ return /* @__PURE__ */ jsxs(FieldDescription$1, { ...spar, ref, ...rootAttrs, children: [
1459
+ hasContent && /* @__PURE__ */ jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsx(PlaceholderInfo, {}) }),
1460
+ children
1461
+ ] });
764
1462
  };
765
1463
  FieldDescription.displayName = "Field.Description";
766
1464
  var FieldErrorMessage = (props) => {
767
1465
  const theme = useComponentTheme("FieldErrorMessage");
768
1466
  const { rootAttrs, rest } = composeRootAttrs(FieldErrorMessageBase, props, theme);
769
1467
  const { children, ref, ...spar } = rest;
770
- return /* @__PURE__ */ jsx(FieldErrorMessage$1, { ...spar, ref, ...rootAttrs, children });
1468
+ const iconAttrs = buildSlotAttrs(FieldErrorMessageBase.getSlotProps("icon"), "icon", {
1469
+ themeSlotProps: theme?.slotProps,
1470
+ themeClassNames: theme?.classNames,
1471
+ instanceSlotProps: props.slotProps,
1472
+ instanceClassNames: props.classNames
1473
+ });
1474
+ const hasContent = children != null && children !== "";
1475
+ return /* @__PURE__ */ jsxs(FieldErrorMessage$1, { ...spar, ref, ...rootAttrs, children: [
1476
+ hasContent && /* @__PURE__ */ jsx("span", { ...iconAttrs, "aria-hidden": "true", children: /* @__PURE__ */ jsx(PlaceholderError, {}) }),
1477
+ children
1478
+ ] });
771
1479
  };
772
1480
  FieldErrorMessage.displayName = "Field.ErrorMessage";
773
1481
 
@@ -784,15 +1492,6 @@ var InputBase = createComponentBase({
784
1492
  slots: ["root"],
785
1493
  classes: { root: "tk-input" }
786
1494
  });
787
- var InputContainerBase = createComponentBase({
788
- name: "InputContainer",
789
- slots: ["root", "startContent", "endContent"],
790
- classes: {
791
- root: "tk-input-container",
792
- startContent: "tk-input-start-content",
793
- endContent: "tk-input-end-content"
794
- }
795
- });
796
1495
  var InputFieldBase = createComponentBase({
797
1496
  name: "InputField",
798
1497
  slots: ["root"],
@@ -808,84 +1507,541 @@ var InputSuffixBase = createComponentBase({
808
1507
  slots: ["root"],
809
1508
  classes: { root: "tk-input-suffix" }
810
1509
  });
1510
+ var InputLeadingIconBase = createComponentBase({
1511
+ name: "InputLeadingIcon",
1512
+ slots: ["root"],
1513
+ classes: { root: "tk-input-leading-icon" }
1514
+ });
1515
+ var InputTrailingIconBase = createComponentBase({
1516
+ name: "InputTrailingIcon",
1517
+ slots: ["root"],
1518
+ classes: { root: "tk-input-trailing-icon" }
1519
+ });
1520
+ var InputClearButtonBase = createComponentBase({
1521
+ name: "InputClearButton",
1522
+ slots: ["root"],
1523
+ classes: { root: "tk-input-clear-button" }
1524
+ });
1525
+ var InputSpinnerBase = createComponentBase({
1526
+ name: "InputSpinner",
1527
+ slots: ["root"],
1528
+ classes: { root: "tk-input-spinner" }
1529
+ });
1530
+ var InputRevealButtonBase = createComponentBase({
1531
+ name: "InputRevealButton",
1532
+ slots: ["root"],
1533
+ classes: { root: "tk-input-reveal-button" }
1534
+ });
1535
+ var InputStrengthBase = createComponentBase({
1536
+ name: "InputStrength",
1537
+ slots: ["root"],
1538
+ classes: { root: "tk-input-strength" }
1539
+ });
1540
+ var InputStepperBase = createComponentBase({
1541
+ name: "InputStepper",
1542
+ slots: ["root"],
1543
+ classes: { root: "tk-input-stepper" }
1544
+ });
1545
+ var InputDecrementBase = createComponentBase({
1546
+ name: "InputDecrement",
1547
+ slots: ["root"],
1548
+ classes: { root: "tk-input-decrement" }
1549
+ });
1550
+ var InputIncrementBase = createComponentBase({
1551
+ name: "InputIncrement",
1552
+ slots: ["root"],
1553
+ classes: { root: "tk-input-increment" }
1554
+ });
1555
+ var InputChipsBase = createComponentBase({
1556
+ name: "InputChips",
1557
+ slots: ["root"],
1558
+ classes: { root: "tk-input-chips" }
1559
+ });
811
1560
 
812
1561
  // src/components/input/context.ts
813
1562
  var [InputProvider, useInputOwnContext] = createSafeContext("InputProvider");
814
1563
 
815
1564
  // src/components/input/defaults.ts
816
- var DEFAULT_SIZE5 = "base";
1565
+ var DEFAULT_SIZE7 = "base";
1566
+ var SEGMENT_COUNT = 4;
1567
+ var computeStrength = (value) => {
1568
+ let strength = 0;
1569
+ if (value.length >= 8) strength += 1;
1570
+ if (/[A-Z]/.test(value)) strength += 1;
1571
+ if (/[a-z]/.test(value)) strength += 1;
1572
+ if (/[0-9]/.test(value)) strength += 1;
1573
+ if (/[^A-Za-z0-9]/.test(value)) strength += 1;
1574
+ return strength;
1575
+ };
1576
+ var levelFor = (strength) => strength < 3 ? "weak" : strength < 4 ? "medium" : "strong";
1577
+ var InputStrength = (props) => {
1578
+ const theme = useComponentTheme("InputStrength");
1579
+ const { fieldValue } = useInputOwnContext("Input.Strength");
1580
+ const Component = props.as ?? "div";
1581
+ const { rootAttrs, rest } = composeRootAttrs(InputStrengthBase, props, theme);
1582
+ const { as: _as, children: _children, ref, ...rendered } = rest;
1583
+ const strength = computeStrength(fieldValue);
1584
+ const filled = Math.min(strength, SEGMENT_COUNT);
1585
+ const level = levelFor(strength);
1586
+ return /* @__PURE__ */ jsx(Component, { ...rendered, ref, ...rootAttrs, children: Array.from({ length: SEGMENT_COUNT }, (_, index) => /* @__PURE__ */ jsx("span", { className: "tk-input-strength-segment", "data-level": index < filled ? level : void 0 }, index)) });
1587
+ };
1588
+ InputStrength.displayName = "Input.Strength";
817
1589
  var Input = (props) => {
818
1590
  const theme = useComponentTheme("Input");
1591
+ const fieldRef = useRef(null);
1592
+ const [fieldNode, setFieldNode] = useState(null);
1593
+ const [fieldValue, setFieldValue] = useState("");
1594
+ const [revealed, setRevealed] = useState(false);
1595
+ const toggleReveal = useCallback(() => setRevealed((value) => !value), []);
1596
+ const clearablesRef = useRef(/* @__PURE__ */ new Map());
1597
+ const [hasAuxContent, setHasAuxContent] = useState(false);
1598
+ const setClearable = useCallback((id, entry) => {
1599
+ if (entry) {
1600
+ clearablesRef.current.set(id, entry);
1601
+ } else {
1602
+ clearablesRef.current.delete(id);
1603
+ }
1604
+ let any = false;
1605
+ for (const value of clearablesRef.current.values()) {
1606
+ if (value.hasContent) {
1607
+ any = true;
1608
+ break;
1609
+ }
1610
+ }
1611
+ setHasAuxContent(any);
1612
+ }, []);
1613
+ const clearAux = useCallback(() => {
1614
+ for (const value of clearablesRef.current.values()) value.clear();
1615
+ }, []);
819
1616
  const { rootAttrs, rest } = composeRootAttrs(InputBase, props, theme, {
820
- stateAttrs: ({ size: size2 = DEFAULT_SIZE5 }) => ({
1617
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE7 }) => ({
821
1618
  "data-size": size2
822
1619
  })
823
1620
  });
824
- const { size = DEFAULT_SIZE5, children, ref, ...sparProps } = rest;
825
- return /* @__PURE__ */ jsx(InputProvider, { value: { size }, children: /* @__PURE__ */ jsx(Input$1, { ...sparProps, ref, ...rootAttrs, children }) });
1621
+ const { size = DEFAULT_SIZE7, children, ref, ...sparProps } = rest;
1622
+ const contextValue = useMemo(
1623
+ () => ({
1624
+ size,
1625
+ fieldRef,
1626
+ fieldNode,
1627
+ setFieldNode,
1628
+ fieldValue,
1629
+ setFieldValue,
1630
+ revealed,
1631
+ setRevealed,
1632
+ toggleReveal,
1633
+ setClearable,
1634
+ hasAuxContent,
1635
+ clearAux
1636
+ }),
1637
+ [size, fieldNode, fieldValue, revealed, setFieldValue, setRevealed, toggleReveal, setClearable, hasAuxContent, clearAux]
1638
+ );
1639
+ const rowChildren = [];
1640
+ const belowChildren = [];
1641
+ Children.forEach(children, (child) => {
1642
+ if (isValidElement(child) && child.type === InputStrength) {
1643
+ belowChildren.push(child);
1644
+ } else {
1645
+ rowChildren.push(child);
1646
+ }
1647
+ });
1648
+ return /* @__PURE__ */ jsxs(InputProvider, { value: contextValue, children: [
1649
+ /* @__PURE__ */ jsx(Input$1, { ...sparProps, ref, ...rootAttrs, children: rowChildren }),
1650
+ belowChildren
1651
+ ] });
826
1652
  };
827
1653
  Input.displayName = "Input";
828
- var InputContainer = (props) => {
829
- const theme = useComponentTheme("InputContainer");
830
- const { invalid, disabled, readOnly } = useInputContext();
831
- const Component = props.as ?? "div";
832
- const { rootAttrs, rest } = composeRootAttrs(InputContainerBase, props, theme, {
833
- stateAttrs: () => ({
834
- "data-invalid": invalid ? "" : void 0,
835
- "data-disabled": disabled ? "" : void 0,
836
- "data-readonly": readOnly ? "" : void 0
837
- })
838
- });
839
- const { as: _as, children, startContent, endContent, ref, ...rendered } = rest;
840
- const slotAttrs = (slot) => buildSlotAttrs(InputContainerBase.getSlotProps(slot), slot, {
841
- themeSlotProps: theme?.slotProps,
842
- themeClassNames: theme?.classNames,
843
- instanceSlotProps: props.slotProps,
844
- instanceClassNames: props.classNames
845
- });
1654
+
1655
+ // src/components/input/dom.ts
1656
+ var setNativeValue = (field, value) => {
1657
+ const prototype = field instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
1658
+ const valueSetter = Object.getOwnPropertyDescriptor(prototype, "value")?.set;
1659
+ valueSetter?.call(field, value);
1660
+ field.dispatchEvent(new Event("input", { bubbles: true }));
1661
+ };
1662
+ var stepField = (field, direction) => {
1663
+ if (!(field instanceof HTMLInputElement)) return;
1664
+ try {
1665
+ if (direction === "up") {
1666
+ field.stepUp();
1667
+ } else {
1668
+ field.stepDown();
1669
+ }
1670
+ } catch {
1671
+ return;
1672
+ }
1673
+ field.dispatchEvent(new Event("input", { bubbles: true }));
1674
+ field.focus();
1675
+ };
1676
+ var InputChips = (props) => {
1677
+ const theme = useComponentTheme("InputChips");
1678
+ const { disabled, readOnly } = useInputContext();
1679
+ const { size, fieldNode, setClearable } = useInputOwnContext("Input.Chips");
1680
+ const { rootAttrs, rest } = composeRootAttrs(InputChipsBase, props, theme);
1681
+ const { as, value, defaultValue, onValueChange, separator, max, allowDuplicates = false, children, ref, ...rendered } = rest;
1682
+ const Component = as ?? "div";
1683
+ const [chips = [], setChips] = useControllableState(value, defaultValue ?? [], onValueChange);
1684
+ const addChip = useCallback(
1685
+ (raw) => {
1686
+ if (disabled || readOnly) return;
1687
+ const label = raw.trim();
1688
+ if (!label) return;
1689
+ if (max !== void 0 && chips.length >= max) return;
1690
+ if (!allowDuplicates && chips.includes(label)) return;
1691
+ setChips([...chips, label]);
1692
+ },
1693
+ [chips, disabled, readOnly, max, allowDuplicates, setChips]
1694
+ );
1695
+ const removeChip = useCallback(
1696
+ (index) => {
1697
+ if (disabled || readOnly) return;
1698
+ setChips(chips.filter((_, i) => i !== index));
1699
+ },
1700
+ [chips, disabled, readOnly, setChips]
1701
+ );
1702
+ const removeLast = useCallback(() => {
1703
+ if (disabled || readOnly || chips.length === 0) return;
1704
+ setChips(chips.slice(0, -1));
1705
+ }, [chips, disabled, readOnly, setChips]);
1706
+ const clearId = useRef(/* @__PURE__ */ Symbol("input-chips")).current;
1707
+ const clearAll = useCallback(() => {
1708
+ if (disabled || readOnly) return;
1709
+ setChips([]);
1710
+ }, [disabled, readOnly, setChips]);
1711
+ useEffect(() => {
1712
+ setClearable(clearId, { hasContent: chips.length > 0, clear: clearAll });
1713
+ return () => setClearable(clearId, null);
1714
+ }, [clearId, chips.length, clearAll, setClearable]);
1715
+ useEffect(() => {
1716
+ const field = fieldNode;
1717
+ if (!field) return;
1718
+ const handleKeyDown = (event) => {
1719
+ if (event.isComposing) return;
1720
+ if (event.key === "Enter" || separator && event.key === separator) {
1721
+ if (!field.value.trim()) return;
1722
+ event.preventDefault();
1723
+ addChip(field.value);
1724
+ setNativeValue(field, "");
1725
+ } else if (event.key === "Backspace" && field.value === "") {
1726
+ removeLast();
1727
+ }
1728
+ };
1729
+ field.addEventListener("keydown", handleKeyDown);
1730
+ return () => field.removeEventListener("keydown", handleKeyDown);
1731
+ }, [fieldNode, addChip, removeLast, separator]);
846
1732
  return /* @__PURE__ */ jsxs(Component, { ...rendered, ref, ...rootAttrs, children: [
847
- startContent != null && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", ...slotAttrs("startContent"), children: startContent }),
848
- children,
849
- endContent != null && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", ...slotAttrs("endContent"), children: endContent })
1733
+ chips.map((chip, index) => (
1734
+ // Render the shared Chip token in the input's neutral/outlined parity
1735
+ // look. `autoDismiss={false}` because Input.Chips owns the tag array
1736
+ // removal must flow through onRemove into our state, not the chip's own.
1737
+ /* @__PURE__ */ jsx(
1738
+ Chip,
1739
+ {
1740
+ appearance: "outlined",
1741
+ variant: "neutral",
1742
+ size,
1743
+ removable: !disabled && !readOnly,
1744
+ disabled: disabled || readOnly,
1745
+ autoDismiss: false,
1746
+ slotProps: { remove: { "aria-label": `Remove ${chip}` } },
1747
+ onRemove: () => removeChip(index),
1748
+ children: chip
1749
+ },
1750
+ `${chip}-${index}`
1751
+ )
1752
+ )),
1753
+ children
850
1754
  ] });
851
1755
  };
852
- InputContainer.displayName = "Input.Container";
1756
+ InputChips.displayName = "Input.Chips";
1757
+ var InputClearButton = (props) => {
1758
+ const theme = useComponentTheme("InputClearButton");
1759
+ const { disabled, readOnly } = useInputContext();
1760
+ const { size, fieldRef, fieldValue, setFieldValue, hasAuxContent, clearAux } = useInputOwnContext("Input.ClearButton");
1761
+ const { rootAttrs, rest } = composeRootAttrs(InputClearButtonBase, props, theme);
1762
+ const {
1763
+ onClick: slotOnClick,
1764
+ onKeyDown: slotOnKeyDown,
1765
+ ...clearRootAttrs
1766
+ } = rootAttrs;
1767
+ const { children, onClear, onClick, onKeyDown, ref, "type": _type, "aria-label": ariaLabel = "Clear input", ...buttonProps } = rest;
1768
+ if (disabled || readOnly || fieldValue === "" && !hasAuxContent) return null;
1769
+ const clear = () => {
1770
+ clearAux();
1771
+ const field = fieldRef.current;
1772
+ if (field) {
1773
+ setNativeValue(field, "");
1774
+ setFieldValue("");
1775
+ }
1776
+ onClear?.();
1777
+ field?.focus();
1778
+ };
1779
+ const handleClick = (event) => {
1780
+ onClick?.(event);
1781
+ slotOnClick?.(event);
1782
+ if (event.defaultPrevented) return;
1783
+ clear();
1784
+ };
1785
+ const handleKeyDown = (event) => {
1786
+ onKeyDown?.(event);
1787
+ slotOnKeyDown?.(event);
1788
+ if (event.defaultPrevented || event.key !== "Escape") return;
1789
+ event.preventDefault();
1790
+ clear();
1791
+ };
1792
+ return /* @__PURE__ */ jsx(
1793
+ Button,
1794
+ {
1795
+ ...buttonProps,
1796
+ ...clearRootAttrs,
1797
+ ref,
1798
+ type: "button",
1799
+ appearance: "text",
1800
+ rounded: true,
1801
+ size,
1802
+ "aria-label": ariaLabel,
1803
+ onClick: handleClick,
1804
+ onKeyDown: handleKeyDown,
1805
+ startContent: children ?? /* @__PURE__ */ jsx(PlaceholderClose, {})
1806
+ }
1807
+ );
1808
+ };
1809
+ InputClearButton.displayName = "Input.ClearButton";
1810
+ var InputDecrement = (props) => {
1811
+ const theme = useComponentTheme("InputDecrement");
1812
+ const { disabled, readOnly } = useInputContext();
1813
+ const { size, fieldRef } = useInputOwnContext("Input.Decrement");
1814
+ const { rootAttrs, rest } = composeRootAttrs(InputDecrementBase, props, theme);
1815
+ const { onClick: slotOnClick, ...decrementRootAttrs } = rootAttrs;
1816
+ const { children, onClick, ref, "type": _type, "disabled": _disabled, "aria-label": ariaLabel = "Decrement value", ...buttonProps } = rest;
1817
+ const handleClick = (event) => {
1818
+ onClick?.(event);
1819
+ slotOnClick?.(event);
1820
+ if (event.defaultPrevented) return;
1821
+ stepField(fieldRef.current, "down");
1822
+ };
1823
+ return /* @__PURE__ */ jsx(
1824
+ Button,
1825
+ {
1826
+ ...buttonProps,
1827
+ ...decrementRootAttrs,
1828
+ ref,
1829
+ type: "button",
1830
+ appearance: "text",
1831
+ rounded: true,
1832
+ size,
1833
+ disabled: disabled || readOnly,
1834
+ "aria-label": ariaLabel,
1835
+ onClick: handleClick,
1836
+ startContent: children ?? /* @__PURE__ */ jsx(PlaceholderChevronDown, {})
1837
+ }
1838
+ );
1839
+ };
1840
+ InputDecrement.displayName = "Input.Decrement";
853
1841
  var InputField = (props) => {
854
1842
  const theme = useComponentTheme("InputField");
855
- const { size } = useInputOwnContext("Input.Field");
856
- const { rootAttrs, rest } = composeRootAttrs(InputFieldBase, props, theme, {
857
- stateAttrs: () => ({
858
- "data-size": size
859
- })
860
- });
861
- const { ref, ...spar } = rest;
862
- return /* @__PURE__ */ jsx(InputField$1, { ...spar, ref, ...rootAttrs });
1843
+ const { fieldRef, setFieldNode, setFieldValue, revealed, setRevealed } = useInputOwnContext("Input.Field");
1844
+ const { rootAttrs, rest } = composeRootAttrs(InputFieldBase, props, theme);
1845
+ const { as, ref, type, onInput, onChange, ...spar } = rest;
1846
+ const effectiveType = type === "password" && revealed ? "text" : type;
1847
+ const renderedType = as === "textarea" ? void 0 : effectiveType;
1848
+ const setFieldRef = useCallback(
1849
+ (node) => {
1850
+ fieldRef.current = node;
1851
+ setFieldNode(node);
1852
+ if (node) setFieldValue(node.value);
1853
+ if (typeof ref === "function") {
1854
+ ref(node);
1855
+ } else if (ref) {
1856
+ ref.current = node;
1857
+ }
1858
+ },
1859
+ [fieldRef, ref, setFieldNode, setFieldValue]
1860
+ );
1861
+ useEffect(() => {
1862
+ const node = fieldRef.current;
1863
+ if (node) setFieldValue(node.value);
1864
+ }, [fieldRef, setFieldValue, spar.value, spar.defaultValue]);
1865
+ useEffect(() => () => setRevealed(false), [setRevealed]);
1866
+ const handleInput = (event) => {
1867
+ onInput?.(event);
1868
+ setFieldValue(event.currentTarget.value);
1869
+ };
1870
+ const handleChange = (event) => {
1871
+ onChange?.(event);
1872
+ setFieldValue(event.currentTarget.value);
1873
+ };
1874
+ return /* @__PURE__ */ jsx(
1875
+ InputField$1,
1876
+ {
1877
+ ...spar,
1878
+ as,
1879
+ type: renderedType,
1880
+ onInput: handleInput,
1881
+ onChange: handleChange,
1882
+ ref: setFieldRef,
1883
+ ...rootAttrs
1884
+ }
1885
+ );
863
1886
  };
864
1887
  InputField.displayName = "Input.Field";
1888
+ var InputIncrement = (props) => {
1889
+ const theme = useComponentTheme("InputIncrement");
1890
+ const { disabled, readOnly } = useInputContext();
1891
+ const { size, fieldRef } = useInputOwnContext("Input.Increment");
1892
+ const { rootAttrs, rest } = composeRootAttrs(InputIncrementBase, props, theme);
1893
+ const { onClick: slotOnClick, ...incrementRootAttrs } = rootAttrs;
1894
+ const { children, onClick, ref, "type": _type, "disabled": _disabled, "aria-label": ariaLabel = "Increment value", ...buttonProps } = rest;
1895
+ const handleClick = (event) => {
1896
+ onClick?.(event);
1897
+ slotOnClick?.(event);
1898
+ if (event.defaultPrevented) return;
1899
+ stepField(fieldRef.current, "up");
1900
+ };
1901
+ return /* @__PURE__ */ jsx(
1902
+ Button,
1903
+ {
1904
+ ...buttonProps,
1905
+ ...incrementRootAttrs,
1906
+ ref,
1907
+ type: "button",
1908
+ appearance: "text",
1909
+ rounded: true,
1910
+ size,
1911
+ disabled: disabled || readOnly,
1912
+ "aria-label": ariaLabel,
1913
+ onClick: handleClick,
1914
+ startContent: children ?? /* @__PURE__ */ jsx(PlaceholderChevronUp, {})
1915
+ }
1916
+ );
1917
+ };
1918
+ InputIncrement.displayName = "Input.Increment";
1919
+ var InputLeadingIcon = (props) => {
1920
+ const theme = useComponentTheme("InputLeadingIcon");
1921
+ useInputOwnContext("Input.LeadingIcon");
1922
+ const Component = props.as ?? "span";
1923
+ const { rootAttrs, rest } = composeRootAttrs(InputLeadingIconBase, props, theme);
1924
+ const { as: _as, children, ref, ...rendered } = rest;
1925
+ return /* @__PURE__ */ jsx(Component, { "aria-hidden": "true", ...rendered, ref, ...rootAttrs, children });
1926
+ };
1927
+ InputLeadingIcon.displayName = "Input.LeadingIcon";
865
1928
  var InputPrefix = (props) => {
866
1929
  const theme = useComponentTheme("InputPrefix");
1930
+ useInputOwnContext("Input.Prefix");
867
1931
  const Component = props.as ?? "span";
868
1932
  const { rootAttrs, rest } = composeRootAttrs(InputPrefixBase, props, theme);
869
1933
  const { as: _as, children, ref, ...rendered } = rest;
870
1934
  return /* @__PURE__ */ jsx(Component, { ...rendered, ref, ...rootAttrs, children });
871
1935
  };
872
1936
  InputPrefix.displayName = "Input.Prefix";
1937
+ var InputRevealButton = (props) => {
1938
+ const theme = useComponentTheme("InputRevealButton");
1939
+ const { disabled, readOnly } = useInputContext();
1940
+ const { size, fieldRef, revealed, setRevealed, toggleReveal } = useInputOwnContext("Input.RevealButton");
1941
+ const { rootAttrs, rest } = composeRootAttrs(InputRevealButtonBase, props, theme);
1942
+ const { onClick: slotOnClick, ...revealRootAttrs } = rootAttrs;
1943
+ const { children, onClick, ref, "type": _type, "aria-label": _ariaLabel, "aria-pressed": _ariaPressed, ...buttonProps } = rest;
1944
+ useEffect(() => {
1945
+ if (!revealed) return;
1946
+ const form = fieldRef.current?.form;
1947
+ if (!form) return;
1948
+ const handleSubmit = () => setRevealed(false);
1949
+ form.addEventListener("submit", handleSubmit);
1950
+ return () => form.removeEventListener("submit", handleSubmit);
1951
+ }, [revealed, fieldRef, setRevealed]);
1952
+ const handleClick = (event) => {
1953
+ onClick?.(event);
1954
+ slotOnClick?.(event);
1955
+ if (event.defaultPrevented) return;
1956
+ toggleReveal();
1957
+ fieldRef.current?.focus();
1958
+ };
1959
+ return /* @__PURE__ */ jsx(
1960
+ Button,
1961
+ {
1962
+ ...buttonProps,
1963
+ ...revealRootAttrs,
1964
+ ref,
1965
+ type: "button",
1966
+ appearance: "text",
1967
+ rounded: true,
1968
+ size,
1969
+ disabled: disabled || readOnly,
1970
+ "aria-label": "Toggle password visibility",
1971
+ "aria-pressed": revealed,
1972
+ onClick: handleClick,
1973
+ startContent: children ?? (revealed ? /* @__PURE__ */ jsx(PlaceholderEyeOff, {}) : /* @__PURE__ */ jsx(PlaceholderEye, {}))
1974
+ }
1975
+ );
1976
+ };
1977
+ InputRevealButton.displayName = "Input.RevealButton";
1978
+ var InputSpinner = (props) => {
1979
+ const theme = useComponentTheme("InputSpinner");
1980
+ useInputOwnContext("Input.Spinner");
1981
+ const Component = props.as ?? "span";
1982
+ const { rootAttrs, rest } = composeRootAttrs(InputSpinnerBase, props, theme);
1983
+ const { as: _as, children, ref, ...rendered } = rest;
1984
+ return /* @__PURE__ */ jsx(Component, { "aria-hidden": "true", ...rendered, ref, ...rootAttrs, children: children ?? /* @__PURE__ */ jsx("span", { className: "tk-input-default-spinner" }) });
1985
+ };
1986
+ InputSpinner.displayName = "Input.Spinner";
1987
+ var InputStepper = (props) => {
1988
+ const theme = useComponentTheme("InputStepper");
1989
+ useInputOwnContext("Input.Stepper");
1990
+ const Component = props.as ?? "div";
1991
+ const { rootAttrs, rest } = composeRootAttrs(InputStepperBase, props, theme);
1992
+ const { as: _as, children, ref, ...rendered } = rest;
1993
+ return /* @__PURE__ */ jsx(Component, { ...rendered, ref, ...rootAttrs, children });
1994
+ };
1995
+ InputStepper.displayName = "Input.Stepper";
873
1996
  var InputSuffix = (props) => {
874
1997
  const theme = useComponentTheme("InputSuffix");
1998
+ useInputOwnContext("Input.Suffix");
875
1999
  const Component = props.as ?? "span";
876
2000
  const { rootAttrs, rest } = composeRootAttrs(InputSuffixBase, props, theme);
877
2001
  const { as: _as, children, ref, ...rendered } = rest;
878
2002
  return /* @__PURE__ */ jsx(Component, { ...rendered, ref, ...rootAttrs, children });
879
2003
  };
880
2004
  InputSuffix.displayName = "Input.Suffix";
2005
+ var InputTrailingIcon = (props) => {
2006
+ const theme = useComponentTheme("InputTrailingIcon");
2007
+ useInputOwnContext("Input.TrailingIcon");
2008
+ const Component = props.as ?? "span";
2009
+ const { rootAttrs, rest } = composeRootAttrs(InputTrailingIconBase, props, theme);
2010
+ const { as: _as, children, ref, ...rendered } = rest;
2011
+ return /* @__PURE__ */ jsx(Component, { "aria-hidden": "true", ...rendered, ref, ...rootAttrs, children });
2012
+ };
2013
+ InputTrailingIcon.displayName = "Input.TrailingIcon";
881
2014
 
882
2015
  // src/components/input/index.ts
883
2016
  var Input2 = Object.assign(Input, {
884
- Container: InputContainer,
885
2017
  Field: InputField,
886
2018
  Prefix: InputPrefix,
887
- Suffix: InputSuffix
2019
+ Suffix: InputSuffix,
2020
+ LeadingIcon: InputLeadingIcon,
2021
+ TrailingIcon: InputTrailingIcon,
2022
+ ClearButton: InputClearButton,
2023
+ Spinner: InputSpinner,
2024
+ RevealButton: InputRevealButton,
2025
+ Strength: InputStrength,
2026
+ Stepper: InputStepper,
2027
+ Decrement: InputDecrement,
2028
+ Increment: InputIncrement,
2029
+ Chips: InputChips
2030
+ });
2031
+
2032
+ // src/components/label/base.ts
2033
+ var LabelBase = createComponentBase({
2034
+ name: "Label",
2035
+ slots: ["root"],
2036
+ classes: { root: "tk-label" }
888
2037
  });
2038
+ var Label = (props) => {
2039
+ const theme = useComponentTheme("Label");
2040
+ const { rootAttrs, rest } = composeRootAttrs(LabelBase, props, theme);
2041
+ const { as, children, ref, ...sparProps } = rest;
2042
+ return /* @__PURE__ */ jsx(Label$1, { ...sparProps, as, ref, ...rootAttrs, children });
2043
+ };
2044
+ Label.displayName = "Label";
889
2045
 
890
2046
  // src/components/radio/base.ts
891
2047
  var RadioBase = createComponentBase({
@@ -918,22 +2074,19 @@ var RADIO_ITEM_CONTEXT_VALUE = { inside: true };
918
2074
  var [RadioItemProvider, useRadioItemOwnContext] = createSafeContext("RadioItemProvider");
919
2075
 
920
2076
  // src/components/radio/defaults.ts
921
- var DEFAULT_SIZE6 = "base";
922
- var DEFAULT_TYPE3 = "default";
2077
+ var DEFAULT_SIZE8 = "base";
923
2078
  var DEFAULT_POSITION = "left";
924
2079
  var Radio = (props) => {
925
2080
  const theme = useComponentTheme("Radio");
926
2081
  const { rootAttrs, rest } = composeRootAttrs(RadioBase, props, theme, {
927
- stateAttrs: ({ size: size2 = DEFAULT_SIZE6, type: type2 = DEFAULT_TYPE3, position: position2 = DEFAULT_POSITION, spread }) => ({
2082
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE8, position: position2 = DEFAULT_POSITION, spread }) => ({
928
2083
  "data-size": size2,
929
- "data-type": type2,
930
2084
  "data-position": position2,
931
2085
  "data-spread": spread ? "" : void 0
932
2086
  })
933
2087
  });
934
2088
  const {
935
- size = DEFAULT_SIZE6,
936
- type = DEFAULT_TYPE3,
2089
+ size = DEFAULT_SIZE8,
937
2090
  position = DEFAULT_POSITION,
938
2091
  invalid,
939
2092
  // `spread` is consumed only as a data-attr above; destructure to keep it
@@ -944,7 +2097,7 @@ var Radio = (props) => {
944
2097
  ref,
945
2098
  ...sparProps
946
2099
  } = rest;
947
- return /* @__PURE__ */ jsx(RadioGroupProvider, { value: { size, type, position }, children: /* @__PURE__ */ jsx(Radio$1, { ...sparProps, invalid, ...rootAttrs, ref, children }) });
2100
+ return /* @__PURE__ */ jsx(RadioGroupProvider, { value: { size, position }, children: /* @__PURE__ */ jsx(Radio$1, { ...sparProps, invalid, ...rootAttrs, ref, children }) });
948
2101
  };
949
2102
  Radio.displayName = "Radio";
950
2103
  var RadioIndicator = (props) => {
@@ -968,7 +2121,6 @@ var RadioItem = (props) => {
968
2121
  const { rootAttrs, rest } = composeRootAttrs(RadioItemBase, props, theme, {
969
2122
  stateAttrs: ({ position }) => ({
970
2123
  "data-size": group.size,
971
- "data-type": group.type,
972
2124
  "data-position": position ?? group.position
973
2125
  })
974
2126
  });
@@ -1052,11 +2204,11 @@ var PopoverTrigger = (props) => {
1052
2204
  PopoverTrigger.displayName = "Popover.Trigger";
1053
2205
 
1054
2206
  // src/components/popover/defaults.ts
1055
- var DEFAULT_VARIANT3 = "dark";
2207
+ var DEFAULT_VARIANT5 = "white";
1056
2208
  var PopoverContent = (props) => {
1057
2209
  const theme = useComponentTheme("PopoverContent");
1058
2210
  const { rootAttrs, rest } = composeRootAttrs(PopoverContentBase, props, theme, {
1059
- stateAttrs: ({ variant = DEFAULT_VARIANT3 }) => ({
2211
+ stateAttrs: ({ variant = DEFAULT_VARIANT5 }) => ({
1060
2212
  "data-variant": variant
1061
2213
  })
1062
2214
  });
@@ -1111,8 +2263,22 @@ var SelectBase = createComponentBase({
1111
2263
  });
1112
2264
  var SelectTriggerBase = createComponentBase({
1113
2265
  name: "SelectTrigger",
2266
+ slots: ["root", "value", "indicator"],
2267
+ classes: {
2268
+ root: "tk-select-trigger",
2269
+ // Truncating value region wrapping the selected label/placeholder; pins the
2270
+ // indicator to the trailing edge of the `space-between` trigger.
2271
+ value: "tk-select-value",
2272
+ // Wrapper around the built-in trigger indicator. Shares the
2273
+ // `tk-select-indicator` recipe with the standalone Select.Indicator so both
2274
+ // entry points style identically.
2275
+ indicator: "tk-select-indicator"
2276
+ }
2277
+ });
2278
+ var SelectIndicatorBase = createComponentBase({
2279
+ name: "SelectIndicator",
1114
2280
  slots: ["root"],
1115
- classes: { root: "tk-select-trigger" }
2281
+ classes: { root: "tk-select-indicator" }
1116
2282
  });
1117
2283
  var SelectContentBase = createComponentBase({
1118
2284
  name: "SelectContent",
@@ -1144,17 +2310,17 @@ var SelectSeparatorBase = createComponentBase({
1144
2310
  var [SelectProvider, useSelectOwnContext] = createSafeContext("SelectProvider");
1145
2311
 
1146
2312
  // src/components/select/defaults.ts
1147
- var DEFAULT_SIZE7 = "base";
2313
+ var DEFAULT_SIZE9 = "base";
1148
2314
  var DEFAULT_CONTENT_WIDTH = "trigger";
1149
2315
  var Select = (props) => {
1150
2316
  const theme = useComponentTheme("Select");
1151
2317
  const { rootAttrs, rest } = composeRootAttrs(SelectBase, props, theme, {
1152
- stateAttrs: ({ size: size2 = DEFAULT_SIZE7, invalid: invalid2 }) => ({
2318
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE9, invalid: invalid2 }) => ({
1153
2319
  "data-size": size2,
1154
2320
  "data-invalid": invalid2 ? "" : void 0
1155
2321
  })
1156
2322
  });
1157
- const { size = DEFAULT_SIZE7, invalid = false, contentWidth = DEFAULT_CONTENT_WIDTH, children, ref, ...sparProps } = rest;
2323
+ const { size = DEFAULT_SIZE9, invalid = false, contentWidth = DEFAULT_CONTENT_WIDTH, children, ref, ...sparProps } = rest;
1158
2324
  return /* @__PURE__ */ jsx(SelectProvider, { value: { size, invalid, contentWidth }, children: /* @__PURE__ */ jsx(Select$1, { ...sparProps, ref, ...rootAttrs, children }) });
1159
2325
  };
1160
2326
  Select.displayName = "Select";
@@ -1167,10 +2333,44 @@ var SelectTrigger = (props) => {
1167
2333
  "data-invalid": invalid ? "" : void 0
1168
2334
  })
1169
2335
  });
1170
- const { children, ref, ...spar } = rest;
1171
- return /* @__PURE__ */ jsx(SelectTrigger$1, { ...spar, ref, ...rootAttrs, children });
2336
+ const { children, indicator, ref, ...spar } = rest;
2337
+ const showIndicator = indicator !== false && indicator !== null;
2338
+ const consumerOwnsLayout = typeof children === "function";
2339
+ if (!showIndicator || consumerOwnsLayout) {
2340
+ return /* @__PURE__ */ jsx(SelectTrigger$1, { ...spar, ref, ...rootAttrs, children });
2341
+ }
2342
+ const resolveIndicatorNode = (state) => {
2343
+ if (indicator === void 0 || indicator === true) return state.isOpen ? DEFAULT_DISCLOSURE_COLLAPSE_ICON : DEFAULT_DISCLOSURE_EXPAND_ICON;
2344
+ if (typeof indicator === "function") return indicator(state);
2345
+ return indicator;
2346
+ };
2347
+ const slotLayers = {
2348
+ themeSlotProps: theme?.slotProps,
2349
+ themeClassNames: theme?.classNames,
2350
+ instanceSlotProps: props.slotProps,
2351
+ instanceClassNames: props.classNames
2352
+ };
2353
+ const valueAttrs = buildSlotAttrs(SelectTriggerBase.getSlotProps("value"), "value", slotLayers);
2354
+ const indicatorAttrs = buildSlotAttrs(SelectTriggerBase.getSlotProps("indicator"), "indicator", slotLayers);
2355
+ return /* @__PURE__ */ jsx(SelectTrigger$1, { ...spar, ref, ...rootAttrs, children: (state) => {
2356
+ const value = children ?? (state.label || spar.placeholder);
2357
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2358
+ /* @__PURE__ */ jsx("span", { ...valueAttrs, children: value }),
2359
+ /* @__PURE__ */ jsx("span", { ...indicatorAttrs, "aria-hidden": "true", children: resolveIndicatorNode({ isOpen: state.isOpen }) })
2360
+ ] });
2361
+ } });
1172
2362
  };
1173
2363
  SelectTrigger.displayName = "Select.Trigger";
2364
+ var SelectIndicator = (props) => {
2365
+ const theme = useComponentTheme("SelectIndicator");
2366
+ const { isOpen } = useSelectContext();
2367
+ const Component = props.as ?? "span";
2368
+ const { rootAttrs, rest } = composeRootAttrs(SelectIndicatorBase, props, theme);
2369
+ const { as: _as, children, ref, ...rendered } = rest;
2370
+ const resolved = resolveDisclosureIndicator(children, isOpen);
2371
+ return /* @__PURE__ */ jsx(Component, { ...rendered, ref, "aria-hidden": "true", ...rootAttrs, children: resolved });
2372
+ };
2373
+ SelectIndicator.displayName = "Select.Indicator";
1174
2374
  var resolveStaticWidth = (mode) => {
1175
2375
  if (mode === "trigger" || mode === "content") return void 0;
1176
2376
  return typeof mode === "number" ? `${mode}px` : mode;
@@ -1241,6 +2441,7 @@ SelectSeparator.displayName = "Select.Separator";
1241
2441
  // src/components/select/index.ts
1242
2442
  var Select2 = Object.assign(Select, {
1243
2443
  Trigger: SelectTrigger,
2444
+ Indicator: SelectIndicator,
1244
2445
  Content: SelectContent,
1245
2446
  Item: SelectItem,
1246
2447
  Group: SelectGroup,
@@ -1248,6 +2449,79 @@ var Select2 = Object.assign(Select, {
1248
2449
  Separator: SelectSeparator
1249
2450
  });
1250
2451
 
2452
+ // src/components/spinner/base.ts
2453
+ var SpinnerBase = createComponentBase({
2454
+ name: "Spinner",
2455
+ slots: ["root", "indicator"],
2456
+ classes: {
2457
+ root: "tk-spinner",
2458
+ indicator: "tk-spinner-indicator"
2459
+ }
2460
+ });
2461
+
2462
+ // src/components/spinner/defaults.ts
2463
+ var DEFAULT_APPEARANCE5 = "rounded";
2464
+ var DEFAULT_SIZE10 = "base";
2465
+ var DEFAULT_VARIANT6 = "neutral";
2466
+ var DEFAULT_ARIA_LABEL = "Loading";
2467
+ var SPINNER_RADIAL_PARTS = 8;
2468
+ var SPINNER_THREE_DOT_PARTS = 3;
2469
+ var renderIndicatorContent = (appearance) => {
2470
+ if (appearance === "rounded") {
2471
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2472
+ /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 40 40", children: /* @__PURE__ */ jsx("circle", { cx: "20", cy: "20", r: "16.6667" }) }),
2473
+ /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 40 40", children: /* @__PURE__ */ jsx("path", { d: "M20 3.3333A16.6667 16.6667 0 0 1 36.6667 20" }) })
2474
+ ] });
2475
+ }
2476
+ if (appearance === "loader") {
2477
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 40 40", children: /* @__PURE__ */ jsx("path", { d: "M20 3.3333A16.6667 16.6667 0 0 1 31.7851 8.2149" }) });
2478
+ }
2479
+ if (appearance === "dots") {
2480
+ return Array.from({ length: SPINNER_RADIAL_PARTS }, (_, index) => /* @__PURE__ */ jsx("span", { className: "tk-spinner-dot" }, index));
2481
+ }
2482
+ if (appearance === "lines") {
2483
+ return Array.from({ length: SPINNER_RADIAL_PARTS }, (_, index) => /* @__PURE__ */ jsx("span", { className: "tk-spinner-line" }, index));
2484
+ }
2485
+ if (appearance === "threeDots") {
2486
+ return Array.from({ length: SPINNER_THREE_DOT_PARTS }, (_, index) => /* @__PURE__ */ jsx("span", { className: "tk-spinner-dot" }, index));
2487
+ }
2488
+ if (appearance === "logo") {
2489
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", focusable: "false", viewBox: "0 0 48 48", children: /* @__PURE__ */ jsx(
2490
+ "path",
2491
+ {
2492
+ clipRule: "evenodd",
2493
+ d: "M24 0C10.7452 0 0 10.7452 0 24C0 37.2548 10.7452 48 24 48C37.2548 48 48 37.2548 48 24V4C48 1.79086 46.2091 0 44 0H24ZM24 8C15.1634 8 8 15.1634 8 24C8 32.8366 15.1634 40 24 40C32.8366 40 40 32.8366 40 24C40 15.1634 32.8366 8 24 8Z",
2494
+ fillRule: "evenodd"
2495
+ }
2496
+ ) });
2497
+ }
2498
+ return null;
2499
+ };
2500
+ var Spinner = (props) => {
2501
+ const theme = useComponentTheme("Spinner");
2502
+ const { rootAttrs, rest } = composeRootAttrs(SpinnerBase, props, theme, {
2503
+ stateAttrs: ({ variant = DEFAULT_VARIANT6, size = DEFAULT_SIZE10, appearance: appearance2 = DEFAULT_APPEARANCE5 }) => ({
2504
+ "data-variant": variant,
2505
+ "data-size": size,
2506
+ "data-type": appearance2
2507
+ })
2508
+ });
2509
+ const { variant: _variant, size: _size, appearance = DEFAULT_APPEARANCE5, ref, ...nativeProps } = rest;
2510
+ const indicatorSlotAttrs = buildSlotAttrs(SpinnerBase.getSlotProps("indicator"), "indicator", {
2511
+ themeSlotProps: theme?.slotProps,
2512
+ themeClassNames: theme?.classNames,
2513
+ instanceSlotProps: props.slotProps,
2514
+ instanceClassNames: props.classNames
2515
+ });
2516
+ const isDecorative = nativeProps["aria-hidden"] === true || nativeProps["aria-hidden"] === "true";
2517
+ const accessibilityAttrs = isDecorative ? {} : {
2518
+ "role": nativeProps.role ?? "status",
2519
+ "aria-label": nativeProps["aria-label"] ?? (nativeProps["aria-labelledby"] ? void 0 : DEFAULT_ARIA_LABEL)
2520
+ };
2521
+ return /* @__PURE__ */ jsx("span", { ...accessibilityAttrs, ...nativeProps, ...rootAttrs, ref, children: /* @__PURE__ */ jsx("span", { ...indicatorSlotAttrs, "aria-hidden": "true", children: renderIndicatorContent(appearance) }) });
2522
+ };
2523
+ Spinner.displayName = "Spinner";
2524
+
1251
2525
  // src/components/switch/base.ts
1252
2526
  var SwitchBase = createComponentBase({
1253
2527
  name: "Switch",
@@ -1265,12 +2539,12 @@ var SwitchBase = createComponentBase({
1265
2539
  var [SwitchProvider, useSwitchOwnContext] = createSafeContext("SwitchProvider");
1266
2540
 
1267
2541
  // src/components/switch/defaults.ts
1268
- var DEFAULT_SIZE8 = "base";
1269
- var DEFAULT_VARIANT4 = "info";
2542
+ var DEFAULT_SIZE11 = "base";
2543
+ var DEFAULT_VARIANT7 = "info";
1270
2544
  var Switch = (props) => {
1271
2545
  const theme = useComponentTheme("Switch");
1272
2546
  const { rootAttrs, rest } = composeRootAttrs(SwitchBase, props, theme, {
1273
- stateAttrs: ({ size = DEFAULT_SIZE8, variant = DEFAULT_VARIANT4 }) => ({
2547
+ stateAttrs: ({ size = DEFAULT_SIZE11, variant = DEFAULT_VARIANT7 }) => ({
1274
2548
  "data-size": size,
1275
2549
  "data-variant": variant
1276
2550
  })
@@ -1287,28 +2561,19 @@ var Switch = (props) => {
1287
2561
  ref,
1288
2562
  ...sparProps
1289
2563
  } = rest;
1290
- return /* @__PURE__ */ jsx(
1291
- Switch$1,
2564
+ return /* @__PURE__ */ jsx(Switch$1, { ...sparProps, invalid, ref, ...rootAttrs, children: (state) => /* @__PURE__ */ jsx(
2565
+ SwitchProvider,
1292
2566
  {
1293
- ...sparProps,
1294
- invalid,
1295
- ref,
1296
- ...rootAttrs,
1297
- children: (state) => /* @__PURE__ */ jsx(
1298
- SwitchProvider,
1299
- {
1300
- value: {
1301
- classNames,
1302
- slotProps,
1303
- checked: state.checked,
1304
- disabled: state.disabled,
1305
- readOnly: state.readOnly
1306
- },
1307
- children: typeof children === "function" ? children(state) : children
1308
- }
1309
- )
2567
+ value: {
2568
+ classNames,
2569
+ slotProps,
2570
+ checked: state.checked,
2571
+ disabled: state.disabled,
2572
+ readOnly: state.readOnly
2573
+ },
2574
+ children: typeof children === "function" ? children(state) : children
1310
2575
  }
1311
- );
2576
+ ) });
1312
2577
  };
1313
2578
  Switch.displayName = "Switch";
1314
2579
  var SwitchIndicator = (props) => {
@@ -1336,6 +2601,870 @@ SwitchIndicator.displayName = "Switch.Indicator";
1336
2601
  var Switch2 = Object.assign(Switch, {
1337
2602
  Indicator: SwitchIndicator
1338
2603
  });
2604
+
2605
+ // src/components/table/base.ts
2606
+ var TableBase = createComponentBase({
2607
+ name: "Table",
2608
+ slots: [
2609
+ "root",
2610
+ "tableViewport",
2611
+ "table",
2612
+ "header",
2613
+ "headerRow",
2614
+ "headerCell",
2615
+ "headerContent",
2616
+ "sortTrigger",
2617
+ "sortIcon",
2618
+ "body",
2619
+ "row",
2620
+ "cell",
2621
+ "selectionCell",
2622
+ "expandCell",
2623
+ "expandButton",
2624
+ "expandedRow",
2625
+ "filterButton",
2626
+ "filterPanel",
2627
+ "pagination",
2628
+ "paginationInfo",
2629
+ "paginationNav",
2630
+ "paginationActions",
2631
+ "paginationSize",
2632
+ "paginationGoToPage",
2633
+ "empty",
2634
+ "loading"
2635
+ ],
2636
+ classes: {
2637
+ root: "tk-table",
2638
+ tableViewport: "tk-table-viewport",
2639
+ table: "tk-table-table",
2640
+ header: "tk-table-header",
2641
+ headerRow: "tk-table-header-row",
2642
+ headerCell: "tk-table-header-cell",
2643
+ headerContent: "tk-table-header-content",
2644
+ sortTrigger: "tk-table-sort-trigger",
2645
+ sortIcon: "tk-table-sort-icon",
2646
+ body: "tk-table-body",
2647
+ row: "tk-table-row",
2648
+ cell: "tk-table-cell",
2649
+ selectionCell: "tk-table-selection-cell",
2650
+ expandCell: "tk-table-expand-cell",
2651
+ expandButton: "tk-table-expand-button",
2652
+ expandedRow: "tk-table-expanded-row",
2653
+ filterButton: "tk-table-filter-button",
2654
+ filterPanel: "tk-table-filter-panel-body",
2655
+ pagination: "tk-table-pagination",
2656
+ paginationInfo: "tk-table-pagination-info",
2657
+ paginationNav: "tk-table-pagination-nav",
2658
+ paginationActions: "tk-table-pagination-actions",
2659
+ paginationSize: "tk-table-pagination-size",
2660
+ paginationGoToPage: "tk-table-pagination-go-to-page",
2661
+ empty: "tk-table-empty",
2662
+ loading: "tk-table-loading"
2663
+ }
2664
+ });
2665
+
2666
+ // src/components/table/context.ts
2667
+ var [TableProvider, useTableContext] = createSafeContext("Table");
2668
+
2669
+ // src/components/table/defaults.ts
2670
+ var DEFAULT_SIZE12 = "base";
2671
+ var DEFAULT_PAGE_SIZE = 10;
2672
+ var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100];
2673
+ var DEFAULT_COLUMN_WIDTH = 150;
2674
+ var UTILITY_COLUMN_WIDTH = 48;
2675
+ var SELECTION_COLUMN_KEY = "__tk_selection__";
2676
+ var EXPAND_COLUMN_KEY = "__tk_expand__";
2677
+ var toRenderableValue = (value, columnId) => {
2678
+ if (value == null || typeof value !== "object" || isValidElement(value)) return value;
2679
+ if (isDevelopment()) {
2680
+ console.error(
2681
+ `[Table] Column "${columnId}" resolved to a non-renderable object value. Provide a \`cell\` render-prop (or an accessor that returns a primitive/element) \u2014 falling back to JSON.stringify.`
2682
+ );
2683
+ }
2684
+ try {
2685
+ return JSON.stringify(value);
2686
+ } catch {
2687
+ return String(value);
2688
+ }
2689
+ };
2690
+ var defaultCell = (ctx) => toRenderableValue(ctx.getValue(), ctx.column.id);
2691
+ var isEmptyFilterValue = (value) => value == null || value === "" || Array.isArray(value) && value.length === 0;
2692
+ var substringFilterFn = (row, columnId, filterValue) => {
2693
+ if (isEmptyFilterValue(filterValue)) return true;
2694
+ return String(row.getValue(columnId)).toLowerCase().includes(String(filterValue).toLowerCase());
2695
+ };
2696
+ substringFilterFn.autoRemove = isEmptyFilterValue;
2697
+ var equalsFilterFn = (row, columnId, filterValue) => {
2698
+ if (isEmptyFilterValue(filterValue)) return true;
2699
+ return String(row.getValue(columnId)) === String(filterValue);
2700
+ };
2701
+ equalsFilterFn.autoRemove = isEmptyFilterValue;
2702
+ var membershipFilterFn = (row, columnId, filterValue) => {
2703
+ if (!Array.isArray(filterValue) || filterValue.length === 0) return true;
2704
+ return filterValue.map(String).includes(String(row.getValue(columnId)));
2705
+ };
2706
+ membershipFilterFn.autoRemove = (value) => !Array.isArray(value) || value.length === 0;
2707
+ var PRESET_FILTER_FN = {
2708
+ "text": substringFilterFn,
2709
+ "select": equalsFilterFn,
2710
+ "radio": equalsFilterFn,
2711
+ "multi-select": membershipFilterFn,
2712
+ "checkbox": membershipFilterFn
2713
+ };
2714
+ var defaultFilterFn = (row, columnId, filterValue) => {
2715
+ if (isEmptyFilterValue(filterValue)) return true;
2716
+ const cell = row.getValue(columnId);
2717
+ if (typeof filterValue === "string") return String(cell).toLowerCase().includes(filterValue.toLowerCase());
2718
+ if (Array.isArray(filterValue)) return filterValue.map(String).includes(String(cell));
2719
+ return String(cell) === String(filterValue);
2720
+ };
2721
+ defaultFilterFn.autoRemove = isEmptyFilterValue;
2722
+ var normalizeColumnFilter = (filter) => {
2723
+ if (filter == null) return void 0;
2724
+ return typeof filter === "string" ? { type: filter } : filter;
2725
+ };
2726
+ var resolveFilterFn = (filter) => {
2727
+ if (filter.filterFn) return filter.filterFn;
2728
+ if (filter.render == null && filter.type) return PRESET_FILTER_FN[filter.type];
2729
+ return defaultFilterFn;
2730
+ };
2731
+ var toTanStackColumns = (columns) => columns.map((col) => {
2732
+ const { id, header, accessor, cell, sortable, filter, sticky, width, align, meta } = col;
2733
+ const normalizedFilter = normalizeColumnFilter(filter);
2734
+ const def = {
2735
+ id,
2736
+ header,
2737
+ enableSorting: sortable ?? false,
2738
+ enableColumnFilter: normalizedFilter != null,
2739
+ meta: {
2740
+ align,
2741
+ sticky,
2742
+ width,
2743
+ className: meta?.className,
2744
+ headerClassName: meta?.headerClassName,
2745
+ headerAlign: meta?.headerAlign,
2746
+ filter: normalizedFilter
2747
+ }
2748
+ };
2749
+ def.cell = cell ?? defaultCell;
2750
+ if (width != null) def.size = width;
2751
+ if (typeof accessor === "function") {
2752
+ def.accessorFn = accessor;
2753
+ } else if (accessor != null) {
2754
+ def.accessorKey = accessor;
2755
+ }
2756
+ if (normalizedFilter) {
2757
+ def.filterFn = resolveFilterFn(normalizedFilter);
2758
+ }
2759
+ return def;
2760
+ });
2761
+ var computeStickyLayout = (ordered) => {
2762
+ const layout = /* @__PURE__ */ new Map();
2763
+ if (isDevelopment()) warnNonContiguousPinning(ordered);
2764
+ let leftOffset = 0;
2765
+ for (const column of ordered) {
2766
+ if (column.side === "left") {
2767
+ layout.set(column.key, { side: "left", offset: leftOffset });
2768
+ leftOffset += column.width;
2769
+ }
2770
+ }
2771
+ let rightOffset = 0;
2772
+ for (let i = ordered.length - 1; i >= 0; i -= 1) {
2773
+ const column = ordered[i];
2774
+ if (column?.side === "right") {
2775
+ layout.set(column.key, { side: "right", offset: rightOffset });
2776
+ rightOffset += column.width;
2777
+ }
2778
+ }
2779
+ return layout;
2780
+ };
2781
+ var warnNonContiguousPinning = (ordered) => {
2782
+ let seenNonLeft = false;
2783
+ for (const column of ordered) {
2784
+ if (column.side === "left") {
2785
+ if (seenNonLeft) return warnPinning("left");
2786
+ } else {
2787
+ seenNonLeft = true;
2788
+ }
2789
+ }
2790
+ let seenNonRight = false;
2791
+ for (let i = ordered.length - 1; i >= 0; i -= 1) {
2792
+ const column = ordered[i];
2793
+ if (column?.side === "right") {
2794
+ if (seenNonRight) return warnPinning("right");
2795
+ } else {
2796
+ seenNonRight = true;
2797
+ }
2798
+ }
2799
+ };
2800
+ var warnPinning = (side) => {
2801
+ console.error(
2802
+ `[Table] Non-contiguous ${side} column pinning detected. Pinned columns must be contiguous against the ${side} edge (no unpinned column between them); otherwise the sticky offset math overlaps the unpinned column. Move the pinned columns together or unpin the gap.`
2803
+ );
2804
+ };
2805
+ var buildOrderedColumns = (table, options) => {
2806
+ const leaf = table.getVisibleLeafColumns();
2807
+ const hasLeftPinned = leaf.some((column) => column.columnDef.meta?.sticky === "left");
2808
+ const utilitySide = hasLeftPinned ? "left" : void 0;
2809
+ const ordered = [];
2810
+ if (options.hasSelection) ordered.push({ key: SELECTION_COLUMN_KEY, side: utilitySide, width: UTILITY_COLUMN_WIDTH });
2811
+ if (options.hasExpansion) ordered.push({ key: EXPAND_COLUMN_KEY, side: utilitySide, width: UTILITY_COLUMN_WIDTH });
2812
+ for (const column of leaf) {
2813
+ ordered.push({
2814
+ key: column.id,
2815
+ side: column.columnDef.meta?.sticky,
2816
+ width: column.getSize() || DEFAULT_COLUMN_WIDTH
2817
+ });
2818
+ }
2819
+ return ordered;
2820
+ };
2821
+ var getExportRows = (table) => {
2822
+ if (!table) return [];
2823
+ const columns = table.getAllLeafColumns();
2824
+ return table.getSortedRowModel().rows.map((row) => {
2825
+ const record = {};
2826
+ for (const column of columns) {
2827
+ if (column.accessorFn || column.columnDef.accessorKey != null) {
2828
+ record[column.id] = row.getValue(column.id);
2829
+ }
2830
+ }
2831
+ return record;
2832
+ });
2833
+ };
2834
+ var resolveStickyCell = (layout, key, options) => {
2835
+ const placement = layout.get(key);
2836
+ const isStickyColumn = !!placement;
2837
+ const stickyHeaderActive = options.isHeader && options.stickyHeader;
2838
+ if (!isStickyColumn && !stickyHeaderActive) return {};
2839
+ const style = { position: "sticky" };
2840
+ if (placement) {
2841
+ if (placement.side === "left") style.left = placement.offset;
2842
+ else style.right = placement.offset;
2843
+ }
2844
+ if (stickyHeaderActive) style.top = 0;
2845
+ style.zIndex = isStickyColumn && stickyHeaderActive ? 3 : stickyHeaderActive ? 2 : 1;
2846
+ return { style, dataSticky: placement?.side };
2847
+ };
2848
+ var resolveCellWidth = (column, stickyLayout) => {
2849
+ const hasWidth = column.columnDef.meta?.width != null || stickyLayout.has(column.id);
2850
+ return hasWidth ? { width: column.getSize() } : void 0;
2851
+ };
2852
+ var TableCell = ({ cell }) => {
2853
+ const { slotAttrs, stickyLayout, stickyHeader } = useTableContext("Table.Cell");
2854
+ const column = cell.column;
2855
+ const meta = column.columnDef.meta;
2856
+ const sticky = resolveStickyCell(stickyLayout, column.id, { isHeader: false, stickyHeader });
2857
+ const attrs = slotAttrs("cell", { className: meta?.className });
2858
+ const content = flexRender(column.columnDef.cell, cell.getContext());
2859
+ return /* @__PURE__ */ jsx("td", { ...attrs, "data-align": meta?.align, "data-sticky": sticky.dataSticky, style: { ...attrs.style, ...sticky.style, ...resolveCellWidth(column, stickyLayout) }, children: content });
2860
+ };
2861
+ TableCell.displayName = "Table.Cell";
2862
+ var mergeStyle = (...styles) => Object.assign({}, ...styles);
2863
+ var SelectionHeaderCell = () => {
2864
+ const { table, slotAttrs, selectionMode, stickyLayout, stickyHeader } = useTableContext("Table.SelectionHeaderCell");
2865
+ const sticky = resolveStickyCell(stickyLayout, SELECTION_COLUMN_KEY, { isHeader: true, stickyHeader });
2866
+ const attrs = slotAttrs("selectionCell");
2867
+ const allSelected = table.getIsAllPageRowsSelected();
2868
+ return /* @__PURE__ */ jsx("th", { ...attrs, scope: "col", "data-sticky": sticky.dataSticky, "data-selection-mode": selectionMode, style: mergeStyle(attrs.style, sticky.style, { width: UTILITY_COLUMN_WIDTH }), children: selectionMode === "multiple" && /* @__PURE__ */ jsx(
2869
+ Checkbox2,
2870
+ {
2871
+ "aria-label": "Select all rows",
2872
+ checked: allSelected,
2873
+ indeterminate: table.getIsSomePageRowsSelected() && !allSelected,
2874
+ onChange: (checked) => table.toggleAllPageRowsSelected(checked),
2875
+ children: /* @__PURE__ */ jsx(Checkbox2.Indicator, {})
2876
+ }
2877
+ ) });
2878
+ };
2879
+ SelectionHeaderCell.displayName = "Table.SelectionHeaderCell";
2880
+ var SelectionBodyCell = ({ row }) => {
2881
+ const { slotAttrs, selectionMode, stickyLayout, stickyHeader } = useTableContext("Table.SelectionBodyCell");
2882
+ const sticky = resolveStickyCell(stickyLayout, SELECTION_COLUMN_KEY, { isHeader: false, stickyHeader });
2883
+ const attrs = slotAttrs("selectionCell");
2884
+ return /* @__PURE__ */ jsx("td", { ...attrs, "data-sticky": sticky.dataSticky, "data-selection-mode": selectionMode, style: mergeStyle(attrs.style, sticky.style, { width: UTILITY_COLUMN_WIDTH }), children: selectionMode === "single" ? /* @__PURE__ */ jsx(Radio2, { "aria-label": "Select row", value: row.getIsSelected() ? row.id : "", onChange: () => row.toggleSelected(true), children: /* @__PURE__ */ jsx(Radio2.Item, { value: row.id, disabled: !row.getCanSelect(), children: /* @__PURE__ */ jsx(Radio2.Indicator, {}) }) }) : /* @__PURE__ */ jsx(Checkbox2, { "aria-label": "Select row", checked: row.getIsSelected(), disabled: !row.getCanSelect(), onChange: (checked) => row.toggleSelected(checked), children: /* @__PURE__ */ jsx(Checkbox2.Indicator, {}) }) });
2885
+ };
2886
+ SelectionBodyCell.displayName = "Table.SelectionBodyCell";
2887
+ var ExpandHeaderCell = () => {
2888
+ const { slotAttrs, stickyLayout, stickyHeader } = useTableContext("Table.ExpandHeaderCell");
2889
+ const sticky = resolveStickyCell(stickyLayout, EXPAND_COLUMN_KEY, { isHeader: true, stickyHeader });
2890
+ const attrs = slotAttrs("expandCell");
2891
+ return /* @__PURE__ */ jsx("th", { ...attrs, scope: "col", "data-sticky": sticky.dataSticky, style: mergeStyle(attrs.style, sticky.style, { width: UTILITY_COLUMN_WIDTH }) });
2892
+ };
2893
+ ExpandHeaderCell.displayName = "Table.ExpandHeaderCell";
2894
+ var ExpandBodyCell = ({ row }) => {
2895
+ const { slotAttrs, stickyLayout, stickyHeader } = useTableContext("Table.ExpandBodyCell");
2896
+ const sticky = resolveStickyCell(stickyLayout, EXPAND_COLUMN_KEY, { isHeader: false, stickyHeader });
2897
+ const attrs = slotAttrs("expandCell");
2898
+ const expanded = row.getIsExpanded();
2899
+ return /* @__PURE__ */ jsx("td", { ...attrs, "data-sticky": sticky.dataSticky, style: mergeStyle(attrs.style, sticky.style, { width: UTILITY_COLUMN_WIDTH }), children: row.getCanExpand() && /* @__PURE__ */ jsx(
2900
+ "button",
2901
+ {
2902
+ ...slotAttrs("expandButton"),
2903
+ type: "button",
2904
+ "aria-label": expanded ? "Collapse row" : "Expand row",
2905
+ "aria-expanded": expanded,
2906
+ onClick: row.getToggleExpandedHandler(),
2907
+ children: expanded ? /* @__PURE__ */ jsx(ChevronBottomIconOutlinedRounded, {}) : /* @__PURE__ */ jsx(ChevronRightIconOutlinedRounded, {})
2908
+ }
2909
+ ) });
2910
+ };
2911
+ ExpandBodyCell.displayName = "Table.ExpandBodyCell";
2912
+ var TableRow = ({ row }) => {
2913
+ const { slotAttrs, hasSelection, hasExpansion, treeMode, expansionRender, totalColumnCount } = useTableContext("Table.Row");
2914
+ const selected = row.getIsSelected();
2915
+ const showDetailPanel = hasExpansion && !treeMode && !!expansionRender && row.getIsExpanded();
2916
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2917
+ /* @__PURE__ */ jsxs("tr", { ...slotAttrs("row"), "data-selected": selected ? "" : void 0, children: [
2918
+ hasSelection && /* @__PURE__ */ jsx(SelectionBodyCell, { row }),
2919
+ hasExpansion && /* @__PURE__ */ jsx(ExpandBodyCell, { row }),
2920
+ row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, { cell }, cell.id))
2921
+ ] }),
2922
+ showDetailPanel && /* @__PURE__ */ jsx("tr", { ...slotAttrs("expandedRow"), children: /* @__PURE__ */ jsx("td", { colSpan: totalColumnCount, children: expansionRender(row.original) }) })
2923
+ ] });
2924
+ };
2925
+ TableRow.displayName = "Table.Row";
2926
+ var TableBody = () => {
2927
+ const { table, slotAttrs, totalColumnCount, emptyState, loading } = useTableContext("Table.Body");
2928
+ const rows = table.getRowModel().rows;
2929
+ return /* @__PURE__ */ jsx("tbody", { ...slotAttrs("body"), children: rows.length === 0 ? /* @__PURE__ */ jsx("tr", { ...slotAttrs("row"), children: /* @__PURE__ */ jsx("td", { ...slotAttrs("empty"), colSpan: totalColumnCount, children: loading ? null : emptyState ?? "No data" }) }) : rows.map((row) => /* @__PURE__ */ jsx(TableRow, { row }, row.id)) });
2930
+ };
2931
+ TableBody.displayName = "Table.Body";
2932
+ var FILTER_BUTTON_CLASS = TableBase.getSlotProps("filterButton").className;
2933
+ var defaultIsActive = (value) => !isEmptyFilterValue(value);
2934
+ var TableColumnFilter = ({ header }) => {
2935
+ const { slotAttrs } = useTableContext("Table.ColumnFilter");
2936
+ const [open, setOpen] = useState(false);
2937
+ const column = header.column;
2938
+ const filter = column.columnDef.meta?.filter;
2939
+ if (!filter) return null;
2940
+ const value = column.getFilterValue();
2941
+ const active = (filter.isActive ?? defaultIsActive)(value);
2942
+ const ctx = {
2943
+ value,
2944
+ setValue: (next) => column.setFilterValue(next),
2945
+ clear: () => column.setFilterValue(void 0),
2946
+ column,
2947
+ close: () => setOpen(false)
2948
+ };
2949
+ return /* @__PURE__ */ jsxs(Popover2, { open, onOpenChange: setOpen, children: [
2950
+ /* @__PURE__ */ jsx(Popover2.Trigger, { className: FILTER_BUTTON_CLASS, "aria-label": "Filter column", "data-active": active ? "" : void 0, children: /* @__PURE__ */ jsx(SearchIconOutlinedRounded, { "aria-hidden": "true" }) }),
2951
+ /* @__PURE__ */ jsxs(Popover2.Content, { className: "tk-table-filter-panel", children: [
2952
+ /* @__PURE__ */ jsx("div", { ...slotAttrs("filterPanel"), children: filter.render ? filter.render(ctx) : /* @__PURE__ */ jsx(PresetFilterControl, { filter, ctx }) }),
2953
+ active && /* @__PURE__ */ jsx(Button, { size: "small", appearance: "text", onClick: ctx.clear, children: "Clear" })
2954
+ ] })
2955
+ ] });
2956
+ };
2957
+ TableColumnFilter.displayName = "Table.ColumnFilter";
2958
+ var PresetFilterControl = ({ filter, ctx }) => {
2959
+ const { type, options = [], placeholder } = filter;
2960
+ const { value, setValue } = ctx;
2961
+ if (type === "text") {
2962
+ return /* @__PURE__ */ jsx(Input2, { children: /* @__PURE__ */ jsx(
2963
+ Input2.Field,
2964
+ {
2965
+ type: "search",
2966
+ placeholder,
2967
+ value: typeof value === "string" ? value : "",
2968
+ onChange: (event) => setValue(event.target.value || void 0)
2969
+ }
2970
+ ) });
2971
+ }
2972
+ if (type === "select") {
2973
+ return /* @__PURE__ */ jsx(SelectFilter, { options, placeholder, value: typeof value === "string" ? value : "", onChange: (next) => setValue(next || void 0) });
2974
+ }
2975
+ if (type === "radio") {
2976
+ return /* @__PURE__ */ jsx(Radio2, { value: typeof value === "string" ? value : "", onChange: (next) => setValue(next || void 0), children: options.map((option) => /* @__PURE__ */ jsx(Radio2.Item, { value: option.value, children: /* @__PURE__ */ jsx(Radio2.Label, { children: option.label }) }, option.value)) });
2977
+ }
2978
+ if (type === "checkbox" || type === "multi-select") {
2979
+ return /* @__PURE__ */ jsx(CheckboxListFilter, { options, value: Array.isArray(value) ? value : [], onChange: setValue });
2980
+ }
2981
+ return null;
2982
+ };
2983
+ PresetFilterControl.displayName = "Table.PresetFilterControl";
2984
+ var SelectFilter = ({
2985
+ options,
2986
+ placeholder,
2987
+ value,
2988
+ onChange
2989
+ }) => {
2990
+ const selected = options.find((option) => option.value === value);
2991
+ return /* @__PURE__ */ jsxs(Select2, { value, onChange, children: [
2992
+ /* @__PURE__ */ jsx(Select2.Trigger, { children: selected ? selected.label : placeholder ?? "Select" }),
2993
+ /* @__PURE__ */ jsx(Select2.Content, { children: options.map((option) => /* @__PURE__ */ jsx(Select2.Item, { value: option.value, children: option.label }, option.value)) })
2994
+ ] });
2995
+ };
2996
+ var CheckboxListFilter = ({ options, value, onChange }) => /* @__PURE__ */ jsx(Fragment, { children: options.map((option) => {
2997
+ const checked = value.includes(option.value);
2998
+ return /* @__PURE__ */ jsxs(
2999
+ Checkbox2,
3000
+ {
3001
+ checked,
3002
+ onChange: (next) => {
3003
+ const updated = next ? [...value, option.value] : value.filter((item) => item !== option.value);
3004
+ onChange(updated.length ? updated : void 0);
3005
+ },
3006
+ children: [
3007
+ /* @__PURE__ */ jsx(Checkbox2.Indicator, {}),
3008
+ option.label
3009
+ ]
3010
+ },
3011
+ option.value
3012
+ );
3013
+ }) });
3014
+ var TableHeaderCell = ({ header }) => {
3015
+ const { slotAttrs, stickyLayout, stickyHeader } = useTableContext("Table.HeaderCell");
3016
+ const column = header.column;
3017
+ const meta = column.columnDef.meta;
3018
+ const align = meta?.headerAlign ?? meta?.align;
3019
+ const canSort = column.getCanSort();
3020
+ const canFilter = column.getCanFilter() && !!meta?.filter;
3021
+ const sorted = column.getIsSorted();
3022
+ const sticky = resolveStickyCell(stickyLayout, column.id, { isHeader: true, stickyHeader });
3023
+ const attrs = slotAttrs("headerCell", { className: meta?.headerClassName });
3024
+ const ariaSort = canSort ? sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : "none" : void 0;
3025
+ const content = header.isPlaceholder ? null : flexRender(column.columnDef.header, header.getContext());
3026
+ return /* @__PURE__ */ jsx(
3027
+ "th",
3028
+ {
3029
+ ...attrs,
3030
+ scope: "col",
3031
+ colSpan: header.colSpan,
3032
+ "aria-sort": ariaSort,
3033
+ "data-align": align,
3034
+ "data-sticky": sticky.dataSticky,
3035
+ "data-sortable": canSort ? "" : void 0,
3036
+ style: { ...attrs.style, ...sticky.style, ...resolveCellWidth(column, stickyLayout) },
3037
+ children: /* @__PURE__ */ jsxs("div", { ...slotAttrs("headerContent"), children: [
3038
+ canSort ? /* @__PURE__ */ jsxs("button", { ...slotAttrs("sortTrigger"), type: "button", onClick: column.getToggleSortingHandler(), children: [
3039
+ content,
3040
+ /* @__PURE__ */ jsx("span", { ...slotAttrs("sortIcon"), "data-direction": sorted || "none", "aria-hidden": "true", children: sorted === "asc" ? /* @__PURE__ */ jsx(ChevronTopIconOutlinedRounded, {}) : sorted === "desc" ? /* @__PURE__ */ jsx(ChevronBottomIconOutlinedRounded, {}) : /* @__PURE__ */ jsx(SwapIconOutlinedRounded, {}) })
3041
+ ] }) : content,
3042
+ canFilter && /* @__PURE__ */ jsx(TableColumnFilter, { header })
3043
+ ] })
3044
+ }
3045
+ );
3046
+ };
3047
+ TableHeaderCell.displayName = "Table.HeaderCell";
3048
+ var TableHeader = () => {
3049
+ const { table, slotAttrs, hasSelection, hasExpansion } = useTableContext("Table.Header");
3050
+ return /* @__PURE__ */ jsx("thead", { ...slotAttrs("header"), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs("tr", { ...slotAttrs("headerRow"), children: [
3051
+ hasSelection && /* @__PURE__ */ jsx(SelectionHeaderCell, {}),
3052
+ hasExpansion && /* @__PURE__ */ jsx(ExpandHeaderCell, {}),
3053
+ headerGroup.headers.map((header) => /* @__PURE__ */ jsx(TableHeaderCell, { header }, header.id))
3054
+ ] }, headerGroup.id)) });
3055
+ };
3056
+ TableHeader.displayName = "Table.Header";
3057
+ var getPaginationItems = (pageIndex, pageCount) => {
3058
+ if (pageCount <= 7) return Array.from({ length: pageCount }, (_, index) => index);
3059
+ if (pageIndex <= 3) return [0, 1, 2, 3, 4, "end-ellipsis", pageCount - 1];
3060
+ if (pageIndex >= pageCount - 4) return [0, "start-ellipsis", pageCount - 5, pageCount - 4, pageCount - 3, pageCount - 2, pageCount - 1];
3061
+ return [0, "start-ellipsis", pageIndex - 1, pageIndex, pageIndex + 1, "end-ellipsis", pageCount - 1];
3062
+ };
3063
+ var TablePagination = () => {
3064
+ const { table, slotAttrs, pageSizeOptions } = useTableContext("Table.Pagination");
3065
+ const { pageIndex, pageSize } = table.getState().pagination;
3066
+ const pageCount = table.getPageCount();
3067
+ const paginationItems = getPaginationItems(pageIndex, pageCount);
3068
+ const [pageInput, setPageInput] = useState("");
3069
+ const totalRows = table.getRowCount();
3070
+ const startItem = pageIndex * pageSize + 1;
3071
+ const endItem = Math.min((pageIndex + 1) * pageSize, totalRows);
3072
+ const itemsLabel = totalRows === 0 ? "0 items" : `Items ${startItem}-${endItem} of ${totalRows}`;
3073
+ const sizeOptions = pageSizeOptions.includes(pageSize) ? pageSizeOptions : [...pageSizeOptions, pageSize].sort((a, b) => a - b);
3074
+ const goToPage = () => {
3075
+ const requestedPage = Number(pageInput);
3076
+ if (!Number.isFinite(requestedPage) || pageCount <= 0 || pageInput === "") return;
3077
+ const targetPage = Math.min(Math.max(Math.trunc(requestedPage), 1), pageCount);
3078
+ table.setPageIndex(targetPage - 1);
3079
+ setPageInput("");
3080
+ };
3081
+ return /* @__PURE__ */ jsxs("div", { ...slotAttrs("pagination"), role: "navigation", "aria-label": "Pagination", children: [
3082
+ /* @__PURE__ */ jsxs("div", { ...slotAttrs("paginationInfo"), children: [
3083
+ /* @__PURE__ */ jsx("span", { "aria-live": "polite", children: pageCount > 0 ? `Page ${pageIndex + 1} of ${pageCount}` : `Page ${pageIndex + 1}` }),
3084
+ /* @__PURE__ */ jsx("span", { "aria-live": "polite", children: itemsLabel })
3085
+ ] }),
3086
+ /* @__PURE__ */ jsxs("div", { ...slotAttrs("paginationNav"), children: [
3087
+ /* @__PURE__ */ jsx(
3088
+ Button,
3089
+ {
3090
+ size: "small",
3091
+ variant: "neutral",
3092
+ appearance: "text",
3093
+ "aria-label": "First page",
3094
+ startContent: /* @__PURE__ */ jsx(ArrowLeftIconOutlinedRounded, {}),
3095
+ disabled: !table.getCanPreviousPage(),
3096
+ onClick: () => table.setPageIndex(0)
3097
+ }
3098
+ ),
3099
+ /* @__PURE__ */ jsx(
3100
+ Button,
3101
+ {
3102
+ size: "small",
3103
+ variant: "neutral",
3104
+ appearance: "text",
3105
+ "aria-label": "Previous page",
3106
+ startContent: /* @__PURE__ */ jsx(ChevronLeftIconOutlinedRounded, {}),
3107
+ disabled: !table.getCanPreviousPage(),
3108
+ onClick: () => table.previousPage()
3109
+ }
3110
+ ),
3111
+ paginationItems.map((item) => {
3112
+ if (typeof item !== "number") {
3113
+ return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2026" }, item);
3114
+ }
3115
+ const pageNumber = item + 1;
3116
+ const current = item === pageIndex;
3117
+ return /* @__PURE__ */ jsx(
3118
+ Button,
3119
+ {
3120
+ type: "button",
3121
+ size: "small",
3122
+ variant: "neutral",
3123
+ appearance: current ? "outlined" : "text",
3124
+ "aria-label": current ? `Page ${pageNumber}, current page` : `Go to page ${pageNumber}`,
3125
+ "aria-current": current ? "page" : void 0,
3126
+ onClick: () => table.setPageIndex(item),
3127
+ children: pageNumber
3128
+ },
3129
+ item
3130
+ );
3131
+ }),
3132
+ /* @__PURE__ */ jsx(
3133
+ Button,
3134
+ {
3135
+ size: "small",
3136
+ variant: "neutral",
3137
+ appearance: "text",
3138
+ "aria-label": "Next page",
3139
+ startContent: /* @__PURE__ */ jsx(ChevronRightIconOutlinedRounded, {}),
3140
+ disabled: !table.getCanNextPage() || pageCount <= 0,
3141
+ onClick: () => table.nextPage()
3142
+ }
3143
+ ),
3144
+ /* @__PURE__ */ jsx(
3145
+ Button,
3146
+ {
3147
+ size: "small",
3148
+ variant: "neutral",
3149
+ appearance: "text",
3150
+ "aria-label": "Last page",
3151
+ startContent: /* @__PURE__ */ jsx(ArrowRightIconOutlinedRounded, {}),
3152
+ disabled: !table.getCanNextPage() || pageCount <= 0,
3153
+ onClick: () => table.setPageIndex(pageCount - 1)
3154
+ }
3155
+ )
3156
+ ] }),
3157
+ /* @__PURE__ */ jsxs("div", { ...slotAttrs("paginationActions"), children: [
3158
+ /* @__PURE__ */ jsx("div", { ...slotAttrs("paginationSize"), children: /* @__PURE__ */ jsxs(Select2, { size: "small", value: String(pageSize), onChange: (value) => table.setPageSize(Number(value)), children: [
3159
+ /* @__PURE__ */ jsx(Select2.Trigger, { "aria-label": "Rows per page", children: pageSize }),
3160
+ /* @__PURE__ */ jsx(Select2.Content, { children: sizeOptions.map((option) => /* @__PURE__ */ jsx(Select2.Item, { value: String(option), children: option }, option)) })
3161
+ ] }) }),
3162
+ /* @__PURE__ */ jsx("div", { ...slotAttrs("paginationGoToPage"), children: /* @__PURE__ */ jsxs(Input2, { size: "small", children: [
3163
+ /* @__PURE__ */ jsx(
3164
+ Input2.Field,
3165
+ {
3166
+ type: "number",
3167
+ min: 1,
3168
+ max: Math.max(pageCount, 1),
3169
+ inputMode: "numeric",
3170
+ "aria-label": "Go to page",
3171
+ placeholder: String(pageIndex + 1),
3172
+ value: pageInput,
3173
+ disabled: pageCount <= 0,
3174
+ onChange: (event) => setPageInput(event.currentTarget.value),
3175
+ onKeyDown: (event) => {
3176
+ if (event.key === "Enter") goToPage();
3177
+ }
3178
+ }
3179
+ ),
3180
+ /* @__PURE__ */ jsx(Input2.TrailingIcon, { as: "button", type: "button", "aria-label": "Go to page", disabled: pageCount <= 0, onClick: goToPage, children: /* @__PURE__ */ jsx(ChevronRightIconOutlinedRounded, {}) })
3181
+ ] }) })
3182
+ ] })
3183
+ ] });
3184
+ };
3185
+ TablePagination.displayName = "Table.Pagination";
3186
+ var EMPTY_SORTING = [];
3187
+ var EMPTY_FILTERS = [];
3188
+ var EMPTY_SELECTION = {};
3189
+ var EMPTY_EXPANDED = {};
3190
+ var Table = (props) => {
3191
+ const theme = useComponentTheme("Table");
3192
+ const { rootAttrs, rest } = composeRootAttrs(TableBase, props, theme, {
3193
+ // Visual vocabulary lives on the root so recipes cascade
3194
+ // to the portal-free table descendants. `data-loading` mirrors the
3195
+ // boolean-presence convention (rule 5).
3196
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE12, striped: striped2, bordered: bordered2, stickyHeader: stickyHeader2, loading: loading2 }) => ({
3197
+ "data-size": size2,
3198
+ "data-striped": striped2 ? "" : void 0,
3199
+ "data-bordered": bordered2 ? "" : void 0,
3200
+ "data-sticky-header": stickyHeader2 ? "" : void 0,
3201
+ "data-loading": loading2 ? "" : void 0
3202
+ })
3203
+ });
3204
+ const {
3205
+ data,
3206
+ columns,
3207
+ getRowId,
3208
+ manual = false,
3209
+ loading = false,
3210
+ size = DEFAULT_SIZE12,
3211
+ striped = false,
3212
+ bordered = false,
3213
+ stickyHeader = false,
3214
+ selection,
3215
+ sorting: sortingConfig,
3216
+ filtering,
3217
+ expansion,
3218
+ pagination,
3219
+ onDataRequest,
3220
+ emptyState,
3221
+ getSubRows,
3222
+ tableRef,
3223
+ ref
3224
+ } = rest;
3225
+ const { classNames, slotProps } = props;
3226
+ const tanstackColumns = useMemo(() => toTanStackColumns(columns), [columns]);
3227
+ const hasSelection = !!selection;
3228
+ const selectionMode = selection?.mode;
3229
+ const hasExpansion = !!expansion;
3230
+ const treeMode = !!getSubRows;
3231
+ const hasColumnFilters = !!filtering || columns.some((column) => !!column.filter);
3232
+ const hasSortableColumn = columns.some((column) => !!column.sortable);
3233
+ const paginationConfig = typeof pagination === "object" ? pagination : void 0;
3234
+ const paginationEnabled = pagination === true || !!paginationConfig;
3235
+ const pageSizeOptions = paginationConfig?.pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS;
3236
+ const [tableViewportScrolled, setTableViewportScrolled] = useState(false);
3237
+ const [sortingState, setSorting] = useControllableState(sortingConfig?.value, sortingConfig?.defaultValue ?? EMPTY_SORTING, sortingConfig?.onChange);
3238
+ const [filtersState, setFilters] = useControllableState(filtering?.value, filtering?.defaultValue ?? EMPTY_FILTERS, filtering?.onChange);
3239
+ const [selectionState, setSelection] = useControllableState(selection?.value, selection?.defaultValue ?? EMPTY_SELECTION, selection?.onChange);
3240
+ const [expandedState, setExpanded] = useControllableState(expansion?.value, expansion?.defaultValue ?? EMPTY_EXPANDED, expansion?.onChange);
3241
+ const readPaginationSlice = () => ({ pageIndex: paginationConfig?.pageIndex ?? 0, pageSize: paginationConfig?.pageSize ?? DEFAULT_PAGE_SIZE });
3242
+ const initialPagination = useMemo(readPaginationSlice, []);
3243
+ const paginationControlled = manual && !!paginationConfig;
3244
+ const controlledPagination = useMemo(
3245
+ () => paginationControlled ? readPaginationSlice() : void 0,
3246
+ [paginationControlled, paginationConfig?.pageIndex, paginationConfig?.pageSize]
3247
+ );
3248
+ const [paginationStateRaw, setPagination] = useControllableState(controlledPagination, initialPagination, paginationConfig?.onChange);
3249
+ const sorting = sortingState ?? EMPTY_SORTING;
3250
+ const columnFilters = filtersState ?? EMPTY_FILTERS;
3251
+ const rowSelection = selectionState ?? EMPTY_SELECTION;
3252
+ const expanded = expandedState ?? EMPTY_EXPANDED;
3253
+ const paginationValue = paginationStateRaw ?? initialPagination;
3254
+ const resetPageOnManual = () => {
3255
+ if (manual && paginationValue.pageIndex !== 0) setPagination({ ...paginationValue, pageIndex: 0 });
3256
+ };
3257
+ const onSortingChange = (updater) => {
3258
+ setSorting(functionalUpdate(updater, sorting));
3259
+ resetPageOnManual();
3260
+ };
3261
+ const onColumnFiltersChange = (updater) => {
3262
+ setFilters(functionalUpdate(updater, columnFilters));
3263
+ resetPageOnManual();
3264
+ };
3265
+ const onRowSelectionChange = (updater) => setSelection(functionalUpdate(updater, rowSelection));
3266
+ const onExpandedChange = (updater) => setExpanded(functionalUpdate(updater, expanded));
3267
+ const onPaginationChange = (updater) => setPagination(functionalUpdate(updater, paginationValue));
3268
+ const table = useReactTable({
3269
+ data,
3270
+ columns: tanstackColumns,
3271
+ getRowId: (row, index) => getRowId(row, index),
3272
+ state: {
3273
+ sorting,
3274
+ columnFilters,
3275
+ rowSelection,
3276
+ expanded,
3277
+ pagination: paginationValue
3278
+ },
3279
+ onSortingChange,
3280
+ onColumnFiltersChange,
3281
+ onRowSelectionChange,
3282
+ onExpandedChange,
3283
+ onPaginationChange,
3284
+ // Table-level sort switch. Per-column `sortable` is the real gate
3285
+ // (`column.getCanSort()` ANDs both), so a `sorting` config without any
3286
+ // `sortable` column makes no header interactive — keying off the columns
3287
+ // alone is sufficient and avoids implying otherwise.
3288
+ enableSorting: hasSortableColumn,
3289
+ enableMultiSort: sortingConfig?.multi ?? false,
3290
+ enableRowSelection: hasSelection,
3291
+ enableMultiRowSelection: selectionMode === "multiple",
3292
+ enableColumnFilters: hasColumnFilters,
3293
+ manualSorting: manual,
3294
+ manualFiltering: manual,
3295
+ manualPagination: manual,
3296
+ autoResetPageIndex: !manual,
3297
+ rowCount: manual ? paginationConfig?.rowCount : void 0,
3298
+ getCoreRowModel: getCoreRowModel(),
3299
+ getSortedRowModel: manual ? void 0 : getSortedRowModel(),
3300
+ getFilteredRowModel: manual ? void 0 : getFilteredRowModel(),
3301
+ getExpandedRowModel: hasExpansion ? getExpandedRowModel() : void 0,
3302
+ getPaginationRowModel: paginationEnabled && !manual ? getPaginationRowModel() : void 0,
3303
+ getSubRows,
3304
+ getRowCanExpand: hasExpansion && !getSubRows ? () => true : void 0
3305
+ });
3306
+ useEffect(() => {
3307
+ if (!tableRef) return;
3308
+ if (typeof tableRef === "function") tableRef(table);
3309
+ else tableRef.current = table;
3310
+ return () => {
3311
+ if (typeof tableRef === "function") tableRef(null);
3312
+ else tableRef.current = null;
3313
+ };
3314
+ }, [tableRef, table]);
3315
+ const onDataRequestRef = useRef(onDataRequest);
3316
+ onDataRequestRef.current = onDataRequest;
3317
+ const dataRequestKey = useMemo(() => JSON.stringify({ pagination: paginationValue, sorting, filters: columnFilters }), [paginationValue, sorting, columnFilters]);
3318
+ useEffect(() => {
3319
+ if (!manual) return;
3320
+ onDataRequestRef.current?.({ pagination: paginationValue, sorting, filters: columnFilters });
3321
+ }, [manual, dataRequestKey]);
3322
+ useEffect(() => {
3323
+ if (paginationControlled || paginationConfig?.pageSize == null) return;
3324
+ if (table.getState().pagination.pageSize === paginationConfig.pageSize) return;
3325
+ table.setPageSize(paginationConfig.pageSize);
3326
+ }, [paginationControlled, paginationConfig?.pageSize, table]);
3327
+ useEffect(() => {
3328
+ if (paginationControlled || paginationConfig?.pageIndex == null) return;
3329
+ if (table.getState().pagination.pageIndex === paginationConfig.pageIndex) return;
3330
+ table.setPageIndex(paginationConfig.pageIndex);
3331
+ }, [paginationControlled, paginationConfig?.pageIndex, table]);
3332
+ const slotAttrs = useCallback(
3333
+ (slot, attrs) => buildSlotAttrs(TableBase.getSlotProps(slot, attrs), slot, {
3334
+ themeSlotProps: theme?.slotProps,
3335
+ themeClassNames: theme?.classNames,
3336
+ themeClassName: theme?.className,
3337
+ instanceSlotProps: slotProps,
3338
+ instanceClassNames: classNames
3339
+ }),
3340
+ [theme, slotProps, classNames]
3341
+ );
3342
+ const stickyLayout = useMemo(() => computeStickyLayout(buildOrderedColumns(table, { hasSelection, hasExpansion })), [table, tanstackColumns, hasSelection, hasExpansion]);
3343
+ const totalColumnCount = tanstackColumns.length + (hasSelection ? 1 : 0) + (hasExpansion ? 1 : 0);
3344
+ const contextValue = {
3345
+ table,
3346
+ size,
3347
+ striped,
3348
+ bordered,
3349
+ stickyHeader,
3350
+ loading,
3351
+ hasSelection,
3352
+ selectionMode,
3353
+ hasExpansion,
3354
+ treeMode,
3355
+ expansionRender: expansion?.render,
3356
+ hasColumnFilters,
3357
+ stickyLayout,
3358
+ totalColumnCount,
3359
+ emptyState,
3360
+ paginationEnabled,
3361
+ pageSizeOptions,
3362
+ slotAttrs
3363
+ };
3364
+ const tableViewportAttrs = slotAttrs("tableViewport");
3365
+ const handleTableViewportScroll = (event) => {
3366
+ tableViewportAttrs.onScroll?.(event);
3367
+ const nextScrolled = event.currentTarget.scrollTop > 0;
3368
+ setTableViewportScrolled((current) => current === nextScrolled ? current : nextScrolled);
3369
+ };
3370
+ return /* @__PURE__ */ jsx(TableProvider, { value: contextValue, children: /* @__PURE__ */ jsxs("div", { ...rootAttrs, ref, children: [
3371
+ /* @__PURE__ */ jsx("div", { ...tableViewportAttrs, "data-scrolled": tableViewportScrolled ? "" : void 0, onScroll: handleTableViewportScroll, children: /* @__PURE__ */ jsxs("table", { ...slotAttrs("table"), "aria-busy": loading || void 0, children: [
3372
+ /* @__PURE__ */ jsx(TableHeader, {}),
3373
+ /* @__PURE__ */ jsx(TableBody, {})
3374
+ ] }) }),
3375
+ paginationEnabled && /* @__PURE__ */ jsx(TablePagination, {}),
3376
+ loading && // No `aria-hidden`: the Spar Spinner ships `role="status"` +
3377
+ // `aria-label="Loading"`, so the overlay politely announces the
3378
+ // loading transition (the table also carries `aria-busy`).
3379
+ /* @__PURE__ */ jsx("div", { ...slotAttrs("loading"), children: /* @__PURE__ */ jsx(Spinner, {}) })
3380
+ ] }) });
3381
+ };
3382
+ Table.displayName = "Table";
3383
+
3384
+ // src/components/tabs/base.ts
3385
+ var TabsBase = createComponentBase({
3386
+ name: "Tabs",
3387
+ slots: ["root"],
3388
+ classes: { root: "tk-tabs" }
3389
+ });
3390
+ var TabsListBase = createComponentBase({
3391
+ name: "TabsList",
3392
+ slots: ["root"],
3393
+ classes: { root: "tk-tabs-list" }
3394
+ });
3395
+ var TabsTriggerBase = createComponentBase({
3396
+ name: "TabsTrigger",
3397
+ slots: ["root"],
3398
+ classes: { root: "tk-tabs-trigger" }
3399
+ });
3400
+ var TabsContentBase = createComponentBase({
3401
+ name: "TabsContent",
3402
+ slots: ["root"],
3403
+ classes: { root: "tk-tabs-content" }
3404
+ });
3405
+
3406
+ // src/components/tabs/context.ts
3407
+ var [TabsOwnProvider, useTabsOwnContext] = createSafeContext("Tabs");
3408
+
3409
+ // src/components/tabs/defaults.ts
3410
+ var DEFAULT_SIZE13 = "base";
3411
+ var DEFAULT_VARIANT8 = "primary";
3412
+ var DEFAULT_APPEARANCE6 = "basic";
3413
+ var Tabs = (props) => {
3414
+ const theme = useComponentTheme("Tabs");
3415
+ const { rootAttrs, rest } = composeRootAttrs(TabsBase, props, theme, {
3416
+ stateAttrs: ({ size: size2 = DEFAULT_SIZE13, variant: variant2 = DEFAULT_VARIANT8, appearance: appearance2 = DEFAULT_APPEARANCE6 }) => ({
3417
+ "data-size": size2,
3418
+ "data-variant": variant2,
3419
+ "data-type": appearance2
3420
+ })
3421
+ });
3422
+ const { size = DEFAULT_SIZE13, variant = DEFAULT_VARIANT8, appearance = DEFAULT_APPEARANCE6, children, ref, ...sparProps } = rest;
3423
+ return /* @__PURE__ */ jsx(TabsOwnProvider, { value: { size, variant, appearance }, children: /* @__PURE__ */ jsx(Tabs$1, { ...sparProps, ...rootAttrs, ref, children }) });
3424
+ };
3425
+ Tabs.displayName = "Tabs";
3426
+ var TabsList = (props) => {
3427
+ const theme = useComponentTheme("TabsList");
3428
+ const { size, variant, appearance } = useTabsOwnContext("Tabs.List");
3429
+ const { rootAttrs, rest } = composeRootAttrs(TabsListBase, props, theme, {
3430
+ stateAttrs: () => ({
3431
+ "data-size": size,
3432
+ "data-variant": variant,
3433
+ "data-type": appearance
3434
+ })
3435
+ });
3436
+ const { children, ref, ...sparProps } = rest;
3437
+ return /* @__PURE__ */ jsx(TabsList$1, { ...sparProps, ...rootAttrs, ref, children });
3438
+ };
3439
+ TabsList.displayName = "Tabs.List";
3440
+ var TabsTrigger = (props) => {
3441
+ const theme = useComponentTheme("TabsTrigger");
3442
+ const { size, variant, appearance } = useTabsOwnContext("Tabs.Trigger");
3443
+ const { rootAttrs, rest } = composeRootAttrs(TabsTriggerBase, props, theme, {
3444
+ stateAttrs: () => ({
3445
+ "data-size": size,
3446
+ "data-variant": variant,
3447
+ "data-type": appearance
3448
+ })
3449
+ });
3450
+ const { children, ref, ...sparProps } = rest;
3451
+ return /* @__PURE__ */ jsx(TabsTrigger$1, { ...sparProps, ...rootAttrs, ref, children });
3452
+ };
3453
+ TabsTrigger.displayName = "Tabs.Trigger";
3454
+ var TabsContent = (props) => {
3455
+ const theme = useComponentTheme("TabsContent");
3456
+ const { rootAttrs, rest } = composeRootAttrs(TabsContentBase, props, theme);
3457
+ const { children, ref, ...sparProps } = rest;
3458
+ return /* @__PURE__ */ jsx(TabsContent$1, { ...sparProps, ...rootAttrs, ref, children });
3459
+ };
3460
+ TabsContent.displayName = "Tabs.Content";
3461
+
3462
+ // src/components/tabs/index.ts
3463
+ var Tabs2 = Object.assign(Tabs, {
3464
+ List: TabsList,
3465
+ Trigger: TabsTrigger,
3466
+ Content: TabsContent
3467
+ });
1339
3468
  var Tooltip = ({ children, id, open, defaultOpen, onOpenChange, delay, hideDelay, disabled }) => {
1340
3469
  return /* @__PURE__ */ jsx(Tooltip$1, { id, open, defaultOpen, onOpenChange, delay, hideDelay, disabled, children });
1341
3470
  };
@@ -1390,11 +3519,11 @@ var TooltipTrigger = (props) => {
1390
3519
  TooltipTrigger.displayName = "Tooltip.Trigger";
1391
3520
 
1392
3521
  // src/components/tooltip/defaults.ts
1393
- var DEFAULT_VARIANT5 = "dark";
3522
+ var DEFAULT_VARIANT9 = "white";
1394
3523
  var TooltipContent = (props) => {
1395
3524
  const theme = useComponentTheme("TooltipContent");
1396
3525
  const { rootAttrs, rest } = composeRootAttrs(TooltipContentBase, props, theme, {
1397
- stateAttrs: ({ variant = DEFAULT_VARIANT5 }) => ({
3526
+ stateAttrs: ({ variant = DEFAULT_VARIANT9 }) => ({
1398
3527
  "data-variant": variant
1399
3528
  })
1400
3529
  });
@@ -1434,4 +3563,74 @@ var Tooltip2 = Object.assign(Tooltip, {
1434
3563
  Arrow: TooltipArrow
1435
3564
  });
1436
3565
 
1437
- export { Accordion2 as Accordion, Badge, Button, Checkbox2 as Checkbox, Drawer2 as Drawer, Field2 as Field, Input2 as Input, Popover2 as Popover, Radio2 as Radio, Select2 as Select, Switch2 as Switch, TakeoffSparProvider, Tooltip2 as Tooltip, useComponentTheme, useTheme };
3566
+ // src/components/toast/base.ts
3567
+ var ToasterBase = createComponentBase({
3568
+ name: "Toaster",
3569
+ slots: ["root"],
3570
+ classes: {
3571
+ root: "tk-toaster"
3572
+ }
3573
+ });
3574
+ var ToastBase = createComponentBase({
3575
+ name: "Toast",
3576
+ slots: ["root"],
3577
+ classes: {
3578
+ root: "tk-toast"
3579
+ }
3580
+ });
3581
+
3582
+ // src/components/toast/defaults.ts
3583
+ var DEFAULT_TOAST_APPEARANCE = "filled";
3584
+ var DEFAULT_CLOSE_LABEL2 = "Dismiss notification";
3585
+
3586
+ // src/components/toast/utils.ts
3587
+ var toastTypeToVariant = (type) => {
3588
+ switch (type) {
3589
+ case "success":
3590
+ return "success";
3591
+ case "error":
3592
+ return "danger";
3593
+ case "warning":
3594
+ return "warning";
3595
+ case "info":
3596
+ return "info";
3597
+ // 'default' and 'loading' have no dedicated Alert variant.
3598
+ default:
3599
+ return "neutral";
3600
+ }
3601
+ };
3602
+ var Toast = (props) => {
3603
+ const theme = useComponentTheme("Toast");
3604
+ const { rootAttrs, rest } = composeRootAttrs(ToastBase, props, theme);
3605
+ const { as, toast, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL2, children, ref, ...toastProps } = rest;
3606
+ const Component = as ?? "div";
3607
+ const variant = toastTypeToVariant(toast.type);
3608
+ return /* @__PURE__ */ jsx(Toast$1.Root, { ...toastProps, as: Component, ref, toast, toaster, ...rootAttrs, children: children ?? /* @__PURE__ */ jsxs(Alert2, { variant, appearance, role: "presentation", children: [
3609
+ /* @__PURE__ */ jsxs(Alert2.Content, { children: [
3610
+ toast.title != null && /* @__PURE__ */ jsx(Toast$1.Title, { as: Alert2.Title, children: toast.title }),
3611
+ toast.description != null && /* @__PURE__ */ jsx(Toast$1.Description, { as: Alert2.Description, children: toast.description })
3612
+ ] }),
3613
+ /* @__PURE__ */ jsx(Toast$1.Close, { as: Alert2.Close, "aria-label": closeLabel }),
3614
+ toast.action && /* @__PURE__ */ jsx(Alert2.Actions, { children: /* @__PURE__ */ jsx(Toast$1.Action, { as: Button, className: "tk-alert-action", variant, appearance: "text", size: "small" }) })
3615
+ ] }) });
3616
+ };
3617
+ Toast.displayName = "Toast";
3618
+ var Toaster = (props) => {
3619
+ const theme = useComponentTheme("Toaster");
3620
+ const { rootAttrs, rest } = composeRootAttrs(ToasterBase, props, theme, {
3621
+ stateAttrs: ({ toaster: toaster2 }) => ({
3622
+ "data-placement": toaster2.placement
3623
+ })
3624
+ });
3625
+ const { as, toaster, appearance = DEFAULT_TOAST_APPEARANCE, closeLabel = DEFAULT_CLOSE_LABEL2, overlap = false, children, ref, ...toasterProps } = rest;
3626
+ const Component = as ?? "div";
3627
+ return /* @__PURE__ */ jsx(Toaster$1, { ...toasterProps, as: Component, ref, toaster, overlap, ...rootAttrs, children: (toast) => (
3628
+ // Spar renders each item directly into a mapped array, so the key must
3629
+ // live on the element this render prop returns. The default branch keys
3630
+ // <Toast>; a consumer `children` result is keyed via Fragment here.
3631
+ children ? /* @__PURE__ */ jsx(Fragment$1, { children: children(toast) }, toast.id) : /* @__PURE__ */ jsx(Toast, { toast, toaster, appearance, closeLabel }, toast.id)
3632
+ ) });
3633
+ };
3634
+ Toaster.displayName = "Toaster";
3635
+
3636
+ export { Accordion2 as Accordion, Alert2 as Alert, Badge, Breadcrumb2 as Breadcrumb, Button, Card2 as Card, Checkbox2 as Checkbox, Chip, Dialog2 as Dialog, Drawer2 as Drawer, Field2 as Field, Input2 as Input, Label, Popover2 as Popover, Radio2 as Radio, Select2 as Select, Spinner, Switch2 as Switch, Table, Tabs2 as Tabs, TakeoffSparProvider, Toast, Toaster, Tooltip2 as Tooltip, getExportRows, useComponentTheme, useTheme };