@timeax/form-palette 0.0.16 → 0.0.17
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.d.mts +101 -3
- package/dist/index.d.ts +101 -3
- package/dist/index.js +1441 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1441 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
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(
|
|
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] =
|
|
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] =
|
|
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] =
|
|
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
|
|
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
|
-
|
|
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 [
|
|
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
|
|
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
|
-
|
|
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 [
|
|
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
|
|
20777
|
-
const [createCollectionContext, createCollectionScope4] = createContextScope(
|
|
20776
|
+
const PROVIDER_NAME2 = name + "CollectionProvider";
|
|
20777
|
+
const [createCollectionContext, createCollectionScope4] = createContextScope(PROVIDER_NAME2);
|
|
20778
20778
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
20779
|
-
|
|
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 =
|
|
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: () =>
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
35297
|
+
Root6,
|
|
35297
35298
|
{
|
|
35298
35299
|
asChild: true,
|
|
35299
35300
|
...rovingFocusGroupScope,
|
|
@@ -38548,7 +38549,7 @@ function roundValue(value, decimalCount) {
|
|
|
38548
38549
|
const rounder = Math.pow(10, decimalCount);
|
|
38549
38550
|
return Math.round(value * rounder) / rounder;
|
|
38550
38551
|
}
|
|
38551
|
-
var
|
|
38552
|
+
var Root7 = Slider;
|
|
38552
38553
|
var Track = SliderTrack;
|
|
38553
38554
|
var Range = SliderRange;
|
|
38554
38555
|
var Thumb2 = SliderThumb;
|
|
@@ -38565,7 +38566,7 @@ function Slider2({
|
|
|
38565
38566
|
[value, defaultValue, min3, max3]
|
|
38566
38567
|
);
|
|
38567
38568
|
return /* @__PURE__ */ jsxs(
|
|
38568
|
-
|
|
38569
|
+
Root7,
|
|
38569
38570
|
{
|
|
38570
38571
|
"data-slot": "slider",
|
|
38571
38572
|
defaultValue,
|
|
@@ -39405,7 +39406,7 @@ var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
|
39405
39406
|
}, [MESSAGE, contentRef, descriptionId]);
|
|
39406
39407
|
return null;
|
|
39407
39408
|
};
|
|
39408
|
-
var
|
|
39409
|
+
var Root8 = Dialog;
|
|
39409
39410
|
var Portal4 = DialogPortal;
|
|
39410
39411
|
var Overlay = DialogOverlay;
|
|
39411
39412
|
var Content3 = DialogContent;
|
|
@@ -39415,7 +39416,7 @@ var Close = DialogClose;
|
|
|
39415
39416
|
function Dialog2({
|
|
39416
39417
|
...props
|
|
39417
39418
|
}) {
|
|
39418
|
-
return /* @__PURE__ */ jsx(
|
|
39419
|
+
return /* @__PURE__ */ jsx(Root8, { "data-slot": "dialog", ...props });
|
|
39419
39420
|
}
|
|
39420
39421
|
function DialogPortal2({
|
|
39421
39422
|
...props
|
|
@@ -41320,7 +41321,7 @@ function useResizeObserver(element, onResize) {
|
|
|
41320
41321
|
}
|
|
41321
41322
|
}, [element, handleResize]);
|
|
41322
41323
|
}
|
|
41323
|
-
var
|
|
41324
|
+
var Root9 = ScrollArea;
|
|
41324
41325
|
var Viewport2 = ScrollAreaViewport;
|
|
41325
41326
|
var Corner = ScrollAreaCorner;
|
|
41326
41327
|
function ScrollArea2({
|
|
@@ -41329,7 +41330,7 @@ function ScrollArea2({
|
|
|
41329
41330
|
...props
|
|
41330
41331
|
}) {
|
|
41331
41332
|
return /* @__PURE__ */ jsxs(
|
|
41332
|
-
|
|
41333
|
+
Root9,
|
|
41333
41334
|
{
|
|
41334
41335
|
"data-slot": "scroll-area",
|
|
41335
41336
|
className: cn("relative", className),
|
|
@@ -41954,6 +41955,1410 @@ var fileManagerModule = {
|
|
|
41954
41955
|
Variant: file_default,
|
|
41955
41956
|
variant: "file"
|
|
41956
41957
|
};
|
|
41958
|
+
// @__NO_SIDE_EFFECTS__
|
|
41959
|
+
function createSlot18(ownerName) {
|
|
41960
|
+
const SlotClone = /* @__PURE__ */ createSlotClone18(ownerName);
|
|
41961
|
+
const Slot22 = React54.forwardRef((props, forwardedRef) => {
|
|
41962
|
+
const { children, ...slotProps } = props;
|
|
41963
|
+
const childrenArray = React54.Children.toArray(children);
|
|
41964
|
+
const slottable = childrenArray.find(isSlottable18);
|
|
41965
|
+
if (slottable) {
|
|
41966
|
+
const newElement = slottable.props.children;
|
|
41967
|
+
const newChildren = childrenArray.map((child) => {
|
|
41968
|
+
if (child === slottable) {
|
|
41969
|
+
if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
|
|
41970
|
+
return React54.isValidElement(newElement) ? newElement.props.children : null;
|
|
41971
|
+
} else {
|
|
41972
|
+
return child;
|
|
41973
|
+
}
|
|
41974
|
+
});
|
|
41975
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
|
|
41976
|
+
}
|
|
41977
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
41978
|
+
});
|
|
41979
|
+
Slot22.displayName = `${ownerName}.Slot`;
|
|
41980
|
+
return Slot22;
|
|
41981
|
+
}
|
|
41982
|
+
// @__NO_SIDE_EFFECTS__
|
|
41983
|
+
function createSlotClone18(ownerName) {
|
|
41984
|
+
const SlotClone = React54.forwardRef((props, forwardedRef) => {
|
|
41985
|
+
const { children, ...slotProps } = props;
|
|
41986
|
+
if (React54.isValidElement(children)) {
|
|
41987
|
+
const childrenRef = getElementRef19(children);
|
|
41988
|
+
const props2 = mergeProps18(slotProps, children.props);
|
|
41989
|
+
if (children.type !== React54.Fragment) {
|
|
41990
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
41991
|
+
}
|
|
41992
|
+
return React54.cloneElement(children, props2);
|
|
41993
|
+
}
|
|
41994
|
+
return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
|
|
41995
|
+
});
|
|
41996
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
41997
|
+
return SlotClone;
|
|
41998
|
+
}
|
|
41999
|
+
var SLOTTABLE_IDENTIFIER18 = /* @__PURE__ */ Symbol("radix.slottable");
|
|
42000
|
+
function isSlottable18(child) {
|
|
42001
|
+
return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER18;
|
|
42002
|
+
}
|
|
42003
|
+
function mergeProps18(slotProps, childProps) {
|
|
42004
|
+
const overrideProps = { ...childProps };
|
|
42005
|
+
for (const propName in childProps) {
|
|
42006
|
+
const slotPropValue = slotProps[propName];
|
|
42007
|
+
const childPropValue = childProps[propName];
|
|
42008
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
42009
|
+
if (isHandler) {
|
|
42010
|
+
if (slotPropValue && childPropValue) {
|
|
42011
|
+
overrideProps[propName] = (...args) => {
|
|
42012
|
+
const result = childPropValue(...args);
|
|
42013
|
+
slotPropValue(...args);
|
|
42014
|
+
return result;
|
|
42015
|
+
};
|
|
42016
|
+
} else if (slotPropValue) {
|
|
42017
|
+
overrideProps[propName] = slotPropValue;
|
|
42018
|
+
}
|
|
42019
|
+
} else if (propName === "style") {
|
|
42020
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
42021
|
+
} else if (propName === "className") {
|
|
42022
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
42023
|
+
}
|
|
42024
|
+
}
|
|
42025
|
+
return { ...slotProps, ...overrideProps };
|
|
42026
|
+
}
|
|
42027
|
+
function getElementRef19(element) {
|
|
42028
|
+
var _a, _b;
|
|
42029
|
+
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
42030
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
42031
|
+
if (mayWarn) {
|
|
42032
|
+
return element.ref;
|
|
42033
|
+
}
|
|
42034
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
42035
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
42036
|
+
if (mayWarn) {
|
|
42037
|
+
return element.props.ref;
|
|
42038
|
+
}
|
|
42039
|
+
return element.props.ref || element.ref;
|
|
42040
|
+
}
|
|
42041
|
+
var NODES16 = [
|
|
42042
|
+
"a",
|
|
42043
|
+
"button",
|
|
42044
|
+
"div",
|
|
42045
|
+
"form",
|
|
42046
|
+
"h2",
|
|
42047
|
+
"h3",
|
|
42048
|
+
"img",
|
|
42049
|
+
"input",
|
|
42050
|
+
"label",
|
|
42051
|
+
"li",
|
|
42052
|
+
"nav",
|
|
42053
|
+
"ol",
|
|
42054
|
+
"p",
|
|
42055
|
+
"select",
|
|
42056
|
+
"span",
|
|
42057
|
+
"svg",
|
|
42058
|
+
"ul"
|
|
42059
|
+
];
|
|
42060
|
+
var Primitive16 = NODES16.reduce((primitive, node) => {
|
|
42061
|
+
const Slot5 = createSlot18(`Primitive.${node}`);
|
|
42062
|
+
const Node2 = React54.forwardRef((props, forwardedRef) => {
|
|
42063
|
+
const { asChild, ...primitiveProps } = props;
|
|
42064
|
+
const Comp = asChild ? Slot5 : node;
|
|
42065
|
+
if (typeof window !== "undefined") {
|
|
42066
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
42067
|
+
}
|
|
42068
|
+
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
42069
|
+
});
|
|
42070
|
+
Node2.displayName = `Primitive.${node}`;
|
|
42071
|
+
return { ...primitive, [node]: Node2 };
|
|
42072
|
+
}, {});
|
|
42073
|
+
// @__NO_SIDE_EFFECTS__
|
|
42074
|
+
function createSlot19(ownerName) {
|
|
42075
|
+
const SlotClone = /* @__PURE__ */ createSlotClone19(ownerName);
|
|
42076
|
+
const Slot22 = React54.forwardRef((props, forwardedRef) => {
|
|
42077
|
+
const { children, ...slotProps } = props;
|
|
42078
|
+
const childrenArray = React54.Children.toArray(children);
|
|
42079
|
+
const slottable = childrenArray.find(isSlottable19);
|
|
42080
|
+
if (slottable) {
|
|
42081
|
+
const newElement = slottable.props.children;
|
|
42082
|
+
const newChildren = childrenArray.map((child) => {
|
|
42083
|
+
if (child === slottable) {
|
|
42084
|
+
if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
|
|
42085
|
+
return React54.isValidElement(newElement) ? newElement.props.children : null;
|
|
42086
|
+
} else {
|
|
42087
|
+
return child;
|
|
42088
|
+
}
|
|
42089
|
+
});
|
|
42090
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
|
|
42091
|
+
}
|
|
42092
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
42093
|
+
});
|
|
42094
|
+
Slot22.displayName = `${ownerName}.Slot`;
|
|
42095
|
+
return Slot22;
|
|
42096
|
+
}
|
|
42097
|
+
// @__NO_SIDE_EFFECTS__
|
|
42098
|
+
function createSlotClone19(ownerName) {
|
|
42099
|
+
const SlotClone = React54.forwardRef((props, forwardedRef) => {
|
|
42100
|
+
const { children, ...slotProps } = props;
|
|
42101
|
+
if (React54.isValidElement(children)) {
|
|
42102
|
+
const childrenRef = getElementRef20(children);
|
|
42103
|
+
const props2 = mergeProps19(slotProps, children.props);
|
|
42104
|
+
if (children.type !== React54.Fragment) {
|
|
42105
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
42106
|
+
}
|
|
42107
|
+
return React54.cloneElement(children, props2);
|
|
42108
|
+
}
|
|
42109
|
+
return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
|
|
42110
|
+
});
|
|
42111
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
42112
|
+
return SlotClone;
|
|
42113
|
+
}
|
|
42114
|
+
var SLOTTABLE_IDENTIFIER19 = /* @__PURE__ */ Symbol("radix.slottable");
|
|
42115
|
+
function isSlottable19(child) {
|
|
42116
|
+
return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER19;
|
|
42117
|
+
}
|
|
42118
|
+
function mergeProps19(slotProps, childProps) {
|
|
42119
|
+
const overrideProps = { ...childProps };
|
|
42120
|
+
for (const propName in childProps) {
|
|
42121
|
+
const slotPropValue = slotProps[propName];
|
|
42122
|
+
const childPropValue = childProps[propName];
|
|
42123
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
42124
|
+
if (isHandler) {
|
|
42125
|
+
if (slotPropValue && childPropValue) {
|
|
42126
|
+
overrideProps[propName] = (...args) => {
|
|
42127
|
+
const result = childPropValue(...args);
|
|
42128
|
+
slotPropValue(...args);
|
|
42129
|
+
return result;
|
|
42130
|
+
};
|
|
42131
|
+
} else if (slotPropValue) {
|
|
42132
|
+
overrideProps[propName] = slotPropValue;
|
|
42133
|
+
}
|
|
42134
|
+
} else if (propName === "style") {
|
|
42135
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
42136
|
+
} else if (propName === "className") {
|
|
42137
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
42138
|
+
}
|
|
42139
|
+
}
|
|
42140
|
+
return { ...slotProps, ...overrideProps };
|
|
42141
|
+
}
|
|
42142
|
+
function getElementRef20(element) {
|
|
42143
|
+
var _a, _b;
|
|
42144
|
+
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
42145
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
42146
|
+
if (mayWarn) {
|
|
42147
|
+
return element.ref;
|
|
42148
|
+
}
|
|
42149
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
42150
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
42151
|
+
if (mayWarn) {
|
|
42152
|
+
return element.props.ref;
|
|
42153
|
+
}
|
|
42154
|
+
return element.props.ref || element.ref;
|
|
42155
|
+
}
|
|
42156
|
+
var NODES17 = [
|
|
42157
|
+
"a",
|
|
42158
|
+
"button",
|
|
42159
|
+
"div",
|
|
42160
|
+
"form",
|
|
42161
|
+
"h2",
|
|
42162
|
+
"h3",
|
|
42163
|
+
"img",
|
|
42164
|
+
"input",
|
|
42165
|
+
"label",
|
|
42166
|
+
"li",
|
|
42167
|
+
"nav",
|
|
42168
|
+
"ol",
|
|
42169
|
+
"p",
|
|
42170
|
+
"select",
|
|
42171
|
+
"span",
|
|
42172
|
+
"svg",
|
|
42173
|
+
"ul"
|
|
42174
|
+
];
|
|
42175
|
+
var Primitive17 = NODES17.reduce((primitive, node) => {
|
|
42176
|
+
const Slot5 = createSlot19(`Primitive.${node}`);
|
|
42177
|
+
const Node2 = React54.forwardRef((props, forwardedRef) => {
|
|
42178
|
+
const { asChild, ...primitiveProps } = props;
|
|
42179
|
+
const Comp = asChild ? Slot5 : node;
|
|
42180
|
+
if (typeof window !== "undefined") {
|
|
42181
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
42182
|
+
}
|
|
42183
|
+
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
42184
|
+
});
|
|
42185
|
+
Node2.displayName = `Primitive.${node}`;
|
|
42186
|
+
return { ...primitive, [node]: Node2 };
|
|
42187
|
+
}, {});
|
|
42188
|
+
var NAME3 = "Toggle";
|
|
42189
|
+
var Toggle = React54.forwardRef((props, forwardedRef) => {
|
|
42190
|
+
const { pressed: pressedProp, defaultPressed, onPressedChange, ...buttonProps } = props;
|
|
42191
|
+
const [pressed, setPressed] = useControllableState({
|
|
42192
|
+
prop: pressedProp,
|
|
42193
|
+
onChange: onPressedChange,
|
|
42194
|
+
defaultProp: defaultPressed != null ? defaultPressed : false,
|
|
42195
|
+
caller: NAME3
|
|
42196
|
+
});
|
|
42197
|
+
return /* @__PURE__ */ jsx(
|
|
42198
|
+
Primitive17.button,
|
|
42199
|
+
{
|
|
42200
|
+
type: "button",
|
|
42201
|
+
"aria-pressed": pressed,
|
|
42202
|
+
"data-state": pressed ? "on" : "off",
|
|
42203
|
+
"data-disabled": props.disabled ? "" : void 0,
|
|
42204
|
+
...buttonProps,
|
|
42205
|
+
ref: forwardedRef,
|
|
42206
|
+
onClick: composeEventHandlers(props.onClick, () => {
|
|
42207
|
+
if (!props.disabled) {
|
|
42208
|
+
setPressed(!pressed);
|
|
42209
|
+
}
|
|
42210
|
+
})
|
|
42211
|
+
}
|
|
42212
|
+
);
|
|
42213
|
+
});
|
|
42214
|
+
Toggle.displayName = NAME3;
|
|
42215
|
+
var TOGGLE_GROUP_NAME = "ToggleGroup";
|
|
42216
|
+
var [createToggleGroupContext] = createContextScope(TOGGLE_GROUP_NAME, [
|
|
42217
|
+
createRovingFocusGroupScope
|
|
42218
|
+
]);
|
|
42219
|
+
var useRovingFocusGroupScope2 = createRovingFocusGroupScope();
|
|
42220
|
+
var ToggleGroup = React54__default.forwardRef((props, forwardedRef) => {
|
|
42221
|
+
const { type, ...toggleGroupProps } = props;
|
|
42222
|
+
if (type === "single") {
|
|
42223
|
+
const singleProps = toggleGroupProps;
|
|
42224
|
+
return /* @__PURE__ */ jsx(ToggleGroupImplSingle, { ...singleProps, ref: forwardedRef });
|
|
42225
|
+
}
|
|
42226
|
+
if (type === "multiple") {
|
|
42227
|
+
const multipleProps = toggleGroupProps;
|
|
42228
|
+
return /* @__PURE__ */ jsx(ToggleGroupImplMultiple, { ...multipleProps, ref: forwardedRef });
|
|
42229
|
+
}
|
|
42230
|
+
throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
|
|
42231
|
+
});
|
|
42232
|
+
ToggleGroup.displayName = TOGGLE_GROUP_NAME;
|
|
42233
|
+
var [ToggleGroupValueProvider, useToggleGroupValueContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
|
|
42234
|
+
var ToggleGroupImplSingle = React54__default.forwardRef((props, forwardedRef) => {
|
|
42235
|
+
const {
|
|
42236
|
+
value: valueProp,
|
|
42237
|
+
defaultValue,
|
|
42238
|
+
onValueChange = () => {
|
|
42239
|
+
},
|
|
42240
|
+
...toggleGroupSingleProps
|
|
42241
|
+
} = props;
|
|
42242
|
+
const [value, setValue] = useControllableState({
|
|
42243
|
+
prop: valueProp,
|
|
42244
|
+
defaultProp: defaultValue != null ? defaultValue : "",
|
|
42245
|
+
onChange: onValueChange,
|
|
42246
|
+
caller: TOGGLE_GROUP_NAME
|
|
42247
|
+
});
|
|
42248
|
+
return /* @__PURE__ */ jsx(
|
|
42249
|
+
ToggleGroupValueProvider,
|
|
42250
|
+
{
|
|
42251
|
+
scope: props.__scopeToggleGroup,
|
|
42252
|
+
type: "single",
|
|
42253
|
+
value: React54__default.useMemo(() => value ? [value] : [], [value]),
|
|
42254
|
+
onItemActivate: setValue,
|
|
42255
|
+
onItemDeactivate: React54__default.useCallback(() => setValue(""), [setValue]),
|
|
42256
|
+
children: /* @__PURE__ */ jsx(ToggleGroupImpl, { ...toggleGroupSingleProps, ref: forwardedRef })
|
|
42257
|
+
}
|
|
42258
|
+
);
|
|
42259
|
+
});
|
|
42260
|
+
var ToggleGroupImplMultiple = React54__default.forwardRef((props, forwardedRef) => {
|
|
42261
|
+
const {
|
|
42262
|
+
value: valueProp,
|
|
42263
|
+
defaultValue,
|
|
42264
|
+
onValueChange = () => {
|
|
42265
|
+
},
|
|
42266
|
+
...toggleGroupMultipleProps
|
|
42267
|
+
} = props;
|
|
42268
|
+
const [value, setValue] = useControllableState({
|
|
42269
|
+
prop: valueProp,
|
|
42270
|
+
defaultProp: defaultValue != null ? defaultValue : [],
|
|
42271
|
+
onChange: onValueChange,
|
|
42272
|
+
caller: TOGGLE_GROUP_NAME
|
|
42273
|
+
});
|
|
42274
|
+
const handleButtonActivate = React54__default.useCallback(
|
|
42275
|
+
(itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
|
|
42276
|
+
[setValue]
|
|
42277
|
+
);
|
|
42278
|
+
const handleButtonDeactivate = React54__default.useCallback(
|
|
42279
|
+
(itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
|
|
42280
|
+
[setValue]
|
|
42281
|
+
);
|
|
42282
|
+
return /* @__PURE__ */ jsx(
|
|
42283
|
+
ToggleGroupValueProvider,
|
|
42284
|
+
{
|
|
42285
|
+
scope: props.__scopeToggleGroup,
|
|
42286
|
+
type: "multiple",
|
|
42287
|
+
value,
|
|
42288
|
+
onItemActivate: handleButtonActivate,
|
|
42289
|
+
onItemDeactivate: handleButtonDeactivate,
|
|
42290
|
+
children: /* @__PURE__ */ jsx(ToggleGroupImpl, { ...toggleGroupMultipleProps, ref: forwardedRef })
|
|
42291
|
+
}
|
|
42292
|
+
);
|
|
42293
|
+
});
|
|
42294
|
+
ToggleGroup.displayName = TOGGLE_GROUP_NAME;
|
|
42295
|
+
var [ToggleGroupContext, useToggleGroupContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
|
|
42296
|
+
var ToggleGroupImpl = React54__default.forwardRef(
|
|
42297
|
+
(props, forwardedRef) => {
|
|
42298
|
+
const {
|
|
42299
|
+
__scopeToggleGroup,
|
|
42300
|
+
disabled = false,
|
|
42301
|
+
rovingFocus = true,
|
|
42302
|
+
orientation,
|
|
42303
|
+
dir,
|
|
42304
|
+
loop = true,
|
|
42305
|
+
...toggleGroupProps
|
|
42306
|
+
} = props;
|
|
42307
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope2(__scopeToggleGroup);
|
|
42308
|
+
const direction = useDirection(dir);
|
|
42309
|
+
const commonProps = { role: "group", dir: direction, ...toggleGroupProps };
|
|
42310
|
+
return /* @__PURE__ */ jsx(ToggleGroupContext, { scope: __scopeToggleGroup, rovingFocus, disabled, children: rovingFocus ? /* @__PURE__ */ jsx(
|
|
42311
|
+
Root6,
|
|
42312
|
+
{
|
|
42313
|
+
asChild: true,
|
|
42314
|
+
...rovingFocusGroupScope,
|
|
42315
|
+
orientation,
|
|
42316
|
+
dir: direction,
|
|
42317
|
+
loop,
|
|
42318
|
+
children: /* @__PURE__ */ jsx(Primitive16.div, { ...commonProps, ref: forwardedRef })
|
|
42319
|
+
}
|
|
42320
|
+
) : /* @__PURE__ */ jsx(Primitive16.div, { ...commonProps, ref: forwardedRef }) });
|
|
42321
|
+
}
|
|
42322
|
+
);
|
|
42323
|
+
var ITEM_NAME4 = "ToggleGroupItem";
|
|
42324
|
+
var ToggleGroupItem = React54__default.forwardRef(
|
|
42325
|
+
(props, forwardedRef) => {
|
|
42326
|
+
const valueContext = useToggleGroupValueContext(ITEM_NAME4, props.__scopeToggleGroup);
|
|
42327
|
+
const context = useToggleGroupContext(ITEM_NAME4, props.__scopeToggleGroup);
|
|
42328
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope2(props.__scopeToggleGroup);
|
|
42329
|
+
const pressed = valueContext.value.includes(props.value);
|
|
42330
|
+
const disabled = context.disabled || props.disabled;
|
|
42331
|
+
const commonProps = { ...props, pressed, disabled };
|
|
42332
|
+
const ref = React54__default.useRef(null);
|
|
42333
|
+
return context.rovingFocus ? /* @__PURE__ */ jsx(
|
|
42334
|
+
Item2,
|
|
42335
|
+
{
|
|
42336
|
+
asChild: true,
|
|
42337
|
+
...rovingFocusGroupScope,
|
|
42338
|
+
focusable: !disabled,
|
|
42339
|
+
active: pressed,
|
|
42340
|
+
ref,
|
|
42341
|
+
children: /* @__PURE__ */ jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef })
|
|
42342
|
+
}
|
|
42343
|
+
) : /* @__PURE__ */ jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef });
|
|
42344
|
+
}
|
|
42345
|
+
);
|
|
42346
|
+
ToggleGroupItem.displayName = ITEM_NAME4;
|
|
42347
|
+
var ToggleGroupItemImpl = React54__default.forwardRef(
|
|
42348
|
+
(props, forwardedRef) => {
|
|
42349
|
+
const { __scopeToggleGroup, value, ...itemProps } = props;
|
|
42350
|
+
const valueContext = useToggleGroupValueContext(ITEM_NAME4, __scopeToggleGroup);
|
|
42351
|
+
const singleProps = { role: "radio", "aria-checked": props.pressed, "aria-pressed": void 0 };
|
|
42352
|
+
const typeProps = valueContext.type === "single" ? singleProps : void 0;
|
|
42353
|
+
return /* @__PURE__ */ jsx(
|
|
42354
|
+
Toggle,
|
|
42355
|
+
{
|
|
42356
|
+
...typeProps,
|
|
42357
|
+
...itemProps,
|
|
42358
|
+
ref: forwardedRef,
|
|
42359
|
+
onPressedChange: (pressed) => {
|
|
42360
|
+
if (pressed) {
|
|
42361
|
+
valueContext.onItemActivate(value);
|
|
42362
|
+
} else {
|
|
42363
|
+
valueContext.onItemDeactivate(value);
|
|
42364
|
+
}
|
|
42365
|
+
}
|
|
42366
|
+
}
|
|
42367
|
+
);
|
|
42368
|
+
}
|
|
42369
|
+
);
|
|
42370
|
+
var Root25 = ToggleGroup;
|
|
42371
|
+
var Item23 = ToggleGroupItem;
|
|
42372
|
+
var toggleVariants = cva(
|
|
42373
|
+
"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",
|
|
42374
|
+
{
|
|
42375
|
+
variants: {
|
|
42376
|
+
variant: {
|
|
42377
|
+
default: "bg-transparent",
|
|
42378
|
+
outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
|
|
42379
|
+
},
|
|
42380
|
+
size: {
|
|
42381
|
+
default: "h-9 px-2 min-w-9",
|
|
42382
|
+
sm: "h-8 px-1.5 min-w-8",
|
|
42383
|
+
lg: "h-10 px-2.5 min-w-10"
|
|
42384
|
+
}
|
|
42385
|
+
},
|
|
42386
|
+
defaultVariants: {
|
|
42387
|
+
variant: "default",
|
|
42388
|
+
size: "default"
|
|
42389
|
+
}
|
|
42390
|
+
}
|
|
42391
|
+
);
|
|
42392
|
+
var ToggleGroupContext2 = React54.createContext({
|
|
42393
|
+
size: "default",
|
|
42394
|
+
variant: "default",
|
|
42395
|
+
spacing: 0
|
|
42396
|
+
});
|
|
42397
|
+
function ToggleGroup2({
|
|
42398
|
+
className,
|
|
42399
|
+
variant,
|
|
42400
|
+
size: size4,
|
|
42401
|
+
spacing = 0,
|
|
42402
|
+
children,
|
|
42403
|
+
...props
|
|
42404
|
+
}) {
|
|
42405
|
+
return /* @__PURE__ */ jsx(
|
|
42406
|
+
Root25,
|
|
42407
|
+
{
|
|
42408
|
+
"data-slot": "toggle-group",
|
|
42409
|
+
"data-variant": variant,
|
|
42410
|
+
"data-size": size4,
|
|
42411
|
+
"data-spacing": spacing,
|
|
42412
|
+
style: { "--gap": spacing },
|
|
42413
|
+
className: cn(
|
|
42414
|
+
"group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",
|
|
42415
|
+
className
|
|
42416
|
+
),
|
|
42417
|
+
...props,
|
|
42418
|
+
children: /* @__PURE__ */ jsx(ToggleGroupContext2.Provider, { value: { variant, size: size4, spacing }, children })
|
|
42419
|
+
}
|
|
42420
|
+
);
|
|
42421
|
+
}
|
|
42422
|
+
function ToggleGroupItem2({
|
|
42423
|
+
className,
|
|
42424
|
+
children,
|
|
42425
|
+
variant,
|
|
42426
|
+
size: size4,
|
|
42427
|
+
...props
|
|
42428
|
+
}) {
|
|
42429
|
+
const context = React54.useContext(ToggleGroupContext2);
|
|
42430
|
+
return /* @__PURE__ */ jsx(
|
|
42431
|
+
Item23,
|
|
42432
|
+
{
|
|
42433
|
+
"data-slot": "toggle-group-item",
|
|
42434
|
+
"data-variant": context.variant || variant,
|
|
42435
|
+
"data-size": context.size || size4,
|
|
42436
|
+
"data-spacing": context.spacing,
|
|
42437
|
+
className: cn(
|
|
42438
|
+
toggleVariants({
|
|
42439
|
+
variant: context.variant || variant,
|
|
42440
|
+
size: context.size || size4
|
|
42441
|
+
}),
|
|
42442
|
+
"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10",
|
|
42443
|
+
"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",
|
|
42444
|
+
className
|
|
42445
|
+
),
|
|
42446
|
+
...props,
|
|
42447
|
+
children
|
|
42448
|
+
}
|
|
42449
|
+
);
|
|
42450
|
+
}
|
|
42451
|
+
// @__NO_SIDE_EFFECTS__
|
|
42452
|
+
function createSlot20(ownerName) {
|
|
42453
|
+
const SlotClone = /* @__PURE__ */ createSlotClone20(ownerName);
|
|
42454
|
+
const Slot22 = React54.forwardRef((props, forwardedRef) => {
|
|
42455
|
+
const { children, ...slotProps } = props;
|
|
42456
|
+
const childrenArray = React54.Children.toArray(children);
|
|
42457
|
+
const slottable = childrenArray.find(isSlottable20);
|
|
42458
|
+
if (slottable) {
|
|
42459
|
+
const newElement = slottable.props.children;
|
|
42460
|
+
const newChildren = childrenArray.map((child) => {
|
|
42461
|
+
if (child === slottable) {
|
|
42462
|
+
if (React54.Children.count(newElement) > 1) return React54.Children.only(null);
|
|
42463
|
+
return React54.isValidElement(newElement) ? newElement.props.children : null;
|
|
42464
|
+
} else {
|
|
42465
|
+
return child;
|
|
42466
|
+
}
|
|
42467
|
+
});
|
|
42468
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React54.isValidElement(newElement) ? React54.cloneElement(newElement, void 0, newChildren) : null });
|
|
42469
|
+
}
|
|
42470
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
42471
|
+
});
|
|
42472
|
+
Slot22.displayName = `${ownerName}.Slot`;
|
|
42473
|
+
return Slot22;
|
|
42474
|
+
}
|
|
42475
|
+
// @__NO_SIDE_EFFECTS__
|
|
42476
|
+
function createSlotClone20(ownerName) {
|
|
42477
|
+
const SlotClone = React54.forwardRef((props, forwardedRef) => {
|
|
42478
|
+
const { children, ...slotProps } = props;
|
|
42479
|
+
if (React54.isValidElement(children)) {
|
|
42480
|
+
const childrenRef = getElementRef21(children);
|
|
42481
|
+
const props2 = mergeProps20(slotProps, children.props);
|
|
42482
|
+
if (children.type !== React54.Fragment) {
|
|
42483
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
42484
|
+
}
|
|
42485
|
+
return React54.cloneElement(children, props2);
|
|
42486
|
+
}
|
|
42487
|
+
return React54.Children.count(children) > 1 ? React54.Children.only(null) : null;
|
|
42488
|
+
});
|
|
42489
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
42490
|
+
return SlotClone;
|
|
42491
|
+
}
|
|
42492
|
+
var SLOTTABLE_IDENTIFIER20 = /* @__PURE__ */ Symbol("radix.slottable");
|
|
42493
|
+
// @__NO_SIDE_EFFECTS__
|
|
42494
|
+
function createSlottable(ownerName) {
|
|
42495
|
+
const Slottable2 = ({ children }) => {
|
|
42496
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
42497
|
+
};
|
|
42498
|
+
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
42499
|
+
Slottable2.__radixId = SLOTTABLE_IDENTIFIER20;
|
|
42500
|
+
return Slottable2;
|
|
42501
|
+
}
|
|
42502
|
+
function isSlottable20(child) {
|
|
42503
|
+
return React54.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER20;
|
|
42504
|
+
}
|
|
42505
|
+
function mergeProps20(slotProps, childProps) {
|
|
42506
|
+
const overrideProps = { ...childProps };
|
|
42507
|
+
for (const propName in childProps) {
|
|
42508
|
+
const slotPropValue = slotProps[propName];
|
|
42509
|
+
const childPropValue = childProps[propName];
|
|
42510
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
42511
|
+
if (isHandler) {
|
|
42512
|
+
if (slotPropValue && childPropValue) {
|
|
42513
|
+
overrideProps[propName] = (...args) => {
|
|
42514
|
+
const result = childPropValue(...args);
|
|
42515
|
+
slotPropValue(...args);
|
|
42516
|
+
return result;
|
|
42517
|
+
};
|
|
42518
|
+
} else if (slotPropValue) {
|
|
42519
|
+
overrideProps[propName] = slotPropValue;
|
|
42520
|
+
}
|
|
42521
|
+
} else if (propName === "style") {
|
|
42522
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
42523
|
+
} else if (propName === "className") {
|
|
42524
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
42525
|
+
}
|
|
42526
|
+
}
|
|
42527
|
+
return { ...slotProps, ...overrideProps };
|
|
42528
|
+
}
|
|
42529
|
+
function getElementRef21(element) {
|
|
42530
|
+
var _a, _b;
|
|
42531
|
+
let getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a.get;
|
|
42532
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
42533
|
+
if (mayWarn) {
|
|
42534
|
+
return element.ref;
|
|
42535
|
+
}
|
|
42536
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
42537
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
42538
|
+
if (mayWarn) {
|
|
42539
|
+
return element.props.ref;
|
|
42540
|
+
}
|
|
42541
|
+
return element.props.ref || element.ref;
|
|
42542
|
+
}
|
|
42543
|
+
var NODES18 = [
|
|
42544
|
+
"a",
|
|
42545
|
+
"button",
|
|
42546
|
+
"div",
|
|
42547
|
+
"form",
|
|
42548
|
+
"h2",
|
|
42549
|
+
"h3",
|
|
42550
|
+
"img",
|
|
42551
|
+
"input",
|
|
42552
|
+
"label",
|
|
42553
|
+
"li",
|
|
42554
|
+
"nav",
|
|
42555
|
+
"ol",
|
|
42556
|
+
"p",
|
|
42557
|
+
"select",
|
|
42558
|
+
"span",
|
|
42559
|
+
"svg",
|
|
42560
|
+
"ul"
|
|
42561
|
+
];
|
|
42562
|
+
var Primitive18 = NODES18.reduce((primitive, node) => {
|
|
42563
|
+
const Slot5 = createSlot20(`Primitive.${node}`);
|
|
42564
|
+
const Node2 = React54.forwardRef((props, forwardedRef) => {
|
|
42565
|
+
const { asChild, ...primitiveProps } = props;
|
|
42566
|
+
const Comp = asChild ? Slot5 : node;
|
|
42567
|
+
if (typeof window !== "undefined") {
|
|
42568
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
42569
|
+
}
|
|
42570
|
+
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
42571
|
+
});
|
|
42572
|
+
Node2.displayName = `Primitive.${node}`;
|
|
42573
|
+
return { ...primitive, [node]: Node2 };
|
|
42574
|
+
}, {});
|
|
42575
|
+
var [createTooltipContext] = createContextScope("Tooltip", [
|
|
42576
|
+
createPopperScope
|
|
42577
|
+
]);
|
|
42578
|
+
var usePopperScope3 = createPopperScope();
|
|
42579
|
+
var PROVIDER_NAME = "TooltipProvider";
|
|
42580
|
+
var DEFAULT_DELAY_DURATION = 700;
|
|
42581
|
+
var TOOLTIP_OPEN = "tooltip.open";
|
|
42582
|
+
var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
|
|
42583
|
+
var TooltipProvider = (props) => {
|
|
42584
|
+
const {
|
|
42585
|
+
__scopeTooltip,
|
|
42586
|
+
delayDuration = DEFAULT_DELAY_DURATION,
|
|
42587
|
+
skipDelayDuration = 300,
|
|
42588
|
+
disableHoverableContent = false,
|
|
42589
|
+
children
|
|
42590
|
+
} = props;
|
|
42591
|
+
const isOpenDelayedRef = React54.useRef(true);
|
|
42592
|
+
const isPointerInTransitRef = React54.useRef(false);
|
|
42593
|
+
const skipDelayTimerRef = React54.useRef(0);
|
|
42594
|
+
React54.useEffect(() => {
|
|
42595
|
+
const skipDelayTimer = skipDelayTimerRef.current;
|
|
42596
|
+
return () => window.clearTimeout(skipDelayTimer);
|
|
42597
|
+
}, []);
|
|
42598
|
+
return /* @__PURE__ */ jsx(
|
|
42599
|
+
TooltipProviderContextProvider,
|
|
42600
|
+
{
|
|
42601
|
+
scope: __scopeTooltip,
|
|
42602
|
+
isOpenDelayedRef,
|
|
42603
|
+
delayDuration,
|
|
42604
|
+
onOpen: React54.useCallback(() => {
|
|
42605
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
42606
|
+
isOpenDelayedRef.current = false;
|
|
42607
|
+
}, []),
|
|
42608
|
+
onClose: React54.useCallback(() => {
|
|
42609
|
+
window.clearTimeout(skipDelayTimerRef.current);
|
|
42610
|
+
skipDelayTimerRef.current = window.setTimeout(
|
|
42611
|
+
() => isOpenDelayedRef.current = true,
|
|
42612
|
+
skipDelayDuration
|
|
42613
|
+
);
|
|
42614
|
+
}, [skipDelayDuration]),
|
|
42615
|
+
isPointerInTransitRef,
|
|
42616
|
+
onPointerInTransitChange: React54.useCallback((inTransit) => {
|
|
42617
|
+
isPointerInTransitRef.current = inTransit;
|
|
42618
|
+
}, []),
|
|
42619
|
+
disableHoverableContent,
|
|
42620
|
+
children
|
|
42621
|
+
}
|
|
42622
|
+
);
|
|
42623
|
+
};
|
|
42624
|
+
TooltipProvider.displayName = PROVIDER_NAME;
|
|
42625
|
+
var TOOLTIP_NAME = "Tooltip";
|
|
42626
|
+
var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
|
|
42627
|
+
var Tooltip = (props) => {
|
|
42628
|
+
const {
|
|
42629
|
+
__scopeTooltip,
|
|
42630
|
+
children,
|
|
42631
|
+
open: openProp,
|
|
42632
|
+
defaultOpen,
|
|
42633
|
+
onOpenChange,
|
|
42634
|
+
disableHoverableContent: disableHoverableContentProp,
|
|
42635
|
+
delayDuration: delayDurationProp
|
|
42636
|
+
} = props;
|
|
42637
|
+
const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
|
|
42638
|
+
const popperScope = usePopperScope3(__scopeTooltip);
|
|
42639
|
+
const [trigger, setTrigger] = React54.useState(null);
|
|
42640
|
+
const contentId = useId3();
|
|
42641
|
+
const openTimerRef = React54.useRef(0);
|
|
42642
|
+
const disableHoverableContent = disableHoverableContentProp != null ? disableHoverableContentProp : providerContext.disableHoverableContent;
|
|
42643
|
+
const delayDuration = delayDurationProp != null ? delayDurationProp : providerContext.delayDuration;
|
|
42644
|
+
const wasOpenDelayedRef = React54.useRef(false);
|
|
42645
|
+
const [open, setOpen] = useControllableState({
|
|
42646
|
+
prop: openProp,
|
|
42647
|
+
defaultProp: defaultOpen != null ? defaultOpen : false,
|
|
42648
|
+
onChange: (open2) => {
|
|
42649
|
+
if (open2) {
|
|
42650
|
+
providerContext.onOpen();
|
|
42651
|
+
document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
|
|
42652
|
+
} else {
|
|
42653
|
+
providerContext.onClose();
|
|
42654
|
+
}
|
|
42655
|
+
onOpenChange == null ? void 0 : onOpenChange(open2);
|
|
42656
|
+
},
|
|
42657
|
+
caller: TOOLTIP_NAME
|
|
42658
|
+
});
|
|
42659
|
+
const stateAttribute = React54.useMemo(() => {
|
|
42660
|
+
return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
|
|
42661
|
+
}, [open]);
|
|
42662
|
+
const handleOpen = React54.useCallback(() => {
|
|
42663
|
+
window.clearTimeout(openTimerRef.current);
|
|
42664
|
+
openTimerRef.current = 0;
|
|
42665
|
+
wasOpenDelayedRef.current = false;
|
|
42666
|
+
setOpen(true);
|
|
42667
|
+
}, [setOpen]);
|
|
42668
|
+
const handleClose = React54.useCallback(() => {
|
|
42669
|
+
window.clearTimeout(openTimerRef.current);
|
|
42670
|
+
openTimerRef.current = 0;
|
|
42671
|
+
setOpen(false);
|
|
42672
|
+
}, [setOpen]);
|
|
42673
|
+
const handleDelayedOpen = React54.useCallback(() => {
|
|
42674
|
+
window.clearTimeout(openTimerRef.current);
|
|
42675
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
42676
|
+
wasOpenDelayedRef.current = true;
|
|
42677
|
+
setOpen(true);
|
|
42678
|
+
openTimerRef.current = 0;
|
|
42679
|
+
}, delayDuration);
|
|
42680
|
+
}, [delayDuration, setOpen]);
|
|
42681
|
+
React54.useEffect(() => {
|
|
42682
|
+
return () => {
|
|
42683
|
+
if (openTimerRef.current) {
|
|
42684
|
+
window.clearTimeout(openTimerRef.current);
|
|
42685
|
+
openTimerRef.current = 0;
|
|
42686
|
+
}
|
|
42687
|
+
};
|
|
42688
|
+
}, []);
|
|
42689
|
+
return /* @__PURE__ */ jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsx(
|
|
42690
|
+
TooltipContextProvider,
|
|
42691
|
+
{
|
|
42692
|
+
scope: __scopeTooltip,
|
|
42693
|
+
contentId,
|
|
42694
|
+
open,
|
|
42695
|
+
stateAttribute,
|
|
42696
|
+
trigger,
|
|
42697
|
+
onTriggerChange: setTrigger,
|
|
42698
|
+
onTriggerEnter: React54.useCallback(() => {
|
|
42699
|
+
if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
|
|
42700
|
+
else handleOpen();
|
|
42701
|
+
}, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
|
|
42702
|
+
onTriggerLeave: React54.useCallback(() => {
|
|
42703
|
+
if (disableHoverableContent) {
|
|
42704
|
+
handleClose();
|
|
42705
|
+
} else {
|
|
42706
|
+
window.clearTimeout(openTimerRef.current);
|
|
42707
|
+
openTimerRef.current = 0;
|
|
42708
|
+
}
|
|
42709
|
+
}, [handleClose, disableHoverableContent]),
|
|
42710
|
+
onOpen: handleOpen,
|
|
42711
|
+
onClose: handleClose,
|
|
42712
|
+
disableHoverableContent,
|
|
42713
|
+
children
|
|
42714
|
+
}
|
|
42715
|
+
) });
|
|
42716
|
+
};
|
|
42717
|
+
Tooltip.displayName = TOOLTIP_NAME;
|
|
42718
|
+
var TRIGGER_NAME5 = "TooltipTrigger";
|
|
42719
|
+
var TooltipTrigger = React54.forwardRef(
|
|
42720
|
+
(props, forwardedRef) => {
|
|
42721
|
+
const { __scopeTooltip, ...triggerProps } = props;
|
|
42722
|
+
const context = useTooltipContext(TRIGGER_NAME5, __scopeTooltip);
|
|
42723
|
+
const providerContext = useTooltipProviderContext(TRIGGER_NAME5, __scopeTooltip);
|
|
42724
|
+
const popperScope = usePopperScope3(__scopeTooltip);
|
|
42725
|
+
const ref = React54.useRef(null);
|
|
42726
|
+
const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
|
|
42727
|
+
const isPointerDownRef = React54.useRef(false);
|
|
42728
|
+
const hasPointerMoveOpenedRef = React54.useRef(false);
|
|
42729
|
+
const handlePointerUp = React54.useCallback(() => isPointerDownRef.current = false, []);
|
|
42730
|
+
React54.useEffect(() => {
|
|
42731
|
+
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
42732
|
+
}, [handlePointerUp]);
|
|
42733
|
+
return /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx(
|
|
42734
|
+
Primitive18.button,
|
|
42735
|
+
{
|
|
42736
|
+
"aria-describedby": context.open ? context.contentId : void 0,
|
|
42737
|
+
"data-state": context.stateAttribute,
|
|
42738
|
+
...triggerProps,
|
|
42739
|
+
ref: composedRefs,
|
|
42740
|
+
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
42741
|
+
if (event.pointerType === "touch") return;
|
|
42742
|
+
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
|
|
42743
|
+
context.onTriggerEnter();
|
|
42744
|
+
hasPointerMoveOpenedRef.current = true;
|
|
42745
|
+
}
|
|
42746
|
+
}),
|
|
42747
|
+
onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
|
|
42748
|
+
context.onTriggerLeave();
|
|
42749
|
+
hasPointerMoveOpenedRef.current = false;
|
|
42750
|
+
}),
|
|
42751
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, () => {
|
|
42752
|
+
if (context.open) {
|
|
42753
|
+
context.onClose();
|
|
42754
|
+
}
|
|
42755
|
+
isPointerDownRef.current = true;
|
|
42756
|
+
document.addEventListener("pointerup", handlePointerUp, { once: true });
|
|
42757
|
+
}),
|
|
42758
|
+
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
42759
|
+
if (!isPointerDownRef.current) context.onOpen();
|
|
42760
|
+
}),
|
|
42761
|
+
onBlur: composeEventHandlers(props.onBlur, context.onClose),
|
|
42762
|
+
onClick: composeEventHandlers(props.onClick, context.onClose)
|
|
42763
|
+
}
|
|
42764
|
+
) });
|
|
42765
|
+
}
|
|
42766
|
+
);
|
|
42767
|
+
TooltipTrigger.displayName = TRIGGER_NAME5;
|
|
42768
|
+
var PORTAL_NAME5 = "TooltipPortal";
|
|
42769
|
+
var [PortalProvider3, usePortalContext3] = createTooltipContext(PORTAL_NAME5, {
|
|
42770
|
+
forceMount: void 0
|
|
42771
|
+
});
|
|
42772
|
+
var TooltipPortal = (props) => {
|
|
42773
|
+
const { __scopeTooltip, forceMount, children, container } = props;
|
|
42774
|
+
const context = useTooltipContext(PORTAL_NAME5, __scopeTooltip);
|
|
42775
|
+
return /* @__PURE__ */ jsx(PortalProvider3, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal, { asChild: true, container, children }) }) });
|
|
42776
|
+
};
|
|
42777
|
+
TooltipPortal.displayName = PORTAL_NAME5;
|
|
42778
|
+
var CONTENT_NAME5 = "TooltipContent";
|
|
42779
|
+
var TooltipContent = React54.forwardRef(
|
|
42780
|
+
(props, forwardedRef) => {
|
|
42781
|
+
const portalContext = usePortalContext3(CONTENT_NAME5, props.__scopeTooltip);
|
|
42782
|
+
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
42783
|
+
const context = useTooltipContext(CONTENT_NAME5, props.__scopeTooltip);
|
|
42784
|
+
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 }) });
|
|
42785
|
+
}
|
|
42786
|
+
);
|
|
42787
|
+
var TooltipContentHoverable = React54.forwardRef((props, forwardedRef) => {
|
|
42788
|
+
const context = useTooltipContext(CONTENT_NAME5, props.__scopeTooltip);
|
|
42789
|
+
const providerContext = useTooltipProviderContext(CONTENT_NAME5, props.__scopeTooltip);
|
|
42790
|
+
const ref = React54.useRef(null);
|
|
42791
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
42792
|
+
const [pointerGraceArea, setPointerGraceArea] = React54.useState(null);
|
|
42793
|
+
const { trigger, onClose } = context;
|
|
42794
|
+
const content = ref.current;
|
|
42795
|
+
const { onPointerInTransitChange } = providerContext;
|
|
42796
|
+
const handleRemoveGraceArea = React54.useCallback(() => {
|
|
42797
|
+
setPointerGraceArea(null);
|
|
42798
|
+
onPointerInTransitChange(false);
|
|
42799
|
+
}, [onPointerInTransitChange]);
|
|
42800
|
+
const handleCreateGraceArea = React54.useCallback(
|
|
42801
|
+
(event, hoverTarget) => {
|
|
42802
|
+
const currentTarget = event.currentTarget;
|
|
42803
|
+
const exitPoint = { x: event.clientX, y: event.clientY };
|
|
42804
|
+
const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
|
|
42805
|
+
const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
|
|
42806
|
+
const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
|
|
42807
|
+
const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
|
|
42808
|
+
setPointerGraceArea(graceArea);
|
|
42809
|
+
onPointerInTransitChange(true);
|
|
42810
|
+
},
|
|
42811
|
+
[onPointerInTransitChange]
|
|
42812
|
+
);
|
|
42813
|
+
React54.useEffect(() => {
|
|
42814
|
+
return () => handleRemoveGraceArea();
|
|
42815
|
+
}, [handleRemoveGraceArea]);
|
|
42816
|
+
React54.useEffect(() => {
|
|
42817
|
+
if (trigger && content) {
|
|
42818
|
+
const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
|
|
42819
|
+
const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
|
|
42820
|
+
trigger.addEventListener("pointerleave", handleTriggerLeave);
|
|
42821
|
+
content.addEventListener("pointerleave", handleContentLeave);
|
|
42822
|
+
return () => {
|
|
42823
|
+
trigger.removeEventListener("pointerleave", handleTriggerLeave);
|
|
42824
|
+
content.removeEventListener("pointerleave", handleContentLeave);
|
|
42825
|
+
};
|
|
42826
|
+
}
|
|
42827
|
+
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
|
|
42828
|
+
React54.useEffect(() => {
|
|
42829
|
+
if (pointerGraceArea) {
|
|
42830
|
+
const handleTrackPointerGrace = (event) => {
|
|
42831
|
+
const target = event.target;
|
|
42832
|
+
const pointerPosition = { x: event.clientX, y: event.clientY };
|
|
42833
|
+
const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target)) || (content == null ? void 0 : content.contains(target));
|
|
42834
|
+
const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
|
|
42835
|
+
if (hasEnteredTarget) {
|
|
42836
|
+
handleRemoveGraceArea();
|
|
42837
|
+
} else if (isPointerOutsideGraceArea) {
|
|
42838
|
+
handleRemoveGraceArea();
|
|
42839
|
+
onClose();
|
|
42840
|
+
}
|
|
42841
|
+
};
|
|
42842
|
+
document.addEventListener("pointermove", handleTrackPointerGrace);
|
|
42843
|
+
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
42844
|
+
}
|
|
42845
|
+
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
42846
|
+
return /* @__PURE__ */ jsx(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
42847
|
+
});
|
|
42848
|
+
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
42849
|
+
var Slottable = createSlottable("TooltipContent");
|
|
42850
|
+
var TooltipContentImpl = React54.forwardRef(
|
|
42851
|
+
(props, forwardedRef) => {
|
|
42852
|
+
const {
|
|
42853
|
+
__scopeTooltip,
|
|
42854
|
+
children,
|
|
42855
|
+
"aria-label": ariaLabel,
|
|
42856
|
+
onEscapeKeyDown,
|
|
42857
|
+
onPointerDownOutside,
|
|
42858
|
+
...contentProps
|
|
42859
|
+
} = props;
|
|
42860
|
+
const context = useTooltipContext(CONTENT_NAME5, __scopeTooltip);
|
|
42861
|
+
const popperScope = usePopperScope3(__scopeTooltip);
|
|
42862
|
+
const { onClose } = context;
|
|
42863
|
+
React54.useEffect(() => {
|
|
42864
|
+
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
42865
|
+
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
42866
|
+
}, [onClose]);
|
|
42867
|
+
React54.useEffect(() => {
|
|
42868
|
+
if (context.trigger) {
|
|
42869
|
+
const handleScroll2 = (event) => {
|
|
42870
|
+
const target = event.target;
|
|
42871
|
+
if (target == null ? void 0 : target.contains(context.trigger)) onClose();
|
|
42872
|
+
};
|
|
42873
|
+
window.addEventListener("scroll", handleScroll2, { capture: true });
|
|
42874
|
+
return () => window.removeEventListener("scroll", handleScroll2, { capture: true });
|
|
42875
|
+
}
|
|
42876
|
+
}, [context.trigger, onClose]);
|
|
42877
|
+
return /* @__PURE__ */ jsx(
|
|
42878
|
+
DismissableLayer,
|
|
42879
|
+
{
|
|
42880
|
+
asChild: true,
|
|
42881
|
+
disableOutsidePointerEvents: false,
|
|
42882
|
+
onEscapeKeyDown,
|
|
42883
|
+
onPointerDownOutside,
|
|
42884
|
+
onFocusOutside: (event) => event.preventDefault(),
|
|
42885
|
+
onDismiss: onClose,
|
|
42886
|
+
children: /* @__PURE__ */ jsxs(
|
|
42887
|
+
Content,
|
|
42888
|
+
{
|
|
42889
|
+
"data-state": context.stateAttribute,
|
|
42890
|
+
...popperScope,
|
|
42891
|
+
...contentProps,
|
|
42892
|
+
ref: forwardedRef,
|
|
42893
|
+
style: {
|
|
42894
|
+
...contentProps.style,
|
|
42895
|
+
// re-namespace exposed content custom properties
|
|
42896
|
+
...{
|
|
42897
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
42898
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
42899
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
42900
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
42901
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
42902
|
+
}
|
|
42903
|
+
},
|
|
42904
|
+
children: [
|
|
42905
|
+
/* @__PURE__ */ jsx(Slottable, { children }),
|
|
42906
|
+
/* @__PURE__ */ jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsx(Root3, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
|
|
42907
|
+
]
|
|
42908
|
+
}
|
|
42909
|
+
)
|
|
42910
|
+
}
|
|
42911
|
+
);
|
|
42912
|
+
}
|
|
42913
|
+
);
|
|
42914
|
+
TooltipContent.displayName = CONTENT_NAME5;
|
|
42915
|
+
var ARROW_NAME4 = "TooltipArrow";
|
|
42916
|
+
var TooltipArrow = React54.forwardRef(
|
|
42917
|
+
(props, forwardedRef) => {
|
|
42918
|
+
const { __scopeTooltip, ...arrowProps } = props;
|
|
42919
|
+
const popperScope = usePopperScope3(__scopeTooltip);
|
|
42920
|
+
const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
|
|
42921
|
+
ARROW_NAME4,
|
|
42922
|
+
__scopeTooltip
|
|
42923
|
+
);
|
|
42924
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsx(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
42925
|
+
}
|
|
42926
|
+
);
|
|
42927
|
+
TooltipArrow.displayName = ARROW_NAME4;
|
|
42928
|
+
function getExitSideFromRect(point, rect) {
|
|
42929
|
+
const top = Math.abs(rect.top - point.y);
|
|
42930
|
+
const bottom = Math.abs(rect.bottom - point.y);
|
|
42931
|
+
const right = Math.abs(rect.right - point.x);
|
|
42932
|
+
const left = Math.abs(rect.left - point.x);
|
|
42933
|
+
switch (Math.min(top, bottom, right, left)) {
|
|
42934
|
+
case left:
|
|
42935
|
+
return "left";
|
|
42936
|
+
case right:
|
|
42937
|
+
return "right";
|
|
42938
|
+
case top:
|
|
42939
|
+
return "top";
|
|
42940
|
+
case bottom:
|
|
42941
|
+
return "bottom";
|
|
42942
|
+
default:
|
|
42943
|
+
throw new Error("unreachable");
|
|
42944
|
+
}
|
|
42945
|
+
}
|
|
42946
|
+
function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
|
|
42947
|
+
const paddedExitPoints = [];
|
|
42948
|
+
switch (exitSide) {
|
|
42949
|
+
case "top":
|
|
42950
|
+
paddedExitPoints.push(
|
|
42951
|
+
{ x: exitPoint.x - padding, y: exitPoint.y + padding },
|
|
42952
|
+
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
42953
|
+
);
|
|
42954
|
+
break;
|
|
42955
|
+
case "bottom":
|
|
42956
|
+
paddedExitPoints.push(
|
|
42957
|
+
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
42958
|
+
{ x: exitPoint.x + padding, y: exitPoint.y - padding }
|
|
42959
|
+
);
|
|
42960
|
+
break;
|
|
42961
|
+
case "left":
|
|
42962
|
+
paddedExitPoints.push(
|
|
42963
|
+
{ x: exitPoint.x + padding, y: exitPoint.y - padding },
|
|
42964
|
+
{ x: exitPoint.x + padding, y: exitPoint.y + padding }
|
|
42965
|
+
);
|
|
42966
|
+
break;
|
|
42967
|
+
case "right":
|
|
42968
|
+
paddedExitPoints.push(
|
|
42969
|
+
{ x: exitPoint.x - padding, y: exitPoint.y - padding },
|
|
42970
|
+
{ x: exitPoint.x - padding, y: exitPoint.y + padding }
|
|
42971
|
+
);
|
|
42972
|
+
break;
|
|
42973
|
+
}
|
|
42974
|
+
return paddedExitPoints;
|
|
42975
|
+
}
|
|
42976
|
+
function getPointsFromRect(rect) {
|
|
42977
|
+
const { top, right, bottom, left } = rect;
|
|
42978
|
+
return [
|
|
42979
|
+
{ x: left, y: top },
|
|
42980
|
+
{ x: right, y: top },
|
|
42981
|
+
{ x: right, y: bottom },
|
|
42982
|
+
{ x: left, y: bottom }
|
|
42983
|
+
];
|
|
42984
|
+
}
|
|
42985
|
+
function isPointInPolygon(point, polygon) {
|
|
42986
|
+
const { x, y } = point;
|
|
42987
|
+
let inside = false;
|
|
42988
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
42989
|
+
const ii = polygon[i];
|
|
42990
|
+
const jj = polygon[j];
|
|
42991
|
+
const xi = ii.x;
|
|
42992
|
+
const yi = ii.y;
|
|
42993
|
+
const xj = jj.x;
|
|
42994
|
+
const yj = jj.y;
|
|
42995
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
42996
|
+
if (intersect) inside = !inside;
|
|
42997
|
+
}
|
|
42998
|
+
return inside;
|
|
42999
|
+
}
|
|
43000
|
+
function getHull(points) {
|
|
43001
|
+
const newPoints = points.slice();
|
|
43002
|
+
newPoints.sort((a, b) => {
|
|
43003
|
+
if (a.x < b.x) return -1;
|
|
43004
|
+
else if (a.x > b.x) return 1;
|
|
43005
|
+
else if (a.y < b.y) return -1;
|
|
43006
|
+
else if (a.y > b.y) return 1;
|
|
43007
|
+
else return 0;
|
|
43008
|
+
});
|
|
43009
|
+
return getHullPresorted(newPoints);
|
|
43010
|
+
}
|
|
43011
|
+
function getHullPresorted(points) {
|
|
43012
|
+
if (points.length <= 1) return points.slice();
|
|
43013
|
+
const upperHull = [];
|
|
43014
|
+
for (let i = 0; i < points.length; i++) {
|
|
43015
|
+
const p = points[i];
|
|
43016
|
+
while (upperHull.length >= 2) {
|
|
43017
|
+
const q = upperHull[upperHull.length - 1];
|
|
43018
|
+
const r2 = upperHull[upperHull.length - 2];
|
|
43019
|
+
if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) upperHull.pop();
|
|
43020
|
+
else break;
|
|
43021
|
+
}
|
|
43022
|
+
upperHull.push(p);
|
|
43023
|
+
}
|
|
43024
|
+
upperHull.pop();
|
|
43025
|
+
const lowerHull = [];
|
|
43026
|
+
for (let i = points.length - 1; i >= 0; i--) {
|
|
43027
|
+
const p = points[i];
|
|
43028
|
+
while (lowerHull.length >= 2) {
|
|
43029
|
+
const q = lowerHull[lowerHull.length - 1];
|
|
43030
|
+
const r2 = lowerHull[lowerHull.length - 2];
|
|
43031
|
+
if ((q.x - r2.x) * (p.y - r2.y) >= (q.y - r2.y) * (p.x - r2.x)) lowerHull.pop();
|
|
43032
|
+
else break;
|
|
43033
|
+
}
|
|
43034
|
+
lowerHull.push(p);
|
|
43035
|
+
}
|
|
43036
|
+
lowerHull.pop();
|
|
43037
|
+
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
|
|
43038
|
+
return upperHull;
|
|
43039
|
+
} else {
|
|
43040
|
+
return upperHull.concat(lowerHull);
|
|
43041
|
+
}
|
|
43042
|
+
}
|
|
43043
|
+
var Provider = TooltipProvider;
|
|
43044
|
+
var Root32 = Tooltip;
|
|
43045
|
+
var Trigger4 = TooltipTrigger;
|
|
43046
|
+
var Portal5 = TooltipPortal;
|
|
43047
|
+
var Content23 = TooltipContent;
|
|
43048
|
+
var Arrow22 = TooltipArrow;
|
|
43049
|
+
function TooltipProvider2({
|
|
43050
|
+
delayDuration = 0,
|
|
43051
|
+
...props
|
|
43052
|
+
}) {
|
|
43053
|
+
return /* @__PURE__ */ jsx(
|
|
43054
|
+
Provider,
|
|
43055
|
+
{
|
|
43056
|
+
"data-slot": "tooltip-provider",
|
|
43057
|
+
delayDuration,
|
|
43058
|
+
...props
|
|
43059
|
+
}
|
|
43060
|
+
);
|
|
43061
|
+
}
|
|
43062
|
+
function Tooltip2({
|
|
43063
|
+
...props
|
|
43064
|
+
}) {
|
|
43065
|
+
return /* @__PURE__ */ jsx(TooltipProvider2, { children: /* @__PURE__ */ jsx(Root32, { "data-slot": "tooltip", ...props }) });
|
|
43066
|
+
}
|
|
43067
|
+
function TooltipTrigger2({
|
|
43068
|
+
...props
|
|
43069
|
+
}) {
|
|
43070
|
+
return /* @__PURE__ */ jsx(Trigger4, { "data-slot": "tooltip-trigger", ...props });
|
|
43071
|
+
}
|
|
43072
|
+
function TooltipContent2({
|
|
43073
|
+
className,
|
|
43074
|
+
sideOffset = 0,
|
|
43075
|
+
children,
|
|
43076
|
+
...props
|
|
43077
|
+
}) {
|
|
43078
|
+
return /* @__PURE__ */ jsx(Portal5, { children: /* @__PURE__ */ jsxs(
|
|
43079
|
+
Content23,
|
|
43080
|
+
{
|
|
43081
|
+
"data-slot": "tooltip-content",
|
|
43082
|
+
sideOffset,
|
|
43083
|
+
className: cn(
|
|
43084
|
+
"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",
|
|
43085
|
+
className
|
|
43086
|
+
),
|
|
43087
|
+
...props,
|
|
43088
|
+
children: [
|
|
43089
|
+
children,
|
|
43090
|
+
/* @__PURE__ */ jsx(Arrow22, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
43091
|
+
]
|
|
43092
|
+
}
|
|
43093
|
+
) });
|
|
43094
|
+
}
|
|
43095
|
+
function mapSizeToToggleSize(size4) {
|
|
43096
|
+
switch (size4) {
|
|
43097
|
+
case "sm":
|
|
43098
|
+
return "sm";
|
|
43099
|
+
case "lg":
|
|
43100
|
+
return "lg";
|
|
43101
|
+
case "md":
|
|
43102
|
+
default:
|
|
43103
|
+
return "default";
|
|
43104
|
+
}
|
|
43105
|
+
}
|
|
43106
|
+
function normalizeValue(val, multiple) {
|
|
43107
|
+
if (multiple) {
|
|
43108
|
+
if (Array.isArray(val)) return val;
|
|
43109
|
+
if (typeof val === "string") return [val];
|
|
43110
|
+
return [];
|
|
43111
|
+
}
|
|
43112
|
+
if (Array.isArray(val)) return val[0] || "";
|
|
43113
|
+
return val || "";
|
|
43114
|
+
}
|
|
43115
|
+
function capitalizeFirst6(label) {
|
|
43116
|
+
if (!label) return label;
|
|
43117
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
43118
|
+
}
|
|
43119
|
+
function normalizeOption(input, {
|
|
43120
|
+
optionValue,
|
|
43121
|
+
optionLabel,
|
|
43122
|
+
optionIcon,
|
|
43123
|
+
optionDisabled,
|
|
43124
|
+
optionTooltip,
|
|
43125
|
+
optionMeta
|
|
43126
|
+
}, autoCap) {
|
|
43127
|
+
var _a, _b, _c, _d, _e, _f;
|
|
43128
|
+
const anyInput = input;
|
|
43129
|
+
if (optionValue || optionLabel || optionIcon || optionDisabled || optionTooltip || optionMeta) {
|
|
43130
|
+
const rawValue = optionValue != null ? anyInput[optionValue] : (_a = anyInput.value) != null ? _a : input;
|
|
43131
|
+
const value2 = String(rawValue);
|
|
43132
|
+
let label2;
|
|
43133
|
+
if (optionLabel != null) {
|
|
43134
|
+
label2 = anyInput[optionLabel];
|
|
43135
|
+
} else if (anyInput.label != null) {
|
|
43136
|
+
label2 = anyInput.label;
|
|
43137
|
+
} else {
|
|
43138
|
+
label2 = String(rawValue != null ? rawValue : value2);
|
|
43139
|
+
}
|
|
43140
|
+
if (autoCap && typeof label2 === "string") {
|
|
43141
|
+
label2 = capitalizeFirst6(label2);
|
|
43142
|
+
}
|
|
43143
|
+
const icon = optionIcon != null ? anyInput[optionIcon] : (_b = anyInput.icon) != null ? _b : void 0;
|
|
43144
|
+
const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
|
|
43145
|
+
const tooltip = optionTooltip != null ? anyInput[optionTooltip] : (_c = anyInput.tooltip) != null ? _c : void 0;
|
|
43146
|
+
const meta = optionMeta != null ? anyInput[optionMeta] : (_d = anyInput.meta) != null ? _d : void 0;
|
|
43147
|
+
return {
|
|
43148
|
+
ui: {
|
|
43149
|
+
value: value2,
|
|
43150
|
+
label: label2,
|
|
43151
|
+
icon,
|
|
43152
|
+
disabled,
|
|
43153
|
+
tooltip,
|
|
43154
|
+
meta
|
|
43155
|
+
},
|
|
43156
|
+
raw: input
|
|
43157
|
+
};
|
|
43158
|
+
}
|
|
43159
|
+
if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
|
|
43160
|
+
const value2 = String(input);
|
|
43161
|
+
let label2 = value2;
|
|
43162
|
+
if (autoCap && typeof label2 === "string") {
|
|
43163
|
+
label2 = capitalizeFirst6(label2);
|
|
43164
|
+
}
|
|
43165
|
+
return {
|
|
43166
|
+
ui: {
|
|
43167
|
+
value: value2,
|
|
43168
|
+
label: label2
|
|
43169
|
+
},
|
|
43170
|
+
raw: input
|
|
43171
|
+
};
|
|
43172
|
+
}
|
|
43173
|
+
const baseValue = (_f = anyInput.value) != null ? _f : String((_e = anyInput.label) != null ? _e : "");
|
|
43174
|
+
const value = String(baseValue);
|
|
43175
|
+
let label = anyInput.label != null ? anyInput.label : String(value);
|
|
43176
|
+
if (autoCap && typeof label === "string") {
|
|
43177
|
+
label = capitalizeFirst6(label);
|
|
43178
|
+
}
|
|
43179
|
+
return {
|
|
43180
|
+
ui: {
|
|
43181
|
+
value,
|
|
43182
|
+
label,
|
|
43183
|
+
icon: anyInput.icon,
|
|
43184
|
+
disabled: !!anyInput.disabled,
|
|
43185
|
+
tooltip: anyInput.tooltip,
|
|
43186
|
+
meta: anyInput.meta
|
|
43187
|
+
},
|
|
43188
|
+
raw: input
|
|
43189
|
+
};
|
|
43190
|
+
}
|
|
43191
|
+
var ShadcnToggleVariant3 = React54.forwardRef(function ShadcnToggleVariant4(props, ref) {
|
|
43192
|
+
const {
|
|
43193
|
+
value,
|
|
43194
|
+
onValue,
|
|
43195
|
+
disabled,
|
|
43196
|
+
readOnly,
|
|
43197
|
+
error,
|
|
43198
|
+
size: size4 = "md",
|
|
43199
|
+
options = [],
|
|
43200
|
+
multiple = false,
|
|
43201
|
+
variant = "default",
|
|
43202
|
+
layout = "horizontal",
|
|
43203
|
+
gridCols = 2,
|
|
43204
|
+
fillWidth: fullWidth = false,
|
|
43205
|
+
optionValue,
|
|
43206
|
+
optionLabel,
|
|
43207
|
+
optionIcon,
|
|
43208
|
+
optionDisabled,
|
|
43209
|
+
optionTooltip,
|
|
43210
|
+
optionMeta,
|
|
43211
|
+
renderOption,
|
|
43212
|
+
className,
|
|
43213
|
+
itemClassName,
|
|
43214
|
+
activeClassName,
|
|
43215
|
+
autoCap = false,
|
|
43216
|
+
gap: itemGapPx
|
|
43217
|
+
} = props;
|
|
43218
|
+
const isDisabled = !!disabled || !!readOnly;
|
|
43219
|
+
const toggleSize = mapSizeToToggleSize(size4);
|
|
43220
|
+
const currentValue = normalizeValue(value, multiple);
|
|
43221
|
+
const normalizedOptions = React54.useMemo(
|
|
43222
|
+
() => options.map(
|
|
43223
|
+
(opt) => normalizeOption(
|
|
43224
|
+
opt,
|
|
43225
|
+
{
|
|
43226
|
+
optionValue,
|
|
43227
|
+
optionLabel,
|
|
43228
|
+
optionIcon,
|
|
43229
|
+
optionDisabled,
|
|
43230
|
+
optionTooltip,
|
|
43231
|
+
optionMeta
|
|
43232
|
+
},
|
|
43233
|
+
autoCap
|
|
43234
|
+
)
|
|
43235
|
+
),
|
|
43236
|
+
[
|
|
43237
|
+
options,
|
|
43238
|
+
optionValue,
|
|
43239
|
+
optionLabel,
|
|
43240
|
+
optionIcon,
|
|
43241
|
+
optionDisabled,
|
|
43242
|
+
optionTooltip,
|
|
43243
|
+
optionMeta,
|
|
43244
|
+
autoCap
|
|
43245
|
+
]
|
|
43246
|
+
);
|
|
43247
|
+
const handleChange = React54.useCallback(
|
|
43248
|
+
(val) => {
|
|
43249
|
+
if (readOnly) return;
|
|
43250
|
+
if (!onValue) return;
|
|
43251
|
+
let rawSelection;
|
|
43252
|
+
if (Array.isArray(val)) {
|
|
43253
|
+
const selected = normalizedOptions.filter(
|
|
43254
|
+
(entry) => val.includes(entry.ui.value)
|
|
43255
|
+
);
|
|
43256
|
+
rawSelection = selected.map((entry) => entry.raw);
|
|
43257
|
+
} else {
|
|
43258
|
+
const found = normalizedOptions.find(
|
|
43259
|
+
(entry) => entry.ui.value === val
|
|
43260
|
+
);
|
|
43261
|
+
rawSelection = found == null ? void 0 : found.raw;
|
|
43262
|
+
}
|
|
43263
|
+
const detail = {
|
|
43264
|
+
source: "variant",
|
|
43265
|
+
raw: rawSelection,
|
|
43266
|
+
// original item(s)
|
|
43267
|
+
nativeEvent: void 0,
|
|
43268
|
+
meta: { action: "toggle" }
|
|
43269
|
+
};
|
|
43270
|
+
onValue(val, detail);
|
|
43271
|
+
},
|
|
43272
|
+
[onValue, readOnly, normalizedOptions]
|
|
43273
|
+
);
|
|
43274
|
+
const layoutClasses = cn(
|
|
43275
|
+
layout === "horizontal" && "flex flex-wrap",
|
|
43276
|
+
layout === "vertical" && "flex flex-col items-stretch",
|
|
43277
|
+
layout === "grid" && "grid",
|
|
43278
|
+
fullWidth && "w-full",
|
|
43279
|
+
fullWidth && layout === "horizontal" && "[&>*]:flex-1",
|
|
43280
|
+
fullWidth && layout === "vertical" && "[&>*]:w-full",
|
|
43281
|
+
className
|
|
43282
|
+
);
|
|
43283
|
+
console.log(layoutClasses, fullWidth, autoCap);
|
|
43284
|
+
const groupStyle = React54.useMemo(() => {
|
|
43285
|
+
const style = {};
|
|
43286
|
+
if (layout === "grid") {
|
|
43287
|
+
style.gridTemplateColumns = `repeat(${gridCols}, minmax(0, 1fr))`;
|
|
43288
|
+
}
|
|
43289
|
+
if (typeof itemGapPx === "number") {
|
|
43290
|
+
style.gap = itemGapPx;
|
|
43291
|
+
}
|
|
43292
|
+
return Object.keys(style).length ? style : void 0;
|
|
43293
|
+
}, [layout, gridCols, itemGapPx]);
|
|
43294
|
+
return /* @__PURE__ */ jsx(
|
|
43295
|
+
ToggleGroup2,
|
|
43296
|
+
{
|
|
43297
|
+
ref,
|
|
43298
|
+
type: multiple ? "multiple" : "single",
|
|
43299
|
+
value: currentValue,
|
|
43300
|
+
onValueChange: handleChange,
|
|
43301
|
+
disabled: isDisabled,
|
|
43302
|
+
variant,
|
|
43303
|
+
size: toggleSize,
|
|
43304
|
+
className: layoutClasses,
|
|
43305
|
+
style: groupStyle,
|
|
43306
|
+
"aria-invalid": !!error,
|
|
43307
|
+
children: normalizedOptions.map(({ ui: opt }) => {
|
|
43308
|
+
const isSelected = multiple ? currentValue.includes(opt.value) : currentValue === opt.value;
|
|
43309
|
+
const contentNode = renderOption ? renderOption(opt, isSelected) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 truncate", children: [
|
|
43310
|
+
opt.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: opt.icon }),
|
|
43311
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: opt.label })
|
|
43312
|
+
] });
|
|
43313
|
+
const itemNode = /* @__PURE__ */ jsx(
|
|
43314
|
+
ToggleGroupItem2,
|
|
43315
|
+
{
|
|
43316
|
+
value: opt.value,
|
|
43317
|
+
disabled: opt.disabled,
|
|
43318
|
+
"aria-label": typeof opt.label === "string" ? opt.label : opt.value,
|
|
43319
|
+
className: cn(
|
|
43320
|
+
// Base Transitions
|
|
43321
|
+
"transition-all",
|
|
43322
|
+
// Default Active State (Shadcn defaults)
|
|
43323
|
+
"data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
|
|
43324
|
+
// Error State
|
|
43325
|
+
error && "border-destructive/50 hover:bg-destructive/10 data-[state=on]:bg-destructive data-[state=on]:text-destructive-foreground",
|
|
43326
|
+
// Variant: Outline specific tweaks
|
|
43327
|
+
variant === "outline" && layout === "horizontal" && !fullWidth && "first:rounded-l-md last:rounded-r-md rounded-none border-l-0 first:border-l",
|
|
43328
|
+
// Layout tweaks
|
|
43329
|
+
fullWidth && "justify-center",
|
|
43330
|
+
// Custom Item Class
|
|
43331
|
+
itemClassName,
|
|
43332
|
+
// Active Class Name (Applied only when selected)
|
|
43333
|
+
isSelected && activeClassName
|
|
43334
|
+
),
|
|
43335
|
+
children: contentNode
|
|
43336
|
+
},
|
|
43337
|
+
opt.value
|
|
43338
|
+
);
|
|
43339
|
+
if (opt.tooltip && !isDisabled) {
|
|
43340
|
+
return /* @__PURE__ */ jsx(TooltipProvider2, { delayDuration: 300, children: /* @__PURE__ */ jsxs(Tooltip2, { children: [
|
|
43341
|
+
/* @__PURE__ */ jsx(TooltipTrigger2, { asChild: true, children: itemNode }),
|
|
43342
|
+
/* @__PURE__ */ jsx(TooltipContent2, { children: /* @__PURE__ */ jsx("p", { children: opt.tooltip }) })
|
|
43343
|
+
] }) }, opt.value);
|
|
43344
|
+
}
|
|
43345
|
+
return itemNode;
|
|
43346
|
+
})
|
|
43347
|
+
}
|
|
43348
|
+
);
|
|
43349
|
+
});
|
|
43350
|
+
ShadcnToggleVariant3.displayName = "ShadcnToggleVariant";
|
|
43351
|
+
|
|
43352
|
+
// src/variants/core/toggle-group.tsx
|
|
43353
|
+
var toggleGroupModule = {
|
|
43354
|
+
variant: "toggle-group",
|
|
43355
|
+
Variant: ShadcnToggleVariant3,
|
|
43356
|
+
meta: {
|
|
43357
|
+
label: "Toggle group",
|
|
43358
|
+
description: "Toggle group component buttons.",
|
|
43359
|
+
tags: ["buttons", "toggle"]
|
|
43360
|
+
}
|
|
43361
|
+
};
|
|
41957
43362
|
|
|
41958
43363
|
// src/variants/index.ts
|
|
41959
43364
|
var variants = [
|
|
@@ -41974,13 +43379,14 @@ var variants = [
|
|
|
41974
43379
|
keyValueModule,
|
|
41975
43380
|
custom_default,
|
|
41976
43381
|
treeselect_default2,
|
|
41977
|
-
fileManagerModule
|
|
43382
|
+
fileManagerModule,
|
|
43383
|
+
toggleGroupModule
|
|
41978
43384
|
];
|
|
41979
43385
|
function registerCoreVariants() {
|
|
41980
43386
|
variants.forEach((item) => registerVariant(item));
|
|
41981
43387
|
}
|
|
41982
43388
|
registerCoreVariants();
|
|
41983
|
-
var
|
|
43389
|
+
var NODES19 = [
|
|
41984
43390
|
"a",
|
|
41985
43391
|
"button",
|
|
41986
43392
|
"div",
|
|
@@ -41999,7 +43405,7 @@ var NODES16 = [
|
|
|
41999
43405
|
"svg",
|
|
42000
43406
|
"ul"
|
|
42001
43407
|
];
|
|
42002
|
-
var
|
|
43408
|
+
var Primitive19 = NODES19.reduce((primitive, node) => {
|
|
42003
43409
|
const Slot5 = createSlot10(`Primitive.${node}`);
|
|
42004
43410
|
const Node2 = React54.forwardRef((props, forwardedRef) => {
|
|
42005
43411
|
const { asChild, ...primitiveProps } = props;
|
|
@@ -42012,10 +43418,10 @@ var Primitive16 = NODES16.reduce((primitive, node) => {
|
|
|
42012
43418
|
Node2.displayName = `Primitive.${node}`;
|
|
42013
43419
|
return { ...primitive, [node]: Node2 };
|
|
42014
43420
|
}, {});
|
|
42015
|
-
var
|
|
43421
|
+
var NAME4 = "Label";
|
|
42016
43422
|
var Label2 = React54.forwardRef((props, forwardedRef) => {
|
|
42017
43423
|
return /* @__PURE__ */ jsx(
|
|
42018
|
-
|
|
43424
|
+
Primitive19.label,
|
|
42019
43425
|
{
|
|
42020
43426
|
...props,
|
|
42021
43427
|
ref: forwardedRef,
|
|
@@ -42029,14 +43435,14 @@ var Label2 = React54.forwardRef((props, forwardedRef) => {
|
|
|
42029
43435
|
}
|
|
42030
43436
|
);
|
|
42031
43437
|
});
|
|
42032
|
-
Label2.displayName =
|
|
42033
|
-
var
|
|
43438
|
+
Label2.displayName = NAME4;
|
|
43439
|
+
var Root10 = Label2;
|
|
42034
43440
|
function Label3({
|
|
42035
43441
|
className,
|
|
42036
43442
|
...props
|
|
42037
43443
|
}) {
|
|
42038
43444
|
return /* @__PURE__ */ jsx(
|
|
42039
|
-
|
|
43445
|
+
Root10,
|
|
42040
43446
|
{
|
|
42041
43447
|
"data-slot": "label",
|
|
42042
43448
|
className: cn(
|