@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/index.mjs CHANGED
@@ -20411,6 +20411,38 @@ function buildGroupLayoutClasses(opts) {
20411
20411
  descriptionClassesBase
20412
20412
  };
20413
20413
  }
20414
+ var badgeVariants = cva(
20415
+ "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",
20416
+ {
20417
+ variants: {
20418
+ variant: {
20419
+ default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
20420
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
20421
+ 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",
20422
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
20423
+ }
20424
+ },
20425
+ defaultVariants: {
20426
+ variant: "default"
20427
+ }
20428
+ }
20429
+ );
20430
+ function Badge({
20431
+ className,
20432
+ variant,
20433
+ asChild = false,
20434
+ ...props
20435
+ }) {
20436
+ const Comp = asChild ? Slot : "span";
20437
+ return /* @__PURE__ */ jsx(
20438
+ Comp,
20439
+ {
20440
+ "data-slot": "badge",
20441
+ className: cn(badgeVariants({ variant }), className),
20442
+ ...props
20443
+ }
20444
+ );
20445
+ }
20414
20446
  function RadioGroup({
20415
20447
  className,
20416
20448
  ...props
@@ -20471,6 +20503,34 @@ function resolveRender(obj) {
20471
20503
  }
20472
20504
  return void 0;
20473
20505
  }
20506
+ function resolveByAccessor(input, accessor, fallback) {
20507
+ if (typeof accessor === "function") return accessor(input);
20508
+ if (typeof accessor === "string") return input == null ? void 0 : input[accessor];
20509
+ return fallback;
20510
+ }
20511
+ function normalizeOptionTags(raw, obj, config) {
20512
+ var _a;
20513
+ const rawTags = (_a = resolveByAccessor(raw, config.optionTags)) != null ? _a : Array.isArray(obj == null ? void 0 : obj.tags) ? obj.tags : void 0;
20514
+ if (!Array.isArray(rawTags) || rawTags.length === 0) return void 0;
20515
+ const tags = rawTags.map((tag) => {
20516
+ var _a2, _b, _c, _d, _e, _f, _g;
20517
+ const tagObj = tag != null && typeof tag === "object" ? tag : void 0;
20518
+ 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;
20519
+ if (label === void 0 || label === null || label === "") {
20520
+ return null;
20521
+ }
20522
+ return {
20523
+ label,
20524
+ icon: (_c = resolveByAccessor(tag, config.optionTagIcon)) != null ? _c : tagObj == null ? void 0 : tagObj.icon,
20525
+ className: (_d = resolveByAccessor(tag, config.optionTagClassName)) != null ? _d : tagObj == null ? void 0 : tagObj.className,
20526
+ color: (_e = resolveByAccessor(tag, config.optionTagColor)) != null ? _e : tagObj == null ? void 0 : tagObj.color,
20527
+ bgColor: (_f = resolveByAccessor(tag, config.optionTagBgColor)) != null ? _f : tagObj == null ? void 0 : tagObj.bgColor,
20528
+ onClick: (_g = resolveByAccessor(tag, config.optionTagOnClick)) != null ? _g : tagObj == null ? void 0 : tagObj.onClick,
20529
+ raw: tag
20530
+ };
20531
+ }).filter(Boolean);
20532
+ return tags.length ? tags : void 0;
20533
+ }
20474
20534
  function resolveValue(raw, obj, index, optionValue) {
20475
20535
  var _a, _b, _c;
20476
20536
  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);
@@ -20508,6 +20568,7 @@ function normalizeOne(raw, index, config) {
20508
20568
  const disabled = resolveDisabled(raw, obj, config.optionDisabled);
20509
20569
  const icon = resolveIcon(raw, obj, config.optionIcon);
20510
20570
  const key = resolveKey(raw, obj, index, value, config.optionKey);
20571
+ const tags = normalizeOptionTags(raw, obj, config);
20511
20572
  const render = resolveRender(obj);
20512
20573
  return {
20513
20574
  key: String(key),
@@ -20517,6 +20578,7 @@ function normalizeOne(raw, index, config) {
20517
20578
  description,
20518
20579
  disabled,
20519
20580
  icon,
20581
+ tags,
20520
20582
  render,
20521
20583
  raw
20522
20584
  };
@@ -20527,7 +20589,7 @@ function globalNormalizeOptions(opts, config) {
20527
20589
  (raw, index) => normalizeOne(raw, index, config)
20528
20590
  );
20529
20591
  }
20530
- function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionValueKey) {
20592
+ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionValueKey, tagConfig) {
20531
20593
  var _a, _b;
20532
20594
  const anyItem = item;
20533
20595
  const rawValue = optionValueKey != null ? anyItem[optionValueKey] : anyItem.value;
@@ -20536,6 +20598,7 @@ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionVal
20536
20598
  const description = anyItem.description;
20537
20599
  const disabled = !!anyItem.disabled;
20538
20600
  const key = (_b = anyItem.key) != null ? _b : index;
20601
+ const tags = normalizeOptionTags(item, anyItem, tagConfig != null ? tagConfig : {});
20539
20602
  const render = resolveRender(anyItem);
20540
20603
  return {
20541
20604
  key: String(key),
@@ -20543,6 +20606,7 @@ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionVal
20543
20606
  label: rawLabel,
20544
20607
  description,
20545
20608
  disabled,
20609
+ tags,
20546
20610
  render,
20547
20611
  raw: item
20548
20612
  };
@@ -20618,7 +20682,7 @@ function capitalizeFirst2(label) {
20618
20682
  if (!label) return label;
20619
20683
  return label.charAt(0).toUpperCase() + label.slice(1);
20620
20684
  }
20621
- function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
20685
+ function normalizeItems(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
20622
20686
  if (mappers) {
20623
20687
  return items.map((item, index) => ({
20624
20688
  value: mappers.getValue(item, index),
@@ -20636,7 +20700,16 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
20636
20700
  item,
20637
20701
  index,
20638
20702
  optionLabelKey,
20639
- optionValueKey
20703
+ optionValueKey,
20704
+ {
20705
+ optionTags: optionTagsKey,
20706
+ optionTagLabel,
20707
+ optionTagIcon,
20708
+ optionTagClassName,
20709
+ optionTagColor,
20710
+ optionTagBgColor,
20711
+ optionTagOnClick
20712
+ }
20640
20713
  ),
20641
20714
  raw: item
20642
20715
  };
@@ -20674,6 +20747,13 @@ var InnerShadcnRadioVariant = (props, ref) => {
20674
20747
  mappers,
20675
20748
  optionValue,
20676
20749
  optionLabel,
20750
+ optionTags,
20751
+ optionTagLabel,
20752
+ optionTagIcon,
20753
+ optionTagClassName,
20754
+ optionTagColor,
20755
+ optionTagBgColor,
20756
+ optionTagOnClick,
20677
20757
  renderOption,
20678
20758
  layout = "list",
20679
20759
  columns = 2,
@@ -20702,9 +20782,30 @@ var InnerShadcnRadioVariant = (props, ref) => {
20702
20782
  mappers,
20703
20783
  //@ts-ignore
20704
20784
  optionValue,
20705
- optionLabel
20785
+ optionLabel,
20786
+ //@ts-ignore
20787
+ optionTags,
20788
+ optionTagLabel,
20789
+ optionTagIcon,
20790
+ optionTagClassName,
20791
+ optionTagColor,
20792
+ optionTagBgColor,
20793
+ optionTagOnClick
20706
20794
  ),
20707
- [items, options, mappers, optionValue, optionLabel]
20795
+ [
20796
+ items,
20797
+ options,
20798
+ mappers,
20799
+ optionValue,
20800
+ optionLabel,
20801
+ optionTags,
20802
+ optionTagLabel,
20803
+ optionTagIcon,
20804
+ optionTagClassName,
20805
+ optionTagColor,
20806
+ optionTagBgColor,
20807
+ optionTagOnClick
20808
+ ]
20708
20809
  );
20709
20810
  const selectedString = React66.useMemo(() => {
20710
20811
  if (value === void 0) return void 0;
@@ -20774,7 +20875,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
20774
20875
  "data-slot": "radio-group",
20775
20876
  ...restGroupProps,
20776
20877
  children: normalized.map((item, index) => {
20777
- var _a, _b;
20878
+ var _a, _b, _c;
20778
20879
  const itemString = String(item.value);
20779
20880
  const selected = selectedString === itemString;
20780
20881
  const optionDisabled = !!disabled || !!item.disabled;
@@ -20838,7 +20939,25 @@ var InnerShadcnRadioVariant = (props, ref) => {
20838
20939
  children: [
20839
20940
  radioNode,
20840
20941
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
20841
- /* @__PURE__ */ jsx("span", { className: labelClassesBase, children: displayItem.label }),
20942
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
20943
+ /* @__PURE__ */ jsx("span", { className: cn(labelClassesBase, "truncate"), children: displayItem.label }),
20944
+ !!((_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(
20945
+ Badge,
20946
+ {
20947
+ className: cn("text-xs", tag.className),
20948
+ onClick: tag.onClick,
20949
+ style: {
20950
+ color: tag.color,
20951
+ backgroundColor: tag.bgColor
20952
+ },
20953
+ children: [
20954
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
20955
+ /* @__PURE__ */ jsx("span", { children: tag.label })
20956
+ ]
20957
+ },
20958
+ tagIndex
20959
+ )) })
20960
+ ] }),
20842
20961
  displayItem.description != null && /* @__PURE__ */ jsx("span", { className: descriptionClassesBase, children: displayItem.description })
20843
20962
  ] })
20844
20963
  ]
@@ -20969,7 +21088,7 @@ function capitalizeFirst3(label) {
20969
21088
  if (!label) return label;
20970
21089
  return label.charAt(0).toUpperCase() + label.slice(1);
20971
21090
  }
20972
- function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
21091
+ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
20973
21092
  if (!items || !items.length) return [];
20974
21093
  if (mappers) {
20975
21094
  return items.map((item, index) => ({
@@ -20989,7 +21108,16 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
20989
21108
  item,
20990
21109
  index,
20991
21110
  optionLabelKey,
20992
- optionValueKey
21111
+ optionValueKey,
21112
+ {
21113
+ optionTags: optionTagsKey,
21114
+ optionTagLabel,
21115
+ optionTagIcon,
21116
+ optionTagClassName,
21117
+ optionTagColor,
21118
+ optionTagBgColor,
21119
+ optionTagOnClick
21120
+ }
20993
21121
  );
20994
21122
  const tristate = anyItem.tristate;
20995
21123
  return {
@@ -21059,6 +21187,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
21059
21187
  mappers,
21060
21188
  optionValue,
21061
21189
  optionLabel,
21190
+ optionTags,
21191
+ optionTagLabel,
21192
+ optionTagIcon,
21193
+ optionTagClassName,
21194
+ optionTagColor,
21195
+ optionTagBgColor,
21196
+ optionTagOnClick,
21062
21197
  renderOption,
21063
21198
  single,
21064
21199
  tristate: tristateDefault,
@@ -21091,9 +21226,29 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
21091
21226
  items != null ? items : options,
21092
21227
  mappers,
21093
21228
  optionValue,
21094
- optionLabel
21229
+ optionLabel,
21230
+ optionTags,
21231
+ optionTagLabel,
21232
+ optionTagIcon,
21233
+ optionTagClassName,
21234
+ optionTagColor,
21235
+ optionTagBgColor,
21236
+ optionTagOnClick
21095
21237
  ),
21096
- [items, options, mappers, optionValue, optionLabel]
21238
+ [
21239
+ items,
21240
+ options,
21241
+ mappers,
21242
+ optionValue,
21243
+ optionLabel,
21244
+ optionTags,
21245
+ optionTagLabel,
21246
+ optionTagIcon,
21247
+ optionTagClassName,
21248
+ optionTagColor,
21249
+ optionTagBgColor,
21250
+ optionTagOnClick
21251
+ ]
21097
21252
  );
21098
21253
  if (isSingle) {
21099
21254
  const singleVal = asSingleValue(value);
@@ -21307,7 +21462,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
21307
21462
  style: groupStyle,
21308
21463
  ...restProps,
21309
21464
  children: normalized.map((item, index) => {
21310
- var _a, _b, _c, _d;
21465
+ var _a, _b, _c, _d, _e;
21311
21466
  const effectiveTristate = (_b = (_a = item.tristate) != null ? _a : tristateDefault) != null ? _b : false;
21312
21467
  const currentState = getEntryState(item.value);
21313
21468
  const internalState = effectiveTristate ? currentState : currentState === "none" ? false : currentState;
@@ -21395,16 +21550,35 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
21395
21550
  children: [
21396
21551
  checkboxNode,
21397
21552
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
21398
- /* @__PURE__ */ jsx(
21399
- "span",
21400
- {
21401
- className: cn(
21402
- labelClassesBase,
21403
- optionLabelClassName
21404
- ),
21405
- children: displayItem.label
21406
- }
21407
- ),
21553
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
21554
+ /* @__PURE__ */ jsx(
21555
+ "span",
21556
+ {
21557
+ className: cn(
21558
+ labelClassesBase,
21559
+ optionLabelClassName,
21560
+ "truncate"
21561
+ ),
21562
+ children: displayItem.label
21563
+ }
21564
+ ),
21565
+ !!((_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(
21566
+ Badge,
21567
+ {
21568
+ className: cn("text-xs", tag.className),
21569
+ onClick: tag.onClick,
21570
+ style: {
21571
+ color: tag.color,
21572
+ backgroundColor: tag.bgColor
21573
+ },
21574
+ children: [
21575
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
21576
+ /* @__PURE__ */ jsx("span", { children: tag.label })
21577
+ ]
21578
+ },
21579
+ tagIndex
21580
+ )) })
21581
+ ] }),
21408
21582
  displayItem.description != null && /* @__PURE__ */ jsx("span", { className: descriptionClassesBase, children: displayItem.description })
21409
21583
  ] })
21410
21584
  ]
@@ -21484,6 +21658,13 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
21484
21658
  optionDisabled,
21485
21659
  optionIcon,
21486
21660
  optionKey,
21661
+ optionTags,
21662
+ optionTagLabel,
21663
+ optionTagIcon,
21664
+ optionTagClassName,
21665
+ optionTagColor,
21666
+ optionTagBgColor,
21667
+ optionTagOnClick,
21487
21668
  searchable,
21488
21669
  searchPlaceholder,
21489
21670
  emptyLabel,
@@ -21527,7 +21708,14 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
21527
21708
  optionDescription,
21528
21709
  optionDisabled,
21529
21710
  optionKey,
21530
- optionIcon
21711
+ optionIcon,
21712
+ optionTags,
21713
+ optionTagLabel,
21714
+ optionTagIcon,
21715
+ optionTagClassName,
21716
+ optionTagColor,
21717
+ optionTagBgColor,
21718
+ optionTagOnClick
21531
21719
  }),
