@timeax/form-palette 0.1.29 → 0.1.31

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,7 +20038,7 @@ 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),
@@ -19992,7 +20056,16 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
19992
20056
  item,
19993
20057
  index,
19994
20058
  optionLabelKey,
19995
- optionValueKey
20059
+ optionValueKey,
20060
+ {
20061
+ optionTags: optionTagsKey,
20062
+ optionTagLabel,
20063
+ optionTagIcon,
20064
+ optionTagClassName,
20065
+ optionTagColor,
20066
+ optionTagBgColor,
20067
+ optionTagOnClick
20068
+ }
19996
20069
  ),
19997
20070
  raw: item
19998
20071
  };
@@ -20030,6 +20103,13 @@ var InnerShadcnRadioVariant = (props, ref) => {
20030
20103
  mappers,
20031
20104
  optionValue,
20032
20105
  optionLabel,
20106
+ optionTags,
20107
+ optionTagLabel,
20108
+ optionTagIcon,
20109
+ optionTagClassName,
20110
+ optionTagColor,
20111
+ optionTagBgColor,
20112
+ optionTagOnClick,
20033
20113
  renderOption,
20034
20114
  layout = "list",
20035
20115
  columns = 2,
@@ -20058,9 +20138,30 @@ var InnerShadcnRadioVariant = (props, ref) => {
20058
20138
  mappers,
20059
20139
  //@ts-ignore
20060
20140
  optionValue,
20061
- optionLabel
20141
+ optionLabel,
20142
+ //@ts-ignore
20143
+ optionTags,
20144
+ optionTagLabel,
20145
+ optionTagIcon,
20146
+ optionTagClassName,
20147
+ optionTagColor,
20148
+ optionTagBgColor,
20149
+ optionTagOnClick
20062
20150
  ),
20063
- [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
+ ]
20064
20165
  );
20065
20166
  const selectedString = React74.useMemo(() => {
20066
20167
  if (value === void 0) return void 0;
@@ -20130,7 +20231,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
20130
20231
  "data-slot": "radio-group",
20131
20232
  ...restGroupProps,
20132
20233
  children: normalized.map((item, index) => {
20133
- var _a, _b;
20234
+ var _a, _b, _c;
20134
20235
  const itemString = String(item.value);
20135
20236
  const selected = selectedString === itemString;
20136
20237
  const optionDisabled = !!disabled || !!item.disabled;
@@ -20194,7 +20295,25 @@ var InnerShadcnRadioVariant = (props, ref) => {
20194
20295
  children: [
20195
20296
  radioNode,
20196
20297
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
20197
- /* @__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
+ ] }),
20198
20317
  displayItem.description != null && /* @__PURE__ */ jsx("span", { className: descriptionClassesBase, children: displayItem.description })
20199
20318
  ] })
20200
20319
  ]
@@ -20325,7 +20444,7 @@ function capitalizeFirst3(label) {
20325
20444
  if (!label) return label;
20326
20445
  return label.charAt(0).toUpperCase() + label.slice(1);
20327
20446
  }
20328
- function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20447
+ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
20329
20448
  if (!items || !items.length) return [];
20330
20449
  if (mappers) {
20331
20450
  return items.map((item, index) => ({
@@ -20345,7 +20464,16 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20345
20464
  item,
20346
20465
  index,
20347
20466
  optionLabelKey,
20348
- optionValueKey
20467
+ optionValueKey,
20468
+ {
20469
+ optionTags: optionTagsKey,
20470
+ optionTagLabel,
20471
+ optionTagIcon,
20472
+ optionTagClassName,
20473
+ optionTagColor,
20474
+ optionTagBgColor,
20475
+ optionTagOnClick
20476
+ }
20349
20477
  );
20350
20478
  const tristate = anyItem.tristate;
20351
20479
  return {
@@ -20415,6 +20543,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20415
20543
  mappers,
20416
20544
  optionValue,
20417
20545
  optionLabel,
20546
+ optionTags,
20547
+ optionTagLabel,
20548
+ optionTagIcon,
20549
+ optionTagClassName,
20550
+ optionTagColor,
20551
+ optionTagBgColor,
20552
+ optionTagOnClick,
20418
20553
  renderOption,
20419
20554
  single,
20420
20555
  tristate: tristateDefault,
@@ -20447,9 +20582,29 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20447
20582
  items != null ? items : options,
20448
20583
  mappers,
20449
20584
  optionValue,
20450
- optionLabel
20585
+ optionLabel,
20586
+ optionTags,
20587
+ optionTagLabel,
20588
+ optionTagIcon,
20589
+ optionTagClassName,
20590
+ optionTagColor,
20591
+ optionTagBgColor,
20592
+ optionTagOnClick
20451
20593
  ),
20452
- [items, options, mappers, optionValue, optionLabel]
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
+ ]
20453
20608
  );
20454
20609
  if (isSingle) {
20455
20610
  const singleVal = asSingleValue(value);
@@ -20663,7 +20818,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20663
20818
  style: groupStyle,
20664
20819
  ...restProps,
20665
20820
  children: normalized.map((item, index) => {
20666
- var _a, _b, _c, _d;
20821
+ var _a, _b, _c, _d, _e;
20667
20822
  const effectiveTristate = (_b = (_a = item.tristate) != null ? _a : tristateDefault) != null ? _b : false;
20668
20823
  const currentState = getEntryState(item.value);
20669
20824
  const internalState = effectiveTristate ? currentState : currentState === "none" ? false : currentState;
@@ -20751,16 +20906,35 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20751
20906
  children: [
20752
20907
  checkboxNode,
20753
20908
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
20754
- /* @__PURE__ */ jsx(
20755
- "span",
20756
- {
20757
- className: cn(
20758
- labelClassesBase,
20759
- optionLabelClassName
20760
- ),
20761
- children: displayItem.label
20762
- }
20763
- ),
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
+ ] }),
20764
20938
  displayItem.description != null && /* @__PURE__ */ jsx("span", { className: descriptionClassesBase, children: displayItem.description })
20765
20939
  ] })
20766
20940
  ]
