@sanity/ui 0.36.17 → 0.37.0
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/lib/sanity-ui.js +222 -197
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.js +286 -277
- package/lib/sanity-ui.modern.js.map +1 -1
- package/lib/sanity-ui.module.js +222 -197
- package/lib/sanity-ui.module.js.map +1 -1
- package/lib/src/components/menu/menu.d.ts +1 -1
- package/lib/src/components/menu/menu.d.ts.map +1 -1
- package/lib/src/components/menu/menuContext.d.ts +2 -2
- package/lib/src/components/menu/menuContext.d.ts.map +1 -1
- package/lib/src/components/menu/menuGroup.d.ts +2 -0
- package/lib/src/components/menu/menuGroup.d.ts.map +1 -1
- package/lib/src/components/menu/useMenuController.d.ts +25 -0
- package/lib/src/components/menu/useMenuController.d.ts.map +1 -0
- package/package.json +6 -6
- package/src/components/menu/__workshop__/index.ts +5 -0
- package/src/components/menu/__workshop__/menuGroupRight.tsx +59 -0
- package/src/components/menu/menu.test.tsx +16 -12
- package/src/components/menu/menu.tsx +26 -210
- package/src/components/menu/menuContext.ts +2 -2
- package/src/components/menu/menuGroup.tsx +54 -77
- package/src/components/menu/menuItem.tsx +5 -5
- package/src/components/menu/useMenuController.ts +239 -0
package/lib/sanity-ui.module.js
CHANGED
|
@@ -3602,8 +3602,8 @@ function responsiveInputPaddingIconRightStyle(props) {
|
|
|
3602
3602
|
}));
|
|
3603
3603
|
}
|
|
3604
3604
|
|
|
3605
|
-
var _templateObject$
|
|
3606
|
-
var ROOT_STYLE = css(_templateObject$
|
|
3605
|
+
var _templateObject$D, _templateObject2$n, _templateObject3$e;
|
|
3606
|
+
var ROOT_STYLE = css(_templateObject$D || (_templateObject$D = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: flex;\n }\n"])));
|
|
3607
3607
|
function textInputRootStyle() {
|
|
3608
3608
|
return ROOT_STYLE;
|
|
3609
3609
|
}
|
|
@@ -3704,20 +3704,20 @@ function responsiveShadowStyle(props) {
|
|
|
3704
3704
|
});
|
|
3705
3705
|
}
|
|
3706
3706
|
|
|
3707
|
-
var _templateObject$
|
|
3707
|
+
var _templateObject$C, _templateObject2$m, _templateObject3$d;
|
|
3708
3708
|
function textBaseStyle(props) {
|
|
3709
3709
|
var $accent = props.$accent,
|
|
3710
3710
|
$muted = props.$muted,
|
|
3711
3711
|
theme = props.theme;
|
|
3712
3712
|
var weights = theme.sanity.fonts.text.weights;
|
|
3713
|
-
return css(_templateObject$
|
|
3713
|
+
return css(_templateObject$C || (_templateObject$C = _taggedTemplateLiteralLoose(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$m || (_templateObject2$m = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$d || (_templateObject3$d = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
|
|
3714
3714
|
}
|
|
3715
3715
|
|
|
3716
3716
|
var _excluded$G = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
3717
3717
|
|
|
3718
|
-
var _templateObject$
|
|
3718
|
+
var _templateObject$B;
|
|
3719
3719
|
var Root$E = styled.div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
|
|
3720
|
-
var SpanWithTextOverflow$2 = styled.span(_templateObject$
|
|
3720
|
+
var SpanWithTextOverflow$2 = styled.span(_templateObject$B || (_templateObject$B = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
3721
3721
|
/**
|
|
3722
3722
|
* @public
|
|
3723
3723
|
*/
|
|
@@ -4018,7 +4018,7 @@ var Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4018
4018
|
}, /*#__PURE__*/React.createElement("strong", null, initials)))));
|
|
4019
4019
|
});
|
|
4020
4020
|
|
|
4021
|
-
var _templateObject$
|
|
4021
|
+
var _templateObject$A;
|
|
4022
4022
|
|
|
4023
4023
|
function responsiveAvatarCounterSizeStyle(props) {
|
|
4024
4024
|
var theme = props.theme;
|
|
@@ -4038,7 +4038,7 @@ function responsiveAvatarCounterSizeStyle(props) {
|
|
|
4038
4038
|
|
|
4039
4039
|
function avatarCounterBaseStyle(props) {
|
|
4040
4040
|
var theme = props.theme;
|
|
4041
|
-
return css(_templateObject$
|
|
4041
|
+
return css(_templateObject$A || (_templateObject$A = _taggedTemplateLiteralLoose(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow: 0 0 0 1px var(--card-bg-color), inset 0 0 0 1.5px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
|
|
4042
4042
|
}
|
|
4043
4043
|
|
|
4044
4044
|
var Root$C = styled.div(responsiveAvatarCounterSizeStyle, avatarCounterBaseStyle);
|
|
@@ -4073,8 +4073,8 @@ function childrenToElementArray(children) {
|
|
|
4073
4073
|
|
|
4074
4074
|
var _excluded$E = ["children", "maxLength", "size", "tone"];
|
|
4075
4075
|
|
|
4076
|
-
var _templateObject$
|
|
4077
|
-
var BASE_STYLES = css(_templateObject$
|
|
4076
|
+
var _templateObject$z;
|
|
4077
|
+
var BASE_STYLES = css(_templateObject$z || (_templateObject$z = _taggedTemplateLiteralLoose(["\n white-space: nowrap;\n\n & > div {\n vertical-align: top;\n\n &:not([hidden]) {\n display: inline-block;\n }\n }\n"])));
|
|
4078
4078
|
|
|
4079
4079
|
function avatarStackStyle() {
|
|
4080
4080
|
return BASE_STYLES;
|
|
@@ -4213,20 +4213,20 @@ var Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
|
|
|
4213
4213
|
}), props.children);
|
|
4214
4214
|
});
|
|
4215
4215
|
|
|
4216
|
-
var _templateObject$
|
|
4216
|
+
var _templateObject$y, _templateObject2$l, _templateObject3$c;
|
|
4217
4217
|
function labelBaseStyle(props) {
|
|
4218
4218
|
var $accent = props.$accent,
|
|
4219
4219
|
$muted = props.$muted,
|
|
4220
4220
|
theme = props.theme;
|
|
4221
4221
|
var fonts = theme.sanity.fonts;
|
|
4222
|
-
return css(_templateObject$
|
|
4222
|
+
return css(_templateObject$y || (_templateObject$y = _taggedTemplateLiteralLoose(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$c || (_templateObject3$c = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
|
|
4223
4223
|
}
|
|
4224
4224
|
|
|
4225
4225
|
var _excluded$C = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
4226
4226
|
|
|
4227
|
-
var _templateObject$
|
|
4227
|
+
var _templateObject$x;
|
|
4228
4228
|
var Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
|
|
4229
|
-
var SpanWithTextOverflow$1 = styled.span(_templateObject$
|
|
4229
|
+
var SpanWithTextOverflow$1 = styled.span(_templateObject$x || (_templateObject$x = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
4230
4230
|
/**
|
|
4231
4231
|
* @public
|
|
4232
4232
|
*/
|
|
@@ -4341,8 +4341,8 @@ var Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
|
|
|
4341
4341
|
}));
|
|
4342
4342
|
});
|
|
4343
4343
|
|
|
4344
|
-
var _templateObject$
|
|
4345
|
-
var rotate$1 = keyframes(_templateObject$
|
|
4344
|
+
var _templateObject$w, _templateObject2$k;
|
|
4345
|
+
var rotate$1 = keyframes(_templateObject$w || (_templateObject$w = _taggedTemplateLiteralLoose(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
|
|
4346
4346
|
var Root$w = styled(Text)(_templateObject2$k || (_templateObject2$k = _taggedTemplateLiteralLoose(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
|
|
4347
4347
|
/**
|
|
4348
4348
|
* @public
|
|
@@ -4393,13 +4393,13 @@ function _colorVarsStyle(base, color, checkered) {
|
|
|
4393
4393
|
};
|
|
4394
4394
|
}
|
|
4395
4395
|
|
|
4396
|
-
var _templateObject$
|
|
4396
|
+
var _templateObject$v;
|
|
4397
4397
|
/**
|
|
4398
4398
|
* @internal
|
|
4399
4399
|
*/
|
|
4400
4400
|
|
|
4401
4401
|
function buttonBaseStyles() {
|
|
4402
|
-
return css(_templateObject$
|
|
4402
|
+
return css(_templateObject$v || (_templateObject$v = _taggedTemplateLiteralLoose(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])));
|
|
4403
4403
|
}
|
|
4404
4404
|
var buttonTheme = {
|
|
4405
4405
|
border: {
|
|
@@ -4450,9 +4450,9 @@ function buttonColorStyles(props) {
|
|
|
4450
4450
|
|
|
4451
4451
|
var _excluded$z = ["children", "disabled", "fontSize", "icon", "iconRight", "justify", "loading", "mode", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "radius", "selected", "space", "text", "textAlign", "tone", "type"];
|
|
4452
4452
|
|
|
4453
|
-
var _templateObject$
|
|
4453
|
+
var _templateObject$u;
|
|
4454
4454
|
var Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
|
|
4455
|
-
var LoadingBox = styled.div(_templateObject$
|
|
4455
|
+
var LoadingBox = styled.div(_templateObject$u || (_templateObject$u = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--card-bg-color);\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])));
|
|
4456
4456
|
/**
|
|
4457
4457
|
* @public
|
|
4458
4458
|
*/
|
|
@@ -4536,7 +4536,7 @@ var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
4536
4536
|
}, boxProps), children));
|
|
4537
4537
|
});
|
|
4538
4538
|
|
|
4539
|
-
var _templateObject$
|
|
4539
|
+
var _templateObject$t, _templateObject2$j, _templateObject3$b;
|
|
4540
4540
|
function cardStyle(props) {
|
|
4541
4541
|
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
4542
4542
|
}
|
|
@@ -4544,7 +4544,7 @@ function cardBaseStyle(props) {
|
|
|
4544
4544
|
var $checkered = props.$checkered,
|
|
4545
4545
|
theme = props.theme;
|
|
4546
4546
|
var space = theme.sanity.space;
|
|
4547
|
-
return css(_templateObject$
|
|
4547
|
+
return css(_templateObject$t || (_templateObject$t = _taggedTemplateLiteralLoose(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_templateObject2$j || (_templateObject2$j = _taggedTemplateLiteralLoose(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
|
|
4548
4548
|
}
|
|
4549
4549
|
function cardColorStyle(props) {
|
|
4550
4550
|
var _theme$sanity$styles, _theme$sanity$styles$;
|
|
@@ -4630,9 +4630,9 @@ var Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
4630
4630
|
})));
|
|
4631
4631
|
});
|
|
4632
4632
|
|
|
4633
|
-
var _templateObject$
|
|
4633
|
+
var _templateObject$s, _templateObject2$i;
|
|
4634
4634
|
function checkboxBaseStyles() {
|
|
4635
|
-
return css(_templateObject$
|
|
4635
|
+
return css(_templateObject$s || (_templateObject$s = _taggedTemplateLiteralLoose(["\n position: relative;\n display: inline-block;\n "])));
|
|
4636
4636
|
}
|
|
4637
4637
|
function inputElementStyles(props) {
|
|
4638
4638
|
var theme = props.theme;
|
|
@@ -4702,7 +4702,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef) {
|
|
|
4702
4702
|
})), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CheckmarkIcon, null), /*#__PURE__*/React.createElement(RemoveIcon, null)));
|
|
4703
4703
|
});
|
|
4704
4704
|
|
|
4705
|
-
var _templateObject$
|
|
4705
|
+
var _templateObject$r;
|
|
4706
4706
|
|
|
4707
4707
|
function codeSyntaxHighlightingStyle(_ref) {
|
|
4708
4708
|
var theme = _ref.theme;
|
|
@@ -4820,7 +4820,7 @@ function codeSyntaxHighlightingStyle(_ref) {
|
|
|
4820
4820
|
}
|
|
4821
4821
|
|
|
4822
4822
|
function codeBaseStyle() {
|
|
4823
|
-
return css(_templateObject$
|
|
4823
|
+
return css(_templateObject$r || (_templateObject$r = _taggedTemplateLiteralLoose(["\n color: var(--card-code-fg-color);\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ", "\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), codeSyntaxHighlightingStyle);
|
|
4824
4824
|
}
|
|
4825
4825
|
|
|
4826
4826
|
var _excluded$w = ["children", "language", "size", "weight"];
|
|
@@ -4928,19 +4928,19 @@ var Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
|
|
|
4928
4928
|
}), children);
|
|
4929
4929
|
});
|
|
4930
4930
|
|
|
4931
|
-
var _templateObject$
|
|
4931
|
+
var _templateObject$q, _templateObject2$h, _templateObject3$a;
|
|
4932
4932
|
function headingBaseStyle(props) {
|
|
4933
4933
|
var $accent = props.$accent,
|
|
4934
4934
|
$muted = props.$muted,
|
|
4935
4935
|
theme = props.theme;
|
|
4936
|
-
return css(_templateObject$
|
|
4936
|
+
return css(_templateObject$q || (_templateObject$q = _taggedTemplateLiteralLoose(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$h || (_templateObject2$h = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$a || (_templateObject3$a = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
|
|
4937
4937
|
}
|
|
4938
4938
|
|
|
4939
4939
|
var _excluded$t = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
4940
4940
|
|
|
4941
|
-
var _templateObject$
|
|
4941
|
+
var _templateObject$p;
|
|
4942
4942
|
var Root$p = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
|
|
4943
|
-
var SpanWithTextOverflow = styled.span(_templateObject$
|
|
4943
|
+
var SpanWithTextOverflow = styled.span(_templateObject$p || (_templateObject$p = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
4944
4944
|
/**
|
|
4945
4945
|
* @public
|
|
4946
4946
|
*/
|
|
@@ -5029,10 +5029,10 @@ var Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
|
|
|
5029
5029
|
|
|
5030
5030
|
var _excluded$r = ["children", "fontSize", "padding", "radius"];
|
|
5031
5031
|
|
|
5032
|
-
var _templateObject$
|
|
5032
|
+
var _templateObject$o;
|
|
5033
5033
|
|
|
5034
5034
|
function kbdStyle() {
|
|
5035
|
-
return css(_templateObject$
|
|
5035
|
+
return css(_templateObject$o || (_templateObject$o = _taggedTemplateLiteralLoose(["\n background: var(--card-bg-color);\n font: inherit;\n box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
5036
5036
|
}
|
|
5037
5037
|
|
|
5038
5038
|
var Root$n = styled.kbd(responsiveRadiusStyle, kbdStyle);
|
|
@@ -5324,8 +5324,8 @@ function LayerProvider(props) {
|
|
|
5324
5324
|
var _excluded$p = ["children", "style"],
|
|
5325
5325
|
_excluded2$1 = ["children", "zOffset"];
|
|
5326
5326
|
|
|
5327
|
-
var _templateObject$
|
|
5328
|
-
var Root$m = styled.div(_templateObject$
|
|
5327
|
+
var _templateObject$n;
|
|
5328
|
+
var Root$m = styled.div(_templateObject$n || (_templateObject$n = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
|
|
5329
5329
|
var LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref) {
|
|
5330
5330
|
var children = props.children,
|
|
5331
5331
|
_props$style = props.style,
|
|
@@ -5467,8 +5467,8 @@ function PortalProvider(props) {
|
|
|
5467
5467
|
}, children);
|
|
5468
5468
|
}
|
|
5469
5469
|
|
|
5470
|
-
var _templateObject$
|
|
5471
|
-
var Root$l = styled.div(_templateObject$
|
|
5470
|
+
var _templateObject$m;
|
|
5471
|
+
var Root$l = styled.div(_templateObject$m || (_templateObject$m = _taggedTemplateLiteralLoose(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
|
|
5472
5472
|
/**
|
|
5473
5473
|
* @public
|
|
5474
5474
|
*/
|
|
@@ -5652,8 +5652,8 @@ function _isScrollable(el) {
|
|
|
5652
5652
|
|
|
5653
5653
|
var _excluded$o = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
|
|
5654
5654
|
|
|
5655
|
-
var _templateObject$
|
|
5656
|
-
var Root$k = styled.div(_templateObject$
|
|
5655
|
+
var _templateObject$l, _templateObject2$g;
|
|
5656
|
+
var Root$k = styled.div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
|
|
5657
5657
|
var ItemWrapper = styled.div(_templateObject2$g || (_templateObject2$g = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
|
|
5658
5658
|
/**
|
|
5659
5659
|
* @beta
|
|
@@ -5799,8 +5799,8 @@ var VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
|
|
|
5799
5799
|
}, children));
|
|
5800
5800
|
});
|
|
5801
5801
|
|
|
5802
|
-
var _templateObject$
|
|
5803
|
-
var Root$j = styled.div(_templateObject$
|
|
5802
|
+
var _templateObject$k, _templateObject2$f, _templateObject3$9;
|
|
5803
|
+
var Root$j = styled.div(_templateObject$k || (_templateObject$k = _taggedTemplateLiteralLoose(["\n position: absolute;\n pointer-events: none;\n width: 27px;\n height: 27px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 13.5px 13.5px;\n }\n\n [data-popper-placement^='top'] > div > & {\n bottom: -27px;\n }\n\n [data-popper-placement^='right'] > div > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-popper-placement^='left'] > div > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-popper-placement^='bottom'] > div > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
|
|
5804
5804
|
var BorderPath = styled.path(_templateObject2$f || (_templateObject2$f = _taggedTemplateLiteralLoose(["\n fill: var(--card-shadow-outline-color);\n"])));
|
|
5805
5805
|
var ShapePath = styled.path(_templateObject3$9 || (_templateObject3$9 = _taggedTemplateLiteralLoose(["\n fill: var(--card-bg-color);\n"])));
|
|
5806
5806
|
var PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
|
|
@@ -5979,10 +5979,10 @@ function usePopoverModifiers(props) {
|
|
|
5979
5979
|
|
|
5980
5980
|
var _excluded$n = ["__unstable_margins", "allowedAutoPlacements", "arrow", "boundaryElement", "children", "content", "constrainSize", "disabled", "fallbackPlacements", "open", "padding", "placement", "portal", "preventOverflow", "radius", "referenceElement", "matchReferenceWidth", "shadow", "scheme", "style", "tether", "tetherOffset", "tone", "width", "zOffset"];
|
|
5981
5981
|
|
|
5982
|
-
var _templateObject$
|
|
5982
|
+
var _templateObject$j, _templateObject2$e, _templateObject3$8;
|
|
5983
5983
|
var Root$i = styled(Layer)(function (_ref) {
|
|
5984
5984
|
var $preventOverflow = _ref.$preventOverflow;
|
|
5985
|
-
return css(_templateObject$
|
|
5985
|
+
return css(_templateObject$j || (_templateObject$j = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n display: flex;\n flex-direction: column;\n max-width: calc(100% - 16px);\n\n & > * {\n min-height: 0;\n }\n\n /* Hide the popover when the reference element is out of bounds */\n ", "\n "])), $preventOverflow && css(_templateObject2$e || (_templateObject2$e = _taggedTemplateLiteralLoose(["\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n "]))));
|
|
5986
5986
|
});
|
|
5987
5987
|
var PopoverCard = styled(Card)(function (_ref2) {
|
|
5988
5988
|
var $constrainSize = _ref2.$constrainSize;
|
|
@@ -6132,9 +6132,9 @@ var Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6132
6132
|
}, node), !portalProp && node));
|
|
6133
6133
|
});
|
|
6134
6134
|
|
|
6135
|
-
var _templateObject$
|
|
6135
|
+
var _templateObject$i, _templateObject2$d;
|
|
6136
6136
|
function radioBaseStyle() {
|
|
6137
|
-
return css(_templateObject$
|
|
6137
|
+
return css(_templateObject$i || (_templateObject$i = _taggedTemplateLiteralLoose(["\n position: relative;\n\n &:not([hidden]) {\n display: inline-block;\n }\n\n &[data-read-only] {\n outline: 1px solid red;\n }\n "])));
|
|
6138
6138
|
}
|
|
6139
6139
|
function inputElementStyle(props) {
|
|
6140
6140
|
var theme = props.theme;
|
|
@@ -6189,10 +6189,10 @@ var Radio = /*#__PURE__*/forwardRef(function Radio(props, forwardedRef) {
|
|
|
6189
6189
|
})), /*#__PURE__*/React.createElement("span", null));
|
|
6190
6190
|
});
|
|
6191
6191
|
|
|
6192
|
-
var _templateObject$
|
|
6192
|
+
var _templateObject$h, _templateObject2$c, _templateObject3$7, _templateObject4$5;
|
|
6193
6193
|
|
|
6194
6194
|
function rootStyle() {
|
|
6195
|
-
return css(_templateObject$
|
|
6195
|
+
return css(_templateObject$h || (_templateObject$h = _taggedTemplateLiteralLoose(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
6196
6196
|
}
|
|
6197
6197
|
|
|
6198
6198
|
function inputBaseStyle(props) {
|
|
@@ -6350,11 +6350,11 @@ var Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
|
|
|
6350
6350
|
}));
|
|
6351
6351
|
});
|
|
6352
6352
|
|
|
6353
|
-
var _templateObject$
|
|
6353
|
+
var _templateObject$g, _templateObject2$b, _templateObject3$6, _templateObject4$4, _templateObject5$3, _templateObject6$1, _templateObject7;
|
|
6354
6354
|
/* Root */
|
|
6355
6355
|
|
|
6356
6356
|
function switchBaseStyles() {
|
|
6357
|
-
return css(_templateObject$
|
|
6357
|
+
return css(_templateObject$g || (_templateObject$g = _taggedTemplateLiteralLoose(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
6358
6358
|
}
|
|
6359
6359
|
/* Input */
|
|
6360
6360
|
|
|
@@ -6445,9 +6445,9 @@ var Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
|
|
|
6445
6445
|
|
|
6446
6446
|
var _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"];
|
|
6447
6447
|
|
|
6448
|
-
var _templateObject$
|
|
6448
|
+
var _templateObject$f;
|
|
6449
6449
|
var Root$d = styled.span(textInputRootStyle);
|
|
6450
|
-
var InputRoot$1 = styled.span(_templateObject$
|
|
6450
|
+
var InputRoot$1 = styled.span(_templateObject$f || (_templateObject$f = _taggedTemplateLiteralLoose(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
|
|
6451
6451
|
var Input$1 = styled.textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
|
|
6452
6452
|
var Presentation$1 = styled.div(responsiveRadiusStyle, textInputRepresentationStyle);
|
|
6453
6453
|
/**
|
|
@@ -6487,12 +6487,12 @@ var TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef) {
|
|
|
6487
6487
|
|
|
6488
6488
|
var _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"];
|
|
6489
6489
|
|
|
6490
|
-
var _templateObject$
|
|
6490
|
+
var _templateObject$e, _templateObject2$a, _templateObject3$5, _templateObject4$3, _templateObject5$2;
|
|
6491
6491
|
var CLEAR_BUTTON_BOX_STYLE = {
|
|
6492
6492
|
zIndex: 2
|
|
6493
6493
|
};
|
|
6494
6494
|
var Root$c = styled.span(textInputRootStyle);
|
|
6495
|
-
var InputRoot = styled.span(_templateObject$
|
|
6495
|
+
var InputRoot = styled.span(_templateObject$e || (_templateObject$e = _taggedTemplateLiteralLoose(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
|
|
6496
6496
|
var Prefix = styled(Card).attrs({
|
|
6497
6497
|
forwardedAs: 'span'
|
|
6498
6498
|
})(_templateObject2$a || (_templateObject2$a = _taggedTemplateLiteralLoose(["\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n & > span {\n display: block;\n margin: -1px;\n }\n"])));
|
|
@@ -6646,8 +6646,8 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef)
|
|
|
6646
6646
|
})), presentationNode, clearButtonNode), suffixNode);
|
|
6647
6647
|
});
|
|
6648
6648
|
|
|
6649
|
-
var _templateObject$
|
|
6650
|
-
var Root$b = styled.div(_templateObject$
|
|
6649
|
+
var _templateObject$d, _templateObject2$9, _templateObject3$4;
|
|
6650
|
+
var Root$b = styled.div(_templateObject$d || (_templateObject$d = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n }\n\n [data-popper-placement^='top'] > div > & {\n bottom: -15px;\n }\n\n [data-popper-placement^='right'] > div > & {\n left: -15px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-popper-placement^='left'] > div > & {\n right: -15px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-popper-placement^='bottom'] > div > & {\n top: -15px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
|
|
6651
6651
|
var Border = styled.path(_templateObject2$9 || (_templateObject2$9 = _taggedTemplateLiteralLoose(["\n fill: var(--card-shadow-outline-color);\n"])));
|
|
6652
6652
|
var Shape = styled.path(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteralLoose(["\n fill: var(--card-bg-color);\n"])));
|
|
6653
6653
|
var TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
|
|
@@ -6668,8 +6668,8 @@ var TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
|
|
|
6668
6668
|
|
|
6669
6669
|
var _excluded$g = ["allowedAutoPlacements", "boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "zOffset"];
|
|
6670
6670
|
|
|
6671
|
-
var _templateObject$
|
|
6672
|
-
var Root$a = styled(Layer)(_templateObject$
|
|
6671
|
+
var _templateObject$c;
|
|
6672
|
+
var Root$a = styled(Layer)(_templateObject$c || (_templateObject$c = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n"])));
|
|
6673
6673
|
/**
|
|
6674
6674
|
* @public
|
|
6675
6675
|
*/
|
|
@@ -6822,12 +6822,12 @@ var Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
6822
6822
|
}, popperNode), !portal && popperNode));
|
|
6823
6823
|
});
|
|
6824
6824
|
|
|
6825
|
-
var _templateObject$
|
|
6825
|
+
var _templateObject$b, _templateObject2$8, _templateObject3$3, _templateObject4$2, _templateObject5$1;
|
|
6826
6826
|
/**
|
|
6827
6827
|
* @internal
|
|
6828
6828
|
*/
|
|
6829
6829
|
|
|
6830
|
-
var Root$9 = styled.div(_templateObject$
|
|
6830
|
+
var Root$9 = styled.div(_templateObject$b || (_templateObject$b = _taggedTemplateLiteralLoose(["\n /* position: relative; */\n"])));
|
|
6831
6831
|
/**
|
|
6832
6832
|
* @internal
|
|
6833
6833
|
*/
|
|
@@ -7473,8 +7473,8 @@ var InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(props
|
|
|
7473
7473
|
|
|
7474
7474
|
var Autocomplete = InnerAutocomplete;
|
|
7475
7475
|
|
|
7476
|
-
var _templateObject$
|
|
7477
|
-
var Root$8 = styled.ol(_templateObject$
|
|
7476
|
+
var _templateObject$a, _templateObject2$7;
|
|
7477
|
+
var Root$8 = styled.ol(_templateObject$a || (_templateObject$a = _taggedTemplateLiteralLoose(["\n margin: 0;\n padding: 0;\n display: flex;\n list-style: none;\n align-items: center;\n white-space: nowrap;\n line-height: 0;\n"])));
|
|
7478
7478
|
var ExpandButton = styled(Button)(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteralLoose(["\n appearance: none;\n margin: -4px;\n"])));
|
|
7479
7479
|
|
|
7480
7480
|
var _excluded$e = ["children", "maxLength", "separator", "space"];
|
|
@@ -7615,9 +7615,9 @@ function useDialog() {
|
|
|
7615
7615
|
|
|
7616
7616
|
var _excluded$d = ["__unstable_autoFocus", "__unstable_hideCloseButton", "cardRadius", "cardShadow", "children", "contentRef", "footer", "header", "id", "onClickOutside", "onClose", "padding", "portal", "position", "scheme", "width", "zOffset"];
|
|
7617
7617
|
|
|
7618
|
-
var _templateObject$
|
|
7618
|
+
var _templateObject$9, _templateObject2$6, _templateObject3$2, _templateObject4$1, _templateObject5, _templateObject6;
|
|
7619
7619
|
var Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
|
|
7620
|
-
var DialogContainer = styled(Container)(_templateObject$
|
|
7620
|
+
var DialogContainer = styled(Container)(_templateObject$9 || (_templateObject$9 = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
|
|
7621
7621
|
var DialogCardRoot = styled(Card)(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n"])));
|
|
7622
7622
|
var DialogLayout = styled(Flex)(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
|
|
7623
7623
|
var DialogHeader = styled(Card)(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));
|
|
@@ -7826,8 +7826,8 @@ function DialogProvider(props) {
|
|
|
7826
7826
|
|
|
7827
7827
|
var _excluded$c = ["fontSize", "keys", "padding", "radius", "space"];
|
|
7828
7828
|
|
|
7829
|
-
var _templateObject$
|
|
7830
|
-
var Root$6 = styled.kbd(_templateObject$
|
|
7829
|
+
var _templateObject$8, _templateObject2$5;
|
|
7830
|
+
var Root$6 = styled.kbd(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
|
|
7831
7831
|
var Key = styled(KBD)(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: block;\n }\n"])));
|
|
7832
7832
|
/**
|
|
7833
7833
|
* @public
|
|
@@ -7863,6 +7863,10 @@ var Hotkeys = /*#__PURE__*/forwardRef(function Hotkeys(props, ref) {
|
|
|
7863
7863
|
})));
|
|
7864
7864
|
});
|
|
7865
7865
|
|
|
7866
|
+
var key$2 = Symbol["for"]('@sanity/ui/context/menu');
|
|
7867
|
+
globalScope[key$2] = globalScope[key$2] || /*#__PURE__*/createContext(null);
|
|
7868
|
+
var MenuContext = globalScope[key$2];
|
|
7869
|
+
|
|
7866
7870
|
/**
|
|
7867
7871
|
* @internal
|
|
7868
7872
|
*/
|
|
@@ -7938,56 +7942,34 @@ function _sortElements(rootElement, elements) {
|
|
|
7938
7942
|
elements.sort(_sort);
|
|
7939
7943
|
}
|
|
7940
7944
|
|
|
7941
|
-
var key$2 = Symbol["for"]('@sanity/ui/context/menu');
|
|
7942
|
-
globalScope[key$2] = globalScope[key$2] || /*#__PURE__*/createContext(null);
|
|
7943
|
-
var MenuContext = globalScope[key$2];
|
|
7944
|
-
|
|
7945
|
-
var _excluded$b = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"];
|
|
7946
|
-
|
|
7947
|
-
var _templateObject$8;
|
|
7948
|
-
var Root$5 = styled(Box)(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n outline: none;\n overflow: auto;\n"])));
|
|
7949
7945
|
/**
|
|
7950
|
-
*
|
|
7946
|
+
* This controller is responsible for controlling UI menu state.
|
|
7947
|
+
*
|
|
7948
|
+
* @internal
|
|
7951
7949
|
*/
|
|
7952
7950
|
|
|
7953
|
-
|
|
7954
|
-
var
|
|
7955
|
-
onClickOutside = props.onClickOutside,
|
|
7956
|
-
onEscape = props.onEscape,
|
|
7957
|
-
onItemClick = props.onItemClick,
|
|
7958
|
-
onItemSelect = props.onItemSelect,
|
|
7959
|
-
onKeyDown = props.onKeyDown,
|
|
7951
|
+
function useMenuController(props) {
|
|
7952
|
+
var onKeyDown = props.onKeyDown,
|
|
7960
7953
|
originElement = props.originElement,
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
registerElement = props.registerElement,
|
|
7964
|
-
_props$shouldFocus = props.shouldFocus,
|
|
7965
|
-
shouldFocus = _props$shouldFocus === void 0 ? props.focusFirst && 'first' || props.focusLast && 'last' || null : _props$shouldFocus,
|
|
7966
|
-
_props$space = props.space,
|
|
7967
|
-
space = _props$space === void 0 ? 1 : _props$space,
|
|
7968
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
7969
|
-
|
|
7970
|
-
var _useLayer = useLayer(),
|
|
7971
|
-
isTopLayer = _useLayer.isTopLayer;
|
|
7954
|
+
shouldFocus = props.shouldFocus;
|
|
7955
|
+
var elementsRef = useRef([]);
|
|
7972
7956
|
|
|
7973
7957
|
var _useState = useState(null),
|
|
7974
7958
|
rootElement = _useState[0],
|
|
7975
7959
|
setRootElement = _useState[1];
|
|
7976
7960
|
|
|
7977
|
-
var elementsRef = useRef([]);
|
|
7978
|
-
|
|
7979
7961
|
var _useState2 = useState(-1),
|
|
7980
7962
|
activeIndex = _useState2[0],
|
|
7981
|
-
|
|
7963
|
+
_setActiveIndex = _useState2[1];
|
|
7982
7964
|
|
|
7983
|
-
var activeIndexRef = useRef(activeIndex);
|
|
7984
7965
|
var activeElement = elementsRef.current[activeIndex] || null;
|
|
7985
|
-
var
|
|
7966
|
+
var activeIndexRef = useRef(activeIndex);
|
|
7986
7967
|
var mounted = Boolean(rootElement);
|
|
7987
|
-
var
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7968
|
+
var setActiveIndex = useCallback(function (nextActiveIndex) {
|
|
7969
|
+
_setActiveIndex(nextActiveIndex);
|
|
7970
|
+
|
|
7971
|
+
activeIndexRef.current = nextActiveIndex;
|
|
7972
|
+
}, []);
|
|
7991
7973
|
var mount = useCallback(function (element, selected) {
|
|
7992
7974
|
if (!element) return function () {
|
|
7993
7975
|
return undefined;
|
|
@@ -8002,7 +7984,6 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8002
7984
|
if (selected) {
|
|
8003
7985
|
var selectedIndex = elementsRef.current.indexOf(element);
|
|
8004
7986
|
setActiveIndex(selectedIndex);
|
|
8005
|
-
activeIndexRef.current = selectedIndex;
|
|
8006
7987
|
}
|
|
8007
7988
|
|
|
8008
7989
|
return function () {
|
|
@@ -8012,7 +7993,7 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8012
7993
|
elementsRef.current.splice(idx, 1);
|
|
8013
7994
|
}
|
|
8014
7995
|
};
|
|
8015
|
-
}, [rootElement]);
|
|
7996
|
+
}, [rootElement, setActiveIndex]);
|
|
8016
7997
|
var handleKeyDown = useCallback(function (event) {
|
|
8017
7998
|
// Move focus to the element that opened the menu before handling the `Tab` press
|
|
8018
7999
|
if (event.key === 'Tab') {
|
|
@@ -8034,7 +8015,6 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8034
8015
|
if (!el) return;
|
|
8035
8016
|
var currentIndex = elementsRef.current.indexOf(el);
|
|
8036
8017
|
setActiveIndex(currentIndex);
|
|
8037
|
-
activeIndexRef.current = currentIndex;
|
|
8038
8018
|
return;
|
|
8039
8019
|
} // Move focus to the last focusable menuitem
|
|
8040
8020
|
|
|
@@ -8051,7 +8031,6 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8051
8031
|
var _currentIndex = elementsRef.current.indexOf(_el);
|
|
8052
8032
|
|
|
8053
8033
|
setActiveIndex(_currentIndex);
|
|
8054
|
-
activeIndexRef.current = _currentIndex;
|
|
8055
8034
|
return;
|
|
8056
8035
|
}
|
|
8057
8036
|
|
|
@@ -8073,7 +8052,6 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8073
8052
|
var _currentIndex2 = elementsRef.current.indexOf(_el2);
|
|
8074
8053
|
|
|
8075
8054
|
setActiveIndex(_currentIndex2);
|
|
8076
|
-
activeIndexRef.current = _currentIndex2;
|
|
8077
8055
|
return;
|
|
8078
8056
|
}
|
|
8079
8057
|
|
|
@@ -8095,32 +8073,22 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8095
8073
|
var _currentIndex3 = elementsRef.current.indexOf(_el3);
|
|
8096
8074
|
|
|
8097
8075
|
setActiveIndex(_currentIndex3);
|
|
8098
|
-
activeIndexRef.current = _currentIndex3;
|
|
8099
8076
|
return;
|
|
8100
8077
|
}
|
|
8101
8078
|
|
|
8102
8079
|
if (onKeyDown) {
|
|
8103
8080
|
onKeyDown(event);
|
|
8104
8081
|
}
|
|
8105
|
-
}, [activeIndex, onKeyDown, originElement]);
|
|
8082
|
+
}, [activeIndex, onKeyDown, originElement, setActiveIndex]);
|
|
8106
8083
|
var handleItemMouseEnter = useCallback(function (event) {
|
|
8107
8084
|
var element = event.currentTarget;
|
|
8108
8085
|
var currentIndex = elementsRef.current.indexOf(element);
|
|
8109
8086
|
setActiveIndex(currentIndex);
|
|
8110
|
-
|
|
8111
|
-
}, []);
|
|
8087
|
+
}, [setActiveIndex]);
|
|
8112
8088
|
var handleItemMouseLeave = useCallback(function () {
|
|
8113
8089
|
rootElement == null ? void 0 : rootElement.focus();
|
|
8114
8090
|
setActiveIndex(-1);
|
|
8115
|
-
|
|
8116
|
-
}, [rootElement]); // Trigger `onItemSelect` when active index changes
|
|
8117
|
-
|
|
8118
|
-
useEffect(function () {
|
|
8119
|
-
if (onItemSelect) onItemSelect(activeIndex);
|
|
8120
|
-
}, [activeIndex, onItemSelect]);
|
|
8121
|
-
useEffect(function () {
|
|
8122
|
-
activeElementRef.current = activeElement;
|
|
8123
|
-
}, [activeElement]); // Set focus on the currently active element
|
|
8091
|
+
}, [rootElement, setActiveIndex]); // Set focus on the currently active element
|
|
8124
8092
|
|
|
8125
8093
|
useEffect(function () {
|
|
8126
8094
|
if (!mounted) return;
|
|
@@ -8162,10 +8130,76 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8162
8130
|
return function () {
|
|
8163
8131
|
window.cancelAnimationFrame(rafId);
|
|
8164
8132
|
};
|
|
8165
|
-
}, [activeIndex, mounted, shouldFocus]);
|
|
8133
|
+
}, [activeIndex, mounted, setActiveIndex, shouldFocus]);
|
|
8134
|
+
return {
|
|
8135
|
+
activeElement: activeElement,
|
|
8136
|
+
activeIndex: activeIndex,
|
|
8137
|
+
handleItemMouseEnter: handleItemMouseEnter,
|
|
8138
|
+
handleItemMouseLeave: handleItemMouseLeave,
|
|
8139
|
+
handleKeyDown: handleKeyDown,
|
|
8140
|
+
mount: mount,
|
|
8141
|
+
rootElement: rootElement,
|
|
8142
|
+
setRootElement: setRootElement
|
|
8143
|
+
};
|
|
8144
|
+
}
|
|
8145
|
+
|
|
8146
|
+
var _excluded$b = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"];
|
|
8147
|
+
|
|
8148
|
+
var _templateObject$7;
|
|
8149
|
+
var Root$5 = styled(Box)(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n outline: none;\n overflow: auto;\n"])));
|
|
8150
|
+
/**
|
|
8151
|
+
* @public
|
|
8152
|
+
*/
|
|
8153
|
+
|
|
8154
|
+
var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
8155
|
+
var children = props.children,
|
|
8156
|
+
onClickOutside = props.onClickOutside,
|
|
8157
|
+
onEscape = props.onEscape,
|
|
8158
|
+
onItemClick = props.onItemClick,
|
|
8159
|
+
onItemSelect = props.onItemSelect,
|
|
8160
|
+
onKeyDown = props.onKeyDown,
|
|
8161
|
+
originElement = props.originElement,
|
|
8162
|
+
_props$padding = props.padding,
|
|
8163
|
+
padding = _props$padding === void 0 ? 1 : _props$padding,
|
|
8164
|
+
registerElement = props.registerElement,
|
|
8165
|
+
_props$shouldFocus = props.shouldFocus,
|
|
8166
|
+
shouldFocus = _props$shouldFocus === void 0 ? props.focusFirst && 'first' || props.focusLast && 'last' || null : _props$shouldFocus,
|
|
8167
|
+
_props$space = props.space,
|
|
8168
|
+
space = _props$space === void 0 ? 1 : _props$space,
|
|
8169
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
8170
|
+
|
|
8171
|
+
var forwardedRef = useForwardedRef(ref);
|
|
8172
|
+
|
|
8173
|
+
var _useLayer = useLayer(),
|
|
8174
|
+
isTopLayer = _useLayer.isTopLayer;
|
|
8175
|
+
|
|
8176
|
+
var _useMenuController = useMenuController({
|
|
8177
|
+
onKeyDown: onKeyDown,
|
|
8178
|
+
originElement: originElement,
|
|
8179
|
+
shouldFocus: shouldFocus
|
|
8180
|
+
}),
|
|
8181
|
+
activeElement = _useMenuController.activeElement,
|
|
8182
|
+
activeIndex = _useMenuController.activeIndex,
|
|
8183
|
+
handleItemMouseEnter = _useMenuController.handleItemMouseEnter,
|
|
8184
|
+
handleItemMouseLeave = _useMenuController.handleItemMouseLeave,
|
|
8185
|
+
handleKeyDown = _useMenuController.handleKeyDown,
|
|
8186
|
+
mount = _useMenuController.mount,
|
|
8187
|
+
rootElement = _useMenuController.rootElement,
|
|
8188
|
+
setRootElement = _useMenuController.setRootElement;
|
|
8189
|
+
|
|
8190
|
+
var handleRefChange = useCallback(function (el) {
|
|
8191
|
+
setRootElement(el);
|
|
8192
|
+
forwardedRef.current = el;
|
|
8193
|
+
}, [forwardedRef, setRootElement]); // Trigger `onItemSelect` when active index changes
|
|
8194
|
+
|
|
8195
|
+
useEffect(function () {
|
|
8196
|
+
if (onItemSelect) onItemSelect(activeIndex);
|
|
8197
|
+
}, [activeIndex, onItemSelect]); // Close menu when clicking outside
|
|
8198
|
+
|
|
8166
8199
|
useClickOutside(useCallback(function (event) {
|
|
8167
8200
|
return isTopLayer && onClickOutside && onClickOutside(event);
|
|
8168
|
-
}, [isTopLayer, onClickOutside]), [rootElement]);
|
|
8201
|
+
}, [isTopLayer, onClickOutside]), [rootElement]); // Close menu when pressing Escape
|
|
8202
|
+
|
|
8169
8203
|
useGlobalKeyDown(useCallback(function (event) {
|
|
8170
8204
|
if (!isTopLayer) return;
|
|
8171
8205
|
|
|
@@ -8173,7 +8207,8 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8173
8207
|
event.stopPropagation();
|
|
8174
8208
|
if (onEscape) onEscape();
|
|
8175
8209
|
}
|
|
8176
|
-
}, [isTopLayer, onEscape]));
|
|
8210
|
+
}, [isTopLayer, onEscape])); // Register root element (for nested menus)
|
|
8211
|
+
|
|
8177
8212
|
useEffect(function () {
|
|
8178
8213
|
if (!rootElement || !registerElement) return;
|
|
8179
8214
|
return registerElement(rootElement);
|
|
@@ -8186,9 +8221,9 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8186
8221
|
mount: mount,
|
|
8187
8222
|
onClickOutside: onClickOutside,
|
|
8188
8223
|
onEscape: onEscape,
|
|
8189
|
-
onMouseEnter: handleItemMouseEnter,
|
|
8190
|
-
onMouseLeave: handleItemMouseLeave,
|
|
8191
8224
|
onItemClick: onItemClick,
|
|
8225
|
+
onItemMouseEnter: handleItemMouseEnter,
|
|
8226
|
+
onItemMouseLeave: handleItemMouseLeave,
|
|
8192
8227
|
registerElement: registerElement
|
|
8193
8228
|
};
|
|
8194
8229
|
}, [activeElement, activeIndex, mount, handleItemMouseEnter, handleItemMouseLeave, onClickOutside, onEscape, onItemClick, registerElement]);
|
|
@@ -8199,7 +8234,7 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8199
8234
|
}, restProps, {
|
|
8200
8235
|
onKeyDown: handleKeyDown,
|
|
8201
8236
|
padding: padding,
|
|
8202
|
-
ref:
|
|
8237
|
+
ref: handleRefChange,
|
|
8203
8238
|
role: "menu",
|
|
8204
8239
|
tabIndex: -1
|
|
8205
8240
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -8387,16 +8422,16 @@ var MenuButton = /*#__PURE__*/forwardRef(function MenuButton(props, ref) {
|
|
|
8387
8422
|
}), button || /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
8388
8423
|
});
|
|
8389
8424
|
|
|
8390
|
-
var _templateObject$
|
|
8425
|
+
var _templateObject$6;
|
|
8391
8426
|
/**
|
|
8392
8427
|
* @public
|
|
8393
8428
|
*/
|
|
8394
8429
|
|
|
8395
|
-
var MenuDivider = styled.hr(_templateObject$
|
|
8430
|
+
var MenuDivider = styled.hr(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
|
|
8396
8431
|
|
|
8397
|
-
var _templateObject$
|
|
8432
|
+
var _templateObject$5, _templateObject2$4;
|
|
8398
8433
|
function selectableBaseStyle() {
|
|
8399
|
-
return css(_templateObject$
|
|
8434
|
+
return css(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
|
|
8400
8435
|
}
|
|
8401
8436
|
function selectableColorStyle(props) {
|
|
8402
8437
|
var _theme$sanity$styles, _theme$sanity$styles$;
|
|
@@ -8435,11 +8470,7 @@ function useMenu() {
|
|
|
8435
8470
|
return value;
|
|
8436
8471
|
}
|
|
8437
8472
|
|
|
8438
|
-
var _excluded$a = ["as", "children", "fontSize", "onClick", "padding", "popover", "radius", "text", "tone"];
|
|
8439
|
-
|
|
8440
|
-
var _templateObject$5;
|
|
8441
|
-
var MOUSE_LEAVE_TIMEOUT = 1000;
|
|
8442
|
-
var TextContainer = styled.span(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: flex;\n }\n\n & > div:first-child {\n flex: 1;\n min-width: 0;\n }\n"])));
|
|
8473
|
+
var _excluded$a = ["as", "children", "fontSize", "icon", "onClick", "padding", "popover", "radius", "space", "text", "tone"];
|
|
8443
8474
|
/**
|
|
8444
8475
|
* @public
|
|
8445
8476
|
*/
|
|
@@ -8449,6 +8480,7 @@ function MenuGroup(props) {
|
|
|
8449
8480
|
as = _props$as === void 0 ? 'button' : _props$as,
|
|
8450
8481
|
children = props.children,
|
|
8451
8482
|
fontSize = props.fontSize,
|
|
8483
|
+
icon = props.icon,
|
|
8452
8484
|
onClick = props.onClick,
|
|
8453
8485
|
_props$padding = props.padding,
|
|
8454
8486
|
padding = _props$padding === void 0 ? 3 : _props$padding,
|
|
@@ -8456,52 +8488,42 @@ function MenuGroup(props) {
|
|
|
8456
8488
|
popover = _props$popover === void 0 ? {} : _props$popover,
|
|
8457
8489
|
_props$radius = props.radius,
|
|
8458
8490
|
radius = _props$radius === void 0 ? 2 : _props$radius,
|
|
8491
|
+
_props$space = props.space,
|
|
8492
|
+
space = _props$space === void 0 ? 3 : _props$space,
|
|
8459
8493
|
text = props.text,
|
|
8460
8494
|
_props$tone = props.tone,
|
|
8461
8495
|
tone = _props$tone === void 0 ? 'default' : _props$tone,
|
|
8462
8496
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$a);
|
|
8463
8497
|
|
|
8464
|
-
var _useState = useState(false),
|
|
8465
|
-
open = _useState[0],
|
|
8466
|
-
setOpen = _useState[1];
|
|
8467
|
-
|
|
8468
8498
|
var _useMenu = useMenu(),
|
|
8469
8499
|
activeElement = _useMenu.activeElement,
|
|
8470
8500
|
mount = _useMenu.mount,
|
|
8471
8501
|
onClickOutside = _useMenu.onClickOutside,
|
|
8472
8502
|
onEscape = _useMenu.onEscape,
|
|
8473
8503
|
onItemClick = _useMenu.onItemClick,
|
|
8474
|
-
|
|
8475
|
-
onMouseLeave = _useMenu.onMouseLeave,
|
|
8504
|
+
onItemMouseEnter = _useMenu.onItemMouseEnter,
|
|
8476
8505
|
registerElement = _useMenu.registerElement;
|
|
8477
8506
|
|
|
8478
|
-
var
|
|
8479
|
-
rootElement =
|
|
8480
|
-
setRootElement =
|
|
8507
|
+
var _useState = useState(null),
|
|
8508
|
+
rootElement = _useState[0],
|
|
8509
|
+
setRootElement = _useState[1];
|
|
8510
|
+
|
|
8511
|
+
var _useState2 = useState(false),
|
|
8512
|
+
open = _useState2[0],
|
|
8513
|
+
setOpen = _useState2[1];
|
|
8481
8514
|
|
|
8482
|
-
var mouseLeaveTimeoutRef = useRef(null);
|
|
8483
8515
|
var shouldFocusRef = useRef(null);
|
|
8484
|
-
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8485
|
-
// Register the element
|
|
8516
|
+
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8486
8517
|
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
var handleMouseEnter = useCallback(function (event) {
|
|
8491
|
-
if (mouseLeaveTimeoutRef.current) {
|
|
8492
|
-
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
8493
|
-
mouseLeaveTimeoutRef.current = null;
|
|
8494
|
-
}
|
|
8518
|
+
var _useState3 = useState(false),
|
|
8519
|
+
withinMenu = _useState3[0],
|
|
8520
|
+
setWithinMenu = _useState3[1];
|
|
8495
8521
|
|
|
8496
|
-
|
|
8522
|
+
var handleMouseEnter = useCallback(function (event) {
|
|
8523
|
+
setWithinMenu(false);
|
|
8524
|
+
onItemMouseEnter(event);
|
|
8497
8525
|
setOpen(true);
|
|
8498
|
-
}, [
|
|
8499
|
-
var handleMouseLeave = useCallback(function (event) {
|
|
8500
|
-
onMouseLeave(event);
|
|
8501
|
-
mouseLeaveTimeoutRef.current = setTimeout(function () {
|
|
8502
|
-
setOpen(false);
|
|
8503
|
-
}, MOUSE_LEAVE_TIMEOUT);
|
|
8504
|
-
}, [onMouseLeave]);
|
|
8526
|
+
}, [onItemMouseEnter]);
|
|
8505
8527
|
var handleMenuKeyDown = useCallback(function (event) {
|
|
8506
8528
|
if (event.key === 'ArrowLeft') {
|
|
8507
8529
|
event.stopPropagation();
|
|
@@ -8511,17 +8533,6 @@ function MenuGroup(props) {
|
|
|
8511
8533
|
});
|
|
8512
8534
|
}
|
|
8513
8535
|
}, [rootElement]);
|
|
8514
|
-
var handleMenuMouseEnter = useCallback(function () {
|
|
8515
|
-
if (mouseLeaveTimeoutRef.current) {
|
|
8516
|
-
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
8517
|
-
mouseLeaveTimeoutRef.current = null;
|
|
8518
|
-
}
|
|
8519
|
-
}, []);
|
|
8520
|
-
var handleMenuMouseLeave = useCallback(function () {
|
|
8521
|
-
mouseLeaveTimeoutRef.current = setTimeout(function () {
|
|
8522
|
-
setOpen(false);
|
|
8523
|
-
}, MOUSE_LEAVE_TIMEOUT);
|
|
8524
|
-
}, []);
|
|
8525
8536
|
var handleClick = useCallback(function (event) {
|
|
8526
8537
|
if (onClick) onClick(event);
|
|
8527
8538
|
shouldFocusRef.current = 'first';
|
|
@@ -8530,25 +8541,31 @@ function MenuGroup(props) {
|
|
|
8530
8541
|
shouldFocusRef.current = null;
|
|
8531
8542
|
});
|
|
8532
8543
|
}, [onClick]);
|
|
8533
|
-
var
|
|
8544
|
+
var handleChildItemClick = useCallback(function () {
|
|
8534
8545
|
setOpen(false);
|
|
8535
8546
|
if (onItemClick) onItemClick();
|
|
8536
8547
|
}, [onItemClick]);
|
|
8548
|
+
var handleMenuMouseEnter = useCallback(function () {
|
|
8549
|
+
return setWithinMenu(true);
|
|
8550
|
+
}, []); // Register the menu item element
|
|
8551
|
+
|
|
8537
8552
|
useEffect(function () {
|
|
8538
|
-
return
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8553
|
+
return mount(rootElement);
|
|
8554
|
+
}, [mount, rootElement]); // Close child menu when a sibling item becomes active
|
|
8555
|
+
|
|
8556
|
+
useEffect(function () {
|
|
8557
|
+
if (!active) setOpen(false);
|
|
8558
|
+
}, [active]); // Update state when child menu is no longer open
|
|
8559
|
+
|
|
8560
|
+
useEffect(function () {
|
|
8561
|
+
if (!open) setWithinMenu(false);
|
|
8562
|
+
}, [open]);
|
|
8563
|
+
var childMenu = /*#__PURE__*/React.createElement(Menu, {
|
|
8546
8564
|
onClickOutside: onClickOutside,
|
|
8547
8565
|
onEscape: onEscape,
|
|
8548
|
-
onItemClick:
|
|
8566
|
+
onItemClick: handleChildItemClick,
|
|
8549
8567
|
onKeyDown: handleMenuKeyDown,
|
|
8550
8568
|
onMouseEnter: handleMenuMouseEnter,
|
|
8551
|
-
onMouseLeave: handleMenuMouseLeave,
|
|
8552
8569
|
registerElement: registerElement,
|
|
8553
8570
|
shouldFocus: shouldFocusRef.current
|
|
8554
8571
|
}, children);
|
|
@@ -8562,6 +8579,7 @@ function MenuGroup(props) {
|
|
|
8562
8579
|
if (event.key === 'ArrowRight') {
|
|
8563
8580
|
shouldFocusRef.current = 'first';
|
|
8564
8581
|
setOpen(true);
|
|
8582
|
+
setWithinMenu(true);
|
|
8565
8583
|
requestAnimationFrame(function () {
|
|
8566
8584
|
shouldFocusRef.current = null;
|
|
8567
8585
|
});
|
|
@@ -8569,7 +8587,7 @@ function MenuGroup(props) {
|
|
|
8569
8587
|
}
|
|
8570
8588
|
}, []);
|
|
8571
8589
|
return /*#__PURE__*/React.createElement(Popover, _extends({}, popover, {
|
|
8572
|
-
content:
|
|
8590
|
+
content: childMenu,
|
|
8573
8591
|
"data-ui": "MenuGroup__popover",
|
|
8574
8592
|
open: open
|
|
8575
8593
|
}), /*#__PURE__*/React.createElement(Selectable, _extends({
|
|
@@ -8577,25 +8595,32 @@ function MenuGroup(props) {
|
|
|
8577
8595
|
"data-ui": "MenuGroup",
|
|
8578
8596
|
forwardedAs: as
|
|
8579
8597
|
}, restProps, {
|
|
8580
|
-
"aria-pressed": as === 'button' ?
|
|
8581
|
-
"data-pressed": as !== 'button' ?
|
|
8582
|
-
"data-selected": active ? '' : undefined,
|
|
8598
|
+
"aria-pressed": as === 'button' ? withinMenu : undefined,
|
|
8599
|
+
"data-pressed": as !== 'button' ? withinMenu : undefined,
|
|
8600
|
+
"data-selected": !withinMenu && active ? '' : undefined,
|
|
8583
8601
|
"$radius": radius,
|
|
8584
8602
|
"$tone": tone,
|
|
8585
8603
|
onClick: handleClick,
|
|
8586
8604
|
onKeyDown: handleKeyDown,
|
|
8587
8605
|
onMouseEnter: handleMouseEnter,
|
|
8588
|
-
onMouseLeave: handleMouseLeave,
|
|
8589
8606
|
ref: setRootElement,
|
|
8590
8607
|
tabIndex: -1,
|
|
8591
8608
|
type: as === 'button' ? 'button' : undefined
|
|
8592
8609
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
8593
8610
|
padding: padding
|
|
8594
|
-
}, /*#__PURE__*/React.createElement(
|
|
8611
|
+
}, /*#__PURE__*/React.createElement(Flex, null, icon && /*#__PURE__*/React.createElement(Text, {
|
|
8595
8612
|
size: fontSize
|
|
8596
|
-
},
|
|
8613
|
+
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon)), /*#__PURE__*/React.createElement(Box, {
|
|
8614
|
+
flex: 1,
|
|
8615
|
+
marginLeft: icon ? space : undefined
|
|
8616
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
8617
|
+
size: fontSize,
|
|
8618
|
+
textOverflow: "ellipsis"
|
|
8619
|
+
}, text)), /*#__PURE__*/React.createElement(Box, {
|
|
8620
|
+
marginLeft: space
|
|
8621
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
8597
8622
|
size: fontSize
|
|
8598
|
-
}, /*#__PURE__*/React.createElement(ChevronRightIcon, null))))));
|
|
8623
|
+
}, /*#__PURE__*/React.createElement(ChevronRightIcon, null)))))));
|
|
8599
8624
|
}
|
|
8600
8625
|
|
|
8601
8626
|
var _excluded$9 = ["as", "children", "disabled", "fontSize", "hotkeys", "icon", "iconRight", "onClick", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "pressed", "radius", "selected", "space", "text", "tone"];
|
|
@@ -8637,14 +8662,14 @@ var MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef) {
|
|
|
8637
8662
|
activeElement = _useMenu.activeElement,
|
|
8638
8663
|
mount = _useMenu.mount,
|
|
8639
8664
|
onItemClick = _useMenu.onItemClick,
|
|
8640
|
-
|
|
8641
|
-
|
|
8665
|
+
onItemMouseEnter = _useMenu.onItemMouseEnter,
|
|
8666
|
+
onItemMouseLeave = _useMenu.onItemMouseLeave;
|
|
8642
8667
|
|
|
8643
8668
|
var _useState = useState(null),
|
|
8644
8669
|
rootElement = _useState[0],
|
|
8645
8670
|
setRootElement = _useState[1];
|
|
8646
8671
|
|
|
8647
|
-
var
|
|
8672
|
+
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8648
8673
|
useEffect(function () {
|
|
8649
8674
|
return mount(rootElement, selectedProp);
|
|
8650
8675
|
}, [mount, rootElement, selectedProp]);
|
|
@@ -8676,14 +8701,14 @@ var MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef) {
|
|
|
8676
8701
|
}, restProps, {
|
|
8677
8702
|
"aria-pressed": as === 'button' && pressed,
|
|
8678
8703
|
"data-pressed": as !== 'button' && pressed ? '' : undefined,
|
|
8679
|
-
"data-selected":
|
|
8704
|
+
"data-selected": active ? '' : undefined,
|
|
8680
8705
|
"data-disabled": disabled ? '' : undefined,
|
|
8681
8706
|
"$radius": radius,
|
|
8682
8707
|
"$tone": tone,
|
|
8683
8708
|
disabled: disabled,
|
|
8684
8709
|
onClick: handleClick,
|
|
8685
|
-
onMouseEnter:
|
|
8686
|
-
onMouseLeave:
|
|
8710
|
+
onMouseEnter: onItemMouseEnter,
|
|
8711
|
+
onMouseLeave: onItemMouseLeave,
|
|
8687
8712
|
padding: 0,
|
|
8688
8713
|
ref: setRef,
|
|
8689
8714
|
role: "menuitem",
|