21532
21720
  [
21533
21721
  options,
@@ -21537,7 +21725,14 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
21537
21725
  optionDescription,
21538
21726
  optionDisabled,
21539
21727
  optionKey,
21540
- optionIcon
21728
+ optionIcon,
21729
+ optionTags,
21730
+ optionTagLabel,
21731
+ optionTagIcon,
21732
+ optionTagClassName,
21733
+ optionTagColor,
21734
+ optionTagBgColor,
21735
+ optionTagOnClick
21541
21736
  ]
21542
21737
  );
21543
21738
  const normalizedValue = value === "" || value == null ? void 0 : value;
@@ -21777,7 +21972,7 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
21777
21972
  data: filteredItems,
21778
21973
  computeItemKey: (_index, item) => item.key,
21779
21974
  itemContent: (index, item) => {
21780
- var _a2;
21975
+ var _a2, _b2;
21781
21976
  const optionNode = /* @__PURE__ */ jsx(
21782
21977
  SelectItem,
21783
21978
  {
@@ -21785,15 +21980,38 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
21785
21980
  disabled: item.disabled,
21786
21981
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
21787
21982
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21788
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
21789
- /* @__PURE__ */ jsx("span", { children: item.labelNode }),
21983
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
21984
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
21985
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.labelNode }),
21986
+ !!((_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(
21987
+ (tag, tagIndex) => /* @__PURE__ */ jsxs(
21988
+ Badge,
21989
+ {
21990
+ className: cn(
21991
+ "text-xs",
21992
+ tag.className
21993
+ ),
21994
+ onClick: tag.onClick,
21995
+ style: {
21996
+ color: tag.color,
21997
+ backgroundColor: tag.bgColor
21998
+ },
21999
+ children: [
22000
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
22001
+ /* @__PURE__ */ jsx("span", { children: tag.label })
22002
+ ]
22003
+ },
22004
+ tagIndex
22005
+ )
22006
+ ) })
22007
+ ] }),
21790
22008
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21791
22009
  ] })
