@seeqdev/qomponents 0.0.59 → 0.0.60
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/FontCustom.woff +0 -0
- package/dist/FontCustom.woff2 +0 -0
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +0 -2
- package/dist/index.d.ts +0 -4
- package/dist/index.esm.js +20 -855
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -856
- package/dist/index.js.map +1 -1
- package/dist/styles.css +4 -188
- package/package.json +3 -4
- package/dist/ButtonWithDropdown/ButtonWithDropdown.d.ts +0 -4
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.d.ts +0 -5
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.d.ts +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +0 -66
- package/dist/ButtonWithDropdown/index.d.ts +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.d.ts +0 -4
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.d.ts +0 -5
- package/dist/ButtonWithPopover/ButtonWithPopover.test.d.ts +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.types.d.ts +0 -48
- package/dist/ButtonWithPopover/index.d.ts +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -2990,20 +2990,6 @@ function useFloating(options) {
|
|
|
2990
2990
|
}), [data, update, refs, elements, floatingStyles]);
|
|
2991
2991
|
}
|
|
2992
2992
|
|
|
2993
|
-
const $7e8f5cd07187803e$export$21b07c8f274aebd5 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
2994
|
-
const { children: children , width: width = 10 , height: height = 5 , ...arrowProps } = props;
|
|
2995
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.svg, _extends({}, arrowProps, {
|
|
2996
|
-
ref: forwardedRef,
|
|
2997
|
-
width: width,
|
|
2998
|
-
height: height,
|
|
2999
|
-
viewBox: "0 0 30 10",
|
|
3000
|
-
preserveAspectRatio: "none"
|
|
3001
|
-
}), props.asChild ? children : /*#__PURE__*/ createElement("polygon", {
|
|
3002
|
-
points: "0,0 30,0 15,10"
|
|
3003
|
-
}));
|
|
3004
|
-
});
|
|
3005
|
-
/* -----------------------------------------------------------------------------------------------*/ const $7e8f5cd07187803e$export$be92b6f5f03c0fe9 = $7e8f5cd07187803e$export$21b07c8f274aebd5;
|
|
3006
|
-
|
|
3007
2993
|
function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
|
|
3008
2994
|
const [size, setSize] = useState(undefined);
|
|
3009
2995
|
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
@@ -3223,52 +3209,6 @@ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ forwardRef((props
|
|
|
3223
3209
|
}
|
|
3224
3210
|
}))));
|
|
3225
3211
|
});
|
|
3226
|
-
/* -------------------------------------------------------------------------------------------------
|
|
3227
|
-
* PopperArrow
|
|
3228
|
-
* -----------------------------------------------------------------------------------------------*/ const $cf1ac5d9fe0e8206$var$ARROW_NAME = 'PopperArrow';
|
|
3229
|
-
const $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE = {
|
|
3230
|
-
top: 'bottom',
|
|
3231
|
-
right: 'left',
|
|
3232
|
-
bottom: 'top',
|
|
3233
|
-
left: 'right'
|
|
3234
|
-
};
|
|
3235
|
-
const $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0 = /*#__PURE__*/ forwardRef(function $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0(props, forwardedRef) {
|
|
3236
|
-
const { __scopePopper: __scopePopper , ...arrowProps } = props;
|
|
3237
|
-
const contentContext = $cf1ac5d9fe0e8206$var$useContentContext($cf1ac5d9fe0e8206$var$ARROW_NAME, __scopePopper);
|
|
3238
|
-
const baseSide = $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE[contentContext.placedSide];
|
|
3239
|
-
return(/*#__PURE__*/ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
3240
|
-
// doesn't report size as we'd expect on SVG elements.
|
|
3241
|
-
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
3242
|
-
createElement("span", {
|
|
3243
|
-
ref: contentContext.onArrowChange,
|
|
3244
|
-
style: {
|
|
3245
|
-
position: 'absolute',
|
|
3246
|
-
left: contentContext.arrowX,
|
|
3247
|
-
top: contentContext.arrowY,
|
|
3248
|
-
[baseSide]: 0,
|
|
3249
|
-
transformOrigin: {
|
|
3250
|
-
top: '',
|
|
3251
|
-
right: '0 0',
|
|
3252
|
-
bottom: 'center 0',
|
|
3253
|
-
left: '100% 0'
|
|
3254
|
-
}[contentContext.placedSide],
|
|
3255
|
-
transform: {
|
|
3256
|
-
top: 'translateY(100%)',
|
|
3257
|
-
right: 'translateY(50%) rotate(90deg) translateX(-50%)',
|
|
3258
|
-
bottom: `rotate(180deg)`,
|
|
3259
|
-
left: 'translateY(50%) rotate(-90deg) translateX(50%)'
|
|
3260
|
-
}[contentContext.placedSide],
|
|
3261
|
-
visibility: contentContext.shouldHideArrow ? 'hidden' : undefined
|
|
3262
|
-
}
|
|
3263
|
-
}, /*#__PURE__*/ createElement($7e8f5cd07187803e$export$be92b6f5f03c0fe9, _extends({}, arrowProps, {
|
|
3264
|
-
ref: forwardedRef,
|
|
3265
|
-
style: {
|
|
3266
|
-
...arrowProps.style,
|
|
3267
|
-
// ensures the element can be measured correctly (mostly for if SVG)
|
|
3268
|
-
display: 'block'
|
|
3269
|
-
}
|
|
3270
|
-
}))));
|
|
3271
|
-
});
|
|
3272
3212
|
/* -----------------------------------------------------------------------------------------------*/ function $cf1ac5d9fe0e8206$var$isNotNull(value) {
|
|
3273
3213
|
return value !== null;
|
|
3274
3214
|
}
|
|
@@ -3324,7 +3264,6 @@ function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) {
|
|
|
3324
3264
|
const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9;
|
|
3325
3265
|
const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d;
|
|
3326
3266
|
const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc;
|
|
3327
|
-
const $cf1ac5d9fe0e8206$export$21b07c8f274aebd5 = $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0;
|
|
3328
3267
|
|
|
3329
3268
|
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
3330
3269
|
var _globalThis$document;
|
|
@@ -4334,7 +4273,7 @@ var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
|
4334
4273
|
|
|
4335
4274
|
var ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
|
|
4336
4275
|
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
4337
|
-
var $
|
|
4276
|
+
var $67UHm$RemoveScroll = ReactRemoveScroll;
|
|
4338
4277
|
|
|
4339
4278
|
/* -------------------------------------------------------------------------------------------------
|
|
4340
4279
|
* Popover
|
|
@@ -4425,7 +4364,7 @@ const $cb5cc270b50c6fcd$export$d7e1f420b25549ff = /*#__PURE__*/ forwardRef((prop
|
|
|
4425
4364
|
const content = contentRef.current;
|
|
4426
4365
|
if (content) return hideOthers(content);
|
|
4427
4366
|
}, []);
|
|
4428
|
-
return /*#__PURE__*/ createElement($
|
|
4367
|
+
return /*#__PURE__*/ createElement($67UHm$RemoveScroll, {
|
|
4429
4368
|
as: $5e63c961fc1ce211$export$8c6ed5c666ac1360,
|
|
4430
4369
|
allowPinchZoom: true
|
|
4431
4370
|
}, /*#__PURE__*/ createElement($cb5cc270b50c6fcd$var$PopoverContentImpl, _extends({}, props, {
|
|
@@ -4527,22 +4466,14 @@ const $cb5cc270b50c6fcd$var$PopoverContentNonModal = /*#__PURE__*/ forwardRef((p
|
|
|
4527
4466
|
}
|
|
4528
4467
|
}))));
|
|
4529
4468
|
});
|
|
4530
|
-
const $cb5cc270b50c6fcd$export$3152841115e061b2 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
4531
|
-
const { __scopePopover: __scopePopover , ...arrowProps } = props;
|
|
4532
|
-
const popperScope = $cb5cc270b50c6fcd$var$usePopperScope(__scopePopover);
|
|
4533
|
-
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$21b07c8f274aebd5, _extends({}, popperScope, arrowProps, {
|
|
4534
|
-
ref: forwardedRef
|
|
4535
|
-
}));
|
|
4536
|
-
});
|
|
4537
4469
|
/* -----------------------------------------------------------------------------------------------*/ function $cb5cc270b50c6fcd$var$getState(open) {
|
|
4538
4470
|
return open ? 'open' : 'closed';
|
|
4539
4471
|
}
|
|
4540
4472
|
const $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9 = $cb5cc270b50c6fcd$export$5b6b19405a83ff9d;
|
|
4541
4473
|
const $cb5cc270b50c6fcd$export$41fb9f06171c75f4 = $cb5cc270b50c6fcd$export$7dacb05d26466c3;
|
|
4542
4474
|
const $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2 = $cb5cc270b50c6fcd$export$d7e1f420b25549ff;
|
|
4543
|
-
const $cb5cc270b50c6fcd$export$21b07c8f274aebd5 = $cb5cc270b50c6fcd$export$3152841115e061b2;
|
|
4544
4475
|
|
|
4545
|
-
const borderStyles$
|
|
4476
|
+
const borderStyles$1 = [
|
|
4546
4477
|
'tw-border-solid',
|
|
4547
4478
|
'tw-border',
|
|
4548
4479
|
'tw-rounded-sm',
|
|
@@ -4576,10 +4507,10 @@ const activeBorderStyles = [
|
|
|
4576
4507
|
'active:tw-border-sq-color-dark',
|
|
4577
4508
|
'dark:hover:tw-border-sq-color-dark-dark',
|
|
4578
4509
|
].join(' ');
|
|
4579
|
-
const bgStyles
|
|
4580
|
-
const disabledClasses$
|
|
4510
|
+
const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
4511
|
+
const disabledClasses$1 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
4581
4512
|
const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React.createElement($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
|
|
4582
|
-
const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip =
|
|
4513
|
+
const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = true, disabled = false, onClick, onHide, }) => {
|
|
4583
4514
|
let tooltipData = undefined;
|
|
4584
4515
|
if (tooltipText) {
|
|
4585
4516
|
tooltipData = {
|
|
@@ -4596,22 +4527,20 @@ const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIco
|
|
|
4596
4527
|
}
|
|
4597
4528
|
};
|
|
4598
4529
|
return (React.createElement($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, { defaultOpen: false, onOpenChange: onOpenChange },
|
|
4599
|
-
React.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
|
|
4530
|
+
React.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, ...tooltipData, onClick: (e) => {
|
|
4600
4531
|
onClick && onClick(e);
|
|
4601
4532
|
} },
|
|
4602
|
-
React.createElement("div", {
|
|
4533
|
+
React.createElement("div", { className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-items-center ${isSmall ? 'tw-py-[1px] tw-px-[5px]' : 'tw-px-2 tw-py-[3px]'} ${disabled ? disabledClasses$1 : isActive ? activeBorderStyles : triggerBorderStyles} ${extraClassNames || ''}` },
|
|
4603
4534
|
React.createElement("span", { className: "tw-nowrap" },
|
|
4604
4535
|
React.createElement(Icon, { icon: icon, testId: "firstIcon", type: "text", large: !isSmall && !label && !secondIcon && !forceSmallIcon, extraClassNames: `tw-text-sq-text-color dark:tw-text-sq-dark-text` }),
|
|
4605
4536
|
secondIcon && React.createElement(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }),
|
|
4606
4537
|
popoverContent ? (React.createElement(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-ml-[3px] tw-text-[8px]", type: "text" })) : undefined),
|
|
4607
4538
|
!isSmall && (React.createElement("small", { className: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-text-[10px]" }, label)))),
|
|
4608
|
-
!!popoverContent ? (React.createElement(PopoverContent, { sideOffset:
|
|
4609
|
-
React.createElement("div", { className: bgStyles
|
|
4610
|
-
' tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem]
|
|
4539
|
+
!!popoverContent ? (React.createElement(PopoverContent, { sideOffset: 4, align: "start" },
|
|
4540
|
+
React.createElement("div", { className: bgStyles +
|
|
4541
|
+
' tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem] outline-none data-[state=open]:animate-in data-[state=closed]:animate-out' +
|
|
4611
4542
|
' data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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' +
|
|
4612
|
-
borderStyles$
|
|
4613
|
-
hasArrow && (React.createElement($cb5cc270b50c6fcd$export$21b07c8f274aebd5, { className: "tw-fill-white tw-stroke-2 dark:tw-fill-sq-dark-background tw-stroke-slate-300 dark:tw-stroke-sq-color-dark-dark" })),
|
|
4614
|
-
popoverContent))) : undefined));
|
|
4543
|
+
borderStyles$1 }, popoverContent))) : undefined));
|
|
4615
4544
|
};
|
|
4616
4545
|
|
|
4617
4546
|
const errorClasses$2 = 'tw-border-sq-danger-color';
|
|
@@ -6520,17 +6449,11 @@ const QTip = () => {
|
|
|
6520
6449
|
let dataset = e.target?.dataset;
|
|
6521
6450
|
let text = dataset?.qtipText;
|
|
6522
6451
|
// Buttons support React.Nodes as children, the tooltip however is applied to the actual button component.
|
|
6523
|
-
// we only check
|
|
6452
|
+
// we only check one level up - alternatively the tooltip can also be provided on the React.Node
|
|
6524
6453
|
if (!text || text === '') {
|
|
6525
|
-
|
|
6526
|
-
dataset = currentTooltipTarget?.dataset;
|
|
6454
|
+
dataset = e.target?.parentElement?.dataset;
|
|
6527
6455
|
text = dataset?.qtipText;
|
|
6528
|
-
|
|
6529
|
-
currentTooltipTarget = e.target?.parentElement?.parentElement;
|
|
6530
|
-
dataset = currentTooltipTarget?.dataset;
|
|
6531
|
-
text = dataset?.qtipText;
|
|
6532
|
-
}
|
|
6533
|
-
tooltipTarget.current = currentTooltipTarget;
|
|
6456
|
+
tooltipTarget.current = e.target?.parentElement;
|
|
6534
6457
|
}
|
|
6535
6458
|
if (text) {
|
|
6536
6459
|
const delay = parseInt(dataset?.qtipDelay ?? DEFAULT_TOOL_TIP_DELAY + '');
|
|
@@ -13595,7 +13518,7 @@ const baseClasses = ['focus:tw-ring-0', 'disabled:tw-cursor-not-allowed'].join('
|
|
|
13595
13518
|
const containerStyles = ['tw-bg-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
13596
13519
|
const errorClasses = 'tw-border-sq-danger-color';
|
|
13597
13520
|
const borderColorClasses = ['tw-border-sq-disabled-gray', 'dark:tw-border-sq-dark-disabled-gray'].join(' ');
|
|
13598
|
-
const borderStyles
|
|
13521
|
+
const borderStyles = [
|
|
13599
13522
|
'tw-border-solid',
|
|
13600
13523
|
'tw-border',
|
|
13601
13524
|
'hover:tw-border-sq-color-dark',
|
|
@@ -13649,7 +13572,7 @@ const optionStyles = [
|
|
|
13649
13572
|
'tw-px-2.5',
|
|
13650
13573
|
'specSelectOption',
|
|
13651
13574
|
].join(' ');
|
|
13652
|
-
const disabledClasses
|
|
13575
|
+
const disabledClasses = ['tw-bg-sq-field-disabled-gray', 'tw-cursor-not-allowed'].join(' ');
|
|
13653
13576
|
const dropDownIndicatorStyles = `tw-text-sq-disabled-gray ${textActiveStyles} specOpenIt`;
|
|
13654
13577
|
const placeholderStyles = ['tw-text-gray-400', 'dark:tw-text-sq-dark-text-lighter', 'specOpenSelect'].join(' ');
|
|
13655
13578
|
const multiValueStyles = [
|
|
@@ -13726,8 +13649,8 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
|
|
|
13726
13649
|
else if (inputGroup === 'right') {
|
|
13727
13650
|
border = menuIsOpen ? 'tw-rounded-tr-sm' : 'tw-rounded-r-sm';
|
|
13728
13651
|
}
|
|
13729
|
-
const appliedClasses = `${borderStyles
|
|
13730
|
-
return `${appliedClasses} ${baseClasses} specSelectControl ${isDisabled ? disabledClasses
|
|
13652
|
+
const appliedClasses = `${borderStyles} ${border} ${showError ? errorClasses : borderColorClasses} ${small ? 'reactSelectMinHeightSmall' : 'reactSelectMinHeight'} `;
|
|
13653
|
+
return `${appliedClasses} ${baseClasses} specSelectControl ${isDisabled ? disabledClasses : ''} ${small ? 'tw-pl-2 tw-pr-1' : 'tw-pl-2.5 tw-pr-1.5'}`;
|
|
13731
13654
|
},
|
|
13732
13655
|
placeholder: () => placeholderStyles,
|
|
13733
13656
|
container: () => `${textStyles} ${containerStyles} ${extraClassNames}`,
|
|
@@ -14991,763 +14914,5 @@ const Accordion = ({ accordionItems, defaultValue, value, onItemSelect, disabled
|
|
|
14991
14914
|
React__default.createElement($1bf158f521e1b1b4$export$7c6e2c02157bb7d2, { className: `data-[state=open]:tw-animate-slideDown data-[state=closed]:tw-animate-slideUp tw-overflow-hidden focus-visible:tw-outline-none ${item.contentClassNames || ''}` }, item.content))))));
|
|
14992
14915
|
};
|
|
14993
14916
|
|
|
14994
|
-
|
|
14995
|
-
const borderStyles$1 = [
|
|
14996
|
-
'tw-border-solid',
|
|
14997
|
-
'tw-border',
|
|
14998
|
-
'tw-rounded-sm',
|
|
14999
|
-
'tw-border-sq-light-gray',
|
|
15000
|
-
'dark:tw-border-gray-700',
|
|
15001
|
-
].join(' ');
|
|
15002
|
-
const disabledClasses$1 = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
15003
|
-
const ButtonWithPopover = ({ children, trigger, tooltipText, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, testId, tooltipTestId, tooltipDelay, tooltipPlacement, disabled = false, align = 'end', alignOffset = -5, placement = 'bottom', placementOffset = 2, onOpenChange, isOpen, isHtmlTooltip = false, isCloseOnContentClick = false, }) => {
|
|
15004
|
-
let tooltipData = undefined;
|
|
15005
|
-
if (tooltipText) {
|
|
15006
|
-
tooltipData = {
|
|
15007
|
-
'data-qtip-text': tooltipText,
|
|
15008
|
-
'data-qtip-placement': tooltipPlacement,
|
|
15009
|
-
'data-qtip-is-html': isHtmlTooltip,
|
|
15010
|
-
'data-qtip-testid': tooltipTestId,
|
|
15011
|
-
'data-qtip-delay': tooltipDelay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
15012
|
-
};
|
|
15013
|
-
}
|
|
15014
|
-
return (React.createElement($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, { open: isOpen, defaultOpen: false, onOpenChange: onOpenChange },
|
|
15015
|
-
React.createElement($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { id: id, className: `tw-border-none`, disabled: disabled, "data-testid": testId },
|
|
15016
|
-
React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-flex tw-flex-col tw-items-center tw-justify-center ${disabled ? disabledClasses$1 : ''} ${extraTriggerClassNames || ''}` }, trigger)),
|
|
15017
|
-
React.createElement($cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, { sideOffset: placementOffset, align: align, side: placement, alignOffset: alignOffset, asChild: true, onClick: () => isCloseOnContentClick && onOpenChange && onOpenChange(false), className: "focus-visible:tw-outline-none tw-outline-none" },
|
|
15018
|
-
React.createElement("div", { className: `${bgStyles$1} ${borderStyles$1} tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem] focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out
|
|
15019
|
-
data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade
|
|
15020
|
-
${extraPopoverClassNames || ''}` },
|
|
15021
|
-
hasArrow && (React.createElement($cb5cc270b50c6fcd$export$21b07c8f274aebd5, { asChild: true },
|
|
15022
|
-
React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[6px] tw-h-[6px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-light-gray dark:tw-border-gray-700 tw-mt-[-2px]" }))),
|
|
15023
|
-
children))));
|
|
15024
|
-
};
|
|
15025
|
-
|
|
15026
|
-
const $6cc32821e9371a1c$var$SELECTION_KEYS = [
|
|
15027
|
-
'Enter',
|
|
15028
|
-
' '
|
|
15029
|
-
];
|
|
15030
|
-
const $6cc32821e9371a1c$var$FIRST_KEYS = [
|
|
15031
|
-
'ArrowDown',
|
|
15032
|
-
'PageUp',
|
|
15033
|
-
'Home'
|
|
15034
|
-
];
|
|
15035
|
-
const $6cc32821e9371a1c$var$LAST_KEYS = [
|
|
15036
|
-
'ArrowUp',
|
|
15037
|
-
'PageDown',
|
|
15038
|
-
'End'
|
|
15039
|
-
];
|
|
15040
|
-
const $6cc32821e9371a1c$var$FIRST_LAST_KEYS = [
|
|
15041
|
-
...$6cc32821e9371a1c$var$FIRST_KEYS,
|
|
15042
|
-
...$6cc32821e9371a1c$var$LAST_KEYS
|
|
15043
|
-
];
|
|
15044
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15045
|
-
* Menu
|
|
15046
|
-
* -----------------------------------------------------------------------------------------------*/ const $6cc32821e9371a1c$var$MENU_NAME = 'Menu';
|
|
15047
|
-
const [$6cc32821e9371a1c$var$Collection, $6cc32821e9371a1c$var$useCollection, $6cc32821e9371a1c$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($6cc32821e9371a1c$var$MENU_NAME);
|
|
15048
|
-
const [$6cc32821e9371a1c$var$createMenuContext, $6cc32821e9371a1c$export$4027731b685e72eb] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($6cc32821e9371a1c$var$MENU_NAME, [
|
|
15049
|
-
$6cc32821e9371a1c$var$createCollectionScope,
|
|
15050
|
-
$cf1ac5d9fe0e8206$export$722aac194ae923,
|
|
15051
|
-
$d7bdfb9eb0fdf311$export$c7109489551a4f4
|
|
15052
|
-
]);
|
|
15053
|
-
const $6cc32821e9371a1c$var$usePopperScope = $cf1ac5d9fe0e8206$export$722aac194ae923();
|
|
15054
|
-
const $6cc32821e9371a1c$var$useRovingFocusGroupScope = $d7bdfb9eb0fdf311$export$c7109489551a4f4();
|
|
15055
|
-
const [$6cc32821e9371a1c$var$MenuProvider, $6cc32821e9371a1c$var$useMenuContext] = $6cc32821e9371a1c$var$createMenuContext($6cc32821e9371a1c$var$MENU_NAME);
|
|
15056
|
-
const [$6cc32821e9371a1c$var$MenuRootProvider, $6cc32821e9371a1c$var$useMenuRootContext] = $6cc32821e9371a1c$var$createMenuContext($6cc32821e9371a1c$var$MENU_NAME);
|
|
15057
|
-
const $6cc32821e9371a1c$export$d9b273488cd8ce6f = (props)=>{
|
|
15058
|
-
const { __scopeMenu: __scopeMenu , open: open = false , children: children , dir: dir , onOpenChange: onOpenChange , modal: modal = true } = props;
|
|
15059
|
-
const popperScope = $6cc32821e9371a1c$var$usePopperScope(__scopeMenu);
|
|
15060
|
-
const [content, setContent] = useState(null);
|
|
15061
|
-
const isUsingKeyboardRef = useRef(false);
|
|
15062
|
-
const handleOpenChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onOpenChange);
|
|
15063
|
-
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
15064
|
-
useEffect(()=>{
|
|
15065
|
-
// Capture phase ensures we set the boolean before any side effects execute
|
|
15066
|
-
// in response to the key or pointer event as they might depend on this value.
|
|
15067
|
-
const handleKeyDown = ()=>{
|
|
15068
|
-
isUsingKeyboardRef.current = true;
|
|
15069
|
-
document.addEventListener('pointerdown', handlePointer, {
|
|
15070
|
-
capture: true,
|
|
15071
|
-
once: true
|
|
15072
|
-
});
|
|
15073
|
-
document.addEventListener('pointermove', handlePointer, {
|
|
15074
|
-
capture: true,
|
|
15075
|
-
once: true
|
|
15076
|
-
});
|
|
15077
|
-
};
|
|
15078
|
-
const handlePointer = ()=>isUsingKeyboardRef.current = false
|
|
15079
|
-
;
|
|
15080
|
-
document.addEventListener('keydown', handleKeyDown, {
|
|
15081
|
-
capture: true
|
|
15082
|
-
});
|
|
15083
|
-
return ()=>{
|
|
15084
|
-
document.removeEventListener('keydown', handleKeyDown, {
|
|
15085
|
-
capture: true
|
|
15086
|
-
});
|
|
15087
|
-
document.removeEventListener('pointerdown', handlePointer, {
|
|
15088
|
-
capture: true
|
|
15089
|
-
});
|
|
15090
|
-
document.removeEventListener('pointermove', handlePointer, {
|
|
15091
|
-
capture: true
|
|
15092
|
-
});
|
|
15093
|
-
};
|
|
15094
|
-
}, []);
|
|
15095
|
-
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, popperScope, /*#__PURE__*/ createElement($6cc32821e9371a1c$var$MenuProvider, {
|
|
15096
|
-
scope: __scopeMenu,
|
|
15097
|
-
open: open,
|
|
15098
|
-
onOpenChange: handleOpenChange,
|
|
15099
|
-
content: content,
|
|
15100
|
-
onContentChange: setContent
|
|
15101
|
-
}, /*#__PURE__*/ createElement($6cc32821e9371a1c$var$MenuRootProvider, {
|
|
15102
|
-
scope: __scopeMenu,
|
|
15103
|
-
onClose: useCallback(()=>handleOpenChange(false)
|
|
15104
|
-
, [
|
|
15105
|
-
handleOpenChange
|
|
15106
|
-
]),
|
|
15107
|
-
isUsingKeyboardRef: isUsingKeyboardRef,
|
|
15108
|
-
dir: direction,
|
|
15109
|
-
modal: modal
|
|
15110
|
-
}, children)));
|
|
15111
|
-
};
|
|
15112
|
-
const $6cc32821e9371a1c$export$9fa5ebd18bee4d43 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15113
|
-
const { __scopeMenu: __scopeMenu , ...anchorProps } = props;
|
|
15114
|
-
const popperScope = $6cc32821e9371a1c$var$usePopperScope(__scopeMenu);
|
|
15115
|
-
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$b688253958b8dfe7, _extends({}, popperScope, anchorProps, {
|
|
15116
|
-
ref: forwardedRef
|
|
15117
|
-
}));
|
|
15118
|
-
});
|
|
15119
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15120
|
-
* MenuPortal
|
|
15121
|
-
* -----------------------------------------------------------------------------------------------*/ const $6cc32821e9371a1c$var$PORTAL_NAME = 'MenuPortal';
|
|
15122
|
-
const [$6cc32821e9371a1c$var$PortalProvider, $6cc32821e9371a1c$var$usePortalContext] = $6cc32821e9371a1c$var$createMenuContext($6cc32821e9371a1c$var$PORTAL_NAME, {
|
|
15123
|
-
forceMount: undefined
|
|
15124
|
-
});
|
|
15125
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15126
|
-
* MenuContent
|
|
15127
|
-
* -----------------------------------------------------------------------------------------------*/ const $6cc32821e9371a1c$var$CONTENT_NAME = 'MenuContent';
|
|
15128
|
-
const [$6cc32821e9371a1c$var$MenuContentProvider, $6cc32821e9371a1c$var$useMenuContentContext] = $6cc32821e9371a1c$var$createMenuContext($6cc32821e9371a1c$var$CONTENT_NAME);
|
|
15129
|
-
const $6cc32821e9371a1c$export$479f0f2f71193efe = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15130
|
-
const portalContext = $6cc32821e9371a1c$var$usePortalContext($6cc32821e9371a1c$var$CONTENT_NAME, props.__scopeMenu);
|
|
15131
|
-
const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
|
|
15132
|
-
const context = $6cc32821e9371a1c$var$useMenuContext($6cc32821e9371a1c$var$CONTENT_NAME, props.__scopeMenu);
|
|
15133
|
-
const rootContext = $6cc32821e9371a1c$var$useMenuRootContext($6cc32821e9371a1c$var$CONTENT_NAME, props.__scopeMenu);
|
|
15134
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$var$Collection.Provider, {
|
|
15135
|
-
scope: props.__scopeMenu
|
|
15136
|
-
}, /*#__PURE__*/ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
|
|
15137
|
-
present: forceMount || context.open
|
|
15138
|
-
}, /*#__PURE__*/ createElement($6cc32821e9371a1c$var$Collection.Slot, {
|
|
15139
|
-
scope: props.__scopeMenu
|
|
15140
|
-
}, rootContext.modal ? /*#__PURE__*/ createElement($6cc32821e9371a1c$var$MenuRootContentModal, _extends({}, contentProps, {
|
|
15141
|
-
ref: forwardedRef
|
|
15142
|
-
})) : /*#__PURE__*/ createElement($6cc32821e9371a1c$var$MenuRootContentNonModal, _extends({}, contentProps, {
|
|
15143
|
-
ref: forwardedRef
|
|
15144
|
-
})))));
|
|
15145
|
-
});
|
|
15146
|
-
/* ---------------------------------------------------------------------------------------------- */ const $6cc32821e9371a1c$var$MenuRootContentModal = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15147
|
-
const context = $6cc32821e9371a1c$var$useMenuContext($6cc32821e9371a1c$var$CONTENT_NAME, props.__scopeMenu);
|
|
15148
|
-
const ref = useRef(null);
|
|
15149
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref); // Hide everything from ARIA except the `MenuContent`
|
|
15150
|
-
useEffect(()=>{
|
|
15151
|
-
const content = ref.current;
|
|
15152
|
-
if (content) return hideOthers(content);
|
|
15153
|
-
}, []);
|
|
15154
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$var$MenuContentImpl, _extends({}, props, {
|
|
15155
|
-
ref: composedRefs // we make sure we're not trapping once it's been closed
|
|
15156
|
-
,
|
|
15157
|
-
trapFocus: context.open // make sure to only disable pointer events when open
|
|
15158
|
-
,
|
|
15159
|
-
disableOutsidePointerEvents: context.open,
|
|
15160
|
-
disableOutsideScroll: true // When focus is trapped, a `focusout` event may still happen.
|
|
15161
|
-
,
|
|
15162
|
-
onFocusOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusOutside, (event)=>event.preventDefault()
|
|
15163
|
-
, {
|
|
15164
|
-
checkForDefaultPrevented: false
|
|
15165
|
-
}),
|
|
15166
|
-
onDismiss: ()=>context.onOpenChange(false)
|
|
15167
|
-
}));
|
|
15168
|
-
});
|
|
15169
|
-
const $6cc32821e9371a1c$var$MenuRootContentNonModal = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15170
|
-
const context = $6cc32821e9371a1c$var$useMenuContext($6cc32821e9371a1c$var$CONTENT_NAME, props.__scopeMenu);
|
|
15171
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$var$MenuContentImpl, _extends({}, props, {
|
|
15172
|
-
ref: forwardedRef,
|
|
15173
|
-
trapFocus: false,
|
|
15174
|
-
disableOutsidePointerEvents: false,
|
|
15175
|
-
disableOutsideScroll: false,
|
|
15176
|
-
onDismiss: ()=>context.onOpenChange(false)
|
|
15177
|
-
}));
|
|
15178
|
-
});
|
|
15179
|
-
/* ---------------------------------------------------------------------------------------------- */ const $6cc32821e9371a1c$var$MenuContentImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15180
|
-
const { __scopeMenu: __scopeMenu , loop: loop = false , trapFocus: trapFocus , onOpenAutoFocus: onOpenAutoFocus , onCloseAutoFocus: onCloseAutoFocus , disableOutsidePointerEvents: disableOutsidePointerEvents , onEntryFocus: onEntryFocus , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , disableOutsideScroll: disableOutsideScroll , ...contentProps } = props;
|
|
15181
|
-
const context = $6cc32821e9371a1c$var$useMenuContext($6cc32821e9371a1c$var$CONTENT_NAME, __scopeMenu);
|
|
15182
|
-
const rootContext = $6cc32821e9371a1c$var$useMenuRootContext($6cc32821e9371a1c$var$CONTENT_NAME, __scopeMenu);
|
|
15183
|
-
const popperScope = $6cc32821e9371a1c$var$usePopperScope(__scopeMenu);
|
|
15184
|
-
const rovingFocusGroupScope = $6cc32821e9371a1c$var$useRovingFocusGroupScope(__scopeMenu);
|
|
15185
|
-
const getItems = $6cc32821e9371a1c$var$useCollection(__scopeMenu);
|
|
15186
|
-
const [currentItemId, setCurrentItemId] = useState(null);
|
|
15187
|
-
const contentRef = useRef(null);
|
|
15188
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentRef, context.onContentChange);
|
|
15189
|
-
const timerRef = useRef(0);
|
|
15190
|
-
const searchRef = useRef('');
|
|
15191
|
-
const pointerGraceTimerRef = useRef(0);
|
|
15192
|
-
const pointerGraceIntentRef = useRef(null);
|
|
15193
|
-
const pointerDirRef = useRef('right');
|
|
15194
|
-
const lastPointerXRef = useRef(0);
|
|
15195
|
-
const ScrollLockWrapper = disableOutsideScroll ? $epM9y$RemoveScroll : Fragment;
|
|
15196
|
-
const scrollLockWrapperProps = disableOutsideScroll ? {
|
|
15197
|
-
as: $5e63c961fc1ce211$export$8c6ed5c666ac1360,
|
|
15198
|
-
allowPinchZoom: true
|
|
15199
|
-
} : undefined;
|
|
15200
|
-
const handleTypeaheadSearch = (key)=>{
|
|
15201
|
-
var _items$find, _items$find2;
|
|
15202
|
-
const search = searchRef.current + key;
|
|
15203
|
-
const items = getItems().filter((item)=>!item.disabled
|
|
15204
|
-
);
|
|
15205
|
-
const currentItem = document.activeElement;
|
|
15206
|
-
const currentMatch = (_items$find = items.find((item)=>item.ref.current === currentItem
|
|
15207
|
-
)) === null || _items$find === void 0 ? void 0 : _items$find.textValue;
|
|
15208
|
-
const values = items.map((item)=>item.textValue
|
|
15209
|
-
);
|
|
15210
|
-
const nextMatch = $6cc32821e9371a1c$var$getNextMatch(values, search, currentMatch);
|
|
15211
|
-
const newItem = (_items$find2 = items.find((item)=>item.textValue === nextMatch
|
|
15212
|
-
)) === null || _items$find2 === void 0 ? void 0 : _items$find2.ref.current; // Reset `searchRef` 1 second after it was last updated
|
|
15213
|
-
(function updateSearch(value) {
|
|
15214
|
-
searchRef.current = value;
|
|
15215
|
-
window.clearTimeout(timerRef.current);
|
|
15216
|
-
if (value !== '') timerRef.current = window.setTimeout(()=>updateSearch('')
|
|
15217
|
-
, 1000);
|
|
15218
|
-
})(search);
|
|
15219
|
-
if (newItem) /**
|
|
15220
|
-
* Imperative focus during keydown is risky so we prevent React's batching updates
|
|
15221
|
-
* to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
|
|
15222
|
-
*/ setTimeout(()=>newItem.focus()
|
|
15223
|
-
);
|
|
15224
|
-
};
|
|
15225
|
-
useEffect(()=>{
|
|
15226
|
-
return ()=>window.clearTimeout(timerRef.current)
|
|
15227
|
-
;
|
|
15228
|
-
}, []); // Make sure the whole tree has focus guards as our `MenuContent` may be
|
|
15229
|
-
// the last element in the DOM (beacuse of the `Portal`)
|
|
15230
|
-
$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
|
|
15231
|
-
const isPointerMovingToSubmenu = useCallback((event)=>{
|
|
15232
|
-
var _pointerGraceIntentRe, _pointerGraceIntentRe2;
|
|
15233
|
-
const isMovingTowards = pointerDirRef.current === ((_pointerGraceIntentRe = pointerGraceIntentRef.current) === null || _pointerGraceIntentRe === void 0 ? void 0 : _pointerGraceIntentRe.side);
|
|
15234
|
-
return isMovingTowards && $6cc32821e9371a1c$var$isPointerInGraceArea(event, (_pointerGraceIntentRe2 = pointerGraceIntentRef.current) === null || _pointerGraceIntentRe2 === void 0 ? void 0 : _pointerGraceIntentRe2.area);
|
|
15235
|
-
}, []);
|
|
15236
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$var$MenuContentProvider, {
|
|
15237
|
-
scope: __scopeMenu,
|
|
15238
|
-
searchRef: searchRef,
|
|
15239
|
-
onItemEnter: useCallback((event)=>{
|
|
15240
|
-
if (isPointerMovingToSubmenu(event)) event.preventDefault();
|
|
15241
|
-
}, [
|
|
15242
|
-
isPointerMovingToSubmenu
|
|
15243
|
-
]),
|
|
15244
|
-
onItemLeave: useCallback((event)=>{
|
|
15245
|
-
var _contentRef$current;
|
|
15246
|
-
if (isPointerMovingToSubmenu(event)) return;
|
|
15247
|
-
(_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 || _contentRef$current.focus();
|
|
15248
|
-
setCurrentItemId(null);
|
|
15249
|
-
}, [
|
|
15250
|
-
isPointerMovingToSubmenu
|
|
15251
|
-
]),
|
|
15252
|
-
onTriggerLeave: useCallback((event)=>{
|
|
15253
|
-
if (isPointerMovingToSubmenu(event)) event.preventDefault();
|
|
15254
|
-
}, [
|
|
15255
|
-
isPointerMovingToSubmenu
|
|
15256
|
-
]),
|
|
15257
|
-
pointerGraceTimerRef: pointerGraceTimerRef,
|
|
15258
|
-
onPointerGraceIntentChange: useCallback((intent)=>{
|
|
15259
|
-
pointerGraceIntentRef.current = intent;
|
|
15260
|
-
}, [])
|
|
15261
|
-
}, /*#__PURE__*/ createElement(ScrollLockWrapper, scrollLockWrapperProps, /*#__PURE__*/ createElement($d3863c46a17e8a28$export$20e40289641fbbb6, {
|
|
15262
|
-
asChild: true,
|
|
15263
|
-
trapped: trapFocus,
|
|
15264
|
-
onMountAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(onOpenAutoFocus, (event)=>{
|
|
15265
|
-
var _contentRef$current2;
|
|
15266
|
-
// when opening, explicitly focus the content area only and leave
|
|
15267
|
-
// `onEntryFocus` in control of focusing first item
|
|
15268
|
-
event.preventDefault();
|
|
15269
|
-
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 || _contentRef$current2.focus();
|
|
15270
|
-
}),
|
|
15271
|
-
onUnmountAutoFocus: onCloseAutoFocus
|
|
15272
|
-
}, /*#__PURE__*/ createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, {
|
|
15273
|
-
asChild: true,
|
|
15274
|
-
disableOutsidePointerEvents: disableOutsidePointerEvents,
|
|
15275
|
-
onEscapeKeyDown: onEscapeKeyDown,
|
|
15276
|
-
onPointerDownOutside: onPointerDownOutside,
|
|
15277
|
-
onFocusOutside: onFocusOutside,
|
|
15278
|
-
onInteractOutside: onInteractOutside,
|
|
15279
|
-
onDismiss: onDismiss
|
|
15280
|
-
}, /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends({
|
|
15281
|
-
asChild: true
|
|
15282
|
-
}, rovingFocusGroupScope, {
|
|
15283
|
-
dir: rootContext.dir,
|
|
15284
|
-
orientation: "vertical",
|
|
15285
|
-
loop: loop,
|
|
15286
|
-
currentTabStopId: currentItemId,
|
|
15287
|
-
onCurrentTabStopIdChange: setCurrentItemId,
|
|
15288
|
-
onEntryFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(onEntryFocus, (event)=>{
|
|
15289
|
-
// only focus first item when using keyboard
|
|
15290
|
-
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
15291
|
-
})
|
|
15292
|
-
}), /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2, _extends({
|
|
15293
|
-
role: "menu",
|
|
15294
|
-
"aria-orientation": "vertical",
|
|
15295
|
-
"data-state": $6cc32821e9371a1c$var$getOpenState(context.open),
|
|
15296
|
-
"data-radix-menu-content": "",
|
|
15297
|
-
dir: rootContext.dir
|
|
15298
|
-
}, popperScope, contentProps, {
|
|
15299
|
-
ref: composedRefs,
|
|
15300
|
-
style: {
|
|
15301
|
-
outline: 'none',
|
|
15302
|
-
...contentProps.style
|
|
15303
|
-
},
|
|
15304
|
-
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onKeyDown, (event)=>{
|
|
15305
|
-
// submenu key events bubble through portals. We only care about keys in this menu.
|
|
15306
|
-
const target = event.target;
|
|
15307
|
-
const isKeyDownInside = target.closest('[data-radix-menu-content]') === event.currentTarget;
|
|
15308
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
15309
|
-
const isCharacterKey = event.key.length === 1;
|
|
15310
|
-
if (isKeyDownInside) {
|
|
15311
|
-
// menus should not be navigated using tab key so we prevent it
|
|
15312
|
-
if (event.key === 'Tab') event.preventDefault();
|
|
15313
|
-
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
|
|
15314
|
-
} // focus first/last item based on key pressed
|
|
15315
|
-
const content = contentRef.current;
|
|
15316
|
-
if (event.target !== content) return;
|
|
15317
|
-
if (!$6cc32821e9371a1c$var$FIRST_LAST_KEYS.includes(event.key)) return;
|
|
15318
|
-
event.preventDefault();
|
|
15319
|
-
const items = getItems().filter((item)=>!item.disabled
|
|
15320
|
-
);
|
|
15321
|
-
const candidateNodes = items.map((item)=>item.ref.current
|
|
15322
|
-
);
|
|
15323
|
-
if ($6cc32821e9371a1c$var$LAST_KEYS.includes(event.key)) candidateNodes.reverse();
|
|
15324
|
-
$6cc32821e9371a1c$var$focusFirst(candidateNodes);
|
|
15325
|
-
}),
|
|
15326
|
-
onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur, (event)=>{
|
|
15327
|
-
// clear search buffer when leaving the menu
|
|
15328
|
-
if (!event.currentTarget.contains(event.target)) {
|
|
15329
|
-
window.clearTimeout(timerRef.current);
|
|
15330
|
-
searchRef.current = '';
|
|
15331
|
-
}
|
|
15332
|
-
}),
|
|
15333
|
-
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerMove, $6cc32821e9371a1c$var$whenMouse((event)=>{
|
|
15334
|
-
const target = event.target;
|
|
15335
|
-
const pointerXHasChanged = lastPointerXRef.current !== event.clientX; // We don't use `event.movementX` for this check because Safari will
|
|
15336
|
-
// always return `0` on a pointer event.
|
|
15337
|
-
if (event.currentTarget.contains(target) && pointerXHasChanged) {
|
|
15338
|
-
const newDir = event.clientX > lastPointerXRef.current ? 'right' : 'left';
|
|
15339
|
-
pointerDirRef.current = newDir;
|
|
15340
|
-
lastPointerXRef.current = event.clientX;
|
|
15341
|
-
}
|
|
15342
|
-
}))
|
|
15343
|
-
})))))));
|
|
15344
|
-
});
|
|
15345
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15346
|
-
* MenuItem
|
|
15347
|
-
* -----------------------------------------------------------------------------------------------*/ const $6cc32821e9371a1c$var$ITEM_NAME = 'MenuItem';
|
|
15348
|
-
const $6cc32821e9371a1c$var$ITEM_SELECT = 'menu.itemSelect';
|
|
15349
|
-
const $6cc32821e9371a1c$export$2ce376c2cc3355c8 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15350
|
-
const { disabled: disabled = false , onSelect: onSelect , ...itemProps } = props;
|
|
15351
|
-
const ref = useRef(null);
|
|
15352
|
-
const rootContext = $6cc32821e9371a1c$var$useMenuRootContext($6cc32821e9371a1c$var$ITEM_NAME, props.__scopeMenu);
|
|
15353
|
-
const contentContext = $6cc32821e9371a1c$var$useMenuContentContext($6cc32821e9371a1c$var$ITEM_NAME, props.__scopeMenu);
|
|
15354
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
15355
|
-
const isPointerDownRef = useRef(false);
|
|
15356
|
-
const handleSelect = ()=>{
|
|
15357
|
-
const menuItem = ref.current;
|
|
15358
|
-
if (!disabled && menuItem) {
|
|
15359
|
-
const itemSelectEvent = new CustomEvent($6cc32821e9371a1c$var$ITEM_SELECT, {
|
|
15360
|
-
bubbles: true,
|
|
15361
|
-
cancelable: true
|
|
15362
|
-
});
|
|
15363
|
-
menuItem.addEventListener($6cc32821e9371a1c$var$ITEM_SELECT, (event)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect(event)
|
|
15364
|
-
, {
|
|
15365
|
-
once: true
|
|
15366
|
-
});
|
|
15367
|
-
$8927f6f2acc4f386$export$6d1a0317bde7de7f(menuItem, itemSelectEvent);
|
|
15368
|
-
if (itemSelectEvent.defaultPrevented) isPointerDownRef.current = false;
|
|
15369
|
-
else rootContext.onClose();
|
|
15370
|
-
}
|
|
15371
|
-
};
|
|
15372
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$var$MenuItemImpl, _extends({}, itemProps, {
|
|
15373
|
-
ref: composedRefs,
|
|
15374
|
-
disabled: disabled,
|
|
15375
|
-
onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, handleSelect),
|
|
15376
|
-
onPointerDown: (event)=>{
|
|
15377
|
-
var _props$onPointerDown;
|
|
15378
|
-
(_props$onPointerDown = props.onPointerDown) === null || _props$onPointerDown === void 0 || _props$onPointerDown.call(props, event);
|
|
15379
|
-
isPointerDownRef.current = true;
|
|
15380
|
-
},
|
|
15381
|
-
onPointerUp: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerUp, (event)=>{
|
|
15382
|
-
var _event$currentTarget;
|
|
15383
|
-
// Pointer down can move to a different menu item which should activate it on pointer up.
|
|
15384
|
-
// We dispatch a click for selection to allow composition with click based triggers and to
|
|
15385
|
-
// prevent Firefox from getting stuck in text selection mode when the menu closes.
|
|
15386
|
-
if (!isPointerDownRef.current) (_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || _event$currentTarget.click();
|
|
15387
|
-
}),
|
|
15388
|
-
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
|
|
15389
|
-
const isTypingAhead = contentContext.searchRef.current !== '';
|
|
15390
|
-
if (disabled || isTypingAhead && event.key === ' ') return;
|
|
15391
|
-
if ($6cc32821e9371a1c$var$SELECTION_KEYS.includes(event.key)) {
|
|
15392
|
-
event.currentTarget.click();
|
|
15393
|
-
/**
|
|
15394
|
-
* We prevent default browser behaviour for selection keys as they should trigger
|
|
15395
|
-
* a selection only:
|
|
15396
|
-
* - prevents space from scrolling the page.
|
|
15397
|
-
* - if keydown causes focus to move, prevents keydown from firing on the new target.
|
|
15398
|
-
*/ event.preventDefault();
|
|
15399
|
-
}
|
|
15400
|
-
})
|
|
15401
|
-
}));
|
|
15402
|
-
});
|
|
15403
|
-
/* ---------------------------------------------------------------------------------------------- */ const $6cc32821e9371a1c$var$MenuItemImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15404
|
-
const { __scopeMenu: __scopeMenu , disabled: disabled = false , textValue: textValue , ...itemProps } = props;
|
|
15405
|
-
const contentContext = $6cc32821e9371a1c$var$useMenuContentContext($6cc32821e9371a1c$var$ITEM_NAME, __scopeMenu);
|
|
15406
|
-
const rovingFocusGroupScope = $6cc32821e9371a1c$var$useRovingFocusGroupScope(__scopeMenu);
|
|
15407
|
-
const ref = useRef(null);
|
|
15408
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
15409
|
-
const [isFocused, setIsFocused] = useState(false); // get the item's `.textContent` as default strategy for typeahead `textValue`
|
|
15410
|
-
const [textContent, setTextContent] = useState('');
|
|
15411
|
-
useEffect(()=>{
|
|
15412
|
-
const menuItem = ref.current;
|
|
15413
|
-
if (menuItem) {
|
|
15414
|
-
var _menuItem$textContent;
|
|
15415
|
-
setTextContent(((_menuItem$textContent = menuItem.textContent) !== null && _menuItem$textContent !== void 0 ? _menuItem$textContent : '').trim());
|
|
15416
|
-
}
|
|
15417
|
-
}, [
|
|
15418
|
-
itemProps.children
|
|
15419
|
-
]);
|
|
15420
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$var$Collection.ItemSlot, {
|
|
15421
|
-
scope: __scopeMenu,
|
|
15422
|
-
disabled: disabled,
|
|
15423
|
-
textValue: textValue !== null && textValue !== void 0 ? textValue : textContent
|
|
15424
|
-
}, /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends({
|
|
15425
|
-
asChild: true
|
|
15426
|
-
}, rovingFocusGroupScope, {
|
|
15427
|
-
focusable: !disabled
|
|
15428
|
-
}), /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
15429
|
-
role: "menuitem",
|
|
15430
|
-
"data-highlighted": isFocused ? '' : undefined,
|
|
15431
|
-
"aria-disabled": disabled || undefined,
|
|
15432
|
-
"data-disabled": disabled ? '' : undefined
|
|
15433
|
-
}, itemProps, {
|
|
15434
|
-
ref: composedRefs,
|
|
15435
|
-
onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerMove, $6cc32821e9371a1c$var$whenMouse((event)=>{
|
|
15436
|
-
if (disabled) contentContext.onItemLeave(event);
|
|
15437
|
-
else {
|
|
15438
|
-
contentContext.onItemEnter(event);
|
|
15439
|
-
if (!event.defaultPrevented) {
|
|
15440
|
-
const item = event.currentTarget;
|
|
15441
|
-
item.focus();
|
|
15442
|
-
}
|
|
15443
|
-
}
|
|
15444
|
-
})),
|
|
15445
|
-
onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, $6cc32821e9371a1c$var$whenMouse((event)=>contentContext.onItemLeave(event)
|
|
15446
|
-
)),
|
|
15447
|
-
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, ()=>setIsFocused(true)
|
|
15448
|
-
),
|
|
15449
|
-
onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur, ()=>setIsFocused(false)
|
|
15450
|
-
)
|
|
15451
|
-
}))));
|
|
15452
|
-
});
|
|
15453
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15454
|
-
* MenuRadioGroup
|
|
15455
|
-
* -----------------------------------------------------------------------------------------------*/ const $6cc32821e9371a1c$var$RADIO_GROUP_NAME = 'MenuRadioGroup';
|
|
15456
|
-
$6cc32821e9371a1c$var$createMenuContext($6cc32821e9371a1c$var$RADIO_GROUP_NAME, {
|
|
15457
|
-
value: undefined,
|
|
15458
|
-
onValueChange: ()=>{}
|
|
15459
|
-
});
|
|
15460
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15461
|
-
* MenuItemIndicator
|
|
15462
|
-
* -----------------------------------------------------------------------------------------------*/ const $6cc32821e9371a1c$var$ITEM_INDICATOR_NAME = 'MenuItemIndicator';
|
|
15463
|
-
$6cc32821e9371a1c$var$createMenuContext($6cc32821e9371a1c$var$ITEM_INDICATOR_NAME, {
|
|
15464
|
-
checked: false
|
|
15465
|
-
});
|
|
15466
|
-
const $6cc32821e9371a1c$export$1cec7dcdd713e220 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15467
|
-
const { __scopeMenu: __scopeMenu , ...separatorProps } = props;
|
|
15468
|
-
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
15469
|
-
role: "separator",
|
|
15470
|
-
"aria-orientation": "horizontal"
|
|
15471
|
-
}, separatorProps, {
|
|
15472
|
-
ref: forwardedRef
|
|
15473
|
-
}));
|
|
15474
|
-
});
|
|
15475
|
-
const $6cc32821e9371a1c$export$bcdda4773debf5fa = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15476
|
-
const { __scopeMenu: __scopeMenu , ...arrowProps } = props;
|
|
15477
|
-
const popperScope = $6cc32821e9371a1c$var$usePopperScope(__scopeMenu);
|
|
15478
|
-
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$export$21b07c8f274aebd5, _extends({}, popperScope, arrowProps, {
|
|
15479
|
-
ref: forwardedRef
|
|
15480
|
-
}));
|
|
15481
|
-
});
|
|
15482
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15483
|
-
* MenuSub
|
|
15484
|
-
* -----------------------------------------------------------------------------------------------*/ const $6cc32821e9371a1c$var$SUB_NAME = 'MenuSub';
|
|
15485
|
-
$6cc32821e9371a1c$var$createMenuContext($6cc32821e9371a1c$var$SUB_NAME);
|
|
15486
|
-
/* -----------------------------------------------------------------------------------------------*/ function $6cc32821e9371a1c$var$getOpenState(open) {
|
|
15487
|
-
return open ? 'open' : 'closed';
|
|
15488
|
-
}
|
|
15489
|
-
function $6cc32821e9371a1c$var$focusFirst(candidates) {
|
|
15490
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
15491
|
-
for (const candidate of candidates){
|
|
15492
|
-
// if focus is already where we want to go, we don't want to keep going through the candidates
|
|
15493
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
15494
|
-
candidate.focus();
|
|
15495
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
15496
|
-
}
|
|
15497
|
-
}
|
|
15498
|
-
/**
|
|
15499
|
-
* Wraps an array around itself at a given start index
|
|
15500
|
-
* Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
|
|
15501
|
-
*/ function $6cc32821e9371a1c$var$wrapArray(array, startIndex) {
|
|
15502
|
-
return array.map((_, index)=>array[(startIndex + index) % array.length]
|
|
15503
|
-
);
|
|
15504
|
-
}
|
|
15505
|
-
/**
|
|
15506
|
-
* This is the "meat" of the typeahead matching logic. It takes in all the values,
|
|
15507
|
-
* the search and the current match, and returns the next match (or `undefined`).
|
|
15508
|
-
*
|
|
15509
|
-
* We normalize the search because if a user has repeatedly pressed a character,
|
|
15510
|
-
* we want the exact same behavior as if we only had that one character
|
|
15511
|
-
* (ie. cycle through options starting with that character)
|
|
15512
|
-
*
|
|
15513
|
-
* We also reorder the values by wrapping the array around the current match.
|
|
15514
|
-
* This is so we always look forward from the current match, and picking the first
|
|
15515
|
-
* match will always be the correct one.
|
|
15516
|
-
*
|
|
15517
|
-
* Finally, if the normalized search is exactly one character, we exclude the
|
|
15518
|
-
* current match from the values because otherwise it would be the first to match always
|
|
15519
|
-
* and focus would never move. This is as opposed to the regular case, where we
|
|
15520
|
-
* don't want focus to move if the current match still matches.
|
|
15521
|
-
*/ function $6cc32821e9371a1c$var$getNextMatch(values, search, currentMatch) {
|
|
15522
|
-
const isRepeated = search.length > 1 && Array.from(search).every((char)=>char === search[0]
|
|
15523
|
-
);
|
|
15524
|
-
const normalizedSearch = isRepeated ? search[0] : search;
|
|
15525
|
-
const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
|
|
15526
|
-
let wrappedValues = $6cc32821e9371a1c$var$wrapArray(values, Math.max(currentMatchIndex, 0));
|
|
15527
|
-
const excludeCurrentMatch = normalizedSearch.length === 1;
|
|
15528
|
-
if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v)=>v !== currentMatch
|
|
15529
|
-
);
|
|
15530
|
-
const nextMatch = wrappedValues.find((value)=>value.toLowerCase().startsWith(normalizedSearch.toLowerCase())
|
|
15531
|
-
);
|
|
15532
|
-
return nextMatch !== currentMatch ? nextMatch : undefined;
|
|
15533
|
-
}
|
|
15534
|
-
// Determine if a point is inside of a polygon.
|
|
15535
|
-
// Based on https://github.com/substack/point-in-polygon
|
|
15536
|
-
function $6cc32821e9371a1c$var$isPointInPolygon(point, polygon) {
|
|
15537
|
-
const { x: x , y: y } = point;
|
|
15538
|
-
let inside = false;
|
|
15539
|
-
for(let i = 0, j = polygon.length - 1; i < polygon.length; j = i++){
|
|
15540
|
-
const xi = polygon[i].x;
|
|
15541
|
-
const yi = polygon[i].y;
|
|
15542
|
-
const xj = polygon[j].x;
|
|
15543
|
-
const yj = polygon[j].y; // prettier-ignore
|
|
15544
|
-
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
15545
|
-
if (intersect) inside = !inside;
|
|
15546
|
-
}
|
|
15547
|
-
return inside;
|
|
15548
|
-
}
|
|
15549
|
-
function $6cc32821e9371a1c$var$isPointerInGraceArea(event, area) {
|
|
15550
|
-
if (!area) return false;
|
|
15551
|
-
const cursorPos = {
|
|
15552
|
-
x: event.clientX,
|
|
15553
|
-
y: event.clientY
|
|
15554
|
-
};
|
|
15555
|
-
return $6cc32821e9371a1c$var$isPointInPolygon(cursorPos, area);
|
|
15556
|
-
}
|
|
15557
|
-
function $6cc32821e9371a1c$var$whenMouse(handler) {
|
|
15558
|
-
return (event)=>event.pointerType === 'mouse' ? handler(event) : undefined
|
|
15559
|
-
;
|
|
15560
|
-
}
|
|
15561
|
-
const $6cc32821e9371a1c$export$be92b6f5f03c0fe9 = $6cc32821e9371a1c$export$d9b273488cd8ce6f;
|
|
15562
|
-
const $6cc32821e9371a1c$export$b688253958b8dfe7 = $6cc32821e9371a1c$export$9fa5ebd18bee4d43;
|
|
15563
|
-
const $6cc32821e9371a1c$export$7c6e2c02157bb7d2 = $6cc32821e9371a1c$export$479f0f2f71193efe;
|
|
15564
|
-
const $6cc32821e9371a1c$export$6d08773d2e66f8f2 = $6cc32821e9371a1c$export$2ce376c2cc3355c8;
|
|
15565
|
-
const $6cc32821e9371a1c$export$1ff3c3f08ae963c0 = $6cc32821e9371a1c$export$1cec7dcdd713e220;
|
|
15566
|
-
const $6cc32821e9371a1c$export$21b07c8f274aebd5 = $6cc32821e9371a1c$export$bcdda4773debf5fa;
|
|
15567
|
-
|
|
15568
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15569
|
-
* DropdownMenu
|
|
15570
|
-
* -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$var$DROPDOWN_MENU_NAME = 'DropdownMenu';
|
|
15571
|
-
const [$d08ef79370b62062$var$createDropdownMenuContext, $d08ef79370b62062$export$c0623cd925aeb687] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($d08ef79370b62062$var$DROPDOWN_MENU_NAME, [
|
|
15572
|
-
$6cc32821e9371a1c$export$4027731b685e72eb
|
|
15573
|
-
]);
|
|
15574
|
-
const $d08ef79370b62062$var$useMenuScope = $6cc32821e9371a1c$export$4027731b685e72eb();
|
|
15575
|
-
const [$d08ef79370b62062$var$DropdownMenuProvider, $d08ef79370b62062$var$useDropdownMenuContext] = $d08ef79370b62062$var$createDropdownMenuContext($d08ef79370b62062$var$DROPDOWN_MENU_NAME);
|
|
15576
|
-
const $d08ef79370b62062$export$e44a253a59704894 = (props)=>{
|
|
15577
|
-
const { __scopeDropdownMenu: __scopeDropdownMenu , children: children , dir: dir , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , modal: modal = true } = props;
|
|
15578
|
-
const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
|
|
15579
|
-
const triggerRef = useRef(null);
|
|
15580
|
-
const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
15581
|
-
prop: openProp,
|
|
15582
|
-
defaultProp: defaultOpen,
|
|
15583
|
-
onChange: onOpenChange
|
|
15584
|
-
});
|
|
15585
|
-
return /*#__PURE__*/ createElement($d08ef79370b62062$var$DropdownMenuProvider, {
|
|
15586
|
-
scope: __scopeDropdownMenu,
|
|
15587
|
-
triggerId: $1746a345f3d73bb7$export$f680877a34711e37(),
|
|
15588
|
-
triggerRef: triggerRef,
|
|
15589
|
-
contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
|
|
15590
|
-
open: open,
|
|
15591
|
-
onOpenChange: setOpen,
|
|
15592
|
-
onOpenToggle: useCallback(()=>setOpen((prevOpen)=>!prevOpen
|
|
15593
|
-
)
|
|
15594
|
-
, [
|
|
15595
|
-
setOpen
|
|
15596
|
-
]),
|
|
15597
|
-
modal: modal
|
|
15598
|
-
}, /*#__PURE__*/ createElement($6cc32821e9371a1c$export$be92b6f5f03c0fe9, _extends({}, menuScope, {
|
|
15599
|
-
open: open,
|
|
15600
|
-
onOpenChange: setOpen,
|
|
15601
|
-
dir: dir,
|
|
15602
|
-
modal: modal
|
|
15603
|
-
}), children));
|
|
15604
|
-
};
|
|
15605
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15606
|
-
* DropdownMenuTrigger
|
|
15607
|
-
* -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$var$TRIGGER_NAME = 'DropdownMenuTrigger';
|
|
15608
|
-
const $d08ef79370b62062$export$d2469213b3befba9 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15609
|
-
const { __scopeDropdownMenu: __scopeDropdownMenu , disabled: disabled = false , ...triggerProps } = props;
|
|
15610
|
-
const context = $d08ef79370b62062$var$useDropdownMenuContext($d08ef79370b62062$var$TRIGGER_NAME, __scopeDropdownMenu);
|
|
15611
|
-
const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
|
|
15612
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$b688253958b8dfe7, _extends({
|
|
15613
|
-
asChild: true
|
|
15614
|
-
}, menuScope), /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
|
|
15615
|
-
type: "button",
|
|
15616
|
-
id: context.triggerId,
|
|
15617
|
-
"aria-haspopup": "menu",
|
|
15618
|
-
"aria-expanded": context.open,
|
|
15619
|
-
"aria-controls": context.open ? context.contentId : undefined,
|
|
15620
|
-
"data-state": context.open ? 'open' : 'closed',
|
|
15621
|
-
"data-disabled": disabled ? '' : undefined,
|
|
15622
|
-
disabled: disabled
|
|
15623
|
-
}, triggerProps, {
|
|
15624
|
-
ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, context.triggerRef),
|
|
15625
|
-
onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDown, (event)=>{
|
|
15626
|
-
// only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
|
|
15627
|
-
// but not when the control key is pressed (avoiding MacOS right click)
|
|
15628
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
15629
|
-
context.onOpenToggle(); // prevent trigger focusing when opening
|
|
15630
|
-
// this allows the content to be given focus without competition
|
|
15631
|
-
if (!context.open) event.preventDefault();
|
|
15632
|
-
}
|
|
15633
|
-
}),
|
|
15634
|
-
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
|
|
15635
|
-
if (disabled) return;
|
|
15636
|
-
if ([
|
|
15637
|
-
'Enter',
|
|
15638
|
-
' '
|
|
15639
|
-
].includes(event.key)) context.onOpenToggle();
|
|
15640
|
-
if (event.key === 'ArrowDown') context.onOpenChange(true); // prevent keydown from scrolling window / first focused item to execute
|
|
15641
|
-
// that keydown (inadvertently closing the menu)
|
|
15642
|
-
if ([
|
|
15643
|
-
'Enter',
|
|
15644
|
-
' ',
|
|
15645
|
-
'ArrowDown'
|
|
15646
|
-
].includes(event.key)) event.preventDefault();
|
|
15647
|
-
})
|
|
15648
|
-
})));
|
|
15649
|
-
});
|
|
15650
|
-
/* -------------------------------------------------------------------------------------------------
|
|
15651
|
-
* DropdownMenuContent
|
|
15652
|
-
* -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$var$CONTENT_NAME = 'DropdownMenuContent';
|
|
15653
|
-
const $d08ef79370b62062$export$6e76d93a37c01248 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15654
|
-
const { __scopeDropdownMenu: __scopeDropdownMenu , ...contentProps } = props;
|
|
15655
|
-
const context = $d08ef79370b62062$var$useDropdownMenuContext($d08ef79370b62062$var$CONTENT_NAME, __scopeDropdownMenu);
|
|
15656
|
-
const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
|
|
15657
|
-
const hasInteractedOutsideRef = useRef(false);
|
|
15658
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$7c6e2c02157bb7d2, _extends({
|
|
15659
|
-
id: context.contentId,
|
|
15660
|
-
"aria-labelledby": context.triggerId
|
|
15661
|
-
}, menuScope, contentProps, {
|
|
15662
|
-
ref: forwardedRef,
|
|
15663
|
-
onCloseAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onCloseAutoFocus, (event)=>{
|
|
15664
|
-
var _context$triggerRef$c;
|
|
15665
|
-
if (!hasInteractedOutsideRef.current) (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
|
|
15666
|
-
hasInteractedOutsideRef.current = false; // Always prevent auto focus because we either focus manually or want user agent focus
|
|
15667
|
-
event.preventDefault();
|
|
15668
|
-
}),
|
|
15669
|
-
onInteractOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onInteractOutside, (event)=>{
|
|
15670
|
-
const originalEvent = event.detail.originalEvent;
|
|
15671
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
15672
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
15673
|
-
if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;
|
|
15674
|
-
}),
|
|
15675
|
-
style: {
|
|
15676
|
-
...props.style,
|
|
15677
|
-
'--radix-dropdown-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',
|
|
15678
|
-
'--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',
|
|
15679
|
-
'--radix-dropdown-menu-content-available-height': 'var(--radix-popper-available-height)',
|
|
15680
|
-
'--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',
|
|
15681
|
-
'--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)'
|
|
15682
|
-
}
|
|
15683
|
-
}));
|
|
15684
|
-
});
|
|
15685
|
-
const $d08ef79370b62062$export$ed97964d1871885d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15686
|
-
const { __scopeDropdownMenu: __scopeDropdownMenu , ...itemProps } = props;
|
|
15687
|
-
const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
|
|
15688
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$6d08773d2e66f8f2, _extends({}, menuScope, itemProps, {
|
|
15689
|
-
ref: forwardedRef
|
|
15690
|
-
}));
|
|
15691
|
-
});
|
|
15692
|
-
const $d08ef79370b62062$export$da160178fd3bc7e9 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15693
|
-
const { __scopeDropdownMenu: __scopeDropdownMenu , ...separatorProps } = props;
|
|
15694
|
-
const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
|
|
15695
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$1ff3c3f08ae963c0, _extends({}, menuScope, separatorProps, {
|
|
15696
|
-
ref: forwardedRef
|
|
15697
|
-
}));
|
|
15698
|
-
});
|
|
15699
|
-
const $d08ef79370b62062$export$34b8980744021ec5 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
15700
|
-
const { __scopeDropdownMenu: __scopeDropdownMenu , ...arrowProps } = props;
|
|
15701
|
-
const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
|
|
15702
|
-
return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$21b07c8f274aebd5, _extends({}, menuScope, arrowProps, {
|
|
15703
|
-
ref: forwardedRef
|
|
15704
|
-
}));
|
|
15705
|
-
});
|
|
15706
|
-
/* -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$export$be92b6f5f03c0fe9 = $d08ef79370b62062$export$e44a253a59704894;
|
|
15707
|
-
const $d08ef79370b62062$export$41fb9f06171c75f4 = $d08ef79370b62062$export$d2469213b3befba9;
|
|
15708
|
-
const $d08ef79370b62062$export$7c6e2c02157bb7d2 = $d08ef79370b62062$export$6e76d93a37c01248;
|
|
15709
|
-
const $d08ef79370b62062$export$6d08773d2e66f8f2 = $d08ef79370b62062$export$ed97964d1871885d;
|
|
15710
|
-
const $d08ef79370b62062$export$1ff3c3f08ae963c0 = $d08ef79370b62062$export$da160178fd3bc7e9;
|
|
15711
|
-
const $d08ef79370b62062$export$21b07c8f274aebd5 = $d08ef79370b62062$export$34b8980744021ec5;
|
|
15712
|
-
|
|
15713
|
-
const borderStyles = [
|
|
15714
|
-
'tw-border-solid',
|
|
15715
|
-
'tw-border',
|
|
15716
|
-
'tw-rounded-sm',
|
|
15717
|
-
'tw-border-sq-light-gray',
|
|
15718
|
-
'dark:tw-border-gray-700',
|
|
15719
|
-
].join(' ');
|
|
15720
|
-
const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
|
|
15721
|
-
const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
|
|
15722
|
-
const ButtonWithDropdown = ({ dropdownItems, triggerIcon, tooltipText, id, extraClassNames, testId, tooltipTestId, tooltipDelay, tooltipPlacement, disabled = false, align = 'end', placement = 'bottom', placementOffset = 2, alignOffset = -5, hasArrow = false, onOpenChange, isHtmlTooltip = false, isOpen, }) => {
|
|
15723
|
-
let tooltipData = undefined;
|
|
15724
|
-
if (tooltipText) {
|
|
15725
|
-
tooltipData = {
|
|
15726
|
-
'data-qtip-text': tooltipText,
|
|
15727
|
-
'data-qtip-placement': tooltipPlacement,
|
|
15728
|
-
'data-qtip-is-html': isHtmlTooltip,
|
|
15729
|
-
'data-qtip-testid': tooltipTestId,
|
|
15730
|
-
'data-qtip-delay': tooltipDelay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
15731
|
-
};
|
|
15732
|
-
}
|
|
15733
|
-
return (React.createElement($d08ef79370b62062$export$be92b6f5f03c0fe9, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange },
|
|
15734
|
-
React.createElement($d08ef79370b62062$export$41fb9f06171c75f4, { id: id, className: `tw-border-none focus-visible:tw-outline-none focus:tw-outline-none focus-within:tw-outline-none`, disabled: disabled, "data-testid": testId },
|
|
15735
|
-
React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-flex tw-flex-col tw-items-center focus-visible:tw-outline-none focus:tw-outline-none focus-within:tw-outline-none ${disabled ? disabledClasses : ''} ${extraClassNames || ''}` }, triggerIcon)),
|
|
15736
|
-
React.createElement($d08ef79370b62062$export$7c6e2c02157bb7d2, { sideOffset: placementOffset, side: placement, align: align, alignOffset: alignOffset, asChild: true, className: "focus-visible:tw-outline-none tw-outline-none" },
|
|
15737
|
-
React.createElement("div", { className: bgStyles +
|
|
15738
|
-
' tw-relative tw-z-[1000] tw-min-w-6 focus-visible:tw-outline-none tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out' +
|
|
15739
|
-
' forceFont data-[side=top]:tw-animate-slideDownAndFade data-[side=right]:tw-animate-slideLeftAndFade data-[side=bottom]:tw-animate-slideUpAndFade data-[side=left]:tw-animate-slideRightAndFade ' +
|
|
15740
|
-
borderStyles },
|
|
15741
|
-
hasArrow && (React.createElement($d08ef79370b62062$export$21b07c8f274aebd5, { asChild: true },
|
|
15742
|
-
React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[6px] tw-h-[6px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-light-gray dark:tw-border-gray-700 tw-mt-[-2px]" }))),
|
|
15743
|
-
dropdownItems.map((item, index) => (React.createElement("div", { key: item.label + index },
|
|
15744
|
-
React.createElement($d08ef79370b62062$export$6d08773d2e66f8f2, { key: item.label + index, onSelect: (e) => {
|
|
15745
|
-
item.onClick(e);
|
|
15746
|
-
}, className: `tw-cursor-pointer tw-flex dark:tw-text-sq-white hover:tw-bg-sq-colored-hover hover:dark:tw-bg-sq-colored-hover-dark tw-leading-none tw-items-center tw-h-[27px] tw-px-[19px] tw-relative tw-select-none tw-outline-none data-[disabled]:tw-text-sq-disabled-gray data-[disabled]:tw-pointer-events-none ${item.containerExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled },
|
|
15747
|
-
item.icon && (React.createElement(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-white tw-w-[18px]" })),
|
|
15748
|
-
React.createElement("div", { "data-testid": item.labelTestId, className: "tw-text-[13px] tw-ml-1" }, item.label)),
|
|
15749
|
-
item.hasDivider && (React.createElement($d08ef79370b62062$export$1ff3c3f08ae963c0, { "data-testid": `dropdown-divider-${index}`, className: "tw-h-[1px] tw-bg-sq-light-gray dark:tw-bg-gray-700 tw-my-[8px]" })))))))));
|
|
15750
|
-
};
|
|
15751
|
-
|
|
15752
|
-
export { Accordion, Button, ButtonWithDropdown, ButtonWithPopover, Checkbox, Icon, Modal, QTip, Select, Tabs, TextArea, TextField, ToolbarButton, Tooltip };
|
|
14917
|
+
export { Accordion, Button, Checkbox, Icon, Modal, QTip, Select, Tabs, TextArea, TextField, ToolbarButton, Tooltip };
|
|
15753
14918
|
//# sourceMappingURL=index.esm.js.map
|