@timeax/form-palette 0.1.29 → 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.js CHANGED
@@ -19805,6 +19805,38 @@ function buildGroupLayoutClasses(opts) {
19805
19805
  descriptionClassesBase
19806
19806
  };
19807
19807
  }
19808
+ var badgeVariants = cva(
19809
+ "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",
19810
+ {
19811
+ variants: {
19812
+ variant: {
19813
+ default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
19814
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
19815
+ 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",
19816
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
19817
+ }
19818
+ },
19819
+ defaultVariants: {
19820
+ variant: "default"
19821
+ }
19822
+ }
19823
+ );
19824
+ function Badge({
19825
+ className,
19826
+ variant,
19827
+ asChild = false,
19828
+ ...props
19829
+ }) {
19830
+ const Comp = asChild ? reactSlot.Slot : "span";
19831
+ return /* @__PURE__ */ jsxRuntime.jsx(
19832
+ Comp,
19833
+ {
19834
+ "data-slot": "badge",
19835
+ className: cn(badgeVariants({ variant }), className),
19836
+ ...props
19837
+ }
19838
+ );
19839
+ }
19808
19840
  function RadioGroup({
19809
19841
  className,
19810
19842
  ...props
@@ -19865,6 +19897,34 @@ function resolveRender(obj) {
19865
19897
  }
19866
19898
  return void 0;
19867
19899
  }
19900
+ function resolveByAccessor(input, accessor, fallback) {
19901
+ if (typeof accessor === "function") return accessor(input);
19902
+ if (typeof accessor === "string") return input == null ? void 0 : input[accessor];
19903
+ return fallback;
19904
+ }
19905
+ function normalizeOptionTags(raw, obj, config) {
19906
+ var _a;
19907
+ const rawTags = (_a = resolveByAccessor(raw, config.optionTags)) != null ? _a : Array.isArray(obj == null ? void 0 : obj.tags) ? obj.tags : void 0;
19908
+ if (!Array.isArray(rawTags) || rawTags.length === 0) return void 0;
19909
+ const tags = rawTags.map((tag) => {
19910
+ var _a2, _b, _c, _d, _e, _f, _g;
19911
+ const tagObj = tag != null && typeof tag === "object" ? tag : void 0;
19912
+ 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;
19913
+ if (label === void 0 || label === null || label === "") {
19914
+ return null;
19915
+ }
19916
+ return {
19917
+ label,
19918
+ icon: (_c = resolveByAccessor(tag, config.optionTagIcon)) != null ? _c : tagObj == null ? void 0 : tagObj.icon,
19919
+ className: (_d = resolveByAccessor(tag, config.optionTagClassName)) != null ? _d : tagObj == null ? void 0 : tagObj.className,
19920
+ color: (_e = resolveByAccessor(tag, config.optionTagColor)) != null ? _e : tagObj == null ? void 0 : tagObj.color,
19921
+ bgColor: (_f = resolveByAccessor(tag, config.optionTagBgColor)) != null ? _f : tagObj == null ? void 0 : tagObj.bgColor,
19922
+ onClick: (_g = resolveByAccessor(tag, config.optionTagOnClick)) != null ? _g : tagObj == null ? void 0 : tagObj.onClick,
19923
+ raw: tag
19924
+ };
19925
+ }).filter(Boolean);
19926
+ return tags.length ? tags : void 0;
19927
+ }
19868
19928
  function resolveValue(raw, obj, index, optionValue) {
19869
19929
  var _a, _b, _c;
19870
19930
  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);
@@ -19902,6 +19962,7 @@ function normalizeOne(raw, index, config) {
19902
19962
  const disabled = resolveDisabled(raw, obj, config.optionDisabled);
19903
19963
  const icon = resolveIcon(raw, obj, config.optionIcon);
19904
19964
  const key = resolveKey(raw, obj, index, value, config.optionKey);
19965
+ const tags = normalizeOptionTags(raw, obj, config);
19905
19966
  const render = resolveRender(obj);
19906
19967
  return {
19907
19968
  key: String(key),
@@ -19911,6 +19972,7 @@ function normalizeOne(raw, index, config) {
19911
19972
  description,
19912
19973
  disabled,
19913
19974
  icon,
19975
+ tags,
19914
19976
  render,
19915
19977
  raw
19916
19978
  };
@@ -19921,7 +19983,7 @@ function globalNormalizeOptions(opts, config) {
19921
19983
  (raw, index) => normalizeOne(raw, index, config)
19922
19984
  );
19923
19985
  }
19924
- function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionValueKey) {
19986
+ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionValueKey, tagConfig) {
19925
19987
  var _a, _b;
19926
19988
  const anyItem = item;
19927
19989
  const rawValue = optionValueKey != null ? anyItem[optionValueKey] : anyItem.value;
@@ -19930,6 +19992,7 @@ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionVal
19930
19992
  const description = anyItem.description;
19931
19993
  const disabled = !!anyItem.disabled;
19932
19994
  const key = (_b = anyItem.key) != null ? _b : index;
19995
+ const tags = normalizeOptionTags(item, anyItem, tagConfig != null ? tagConfig : {});
19933
19996
  const render = resolveRender(anyItem);
19934
19997
  return {
19935
19998
  key: String(key),
@@ -19937,6 +20000,7 @@ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionVal
19937
20000
  label: rawLabel,
19938
20001
  description,
19939
20002
  disabled,
20003
+ tags,
19940
20004
  render,
19941
20005
  raw: item
19942
20006
  };
@@ -20012,7 +20076,7 @@ function capitalizeFirst2(label) {
20012
20076
  if (!label) return label;
20013
20077
  return label.charAt(0).toUpperCase() + label.slice(1);
20014
20078
  }
20015
- function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
20079
+ function normalizeItems(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
20016
20080
  if (mappers) {
20017
20081
  return items.map((item, index) => ({
20018
20082
  value: mappers.getValue(item, index),
@@ -20030,7 +20094,16 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
20030
20094
  item,
20031
20095
  index,
20032
20096
  optionLabelKey,
20033
- optionValueKey
20097
+ optionValueKey,
20098
+ {
20099
+ optionTags: optionTagsKey,
20100
+ optionTagLabel,
20101
+ optionTagIcon,
20102
+ optionTagClassName,
20103
+ optionTagColor,
20104
+ optionTagBgColor,
20105
+ optionTagOnClick
20106
+ }
20034
20107
  ),
20035
20108
  raw: item
20036
20109
  };
@@ -20068,6 +20141,13 @@ var InnerShadcnRadioVariant = (props, ref) => {
20068
20141
  mappers,
20069
20142
  optionValue,
20070
20143
  optionLabel,
20144
+ optionTags,
20145
+ optionTagLabel,
20146
+ optionTagIcon,
20147
+ optionTagClassName,
20148
+ optionTagColor,
20149
+ optionTagBgColor,
20150
+ optionTagOnClick,
20071
20151
  renderOption,
20072
20152
  layout = "list",
20073
20153
  columns = 2,
@@ -20096,9 +20176,30 @@ var InnerShadcnRadioVariant = (props, ref) => {
20096
20176
  mappers,
20097
20177
  //@ts-ignore
20098
20178
  optionValue,
20099
- optionLabel
20179
+ optionLabel,
20180
+ //@ts-ignore
20181
+ optionTags,
20182
+ optionTagLabel,
20183
+ optionTagIcon,
20184
+ optionTagClassName,
20185
+ optionTagColor,
20186
+ optionTagBgColor,
20187
+ optionTagOnClick
20100
20188
  ),
20101
- [items, options, mappers, optionValue, optionLabel]
20189
+ [
20190
+ items,
20191
+ options,
20192
+ mappers,
20193
+ optionValue,
20194
+ optionLabel,
20195
+ optionTags,
20196
+ optionTagLabel,
20197
+ optionTagIcon,
20198
+ optionTagClassName,
20199
+ optionTagColor,
20200
+ optionTagBgColor,
20201
+ optionTagOnClick
20202
+ ]
20102
20203
  );
20103
20204
  const selectedString = React74__namespace.useMemo(() => {
20104
20205
  if (value === void 0) return void 0;
@@ -20168,7 +20269,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
20168
20269
  "data-slot": "radio-group",
20169
20270
  ...restGroupProps,
20170
20271
  children: normalized.map((item, index) => {
20171
- var _a, _b;
20272
+ var _a, _b, _c;
20172
20273
  const itemString = String(item.value);
20173
20274
  const selected = selectedString === itemString;
20174
20275
  const optionDisabled = !!disabled || !!item.disabled;
@@ -20232,7 +20333,25 @@ var InnerShadcnRadioVariant = (props, ref) => {
20232
20333
  children: [
20233
20334
  radioNode,
20234
20335
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0", children: [
20235
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: labelClassesBase, children: displayItem.label }),
20336
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
20337
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(labelClassesBase, "truncate"), children: displayItem.label }),
20338
+ !!((_c = displayItem.tags) == null ? void 0 : _c.length) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: displayItem.tags.map((tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
20339
+ Badge,
20340
+ {
20341
+ className: cn("text-xs", tag.className),
20342
+ onClick: tag.onClick,
20343
+ style: {
20344
+ color: tag.color,
20345
+ backgroundColor: tag.bgColor
20346
+ },
20347
+ children: [
20348
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
20349
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
20350
+ ]
20351
+ },
20352
+ tagIndex
20353
+ )) })
20354
+ ] }),
20236
20355
  displayItem.description != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: descriptionClassesBase, children: displayItem.description })
