@timeax/form-palette 0.1.28 → 0.1.30

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/extra.mjs CHANGED
@@ -19767,6 +19767,38 @@ function buildGroupLayoutClasses(opts) {
19767
19767
  descriptionClassesBase
19768
19768
  };
19769
19769
  }
19770
+ var badgeVariants = cva(
19771
+ "inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
19772
+ {
19773
+ variants: {
19774
+ variant: {
19775
+ default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
19776
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
19777
+ destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
19778
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
19779
+ }
19780
+ },
19781
+ defaultVariants: {
19782
+ variant: "default"
19783
+ }
19784
+ }
19785
+ );
19786
+ function Badge({
19787
+ className,
19788
+ variant,
19789
+ asChild = false,
19790
+ ...props
19791
+ }) {
19792
+ const Comp = asChild ? Slot : "span";
19793
+ return /* @__PURE__ */ jsx(
19794
+ Comp,
19795
+ {
19796
+ "data-slot": "badge",
19797
+ className: cn(badgeVariants({ variant }), className),
19798
+ ...props
19799
+ }
19800
+ );
19801
+ }
19770
19802
  function RadioGroup({
19771
19803
  className,
19772
19804
  ...props
@@ -19827,6 +19859,34 @@ function resolveRender(obj) {
19827
19859
  }
19828
19860
  return void 0;
19829
19861
  }
19862
+ function resolveByAccessor(input, accessor, fallback) {
19863
+ if (typeof accessor === "function") return accessor(input);
19864
+ if (typeof accessor === "string") return input == null ? void 0 : input[accessor];
19865
+ return fallback;
19866
+ }
19867
+ function normalizeOptionTags(raw, obj, config) {
19868
+ var _a;
19869
+ const rawTags = (_a = resolveByAccessor(raw, config.optionTags)) != null ? _a : Array.isArray(obj == null ? void 0 : obj.tags) ? obj.tags : void 0;
19870
+ if (!Array.isArray(rawTags) || rawTags.length === 0) return void 0;
19871
+ const tags = rawTags.map((tag) => {
19872
+ var _a2, _b, _c, _d, _e, _f, _g;
19873
+ const tagObj = tag != null && typeof tag === "object" ? tag : void 0;
19874
+ const label = (_b = (_a2 = resolveByAccessor(tag, config.optionTagLabel)) != null ? _a2 : tagObj == null ? void 0 : tagObj.label) != null ? _b : typeof tag === "string" || typeof tag === "number" ? String(tag) : void 0;
19875
+ if (label === void 0 || label === null || label === "") {
19876
+ return null;
19877
+ }
19878
+ return {
19879
+ label,
19880
+ icon: (_c = resolveByAccessor(tag, config.optionTagIcon)) != null ? _c : tagObj == null ? void 0 : tagObj.icon,
19881
+ className: (_d = resolveByAccessor(tag, config.optionTagClassName)) != null ? _d : tagObj == null ? void 0 : tagObj.className,
19882
+ color: (_e = resolveByAccessor(tag, config.optionTagColor)) != null ? _e : tagObj == null ? void 0 : tagObj.color,
19883
+ bgColor: (_f = resolveByAccessor(tag, config.optionTagBgColor)) != null ? _f : tagObj == null ? void 0 : tagObj.bgColor,
19884
+ onClick: (_g = resolveByAccessor(tag, config.optionTagOnClick)) != null ? _g : tagObj == null ? void 0 : tagObj.onClick,
19885
+ raw: tag
19886
+ };
19887
+ }).filter(Boolean);
19888
+ return tags.length ? tags : void 0;
19889
+ }
19830
19890
  function resolveValue(raw, obj, index, optionValue) {
19831
19891
  var _a, _b, _c;
19832
19892
  return typeof optionValue === "function" ? optionValue(raw) : typeof optionValue === "string" ? obj[optionValue] : (_c = (_b = (_a = obj.value) != null ? _a : obj.id) != null ? _b : obj.key) != null ? _c : String(index);
@@ -19864,6 +19924,7 @@ function normalizeOne(raw, index, config) {
19864
19924
  const disabled = resolveDisabled(raw, obj, config.optionDisabled);
19865
19925
  const icon = resolveIcon(raw, obj, config.optionIcon);
19866
19926
  const key = resolveKey(raw, obj, index, value, config.optionKey);
19927
+ const tags = normalizeOptionTags(raw, obj, config);
19867
19928
  const render = resolveRender(obj);
19868
19929
  return {
19869
19930
  key: String(key),
@@ -19873,6 +19934,7 @@ function normalizeOne(raw, index, config) {
19873
19934
  description,
19874
19935
  disabled,
19875
19936
  icon,
19937
+ tags,
19876
19938
  render,
19877
19939
  raw
19878
19940
  };
@@ -19883,7 +19945,7 @@ function globalNormalizeOptions(opts, config) {
19883
19945
  (raw, index) => normalizeOne(raw, index, config)
19884
19946
  );
19885
19947
  }
19886
- function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionValueKey) {
19948
+ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionValueKey, tagConfig) {
19887
19949
  var _a, _b;
19888
19950
  const anyItem = item;
19889
19951
  const rawValue = optionValueKey != null ? anyItem[optionValueKey] : anyItem.value;
@@ -19892,6 +19954,7 @@ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionVal
19892
19954
  const description = anyItem.description;
19893
19955
  const disabled = !!anyItem.disabled;
19894
19956
  const key = (_b = anyItem.key) != null ? _b : index;
19957
+ const tags = normalizeOptionTags(item, anyItem, tagConfig != null ? tagConfig : {});
19895
19958
  const render = resolveRender(anyItem);
19896
19959
  return {
19897
19960
  key: String(key),
@@ -19899,6 +19962,7 @@ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionVal
19899
19962
  label: rawLabel,
19900
19963
  description,
19901
19964
  disabled,
19965
+ tags,
19902
19966
  render,
19903
19967
  raw: item
19904
19968
  };
@@ -19974,24 +20038,37 @@ function capitalizeFirst2(label) {
19974
20038
  if (!label) return label;
19975
20039
  return label.charAt(0).toUpperCase() + label.slice(1);
19976
20040
  }
19977
- function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
20041
+ function normalizeItems(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
19978
20042
  if (mappers) {
19979
20043
  return items.map((item, index) => ({
19980
20044
  value: mappers.getValue(item, index),
19981
20045
  label: mappers.getLabel(item, index),
19982
20046
  description: mappers.getDescription ? mappers.getDescription(item, index) : void 0,
19983
20047
  disabled: mappers.isDisabled ? mappers.isDisabled(item, index) : false,
19984
- key: mappers.getKey ? mappers.getKey(item, index) : index
20048
+ key: mappers.getKey ? mappers.getKey(item, index) : index,
20049
+ raw: item
19985
20050
  }));
19986
20051
  }
19987
20052
  if (optionValueKey || optionLabelKey) {
19988
20053
  return items.map((item, index) => {
19989
- return globalNormalizeCheckBasedOptions(
19990
- item,
19991
- index,
19992
- optionLabelKey,
19993
- optionValueKey
19994
- );
20054
+ return {
20055
+ ...globalNormalizeCheckBasedOptions(
20056
+ item,
20057
+ index,
20058
+ optionLabelKey,
20059
+ optionValueKey,
20060
+ {
20061
+ optionTags: optionTagsKey,
20062
+ optionTagLabel,
20063
+ optionTagIcon,
20064
+ optionTagClassName,
20065
+ optionTagColor,
20066
+ optionTagBgColor,
20067
+ optionTagOnClick
20068
+ }
20069
+ ),
20070
+ raw: item
20071
+ };
19995
20072
  });
19996
20073
  }
19997
20074
  return items.map((item, index) => {
@@ -20002,7 +20079,8 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
20002
20079
  label: String(item),
20003
20080
  description: void 0,
20004
20081
  disabled: false,
20005
- key: index
20082
+ key: index,
20083
+ raw: item
20006
20084
  };
20007
20085
  }
20008
20086
  return item;
@@ -20025,6 +20103,13 @@ var InnerShadcnRadioVariant = (props, ref) => {
20025
20103
  mappers,
20026
20104
  optionValue,
20027
20105
  optionLabel,
20106
+ optionTags,
20107
+ optionTagLabel,
20108
+ optionTagIcon,
20109
+ optionTagClassName,
20110
+ optionTagColor,
20111
+ optionTagBgColor,
20112
+ optionTagOnClick,
20028
20113
  renderOption,
20029
20114
  layout = "list",
20030
20115
  columns = 2,
@@ -20053,9 +20138,30 @@ var InnerShadcnRadioVariant = (props, ref) => {
20053
20138
  mappers,
20054
20139
  //@ts-ignore
20055
20140
  optionValue,
20056
- optionLabel
20141
+ optionLabel,
20142
+ //@ts-ignore
20143
+ optionTags,
20144
+ optionTagLabel,
20145
+ optionTagIcon,
20146
+ optionTagClassName,
20147
+ optionTagColor,
20148
+ optionTagBgColor,
20149
+ optionTagOnClick
20057
20150
  ),
20058
- [items, options, mappers, optionValue, optionLabel]
20151
+ [
20152
+ items,
20153
+ options,
20154
+ mappers,
20155
+ optionValue,
20156
+ optionLabel,
20157
+ optionTags,
20158
+ optionTagLabel,
20159
+ optionTagIcon,
20160
+ optionTagClassName,
20161
+ optionTagColor,
20162
+ optionTagBgColor,
20163
+ optionTagOnClick
20164
+ ]
20059
20165
  );
20060
20166
  const selectedString = React74.useMemo(() => {
20061
20167
  if (value === void 0) return void 0;
@@ -20065,11 +20171,12 @@ var InnerShadcnRadioVariant = (props, ref) => {
20065
20171
  return found ? String(found.value) : void 0;
20066
20172
  }, [normalized, value]);
20067
20173
  const handleSelect = React74.useCallback(
20068
- (next) => {
20174
+ (next, selectedRaw) => {
20069
20175
  if (!onValue || disabled) return;
20070
20176
  const detail = {
20071
20177
  source: "variant",
20072
- raw: next,
20178
+ raw: selectedRaw != null ? selectedRaw : next,
20179
+ selectedOptions: [selectedRaw != null ? selectedRaw : next],
20073
20180
  nativeEvent: void 0,
20074
20181
  meta: void 0
20075
20182
  };
@@ -20079,9 +20186,10 @@ var InnerShadcnRadioVariant = (props, ref) => {
20079
20186
  );
20080
20187
  const handleRadioChange = React74.useCallback(
20081
20188
  (raw) => {
20189
+ var _a;
20082
20190
  const found = normalized.find((item) => String(item.value) === raw);
20083
20191
  if (!found) return;
20084
- handleSelect(found.value);
20192
+ handleSelect(found.value, (_a = found.raw) != null ? _a : found.value);
20085
20193
  },
20086
20194
  [normalized, handleSelect]
20087
20195
  );
@@ -20123,7 +20231,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
20123
20231
  "data-slot": "radio-group",
20124
20232
  ...restGroupProps,
20125
20233
  children: normalized.map((item, index) => {
20126
- var _a, _b;
20234
+ var _a, _b, _c;
20127
20235
  const itemString = String(item.value);
20128
20236
  const selected = selectedString === itemString;
20129
20237
  const optionDisabled = !!disabled || !!item.disabled;
@@ -20187,7 +20295,25 @@ var InnerShadcnRadioVariant = (props, ref) => {
20187
20295
  children: [
20188
20296
  radioNode,
20189
20297
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
20190
- /* @__PURE__ */ jsx("span", { className: labelClassesBase, children: displayItem.label }),
20298
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
20299
+ /* @__PURE__ */ jsx("span", { className: cn(labelClassesBase, "truncate"), children: displayItem.label }),
20300
+ !!((_c = displayItem.tags) == null ? void 0 : _c.length) && /* @__PURE__ */ jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: displayItem.tags.map((tag, tagIndex) => /* @__PURE__ */ jsxs(
20301
+ Badge,
20302
+ {
20303
+ className: cn("text-xs", tag.className),
20304
+ onClick: tag.onClick,
20305
+ style: {
20306
+ color: tag.color,
20307
+ backgroundColor: tag.bgColor
20308
+ },
20309
+ children: [
20310
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
20311
+ /* @__PURE__ */ jsx("span", { children: tag.label })
20312
+ ]
20313
+ },
20314
+ tagIndex
20315
+ )) })
20316
+ ] }),
20191
20317
  displayItem.description != null && /* @__PURE__ */ jsx("span", { className: descriptionClassesBase, children: displayItem.description })
20192
20318
  ] })
20193
20319
  ]
@@ -20318,7 +20444,7 @@ function capitalizeFirst3(label) {
20318
20444
  if (!label) return label;
20319
20445
  return label.charAt(0).toUpperCase() + label.slice(1);
20320
20446
  }
20321
- function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20447
+ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
20322
20448
  if (!items || !items.length) return [];
20323
20449
  if (mappers) {
20324
20450
  return items.map((item, index) => ({
@@ -20327,7 +20453,8 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20327
20453
  description: mappers.getDescription ? mappers.getDescription(item, index) : void 0,
20328
20454
  disabled: mappers.isDisabled ? mappers.isDisabled(item, index) : false,
20329
20455
  key: mappers.getKey ? mappers.getKey(item, index) : index,
20330
- tristate: mappers.getTristate ? mappers.getTristate(item, index) : void 0
20456
+ tristate: mappers.getTristate ? mappers.getTristate(item, index) : void 0,
20457
+ raw: item
20331
20458
  }));
20332
20459
  }
20333
20460
  if (optionValueKey || optionLabelKey) {
@@ -20337,12 +20464,22 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20337
20464
  item,
20338
20465
  index,
20339
20466
  optionLabelKey,
20340
- optionValueKey
20467
+ optionValueKey,
20468
+ {
20469
+ optionTags: optionTagsKey,
20470
+ optionTagLabel,
20471
+ optionTagIcon,
20472
+ optionTagClassName,
20473
+ optionTagColor,
20474
+ optionTagBgColor,
20475
+ optionTagOnClick
20476
+ }
20341
20477
  );
20342
20478
  const tristate = anyItem.tristate;
20343
20479
  return {
20344
20480
  ...normalised,
20345
- tristate
20481
+ tristate,
20482
+ raw: item
20346
20483
  };
20347
20484
  });
20348
20485
  }
