@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.
@@ -2630,7 +2630,7 @@ globalScope[key$7] = globalScope[key$7] || /*#__PURE__*/createContext(null);
2630
2630
 
2631
2631
  var ThemeContext = globalScope[key$7];
2632
2632
 
2633
- var _excluded$H = ["color", "layer"];
2633
+ var _excluded$I = ["color", "layer"];
2634
2634
  /**
2635
2635
  * @public
2636
2636
  */
@@ -2649,7 +2649,7 @@ function ThemeProvider(props) {
2649
2649
 
2650
2650
  var rootColor = themeProp.color,
2651
2651
  rootLayer = themeProp.layer,
2652
- restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$H);
2652
+ restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$I);
2653
2653
 
2654
2654
  var colorScheme = rootColor[scheme] || rootColor.light;
2655
2655
  var color = colorScheme[tone] || colorScheme["default"];
@@ -3705,7 +3705,7 @@ function textBaseStyle(props) {
3705
3705
  return css(_templateObject$C || (_templateObject$C = _taggedTemplateLiteralLoose(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow: 0 0 0 1px var(--card-bg-color), 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$m || (_templateObject2$m = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$d || (_templateObject3$d = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
3706
3706
  }
3707
3707
 
3708
- var _excluded$G = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
3708
+ var _excluded$H = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
3709
3709
 
3710
3710
  var _templateObject$B;
3711
3711
  var Root$E = styled.div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
@@ -3725,7 +3725,7 @@ var Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
3725
3725
  size = _props$size === void 0 ? 2 : _props$size,
3726
3726
  textOverflow = props.textOverflow,
3727
3727
  weight = props.weight,
3728
- restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
3728
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$H);
3729
3729
 
3730
3730
  var children = childrenProp;
3731
3731
 
@@ -3885,7 +3885,7 @@ function avatarStrokeStyle() {
3885
3885
  };
3886
3886
  }
3887
3887
 
3888
- var _excluded$F = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
3888
+ var _excluded$G = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
3889
3889
  var Root$D = styled.div(responsiveAvatarSizeStyle, avatarStyle.root);
3890
3890
  var Arrow = styled.div(avatarStyle.arrow);
3891
3891
  var BgStroke = styled.ellipse(avatarStyle.bgStroke);
@@ -3908,7 +3908,7 @@ var Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
3908
3908
  _props$status = props.status,
3909
3909
  status = _props$status === void 0 ? 'online' : _props$status,
3910
3910
  sizeProp = props.size,
3911
- restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
3911
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
3912
3912
 
3913
3913
  var as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
3914
3914
  var size = useResponsiveProp(sizeProp, [0]);
@@ -4061,7 +4061,7 @@ function childrenToElementArray(children) {
4061
4061
  });
4062
4062
  }
4063
4063
 
4064
- var _excluded$E = ["children", "maxLength", "size", "tone"];
4064
+ var _excluded$F = ["children", "maxLength", "size", "tone"];
4065
4065
 
4066
4066
  var _templateObject$z;
4067
4067
  var BASE_STYLES = css(_templateObject$z || (_templateObject$z = _taggedTemplateLiteralLoose(["\n white-space: nowrap;\n\n & > div {\n vertical-align: top;\n\n &:not([hidden]) {\n display: inline-block;\n }\n }\n"])));
@@ -4097,7 +4097,7 @@ var AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4097
4097
  maxLengthProp = _props$maxLength === void 0 ? 4 : _props$maxLength,
4098
4098
  _props$size = props.size,
4099
4099
  size = _props$size === void 0 ? 0 : _props$size,
4100
- restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4100
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
4101
4101
 
4102
4102
  var maxLength = Math.max(maxLengthProp, 0);
4103
4103
  var children = childrenToElementArray(childrenProp).filter(function (child) {
@@ -4126,7 +4126,7 @@ var AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
4126
4126
  }));
4127
4127
  });
4128
4128
 
4129
- var _excluded$D = ["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"];
4129
+ var _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"];
4130
4130
  var Root$A = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle);
