@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/index.js CHANGED
@@ -20449,6 +20449,38 @@ function buildGroupLayoutClasses(opts) {
20449
20449
  descriptionClassesBase
20450
20450
  };
20451
20451
  }
20452
+ var badgeVariants = cva(
20453
+ "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",
20454
+ {
20455
+ variants: {
20456
+ variant: {
20457
+ default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
20458
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
20459
+ 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",
20460
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
20461
+ }
20462
+ },
20463
+ defaultVariants: {
20464
+ variant: "default"
20465
+ }
20466
+ }
20467
+ );
20468
+ function Badge({
20469
+ className,
20470
+ variant,
20471
+ asChild = false,
20472
+ ...props
20473
+ }) {
20474
+ const Comp = asChild ? reactSlot.Slot : "span";
20475
+ return /* @__PURE__ */ jsxRuntime.jsx(
20476
+ Comp,
20477
+ {
20478
+ "data-slot": "badge",
20479
+ className: cn(badgeVariants({ variant }), className),
20480
+ ...props
20481
+ }
20482
+ );
20483
+ }
20452
20484
  function RadioGroup({
20453
20485
  className,
20454
20486
  ...props
@@ -20509,6 +20541,34 @@ function resolveRender(obj) {
20509
20541
  }
20510
20542
  return void 0;
20511
20543
  }
20544
+ function resolveByAccessor(input, accessor, fallback) {
20545
+ if (typeof accessor === "function") return accessor(input);
20546
+ if (typeof accessor === "string") return input == null ? void 0 : input[accessor];
20547
+ return fallback;
20548
+ }
20549
+ function normalizeOptionTags(raw, obj, config) {
20550
+ var _a;
20551
+ const rawTags = (_a = resolveByAccessor(raw, config.optionTags)) != null ? _a : Array.isArray(obj == null ? void 0 : obj.tags) ? obj.tags : void 0;
20552
+ if (!Array.isArray(rawTags) || rawTags.length === 0) return void 0;
20553
+ const tags = rawTags.map((tag) => {
20554
+ var _a2, _b, _c, _d, _e, _f, _g;
20555
+ const tagObj = tag != null && typeof tag === "object" ? tag : void 0;
20556
+ 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;
20557
+ if (label === void 0 || label === null || label === "") {
20558
+ return null;
20559
+ }
20560
+ return {
20561
+ label,
20562
+ icon: (_c = resolveByAccessor(tag, config.optionTagIcon)) != null ? _c : tagObj == null ? void 0 : tagObj.icon,
20563
+ className: (_d = resolveByAccessor(tag, config.optionTagClassName)) != null ? _d : tagObj == null ? void 0 : tagObj.className,
20564
+ color: (_e = resolveByAccessor(tag, config.optionTagColor)) != null ? _e : tagObj == null ? void 0 : tagObj.color,
20565
+ bgColor: (_f = resolveByAccessor(tag, config.optionTagBgColor)) != null ? _f : tagObj == null ? void 0 : tagObj.bgColor,
20566
+ onClick: (_g = resolveByAccessor(tag, config.optionTagOnClick)) != null ? _g : tagObj == null ? void 0 : tagObj.onClick,
20567
+ raw: tag
20568
+ };
20569
+ }).filter(Boolean);
20570
+ return tags.length ? tags : void 0;
20571
+ }
20512
20572
  function resolveValue(raw, obj, index, optionValue) {
20513
20573
  var _a, _b, _c;
20514
20574
  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);
@@ -20546,6 +20606,7 @@ function normalizeOne(raw, index, config) {
20546
20606
  const disabled = resolveDisabled(raw, obj, config.optionDisabled);
20547
20607
  const icon = resolveIcon(raw, obj, config.optionIcon);
20548
20608
  const key = resolveKey(raw, obj, index, value, config.optionKey);
20609
+ const tags = normalizeOptionTags(raw, obj, config);
20549
20610
  const render = resolveRender(obj);
20550
20611
  return {
20551
20612
  key: String(key),
@@ -20555,6 +20616,7 @@ function normalizeOne(raw, index, config) {
20555
20616
  description,
20556
20617
  disabled,
20557
20618
  icon,
20619
+ tags,
20558
20620
  render,
20559
20621
  raw
20560
20622
  };
@@ -20565,7 +20627,7 @@ function globalNormalizeOptions(opts, config) {
20565
20627
  (raw, index) => normalizeOne(raw, index, config)
20566
20628
  );
20567
20629
  }
20568
- function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionValueKey) {
20630
+ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionValueKey, tagConfig) {
20569
20631
  var _a, _b;
20570
20632
  const anyItem = item;
20571
20633
  const rawValue = optionValueKey != null ? anyItem[optionValueKey] : anyItem.value;
@@ -20574,6 +20636,7 @@ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionVal
20574
20636
  const description = anyItem.description;
20575
20637
  const disabled = !!anyItem.disabled;
20576
20638
  const key = (_b = anyItem.key) != null ? _b : index;
20639
+ const tags = normalizeOptionTags(item, anyItem, tagConfig != null ? tagConfig : {});
20577
20640
  const render = resolveRender(anyItem);
20578
20641
  return {
20579
20642
  key: String(key),
@@ -20581,6 +20644,7 @@ function globalNormalizeCheckBasedOptions(item, index, optionLabelKey, optionVal
20581
20644
  label: rawLabel,
20582
20645
  description,
20583
20646
  disabled,
20647
+ tags,
20584
20648
  render,
20585
20649
  raw: item
20586
20650
  };
@@ -20656,7 +20720,7 @@ function capitalizeFirst2(label) {
20656
20720
  if (!label) return label;
20657
20721
  return label.charAt(0).toUpperCase() + label.slice(1);
20658
20722
  }
20659
- function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
20723
+ function normalizeItems(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
20660
20724
  if (mappers) {
20661
20725
  return items.map((item, index) => ({
20662
20726
  value: mappers.getValue(item, index),
@@ -20674,7 +20738,16 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
20674
20738
  item,
20675
20739
  index,
20676
20740
  optionLabelKey,
20677
- optionValueKey
20741
+ optionValueKey,
20742
+ {
20743
+ optionTags: optionTagsKey,
20744
+ optionTagLabel,
20745
+ optionTagIcon,
20746
+ optionTagClassName,
20747
+ optionTagColor,
20748
+ optionTagBgColor,
20749
+ optionTagOnClick
20750
+ }
20678
20751
  ),
20679
20752
  raw: item
20680
20753
  };
@@ -20712,6 +20785,13 @@ var InnerShadcnRadioVariant = (props, ref) => {
20712
20785
  mappers,
20713
20786
  optionValue,
20714
20787
  optionLabel,
20788
+ optionTags,
20789
+ optionTagLabel,
20790
+ optionTagIcon,
20791
+ optionTagClassName,
20792
+ optionTagColor,
20793
+ optionTagBgColor,
20794
+ optionTagOnClick,
20715
20795
  renderOption,
20716
20796
  layout = "list",
20717
20797
  columns = 2,
@@ -20740,9 +20820,30 @@ var InnerShadcnRadioVariant = (props, ref) => {
20740
20820
  mappers,
20741
20821
  //@ts-ignore
20742
20822
  optionValue,
20743
- optionLabel
20823
+ optionLabel,
20824
+ //@ts-ignore
20825
+ optionTags,
20826
+ optionTagLabel,
20827
+ optionTagIcon,
20828
+ optionTagClassName,
20829
+ optionTagColor,
20830
+ optionTagBgColor,
20831
+ optionTagOnClick
20744
20832
  ),
20745
- [items, options, mappers, optionValue, optionLabel]
20833
+ [
20834
+ items,
20835
+ options,
20836
+ mappers,
20837
+ optionValue,
20838
+ optionLabel,
20839
+ optionTags,
20840
+ optionTagLabel,
20841
+ optionTagIcon,
20842
+ optionTagClassName,
20843
+ optionTagColor,
20844
+ optionTagBgColor,
20845
+ optionTagOnClick
20846
+ ]
20746
20847
  );
20747
20848
  const selectedString = React66__namespace.useMemo(() => {
20748
20849
  if (value === void 0) return void 0;
@@ -20812,7 +20913,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
20812
20913
  "data-slot": "radio-group",
20813
20914
  ...restGroupProps,
20814
20915
  children: normalized.map((item, index) => {
20815
- var _a, _b;
20916
+ var _a, _b, _c;
20816
20917
  const itemString = String(item.value);
20817
20918
  const selected = selectedString === itemString;
20818
20919
  const optionDisabled = !!disabled || !!item.disabled;
@@ -20876,7 +20977,25 @@ var InnerShadcnRadioVariant = (props, ref) => {
20876
20977
  children: [
20877
20978
  radioNode,
20878
20979
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0", children: [
20879
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: labelClassesBase, children: displayItem.label }),
20980
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
20981
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(labelClassesBase, "truncate"), children: displayItem.label }),
20982
+ !!((_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(
20983
+ Badge,
20984
+ {
20985
+ className: cn("text-xs", tag.className),
20986
+ onClick: tag.onClick,
20987
+ style: {
20988
+ color: tag.color,
20989
+ backgroundColor: tag.bgColor
20990
+ },
20991
+ children: [
20992
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
20993
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
20994
+ ]
20995
+ },
20996
+ tagIndex
20997
+ )) })
20998
+ ] }),
20880
20999
  displayItem.description != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: descriptionClassesBase, children: displayItem.description })
20881
21000
  ] })