21792
22010
  ] })
21793
22011
  },
21794
22012
  item.key
21795
22013
  );
21796
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
22014
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21797
22015
  if (!renderer) return optionNode;
21798
22016
  return renderer({
21799
22017
  item,
@@ -21812,7 +22030,7 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
21812
22030
  }
21813
22031
  )
21814
22032
  ) : /* @__PURE__ */ jsx("div", { className: "max-h-60 overflow-auto", children: filteredItems.map((item, index) => {
21815
- var _a2;
22033
+ var _a2, _b2;
21816
22034
  const optionNode = /* @__PURE__ */ jsx(
21817
22035
  SelectItem,
21818
22036
  {
@@ -21820,15 +22038,38 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
21820
22038
  disabled: item.disabled,
21821
22039
  children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
21822
22040
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21823
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
21824
- /* @__PURE__ */ jsx("span", { children: item.labelNode }),
22041
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
22042
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
22043
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.labelNode }),
22044
+ !!((_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(
22045
+ (tag, tagIndex) => /* @__PURE__ */ jsxs(
22046
+ Badge,
22047
+ {
22048
+ className: cn(
22049
+ "text-xs",
22050
+ tag.className
22051
+ ),
22052
+ onClick: tag.onClick,
22053
+ style: {
22054
+ color: tag.color,
22055
+ backgroundColor: tag.bgColor
22056
+ },
22057
+ children: [
22058
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
22059
+ /* @__PURE__ */ jsx("span", { children: tag.label })
22060
+ ]
22061
+ },
22062
+ tagIndex
22063
+ )
22064
+ ) })
22065
+ ] }),
21825
22066
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21826
22067
  ] })