20237
20356
  ] })
20238
20357
  ]
@@ -20363,7 +20482,7 @@ function capitalizeFirst3(label) {
20363
20482
  if (!label) return label;
20364
20483
  return label.charAt(0).toUpperCase() + label.slice(1);
20365
20484
  }
20366
- function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20485
+ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
20367
20486
  if (!items || !items.length) return [];
20368
20487
  if (mappers) {
20369
20488
  return items.map((item, index) => ({
@@ -20383,7 +20502,16 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20383
20502
  item,
20384
20503
  index,
20385
20504
  optionLabelKey,
20386
- optionValueKey
20505
+ optionValueKey,
20506
+ {
20507
+ optionTags: optionTagsKey,
20508
+ optionTagLabel,
20509
+ optionTagIcon,
20510
+ optionTagClassName,
20511
+ optionTagColor,
20512
+ optionTagBgColor,
20513
+ optionTagOnClick
20514
+ }
20387
20515
  );
20388
20516
  const tristate = anyItem.tristate;
20389
20517
  return {
@@ -20453,6 +20581,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20453
20581
  mappers,
20454
20582
  optionValue,
20455
20583
  optionLabel,
20584
+ optionTags,
20585
+ optionTagLabel,
20586
+ optionTagIcon,
20587
+ optionTagClassName,
20588
+ optionTagColor,
20589
+ optionTagBgColor,
20590
+ optionTagOnClick,
20456
20591
  renderOption,
20457
20592
  single,
20458
20593
  tristate: tristateDefault,
@@ -20485,9 +20620,29 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20485
20620
  items != null ? items : options,
20486
20621
  mappers,
20487
20622
  optionValue,
20488
- optionLabel
20623
+ optionLabel,
20624
+ optionTags,
20625
+ optionTagLabel,
20626
+ optionTagIcon,
20627
+ optionTagClassName,
20628
+ optionTagColor,
20629
+ optionTagBgColor,
20630
+ optionTagOnClick
20489
20631
  ),
20490
- [items, options, mappers, optionValue, optionLabel]
20632
+ [
20633
+ items,
20634
+ options,
20635
+ mappers,
20636
+ optionValue,
20637
+ optionLabel,
20638
+ optionTags,
20639
+ optionTagLabel,
20640
+ optionTagIcon,
20641
+ optionTagClassName,
20642
+ optionTagColor,
20643
+ optionTagBgColor,
20644
+ optionTagOnClick
20645
+ ]
20491
20646
  );
20492
20647
  if (isSingle) {
20493
20648
  const singleVal = asSingleValue(value);
@@ -20701,7 +20856,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20701
20856
  style: groupStyle,
20702
20857
  ...restProps,
20703
20858
  children: normalized.map((item, index) => {
20704
- var _a, _b, _c, _d;
20859
+ var _a, _b, _c, _d, _e;
20705
20860
  const effectiveTristate = (_b = (_a = item.tristate) != null ? _a : tristateDefault) != null ? _b : false;
20706
20861
  const currentState = getEntryState(item.value);
20707
20862
  const internalState = effectiveTristate ? currentState : currentState === "none" ? false : currentState;
@@ -20789,16 +20944,35 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
20789
20944
  children: [
20790
20945
  checkboxNode,
20791
20946
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
20792
- /* @__PURE__ */ jsxRuntime.jsx(
20793
- "span",
20794
- {
20795
- className: cn(
20796
- labelClassesBase,
20797
- optionLabelClassName
20798
- ),
20799
- children: displayItem.label
20800
- }
20801
- ),
20947
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
20948
+ /* @__PURE__ */ jsxRuntime.jsx(
20949
+ "span",
20950
+ {
20951
+ className: cn(
20952
+ labelClassesBase,
20953
+ optionLabelClassName,
20954
+ "truncate"
20955
+ ),
20956
+ children: displayItem.label
20957
+ }
20958
+ ),
20959
+ !!((_e = displayItem.tags) == null ? void 0 : _e.length) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: displayItem.tags.map((tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
20960
+ Badge,
20961
+ {
20962
+ className: cn("text-xs", tag.className),
20963
+ onClick: tag.onClick,
20964
+ style: {
20965
+ color: tag.color,
20966
+ backgroundColor: tag.bgColor
20967
+ },
20968
+ children: [
20969
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
20970
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
20971
+ ]
20972
+ },
20973
+ tagIndex
20974
+ )) })
20975
+ ] }),
20802
20976
  displayItem.description != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: descriptionClassesBase, children: displayItem.description })