@@ -20840,6 +21014,13 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
20840
21014
  optionDisabled,
20841
21015
  optionIcon,
20842
21016
  optionKey,
21017
+ optionTags,
21018
+ optionTagLabel,
21019
+ optionTagIcon,
21020
+ optionTagClassName,
21021
+ optionTagColor,
21022
+ optionTagBgColor,
21023
+ optionTagOnClick,
20843
21024
  searchable,
20844
21025
  searchPlaceholder,
20845
21026
  emptyLabel,
@@ -20883,7 +21064,14 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
20883
21064
  optionDescription,
20884
21065
  optionDisabled,
20885
21066
  optionKey,
20886
- optionIcon
21067
+ optionIcon,
21068
+ optionTags,
21069
+ optionTagLabel,
21070
+ optionTagIcon,
21071
+ optionTagClassName,
21072
+ optionTagColor,
21073
+ optionTagBgColor,
21074
+ optionTagOnClick
20887
21075
  }),
20888
21076
  [
20889
21077
  options,
@@ -20893,7 +21081,14 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
20893
21081
  optionDescription,
20894
21082
  optionDisabled,
20895
21083
  optionKey,
20896
- optionIcon
21084
+ optionIcon,
21085
+ optionTags,
21086
+ optionTagLabel,
21087
+ optionTagIcon,
21088
+ optionTagClassName,
21089
+ optionTagColor,
21090
+ optionTagBgColor,
21091
+ optionTagOnClick
20897
21092
  ]
20898
21093
  );
20899
21094
  const normalizedValue = value === "" || value == null ? void 0 : value;
@@ -21133,7 +21328,7 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
21133
21328
  data: filteredItems,
21134
21329
  computeItemKey: (_index, item) => item.key,
