@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.js
CHANGED
|
@@ -3611,8 +3611,8 @@ function responsiveInputPaddingIconRightStyle(props) {
|
|
|
3611
3611
|
}));
|
|
3612
3612
|
}
|
|
3613
3613
|
|
|
3614
|
-
var _templateObject$
|
|
3615
|
-
var ROOT_STYLE = styled.css(_templateObject$
|
|
3614
|
+
var _templateObject$D, _templateObject2$n, _templateObject3$e;
|
|
3615
|
+
var ROOT_STYLE = styled.css(_templateObject$D || (_templateObject$D = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: flex;\n }\n"])));
|
|
3616
3616
|
function textInputRootStyle() {
|
|
3617
3617
|
return ROOT_STYLE;
|
|
3618
3618
|
}
|
|
@@ -3713,20 +3713,20 @@ function responsiveShadowStyle(props) {
|
|
|
3713
3713
|
});
|
|
3714
3714
|
}
|
|
3715
3715
|
|
|
3716
|
-
var _templateObject$
|
|
3716
|
+
var _templateObject$C, _templateObject2$m, _templateObject3$d;
|
|
3717
3717
|
function textBaseStyle(props) {
|
|
3718
3718
|
var $accent = props.$accent,
|
|
3719
3719
|
$muted = props.$muted,
|
|
3720
3720
|
theme = props.theme;
|
|
3721
3721
|
var weights = theme.sanity.fonts.text.weights;
|
|
3722
|
-
return styled.css(_templateObject$
|
|
3722
|
+
return styled.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 && styled.css(_templateObject2$m || (_templateObject2$m = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_templateObject3$d || (_templateObject3$d = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
|
|
3723
3723
|
}
|
|
3724
3724
|
|
|
3725
3725
|
var _excluded$G = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
3726
3726
|
|
|
3727
|
-
var _templateObject$
|
|
3727
|
+
var _templateObject$B;
|
|
3728
3728
|
var Root$E = styled__default["default"].div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
|
|
3729
|
-
var SpanWithTextOverflow$2 = styled__default["default"].span(_templateObject$
|
|
3729
|
+
var SpanWithTextOverflow$2 = styled__default["default"].span(_templateObject$B || (_templateObject$B = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
3730
3730
|
/**
|
|
3731
3731
|
* @public
|
|
3732
3732
|
*/
|
|
@@ -4027,7 +4027,7 @@ var Avatar = /*#__PURE__*/React.forwardRef(function Avatar(props, ref) {
|
|
|
4027
4027
|
}, /*#__PURE__*/React__default["default"].createElement("strong", null, initials)))));
|
|
4028
4028
|
});
|
|
4029
4029
|
|
|
4030
|
-
var _templateObject$
|
|
4030
|
+
var _templateObject$A;
|
|
4031
4031
|
|
|
4032
4032
|
function responsiveAvatarCounterSizeStyle(props) {
|
|
4033
4033
|
var theme = props.theme;
|
|
@@ -4047,7 +4047,7 @@ function responsiveAvatarCounterSizeStyle(props) {
|
|
|
4047
4047
|
|
|
4048
4048
|
function avatarCounterBaseStyle(props) {
|
|
4049
4049
|
var theme = props.theme;
|
|
4050
|
-
return styled.css(_templateObject$
|
|
4050
|
+
return styled.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]));
|
|
4051
4051
|
}
|
|
4052
4052
|
|
|
4053
4053
|
var Root$C = styled__default["default"].div(responsiveAvatarCounterSizeStyle, avatarCounterBaseStyle);
|
|
@@ -4082,8 +4082,8 @@ function childrenToElementArray(children) {
|
|
|
4082
4082
|
|
|
4083
4083
|
var _excluded$E = ["children", "maxLength", "size", "tone"];
|
|
4084
4084
|
|
|
4085
|
-
var _templateObject$
|
|
4086
|
-
var BASE_STYLES = styled.css(_templateObject$
|
|
4085
|
+
var _templateObject$z;
|
|
4086
|
+
var BASE_STYLES = styled.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"])));
|
|
4087
4087
|
|
|
4088
4088
|
function avatarStackStyle() {
|
|
4089
4089
|
return BASE_STYLES;
|
|
@@ -4222,20 +4222,20 @@ var Box = /*#__PURE__*/React.forwardRef(function Box(props, ref) {
|
|
|
4222
4222
|
}), props.children);
|
|
4223
4223
|
});
|
|
4224
4224
|
|
|
4225
|
-
var _templateObject$
|
|
4225
|
+
var _templateObject$y, _templateObject2$l, _templateObject3$c;
|
|
4226
4226
|
function labelBaseStyle(props) {
|
|
4227
4227
|
var $accent = props.$accent,
|
|
4228
4228
|
$muted = props.$muted,
|
|
4229
4229
|
theme = props.theme;
|
|
4230
4230
|
var fonts = theme.sanity.fonts;
|
|
4231
|
-
return styled.css(_templateObject$
|
|
4231
|
+
return styled.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 && styled.css(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_templateObject3$c || (_templateObject3$c = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
|
|
4232
4232
|
}
|
|
4233
4233
|
|
|
4234
4234
|
var _excluded$C = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
4235
4235
|
|
|
4236
|
-
var _templateObject$
|
|
4236
|
+
var _templateObject$x;
|
|
4237
4237
|
var Root$z = styled__default["default"].div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
|
|
4238
|
-
var SpanWithTextOverflow$1 = styled__default["default"].span(_templateObject$
|
|
4238
|
+
var SpanWithTextOverflow$1 = styled__default["default"].span(_templateObject$x || (_templateObject$x = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
4239
4239
|
/**
|
|
4240
4240
|
* @public
|
|
4241
4241
|
*/
|
|
@@ -4350,8 +4350,8 @@ var Flex = /*#__PURE__*/React.forwardRef(function Flex(props, ref) {
|
|
|
4350
4350
|
}));
|
|
4351
4351
|
});
|
|
4352
4352
|
|
|
4353
|
-
var _templateObject$
|
|
4354
|
-
var rotate$1 = styled.keyframes(_templateObject$
|
|
4353
|
+
var _templateObject$w, _templateObject2$k;
|
|
4354
|
+
var rotate$1 = styled.keyframes(_templateObject$w || (_templateObject$w = _taggedTemplateLiteralLoose(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
|
|
4355
4355
|
var Root$w = styled__default["default"](Text)(_templateObject2$k || (_templateObject2$k = _taggedTemplateLiteralLoose(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
|
|
4356
4356
|
/**
|
|
4357
4357
|
* @public
|
|
@@ -4402,13 +4402,13 @@ function _colorVarsStyle(base, color, checkered) {
|
|
|
4402
4402
|
};
|
|
4403
4403
|
}
|
|
4404
4404
|
|
|
4405
|
-
var _templateObject$
|
|
4405
|
+
var _templateObject$v;
|
|
4406
4406
|
/**
|
|
4407
4407
|
* @internal
|
|
4408
4408
|
*/
|
|
4409
4409
|
|
|
4410
4410
|
function buttonBaseStyles() {
|
|
4411
|
-
return styled.css(_templateObject$
|
|
4411
|
+
return styled.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 "])));
|
|
4412
4412
|
}
|
|
4413
4413
|
var buttonTheme = {
|
|
4414
4414
|
border: {
|
|
@@ -4459,9 +4459,9 @@ function buttonColorStyles(props) {
|
|
|
4459
4459
|
|
|
4460
4460
|
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"];
|
|
4461
4461
|
|
|
4462
|
-
var _templateObject$
|
|
4462
|
+
var _templateObject$u;
|
|
4463
4463
|
var Root$v = styled__default["default"].button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
|
|
4464
|
-
var LoadingBox = styled__default["default"].div(_templateObject$
|
|
4464
|
+
var LoadingBox = styled__default["default"].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"])));
|
|
4465
4465
|
/**
|
|
4466
4466
|
* @public
|
|
4467
4467
|
*/
|
|
@@ -4545,7 +4545,7 @@ var Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
|
4545
4545
|
}, boxProps), children));
|
|
4546
4546
|
});
|
|
4547
4547
|
|
|
4548
|
-
var _templateObject$
|
|
4548
|
+
var _templateObject$t, _templateObject2$j, _templateObject3$b;
|
|
4549
4549
|
function cardStyle(props) {
|
|
4550
4550
|
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
4551
4551
|
}
|
|
@@ -4553,7 +4553,7 @@ function cardBaseStyle(props) {
|
|
|
4553
4553
|
var $checkered = props.$checkered,
|
|
4554
4554
|
theme = props.theme;
|
|
4555
4555
|
var space = theme.sanity.space;
|
|
4556
|
-
return styled.css(_templateObject$
|
|
4556
|
+
return styled.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 && styled.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]));
|
|
4557
4557
|
}
|
|
4558
4558
|
function cardColorStyle(props) {
|
|
4559
4559
|
var _theme$sanity$styles, _theme$sanity$styles$;
|
|
@@ -4639,9 +4639,9 @@ var Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
|
4639
4639
|
})));
|
|
4640
4640
|
});
|
|
4641
4641
|
|
|
4642
|
-
var _templateObject$
|
|
4642
|
+
var _templateObject$s, _templateObject2$i;
|
|
4643
4643
|
function checkboxBaseStyles() {
|
|
4644
|
-
return styled.css(_templateObject$
|
|
4644
|
+
return styled.css(_templateObject$s || (_templateObject$s = _taggedTemplateLiteralLoose(["\n position: relative;\n display: inline-block;\n "])));
|
|
4645
4645
|
}
|
|
4646
4646
|
function inputElementStyles(props) {
|
|
4647
4647
|
var theme = props.theme;
|
|
@@ -4711,7 +4711,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, forwardedR
|
|
|
4711
4711
|
})), /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement(icons.CheckmarkIcon, null), /*#__PURE__*/React__default["default"].createElement(icons.RemoveIcon, null)));
|
|
4712
4712
|
});
|
|
4713
4713
|
|
|
4714
|
-
var _templateObject$
|
|
4714
|
+
var _templateObject$r;
|
|
4715
4715
|
|
|
4716
4716
|
function codeSyntaxHighlightingStyle(_ref) {
|
|
4717
4717
|
var theme = _ref.theme;
|
|
@@ -4829,7 +4829,7 @@ function codeSyntaxHighlightingStyle(_ref) {
|
|
|
4829
4829
|
}
|
|
4830
4830
|
|
|
4831
4831
|
function codeBaseStyle() {
|
|
4832
|
-
return styled.css(_templateObject$
|
|
4832
|
+
return styled.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);
|
|
4833
4833
|
}
|
|
4834
4834
|
|
|
4835
4835
|
var _excluded$w = ["children", "language", "size", "weight"];
|
|
@@ -4937,19 +4937,19 @@ var Grid = /*#__PURE__*/React.forwardRef(function Grid(props, ref) {
|
|
|
4937
4937
|
}), children);
|
|
4938
4938
|
});
|
|
4939
4939
|
|
|
4940
|
-
var _templateObject$
|
|
4940
|
+
var _templateObject$q, _templateObject2$h, _templateObject3$a;
|
|
4941
4941
|
function headingBaseStyle(props) {
|
|
4942
4942
|
var $accent = props.$accent,
|
|
4943
4943
|
$muted = props.$muted,
|
|
4944
4944
|
theme = props.theme;
|
|
4945
|
-
return styled.css(_templateObject$
|
|
4945
|
+
return styled.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 && styled.css(_templateObject2$h || (_templateObject2$h = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_templateObject3$a || (_templateObject3$a = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
|
|
4946
4946
|
}
|
|
4947
4947
|
|
|
4948
4948
|
var _excluded$t = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
4949
4949
|
|
|
4950
|
-
var _templateObject$
|
|
4950
|
+
var _templateObject$p;
|
|
4951
4951
|
var Root$p = styled__default["default"].div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
|
|
4952
|
-
var SpanWithTextOverflow = styled__default["default"].span(_templateObject$
|
|
4952
|
+
var SpanWithTextOverflow = styled__default["default"].span(_templateObject$p || (_templateObject$p = _taggedTemplateLiteralLoose(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n"])));
|
|
4953
4953
|
/**
|
|
4954
4954
|
* @public
|
|
4955
4955
|
*/
|
|
@@ -5038,10 +5038,10 @@ var Inline = /*#__PURE__*/React.forwardRef(function Inline(props, ref) {
|
|
|
5038
5038
|
|
|
5039
5039
|
var _excluded$r = ["children", "fontSize", "padding", "radius"];
|
|
5040
5040
|
|
|
5041
|
-
var _templateObject$
|
|
5041
|
+
var _templateObject$o;
|
|
5042
5042
|
|
|
5043
5043
|
function kbdStyle() {
|
|
5044
|
-
return styled.css(_templateObject$
|
|
5044
|
+
return styled.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 "])));
|
|
5045
5045
|
}
|
|
5046
5046
|
|
|
5047
5047
|
var Root$n = styled__default["default"].kbd(responsiveRadiusStyle, kbdStyle);
|
|
@@ -5333,8 +5333,8 @@ function LayerProvider(props) {
|
|
|
5333
5333
|
var _excluded$p = ["children", "style"],
|
|
5334
5334
|
_excluded2$1 = ["children", "zOffset"];
|
|
5335
5335
|
|
|
5336
|
-
var _templateObject$
|
|
5337
|
-
var Root$m = styled__default["default"].div(_templateObject$
|
|
5336
|
+
var _templateObject$n;
|
|
5337
|
+
var Root$m = styled__default["default"].div(_templateObject$n || (_templateObject$n = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
|
|
5338
5338
|
var LayerChildren = /*#__PURE__*/React.forwardRef(function LayerChildren(props, ref) {
|
|
5339
5339
|
var children = props.children,
|
|
5340
5340
|
_props$style = props.style,
|
|
@@ -5476,8 +5476,8 @@ function PortalProvider(props) {
|
|
|
5476
5476
|
}, children);
|
|
5477
5477
|
}
|
|
5478
5478
|
|
|
5479
|
-
var _templateObject$
|
|
5480
|
-
var Root$l = styled__default["default"].div(_templateObject$
|
|
5479
|
+
var _templateObject$m;
|
|
5480
|
+
var Root$l = styled__default["default"].div(_templateObject$m || (_templateObject$m = _taggedTemplateLiteralLoose(["\n display: block;\n width: 0;\n height: 0;\n position: absolute;\n overflow: hidden;\n"])));
|
|
5481
5481
|
/**
|
|
5482
5482
|
* @public
|
|
5483
5483
|
*/
|
|
@@ -5661,8 +5661,8 @@ function _isScrollable(el) {
|
|
|
5661
5661
|
|
|
5662
5662
|
var _excluded$o = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
|
|
5663
5663
|
|
|
5664
|
-
var _templateObject$
|
|
5665
|
-
var Root$k = styled__default["default"].div(_templateObject$
|
|
5664
|
+
var _templateObject$l, _templateObject2$g;
|
|
5665
|
+
var Root$k = styled__default["default"].div(_templateObject$l || (_templateObject$l = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
|
|
5666
5666
|
var ItemWrapper = styled__default["default"].div(_templateObject2$g || (_templateObject2$g = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: 0;\n right: 0;\n"])));
|
|
5667
5667
|
/**
|
|
5668
5668
|
* @beta
|
|
@@ -5808,8 +5808,8 @@ var VirtualList = /*#__PURE__*/React.forwardRef(function VirtualList(props, ref)
|
|
|
5808
5808
|
}, children));
|
|
5809
5809
|
});
|
|
5810
5810
|
|
|
5811
|
-
var _templateObject$
|
|
5812
|
-
var Root$j = styled__default["default"].div(_templateObject$
|
|
5811
|
+
var _templateObject$k, _templateObject2$f, _templateObject3$9;
|
|
5812
|
+
var Root$j = styled__default["default"].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"])));
|
|
5813
5813
|
var BorderPath = styled__default["default"].path(_templateObject2$f || (_templateObject2$f = _taggedTemplateLiteralLoose(["\n fill: var(--card-shadow-outline-color);\n"])));
|
|
5814
5814
|
var ShapePath = styled__default["default"].path(_templateObject3$9 || (_templateObject3$9 = _taggedTemplateLiteralLoose(["\n fill: var(--card-bg-color);\n"])));
|
|
5815
5815
|
var PopoverArrow = /*#__PURE__*/React.forwardRef(function PopoverArrow(props, ref) {
|
|
@@ -5988,10 +5988,10 @@ function usePopoverModifiers(props) {
|
|
|
5988
5988
|
|
|
5989
5989
|
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"];
|
|
5990
5990
|
|
|
5991
|
-
var _templateObject$
|
|
5991
|
+
var _templateObject$j, _templateObject2$e, _templateObject3$8;
|
|
5992
5992
|
var Root$i = styled__default["default"](Layer)(function (_ref) {
|
|
5993
5993
|
var $preventOverflow = _ref.$preventOverflow;
|
|
5994
|
-
return styled.css(_templateObject$
|
|
5994
|
+
return styled.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 && styled.css(_templateObject2$e || (_templateObject2$e = _taggedTemplateLiteralLoose(["\n &[data-popper-reference-hidden='true'] {\n display: none;\n }\n "]))));
|
|
5995
5995
|
});
|
|
5996
5996
|
var PopoverCard = styled__default["default"](Card)(function (_ref2) {
|
|
5997
5997
|
var $constrainSize = _ref2.$constrainSize;
|
|
@@ -6141,9 +6141,9 @@ var Popover = /*#__PURE__*/React.forwardRef(function Popover(props, ref) {
|
|
|
6141
6141
|
}, node), !portalProp && node));
|
|
6142
6142
|
});
|
|
6143
6143
|
|
|
6144
|
-
var _templateObject$
|
|
6144
|
+
var _templateObject$i, _templateObject2$d;
|
|
6145
6145
|
function radioBaseStyle() {
|
|
6146
|
-
return styled.css(_templateObject$
|
|
6146
|
+
return styled.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 "])));
|
|
6147
6147
|
}
|
|
6148
6148
|
function inputElementStyle(props) {
|
|
6149
6149
|
var theme = props.theme;
|
|
@@ -6198,10 +6198,10 @@ var Radio = /*#__PURE__*/React.forwardRef(function Radio(props, forwardedRef) {
|
|
|
6198
6198
|
})), /*#__PURE__*/React__default["default"].createElement("span", null));
|
|
6199
6199
|
});
|
|
6200
6200
|
|
|
6201
|
-
var _templateObject$
|
|
6201
|
+
var _templateObject$h, _templateObject2$c, _templateObject3$7, _templateObject4$5;
|
|
6202
6202
|
|
|
6203
6203
|
function rootStyle() {
|
|
6204
|
-
return styled.css(_templateObject$
|
|
6204
|
+
return styled.css(_templateObject$h || (_templateObject$h = _taggedTemplateLiteralLoose(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
6205
6205
|
}
|
|
6206
6206
|
|
|
6207
6207
|
function inputBaseStyle(props) {
|
|
@@ -6359,11 +6359,11 @@ var Stack = /*#__PURE__*/React.forwardRef(function Stack(props, ref) {
|
|
|
6359
6359
|
}));
|
|
6360
6360
|
});
|
|
6361
6361
|
|
|
6362
|
-
var _templateObject$
|
|
6362
|
+
var _templateObject$g, _templateObject2$b, _templateObject3$6, _templateObject4$4, _templateObject5$3, _templateObject6$1, _templateObject7;
|
|
6363
6363
|
/* Root */
|
|
6364
6364
|
|
|
6365
6365
|
function switchBaseStyles() {
|
|
6366
|
-
return styled.css(_templateObject$
|
|
6366
|
+
return styled.css(_templateObject$g || (_templateObject$g = _taggedTemplateLiteralLoose(["\n position: relative;\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
6367
6367
|
}
|
|
6368
6368
|
/* Input */
|
|
6369
6369
|
|
|
@@ -6454,9 +6454,9 @@ var Switch = /*#__PURE__*/React.forwardRef(function Switch(props, forwardedRef)
|
|
|
6454
6454
|
|
|
6455
6455
|
var _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"];
|
|
6456
6456
|
|
|
6457
|
-
var _templateObject$
|
|
6457
|
+
var _templateObject$f;
|
|
6458
6458
|
var Root$d = styled__default["default"].span(textInputRootStyle);
|
|
6459
|
-
var InputRoot$1 = styled__default["default"].span(_templateObject$
|
|
6459
|
+
var InputRoot$1 = styled__default["default"].span(_templateObject$f || (_templateObject$f = _taggedTemplateLiteralLoose(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
|
|
6460
6460
|
var Input$1 = styled__default["default"].textarea(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
|
|
6461
6461
|
var Presentation$1 = styled__default["default"].div(responsiveRadiusStyle, textInputRepresentationStyle);
|
|
6462
6462
|
/**
|
|
@@ -6496,12 +6496,12 @@ var TextArea = /*#__PURE__*/React.forwardRef(function TextArea(props, forwardedR
|
|
|
6496
6496
|
|
|
6497
6497
|
var _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"];
|
|
6498
6498
|
|
|
6499
|
-
var _templateObject$
|
|
6499
|
+
var _templateObject$e, _templateObject2$a, _templateObject3$5, _templateObject4$3, _templateObject5$2;
|
|
6500
6500
|
var CLEAR_BUTTON_BOX_STYLE = {
|
|
6501
6501
|
zIndex: 2
|
|
6502
6502
|
};
|
|
6503
6503
|
var Root$c = styled__default["default"].span(textInputRootStyle);
|
|
6504
|
-
var InputRoot = styled__default["default"].span(_templateObject$
|
|
6504
|
+
var InputRoot = styled__default["default"].span(_templateObject$e || (_templateObject$e = _taggedTemplateLiteralLoose(["\n flex: 1;\n min-width: 0;\n display: block;\n position: relative;\n"])));
|
|
6505
6505
|
var Prefix = styled__default["default"](Card).attrs({
|
|
6506
6506
|
forwardedAs: 'span'
|
|
6507
6507
|
})(_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"])));
|
|
@@ -6655,8 +6655,8 @@ var TextInput = /*#__PURE__*/React.forwardRef(function TextInput(props, forwarde
|
|
|
6655
6655
|
})), presentationNode, clearButtonNode), suffixNode);
|
|
6656
6656
|
});
|
|
6657
6657
|
|
|
6658
|
-
var _templateObject$
|
|
6659
|
-
var Root$b = styled__default["default"].div(_templateObject$
|
|
6658
|
+
var _templateObject$d, _templateObject2$9, _templateObject3$4;
|
|
6659
|
+
var Root$b = styled__default["default"].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"])));
|
|
6660
6660
|
var Border = styled__default["default"].path(_templateObject2$9 || (_templateObject2$9 = _taggedTemplateLiteralLoose(["\n fill: var(--card-shadow-outline-color);\n"])));
|
|
6661
6661
|
var Shape = styled__default["default"].path(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteralLoose(["\n fill: var(--card-bg-color);\n"])));
|
|
6662
6662
|
var TooltipArrow = /*#__PURE__*/React.forwardRef(function TooltipArrow(props, ref) {
|
|
@@ -6677,8 +6677,8 @@ var TooltipArrow = /*#__PURE__*/React.forwardRef(function TooltipArrow(props, re
|
|
|
6677
6677
|
|
|
6678
6678
|
var _excluded$g = ["allowedAutoPlacements", "boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "zOffset"];
|
|
6679
6679
|
|
|
6680
|
-
var _templateObject$
|
|
6681
|
-
var Root$a = styled__default["default"](Layer)(_templateObject$
|
|
6680
|
+
var _templateObject$c;
|
|
6681
|
+
var Root$a = styled__default["default"](Layer)(_templateObject$c || (_templateObject$c = _taggedTemplateLiteralLoose(["\n pointer-events: none;\n"])));
|
|
6682
6682
|
/**
|
|
6683
6683
|
* @public
|
|
6684
6684
|
*/
|
|
@@ -6831,12 +6831,12 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
|
|
|
6831
6831
|
}, popperNode), !portal && popperNode));
|
|
6832
6832
|
});
|
|
6833
6833
|
|
|
6834
|
-
var _templateObject$
|
|
6834
|
+
var _templateObject$b, _templateObject2$8, _templateObject3$3, _templateObject4$2, _templateObject5$1;
|
|
6835
6835
|
/**
|
|
6836
6836
|
* @internal
|
|
6837
6837
|
*/
|
|
6838
6838
|
|
|
6839
|
-
var Root$9 = styled__default["default"].div(_templateObject$
|
|
6839
|
+
var Root$9 = styled__default["default"].div(_templateObject$b || (_templateObject$b = _taggedTemplateLiteralLoose(["\n /* position: relative; */\n"])));
|
|
6840
6840
|
/**
|
|
6841
6841
|
* @internal
|
|
6842
6842
|
*/
|
|
@@ -7482,8 +7482,8 @@ var InnerAutocomplete = /*#__PURE__*/React.forwardRef(function InnerAutocomplete
|
|
|
7482
7482
|
|
|
7483
7483
|
var Autocomplete = InnerAutocomplete;
|
|
7484
7484
|
|
|
7485
|
-
var _templateObject$
|
|
7486
|
-
var Root$8 = styled__default["default"].ol(_templateObject$
|
|
7485
|
+
var _templateObject$a, _templateObject2$7;
|
|
7486
|
+
var Root$8 = styled__default["default"].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"])));
|
|
7487
7487
|
var ExpandButton = styled__default["default"](Button)(_templateObject2$7 || (_templateObject2$7 = _taggedTemplateLiteralLoose(["\n appearance: none;\n margin: -4px;\n"])));
|
|
7488
7488
|
|
|
7489
7489
|
var _excluded$e = ["children", "maxLength", "separator", "space"];
|
|
@@ -7624,9 +7624,9 @@ function useDialog() {
|
|
|
7624
7624
|
|
|
7625
7625
|
var _excluded$d = ["__unstable_autoFocus", "__unstable_hideCloseButton", "cardRadius", "cardShadow", "children", "contentRef", "footer", "header", "id", "onClickOutside", "onClose", "padding", "portal", "position", "scheme", "width", "zOffset"];
|
|
7626
7626
|
|
|
7627
|
-
var _templateObject$
|
|
7627
|
+
var _templateObject$9, _templateObject2$6, _templateObject3$2, _templateObject4$1, _templateObject5, _templateObject6;
|
|
7628
7628
|
var Root$7 = styled__default["default"](Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
|
|
7629
|
-
var DialogContainer = styled__default["default"](Container)(_templateObject$
|
|
7629
|
+
var DialogContainer = styled__default["default"](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"])));
|
|
7630
7630
|
var DialogCardRoot = styled__default["default"](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"])));
|
|
7631
7631
|
var DialogLayout = styled__default["default"](Flex)(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
|
|
7632
7632
|
var DialogHeader = styled__default["default"](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"])));
|
|
@@ -7835,8 +7835,8 @@ function DialogProvider(props) {
|
|
|
7835
7835
|
|
|
7836
7836
|
var _excluded$c = ["fontSize", "keys", "padding", "radius", "space"];
|
|
7837
7837
|
|
|
7838
|
-
var _templateObject$
|
|
7839
|
-
var Root$6 = styled__default["default"].kbd(_templateObject$
|
|
7838
|
+
var _templateObject$8, _templateObject2$5;
|
|
7839
|
+
var Root$6 = styled__default["default"].kbd(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: block;\n }\n font: inherit;\n"])));
|
|
7840
7840
|
var Key = styled__default["default"](KBD)(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteralLoose(["\n &:not([hidden]) {\n display: block;\n }\n"])));
|
|
7841
7841
|
/**
|
|
7842
7842
|
* @public
|
|
@@ -7872,6 +7872,10 @@ var Hotkeys = /*#__PURE__*/React.forwardRef(function Hotkeys(props, ref) {
|
|
|
7872
7872
|
})));
|
|
7873
7873
|
});
|
|
7874
7874
|
|
|
7875
|
+
var key$2 = Symbol["for"]('@sanity/ui/context/menu');
|
|
7876
|
+
globalScope[key$2] = globalScope[key$2] || /*#__PURE__*/React.createContext(null);
|
|
7877
|
+
var MenuContext = globalScope[key$2];
|
|
7878
|
+
|
|
7875
7879
|
/**
|
|
7876
7880
|
* @internal
|
|
7877
7881
|
*/
|
|
@@ -7947,56 +7951,34 @@ function _sortElements(rootElement, elements) {
|
|
|
7947
7951
|
elements.sort(_sort);
|
|
7948
7952
|
}
|
|
7949
7953
|
|
|
7950
|
-
var key$2 = Symbol["for"]('@sanity/ui/context/menu');
|
|
7951
|
-
globalScope[key$2] = globalScope[key$2] || /*#__PURE__*/React.createContext(null);
|
|
7952
|
-
var MenuContext = globalScope[key$2];
|
|
7953
|
-
|
|
7954
|
-
var _excluded$b = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"];
|
|
7955
|
-
|
|
7956
|
-
var _templateObject$8;
|
|
7957
|
-
var Root$5 = styled__default["default"](Box)(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n outline: none;\n overflow: auto;\n"])));
|
|
7958
7954
|
/**
|
|
7959
|
-
*
|
|
7955
|
+
* This controller is responsible for controlling UI menu state.
|
|
7956
|
+
*
|
|
7957
|
+
* @internal
|
|
7960
7958
|
*/
|
|
7961
7959
|
|
|
7962
|
-
|
|
7963
|
-
var
|
|
7964
|
-
onClickOutside = props.onClickOutside,
|
|
7965
|
-
onEscape = props.onEscape,
|
|
7966
|
-
onItemClick = props.onItemClick,
|
|
7967
|
-
onItemSelect = props.onItemSelect,
|
|
7968
|
-
onKeyDown = props.onKeyDown,
|
|
7960
|
+
function useMenuController(props) {
|
|
7961
|
+
var onKeyDown = props.onKeyDown,
|
|
7969
7962
|
originElement = props.originElement,
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
registerElement = props.registerElement,
|
|
7973
|
-
_props$shouldFocus = props.shouldFocus,
|
|
7974
|
-
shouldFocus = _props$shouldFocus === void 0 ? props.focusFirst && 'first' || props.focusLast && 'last' || null : _props$shouldFocus,
|
|
7975
|
-
_props$space = props.space,
|
|
7976
|
-
space = _props$space === void 0 ? 1 : _props$space,
|
|
7977
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
7978
|
-
|
|
7979
|
-
var _useLayer = useLayer(),
|
|
7980
|
-
isTopLayer = _useLayer.isTopLayer;
|
|
7963
|
+
shouldFocus = props.shouldFocus;
|
|
7964
|
+
var elementsRef = React.useRef([]);
|
|
7981
7965
|
|
|
7982
7966
|
var _useState = React.useState(null),
|
|
7983
7967
|
rootElement = _useState[0],
|
|
7984
7968
|
setRootElement = _useState[1];
|
|
7985
7969
|
|
|
7986
|
-
var elementsRef = React.useRef([]);
|
|
7987
|
-
|
|
7988
7970
|
var _useState2 = React.useState(-1),
|
|
7989
7971
|
activeIndex = _useState2[0],
|
|
7990
|
-
|
|
7972
|
+
_setActiveIndex = _useState2[1];
|
|
7991
7973
|
|
|
7992
|
-
var activeIndexRef = React.useRef(activeIndex);
|
|
7993
7974
|
var activeElement = elementsRef.current[activeIndex] || null;
|
|
7994
|
-
var
|
|
7975
|
+
var activeIndexRef = React.useRef(activeIndex);
|
|
7995
7976
|
var mounted = Boolean(rootElement);
|
|
7996
|
-
var
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
7977
|
+
var setActiveIndex = React.useCallback(function (nextActiveIndex) {
|
|
7978
|
+
_setActiveIndex(nextActiveIndex);
|
|
7979
|
+
|
|
7980
|
+
activeIndexRef.current = nextActiveIndex;
|
|
7981
|
+
}, []);
|
|
8000
7982
|
var mount = React.useCallback(function (element, selected) {
|
|
8001
7983
|
if (!element) return function () {
|
|
8002
7984
|
return undefined;
|
|
@@ -8011,7 +7993,6 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8011
7993
|
if (selected) {
|
|
8012
7994
|
var selectedIndex = elementsRef.current.indexOf(element);
|
|
8013
7995
|
setActiveIndex(selectedIndex);
|
|
8014
|
-
activeIndexRef.current = selectedIndex;
|
|
8015
7996
|
}
|
|
8016
7997
|
|
|
8017
7998
|
return function () {
|
|
@@ -8021,7 +8002,7 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8021
8002
|
elementsRef.current.splice(idx, 1);
|
|
8022
8003
|
}
|
|
8023
8004
|
};
|
|
8024
|
-
}, [rootElement]);
|
|
8005
|
+
}, [rootElement, setActiveIndex]);
|
|
8025
8006
|
var handleKeyDown = React.useCallback(function (event) {
|
|
8026
8007
|
// Move focus to the element that opened the menu before handling the `Tab` press
|
|
8027
8008
|
if (event.key === 'Tab') {
|
|
@@ -8043,7 +8024,6 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8043
8024
|
if (!el) return;
|
|
8044
8025
|
var currentIndex = elementsRef.current.indexOf(el);
|
|
8045
8026
|
setActiveIndex(currentIndex);
|
|
8046
|
-
activeIndexRef.current = currentIndex;
|
|
8047
8027
|
return;
|
|
8048
8028
|
} // Move focus to the last focusable menuitem
|
|
8049
8029
|
|
|
@@ -8060,7 +8040,6 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8060
8040
|
var _currentIndex = elementsRef.current.indexOf(_el);
|
|
8061
8041
|
|
|
8062
8042
|
setActiveIndex(_currentIndex);
|
|
8063
|
-
activeIndexRef.current = _currentIndex;
|
|
8064
8043
|
return;
|
|
8065
8044
|
}
|
|
8066
8045
|
|
|
@@ -8082,7 +8061,6 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8082
8061
|
var _currentIndex2 = elementsRef.current.indexOf(_el2);
|
|
8083
8062
|
|
|
8084
8063
|
setActiveIndex(_currentIndex2);
|
|
8085
|
-
activeIndexRef.current = _currentIndex2;
|
|
8086
8064
|
return;
|
|
8087
8065
|
}
|
|
8088
8066
|
|
|
@@ -8104,32 +8082,22 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8104
8082
|
var _currentIndex3 = elementsRef.current.indexOf(_el3);
|
|
8105
8083
|
|
|
8106
8084
|
setActiveIndex(_currentIndex3);
|
|
8107
|
-
activeIndexRef.current = _currentIndex3;
|
|
8108
8085
|
return;
|
|
8109
8086
|
}
|
|
8110
8087
|
|
|
8111
8088
|
if (onKeyDown) {
|
|
8112
8089
|
onKeyDown(event);
|
|
8113
8090
|
}
|
|
8114
|
-
}, [activeIndex, onKeyDown, originElement]);
|
|
8091
|
+
}, [activeIndex, onKeyDown, originElement, setActiveIndex]);
|
|
8115
8092
|
var handleItemMouseEnter = React.useCallback(function (event) {
|
|
8116
8093
|
var element = event.currentTarget;
|
|
8117
8094
|
var currentIndex = elementsRef.current.indexOf(element);
|
|
8118
8095
|
setActiveIndex(currentIndex);
|
|
8119
|
-
|
|
8120
|
-
}, []);
|
|
8096
|
+
}, [setActiveIndex]);
|
|
8121
8097
|
var handleItemMouseLeave = React.useCallback(function () {
|
|
8122
8098
|
rootElement == null ? void 0 : rootElement.focus();
|
|
8123
8099
|
setActiveIndex(-1);
|
|
8124
|
-
|
|
8125
|
-
}, [rootElement]); // Trigger `onItemSelect` when active index changes
|
|
8126
|
-
|
|
8127
|
-
React.useEffect(function () {
|
|
8128
|
-
if (onItemSelect) onItemSelect(activeIndex);
|
|
8129
|
-
}, [activeIndex, onItemSelect]);
|
|
8130
|
-
React.useEffect(function () {
|
|
8131
|
-
activeElementRef.current = activeElement;
|
|
8132
|
-
}, [activeElement]); // Set focus on the currently active element
|
|
8100
|
+
}, [rootElement, setActiveIndex]); // Set focus on the currently active element
|
|
8133
8101
|
|
|
8134
8102
|
React.useEffect(function () {
|
|
8135
8103
|
if (!mounted) return;
|
|
@@ -8171,10 +8139,76 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8171
8139
|
return function () {
|
|
8172
8140
|
window.cancelAnimationFrame(rafId);
|
|
8173
8141
|
};
|
|
8174
|
-
}, [activeIndex, mounted, shouldFocus]);
|
|
8142
|
+
}, [activeIndex, mounted, setActiveIndex, shouldFocus]);
|
|
8143
|
+
return {
|
|
8144
|
+
activeElement: activeElement,
|
|
8145
|
+
activeIndex: activeIndex,
|
|
8146
|
+
handleItemMouseEnter: handleItemMouseEnter,
|
|
8147
|
+
handleItemMouseLeave: handleItemMouseLeave,
|
|
8148
|
+
handleKeyDown: handleKeyDown,
|
|
8149
|
+
mount: mount,
|
|
8150
|
+
rootElement: rootElement,
|
|
8151
|
+
setRootElement: setRootElement
|
|
8152
|
+
};
|
|
8153
|
+
}
|
|
8154
|
+
|
|
8155
|
+
var _excluded$b = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"];
|
|
8156
|
+
|
|
8157
|
+
var _templateObject$7;
|
|
8158
|
+
var Root$5 = styled__default["default"](Box)(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n outline: none;\n overflow: auto;\n"])));
|
|
8159
|
+
/**
|
|
8160
|
+
* @public
|
|
8161
|
+
*/
|
|
8162
|
+
|
|
8163
|
+
var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
8164
|
+
var children = props.children,
|
|
8165
|
+
onClickOutside = props.onClickOutside,
|
|
8166
|
+
onEscape = props.onEscape,
|
|
8167
|
+
onItemClick = props.onItemClick,
|
|
8168
|
+
onItemSelect = props.onItemSelect,
|
|
8169
|
+
onKeyDown = props.onKeyDown,
|
|
8170
|
+
originElement = props.originElement,
|
|
8171
|
+
_props$padding = props.padding,
|
|
8172
|
+
padding = _props$padding === void 0 ? 1 : _props$padding,
|
|
8173
|
+
registerElement = props.registerElement,
|
|
8174
|
+
_props$shouldFocus = props.shouldFocus,
|
|
8175
|
+
shouldFocus = _props$shouldFocus === void 0 ? props.focusFirst && 'first' || props.focusLast && 'last' || null : _props$shouldFocus,
|
|
8176
|
+
_props$space = props.space,
|
|
8177
|
+
space = _props$space === void 0 ? 1 : _props$space,
|
|
8178
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
8179
|
+
|
|
8180
|
+
var forwardedRef = useForwardedRef(ref);
|
|
8181
|
+
|
|
8182
|
+
var _useLayer = useLayer(),
|
|
8183
|
+
isTopLayer = _useLayer.isTopLayer;
|
|
8184
|
+
|
|
8185
|
+
var _useMenuController = useMenuController({
|
|
8186
|
+
onKeyDown: onKeyDown,
|
|
8187
|
+
originElement: originElement,
|
|
8188
|
+
shouldFocus: shouldFocus
|
|
8189
|
+
}),
|
|
8190
|
+
activeElement = _useMenuController.activeElement,
|
|
8191
|
+
activeIndex = _useMenuController.activeIndex,
|
|
8192
|
+
handleItemMouseEnter = _useMenuController.handleItemMouseEnter,
|
|
8193
|
+
handleItemMouseLeave = _useMenuController.handleItemMouseLeave,
|
|
8194
|
+
handleKeyDown = _useMenuController.handleKeyDown,
|
|
8195
|
+
mount = _useMenuController.mount,
|
|
8196
|
+
rootElement = _useMenuController.rootElement,
|
|
8197
|
+
setRootElement = _useMenuController.setRootElement;
|
|
8198
|
+
|
|
8199
|
+
var handleRefChange = React.useCallback(function (el) {
|
|
8200
|
+
setRootElement(el);
|
|
8201
|
+
forwardedRef.current = el;
|
|
8202
|
+
}, [forwardedRef, setRootElement]); // Trigger `onItemSelect` when active index changes
|
|
8203
|
+
|
|
8204
|
+
React.useEffect(function () {
|
|
8205
|
+
if (onItemSelect) onItemSelect(activeIndex);
|
|
8206
|
+
}, [activeIndex, onItemSelect]); // Close menu when clicking outside
|
|
8207
|
+
|
|
8175
8208
|
useClickOutside(React.useCallback(function (event) {
|
|
8176
8209
|
return isTopLayer && onClickOutside && onClickOutside(event);
|
|
8177
|
-
}, [isTopLayer, onClickOutside]), [rootElement]);
|
|
8210
|
+
}, [isTopLayer, onClickOutside]), [rootElement]); // Close menu when pressing Escape
|
|
8211
|
+
|
|
8178
8212
|
useGlobalKeyDown(React.useCallback(function (event) {
|
|
8179
8213
|
if (!isTopLayer) return;
|
|
8180
8214
|
|
|
@@ -8182,7 +8216,8 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8182
8216
|
event.stopPropagation();
|
|
8183
8217
|
if (onEscape) onEscape();
|
|
8184
8218
|
}
|
|
8185
|
-
}, [isTopLayer, onEscape]));
|
|
8219
|
+
}, [isTopLayer, onEscape])); // Register root element (for nested menus)
|
|
8220
|
+
|
|
8186
8221
|
React.useEffect(function () {
|
|
8187
8222
|
if (!rootElement || !registerElement) return;
|
|
8188
8223
|
return registerElement(rootElement);
|
|
@@ -8195,9 +8230,9 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8195
8230
|
mount: mount,
|
|
8196
8231
|
onClickOutside: onClickOutside,
|
|
8197
8232
|
onEscape: onEscape,
|
|
8198
|
-
onMouseEnter: handleItemMouseEnter,
|
|
8199
|
-
onMouseLeave: handleItemMouseLeave,
|
|
8200
8233
|
onItemClick: onItemClick,
|
|
8234
|
+
onItemMouseEnter: handleItemMouseEnter,
|
|
8235
|
+
onItemMouseLeave: handleItemMouseLeave,
|
|
8201
8236
|
registerElement: registerElement
|
|
8202
8237
|
};
|
|
8203
8238
|
}, [activeElement, activeIndex, mount, handleItemMouseEnter, handleItemMouseLeave, onClickOutside, onEscape, onItemClick, registerElement]);
|
|
@@ -8208,7 +8243,7 @@ var Menu = /*#__PURE__*/React.forwardRef(function Menu(props, ref) {
|
|
|
8208
8243
|
}, restProps, {
|
|
8209
8244
|
onKeyDown: handleKeyDown,
|
|
8210
8245
|
padding: padding,
|
|
8211
|
-
ref:
|
|
8246
|
+
ref: handleRefChange,
|
|
8212
8247
|
role: "menu",
|
|
8213
8248
|
tabIndex: -1
|
|
8214
8249
|
}), /*#__PURE__*/React__default["default"].createElement(Stack, {
|
|
@@ -8396,16 +8431,16 @@ var MenuButton = /*#__PURE__*/React.forwardRef(function MenuButton(props, ref) {
|
|
|
8396
8431
|
}), button || /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null));
|
|
8397
8432
|
});
|
|
8398
8433
|
|
|
8399
|
-
var _templateObject$
|
|
8434
|
+
var _templateObject$6;
|
|
8400
8435
|
/**
|
|
8401
8436
|
* @public
|
|
8402
8437
|
*/
|
|
8403
8438
|
|
|
8404
|
-
var MenuDivider = styled__default["default"].hr(_templateObject$
|
|
8439
|
+
var MenuDivider = styled__default["default"].hr(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
|
|
8405
8440
|
|
|
8406
|
-
var _templateObject$
|
|
8441
|
+
var _templateObject$5, _templateObject2$4;
|
|
8407
8442
|
function selectableBaseStyle() {
|
|
8408
|
-
return styled.css(_templateObject$
|
|
8443
|
+
return styled.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 "])));
|
|
8409
8444
|
}
|
|
8410
8445
|
function selectableColorStyle(props) {
|
|
8411
8446
|
var _theme$sanity$styles, _theme$sanity$styles$;
|
|
@@ -8444,11 +8479,7 @@ function useMenu() {
|
|
|
8444
8479
|
return value;
|
|
8445
8480
|
}
|
|
8446
8481
|
|
|
8447
|
-
var _excluded$a = ["as", "children", "fontSize", "onClick", "padding", "popover", "radius", "text", "tone"];
|
|
8448
|
-
|
|
8449
|
-
var _templateObject$5;
|
|
8450
|
-
var MOUSE_LEAVE_TIMEOUT = 1000;
|
|
8451
|
-
var TextContainer = styled__default["default"].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"])));
|
|
8482
|
+
var _excluded$a = ["as", "children", "fontSize", "icon", "onClick", "padding", "popover", "radius", "space", "text", "tone"];
|
|
8452
8483
|
/**
|
|
8453
8484
|
* @public
|
|
8454
8485
|
*/
|
|
@@ -8458,6 +8489,7 @@ function MenuGroup(props) {
|
|
|
8458
8489
|
as = _props$as === void 0 ? 'button' : _props$as,
|
|
8459
8490
|
children = props.children,
|
|
8460
8491
|
fontSize = props.fontSize,
|
|
8492
|
+
icon = props.icon,
|
|
8461
8493
|
onClick = props.onClick,
|
|
8462
8494
|
_props$padding = props.padding,
|
|
8463
8495
|
padding = _props$padding === void 0 ? 3 : _props$padding,
|
|
@@ -8465,52 +8497,42 @@ function MenuGroup(props) {
|
|
|
8465
8497
|
popover = _props$popover === void 0 ? {} : _props$popover,
|
|
8466
8498
|
_props$radius = props.radius,
|
|
8467
8499
|
radius = _props$radius === void 0 ? 2 : _props$radius,
|
|
8500
|
+
_props$space = props.space,
|
|
8501
|
+
space = _props$space === void 0 ? 3 : _props$space,
|
|
8468
8502
|
text = props.text,
|
|
8469
8503
|
_props$tone = props.tone,
|
|
8470
8504
|
tone = _props$tone === void 0 ? 'default' : _props$tone,
|
|
8471
8505
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$a);
|
|
8472
8506
|
|
|
8473
|
-
var _useState = React.useState(false),
|
|
8474
|
-
open = _useState[0],
|
|
8475
|
-
setOpen = _useState[1];
|
|
8476
|
-
|
|
8477
8507
|
var _useMenu = useMenu(),
|
|
8478
8508
|
activeElement = _useMenu.activeElement,
|
|
8479
8509
|
mount = _useMenu.mount,
|
|
8480
8510
|
onClickOutside = _useMenu.onClickOutside,
|
|
8481
8511
|
onEscape = _useMenu.onEscape,
|
|
8482
8512
|
onItemClick = _useMenu.onItemClick,
|
|
8483
|
-
|
|
8484
|
-
onMouseLeave = _useMenu.onMouseLeave,
|
|
8513
|
+
onItemMouseEnter = _useMenu.onItemMouseEnter,
|
|
8485
8514
|
registerElement = _useMenu.registerElement;
|
|
8486
8515
|
|
|
8487
|
-
var
|
|
8488
|
-
rootElement =
|
|
8489
|
-
setRootElement =
|
|
8516
|
+
var _useState = React.useState(null),
|
|
8517
|
+
rootElement = _useState[0],
|
|
8518
|
+
setRootElement = _useState[1];
|
|
8519
|
+
|
|
8520
|
+
var _useState2 = React.useState(false),
|
|
8521
|
+
open = _useState2[0],
|
|
8522
|
+
setOpen = _useState2[1];
|
|
8490
8523
|
|
|
8491
|
-
var mouseLeaveTimeoutRef = React.useRef(null);
|
|
8492
8524
|
var shouldFocusRef = React.useRef(null);
|
|
8493
|
-
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8494
|
-
// Register the element
|
|
8525
|
+
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8495
8526
|
|
|
8496
|
-
React.
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
var handleMouseEnter = React.useCallback(function (event) {
|
|
8500
|
-
if (mouseLeaveTimeoutRef.current) {
|
|
8501
|
-
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
8502
|
-
mouseLeaveTimeoutRef.current = null;
|
|
8503
|
-
}
|
|
8527
|
+
var _useState3 = React.useState(false),
|
|
8528
|
+
withinMenu = _useState3[0],
|
|
8529
|
+
setWithinMenu = _useState3[1];
|
|
8504
8530
|
|
|
8505
|
-
|
|
8531
|
+
var handleMouseEnter = React.useCallback(function (event) {
|
|
8532
|
+
setWithinMenu(false);
|
|
8533
|
+
onItemMouseEnter(event);
|
|
8506
8534
|
setOpen(true);
|
|
8507
|
-
}, [
|
|
8508
|
-
var handleMouseLeave = React.useCallback(function (event) {
|
|
8509
|
-
onMouseLeave(event);
|
|
8510
|
-
mouseLeaveTimeoutRef.current = setTimeout(function () {
|
|
8511
|
-
setOpen(false);
|
|
8512
|
-
}, MOUSE_LEAVE_TIMEOUT);
|
|
8513
|
-
}, [onMouseLeave]);
|
|
8535
|
+
}, [onItemMouseEnter]);
|
|
8514
8536
|
var handleMenuKeyDown = React.useCallback(function (event) {
|
|
8515
8537
|
if (event.key === 'ArrowLeft') {
|
|
8516
8538
|
event.stopPropagation();
|
|
@@ -8520,17 +8542,6 @@ function MenuGroup(props) {
|
|
|
8520
8542
|
});
|
|
8521
8543
|
}
|
|
8522
8544
|
}, [rootElement]);
|
|
8523
|
-
var handleMenuMouseEnter = React.useCallback(function () {
|
|
8524
|
-
if (mouseLeaveTimeoutRef.current) {
|
|
8525
|
-
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
8526
|
-
mouseLeaveTimeoutRef.current = null;
|
|
8527
|
-
}
|
|
8528
|
-
}, []);
|
|
8529
|
-
var handleMenuMouseLeave = React.useCallback(function () {
|
|
8530
|
-
mouseLeaveTimeoutRef.current = setTimeout(function () {
|
|
8531
|
-
setOpen(false);
|
|
8532
|
-
}, MOUSE_LEAVE_TIMEOUT);
|
|
8533
|
-
}, []);
|
|
8534
8545
|
var handleClick = React.useCallback(function (event) {
|
|
8535
8546
|
if (onClick) onClick(event);
|
|
8536
8547
|
shouldFocusRef.current = 'first';
|
|
@@ -8539,25 +8550,31 @@ function MenuGroup(props) {
|
|
|
8539
8550
|
shouldFocusRef.current = null;
|
|
8540
8551
|
});
|
|
8541
8552
|
}, [onClick]);
|
|
8542
|
-
var
|
|
8553
|
+
var handleChildItemClick = React.useCallback(function () {
|
|
8543
8554
|
setOpen(false);
|
|
8544
8555
|
if (onItemClick) onItemClick();
|
|
8545
8556
|
}, [onItemClick]);
|
|
8557
|
+
var handleMenuMouseEnter = React.useCallback(function () {
|
|
8558
|
+
return setWithinMenu(true);
|
|
8559
|
+
}, []); // Register the menu item element
|
|
8560
|
+
|
|
8546
8561
|
React.useEffect(function () {
|
|
8547
|
-
return
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8562
|
+
return mount(rootElement);
|
|
8563
|
+
}, [mount, rootElement]); // Close child menu when a sibling item becomes active
|
|
8564
|
+
|
|
8565
|
+
React.useEffect(function () {
|
|
8566
|
+
if (!active) setOpen(false);
|
|
8567
|
+
}, [active]); // Update state when child menu is no longer open
|
|
8568
|
+
|
|
8569
|
+
React.useEffect(function () {
|
|
8570
|
+
if (!open) setWithinMenu(false);
|
|
8571
|
+
}, [open]);
|
|
8572
|
+
var childMenu = /*#__PURE__*/React__default["default"].createElement(Menu, {
|
|
8555
8573
|
onClickOutside: onClickOutside,
|
|
8556
8574
|
onEscape: onEscape,
|
|
8557
|
-
onItemClick:
|
|
8575
|
+
onItemClick: handleChildItemClick,
|
|
8558
8576
|
onKeyDown: handleMenuKeyDown,
|
|
8559
8577
|
onMouseEnter: handleMenuMouseEnter,
|
|
8560
|
-
onMouseLeave: handleMenuMouseLeave,
|
|
8561
8578
|
registerElement: registerElement,
|
|
8562
8579
|
shouldFocus: shouldFocusRef.current
|
|
8563
8580
|
}, children);
|
|
@@ -8571,6 +8588,7 @@ function MenuGroup(props) {
|
|
|
8571
8588
|
if (event.key === 'ArrowRight') {
|
|
8572
8589
|
shouldFocusRef.current = 'first';
|
|
8573
8590
|
setOpen(true);
|
|
8591
|
+
setWithinMenu(true);
|
|
8574
8592
|
requestAnimationFrame(function () {
|
|
8575
8593
|
shouldFocusRef.current = null;
|
|
8576
8594
|
});
|
|
@@ -8578,7 +8596,7 @@ function MenuGroup(props) {
|
|
|
8578
8596
|
}
|
|
8579
8597
|
}, []);
|
|
8580
8598
|
return /*#__PURE__*/React__default["default"].createElement(Popover, _extends({}, popover, {
|
|
8581
|
-
content:
|
|
8599
|
+
content: childMenu,
|
|
8582
8600
|
"data-ui": "MenuGroup__popover",
|
|
8583
8601
|
open: open
|
|
8584
8602
|
}), /*#__PURE__*/React__default["default"].createElement(Selectable, _extends({
|
|
@@ -8586,25 +8604,32 @@ function MenuGroup(props) {
|
|
|
8586
8604
|
"data-ui": "MenuGroup",
|
|
8587
8605
|
forwardedAs: as
|
|
8588
8606
|
}, restProps, {
|
|
8589
|
-
"aria-pressed": as === 'button' ?
|
|
8590
|
-
"data-pressed": as !== 'button' ?
|
|
8591
|
-
"data-selected": active ? '' : undefined,
|
|
8607
|
+
"aria-pressed": as === 'button' ? withinMenu : undefined,
|
|
8608
|
+
"data-pressed": as !== 'button' ? withinMenu : undefined,
|
|
8609
|
+
"data-selected": !withinMenu && active ? '' : undefined,
|
|
8592
8610
|
"$radius": radius,
|
|
8593
8611
|
"$tone": tone,
|
|
8594
8612
|
onClick: handleClick,
|
|
8595
8613
|
onKeyDown: handleKeyDown,
|
|
8596
8614
|
onMouseEnter: handleMouseEnter,
|
|
8597
|
-
onMouseLeave: handleMouseLeave,
|
|
8598
8615
|
ref: setRootElement,
|
|
8599
8616
|
tabIndex: -1,
|
|
8600
8617
|
type: as === 'button' ? 'button' : undefined
|
|
8601
8618
|
}), /*#__PURE__*/React__default["default"].createElement(Box, {
|
|
8602
8619
|
padding: padding
|
|
8603
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
8620
|
+
}, /*#__PURE__*/React__default["default"].createElement(Flex, null, icon && /*#__PURE__*/React__default["default"].createElement(Text, {
|
|
8604
8621
|
size: fontSize
|
|
8605
|
-
},
|
|
8622
|
+
}, /*#__PURE__*/React.isValidElement(icon) && icon, ReactIs.isValidElementType(icon) && /*#__PURE__*/React.createElement(icon)), /*#__PURE__*/React__default["default"].createElement(Box, {
|
|
8623
|
+
flex: 1,
|
|
8624
|
+
marginLeft: icon ? space : undefined
|
|
8625
|
+
}, /*#__PURE__*/React__default["default"].createElement(Text, {
|
|
8626
|
+
size: fontSize,
|
|
8627
|
+
textOverflow: "ellipsis"
|
|
8628
|
+
}, text)), /*#__PURE__*/React__default["default"].createElement(Box, {
|
|
8629
|
+
marginLeft: space
|
|
8630
|
+
}, /*#__PURE__*/React__default["default"].createElement(Text, {
|
|
8606
8631
|
size: fontSize
|
|
8607
|
-
}, /*#__PURE__*/React__default["default"].createElement(icons.ChevronRightIcon, null))))));
|
|
8632
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons.ChevronRightIcon, null)))))));
|
|
8608
8633
|
}
|
|
8609
8634
|
|
|
8610
8635
|
var _excluded$9 = ["as", "children", "disabled", "fontSize", "hotkeys", "icon", "iconRight", "onClick", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "pressed", "radius", "selected", "space", "text", "tone"];
|
|
@@ -8646,14 +8671,14 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(props, forwardedR
|
|
|
8646
8671
|
activeElement = _useMenu.activeElement,
|
|
8647
8672
|
mount = _useMenu.mount,
|
|
8648
8673
|
onItemClick = _useMenu.onItemClick,
|
|
8649
|
-
|
|
8650
|
-
|
|
8674
|
+
onItemMouseEnter = _useMenu.onItemMouseEnter,
|
|
8675
|
+
onItemMouseLeave = _useMenu.onItemMouseLeave;
|
|
8651
8676
|
|
|
8652
8677
|
var _useState = React.useState(null),
|
|
8653
8678
|
rootElement = _useState[0],
|
|
8654
8679
|
setRootElement = _useState[1];
|
|
8655
8680
|
|
|
8656
|
-
var
|
|
8681
|
+
var active = Boolean(activeElement) && activeElement === rootElement;
|
|
8657
8682
|
React.useEffect(function () {
|
|
8658
8683
|
return mount(rootElement, selectedProp);
|
|
8659
8684
|
}, [mount, rootElement, selectedProp]);
|
|
@@ -8685,14 +8710,14 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(props, forwardedR
|
|
|
8685
8710
|
}, restProps, {
|
|
8686
8711
|
"aria-pressed": as === 'button' && pressed,
|
|
8687
8712
|
"data-pressed": as !== 'button' && pressed ? '' : undefined,
|
|
8688
|
-
"data-selected":
|
|
8713
|
+
"data-selected": active ? '' : undefined,
|
|
8689
8714
|
"data-disabled": disabled ? '' : undefined,
|
|
8690
8715
|
"$radius": radius,
|
|
8691
8716
|
"$tone": tone,
|
|
8692
8717
|
disabled: disabled,
|
|
8693
8718
|
onClick: handleClick,
|
|
8694
|
-
onMouseEnter:
|
|
8695
|
-
onMouseLeave:
|
|
8719
|
+
onMouseEnter: onItemMouseEnter,
|
|
8720
|
+
onMouseLeave: onItemMouseLeave,
|
|
8696
8721
|
padding: 0,
|
|
8697
8722
|
ref: setRef,
|
|
8698
8723
|
role: "menuitem",
|