@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.js CHANGED
@@ -1179,11 +1179,11 @@ var init_parseHeaders = __esm({
1179
1179
  function normalizeHeader(header) {
1180
1180
  return header && String(header).trim().toLowerCase();
1181
1181
  }
1182
- function normalizeValue(value) {
1182
+ function normalizeValue2(value) {
1183
1183
  if (value === false || value == null) {
1184
1184
  return value;
1185
1185
  }
1186
- return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
1186
+ return utils_default.isArray(value) ? value.map(normalizeValue2) : String(value);
1187
1187
  }
1188
1188
  function parseTokens(str) {
1189
1189
  const tokens = /* @__PURE__ */ Object.create(null);
@@ -1245,7 +1245,7 @@ var init_AxiosHeaders = __esm({
1245
1245
  }
1246
1246
  const key = utils_default.findKey(self2, lHeader);
1247
1247
  if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1248
- self2[key || _header] = normalizeValue(_value);
1248
+ self2[key || _header] = normalizeValue2(_value);
1249
1249
  }
1250
1250
  }
1251
1251
  const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
@@ -1336,7 +1336,7 @@ var init_AxiosHeaders = __esm({
1336
1336
  utils_default.forEach(this, (value, header) => {
1337
1337
  const key = utils_default.findKey(headers, header);
1338
1338
  if (key) {
1339
- self2[key] = normalizeValue(value);
1339
+ self2[key] = normalizeValue2(value);
1340
1340
  delete self2[header];
1341
1341
  return;
1342
1342
  }
@@ -1344,7 +1344,7 @@ var init_AxiosHeaders = __esm({
1344
1344
  if (normalized !== header) {
1345
1345
  delete self2[header];
1346
1346
  }
1347
- self2[normalized] = normalizeValue(value);
1347
+ self2[normalized] = normalizeValue2(value);
1348
1348
  headers[normalized] = true;
1349
1349
  });
1350
1350
  return this;
@@ -20603,19 +20603,19 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
20603
20603
  }
20604
20604
  function createContext2(rootComponentName, defaultContext) {
20605
20605
  const Context = React54__namespace.createContext(defaultContext);
20606
- const Provider = (props) => {
20606
+ const Provider2 = (props) => {
20607
20607
  const { children, ...context } = props;
20608
20608
  const value = React54__namespace.useMemo(() => context, Object.values(context));
20609
20609
  return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
20610
20610
  };
20611
- Provider.displayName = rootComponentName + "Provider";
20611
+ Provider2.displayName = rootComponentName + "Provider";
20612
20612
  function useContext22(consumerName) {
20613
20613
  const context = React54__namespace.useContext(Context);
20614
20614
  if (context) return context;
20615
20615
  if (defaultContext !== void 0) return defaultContext;
20616
20616
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
20617
20617
  }
20618
- return [Provider, useContext22];
20618
+ return [Provider2, useContext22];
20619
20619
  }
20620
20620
  function createContextScope(scopeName, createContextScopeDeps = []) {
20621
20621
  let defaultContexts = [];
@@ -20623,14 +20623,14 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
20623
20623
  const BaseContext = React54__namespace.createContext(defaultContext);
20624
20624
  const index2 = defaultContexts.length;
20625
20625
  defaultContexts = [...defaultContexts, defaultContext];
20626
- const Provider = (props) => {
20626
+ const Provider2 = (props) => {
20627
20627
  var _a;
20628
20628
  const { scope, children, ...context } = props;
20629
20629
  const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
20630
20630
  const value = React54__namespace.useMemo(() => context, Object.values(context));
20631
20631
  return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
20632
20632
  };
20633
- Provider.displayName = rootComponentName + "Provider";
20633
+ Provider2.displayName = rootComponentName + "Provider";
20634
20634
  function useContext22(consumerName, scope) {
20635
20635
  var _a;
20636
20636
  const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
@@ -20639,7 +20639,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
20639
20639
  if (defaultContext !== void 0) return defaultContext;
20640
20640
  throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
20641
20641
  }
20642
- return [Provider, useContext22];
20642
+ return [Provider2, useContext22];
20643
20643
  }
20644
20644
  const createScope = () => {
20645
20645
  const scopeContexts = defaultContexts.map((defaultContext) => {
@@ -20794,10 +20794,10 @@ function getElementRef(element) {
20794
20794
  return element.props.ref || element.ref;
20795
20795
  }
20796
20796
  function createCollection(name) {
20797
- const PROVIDER_NAME = name + "CollectionProvider";
20798
- const [createCollectionContext, createCollectionScope4] = createContextScope(PROVIDER_NAME);
20797
+ const PROVIDER_NAME2 = name + "CollectionProvider";
20798
+ const [createCollectionContext, createCollectionScope4] = createContextScope(PROVIDER_NAME2);
20799
20799
  const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
20800
- PROVIDER_NAME,
20800
+ PROVIDER_NAME2,
20801
20801
  { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
20802
20802
  );
20803
20803
  const CollectionProvider = (props) => {
@@ -20806,7 +20806,7 @@ function createCollection(name) {
20806
20806
  const itemMap = React54__namespace.default.useRef(/* @__PURE__ */ new Map()).current;
20807
20807
  return /* @__PURE__ */ jsxRuntime.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
20808
20808
  };
20809
- CollectionProvider.displayName = PROVIDER_NAME;
20809
+ CollectionProvider.displayName = PROVIDER_NAME2;
20810
20810
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
20811
20811
  const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
20812
20812
  const CollectionSlot = React54__namespace.default.forwardRef(
@@ -24452,6 +24452,7 @@ var VisuallyHidden = React54__namespace.forwardRef(
24452
24452
  }
24453
24453
  );
24454
24454
  VisuallyHidden.displayName = NAME2;
24455
+ var Root3 = VisuallyHidden;
24455
24456
 
24456
24457
  // ../../node_modules/aria-hidden/dist/es2015/index.js
24457
24458
  var getDefaultParent = function(originalTarget) {
@@ -30486,7 +30487,7 @@ __export(custom_components_exports, {
30486
30487
  NextMonthButton: () => NextMonthButton,
30487
30488
  Option: () => Option,
30488
30489
  PreviousMonthButton: () => PreviousMonthButton,
30489
- Root: () => Root3,
30490
+ Root: () => Root4,
30490
30491
  Select: () => Select3,
30491
30492
  Week: () => Week,
30492
30493
  WeekNumber: () => WeekNumber,
@@ -30676,7 +30677,7 @@ function PreviousMonthButton(props) {
30676
30677
  const { components } = useDayPicker();
30677
30678
  return React54__namespace.default.createElement(components.Button, { ...props });
30678
30679
  }
30679
- function Root3(props) {
30680
+ function Root4(props) {
30680
30681
  const { rootRef, ...rest } = props;
30681
30682
  return React54__namespace.default.createElement("div", { ...rest, ref: rootRef });
30682
30683
  }
@@ -34529,7 +34530,7 @@ SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME2;
34529
34530
  function getState2(checked) {
34530
34531
  return checked ? "checked" : "unchecked";
34531
34532
  }
34532
- var Root4 = Switch;
34533
+ var Root5 = Switch;
34533
34534
  var Thumb = SwitchThumb;
34534
34535
  function Switch2({
34535
34536
  className,
@@ -34537,7 +34538,7 @@ function Switch2({
34537
34538
  ...props
34538
34539
  }) {
34539
34540
  return /* @__PURE__ */ jsxRuntime.jsx(
34540
- Root4,
34541
+ Root5,
34541
34542
  {
34542
34543
  "data-slot": "switch",
34543
34544
  className: cn(
@@ -35140,7 +35141,7 @@ function focusFirst2(candidates, preventScroll = false) {
35140
35141
  function wrapArray2(array, startIndex) {
35141
35142
  return array.map((_, index2) => array[(startIndex + index2) % array.length]);
35142
35143
  }
35143
- var Root5 = RovingFocusGroup;
35144
+ var Root6 = RovingFocusGroup;
35144
35145
  var Item2 = RovingFocusGroupItem;
35145
35146
  var RADIO_NAME = "Radio";
35146
35147
  var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
@@ -35314,7 +35315,7 @@ var RadioGroup = React54__namespace.forwardRef(
35314
35315
  value,
35315
35316
  onValueChange: setValue,
35316
35317
  children: /* @__PURE__ */ jsxRuntime.jsx(
35317
- Root5,
35318
+ Root6,
35318
35319
  {
35319
35320
  asChild: true,
35320
35321
  ...rovingFocusGroupScope,
@@ -35569,6 +35570,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
35569
35570
  () => normalizeItems(
35570
35571
  items,
35571
35572
  mappers,
35573
+ //@ts-ignore
35572
35574
  optionValue,
35573
35575
  optionLabel
35574
35576
  ),
@@ -35701,6 +35703,10 @@ var InnerShadcnRadioVariant = (props, ref) => {
35701
35703
  size: size4,
35702
35704
  density,
35703
35705
  optionId,
35706
+ click() {
35707
+ if (optionDisabled) return;
35708
+ handleSelect(displayItem.value);
35709
+ },
35704
35710
  radio: radioNode
35705
35711
  })
35706
35712
  },
@@ -36592,6 +36598,11 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
36592
36598
  size: size4,
36593
36599
  density,
36594
36600
  checkboxId,
36601
+ click() {
36602
+ if (optionDisabled) return;
36603
+ const nextInternal = effectiveTristate ? internalState === "none" ? true : internalState === true ? false : "none" : internalState === true ? false : true;
36604
+ updateGroupValue(item.value, nextInternal, effectiveTristate);
36605
+ },
36595
36606
  checkbox: checkboxNode
36596
36607
  }),
36597
36608
  hiddenInput
@@ -37013,7 +37024,13 @@ var ShadcnSelectVariant = React54__namespace.forwardRef(function ShadcnSelectVar
37013
37024
  item,
37014
37025
  selected: selectedItem != null && String(selectedItem.value) === String(item.value),
37015
37026
  index: index2,
37016
- option: optionNode
37027
+ option: optionNode,
37028
+ click() {
37029
+ if (disabled || readOnly || item.disabled) return;
37030
+ handleChange(String(item.value));
37031
+ setOpen(false);
37032
+ setQuery("");
37033
+ }
37017
37034
  });
37018
37035
  }),
37019
37036
  virtualScroll && renderedItems.length < filteredItems.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1 text-[10px] text-muted-foreground text-center", children: "Scroll to load more\u2026" })
@@ -37755,7 +37772,11 @@ var ShadcnMultiSelectVariant = React54__namespace.forwardRef(function ShadcnMult
37755
37772
  item,
37756
37773
  selected,
37757
37774
  index: index2,
37758
- option: row
37775
+ option: row,
37776
+ click() {
37777
+ if (item.disabled) return;
37778
+ handleToggleValue(item.value);
37779
+ }
37759
37780
  });
37760
37781
  }),
37761
37782
  showSelectAll && selectAllPosition === "bottom" && /* @__PURE__ */ jsxRuntime.jsxs(
@@ -38569,7 +38590,7 @@ function roundValue(value, decimalCount) {
38569
38590
  const rounder = Math.pow(10, decimalCount);
38570
38591
  return Math.round(value * rounder) / rounder;
38571
38592
  }
38572
- var Root6 = Slider;
38593
+ var Root7 = Slider;
38573
38594
  var Track = SliderTrack;
38574
38595
  var Range = SliderRange;
38575
38596
  var Thumb2 = SliderThumb;
@@ -38586,7 +38607,7 @@ function Slider2({
38586
38607
  [value, defaultValue, min3, max3]
38587
38608
  );
38588
38609
  return /* @__PURE__ */ jsxRuntime.jsxs(
38589
- Root6,
38610
+ Root7,
38590
38611
  {
38591
38612
  "data-slot": "slider",
38592
38613
  defaultValue,
@@ -39426,7 +39447,7 @@ var DescriptionWarning = ({ contentRef, descriptionId }) => {
39426
39447
  }, [MESSAGE, contentRef, descriptionId]);
39427
39448
  return null;
39428
39449
  };
39429
- var Root7 = Dialog;
39450
+ var Root8 = Dialog;
39430
39451
  var Portal4 = DialogPortal;
39431
39452
  var Overlay = DialogOverlay;
39432
39453
  var Content3 = DialogContent;
@@ -39436,7 +39457,7 @@ var Close = DialogClose;
39436
39457
  function Dialog2({
39437
39458
  ...props
39438
39459
  }) {
39439
- return /* @__PURE__ */ jsxRuntime.jsx(Root7, { "data-slot": "dialog", ...props });
39460
+ return /* @__PURE__ */ jsxRuntime.jsx(Root8, { "data-slot": "dialog", ...props });
39440
39461
  }
39441
39462
  function DialogPortal2({
39442
39463
  ...props
@@ -40398,7 +40419,7 @@ var ShadcnTreeSelectVariant = React54__namespace.forwardRef(function ShadcnTreeS
40398
40419
  displayedNodes.map((item, index2) => {
40399
40420
  const selected = selectedValues.includes(item.value);
40400
40421
  const isExpanded = expanded.has(item.value);
40401
- return /* @__PURE__ */ jsxRuntime.jsxs(
40422
+ const optionNode = /* @__PURE__ */ jsxRuntime.jsxs(
40402
40423
  "div",
40403
40424
  {
40404
40425
  className: cn(
@@ -40456,6 +40477,16 @@ var ShadcnTreeSelectVariant = React54__namespace.forwardRef(function ShadcnTreeS
40456
40477
  },
40457
40478
  item.key
40458
40479
  );
40480
+ if (!renderOption) return optionNode;
40481
+ return renderOption({
40482
+ item,
40483
+ selected,
40484
+ index: index2,
40485
+ option: optionNode,
40486
+ click() {
40487
+ if (!item.disabled) handleToggleValue(item);
40488
+ }
40489
+ });
40459
40490
  })
40460
40491
  ] });
40461
40492
  const SelectBody = /* @__PURE__ */ jsxRuntime.jsxs(
@@ -41341,7 +41372,7 @@ function useResizeObserver(element, onResize) {
41341
41372
  }
41342
41373
  }, [element, handleResize]);
41343
41374
  }
41344
- var Root8 = ScrollArea;
41375
+ var Root9 = ScrollArea;
41345
41376
  var Viewport2 = ScrollAreaViewport;
41346
41377
  var Corner = ScrollAreaCorner;
41347
41378
  function ScrollArea2({
@@ -41350,7 +41381,7 @@ function ScrollArea2({
41350
41381
  ...props
41351
41382
  }) {
41352
41383
  return /* @__PURE__ */ jsxRuntime.jsxs(
41353
- Root8,
41384
+ Root9,
41354
41385
  {
41355
41386
  "data-slot": "scroll-area",
41356
41387
  className: cn("relative", className),
@@ -41975,6 +42006,1410 @@ var fileManagerModule = {
41975
42006
  Variant: file_default,
41976
42007
  variant: "file"
41977
42008
  };
42009
+ // @__NO_SIDE_EFFECTS__
42010
+ function createSlot18(ownerName) {
42011
+ const SlotClone = /* @__PURE__ */ createSlotClone18(ownerName);
42012
+ const Slot22 = React54__namespace.forwardRef((props, forwardedRef) => {
42013
+ const { children, ...slotProps } = props;
42014
+ const childrenArray = React54__namespace.Children.toArray(children);
42015
+ const slottable = childrenArray.find(isSlottable18);
42016
+ if (slottable) {
42017
+ const newElement = slottable.props.children;
42018
+ const newChildren = childrenArray.map((child) => {
42019
+ if (child === slottable) {
42020
+ if (React54__namespace.Children.count(newElement) > 1) return React54__namespace.Children.only(null);
42021
+ return React54__namespace.isValidElement(newElement) ? newElement.props.children : null;
42022
+ } else {
42023
+ return child;
42024
+ }
42025
+ });
42026
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54__namespace.isValidElement(newElement) ? React54__namespace.cloneElement(newElement, void 0, newChildren) : null });
42027
+ }
42028
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
42029
+ });
42030
+ Slot22.displayName = `${ownerName}.Slot`;
42031
+ return Slot22;
42032
+ }
42033
+ // @__NO_SIDE_EFFECTS__
42034
+ function createSlotClone18(ownerName) {
42035
+ const SlotClone = React54__namespace.forwardRef((props, forwardedRef) => {
42036
+ const { children, ...slotProps } = props;
42037
+ if (React54__namespace.isValidElement(children)) {
42038
+ const childrenRef = getElementRef19(children);
42039
+ const props2 = mergeProps18(slotProps, children.props);
42040
+ if (children.type !== React54__namespace.Fragment) {
42041
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
42042
+ }
42043
+ return React54__namespace.cloneElement(children, props2);
42044
+ }
42045
+ return React54__namespace.Children.count(children) > 1 ? React54__namespace.Children.only(null) : null;
42046
+ });
42047
+ SlotClone.displayName = `${ownerName}.SlotClone`;
42048
+ return SlotClone;
42049
+ }
42050
+ var SLOTTABLE_IDENTIFIER18 = /* @__PURE__ */ Symbol("radix.slottable");
42051
+ function isSlottable18(child) {
42052
+ return React54__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER18;
42053
+ }
42054
+ function mergeProps18(slotProps, childProps) {
42055
+ const overrideProps = { ...childProps };
42056
+ for (const propName in childProps) {
42057
+ const slotPropValue = slotProps[propName];
42058
+ const childPropValue = childProps[propName];
42059
+ const isHandler = /^on[A-Z]/.test(propName);
42060
+ if (isHandler) {
42061
+ if (slotPropValue && childPropValue) {
42062
+ overrideProps[propName] = (...args) => {
42063
+ const result = childPropValue(...args);
42064
+ slotPropValue(...args);
42065
+ return result;
42066
+ };
42067
+ } else if (slotPropValue) {
42068
+ overrideProps[propName] = slotPropValue;
42069
+ }
42070
+ } else if (propName === "style") {
42071
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42072
+ } else if (propName === "className") {
42073
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42074
+ }
42075
+ }
42076
+ return { ...slotProps, ...overrideProps };
42077
+ }
42078
+ function getElementRef19(element) {
42079
+ var _a, _b;
42080
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42081
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42082
+ if (mayWarn) {
42083
+ return element.ref;
42084
+ }
42085
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42086
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42087
+ if (mayWarn) {
42088
+ return element.props.ref;
42089
+ }
42090
+ return element.props.ref || element.ref;
42091
+ }
42092
+ var NODES16 = [
42093
+ "a",
42094
+ "button",
42095
+ "div",
42096
+ "form",
42097
+ "h2",
42098
+ "h3",
42099
+ "img",
42100
+ "input",
42101
+ "label",
42102
+ "li",
42103
+ "nav",
42104
+ "ol",
42105
+ "p",
42106
+ "select",
42107
+ "span",
42108
+ "svg",
42109
+ "ul"
42110
+ ];
42111
+ var Primitive16 = NODES16.reduce((primitive, node) => {
42112
+ const Slot5 = createSlot18(`Primitive.${node}`);
42113
+ const Node2 = React54__namespace.forwardRef((props, forwardedRef) => {
42114
+ const { asChild, ...primitiveProps } = props;
42115
+ const Comp = asChild ? Slot5 : node;
42116
+ if (typeof window !== "undefined") {
42117
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42118
+ }
42119
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42120
+ });
42121
+ Node2.displayName = `Primitive.${node}`;
42122
+ return { ...primitive, [node]: Node2 };
42123
+ }, {});
42124
+ // @__NO_SIDE_EFFECTS__
42125
+ function createSlot19(ownerName) {
42126
+ const SlotClone = /* @__PURE__ */ createSlotClone19(ownerName);
42127
+ const Slot22 = React54__namespace.forwardRef((props, forwardedRef) => {
42128
+ const { children, ...slotProps } = props;
42129
+ const childrenArray = React54__namespace.Children.toArray(children);
42130
+ const slottable = childrenArray.find(isSlottable19);
42131
+ if (slottable) {
42132
+ const newElement = slottable.props.children;
42133
+ const newChildren = childrenArray.map((child) => {
42134
+ if (child === slottable) {
42135
+ if (React54__namespace.Children.count(newElement) > 1) return React54__namespace.Children.only(null);
42136
+ return React54__namespace.isValidElement(newElement) ? newElement.props.children : null;
42137
+ } else {
42138
+ return child;
42139
+ }
42140
+ });
42141
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54__namespace.isValidElement(newElement) ? React54__namespace.cloneElement(newElement, void 0, newChildren) : null });
42142
+ }
42143
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
42144
+ });
42145
+ Slot22.displayName = `${ownerName}.Slot`;
42146
+ return Slot22;
42147
+ }
42148
+ // @__NO_SIDE_EFFECTS__
42149
+ function createSlotClone19(ownerName) {
42150
+ const SlotClone = React54__namespace.forwardRef((props, forwardedRef) => {
42151
+ const { children, ...slotProps } = props;
42152
+ if (React54__namespace.isValidElement(children)) {
42153
+ const childrenRef = getElementRef20(children);
42154
+ const props2 = mergeProps19(slotProps, children.props);
42155
+ if (children.type !== React54__namespace.Fragment) {
42156
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
42157
+ }
42158
+ return React54__namespace.cloneElement(children, props2);
42159
+ }
42160
+ return React54__namespace.Children.count(children) > 1 ? React54__namespace.Children.only(null) : null;
42161
+ });
42162
+ SlotClone.displayName = `${ownerName}.SlotClone`;
42163
+ return SlotClone;
42164
+ }
42165
+ var SLOTTABLE_IDENTIFIER19 = /* @__PURE__ */ Symbol("radix.slottable");
42166
+ function isSlottable19(child) {
42167
+ return React54__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER19;
42168
+ }
42169
+ function mergeProps19(slotProps, childProps) {
42170
+ const overrideProps = { ...childProps };
42171
+ for (const propName in childProps) {
42172
+ const slotPropValue = slotProps[propName];
42173
+ const childPropValue = childProps[propName];
42174
+ const isHandler = /^on[A-Z]/.test(propName);
42175
+ if (isHandler) {
42176
+ if (slotPropValue && childPropValue) {
42177
+ overrideProps[propName] = (...args) => {
42178
+ const result = childPropValue(...args);
42179
+ slotPropValue(...args);
42180
+ return result;
42181
+ };
42182
+ } else if (slotPropValue) {
42183
+ overrideProps[propName] = slotPropValue;
42184
+ }
42185
+ } else if (propName === "style") {
42186
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42187
+ } else if (propName === "className") {
42188
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42189
+ }
42190
+ }
42191
+ return { ...slotProps, ...overrideProps };
42192
+ }
42193
+ function getElementRef20(element) {
42194
+ var _a, _b;
42195
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42196
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42197
+ if (mayWarn) {
42198
+ return element.ref;
42199
+ }
42200
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42201
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42202
+ if (mayWarn) {
42203
+ return element.props.ref;
42204
+ }
42205
+ return element.props.ref || element.ref;
42206
+ }
42207
+ var NODES17 = [
42208
+ "a",
42209
+ "button",
42210
+ "div",
42211
+ "form",
42212
+ "h2",
42213
+ "h3",
42214
+ "img",
42215
+ "input",
42216
+ "label",
42217
+ "li",
42218
+ "nav",
42219
+ "ol",
42220
+ "p",
42221
+ "select",
42222
+ "span",
42223
+ "svg",
42224
+ "ul"
42225
+ ];
42226
+ var Primitive17 = NODES17.reduce((primitive, node) => {
42227
+ const Slot5 = createSlot19(`Primitive.${node}`);
42228
+ const Node2 = React54__namespace.forwardRef((props, forwardedRef) => {
42229
+ const { asChild, ...primitiveProps } = props;
42230
+ const Comp = asChild ? Slot5 : node;
42231
+ if (typeof window !== "undefined") {
42232
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42233
+ }
42234
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42235
+ });
42236
+ Node2.displayName = `Primitive.${node}`;
42237
+ return { ...primitive, [node]: Node2 };
42238
+ }, {});
42239
+ var NAME3 = "Toggle";
42240
+ var Toggle = React54__namespace.forwardRef((props, forwardedRef) => {
42241
+ const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
42242
+ const [pressed, setPressed] = useControllableState({
42243
+ prop: pressedProp,
42244
+ onChange: onPressedChange,
42245
+ defaultProp: defaultPressed != null ? defaultPressed : false,
42246
+ caller: NAME3
42247
+ });
42248
+ return /* @__PURE__ */ jsxRuntime.jsx(
42249
+ Primitive17.button,
42250
+ {
42251
+ type: "button",
42252
+ "aria-pressed": pressed,
42253
+ "data-state": pressed ? "on" : "off",
42254
+ "data-disabled": props.disabled ? "" : void 0,
42255
+ ...buttonProps,
42256
+ ref: forwardedRef,
42257
+ onClick: composeEventHandlers(props.onClick, () => {
42258
+ if (!props.disabled) {
42259
+ setPressed(!pressed);
42260
+ }
42261
+ })
42262
+ }
42263
+ );
42264
+ });
42265
+ Toggle.displayName = NAME3;
42266
+ var TOGGLE_GROUP_NAME = "ToggleGroup";
42267
+ var [createToggleGroupContext] = createContextScope(TOGGLE_GROUP_NAME, [
42268
+ createRovingFocusGroupScope
42269
+ ]);
42270
+ var useRovingFocusGroupScope2 = createRovingFocusGroupScope();
42271
+ var ToggleGroup = React54__namespace.default.forwardRef((props, forwardedRef) => {
42272
+ const { type, ...toggleGroupProps } = props;
42273
+ if (type === "single") {
42274
+ const singleProps = toggleGroupProps;
42275
+ return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupImplSingle, { ...singleProps, ref: forwardedRef });
42276
+ }
42277
+ if (type === "multiple") {
42278
+ const multipleProps = toggleGroupProps;
42279
+ return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupImplMultiple, { ...multipleProps, ref: forwardedRef });
42280
+ }
42281
+ throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
42282
+ });
42283
+ ToggleGroup.displayName = TOGGLE_GROUP_NAME;
42284
+ var [ToggleGroupValueProvider, useToggleGroupValueContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
42285
+ var ToggleGroupImplSingle = React54__namespace.default.forwardRef((props, forwardedRef) => {
42286
+ const {
42287
+ value: valueProp,
42288
+ defaultValue,
42289
+ onValueChange = () => {
42290
+ },
42291
+ ...toggleGroupSingleProps
42292
+ } = props;
42293
+ const [value, setValue] = useControllableState({
42294
+ prop: valueProp,
42295
+ defaultProp: defaultValue != null ? defaultValue : "",
42296
+ onChange: onValueChange,
42297
+ caller: TOGGLE_GROUP_NAME
42298
+ });
42299
+ return /* @__PURE__ */ jsxRuntime.jsx(
42300
+ ToggleGroupValueProvider,
42301
+ {
42302
+ scope: props.__scopeToggleGroup,
42303
+ type: "single",
42304
+ value: React54__namespace.default.useMemo(() => value ? [value] : [], [value]),
42305
+ onItemActivate: setValue,
42306
+ onItemDeactivate: React54__namespace.default.useCallback(() => setValue(""), [setValue]),
42307
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupImpl, { ...toggleGroupSingleProps, ref: forwardedRef })
42308
+ }
42309
+ );
42310
+ });
42311
+ var ToggleGroupImplMultiple = React54__namespace.default.forwardRef((props, forwardedRef) => {
42312
+ const {
42313
+ value: valueProp,
42314
+ defaultValue,
42315
+ onValueChange = () => {
42316
+ },
42317
+ ...toggleGroupMultipleProps
42318
+ } = props;
42319
+ const [value, setValue] = useControllableState({
42320
+ prop: valueProp,
42321
+ defaultProp: defaultValue != null ? defaultValue : [],
42322
+ onChange: onValueChange,
42323
+ caller: TOGGLE_GROUP_NAME
42324
+ });
42325
+ const handleButtonActivate = React54__namespace.default.useCallback(
42326
+ (itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
42327
+ [setValue]
42328
+ );
42329
+ const handleButtonDeactivate = React54__namespace.default.useCallback(
42330
+ (itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
42331
+ [setValue]
42332
+ );
42333
+ return /* @__PURE__ */ jsxRuntime.jsx(
42334
+ ToggleGroupValueProvider,
42335
+ {
42336
+ scope: props.__scopeToggleGroup,
42337
+ type: "multiple",
42338
+ value,
42339
+ onItemActivate: handleButtonActivate,
42340
+ onItemDeactivate: handleButtonDeactivate,
42341
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupImpl, { ...toggleGroupMultipleProps, ref: forwardedRef })
42342
+ }
42343
+ );
42344
+ });
42345
+ ToggleGroup.displayName = TOGGLE_GROUP_NAME;
42346
+ var [ToggleGroupContext, useToggleGroupContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
42347
+ var ToggleGroupImpl = React54__namespace.default.forwardRef(
42348
+ (props, forwardedRef) => {
42349
+ const {
42350
+ __scopeToggleGroup,
42351
+ disabled = false,
42352
+ rovingFocus = true,
42353
+ orientation,
42354
+ dir,
42355
+ loop = true,
42356
+ ...toggleGroupProps
42357
+ } = props;
42358
+ const rovingFocusGroupScope = useRovingFocusGroupScope2(__scopeToggleGroup);
42359
+ const direction = useDirection(dir);
42360
+ const commonProps = { role: "group", dir: direction, ...toggleGroupProps };
42361
+ return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupContext, { scope: __scopeToggleGroup, rovingFocus, disabled, children: rovingFocus ? /* @__PURE__ */ jsxRuntime.jsx(
42362
+ Root6,
42363
+ {
42364
+ asChild: true,
42365
+ ...rovingFocusGroupScope,
42366
+ orientation,
42367
+ dir: direction,
42368
+ loop,
42369
+ children: /* @__PURE__ */ jsxRuntime.jsx(Primitive16.div, { ...commonProps, ref: forwardedRef })
42370
+ }
42371
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Primitive16.div, { ...commonProps, ref: forwardedRef }) });
42372
+ }
42373
+ );
42374
+ var ITEM_NAME4 = "ToggleGroupItem";
42375
+ var ToggleGroupItem = React54__namespace.default.forwardRef(
42376
+ (props, forwardedRef) => {
42377
+ const valueContext = useToggleGroupValueContext(ITEM_NAME4, props.__scopeToggleGroup);
42378
+ const context = useToggleGroupContext(ITEM_NAME4, props.__scopeToggleGroup);
42379
+ const rovingFocusGroupScope = useRovingFocusGroupScope2(props.__scopeToggleGroup);
42380
+ const pressed = valueContext.value.includes(props.value);
42381
+ const disabled = context.disabled || props.disabled;
42382
+ const commonProps = { ...props, pressed, disabled };
42383
+ const ref = React54__namespace.default.useRef(null);
42384
+ return context.rovingFocus ? /* @__PURE__ */ jsxRuntime.jsx(
42385
+ Item2,
42386
+ {
42387
+ asChild: true,
42388
+ ...rovingFocusGroupScope,
42389
+ focusable: !disabled,
42390
+ active: pressed,
42391
+ ref,
42392
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef })
42393
+ }
42394
+ ) : /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef });
42395
+ }
42396
+ );
42397
+ ToggleGroupItem.displayName = ITEM_NAME4;
42398
+ var ToggleGroupItemImpl = React54__namespace.default.forwardRef(
42399
+ (props, forwardedRef) => {
42400
+ const { __scopeToggleGroup, value, ...itemProps } = props;
42401
+ const valueContext = useToggleGroupValueContext(ITEM_NAME4, __scopeToggleGroup);
42402
+ const singleProps = { role: "radio", "aria-checked": props.pressed, "aria-pressed": void 0 };
42403
+ const typeProps = valueContext.type === "single" ? singleProps : void 0;
42404
+ return /* @__PURE__ */ jsxRuntime.jsx(
42405
+ Toggle,
42406
+ {
42407
+ ...typeProps,
42408
+ ...itemProps,
42409
+ ref: forwardedRef,
42410
+ onPressedChange: (pressed) => {
42411
+ if (pressed) {
42412
+ valueContext.onItemActivate(value);
42413
+ } else {
42414
+ valueContext.onItemDeactivate(value);
42415
+ }
42416
+ }
42417
+ }
42418
+ );
42419
+ }
42420
+ );
42421
+ var Root25 = ToggleGroup;
42422
+ var Item23 = ToggleGroupItem;
42423
+ var toggleVariants = cva(
42424
+ "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",
42425
+ {
42426
+ variants: {
42427
+ variant: {
42428
+ default: "bg-transparent",
42429
+ outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
42430
+ },
42431
+ size: {
42432
+ default: "h-9 px-2 min-w-9",
42433
+ sm: "h-8 px-1.5 min-w-8",
42434
+ lg: "h-10 px-2.5 min-w-10"
42435
+ }
42436
+ },
42437
+ defaultVariants: {
42438
+ variant: "default",
42439
+ size: "default"
42440
+ }
42441
+ }
42442
+ );
42443
+ var ToggleGroupContext2 = React54__namespace.createContext({
42444
+ size: "default",
42445
+ variant: "default",
42446
+ spacing: 0
42447
+ });
42448
+ function ToggleGroup2({
42449
+ className,
42450
+ variant,
42451
+ size: size4,
42452
+ spacing = 0,
42453
+ children,
42454
+ ...props
42455
+ }) {
42456
+ return /* @__PURE__ */ jsxRuntime.jsx(
42457
+ Root25,
42458
+ {
42459
+ "data-slot": "toggle-group",
42460
+ "data-variant": variant,
42461
+ "data-size": size4,
42462
+ "data-spacing": spacing,
42463
+ style: { "--gap": spacing },
42464
+ className: cn(
42465
+ "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",
42466
+ className
42467
+ ),
42468
+ ...props,
42469
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupContext2.Provider, { value: { variant, size: size4, spacing }, children })
42470
+ }
42471
+ );
42472
+ }
42473
+ function ToggleGroupItem2({
42474
+ className,
42475
+ children,
42476
+ variant,
42477
+ size: size4,
42478
+ ...props
42479
+ }) {
42480
+ const context = React54__namespace.useContext(ToggleGroupContext2);
42481
+ return /* @__PURE__ */ jsxRuntime.jsx(
42482
+ Item23,
42483
+ {
42484
+ "data-slot": "toggle-group-item",
42485
+ "data-variant": context.variant || variant,
42486
+ "data-size": context.size || size4,
42487
+ "data-spacing": context.spacing,
42488
+ className: cn(
42489
+ toggleVariants({
42490
+ variant: context.variant || variant,
42491
+ size: context.size || size4
42492
+ }),
42493
+ "w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10",
42494
+ "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",
42495
+ className
42496
+ ),
42497
+ ...props,
42498
+ children
42499
+ }
42500
+ );
42501
+ }
42502
+ // @__NO_SIDE_EFFECTS__
42503
+ function createSlot20(ownerName) {
42504
+ const SlotClone = /* @__PURE__ */ createSlotClone20(ownerName);
42505
+ const Slot22 = React54__namespace.forwardRef((props, forwardedRef) => {
42506
+ const { children, ...slotProps } = props;
42507
+ const childrenArray = React54__namespace.Children.toArray(children);
42508
+ const slottable = childrenArray.find(isSlottable20);
42509
+ if (slottable) {
42510
+ const newElement = slottable.props.children;
42511
+ const newChildren = childrenArray.map((child) => {
42512
+ if (child === slottable) {
42513
+ if (React54__namespace.Children.count(newElement) > 1) return React54__namespace.Children.only(null);
42514
+ return React54__namespace.isValidElement(newElement) ? newElement.props.children : null;
42515
+ } else {
42516
+ return child;
42517
+ }
42518
+ });
42519
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54__namespace.isValidElement(newElement) ? React54__namespace.cloneElement(newElement, void 0, newChildren) : null });
42520
+ }
42521
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
42522
+ });
42523
+ Slot22.displayName = `${ownerName}.Slot`;
42524
+ return Slot22;
42525
+ }
42526
+ // @__NO_SIDE_EFFECTS__
42527
+ function createSlotClone20(ownerName) {
42528
+ const SlotClone = React54__namespace.forwardRef((props, forwardedRef) => {
42529
+ const { children, ...slotProps } = props;
42530
+ if (React54__namespace.isValidElement(children)) {
42531
+ const childrenRef = getElementRef21(children);
42532
+ const props2 = mergeProps20(slotProps, children.props);
42533
+ if (children.type !== React54__namespace.Fragment) {
42534
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
42535
+ }
42536
+ return React54__namespace.cloneElement(children, props2);
42537
+ }
42538
+ return React54__namespace.Children.count(children) > 1 ? React54__namespace.Children.only(null) : null;
42539
+ });
42540
+ SlotClone.displayName = `${ownerName}.SlotClone`;
42541
+ return SlotClone;
42542
+ }
42543
+ var SLOTTABLE_IDENTIFIER20 = /* @__PURE__ */ Symbol("radix.slottable");
42544
+ // @__NO_SIDE_EFFECTS__
42545
+ function createSlottable(ownerName) {
42546
+ const Slottable2 = ({ children }) => {
42547
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
42548
+ };
42549
+ Slottable2.displayName = `${ownerName}.Slottable`;
42550
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER20;
42551
+ return Slottable2;
42552
+ }
42553
+ function isSlottable20(child) {
42554
+ return React54__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER20;
42555
+ }
42556
+ function mergeProps20(slotProps, childProps) {
42557
+ const overrideProps = { ...childProps };
42558
+ for (const propName in childProps) {
42559
+ const slotPropValue = slotProps[propName];
42560
+ const childPropValue = childProps[propName];
42561
+ const isHandler = /^on[A-Z]/.test(propName);
42562
+ if (isHandler) {
42563
+ if (slotPropValue && childPropValue) {
42564
+ overrideProps[propName] = (...args) => {
42565
+ const result = childPropValue(...args);
42566
+ slotPropValue(...args);
42567
+ return result;
42568
+ };
42569
+ } else if (slotPropValue) {
42570
+ overrideProps[propName] = slotPropValue;
42571
+ }
42572
+ } else if (propName === "style") {
42573
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
42574
+ } else if (propName === "className") {
42575
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
42576
+ }
42577
+ }
42578
+ return { ...slotProps, ...overrideProps };
42579
+ }
42580
+ function getElementRef21(element) {
42581
+ var _a, _b;
42582
+ let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
42583
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42584
+ if (mayWarn) {
42585
+ return element.ref;
42586
+ }
42587
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
42588
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
42589
+ if (mayWarn) {
42590
+ return element.props.ref;
42591
+ }
42592
+ return element.props.ref || element.ref;
42593
+ }
42594
+ var NODES18 = [
42595
+ "a",
42596
+ "button",
42597
+ "div",
42598
+ "form",
42599
+ "h2",
42600
+ "h3",
42601
+ "img",
42602
+ "input",
42603
+ "label",
42604
+ "li",
42605
+ "nav",
42606
+ "ol",
42607
+ "p",
42608
+ "select",
42609
+ "span",
42610
+ "svg",
42611
+ "ul"
42612
+ ];
42613
+ var Primitive18 = NODES18.reduce((primitive, node) => {
42614
+ const Slot5 = createSlot20(`Primitive.${node}`);
42615
+ const Node2 = React54__namespace.forwardRef((props, forwardedRef) => {
42616
+ const { asChild, ...primitiveProps } = props;
42617
+ const Comp = asChild ? Slot5 : node;
42618
+ if (typeof window !== "undefined") {
42619
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
42620
+ }
42621
+ return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
42622
+ });
42623
+ Node2.displayName = `Primitive.${node}`;
42624
+ return { ...primitive, [node]: Node2 };
42625
+ }, {});
42626
+ var [createTooltipContext] = createContextScope("Tooltip", [
42627
+ createPopperScope
42628
+ ]);
42629
+ var usePopperScope3 = createPopperScope();
42630
+ var PROVIDER_NAME = "TooltipProvider";
42631
+ var DEFAULT_DELAY_DURATION = 700;
42632
+ var TOOLTIP_OPEN = "tooltip.open";
42633
+ var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
42634
+ var TooltipProvider = (props) => {
42635
+ const {
42636
+ __scopeTooltip,
42637
+ delayDuration = DEFAULT_DELAY_DURATION,
42638
+ skipDelayDuration = 300,
42639
+ disableHoverableContent = false,
42640
+ children
42641
+ } = props;
42642
+ const isOpenDelayedRef = React54__namespace.useRef(true);
42643
+ const isPointerInTransitRef = React54__namespace.useRef(false);
42644
+ const skipDelayTimerRef = React54__namespace.useRef(0);
42645
+ React54__namespace.useEffect(() => {
42646
+ const skipDelayTimer = skipDelayTimerRef.current;
42647
+ return () => window.clearTimeout(skipDelayTimer);
42648
+ }, []);
42649
+ return /* @__PURE__ */ jsxRuntime.jsx(
42650
+ TooltipProviderContextProvider,
42651
+ {
42652
+ scope: __scopeTooltip,
42653
+ isOpenDelayedRef,
42654
+ delayDuration,
42655
+ onOpen: React54__namespace.useCallback(() => {
42656
+ window.clearTimeout(skipDelayTimerRef.current);
42657
+ isOpenDelayedRef.current = false;
42658
+ }, []),
42659
+ onClose: React54__namespace.useCallback(() => {
42660
+ window.clearTimeout(skipDelayTimerRef.current);
42661
+ skipDelayTimerRef.current = window.setTimeout(
42662
+ () => isOpenDelayedRef.current = true,
42663
+ skipDelayDuration
42664
+ );
42665
+ }, [skipDelayDuration]),
42666
+ isPointerInTransitRef,
42667
+ onPointerInTransitChange: React54__namespace.useCallback((inTransit) => {
42668
+ isPointerInTransitRef.current = inTransit;
42669
+ }, []),
42670
+ disableHoverableContent,
42671
+ children
42672
+ }
42673
+ );
42674
+ };
42675
+ TooltipProvider.displayName = PROVIDER_NAME;
42676
+ var TOOLTIP_NAME = "Tooltip";
42677
+ var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
42678
+ var Tooltip = (props) => {
42679
+ const {
42680
+ __scopeTooltip,
42681
+ children,
42682
+ open: openProp,
42683
+ defaultOpen,
42684
+ onOpenChange,
42685
+ disableHoverableContent: disableHoverableContentProp,
42686
+ delayDuration: delayDurationProp
42687
+ } = props;
42688
+ const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
42689
+ const popperScope = usePopperScope3(__scopeTooltip);
42690
+ const [trigger, setTrigger] = React54__namespace.useState(null);
42691
+ const contentId = useId3();
42692
+ const openTimerRef = React54__namespace.useRef(0);
42693
+ const disableHoverableContent = disableHoverableContentProp != null ? disableHoverableContentProp : providerContext.disableHoverableContent;
42694
+ const delayDuration = delayDurationProp != null ? delayDurationProp : providerContext.delayDuration;
42695
+ const wasOpenDelayedRef = React54__namespace.useRef(false);
42696
+ const [open, setOpen] = useControllableState({
42697
+ prop: openProp,
42698
+ defaultProp: defaultOpen != null ? defaultOpen : false,
42699
+ onChange: (open2) => {
42700
+ if (open2) {
42701
+ providerContext.onOpen();
42702
+ document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
42703
+ } else {
42704
+ providerContext.onClose();
42705
+ }
42706
+ onOpenChange == null ? void 0 : onOpenChange(open2);
42707
+ },
42708
+ caller: TOOLTIP_NAME
42709
+ });
42710
+ const stateAttribute = React54__namespace.useMemo(() => {
42711
+ return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
42712
+ }, [open]);
42713
+ const handleOpen = React54__namespace.useCallback(() => {
42714
+ window.clearTimeout(openTimerRef.current);
42715
+ openTimerRef.current = 0;
42716
+ wasOpenDelayedRef.current = false;
42717
+ setOpen(true);
42718
+ }, [setOpen]);
42719
+ const handleClose = React54__namespace.useCallback(() => {
42720
+ window.clearTimeout(openTimerRef.current);
42721
+ openTimerRef.current = 0;
42722
+ setOpen(false);
42723
+ }, [setOpen]);
42724
+ const handleDelayedOpen = React54__namespace.useCallback(() => {
42725
+ window.clearTimeout(openTimerRef.current);
42726
+ openTimerRef.current = window.setTimeout(() => {
42727
+ wasOpenDelayedRef.current = true;
42728
+ setOpen(true);
42729
+ openTimerRef.current = 0;
42730
+ }, delayDuration);
42731
+ }, [delayDuration, setOpen]);
42732
+ React54__namespace.useEffect(() => {
42733
+ return () => {
42734
+ if (openTimerRef.current) {
42735
+ window.clearTimeout(openTimerRef.current);
42736
+ openTimerRef.current = 0;
42737
+ }
42738
+ };
42739
+ }, []);
42740
+ return /* @__PURE__ */ jsxRuntime.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
42741
+ TooltipContextProvider,
42742
+ {
42743
+ scope: __scopeTooltip,
42744
+ contentId,
42745
+ open,
42746
+ stateAttribute,
42747
+ trigger,
42748
+ onTriggerChange: setTrigger,
42749
+ onTriggerEnter: React54__namespace.useCallback(() => {
42750
+ if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
42751
+ else handleOpen();
42752
+ }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
42753
+ onTriggerLeave: React54__namespace.useCallback(() => {
42754
+ if (disableHoverableContent) {
42755
+ handleClose();
42756
+ } else {
42757
+ window.clearTimeout(openTimerRef.current);
42758
+ openTimerRef.current = 0;
42759
+ }
42760
+ }, [handleClose, disableHoverableContent]),
42761
+ onOpen: handleOpen,
42762
+ onClose: handleClose,
42763
+ disableHoverableContent,
42764
+ children
42765
+ }
42766
+ ) });
42767
+ };
42768
+ Tooltip.displayName = TOOLTIP_NAME;
42769
+ var TRIGGER_NAME5 = "TooltipTrigger";
42770
+ var TooltipTrigger = React54__namespace.forwardRef(
42771
+ (props, forwardedRef) => {
42772
+ const { __scopeTooltip, ...triggerProps } = props;
42773
+ const context = useTooltipContext(TRIGGER_NAME5, __scopeTooltip);
42774
+ const providerContext = useTooltipProviderContext(TRIGGER_NAME5, __scopeTooltip);
42775
+ const popperScope = usePopperScope3(__scopeTooltip);
42776
+ const ref = React54__namespace.useRef(null);
42777
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
42778
+ const isPointerDownRef = React54__namespace.useRef(false);
42779
+ const hasPointerMoveOpenedRef = React54__namespace.useRef(false);
42780
+ const handlePointerUp = React54__namespace.useCallback(() => isPointerDownRef.current = false, []);
42781
+ React54__namespace.useEffect(() => {
42782
+ return () => document.removeEventListener("pointerup", handlePointerUp);
42783
+ }, [handlePointerUp]);
42784
+ return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
42785
+ Primitive18.button,
42786
+ {
42787
+ "aria-describedby": context.open ? context.contentId : void 0,
42788
+ "data-state": context.stateAttribute,
42789
+ ...triggerProps,
42790
+ ref: composedRefs,
42791
+ onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
42792
+ if (event.pointerType === "touch") return;
42793
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
42794
+ context.onTriggerEnter();
42795
+ hasPointerMoveOpenedRef.current = true;
42796
+ }
42797
+ }),
42798
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
42799
+ context.onTriggerLeave();
42800
+ hasPointerMoveOpenedRef.current = false;
42801
+ }),
42802
+ onPointerDown: composeEventHandlers(props.onPointerDown, () => {
42803
+ if (context.open) {
42804
+ context.onClose();
42805
+ }
42806
+ isPointerDownRef.current = true;
42807
+ document.addEventListener("pointerup", handlePointerUp, { once: true });
42808
+ }),
42809
+ onFocus: composeEventHandlers(props.onFocus, () => {
42810
+ if (!isPointerDownRef.current) context.onOpen();
42811
+ }),
42812
+ onBlur: composeEventHandlers(props.onBlur, context.onClose),
42813
+ onClick: composeEventHandlers(props.onClick, context.onClose)
42814
+ }
42815
+ ) });
42816
+ }
42817
+ );
42818
+ TooltipTrigger.displayName = TRIGGER_NAME5;
42819
+ var PORTAL_NAME5 = "TooltipPortal";
42820
+ var [PortalProvider3, usePortalContext3] = createTooltipContext(PORTAL_NAME5, {
42821
+ forceMount: void 0
42822
+ });
42823
+ var TooltipPortal = (props) => {
42824
+ const { __scopeTooltip, forceMount, children, container } = props;
42825
+ const context = useTooltipContext(PORTAL_NAME5, __scopeTooltip);
42826
+ return /* @__PURE__ */ jsxRuntime.jsx(PortalProvider3, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(Portal, { asChild: true, container, children }) }) });
42827
+ };
42828
+ TooltipPortal.displayName = PORTAL_NAME5;
42829
+ var CONTENT_NAME5 = "TooltipContent";
42830
+ var TooltipContent = React54__namespace.forwardRef(
42831
+ (props, forwardedRef) => {
42832
+ const portalContext = usePortalContext3(CONTENT_NAME5, props.__scopeTooltip);
42833
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
42834
+ const context = useTooltipContext(CONTENT_NAME5, props.__scopeTooltip);
42835
+ return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
42836
+ }
42837
+ );
42838
+ var TooltipContentHoverable = React54__namespace.forwardRef((props, forwardedRef) => {
42839
+ const context = useTooltipContext(CONTENT_NAME5, props.__scopeTooltip);
42840
+ const providerContext = useTooltipProviderContext(CONTENT_NAME5, props.__scopeTooltip);
42841
+ const ref = React54__namespace.useRef(null);
42842
+ const composedRefs = useComposedRefs(forwardedRef, ref);
42843
+ const [pointerGraceArea, setPointerGraceArea] = React54__namespace.useState(null);
42844
+ const { trigger, onClose } = context;
42845
+ const content = ref.current;
42846
+ const { onPointerInTransitChange } = providerContext;
42847
+ const handleRemoveGraceArea = React54__namespace.useCallback(() => {
42848
+ setPointerGraceArea(null);
42849
+ onPointerInTransitChange(false);
42850
+ }, [onPointerInTransitChange]);
42851
+ const handleCreateGraceArea = React54__namespace.useCallback(
42852
+ (event, hoverTarget) => {
42853
+ const currentTarget = event.currentTarget;
42854
+ const exitPoint = { x: event.clientX, y: event.clientY };
42855
+ const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
42856
+ const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
42857
+ const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
42858
+ const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
42859
+ setPointerGraceArea(graceArea);
42860
+ onPointerInTransitChange(true);
42861
+ },
42862
+ [onPointerInTransitChange]
42863
+ );
42864
+ React54__namespace.useEffect(() => {
42865
+ return () => handleRemoveGraceArea();
42866
+ }, [handleRemoveGraceArea]);
42867
+ React54__namespace.useEffect(() => {
42868
+ if (trigger && content) {
42869
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
42870
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
42871
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
42872
+ content.addEventListener("pointerleave", handleContentLeave);
42873
+ return () => {
42874
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
42875
+ content.removeEventListener("pointerleave", handleContentLeave);
42876
+ };
42877
+ }
42878
+ }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
42879
+ React54__namespace.useEffect(() => {
42880
+ if (pointerGraceArea) {
42881
+ const handleTrackPointerGrace = (event) => {
42882
+ const target = event.target;
42883
+ const pointerPosition = { x: event.clientX, y: event.clientY };
42884
+ const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target)) || (content == null ? void 0 : content.contains(target));
42885
+ const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
42886
+ if (hasEnteredTarget) {
42887
+ handleRemoveGraceArea();
42888
+ } else if (isPointerOutsideGraceArea) {
42889
+ handleRemoveGraceArea();
42890
+ onClose();
42891
+ }
42892
+ };
42893
+ document.addEventListener("pointermove", handleTrackPointerGrace);
42894
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
42895
+ }
42896
+ }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
42897
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
42898
+ });
42899
+ var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
42900
+ var Slottable = createSlottable("TooltipContent");
42901
+ var TooltipContentImpl = React54__namespace.forwardRef(
42902
+ (props, forwardedRef) => {
42903
+ const {
42904
+ __scopeTooltip,
42905
+ children,
42906
+ "aria-label": ariaLabel,
42907
+ onEscapeKeyDown,
42908
+ onPointerDownOutside,
42909
+ ...contentProps
42910
+ } = props;
42911
+ const context = useTooltipContext(CONTENT_NAME5, __scopeTooltip);
42912
+ const popperScope = usePopperScope3(__scopeTooltip);
42913
+ const { onClose } = context;
42914
+ React54__namespace.useEffect(() => {
42915
+ document.addEventListener(TOOLTIP_OPEN, onClose);
42916
+ return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
42917
+ }, [onClose]);
42918
+ React54__namespace.useEffect(() => {
42919
+ if (context.trigger) {
42920
+ const handleScroll2 = (event) => {
42921
+ const target = event.target;
42922
+ if (target == null ? void 0 : target.contains(context.trigger)) onClose();
42923
+ };
42924
+ window.addEventListener("scroll", handleScroll2, { capture: true });
42925
+ return () => window.removeEventListener("scroll", handleScroll2, { capture: true });
42926
+ }
42927
+ }, [context.trigger, onClose]);
42928
+ return /* @__PURE__ */ jsxRuntime.jsx(
42929
+ DismissableLayer,
42930
+ {
42931
+ asChild: true,
42932
+ disableOutsidePointerEvents: false,
42933
+ onEscapeKeyDown,
42934
+ onPointerDownOutside,
42935
+ onFocusOutside: (event) => event.preventDefault(),
42936
+ onDismiss: onClose,
42937
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
42938
+ Content,
42939
+ {
42940
+ "data-state": context.stateAttribute,
42941
+ ...popperScope,
42942
+ ...contentProps,
42943
+ ref: forwardedRef,
42944
+ style: {
42945
+ ...contentProps.style,
42946
+ // re-namespace exposed content custom properties
42947
+ ...{
42948
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
42949
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
42950
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
42951
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
42952
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
42953
+ }
42954
+ },
42955
+ children: [
42956
+ /* @__PURE__ */ jsxRuntime.jsx(Slottable, { children }),
42957
+ /* @__PURE__ */ jsxRuntime.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntime.jsx(Root3, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
42958
+ ]
42959
+ }
42960
+ )
42961
+ }
42962
+ );
42963
+ }
42964
+ );
42965
+ TooltipContent.displayName = CONTENT_NAME5;
42966
+ var ARROW_NAME4 = "TooltipArrow";
42967
+ var TooltipArrow = React54__namespace.forwardRef(
42968
+ (props, forwardedRef) => {
42969
+ const { __scopeTooltip, ...arrowProps } = props;
42970
+ const popperScope = usePopperScope3(__scopeTooltip);
42971
+ const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
42972
+ ARROW_NAME4,
42973
+ __scopeTooltip
42974
+ );
42975
+ return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntime.jsx(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
42976
+ }
42977
+ );
42978
+ TooltipArrow.displayName = ARROW_NAME4;
42979
+ function getExitSideFromRect(point, rect) {
42980
+ const top = Math.abs(rect.top - point.y);
42981
+ const bottom = Math.abs(rect.bottom - point.y);
42982
+ const right = Math.abs(rect.right - point.x);
42983
+ const left = Math.abs(rect.left - point.x);
42984
+ switch (Math.min(top, bottom, right, left)) {
42985
+ case left:
42986
+ return "left";
42987
+ case right:
42988
+ return "right";
42989
+ case top:
42990
+ return "top";
42991
+ case bottom:
42992
+ return "bottom";
42993
+ default:
42994
+ throw new Error("unreachable");
42995
+ }
42996
+ }
42997
+ function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
42998
+ const paddedExitPoints = [];
42999
+ switch (exitSide) {
43000
+ case "top":
43001
+ paddedExitPoints.push(
43002
+ { x: exitPoint.x - padding, y: exitPoint.y + padding },
43003
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
43004
+ );
43005
+ break;
43006
+ case "bottom":
43007
+ paddedExitPoints.push(
43008
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
43009
+ { x: exitPoint.x + padding, y: exitPoint.y - padding }
43010
+ );
43011
+ break;
43012
+ case "left":
43013
+ paddedExitPoints.push(
43014
+ { x: exitPoint.x + padding, y: exitPoint.y - padding },
43015
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
43016
+ );
43017
+ break;
43018
+ case "right":
43019
+ paddedExitPoints.push(
43020
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
43021
+ { x: exitPoint.x - padding, y: exitPoint.y + padding }
43022
+ );
43023
+ break;
43024
+ }
43025
+ return paddedExitPoints;
43026
+ }
43027
+ function getPointsFromRect(rect) {
43028
+ const { top, right, bottom, left } = rect;
43029
+ return [
43030
+ { x: left, y: top },
43031
+ { x: right, y: top },
43032
+ { x: right, y: bottom },
43033
+ { x: left, y: bottom }
43034
+ ];
43035
+ }
43036
+ function isPointInPolygon(point, polygon) {
43037
+ const { x, y } = point;
43038
+ let inside = false;
43039
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
43040
+ const ii = polygon[i];
43041
+ const jj = polygon[j];
43042
+ const xi = ii.x;
43043
+ const yi = ii.y;
43044
+ const xj = jj.x;
43045
+ const yj = jj.y;
43046
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
43047
+ if (intersect) inside = !inside;
43048
+ }
43049
+ return inside;
43050
+ }
43051
+ function getHull(points) {
43052
+ const newPoints = points.slice();
43053
+ newPoints.sort((a, b) => {
43054
+ if (a.x < b.x) return -1;
43055
+ else if (a.x > b.x) return 1;
43056
+ else if (a.y < b.y) return -1;
43057
+ else if (a.y > b.y) return 1;
43058
+ else return 0;
43059
+ });
43060
+ return getHullPresorted(newPoints);
43061
+ }
43062
+ function getHullPresorted(points) {
43063
+ if (points.length <= 1) return points.slice();
43064
+ const upperHull = [];
43065
+ for (let i = 0; i < points.length; i++) {
43066
+ const p = points[i];
43067
+ while (upperHull.length >= 2) {
43068
+ const q = upperHull[upperHull.length - 1];
43069
+ const r2 = upperHull[upperHull.length - 2];
43070
+ if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) upperHull.pop();
43071
+ else break;
43072
+ }
43073
+ upperHull.push(p);
43074
+ }
43075
+ upperHull.pop();
43076
+ const lowerHull = [];
43077
+ for (let i = points.length - 1; i >= 0; i--) {
43078
+ const p = points[i];
43079
+ while (lowerHull.length >= 2) {
43080
+ const q = lowerHull[lowerHull.length - 1];
43081
+ const r2 = lowerHull[lowerHull.length - 2];
43082
+ if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) lowerHull.pop();
43083
+ else break;
43084
+ }
43085
+ lowerHull.push(p);
43086
+ }
43087
+ lowerHull.pop();
43088
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
43089
+ return upperHull;
43090
+ } else {
43091
+ return upperHull.concat(lowerHull);
43092
+ }
43093
+ }
43094
+ var Provider = TooltipProvider;
43095
+ var Root32 = Tooltip;
43096
+ var Trigger4 = TooltipTrigger;
43097
+ var Portal5 = TooltipPortal;
43098
+ var Content23 = TooltipContent;
43099
+ var Arrow22 = TooltipArrow;
43100
+ function TooltipProvider2({
43101
+ delayDuration = 0,
43102
+ ...props
43103
+ }) {
43104
+ return /* @__PURE__ */ jsxRuntime.jsx(
43105
+ Provider,
43106
+ {
43107
+ "data-slot": "tooltip-provider",
43108
+ delayDuration,
43109
+ ...props
43110
+ }
43111
+ );
43112
+ }
43113
+ function Tooltip2({
43114
+ ...props
43115
+ }) {
43116
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider2, { children: /* @__PURE__ */ jsxRuntime.jsx(Root32, { "data-slot": "tooltip", ...props }) });
43117
+ }
43118
+ function TooltipTrigger2({
43119
+ ...props
43120
+ }) {
43121
+ return /* @__PURE__ */ jsxRuntime.jsx(Trigger4, { "data-slot": "tooltip-trigger", ...props });
43122
+ }
43123
+ function TooltipContent2({
43124
+ className,
43125
+ sideOffset = 0,
43126
+ children,
43127
+ ...props
43128
+ }) {
43129
+ return /* @__PURE__ */ jsxRuntime.jsx(Portal5, { children: /* @__PURE__ */ jsxRuntime.jsxs(
43130
+ Content23,
43131
+ {
43132
+ "data-slot": "tooltip-content",
43133
+ sideOffset,
43134
+ className: cn(
43135
+ "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",
43136
+ className
43137
+ ),
43138
+ ...props,
43139
+ children: [
43140
+ children,
43141
+ /* @__PURE__ */ jsxRuntime.jsx(Arrow22, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
43142
+ ]
43143
+ }
43144
+ ) });
43145
+ }
43146
+ function mapSizeToToggleSize(size4) {
43147
+ switch (size4) {
43148
+ case "sm":
43149
+ return "sm";
43150
+ case "lg":
43151
+ return "lg";
43152
+ case "md":
43153
+ default:
43154
+ return "default";
43155
+ }
43156
+ }
43157
+ function normalizeValue(val, multiple) {
43158
+ if (multiple) {
43159
+ if (Array.isArray(val)) return val;
43160
+ if (typeof val === "string") return [val];
43161
+ return [];
43162
+ }
43163
+ if (Array.isArray(val)) return val[0] || "";
43164
+ return val || "";
43165
+ }
43166
+ function capitalizeFirst6(label) {
43167
+ if (!label) return label;
43168
+ return label.charAt(0).toUpperCase() + label.slice(1);
43169
+ }
43170
+ function normalizeOption(input, {
43171
+ optionValue,
43172
+ optionLabel,
43173
+ optionIcon,
43174
+ optionDisabled,
43175
+ optionTooltip,
43176
+ optionMeta
43177
+ }, autoCap) {
43178
+ var _a, _b, _c, _d, _e, _f;
43179
+ const anyInput = input;
43180
+ if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
43181
+ const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
43182
+ const value2 = String(rawValue);
43183
+ let label2;
43184
+ if (optionLabel != null) {
43185
+ label2 = anyInput[optionLabel];
43186
+ } else if (anyInput.label != null) {
43187
+ label2 = anyInput.label;
43188
+ } else {
43189
+ label2 = String(rawValue != null ? rawValue : value2);
43190
+ }
43191
+ if (autoCap && typeof label2 === "string") {
43192
+ label2 = capitalizeFirst6(label2);
43193
+ }
43194
+ const icon = optionIcon != null ? anyInput[optionIcon] : (_b = anyInput.icon) != null ? _b : void 0;
43195
+ const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
43196
+ const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
43197
+ const meta = optionMeta != null ? anyInput[optionMeta] : (_d = anyInput.meta) != null ? _d : void 0;
43198
+ return {
43199
+ ui: {
43200
+ value: value2,
43201
+ label: label2,
43202
+ icon,
43203
+ disabled,
43204
+ tooltip,
43205
+ meta
43206
+ },
43207
+ raw: input
43208
+ };
43209
+ }
43210
+ if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
43211
+ const value2 = String(input);
43212
+ let label2 = value2;
43213
+ if (autoCap && typeof label2 === "string") {
43214
+ label2 = capitalizeFirst6(label2);
43215
+ }
43216
+ return {
43217
+ ui: {
43218
+ value: value2,
43219
+ label: label2
43220
+ },
43221
+ raw: input
43222
+ };
43223
+ }
43224
+ const baseValue = (_f = anyInput.value) != null ? _f : String((_e = anyInput.label) != null ? _e : "");
43225
+ const value = String(baseValue);
43226
+ let label = anyInput.label != null ? anyInput.label : String(value);
43227
+ if (autoCap && typeof label === "string") {
43228
+ label = capitalizeFirst6(label);
43229
+ }
43230
+ return {
43231
+ ui: {
43232
+ value,
43233
+ label,
43234
+ icon: anyInput.icon,
43235
+ disabled: !!anyInput.disabled,
43236
+ tooltip: anyInput.tooltip,
43237
+ meta: anyInput.meta
43238
+ },
43239
+ raw: input
43240
+ };
43241
+ }
43242
+ var ShadcnToggleVariant3 = React54__namespace.forwardRef(function ShadcnToggleVariant4(props, ref) {
43243
+ const {
43244
+ value,
43245
+ onValue,
43246
+ disabled,
43247
+ readOnly,
43248
+ error,
43249
+ size: size4 = "md",
43250
+ options = [],
43251
+ multiple = false,
43252
+ variant = "default",
43253
+ layout = "horizontal",
43254
+ gridCols = 2,
43255
+ fillWidth: fullWidth = false,
43256
+ optionValue,
43257
+ optionLabel,
43258
+ optionIcon,
43259
+ optionDisabled,
43260
+ optionTooltip,
43261
+ optionMeta,
43262
+ renderOption,
43263
+ className,
43264
+ itemClassName,
43265
+ activeClassName,
43266
+ autoCap = false,
43267
+ gap: itemGapPx
43268
+ } = props;
43269
+ const isDisabled = !!disabled || !!readOnly;
43270
+ const toggleSize = mapSizeToToggleSize(size4);
43271
+ const currentValue = normalizeValue(value, multiple);
43272
+ const normalizedOptions = React54__namespace.useMemo(
43273
+ () => options.map(
43274
+ (opt) => normalizeOption(
43275
+ opt,
43276
+ {
43277
+ optionValue,
43278
+ optionLabel,
43279
+ optionIcon,
43280
+ optionDisabled,
43281
+ optionTooltip,
43282
+ optionMeta
43283
+ },
43284
+ autoCap
43285
+ )
43286
+ ),
43287
+ [
43288
+ options,
43289
+ optionValue,
43290
+ optionLabel,
43291
+ optionIcon,
43292
+ optionDisabled,
43293
+ optionTooltip,
43294
+ optionMeta,
43295
+ autoCap
43296
+ ]
43297
+ );
43298
+ const handleChange = React54__namespace.useCallback(
43299
+ (val) => {
43300
+ if (readOnly) return;
43301
+ if (!onValue) return;
43302
+ let rawSelection;
43303
+ if (Array.isArray(val)) {
43304
+ const selected = normalizedOptions.filter(
43305
+ (entry) => val.includes(entry.ui.value)
43306
+ );
43307
+ rawSelection = selected.map((entry) => entry.raw);
43308
+ } else {
43309
+ const found = normalizedOptions.find(
43310
+ (entry) => entry.ui.value === val
43311
+ );
43312
+ rawSelection = found == null ? void 0 : found.raw;
43313
+ }
43314
+ const detail = {
43315
+ source: "variant",
43316
+ raw: rawSelection,
43317
+ // original item(s)
43318
+ nativeEvent: void 0,
43319
+ meta: { action: "toggle" }
43320
+ };
43321
+ onValue(val, detail);
43322
+ },
43323
+ [onValue, readOnly, normalizedOptions]
43324
+ );
43325
+ const layoutClasses = cn(
43326
+ layout === "horizontal" && "flex flex-wrap",
43327
+ layout === "vertical" && "flex flex-col items-stretch",
43328
+ layout === "grid" && "grid",
43329
+ fullWidth && "w-full",
43330
+ fullWidth && layout === "horizontal" && "[&>*]:flex-1",
43331
+ fullWidth && layout === "vertical" && "[&>*]:w-full",
43332
+ className
43333
+ );
43334
+ console.log(layoutClasses, fullWidth, autoCap);
43335
+ const groupStyle = React54__namespace.useMemo(() => {
43336
+ const style = {};
43337
+ if (layout === "grid") {
43338
+ style.gridTemplateColumns = `repeat(${gridCols}, minmax(0, 1fr))`;
43339
+ }
43340
+ if (typeof itemGapPx === "number") {
43341
+ style.gap = itemGapPx;
43342
+ }
43343
+ return Object.keys(style).length ? style : void 0;
43344
+ }, [layout, gridCols, itemGapPx]);
43345
+ return /* @__PURE__ */ jsxRuntime.jsx(
43346
+ ToggleGroup2,
43347
+ {
43348
+ ref,
43349
+ type: multiple ? "multiple" : "single",
43350
+ value: currentValue,
43351
+ onValueChange: handleChange,
43352
+ disabled: isDisabled,
43353
+ variant,
43354
+ size: toggleSize,
43355
+ className: layoutClasses,
43356
+ style: groupStyle,
43357
+ "aria-invalid": !!error,
43358
+ children: normalizedOptions.map(({ ui: opt }) => {
43359
+ const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
43360
+ const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 truncate", children: [
43361
+ opt.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: opt.icon }),
43362
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: opt.label })
43363
+ ] });
43364
+ const itemNode = /* @__PURE__ */ jsxRuntime.jsx(
43365
+ ToggleGroupItem2,
43366
+ {
43367
+ value: opt.value,
43368
+ disabled: opt.disabled,
43369
+ "aria-label": typeof opt.label === "string" ? opt.label : opt.value,
43370
+ className: cn(
43371
+ // Base Transitions
43372
+ "transition-all",
43373
+ // Default Active State (Shadcn defaults)
43374
+ "data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
43375
+ // Error State
43376
+ error && "border-destructive/50 hover:bg-destructive/10 data-[state=on]:bg-destructive data-[state=on]:text-destructive-foreground",
43377
+ // Variant: Outline specific tweaks
43378
+ variant === "outline" && layout === "horizontal" && !fullWidth && "first:rounded-l-md last:rounded-r-md rounded-none border-l-0 first:border-l",
43379
+ // Layout tweaks
43380
+ fullWidth && "justify-center",
43381
+ // Custom Item Class
43382
+ itemClassName,
43383
+ // Active Class Name (Applied only when selected)
43384
+ isSelected && activeClassName
43385
+ ),
43386
+ children: contentNode
43387
+ },
43388
+ opt.value
43389
+ );
43390
+ if (opt.tooltip && !isDisabled) {
43391
+ return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider2, { delayDuration: 300, children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
43392
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger2, { asChild: true, children: itemNode }),
43393
+ /* @__PURE__ */ jsxRuntime.jsx(TooltipContent2, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: opt.tooltip }) })
43394
+ ] }) }, opt.value);
43395
+ }
43396
+ return itemNode;
43397
+ })
43398
+ }
43399
+ );
43400
+ });
43401
+ ShadcnToggleVariant3.displayName = "ShadcnToggleVariant";
43402
+
43403
+ // src/variants/core/toggle-group.tsx
43404
+ var toggleGroupModule = {
43405
+ variant: "toggle-group",
43406
+ Variant: ShadcnToggleVariant3,
43407
+ meta: {
43408
+ label: "Toggle group",
43409
+ description: "Toggle group component buttons.",
43410
+ tags: ["buttons", "toggle"]
43411
+ }
43412
+ };
41978
43413
 
