@sanity/ui 0.37.21 → 0.37.22
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/dts/src/primitives/spinner/spinner.d.ts +1 -1
- package/lib/dts/src/primitives/spinner/spinner.d.ts.map +1 -1
- package/lib/dts/src/primitives/spinner/styles.d.ts +9 -0
- package/lib/dts/src/primitives/spinner/styles.d.ts.map +1 -0
- package/lib/sanity-ui.js +59 -19
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.js +71 -27
- package/lib/sanity-ui.modern.js.map +1 -1
- package/lib/sanity-ui.module.js +59 -19
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +2 -2
- package/src/primitives/button/__workshop__/props.tsx +2 -0
- package/src/primitives/spinner/spinner.tsx +8 -19
- package/src/primitives/spinner/styles.ts +43 -0
package/lib/sanity-ui.modern.js
CHANGED
|
@@ -2544,7 +2544,7 @@ globalScope[key$7] = globalScope[key$7] || /*#__PURE__*/createContext(null);
|
|
|
2544
2544
|
|
|
2545
2545
|
const ThemeContext = globalScope[key$7];
|
|
2546
2546
|
|
|
2547
|
-
const _excluded$
|
|
2547
|
+
const _excluded$I = ["color", "layer"];
|
|
2548
2548
|
/**
|
|
2549
2549
|
* @public
|
|
2550
2550
|
*/
|
|
@@ -2564,7 +2564,7 @@ function ThemeProvider(props) {
|
|
|
2564
2564
|
color: rootColor,
|
|
2565
2565
|
layer: rootLayer
|
|
2566
2566
|
} = themeProp,
|
|
2567
|
-
restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$
|
|
2567
|
+
restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$I);
|
|
2568
2568
|
|
|
2569
2569
|
const colorScheme = rootColor[scheme] || rootColor.light;
|
|
2570
2570
|
const color = colorScheme[tone] || colorScheme.default;
|
|
@@ -3870,7 +3870,7 @@ function textBaseStyle(props) {
|
|
|
3870
3870
|
`)), theme.sanity.fonts.code.family, weights.bold);
|
|
3871
3871
|
}
|
|
3872
3872
|
|
|
3873
|
-
const _excluded$
|
|
3873
|
+
const _excluded$H = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
3874
3874
|
|
|
3875
3875
|
let _$z = t => t,
|
|
3876
3876
|
_t$B;
|
|
@@ -3895,7 +3895,7 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
|
|
|
3895
3895
|
textOverflow,
|
|
3896
3896
|
weight
|
|
3897
3897
|
} = props,
|
|
3898
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
3898
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$H);
|
|
3899
3899
|
|
|
3900
3900
|
let children = childrenProp;
|
|
3901
3901
|
|
|
@@ -4066,7 +4066,7 @@ function avatarStrokeStyle() {
|
|
|
4066
4066
|
};
|
|
4067
4067
|
}
|
|
4068
4068
|
|
|
4069
|
-
const _excluded$
|
|
4069
|
+
const _excluded$G = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
|
|
4070
4070
|
const Root$D = styled.div(responsiveAvatarSizeStyle, avatarStyle.root);
|
|
4071
4071
|
const Arrow = styled.div(avatarStyle.arrow);
|
|
4072
4072
|
const BgStroke = styled.ellipse(avatarStyle.bgStroke);
|
|
@@ -4089,7 +4089,7 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4089
4089
|
status = 'online',
|
|
4090
4090
|
size: sizeProp
|
|
4091
4091
|
} = props,
|
|
4092
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4092
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
|
|
4093
4093
|
|
|
4094
4094
|
const as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
|
|
4095
4095
|
const size = useResponsiveProp(sizeProp, [0]);
|
|
@@ -4246,7 +4246,7 @@ function childrenToElementArray(children) {
|
|
|
4246
4246
|
return childrenArray.filter(node => isElement(node) || isFragment(node) || typeof node === 'string');
|
|
4247
4247
|
}
|
|
4248
4248
|
|
|
4249
|
-
const _excluded$
|
|
4249
|
+
const _excluded$F = ["children", "maxLength", "size", "tone"];
|
|
4250
4250
|
|
|
4251
4251
|
let _$x = t => t,
|
|
4252
4252
|
_t$z;
|
|
@@ -4296,7 +4296,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4296
4296
|
maxLength: maxLengthProp = 4,
|
|
4297
4297
|
size = 0
|
|
4298
4298
|
} = props,
|
|
4299
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4299
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
|
|
4300
4300
|
|
|
4301
4301
|
const maxLength = Math.max(maxLengthProp, 0);
|
|
4302
4302
|
const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
|
|
@@ -4321,7 +4321,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4321
4321
|
}))));
|
|
4322
4322
|
});
|
|
4323
4323
|
|
|
4324
|
-
const _excluded$
|
|
4324
|
+
const _excluded$E = ["as", "column", "columnStart", "columnEnd", "display", "flex", "height", "margin", "marginX", "marginY", "marginTop", "marginRight", "marginBottom", "marginLeft", "overflow", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "row", "rowStart", "rowEnd", "sizing"];
|
|
4325
4325
|
const Root$A = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle);
|
|
4326
4326
|
/**
|
|
4327
4327
|
* @public
|
|
@@ -4356,7 +4356,7 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
|
|
|
4356
4356
|
rowEnd,
|
|
4357
4357
|
sizing
|
|
4358
4358
|
} = props,
|
|
4359
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4359
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
|
|
4360
4360
|
|
|
4361
4361
|
return /*#__PURE__*/React.createElement(Root$A, _extends({
|
|
4362
4362
|
"data-as": typeof asProp === 'string' ? asProp : undefined,
|
|
@@ -4432,7 +4432,7 @@ function labelBaseStyle(props) {
|
|
|
4432
4432
|
`)), fonts.code.family);
|
|
4433
4433
|
}
|
|
4434
4434
|
|
|
4435
|
-
const _excluded$
|
|
4435
|
+
const _excluded$D = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
4436
4436
|
|
|
4437
4437
|
let _$v = t => t,
|
|
4438
4438
|
_t$x;
|
|
@@ -4457,7 +4457,7 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
|
|
|
4457
4457
|
textOverflow,
|
|
4458
4458
|
weight
|
|
4459
4459
|
} = props,
|
|
4460
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4460
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
|
|
4461
4461
|
|
|
4462
4462
|
let children = childrenProp;
|
|
4463
4463
|
|
|
@@ -4498,7 +4498,7 @@ function badgeStyle(props) {
|
|
|
4498
4498
|
};
|
|
4499
4499
|
}
|
|
4500
4500
|
|
|
4501
|
-
const _excluded$
|
|
4501
|
+
const _excluded$C = ["children", "fontSize", "mode", "padding", "radius", "tone"];
|
|
4502
4502
|
const Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
|
|
4503
4503
|
/**
|
|
4504
4504
|
* @public
|
|
@@ -4513,7 +4513,7 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
|
|
|
4513
4513
|
radius = 2,
|
|
4514
4514
|
tone = 'default'
|
|
4515
4515
|
} = props,
|
|
4516
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4516
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
|
|
4517
4517
|
|
|
4518
4518
|
return /*#__PURE__*/React.createElement(Root$y, _extends({
|
|
4519
4519
|
"data-ui": "Badge"
|
|
@@ -4528,7 +4528,7 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
|
|
|
4528
4528
|
}, children));
|
|
4529
4529
|
});
|
|
4530
4530
|
|
|
4531
|
-
const _excluded$
|
|
4531
|
+
const _excluded$B = ["align", "as", "direction", "gap", "justify", "wrap"];
|
|
4532
4532
|
const Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
|
|
4533
4533
|
/**
|
|
4534
4534
|
* @public
|
|
@@ -4543,7 +4543,7 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
|
|
|
4543
4543
|
justify,
|
|
4544
4544
|
wrap
|
|
4545
4545
|
} = props,
|
|
4546
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4546
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
|
|
4547
4547
|
|
|
4548
4548
|
return /*#__PURE__*/React.createElement(Root$x, _extends({
|
|
4549
4549
|
"data-ui": "Flex"
|
|
@@ -4562,27 +4562,71 @@ let _$u = t => t,
|
|
|
4562
4562
|
_t$w,
|
|
4563
4563
|
_t2$k;
|
|
4564
4564
|
const rotate$1 = keyframes(_t$w || (_t$w = _$u`
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4565
|
+
from {
|
|
4566
|
+
transform: rotate(0deg);
|
|
4567
|
+
}
|
|
4568
4568
|
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4569
|
+
to {
|
|
4570
|
+
transform: rotate(360deg);
|
|
4571
|
+
}
|
|
4572
4572
|
`));
|
|
4573
|
-
|
|
4574
|
-
|
|
4573
|
+
function spinnerStyle(props) {
|
|
4574
|
+
const {
|
|
4575
|
+
$muted
|
|
4576
|
+
} = props;
|
|
4577
|
+
return css(_t2$k || (_t2$k = _$u`
|
|
4575
4578
|
animation: ${0} 500ms linear infinite;
|
|
4576
|
-
|
|
4577
|
-
`), rotate$1);
|
|
4579
|
+
color: ${0};
|
|
4580
|
+
`), rotate$1, $muted ? 'var(--card-muted-fg-color)' : 'var(--card-fg-color)');
|
|
4581
|
+
}
|
|
4582
|
+
function spinnerSizeStyle(props) {
|
|
4583
|
+
const {
|
|
4584
|
+
$size
|
|
4585
|
+
} = props;
|
|
4586
|
+
const {
|
|
4587
|
+
fonts,
|
|
4588
|
+
media
|
|
4589
|
+
} = props.theme.sanity;
|
|
4590
|
+
return responsive(media, $size, size => {
|
|
4591
|
+
const {
|
|
4592
|
+
ascenderHeight,
|
|
4593
|
+
descenderHeight,
|
|
4594
|
+
lineHeight,
|
|
4595
|
+
iconSize
|
|
4596
|
+
} = fonts.text.sizes[size];
|
|
4597
|
+
const capHeight = lineHeight - ascenderHeight - descenderHeight;
|
|
4598
|
+
return {
|
|
4599
|
+
width: rem(capHeight),
|
|
4600
|
+
height: rem(capHeight),
|
|
4601
|
+
'& > svg': {
|
|
4602
|
+
display: 'block',
|
|
4603
|
+
width: rem(iconSize),
|
|
4604
|
+
height: rem(iconSize),
|
|
4605
|
+
margin: (capHeight - iconSize) / 2
|
|
4606
|
+
}
|
|
4607
|
+
};
|
|
4608
|
+
});
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
const _excluded$A = ["muted", "size"];
|
|
4612
|
+
const Root$w = styled.div(spinnerStyle, spinnerSizeStyle);
|
|
4578
4613
|
/**
|
|
4579
4614
|
* @public
|
|
4580
4615
|
*/
|
|
4581
4616
|
|
|
4582
4617
|
const Spinner = /*#__PURE__*/forwardRef(function Spinner(props, ref) {
|
|
4618
|
+
const {
|
|
4619
|
+
muted,
|
|
4620
|
+
size = 2
|
|
4621
|
+
} = props,
|
|
4622
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
|
|
4623
|
+
|
|
4624
|
+
const $size = useMemo(() => Array.isArray(size) ? size : [size], [size]);
|
|
4583
4625
|
return /*#__PURE__*/React.createElement(Root$w, _extends({
|
|
4584
4626
|
"data-ui": "Spinner"
|
|
4585
|
-
},
|
|
4627
|
+
}, restProps, {
|
|
4628
|
+
"$muted": muted,
|
|
4629
|
+
"$size": $size,
|
|
4586
4630
|
ref: ref
|
|
4587
4631
|
}), /*#__PURE__*/React.createElement(SpinnerIcon, null));
|
|
4588
4632
|
});
|