@@ -20355,7 +20492,8 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20355
20492
  description: void 0,
20356
20493
  disabled: false,
20357
20494
  key: index,
20358
- tristate: void 0
20495
+ tristate: void 0,
20496
+ raw: item
20359
20497
  };
20360
20498
  }
20361
20499
  return item;
@@ -20366,7 +20504,17 @@ function isEqualValue2(a3, b2) {
20366
20504
  }
20367
20505
  function asGroupValue(value) {
20368
20506
  if (!value) return void 0;
20369
- if (Array.isArray(value)) return value;
20507
+ if (Array.isArray(value)) {
20508
+ if (value.length === 0) return void 0;
20509
+ const first = value[0];
20510
+ if (first && typeof first === "object" && "value" in first && "state" in first) {
20511
+ return value;
20512
+ }
20513
+ return value.map((item) => ({
20514
+ value: item,
20515
+ state: true
20516
+ }));
20517
+ }
20370
20518
  if (typeof value == "object")
20371
20519
  return Object.keys(value).map(
20372
20520
  (key) => ({
@@ -20395,6 +20543,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20395
20543
  mappers,
20396
20544
  optionValue,
20397
20545
  optionLabel,
20546
+ optionTags,
20547
+ optionTagLabel,
20548
+ optionTagIcon,
20549
+ optionTagClassName,
20550
+ optionTagColor,
20551
+ optionTagBgColor,
20552
+ optionTagOnClick,
20398
20553
  renderOption,
20399
20554
  single,
20400
20555
  tristate: tristateDefault,
@@ -20422,11 +20577,41 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20422
20577
  } = props;
20423
20578
  const hasError = !!error;
20424
20579
  const isSingle = !!single;
20580
+ const normalized = React74.useMemo(
20581
+ () => normalizeItems2(
20582
+ items != null ? items : options,
20583
+ mappers,
20584
+ optionValue,
20585
+ optionLabel,
20586
+ optionTags,
20587
+ optionTagLabel,
20588
+ optionTagIcon,
20589
+ optionTagClassName,
20590
+ optionTagColor,
20591
+ optionTagBgColor,
20592
+ optionTagOnClick
20593
+ ),
20594
+ [
20595
+ items,
20596
+ options,
20597
+ mappers,
20598
+ optionValue,
20599
+ optionLabel,
20600
+ optionTags,
20601
+ optionTagLabel,
20602
+ optionTagIcon,
20603
+ optionTagClassName,
20604
+ optionTagColor,
20605
+ optionTagBgColor,
20606
+ optionTagOnClick
20607
+ ]
20608
+ );
20425
20609
  if (isSingle) {
20426
20610
  const singleVal = asSingleValue(value);
20427
20611
  const effectiveTristate = !!tristateDefault;
20428
20612
  const internalState = effectiveTristate ? singleVal != null ? singleVal : "none" : !!singleVal;
20429
20613
  const handleSingleChange = (next) => {
20614
+ var _a;
20430
20615
  if (!onValue || disabled) return;
20431
20616
  let nextPublic;
20432
20617
  if (effectiveTristate) {
@@ -20437,6 +20622,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20437
20622
  const detail = {
20438
20623
  source: "variant",
20439
20624
  raw: nextPublic,
20625
+ selectedOptions: nextPublic === true ? normalized[0] ? [(_a = normalized[0].raw) != null ? _a : normalized[0].value] : [] : [],
20440
20626
  nativeEvent: void 0,
20441
20627
  meta: void 0
20442
20628
  };
@@ -20495,15 +20681,6 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20495
20681
  );
20496
20682
  }
20497
20683
  const groupValue = asGroupValue(value);
20498
- const normalized = React74.useMemo(
20499
- () => normalizeItems2(
20500
- items != null ? items : options,
20501
- mappers,
20502
- optionValue,
20503
- optionLabel
20504
- ),
20505
- [items, options, mappers, optionValue, optionLabel]
20506
- );
20507
20684
  const {
20508
20685
  groupStyle,
20509
20686
  groupClasses,
@@ -20523,6 +20700,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20523
20700
  labelTextSizeClass: labelTextSize2(size),
20524
20701
  descriptionTextSizeClass: descriptionTextSize2(size)
20525
20702
  });
20703
+ const hasAnyTristate = React74.useMemo(
20704
+ () => normalized.some((item) => {
20705
+ var _a, _b;
20706
+ return (_b = (_a = item.tristate) != null ? _a : tristateDefault) != null ? _b : false;
20707
+ }),
20708
+ [normalized, tristateDefault]
20709
+ );
20526
20710
  const findEntryIndex = React74.useCallback(
20527
20711
  (val) => {
20528
20712
  if (!groupValue) return -1;
@@ -20595,14 +20779,28 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20595
20779
  const detail = {
20596
20780
  source: "variant",
20597
20781
  raw: nextList,
20782
+ selectedOptions: nextList.map(
20783
+ (entry) => {
20784
+ var _a, _b;
20785
+ return (_b = (_a = normalized.find(
20786
+ (item) => isEqualValue2(item.value, entry.value)
20787
+ )) == null ? void 0 : _a.raw) != null ? _b : entry.value;
20788
+ }
20789
+ ),
20598
20790
  nativeEvent: void 0,
20599
20791
  meta: void 0
20600
20792
  };
20601
- const value2 = {};
20602
- nextList.forEach((item) => value2[item.value] = item.state);
20603
- onValue(value2, detail);
20793
+ if (hasAnyTristate) {
20794
+ const value2 = {};
20795
+ nextList.forEach(
20796
+ (item) => value2[item.value] = item.state
20797
+ );
20798
+ onValue(value2, detail);
20799
+ return;
20800
+ }
20801
+ onValue(nextList.map((item) => item.value), detail);
20604
20802
  },
20605
- [onValue, disabled, groupValue]
20803
+ [onValue, disabled, groupValue, normalized, hasAnyTristate]
20606
20804
  );
20607
20805
  return /* @__PURE__ */ jsx(
20608
20806
  "div",
@@ -20620,7 +20818,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20620
20818
  style: groupStyle,
20621
20819
  ...restProps,
20622
20820
  children: normalized.map((item, index) => {
20623
- var _a, _b, _c, _d;
20821
+ var _a, _b, _c, _d, _e;
20624
20822
  const effectiveTristate = (_b = (_a = item.tristate) != null ? _a : tristateDefault) != null ? _b : false;
20625
20823
  const currentState = getEntryState(item.value);
20626
20824
  const internalState = effectiveTristate ? currentState : currentState === "none" ? false : currentState;
@@ -20708,16 +20906,35 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20708
20906
  children: [
20709
20907
  checkboxNode,
20710
20908
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
20711
- /* @__PURE__ */ jsx(
20712
- "span",
20713
- {
20714
- className: cn(
20715
- labelClassesBase,
20716
- optionLabelClassName
20717
- ),
20718
- children: displayItem.label
20719
- }
20720
- ),
20909
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
20910
+ /* @__PURE__ */ jsx(
20911
+ "span",
20912
+ {
20913
+ className: cn(
20914
+ labelClassesBase,
20915
+ optionLabelClassName,
20916
+ "truncate"
20917
+ ),
20918
+ children: displayItem.label
20919
+ }
20920
+ ),
20921
+ !!((_e = displayItem.tags) == null ? void 0 : _e.length) && /* @__PURE__ */ jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: displayItem.tags.map((tag, tagIndex) => /* @__PURE__ */ jsxs(
20922
+ Badge,
20923
+ {
20924
+ className: cn("text-xs", tag.className),
20925
+ onClick: tag.onClick,
20926
+ style: {
20927
+ color: tag.color,
20928
+ backgroundColor: tag.bgColor
20929
+ },
20930
+ children: [
20931
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
20932
+ /* @__PURE__ */ jsx("span", { children: tag.label })
20933
+ ]
20934
+ },
20935
+ tagIndex
20936
+ )) })
20937
+ ] }),
20721
20938
  displayItem.description != null && /* @__PURE__ */ jsx("span", { className: descriptionClassesBase, children: displayItem.description })
20722
20939
  ] })