21827
22068
  ] })
21828
22069
  },
21829
22070
  item.key
21830
22071
  );
21831
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
22072
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21832
22073
  if (!renderer) return optionNode;
21833
22074
  return renderer({
21834
22075
  item,
@@ -21978,38 +22219,6 @@ var selectModule = {
21978
22219
  tags: ["select", "dropdown", "single-value"]
21979
22220
  }
21980
22221
  };
21981
- var badgeVariants = cva(
21982
- "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",
21983
- {
21984
- variants: {
21985
- variant: {
21986
- default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
21987
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
21988
- 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",
21989
- outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
21990
- }
21991
- },
21992
- defaultVariants: {
21993
- variant: "default"
21994
- }
21995
- }
21996
- );
21997
- function Badge({
21998
- className,
21999
- variant,
22000
- asChild = false,
22001
- ...props
22002
- }) {
22003
- const Comp = asChild ? Slot : "span";
22004
- return /* @__PURE__ */ jsx(
22005
- Comp,
22006
- {
22007
- "data-slot": "badge",
22008
- className: cn(badgeVariants({ variant }), className),
22009
- ...props
22010
- }
22011
- );
22012
- }
22013
22222
  function getTextWidth(text, font) {
22014
22223
  if (typeof window === "undefined") return 0;
22015
22224
  const canvas = window.__canvas || (window.__canvas = document.createElement("canvas"));
@@ -22199,6 +22408,13 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
22199
22408
  optionDisabled,
22200
22409
  optionIcon,
22201
22410
  optionKey,
22411
+ optionTags,
22412
+ optionTagLabel,
22413
+ optionTagIcon,
22414
+ optionTagClassName,
22415
+ optionTagColor,
22416
+ optionTagBgColor,
22417
+ optionTagOnClick,
22202
22418
  searchable,
22203
22419
  searchPlaceholder,
22204
22420
  emptySearchText,
@@ -22247,7 +22463,14 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
22247
22463
  optionDescription,
22248
22464
  optionDisabled,
22249
22465
  optionKey,
22250
- optionIcon
22466
+ optionIcon,
22467
+ optionTags,
22468
+ optionTagLabel,
22469
+ optionTagIcon,
22470
+ optionTagClassName,
22471
+ optionTagColor,
22472
+ optionTagBgColor,
22473
+ optionTagOnClick
22251
22474
  });