20803
20977
  ] })
20804
20978
  ]
@@ -20878,6 +21052,13 @@ var ShadcnSelectVariant = React74__namespace.forwardRef(function ShadcnSelectVar
20878
21052
  optionDisabled,
20879
21053
  optionIcon,
20880
21054
  optionKey,
21055
+ optionTags,
21056
+ optionTagLabel,
21057
+ optionTagIcon,
21058
+ optionTagClassName,
21059
+ optionTagColor,
21060
+ optionTagBgColor,
21061
+ optionTagOnClick,
20881
21062
  searchable,
20882
21063
  searchPlaceholder,
20883
21064
  emptyLabel,
@@ -20921,7 +21102,14 @@ var ShadcnSelectVariant = React74__namespace.forwardRef(function ShadcnSelectVar
20921
21102
  optionDescription,
20922
21103
  optionDisabled,
20923
21104
  optionKey,
20924
- optionIcon
21105
+ optionIcon,
21106
+ optionTags,
21107
+ optionTagLabel,
21108
+ optionTagIcon,
21109
+ optionTagClassName,
21110
+ optionTagColor,
21111
+ optionTagBgColor,
21112
+ optionTagOnClick
20925
21113
  }),
20926
21114
  [
20927
21115
  options,
@@ -20931,7 +21119,14 @@ var ShadcnSelectVariant = React74__namespace.forwardRef(function ShadcnSelectVar
20931
21119
  optionDescription,
20932
21120
  optionDisabled,
20933
21121
  optionKey,
20934
- optionIcon
21122
+ optionIcon,
21123
+ optionTags,
21124
+ optionTagLabel,
21125
+ optionTagIcon,
21126
+ optionTagClassName,
21127
+ optionTagColor,
21128
+ optionTagBgColor,
21129
+ optionTagOnClick
20935
21130
  ]
20936
21131
  );