20723
20940
  ]
@@ -20797,6 +21014,13 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
20797
21014
  optionDisabled,
20798
21015
  optionIcon,
20799
21016
  optionKey,
21017
+ optionTags,
21018
+ optionTagLabel,
21019
+ optionTagIcon,
21020
+ optionTagClassName,
21021
+ optionTagColor,
21022
+ optionTagBgColor,
21023
+ optionTagOnClick,
20800
21024
  searchable,
20801
21025
  searchPlaceholder,
20802
21026
  emptyLabel,
@@ -20840,7 +21064,14 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
20840
21064
  optionDescription,
20841
21065
  optionDisabled,
20842
21066
  optionKey,
20843
- optionIcon
21067
+ optionIcon,
21068
+ optionTags,
21069
+ optionTagLabel,
21070
+ optionTagIcon,
21071
+ optionTagClassName,
21072
+ optionTagColor,
21073
+ optionTagBgColor,
21074
+ optionTagOnClick
20844
21075
  }),
20845
21076
  [
20846
21077
  options,
@@ -20850,7 +21081,14 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
20850
21081
  optionDescription,
20851
21082
  optionDisabled,
20852
21083
  optionKey,
20853
- optionIcon
21084
+ optionIcon,
21085
+ optionTags,
21086
+ optionTagLabel,
21087
+ optionTagIcon,
21088
+ optionTagClassName,
21089
+ optionTagColor,
21090
+ optionTagBgColor,
21091
+ optionTagOnClick
20854
21092
  ]