20882
21001
  ]
@@ -21007,7 +21126,7 @@ function capitalizeFirst3(label) {
21007
21126
  if (!label) return label;
21008
21127
  return label.charAt(0).toUpperCase() + label.slice(1);
21009
21128
  }
21010
- function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
21129
+ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey, optionTagsKey, optionTagLabel, optionTagIcon, optionTagClassName, optionTagColor, optionTagBgColor, optionTagOnClick) {
21011
21130
  if (!items || !items.length) return [];
21012
21131
  if (mappers) {
21013
21132
  return items.map((item, index) => ({
@@ -21027,7 +21146,16 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
21027
21146
  item,
21028
21147
  index,
21029
21148
  optionLabelKey,
21030
- optionValueKey
21149
+ optionValueKey,
21150
+ {
21151
+ optionTags: optionTagsKey,
21152
+ optionTagLabel,
21153
+ optionTagIcon,
21154
+ optionTagClassName,
21155
+ optionTagColor,
21156
+ optionTagBgColor,
21157
+ optionTagOnClick
21158
+ }
21031
21159
  );
21032
21160
  const tristate = anyItem.tristate;
21033
21161
  return {
@@ -21097,6 +21225,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
21097
21225
  mappers,
21098
21226
  optionValue,
21099
21227
  optionLabel,
21228
+ optionTags,
21229
+ optionTagLabel,
21230
+ optionTagIcon,
21231
+ optionTagClassName,
21232
+ optionTagColor,
21233
+ optionTagBgColor,
21234
+ optionTagOnClick,
21100
21235
  renderOption,
21101
21236
  single,
21102
21237
  tristate: tristateDefault,
@@ -21129,9 +21264,29 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
21129
21264
  items != null ? items : options,
21130
21265
  mappers,
21131
21266
  optionValue,
21132
- optionLabel
21267
+ optionLabel,
21268
+ optionTags,
21269
+ optionTagLabel,
21270
+ optionTagIcon,
21271
+ optionTagClassName,
21272
+ optionTagColor,
21273
+ optionTagBgColor,
21274
+ optionTagOnClick
21133
21275
  ),
21134
- [items, options, mappers, optionValue, optionLabel]
21276
+ [
21277
+ items,
21278
+ options,
21279
+ mappers,
21280
+ optionValue,
21281
+ optionLabel,
21282
+ optionTags,
21283
+ optionTagLabel,
21284
+ optionTagIcon,
21285
+ optionTagClassName,
21286
+ optionTagColor,
21287
+ optionTagBgColor,
21288
+ optionTagOnClick
21289
+ ]
21135
21290
  );
21136
21291
  if (isSingle) {
21137
21292
  const singleVal = asSingleValue(value);
@@ -21345,7 +21500,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
21345
21500
  style: groupStyle,
21346
21501
  ...restProps,
21347
21502
  children: normalized.map((item, index) => {
21348
- var _a, _b, _c, _d;
21503
+ var _a, _b, _c, _d, _e;
21349
21504
  const effectiveTristate = (_b = (_a = item.tristate) != null ? _a : tristateDefault) != null ? _b : false;
21350
21505
  const currentState = getEntryState(item.value);
21351
21506
  const internalState = effectiveTristate ? currentState : currentState === "none" ? false : currentState;
@@ -21433,16 +21588,35 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
21433
21588
  children: [
21434
21589
  checkboxNode,
21435
21590
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
21436
- /* @__PURE__ */ jsxRuntime.jsx(
21437
- "span",
21438
- {
21439
- className: cn(
21440
- labelClassesBase,
21441
- optionLabelClassName
21442
- ),
21443
- children: displayItem.label
21444
- }
21445
- ),
21591
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
21592
+ /* @__PURE__ */ jsxRuntime.jsx(
21593
+ "span",
21594
+ {
21595
+ className: cn(
21596
+ labelClassesBase,
21597
+ optionLabelClassName,
21598
+ "truncate"
21599
+ ),
21600
+ children: displayItem.label
21601
+ }
21602
+ ),
21603
+ !!((_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(
21604
+ Badge,
21605
+ {
21606
+ className: cn("text-xs", tag.className),
21607
+ onClick: tag.onClick,
21608
+ style: {
21609
+ color: tag.color,
21610
+ backgroundColor: tag.bgColor
21611
+ },
21612
+ children: [
21613
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
21614
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
21615
+ ]
21616
+ },
21617
+ tagIndex
21618
+ )) })
21619
+ ] }),
21446
21620
  displayItem.description != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: descriptionClassesBase, children: displayItem.description })
21447
21621
  ] })
