@sanity/ui 0.37.15 → 0.37.16
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/sanity-ui.js +11 -3
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.mjs +13 -5
- package/lib/sanity-ui.modern.mjs.map +1 -1
- package/lib/sanity-ui.module.js +11 -3
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +2 -2
- package/src/primitives/textArea/textArea.tsx +2 -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/lib/sanity-ui.module.js
CHANGED
|
@@ -3692,11 +3692,12 @@ function textInputRootStyle() {
|
|
|
3692
3692
|
}
|
|
3693
3693
|
function textInputBaseStyle(props) {
|
|
3694
3694
|
var theme = props.theme,
|
|
3695
|
+
$scheme = props.$scheme,
|
|
3695
3696
|
$tone = props.$tone,
|
|
3696
3697
|
$weight = props.$weight;
|
|
3697
3698
|
var font = theme.sanity.fonts.text;
|
|
3698
3699
|
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);
|
|
3700
|
+
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
3701
|
}
|
|
3701
3702
|
function textInputFontSizeStyle(props) {
|
|
3702
3703
|
var theme = props.theme;
|
|
@@ -3715,13 +3716,14 @@ function textInputRepresentationStyle(props) {
|
|
|
3715
3716
|
var $border = props.$border,
|
|
3716
3717
|
$hasPrefix = props.$hasPrefix,
|
|
3717
3718
|
$hasSuffix = props.$hasSuffix,
|
|
3719
|
+
$scheme = props.$scheme,
|
|
3718
3720
|
$tone = props.$tone,
|
|
3719
3721
|
theme = props.theme;
|
|
3720
3722
|
var _theme$sanity2 = theme.sanity,
|
|
3721
3723
|
focusRing = _theme$sanity2.focusRing,
|
|
3722
3724
|
input = _theme$sanity2.input;
|
|
3723
3725
|
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({
|
|
3726
|
+
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
3727
|
color: color["default"].enabled.border,
|
|
3726
3728
|
width: input.border.width
|
|
3727
3729
|
}) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
|
|
@@ -6580,6 +6582,7 @@ var TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef) {
|
|
|
6580
6582
|
}, restProps, {
|
|
6581
6583
|
"$fontSize": useArrayProp(fontSize),
|
|
6582
6584
|
"$padding": useArrayProp(padding),
|
|
6585
|
+
"$scheme": rootTheme.scheme,
|
|
6583
6586
|
"$space": useArrayProp(0),
|
|
6584
6587
|
"$tone": rootTheme.tone,
|
|
6585
6588
|
"$weight": weight,
|
|
@@ -6588,6 +6591,7 @@ var TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef) {
|
|
|
6588
6591
|
})), /*#__PURE__*/React.createElement(Presentation$1, {
|
|
6589
6592
|
"$border": border,
|
|
6590
6593
|
"$radius": useArrayProp(radius),
|
|
6594
|
+
"$scheme": rootTheme.scheme,
|
|
6591
6595
|
"$tone": rootTheme.tone,
|
|
6592
6596
|
"data-tone": rootTheme.tone
|
|
6593
6597
|
})));
|
|
@@ -6689,7 +6693,9 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef)
|
|
|
6689
6693
|
"$hasPrefix": $hasPrefix,
|
|
6690
6694
|
"$hasSuffix": $hasSuffix,
|
|
6691
6695
|
"$radius": radius,
|
|
6696
|
+
"$scheme": rootTheme.scheme,
|
|
6692
6697
|
"$tone": rootTheme.tone,
|
|
6698
|
+
"data-scheme": rootTheme.scheme,
|
|
6693
6699
|
"data-tone": rootTheme.tone
|
|
6694
6700
|
}, icon && /*#__PURE__*/React.createElement(LeftBox, {
|
|
6695
6701
|
padding: padding
|
|
@@ -6700,7 +6706,7 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef)
|
|
|
6700
6706
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
6701
6707
|
size: fontSize
|
|
6702
6708
|
}, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight))));
|
|
6703
|
-
}, [border, fontSize, icon, iconRight, padding, radius, rootTheme
|
|
6709
|
+
}, [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
|
|
6704
6710
|
|
|
6705
6711
|
var clearButtonBoxPadding = useMemo(function () {
|
|
6706
6712
|
return padding.map(function (v) {
|
|
@@ -6755,12 +6761,14 @@ var TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef)
|
|
|
6755
6761
|
tone: rootTheme.tone
|
|
6756
6762
|
}, prefixNode, /*#__PURE__*/React.createElement(InputRoot, null, /*#__PURE__*/React.createElement(Input, _extends({
|
|
6757
6763
|
"data-as": "input",
|
|
6764
|
+
"data-scheme": rootTheme.scheme,
|
|
6758
6765
|
"data-tone": rootTheme.tone
|
|
6759
6766
|
}, restProps, {
|
|
6760
6767
|
"$fontSize": fontSize,
|
|
6761
6768
|
"$iconLeft": $hasIcon,
|
|
6762
6769
|
"$iconRight": $hasIconRight || $hasClearButton,
|
|
6763
6770
|
"$padding": padding,
|
|
6771
|
+
"$scheme": rootTheme.scheme,
|
|
6764
6772
|
"$space": space,
|
|
6765
6773
|
"$tone": rootTheme.tone,
|
|
6766
6774
|
"$weight": weight,
|