20855
21093
  );
20856
21094
  const normalizedValue = value === "" || value == null ? void 0 : value;
@@ -20878,13 +21116,14 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
20878
21116
  );
20879
21117
  const handleChange = React74.useCallback(
20880
21118
  (rawKey) => {
20881
- var _a2, _b2, _c;
21119
+ var _a2, _b2, _c, _d;
20882
21120
  if (!onValue || rawKey === "") return;
20883
21121
  const primitive = (_a2 = valueMap.get(rawKey)) != null ? _a2 : rawKey;
20884
21122
  const item = (_b2 = items.find((it) => String(it.value) === String(primitive))) != null ? _b2 : null;
20885
21123
  const detail = {
20886
21124
  source: "variant",
20887
21125
  raw: (_c = item == null ? void 0 : item.raw) != null ? _c : primitive,
21126
+ selectedOptions: [(_d = item == null ? void 0 : item.raw) != null ? _d : primitive],
20888
21127
  nativeEvent: void 0,
20889
21128
  meta: void 0
20890
21129
  };
@@ -20986,6 +21225,7 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
20986
21225
  const detail = {
20987
21226
  source: "variant",
20988
21227
  raw: void 0,
21228
+ selectedOptions: [],
20989
21229
  nativeEvent: void 0,
20990
21230
  meta: { action: "clear" }
20991
21231
  };
@@ -21088,7 +21328,7 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
21088
21328
  data: filteredItems,
21089
21329
  computeItemKey: (_index, item) => item.key,
21090
21330
  itemContent: (index, item) => {
21091
- var _a2;
21331
+ var _a2, _b2;
21092
21332
  const optionNode = /* @__PURE__ */ jsx(
21093
21333
  SelectItem,
21094
21334
  {
@@ -21096,15 +21336,38 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
21096
21336
  disabled: item.disabled,
21097
21337
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
21098
21338
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21099
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
21100
- /* @__PURE__ */ jsx("span", { children: item.labelNode }),
21339
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
21340
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
21341
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.labelNode }),
21342
+ !!((_a2 = item.tags) == null ? void 0 : _a2.length) && /* @__PURE__ */ jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: item.tags.map(
21343
+ (tag, tagIndex) => /* @__PURE__ */ jsxs(
21344
+ Badge,
21345
+ {
21346
+ className: cn(
21347
+ "text-xs",
21348
+ tag.className
21349
+ ),
21350
+ onClick: tag.onClick,
21351
+ style: {
21352
+ color: tag.color,
21353
+ backgroundColor: tag.bgColor
21354
+ },
21355
+ children: [
21356
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
21357
+ /* @__PURE__ */ jsx("span", { children: tag.label })
21358
+ ]
21359
+ },
21360
+ tagIndex
21361
+ )
21362
+ ) })
21363
+ ] }),
21101
21364
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21102
21365
  ] })