22252
22475
  return { items: items2, keyedItems: (0, import_lodash.keyBy)(items2, "value") };
22253
22476
  }, [
@@ -22258,7 +22481,14 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
22258
22481
  optionDescription,
22259
22482
  optionDisabled,
22260
22483
  optionKey,
22261
- optionIcon
22484
+ optionIcon,
22485
+ optionTags,
22486
+ optionTagLabel,
22487
+ optionTagIcon,
22488
+ optionTagClassName,
22489
+ optionTagColor,
22490
+ optionTagBgColor,
22491
+ optionTagOnClick
22262
22492
  ]);
22263
22493
  const selectedValues = React66.useMemo(
22264
22494
  () => new Set(value != null ? value : []),
@@ -22676,7 +22906,7 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
22676
22906
  EmptyPlaceholder: () => /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: emptySearchText != null ? emptySearchText : "No results found" })
22677
22907
  },
22678
22908
  itemContent: (index, item) => {
22679
- var _a2;
22909
+ var _a2, _b;
22680
22910
  const selected = selectedValues.has(item.value);
22681
22911
  const row = /* @__PURE__ */ jsxs(
22682
22912
  "button",
@@ -22700,8 +22930,31 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
22700
22930
  }),
22701
22931
  /* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-start gap-2", children: [
22702
22932
  item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
22703
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
22704
- /* @__PURE__ */ jsx("span", { children: item.labelNode }),
22933
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
22934
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
22935
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.labelNode }),
22936
+ !!((_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(
22937
+ (tag, tagIndex) => /* @__PURE__ */ jsxs(
22938
+ Badge,
22939
+ {
22940
+ className: cn(
22941
+ "text-xs",
22942
+ tag.className
22943
+ ),
22944
+ onClick: tag.onClick,
22945
+ style: {
22946
+ color: tag.color,
22947
+ backgroundColor: tag.bgColor
22948
+ },
22949
+ children: [
22950
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
22951
+ /* @__PURE__ */ jsx("span", { children: tag.label })
22952
+ ]
22953
+ },
22954
+ tagIndex
22955
+ )
22956
+ ) })
22957
+ ] }),
22705
22958
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
22706
22959
  ] })
