@sanity/ui 0.37.15 → 0.37.18
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/textArea/textArea.d.ts.map +1 -1
- package/lib/dts/src/primitives/textInput/textInput.d.ts.map +1 -1
- package/lib/dts/src/styles/input/textInputStyle.d.ts +3 -1
- package/lib/dts/src/styles/input/textInputStyle.d.ts.map +1 -1
- package/lib/dts/src/theme/studioTheme/color.d.ts.map +1 -1
- package/lib/sanity-ui.js +35 -23
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.mjs +37 -25
- package/lib/sanity-ui.modern.mjs.map +1 -1
- package/lib/sanity-ui.module.js +35 -23
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +2 -2
- package/src/components/dialog/styles.ts +1 -1
- package/src/primitives/textArea/textArea.tsx +4 -0
- package/src/primitives/textInput/__workshop__/tones.tsx +222 -105
- package/src/primitives/textInput/textInput.tsx +5 -1
- package/src/styles/input/textInputStyle.ts +7 -5
- package/src/theme/studioTheme/color.ts +15 -14
package/lib/sanity-ui.module.js
CHANGED
|
@@ -1975,18 +1975,20 @@ var color = createColorTheme({
|
|
|
1975
1975
|
name = _ref.name;
|
|
1976
1976
|
|
|
1977
1977
|
if (name === 'default') {
|
|
1978
|
-
var
|
|
1978
|
+
var _tints = hues.gray;
|
|
1979
|
+
|
|
1980
|
+
var _skeletonFrom = dark ? _tints[900].hex : _tints[100].hex;
|
|
1979
1981
|
|
|
1980
1982
|
return {
|
|
1981
1983
|
fg: dark ? white$1.hex : black$1.hex,
|
|
1982
1984
|
bg: dark ? black$1.hex : white$1.hex,
|
|
1983
|
-
border:
|
|
1985
|
+
border: _tints[dark ? 800 : 200].hex,
|
|
1984
1986
|
focusRing: hues.blue[dark ? 500 : 500].hex,
|
|
1985
1987
|
shadow: {
|
|
1986
|
-
outline: rgba(
|
|
1987
|
-
umbra:
|
|
1988
|
-
penumbra:
|
|
1989
|
-
ambient:
|
|
1988
|
+
outline: rgba(_tints[500].hex, 0.4),
|
|
1989
|
+
umbra: dark ? rgba(_tints[950].hex, 0.4) : rgba(_tints[500].hex, 0.2),
|
|
1990
|
+
penumbra: dark ? rgba(_tints[950].hex, 0.28) : rgba(_tints[500].hex, 0.14),
|
|
1991
|
+
ambient: dark ? rgba(_tints[950].hex, 0.24) : rgba(_tints[500].hex, 0.12)
|
|
1990
1992
|
},
|
|
1991
1993
|
skeleton: {
|
|
1992
1994
|
from: _skeletonFrom,
|
|
@@ -1996,18 +1998,18 @@ var color = createColorTheme({
|
|
|
1996
1998
|
}
|
|
1997
1999
|
|
|
1998
2000
|
if (name === 'transparent') {
|
|
1999
|
-
var
|
|
2000
|
-
var _skeletonFrom2 =
|
|
2001
|
+
var _tints2 = tones["default"];
|
|
2002
|
+
var _skeletonFrom2 = _tints2[dark ? 800 : 200].hex;
|
|
2001
2003
|
return {
|
|
2002
|
-
fg:
|
|
2003
|
-
bg:
|
|
2004
|
-
border:
|
|
2004
|
+
fg: _tints2[dark ? 100 : 900].hex,
|
|
2005
|
+
bg: _tints2[dark ? 950 : 50].hex,
|
|
2006
|
+
border: _tints2[dark ? 800 : 300].hex,
|
|
2005
2007
|
focusRing: hues.blue[500].hex,
|
|
2006
2008
|
shadow: {
|
|
2007
|
-
outline: rgba(
|
|
2008
|
-
umbra:
|
|
2009
|
-
penumbra:
|
|
2010
|
-
ambient:
|
|
2009
|
+
outline: rgba(_tints2[500].hex, 0.4),
|
|
2010
|
+
umbra: dark ? rgba(_tints2[900].hex, 0.4) : rgba(_tints2[500].hex, 0.2),
|
|
2011
|
+
penumbra: dark ? rgba(_tints2[900].hex, 0.28) : rgba(_tints2[500].hex, 0.14),
|
|
2012
|
+
ambient: dark ? rgba(_tints2[900].hex, 0.24) : rgba(_tints2[500].hex, 0.12)
|
|
2011
2013
|
},
|
|
2012
2014
|
skeleton: {
|
|
2013
2015
|
from: _skeletonFrom2,
|
|
@@ -2024,10 +2026,10 @@ var color = createColorTheme({
|
|
|
2024
2026
|
border: tints[dark ? 800 : 200].hex,
|
|
2025
2027
|
focusRing: tints[500].hex,
|
|
2026
2028
|
shadow: {
|
|
2027
|
-
outline: rgba(tints[500].hex,
|
|
2028
|
-
umbra:
|
|
2029
|
-
penumbra:
|
|
2030
|
-
ambient:
|
|
2029
|
+
outline: rgba(tints[500].hex, 0.4),
|
|
2030
|
+
umbra: dark ? rgba(tints[900].hex, 0.4) : rgba(tints[500].hex, 0.2),
|
|
2031
|
+
penumbra: dark ? rgba(tints[900].hex, 0.28) : rgba(tints[500].hex, 0.14),
|
|
2032
|
+
ambient: dark ? rgba(tints[900].hex, 0.24) : rgba(tints[500].hex, 0.12)
|
|
2031
2033
|
},
|
|
2032
2034
|
skeleton: {
|
|
2033
2035
|
from: skeletonFrom,
|
|
@@ -3692,11 +3694,12 @@ function textInputRootStyle() {
|
|
|
3692
3694
|
}
|
|
3693
3695
|
function textInputBaseStyle(props) {
|
|
3694
3696
|
var theme = props.theme,
|
|
3697
|
+
$scheme = props.$scheme,
|
|
3695
3698
|
$tone = props.$tone,
|
|
3696
3699
|
$weight = props.$weight;
|
|
3697
3700
|
var font = theme.sanity.fonts.text;
|
|
3698
3701
|
var color = theme.sanity.color.input;
|
|
3699
|
-
return css(_templateObject2$n || (_templateObject2$n = _taggedTemplateLiteralLoose(["\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-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, $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);
|
|
3702
|
+
return css(_templateObject2$n || (_templateObject2$n = _taggedTemplateLiteralLoose(["\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);
|
|
3700
3703
|
}
|
|
3701
3704
|
function textInputFontSizeStyle(props) {
|
|
3702
3705
|
var theme = props.theme;
|
|
@@ -3715,13 +3718,14 @@ function textInputRepresentationStyle(props) {
|
|
|
3715
3718
|
var $border = props.$border,
|
|
3716
3719
|
$hasPrefix = props.$hasPrefix,
|
|
3717
3720
|
$hasSuffix = props.$hasSuffix,
|
|
3721
|
+
$scheme = props.$scheme,
|
|
3718
3722
|
$tone = props.$tone,
|
|
3719
3723
|
theme = props.theme;
|
|
3720
3724
|
var _theme$sanity2 = theme.sanity,
|
|
3721
3725
|
focusRing = _theme$sanity2.focusRing,
|
|
3722
3726
|
input = _theme$sanity2.input;
|
|
3723
3727
|
var color = theme.sanity.color.input;
|
|
3724
|
-
return css(_templateObject3$e || (_templateObject3$e = _taggedTemplateLiteralLoose(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + & {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n --input-box-shadow: ", ";\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n --input-box-shadow: ", ";\n }\n\n /* disabled */\n *:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n --input-box-shadow: ", ";\n }\n\n /* readOnly */\n *:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + & {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $tone, color["default"].enabled.bg, color["default"].enabled.fg, $border ? focusRingBorderStyle({
|
|
3728
|
+
return css(_templateObject3$e || (_templateObject3$e = _taggedTemplateLiteralLoose(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-scheme='", "'][data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + & {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n --input-box-shadow: ", ";\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n --input-box-shadow: ", ";\n }\n\n /* disabled */\n *:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n --input-box-shadow: ", ";\n }\n\n /* readOnly */\n *:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + & {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $scheme, $tone, color["default"].enabled.bg, color["default"].enabled.fg, $border ? focusRingBorderStyle({
|
|
3725
3729
|
color: color["default"].enabled.border,
|
|
3726
3730
|
width: input.border.width
|
|
3727
3731
|
}) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
|
|
@@ -6576,10 +6580,12 @@ var TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef) {
|
|
|
6576
6580
|
"data-ui": "TextArea"
|
|
6577
6581
|
}, /*#__PURE__*/React.createElement(InputRoot$1, null, /*#__PURE__*/React.createElement(Input$1, _extends({
|
|
6578
6582
|
"data-as": "textarea",
|
|
6583
|
+
"data-scheme": rootTheme.scheme,
|
|
6579
6584
|
"data-tone": rootTheme.tone
|
|
6580
6585
|
}, restProps, {
|
|
6581
6586
|
"$fontSize": useArrayProp(fontSize),
|
|
6582
6587
|
"$padding": useArrayProp(padding),
|
|
6588
|
+
"$scheme": rootTheme.scheme,
|
|
6583
6589
|
"$space": useArrayProp(0),
|
|
6584
6590
|
"$tone": rootTheme.tone,
|
|
6585
6591
|
"$weight": weight,
|
|
@@ -6588,7 +6594,9 @@ var TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef) {
|
|
|
6588
6594
|
})), /*#__PURE__*/React.createElement(Presentation$1, {
|
|
6589
6595
|
"$border": border,
|
|
6590
6596
|
"$radius": useArrayProp(radius),
|
|
6597
|
+
"$scheme": rootTheme.scheme,
|
|
6591
6598
|
"$tone": rootTheme.tone,
|
|
6599
|
+
"data-scheme": rootTheme.scheme,
|
|
6592
6600
|
"data-tone": rootTheme.tone
|
|
6593
6601
|
})));
|
|
6594
6602
|
});
|
|
@@ -6689,7 +6697,9 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef)
|
|
|
6689
6697
|
"$hasPrefix": $hasPrefix,
|
|
6690
6698
|
"$hasSuffix": $hasSuffix,
|
|
6691
6699
|
"$radius": radius,
|
|
6700
|
+
"$scheme": rootTheme.scheme,
|
|
6692
6701
|
"$tone": rootTheme.tone,
|
|
6702
|
+
"data-scheme": rootTheme.scheme,
|
|
6693
6703
|
"data-tone": rootTheme.tone
|
|
6694
6704
|
}, icon && /*#__PURE__*/React.createElement(LeftBox, {
|
|
6695
6705
|
padding: padding
|
|
@@ -6700,7 +6710,7 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef)
|
|
|
6700
6710
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
6701
6711
|
size: fontSize
|
|
6702
6712
|
}, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight))));
|
|
6703
|
-
}, [border, fontSize, icon, iconRight, padding, radius, rootTheme
|
|
6713
|
+
}, [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
|
|
6704
6714
|
|
|
6705
6715
|
var clearButtonBoxPadding = useMemo(function () {
|
|
6706
6716
|
return padding.map(function (v) {
|
|
@@ -6755,12 +6765,14 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef)
|
|
|
6755
6765
|
tone: rootTheme.tone
|
|
6756
6766
|
}, prefixNode, /*#__PURE__*/React.createElement(InputRoot, null, /*#__PURE__*/React.createElement(Input, _extends({
|
|
6757
6767
|
"data-as": "input",
|
|
6768
|
+
"data-scheme": rootTheme.scheme,
|
|
6758
6769
|
"data-tone": rootTheme.tone
|
|
6759
6770
|
}, restProps, {
|
|
6760
6771
|
"$fontSize": fontSize,
|
|
6761
6772
|
"$iconLeft": $hasIcon,
|
|
6762
6773
|
"$iconRight": $hasIconRight || $hasClearButton,
|
|
6763
6774
|
"$padding": padding,
|
|
6775
|
+
"$scheme": rootTheme.scheme,
|
|
6764
6776
|
"$space": space,
|
|
6765
6777
|
"$tone": rootTheme.tone,
|
|
6766
6778
|
"$weight": weight,
|
|
@@ -7724,7 +7736,7 @@ function dialogStyle(_ref) {
|
|
|
7724
7736
|
alignItems: 'center',
|
|
7725
7737
|
justifyContent: 'center',
|
|
7726
7738
|
outline: 'none',
|
|
7727
|
-
background: color.shadow.
|
|
7739
|
+
background: color.shadow.umbra
|
|
7728
7740
|
};
|
|
7729
7741
|
}
|
|
7730
7742
|
function responsiveDialogPositionStyle(props) {
|