@inf-monkeys-tech/monkeys-design 0.4.32 → 0.4.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +226 -226
  3. package/dist/components/base/index.d.mts +2 -2
  4. package/dist/components/base/index.d.ts +2 -2
  5. package/dist/components/base/index.js +990 -28
  6. package/dist/components/base/index.js.map +1 -1
  7. package/dist/components/base/index.mjs +987 -30
  8. package/dist/components/base/index.mjs.map +1 -1
  9. package/dist/components/data-explorer/index.js.map +1 -1
  10. package/dist/components/data-explorer/index.mjs.map +1 -1
  11. package/dist/components/layout/index.js.map +1 -1
  12. package/dist/components/layout/index.mjs.map +1 -1
  13. package/dist/components/login/index.js.map +1 -1
  14. package/dist/components/login/index.mjs.map +1 -1
  15. package/dist/components/toolbar/index.js.map +1 -1
  16. package/dist/components/toolbar/index.mjs.map +1 -1
  17. package/dist/components/workbench/index.d.mts +193 -2
  18. package/dist/components/workbench/index.d.ts +193 -2
  19. package/dist/components/workbench/index.js +2164 -585
  20. package/dist/components/workbench/index.js.map +1 -1
  21. package/dist/components/workbench/index.mjs +2367 -813
  22. package/dist/components/workbench/index.mjs.map +1 -1
  23. package/dist/icons/oauth/index.js.map +1 -1
  24. package/dist/icons/oauth/index.mjs.map +1 -1
  25. package/dist/index.d.mts +3 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +1958 -170
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +1950 -172
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/palette/index.js.map +1 -1
  32. package/dist/palette/index.mjs.map +1 -1
  33. package/dist/registry/index.js.map +1 -1
  34. package/dist/registry/index.mjs.map +1 -1
  35. package/dist/styles/artist-login.scss +374 -374
  36. package/dist/styles/global.scss +21 -21
  37. package/dist/styles/workflow-board.scss +440 -440
  38. package/dist/styles/workflow-nodes.css +340 -340
  39. package/dist/{theme-CvbotXXr.d.ts → theme-Clm5dVb0.d.mts} +10 -3
  40. package/dist/{theme-6RDum855.d.mts → theme-sIoU5-YC.d.ts} +10 -3
  41. package/dist/theme-system/index.d.mts +1 -1
  42. package/dist/theme-system/index.d.ts +1 -1
  43. package/dist/theme-system/index.js +842 -18
  44. package/dist/theme-system/index.js.map +1 -1
  45. package/dist/theme-system/index.mjs +843 -19
  46. package/dist/theme-system/index.mjs.map +1 -1
  47. package/dist/themes/artist/index.js.map +1 -1
  48. package/dist/themes/artist/index.mjs.map +1 -1
  49. package/dist/themes/bsd/index.js.map +1 -1
  50. package/dist/themes/bsd/index.mjs.map +1 -1
  51. package/dist/themes/concept/index.js.map +1 -1
  52. package/dist/themes/concept/index.mjs.map +1 -1
  53. package/dist/themes/default/index.js.map +1 -1
  54. package/dist/themes/default/index.mjs.map +1 -1
  55. package/dist/{types-BgEEUqSm.d.mts → types-Bn6PEDsX.d.mts} +163 -1
  56. package/dist/{types-BgEEUqSm.d.ts → types-Bn6PEDsX.d.ts} +163 -1
  57. package/package.json +139 -138
@@ -1,4 +1,4 @@
1
- import { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext, useContext } from 'react';
1
+ import { forwardRef, useRef, useState, useEffect, useId, useMemo, createContext, useContext, useCallback } from 'react';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import * as ContextMenu from '@radix-ui/react-context-menu';
4
4
 
@@ -363,7 +363,41 @@ var baseSlots = {
363
363
  tableEmptyActions: "mt-4 flex flex-wrap items-center justify-center gap-2",
364
364
  tableLoadingRow: "border-b border-border/60",
365
365
  tableLoadingCell: "px-3 py-2",
366
- tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70"
366
+ tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70",
367
+ layoutRoot: cn(
368
+ "grid min-w-0 overflow-hidden grid-rows-[auto_minmax(0,1fr)_auto] gap-3 rounded-lg border border-border/70 bg-background p-3 text-foreground",
369
+ motionBase
370
+ ),
371
+ layoutRootFull: "h-full min-h-0",
372
+ layoutHeader: "min-w-0",
373
+ layoutBody: "grid min-h-0 min-w-0 overflow-hidden gap-3",
374
+ layoutSidebar: "min-h-0 min-w-0 overflow-hidden",
375
+ layoutMain: "min-h-0 min-w-0 overflow-hidden",
376
+ layoutAside: "min-h-0 min-w-0 overflow-hidden",
377
+ layoutFooter: "min-w-0",
378
+ layoutPane: cn(
379
+ "h-full max-h-full min-h-0 min-w-0 overflow-hidden rounded-lg bg-background text-foreground",
380
+ motionBase
381
+ ),
382
+ layoutPaneScrollable: "overflow-auto",
383
+ layoutPaneBordered: "border border-border/70",
384
+ layoutPaneMuted: "bg-muted/25",
385
+ layoutPaneSoft: "bg-background/95 shadow-sm",
386
+ layoutPaneTransparent: "bg-transparent shadow-none",
387
+ layoutSplitRoot: "grid min-h-0 min-w-0 overflow-hidden",
388
+ layoutSplitHorizontal: "grid-flow-col",
389
+ layoutSplitVertical: "grid-flow-row",
390
+ layoutSplitPane: "min-h-0 min-w-0 overflow-hidden",
391
+ layoutSplitPrimary: "",
392
+ layoutSplitSecondary: "",
393
+ layoutResizeHandle: cn(
394
+ "group/resize relative z-10 flex shrink-0 items-center justify-center bg-transparent text-muted-foreground hover:bg-border/60 active:bg-border/70 focus-visible:bg-border/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
395
+ motionInteractive
396
+ ),
397
+ layoutResizeHandleHorizontal: "w-2 cursor-col-resize",
398
+ layoutResizeHandleVertical: "h-2 cursor-row-resize",
399
+ layoutResizeHandleDisabled: "cursor-default opacity-60",
400
+ layoutResizeHandleIndicator: "rounded-full bg-muted-foreground/45 group-hover/resize:bg-primary/70"
367
401
  };