21448
21622
  ]
@@ -21522,6 +21696,13 @@ var ShadcnSelectVariant = React66__namespace.forwardRef(function ShadcnSelectVar
21522
21696
  optionDisabled,
21523
21697
  optionIcon,
21524
21698
  optionKey,
21699
+ optionTags,
21700
+ optionTagLabel,
21701
+ optionTagIcon,
21702
+ optionTagClassName,
21703
+ optionTagColor,
21704
+ optionTagBgColor,
21705
+ optionTagOnClick,
21525
21706
  searchable,
21526
21707
  searchPlaceholder,
21527
21708
  emptyLabel,
@@ -21565,7 +21746,14 @@ var ShadcnSelectVariant = React66__namespace.forwardRef(function ShadcnSelectVar
21565
21746
  optionDescription,
21566
21747
  optionDisabled,
21567
21748
  optionKey,
21568
- optionIcon
21749
+ optionIcon,
21750
+ optionTags,
21751
+ optionTagLabel,
21752
+ optionTagIcon,
21753
+ optionTagClassName,
21754
+ optionTagColor,
21755
+ optionTagBgColor,
21756
+ optionTagOnClick
21569
21757
  }),
21570
21758
  [
21571
21759
  options,
@@ -21575,7 +21763,14 @@ var ShadcnSelectVariant = React66__namespace.forwardRef(function ShadcnSelectVar
21575
21763
  optionDescription,
21576
21764
  optionDisabled,
21577
21765
  optionKey,
21578
- optionIcon
21766
+ optionIcon,
21767
+ optionTags,
21768
+ optionTagLabel,
21769
+ optionTagIcon,
21770
+ optionTagClassName,
21771
+ optionTagColor,
21772
+ optionTagBgColor,
21773
+ optionTagOnClick
21579
21774
  ]
21580
21775
  );
