@sanity/ui 2.0.0-alpha.11 → 2.0.0-alpha.13

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/dist/index.js CHANGED
@@ -3896,7 +3896,7 @@ var __defProp$E = Object.defineProperty;
3896
3896
  var __template$D = (cooked, raw) => __freeze$D(__defProp$E(cooked, "raw", {
3897
3897
  value: __freeze$D(raw || cooked.slice())
3898
3898
  }));
3899
- var _a$D, _b$m, _c$d;
3899
+ var _a$D, _b$n, _c$d;
3900
3900
  const ROOT_STYLE = styled.css(_a$D || (_a$D = __template$D(["\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n"])));
3901
3901
  function textInputRootStyle() {
3902
3902
  return ROOT_STYLE;
@@ -3910,7 +3910,7 @@ function textInputBaseStyle(props) {
3910
3910
  } = props;
3911
3911
  const font = theme.sanity.fonts.text;
3912
3912
  const color = theme.sanity.color.input;
3913
- return styled.css(_b$m || (_b$m = __template$D(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='", "'][data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
3913
+ return styled.css(_b$n || (_b$n = __template$D(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='", "'][data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
3914
3914
  }
3915
3915
  function textInputFontSizeStyle(props) {
3916
3916
  const {
@@ -4026,7 +4026,7 @@ var __defProp$D = Object.defineProperty;
4026
4026
  var __template$C = (cooked, raw) => __freeze$C(__defProp$D(cooked, "raw", {
4027
4027
  value: __freeze$C(raw || cooked.slice())
4028
4028
  }));
4029
- var _a$C, _b$l, _c$c;
4029
+ var _a$C, _b$m, _c$c;
4030
4030
  function textBaseStyle(props) {
4031
4031
  const {
4032
4032
  $accent,
@@ -4036,7 +4036,7 @@ function textBaseStyle(props) {
4036
4036
  const {
4037
4037
  weights
4038
4038
  } = theme.sanity.fonts.text;
4039
- return styled.css(_c$c || (_c$c = __template$C(["\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:\n 0 0 0 1px var(--card-bg-color),\n 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 & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n color: var(--card-icon-color);\n }\n "])), $accent && styled.css(_a$C || (_a$C = __template$C(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$l || (_b$l = __template$C(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
4039
+ return styled.css(_c$c || (_c$c = __template$C(["\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:\n 0 0 0 1px var(--card-bg-color),\n 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 & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n color: var(--card-icon-color);\n }\n "])), $accent && styled.css(_a$C || (_a$C = __template$C(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$m || (_b$m = __template$C(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
4040
4040
  }
4041
4041
  var __freeze$B = Object.freeze;
4042
4042
  var __defProp$C = Object.defineProperty;
@@ -4601,9 +4601,9 @@ var __defProp$z = Object.defineProperty;
4601
4601
  var __template$y = (cooked, raw) => __freeze$y(__defProp$z(cooked, "raw", {
4602
4602
  value: __freeze$y(raw || cooked.slice())
4603
4603
  }));
4604
- var _a$y, _b$k;
4604
+ var _a$y, _b$l;
4605
4605
  const rotate$1 = styled.keyframes(_a$y || (_a$y = __template$y(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
4606
- const Root$x = styled__default.default(Text)(_b$k || (_b$k = __template$y(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
4606
+ const Root$x = styled__default.default(Text)(_b$l || (_b$l = __template$y(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
4607
4607
  const Spinner = react.forwardRef(function Spinner2(props, ref) {
4608
4608
  return /* @__PURE__ */jsxRuntime.jsx(Root$x, {
4609
4609
  "data-ui": "Spinner",
@@ -4648,9 +4648,12 @@ var __defProp$y = Object.defineProperty;
4648
4648
  var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
4649
4649
  value: __freeze$x(raw || cooked.slice())
4650
4650
  }));
4651
- var _a$x;
4652
- function buttonBaseStyles() {
4653
- return styled.css(_a$x || (_a$x = __template$x(["\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 "])));
4651
+ var _a$x, _b$k;
4652
+ function buttonBaseStyles(_ref20) {
4653
+ let {
4654
+ $width
4655
+ } = _ref20;
4656
+ return styled.css(_b$k || (_b$k = __template$x(["\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 ", "\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 "])), $width === "fill" && styled.css(_a$x || (_a$x = __template$x(["\n width: -webkit-fill-available;\n width: stretch;\n "]))));
4654
4657
  }
4655
4658
  const buttonTheme = {
4656
4659
  border: {
@@ -4665,7 +4668,7 @@ function combineBoxShadow() {
4665
4668
  return boxShadows.filter(Boolean).join(",");
4666
4669
  }
4667
4670
  function buttonColorStyles(props) {
4668
- var _a2, _b;
4671
+ var _a2, _b2;
4669
4672
  const {
4670
4673
  $mode,
4671
4674
  theme
@@ -4708,7 +4711,7 @@ function buttonColorStyles(props) {
4708
4711
  },
4709
4712
  "&[data-selected]": _colorVarsStyle(base, color.pressed)
4710
4713
  }
4711
- }, (_b = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b.root].filter(Boolean);
4714
+ }, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b2.root].filter(Boolean);
4712
4715
  }
4713
4716
  var __freeze$w = Object.freeze;
4714
4717
  var __defProp$x = Object.defineProperty;
@@ -4743,6 +4746,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
4743
4746
  tone = "default",
4744
4747
  type = "button",
4745
4748
  muted = false,
4749
+ width,
4746
4750
  ...restProps
4747
4751
  } = props;
4748
4752
  const justify = useArrayProp(justifyProp);
@@ -4777,6 +4781,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
4777
4781
  disabled: Boolean(loading || disabled),
4778
4782
  ref,
4779
4783
  type,
4784
+ $width: width,
4780
4785
  children: [Boolean(loading) && /* @__PURE__ */jsxRuntime.jsx(LoadingBox, {
4781
4786
  children: /* @__PURE__ */jsxRuntime.jsx(Spinner, {})
4782
4787
  }), (icon || text || iconRight) && /* @__PURE__ */jsxRuntime.jsx(Box, {
@@ -5005,10 +5010,10 @@ var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
5005
5010
  value: __freeze$t(raw || cooked.slice())
5006
5011
  }));
5007
5012
  var _a$t;
5008
- function codeSyntaxHighlightingStyle(_ref20) {
5013
+ function codeSyntaxHighlightingStyle(_ref21) {
5009
5014
  let {
5010
5015
  theme
5011
- } = _ref20;
5016
+ } = _ref21;
5012
5017
  const color = theme.sanity.color.syntax;
5013
5018
  return {
5014
5019
  "&.atrule": {
@@ -6316,13 +6321,13 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
6316
6321
  }));
6317
6322
  if (constrainSize || matchReferenceWidth) {
6318
6323
  ret.push(size({
6319
- apply(_ref21) {
6324
+ apply(_ref22) {
6320
6325
  let {
6321
6326
  availableWidth,
6322
6327
  availableHeight,
6323
6328
  elements,
6324
6329
  referenceWidth
6325
- } = _ref21;
6330
+ } = _ref22;
6326
6331
  referenceWidthRef.current = referenceWidth;
6327
6332
  const _currentWidth = widthRef.current;
6328
6333
  const _maxWidth = maxWidthRef.current;
@@ -7131,12 +7136,12 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
7131
7136
  mainAxis: 3
7132
7137
  }));
7133
7138
  ret.push(reactDom$1.size({
7134
- apply(_ref22) {
7139
+ apply(_ref23) {
7135
7140
  let {
7136
7141
  availableWidth,
7137
7142
  availableHeight,
7138
7143
  elements
7139
- } = _ref22;
7144
+ } = _ref23;
7140
7145
  Object.assign(elements.floating.style, {
7141
7146
  maxWidth: "".concat(availableWidth - 4 * 2, "px"),
7142
7147
  // the padding is `4px`
@@ -7442,10 +7447,10 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7442
7447
  query,
7443
7448
  value
7444
7449
  } = state;
7445
- const defaultRenderOption = react.useCallback(_ref23 => {
7450
+ const defaultRenderOption = react.useCallback(_ref24 => {
7446
7451
  let {
7447
7452
  value: value2
7448
- } = _ref23;
7453
+ } = _ref24;
7449
7454
  return /* @__PURE__ */jsxRuntime.jsx(Card, {
7450
7455
  "data-as": "button",
7451
7456
  padding: paddingProp,
@@ -7899,10 +7904,10 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7899
7904
  });
7900
7905
  });
7901
7906
  const BORDER_OFFSET_X = 12;
7902
- function dialogStyle(_ref24) {
7907
+ function dialogStyle(_ref25) {
7903
7908
  let {
7904
7909
  theme
7905
- } = _ref24;
7910
+ } = _ref25;
7906
7911
  const color = theme.sanity.color.base;
7907
7912
  return {
7908
7913
  "&:not([hidden])": {
@@ -8987,15 +8992,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
8987
8992
  var _a$6, _b$3, _c$1, _d;
8988
8993
  const keyframe = styled.keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8989
8994
  const animation = styled.css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
8990
- const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref25 => {
8995
+ const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref26 => {
8991
8996
  let {
8992
8997
  $visible
8993
- } = _ref25;
8998
+ } = _ref26;
8994
8999
  return $visible ? 1 : 0;
8995
- }, _ref26 => {
9000
+ }, _ref27 => {
8996
9001
  let {
8997
9002
  $animated
8998
- } = _ref26;
9003
+ } = _ref27;
8999
9004
  return $animated ? animation : styled.css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
9000
9005
  });
9001
9006
  const Root$4 = styled__default.default(Box)(responsiveRadiusStyle, skeletonStyle);
@@ -9026,12 +9031,12 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
9026
9031
  ref
9027
9032
  });
9028
9033
  });
9029
- const Root$3 = styled__default.default(Skeleton)(_ref27 => {
9034
+ const Root$3 = styled__default.default(Skeleton)(_ref28 => {
9030
9035
  let {
9031
9036
  $size,
9032
9037
  $style,
9033
9038
  theme
9034
- } = _ref27;
9039
+ } = _ref28;
9035
9040
  const {
9036
9041
  media
9037
9042
  } = theme.sanity;
@@ -9379,12 +9384,12 @@ function ToastProvider(props) {
9379
9384
  paddingY,
9380
9385
  children: /* @__PURE__ */jsxRuntime.jsx(framerMotion.AnimatePresence, {
9381
9386
  initial: false,
9382
- children: state.map(_ref28 => {
9387
+ children: state.map(_ref29 => {
9383
9388
  let {
9384
9389
  dismiss,
9385
9390
  id,
9386
9391
  params
9387
- } = _ref28;
9392
+ } = _ref29;
9388
9393
  return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
9389
9394
  animate: {
9390
9395
  opacity: 1,