21103
21366
  ] })
21104
21367
  },
21105
21368
  item.key
21106
21369
  );
21107
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
21370
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21108
21371
  if (!renderer) return optionNode;
21109
21372
  return renderer({
21110
21373
  item,
@@ -21123,7 +21386,7 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
21123
21386
  }
21124
21387
  )
21125
21388
  ) : /* @__PURE__ */ jsx("div", { className: "max-h-60 overflow-auto", children: filteredItems.map((item, index) => {
21126
- var _a2;
21389
+ var _a2, _b2;
21127
21390
  const optionNode = /* @__PURE__ */ jsx(
21128
21391
  SelectItem,
21129
21392
  {
@@ -21131,15 +21394,38 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
21131
21394
  disabled: item.disabled,
21132
21395
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
21133
21396
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21134
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
21135
- /* @__PURE__ */ jsx("span", { children: item.labelNode }),
21397
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
21398
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
21399
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.labelNode }),
21400
+ !!((_a2 = item.tags) == null ? void 0 : _a2.length) && /* @__PURE__ */ jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: item.tags.map(
21401
+ (tag, tagIndex) => /* @__PURE__ */ jsxs(
21402
+ Badge,
21403
+ {
21404
+ className: cn(
21405
+ "text-xs",
21406
+ tag.className
21407
+ ),
21408
+ onClick: tag.onClick,
21409
+ style: {
21410
+ color: tag.color,
21411
+ backgroundColor: tag.bgColor
21412
+ },
21413
+ children: [
21414
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
21415
+ /* @__PURE__ */ jsx("span", { children: tag.label })
21416
+ ]
21417
+ },
21418
+ tagIndex
21419
+ )
21420
+ ) })
21421
+ ] }),
21136
21422
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21137
21423
  ] })
21138
21424
  ] })
21139
21425
  },
21140
21426
  item.key
21141
21427
  );
21142
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
21428
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21143
21429
  if (!renderer) return optionNode;
21144
21430
  return renderer({
21145
21431
  item,
@@ -21289,38 +21575,6 @@ var selectModule = {
21289
21575
  tags: ["select", "dropdown", "single-value"]
21290
21576
  }
21291
21577
  };
21292
- var badgeVariants = cva(
21293
- "inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
21294
- {
21295
- variants: {
21296
- variant: {
21297
- default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
21298
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
21299
- destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
21300
- outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
21301
- }
21302
- },
21303
- defaultVariants: {
21304
- variant: "default"
21305
- }
21306
- }
21307
- );
21308
- function Badge({
21309
- className,
21310
- variant,
21311
- asChild = false,
21312
- ...props
21313
- }) {
21314
- const Comp = asChild ? Slot : "span";
21315
- return /* @__PURE__ */ jsx(
21316
- Comp,
21317
- {
21318
- "data-slot": "badge",
21319
- className: cn(badgeVariants({ variant }), className),
21320
- ...props
21321
- }
21322
- );
21323
- }
21324
21578
  function getTextWidth(text, font) {
21325
21579
  if (typeof window === "undefined") return 0;
21326
21580
  const canvas = window.__canvas || (window.__canvas = document.createElement("canvas"));
@@ -21510,6 +21764,13 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21510
21764
  optionDisabled,
21511
21765
  optionIcon,
21512
21766
  optionKey,
21767
+ optionTags,
21768
+ optionTagLabel,
21769
+ optionTagIcon,
21770
+ optionTagClassName,
21771
+ optionTagColor,
21772
+ optionTagBgColor,
21773
+ optionTagOnClick,
21513
21774
  searchable,
21514
21775
  searchPlaceholder,
21515
21776
  emptySearchText,
@@ -21558,7 +21819,14 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21558
21819
  optionDescription,
21559
21820
  optionDisabled,
21560
21821
  optionKey,
21561
- optionIcon
21822
+ optionIcon,
21823
+ optionTags,
21824
+ optionTagLabel,
21825
+ optionTagIcon,
21826
+ optionTagClassName,
21827
+ optionTagColor,
21828
+ optionTagBgColor,
21829
+ optionTagOnClick
21562
21830
  });
21563
21831
  return { items: items2, keyedItems: (0, import_lodash.keyBy)(items2, "value") };