22707
22960
  ] })
@@ -22709,7 +22962,7 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
22709
22962
  },
22710
22963
  item.key
22711
22964
  );
22712
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
22965
+ const renderer = (_b = item.render) != null ? _b : renderOption;
22713
22966
  if (!renderer) return row;
22714
22967
  return renderer({
22715
22968
  item,
@@ -24176,6 +24429,13 @@ var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVarian
24176
24429
  optionDisabled,
24177
24430
  optionIcon,
24178
24431
  optionKey,
24432
+ optionTags,
24433
+ optionTagLabel,
24434
+ optionTagIcon,
24435
+ optionTagClassName,
24436
+ optionTagColor,
24437
+ optionTagBgColor,
24438
+ optionTagOnClick,
24179
24439
  searchable = true,
24180
24440
  searchPlaceholder,
24181
24441
  emptyLabel,
@@ -24227,7 +24487,14 @@ var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVarian
24227
24487
  optionDescription,
24228
24488
  optionDisabled,
24229
24489
  optionIcon,
24230
- optionKey
24490
+ optionKey,
24491
+ optionTags,
24492
+ optionTagLabel,
24493
+ optionTagIcon,
24494
+ optionTagClassName,
24495
+ optionTagColor,
24496
+ optionTagBgColor,
24497
+ optionTagOnClick
24231
24498
  }),
24232
24499
  [
24233
24500
  options,
@@ -24237,7 +24504,14 @@ var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVarian
24237
24504
  optionDescription,
24238
24505
  optionDisabled,
24239
24506
  optionIcon,
24240
- optionKey
24507
+ optionKey,
24508
+ optionTags,
24509
+ optionTagLabel,
24510
+ optionTagIcon,
24511
+ optionTagClassName,
24512
+ optionTagColor,
24513
+ optionTagBgColor,
24514
+ optionTagOnClick
24241
24515
  ]
24242
24516
  );
24243
24517
  const allNodesFlat = React66.useMemo(() => flattenTree(tree), [tree]);
