@sanity/ui 0.36.16 → 0.37.2
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 +242 -209
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.js +297 -281
- package/lib/sanity-ui.modern.js.map +1 -1
- package/lib/sanity-ui.module.js +242 -209
- package/lib/sanity-ui.module.js.map +1 -1
- package/lib/src/components/autocomplete/autocomplete.d.ts +2 -0
- package/lib/src/components/autocomplete/autocomplete.d.ts.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 +9 -1
- 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/menuItem.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/autocomplete/__workshop__/fullscreen.tsx +24 -5
- package/src/components/autocomplete/autocomplete.tsx +9 -1
- 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 +39 -20
- package/src/components/menu/menu.tsx +30 -210
- package/src/components/menu/menuContext.ts +11 -1
- package/src/components/menu/menuGroup.tsx +56 -78
- package/src/components/menu/menuItem.tsx +12 -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
|
*/
|
|
@@ -7432,7 +7432,9 @@ var InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(props
|
|
|
7432
7432
|
return renderPopover({
|
|
7433
7433
|
content: content,
|
|
7434
7434
|
hidden: !expanded,
|
|
7435
|
-
inputElement: inputElementRef.current
|
|
7435
|
+
inputElement: inputElementRef.current,
|
|
7436
|
+
onMouseEnter: handlePopoverMouseEnter,
|
|
7437
|
+
onMouseLeave: handlePopoverMouseLeave
|
|
7436
7438
|
}, setResultsPopoverElement);
|
|
7437
7439
|
}
|
|
7438
7440
|
|
|
@@ -7471,8 +7473,8 @@ var InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(props
|
|
|
7471
7473
|
|
|
7472
7474
|
var Autocomplete = InnerAutocomplete;
|
|
7473
7475
|
|
|
7474
|
-
var _templateObject$
|
|
7475
|
-
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"])));
|
|
7476
7478
|
var ExpandButton = styled(Button)(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteralLoose(["\n appearance: none;\n margin: -4px;\n"])));
|
|
7477
7479
|
|
|
7478
7480
|
var _excluded$e = ["children", "maxLength", "separator", "space"];
|
|
@@ -7613,9 +7615,9 @@ function useDialog() {
|
|
|
7613
7615
|
|
|
7614
7616
|
var _excluded$d = ["__unstable_autoFocus", "__unstable_hideCloseButton", "cardRadius", "cardShadow", "children", "contentRef", "footer", "header", "id", "onClickOutside", "onClose", "padding", "portal", "position", "scheme", "width", "zOffset"];
|
|
7615
7617
|
|
|
7616
|
-
var _templateObject$
|
|
7618
|
+
var _templateObject$9, _templateObject2$6, _templateObject3$2, _templateObject4$1, _templateObject5, _templateObject6;
|
|
7617
7619
|
var Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
|
|
7618
|
-
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"])));
|
|
7619
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"])));
|
|
7620
7622
|
var DialogLayout = styled(Flex)(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
|
|
7621
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"])));
|
|
@@ -7824,8 +7826,8 @@ function DialogProvider(props) {
|
|
|
7824
7826
|
|
|
7825
7827
|
var _excluded$c = ["fontSize", "keys", "padding", "radius", "space"];
|
|
7826
7828
|
|
|
7827
|
-
var _templateObject$
|
|
7828
|
-
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"])));
|
|
7829
7831
|
var Key = styled(KBD)(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: block;\n }\n"])));
|
|
7830
7832
|
/**
|
|
7831
7833
|
* @public
|
|
@@ -7861,6 +7863,10 @@ var Hotkeys = /*#__PURE__*/forwardRef(function Hotkeys(props, ref) {
|
|
|
7861
7863
|
})));
|
|
7862
7864
|
});
|
|
7863
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
|
+
|
|
7864
7870
|
/**
|
|
7865
7871
|
* @internal
|
|
7866
7872
|
*/
|
|
@@ -7936,56 +7942,34 @@ function _sortElements(rootElement, elements) {
|
|
|
7936
7942
|
elements.sort(_sort);
|
|
7937
7943
|
}
|
|
7938
7944
|
|
|
7939
|
-
var key$2 = Symbol["for"]('@sanity/ui/context/menu');
|
|
7940
|
-
globalScope[key$2] = globalScope[key$2] || /*#__PURE__*/createContext(null);
|
|
7941
|
-
var MenuContext = globalScope[key$2];
|
|
7942
|
-
|
|
7943
|
-
var _excluded$b = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"];
|
|
7944
|
-
|
|
7945
|
-
var _templateObject$8;
|
|
7946
|
-
var Root$5 = styled(Box)(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n outline: none;\n overflow: auto;\n"])));
|
|
7947
7945
|
/**
|
|
7948
|
-
*
|
|
7946
|
+
* This controller is responsible for controlling UI menu state.
|
|
7947
|
+
*
|
|
7948
|
+
* @internal
|
|
7949
7949
|
*/
|
|
7950
7950
|
|
|
7951
|
-
|
|
7952
|
-
var
|
|
7953
|
-
onClickOutside = props.onClickOutside,
|
|
7954
|
-
onEscape = props.onEscape,
|
|
7955
|
-
onItemClick = props.onItemClick,
|
|
7956
|
-
onItemSelect = props.onItemSelect,
|
|
7957
|
-
onKeyDown = props.onKeyDown,
|
|
7951
|
+
function useMenuController(props) {
|
|
7952
|
+
var onKeyDown = props.onKeyDown,
|
|
7958
7953
|
originElement = props.originElement,
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
registerElement = props.registerElement,
|
|
7962
|
-
_props$shouldFocus = props.shouldFocus,
|
|
7963
|
-
shouldFocus = _props$shouldFocus === void 0 ? props.focusFirst && 'first' || props.focusLast && 'last' || null : _props$shouldFocus,
|
|
7964
|
-
_props$space = props.space,
|
|
7965
|
-
space = _props$space === void 0 ? 1 : _props$space,
|
|
7966
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
7967
|
-
|
|
7968
|
-
var _useLayer = useLayer(),
|
|
7969
|
-
isTopLayer = _useLayer.isTopLayer;
|
|
7954
|
+
shouldFocus = props.shouldFocus;
|
|
7955
|
+
var elementsRef = useRef([]);
|
|
7970
7956
|
|
|
7971
7957
|
var _useState = useState(null),
|
|
7972
7958
|
rootElement = _useState[0],
|
|
7973
7959
|
setRootElement = _useState[1];
|
|
7974
7960
|
|
|
7975
|
-
var elementsRef = useRef([]);
|
|
7976
|
-
|
|
7977
7961
|
var _useState2 = useState(-1),
|
|
7978
7962
|
activeIndex = _useState2[0],
|
|
7979
|
-
|
|
7963
|
+
_setActiveIndex = _useState2[1];
|
|
7980
7964
|
|
|
7981
|
-
var activeIndexRef = useRef(activeIndex);
|
|
7982
7965
|
var activeElement = elementsRef.current[activeIndex] || null;
|
|
7983
|
-
var
|
|
7966
|
+
var activeIndexRef = useRef(activeIndex);
|
|
7984
7967
|
var mounted = Boolean(rootElement);
|
|
7985
|
-
var
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7968
|
+
var setActiveIndex = useCallback(function (nextActiveIndex) {
|
|
7969
|
+
_setActiveIndex(nextActiveIndex);
|
|
7970
|
+
|
|
7971
|
+
activeIndexRef.current = nextActiveIndex;
|
|
7972
|
+
}, []);
|
|
7989
7973
|
var mount = useCallback(function (element, selected) {
|
|
7990
7974
|
if (!element) return function () {
|
|
7991
7975
|
return undefined;
|
|
@@ -8000,7 +7984,6 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8000
7984
|
if (selected) {
|
|
8001
7985
|
var selectedIndex = elementsRef.current.indexOf(element);
|
|
8002
7986
|
setActiveIndex(selectedIndex);
|
|
8003
|
-
activeIndexRef.current = selectedIndex;
|
|
8004
7987
|
}
|
|
8005
7988
|
|
|
8006
7989
|
return function () {
|
|
@@ -8010,7 +7993,7 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8010
7993
|
elementsRef.current.splice(idx, 1);
|
|
8011
7994
|
}
|
|
8012
7995
|
};
|
|
8013
|
-
}, [rootElement]);
|
|
7996
|
+
}, [rootElement, setActiveIndex]);
|
|
8014
7997
|
var handleKeyDown = useCallback(function (event) {
|
|
8015
7998
|
// Move focus to the element that opened the menu before handling the `Tab` press
|
|
8016
7999
|
if (event.key === 'Tab') {
|
|
@@ -8032,7 +8015,6 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8032
8015
|
if (!el) return;
|
|
8033
8016
|
var currentIndex = elementsRef.current.indexOf(el);
|
|
8034
8017
|
setActiveIndex(currentIndex);
|
|
8035
|
-
activeIndexRef.current = currentIndex;
|
|
8036
8018
|
return;
|
|
8037
8019
|
} // Move focus to the last focusable menuitem
|
|
8038
8020
|
|
|
@@ -8049,7 +8031,6 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8049
8031
|
var _currentIndex = elementsRef.current.indexOf(_el);
|
|
8050
8032
|
|
|
8051
8033
|
setActiveIndex(_currentIndex);
|
|
8052
|
-
activeIndexRef.current = _currentIndex;
|
|
8053
8034
|
return;
|
|
8054
8035
|
}
|
|
8055
8036
|
|
|
@@ -8071,7 +8052,6 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8071
8052
|
var _currentIndex2 = elementsRef.current.indexOf(_el2);
|
|
8072
8053
|
|
|
8073
8054
|
setActiveIndex(_currentIndex2);
|
|
8074
|
-
activeIndexRef.current = _currentIndex2;
|
|
8075
8055
|
return;
|
|
8076
8056
|
}
|
|
8077
8057
|
|
|
@@ -8093,32 +8073,22 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8093
8073
|
var _currentIndex3 = elementsRef.current.indexOf(_el3);
|
|
8094
8074
|
|
|
8095
8075
|
setActiveIndex(_currentIndex3);
|
|
8096
|
-
activeIndexRef.current = _currentIndex3;
|
|
8097
8076
|
return;
|
|
8098
8077
|
}
|
|
8099
8078
|
|
|
8100
8079
|
if (onKeyDown) {
|
|
8101
8080
|
onKeyDown(event);
|
|
8102
8081
|
}
|
|
8103
|
-
}, [activeIndex, onKeyDown, originElement]);
|
|
8082
|
+
}, [activeIndex, onKeyDown, originElement, setActiveIndex]);
|
|
8104
8083
|
var handleItemMouseEnter = useCallback(function (event) {
|
|
8105
8084
|
var element = event.currentTarget;
|
|
8106
8085
|
var currentIndex = elementsRef.current.indexOf(element);
|
|
8107
8086
|
setActiveIndex(currentIndex);
|
|
8108
|
-
|
|
8109
|
-
}, []);
|
|
8087
|
+
}, [setActiveIndex]);
|
|
8110
8088
|
var handleItemMouseLeave = useCallback(function () {
|
|
8111
8089
|
rootElement == null ? void 0 : rootElement.focus();
|
|
8112
8090
|
setActiveIndex(-1);
|
|
8113
|
-
|
|
8114
|
-
}, [rootElement]); // Trigger `onItemSelect` when active index changes
|
|
8115
|
-
|
|
8116
|
-
useEffect(function () {
|
|
8117
|
-
if (onItemSelect) onItemSelect(activeIndex);
|
|
8118
|
-
}, [activeIndex, onItemSelect]);
|
|
8119
|
-
useEffect(function () {
|
|
8120
|
-
activeElementRef.current = activeElement;
|
|
8121
|
-
}, [activeElement]); // Set focus on the currently active element
|
|
8091
|
+
}, [rootElement, setActiveIndex]); // Set focus on the currently active element
|
|
8122
8092
|
|
|
8123
8093
|
useEffect(function () {
|
|
8124
8094
|
if (!mounted) return;
|
|
@@ -8160,10 +8130,76 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8160
8130
|
return function () {
|
|
8161
8131
|
window.cancelAnimationFrame(rafId);
|
|
8162
8132
|
};
|
|
8163
|
-
}, [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
|
+
|
|
8164
8199
|
useClickOutside(useCallback(function (event) {
|
|
8165
8200
|
return isTopLayer && onClickOutside && onClickOutside(event);
|
|
8166
|
-
}, [isTopLayer, onClickOutside]), [rootElement]);
|
|
8201
|
+
}, [isTopLayer, onClickOutside]), [rootElement]); // Close menu when pressing Escape
|
|
8202
|
+
|
|
8167
8203
|
useGlobalKeyDown(useCallback(function (event) {
|
|
8168
8204
|
if (!isTopLayer) return;
|
|
8169
8205
|
|
|
@@ -8171,7 +8207,8 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8171
8207
|
event.stopPropagation();
|
|
8172
8208
|
if (onEscape) onEscape();
|
|
8173
8209
|
}
|
|
8174
|
-
}, [isTopLayer, onEscape]));
|
|
8210
|
+
}, [isTopLayer, onEscape])); // Register root element (for nested menus)
|
|
8211
|
+
|
|
8175
8212
|
useEffect(function () {
|
|
8176
8213
|
if (!rootElement || !registerElement) return;
|
|
8177
8214
|
return registerElement(rootElement);
|
|
@@ -8184,10 +8221,13 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8184
8221
|
mount: mount,
|
|
8185
8222
|
onClickOutside: onClickOutside,
|
|
8186
8223
|
onEscape: onEscape,
|
|
8187
|
-
onMouseEnter: handleItemMouseEnter,
|
|
8188
|
-
onMouseLeave: handleItemMouseLeave,
|
|
8189
8224
|
onItemClick: onItemClick,
|
|
8190
|
-
|
|
8225
|
+
onItemMouseEnter: handleItemMouseEnter,
|
|
8226
|
+
onItemMouseLeave: handleItemMouseLeave,
|
|
8227
|
+
registerElement: registerElement,
|
|
8228
|
+
// deprecated
|
|
8229
|
+
onMouseEnter: handleItemMouseEnter,
|
|
8230
|
+
onMouseLeave: handleItemMouseLeave
|
|
8191
8231
|
};
|
|
8192
8232
|
}, [activeElement, activeIndex, mount, handleItemMouseEnter, handleItemMouseLeave, onClickOutside, onEscape, onItemClick, registerElement]);
|
|
8193
8233
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
@@ -8197,7 +8237,7 @@ var Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
8197
8237
|
}, restProps, {
|
|
8198
8238
|
onKeyDown: handleKeyDown,
|
|
8199
8239
|
padding: padding,
|
|
8200
|
-
ref:
|
|
8240
|
+
ref: handleRefChange,
|
|
8201
8241
|
role: "menu",
|
|
8202
8242
|
tabIndex: -1
|
|
8203
8243
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -8385,16 +8425,16 @@ var MenuButton = /*#__PURE__*/forwardRef(function MenuButton(props, ref) {
|
|
|
8385
8425
|
}), button || /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
8386
8426
|
});
|
|
8387
8427
|
|
|
8388
|
-
var _templateObject$
|
|
8428
|
+
var _templateObject$6;
|
|
8389
8429
|
/**
|
|
8390
8430
|
* @public
|
|
8391
8431
|
*/
|
|
8392
8432
|
|
|
8393
|
-
var MenuDivider = styled.hr(_templateObject$
|
|
8433
|
+
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"])));
|
|
8394
8434
|
|
|
8395
|
-
var _templateObject$
|
|
8435
|
+
var _templateObject$5, _templateObject2$4;
|
|
8396
8436
|
function selectableBaseStyle() {
|
|
8397
|
-
return css(_templateObject$
|
|
8437
|
+
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 "])));
|
|
8398
8438
|
}
|
|
8399
8439
|
function selectableColorStyle(props) {
|
|
8400
8440
|
var _theme$sanity$styles, _theme$sanity$styles$;
|
|
@@ -8433,11 +8473,7 @@ function useMenu() {
|
|
|
8433
8473
|
return value;
|
|
8434
8474
|
}
|
|
8435
8475
|
|
|
8436
|
-
var _excluded$a = ["as", "children", "fontSize", "onClick", "padding", "popover", "radius", "text", "tone"];
|
|
8437
|
-
|
|
8438
|
-
var _templateObject$5;
|
|
8439
|
-
var MOUSE_LEAVE_TIMEOUT = 1000;
|
|
8440
|
-
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"])));
|
|
8476
|
+
var _excluded$a = ["as", "children", "fontSize", "icon", "onClick", "padding", "popover", "radius", "space", "text", "tone"];
|
|
8441
8477
|
/**
|
|
8442
8478
|
* @public
|
|
8443
8479
|
*/
|
|
@@ -8447,6 +8483,7 @@ function MenuGroup(props) {
|
|
|
8447
8483
|
as = _props$as === void 0 ? 'button' : _props$as,
|
|
8448
8484
|
children = props.children,
|
|
8449
8485
|
fontSize = props.fontSize,
|
|
8486
|
+
icon = props.icon,
|
|
8450
8487
|
onClick = props.onClick,
|
|
8451
8488
|
_props$padding = props.padding,
|
|
8452
8489
|
padding = _props$padding === void 0 ? 3 : _props$padding,
|
|
@@ -8454,52 +8491,43 @@ function MenuGroup(props) {
|
|
|
8454
8491
|
popover = _props$popover === void 0 ? {} : _props$popover,
|
|
8455
8492
|
_props$radius = props.radius,
|
|
8456
8493
|
radius = _props$radius === void 0 ? 2 : _props$radius,
|
|
8494
|
+
_props$space = props.space,
|
|
8495
|
+
space = _props$space === void 0 ? 3 : _props$space,
|
|
8457
8496
|
text = props.text,
|
|
8458
8497
|
_props$tone = props.tone,
|
|
8459
8498
|
tone = _props$tone === void 0 ? 'default' : _props$tone,
|
|
8460
8499
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$a);
|
|
8461
8500
|
|
|
8462
|
-
var
|
|
8463
|
-
|
|
8464
|
-
|
|
8501
|
+
var menu = useMenu();
|
|
8502
|
+
var activeElement = menu.activeElement,
|
|
8503
|
+
mount = menu.mount,
|
|
8504
|
+
onClickOutside = menu.onClickOutside,
|
|
8505
|
+
onEscape = menu.onEscape,
|
|
8506
|
+
onItemClick = menu.onItemClick,
|
|
8507
|
+
_menu$onItemMouseEnte = menu.onItemMouseEnter,
|
|
8508
|
+
onItemMouseEnter = _menu$onItemMouseEnte === void 0 ? menu.onMouseEnter : _menu$onItemMouseEnte,
|
|
8509
|
+
registerElement = menu.registerElement;
|
|
8465
8510
|
|
|
8466
|
-
var
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
onClickOutside = _useMenu.onClickOutside,
|
|
8470
|
-
onEscape = _useMenu.onEscape,
|
|
8471
|
-
onItemClick = _useMenu.onItemClick,
|
|
8472
|
-
onMouseEnter = _useMenu.onMouseEnter,
|
|
8473
|
-
onMouseLeave = _useMenu.onMouseLeave,
|
|
8474
|
-
registerElement = _useMenu.registerElement;
|
|
8511
|
+
var _useState = useState(null),
|
|
8512
|
+
rootElement = _useState[0],
|
|
8513
|
+
setRootElement = _useState[1];
|
|
8475
8514
|
|
|
8476
|
-
var _useState2 = useState(
|
|
8477
|
-
|
|
8478
|
-
|
|
8515
|
+
var _useState2 = useState(false),
|
|
8516
|
+
open = _useState2[0],
|
|
8517
|
+
setOpen = _useState2[1];
|
|
8479
8518
|
|
|
8480
|
-
var mouseLeaveTimeoutRef = useRef(null);
|
|
8481
8519
|
var shouldFocusRef = useRef(null);
|
|
8482
|
-
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8483
|
-
// Register the element
|
|
8520
|
+
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8484
8521
|
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
var handleMouseEnter = useCallback(function (event) {
|
|
8489
|
-
if (mouseLeaveTimeoutRef.current) {
|
|
8490
|
-
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
8491
|
-
mouseLeaveTimeoutRef.current = null;
|
|
8492
|
-
}
|
|
8522
|
+
var _useState3 = useState(false),
|
|
8523
|
+
withinMenu = _useState3[0],
|
|
8524
|
+
setWithinMenu = _useState3[1];
|
|
8493
8525
|
|
|
8494
|
-
|
|
8526
|
+
var handleMouseEnter = useCallback(function (event) {
|
|
8527
|
+
setWithinMenu(false);
|
|
8528
|
+
onItemMouseEnter(event);
|
|
8495
8529
|
setOpen(true);
|
|
8496
|
-
}, [
|
|
8497
|
-
var handleMouseLeave = useCallback(function (event) {
|
|
8498
|
-
onMouseLeave(event);
|
|
8499
|
-
mouseLeaveTimeoutRef.current = setTimeout(function () {
|
|
8500
|
-
setOpen(false);
|
|
8501
|
-
}, MOUSE_LEAVE_TIMEOUT);
|
|
8502
|
-
}, [onMouseLeave]);
|
|
8530
|
+
}, [onItemMouseEnter]);
|
|
8503
8531
|
var handleMenuKeyDown = useCallback(function (event) {
|
|
8504
8532
|
if (event.key === 'ArrowLeft') {
|
|
8505
8533
|
event.stopPropagation();
|
|
@@ -8509,17 +8537,6 @@ function MenuGroup(props) {
|
|
|
8509
8537
|
});
|
|
8510
8538
|
}
|
|
8511
8539
|
}, [rootElement]);
|
|
8512
|
-
var handleMenuMouseEnter = useCallback(function () {
|
|
8513
|
-
if (mouseLeaveTimeoutRef.current) {
|
|
8514
|
-
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
8515
|
-
mouseLeaveTimeoutRef.current = null;
|
|
8516
|
-
}
|
|
8517
|
-
}, []);
|
|
8518
|
-
var handleMenuMouseLeave = useCallback(function () {
|
|
8519
|
-
mouseLeaveTimeoutRef.current = setTimeout(function () {
|
|
8520
|
-
setOpen(false);
|
|
8521
|
-
}, MOUSE_LEAVE_TIMEOUT);
|
|
8522
|
-
}, []);
|
|
8523
8540
|
var handleClick = useCallback(function (event) {
|
|
8524
8541
|
if (onClick) onClick(event);
|
|
8525
8542
|
shouldFocusRef.current = 'first';
|
|
@@ -8528,25 +8545,31 @@ function MenuGroup(props) {
|
|
|
8528
8545
|
shouldFocusRef.current = null;
|
|
8529
8546
|
});
|
|
8530
8547
|
}, [onClick]);
|
|
8531
|
-
var
|
|
8548
|
+
var handleChildItemClick = useCallback(function () {
|
|
8532
8549
|
setOpen(false);
|
|
8533
8550
|
if (onItemClick) onItemClick();
|
|
8534
8551
|
}, [onItemClick]);
|
|
8552
|
+
var handleMenuMouseEnter = useCallback(function () {
|
|
8553
|
+
return setWithinMenu(true);
|
|
8554
|
+
}, []); // Register the menu item element
|
|
8555
|
+
|
|
8535
8556
|
useEffect(function () {
|
|
8536
|
-
return
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8557
|
+
return mount(rootElement);
|
|
8558
|
+
}, [mount, rootElement]); // Close child menu when a sibling item becomes active
|
|
8559
|
+
|
|
8560
|
+
useEffect(function () {
|
|
8561
|
+
if (!active) setOpen(false);
|
|
8562
|
+
}, [active]); // Update state when child menu is no longer open
|
|
8563
|
+
|
|
8564
|
+
useEffect(function () {
|
|
8565
|
+
if (!open) setWithinMenu(false);
|
|
8566
|
+
}, [open]);
|
|
8567
|
+
var childMenu = /*#__PURE__*/React.createElement(Menu, {
|
|
8544
8568
|
onClickOutside: onClickOutside,
|
|
8545
8569
|
onEscape: onEscape,
|
|
8546
|
-
onItemClick:
|
|
8570
|
+
onItemClick: handleChildItemClick,
|
|
8547
8571
|
onKeyDown: handleMenuKeyDown,
|
|
8548
8572
|
onMouseEnter: handleMenuMouseEnter,
|
|
8549
|
-
onMouseLeave: handleMenuMouseLeave,
|
|
8550
8573
|
registerElement: registerElement,
|
|
8551
8574
|
shouldFocus: shouldFocusRef.current
|
|
8552
8575
|
}, children);
|
|
@@ -8560,6 +8583,7 @@ function MenuGroup(props) {
|
|
|
8560
8583
|
if (event.key === 'ArrowRight') {
|
|
8561
8584
|
shouldFocusRef.current = 'first';
|
|
8562
8585
|
setOpen(true);
|
|
8586
|
+
setWithinMenu(true);
|
|
8563
8587
|
requestAnimationFrame(function () {
|
|
8564
8588
|
shouldFocusRef.current = null;
|
|
8565
8589
|
});
|
|
@@ -8567,7 +8591,7 @@ function MenuGroup(props) {
|
|
|
8567
8591
|
}
|
|
8568
8592
|
}, []);
|
|
8569
8593
|
return /*#__PURE__*/React.createElement(Popover, _extends({}, popover, {
|
|
8570
|
-
content:
|
|
8594
|
+
content: childMenu,
|
|
8571
8595
|
"data-ui": "MenuGroup__popover",
|
|
8572
8596
|
open: open
|
|
8573
8597
|
}), /*#__PURE__*/React.createElement(Selectable, _extends({
|
|
@@ -8575,25 +8599,32 @@ function MenuGroup(props) {
|
|
|
8575
8599
|
"data-ui": "MenuGroup",
|
|
8576
8600
|
forwardedAs: as
|
|
8577
8601
|
}, restProps, {
|
|
8578
|
-
"aria-pressed": as === 'button' ?
|
|
8579
|
-
"data-pressed": as !== 'button' ?
|
|
8580
|
-
"data-selected": active ? '' : undefined,
|
|
8602
|
+
"aria-pressed": as === 'button' ? withinMenu : undefined,
|
|
8603
|
+
"data-pressed": as !== 'button' ? withinMenu : undefined,
|
|
8604
|
+
"data-selected": !withinMenu && active ? '' : undefined,
|
|
8581
8605
|
"$radius": radius,
|
|
8582
8606
|
"$tone": tone,
|
|
8583
8607
|
onClick: handleClick,
|
|
8584
8608
|
onKeyDown: handleKeyDown,
|
|
8585
8609
|
onMouseEnter: handleMouseEnter,
|
|
8586
|
-
onMouseLeave: handleMouseLeave,
|
|
8587
8610
|
ref: setRootElement,
|
|
8588
8611
|
tabIndex: -1,
|
|
8589
8612
|
type: as === 'button' ? 'button' : undefined
|
|
8590
8613
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
8591
8614
|
padding: padding
|
|
8592
|
-
}, /*#__PURE__*/React.createElement(
|
|
8615
|
+
}, /*#__PURE__*/React.createElement(Flex, null, icon && /*#__PURE__*/React.createElement(Text, {
|
|
8593
8616
|
size: fontSize
|
|
8594
|
-
},
|
|
8617
|
+
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon)), /*#__PURE__*/React.createElement(Box, {
|
|
8618
|
+
flex: 1,
|
|
8619
|
+
marginLeft: icon ? space : undefined
|
|
8620
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
8621
|
+
size: fontSize,
|
|
8622
|
+
textOverflow: "ellipsis"
|
|
8623
|
+
}, text)), /*#__PURE__*/React.createElement(Box, {
|
|
8624
|
+
marginLeft: space
|
|
8625
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
8595
8626
|
size: fontSize
|
|
8596
|
-
}, /*#__PURE__*/React.createElement(ChevronRightIcon, null))))));
|
|
8627
|
+
}, /*#__PURE__*/React.createElement(ChevronRightIcon, null)))))));
|
|
8597
8628
|
}
|
|
8598
8629
|
|
|
8599
8630
|
var _excluded$9 = ["as", "children", "disabled", "fontSize", "hotkeys", "icon", "iconRight", "onClick", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "pressed", "radius", "selected", "space", "text", "tone"];
|
|
@@ -8631,18 +8662,20 @@ var MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef) {
|
|
|
8631
8662
|
tone = _props$tone === void 0 ? 'default' : _props$tone,
|
|
8632
8663
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$9);
|
|
8633
8664
|
|
|
8634
|
-
var
|
|
8635
|
-
|
|
8636
|
-
mount =
|
|
8637
|
-
onItemClick =
|
|
8638
|
-
|
|
8639
|
-
|
|
8665
|
+
var menu = useMenu();
|
|
8666
|
+
var activeElement = menu.activeElement,
|
|
8667
|
+
mount = menu.mount,
|
|
8668
|
+
onItemClick = menu.onItemClick,
|
|
8669
|
+
_menu$onItemMouseEnte = menu.onItemMouseEnter,
|
|
8670
|
+
onItemMouseEnter = _menu$onItemMouseEnte === void 0 ? menu.onMouseEnter : _menu$onItemMouseEnte,
|
|
8671
|
+
_menu$onItemMouseLeav = menu.onItemMouseLeave,
|
|
8672
|
+
onItemMouseLeave = _menu$onItemMouseLeav === void 0 ? menu.onMouseLeave : _menu$onItemMouseLeav;
|
|
8640
8673
|
|
|
8641
8674
|
var _useState = useState(null),
|
|
8642
8675
|
rootElement = _useState[0],
|
|
8643
8676
|
setRootElement = _useState[1];
|
|
8644
8677
|
|
|
8645
|
-
var
|
|
8678
|
+
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8646
8679
|
useEffect(function () {
|
|
8647
8680
|
return mount(rootElement, selectedProp);
|
|
8648
8681
|
}, [mount, rootElement, selectedProp]);
|
|
@@ -8674,14 +8707,14 @@ var MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef) {
|
|
|
8674
8707
|
}, restProps, {
|
|
8675
8708
|
"aria-pressed": as === 'button' && pressed,
|
|
8676
8709
|
"data-pressed": as !== 'button' && pressed ? '' : undefined,
|
|
8677
|
-
"data-selected":
|
|
8710
|
+
"data-selected": active ? '' : undefined,
|
|
8678
8711
|
"data-disabled": disabled ? '' : undefined,
|
|
8679
8712
|
"$radius": radius,
|
|
8680
8713
|
"$tone": tone,
|
|
8681
8714
|
disabled: disabled,
|
|
8682
8715
|
onClick: handleClick,
|
|
8683
|
-
onMouseEnter:
|
|
8684
|
-
onMouseLeave:
|
|
8716
|
+
onMouseEnter: onItemMouseEnter,
|
|
8717
|
+
onMouseLeave: onItemMouseLeave,
|
|
8685
8718
|
padding: 0,
|
|
8686
8719
|
ref: setRef,
|
|
8687
8720
|
role: "menuitem",
|