21581
21776
  const normalizedValue = value === "" || value == null ? void 0 : value;
@@ -21815,7 +22010,7 @@ var ShadcnSelectVariant = React66__namespace.forwardRef(function ShadcnSelectVar
21815
22010
  data: filteredItems,
21816
22011
  computeItemKey: (_index, item) => item.key,
21817
22012
  itemContent: (index, item) => {
21818
- var _a2;
22013
+ var _a2, _b2;
21819
22014
  const optionNode = /* @__PURE__ */ jsxRuntime.jsx(
21820
22015
  SelectItem,
21821
22016
  {
@@ -21823,15 +22018,38 @@ var ShadcnSelectVariant = React66__namespace.forwardRef(function ShadcnSelectVar
21823
22018
  disabled: item.disabled,
21824
22019
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
21825
22020
  item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21826
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
21827
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.labelNode }),
22021
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
22022
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
22023
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.labelNode }),
22024
+ !!((_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(
22025
+ (tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
22026
+ Badge,
22027
+ {
22028
+ className: cn(
22029
+ "text-xs",
22030
+ tag.className
22031
+ ),
22032
+ onClick: tag.onClick,
22033
+ style: {
22034
+ color: tag.color,
22035
+ backgroundColor: tag.bgColor
22036
+ },
22037
+ children: [
22038
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
22039
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
22040
+ ]
22041
+ },
22042
+ tagIndex
22043
+ )
22044
+ ) })
22045
+ ] }),
21828
22046
  item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21829
22047
  ] })
21830
22048
  ] })
21831
22049
  },
21832
22050
  item.key