20937
21132
  const normalizedValue = value === "" || value == null ? void 0 : value;
@@ -21171,7 +21366,7 @@ var ShadcnSelectVariant = React74__namespace.forwardRef(function ShadcnSelectVar
21171
21366
  data: filteredItems,
21172
21367
  computeItemKey: (_index, item) => item.key,
21173
21368
  itemContent: (index, item) => {
21174
- var _a2;
21369
+ var _a2, _b2;
21175
21370
  const optionNode = /* @__PURE__ */ jsxRuntime.jsx(
21176
21371
  SelectItem,
21177
21372
  {
@@ -21179,15 +21374,38 @@ var ShadcnSelectVariant = React74__namespace.forwardRef(function ShadcnSelectVar
21179
21374
  disabled: item.disabled,
21180
21375
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
21181
21376
  item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21182
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
21183
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.labelNode }),
21377
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
21378
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
21379
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.labelNode }),
21380
+ !!((_a2 = item.tags) == null ? void 0 : _a2.length) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: item.tags.map(
21381
+ (tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
21382
+ Badge,
21383
+ {
21384
+ className: cn(
21385
+ "text-xs",
21386
+ tag.className
21387
+ ),
21388
+ onClick: tag.onClick,
21389
+ style: {
21390
+ color: tag.color,
21391
+ backgroundColor: tag.bgColor
21392
+ },
21393
+ children: [
21394
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
21395
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
21396
+ ]
21397
+ },
21398
+ tagIndex
21399
+ )
21400
+ ) })
21401
+ ] }),
21184
21402
  item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21185
21403
  ] })
21186
21404
  ] })
21187
21405
  },
21188
21406
  item.key
21189
21407
  );
21190
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
21408
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21191
21409
  if (!renderer) return optionNode;