21564
21832
  }, [
@@ -21569,7 +21837,14 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21569
21837
  optionDescription,
21570
21838
  optionDisabled,
21571
21839
  optionKey,
21572
- optionIcon
21840
+ optionIcon,
21841
+ optionTags,
21842
+ optionTagLabel,
21843
+ optionTagIcon,
21844
+ optionTagClassName,
21845
+ optionTagColor,
21846
+ optionTagBgColor,
21847
+ optionTagOnClick
21573
21848
  ]);
21574
21849
  const selectedValues = React74.useMemo(
21575
21850
  () => new Set(value != null ? value : []),
@@ -21620,7 +21895,12 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21620
21895
  next = [...current, primitive];
21621
21896
  }
21622
21897
  const final = next.length ? next : void 0;
21623
- const values = next == null ? void 0 : next.map((item) => keyedItems[item].raw);
21898
+ const values = next == null ? void 0 : next.map(
21899
+ (item) => {
21900
+ var _a2, _b;
21901
+ return (_b = (_a2 = keyedItems[item]) == null ? void 0 : _a2.raw) != null ? _b : item;
21902
+ }
21903
+ );
21624
21904
  const detail = {
21625
21905
  source: "variant",
21626
21906
  raw: {
@@ -21629,12 +21909,13 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21629
21909
  next: final,
21630
21910
  values
21631
21911
  },
21912
+ selectedOptions: values != null ? values : [],
21632
21913
  nativeEvent: void 0,
21633
21914
  meta: void 0
21634
21915
  };
21635
21916
  onValue(final, detail);
21636
21917
  },
21637
- [onValue, value, disabled, readOnly]
21918
+ [onValue, value, disabled, readOnly, keyedItems]
21638
21919
  );
21639
21920
  const handleSelectAll = React74.useCallback(() => {
21640
21921
  if (!onValue || disabled || readOnly) return;
@@ -21650,7 +21931,10 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21650
21931
  next = Array.from(merged);
21651
21932
  }
21652
21933
  const final = next.length ? next : void 0;
21653
- const values = next.map((item) => keyedItems[item].raw);
21934
+ const values = next.map((item) => {
21935
+ var _a2, _b;
21936
+ return (_b = (_a2 = keyedItems[item]) == null ? void 0 : _a2.raw) != null ? _b : item;
21937
+ });
21654
21938
  const detail = {
21655
21939
  source: "variant",
21656
21940
  raw: {
@@ -21658,6 +21942,7 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21658
21942
  next: final,
21659
21943
  values
21660
21944
  },
21945
+ selectedOptions: values,
21661
21946
  nativeEvent: void 0,
21662
21947
  meta: {
21663
21948
  allSelected: !currentlyAllSelected
@@ -21670,7 +21955,8 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21670
21955
  disabled,
21671
21956
  readOnly,
21672
21957
  allSelectableValues,
21673
- selectedValues
21958
+ selectedValues,
21959
+ keyedItems
21674
21960
  ]);
21675
21961
  const handleClearAll = React74.useCallback(() => {
21676
21962
  if (!onValue || disabled || readOnly) return;
@@ -21679,6 +21965,7 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21679
21965
  raw: {
21680
21966
  type: "clear"
21681
21967
  },
21968
+ selectedOptions: [],
21682
21969
  nativeEvent: void 0,
21683
21970
  meta: void 0
21684
21971
  };
@@ -21694,9 +21981,14 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21694
21981
  selectedValues,
21695
21982
  item.value
21696
21983
  );
21984
+ const selectedOptions = (updated != null ? updated : []).map((value2) => {
21985
+ var _a2, _b;
21986
+ return (_b = (_a2 = keyedItems[value2]) == null ? void 0 : _a2.raw) != null ? _b : value2;
21987
+ });
21697
21988
  const detail = {
21698
21989
  source: "variant",
21699
21990
  raw: item,
21991
+ selectedOptions,
21700
21992
  nativeEvent: void 0,
21701
21993
  meta: { action: "remove", removed: value }
21702
21994
  };
@@ -21970,7 +22262,7 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21970
22262
  EmptyPlaceholder: () => /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: emptySearchText != null ? emptySearchText : "No results found" })
21971
22263
  },
21972
22264
  itemContent: (index, item) => {
21973
- var _a2;
22265
+ var _a2, _b;
21974
22266
  const selected = selectedValues.has(item.value);
21975
22267
  const row = /* @__PURE__ */ jsxs(
21976
22268
  "button",
@@ -21994,8 +22286,31 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21994
22286
  }),
21995
22287
  /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-start gap-2", children: [
21996
22288
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21997
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
21998
- /* @__PURE__ */ jsx("span", { children: item.labelNode }),
22289
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
22290
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
22291
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.labelNode }),
22292
+ !!((_a2 = item.tags) == null ? void 0 : _a2.length) && /* @__PURE__ */ jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: item.tags.map(
22293
+ (tag, tagIndex) => /* @__PURE__ */ jsxs(
22294
+ Badge,
22295
+ {
22296
+ className: cn(
22297
+ "text-xs",
22298
+ tag.className
22299
+ ),
22300
+ onClick: tag.onClick,
22301
+ style: {
22302
+ color: tag.color,
22303
+ backgroundColor: tag.bgColor
22304
+ },
22305
+ children: [
22306
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
22307
+ /* @__PURE__ */ jsx("span", { children: tag.label })
22308
+ ]
22309
+ },
22310
+ tagIndex
22311
+ )
22312
+ ) })
22313
+ ] }),
21999
22314
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
22000
22315
  ] })
22001
22316
  ] })
@@ -22003,7 +22318,7 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
22003
22318
  },
22004
22319
  item.key
22005
22320
  );
22006
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
22321
+ const renderer = (_b = item.render) != null ? _b : renderOption;
22007
22322
  if (!renderer) return row;
22008
22323
  return renderer({
22009
22324
  item,
@@ -23470,6 +23785,13 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23470
23785
  optionDisabled,
23471
23786
  optionIcon,
23472
23787
  optionKey,
23788
+ optionTags,
23789
+ optionTagLabel,
23790
+ optionTagIcon,
23791
+ optionTagClassName,
23792
+ optionTagColor,
23793
+ optionTagBgColor,
23794
+ optionTagOnClick,
23473
23795
  searchable = true,
23474
23796
  searchPlaceholder,
23475
23797
  emptyLabel,
@@ -23521,7 +23843,14 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23521
23843
  optionDescription,
23522
23844
  optionDisabled,
23523
23845
  optionIcon,
23524
- optionKey
23846
+ optionKey,
23847
+ optionTags,
23848
+ optionTagLabel,
23849
+ optionTagIcon,
23850
+ optionTagClassName,
23851
+ optionTagColor,
23852
+ optionTagBgColor,
23853
+ optionTagOnClick
23525
23854
  }),