@@ -24533,7 +24807,7 @@ var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVarian
24533
24807
  data: displayedNodes,
24534
24808
  computeItemKey: (_index, item) => item.key,
24535
24809
  itemContent: (index, item) => {
24536
- var _a;
24810
+ var _a, _b;
24537
24811
  const selected = selectedValues.includes(item.value);
24538
24812
  const isExpanded = expanded.has(item.value);
24539
24813
  const parentInLeafOnly = leafOnly && item.hasChildren;
@@ -24592,14 +24866,35 @@ var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVarian
24592
24866
  ),
24593
24867
  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" }),
24594
24868
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
24595
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium leading-none", children: item.labelNode }),
24869
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
24870
+ /* @__PURE__ */ jsx("span", { className: "truncate font-medium leading-none", children: item.labelNode }),
24871
+ !!((_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(
24872
+ Badge,
24873
+ {
24874
+ className: cn(
24875
+ "text-xs",
24876
+ tag.className
24877
+ ),
24878
+ onClick: tag.onClick,
24879
+ style: {
24880
+ color: tag.color,
24881
+ backgroundColor: tag.bgColor
24882
+ },
24883
+ children: [
24884
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
24885
+ /* @__PURE__ */ jsx("span", { children: tag.label })
24886
+ ]
24887
+ },
24888
+ tagIndex
24889
+ )) })
24890
+ ] }),
24596
24891
  item.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground truncate mt-0.5", children: item.description })
24597
24892
  ] }),
24598
24893
  !multiple && selected && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-primary ml-auto" })
24599
24894
  ]
24600
24895
  }
24601
24896
  );
24602
- const renderer = (_a = item.render) != null ? _a : renderOption;
24897
+ const renderer = (_b = item.render) != null ? _b : renderOption;
24603
24898
  if (!renderer) {
24604
24899
  return /* @__PURE__ */ jsx(React66.Fragment, { children: optionNode }, item.key);
24605
24900
  }