21833
22051
  );
21834
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
22052
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21835
22053
  if (!renderer) return optionNode;
21836
22054
  return renderer({
21837
22055
  item,
@@ -21850,7 +22068,7 @@ var ShadcnSelectVariant = React66__namespace.forwardRef(function ShadcnSelectVar
21850
22068
  }
21851
22069
  )
21852
22070
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-60 overflow-auto", children: filteredItems.map((item, index) => {
21853
- var _a2;
22071
+ var _a2, _b2;
21854
22072
  const optionNode = /* @__PURE__ */ jsxRuntime.jsx(
21855
22073
  SelectItem,
21856
22074
  {
@@ -21858,15 +22076,38 @@ var ShadcnSelectVariant = React66__namespace.forwardRef(function ShadcnSelectVar
21858
22076
  disabled: item.disabled,
21859
22077
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
21860
22078
  item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
21861
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
21862
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.labelNode }),
22079
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
22080
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
22081
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.labelNode }),
22082
+ !!((_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(
22083
+ (tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
22084
+ Badge,
22085
+ {
22086
+ className: cn(
22087
+ "text-xs",
22088
+ tag.className
22089
+ ),
22090
+ onClick: tag.onClick,
22091
+ style: {
22092
+ color: tag.color,
22093
+ backgroundColor: tag.bgColor
22094
+ },
22095
+ children: [
22096
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
22097
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
22098
+ ]
22099
+ },
22100
+ tagIndex
22101
+ )
22102
+ ) })
22103
+ ] }),
21863
22104
  item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
21864
22105
  ] })
21865
22106
  ] })
21866
22107
  },
21867
22108
  item.key
21868
22109
  );
21869
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
22110
+ const renderer = (_b2 = item.render) != null ? _b2 : renderOption;
21870
22111
  if (!renderer) return optionNode;
21871
22112
  return renderer({
21872
22113
  item,
@@ -22016,38 +22257,6 @@ var selectModule = {
22016
22257
  tags: ["select", "dropdown", "single-value"]
22017
22258
  }
22018
22259
  };
22019
- var badgeVariants = cva(
22020
- "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",
22021
- {
22022
- variants: {
22023
- variant: {
22024
- default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
22025
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
22026
- 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",
22027
- outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
22028
- }
22029
- },
22030
- defaultVariants: {
22031
- variant: "default"
22032
- }
22033
- }
22034
- );
22035
- function Badge({
22036
- className,
22037
- variant,
22038
- asChild = false,
22039
- ...props
22040
- }) {
22041
- const Comp = asChild ? reactSlot.Slot : "span";
22042
- return /* @__PURE__ */ jsxRuntime.jsx(
22043
- Comp,
22044
- {
22045
- "data-slot": "badge",
22046
- className: cn(badgeVariants({ variant }), className),
22047
- ...props
22048
- }
22049
- );
22050
- }
22051
22260
  function getTextWidth(text, font) {
22052
22261
  if (typeof window === "undefined") return 0;
22053
22262
  const canvas = window.__canvas || (window.__canvas = document.createElement("canvas"));
@@ -22237,6 +22446,13 @@ var ShadcnMultiSelectVariant = React66__namespace.forwardRef(function ShadcnMult
22237
22446
  optionDisabled,
22238
22447
  optionIcon,
22239
22448
  optionKey,
22449
+ optionTags,
22450
+ optionTagLabel,
22451
+ optionTagIcon,
22452
+ optionTagClassName,
22453
+ optionTagColor,
22454
+ optionTagBgColor,
22455
+ optionTagOnClick,
22240
22456
  searchable,
22241
22457
  searchPlaceholder,
22242
22458
  emptySearchText,
@@ -22285,7 +22501,14 @@ var ShadcnMultiSelectVariant = React66__namespace.forwardRef(function ShadcnMult
22285
22501
  optionDescription,
22286
22502
  optionDisabled,
22287
22503
  optionKey,
22288
- optionIcon
22504
+ optionIcon,
22505
+ optionTags,
22506
+ optionTagLabel,
22507
+ optionTagIcon,
22508
+ optionTagClassName,
22509
+ optionTagColor,
22510
+ optionTagBgColor,
22511
+ optionTagOnClick
22289
22512
  });
22290
22513
  return { items: items2, keyedItems: (0, import_lodash.keyBy)(items2, "value") };
22291
22514
  }, [
@@ -22296,7 +22519,14 @@ var ShadcnMultiSelectVariant = React66__namespace.forwardRef(function ShadcnMult
22296
22519
  optionDescription,
22297
22520
  optionDisabled,
22298
22521
  optionKey,
22299
- optionIcon
22522
+ optionIcon,
22523
+ optionTags,
22524
+ optionTagLabel,
22525
+ optionTagIcon,
22526
+ optionTagClassName,
22527
+ optionTagColor,
22528
+ optionTagBgColor,
22529
+ optionTagOnClick
22300
22530
  ]);
22301
22531
  const selectedValues = React66__namespace.useMemo(
22302
22532
  () => new Set(value != null ? value : []),
@@ -22714,7 +22944,7 @@ var ShadcnMultiSelectVariant = React66__namespace.forwardRef(function ShadcnMult
22714
22944
  EmptyPlaceholder: () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: emptySearchText != null ? emptySearchText : "No results found" })
22715
22945
  },