21192
21410
  return renderer({
21193
21411
  item,
@@ -21206,7 +21424,7 @@ var ShadcnSelectVariant = React74__namespace.forwardRef(function ShadcnSelectVar
21206
21424
  }
21207
21425
  )
21208
21426
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-60 overflow-auto", children: filteredItems.map((item, index) => {
21209
- var _a2;
21427
+ var _a2, _b2;
21210
21428
  const optionNode = /* @__PURE__ */ jsxRuntime.jsx(
21211
21429
  SelectItem,
21212
21430
  {
@@ -21214,15 +21432,38 @@ var ShadcnSelectVariant = React74__namespace.forwardRef(function ShadcnSelectVar
21214
21432
  disabled: item.disabled,
21215
21433
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
21216
21434
  item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21217
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
21218
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.labelNode }),
21435
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
21436
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
21437
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.labelNode }),
21438
+ !!((_a2 = item.tags) == null ? void 0 : _a2.length) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: item.tags.map(
21439
+ (tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
21440
+ Badge,
21441
+ {
21442
+ className: cn(
21443
+ "text-xs",
21444
+ tag.className
21445
+ ),
21446
+ onClick: tag.onClick,
21447
+ style: {
21448
+ color: tag.color,
21449
+ backgroundColor: tag.bgColor
21450
+ },
21451
+ children: [
21452
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
21453
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
21454
+ ]
21455
+ },
21456
+ tagIndex
21457
+ )
21458
+ ) })
21459
+ ] }),
21219
21460
  item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21220
21461
  ] })
21221
21462
  ] })
21222
21463
  },
21223
21464
  item.key
21224
21465
  );
21225
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
21466
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21226
21467
  if (!renderer) return optionNode;
21227
21468
  return renderer({
21228
21469
  item,
@@ -21372,38 +21613,6 @@ var selectModule = {
21372
21613
  tags: ["select", "dropdown", "single-value"]
21373
21614
  }
21374
21615
  };
21375
- var badgeVariants = cva(
21376
- "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",
21377
- {
21378
- variants: {
21379
- variant: {
21380
- default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
21381
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
21382
- 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",
21383
- outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
21384
- }
21385
- },
21386
- defaultVariants: {
21387
- variant: "default"
21388
- }
21389
- }
21390
- );
21391
- function Badge({
21392
- className,
21393
- variant,
21394
- asChild = false,
21395
- ...props
21396
- }) {
21397
- const Comp = asChild ? reactSlot.Slot : "span";
21398
- return /* @__PURE__ */ jsxRuntime.jsx(
21399
- Comp,
21400
- {
21401
- "data-slot": "badge",
21402
- className: cn(badgeVariants({ variant }), className),
21403
- ...props
21404
- }
21405
- );
21406
- }
21407
21616
  function getTextWidth(text, font) {
21408
21617
  if (typeof window === "undefined") return 0;
21409
21618
  const canvas = window.__canvas || (window.__canvas = document.createElement("canvas"));
@@ -21593,6 +21802,13 @@ var ShadcnMultiSelectVariant = React74__namespace.forwardRef(function ShadcnMult
21593
21802
  optionDisabled,
21594
21803
  optionIcon,
21595
21804
  optionKey,
21805
+ optionTags,
21806
+ optionTagLabel,
21807
+ optionTagIcon,
21808
+ optionTagClassName,
21809
+ optionTagColor,
21810
+ optionTagBgColor,
21811
+ optionTagOnClick,
21596
21812
  searchable,
21597
21813
  searchPlaceholder,
21598
21814
  emptySearchText,
@@ -21641,7 +21857,14 @@ var ShadcnMultiSelectVariant = React74__namespace.forwardRef(function ShadcnMult
21641
21857
  optionDescription,
21642
21858
  optionDisabled,
21643
21859
  optionKey,
21644
- optionIcon
21860
+ optionIcon,
21861
+ optionTags,
21862
+ optionTagLabel,
21863
+ optionTagIcon,
21864
+ optionTagClassName,
21865
+ optionTagColor,
21866
+ optionTagBgColor,
21867
+ optionTagOnClick
21645
21868
  });
21646
21869
  return { items: items2, keyedItems: (0, import_lodash.keyBy)(items2, "value") };
21647
21870
  }, [
@@ -21652,7 +21875,14 @@ var ShadcnMultiSelectVariant = React74__namespace.forwardRef(function ShadcnMult
21652
21875
  optionDescription,
21653
21876
  optionDisabled,
21654
21877
  optionKey,
21655
- optionIcon
21878
+ optionIcon,
21879
+ optionTags,
21880
+ optionTagLabel,
21881
+ optionTagIcon,
21882
+ optionTagClassName,
21883
+ optionTagColor,
21884
+ optionTagBgColor,
21885
+ optionTagOnClick
21656
21886
  ]);
21657
21887
  const selectedValues = React74__namespace.useMemo(
21658
21888
  () => new Set(value != null ? value : []),
@@ -22070,7 +22300,7 @@ var ShadcnMultiSelectVariant = React74__namespace.forwardRef(function ShadcnMult
22070
22300
  EmptyPlaceholder: () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: emptySearchText != null ? emptySearchText : "No results found" })
22071
22301
  },