4131
4131
  /**
4132
4132
  * @public
@@ -4163,7 +4163,7 @@ var Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
4163
4163
  rowStart = props.rowStart,
4164
4164
  rowEnd = props.rowEnd,
4165
4165
  sizing = props.sizing,
4166
- restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4166
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
4167
4167
 
4168
4168
  return /*#__PURE__*/React.createElement(Root$A, _extends({
4169
4169
  "data-as": typeof asProp === 'string' ? asProp : undefined,
@@ -4208,7 +4208,7 @@ function labelBaseStyle(props) {
4208
4208
  return css(_templateObject$y || (_templateObject$y = _taggedTemplateLiteralLoose(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_templateObject2$l || (_templateObject2$l = _taggedTemplateLiteralLoose(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_templateObject3$c || (_templateObject3$c = _taggedTemplateLiteralLoose(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
4209
4209
  }
4210
4210
 
4211
- var _excluded$C = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
4211
+ var _excluded$D = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
4212
4212
 
4213
4213
  var _templateObject$x;
4214
4214
  var Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
@@ -4227,7 +4227,7 @@ var Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
4227
4227
  size = _props$size === void 0 ? 2 : _props$size,
4228
4228
  textOverflow = props.textOverflow,
4229
4229
  weight = props.weight,
4230
- restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
4230
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
4231
4231
 
4232
4232
  var children = childrenProp;
4233
4233
 
@@ -4266,7 +4266,7 @@ function badgeStyle(props) {
4266
4266
  };
4267
4267
  }
4268
4268
 
4269
- var _excluded$B = ["children", "fontSize", "mode", "padding", "radius", "tone"];
4269
+ var _excluded$C = ["children", "fontSize", "mode", "padding", "radius", "tone"];
4270
4270
  var Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
4271
4271
  /**
4272
4272
  * @public
@@ -4283,7 +4283,7 @@ var Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4283
4283
  radius = _props$radius === void 0 ? 2 : _props$radius,
4284
4284
  _props$tone = props.tone,
4285
4285
  tone = _props$tone === void 0 ? 'default' : _props$tone,
4286
- restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
4286
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
4287
4287
 
4288
4288
  return /*#__PURE__*/React.createElement(Root$y, _extends({
4289
4289
  "data-ui": "Badge"
@@ -4298,7 +4298,7 @@ var Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
4298
4298
  }, children));
4299
4299
  });
4300
4300
 
4301
- var _excluded$A = ["align", "as", "direction", "gap", "justify", "wrap"];
4301
+ var _excluded$B = ["align", "as", "direction", "gap", "justify", "wrap"];
4302
4302
  var Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
4303
4303
  /**
4304
4304
  * @public
@@ -4312,7 +4312,7 @@ var Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4312
4312
  gap = props.gap,
4313
4313
  justify = props.justify,
4314
4314
  wrap = props.wrap,
4315
- restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
4315
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
4316
4316
 
4317
4317
  return /*#__PURE__*/React.createElement(Root$x, _extends({
4318
4318
  "data-ui": "Flex"
@@ -4328,16 +4328,56 @@ var Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
4328
4328
  });
4329
4329
 
4330
4330
  var _templateObject$w, _templateObject2$k;
4331
- var rotate$1 = keyframes(_templateObject$w || (_templateObject$w = _taggedTemplateLiteralLoose(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
4332
- var Root$w = styled(Text)(_templateObject2$k || (_templateObject2$k = _taggedTemplateLiteralLoose(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
4331
+ var rotate$1 = keyframes(_templateObject$w || (_templateObject$w = _taggedTemplateLiteralLoose(["\nfrom {\n transform: rotate(0deg);\n}\n\nto {\n transform: rotate(360deg);\n}\n"])));
4332
+ function spinnerStyle(props) {
4333
+ var $muted = props.$muted;
4334
+ return css(_templateObject2$k || (_templateObject2$k = _taggedTemplateLiteralLoose(["\n animation: ", " 500ms linear infinite;\n color: ", ";\n "])), rotate$1, $muted ? 'var(--card-muted-fg-color)' : 'var(--card-fg-color)');
4335
+ }
4336
+ function spinnerSizeStyle(props) {
4337
+ var $size = props.$size;
4338
+ var _props$theme$sanity = props.theme.sanity,
4339
+ fonts = _props$theme$sanity.fonts,
4340
+ media = _props$theme$sanity.media;
4341
+ return responsive(media, $size, function (size) {
4342
+ var _fonts$text$sizes$siz = fonts.text.sizes[size],
4343
+ ascenderHeight = _fonts$text$sizes$siz.ascenderHeight,
4344
+ descenderHeight = _fonts$text$sizes$siz.descenderHeight,
4345
+ lineHeight = _fonts$text$sizes$siz.lineHeight,
4346
+ iconSize = _fonts$text$sizes$siz.iconSize;
4347
+ var capHeight = lineHeight - ascenderHeight - descenderHeight;
4348
+ return {
4349
+ width: rem(capHeight),
4350
+ height: rem(capHeight),
4351
+ '& > svg': {
4352
+ display: 'block',
4353
+ width: rem(iconSize),
4354
+ height: rem(iconSize),
4355
+ margin: (capHeight - iconSize) / 2
4356
+ }
4357
+ };
4358
+ });
4359
+ }
4360
+
4361
+ var _excluded$A = ["muted", "size"];
4362
+ var Root$w = styled.div(spinnerStyle, spinnerSizeStyle);
4333
4363
  /**
4334
4364
  * @public
4335
4365
  */
4336
4366
 
4337
4367
  var Spinner = /*#__PURE__*/forwardRef(function Spinner(props, ref) {
4368
+ var muted = props.muted,
4369
+ _props$size = props.size,
4370
+ size = _props$size === void 0 ? 2 : _props$size,
4371
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
4372
+
4373
+ var $size = useMemo(function () {
4374
+ return Array.isArray(size) ? size : [size];
4375
+ }, [size]);
4338
4376
  return /*#__PURE__*/React.createElement(Root$w, _extends({
4339
4377
  "data-ui": "Spinner"
4340
- }, props, {
4378
+ }, restProps, {
4379
+ "$muted": muted,
4380
+ "$size": $size,
4341
4381
  ref: ref
4342
4382
  }), /*#__PURE__*/React.createElement(SpinnerIcon, null));
4343
4383
  });