23526
23855
  [
23527
23856
  options,
@@ -23531,7 +23860,14 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23531
23860
  optionDescription,
23532
23861
  optionDisabled,
23533
23862
  optionIcon,
23534
- optionKey
23863
+ optionKey,
23864
+ optionTags,
23865
+ optionTagLabel,
23866
+ optionTagIcon,
23867
+ optionTagClassName,
23868
+ optionTagColor,
23869
+ optionTagBgColor,
23870
+ optionTagOnClick
23535
23871
  ]
23536
23872
  );
23537
23873
  const allNodesFlat = React74.useMemo(() => flattenTree(tree), [tree]);
@@ -23621,9 +23957,16 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23621
23957
  setOpen(false);
23622
23958
  }
23623
23959
  const nextSelectedValues = Array.isArray(nextValue) ? nextValue : nextValue !== void 0 && nextValue !== null ? [nextValue] : [];
23960
+ const nextSelectedOptions = nextSelectedValues.map(
23961
+ (val) => {
23962
+ var _a, _b;
23963
+ return (_b = (_a = allNodesFlat.find((node) => node.value === val)) == null ? void 0 : _a.raw) != null ? _b : val;
23964
+ }
23965
+ );
23624
23966
  const detail = {
23625
23967
  source: "variant",
23626
23968
  raw: item.raw,
23969
+ selectedOptions: nextSelectedOptions,
23627
23970
  nativeEvent: void 0,
23628
23971
  meta: {
23629
23972
  toggled: item.value,
@@ -23638,7 +23981,8 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23638
23981
  multiple,
23639
23982
  selectedValues,
23640
23983
  onValue,
23641
- toggleExpanded
23984
+ toggleExpanded,
23985
+ allNodesFlat
23642
23986
  ]
23643
23987
  );
23644
23988
  const handleClear = React74.useCallback(() => {
@@ -23646,6 +23990,7 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23646
23990
  const detail = {
23647
23991
  source: "variant",
23648
23992
  raw: void 0,
23993
+ selectedOptions: [],
23649
23994
  nativeEvent: void 0,
23650
23995
  meta: { action: "clear" }
23651
23996
  };
@@ -23818,7 +24163,7 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23818
24163
  data: displayedNodes,
23819
24164
  computeItemKey: (_index, item) => item.key,
23820
24165
  itemContent: (index, item) => {
23821
- var _a;
24166
+ var _a, _b;
23822
24167
  const selected = selectedValues.includes(item.value);
23823
24168
  const isExpanded = expanded.has(item.value);
23824
24169
  const parentInLeafOnly = leafOnly && item.hasChildren;
@@ -23877,14 +24222,35 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23877
24222
  ),
23878
24223
  item.icon ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: item.icon }) : item.hasChildren ? isExpanded ? /* @__PURE__ */ jsx(FolderOpen, { className: "h-4 w-4 text-blue-400/80 fill-blue-400/20" }) : /* @__PURE__ */ jsx(Folder, { className: "h-4 w-4 text-blue-400/80 fill-blue-400/20" }) : /* @__PURE__ */ jsx(File2, { className: "h-4 w-4 text-muted-foreground/60" }),
23879
24224
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
23880
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium leading-none", children: item.labelNode }),
24225
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
24226
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium leading-none", children: item.labelNode }),
24227
+ !!((_a = item.tags) == null ? void 0 : _a.length) && /* @__PURE__ */ jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: item.tags.map((tag, tagIndex) => /* @__PURE__ */ jsxs(
24228
+ Badge,
24229
+ {
24230
+ className: cn(
24231
+ "text-xs",
24232
+ tag.className
24233
+ ),
24234
+ onClick: tag.onClick,
24235
+ style: {
24236
+ color: tag.color,
24237
+ backgroundColor: tag.bgColor
24238
+ },
24239
+ children: [
24240
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
24241
+ /* @__PURE__ */ jsx("span", { children: tag.label })
24242
+ ]
24243
+ },
24244
+ tagIndex
24245
+ )) })
24246
+ ] }),
23881
24247
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground truncate mt-0.5", children: item.description })
23882
24248
  ] }),
23883
24249
  !multiple && selected && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-primary ml-auto" })
23884
24250
  ]
23885
24251
  }
23886
24252
  );
23887
- const renderer = (_a = item.render) != null ? _a : renderOption;
24253
+ const renderer = (_b = item.render) != null ? _b : renderOption;
23888
24254
  if (!renderer) {
23889
24255
  return /* @__PURE__ */ jsx(React74.Fragment, { children: optionNode }, item.key);
23890
24256
  }