22072
22302
  itemContent: (index, item) => {
22073
- var _a2;
22303
+ var _a2, _b;
22074
22304
  const selected = selectedValues.has(item.value);
22075
22305
  const row = /* @__PURE__ */ jsxRuntime.jsxs(
22076
22306
  "button",
@@ -22094,8 +22324,31 @@ var ShadcnMultiSelectVariant = React74__namespace.forwardRef(function ShadcnMult
22094
22324
  }),
22095
22325
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 items-start gap-2", children: [
22096
22326
  item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
22097
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
22098
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.labelNode }),
22327
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
22328
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
22329
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.labelNode }),
22330
+ !!((_a2 = item.tags) == null ? void 0 : _a2.length) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: item.tags.map(
22331
+ (tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
22332
+ Badge,
22333
+ {
22334
+ className: cn(
22335
+ "text-xs",
22336
+ tag.className
22337
+ ),
22338
+ onClick: tag.onClick,
22339
+ style: {
22340
+ color: tag.color,
22341
+ backgroundColor: tag.bgColor
22342
+ },
22343
+ children: [
22344
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
22345
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
22346
+ ]
22347
+ },
22348
+ tagIndex
22349
+ )
22350
+ ) })
22351
+ ] }),
22099
22352
  item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
22100
22353
  ] })
22101
22354
  ] })
@@ -22103,7 +22356,7 @@ var ShadcnMultiSelectVariant = React74__namespace.forwardRef(function ShadcnMult
22103
22356
  },
22104
22357
  item.key
22105
22358
  );
22106
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
22359
+ const renderer = (_b = item.render) != null ? _b : renderOption;
22107
22360
  if (!renderer) return row;
22108
22361
  return renderer({
22109
22362
  item,
@@ -23570,6 +23823,13 @@ var ShadcnTreeSelectVariant = React74__namespace.forwardRef(function ShadcnTreeS
23570
23823
  optionDisabled,
23571
23824
  optionIcon,
23572
23825
  optionKey,
23826
+ optionTags,
23827
+ optionTagLabel,
23828
+ optionTagIcon,
23829
+ optionTagClassName,
23830
+ optionTagColor,
23831
+ optionTagBgColor,
23832
+ optionTagOnClick,
23573
23833
  searchable = true,
23574
23834
  searchPlaceholder,
23575
23835
  emptyLabel,
@@ -23621,7 +23881,14 @@ var ShadcnTreeSelectVariant = React74__namespace.forwardRef(function ShadcnTreeS
23621
23881
  optionDescription,
23622
23882
  optionDisabled,
23623
23883
  optionIcon,
23624
- optionKey
23884
+ optionKey,
23885
+ optionTags,
23886
+ optionTagLabel,
23887
+ optionTagIcon,
23888
+ optionTagClassName,
23889
+ optionTagColor,
23890
+ optionTagBgColor,
23891
+ optionTagOnClick
23625
23892
  }),
23626
23893
  [
23627
23894
  options,
@@ -23631,7 +23898,14 @@ var ShadcnTreeSelectVariant = React74__namespace.forwardRef(function ShadcnTreeS
23631
23898
  optionDescription,
23632
23899
  optionDisabled,
23633
23900
  optionIcon,
23634
- optionKey
23901
+ optionKey,
23902
+ optionTags,
23903
+ optionTagLabel,
23904
+ optionTagIcon,
23905
+ optionTagClassName,
23906
+ optionTagColor,
23907
+ optionTagBgColor,
23908
+ optionTagOnClick
23635
23909
  ]
23636
23910
  );
23637
23911
  const allNodesFlat = React74__namespace.useMemo(() => flattenTree(tree), [tree]);
@@ -23927,7 +24201,7 @@ var ShadcnTreeSelectVariant = React74__namespace.forwardRef(function ShadcnTreeS
23927
24201
  data: displayedNodes,
23928
24202
  computeItemKey: (_index, item) => item.key,
23929
24203
  itemContent: (index, item) => {
23930
- var _a;
24204
+ var _a, _b;
23931
24205
  const selected = selectedValues.includes(item.value);
23932
24206
  const isExpanded = expanded.has(item.value);
23933
24207
  const parentInLeafOnly = leafOnly && item.hasChildren;
@@ -23986,14 +24260,35 @@ var ShadcnTreeSelectVariant = React74__namespace.forwardRef(function ShadcnTreeS
23986
24260
  ),
23987
24261
  item.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: item.icon }) : item.hasChildren ? isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(FolderOpen, { className: "h-4 w-4 text-blue-400/80 fill-blue-400/20" }) : /* @__PURE__ */ jsxRuntime.jsx(Folder, { className: "h-4 w-4 text-blue-400/80 fill-blue-400/20" }) : /* @__PURE__ */ jsxRuntime.jsx(File2, { className: "h-4 w-4 text-muted-foreground/60" }),
23988
24262
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
23989
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium leading-none", children: item.labelNode }),
24263
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
24264
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium leading-none", children: item.labelNode }),
24265
+ !!((_a = item.tags) == null ? void 0 : _a.length) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: item.tags.map((tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
24266
+ Badge,
24267
+ {
24268
+ className: cn(
24269
+ "text-xs",
24270
+ tag.className
24271
+ ),
24272
+ onClick: tag.onClick,
24273
+ style: {
24274
+ color: tag.color,
24275
+ backgroundColor: tag.bgColor
24276
+ },
24277
+ children: [
24278
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
24279
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
24280
+ ]
24281
+ },
24282
+ tagIndex
24283
+ )) })
24284
+ ] }),
23990
24285
  item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground truncate mt-0.5", children: item.description })
