@timeax/form-palette 0.0.16 → 0.0.18

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
@@ -1158,11 +1158,11 @@ var init_parseHeaders = __esm({
1158
1158
  function normalizeHeader(header) {
1159
1159
  return header && String(header).trim().toLowerCase();
1160
1160
  }
1161
- function normalizeValue(value) {
1161
+ function normalizeValue2(value) {
1162
1162
  if (value === false || value == null) {
1163
1163
  return value;
1164
1164
  }
1165
- return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
1165
+ return utils_default.isArray(value) ? value.map(normalizeValue2) : String(value);
1166
1166
  }
1167
1167
  function parseTokens(str) {
1168
1168
  const tokens = /* @__PURE__ */ Object.create(null);
@@ -1224,7 +1224,7 @@ var init_AxiosHeaders = __esm({
1224
1224
  }
1225
1225
  const key = utils_default.findKey(self2, lHeader);
1226
1226
  if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1227
- self2[key || _header] = normalizeValue(_value);
1227
+ self2[key || _header] = normalizeValue2(_value);
1228
1228
  }
1229
1229
  }
1230
1230
  const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
@@ -1315,7 +1315,7 @@ var init_AxiosHeaders = __esm({
1315
1315
  utils_default.forEach(this, (value, header) => {
1316
1316
  const key = utils_default.findKey(headers, header);
1317
1317
  if (key) {
1318
- self2[key] = normalizeValue(value);
1318
+ self2[key] = normalizeValue2(value);
1319
1319
  delete self2[header];
1320
1320
  return;
1321
1321
  }
@@ -1323,7 +1323,7 @@ var init_AxiosHeaders = __esm({
1323
1323
  if (normalized !== header) {
1324
1324
  delete self2[header];
1325
1325
  }
1326
- self2[normalized] = normalizeValue(value);
1326
+ self2[normalized] = normalizeValue2(value);
1327
1327
  headers[normalized] = true;
1328
1328
  });
1329
1329
  return this;
@@ -20582,19 +20582,19 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
20582
20582
  }
20583
20583
  function createContext2(rootComponentName, defaultContext) {
20584
20584
  const Context = React54.createContext(defaultContext);
20585
- const Provider = (props) => {
20585
+ const Provider2 = (props) => {
20586
20586
  const { children, ...context } = props;
20587
20587
  const value = React54.useMemo(() => context, Object.values(context));
20588
20588
  return /* @__PURE__ */ jsx(Context.Provider, { value, children });
20589
20589
  };
20590
- Provider.displayName = rootComponentName + "Provider";
20590
+ Provider2.displayName = rootComponentName + "Provider";
20591
20591
  function useContext22(consumerName) {
20592
20592
  const context = React54.useContext(Context);
20593
20593
  if (context) return context;
20594
20594
  if (defaultContext !== void 0) return defaultContext;
20595
20595
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
20596
20596
  }
20597
- return [Provider, useContext22];
20597
+ return [Provider2, useContext22];
20598
20598
  }
20599
20599
  function createContextScope(scopeName, createContextScopeDeps = []) {
20600
20600
  let defaultContexts = [];
@@ -20602,14 +20602,14 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
20602
20602
  const BaseContext = React54.createContext(defaultContext);
20603
20603
  const index2 = defaultContexts.length;
20604
20604
  defaultContexts = [...defaultContexts, defaultContext];
20605
- const Provider = (props) => {
20605
+ const Provider2 = (props) => {
20606
20606
  var _a;
20607
20607
  const { scope, children, ...context } = props;
20608
20608
  const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
20609
20609
  const value = React54.useMemo(() => context, Object.values(context));
20610
20610
  return /* @__PURE__ */ jsx(Context.Provider, { value, children });
20611
20611
  };
20612
- Provider.displayName = rootComponentName + "Provider";
20612
+ Provider2.displayName = rootComponentName + "Provider";
20613
20613
  function useContext22(consumerName, scope) {
20614
20614
  var _a;
20615
20615
  const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
@@ -20618,7 +20618,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
20618
20618
  if (defaultContext !== void 0) return defaultContext;
20619
20619
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
20620
20620
  }
20621
- return [Provider, useContext22];
20621
+ return [Provider2, useContext22];
20622
20622
  }
20623
20623
  const createScope = () => {
20624
20624
  const scopeContexts = defaultContexts.map((defaultContext) => {
@@ -20773,10 +20773,10 @@ function getElementRef(element) {
20773
20773
  return element.props.ref || element.ref;
20774
20774
  }
20775
20775
  function createCollection(name) {
20776
- const PROVIDER_NAME = name + "CollectionProvider";
20777
- const [createCollectionContext, createCollectionScope4] = createContextScope(PROVIDER_NAME);
20776
+ const PROVIDER_NAME2 = name + "CollectionProvider";
20777
+ const [createCollectionContext, createCollectionScope4] = createContextScope(PROVIDER_NAME2);
20778
20778
  const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
20779
- PROVIDER_NAME,
20779
+ PROVIDER_NAME2,
20780
20780
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
20781
20781
  );
20782
20782
  const CollectionProvider = (props) => {
@@ -20785,7 +20785,7 @@ function createCollection(name) {
20785
20785
  const itemMap = React54__default.useRef(/* @__PURE__ */ new Map()).current;
20786
20786
  return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
20787
20787
  };
20788
- CollectionProvider.displayName = PROVIDER_NAME;
20788
+ CollectionProvider.displayName = PROVIDER_NAME2;
20789
20789
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
20790
20790
  const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
20791
20791
  const CollectionSlot = React54__default.forwardRef(
@@ -24431,6 +24431,7 @@ var VisuallyHidden = React54.forwardRef(
24431
24431
  }
24432
24432
  );
24433
24433
  VisuallyHidden.displayName = NAME2;
24434
+ var Root3 = VisuallyHidden;
24434
24435
 
24435
24436
  // ../../node_modules/aria-hidden/dist/es2015/index.js
24436
24437
  var getDefaultParent = function(originalTarget) {
@@ -30465,7 +30466,7 @@ __export(custom_components_exports, {
30465
30466
  NextMonthButton: () => NextMonthButton,
30466
30467
  Option: () => Option,
30467
30468
  PreviousMonthButton: () => PreviousMonthButton,
30468
- Root: () => Root3,
30469
+ Root: () => Root4,
30469
30470
  Select: () => Select3,
30470
30471
  Week: () => Week,
30471
30472
  WeekNumber: () => WeekNumber,
@@ -30655,7 +30656,7 @@ function PreviousMonthButton(props) {
30655
30656
  const { components } = useDayPicker();
30656
30657
  return React54__default.createElement(components.Button, { ...props });
30657
30658
  }
30658
- function Root3(props) {
30659
+ function Root4(props) {
30659
30660
  const { rootRef, ...rest } = props;
30660
30661
  return React54__default.createElement("div", { ...rest, ref: rootRef });
30661
30662
  }
@@ -34508,7 +34509,7 @@ SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME2;
34508
34509
  function getState2(checked) {
34509
34510
  return checked ? "checked" : "unchecked";
34510
34511
  }
34511
- var Root4 = Switch;
34512
+ var Root5 = Switch;
34512
34513
  var Thumb = SwitchThumb;
34513
34514
  function Switch2({
34514
34515
  className,
@@ -34516,7 +34517,7 @@ function Switch2({
34516
34517
  ...props
34517
34518
  }) {
34518
34519
  return /* @__PURE__ */ jsx(
34519
- Root4,
34520
+ Root5,
34520
34521
  {
34521
34522
  "data-slot": "switch",
34522
34523
  className: cn(
@@ -35119,7 +35120,7 @@ function focusFirst2(candidates, preventScroll = false) {
35119
35120
  function wrapArray2(array, startIndex) {
35120
35121
  return array.map((_, index2) => array[(startIndex + index2) % array.length]);
35121
35122
  }
35122
- var Root5 = RovingFocusGroup;
35123
+ var Root6 = RovingFocusGroup;
35123
35124
  var Item2 = RovingFocusGroupItem;
35124
35125
  var RADIO_NAME = "Radio";
35125
35126
  var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
@@ -35293,7 +35294,7 @@ var RadioGroup = React54.forwardRef(
35293
35294
  value,
35294
35295
  onValueChange: setValue,
35295
35296
  children: /* @__PURE__ */ jsx(
35296
- Root5,
35297
+ Root6,
35297
35298
  {
35298
35299
  asChild: true,
35299
35300
  ...rovingFocusGroupScope,
@@ -35548,6 +35549,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
35548
35549
  () => normalizeItems(
35549
35550
  items,
35550
35551
  mappers,
35552
+ //@ts-ignore
35551
35553
  optionValue,
35552
35554
  optionLabel
35553
35555
  ),
@@ -35680,6 +35682,10 @@ var InnerShadcnRadioVariant = (props, ref) => {
35680
35682
  size: size4,
35681
35683
  density,
35682
35684
  optionId,
35685
+ click() {
35686
+ if (optionDisabled) return;
35687
+ handleSelect(displayItem.value);
35688
+ },
35683
35689
  radio: radioNode
35684
35690
  })
35685
35691
  },
@@ -36571,6 +36577,11 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
36571
36577
  size: size4,
36572
36578
  density,
36573
36579
  checkboxId,
36580
+ click() {
36581
+ if (optionDisabled) return;
36582
+ const nextInternal = effectiveTristate ? internalState === "none" ? true : internalState === true ? false : "none" : internalState === true ? false : true;
36583
+ updateGroupValue(item.value, nextInternal, effectiveTristate);
36584
+ },
36574
36585
  checkbox: checkboxNode
36575
36586
  }),
36576
36587
  hiddenInput
@@ -36992,7 +37003,13 @@ var ShadcnSelectVariant = React54.forwardRef(function ShadcnSelectVariant2(props
36992
37003
  item,
36993
37004
  selected: selectedItem != null && String(selectedItem.value) === String(item.value),
36994
37005
  index: index2,
36995
- option: optionNode
37006
+ option: optionNode,
37007
+ click() {
37008
+ if (disabled || readOnly || item.disabled) return;
37009
+ handleChange(String(item.value));
37010
+ setOpen(false);
37011
+ setQuery("");
37012
+ }
36996
37013
  });
36997
37014
  }),
36998
37015
  virtualScroll && renderedItems.length < filteredItems.length && /* @__PURE__ */ jsx("div", { className: "px-2 py-1 text-[10px] text-muted-foreground text-center", children: "Scroll to load more\u2026" })
@@ -37734,7 +37751,11 @@ var ShadcnMultiSelectVariant = React54.forwardRef(function ShadcnMultiSelectVari
37734
37751
  item,
37735
37752
  selected,
37736
37753
  index: index2,
37737
- option: row
37754
+ option: row,
37755
+ click() {
37756
+ if (item.disabled) return;
37757
+ handleToggleValue(item.value);
37758
+ }
37738
37759
  });
37739
37760
  }),
37740
37761
  showSelectAll && selectAllPosition === "bottom" && /* @__PURE__ */ jsxs(
@@ -38548,7 +38569,7 @@ function roundValue(value, decimalCount) {
38548
38569
  const rounder = Math.pow(10, decimalCount);
38549
38570
  return Math.round(value * rounder) / rounder;
38550
38571
  }
38551
- var Root6 = Slider;
38572
+ var Root7 = Slider;
38552
38573
  var Track = SliderTrack;
38553
38574
  var Range = SliderRange;
38554
38575
  var Thumb2 = SliderThumb;
@@ -38565,7 +38586,7 @@ function Slider2({
38565
38586
  [value, defaultValue, min3, max3]
38566
38587
  );
38567
38588
  return /* @__PURE__ */ jsxs(
38568
- Root6,
38589
+ Root7,
38569
38590
  {
38570
38591
  "data-slot": "slider",
38571
38592
  defaultValue,
@@ -39405,7 +39426,7 @@ var DescriptionWarning = ({ contentRef, descriptionId }) => {
39405
39426
  }, [MESSAGE, contentRef, descriptionId]);
39406
39427
  return null;
39407
39428
  };
39408
- var Root7 = Dialog;
39429
+ var Root8 = Dialog;
39409
39430
  var Portal4 = DialogPortal;
39410
39431
  var Overlay = DialogOverlay;
39411
39432
  var Content3 = DialogContent;
@@ -39415,7 +39436,7 @@ var Close = DialogClose;
39415
39436
  function Dialog2({
39416
39437
  ...props
39417
39438
  }) {
39418
- return /* @__PURE__ */ jsx(Root7, { "data-slot": "dialog", ...props });
39439
+ return /* @__PURE__ */ jsx(Root8, { "data-slot": "dialog", ...props });
39419
39440
  }
39420
39441
  function DialogPortal2({
39421
39442
  ...props
@@ -40377,7 +40398,7 @@ var ShadcnTreeSelectVariant = React54.forwardRef(function ShadcnTreeSelectVarian
40377
40398
  displayedNodes.map((item, index2) => {
40378
40399
  const selected = selectedValues.includes(item.value);
40379
40400
  const isExpanded = expanded.has(item.value);
40380
- return /* @__PURE__ */ jsxs(
40401
+ const optionNode = /* @__PURE__ */ jsxs(
40381
40402
  "div",
40382
40403
  {
40383
40404
  className: cn(
@@ -40435,6 +40456,16 @@ var ShadcnTreeSelectVariant = React54.forwardRef(function ShadcnTreeSelectVarian
40435
40456
  },
40436
40457
  item.key
40437
40458
  );
40459
+ if (!renderOption) return optionNode;
40460
+ return renderOption({
40461
+ item,
40462
+ selected,
40463
+ index: index2,
40464
+ option: optionNode,
40465
+ click() {
40466
+ if (!item.disabled) handleToggleValue(item);
40467
+ }
40468
+ });
40438
40469
  })
40439
40470
  ] });
40440
40471
  const SelectBody = /* @__PURE__ */ jsxs(
@@ -41320,7 +41351,7 @@ function useResizeObserver(element, onResize) {
41320
41351
  }
41321
41352
  }, [element, handleResize]);
41322
41353
  }
41323
- var Root8 = ScrollArea;
41354
+ var Root9 = ScrollArea;
41324
41355
  var Viewport2 = ScrollAreaViewport;
41325
41356
  var Corner = ScrollAreaCorner;
41326
41357
  function ScrollArea2({
@@ -41329,7 +41360,7 @@ function ScrollArea2({
41329
41360
  ...props
41330
41361
  }) {
41331
41362
  return /* @__PURE__ */ jsxs(
41332
- Root8,
41363
+ Root9,
41333
41364
  {
41334
41365
  "data-slot": "scroll-area",
41335
41366
  className: cn("relative", className),
@@ -41954,6 +41985,1410 @@ var fileManagerModule = {
41954
41985
  Variant: file_default,
41955
41986
  variant: "file"
41956
41987
  };
41988
+ // @__NO_SIDE_EFFECTS__
41989
+ function createSlot18(ownerName) {
41990
+ const SlotClone = /* @__PURE__ */ createSlotClone18(ownerName);
41991
+ const Slot22 = React54.forwardRef((props, forwardedRef) => {
41992
+ const { children, ...slotProps } = props;
41993
+ const childrenArray = React54.Children.toArray(children);
41994
+ const slottable = childrenArray.find(isSlottable18);
41995
+ if (slottable) {
41996
+ const newElement = slottable.props.children;
41997
+ const newChildren = childrenArray.map((child) => {
41998
+ if (child === slottable) {
41999
+ if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
42000
+ return React54.isValidElement(newElement) ? newElement.props.children : null;
42001
+ } else {
42002
+ return child;
42003
+ }
42004
+ });
42005
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
42006
+ }
42007
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
42008
+ });
42009
+ Slot22.displayName = `${ownerName}.Slot`;
42010
+ return Slot22;
42011
+ }
42012
+ // @__NO_SIDE_EFFECTS__
42013
+ function createSlotClone18(ownerName) {
42014
+ const SlotClone = React54.forwardRef((props, forwardedRef) => {
42015
+ const { children, ...slotProps } = props;
42016
+ if (React54.isValidElement(children)) {
42017
+ const childrenRef = getElementRef19(children);
42018
+ const props2 = mergeProps18(slotProps, children.props);
42019
+ if (children.type !== React54.Fragment) {
42020
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
42021
+ }
42022
+ return React54.cloneElement(children, props2);
42023
+ }
42024
+ return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
42025
+ });
42026
+ SlotClone.displayName = `${ownerName}.SlotClone`;
42027
+ return SlotClone;
42028
+ }
42029
+ var SLOTTABLE_IDENTIFIER18 = /* @__PURE__ */ Symbol("radix.slottable");
42030
+ function isSlottable18(child) {
42031
+ return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER18;
42032
+ }
42033
+ function mergeProps18(slotProps, childProps) {
42034
+ const overrideProps = { ...childProps };
42035
+ for (const propName in childProps) {
42036
+ const slotPropValue = slotProps[propName];
42037
+ const childPropValue = childProps[propName];
42038
+ const isHandler = /^on[A-Z]/.test(propName);
42039
+ if (isHandler) {
42040
+ if (slotPropValue && childPropValue) {
42041
+ overrideProps[propName] = (...args) => {
42042
+ const result = childPropValue(...args);
42043
+ slotPropValue(...args);
42044
+ return result;
42045
+ };
42046
+ } else if (slotPropValue) {
42047
+ overrideProps[propName] = slotPropValue;
42048
+ }
42049
+ } else if (propName === "style") {
42050
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42051
+ } else if (propName === "className") {
42052
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42053
+ }
42054
+ }
42055
+ return { ...slotProps, ...overrideProps };
42056
+ }
42057
+ function getElementRef19(element) {
42058
+ var _a, _b;
42059
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42060
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42061
+ if (mayWarn) {
42062
+ return element.ref;
42063
+ }
42064
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42065
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42066
+ if (mayWarn) {
42067
+ return element.props.ref;
42068
+ }
42069
+ return element.props.ref || element.ref;
42070
+ }
42071
+ var NODES16 = [
42072
+ "a",
42073
+ "button",
42074
+ "div",
42075
+ "form",
42076
+ "h2",
42077
+ "h3",
42078
+ "img",
42079
+ "input",
42080
+ "label",
42081
+ "li",
42082
+ "nav",
42083
+ "ol",
42084
+ "p",
42085
+ "select",
42086
+ "span",
42087
+ "svg",
42088
+ "ul"
42089
+ ];
42090
+ var Primitive16 = NODES16.reduce((primitive, node) => {
42091
+ const Slot5 = createSlot18(`Primitive.${node}`);
42092
+ const Node2 = React54.forwardRef((props, forwardedRef) => {
42093
+ const { asChild, ...primitiveProps } = props;
42094
+ const Comp = asChild ? Slot5 : node;
42095
+ if (typeof window !== "undefined") {
42096
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42097
+ }
42098
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42099
+ });
42100
+ Node2.displayName = `Primitive.${node}`;
42101
+ return { ...primitive, [node]: Node2 };
42102
+ }, {});
42103
+ // @__NO_SIDE_EFFECTS__
42104
+ function createSlot19(ownerName) {
42105
+ const SlotClone = /* @__PURE__ */ createSlotClone19(ownerName);
42106
+ const Slot22 = React54.forwardRef((props, forwardedRef) => {
42107
+ const { children, ...slotProps } = props;
42108
+ const childrenArray = React54.Children.toArray(children);
42109
+ const slottable = childrenArray.find(isSlottable19);
42110
+ if (slottable) {
42111
+ const newElement = slottable.props.children;
42112
+ const newChildren = childrenArray.map((child) => {
42113
+ if (child === slottable) {
42114
+ if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
42115
+ return React54.isValidElement(newElement) ? newElement.props.children : null;
42116
+ } else {
42117
+ return child;
42118
+ }
42119
+ });
42120
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
42121
+ }
42122
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
42123
+ });
42124
+ Slot22.displayName = `${ownerName}.Slot`;
42125
+ return Slot22;
42126
+ }
42127
+ // @__NO_SIDE_EFFECTS__
42128
+ function createSlotClone19(ownerName) {
42129
+ const SlotClone = React54.forwardRef((props, forwardedRef) => {
42130
+ const { children, ...slotProps } = props;
42131
+ if (React54.isValidElement(children)) {
42132
+ const childrenRef = getElementRef20(children);
42133
+ const props2 = mergeProps19(slotProps, children.props);
42134
+ if (children.type !== React54.Fragment) {
42135
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
42136
+ }
42137
+ return React54.cloneElement(children, props2);
42138
+ }
42139
+ return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
42140
+ });
42141
+ SlotClone.displayName = `${ownerName}.SlotClone`;
42142
+ return SlotClone;
42143
+ }
42144
+ var SLOTTABLE_IDENTIFIER19 = /* @__PURE__ */ Symbol("radix.slottable");
42145
+ function isSlottable19(child) {
42146
+ return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER19;
42147
+ }
42148
+ function mergeProps19(slotProps, childProps) {
42149
+ const overrideProps = { ...childProps };
42150
+ for (const propName in childProps) {
42151
+ const slotPropValue = slotProps[propName];
42152
+ const childPropValue = childProps[propName];
42153
+ const isHandler = /^on[A-Z]/.test(propName);
42154
+ if (isHandler) {
42155
+ if (slotPropValue && childPropValue) {
42156
+ overrideProps[propName] = (...args) => {
42157
+ const result = childPropValue(...args);
42158
+ slotPropValue(...args);
42159
+ return result;
42160
+ };
42161
+ } else if (slotPropValue) {
42162
+ overrideProps[propName] = slotPropValue;
42163
+ }
42164
+ } else if (propName === "style") {
42165
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42166
+ } else if (propName === "className") {
42167
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42168
+ }
42169
+ }
42170
+ return { ...slotProps, ...overrideProps };
42171
+ }
42172
+ function getElementRef20(element) {
42173
+ var _a, _b;
42174
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42175
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42176
+ if (mayWarn) {
42177
+ return element.ref;
42178
+ }
42179
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42180
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42181
+ if (mayWarn) {
42182
+ return element.props.ref;
42183
+ }
42184
+ return element.props.ref || element.ref;
42185
+ }
42186
+ var NODES17 = [
42187
+ "a",
42188
+ "button",
42189
+ "div",
42190
+ "form",
42191
+ "h2",
42192
+ "h3",
42193
+ "img",
42194
+ "input",
42195
+ "label",
42196
+ "li",
42197
+ "nav",
42198
+ "ol",
42199
+ "p",
42200
+ "select",
42201
+ "span",
42202
+ "svg",
42203
+ "ul"
42204
+ ];
42205
+ var Primitive17 = NODES17.reduce((primitive, node) => {
42206
+ const Slot5 = createSlot19(`Primitive.${node}`);
42207
+ const Node2 = React54.forwardRef((props, forwardedRef) => {
42208
+ const { asChild, ...primitiveProps } = props;
42209
+ const Comp = asChild ? Slot5 : node;
42210
+ if (typeof window !== "undefined") {
42211
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42212
+ }
42213
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42214
+ });
42215
+ Node2.displayName = `Primitive.${node}`;
42216
+ return { ...primitive, [node]: Node2 };
42217
+ }, {});
42218
+ var NAME3 = "Toggle";
42219
+ var Toggle = React54.forwardRef((props, forwardedRef) => {
42220
+ const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
42221
+ const [pressed, setPressed] = useControllableState({
42222
+ prop: pressedProp,
42223
+ onChange: onPressedChange,
42224
+ defaultProp: defaultPressed != null ? defaultPressed : false,
42225
+ caller: NAME3
42226
+ });
42227
+ return /* @__PURE__ */ jsx(
42228
+ Primitive17.button,
42229
+ {
42230
+ type: "button",
42231
+ "aria-pressed": pressed,
42232
+ "data-state": pressed ? "on" : "off",
42233
+ "data-disabled": props.disabled ? "" : void 0,
42234
+ ...buttonProps,
42235
+ ref: forwardedRef,
42236
+ onClick: composeEventHandlers(props.onClick, () => {
42237
+ if (!props.disabled) {
42238
+ setPressed(!pressed);
42239
+ }
42240
+ })
42241
+ }
42242
+ );
42243
+ });
42244
+ Toggle.displayName = NAME3;
42245
+ var TOGGLE_GROUP_NAME = "ToggleGroup";
42246
+ var [createToggleGroupContext] = createContextScope(TOGGLE_GROUP_NAME, [
42247
+ createRovingFocusGroupScope
42248
+ ]);
42249
+ var useRovingFocusGroupScope2 = createRovingFocusGroupScope();
42250
+ var ToggleGroup = React54__default.forwardRef((props, forwardedRef) => {
42251
+ const { type, ...toggleGroupProps } = props;
42252
+ if (type === "single") {
42253
+ const singleProps = toggleGroupProps;
42254
+ return /* @__PURE__ */ jsx(ToggleGroupImplSingle, { ...singleProps, ref: forwardedRef });
42255
+ }
42256
+ if (type === "multiple") {
42257
+ const multipleProps = toggleGroupProps;
42258
+ return /* @__PURE__ */ jsx(ToggleGroupImplMultiple, { ...multipleProps, ref: forwardedRef });
42259
+ }
42260
+ throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
42261
+ });
42262
+ ToggleGroup.displayName = TOGGLE_GROUP_NAME;
42263
+ var [ToggleGroupValueProvider, useToggleGroupValueContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
42264
+ var ToggleGroupImplSingle = React54__default.forwardRef((props, forwardedRef) => {
42265
+ const {
42266
+ value: valueProp,
42267
+ defaultValue,
42268
+ onValueChange = () => {
42269
+ },
42270
+ ...toggleGroupSingleProps
42271
+ } = props;
42272
+ const [value, setValue] = useControllableState({
42273
+ prop: valueProp,
42274
+ defaultProp: defaultValue != null ? defaultValue : "",
42275
+ onChange: onValueChange,
42276
+ caller: TOGGLE_GROUP_NAME
42277
+ });
42278
+ return /* @__PURE__ */ jsx(
42279
+ ToggleGroupValueProvider,
42280
+ {
42281
+ scope: props.__scopeToggleGroup,
42282
+ type: "single",
42283
+ value: React54__default.useMemo(() => value ? [value] : [], [value]),
42284
+ onItemActivate: setValue,
42285
+ onItemDeactivate: React54__default.useCallback(() => setValue(""), [setValue]),
42286
+ children: /* @__PURE__ */ jsx(ToggleGroupImpl, { ...toggleGroupSingleProps, ref: forwardedRef })
42287
+ }
42288
+ );
42289
+ });
42290
+ var ToggleGroupImplMultiple = React54__default.forwardRef((props, forwardedRef) => {
42291
+ const {
42292
+ value: valueProp,
42293
+ defaultValue,
42294
+ onValueChange = () => {
42295
+ },
42296
+ ...toggleGroupMultipleProps
42297
+ } = props;
42298
+ const [value, setValue] = useControllableState({
42299
+ prop: valueProp,
42300
+ defaultProp: defaultValue != null ? defaultValue : [],
42301
+ onChange: onValueChange,
42302
+ caller: TOGGLE_GROUP_NAME
42303
+ });
42304
+ const handleButtonActivate = React54__default.useCallback(
42305
+ (itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
42306
+ [setValue]
42307
+ );
42308
+ const handleButtonDeactivate = React54__default.useCallback(
42309
+ (itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
42310
+ [setValue]
42311
+ );
42312
+ return /* @__PURE__ */ jsx(
42313
+ ToggleGroupValueProvider,
42314
+ {
42315
+ scope: props.__scopeToggleGroup,
42316
+ type: "multiple",
42317
+ value,
42318
+ onItemActivate: handleButtonActivate,
42319
+ onItemDeactivate: handleButtonDeactivate,
42320
+ children: /* @__PURE__ */ jsx(ToggleGroupImpl, { ...toggleGroupMultipleProps, ref: forwardedRef })
42321
+ }
42322
+ );
42323
+ });
42324
+ ToggleGroup.displayName = TOGGLE_GROUP_NAME;
42325
+ var [ToggleGroupContext, useToggleGroupContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
42326
+ var ToggleGroupImpl = React54__default.forwardRef(
42327
+ (props, forwardedRef) => {
42328
+ const {
42329
+ __scopeToggleGroup,
42330
+ disabled = false,
42331
+ rovingFocus = true,
42332
+ orientation,
42333
+ dir,
42334
+ loop = true,
42335
+ ...toggleGroupProps
42336
+ } = props;
42337
+ const rovingFocusGroupScope = useRovingFocusGroupScope2(__scopeToggleGroup);
42338
+ const direction = useDirection(dir);
42339
+ const commonProps = { role: "group", dir: direction, ...toggleGroupProps };
42340
+ return /* @__PURE__ */ jsx(ToggleGroupContext, { scope: __scopeToggleGroup, rovingFocus, disabled, children: rovingFocus ? /* @__PURE__ */ jsx(
42341
+ Root6,
42342
+ {
42343
+ asChild: true,
42344
+ ...rovingFocusGroupScope,
42345
+ orientation,
42346
+ dir: direction,
42347
+ loop,
42348
+ children: /* @__PURE__ */ jsx(Primitive16.div, { ...commonProps, ref: forwardedRef })
42349
+ }
42350
+ ) : /* @__PURE__ */ jsx(Primitive16.div, { ...commonProps, ref: forwardedRef }) });
42351
+ }
42352
+ );
42353
+ var ITEM_NAME4 = "ToggleGroupItem";
42354
+ var ToggleGroupItem = React54__default.forwardRef(
42355
+ (props, forwardedRef) => {
42356
+ const valueContext = useToggleGroupValueContext(ITEM_NAME4, props.__scopeToggleGroup);
42357
+ const context = useToggleGroupContext(ITEM_NAME4, props.__scopeToggleGroup);
42358
+ const rovingFocusGroupScope = useRovingFocusGroupScope2(props.__scopeToggleGroup);
42359
+ const pressed = valueContext.value.includes(props.value);
42360
+ const disabled = context.disabled || props.disabled;
42361
+ const commonProps = { ...props, pressed, disabled };
42362
+ const ref = React54__default.useRef(null);
42363
+ return context.rovingFocus ? /* @__PURE__ */ jsx(
42364
+ Item2,
42365
+ {
42366
+ asChild: true,
42367
+ ...rovingFocusGroupScope,
42368
+ focusable: !disabled,
42369
+ active: pressed,
42370
+ ref,
42371
+ children: /* @__PURE__ */ jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef })
42372
+ }
42373
+ ) : /* @__PURE__ */ jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef });
42374
+ }
42375
+ );
42376
+ ToggleGroupItem.displayName = ITEM_NAME4;
42377
+ var ToggleGroupItemImpl = React54__default.forwardRef(
42378
+ (props, forwardedRef) => {
42379
+ const { __scopeToggleGroup, value, ...itemProps } = props;
42380
+ const valueContext = useToggleGroupValueContext(ITEM_NAME4, __scopeToggleGroup);
42381
+ const singleProps = { role: "radio", "aria-checked": props.pressed, "aria-pressed": void 0 };
42382
+ const typeProps = valueContext.type === "single" ? singleProps : void 0;
42383
+ return /* @__PURE__ */ jsx(
42384
+ Toggle,
42385
+ {
42386
+ ...typeProps,
42387
+ ...itemProps,
42388
+ ref: forwardedRef,
42389
+ onPressedChange: (pressed) => {
42390
+ if (pressed) {
42391
+ valueContext.onItemActivate(value);
42392
+ } else {
42393
+ valueContext.onItemDeactivate(value);
42394
+ }
42395
+ }
42396
+ }
42397
+ );
42398
+ }
42399
+ );
42400
+ var Root25 = ToggleGroup;
42401
+ var Item23 = ToggleGroupItem;
42402
+ var toggleVariants = cva(
42403
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
42404
+ {
42405
+ variants: {
42406
+ variant: {
42407
+ default: "bg-transparent",
42408
+ outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
42409
+ },
42410
+ size: {
42411
+ default: "h-9 px-2 min-w-9",
42412
+ sm: "h-8 px-1.5 min-w-8",
42413
+ lg: "h-10 px-2.5 min-w-10"
42414
+ }
42415
+ },
42416
+ defaultVariants: {
42417
+ variant: "default",
42418
+ size: "default"
42419
+ }
42420
+ }
42421
+ );
42422
+ var ToggleGroupContext2 = React54.createContext({
42423
+ size: "default",
42424
+ variant: "default",
42425
+ spacing: 0
42426
+ });
42427
+ function ToggleGroup2({
42428
+ className,
42429
+ variant,
42430
+ size: size4,
42431
+ spacing = 0,
42432
+ children,
42433
+ ...props
42434
+ }) {
42435
+ return /* @__PURE__ */ jsx(
42436
+ Root25,
42437
+ {
42438
+ "data-slot": "toggle-group",
42439
+ "data-variant": variant,
42440
+ "data-size": size4,
42441
+ "data-spacing": spacing,
42442
+ style: { "--gap": spacing },
42443
+ className: cn(
42444
+ "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",
42445
+ className
42446
+ ),
42447
+ ...props,
42448
+ children: /* @__PURE__ */ jsx(ToggleGroupContext2.Provider, { value: { variant, size: size4, spacing }, children })
42449
+ }
42450
+ );
42451
+ }
42452
+ function ToggleGroupItem2({
42453
+ className,
42454
+ children,
42455
+ variant,
42456
+ size: size4,
42457
+ ...props
42458
+ }) {
42459
+ const context = React54.useContext(ToggleGroupContext2);
42460
+ return /* @__PURE__ */ jsx(
42461
+ Item23,
42462
+ {
42463
+ "data-slot": "toggle-group-item",
42464
+ "data-variant": context.variant || variant,
42465
+ "data-size": context.size || size4,
42466
+ "data-spacing": context.spacing,
42467
+ className: cn(
42468
+ toggleVariants({
42469
+ variant: context.variant || variant,
42470
+ size: context.size || size4
42471
+ }),
42472
+ "w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10",
42473
+ "data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",
42474
+ className
42475
+ ),
42476
+ ...props,
42477
+ children
42478
+ }
42479
+ );
42480
+ }
42481
+ // @__NO_SIDE_EFFECTS__
42482
+ function createSlot20(ownerName) {
42483
+ const SlotClone = /* @__PURE__ */ createSlotClone20(ownerName);
42484
+ const Slot22 = React54.forwardRef((props, forwardedRef) => {
42485
+ const { children, ...slotProps } = props;
42486
+ const childrenArray = React54.Children.toArray(children);
42487
+ const slottable = childrenArray.find(isSlottable20);
42488
+ if (slottable) {
42489
+ const newElement = slottable.props.children;
42490
+ const newChildren = childrenArray.map((child) => {
42491
+ if (child === slottable) {
42492
+ if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
42493
+ return React54.isValidElement(newElement) ? newElement.props.children : null;
42494
+ } else {
42495
+ return child;
42496
+ }
42497
+ });
42498
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
42499
+ }
42500
+ return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
42501
+ });
42502
+ Slot22.displayName = `${ownerName}.Slot`;
42503
+ return Slot22;
42504
+ }
42505
+ // @__NO_SIDE_EFFECTS__
42506
+ function createSlotClone20(ownerName) {
42507
+ const SlotClone = React54.forwardRef((props, forwardedRef) => {
42508
+ const { children, ...slotProps } = props;
42509
+ if (React54.isValidElement(children)) {
42510
+ const childrenRef = getElementRef21(children);
42511
+ const props2 = mergeProps20(slotProps, children.props);
42512
+ if (children.type !== React54.Fragment) {
42513
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
42514
+ }
42515
+ return React54.cloneElement(children, props2);
42516
+ }
42517
+ return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
42518
+ });
42519
+ SlotClone.displayName = `${ownerName}.SlotClone`;
42520
+ return SlotClone;
42521
+ }
42522
+ var SLOTTABLE_IDENTIFIER20 = /* @__PURE__ */ Symbol("radix.slottable");
42523
+ // @__NO_SIDE_EFFECTS__
42524
+ function createSlottable(ownerName) {
42525
+ const Slottable2 = ({ children }) => {
42526
+ return /* @__PURE__ */ jsx(Fragment, { children });
42527
+ };
42528
+ Slottable2.displayName = `${ownerName}.Slottable`;
42529
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER20;
42530
+ return Slottable2;
42531
+ }
42532
+ function isSlottable20(child) {
42533
+ return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER20;
42534
+ }
42535
+ function mergeProps20(slotProps, childProps) {
42536
+ const overrideProps = { ...childProps };
42537
+ for (const propName in childProps) {
42538
+ const slotPropValue = slotProps[propName];
42539
+ const childPropValue = childProps[propName];
42540
+ const isHandler = /^on[A-Z]/.test(propName);
42541
+ if (isHandler) {
42542
+ if (slotPropValue && childPropValue) {
42543
+ overrideProps[propName] = (...args) => {
42544
+ const result = childPropValue(...args);
42545
+ slotPropValue(...args);
42546
+ return result;
42547
+ };
42548
+ } else if (slotPropValue) {
42549
+ overrideProps[propName] = slotPropValue;
42550
+ }
42551
+ } else if (propName === "style") {
42552
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42553
+ } else if (propName === "className") {
42554
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42555
+ }
42556
+ }
42557
+ return { ...slotProps, ...overrideProps };
42558
+ }
42559
+ function getElementRef21(element) {
42560
+ var _a, _b;
42561
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42562
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42563
+ if (mayWarn) {
42564
+ return element.ref;
42565
+ }
42566
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42567
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42568
+ if (mayWarn) {
42569
+ return element.props.ref;
42570
+ }
42571
+ return element.props.ref || element.ref;
42572
+ }
42573
+ var NODES18 = [
42574
+ "a",
42575
+ "button",
42576
+ "div",
42577
+ "form",
42578
+ "h2",
42579
+ "h3",
42580
+ "img",
42581
+ "input",
42582
+ "label",
42583
+ "li",
42584
+ "nav",
42585
+ "ol",
42586
+ "p",
42587
+ "select",
42588
+ "span",
42589
+ "svg",
42590
+ "ul"
42591
+ ];
42592
+ var Primitive18 = NODES18.reduce((primitive, node) => {
42593
+ const Slot5 = createSlot20(`Primitive.${node}`);
42594
+ const Node2 = React54.forwardRef((props, forwardedRef) => {
42595
+ const { asChild, ...primitiveProps } = props;
42596
+ const Comp = asChild ? Slot5 : node;
42597
+ if (typeof window !== "undefined") {
42598
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42599
+ }
42600
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42601
+ });
42602
+ Node2.displayName = `Primitive.${node}`;
42603
+ return { ...primitive, [node]: Node2 };
42604
+ }, {});
42605
+ var [createTooltipContext] = createContextScope("Tooltip", [
42606
+ createPopperScope
42607
+ ]);
42608
+ var usePopperScope3 = createPopperScope();
42609
+ var PROVIDER_NAME = "TooltipProvider";
42610
+ var DEFAULT_DELAY_DURATION = 700;
42611
+ var TOOLTIP_OPEN = "tooltip.open";
42612
+ var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
42613
+ var TooltipProvider = (props) => {
42614
+ const {
42615
+ __scopeTooltip,
42616
+ delayDuration = DEFAULT_DELAY_DURATION,
42617
+ skipDelayDuration = 300,
42618
+ disableHoverableContent = false,
42619
+ children
42620
+ } = props;
42621
+ const isOpenDelayedRef = React54.useRef(true);
42622
+ const isPointerInTransitRef = React54.useRef(false);
42623
+ const skipDelayTimerRef = React54.useRef(0);
42624
+ React54.useEffect(() => {
42625
+ const skipDelayTimer = skipDelayTimerRef.current;
42626
+ return () => window.clearTimeout(skipDelayTimer);
42627
+ }, []);
42628
+ return /* @__PURE__ */ jsx(
42629
+ TooltipProviderContextProvider,
42630
+ {
42631
+ scope: __scopeTooltip,
42632
+ isOpenDelayedRef,
42633
+ delayDuration,
42634
+ onOpen: React54.useCallback(() => {
42635
+ window.clearTimeout(skipDelayTimerRef.current);
42636
+ isOpenDelayedRef.current = false;
42637
+ }, []),
42638
+ onClose: React54.useCallback(() => {
42639
+ window.clearTimeout(skipDelayTimerRef.current);
42640
+ skipDelayTimerRef.current = window.setTimeout(
42641
+ () => isOpenDelayedRef.current = true,
42642
+ skipDelayDuration
42643
+ );
42644
+ }, [skipDelayDuration]),
42645
+ isPointerInTransitRef,
42646
+ onPointerInTransitChange: React54.useCallback((inTransit) => {
42647
+ isPointerInTransitRef.current = inTransit;
42648
+ }, []),
42649
+ disableHoverableContent,
42650
+ children
42651
+ }
42652
+ );
42653
+ };
42654
+ TooltipProvider.displayName = PROVIDER_NAME;
42655
+ var TOOLTIP_NAME = "Tooltip";
42656
+ var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
42657
+ var Tooltip = (props) => {
42658
+ const {
42659
+ __scopeTooltip,
42660
+ children,
42661
+ open: openProp,
42662
+ defaultOpen,
42663
+ onOpenChange,
42664
+ disableHoverableContent: disableHoverableContentProp,
42665
+ delayDuration: delayDurationProp
42666
+ } = props;
42667
+ const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
42668
+ const popperScope = usePopperScope3(__scopeTooltip);
42669
+ const [trigger, setTrigger] = React54.useState(null);
42670
+ const contentId = useId3();
42671
+ const openTimerRef = React54.useRef(0);
42672
+ const disableHoverableContent = disableHoverableContentProp != null ? disableHoverableContentProp : providerContext.disableHoverableContent;
42673
+ const delayDuration = delayDurationProp != null ? delayDurationProp : providerContext.delayDuration;
42674
+ const wasOpenDelayedRef = React54.useRef(false);
42675
+ const [open, setOpen] = useControllableState({
42676
+ prop: openProp,
42677
+ defaultProp: defaultOpen != null ? defaultOpen : false,
42678
+ onChange: (open2) => {
42679
+ if (open2) {
42680
+ providerContext.onOpen();
42681
+ document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
42682
+ } else {
42683
+ providerContext.onClose();
42684
+ }
42685
+ onOpenChange == null ? void 0 : onOpenChange(open2);
42686
+ },
42687
+ caller: TOOLTIP_NAME
42688
+ });
42689
+ const stateAttribute = React54.useMemo(() => {
42690
+ return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
42691
+ }, [open]);
42692
+ const handleOpen = React54.useCallback(() => {
42693
+ window.clearTimeout(openTimerRef.current);
42694
+ openTimerRef.current = 0;
42695
+ wasOpenDelayedRef.current = false;
42696
+ setOpen(true);
42697
+ }, [setOpen]);
42698
+ const handleClose = React54.useCallback(() => {
42699
+ window.clearTimeout(openTimerRef.current);
42700
+ openTimerRef.current = 0;
42701
+ setOpen(false);
42702
+ }, [setOpen]);
42703
+ const handleDelayedOpen = React54.useCallback(() => {
42704
+ window.clearTimeout(openTimerRef.current);
42705
+ openTimerRef.current = window.setTimeout(() => {
42706
+ wasOpenDelayedRef.current = true;
42707
+ setOpen(true);
42708
+ openTimerRef.current = 0;
42709
+ }, delayDuration);
42710
+ }, [delayDuration, setOpen]);
42711
+ React54.useEffect(() => {
42712
+ return () => {
42713
+ if (openTimerRef.current) {
42714
+ window.clearTimeout(openTimerRef.current);
42715
+ openTimerRef.current = 0;
42716
+ }
42717
+ };
42718
+ }, []);
42719
+ return /* @__PURE__ */ jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsx(
42720
+ TooltipContextProvider,
42721
+ {
42722
+ scope: __scopeTooltip,
42723
+ contentId,
42724
+ open,
42725
+ stateAttribute,
42726
+ trigger,
42727
+ onTriggerChange: setTrigger,
42728
+ onTriggerEnter: React54.useCallback(() => {
42729
+ if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
42730
+ else handleOpen();
42731
+ }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
42732
+ onTriggerLeave: React54.useCallback(() => {
42733
+ if (disableHoverableContent) {
42734
+ handleClose();
42735
+ } else {
42736
+ window.clearTimeout(openTimerRef.current);
42737
+ openTimerRef.current = 0;
42738
+ }
42739
+ }, [handleClose, disableHoverableContent]),
42740
+ onOpen: handleOpen,
42741
+ onClose: handleClose,
42742
+ disableHoverableContent,
42743
+ children
42744
+ }
42745
+ ) });
42746
+ };
42747
+ Tooltip.displayName = TOOLTIP_NAME;
42748
+ var TRIGGER_NAME5 = "TooltipTrigger";
42749
+ var TooltipTrigger = React54.forwardRef(
42750
+ (props, forwardedRef) => {
42751
+ const { __scopeTooltip, ...triggerProps } = props;
42752
+ const context = useTooltipContext(TRIGGER_NAME5, __scopeTooltip);
42753
+ const providerContext = useTooltipProviderContext(TRIGGER_NAME5, __scopeTooltip);
42754
+ const popperScope = usePopperScope3(__scopeTooltip);
42755
+ const ref = React54.useRef(null);
42756
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
42757
+ const isPointerDownRef = React54.useRef(false);
42758
+ const hasPointerMoveOpenedRef = React54.useRef(false);
42759
+ const handlePointerUp = React54.useCallback(() => isPointerDownRef.current = false, []);
42760
+ React54.useEffect(() => {
42761
+ return () => document.removeEventListener("pointerup", handlePointerUp);
42762
+ }, [handlePointerUp]);
42763
+ return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
42764
+ Primitive18.button,
42765
+ {
42766
+ "aria-describedby": context.open ? context.contentId : void 0,
42767
+ "data-state": context.stateAttribute,
42768
+ ...triggerProps,
42769
+ ref: composedRefs,
42770
+ onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
42771
+ if (event.pointerType === "touch") return;
42772
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
42773
+ context.onTriggerEnter();
42774
+ hasPointerMoveOpenedRef.current = true;
42775
+ }
42776
+ }),
42777
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
42778
+ context.onTriggerLeave();
42779
+ hasPointerMoveOpenedRef.current = false;
42780
+ }),
42781
+ onPointerDown: composeEventHandlers(props.onPointerDown, () => {
42782
+ if (context.open) {
42783
+ context.onClose();
42784
+ }
42785
+ isPointerDownRef.current = true;
42786
+ document.addEventListener("pointerup", handlePointerUp, { once: true });
42787
+ }),
42788
+ onFocus: composeEventHandlers(props.onFocus, () => {
42789
+ if (!isPointerDownRef.current) context.onOpen();
42790
+ }),
42791
+ onBlur: composeEventHandlers(props.onBlur, context.onClose),
42792
+ onClick: composeEventHandlers(props.onClick, context.onClose)
42793
+ }
42794
+ ) });
42795
+ }
42796
+ );
42797
+ TooltipTrigger.displayName = TRIGGER_NAME5;
42798
+ var PORTAL_NAME5 = "TooltipPortal";
42799
+ var [PortalProvider3, usePortalContext3] = createTooltipContext(PORTAL_NAME5, {
42800
+ forceMount: void 0
42801
+ });
42802
+ var TooltipPortal = (props) => {
42803
+ const { __scopeTooltip, forceMount, children, container } = props;
42804
+ const context = useTooltipContext(PORTAL_NAME5, __scopeTooltip);
42805
+ return /* @__PURE__ */ jsx(PortalProvider3, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal, { asChild: true, container, children }) }) });
42806
+ };
42807
+ TooltipPortal.displayName = PORTAL_NAME5;
42808
+ var CONTENT_NAME5 = "TooltipContent";
42809
+ var TooltipContent = React54.forwardRef(
42810
+ (props, forwardedRef) => {
42811
+ const portalContext = usePortalContext3(CONTENT_NAME5, props.__scopeTooltip);
42812
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
42813
+ const context = useTooltipContext(CONTENT_NAME5, props.__scopeTooltip);
42814
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
42815
+ }
42816
+ );
42817
+ var TooltipContentHoverable = React54.forwardRef((props, forwardedRef) => {
42818
+ const context = useTooltipContext(CONTENT_NAME5, props.__scopeTooltip);
42819
+ const providerContext = useTooltipProviderContext(CONTENT_NAME5, props.__scopeTooltip);
42820
+ const ref = React54.useRef(null);
42821
+ const composedRefs = useComposedRefs(forwardedRef, ref);
42822
+ const [pointerGraceArea, setPointerGraceArea] = React54.useState(null);
42823
+ const { trigger, onClose } = context;
42824
+ const content = ref.current;
42825
+ const { onPointerInTransitChange } = providerContext;
42826
+ const handleRemoveGraceArea = React54.useCallback(() => {
42827
+ setPointerGraceArea(null);
42828
+ onPointerInTransitChange(false);
42829
+ }, [onPointerInTransitChange]);
42830
+ const handleCreateGraceArea = React54.useCallback(
42831
+ (event, hoverTarget) => {
42832
+ const currentTarget = event.currentTarget;
42833
+ const exitPoint = { x: event.clientX, y: event.clientY };
42834
+ const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
42835
+ const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
42836
+ const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
42837
+ const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
42838
+ setPointerGraceArea(graceArea);
42839
+ onPointerInTransitChange(true);
42840
+ },
42841
+ [onPointerInTransitChange]
42842
+ );
42843
+ React54.useEffect(() => {
42844
+ return () => handleRemoveGraceArea();
42845
+ }, [handleRemoveGraceArea]);
42846
+ React54.useEffect(() => {
42847
+ if (trigger && content) {
42848
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
42849
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
42850
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
42851
+ content.addEventListener("pointerleave", handleContentLeave);
42852
+ return () => {
42853
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
42854
+ content.removeEventListener("pointerleave", handleContentLeave);
42855
+ };
42856
+ }
42857
+ }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
42858
+ React54.useEffect(() => {
42859
+ if (pointerGraceArea) {
42860
+ const handleTrackPointerGrace = (event) => {
42861
+ const target = event.target;
42862
+ const pointerPosition = { x: event.clientX, y: event.clientY };
42863
+ const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target)) || (content == null ? void 0 : content.contains(target));
42864
+ const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
42865
+ if (hasEnteredTarget) {
42866
+ handleRemoveGraceArea();
42867
+ } else if (isPointerOutsideGraceArea) {
42868
+ handleRemoveGraceArea();
42869
+ onClose();
42870
+ }
42871
+ };
42872
+ document.addEventListener("pointermove", handleTrackPointerGrace);
42873
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
42874
+ }
42875
+ }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
42876
+ return /* @__PURE__ */ jsx(TooltipContentImpl, { ...props, ref: composedRefs });
42877
+ });
42878
+ var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
42879
+ var Slottable = createSlottable("TooltipContent");
42880
+ var TooltipContentImpl = React54.forwardRef(
42881
+ (props, forwardedRef) => {
42882
+ const {
42883
+ __scopeTooltip,
42884
+ children,
42885
+ "aria-label": ariaLabel,
42886
+ onEscapeKeyDown,
42887
+ onPointerDownOutside,
42888
+ ...contentProps
42889
+ } = props;
42890
+ const context = useTooltipContext(CONTENT_NAME5, __scopeTooltip);
42891
+ const popperScope = usePopperScope3(__scopeTooltip);
42892
+ const { onClose } = context;
42893
+ React54.useEffect(() => {
42894
+ document.addEventListener(TOOLTIP_OPEN, onClose);
42895
+ return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
42896
+ }, [onClose]);
42897
+ React54.useEffect(() => {
42898
+ if (context.trigger) {
42899
+ const handleScroll2 = (event) => {
42900
+ const target = event.target;
42901
+ if (target == null ? void 0 : target.contains(context.trigger)) onClose();
42902
+ };
42903
+ window.addEventListener("scroll", handleScroll2, { capture: true });
42904
+ return () => window.removeEventListener("scroll", handleScroll2, { capture: true });
42905
+ }
42906
+ }, [context.trigger, onClose]);
42907
+ return /* @__PURE__ */ jsx(
42908
+ DismissableLayer,
42909
+ {
42910
+ asChild: true,
42911
+ disableOutsidePointerEvents: false,
42912
+ onEscapeKeyDown,
42913
+ onPointerDownOutside,
42914
+ onFocusOutside: (event) => event.preventDefault(),
42915
+ onDismiss: onClose,
42916
+ children: /* @__PURE__ */ jsxs(
42917
+ Content,
42918
+ {
42919
+ "data-state": context.stateAttribute,
42920
+ ...popperScope,
42921
+ ...contentProps,
42922
+ ref: forwardedRef,
42923
+ style: {
42924
+ ...contentProps.style,
42925
+ // re-namespace exposed content custom properties
42926
+ ...{
42927
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
42928
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
42929
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
42930
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
42931
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
42932
+ }
42933
+ },
42934
+ children: [
42935
+ /* @__PURE__ */ jsx(Slottable, { children }),
42936
+ /* @__PURE__ */ jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsx(Root3, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
42937
+ ]
42938
+ }
42939
+ )
42940
+ }
42941
+ );
42942
+ }
42943
+ );
42944
+ TooltipContent.displayName = CONTENT_NAME5;
42945
+ var ARROW_NAME4 = "TooltipArrow";
42946
+ var TooltipArrow = React54.forwardRef(
42947
+ (props, forwardedRef) => {
42948
+ const { __scopeTooltip, ...arrowProps } = props;
42949
+ const popperScope = usePopperScope3(__scopeTooltip);
42950
+ const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
42951
+ ARROW_NAME4,
42952
+ __scopeTooltip
42953
+ );
42954
+ return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsx(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
42955
+ }
42956
+ );
42957
+ TooltipArrow.displayName = ARROW_NAME4;
42958
+ function getExitSideFromRect(point, rect) {
42959
+ const top = Math.abs(rect.top - point.y);
42960
+ const bottom = Math.abs(rect.bottom - point.y);
42961
+ const right = Math.abs(rect.right - point.x);
42962
+ const left = Math.abs(rect.left - point.x);
42963
+ switch (Math.min(top, bottom, right, left)) {
42964
+ case left:
42965
+ return "left";
42966
+ case right:
42967
+ return "right";
42968
+ case top:
42969
+ return "top";
42970
+ case bottom:
42971
+ return "bottom";
42972
+ default:
42973
+ throw new Error("unreachable");
42974
+ }
42975
+ }
42976
+ function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
42977
+ const paddedExitPoints = [];
42978
+ switch (exitSide) {
42979
+ case "top":
42980
+ paddedExitPoints.push(
42981
+ { x: exitPoint.x - padding, y: exitPoint.y + padding },
42982
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
42983
+ );
42984
+ break;
42985
+ case "bottom":
42986
+ paddedExitPoints.push(
42987
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
42988
+ { x: exitPoint.x + padding, y: exitPoint.y - padding }
42989
+ );
42990
+ break;
42991
+ case "left":
42992
+ paddedExitPoints.push(
42993
+ { x: exitPoint.x + padding, y: exitPoint.y - padding },
42994
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
42995
+ );
42996
+ break;
42997
+ case "right":
42998
+ paddedExitPoints.push(
42999
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
43000
+ { x: exitPoint.x - padding, y: exitPoint.y + padding }
43001
+ );
43002
+ break;
43003
+ }
43004
+ return paddedExitPoints;
43005
+ }
43006
+ function getPointsFromRect(rect) {
43007
+ const { top, right, bottom, left } = rect;
43008
+ return [
43009
+ { x: left, y: top },
43010
+ { x: right, y: top },
43011
+ { x: right, y: bottom },
43012
+ { x: left, y: bottom }
43013
+ ];
43014
+ }
43015
+ function isPointInPolygon(point, polygon) {
43016
+ const { x, y } = point;
43017
+ let inside = false;
43018
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
43019
+ const ii = polygon[i];
43020
+ const jj = polygon[j];
43021
+ const xi = ii.x;
43022
+ const yi = ii.y;
43023
+ const xj = jj.x;
43024
+ const yj = jj.y;
43025
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
43026
+ if (intersect) inside = !inside;
43027
+ }
43028
+ return inside;
43029
+ }
43030
+ function getHull(points) {
43031
+ const newPoints = points.slice();
43032
+ newPoints.sort((a, b) => {
43033
+ if (a.x < b.x) return -1;
43034
+ else if (a.x > b.x) return 1;
43035
+ else if (a.y < b.y) return -1;
43036
+ else if (a.y > b.y) return 1;
43037
+ else return 0;
43038
+ });
43039
+ return getHullPresorted(newPoints);
43040
+ }
43041
+ function getHullPresorted(points) {
43042
+ if (points.length <= 1) return points.slice();
43043
+ const upperHull = [];
43044
+ for (let i = 0; i < points.length; i++) {
43045
+ const p = points[i];
43046
+ while (upperHull.length >= 2) {
43047
+ const q = upperHull[upperHull.length - 1];
43048
+ const r2 = upperHull[upperHull.length - 2];
43049
+ if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) upperHull.pop();
43050
+ else break;
43051
+ }
43052
+ upperHull.push(p);
43053
+ }
43054
+ upperHull.pop();
43055
+ const lowerHull = [];
43056
+ for (let i = points.length - 1; i >= 0; i--) {
43057
+ const p = points[i];
43058
+ while (lowerHull.length >= 2) {
43059
+ const q = lowerHull[lowerHull.length - 1];
43060
+ const r2 = lowerHull[lowerHull.length - 2];
43061
+ if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) lowerHull.pop();
43062
+ else break;
43063
+ }
43064
+ lowerHull.push(p);
43065
+ }
43066
+ lowerHull.pop();
43067
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
43068
+ return upperHull;
43069
+ } else {
43070
+ return upperHull.concat(lowerHull);
43071
+ }
43072
+ }
43073
+ var Provider = TooltipProvider;
43074
+ var Root32 = Tooltip;
43075
+ var Trigger4 = TooltipTrigger;
43076
+ var Portal5 = TooltipPortal;
43077
+ var Content23 = TooltipContent;
43078
+ var Arrow22 = TooltipArrow;
43079
+ function TooltipProvider2({
43080
+ delayDuration = 0,
43081
+ ...props
43082
+ }) {
43083
+ return /* @__PURE__ */ jsx(
43084
+ Provider,
43085
+ {
43086
+ "data-slot": "tooltip-provider",
43087
+ delayDuration,
43088
+ ...props
43089
+ }
43090
+ );
43091
+ }
43092
+ function Tooltip2({
43093
+ ...props
43094
+ }) {
43095
+ return /* @__PURE__ */ jsx(TooltipProvider2, { children: /* @__PURE__ */ jsx(Root32, { "data-slot": "tooltip", ...props }) });
43096
+ }
43097
+ function TooltipTrigger2({
43098
+ ...props
43099
+ }) {
43100
+ return /* @__PURE__ */ jsx(Trigger4, { "data-slot": "tooltip-trigger", ...props });
43101
+ }
43102
+ function TooltipContent2({
43103
+ className,
43104
+ sideOffset = 0,
43105
+ children,
43106
+ ...props
43107
+ }) {
43108
+ return /* @__PURE__ */ jsx(Portal5, { children: /* @__PURE__ */ jsxs(
43109
+ Content23,
43110
+ {
43111
+ "data-slot": "tooltip-content",
43112
+ sideOffset,
43113
+ className: cn(
43114
+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
43115
+ className
43116
+ ),
43117
+ ...props,
43118
+ children: [
43119
+ children,
43120
+ /* @__PURE__ */ jsx(Arrow22, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
43121
+ ]
43122
+ }
43123
+ ) });
43124
+ }
43125
+ function mapSizeToToggleSize(size4) {
43126
+ switch (size4) {
43127
+ case "sm":
43128
+ return "sm";
43129
+ case "lg":
43130
+ return "lg";
43131
+ case "md":
43132
+ default:
43133
+ return "default";
43134
+ }
43135
+ }
43136
+ function normalizeValue(val, multiple) {
43137
+ if (multiple) {
43138
+ if (Array.isArray(val)) return val;
43139
+ if (typeof val === "string") return [val];
43140
+ return [];
43141
+ }
43142
+ if (Array.isArray(val)) return val[0] || "";
43143
+ return val || "";
43144
+ }
43145
+ function capitalizeFirst6(label) {
43146
+ if (!label) return label;
43147
+ return label.charAt(0).toUpperCase() + label.slice(1);
43148
+ }
43149
+ function normalizeOption(input, {
43150
+ optionValue,
43151
+ optionLabel,
43152
+ optionIcon,
43153
+ optionDisabled,
43154
+ optionTooltip,
43155
+ optionMeta
43156
+ }, autoCap) {
43157
+ var _a, _b, _c, _d, _e, _f;
43158
+ const anyInput = input;
43159
+ if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
43160
+ const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
43161
+ const value2 = String(rawValue);
43162
+ let label2;
43163
+ if (optionLabel != null) {
43164
+ label2 = anyInput[optionLabel];
43165
+ } else if (anyInput.label != null) {
43166
+ label2 = anyInput.label;
43167
+ } else {
43168
+ label2 = String(rawValue != null ? rawValue : value2);
43169
+ }
43170
+ if (autoCap && typeof label2 === "string") {
43171
+ label2 = capitalizeFirst6(label2);
43172
+ }
43173
+ const icon = optionIcon != null ? anyInput[optionIcon] : (_b = anyInput.icon) != null ? _b : void 0;
43174
+ const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
43175
+ const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
43176
+ const meta = optionMeta != null ? anyInput[optionMeta] : (_d = anyInput.meta) != null ? _d : void 0;
43177
+ return {
43178
+ ui: {
43179
+ value: value2,
43180
+ label: label2,
43181
+ icon,
43182
+ disabled,
43183
+ tooltip,
43184
+ meta
43185
+ },
43186
+ raw: input
43187
+ };
43188
+ }
43189
+ if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
43190
+ const value2 = String(input);
43191
+ let label2 = value2;
43192
+ if (autoCap && typeof label2 === "string") {
43193
+ label2 = capitalizeFirst6(label2);
43194
+ }
43195
+ return {
43196
+ ui: {
43197
+ value: value2,
43198
+ label: label2
43199
+ },
43200
+ raw: input
43201
+ };
43202
+ }
43203
+ const baseValue = (_f = anyInput.value) != null ? _f : String((_e = anyInput.label) != null ? _e : "");
43204
+ const value = String(baseValue);
43205
+ let label = anyInput.label != null ? anyInput.label : String(value);
43206
+ if (autoCap && typeof label === "string") {
43207
+ label = capitalizeFirst6(label);
43208
+ }
43209
+ return {
43210
+ ui: {
43211
+ value,
43212
+ label,
43213
+ icon: anyInput.icon,
43214
+ disabled: !!anyInput.disabled,
43215
+ tooltip: anyInput.tooltip,
43216
+ meta: anyInput.meta
43217
+ },
43218
+ raw: input
43219
+ };
43220
+ }
43221
+ var ShadcnToggleVariant3 = React54.forwardRef(function ShadcnToggleVariant4(props, ref) {
43222
+ const {
43223
+ value,
43224
+ onValue,
43225
+ disabled,
43226
+ readOnly,
43227
+ error,
43228
+ size: size4 = "md",
43229
+ options = [],
43230
+ multiple = false,
43231
+ variant = "default",
43232
+ layout = "horizontal",
43233
+ gridCols = 2,
43234
+ fillWidth: fullWidth = false,
43235
+ optionValue,
43236
+ optionLabel,
43237
+ optionIcon,
43238
+ optionDisabled,
43239
+ optionTooltip,
43240
+ optionMeta,
43241
+ renderOption,
43242
+ className,
43243
+ itemClassName,
43244
+ activeClassName,
43245
+ autoCap = false,
43246
+ gap: itemGapPx
43247
+ } = props;
43248
+ const isDisabled = !!disabled || !!readOnly;
43249
+ const toggleSize = mapSizeToToggleSize(size4);
43250
+ const currentValue = normalizeValue(value, multiple);
43251
+ const normalizedOptions = React54.useMemo(
43252
+ () => options.map(
43253
+ (opt) => normalizeOption(
43254
+ opt,
43255
+ {
43256
+ optionValue,
43257
+ optionLabel,
43258
+ optionIcon,
43259
+ optionDisabled,
43260
+ optionTooltip,
43261
+ optionMeta
43262
+ },
43263
+ autoCap
43264
+ )
43265
+ ),
43266
+ [
43267
+ options,
43268
+ optionValue,
43269
+ optionLabel,
43270
+ optionIcon,
43271
+ optionDisabled,
43272
+ optionTooltip,
43273
+ optionMeta,
43274
+ autoCap
43275
+ ]
43276
+ );
43277
+ const handleChange = React54.useCallback(
43278
+ (val) => {
43279
+ if (readOnly) return;
43280
+ if (!onValue) return;
43281
+ let rawSelection;
43282
+ if (Array.isArray(val)) {
43283
+ const selected = normalizedOptions.filter(
43284
+ (entry) => val.includes(entry.ui.value)
43285
+ );
43286
+ rawSelection = selected.map((entry) => entry.raw);
43287
+ } else {
43288
+ const found = normalizedOptions.find(
43289
+ (entry) => entry.ui.value === val
43290
+ );
43291
+ rawSelection = found == null ? void 0 : found.raw;
43292
+ }
43293
+ const detail = {
43294
+ source: "variant",
43295
+ raw: rawSelection,
43296
+ // original item(s)
43297
+ nativeEvent: void 0,
43298
+ meta: { action: "toggle" }
43299
+ };
43300
+ onValue(val, detail);
43301
+ },
43302
+ [onValue, readOnly, normalizedOptions]
43303
+ );
43304
+ const layoutClasses = cn(
43305
+ layout === "horizontal" && "flex flex-wrap",
43306
+ layout === "vertical" && "flex flex-col items-stretch",
43307
+ layout === "grid" && "grid",
43308
+ fullWidth && "w-full",
43309
+ fullWidth && layout === "horizontal" && "[&>*]:flex-1",
43310
+ fullWidth && layout === "vertical" && "[&>*]:w-full",
43311
+ className
43312
+ );
43313
+ console.log(layoutClasses, fullWidth, autoCap);
43314
+ const groupStyle = React54.useMemo(() => {
43315
+ const style = {};
43316
+ if (layout === "grid") {
43317
+ style.gridTemplateColumns = `repeat(${gridCols}, minmax(0, 1fr))`;
43318
+ }
43319
+ if (typeof itemGapPx === "number") {
43320
+ style.gap = itemGapPx;
43321
+ }
43322
+ return Object.keys(style).length ? style : void 0;
43323
+ }, [layout, gridCols, itemGapPx]);
43324
+ return /* @__PURE__ */ jsx(
43325
+ ToggleGroup2,
43326
+ {
43327
+ ref,
43328
+ type: multiple ? "multiple" : "single",
43329
+ value: currentValue,
43330
+ onValueChange: handleChange,
43331
+ disabled: isDisabled,
43332
+ variant,
43333
+ size: toggleSize,
43334
+ className: layoutClasses,
43335
+ style: groupStyle,
43336
+ "aria-invalid": !!error,
43337
+ children: normalizedOptions.map(({ ui: opt }) => {
43338
+ const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
43339
+ const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
43340
+ opt.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: opt.icon }),
43341
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
43342
+ ] });
43343
+ const itemNode = /* @__PURE__ */ jsx(
43344
+ ToggleGroupItem2,
43345
+ {
43346
+ value: opt.value,
43347
+ disabled: opt.disabled,
43348
+ "aria-label": typeof opt.label === "string" ? opt.label : opt.value,
43349
+ className: cn(
43350
+ // Base Transitions
43351
+ "transition-all",
43352
+ // Default Active State (Shadcn defaults)
43353
+ "data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
43354
+ // Error State
43355
+ error && "border-destructive/50 hover:bg-destructive/10 data-[state=on]:bg-destructive data-[state=on]:text-destructive-foreground",
43356
+ // Variant: Outline specific tweaks
43357
+ variant === "outline" && layout === "horizontal" && !fullWidth && "first:rounded-l-md last:rounded-r-md rounded-none border-l-0 first:border-l",
43358
+ // Layout tweaks
43359
+ fullWidth && "justify-center",
43360
+ // Custom Item Class
43361
+ itemClassName,
43362
+ // Active Class Name (Applied only when selected)
43363
+ isSelected && activeClassName
43364
+ ),
43365
+ children: contentNode
43366
+ },
43367
+ opt.value
43368
+ );
43369
+ if (opt.tooltip && !isDisabled) {
43370
+ return /* @__PURE__ */ jsx(TooltipProvider2, { delayDuration: 300, children: /* @__PURE__ */ jsxs(Tooltip2, { children: [
43371
+ /* @__PURE__ */ jsx(TooltipTrigger2, { asChild: true, children: itemNode }),
43372
+ /* @__PURE__ */ jsx(TooltipContent2, { children: /* @__PURE__ */ jsx("p", { children: opt.tooltip }) })
43373
+ ] }) }, opt.value);
43374
+ }
43375
+ return itemNode;
43376
+ })
43377
+ }
43378
+ );
43379
+ });
43380
+ ShadcnToggleVariant3.displayName = "ShadcnToggleVariant";
43381
+
43382
+ // src/variants/core/toggle-group.tsx
43383
+ var toggleGroupModule = {
43384
+ variant: "toggle-group",
43385
+ Variant: ShadcnToggleVariant3,
43386
+ meta: {
43387
+ label: "Toggle group",
43388
+ description: "Toggle group component buttons.",
43389
+ tags: ["buttons", "toggle"]
43390
+ }
43391
+ };
41957
43392
 
41958
43393
  // src/variants/index.ts
41959
43394
  var variants = [
@@ -41974,13 +43409,14 @@ var variants = [
41974
43409
  keyValueModule,
41975
43410
  custom_default,
41976
43411
  treeselect_default2,
41977
- fileManagerModule
43412
+ fileManagerModule,
43413
+ toggleGroupModule
41978
43414
  ];
41979
43415
  function registerCoreVariants() {
41980
43416
  variants.forEach((item) => registerVariant(item));
41981
43417
  }
41982
43418
  registerCoreVariants();
41983
- var NODES16 = [
43419
+ var NODES19 = [
41984
43420
  "a",
41985
43421
  "button",
41986
43422
  "div",
@@ -41999,7 +43435,7 @@ var NODES16 = [
41999
43435
  "svg",
42000
43436
  "ul"
42001
43437
  ];
42002
- var Primitive16 = NODES16.reduce((primitive, node) => {
43438
+ var Primitive19 = NODES19.reduce((primitive, node) => {
42003
43439
  const Slot5 = createSlot10(`Primitive.${node}`);
42004
43440
  const Node2 = React54.forwardRef((props, forwardedRef) => {
42005
43441
  const { asChild, ...primitiveProps } = props;
@@ -42012,10 +43448,10 @@ var Primitive16 = NODES16.reduce((primitive, node) => {
42012
43448
  Node2.displayName = `Primitive.${node}`;
42013
43449
  return { ...primitive, [node]: Node2 };
42014
43450
  }, {});
42015
- var NAME3 = "Label";
43451
+ var NAME4 = "Label";
42016
43452
  var Label2 = React54.forwardRef((props, forwardedRef) => {
42017
43453
  return /* @__PURE__ */ jsx(
42018
- Primitive16.label,
43454
+ Primitive19.label,
42019
43455
  {
42020
43456
  ...props,
42021
43457
  ref: forwardedRef,
@@ -42029,14 +43465,14 @@ var Label2 = React54.forwardRef((props, forwardedRef) => {
42029
43465
  }
42030
43466
  );
42031
43467
  });
42032
- Label2.displayName = NAME3;
42033
- var Root9 = Label2;
43468
+ Label2.displayName = NAME4;
43469
+ var Root10 = Label2;
42034
43470
  function Label3({
42035
43471
  className,
42036
43472
  ...props
42037
43473
  }) {
42038
43474
  return /* @__PURE__ */ jsx(
42039
- Root9,
43475
+ Root10,
42040
43476
  {
42041
43477
  "data-slot": "label",
42042
43478
  className: cn(