41979
43414
  // src/variants/index.ts
41980
43415
  var variants = [
@@ -41995,13 +43430,14 @@ var variants = [
41995
43430
  keyValueModule,
41996
43431
  custom_default,
41997
43432
  treeselect_default2,
41998
- fileManagerModule
43433
+ fileManagerModule,
43434
+ toggleGroupModule
41999
43435
  ];
42000
43436
  function registerCoreVariants() {
42001
43437
  variants.forEach((item) => registerVariant(item));
42002
43438
  }
42003
43439
  registerCoreVariants();
42004
- var NODES16 = [
43440
+ var NODES19 = [
42005
43441
  "a",
42006
43442
  "button",
42007
43443
  "div",
@@ -42020,7 +43456,7 @@ var NODES16 = [
42020
43456
  "svg",
42021
43457
  "ul"
42022
43458
  ];
42023
- var Primitive16 = NODES16.reduce((primitive, node) => {
43459
+ var Primitive19 = NODES19.reduce((primitive, node) => {
42024
43460
  const Slot5 = createSlot10(`Primitive.${node}`);
42025
43461
  const Node2 = React54__namespace.forwardRef((props, forwardedRef) => {
42026
43462
  const { asChild, ...primitiveProps } = props;
@@ -42033,10 +43469,10 @@ var Primitive16 = NODES16.reduce((primitive, node) => {
42033
43469
  Node2.displayName = `Primitive.${node}`;
42034
43470
  return { ...primitive, [node]: Node2 };
42035
43471
  }, {});
42036
- var NAME3 = "Label";
43472
+ var NAME4 = "Label";
42037
43473
  var Label2 = React54__namespace.forwardRef((props, forwardedRef) => {
42038
43474
  return /* @__PURE__ */ jsxRuntime.jsx(
42039
- Primitive16.label,
43475
+ Primitive19.label,
42040
43476
  {
42041
43477
  ...props,
42042
43478
  ref: forwardedRef,
@@ -42050,14 +43486,14 @@ var Label2 = React54__namespace.forwardRef((props, forwardedRef) => {
42050
43486
  }
42051
43487
  );
42052
43488
  });
42053
- Label2.displayName = NAME3;
42054
- var Root9 = Label2;
43489
+ Label2.displayName = NAME4;
43490
+ var Root10 = Label2;
42055
43491
  function Label3({
42056
43492
  className,
42057
43493
  ...props
42058
43494
  }) {
42059
43495
  return /* @__PURE__ */ jsxRuntime.jsx(
42060
- Root9,
43496
+ Root10,
42061
43497
  {
42062
43498
  "data-slot": "label",
42063
43499
  className: cn(