21135
21330
  itemContent: (index, item) => {
21136
- var _a2;
21331
+ var _a2, _b2;
21137
21332
  const optionNode = /* @__PURE__ */ jsx(
21138
21333
  SelectItem,
21139
21334
  {
@@ -21141,15 +21336,38 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
21141
21336
  disabled: item.disabled,
21142
21337
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
21143
21338
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21144
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
21145
- /* @__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
+ ] }),
21146
21364
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21147
21365
  ] })
21148
21366
  ] })
21149
21367
  },
21150
21368
  item.key
21151
21369
  );
21152
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
21370
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21153
21371
  if (!renderer) return optionNode;
21154
21372
  return renderer({
21155
21373
  item,
@@ -21168,7 +21386,7 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
21168
21386
  }
21169
21387
  )
21170
21388
  ) : /* @__PURE__ */ jsx("div", { className: "max-h-60 overflow-auto", children: filteredItems.map((item, index) => {
21171
- var _a2;
21389
+ var _a2, _b2;
21172
21390
  const optionNode = /* @__PURE__ */ jsx(
21173
21391
  SelectItem,
21174
21392
  {
@@ -21176,15 +21394,38 @@ var ShadcnSelectVariant = React74.forwardRef(function ShadcnSelectVariant2(props
21176
21394
  disabled: item.disabled,
21177
21395
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
21178
21396
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21179
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
21180
- /* @__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
+ ] }),
21181
21422
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21182
21423
  ] })
21183
21424
  ] })
21184
21425
  },
21185
21426
  item.key
21186
21427
  );
21187
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
21428
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21188
21429
  if (!renderer) return optionNode;
21189
21430
  return renderer({
21190
21431
  item,
@@ -21334,38 +21575,6 @@ var selectModule = {
21334
21575
  tags: ["select", "dropdown", "single-value"]
21335
21576
  }
21336
21577
  };
21337
- var badgeVariants = cva(
21338
- "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",
21339
- {
21340
- variants: {
21341
- variant: {
21342
- default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
21343
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
21344
- 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",
21345
- outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
21346
- }
21347
- },
21348
- defaultVariants: {
21349
- variant: "default"
21350
- }
21351
- }
21352
- );
21353
- function Badge({
21354
- className,
21355
- variant,
21356
- asChild = false,
21357
- ...props
21358
- }) {
21359
- const Comp = asChild ? Slot : "span";
21360
- return /* @__PURE__ */ jsx(
21361
- Comp,
21362
- {
21363
- "data-slot": "badge",
21364
- className: cn(badgeVariants({ variant }), className),
21365
- ...props
21366
- }
21367
- );
21368
- }
21369
21578
  function getTextWidth(text, font) {
21370
21579
  if (typeof window === "undefined") return 0;
21371
21580
  const canvas = window.__canvas || (window.__canvas = document.createElement("canvas"));
@@ -21555,6 +21764,13 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21555
21764
  optionDisabled,
21556
21765
  optionIcon,
21557
21766
  optionKey,
21767
+ optionTags,
21768
+ optionTagLabel,
21769
+ optionTagIcon,
21770
+ optionTagClassName,
21771
+ optionTagColor,
21772
+ optionTagBgColor,
21773
+ optionTagOnClick,
21558
21774
  searchable,
21559
21775
  searchPlaceholder,
21560
21776
  emptySearchText,
@@ -21603,7 +21819,14 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21603
21819
  optionDescription,
21604
21820
  optionDisabled,
21605
21821
  optionKey,
21606
- optionIcon
21822
+ optionIcon,
21823
+ optionTags,
21824
+ optionTagLabel,
21825
+ optionTagIcon,
21826
+ optionTagClassName,
21827
+ optionTagColor,
21828
+ optionTagBgColor,
21829
+ optionTagOnClick
21607
21830
  });
21608
21831
  return { items: items2, keyedItems: (0, import_lodash.keyBy)(items2, "value") };
21609
21832
  }, [
@@ -21614,7 +21837,14 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
21614
21837
  optionDescription,
21615
21838
  optionDisabled,
21616
21839
  optionKey,
21617
- optionIcon
21840
+ optionIcon,
21841
+ optionTags,
21842
+ optionTagLabel,
21843
+ optionTagIcon,
21844
+ optionTagClassName,
21845
+ optionTagColor,
21846
+ optionTagBgColor,
21847
+ optionTagOnClick
21618
21848
  ]);
21619
21849
  const selectedValues = React74.useMemo(
21620
21850
  () => new Set(value != null ? value : []),
@@ -22032,7 +22262,7 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
22032
22262
  EmptyPlaceholder: () => /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: emptySearchText != null ? emptySearchText : "No results found" })
22033
22263
  },
22034
22264
  itemContent: (index, item) => {
22035
- var _a2;
22265
+ var _a2, _b;
22036
22266
  const selected = selectedValues.has(item.value);
22037
22267
  const row = /* @__PURE__ */ jsxs(
22038
22268
  "button",
@@ -22056,8 +22286,31 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
22056
22286
  }),
22057
22287
  /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-start gap-2", children: [
22058
22288
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
22059
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
22060
- /* @__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
+ ] }),
22061
22314
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
22062
22315
  ] })
22063
22316
  ] })
@@ -22065,7 +22318,7 @@ var ShadcnMultiSelectVariant = React74.forwardRef(function ShadcnMultiSelectVari
22065
22318
  },
22066
22319
  item.key
22067
22320
  );
22068
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
22321
+ const renderer = (_b = item.render) != null ? _b : renderOption;
22069
22322
  if (!renderer) return row;
22070
22323
  return renderer({
22071
22324
  item,
@@ -23532,6 +23785,13 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23532
23785
  optionDisabled,
23533
23786
  optionIcon,
23534
23787
  optionKey,
23788
+ optionTags,
23789
+ optionTagLabel,
23790
+ optionTagIcon,
23791
+ optionTagClassName,
23792
+ optionTagColor,
23793
+ optionTagBgColor,
23794
+ optionTagOnClick,
23535
23795
  searchable = true,
23536
23796
  searchPlaceholder,
23537
23797
  emptyLabel,
@@ -23583,7 +23843,14 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23583
23843
  optionDescription,
23584
23844
  optionDisabled,
23585
23845
  optionIcon,
23586
- optionKey
23846
+ optionKey,
23847
+ optionTags,
23848
+ optionTagLabel,
23849
+ optionTagIcon,
23850
+ optionTagClassName,
23851
+ optionTagColor,
23852
+ optionTagBgColor,
23853
+ optionTagOnClick
23587
23854
  }),
23588
23855
  [
23589
23856
  options,
@@ -23593,7 +23860,14 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23593
23860
  optionDescription,
23594
23861
  optionDisabled,
23595
23862
  optionIcon,
23596
- optionKey
23863
+ optionKey,
23864
+ optionTags,
23865
+ optionTagLabel,
23866
+ optionTagIcon,
23867
+ optionTagClassName,
23868
+ optionTagColor,
23869
+ optionTagBgColor,
23870
+ optionTagOnClick
23597
23871
  ]
23598
23872
  );
23599
23873
  const allNodesFlat = React74.useMemo(() => flattenTree(tree), [tree]);
@@ -23889,7 +24163,7 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23889
24163
  data: displayedNodes,
23890
24164
  computeItemKey: (_index, item) => item.key,
23891
24165
  itemContent: (index, item) => {
23892
- var _a;
24166
+ var _a, _b;
23893
24167
  const selected = selectedValues.includes(item.value);
23894
24168
  const isExpanded = expanded.has(item.value);
23895
24169
  const parentInLeafOnly = leafOnly && item.hasChildren;
@@ -23948,14 +24222,35 @@ var ShadcnTreeSelectVariant = React74.forwardRef(function ShadcnTreeSelectVarian
23948
24222
  ),
23949
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" }),
23950
24224
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
23951
- /* @__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
+ ] }),
23952
24247
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground truncate mt-0.5", children: item.description })
23953
24248
  ] }),
23954
24249
  !multiple && selected && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-primary ml-auto" })
23955
24250
  ]
23956
24251
  }
23957
24252
  );
23958
- const renderer = (_a = item.render) != null ? _a : renderOption;
24253
+ const renderer = (_b = item.render) != null ? _b : renderOption;
23959
24254
  if (!renderer) {
23960
24255
  return /* @__PURE__ */ jsx(React74.Fragment, { children: optionNode }, item.key);
23961
24256
  }
@@ -25348,11 +25643,18 @@ function normalizeOption(input, {
25348
25643
  optionIcon,
25349
25644
  optionDisabled,
25350
25645
  optionTooltip,
25351
- optionMeta
25646
+ optionMeta,
25647
+ optionTags,
25648
+ optionTagLabel,
25649
+ optionTagIcon,
25650
+ optionTagClassName,
25651
+ optionTagColor,
25652
+ optionTagBgColor,
25653
+ optionTagOnClick
25352
25654
  }, autoCap) {
25353
25655
  var _a, _b, _c, _d, _e, _f;
25354
25656
  const anyInput = input;
25355
- if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
25657
+ if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta || optionTags || optionTagLabel || optionTagIcon || optionTagClassName || optionTagColor || optionTagBgColor || optionTagOnClick) {
25356
25658
  const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
25357
25659
  const value2 = String(rawValue);
25358
25660
  let label2;
@@ -25370,6 +25672,24 @@ function normalizeOption(input, {
25370
25672
  const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
25371
25673
  const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
25372
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;
25373
25693
  return {
25374
25694
  ui: {
25375
25695
  value: value2,
@@ -25377,7 +25697,8 @@ function normalizeOption(input, {
25377
25697
  icon,
25378
25698
  disabled,
25379
25699
  tooltip,
25380
- meta
25700
+ meta,
25701
+ tags
25381
25702
  },
25382
25703
  raw: input
25383
25704
  };
@@ -25409,7 +25730,8 @@ function normalizeOption(input, {
25409
25730
  icon: anyInput.icon,
25410
25731
  disabled: !!anyInput.disabled,
25411
25732
  tooltip: anyInput.tooltip,
25412
- meta: anyInput.meta
25733
+ meta: anyInput.meta,
25734
+ tags: Array.isArray(anyInput.tags) ? anyInput.tags : void 0
25413
25735
  },
25414
25736
  raw: input
25415
25737
  };
@@ -25434,6 +25756,13 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25434
25756
  optionDisabled,
25435
25757
  optionTooltip,
25436
25758
  optionMeta,
25759
+ optionTags,
25760
+ optionTagLabel,
25761
+ optionTagIcon,
25762
+ optionTagClassName,
25763
+ optionTagColor,
25764
+ optionTagBgColor,
25765
+ optionTagOnClick,
25437
25766
  renderOption,
25438
25767
  className,
25439
25768
  itemClassName,
@@ -25454,7 +25783,14 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25454
25783
  optionIcon,
25455
25784
  optionDisabled,
25456
25785
  optionTooltip,
25457
- optionMeta
25786
+ optionMeta,
25787
+ optionTags,
25788
+ optionTagLabel,
25789
+ optionTagIcon,
25790
+ optionTagClassName,
25791
+ optionTagColor,
25792
+ optionTagBgColor,
25793
+ optionTagOnClick
25458
25794
  },
25459
25795
  autoCap
25460
25796
  )
@@ -25467,6 +25803,13 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25467
25803
  optionDisabled,
25468
25804
  optionTooltip,
25469
25805
  optionMeta,
25806
+ optionTags,
25807
+ optionTagLabel,
25808
+ optionTagIcon,
25809
+ optionTagClassName,
25810
+ optionTagColor,
25811
+ optionTagBgColor,
25812
+ optionTagOnClick,
25470
25813
  autoCap
25471
25814
  ]
25472
25815
  );
@@ -25532,11 +25875,28 @@ var ShadcnToggleVariant3 = React74.forwardRef(function ShadcnToggleVariant4(prop
25532
25875
  style: groupStyle,
25533
25876
  "aria-invalid": !!error,
25534
25877
  children: normalizedOptions.map(({ ui: opt }) => {
25878
+ var _a;
25535
25879
  const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
25536
- 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: [
25537
25881
  opt.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: opt.icon }),
25538
- /* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
25539
- ] });
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
+ ] }) });
25540
25900
  const itemNode = /* @__PURE__ */ jsx(
25541
25901
  ToggleGroupItem,
25542
25902
  {
@@ -33566,6 +33926,7 @@ function useData(opts, deps = []) {
33566
33926
  var _a2;
33567
33927
  return (_a2 = opts.initial) != null ? _a2 : [];
33568
33928
  });
33929
+ const [res, setRes] = React74.useState();
33569
33930
  const [loading, setLoading] = React74.useState(false);
33570
33931
  const [error, setError] = React74.useState(void 0);
33571
33932
  const dataRef = React74.useRef(data);
@@ -33694,6 +34055,7 @@ function useData(opts, deps = []) {
33694
34055
  (prev) => prev.filter((x2) => nextIds.has(x2))
33695
34056
  );
33696
34057
  }
34058
+ setRes(resBody);
33697
34059
  setData(list);
33698
34060
  setLoading(false);
33699
34061
  return list;
@@ -33848,7 +34210,7 @@ function useData(opts, deps = []) {
33848
34210
  (idOrIds) => {
33849
34211
  if (selectionMode === "none") return;
33850
34212
  const ids = normalizeIds(idOrIds).filter(isKey);
33851
- if (!ids.length) return;
34213
+ if (!ids.length) return clearSelection();
33852
34214
  for (const id of ids) {
33853
34215
  const hit = dataById.get(id);
33854
34216
  if (hit) selectedCacheRef.current.set(id, hit);
@@ -33925,6 +34287,7 @@ function useData(opts, deps = []) {
33925
34287
  id: opts.id,
33926
34288
  data,
33927
34289
  visible,
34290
+ res,
33928
34291
  loading,
33929
34292
  error,
33930
34293
  query,