@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.modern.js
CHANGED
|
@@ -3567,11 +3567,11 @@ function responsiveInputPaddingIconRightStyle(props) {
|
|
|
3567
3567
|
}));
|
|
3568
3568
|
}
|
|
3569
3569
|
|
|
3570
|
-
let _$
|
|
3571
|
-
_t$
|
|
3570
|
+
let _$C = t => t,
|
|
3571
|
+
_t$D,
|
|
3572
3572
|
_t2$n,
|
|
3573
3573
|
_t3$e;
|
|
3574
|
-
const ROOT_STYLE = css(_t$
|
|
3574
|
+
const ROOT_STYLE = css(_t$D || (_t$D = _$C`
|
|
3575
3575
|
&:not([hidden]) {
|
|
3576
3576
|
display: flex;
|
|
3577
3577
|
}
|
|
@@ -3586,7 +3586,7 @@ function textInputBaseStyle(props) {
|
|
|
3586
3586
|
} = props;
|
|
3587
3587
|
const font = theme.sanity.fonts.text;
|
|
3588
3588
|
const color = theme.sanity.color.input;
|
|
3589
|
-
return css(_t2$n || (_t2$n = _$
|
|
3589
|
+
return css(_t2$n || (_t2$n = _$C`
|
|
3590
3590
|
--input-fg-color: ${0};
|
|
3591
3591
|
--input-placeholder-color: ${0};
|
|
3592
3592
|
|
|
@@ -3677,7 +3677,7 @@ function textInputRepresentationStyle(props) {
|
|
|
3677
3677
|
input
|
|
3678
3678
|
} = theme.sanity;
|
|
3679
3679
|
const color = theme.sanity.color.input;
|
|
3680
|
-
return css(_t3$e || (_t3$e = _$
|
|
3680
|
+
return css(_t3$e || (_t3$e = _$C`
|
|
3681
3681
|
--card-bg-color: ${0};
|
|
3682
3682
|
--card-fg-color: ${0};
|
|
3683
3683
|
--input-box-shadow: none;
|
|
@@ -3813,8 +3813,8 @@ function responsiveShadowStyle(props) {
|
|
|
3813
3813
|
return responsive(media, getResponsiveProp(props.$shadow), shadow => shadowStyle(shadows[shadow]));
|
|
3814
3814
|
}
|
|
3815
3815
|
|
|
3816
|
-
let _$
|
|
3817
|
-
_t$
|
|
3816
|
+
let _$B = t => t,
|
|
3817
|
+
_t$C,
|
|
3818
3818
|
_t2$m,
|
|
3819
3819
|
_t3$d;
|
|
3820
3820
|
function textBaseStyle(props) {
|
|
@@ -3826,7 +3826,7 @@ function textBaseStyle(props) {
|
|
|
3826
3826
|
const {
|
|
3827
3827
|
weights
|
|
3828
3828
|
} = theme.sanity.fonts.text;
|
|
3829
|
-
return css(_t$
|
|
3829
|
+
return css(_t$C || (_t$C = _$B`
|
|
3830
3830
|
color: var(--card-fg-color);
|
|
3831
3831
|
|
|
3832
3832
|
${0}
|
|
@@ -3868,19 +3868,19 @@ function textBaseStyle(props) {
|
|
|
3868
3868
|
& [data-sanity-icon] {
|
|
3869
3869
|
vertical-align: baseline;
|
|
3870
3870
|
}
|
|
3871
|
-
`), $accent && css(_t2$m || (_t2$m = _$
|
|
3871
|
+
`), $accent && css(_t2$m || (_t2$m = _$B`
|
|
3872
3872
|
color: var(--card-accent-fg-color);
|
|
3873
|
-
`)), $muted && css(_t3$d || (_t3$d = _$
|
|
3873
|
+
`)), $muted && css(_t3$d || (_t3$d = _$B`
|
|
3874
3874
|
color: var(--card-muted-fg-color);
|
|
3875
3875
|
`)), theme.sanity.fonts.code.family, weights.bold);
|
|
3876
3876
|
}
|
|
3877
3877
|
|
|
3878
3878
|
const _excluded$G = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
3879
3879
|
|
|
3880
|
-
let _$
|
|
3881
|
-
_t$
|
|
3880
|
+
let _$A = t => t,
|
|
3881
|
+
_t$B;
|
|
3882
3882
|
const Root$E = styled.div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
|
|
3883
|
-
const SpanWithTextOverflow$2 = styled.span(_t$
|
|
3883
|
+
const SpanWithTextOverflow$2 = styled.span(_t$B || (_t$B = _$A`
|
|
3884
3884
|
display: block;
|
|
3885
3885
|
white-space: nowrap;
|
|
3886
3886
|
text-overflow: ellipsis;
|
|
@@ -4183,8 +4183,8 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4183
4183
|
}, /*#__PURE__*/React.createElement("strong", null, initials)))));
|
|
4184
4184
|
});
|
|
4185
4185
|
|
|
4186
|
-
let _$
|
|
4187
|
-
_t$
|
|
4186
|
+
let _$z = t => t,
|
|
4187
|
+
_t$A;
|
|
4188
4188
|
|
|
4189
4189
|
function responsiveAvatarCounterSizeStyle(props) {
|
|
4190
4190
|
const {
|
|
@@ -4209,7 +4209,7 @@ function avatarCounterBaseStyle(props) {
|
|
|
4209
4209
|
const {
|
|
4210
4210
|
theme
|
|
4211
4211
|
} = props;
|
|
4212
|
-
return css(_t$
|
|
4212
|
+
return css(_t$A || (_t$A = _$z`
|
|
4213
4213
|
align-items: center;
|
|
4214
4214
|
justify-content: center;
|
|
4215
4215
|
box-sizing: border-box;
|
|
@@ -4255,9 +4255,9 @@ function childrenToElementArray(children) {
|
|
|
4255
4255
|
|
|
4256
4256
|
const _excluded$E = ["children", "maxLength", "size", "tone"];
|
|
4257
4257
|
|
|
4258
|
-
let _$
|
|
4259
|
-
_t$
|
|
4260
|
-
const BASE_STYLES = css(_t$
|
|
4258
|
+
let _$y = t => t,
|
|
4259
|
+
_t$z;
|
|
4260
|
+
const BASE_STYLES = css(_t$z || (_t$z = _$y`
|
|
4261
4261
|
white-space: nowrap;
|
|
4262
4262
|
|
|
4263
4263
|
& > div {
|
|
@@ -4403,8 +4403,8 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
|
|
|
4403
4403
|
}), props.children);
|
|
4404
4404
|
});
|
|
4405
4405
|
|
|
4406
|
-
let _$
|
|
4407
|
-
_t$
|
|
4406
|
+
let _$x = t => t,
|
|
4407
|
+
_t$y,
|
|
4408
4408
|
_t2$l,
|
|
4409
4409
|
_t3$c;
|
|
4410
4410
|
function labelBaseStyle(props) {
|
|
@@ -4416,7 +4416,7 @@ function labelBaseStyle(props) {
|
|
|
4416
4416
|
const {
|
|
4417
4417
|
fonts
|
|
4418
4418
|
} = theme.sanity;
|
|
4419
|
-
return css(_t$
|
|
4419
|
+
return css(_t$y || (_t$y = _$x`
|
|
4420
4420
|
text-transform: uppercase;
|
|
4421
4421
|
|
|
4422
4422
|
${0}
|
|
@@ -4436,19 +4436,19 @@ function labelBaseStyle(props) {
|
|
|
4436
4436
|
& [data-sanity-icon] {
|
|
4437
4437
|
vertical-align: baseline;
|
|
4438
4438
|
}
|
|
4439
|
-
`), $accent && css(_t2$l || (_t2$l = _$
|
|
4439
|
+
`), $accent && css(_t2$l || (_t2$l = _$x`
|
|
4440
4440
|
color: var(--card-accent-fg-color);
|
|
4441
|
-
`)), $muted && css(_t3$c || (_t3$c = _$
|
|
4441
|
+
`)), $muted && css(_t3$c || (_t3$c = _$x`
|
|
4442
4442
|
color: var(--card-muted-fg-color);
|
|
4443
4443
|
`)), fonts.code.family);
|
|
4444
4444
|
}
|
|
4445
4445
|
|
|
4446
4446
|
const _excluded$C = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
4447
4447
|
|
|
4448
|
-
let _$
|
|
4449
|
-
_t$
|
|
4448
|
+
let _$w = t => t,
|
|
4449
|
+
_t$x;
|
|
4450
4450
|
const Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
|
|
4451
|
-
const SpanWithTextOverflow$1 = styled.span(_t$
|
|
4451
|
+
const SpanWithTextOverflow$1 = styled.span(_t$x || (_t$x = _$w`
|
|
4452
4452
|
display: block;
|
|
4453
4453
|
white-space: nowrap;
|
|
4454
4454
|
text-overflow: ellipsis;
|
|
@@ -4569,10 +4569,10 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
|
|
|
4569
4569
|
}));
|
|
4570
4570
|
});
|
|
4571
4571
|
|
|
4572
|
-
let _$
|
|
4573
|
-
_t$
|
|
4572
|
+
let _$v = t => t,
|
|
4573
|
+
_t$w,
|
|
4574
4574
|
_t2$k;
|
|
4575
|
-
const rotate$1 = keyframes(_t$
|
|
4575
|
+
const rotate$1 = keyframes(_t$w || (_t$w = _$v`
|
|
4576
4576
|
from {
|
|
4577
4577
|
transform: rotate(0deg);
|
|
4578
4578
|
}
|
|
@@ -4581,7 +4581,7 @@ const rotate$1 = keyframes(_t$x || (_t$x = _$w`
|
|
|
4581
4581
|
transform: rotate(360deg);
|
|
4582
4582
|
}
|
|
4583
4583
|
`));
|
|
4584
|
-
const Root$w = styled(Text)(_t2$k || (_t2$k = _$
|
|
4584
|
+
const Root$w = styled(Text)(_t2$k || (_t2$k = _$v`
|
|
4585
4585
|
& > span > svg {
|
|
4586
4586
|
animation: ${0} 500ms linear infinite;
|
|
4587
4587
|
}
|
|
@@ -4631,14 +4631,14 @@ function _colorVarsStyle(base, color, checkered = false) {
|
|
|
4631
4631
|
};
|
|
4632
4632
|
}
|
|
4633
4633
|
|
|
4634
|
-
let _$
|
|
4635
|
-
_t$
|
|
4634
|
+
let _$u = t => t,
|
|
4635
|
+
_t$v;
|
|
4636
4636
|
/**
|
|
4637
4637
|
* @internal
|
|
4638
4638
|
*/
|
|
4639
4639
|
|
|
4640
4640
|
function buttonBaseStyles() {
|
|
4641
|
-
return css(_t$
|
|
4641
|
+
return css(_t$v || (_t$v = _$u`
|
|
4642
4642
|
-webkit-font-smoothing: inherit;
|
|
4643
4643
|
appearance: none;
|
|
4644
4644
|
display: inline-flex;
|
|
@@ -4722,10 +4722,10 @@ function buttonColorStyles(props) {
|
|
|
4722
4722
|
|
|
4723
4723
|
const _excluded$z = ["children", "disabled", "fontSize", "icon", "iconRight", "justify", "loading", "mode", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "radius", "selected", "space", "text", "textAlign", "tone", "type"];
|
|
4724
4724
|
|
|
4725
|
-
let _$
|
|
4726
|
-
_t$
|
|
4725
|
+
let _$t = t => t,
|
|
4726
|
+
_t$u;
|
|
4727
4727
|
const Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
|
|
4728
|
-
const LoadingBox = styled.div(_t$
|
|
4728
|
+
const LoadingBox = styled.div(_t$u || (_t$u = _$t`
|
|
4729
4729
|
position: absolute;
|
|
4730
4730
|
top: 0;
|
|
4731
4731
|
left: 0;
|
|
@@ -4815,8 +4815,8 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
4815
4815
|
}, boxProps), children));
|
|
4816
4816
|
});
|
|
4817
4817
|
|
|
4818
|
-
let _$
|
|
4819
|
-
_t$
|
|
4818
|
+
let _$s = t => t,
|
|
4819
|
+
_t$t,
|
|
4820
4820
|
_t2$j,
|
|
4821
4821
|
_t3$b;
|
|
4822
4822
|
function cardStyle(props) {
|
|
@@ -4828,7 +4828,7 @@ function cardBaseStyle(props) {
|
|
|
4828
4828
|
theme
|
|
4829
4829
|
} = props;
|
|
4830
4830
|
const space = theme.sanity.space;
|
|
4831
|
-
return css(_t$
|
|
4831
|
+
return css(_t$t || (_t$t = _$s`
|
|
4832
4832
|
${0}
|
|
4833
4833
|
|
|
4834
4834
|
&[data-as='button'] {
|
|
@@ -4851,7 +4851,7 @@ function cardBaseStyle(props) {
|
|
|
4851
4851
|
&[data-as='pre'] {
|
|
4852
4852
|
font: inherit;
|
|
4853
4853
|
}
|
|
4854
|
-
`), $checkered && css(_t2$j || (_t2$j = _$
|
|
4854
|
+
`), $checkered && css(_t2$j || (_t2$j = _$s`
|
|
4855
4855
|
background-size: ${0}px ${0}px;
|
|
4856
4856
|
background-position: 50% 50%;
|
|
4857
4857
|
background-image: var(--card-bg-image);
|
|
@@ -4876,7 +4876,7 @@ function cardColorStyle(props) {
|
|
|
4876
4876
|
width: 0,
|
|
4877
4877
|
color: 'var(--card-border-color)'
|
|
4878
4878
|
};
|
|
4879
|
-
return css(_t3$b || (_t3$b = _$
|
|
4879
|
+
return css(_t3$b || (_t3$b = _$s`
|
|
4880
4880
|
${0}
|
|
4881
4881
|
|
|
4882
4882
|
background-color: var(--card-bg-color);
|
|
@@ -5032,11 +5032,11 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
5032
5032
|
})));
|
|
5033
5033
|
});
|
|
5034
5034
|
|
|
5035
|
-
let _$
|
|
5036
|
-
_t$
|
|
5035
|
+
let _$r = t => t,
|
|
5036
|
+
_t$s,
|
|
5037
5037
|
_t2$i;
|
|
5038
5038
|
function checkboxBaseStyles() {
|
|
5039
|
-
return css(_t$
|
|
5039
|
+
return css(_t$s || (_t$s = _$r`
|
|
5040
5040
|
position: relative;
|
|
5041
5041
|
display: inline-block;
|
|
5042
5042
|
`));
|
|
@@ -5051,7 +5051,7 @@ function inputElementStyles(props) {
|
|
|
5051
5051
|
input,
|
|
5052
5052
|
radius
|
|
5053
5053
|
} = theme.sanity;
|
|
5054
|
-
return css(_t2$i || (_t2$i = _$
|
|
5054
|
+
return css(_t2$i || (_t2$i = _$r`
|
|
5055
5055
|
position: absolute;
|
|
5056
5056
|
top: 0;
|
|
5057
5057
|
left: 0;
|
|
@@ -5178,8 +5178,8 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef)
|
|
|
5178
5178
|
})), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CheckmarkIcon, null), /*#__PURE__*/React.createElement(RemoveIcon, null)));
|
|
5179
5179
|
});
|
|
5180
5180
|
|
|
5181
|
-
let _$
|
|
5182
|
-
_t$
|
|
5181
|
+
let _$q = t => t,
|
|
5182
|
+
_t$r;
|
|
5183
5183
|
|
|
5184
5184
|
function codeSyntaxHighlightingStyle({
|
|
5185
5185
|
theme
|
|
@@ -5298,7 +5298,7 @@ function codeSyntaxHighlightingStyle({
|
|
|
5298
5298
|
}
|
|
5299
5299
|
|
|
5300
5300
|
function codeBaseStyle() {
|
|
5301
|
-
return css(_t$
|
|
5301
|
+
return css(_t$r || (_t$r = _$q`
|
|
5302
5302
|
color: var(--card-code-fg-color);
|
|
5303
5303
|
|
|
5304
5304
|
& code {
|
|
@@ -5431,8 +5431,8 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
|
|
|
5431
5431
|
}), children);
|
|
5432
5432
|
});
|
|
5433
5433
|
|
|
5434
|
-
let _$
|
|
5435
|
-
_t$
|
|
5434
|
+
let _$p = t => t,
|
|
5435
|
+
_t$q,
|
|
5436
5436
|
_t2$h,
|
|
5437
5437
|
_t3$a;
|
|
5438
5438
|
function headingBaseStyle(props) {
|
|
@@ -5441,7 +5441,7 @@ function headingBaseStyle(props) {
|
|
|
5441
5441
|
$muted,
|
|
5442
5442
|
theme
|
|
5443
5443
|
} = props;
|
|
5444
|
-
return css(_t$
|
|
5444
|
+
return css(_t$q || (_t$q = _$p`
|
|
5445
5445
|
${0}
|
|
5446
5446
|
|
|
5447
5447
|
${0}
|
|
@@ -5475,19 +5475,19 @@ function headingBaseStyle(props) {
|
|
|
5475
5475
|
& [data-sanity-icon] {
|
|
5476
5476
|
vertical-align: baseline;
|
|
5477
5477
|
}
|
|
5478
|
-
`), $accent && css(_t2$h || (_t2$h = _$
|
|
5478
|
+
`), $accent && css(_t2$h || (_t2$h = _$p`
|
|
5479
5479
|
color: var(--card-accent-fg-color);
|
|
5480
|
-
`)), $muted && css(_t3$a || (_t3$a = _$
|
|
5480
|
+
`)), $muted && css(_t3$a || (_t3$a = _$p`
|
|
5481
5481
|
color: var(--card-muted-fg-color);
|
|
5482
5482
|
`)), theme.sanity.fonts.code.family);
|
|
5483
5483
|
}
|
|
5484
5484
|
|
|
5485
5485
|
const _excluded$t = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
5486
5486
|
|
|
5487
|
-
let _$
|
|
5488
|
-
_t$
|
|
5487
|
+
let _$o = t => t,
|
|
5488
|
+
_t$p;
|
|
5489
5489
|
const Root$p = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
|
|
5490
|
-
const SpanWithTextOverflow = styled.span(_t$
|
|
5490
|
+
const SpanWithTextOverflow = styled.span(_t$p || (_t$p = _$o`
|
|
5491
5491
|
display: block;
|
|
5492
5492
|
white-space: nowrap;
|
|
5493
5493
|
text-overflow: ellipsis;
|
|
@@ -5582,11 +5582,11 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
|
|
|
5582
5582
|
|
|
5583
5583
|
const _excluded$r = ["children", "fontSize", "padding", "radius"];
|
|
5584
5584
|
|
|
5585
|
-
let _$
|
|
5586
|
-
_t$
|
|
5585
|
+
let _$n = t => t,
|
|
5586
|
+
_t$o;
|
|
5587
5587
|
|
|
5588
5588
|
function kbdStyle() {
|
|
5589
|
-
return css(_t$
|
|
5589
|
+
return css(_t$o || (_t$o = _$n`
|
|
5590
5590
|
background: var(--card-bg-color);
|
|
5591
5591
|
font: inherit;
|
|
5592
5592
|
box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);
|
|
@@ -5850,9 +5850,9 @@ function LayerProvider(props) {
|
|
|
5850
5850
|
const _excluded$p = ["children", "style"],
|
|
5851
5851
|
_excluded2$1 = ["children", "zOffset"];
|
|
5852
5852
|
|
|
5853
|
-
let _$
|
|
5854
|
-
_t$
|
|
5855
|
-
const Root$m = styled.div(_t$
|
|
5853
|
+
let _$m = t => t,
|
|
5854
|
+
_t$n;
|
|
5855
|
+
const Root$m = styled.div(_t$n || (_t$n = _$m`
|
|
5856
5856
|
position: relative;
|
|
5857
5857
|
`));
|
|
5858
5858
|
const LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref) {
|
|
@@ -6002,9 +6002,9 @@ function PortalProvider(props) {
|
|
|
6002
6002
|
}, children);
|
|
6003
6003
|
}
|
|
6004
6004
|
|
|
6005
|
-
let _$
|
|
6006
|
-
_t$
|
|
6007
|
-
const Root$l = styled.div(_t$
|
|
6005
|
+
let _$l = t => t,
|
|
6006
|
+
_t$m;
|
|
6007
|
+
const Root$l = styled.div(_t$m || (_t$m = _$l`
|
|
6008
6008
|
display: block;
|
|
6009
6009
|
width: 0;
|
|
6010
6010
|
height: 0;
|
|
@@ -6196,13 +6196,13 @@ function _isScrollable(el) {
|
|
|
6196
6196
|
|
|
6197
6197
|
const _excluded$o = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
|
|
6198
6198
|
|
|
6199
|
-
let _$
|
|
6200
|
-
_t$
|
|
6199
|
+
let _$k = t => t,
|
|
6200
|
+
_t$l,
|
|
6201
6201
|
_t2$g;
|
|
6202
|
-
const Root$k = styled.div(_t$
|
|
6202
|
+
const Root$k = styled.div(_t$l || (_t$l = _$k`
|
|
6203
6203
|
position: relative;
|
|
6204
6204
|
`));
|
|
6205
|
-
const ItemWrapper = styled.div(_t2$g || (_t2$g = _$
|
|
6205
|
+
const ItemWrapper = styled.div(_t2$g || (_t2$g = _$k`
|
|
6206
6206
|
position: absolute;
|
|
6207
6207
|
left: 0;
|
|
6208
6208
|
right: 0;
|
|
@@ -6340,11 +6340,11 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
|
|
|
6340
6340
|
}, children));
|
|
6341
6341
|
});
|
|
6342
6342
|
|
|
6343
|
-
let _$
|
|
6344
|
-
_t$
|
|
6343
|
+
let _$j = t => t,
|
|
6344
|
+
_t$k,
|
|
6345
6345
|
_t2$f,
|
|
6346
6346
|
_t3$9;
|
|
6347
|
-
const Root$j = styled.div(_t$
|
|
6347
|
+
const Root$j = styled.div(_t$k || (_t$k = _$j`
|
|
6348
6348
|
position: absolute;
|
|
6349
6349
|
pointer-events: none;
|
|
6350
6350
|
width: 27px;
|
|
@@ -6388,10 +6388,10 @@ const Root$j = styled.div(_t$l || (_t$l = _$k`
|
|
|
6388
6388
|
}
|
|
6389
6389
|
}
|
|
6390
6390
|
`));
|
|
6391
|
-
const BorderPath = styled.path(_t2$f || (_t2$f = _$
|
|
6391
|
+
const BorderPath = styled.path(_t2$f || (_t2$f = _$j`
|
|
6392
6392
|
fill: var(--card-shadow-outline-color);
|
|
6393
6393
|
`));
|
|
6394
|
-
const ShapePath = styled.path(_t3$9 || (_t3$9 = _$
|
|
6394
|
+
const ShapePath = styled.path(_t3$9 || (_t3$9 = _$j`
|
|
6395
6395
|
fill: var(--card-bg-color);
|
|
6396
6396
|
`));
|
|
6397
6397
|
const PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
|
|
@@ -6588,12 +6588,12 @@ function usePopoverModifiers(props) {
|
|
|
6588
6588
|
const _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"];
|
|
6589
6589
|
|
|
6590
6590
|
let _2 = t => t,
|
|
6591
|
-
_t$
|
|
6591
|
+
_t$j,
|
|
6592
6592
|
_t2$e,
|
|
6593
6593
|
_t3$8;
|
|
6594
6594
|
const Root$i = styled(Layer)(({
|
|
6595
6595
|
$preventOverflow
|
|
6596
|
-
}) => css(_t$
|
|
6596
|
+
}) => css(_t$j || (_t$j = _2`
|
|
6597
6597
|
pointer-events: none;
|
|
6598
6598
|
display: flex;
|
|
6599
6599
|
flex-direction: column;
|
|
@@ -6754,11 +6754,11 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6754
6754
|
}, node), !portalProp && node));
|
|
6755
6755
|
});
|
|
6756
6756
|
|
|
6757
|
-
let _$
|
|
6758
|
-
_t$
|
|
6757
|
+
let _$i = t => t,
|
|
6758
|
+
_t$i,
|
|
6759
6759
|
_t2$d;
|
|
6760
6760
|
function radioBaseStyle() {
|
|
6761
|
-
return css(_t$
|
|
6761
|
+
return css(_t$i || (_t$i = _$i`
|
|
6762
6762
|
position: relative;
|
|
6763
6763
|
|
|
6764
6764
|
&:not([hidden]) {
|
|
@@ -6780,7 +6780,7 @@ function inputElementStyle(props) {
|
|
|
6780
6780
|
} = theme.sanity;
|
|
6781
6781
|
const color = theme.sanity.color.input;
|
|
6782
6782
|
const dist = (input.radio.size - input.radio.markSize) / 2;
|
|
6783
|
-
return css(_t2$d || (_t2$d = _$
|
|
6783
|
+
return css(_t2$d || (_t2$d = _$i`
|
|
6784
6784
|
appearance: none;
|
|
6785
6785
|
position: absolute;
|
|
6786
6786
|
top: 0;
|
|
@@ -6898,14 +6898,14 @@ const Radio = /*#__PURE__*/forwardRef(function Radio(props, forwardedRef) {
|
|
|
6898
6898
|
})), /*#__PURE__*/React.createElement("span", null));
|
|
6899
6899
|
});
|
|
6900
6900
|
|
|
6901
|
-
let _$
|
|
6902
|
-
_t$
|
|
6901
|
+
let _$h = t => t,
|
|
6902
|
+
_t$h,
|
|
6903
6903
|
_t2$c,
|
|
6904
6904
|
_t3$7,
|
|
6905
6905
|
_t4$5;
|
|
6906
6906
|
|
|
6907
6907
|
function rootStyle() {
|
|
6908
|
-
return css(_t$
|
|
6908
|
+
return css(_t$h || (_t$h = _$h`
|
|
6909
6909
|
position: relative;
|
|
6910
6910
|
width: stretch;
|
|
6911
6911
|
|
|
@@ -6920,7 +6920,7 @@ function inputBaseStyle(props) {
|
|
|
6920
6920
|
theme
|
|
6921
6921
|
} = props;
|
|
6922
6922
|
const font = theme.sanity.fonts.text;
|
|
6923
|
-
return css(_t2$c || (_t2$c = _$
|
|
6923
|
+
return css(_t2$c || (_t2$c = _$h`
|
|
6924
6924
|
-webkit-font-smoothing: antialiased;
|
|
6925
6925
|
appearance: none;
|
|
6926
6926
|
border: 0;
|
|
@@ -6945,7 +6945,7 @@ function inputColorStyle(props) {
|
|
|
6945
6945
|
input
|
|
6946
6946
|
} = theme.sanity;
|
|
6947
6947
|
const color = theme.sanity.color.input;
|
|
6948
|
-
return css(_t3$7 || (_t3$7 = _$
|
|
6948
|
+
return css(_t3$7 || (_t3$7 = _$h`
|
|
6949
6949
|
/* enabled */
|
|
6950
6950
|
background-color: ${0};
|
|
6951
6951
|
color: ${0};
|
|
@@ -7026,7 +7026,7 @@ function iconBoxStyle(props) {
|
|
|
7026
7026
|
theme
|
|
7027
7027
|
} = props;
|
|
7028
7028
|
const color = theme.sanity.color.input;
|
|
7029
|
-
return css(_t4$5 || (_t4$5 = _$
|
|
7029
|
+
return css(_t4$5 || (_t4$5 = _$h`
|
|
7030
7030
|
pointer-events: none;
|
|
7031
7031
|
position: absolute;
|
|
7032
7032
|
top: 0;
|
|
@@ -7151,8 +7151,8 @@ const Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
|
|
|
7151
7151
|
}));
|
|
7152
7152
|
});
|
|
7153
7153
|
|
|
7154
|
-
let _$
|
|
7155
|
-
_t$
|
|
7154
|
+
let _$g = t => t,
|
|
7155
|
+
_t$g,
|
|
7156
7156
|
_t2$b,
|
|
7157
7157
|
_t3$6,
|
|
7158
7158
|
_t4$4,
|
|
@@ -7162,7 +7162,7 @@ let _$h = t => t,
|
|
|
7162
7162
|
/* Root */
|
|
7163
7163
|
|
|
7164
7164
|
function switchBaseStyles() {
|
|
7165
|
-
return css(_t$
|
|
7165
|
+
return css(_t$g || (_t$g = _$g`
|
|
7166
7166
|
position: relative;
|
|
7167
7167
|
&:not([hidden]) {
|
|
7168
7168
|
display: inline-block;
|
|
@@ -7173,7 +7173,7 @@ function switchBaseStyles() {
|
|
|
7173
7173
|
|
|
7174
7174
|
function switchInputStyles() {
|
|
7175
7175
|
// Visually hide the input element while keeping it interactive
|
|
7176
|
-
return css(_t2$b || (_t2$b = _$
|
|
7176
|
+
return css(_t2$b || (_t2$b = _$g`
|
|
7177
7177
|
position: absolute;
|
|
7178
7178
|
top: 0;
|
|
7179
7179
|
right: 0;
|
|
@@ -7201,7 +7201,7 @@ function switchRepresentationStyles(props) {
|
|
|
7201
7201
|
input
|
|
7202
7202
|
} = theme.sanity;
|
|
7203
7203
|
const color = theme.sanity.color.button.default;
|
|
7204
|
-
return css(_t3$6 || (_t3$6 = _$
|
|
7204
|
+
return css(_t3$6 || (_t3$6 = _$g`
|
|
7205
7205
|
--switch-bg-color: ${0};
|
|
7206
7206
|
--switch-fg-color: ${0};
|
|
7207
7207
|
--switch-box-shadow: none;
|
|
@@ -7273,7 +7273,7 @@ function switchTrackStyles(props) {
|
|
|
7273
7273
|
const {
|
|
7274
7274
|
input
|
|
7275
7275
|
} = theme.sanity;
|
|
7276
|
-
return css(_t4$4 || (_t4$4 = _$
|
|
7276
|
+
return css(_t4$4 || (_t4$4 = _$g`
|
|
7277
7277
|
&:not([hidden]) {
|
|
7278
7278
|
display: block;
|
|
7279
7279
|
}
|
|
@@ -7303,7 +7303,7 @@ function switchThumbStyles(props) {
|
|
|
7303
7303
|
const checkedOffset = trackWidth - trackPadding * 2 - size;
|
|
7304
7304
|
const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
|
|
7305
7305
|
const checked = $indeterminate !== true && props.$checked === true;
|
|
7306
|
-
return css(_t5$3 || (_t5$3 = _$
|
|
7306
|
+
return css(_t5$3 || (_t5$3 = _$g`
|
|
7307
7307
|
&:not([hidden]) {
|
|
7308
7308
|
display: block;
|
|
7309
7309
|
}
|
|
@@ -7322,9 +7322,9 @@ function switchThumbStyles(props) {
|
|
|
7322
7322
|
${0}
|
|
7323
7323
|
|
|
7324
7324
|
${0}
|
|
7325
|
-
`), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$1 || (_t6$1 = _$
|
|
7325
|
+
`), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$1 || (_t6$1 = _$g`
|
|
7326
7326
|
transform: translate3d(${0}px, 0, 0);
|
|
7327
|
-
`), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$
|
|
7327
|
+
`), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$g`
|
|
7328
7328
|
transform: translate3d(${0}px, 0, 0);
|
|
7329
7329
|
`), indeterminateOffset));
|
|
7330
7330
|
}
|
|
@@ -7379,10 +7379,10 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
|
|
|
7379
7379
|
|
|
7380
7380
|
const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"];
|
|
7381
7381
|
|
|
7382
|
-
let _$
|
|
7383
|
-
_t$
|
|
7382
|
+
let _$f = t => t,
|
|
7383
|
+
_t$f;
|
|
7384
7384
|
const Root$d = styled.span(textInputRootStyle);
|
|
7385
|
-
const InputRoot$1 = styled.span(_t$
|
|
7385
|
+
const InputRoot$1 = styled.span(_t$f || (_t$f = _$f`
|
|
7386
7386
|
flex: 1;
|
|
7387
7387
|
min-width: 0;
|
|
7388
7388
|
display: block;
|
|
@@ -7424,8 +7424,8 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
|
|
|
7424
7424
|
|
|
7425
7425
|
const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"];
|
|
7426
7426
|
|
|
7427
|
-
let _$
|
|
7428
|
-
_t$
|
|
7427
|
+
let _$e = t => t,
|
|
7428
|
+
_t$e,
|
|
7429
7429
|
_t2$a,
|
|
7430
7430
|
_t3$5,
|
|
7431
7431
|
_t4$3,
|
|
@@ -7434,7 +7434,7 @@ const CLEAR_BUTTON_BOX_STYLE = {
|
|
|
7434
7434
|
zIndex: 2
|
|
7435
7435
|
};
|
|
7436
7436
|
const Root$c = styled.span(textInputRootStyle);
|
|
7437
|
-
const InputRoot = styled.span(_t$
|
|
7437
|
+
const InputRoot = styled.span(_t$e || (_t$e = _$e`
|
|
7438
7438
|
flex: 1;
|
|
7439
7439
|
min-width: 0;
|
|
7440
7440
|
display: block;
|
|
@@ -7442,7 +7442,7 @@ const InputRoot = styled.span(_t$f || (_t$f = _$f`
|
|
|
7442
7442
|
`));
|
|
7443
7443
|
const Prefix = styled(Card).attrs({
|
|
7444
7444
|
forwardedAs: 'span'
|
|
7445
|
-
})(_t2$a || (_t2$a = _$
|
|
7445
|
+
})(_t2$a || (_t2$a = _$e`
|
|
7446
7446
|
border-top-right-radius: 0;
|
|
7447
7447
|
border-bottom-right-radius: 0;
|
|
7448
7448
|
|
|
@@ -7453,7 +7453,7 @@ const Prefix = styled(Card).attrs({
|
|
|
7453
7453
|
`));
|
|
7454
7454
|
const Suffix = styled(Card).attrs({
|
|
7455
7455
|
forwardedAs: 'span'
|
|
7456
|
-
})(_t3$5 || (_t3$5 = _$
|
|
7456
|
+
})(_t3$5 || (_t3$5 = _$e`
|
|
7457
7457
|
border-top-left-radius: 0;
|
|
7458
7458
|
border-bottom-left-radius: 0;
|
|
7459
7459
|
|
|
@@ -7464,12 +7464,12 @@ const Suffix = styled(Card).attrs({
|
|
|
7464
7464
|
`));
|
|
7465
7465
|
const Input = styled.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
|
|
7466
7466
|
const Presentation = styled.span(responsiveRadiusStyle, textInputRepresentationStyle);
|
|
7467
|
-
const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$
|
|
7467
|
+
const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$e`
|
|
7468
7468
|
position: absolute;
|
|
7469
7469
|
top: 0;
|
|
7470
7470
|
left: 0;
|
|
7471
7471
|
`));
|
|
7472
|
-
const RightCard = styled(Card)(_t5$2 || (_t5$2 = _$
|
|
7472
|
+
const RightCard = styled(Card)(_t5$2 || (_t5$2 = _$e`
|
|
7473
7473
|
background-color: transparent;
|
|
7474
7474
|
position: absolute;
|
|
7475
7475
|
top: 0;
|
|
@@ -7593,11 +7593,11 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7593
7593
|
})), presentationNode, clearButtonNode), suffixNode);
|
|
7594
7594
|
});
|
|
7595
7595
|
|
|
7596
|
-
let _$
|
|
7597
|
-
_t$
|
|
7596
|
+
let _$d = t => t,
|
|
7597
|
+
_t$d,
|
|
7598
7598
|
_t2$9,
|
|
7599
7599
|
_t3$4;
|
|
7600
|
-
const Root$b = styled.div(_t$
|
|
7600
|
+
const Root$b = styled.div(_t$d || (_t$d = _$d`
|
|
7601
7601
|
position: absolute;
|
|
7602
7602
|
width: 15px;
|
|
7603
7603
|
height: 15px;
|
|
@@ -7642,10 +7642,10 @@ const Root$b = styled.div(_t$e || (_t$e = _$e`
|
|
|
7642
7642
|
}
|
|
7643
7643
|
}
|
|
7644
7644
|
`));
|
|
7645
|
-
const Border = styled.path(_t2$9 || (_t2$9 = _$
|
|
7645
|
+
const Border = styled.path(_t2$9 || (_t2$9 = _$d`
|
|
7646
7646
|
fill: var(--card-shadow-outline-color);
|
|
7647
7647
|
`));
|
|
7648
|
-
const Shape = styled.path(_t3$4 || (_t3$4 = _$
|
|
7648
|
+
const Shape = styled.path(_t3$4 || (_t3$4 = _$d`
|
|
7649
7649
|
fill: var(--card-bg-color);
|
|
7650
7650
|
`));
|
|
7651
7651
|
const TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
|
|
@@ -7666,9 +7666,9 @@ const TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
|
|
|
7666
7666
|
|
|
7667
7667
|
const _excluded$g = ["allowedAutoPlacements", "boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "zOffset"];
|
|
7668
7668
|
|
|
7669
|
-
let _$
|
|
7670
|
-
_t$
|
|
7671
|
-
const Root$a = styled(Layer)(_t$
|
|
7669
|
+
let _$c = t => t,
|
|
7670
|
+
_t$c;
|
|
7671
|
+
const Root$a = styled(Layer)(_t$c || (_t$c = _$c`
|
|
7672
7672
|
pointer-events: none;
|
|
7673
7673
|
`));
|
|
7674
7674
|
/**
|
|
@@ -7802,8 +7802,8 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7802
7802
|
}, popperNode), !portal && popperNode));
|
|
7803
7803
|
});
|
|
7804
7804
|
|
|
7805
|
-
let _$
|
|
7806
|
-
_t$
|
|
7805
|
+
let _$b = t => t,
|
|
7806
|
+
_t$b,
|
|
7807
7807
|
_t2$8,
|
|
7808
7808
|
_t3$3,
|
|
7809
7809
|
_t4$2,
|
|
@@ -7812,14 +7812,14 @@ let _$c = t => t,
|
|
|
7812
7812
|
* @internal
|
|
7813
7813
|
*/
|
|
7814
7814
|
|
|
7815
|
-
const Root$9 = styled.div(_t$
|
|
7815
|
+
const Root$9 = styled.div(_t$b || (_t$b = _$b`
|
|
7816
7816
|
/* position: relative; */
|
|
7817
7817
|
`));
|
|
7818
7818
|
/**
|
|
7819
7819
|
* @internal
|
|
7820
7820
|
*/
|
|
7821
7821
|
|
|
7822
|
-
const ListBox = styled(Box)(_t2$8 || (_t2$8 = _$
|
|
7822
|
+
const ListBox = styled(Box)(_t2$8 || (_t2$8 = _$b`
|
|
7823
7823
|
& > ul {
|
|
7824
7824
|
list-style: none;
|
|
7825
7825
|
padding: 0;
|
|
@@ -7830,7 +7830,7 @@ const ListBox = styled(Box)(_t2$8 || (_t2$8 = _$c`
|
|
|
7830
7830
|
* @internal
|
|
7831
7831
|
*/
|
|
7832
7832
|
|
|
7833
|
-
const ResultsPopover = styled(Popover)(_t3$3 || (_t3$3 = _$
|
|
7833
|
+
const ResultsPopover = styled(Popover)(_t3$3 || (_t3$3 = _$b`
|
|
7834
7834
|
& > div {
|
|
7835
7835
|
overflow: auto;
|
|
7836
7836
|
-webkit-overflow-scrolling: touch;
|
|
@@ -7840,7 +7840,7 @@ const ResultsPopover = styled(Popover)(_t3$3 || (_t3$3 = _$c`
|
|
|
7840
7840
|
display: none;
|
|
7841
7841
|
}
|
|
7842
7842
|
`));
|
|
7843
|
-
const rotate = keyframes(_t4$2 || (_t4$2 = _$
|
|
7843
|
+
const rotate = keyframes(_t4$2 || (_t4$2 = _$b`
|
|
7844
7844
|
from {
|
|
7845
7845
|
transform: rotate(0deg);
|
|
7846
7846
|
}
|
|
@@ -7853,7 +7853,7 @@ const rotate = keyframes(_t4$2 || (_t4$2 = _$c`
|
|
|
7853
7853
|
* @internal
|
|
7854
7854
|
*/
|
|
7855
7855
|
|
|
7856
|
-
const AnimatedSpinnerIcon = styled(SpinnerIcon)(_t5$1 || (_t5$1 = _$
|
|
7856
|
+
const AnimatedSpinnerIcon = styled(SpinnerIcon)(_t5$1 || (_t5$1 = _$b`
|
|
7857
7857
|
animation: ${0} 500ms linear infinite;
|
|
7858
7858
|
`), rotate);
|
|
7859
7859
|
|
|
@@ -8397,7 +8397,9 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
|
|
|
8397
8397
|
return renderPopover({
|
|
8398
8398
|
content,
|
|
8399
8399
|
hidden: !expanded,
|
|
8400
|
-
inputElement: inputElementRef.current
|
|
8400
|
+
inputElement: inputElementRef.current,
|
|
8401
|
+
onMouseEnter: handlePopoverMouseEnter,
|
|
8402
|
+
onMouseLeave: handlePopoverMouseLeave
|
|
8401
8403
|
}, setResultsPopoverElement);
|
|
8402
8404
|
}
|
|
8403
8405
|
|
|
@@ -8436,10 +8438,10 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
|
|
|
8436
8438
|
|
|
8437
8439
|
const Autocomplete = InnerAutocomplete;
|
|
8438
8440
|
|
|
8439
|
-
let _$
|
|
8440
|
-
_t$
|
|
8441
|
+
let _$a = t => t,
|
|
8442
|
+
_t$a,
|
|
8441
8443
|
_t2$7;
|
|
8442
|
-
const Root$8 = styled.ol(_t$
|
|
8444
|
+
const Root$8 = styled.ol(_t$a || (_t$a = _$a`
|
|
8443
8445
|
margin: 0;
|
|
8444
8446
|
padding: 0;
|
|
8445
8447
|
display: flex;
|
|
@@ -8448,7 +8450,7 @@ const Root$8 = styled.ol(_t$b || (_t$b = _$b`
|
|
|
8448
8450
|
white-space: nowrap;
|
|
8449
8451
|
line-height: 0;
|
|
8450
8452
|
`));
|
|
8451
|
-
const ExpandButton = styled(Button)(_t2$7 || (_t2$7 = _$
|
|
8453
|
+
const ExpandButton = styled(Button)(_t2$7 || (_t2$7 = _$a`
|
|
8452
8454
|
appearance: none;
|
|
8453
8455
|
margin: -4px;
|
|
8454
8456
|
`));
|
|
@@ -8578,15 +8580,15 @@ function useDialog() {
|
|
|
8578
8580
|
|
|
8579
8581
|
const _excluded$d = ["__unstable_autoFocus", "__unstable_hideCloseButton", "cardRadius", "cardShadow", "children", "contentRef", "footer", "header", "id", "onClickOutside", "onClose", "padding", "portal", "position", "scheme", "width", "zOffset"];
|
|
8580
8582
|
|
|
8581
|
-
let _$
|
|
8582
|
-
_t$
|
|
8583
|
+
let _$9 = t => t,
|
|
8584
|
+
_t$9,
|
|
8583
8585
|
_t2$6,
|
|
8584
8586
|
_t3$2,
|
|
8585
8587
|
_t4$1,
|
|
8586
8588
|
_t5,
|
|
8587
8589
|
_t6;
|
|
8588
8590
|
const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDialogPositionStyle);
|
|
8589
|
-
const DialogContainer = styled(Container)(_t$
|
|
8591
|
+
const DialogContainer = styled(Container)(_t$9 || (_t$9 = _$9`
|
|
8590
8592
|
&:not([hidden]) {
|
|
8591
8593
|
display: flex;
|
|
8592
8594
|
}
|
|
@@ -8596,7 +8598,7 @@ const DialogContainer = styled(Container)(_t$a || (_t$a = _$a`
|
|
|
8596
8598
|
align-items: center;
|
|
8597
8599
|
justify-content: center;
|
|
8598
8600
|
`));
|
|
8599
|
-
const DialogCardRoot = styled(Card)(_t2$6 || (_t2$6 = _$
|
|
8601
|
+
const DialogCardRoot = styled(Card)(_t2$6 || (_t2$6 = _$9`
|
|
8600
8602
|
&:not([hidden]) {
|
|
8601
8603
|
display: flex;
|
|
8602
8604
|
}
|
|
@@ -8605,12 +8607,12 @@ const DialogCardRoot = styled(Card)(_t2$6 || (_t2$6 = _$a`
|
|
|
8605
8607
|
max-height: 100%;
|
|
8606
8608
|
overflow: hidden;
|
|
8607
8609
|
`));
|
|
8608
|
-
const DialogLayout = styled(Flex)(_t3$2 || (_t3$2 = _$
|
|
8610
|
+
const DialogLayout = styled(Flex)(_t3$2 || (_t3$2 = _$9`
|
|
8609
8611
|
flex: 1;
|
|
8610
8612
|
min-height: 0;
|
|
8611
8613
|
width: 100%;
|
|
8612
8614
|
`));
|
|
8613
|
-
const DialogHeader = styled(Card)(_t4$1 || (_t4$1 = _$
|
|
8615
|
+
const DialogHeader = styled(Card)(_t4$1 || (_t4$1 = _$9`
|
|
8614
8616
|
position: relative;
|
|
8615
8617
|
z-index: 2;
|
|
8616
8618
|
|
|
@@ -8624,13 +8626,13 @@ const DialogHeader = styled(Card)(_t4$1 || (_t4$1 = _$a`
|
|
|
8624
8626
|
border-bottom: 1px solid var(--card-hairline-soft-color);
|
|
8625
8627
|
}
|
|
8626
8628
|
`));
|
|
8627
|
-
const DialogContent = styled(Box)(_t5 || (_t5 = _$
|
|
8629
|
+
const DialogContent = styled(Box)(_t5 || (_t5 = _$9`
|
|
8628
8630
|
position: relative;
|
|
8629
8631
|
z-index: 1;
|
|
8630
8632
|
overflow: auto;
|
|
8631
8633
|
outline: none;
|
|
8632
8634
|
`));
|
|
8633
|
-
const DialogFooter = styled(Box)(_t6 || (_t6 = _$
|
|
8635
|
+
const DialogFooter = styled(Box)(_t6 || (_t6 = _$9`
|
|
8634
8636
|
position: relative;
|
|
8635
8637
|
z-index: 3;
|
|
8636
8638
|
border-top: 1px solid var(--card-hairline-soft-color);
|
|
@@ -8832,16 +8834,16 @@ function DialogProvider(props) {
|
|
|
8832
8834
|
|
|
8833
8835
|
const _excluded$c = ["fontSize", "keys", "padding", "radius", "space"];
|
|
8834
8836
|
|
|
8835
|
-
let _$
|
|
8836
|
-
_t$
|
|
8837
|
+
let _$8 = t => t,
|
|
8838
|
+
_t$8,
|
|
8837
8839
|
_t2$5;
|
|
8838
|
-
const Root$6 = styled.kbd(_t$
|
|
8840
|
+
const Root$6 = styled.kbd(_t$8 || (_t$8 = _$8`
|
|
8839
8841
|
&:not([hidden]) {
|
|
8840
8842
|
display: block;
|
|
8841
8843
|
}
|
|
8842
8844
|
font: inherit;
|
|
8843
8845
|
`));
|
|
8844
|
-
const Key = styled(KBD)(_t2$5 || (_t2$5 = _$
|
|
8846
|
+
const Key = styled(KBD)(_t2$5 || (_t2$5 = _$8`
|
|
8845
8847
|
&:not([hidden]) {
|
|
8846
8848
|
display: block;
|
|
8847
8849
|
}
|
|
@@ -8879,6 +8881,10 @@ const Hotkeys = /*#__PURE__*/forwardRef(function Hotkeys(props, ref) {
|
|
|
8879
8881
|
}, key))));
|
|
8880
8882
|
});
|
|
8881
8883
|
|
|
8884
|
+
const key$2 = Symbol.for('@sanity/ui/context/menu');
|
|
8885
|
+
globalScope[key$2] = globalScope[key$2] || /*#__PURE__*/createContext(null);
|
|
8886
|
+
const MenuContext = globalScope[key$2];
|
|
8887
|
+
|
|
8882
8888
|
/**
|
|
8883
8889
|
* @internal
|
|
8884
8890
|
*/
|
|
@@ -8953,52 +8959,29 @@ function _sortElements(rootElement, elements) {
|
|
|
8953
8959
|
elements.sort(_sort);
|
|
8954
8960
|
}
|
|
8955
8961
|
|
|
8956
|
-
const key$2 = Symbol.for('@sanity/ui/context/menu');
|
|
8957
|
-
globalScope[key$2] = globalScope[key$2] || /*#__PURE__*/createContext(null);
|
|
8958
|
-
const MenuContext = globalScope[key$2];
|
|
8959
|
-
|
|
8960
|
-
const _excluded$b = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"];
|
|
8961
|
-
|
|
8962
|
-
let _$8 = t => t,
|
|
8963
|
-
_t$8;
|
|
8964
|
-
const Root$5 = styled(Box)(_t$8 || (_t$8 = _$8`
|
|
8965
|
-
outline: none;
|
|
8966
|
-
overflow: auto;
|
|
8967
|
-
`));
|
|
8968
8962
|
/**
|
|
8969
|
-
*
|
|
8963
|
+
* This controller is responsible for controlling UI menu state.
|
|
8964
|
+
*
|
|
8965
|
+
* @internal
|
|
8970
8966
|
*/
|
|
8971
8967
|
|
|
8972
|
-
|
|
8968
|
+
function useMenuController(props) {
|
|
8973
8969
|
const {
|
|
8974
|
-
children,
|
|
8975
|
-
onClickOutside,
|
|
8976
|
-
onEscape,
|
|
8977
|
-
onItemClick,
|
|
8978
|
-
onItemSelect,
|
|
8979
8970
|
onKeyDown,
|
|
8980
8971
|
originElement,
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
shouldFocus = props.focusFirst && 'first' || props.focusLast && 'last' || null,
|
|
8984
|
-
space = 1
|
|
8985
|
-
} = props,
|
|
8986
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
8987
|
-
|
|
8988
|
-
const {
|
|
8989
|
-
isTopLayer
|
|
8990
|
-
} = useLayer();
|
|
8991
|
-
const [rootElement, setRootElement] = useState(null);
|
|
8972
|
+
shouldFocus
|
|
8973
|
+
} = props;
|
|
8992
8974
|
const elementsRef = useRef([]);
|
|
8993
|
-
const [
|
|
8994
|
-
const
|
|
8975
|
+
const [rootElement, setRootElement] = useState(null);
|
|
8976
|
+
const [activeIndex, _setActiveIndex] = useState(-1);
|
|
8995
8977
|
const activeElement = elementsRef.current[activeIndex] || null;
|
|
8996
|
-
const
|
|
8978
|
+
const activeIndexRef = useRef(activeIndex);
|
|
8997
8979
|
const mounted = Boolean(rootElement);
|
|
8998
|
-
const
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
8980
|
+
const setActiveIndex = useCallback(nextActiveIndex => {
|
|
8981
|
+
_setActiveIndex(nextActiveIndex);
|
|
8982
|
+
|
|
8983
|
+
activeIndexRef.current = nextActiveIndex;
|
|
8984
|
+
}, []);
|
|
9002
8985
|
const mount = useCallback((element, selected) => {
|
|
9003
8986
|
if (!element) return () => undefined;
|
|
9004
8987
|
|
|
@@ -9011,7 +8994,6 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9011
8994
|
if (selected) {
|
|
9012
8995
|
const selectedIndex = elementsRef.current.indexOf(element);
|
|
9013
8996
|
setActiveIndex(selectedIndex);
|
|
9014
|
-
activeIndexRef.current = selectedIndex;
|
|
9015
8997
|
}
|
|
9016
8998
|
|
|
9017
8999
|
return () => {
|
|
@@ -9021,7 +9003,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9021
9003
|
elementsRef.current.splice(idx, 1);
|
|
9022
9004
|
}
|
|
9023
9005
|
};
|
|
9024
|
-
}, [rootElement]);
|
|
9006
|
+
}, [rootElement, setActiveIndex]);
|
|
9025
9007
|
const handleKeyDown = useCallback(event => {
|
|
9026
9008
|
// Move focus to the element that opened the menu before handling the `Tab` press
|
|
9027
9009
|
if (event.key === 'Tab') {
|
|
@@ -9043,7 +9025,6 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9043
9025
|
if (!el) return;
|
|
9044
9026
|
const currentIndex = elementsRef.current.indexOf(el);
|
|
9045
9027
|
setActiveIndex(currentIndex);
|
|
9046
|
-
activeIndexRef.current = currentIndex;
|
|
9047
9028
|
return;
|
|
9048
9029
|
} // Move focus to the last focusable menuitem
|
|
9049
9030
|
|
|
@@ -9058,7 +9039,6 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9058
9039
|
if (!el) return;
|
|
9059
9040
|
const currentIndex = elementsRef.current.indexOf(el);
|
|
9060
9041
|
setActiveIndex(currentIndex);
|
|
9061
|
-
activeIndexRef.current = currentIndex;
|
|
9062
9042
|
return;
|
|
9063
9043
|
}
|
|
9064
9044
|
|
|
@@ -9076,7 +9056,6 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9076
9056
|
const el = focusableElements[focusedIndex];
|
|
9077
9057
|
const currentIndex = elementsRef.current.indexOf(el);
|
|
9078
9058
|
setActiveIndex(currentIndex);
|
|
9079
|
-
activeIndexRef.current = currentIndex;
|
|
9080
9059
|
return;
|
|
9081
9060
|
}
|
|
9082
9061
|
|
|
@@ -9094,32 +9073,22 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9094
9073
|
const el = focusableElements[focusedIndex];
|
|
9095
9074
|
const currentIndex = elementsRef.current.indexOf(el);
|
|
9096
9075
|
setActiveIndex(currentIndex);
|
|
9097
|
-
activeIndexRef.current = currentIndex;
|
|
9098
9076
|
return;
|
|
9099
9077
|
}
|
|
9100
9078
|
|
|
9101
9079
|
if (onKeyDown) {
|
|
9102
9080
|
onKeyDown(event);
|
|
9103
9081
|
}
|
|
9104
|
-
}, [activeIndex, onKeyDown, originElement]);
|
|
9082
|
+
}, [activeIndex, onKeyDown, originElement, setActiveIndex]);
|
|
9105
9083
|
const handleItemMouseEnter = useCallback(event => {
|
|
9106
9084
|
const element = event.currentTarget;
|
|
9107
9085
|
const currentIndex = elementsRef.current.indexOf(element);
|
|
9108
9086
|
setActiveIndex(currentIndex);
|
|
9109
|
-
|
|
9110
|
-
}, []);
|
|
9087
|
+
}, [setActiveIndex]);
|
|
9111
9088
|
const handleItemMouseLeave = useCallback(() => {
|
|
9112
9089
|
rootElement == null ? void 0 : rootElement.focus();
|
|
9113
9090
|
setActiveIndex(-1);
|
|
9114
|
-
|
|
9115
|
-
}, [rootElement]); // Trigger `onItemSelect` when active index changes
|
|
9116
|
-
|
|
9117
|
-
useEffect(() => {
|
|
9118
|
-
if (onItemSelect) onItemSelect(activeIndex);
|
|
9119
|
-
}, [activeIndex, onItemSelect]);
|
|
9120
|
-
useEffect(() => {
|
|
9121
|
-
activeElementRef.current = activeElement;
|
|
9122
|
-
}, [activeElement]); // Set focus on the currently active element
|
|
9091
|
+
}, [rootElement, setActiveIndex]); // Set focus on the currently active element
|
|
9123
9092
|
|
|
9124
9093
|
useEffect(() => {
|
|
9125
9094
|
if (!mounted) return;
|
|
@@ -9160,8 +9129,76 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9160
9129
|
return () => {
|
|
9161
9130
|
window.cancelAnimationFrame(rafId);
|
|
9162
9131
|
};
|
|
9163
|
-
}, [activeIndex, mounted, shouldFocus]);
|
|
9164
|
-
|
|
9132
|
+
}, [activeIndex, mounted, setActiveIndex, shouldFocus]);
|
|
9133
|
+
return {
|
|
9134
|
+
activeElement,
|
|
9135
|
+
activeIndex,
|
|
9136
|
+
handleItemMouseEnter,
|
|
9137
|
+
handleItemMouseLeave,
|
|
9138
|
+
handleKeyDown,
|
|
9139
|
+
mount,
|
|
9140
|
+
rootElement,
|
|
9141
|
+
setRootElement
|
|
9142
|
+
};
|
|
9143
|
+
}
|
|
9144
|
+
|
|
9145
|
+
const _excluded$b = ["children", "focusFirst", "focusLast", "onClickOutside", "onEscape", "onItemClick", "onItemSelect", "onKeyDown", "originElement", "padding", "registerElement", "shouldFocus", "space"];
|
|
9146
|
+
|
|
9147
|
+
let _$7 = t => t,
|
|
9148
|
+
_t$7;
|
|
9149
|
+
const Root$5 = styled(Box)(_t$7 || (_t$7 = _$7`
|
|
9150
|
+
outline: none;
|
|
9151
|
+
overflow: auto;
|
|
9152
|
+
`));
|
|
9153
|
+
/**
|
|
9154
|
+
* @public
|
|
9155
|
+
*/
|
|
9156
|
+
|
|
9157
|
+
const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
9158
|
+
const {
|
|
9159
|
+
children,
|
|
9160
|
+
onClickOutside,
|
|
9161
|
+
onEscape,
|
|
9162
|
+
onItemClick,
|
|
9163
|
+
onItemSelect,
|
|
9164
|
+
onKeyDown,
|
|
9165
|
+
originElement,
|
|
9166
|
+
padding = 1,
|
|
9167
|
+
registerElement,
|
|
9168
|
+
shouldFocus = props.focusFirst && 'first' || props.focusLast && 'last' || null,
|
|
9169
|
+
space = 1
|
|
9170
|
+
} = props,
|
|
9171
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
9172
|
+
|
|
9173
|
+
const forwardedRef = useForwardedRef(ref);
|
|
9174
|
+
const {
|
|
9175
|
+
isTopLayer
|
|
9176
|
+
} = useLayer();
|
|
9177
|
+
const {
|
|
9178
|
+
activeElement,
|
|
9179
|
+
activeIndex,
|
|
9180
|
+
handleItemMouseEnter,
|
|
9181
|
+
handleItemMouseLeave,
|
|
9182
|
+
handleKeyDown,
|
|
9183
|
+
mount,
|
|
9184
|
+
rootElement,
|
|
9185
|
+
setRootElement
|
|
9186
|
+
} = useMenuController({
|
|
9187
|
+
onKeyDown,
|
|
9188
|
+
originElement,
|
|
9189
|
+
shouldFocus
|
|
9190
|
+
});
|
|
9191
|
+
const handleRefChange = useCallback(el => {
|
|
9192
|
+
setRootElement(el);
|
|
9193
|
+
forwardedRef.current = el;
|
|
9194
|
+
}, [forwardedRef, setRootElement]); // Trigger `onItemSelect` when active index changes
|
|
9195
|
+
|
|
9196
|
+
useEffect(() => {
|
|
9197
|
+
if (onItemSelect) onItemSelect(activeIndex);
|
|
9198
|
+
}, [activeIndex, onItemSelect]); // Close menu when clicking outside
|
|
9199
|
+
|
|
9200
|
+
useClickOutside(useCallback(event => isTopLayer && onClickOutside && onClickOutside(event), [isTopLayer, onClickOutside]), [rootElement]); // Close menu when pressing Escape
|
|
9201
|
+
|
|
9165
9202
|
useGlobalKeyDown(useCallback(event => {
|
|
9166
9203
|
if (!isTopLayer) return;
|
|
9167
9204
|
|
|
@@ -9169,7 +9206,8 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9169
9206
|
event.stopPropagation();
|
|
9170
9207
|
if (onEscape) onEscape();
|
|
9171
9208
|
}
|
|
9172
|
-
}, [isTopLayer, onEscape]));
|
|
9209
|
+
}, [isTopLayer, onEscape])); // Register root element (for nested menus)
|
|
9210
|
+
|
|
9173
9211
|
useEffect(() => {
|
|
9174
9212
|
if (!rootElement || !registerElement) return;
|
|
9175
9213
|
return registerElement(rootElement);
|
|
@@ -9181,10 +9219,13 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9181
9219
|
mount,
|
|
9182
9220
|
onClickOutside,
|
|
9183
9221
|
onEscape,
|
|
9184
|
-
onMouseEnter: handleItemMouseEnter,
|
|
9185
|
-
onMouseLeave: handleItemMouseLeave,
|
|
9186
9222
|
onItemClick,
|
|
9187
|
-
|
|
9223
|
+
onItemMouseEnter: handleItemMouseEnter,
|
|
9224
|
+
onItemMouseLeave: handleItemMouseLeave,
|
|
9225
|
+
registerElement,
|
|
9226
|
+
// deprecated
|
|
9227
|
+
onMouseEnter: handleItemMouseEnter,
|
|
9228
|
+
onMouseLeave: handleItemMouseLeave
|
|
9188
9229
|
}), [activeElement, activeIndex, mount, handleItemMouseEnter, handleItemMouseLeave, onClickOutside, onEscape, onItemClick, registerElement]);
|
|
9189
9230
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
9190
9231
|
value: value
|
|
@@ -9193,7 +9234,7 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9193
9234
|
}, restProps, {
|
|
9194
9235
|
onKeyDown: handleKeyDown,
|
|
9195
9236
|
padding: padding,
|
|
9196
|
-
ref:
|
|
9237
|
+
ref: handleRefChange,
|
|
9197
9238
|
role: "menu",
|
|
9198
9239
|
tabIndex: -1
|
|
9199
9240
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -9355,24 +9396,24 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(props, ref) {
|
|
|
9355
9396
|
}), button || /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
9356
9397
|
});
|
|
9357
9398
|
|
|
9358
|
-
let _$
|
|
9359
|
-
_t$
|
|
9399
|
+
let _$6 = t => t,
|
|
9400
|
+
_t$6;
|
|
9360
9401
|
/**
|
|
9361
9402
|
* @public
|
|
9362
9403
|
*/
|
|
9363
9404
|
|
|
9364
|
-
const MenuDivider = styled.hr(_t$
|
|
9405
|
+
const MenuDivider = styled.hr(_t$6 || (_t$6 = _$6`
|
|
9365
9406
|
height: 1px;
|
|
9366
9407
|
border: 0;
|
|
9367
9408
|
background: var(--card-hairline-soft-color);
|
|
9368
9409
|
margin: 0;
|
|
9369
9410
|
`));
|
|
9370
9411
|
|
|
9371
|
-
let _$
|
|
9372
|
-
_t$
|
|
9412
|
+
let _$5 = t => t,
|
|
9413
|
+
_t$5,
|
|
9373
9414
|
_t2$4;
|
|
9374
9415
|
function selectableBaseStyle() {
|
|
9375
|
-
return css(_t$
|
|
9416
|
+
return css(_t$5 || (_t$5 = _$5`
|
|
9376
9417
|
background-color: inherit;
|
|
9377
9418
|
color: inherit;
|
|
9378
9419
|
|
|
@@ -9406,7 +9447,7 @@ function selectableColorStyle(props) {
|
|
|
9406
9447
|
} = theme.sanity.color; // @todo: remove use of `muted` here
|
|
9407
9448
|
|
|
9408
9449
|
const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
|
|
9409
|
-
return css(_t2$4 || (_t2$4 = _$
|
|
9450
|
+
return css(_t2$4 || (_t2$4 = _$5`
|
|
9410
9451
|
${0}
|
|
9411
9452
|
|
|
9412
9453
|
background-color: var(--card-bg-color);
|
|
@@ -9499,21 +9540,7 @@ function useMenu() {
|
|
|
9499
9540
|
return value;
|
|
9500
9541
|
}
|
|
9501
9542
|
|
|
9502
|
-
const _excluded$a = ["as", "children", "fontSize", "onClick", "padding", "popover", "radius", "text", "tone"];
|
|
9503
|
-
|
|
9504
|
-
let _$5 = t => t,
|
|
9505
|
-
_t$5;
|
|
9506
|
-
const MOUSE_LEAVE_TIMEOUT = 1000;
|
|
9507
|
-
const TextContainer = styled.span(_t$5 || (_t$5 = _$5`
|
|
9508
|
-
&:not([hidden]) {
|
|
9509
|
-
display: flex;
|
|
9510
|
-
}
|
|
9511
|
-
|
|
9512
|
-
& > div:first-child {
|
|
9513
|
-
flex: 1;
|
|
9514
|
-
min-width: 0;
|
|
9515
|
-
}
|
|
9516
|
-
`));
|
|
9543
|
+
const _excluded$a = ["as", "children", "fontSize", "icon", "onClick", "padding", "popover", "radius", "space", "text", "tone"];
|
|
9517
9544
|
/**
|
|
9518
9545
|
* @public
|
|
9519
9546
|
*/
|
|
@@ -9523,48 +9550,37 @@ function MenuGroup(props) {
|
|
|
9523
9550
|
as = 'button',
|
|
9524
9551
|
children,
|
|
9525
9552
|
fontSize,
|
|
9553
|
+
icon,
|
|
9526
9554
|
onClick,
|
|
9527
9555
|
padding = 3,
|
|
9528
9556
|
popover = {},
|
|
9529
9557
|
radius = 2,
|
|
9558
|
+
space = 3,
|
|
9530
9559
|
text,
|
|
9531
9560
|
tone = 'default'
|
|
9532
9561
|
} = props,
|
|
9533
9562
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$a);
|
|
9534
9563
|
|
|
9535
|
-
const
|
|
9564
|
+
const menu = useMenu();
|
|
9536
9565
|
const {
|
|
9537
9566
|
activeElement,
|
|
9538
9567
|
mount,
|
|
9539
9568
|
onClickOutside,
|
|
9540
9569
|
onEscape,
|
|
9541
9570
|
onItemClick,
|
|
9542
|
-
onMouseEnter,
|
|
9543
|
-
onMouseLeave,
|
|
9571
|
+
onItemMouseEnter = menu.onMouseEnter,
|
|
9544
9572
|
registerElement
|
|
9545
|
-
} =
|
|
9573
|
+
} = menu;
|
|
9546
9574
|
const [rootElement, setRootElement] = useState(null);
|
|
9547
|
-
const
|
|
9575
|
+
const [open, setOpen] = useState(false);
|
|
9548
9576
|
const shouldFocusRef = useRef(null);
|
|
9549
|
-
const active = Boolean(activeElement) && activeElement === rootElement;
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
useEffect(() => mount(rootElement), [mount, rootElement]);
|
|
9577
|
+
const active = Boolean(activeElement) && activeElement === rootElement;
|
|
9578
|
+
const [withinMenu, setWithinMenu] = useState(false);
|
|
9553
9579
|
const handleMouseEnter = useCallback(event => {
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
mouseLeaveTimeoutRef.current = null;
|
|
9557
|
-
}
|
|
9558
|
-
|
|
9559
|
-
onMouseEnter(event);
|
|
9580
|
+
setWithinMenu(false);
|
|
9581
|
+
onItemMouseEnter(event);
|
|
9560
9582
|
setOpen(true);
|
|
9561
|
-
}, [
|
|
9562
|
-
const handleMouseLeave = useCallback(event => {
|
|
9563
|
-
onMouseLeave(event);
|
|
9564
|
-
mouseLeaveTimeoutRef.current = setTimeout(() => {
|
|
9565
|
-
setOpen(false);
|
|
9566
|
-
}, MOUSE_LEAVE_TIMEOUT);
|
|
9567
|
-
}, [onMouseLeave]);
|
|
9583
|
+
}, [onItemMouseEnter]);
|
|
9568
9584
|
const handleMenuKeyDown = useCallback(event => {
|
|
9569
9585
|
if (event.key === 'ArrowLeft') {
|
|
9570
9586
|
event.stopPropagation();
|
|
@@ -9574,17 +9590,6 @@ function MenuGroup(props) {
|
|
|
9574
9590
|
});
|
|
9575
9591
|
}
|
|
9576
9592
|
}, [rootElement]);
|
|
9577
|
-
const handleMenuMouseEnter = useCallback(() => {
|
|
9578
|
-
if (mouseLeaveTimeoutRef.current) {
|
|
9579
|
-
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
9580
|
-
mouseLeaveTimeoutRef.current = null;
|
|
9581
|
-
}
|
|
9582
|
-
}, []);
|
|
9583
|
-
const handleMenuMouseLeave = useCallback(() => {
|
|
9584
|
-
mouseLeaveTimeoutRef.current = setTimeout(() => {
|
|
9585
|
-
setOpen(false);
|
|
9586
|
-
}, MOUSE_LEAVE_TIMEOUT);
|
|
9587
|
-
}, []);
|
|
9588
9593
|
const handleClick = useCallback(event => {
|
|
9589
9594
|
if (onClick) onClick(event);
|
|
9590
9595
|
shouldFocusRef.current = 'first';
|
|
@@ -9593,25 +9598,27 @@ function MenuGroup(props) {
|
|
|
9593
9598
|
shouldFocusRef.current = null;
|
|
9594
9599
|
});
|
|
9595
9600
|
}, [onClick]);
|
|
9596
|
-
const
|
|
9601
|
+
const handleChildItemClick = useCallback(() => {
|
|
9597
9602
|
setOpen(false);
|
|
9598
9603
|
if (onItemClick) onItemClick();
|
|
9599
9604
|
}, [onItemClick]);
|
|
9605
|
+
const handleMenuMouseEnter = useCallback(() => setWithinMenu(true), []); // Register the menu item element
|
|
9606
|
+
|
|
9607
|
+
useEffect(() => mount(rootElement), [mount, rootElement]); // Close child menu when a sibling item becomes active
|
|
9608
|
+
|
|
9600
9609
|
useEffect(() => {
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
const content = /*#__PURE__*/React.createElement(Menu, {
|
|
9610
|
+
if (!active) setOpen(false);
|
|
9611
|
+
}, [active]); // Update state when child menu is no longer open
|
|
9612
|
+
|
|
9613
|
+
useEffect(() => {
|
|
9614
|
+
if (!open) setWithinMenu(false);
|
|
9615
|
+
}, [open]);
|
|
9616
|
+
const childMenu = /*#__PURE__*/React.createElement(Menu, {
|
|
9609
9617
|
onClickOutside: onClickOutside,
|
|
9610
9618
|
onEscape: onEscape,
|
|
9611
|
-
onItemClick:
|
|
9619
|
+
onItemClick: handleChildItemClick,
|
|
9612
9620
|
onKeyDown: handleMenuKeyDown,
|
|
9613
9621
|
onMouseEnter: handleMenuMouseEnter,
|
|
9614
|
-
onMouseLeave: handleMenuMouseLeave,
|
|
9615
9622
|
registerElement: registerElement,
|
|
9616
9623
|
shouldFocus: shouldFocusRef.current
|
|
9617
9624
|
}, children);
|
|
@@ -9625,6 +9632,7 @@ function MenuGroup(props) {
|
|
|
9625
9632
|
if (event.key === 'ArrowRight') {
|
|
9626
9633
|
shouldFocusRef.current = 'first';
|
|
9627
9634
|
setOpen(true);
|
|
9635
|
+
setWithinMenu(true);
|
|
9628
9636
|
requestAnimationFrame(() => {
|
|
9629
9637
|
shouldFocusRef.current = null;
|
|
9630
9638
|
});
|
|
@@ -9632,7 +9640,7 @@ function MenuGroup(props) {
|
|
|
9632
9640
|
}
|
|
9633
9641
|
}, []);
|
|
9634
9642
|
return /*#__PURE__*/React.createElement(Popover, _extends({}, popover, {
|
|
9635
|
-
content:
|
|
9643
|
+
content: childMenu,
|
|
9636
9644
|
"data-ui": "MenuGroup__popover",
|
|
9637
9645
|
open: open
|
|
9638
9646
|
}), /*#__PURE__*/React.createElement(Selectable, _extends({
|
|
@@ -9640,25 +9648,32 @@ function MenuGroup(props) {
|
|
|
9640
9648
|
"data-ui": "MenuGroup",
|
|
9641
9649
|
forwardedAs: as
|
|
9642
9650
|
}, restProps, {
|
|
9643
|
-
"aria-pressed": as === 'button' ?
|
|
9644
|
-
"data-pressed": as !== 'button' ?
|
|
9645
|
-
"data-selected": active ? '' : undefined,
|
|
9651
|
+
"aria-pressed": as === 'button' ? withinMenu : undefined,
|
|
9652
|
+
"data-pressed": as !== 'button' ? withinMenu : undefined,
|
|
9653
|
+
"data-selected": !withinMenu && active ? '' : undefined,
|
|
9646
9654
|
"$radius": radius,
|
|
9647
9655
|
"$tone": tone,
|
|
9648
9656
|
onClick: handleClick,
|
|
9649
9657
|
onKeyDown: handleKeyDown,
|
|
9650
9658
|
onMouseEnter: handleMouseEnter,
|
|
9651
|
-
onMouseLeave: handleMouseLeave,
|
|
9652
9659
|
ref: setRootElement,
|
|
9653
9660
|
tabIndex: -1,
|
|
9654
9661
|
type: as === 'button' ? 'button' : undefined
|
|
9655
9662
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
9656
9663
|
padding: padding
|
|
9657
|
-
}, /*#__PURE__*/React.createElement(
|
|
9664
|
+
}, /*#__PURE__*/React.createElement(Flex, null, icon && /*#__PURE__*/React.createElement(Text, {
|
|
9658
9665
|
size: fontSize
|
|
9659
|
-
},
|
|
9666
|
+
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon)), /*#__PURE__*/React.createElement(Box, {
|
|
9667
|
+
flex: 1,
|
|
9668
|
+
marginLeft: icon ? space : undefined
|
|
9669
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
9670
|
+
size: fontSize,
|
|
9671
|
+
textOverflow: "ellipsis"
|
|
9672
|
+
}, text)), /*#__PURE__*/React.createElement(Box, {
|
|
9673
|
+
marginLeft: space
|
|
9674
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
9660
9675
|
size: fontSize
|
|
9661
|
-
}, /*#__PURE__*/React.createElement(ChevronRightIcon, null))))));
|
|
9676
|
+
}, /*#__PURE__*/React.createElement(ChevronRightIcon, null)))))));
|
|
9662
9677
|
}
|
|
9663
9678
|
|
|
9664
9679
|
const _excluded$9 = ["as", "children", "disabled", "fontSize", "hotkeys", "icon", "iconRight", "onClick", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "pressed", "radius", "selected", "space", "text", "tone"];
|
|
@@ -9692,15 +9707,16 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef)
|
|
|
9692
9707
|
} = props,
|
|
9693
9708
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$9);
|
|
9694
9709
|
|
|
9710
|
+
const menu = useMenu();
|
|
9695
9711
|
const {
|
|
9696
9712
|
activeElement,
|
|
9697
9713
|
mount,
|
|
9698
9714
|
onItemClick,
|
|
9699
|
-
onMouseEnter,
|
|
9700
|
-
onMouseLeave
|
|
9701
|
-
} =
|
|
9715
|
+
onItemMouseEnter = menu.onMouseEnter,
|
|
9716
|
+
onItemMouseLeave = menu.onMouseLeave
|
|
9717
|
+
} = menu;
|
|
9702
9718
|
const [rootElement, setRootElement] = useState(null);
|
|
9703
|
-
const
|
|
9719
|
+
const active = Boolean(activeElement) && activeElement === rootElement;
|
|
9704
9720
|
useEffect(() => mount(rootElement, selectedProp), [mount, rootElement, selectedProp]);
|
|
9705
9721
|
const ref = useForwardedRef(forwardedRef);
|
|
9706
9722
|
const handleClick = useCallback(event => {
|
|
@@ -9728,14 +9744,14 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef)
|
|
|
9728
9744
|
}, restProps, {
|
|
9729
9745
|
"aria-pressed": as === 'button' && pressed,
|
|
9730
9746
|
"data-pressed": as !== 'button' && pressed ? '' : undefined,
|
|
9731
|
-
"data-selected":
|
|
9747
|
+
"data-selected": active ? '' : undefined,
|
|
9732
9748
|
"data-disabled": disabled ? '' : undefined,
|
|
9733
9749
|
"$radius": radius,
|
|
9734
9750
|
"$tone": tone,
|
|
9735
9751
|
disabled: disabled,
|
|
9736
9752
|
onClick: handleClick,
|
|
9737
|
-
onMouseEnter:
|
|
9738
|
-
onMouseLeave:
|
|
9753
|
+
onMouseEnter: onItemMouseEnter,
|
|
9754
|
+
onMouseLeave: onItemMouseLeave,
|
|
9739
9755
|
padding: 0,
|
|
9740
9756
|
ref: setRef,
|
|
9741
9757
|
role: "menuitem",
|