368
402
  var densitySlots = {
369
403
  compact: {
@@ -437,7 +471,12 @@ var densitySlots = {
437
471
  tableCell: "px-2 py-1.5 text-xs",
438
472
  tableHeadLabel: "text-[11px]",
439
473
  tableHeadDescription: "text-[10px] leading-3",
440
- tableLoadingCell: "px-2 py-1.5"
474
+ tableLoadingCell: "px-2 py-1.5",
475
+ layoutRoot: "gap-2 p-2",
476
+ layoutBody: "gap-2",
477
+ layoutPane: "rounded-md text-xs",
478
+ layoutResizeHandleHorizontal: "w-1.5",
479
+ layoutResizeHandleVertical: "h-1.5"
441
480
  },
442
481
  default: {
443
482
  buttonBase: "h-9"
@@ -488,7 +527,12 @@ var densitySlots = {
488
527
  menuSubTrigger: "min-h-9 px-3 py-2",
489
528
  tableHead: "h-12 px-4 py-3",
490
529
  tableCell: "px-4 py-3",
491
- tableLoadingCell: "px-4 py-3"
530
+ tableLoadingCell: "px-4 py-3",
531
+ layoutRoot: "gap-4 p-4",
532
+ layoutBody: "gap-4",
533
+ layoutPane: "rounded-xl",
534
+ layoutResizeHandleHorizontal: "w-2.5",
535
+ layoutResizeHandleVertical: "h-2.5"
492
536
  }
493
537
  };
494
538
  var radiusSlots = {
@@ -532,7 +576,9 @@ var radiusSlots = {
532
576
  menuSubContent: "rounded-none",
533
577
  tableContainer: "rounded-none",
534
578
  tableEmptyIcon: "rounded-none",
535
- tableLoadingSkeleton: "rounded-none"
579
+ tableLoadingSkeleton: "rounded-none",
580
+ layoutRoot: "rounded-none",
581
+ layoutPane: "rounded-none"
536
582
  },
537
583
  sm: {
538
584
  buttonBase: "rounded-sm",
@@ -574,7 +620,9 @@ var radiusSlots = {
574
620
  menuSubContent: "rounded-sm",
575
621
  tableContainer: "rounded-sm",
576
622
  tableEmptyIcon: "rounded-sm",
577
- tableLoadingSkeleton: "rounded-sm"
623
+ tableLoadingSkeleton: "rounded-sm",
624
+ layoutRoot: "rounded-sm",
625
+ layoutPane: "rounded-sm"
578
626
  },
579
627
  md: {},
580
628
  lg: {
@@ -611,7 +659,9 @@ var radiusSlots = {
611
659
  menuSubContent: "rounded-lg",
612
660
  tableContainer: "rounded-xl",
613
661
  tableEmptyIcon: "rounded-xl",
614
- tableLoadingSkeleton: "rounded-lg"
662
+ tableLoadingSkeleton: "rounded-lg",
663
+ layoutRoot: "rounded-xl",
664
+ layoutPane: "rounded-xl"
615
665
  },
616
666
  xl: {
617
667
  buttonBase: "rounded-xl",
@@ -649,7 +699,9 @@ var radiusSlots = {
649
699
  menuSubContent: "rounded-xl",
650
700
  tableContainer: "rounded-2xl",
651
701
  tableEmptyIcon: "rounded-2xl",
652
- tableLoadingSkeleton: "rounded-xl"
702
+ tableLoadingSkeleton: "rounded-xl",
703
+ layoutRoot: "rounded-2xl",
704
+ layoutPane: "rounded-2xl"
653
705
  },
654
706
  full: {
655
707
  buttonBase: "rounded-full",
@@ -691,7 +743,9 @@ var radiusSlots = {
691
743
  menuSubContent: "rounded-2xl",
692
744
  tableContainer: "rounded-2xl",
693
745
  tableEmptyIcon: "rounded-full",
694
- tableLoadingSkeleton: "rounded-full"
746
+ tableLoadingSkeleton: "rounded-full",
747
+ layoutRoot: "rounded-2xl",
748
+ layoutPane: "rounded-2xl"
695
749
  }
696
750
  };
697
751
  var borderSlots = {
@@ -733,7 +787,10 @@ var borderSlots = {
733
787
  tableFooterBarAttached: "border-t border-transparent",
734
788
  tableRow: "border-transparent",
735
789
  tableEmptyRow: "border-transparent",
736
- tableLoadingRow: "border-transparent"
790
+ tableLoadingRow: "border-transparent",
791
+ layoutRoot: "border-transparent",
792
+ layoutPaneBordered: "border-transparent",
793
+ layoutResizeHandle: "bg-transparent hover:bg-transparent active:bg-transparent focus-visible:bg-transparent"
737
794
  },
738
795
  subtle: {
739
796
  buttonDefault: "border-border/60",
@@ -773,7 +830,9 @@ var borderSlots = {
773
830
  tableFooterBarAttached: "border-t border-border/60",
774
831
  tableRow: "border-border/50",
775
832
  tableEmptyRow: "border-border/50",
776
- tableLoadingRow: "border-border/50"
833
+ tableLoadingRow: "border-border/50",
834
+ layoutRoot: "border-border/60",
835
+ layoutPaneBordered: "border-border/60"
777
836
  },
778
837
  solid: {},
779
838
  strong: {
@@ -814,7 +873,10 @@ var borderSlots = {
814
873
  tableFooterBarAttached: "border-t border-foreground/20",
815
874
  tableRow: "border-foreground/15",
816
875
  tableEmptyRow: "border-foreground/15",
817
- tableLoadingRow: "border-foreground/15"
876
+ tableLoadingRow: "border-foreground/15",
877
+ layoutRoot: "border-foreground/20",
878
+ layoutPaneBordered: "border-foreground/20",
879
+ layoutResizeHandle: "hover:bg-foreground/15 active:bg-foreground/20 focus-visible:bg-foreground/15"
818
880
  }
819
881
  };
820
882
  var backgroundSlots = {
@@ -856,7 +918,11 @@ var backgroundSlots = {
856
918
  tableFooter: "bg-muted/35",
857
919
  tableFooterBar: "bg-muted/30 shadow-none",
858
920
  tableRowInteractive: "cursor-pointer hover:bg-muted/45",
859
- tableLoadingSkeleton: "bg-muted"
921
+ tableLoadingSkeleton: "bg-muted",
922
+ layoutRoot: "bg-card",
923
+ layoutPane: "bg-card",
924
+ layoutPaneMuted: "bg-muted/35",
925
+ layoutResizeHandle: "hover:bg-border/70 active:bg-border/80 focus-visible:bg-border/70"
860
926
  },
861
927
  soft: {
862
928
  buttonDefault: "bg-muted/30 hover:bg-muted/55",
@@ -892,7 +958,10 @@ var backgroundSlots = {
892
958
  tableFooter: "bg-muted/25",
893
959
  tableFooterBar: "bg-muted/25 shadow-none",
894
960
  tableRowInteractive: "cursor-pointer hover:bg-muted/35",
895
- tableLoadingSkeleton: "bg-muted/65"
961
+ tableLoadingSkeleton: "bg-muted/65",
962
+ layoutRoot: "bg-background/95 shadow-sm",
963
+ layoutPane: "bg-background/95 shadow-sm",
964
+ layoutPaneSoft: "bg-background/95 shadow-md"
896
965
  },
897
966
  glass: {
898
967
  buttonBase: "backdrop-blur-md",
@@ -953,7 +1022,13 @@ var backgroundSlots = {
953
1022
  tableRow: "border-white/10",
954
1023
  tableRowInteractive: "cursor-pointer hover:bg-white/[0.08]",
955
1024
  tableHeadLabel: "text-foreground",
956
- tableLoadingSkeleton: "bg-white/[0.16]"
1025
+ tableLoadingSkeleton: "bg-white/[0.16]",
1026
+ layoutRoot: "border-white/10 bg-white/[0.05] shadow-none backdrop-blur-md",
1027
+ layoutPane: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
1028
+ layoutPaneMuted: "bg-white/[0.08]",
1029
+ layoutPaneSoft: "bg-white/[0.10] shadow-none backdrop-blur-md",
1030
+ layoutResizeHandle: "text-foreground/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
1031
+ layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
957
1032
  },
958
1033
  dark: {
959
1034
  buttonBase: "border-white/15 text-white shadow-lg backdrop-blur",
@@ -1082,7 +1157,13 @@ var backgroundSlots = {
1082
1157
  menuSubTrigger: "text-white focus:bg-white/[0.10] focus:text-white data-[highlighted]:bg-white/[0.10] data-[highlighted]:text-white data-[state=open]:bg-white/[0.12]",
1083
1158
  menuSubTriggerIcon: "text-white/55",
1084
1159
  menuSubContent: "border-white/10 bg-slate-950 text-white shadow-2xl",
1085
- tableLoadingSkeleton: "bg-white/[0.14]"
1160
+ tableLoadingSkeleton: "bg-white/[0.14]",
1161
+ layoutRoot: "border-white/10 bg-slate-950 text-white shadow-none",
1162
+ layoutPane: "border-white/10 bg-slate-950 text-white shadow-none",
1163
+ layoutPaneMuted: "bg-white/[0.06]",
1164
+ layoutPaneSoft: "bg-white/[0.08] shadow-none",
1165
+ layoutResizeHandle: "text-white/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
1166
+ layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
1086
1167
  }
1087
1168
  };
1088
1169
  var presetDefaults = {
@@ -2940,6 +3021,432 @@ var BaseInput = forwardRef(
2940
3021
  );
2941
3022
  }
2942
3023
  );
3024
+ var DEFAULT_SPLIT_SIZE = 50;
3025
+ var DEFAULT_MIN_SIZE = 20;
3026
+ var DEFAULT_MAX_SIZE = 80;
3027
+ var DEFAULT_KEYBOARD_STEP = 2.5;
3028
+ function toCssSize(value, fallback) {
3029
+ if (typeof value === "number") {
3030
+ if (!Number.isFinite(value) || value < 0) {
3031
+ throw new Error("BaseLayout size and gap props must be finite, non-negative numbers.");
3032
+ }
3033
+ return `${value}px`;
3034
+ }
3035
+ return value ?? fallback;
3036
+ }
3037
+ function assertPercent(name, value) {
3038
+ if (!Number.isFinite(value)) {
3039
+ throw new Error(`BaseLayoutSplit ${name} must be a finite number.`);
3040
+ }
3041
+ if (value < 0 || value > 100) {
3042
+ throw new Error(`BaseLayoutSplit ${name} must be between 0 and 100.`);
3043
+ }
3044
+ return value;
3045
+ }
3046
+ function clamp(value, min, max) {
3047
+ return Math.min(Math.max(value, min), max);
3048
+ }
3049
+ function resolveSplitBounds({
3050
+ minSize = DEFAULT_MIN_SIZE,
3051
+ maxSize = DEFAULT_MAX_SIZE,
3052
+ keyboardStep = DEFAULT_KEYBOARD_STEP
3053
+ }) {
3054
+ const min = assertPercent("minSize", minSize);
3055
+ const max = assertPercent("maxSize", maxSize);
3056
+ if (min > max) {
3057
+ throw new Error("BaseLayoutSplit minSize cannot be greater than maxSize.");
3058
+ }
3059
+ if (!Number.isFinite(keyboardStep) || keyboardStep <= 0) {
3060
+ throw new Error("BaseLayoutSplit keyboardStep must be a finite positive number.");
3061
+ }
3062
+ return { min, max, keyboardStep };
3063
+ }
3064
+ function resolveSplitSize(name, value, fallback, min, max) {
3065
+ return clamp(assertPercent(name, value ?? fallback), min, max);
3066
+ }
3067
+ function getSeparatorOrientation(orientation) {
3068
+ return orientation === "horizontal" ? "vertical" : "horizontal";
3069
+ }
3070
+ function BaseLayout({
3071
+ header,
3072
+ sidebar,
3073
+ aside,
3074
+ footer,
3075
+ children,
3076
+ sidebarSize,
3077
+ asideSize,
3078
+ gap,
3079
+ fullHeight,
3080
+ appearance,
3081
+ className,
3082
+ classNames,
3083
+ style,
3084
+ ...layoutProps
3085
+ }) {
3086
+ const theme = resolveBaseAppearance(appearance);
3087
+ const hasHeader = hasRenderableNode(header);
3088
+ const hasSidebar = hasRenderableNode(sidebar);
3089
+ const hasAside = hasRenderableNode(aside);
3090
+ const hasFooter = hasRenderableNode(footer);
3091
+ const bodyColumns = [
3092
+ hasSidebar ? "var(--base-layout-sidebar-size)" : void 0,
3093
+ "minmax(0, 1fr)",
3094
+ hasAside ? "var(--base-layout-aside-size)" : void 0
3095
+ ].filter(Boolean).join(" ");
3096
+ const layoutRows = [
3097
+ hasHeader ? "auto" : void 0,
3098
+ "minmax(0, 1fr)",
3099
+ hasFooter ? "auto" : void 0
3100
+ ].filter(Boolean).join(" ");
3101
+ const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
3102
+ const layoutStyle = {
3103
+ ...theme.styles.layout,
3104
+ "--base-layout-sidebar-size": toCssSize(sidebarSize, "16rem"),
3105
+ "--base-layout-aside-size": toCssSize(asideSize, "20rem"),
3106
+ gridTemplateRows: layoutRows,
3107
+ ...resolvedGap !== void 0 ? { gap: resolvedGap } : {},
3108
+ ...style
3109
+ };
3110
+ const bodyStyle = {
3111
+ ...theme.styles.layoutBody,
3112
+ gridTemplateColumns: bodyColumns,
3113
+ ...resolvedGap !== void 0 ? { gap: resolvedGap } : {}
3114
+ };
3115
+ return /* @__PURE__ */ jsxs(
3116
+ "div",
3117
+ {
3118
+ ...layoutProps,
3119
+ className: cn(
3120
+ theme.slots.layoutRoot,
3121
+ fullHeight && theme.slots.layoutRootFull,
3122
+ classNames?.root,
3123
+ className
3124
+ ),
3125
+ style: layoutStyle,
3126
+ children: [
3127
+ hasHeader ? /* @__PURE__ */ jsx(
3128
+ "div",
3129
+ {
3130
+ className: cn(theme.slots.layoutHeader, classNames?.header),
3131
+ style: theme.styles.layoutHeader,
3132
+ children: header
3133
+ }
3134
+ ) : null,
3135
+ /* @__PURE__ */ jsxs(
3136
+ "div",
3137
+ {
3138
+ className: cn(theme.slots.layoutBody, classNames?.body),
3139
+ style: bodyStyle,
3140
+ children: [
3141
+ hasSidebar ? /* @__PURE__ */ jsx(
3142
+ "aside",
3143
+ {
3144
+ className: cn(theme.slots.layoutSidebar, classNames?.sidebar),
3145
+ style: theme.styles.layoutSidebar,
3146
+ children: sidebar
3147
+ }
3148
+ ) : null,
3149
+ /* @__PURE__ */ jsx(
3150
+ "main",
3151
+ {
3152
+ className: cn(theme.slots.layoutMain, classNames?.main),
3153
+ style: theme.styles.layoutMain,
3154
+ children
3155
+ }
3156
+ ),
3157
+ hasAside ? /* @__PURE__ */ jsx(
3158
+ "aside",
3159
+ {
3160
+ className: cn(theme.slots.layoutAside, classNames?.aside),
3161
+ style: theme.styles.layoutAside,
3162
+ children: aside
3163
+ }
3164
+ ) : null
3165
+ ]
3166
+ }
3167
+ ),
3168
+ hasFooter ? /* @__PURE__ */ jsx(
3169
+ "div",
3170
+ {
3171
+ className: cn(theme.slots.layoutFooter, classNames?.footer),
3172
+ style: theme.styles.layoutFooter,
3173
+ children: footer
3174
+ }
3175
+ ) : null
3176
+ ]
3177
+ }
3178
+ );
3179
+ }
3180
+ function BaseLayoutPane({
3181
+ as = "div",
3182
+ scrollable = false,
3183
+ bordered = true,
3184
+ surface = "default",
3185
+ children,
3186
+ appearance,
3187
+ className,
3188
+ classNames,
3189
+ style,
3190
+ ...paneProps
3191
+ }) {
3192
+ const theme = resolveBaseAppearance(appearance);
3193
+ const Component = as;
3194
+ return /* @__PURE__ */ jsx(
3195
+ Component,
3196
+ {
3197
+ ...paneProps,
3198
+ className: cn(
3199
+ theme.slots.layoutPane,
3200
+ scrollable && theme.slots.layoutPaneScrollable,
3201
+ bordered && theme.slots.layoutPaneBordered,
3202
+ surface === "muted" && theme.slots.layoutPaneMuted,
3203
+ surface === "soft" && theme.slots.layoutPaneSoft,
3204
+ surface === "transparent" && theme.slots.layoutPaneTransparent,
3205
+ classNames?.root,
3206
+ className
3207
+ ),
3208
+ style: {
3209
+ ...theme.styles.layoutPane,
3210
+ ...style
3211
+ },
3212
+ children
3213
+ }
3214
+ );
3215
+ }
3216
+ function BaseLayoutResizeHandle({
3217
+ orientation = "horizontal",
3218
+ resizable = false,
3219
+ disabled = false,
3220
+ size,
3221
+ minSize,
3222
+ maxSize,
3223
+ label = "Resize panels",
3224
+ appearance,
3225
+ className,
3226
+ classNames,
3227
+ style,
3228
+ tabIndex,
3229
+ ...handleProps
3230
+ }) {
3231
+ const theme = resolveBaseAppearance(appearance);
3232
+ const interactive = resizable && !disabled;
3233
+ const separatorOrientation = getSeparatorOrientation(orientation);
3234
+ return /* @__PURE__ */ jsx(
3235
+ "div",
3236
+ {
3237
+ ...handleProps,
3238
+ role: interactive ? "separator" : void 0,
3239
+ "aria-label": interactive ? label : void 0,
3240
+ "aria-orientation": interactive ? separatorOrientation : void 0,
3241
+ "aria-valuemin": interactive ? minSize : void 0,
3242
+ "aria-valuemax": interactive ? maxSize : void 0,
3243
+ "aria-valuenow": interactive ? size : void 0,
3244
+ "aria-disabled": interactive ? void 0 : true,
3245
+ tabIndex: interactive ? tabIndex ?? 0 : void 0,
3246
+ className: cn(
3247
+ theme.slots.layoutResizeHandle,
3248
+ orientation === "horizontal" ? theme.slots.layoutResizeHandleHorizontal : theme.slots.layoutResizeHandleVertical,
3249
+ !interactive && theme.slots.layoutResizeHandleDisabled,
3250
+ classNames?.root,
3251
+ className
3252
+ ),
3253
+ style: {
3254
+ ...theme.styles.layoutResizeHandle,
3255
+ ...style
3256
+ },
3257
+ children: /* @__PURE__ */ jsx(
3258
+ "span",
3259
+ {
3260
+ "aria-hidden": "true",
3261
+ className: cn(
3262
+ theme.slots.layoutResizeHandleIndicator,
3263
+ orientation === "horizontal" ? "h-8 w-px" : "h-px w-8",
3264
+ classNames?.indicator
3265
+ )
3266
+ }
3267
+ )
3268
+ }
3269
+ );
3270
+ }
3271
+ function BaseLayoutSplit({
3272
+ orientation = "horizontal",
3273
+ primary,
3274
+ secondary,
3275
+ children,
3276
+ resizable = false,
3277
+ size,
3278
+ defaultSize,
3279
+ minSize,
3280
+ maxSize,
3281
+ gap,
3282
+ keyboardStep,
3283
+ resizeLabel,
3284
+ appearance,
3285
+ className,
3286
+ classNames,
3287
+ style,
3288
+ onSizeChange,
3289
+ ...splitProps
3290
+ }) {
3291
+ const theme = resolveBaseAppearance(appearance);
3292
+ const bounds = resolveSplitBounds({ minSize, maxSize, keyboardStep });
3293
+ const initialSize = resolveSplitSize(
3294
+ "defaultSize",
3295
+ defaultSize,
3296
+ DEFAULT_SPLIT_SIZE,
3297
+ bounds.min,
3298
+ bounds.max
3299
+ );
3300
+ const [uncontrolledSize, setUncontrolledSize] = useState(initialSize);
3301
+ const rootRef = useRef(null);
3302
+ const cleanupRef = useRef(null);
3303
+ const controlled = size !== void 0;
3304
+ const renderedSize = resolveSplitSize(
3305
+ "size",
3306
+ controlled ? size : uncontrolledSize,
3307
+ initialSize,
3308
+ bounds.min,
3309
+ bounds.max
3310
+ );
3311
+ const commitSize = useCallback(
3312
+ (nextSize) => {
3313
+ const clampedSize = clamp(nextSize, bounds.min, bounds.max);
3314
+ if (!controlled) {
3315
+ setUncontrolledSize(clampedSize);
3316
+ }
3317
+ onSizeChange?.(clampedSize);
3318
+ },
3319
+ [bounds.max, bounds.min, controlled, onSizeChange]
3320
+ );
3321
+ const updateFromPointer = useCallback(
3322
+ (event) => {
3323
+ const root = rootRef.current;
3324
+ if (!root) return;
3325
+ const rect = root.getBoundingClientRect();
3326
+ const total = orientation === "horizontal" ? rect.width : rect.height;
3327
+ if (total <= 0) return;
3328
+ const offset = orientation === "horizontal" ? event.clientX - rect.left : event.clientY - rect.top;
3329
+ commitSize(offset / total * 100);
3330
+ },
3331
+ [commitSize, orientation]
3332
+ );
3333
+ const stopResize = useCallback(() => {
3334
+ cleanupRef.current?.();
3335
+ cleanupRef.current = null;
3336
+ }, []);
3337
+ useEffect(() => stopResize, [stopResize]);
3338
+ const handlePointerDown = (event) => {
3339
+ if (!resizable) return;
3340
+ event.preventDefault();
3341
+ stopResize();
3342
+ updateFromPointer(event);
3343
+ const handleMove = (nextEvent) => {
3344
+ updateFromPointer(nextEvent);
3345
+ };
3346
+ const handleStop = () => {
3347
+ stopResize();
3348
+ };
3349
+ window.addEventListener("pointermove", handleMove);
3350
+ window.addEventListener("pointerup", handleStop, { once: true });
3351
+ window.addEventListener("pointercancel", handleStop, { once: true });
3352
+ cleanupRef.current = () => {
3353
+ window.removeEventListener("pointermove", handleMove);
3354
+ window.removeEventListener("pointerup", handleStop);
3355
+ window.removeEventListener("pointercancel", handleStop);
3356
+ };
3357
+ };
3358
+ const handleKeyDown = (event) => {
3359
+ if (!resizable) return;
3360
+ const step = event.shiftKey ? bounds.keyboardStep * 4 : bounds.keyboardStep;
3361
+ let nextSize;
3362
+ if (event.key === "Home") nextSize = bounds.min;
3363
+ if (event.key === "End") nextSize = bounds.max;
3364
+ if (orientation === "horizontal" && event.key === "ArrowLeft") {
3365
+ nextSize = renderedSize - step;
3366
+ }
3367
+ if (orientation === "horizontal" && event.key === "ArrowRight") {
3368
+ nextSize = renderedSize + step;
3369
+ }
3370
+ if (orientation === "vertical" && event.key === "ArrowUp") {
3371
+ nextSize = renderedSize - step;
3372
+ }
3373
+ if (orientation === "vertical" && event.key === "ArrowDown") {
3374
+ nextSize = renderedSize + step;
3375
+ }
3376
+ if (nextSize === void 0) return;
3377
+ event.preventDefault();
3378
+ commitSize(nextSize);
3379
+ };
3380
+ const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
3381
+ const resizeTrack = resolvedGap !== void 0 ? "var(--base-layout-split-gap)" : "auto";
3382
+ const resizeHandleStyle = resolvedGap !== void 0 ? orientation === "horizontal" ? { width: "var(--base-layout-split-gap)" } : { height: "var(--base-layout-split-gap)" } : void 0;
3383
+ const splitStyle = {
3384
+ ...theme.styles.layoutSplit,
3385
+ [orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: resizable ? `${renderedSize}% ${resizeTrack} minmax(0, 1fr)` : `${renderedSize}% minmax(0, 1fr)`,
3386
+ ...resizable ? { gap: 0 } : {},
3387
+ ...resolvedGap !== void 0 ? {
3388
+ "--base-layout-split-gap": resolvedGap,
3389
+ ...resizable ? {} : { gap: resolvedGap }
3390
+ } : {},
3391
+ ...style
3392
+ };
3393
+ return /* @__PURE__ */ jsxs(
3394
+ "div",
3395
+ {
3396
+ ...splitProps,
3397
+ ref: rootRef,
3398
+ className: cn(
3399
+ theme.slots.layoutSplitRoot,
3400
+ orientation === "horizontal" ? theme.slots.layoutSplitHorizontal : theme.slots.layoutSplitVertical,
3401
+ classNames?.root,
3402
+ className
3403
+ ),
3404
+ style: splitStyle,
3405
+ children: [
3406
+ /* @__PURE__ */ jsx(
3407
+ "div",
3408
+ {
3409
+ className: cn(
3410
+ theme.slots.layoutSplitPane,
3411
+ theme.slots.layoutSplitPrimary,
3412
+ classNames?.primary
3413
+ ),
3414
+ style: theme.styles.layoutSplitPane,
3415
+ children: hasRenderableNode(primary) ? primary : children
3416
+ }
3417
+ ),
3418
+ resizable ? /* @__PURE__ */ jsx(
3419
+ BaseLayoutResizeHandle,
3420
+ {
3421
+ orientation,
3422
+ resizable: true,
3423
+ size: renderedSize,
3424
+ minSize: bounds.min,
3425
+ maxSize: bounds.max,
3426
+ label: resizeLabel,
3427
+ appearance,
3428
+ className: classNames?.handle,
3429
+ style: resizeHandleStyle,
3430
+ onPointerDown: handlePointerDown,
3431
+ onKeyDown: handleKeyDown
3432
+ }
3433
+ ) : null,
3434
+ /* @__PURE__ */ jsx(
3435
+ "div",
3436
+ {
3437
+ className: cn(
3438
+ theme.slots.layoutSplitPane,
3439
+ theme.slots.layoutSplitSecondary,
3440
+ classNames?.secondary
3441
+ ),
3442
+ style: theme.styles.layoutSplitPane,
3443
+ children: secondary
3444
+ }
3445
+ )
3446
+ ]
3447
+ }
3448
+ );
3449
+ }
2943
3450
  function DefaultLoadingIcon({ className }) {
2944
3451
  return /* @__PURE__ */ jsxs(
2945
3452
  "svg",
@@ -3017,6 +3524,448 @@ function BaseLoadingState({
3017
3524
  }
3018
3525
  );
3019
3526
  }
3527
+ function normalizeValues(values) {
3528
+ const nextValues = [];
3529
+ const seen = /* @__PURE__ */ new Set();
3530
+ values?.forEach((value) => {
3531
+ if (seen.has(value)) return;
3532
+ seen.add(value);
3533
+ nextValues.push(value);
3534
+ });
3535
+ return nextValues;
3536
+ }
3537
+ function getNextEnabledIndex(options, currentIndex, direction) {
3538
+ if (!options.length) return -1;
3539
+ const startIndex = currentIndex >= 0 ? currentIndex : 0;
3540
+ for (let offset = 1; offset <= options.length; offset += 1) {
3541
+ const nextIndex = (startIndex + offset * direction + options.length) % options.length;
3542
+ if (!options[nextIndex]?.disabled) {
3543
+ return nextIndex;
3544
+ }
3545
+ }
3546
+ return -1;
3547
+ }
3548
+ function getFirstEnabledIndex(options) {
3549
+ return options.findIndex((option) => !option.disabled);
3550
+ }
3551
+ function getSafeTagCount(maxTagCount, total) {
3552
+ if (maxTagCount === void 0) return total;
3553
+ if (!Number.isFinite(maxTagCount)) return total;
3554
+ return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
3555
+ }
3556
+ function getDefaultRemoveLabel(option) {
3557
+ return `Remove ${option.value}`;
3558
+ }
3559
+ var BaseMultiSelect = forwardRef(
3560
+ function BaseMultiSelect2({
3561
+ options,
3562
+ value,
3563
+ defaultValue,
3564
+ name,
3565
+ placeholder = "Select options",
3566
+ icon,
3567
+ invalid = false,
3568
+ disabled = false,
3569
+ required = false,
3570
+ openForPreview = false,
3571
+ maxTagCount,
3572
+ removeLabel = getDefaultRemoveLabel,
3573
+ emptyLabel = "No options",
3574
+ appearance,
3575
+ className,
3576
+ classNames,
3577
+ style,
3578
+ id,
3579
+ "aria-invalid": nativeAriaInvalid,
3580
+ "aria-label": nativeAriaLabel,
3581
+ "aria-labelledby": nativeAriaLabelledBy,
3582
+ onValueChange,
3583
+ ...rootProps
3584
+ }, ref) {
3585
+ const theme = resolveBaseAppearance(appearance);
3586
+ const generatedId = useId();
3587
+ const multiSelectId = id ?? generatedId;
3588
+ const controlId = `${multiSelectId}-control`;
3589
+ const listboxId = `${multiSelectId}-listbox`;
3590
+ const rootRef = useRef(null);
3591
+ const optionList = options ?? [];
3592
+ const forceOpen = openForPreview;
3593
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
3594
+ const open = forceOpen || uncontrolledOpen;
3595
+ const [uncontrolledValue, setUncontrolledValue] = useState(
3596
+ () => normalizeValues(defaultValue)
3597
+ );
3598
+ const [activeIndex, setActiveIndex] = useState(
3599
+ () => getFirstEnabledIndex(optionList)
3600
+ );
3601
+ const isControlled = value !== void 0;
3602
+ const selectedValues = useMemo(
3603
+ () => normalizeValues(isControlled ? value : uncontrolledValue),
3604
+ [isControlled, uncontrolledValue, value]
3605
+ );
3606
+ const selectedValueSet = useMemo(
3607
+ () => new Set(selectedValues),
3608
+ [selectedValues]
3609
+ );
3610
+ const optionByValue = useMemo(() => {
3611
+ const map = /* @__PURE__ */ new Map();
3612
+ optionList.forEach((option) => {
3613
+ if (!map.has(option.value)) {
3614
+ map.set(option.value, option);
3615
+ }
3616
+ });
3617
+ return map;
3618
+ }, [optionList]);
3619
+ const selectedOptions = useMemo(
3620
+ () => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
3621
+ (option) => option !== void 0
3622
+ ),
3623
+ [optionByValue, selectedValues]
3624
+ );
3625
+ const firstEnabledIndex = useMemo(
3626
+ () => getFirstEnabledIndex(optionList),
3627
+ [optionList]
3628
+ );
3629
+ const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
3630
+ const visibleTagCount = getSafeTagCount(
3631
+ maxTagCount,
3632
+ selectedOptions.length
3633
+ );
3634
+ const visibleOptions = selectedOptions.slice(0, visibleTagCount);
3635
+ const overflowCount = selectedOptions.length - visibleOptions.length;
3636
+ const isPlaceholder = selectedOptions.length === 0;
3637
+ const setRootRef = (node) => {
3638
+ rootRef.current = node;
3639
+ if (typeof ref === "function") {
3640
+ ref(node);
3641
+ } else if (ref) {
3642
+ ref.current = node;
3643
+ }
3644
+ };
3645
+ const setOpen = (nextOpen) => {
3646
+ if (disabled || forceOpen) return;
3647
+ setUncontrolledOpen(nextOpen);
3648
+ if (nextOpen) {
3649
+ setActiveIndex(resolvedActiveIndex);
3650
+ }
3651
+ };
3652
+ useEffect(() => {
3653
+ if (!open || forceOpen) return void 0;
3654
+ const handlePointerDown = (event) => {
3655
+ if (!rootRef.current?.contains(event.target)) {
3656
+ setUncontrolledOpen(false);
3657
+ }
3658
+ };
3659
+ document.addEventListener("pointerdown", handlePointerDown);
3660
+ return () => {
3661
+ document.removeEventListener("pointerdown", handlePointerDown);
3662
+ };
3663
+ }, [forceOpen, open]);
3664
+ useEffect(() => {
3665
+ if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
3666
+ setActiveIndex(resolvedActiveIndex);
3667
+ }
3668
+ }, [activeIndex, resolvedActiveIndex]);
3669
+ const commitValues = (nextValues) => {
3670
+ const normalizedValues = normalizeValues(nextValues);
3671
+ if (!isControlled) {
3672
+ setUncontrolledValue(normalizedValues);
3673
+ }
3674
+ onValueChange?.(normalizedValues);
3675
+ };
3676
+ const toggleOption = (option) => {
3677
+ if (!option || option.disabled || disabled) return;
3678
+ const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
3679
+ commitValues(nextValues);
3680
+ };
3681
+ const removeOption = (option) => {
3682
+ if (disabled) return;
3683
+ commitValues(
3684
+ selectedValues.filter((selectedValue) => selectedValue !== option.value)
3685
+ );
3686
+ };
3687
+ const focusOption = (direction) => {
3688
+ const nextIndex = getNextEnabledIndex(
3689
+ optionList,
3690
+ resolvedActiveIndex,
3691
+ direction
3692
+ );
3693
+ if (nextIndex >= 0) {
3694
+ setActiveIndex(nextIndex);
3695
+ }
3696
+ };
3697
+ const handleKeyDown = (event) => {
3698
+ if (disabled) return;
3699
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
3700
+ event.preventDefault();
3701
+ if (!open) {
3702
+ setOpen(true);
3703
+ setActiveIndex(firstEnabledIndex);
3704
+ return;
3705
+ }
3706
+ focusOption(event.key === "ArrowDown" ? 1 : -1);
3707
+ return;
3708
+ }
3709
+ if (event.key === "Home") {
3710
+ event.preventDefault();
3711
+ setOpen(true);
3712
+ setActiveIndex(firstEnabledIndex);
3713
+ return;
3714
+ }
3715
+ if (event.key === "End") {
3716
+ event.preventDefault();
3717
+ setOpen(true);
3718
+ for (let index = optionList.length - 1; index >= 0; index -= 1) {
3719
+ if (!optionList[index]?.disabled) {
3720
+ setActiveIndex(index);
3721
+ break;
3722
+ }
3723
+ }
3724
+ return;
3725
+ }
3726
+ if (event.key === "Enter" || event.key === " ") {
3727
+ event.preventDefault();
3728
+ if (!open) {
3729
+ setOpen(true);
3730
+ return;
3731
+ }
3732
+ toggleOption(optionList[resolvedActiveIndex]);
3733
+ return;
3734
+ }
3735
+ if (event.key === "Escape") {
3736
+ setOpen(false);
3737
+ }
3738
+ };
3739
+ return /* @__PURE__ */ jsxs(
3740
+ "div",
3741
+ {
3742
+ ...rootProps,
3743
+ id,
3744
+ ref: setRootRef,
3745
+ className: cn(
3746
+ theme.slots.controlWrapper,
3747
+ "overflow-visible",
3748
+ open && "z-50",
3749
+ invalid && theme.slots.controlInvalid,
3750
+ disabled && theme.slots.controlDisabled,
3751
+ classNames?.root,
3752
+ className
3753
+ ),
3754
+ style: {
3755
+ ...theme.styles.control,
3756
+ ...invalid ? theme.styles.controlInvalid : void 0,
3757
+ ...disabled ? theme.styles.controlDisabled : void 0,
3758
+ ...style
3759
+ },
3760
+ children: [
3761
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
3762
+ /* @__PURE__ */ jsx(
3763
+ "div",
3764
+ {
3765
+ id: controlId,
3766
+ role: "combobox",
3767
+ tabIndex: disabled ? -1 : 0,
3768
+ "aria-haspopup": "listbox",
3769
+ "aria-expanded": open,
3770
+ "aria-controls": listboxId,
3771
+ "aria-disabled": disabled || void 0,
3772
+ "aria-required": required || void 0,
3773
+ "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
3774
+ "aria-label": nativeAriaLabel,
3775
+ "aria-labelledby": nativeAriaLabelledBy,
3776
+ className: cn(
3777
+ theme.slots.controlBase,
3778
+ "flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
3779
+ disabled && "!cursor-not-allowed",
3780
+ classNames?.control
3781
+ ),
3782
+ onClick: () => setOpen(!open),
3783
+ onKeyDown: handleKeyDown,
3784
+ children: /* @__PURE__ */ jsxs(
3785
+ "span",
3786
+ {
3787
+ className: cn(
3788
+ "flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
3789
+ classNames?.tagList
3790
+ ),
3791
+ children: [
3792
+ visibleOptions.map((option) => /* @__PURE__ */ jsxs(
3793
+ "span",
3794
+ {
3795
+ className: cn(
3796
+ "inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-muted/65 px-2 py-0.5 text-xs font-medium text-foreground",
3797
+ classNames?.tag
3798
+ ),
3799
+ children: [
3800
+ /* @__PURE__ */ jsx(
3801
+ "span",
3802
+ {
3803
+ className: cn(
3804
+ "max-w-40 truncate",
3805
+ classNames?.tagLabel
3806
+ ),
3807
+ children: option.label
3808
+ }
3809
+ ),
3810
+ /* @__PURE__ */ jsx(
3811
+ "button",
3812
+ {
3813
+ type: "button",
3814
+ "aria-label": removeLabel(option),
3815
+ disabled,
3816
+ className: cn(
3817
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background/80 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed",
3818
+ classNames?.tagRemove
3819
+ ),
3820
+ onClick: (event) => {
3821
+ event.preventDefault();
3822
+ event.stopPropagation();
3823
+ removeOption(option);
3824
+ },
3825
+ onMouseDown: (event) => {
3826
+ event.preventDefault();
3827
+ event.stopPropagation();
3828
+ },
3829
+ onKeyDown: (event) => event.stopPropagation(),
3830
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "x" })
3831
+ }
3832
+ )
3833
+ ]
3834
+ },
3835
+ option.value
3836
+ )),
3837
+ overflowCount > 0 ? /* @__PURE__ */ jsxs(
3838
+ "span",
3839
+ {
3840
+ className: cn(
3841
+ "inline-flex max-w-full items-center rounded-full border border-border/70 bg-muted/45 px-2 py-0.5 text-xs font-medium text-muted-foreground",
3842
+ classNames?.tag
3843
+ ),
3844
+ children: [
3845
+ "+",
3846
+ overflowCount
3847
+ ]
3848
+ }
3849
+ ) : null,
3850
+ isPlaceholder ? /* @__PURE__ */ jsx(
3851
+ "span",
3852
+ {
3853
+ className: cn(
3854
+ "min-w-0 truncate",
3855
+ theme.slots.selectPlaceholder,
3856
+ classNames?.placeholder
3857
+ ),
3858
+ children: placeholder
3859
+ }
3860
+ ) : null
3861
+ ]
3862
+ }
3863
+ )
3864
+ }
3865
+ ),
3866
+ /* @__PURE__ */ jsx(
3867
+ "span",
3868
+ {
3869
+ className: cn(
3870
+ theme.slots.selectChevron,
3871
+ open && "rotate-[225deg]",
3872
+ classNames?.chevron
3873
+ )
3874
+ }
3875
+ ),
3876
+ name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsx(
3877
+ "input",
3878
+ {
3879
+ type: "hidden",
3880
+ name,
3881
+ value: selectedValue,
3882
+ className: classNames?.hiddenInput
3883
+ },
3884
+ selectedValue
3885
+ )) : null,
3886
+ open ? /* @__PURE__ */ jsx(
3887
+ "div",
3888
+ {
3889
+ id: listboxId,
3890
+ role: "listbox",
3891
+ "aria-multiselectable": "true",
3892
+ "aria-labelledby": controlId,
3893
+ className: cn(theme.slots.selectMenu, classNames?.menu),
3894
+ style: theme.styles.selectMenu,
3895
+ children: optionList.length > 0 ? optionList.map((option, index) => {
3896
+ const selected = selectedValueSet.has(option.value);
3897
+ const active = index === resolvedActiveIndex;
3898
+ return /* @__PURE__ */ jsxs(
3899
+ "button",
3900
+ {
3901
+ type: "button",
3902
+ role: "option",
3903
+ "aria-selected": selected,
3904
+ disabled: option.disabled,
3905
+ className: cn(
3906
+ theme.slots.selectOption,
3907
+ "gap-2",
3908
+ active && theme.slots.selectOptionActive,
3909
+ selected && theme.slots.selectOptionSelected,
3910
+ option.disabled && theme.slots.selectOptionDisabled,
3911
+ classNames?.option
3912
+ ),
3913
+ style: {
3914
+ ...theme.styles.selectOption,
3915
+ ...active ? theme.styles.selectOptionActive : void 0,
3916
+ ...selected ? theme.styles.selectOptionSelected : void 0
3917
+ },
3918
+ onMouseEnter: () => {
3919
+ if (!option.disabled) {
3920
+ setActiveIndex(index);
3921
+ }
3922
+ },
3923
+ onMouseDown: (event) => event.preventDefault(),
3924
+ onClick: () => toggleOption(option),
3925
+ children: [
3926
+ /* @__PURE__ */ jsx(
3927
+ "span",
3928
+ {
3929
+ "aria-hidden": "true",
3930
+ className: cn(
3931
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
3932
+ selected && "border-primary/40 bg-primary text-primary-foreground",
3933
+ classNames?.optionIndicator
3934
+ ),
3935
+ children: selected ? "\u2713" : null
3936
+ }
3937
+ ),
3938
+ /* @__PURE__ */ jsx(
3939
+ "span",
3940
+ {
3941
+ className: cn(
3942
+ "min-w-0 flex-1 truncate",
3943
+ classNames?.optionLabel
3944
+ ),
3945
+ children: option.label
3946
+ }
3947
+ )
3948
+ ]
3949
+ },
3950
+ option.value
3951
+ );
3952
+ }) : /* @__PURE__ */ jsx(
3953
+ "div",
3954
+ {
3955
+ className: cn(
3956
+ "px-2.5 py-2 text-sm text-muted-foreground",
3957
+ classNames?.empty
3958
+ ),
3959
+ children: emptyLabel
3960
+ }
3961
+ )
3962
+ }
3963
+ ) : null
3964
+ ]
3965
+ }
3966
+ );
3967
+ }
3968
+ );
3020
3969
  function BaseNotice({
3021
3970
  tone,
3022
3971
  icon,
@@ -3229,7 +4178,7 @@ function BasePagination({
3229
4178
  function toFiniteNumber(value, fallback) {
3230
4179
  return Number.isFinite(value) ? Number(value) : fallback;
3231
4180
  }
3232
- function clamp(value, min, max) {
4181
+ function clamp2(value, min, max) {
3233
4182
  return Math.min(Math.max(value, min), max);
3234
4183
  }
3235
4184
  function BaseProgress({
@@ -3247,7 +4196,7 @@ function BaseProgress({
3247
4196
  }) {
3248
4197
  const theme = resolveBaseAppearance(appearance);
3249
4198
  const safeMax = Math.max(toFiniteNumber(max, 100), 1);
3250
- const safeValue = clamp(toFiniteNumber(value, 0), 0, safeMax);
4199
+ const safeValue = clamp2(toFiniteNumber(value, 0), 0, safeMax);
3251
4200
  const percent = safeValue / safeMax * 100;
3252
4201
  const renderedValue = valueFormatter?.(safeValue, safeMax) ?? `${Math.round(percent)}%`;
3253
4202
  const hasLabelRow = hasRenderableNode(label) || showValue;
@@ -3418,7 +4367,7 @@ function getInitialValue2(options, defaultValue) {
3418
4367
  }
3419
4368
  return "";
3420
4369
  }
3421
- function getNextEnabledIndex(options, currentIndex, direction) {
4370
+ function getNextEnabledIndex2(options, currentIndex, direction) {
3422
4371
  if (!options.length) return -1;
3423
4372
  for (let offset = 1; offset <= options.length; offset += 1) {
3424
4373
  const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
@@ -3520,7 +4469,7 @@ var BaseSelect = forwardRef(
3520
4469
  };
3521
4470
  const focusOption = (direction) => {
3522
4471
  const currentIndex = activeIndex >= 0 ? activeIndex : 0;
3523
- const nextIndex = getNextEnabledIndex(optionList, currentIndex, direction);
4472
+ const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
3524
4473
  if (nextIndex >= 0) {
3525
4474
  commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
3526
4475
  }
@@ -4013,7 +4962,7 @@ function useBaseTableContext(appearance) {
4013
4962
  }
4014
4963
  };
4015
4964
  }
4016
- function toCssSize(value) {
4965
+ function toCssSize2(value) {
4017
4966
  if (value === void 0) return void 0;
4018
4967
  return typeof value === "number" ? `${value}px` : value;
4019
4968
  }
@@ -4226,7 +5175,7 @@ function BaseTableRow({
4226
5175
  }
4227
5176
  );
4228
5177
  }
4229
- function BaseTableHead({
5178
+ var BaseTableHead = forwardRef(function BaseTableHead2({
4230
5179
  columnId,
4231
5180
  align = "left",
4232
5181
  icon,
@@ -4254,10 +5203,18 @@ function BaseTableHead({
4254
5203
  onDragOver,
4255
5204
  onDrop,
4256
5205
  ...headProps
4257
- }) {
5206
+ }, forwardedRef) {
4258
5207
  const tableContext = useBaseTableContext(appearance);
4259
5208
  const { theme } = tableContext;
4260
5209
  const headRef = useRef(null);
5210
+ const setHeadRef = (node) => {
5211
+ headRef.current = node;
5212
+ if (typeof forwardedRef === "function") {
5213
+ forwardedRef(node);
5214
+ } else if (forwardedRef) {
5215
+ forwardedRef.current = node;
5216
+ }
5217
+ };
4261
5218
  const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
4262
5219
  const canDrag = Boolean(
4263
5220
  columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
@@ -4412,7 +5369,7 @@ function BaseTableHead({
4412
5369
  "th",
4413
5370
  {
4414
5371
  ...headProps,
4415
- ref: headRef,
5372
+ ref: setHeadRef,
4416
5373
  scope: headProps.scope ?? "col",
4417
5374
  "aria-sort": ariaSort,
4418
5375
  className: cn(
@@ -4424,9 +5381,9 @@ function BaseTableHead({
4424
5381
  ),
4425
5382
  style: {
4426
5383
  ...theme.styles.tableHead,
4427
- width: toCssSize(controlledWidth),
4428
- minWidth: toCssSize(minWidth),
4429
- maxWidth: toCssSize(maxWidth),
5384
+ width: toCssSize2(controlledWidth),
5385
+ minWidth: toCssSize2(minWidth),
5386
+ maxWidth: toCssSize2(maxWidth),
4430
5387
  ...style
4431
5388
  },
4432
5389
  onDragOver: handleDragOver,
@@ -4447,7 +5404,7 @@ function BaseTableHead({
4447
5404
  ]
4448
5405
  }
4449
5406
  );
4450
- }
5407
+ });
4451
5408
  function BaseTableCell({
4452
5409
  align = "left",
4453
5410
  appearance,
@@ -4575,7 +5532,7 @@ function BaseTableLoading({
4575
5532
  classNames?.skeleton
4576
5533
  ),
4577
5534
  style: {
4578
- width: toCssSize(columnWidths[columnIndex])
5535
+ width: toCssSize2(columnWidths[columnIndex])
4579
5536
  }
4580
5537
  }
4581
5538
  )
@@ -4881,6 +5838,6 @@ function BaseToolbar({
4881
5838
  );
4882
5839
  }
4883
5840
 
4884
- export { BaseAccordion, BaseAvatar, BaseBadge, BaseBreadcrumb, BaseButton, BaseCheckbox, BaseContextMenu, BaseContextMenuCheckboxItem, BaseContextMenuContent, BaseContextMenuItem, BaseContextMenuLabel, BaseContextMenuRadioGroup, BaseContextMenuRadioItem, BaseContextMenuSeparator, BaseContextMenuSub, BaseContextMenuSubContent, BaseContextMenuSubTrigger, BaseContextMenuTrigger, BaseDescriptionList, BaseDialog, BaseDivider, BaseDropdownMenu, BaseEmptyState, BaseField, BaseInput, BaseLoadingState, BaseNotice, BasePagination, BasePanel, BaseProgress, BaseRadioGroup, BaseSectionHeader, BaseSegmentedControl, BaseSelect, BaseSkeleton, BaseSwitch, BaseTable, BaseTableBody, BaseTableCaption, BaseTableCell, BaseTableContainer, BaseTableEmpty, BaseTableFooter, BaseTableFooterBar, BaseTableHead, BaseTableHeader, BaseTableLoading, BaseTableRow, BaseTabs, BaseTextarea, BaseToolbar, BaseTooltip, cn, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, resolveBaseAppearance };
5841
+ export { BaseAccordion, BaseAvatar, BaseBadge, BaseBreadcrumb, BaseButton, BaseCheckbox, BaseContextMenu, BaseContextMenuCheckboxItem, BaseContextMenuContent, BaseContextMenuItem, BaseContextMenuLabel, BaseContextMenuRadioGroup, BaseContextMenuRadioItem, BaseContextMenuSeparator, BaseContextMenuSub, BaseContextMenuSubContent, BaseContextMenuSubTrigger, BaseContextMenuTrigger, BaseDescriptionList, BaseDialog, BaseDivider, BaseDropdownMenu, BaseEmptyState, BaseField, BaseInput, BaseLayout, BaseLayoutPane, BaseLayoutResizeHandle, BaseLayoutSplit, BaseLoadingState, BaseMultiSelect, BaseNotice, BasePagination, BasePanel, BaseProgress, BaseRadioGroup, BaseSectionHeader, BaseSegmentedControl, BaseSelect, BaseSkeleton, BaseSwitch, BaseTable, BaseTableBody, BaseTableCaption, BaseTableCell, BaseTableContainer, BaseTableEmpty, BaseTableFooter, BaseTableFooterBar, BaseTableHead, BaseTableHeader, BaseTableLoading, BaseTableRow, BaseTabs, BaseTextarea, BaseToolbar, BaseTooltip, cn, getBaseBadgeToneClassName, getBaseButtonToneClassName, getBaseMenuItemToneClassName, getBaseNoticeToneClassName, resolveBaseAppearance };
4885
5842
  //# sourceMappingURL=index.mjs.map
4886
5843
  //# sourceMappingURL=index.mjs.map