@@ -25277,11 +25643,18 @@ function normalizeOption(input, {
25277
25643
  optionIcon,
25278
25644
  optionDisabled,
25279
25645
  optionTooltip,
25280
- optionMeta
25646
+ optionMeta,
25647
+ optionTags,
25648
+ optionTagLabel,
25649
+ optionTagIcon,
25650
+ optionTagClassName,
25651
+ optionTagColor,
25652
+ optionTagBgColor,
25653
+ optionTagOnClick
25281
25654
  }, autoCap) {
25282
25655
  var _a, _b, _c, _d, _e, _f;
25283
25656
  const anyInput = input;
25284
- if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
25657
+ if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta || optionTags || optionTagLabel || optionTagIcon || optionTagClassName || optionTagColor || optionTagBgColor || optionTagOnClick) {
25285
25658
  const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
25286
25659
  const value2 = String(rawValue);
25287
25660
  let label2;
@@ -25299,6 +25672,24 @@ function normalizeOption(input, {
25299
25672
  const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
25300
25673
  const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
25301
25674
  const meta = optionMeta != null ? anyInput[optionMeta] : (_d = anyInput.meta) != null ? _d : void 0;
25675
+ const rawTags = optionTags != null ? anyInput[optionTags] : anyInput.tags;
25676
+ const tags = Array.isArray(rawTags) ? rawTags.flatMap((tag) => {
25677
+ const label3 = optionTagLabel != null ? tag == null ? void 0 : tag[optionTagLabel] : tag == null ? void 0 : tag.label;
25678
+ if (label3 === void 0 || label3 === null || label3 === "") {
25679
+ return [];
25680
+ }
25681
+ return [
25682
+ {
25683
+ label: label3,
25684
+ icon: optionTagIcon != null ? tag == null ? void 0 : tag[optionTagIcon] : tag == null ? void 0 : tag.icon,
25685
+ className: optionTagClassName != null ? tag == null ? void 0 : tag[optionTagClassName] : tag == null ? void 0 : tag.className,
25686
+ color: optionTagColor != null ? tag == null ? void 0 : tag[optionTagColor] : tag == null ? void 0 : tag.color,
25687
+ bgColor: optionTagBgColor != null ? tag == null ? void 0 : tag[optionTagBgColor] : tag == null ? void 0 : tag.bgColor,
25688
+ onClick: optionTagOnClick != null ? tag == null ? void 0 : tag[optionTagOnClick] : tag == null ? void 0 : tag.onClick,
25689
+ raw: tag
25690
+ }
25691
+ ];
25692
+ }) : void 0;
25302
25693
  return {
25303
25694
  ui: {
25304
25695
  value: value2,
@@ -25306,7 +25697,8 @@ function normalizeOption(input, {
25306
25697
  icon,
25307
25698
  disabled,
25308
25699
  tooltip,
25309
- meta
25700
+ meta,
25701
+ tags
25310
25702
  },
25311
25703
  raw: input
25312
25704
  };
@@ -25338,7 +25730,8 @@ function normalizeOption(input, {
25338
25730
  icon: anyInput.icon,
25339
25731
  disabled: !!anyInput.disabled,
25340
25732
  tooltip: anyInput.tooltip,
25341
- meta: anyInput.meta
25733
+ meta: anyInput.meta,
25734
+ tags: Array.isArray(anyInput.tags) ? anyInput.tags : void 0
25342
25735
  },
25343
25736
  raw: input
25344
25737
  };
@@ -25363,6 +25756,13 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25363
25756
  optionDisabled,
25364
25757
  optionTooltip,
25365
25758
  optionMeta,
25759
+ optionTags,
25760
+ optionTagLabel,
25761
+ optionTagIcon,
25762
+ optionTagClassName,
25763
+ optionTagColor,
25764
+ optionTagBgColor,
25765
+ optionTagOnClick,
25366
25766
  renderOption,
25367
25767
  className,
25368
25768
  itemClassName,
@@ -25383,7 +25783,14 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25383
25783
  optionIcon,
25384
25784
  optionDisabled,
25385
25785
  optionTooltip,
25386
- optionMeta
25786
+ optionMeta,
25787
+ optionTags,
25788
+ optionTagLabel,
25789
+ optionTagIcon,
25790
+ optionTagClassName,
25791
+ optionTagColor,
25792
+ optionTagBgColor,
25793
+ optionTagOnClick
25387
25794
  },
25388
25795
  autoCap
25389
25796
  )
@@ -25396,6 +25803,13 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25396
25803
  optionDisabled,
25397
25804
  optionTooltip,
25398
25805
  optionMeta,
25806
+ optionTags,
25807
+ optionTagLabel,
25808
+ optionTagIcon,
25809
+ optionTagClassName,
25810
+ optionTagColor,
25811
+ optionTagBgColor,
25812
+ optionTagOnClick,
25399
25813
  autoCap
25400
25814
  ]
25401
25815
  );
@@ -25419,6 +25833,7 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25419
25833
  source: "variant",
25420
25834
  raw: rawSelection,
25421
25835
  // original item(s)
25836
+ selectedOptions: Array.isArray(rawSelection) ? rawSelection : rawSelection === void 0 ? [] : [rawSelection],
25422
25837
  nativeEvent: void 0,
25423
25838
  meta: { action: "toggle" }
25424
25839
  };
@@ -25460,11 +25875,28 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25460
25875
  style: groupStyle,
25461
25876
  "aria-invalid": !!error,
25462
25877
  children: normalizedOptions.map(({ ui: opt }) => {
25878
+ var _a;
25463
25879
  const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
25464
- const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
25880
+ const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsx("div", { className: "flex flex-col items-start gap-1 truncate", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full min-w-0 items-start gap-2", children: [
25465
25881
  opt.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: opt.icon }),
25466
- /* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
25467
- ] });
25882
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label }),
25883
+ !!((_a = opt.tags) == null ? void 0 : _a.length) && /* @__PURE__ */ jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: opt.tags.map((tag, tagIndex) => /* @__PURE__ */ jsxs(
25884
+ Badge,
25885
+ {
25886
+ className: cn("text-xs", tag.className),
25887
+ onClick: tag.onClick,
25888
+ style: {
25889
+ color: tag.color,
25890
+ backgroundColor: tag.bgColor
25891
+ },
25892
+ children: [
25893
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
25894
+ /* @__PURE__ */ jsx("span", { children: tag.label })
25895
+ ]
25896
+ },
25897
+ tagIndex
25898
+ )) })
25899
+ ] }) });
25468
25900
  const itemNode = /* @__PURE__ */ jsx(
25469
25901
  ToggleGroupItem,
25470
25902
  {
@@ -30198,7 +30630,7 @@ var ShadcnIconVariant = React74.forwardRef(function ShadcnIconVariant2(props, re
30198
30630
  PopoverContent,
30199
30631
  {
30200
30632
  className: cn(
30201
- "w-(--radix-popover-trigger-width) p-0",
30633
+ "w-(--radix-popover-trigger-width) p-0 max-h-(--radix-popper-available-height)",
30202
30634
  popoverClassName
30203
30635
  ),
30204
30636
  align: "start",
@@ -31048,7 +31480,7 @@ var ShadcnImageIconVariant = React74.forwardRef(function ShadcnImageIconVariant2
31048
31480
  PopoverContent,
31049
31481
  {
31050
31482
  className: cn(
31051
- "w-(--radix-popover-trigger-width) p-0",
31483
+ "w-(--radix-popover-trigger-width) p-0 max-h-(--radix-popper-available-height)",
31052
31484
  popoverClassName
31053
31485
  ),
31054
31486
  align: "start",