22716
22946
  itemContent: (index, item) => {
22717
- var _a2;
22947
+ var _a2, _b;
22718
22948
  const selected = selectedValues.has(item.value);
22719
22949
  const row = /* @__PURE__ */ jsxRuntime.jsxs(
22720
22950
  "button",
@@ -22738,8 +22968,31 @@ var ShadcnMultiSelectVariant = React66__namespace.forwardRef(function ShadcnMult
22738
22968
  }),
22739
22969
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 items-start gap-2", children: [
22740
22970
  item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 shrink-0", children: item.icon }),
22741
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
22742
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.labelNode }),
22971
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
22972
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
22973
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.labelNode }),
22974
+ !!((_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(
22975
+ (tag, tagIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
22976
+ Badge,
22977
+ {
22978
+ className: cn(
22979
+ "text-xs",
22980
+ tag.className
22981
+ ),
22982
+ onClick: tag.onClick,
22983
+ style: {
22984
+ color: tag.color,
22985
+ backgroundColor: tag.bgColor
22986
+ },
22987
+ children: [
22988
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
22989
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
22990
+ ]
22991
+ },
22992
+ tagIndex
22993
+ )
22994
+ ) })
22995
+ ] }),
22743
22996
  item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.description })
22744
22997
  ] })
22745
22998
  ] })
@@ -22747,7 +23000,7 @@ var ShadcnMultiSelectVariant = React66__namespace.forwardRef(function ShadcnMult
22747
23000
  },
22748
23001
  item.key
22749
23002
  );
22750
- const renderer = (_a2 = item.render) != null ? _a2 : renderOption;
23003
+ const renderer = (_b = item.render) != null ? _b : renderOption;
22751
23004
  if (!renderer) return row;
22752
23005
  return renderer({
22753
23006
  item,
@@ -24214,6 +24467,13 @@ var ShadcnTreeSelectVariant = React66__namespace.forwardRef(function ShadcnTreeS
24214
24467
  optionDisabled,
24215
24468
  optionIcon,
24216
24469
  optionKey,
24470
+ optionTags,
24471
+ optionTagLabel,
24472
+ optionTagIcon,
24473
+ optionTagClassName,
24474
+ optionTagColor,
24475
+ optionTagBgColor,
24476
+ optionTagOnClick,
24217
24477
  searchable = true,
24218
24478
  searchPlaceholder,
24219
24479
  emptyLabel,
@@ -24265,7 +24525,14 @@ var ShadcnTreeSelectVariant = React66__namespace.forwardRef(function ShadcnTreeS
24265
24525
  optionDescription,
24266
24526
  optionDisabled,
24267
24527
  optionIcon,
24268
- optionKey
24528
+ optionKey,
24529
+ optionTags,
24530
+ optionTagLabel,
24531
+ optionTagIcon,
24532
+ optionTagClassName,
24533
+ optionTagColor,
24534
+ optionTagBgColor,
24535
+ optionTagOnClick
24269
24536
  }),
24270
24537
  [
24271
24538
  options,
@@ -24275,7 +24542,14 @@ var ShadcnTreeSelectVariant = React66__namespace.forwardRef(function ShadcnTreeS
24275
24542
  optionDescription,
24276
24543
  optionDisabled,
24277
24544
  optionIcon,
24278
- optionKey
24545
+ optionKey,
24546
+ optionTags,
24547
+ optionTagLabel,
24548
+ optionTagIcon,
24549
+ optionTagClassName,
24550
+ optionTagColor,
24551
+ optionTagBgColor,
24552
+ optionTagOnClick
24279
24553
  ]
24280
24554
  );
24281
24555
  const allNodesFlat = React66__namespace.useMemo(() => flattenTree(tree), [tree]);
@@ -24571,7 +24845,7 @@ var ShadcnTreeSelectVariant = React66__namespace.forwardRef(function ShadcnTreeS
24571
24845
  data: displayedNodes,
24572
24846
  computeItemKey: (_index, item) => item.key,
24573
24847
  itemContent: (index, item) => {
24574
- var _a;
24848
+ var _a, _b;
24575
24849
  const selected = selectedValues.includes(item.value);
24576
24850
  const isExpanded = expanded.has(item.value);
24577
24851
  const parentInLeafOnly = leafOnly && item.hasChildren;
@@ -24630,14 +24904,35 @@ var ShadcnTreeSelectVariant = React66__namespace.forwardRef(function ShadcnTreeS
24630
24904
  ),
24631
24905
  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" }),
24632
24906
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
24633
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium leading-none", children: item.labelNode }),
24907
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-start gap-2", children: [
24908
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate font-medium leading-none", children: item.labelNode }),
24909
+ !!((_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(
24910
+ Badge,
24911
+ {
24912
+ className: cn(
24913
+ "text-xs",
24914
+ tag.className
24915
+ ),
24916
+ onClick: tag.onClick,
24917
+ style: {
24918
+ color: tag.color,
24919
+ backgroundColor: tag.bgColor
24920
+ },
24921
+ children: [
24922
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
24923
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
24924
+ ]
24925
+ },
24926
+ tagIndex
24927
+ )) })
24928
+ ] }),
24634
24929
  item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground truncate mt-0.5", children: item.description })