23991
24286
  ] }),
23992
24287
  !multiple && selected && /* @__PURE__ */ jsxRuntime.jsx(Check, { className: "h-4 w-4 text-primary ml-auto" })
23993
24288
  ]
23994
24289
  }
23995
24290
  );
23996
- const renderer = (_a = item.render) != null ? _a : renderOption;
24291
+ const renderer = (_b = item.render) != null ? _b : renderOption;
23997
24292
  if (!renderer) {
23998
24293
  return /* @__PURE__ */ jsxRuntime.jsx(React74__namespace.Fragment, { children: optionNode }, item.key);
23999
24294
  }
@@ -25386,11 +25681,18 @@ function normalizeOption(input, {
25386
25681
  optionIcon,
25387
25682
  optionDisabled,
25388
25683
  optionTooltip,
25389
- optionMeta
25684
+ optionMeta,
25685
+ optionTags,
25686
+ optionTagLabel,
25687
+ optionTagIcon,
25688
+ optionTagClassName,
25689
+ optionTagColor,
25690
+ optionTagBgColor,
25691
+ optionTagOnClick
25390
25692
  }, autoCap) {
25391
25693
  var _a, _b, _c, _d, _e, _f;
25392
25694
  const anyInput = input;
25393
- if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
25695
+ if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta || optionTags || optionTagLabel || optionTagIcon || optionTagClassName || optionTagColor || optionTagBgColor || optionTagOnClick) {
25394
25696
  const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
25395
25697
  const value2 = String(rawValue);
25396
25698
  let label2;
@@ -25408,6 +25710,24 @@ function normalizeOption(input, {
25408
25710
  const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
25409
25711
  const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
25410
25712
  const meta = optionMeta != null ? anyInput[optionMeta] : (_d = anyInput.meta) != null ? _d : void 0;
25713
+ const rawTags = optionTags != null ? anyInput[optionTags] : anyInput.tags;
25714
+ const tags = Array.isArray(rawTags) ? rawTags.flatMap((tag) => {
25715
+ const label3 = optionTagLabel != null ? tag == null ? void 0 : tag[optionTagLabel] : tag == null ? void 0 : tag.label;
25716
+ if (label3 === void 0 || label3 === null || label3 === "") {
25717
+ return [];
25718
+ }
25719
+ return [
25720
+ {
25721
+ label: label3,
25722
+ icon: optionTagIcon != null ? tag == null ? void 0 : tag[optionTagIcon] : tag == null ? void 0 : tag.icon,
25723
+ className: optionTagClassName != null ? tag == null ? void 0 : tag[optionTagClassName] : tag == null ? void 0 : tag.className,
25724
+ color: optionTagColor != null ? tag == null ? void 0 : tag[optionTagColor] : tag == null ? void 0 : tag.color,
25725
+ bgColor: optionTagBgColor != null ? tag == null ? void 0 : tag[optionTagBgColor] : tag == null ? void 0 : tag.bgColor,
25726
+ onClick: optionTagOnClick != null ? tag == null ? void 0 : tag[optionTagOnClick] : tag == null ? void 0 : tag.onClick,
25727
+ raw: tag
25728
+ }
25729
+ ];
25730
+ }) : void 0;
25411
25731
  return {
25412
25732
  ui: {
25413
25733
  value: value2,
@@ -25415,7 +25735,8 @@ function normalizeOption(input, {
25415
25735
  icon,
25416
25736
  disabled,
25417
25737
  tooltip,
25418
- meta
25738
+ meta,
25739
+ tags
25419
25740
  },
25420
25741
  raw: input
25421
25742
  };
@@ -25447,7 +25768,8 @@ function normalizeOption(input, {
25447
25768
  icon: anyInput.icon,
25448
25769
  disabled: !!anyInput.disabled,
25449
25770
  tooltip: anyInput.tooltip,
25450
- meta: anyInput.meta
25771
+ meta: anyInput.meta,
25772
+ tags: Array.isArray(anyInput.tags) ? anyInput.tags : void 0
25451
25773
  },
25452
25774
  raw: input
25453
25775
  };
@@ -25472,6 +25794,13 @@ var ShadcnToggleVariant3 = React74__namespace.forwardRef(function ShadcnToggleVa
25472
25794
  optionDisabled,
25473
25795
  optionTooltip,
25474
25796
  optionMeta,
25797
+ optionTags,
25798
+ optionTagLabel,
25799
+ optionTagIcon,
25800
+ optionTagClassName,
25801
+ optionTagColor,
25802
+ optionTagBgColor,
25803
+ optionTagOnClick,
25475
25804
  renderOption,
25476
25805
  className,
25477
25806
  itemClassName,
@@ -25492,7 +25821,14 @@ var ShadcnToggleVariant3 = React74__namespace.forwardRef(function ShadcnToggleVa
25492
25821
  optionIcon,
25493
25822
  optionDisabled,
25494
25823
  optionTooltip,
25495
- optionMeta
25824
+ optionMeta,
25825
+ optionTags,
25826
+ optionTagLabel,
25827
+ optionTagIcon,
25828
+ optionTagClassName,
25829
+ optionTagColor,
25830
+ optionTagBgColor,
25831
+ optionTagOnClick
25496
25832
  },
25497
25833
  autoCap
25498
25834
  )
@@ -25505,6 +25841,13 @@ var ShadcnToggleVariant3 = React74__namespace.forwardRef(function ShadcnToggleVa
25505
25841
  optionDisabled,
25506
25842
  optionTooltip,
25507
25843
  optionMeta,
25844
+ optionTags,
25845
+ optionTagLabel,
25846
+ optionTagIcon,
25847
+ optionTagClassName,
25848
+ optionTagColor,
25849
+ optionTagBgColor,
25850
+ optionTagOnClick,
25508
25851
  autoCap
25509
25852
  ]
25510
25853
  );
@@ -25570,11 +25913,28 @@ var ShadcnToggleVariant3 = React74__namespace.forwardRef(function ShadcnToggleVa
25570
25913
  style: groupStyle,
25571
25914
  "aria-invalid": !!error,
25572
25915
  children: normalizedOptions.map(({ ui: opt }) => {
25916
+ var _a;
25573
25917
  const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
25574
- const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
25918
+ const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-start gap-1 truncate", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full min-w-0 items-start gap-2", children: [
25575
25919
  opt.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: opt.icon }),
25576
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: opt.label })
25577
- ] });
25920
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: opt.label }),
25921
+ !!((_a = opt.tags) == null ? void 0 : _a.length) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex shrink-0 flex-wrap gap-1", children: opt.tags.map((tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
25922
+ Badge,
25923
+ {
25924
+ className: cn("text-xs", tag.className),
25925
+ onClick: tag.onClick,
25926
+ style: {
25927
+ color: tag.color,
25928
+ backgroundColor: tag.bgColor
25929
+ },
25930
+ children: [
25931
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
25932
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
25933
+ ]
25934
+ },
25935
+ tagIndex
25936
+ )) })
25937
+ ] }) });
25578
25938
  const itemNode = /* @__PURE__ */ jsxRuntime.jsx(
25579
25939
  ToggleGroupItem,
25580
25940
  {