@@ -25992,11 +26287,18 @@ function normalizeOption(input, {
25992
26287
  optionIcon,
25993
26288
  optionDisabled,
25994
26289
  optionTooltip,
25995
- optionMeta
26290
+ optionMeta,
26291
+ optionTags,
26292
+ optionTagLabel,
26293
+ optionTagIcon,
26294
+ optionTagClassName,
26295
+ optionTagColor,
26296
+ optionTagBgColor,
26297
+ optionTagOnClick
25996
26298
  }, autoCap) {
25997
26299
  var _a, _b, _c, _d, _e, _f;
25998
26300
  const anyInput = input;
25999
- if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
26301
+ if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta || optionTags || optionTagLabel || optionTagIcon || optionTagClassName || optionTagColor || optionTagBgColor || optionTagOnClick) {
26000
26302
  const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
26001
26303
  const value2 = String(rawValue);
26002
26304
  let label2;
@@ -26014,6 +26316,24 @@ function normalizeOption(input, {
26014
26316
  const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
26015
26317
  const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
26016
26318
  const meta = optionMeta != null ? anyInput[optionMeta] : (_d = anyInput.meta) != null ? _d : void 0;
26319
+ const rawTags = optionTags != null ? anyInput[optionTags] : anyInput.tags;
26320
+ const tags = Array.isArray(rawTags) ? rawTags.flatMap((tag) => {
26321
+ const label3 = optionTagLabel != null ? tag == null ? void 0 : tag[optionTagLabel] : tag == null ? void 0 : tag.label;
26322
+ if (label3 === void 0 || label3 === null || label3 === "") {
26323
+ return [];
26324
+ }
26325
+ return [
26326
+ {
26327
+ label: label3,
26328
+ icon: optionTagIcon != null ? tag == null ? void 0 : tag[optionTagIcon] : tag == null ? void 0 : tag.icon,
26329
+ className: optionTagClassName != null ? tag == null ? void 0 : tag[optionTagClassName] : tag == null ? void 0 : tag.className,
26330
+ color: optionTagColor != null ? tag == null ? void 0 : tag[optionTagColor] : tag == null ? void 0 : tag.color,
26331
+ bgColor: optionTagBgColor != null ? tag == null ? void 0 : tag[optionTagBgColor] : tag == null ? void 0 : tag.bgColor,
26332
+ onClick: optionTagOnClick != null ? tag == null ? void 0 : tag[optionTagOnClick] : tag == null ? void 0 : tag.onClick,
26333
+ raw: tag
26334
+ }
26335
+ ];
26336
+ }) : void 0;
26017
26337
  return {
26018
26338
  ui: {
26019
26339
  value: value2,
@@ -26021,7 +26341,8 @@ function normalizeOption(input, {
26021
26341
  icon,
26022
26342
  disabled,
26023
26343
  tooltip,
26024
- meta
26344
+ meta,
26345
+ tags
26025
26346
  },
26026
26347
  raw: input
26027
26348
  };
@@ -26053,7 +26374,8 @@ function normalizeOption(input, {
26053
26374
  icon: anyInput.icon,
26054
26375
  disabled: !!anyInput.disabled,
26055
26376
  tooltip: anyInput.tooltip,
26056
- meta: anyInput.meta
26377
+ meta: anyInput.meta,
26378
+ tags: Array.isArray(anyInput.tags) ? anyInput.tags : void 0
26057
26379
  },
26058
26380
  raw: input
26059
26381
  };
@@ -26078,6 +26400,13 @@ var ShadcnToggleVariant3 = React66.forwardRef(function ShadcnToggleVariant4(prop
26078
26400
  optionDisabled,
26079
26401
  optionTooltip,
26080
26402
  optionMeta,
26403
+ optionTags,
26404
+ optionTagLabel,
26405
+ optionTagIcon,
26406
+ optionTagClassName,
26407
+ optionTagColor,
26408
+ optionTagBgColor,
26409
+ optionTagOnClick,
26081
26410
  renderOption,
26082
26411
  className,
26083
26412
  itemClassName,
@@ -26098,7 +26427,14 @@ var ShadcnToggleVariant3 = React66.forwardRef(function ShadcnToggleVariant4(prop
26098
26427
  optionIcon,
26099
26428
  optionDisabled,
26100
26429
  optionTooltip,
26101
- optionMeta
26430
+ optionMeta,
26431
+ optionTags,
26432
+ optionTagLabel,
26433
+ optionTagIcon,
26434
+ optionTagClassName,
26435
+ optionTagColor,
26436
+ optionTagBgColor,
26437
+ optionTagOnClick
26102
26438
  },
26103
26439
  autoCap
26104
26440
  )
@@ -26111,6 +26447,13 @@ var ShadcnToggleVariant3 = React66.forwardRef(function ShadcnToggleVariant4(prop
26111
26447
  optionDisabled,
26112
26448
  optionTooltip,
26113
26449
  optionMeta,
26450
+ optionTags,
26451
+ optionTagLabel,
26452
+ optionTagIcon,
26453
+ optionTagClassName,
26454
+ optionTagColor,
26455
+ optionTagBgColor,
26456
+ optionTagOnClick,
26114
26457
  autoCap
26115
26458
  ]
26116
26459
  );
@@ -26176,11 +26519,28 @@ var ShadcnToggleVariant3 = React66.forwardRef(function ShadcnToggleVariant4(prop
26176
26519
  style: groupStyle,
26177
26520
  "aria-invalid": !!error,
26178
26521
  children: normalizedOptions.map(({ ui: opt }) => {
26522
+ var _a;
26179
26523
  const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
26180
- const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
26524
+ 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: [
26181
26525
  opt.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: opt.icon }),
26182
- /* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
26183
- ] });
26526
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label }),
26527
+ !!((_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(
26528
+ Badge,
26529
+ {
26530
+ className: cn("text-xs", tag.className),
26531
+ onClick: tag.onClick,
26532
+ style: {
26533
+ color: tag.color,
26534
+ backgroundColor: tag.bgColor
26535
+ },
26536
+ children: [
26537
+ tag.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: tag.icon }),
26538
+ /* @__PURE__ */ jsx("span", { children: tag.label })
26539
+ ]
26540
+ },
26541
+ tagIndex
26542
+ )) })
26543
+ ] }) });
26184
26544
  const itemNode = /* @__PURE__ */ jsx(
26185
26545
  ToggleGroupItem,
26186
26546
  {