24635
24930
  ] }),
24636
24931
  !multiple && selected && /* @__PURE__ */ jsxRuntime.jsx(Check, { className: "h-4 w-4 text-primary ml-auto" })
24637
24932
  ]
24638
24933
  }
24639
24934
  );
24640
- const renderer = (_a = item.render) != null ? _a : renderOption;
24935
+ const renderer = (_b = item.render) != null ? _b : renderOption;
24641
24936
  if (!renderer) {
24642
24937
  return /* @__PURE__ */ jsxRuntime.jsx(React66__namespace.Fragment, { children: optionNode }, item.key);
24643
24938
  }
@@ -26030,11 +26325,18 @@ function normalizeOption(input, {
26030
26325
  optionIcon,
26031
26326
  optionDisabled,
26032
26327
  optionTooltip,
26033
- optionMeta
26328
+ optionMeta,
26329
+ optionTags,
26330
+ optionTagLabel,
26331
+ optionTagIcon,
26332
+ optionTagClassName,
26333
+ optionTagColor,
26334
+ optionTagBgColor,
26335
+ optionTagOnClick
26034
26336
  }, autoCap) {
26035
26337
  var _a, _b, _c, _d, _e, _f;
26036
26338
  const anyInput = input;
26037
- if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
26339
+ if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta || optionTags || optionTagLabel || optionTagIcon || optionTagClassName || optionTagColor || optionTagBgColor || optionTagOnClick) {
26038
26340
  const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
26039
26341
  const value2 = String(rawValue);
26040
26342
  let label2;
@@ -26052,6 +26354,24 @@ function normalizeOption(input, {
26052
26354
  const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
26053
26355
  const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
26054
26356
  const meta = optionMeta != null ? anyInput[optionMeta] : (_d = anyInput.meta) != null ? _d : void 0;
26357
+ const rawTags = optionTags != null ? anyInput[optionTags] : anyInput.tags;
26358
+ const tags = Array.isArray(rawTags) ? rawTags.flatMap((tag) => {
26359
+ const label3 = optionTagLabel != null ? tag == null ? void 0 : tag[optionTagLabel] : tag == null ? void 0 : tag.label;
26360
+ if (label3 === void 0 || label3 === null || label3 === "") {
26361
+ return [];
26362
+ }
26363
+ return [
26364
+ {
26365
+ label: label3,
26366
+ icon: optionTagIcon != null ? tag == null ? void 0 : tag[optionTagIcon] : tag == null ? void 0 : tag.icon,
26367
+ className: optionTagClassName != null ? tag == null ? void 0 : tag[optionTagClassName] : tag == null ? void 0 : tag.className,
26368
+ color: optionTagColor != null ? tag == null ? void 0 : tag[optionTagColor] : tag == null ? void 0 : tag.color,
26369
+ bgColor: optionTagBgColor != null ? tag == null ? void 0 : tag[optionTagBgColor] : tag == null ? void 0 : tag.bgColor,
26370
+ onClick: optionTagOnClick != null ? tag == null ? void 0 : tag[optionTagOnClick] : tag == null ? void 0 : tag.onClick,
26371
+ raw: tag
26372
+ }
26373
+ ];
26374
+ }) : void 0;
26055
26375
  return {
26056
26376
  ui: {
26057
26377
  value: value2,
@@ -26059,7 +26379,8 @@ function normalizeOption(input, {
26059
26379
  icon,
26060
26380
  disabled,
26061
26381
  tooltip,
26062
- meta
26382
+ meta,
26383
+ tags
26063
26384
  },
26064
26385
  raw: input
26065
26386
  };
@@ -26091,7 +26412,8 @@ function normalizeOption(input, {
26091
26412
  icon: anyInput.icon,
26092
26413
  disabled: !!anyInput.disabled,
26093
26414
  tooltip: anyInput.tooltip,
26094
- meta: anyInput.meta
26415
+ meta: anyInput.meta,
26416
+ tags: Array.isArray(anyInput.tags) ? anyInput.tags : void 0
26095
26417
  },
26096
26418
  raw: input
26097
26419
  };
@@ -26116,6 +26438,13 @@ var ShadcnToggleVariant3 = React66__namespace.forwardRef(function ShadcnToggleVa
26116
26438
  optionDisabled,
26117
26439
  optionTooltip,
26118
26440
  optionMeta,
26441
+ optionTags,
26442
+ optionTagLabel,
26443
+ optionTagIcon,
26444
+ optionTagClassName,
26445
+ optionTagColor,
26446
+ optionTagBgColor,
26447
+ optionTagOnClick,
26119
26448
  renderOption,
26120
26449
  className,
26121
26450
  itemClassName,
@@ -26136,7 +26465,14 @@ var ShadcnToggleVariant3 = React66__namespace.forwardRef(function ShadcnToggleVa
26136
26465
  optionIcon,
26137
26466
  optionDisabled,
26138
26467
  optionTooltip,
26139
- optionMeta
26468
+ optionMeta,
26469
+ optionTags,
26470
+ optionTagLabel,
26471
+ optionTagIcon,
26472
+ optionTagClassName,
26473
+ optionTagColor,
26474
+ optionTagBgColor,
26475
+ optionTagOnClick
26140
26476
  },
26141
26477
  autoCap
26142
26478
  )
@@ -26149,6 +26485,13 @@ var ShadcnToggleVariant3 = React66__namespace.forwardRef(function ShadcnToggleVa
26149
26485
  optionDisabled,
26150
26486
  optionTooltip,
26151
26487
  optionMeta,
26488
+ optionTags,
26489
+ optionTagLabel,
26490
+ optionTagIcon,
26491
+ optionTagClassName,
26492
+ optionTagColor,
26493
+ optionTagBgColor,
26494
+ optionTagOnClick,
26152
26495
  autoCap
26153
26496
  ]
26154
26497
  );
@@ -26214,11 +26557,28 @@ var ShadcnToggleVariant3 = React66__namespace.forwardRef(function ShadcnToggleVa
26214
26557
  style: groupStyle,
26215
26558
  "aria-invalid": !!error,
26216
26559
  children: normalizedOptions.map(({ ui: opt }) => {
26560
+ var _a;
26217
26561
  const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
26218
- const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
26562
+ 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: [
26219
26563
  opt.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: opt.icon }),
26220
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: opt.label })
26221
- ] });
26564
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: opt.label }),
26565
+ !!((_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(
26566
+ Badge,
26567
+ {
26568
+ className: cn("text-xs", tag.className),
26569
+ onClick: tag.onClick,
26570
+ style: {
26571
+ color: tag.color,
26572
+ backgroundColor: tag.bgColor
26573
+ },
26574
+ children: [
26575
+ tag.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: tag.icon }),
26576
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag.label })
26577
+ ]
26578
+ },
26579
+ tagIndex
26580
+ )) })
26581
+ ] }) });
26222
26582
  const itemNode = /* @__PURE__ */ jsxRuntime.jsx(
26223
26583
  ToggleGroupItem,
26224
26584
  {