@spark-web/text-input 6.0.0-rc.0 → 6.0.0
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/CHANGELOG.md +50 -9
- package/dist/declarations/src/children-to-adornments.d.ts +2 -2
- package/dist/declarations/src/input-adornment.d.ts +3 -3
- package/dist/declarations/src/input-container.d.ts +1 -1
- package/dist/declarations/src/text-input.d.ts +2530 -2502
- package/dist/spark-web-text-input.cjs.d.ts +1 -1
- package/dist/spark-web-text-input.cjs.dev.js +24 -12
- package/dist/spark-web-text-input.cjs.prod.js +24 -12
- package/dist/spark-web-text-input.esm.js +24 -12
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./declarations/src/index";
|
|
1
|
+
export * from "./declarations/src/index.js";
|
|
2
2
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhcmstd2ViLXRleHQtaW5wdXQuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
|
@@ -114,11 +114,12 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
114
114
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 1),
|
|
115
115
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
116
116
|
disabled = _useFieldContext2$.disabled,
|
|
117
|
-
invalid = _useFieldContext2$.invalid
|
|
117
|
+
invalid = _useFieldContext2$.invalid,
|
|
118
|
+
readOnly = _useFieldContext2$.readOnly;
|
|
118
119
|
return jsxRuntime.jsxs(box.Box, _objectSpread(_objectSpread({
|
|
119
120
|
borderRadius: "small",
|
|
120
121
|
position: "relative",
|
|
121
|
-
background: disabled ? 'inputDisabled' : 'input'
|
|
122
|
+
background: disabled || readOnly ? 'inputDisabled' : 'input'
|
|
122
123
|
}, boxProps), {}, {
|
|
123
124
|
children: [startAdornment, children, jsxRuntime.jsx(FocusIndicator, {
|
|
124
125
|
invalid: invalid
|
|
@@ -126,7 +127,9 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
126
127
|
}));
|
|
127
128
|
};
|
|
128
129
|
var FocusIndicator = function FocusIndicator(_ref2) {
|
|
130
|
+
var _theme$components$tex, _theme$components$tex2, _theme$components$tex3;
|
|
129
131
|
var invalid = _ref2.invalid;
|
|
132
|
+
var theme$1 = theme.useTheme();
|
|
130
133
|
return jsxRuntime.jsx(box.Box, {
|
|
131
134
|
"aria-hidden": "true",
|
|
132
135
|
as: "span",
|
|
@@ -135,14 +138,14 @@ var FocusIndicator = function FocusIndicator(_ref2) {
|
|
|
135
138
|
}
|
|
136
139
|
// Styles
|
|
137
140
|
,
|
|
138
|
-
border: invalid ? 'critical' :
|
|
139
|
-
borderRadius:
|
|
141
|
+
border: invalid ? 'critical' : (_theme$components$tex = theme$1.components.textInput) === null || _theme$components$tex === void 0 ? void 0 : _theme$components$tex.borderColor,
|
|
142
|
+
borderRadius: (_theme$components$tex2 = theme$1.components.textInput) === null || _theme$components$tex2 === void 0 ? void 0 : _theme$components$tex2.borderRadius,
|
|
140
143
|
position: "absolute",
|
|
141
144
|
bottom: 0,
|
|
142
145
|
left: 0,
|
|
143
146
|
right: 0,
|
|
144
147
|
top: 0,
|
|
145
|
-
shadow:
|
|
148
|
+
shadow: (_theme$components$tex3 = theme$1.components.textInput) === null || _theme$components$tex3 === void 0 ? void 0 : _theme$components$tex3.boxShadow,
|
|
146
149
|
css: react$1.css({
|
|
147
150
|
pointerEvents: 'none'
|
|
148
151
|
})
|
|
@@ -165,7 +168,7 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
165
168
|
};
|
|
166
169
|
}
|
|
167
170
|
react.Children.forEach(children, function (child) {
|
|
168
|
-
if (
|
|
171
|
+
if (/*#__PURE__*/react.isValidElement(child)) {
|
|
169
172
|
if (child.props.placement === 'end') {
|
|
170
173
|
endAdornment = child;
|
|
171
174
|
}
|
|
@@ -180,17 +183,19 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
180
183
|
};
|
|
181
184
|
};
|
|
182
185
|
|
|
183
|
-
var _excluded = ["children", "data"];
|
|
186
|
+
var _excluded = ["children", "data", "overflowStrategy"];
|
|
184
187
|
/** Organize and emphasize information quickly and effectively in a list of text elements. */
|
|
185
188
|
var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
186
189
|
var children = _ref.children,
|
|
187
190
|
data = _ref.data,
|
|
191
|
+
overflowStrategy = _ref.overflowStrategy,
|
|
188
192
|
consumerProps = _objectWithoutProperties(_ref, _excluded);
|
|
189
193
|
var _useFieldContext = field.useFieldContext(),
|
|
190
194
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
191
195
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
192
196
|
disabled = _useFieldContext2$.disabled,
|
|
193
197
|
invalid = _useFieldContext2$.invalid,
|
|
198
|
+
readOnly = _useFieldContext2$.readOnly,
|
|
194
199
|
a11yProps = _useFieldContext2[1];
|
|
195
200
|
var _childrenToAdornments = childrenToAdornments(children),
|
|
196
201
|
startAdornment = _childrenToAdornments.startAdornment,
|
|
@@ -199,7 +204,9 @@ var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
199
204
|
disabled: disabled,
|
|
200
205
|
invalid: invalid,
|
|
201
206
|
startAdornment: Boolean(startAdornment),
|
|
202
|
-
endAdornment: Boolean(endAdornment)
|
|
207
|
+
endAdornment: Boolean(endAdornment),
|
|
208
|
+
readOnly: readOnly,
|
|
209
|
+
overflowStrategy: overflowStrategy
|
|
203
210
|
}),
|
|
204
211
|
_useInputStyles2 = _slicedToArray(_useInputStyles, 2),
|
|
205
212
|
boxProps = _useInputStyles2[0],
|
|
@@ -214,6 +221,7 @@ var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
214
221
|
css: react$1.css(inputStyles),
|
|
215
222
|
data: data,
|
|
216
223
|
disabled: disabled,
|
|
224
|
+
readOnly: readOnly,
|
|
217
225
|
ref: forwardedRef
|
|
218
226
|
}))
|
|
219
227
|
});
|
|
@@ -225,17 +233,21 @@ TextInput.displayName = 'TextInput';
|
|
|
225
233
|
* item is a CSS object to be passed to Emotion's `css` function
|
|
226
234
|
**/
|
|
227
235
|
var useInputStyles = function useInputStyles(_ref2) {
|
|
236
|
+
var _theme$components$tex, _theme$components$tex2;
|
|
228
237
|
var disabled = _ref2.disabled,
|
|
229
238
|
startAdornment = _ref2.startAdornment,
|
|
230
|
-
endAdornment = _ref2.endAdornment
|
|
239
|
+
endAdornment = _ref2.endAdornment,
|
|
240
|
+
readOnly = _ref2.readOnly,
|
|
241
|
+
_ref2$overflowStrateg = _ref2.overflowStrategy,
|
|
242
|
+
overflowStrategy = _ref2$overflowStrateg === void 0 ? 'truncate' : _ref2$overflowStrateg;
|
|
231
243
|
var theme$1 = theme.useTheme();
|
|
232
|
-
var overflowStyles = text.useOverflowStrategy(
|
|
244
|
+
var overflowStyles = text.useOverflowStrategy(overflowStrategy);
|
|
233
245
|
var focusRingStyles = a11y.useFocusRing({
|
|
234
246
|
always: true
|
|
235
247
|
});
|
|
236
248
|
var textStyles = text.useText({
|
|
237
249
|
baseline: false,
|
|
238
|
-
tone: disabled ? '
|
|
250
|
+
tone: disabled || readOnly ? 'field' : 'neutral',
|
|
239
251
|
size: 'standard',
|
|
240
252
|
weight: 'regular'
|
|
241
253
|
});
|
|
@@ -251,7 +263,7 @@ var useInputStyles = function useInputStyles(_ref2) {
|
|
|
251
263
|
width: 'full'
|
|
252
264
|
}, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typographyStyles), responsiveStyles), overflowStyles), {}, {
|
|
253
265
|
':enabled': {
|
|
254
|
-
':focus + [data-focus-indicator]': _objectSpread({
|
|
266
|
+
':focus + [data-focus-indicator]': (_theme$components$tex = (_theme$components$tex2 = theme$1.components.textInput) === null || _theme$components$tex2 === void 0 ? void 0 : _theme$components$tex2.focused) !== null && _theme$components$tex !== void 0 ? _theme$components$tex : _objectSpread({
|
|
255
267
|
borderColor: theme$1.border.color.fieldAccent
|
|
256
268
|
}, focusRingStyles)
|
|
257
269
|
},
|
|
@@ -114,11 +114,12 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
114
114
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 1),
|
|
115
115
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
116
116
|
disabled = _useFieldContext2$.disabled,
|
|
117
|
-
invalid = _useFieldContext2$.invalid
|
|
117
|
+
invalid = _useFieldContext2$.invalid,
|
|
118
|
+
readOnly = _useFieldContext2$.readOnly;
|
|
118
119
|
return jsxRuntime.jsxs(box.Box, _objectSpread(_objectSpread({
|
|
119
120
|
borderRadius: "small",
|
|
120
121
|
position: "relative",
|
|
121
|
-
background: disabled ? 'inputDisabled' : 'input'
|
|
122
|
+
background: disabled || readOnly ? 'inputDisabled' : 'input'
|
|
122
123
|
}, boxProps), {}, {
|
|
123
124
|
children: [startAdornment, children, jsxRuntime.jsx(FocusIndicator, {
|
|
124
125
|
invalid: invalid
|
|
@@ -126,7 +127,9 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
126
127
|
}));
|
|
127
128
|
};
|
|
128
129
|
var FocusIndicator = function FocusIndicator(_ref2) {
|
|
130
|
+
var _theme$components$tex, _theme$components$tex2, _theme$components$tex3;
|
|
129
131
|
var invalid = _ref2.invalid;
|
|
132
|
+
var theme$1 = theme.useTheme();
|
|
130
133
|
return jsxRuntime.jsx(box.Box, {
|
|
131
134
|
"aria-hidden": "true",
|
|
132
135
|
as: "span",
|
|
@@ -135,14 +138,14 @@ var FocusIndicator = function FocusIndicator(_ref2) {
|
|
|
135
138
|
}
|
|
136
139
|
// Styles
|
|
137
140
|
,
|
|
138
|
-
border: invalid ? 'critical' :
|
|
139
|
-
borderRadius:
|
|
141
|
+
border: invalid ? 'critical' : (_theme$components$tex = theme$1.components.textInput) === null || _theme$components$tex === void 0 ? void 0 : _theme$components$tex.borderColor,
|
|
142
|
+
borderRadius: (_theme$components$tex2 = theme$1.components.textInput) === null || _theme$components$tex2 === void 0 ? void 0 : _theme$components$tex2.borderRadius,
|
|
140
143
|
position: "absolute",
|
|
141
144
|
bottom: 0,
|
|
142
145
|
left: 0,
|
|
143
146
|
right: 0,
|
|
144
147
|
top: 0,
|
|
145
|
-
shadow:
|
|
148
|
+
shadow: (_theme$components$tex3 = theme$1.components.textInput) === null || _theme$components$tex3 === void 0 ? void 0 : _theme$components$tex3.boxShadow,
|
|
146
149
|
css: react$1.css({
|
|
147
150
|
pointerEvents: 'none'
|
|
148
151
|
})
|
|
@@ -165,7 +168,7 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
165
168
|
};
|
|
166
169
|
}
|
|
167
170
|
react.Children.forEach(children, function (child) {
|
|
168
|
-
if (
|
|
171
|
+
if (/*#__PURE__*/react.isValidElement(child)) {
|
|
169
172
|
if (child.props.placement === 'end') {
|
|
170
173
|
endAdornment = child;
|
|
171
174
|
}
|
|
@@ -180,17 +183,19 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
180
183
|
};
|
|
181
184
|
};
|
|
182
185
|
|
|
183
|
-
var _excluded = ["children", "data"];
|
|
186
|
+
var _excluded = ["children", "data", "overflowStrategy"];
|
|
184
187
|
/** Organize and emphasize information quickly and effectively in a list of text elements. */
|
|
185
188
|
var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
186
189
|
var children = _ref.children,
|
|
187
190
|
data = _ref.data,
|
|
191
|
+
overflowStrategy = _ref.overflowStrategy,
|
|
188
192
|
consumerProps = _objectWithoutProperties(_ref, _excluded);
|
|
189
193
|
var _useFieldContext = field.useFieldContext(),
|
|
190
194
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
191
195
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
192
196
|
disabled = _useFieldContext2$.disabled,
|
|
193
197
|
invalid = _useFieldContext2$.invalid,
|
|
198
|
+
readOnly = _useFieldContext2$.readOnly,
|
|
194
199
|
a11yProps = _useFieldContext2[1];
|
|
195
200
|
var _childrenToAdornments = childrenToAdornments(children),
|
|
196
201
|
startAdornment = _childrenToAdornments.startAdornment,
|
|
@@ -199,7 +204,9 @@ var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
199
204
|
disabled: disabled,
|
|
200
205
|
invalid: invalid,
|
|
201
206
|
startAdornment: Boolean(startAdornment),
|
|
202
|
-
endAdornment: Boolean(endAdornment)
|
|
207
|
+
endAdornment: Boolean(endAdornment),
|
|
208
|
+
readOnly: readOnly,
|
|
209
|
+
overflowStrategy: overflowStrategy
|
|
203
210
|
}),
|
|
204
211
|
_useInputStyles2 = _slicedToArray(_useInputStyles, 2),
|
|
205
212
|
boxProps = _useInputStyles2[0],
|
|
@@ -214,6 +221,7 @@ var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
214
221
|
css: react$1.css(inputStyles),
|
|
215
222
|
data: data,
|
|
216
223
|
disabled: disabled,
|
|
224
|
+
readOnly: readOnly,
|
|
217
225
|
ref: forwardedRef
|
|
218
226
|
}))
|
|
219
227
|
});
|
|
@@ -225,17 +233,21 @@ TextInput.displayName = 'TextInput';
|
|
|
225
233
|
* item is a CSS object to be passed to Emotion's `css` function
|
|
226
234
|
**/
|
|
227
235
|
var useInputStyles = function useInputStyles(_ref2) {
|
|
236
|
+
var _theme$components$tex, _theme$components$tex2;
|
|
228
237
|
var disabled = _ref2.disabled,
|
|
229
238
|
startAdornment = _ref2.startAdornment,
|
|
230
|
-
endAdornment = _ref2.endAdornment
|
|
239
|
+
endAdornment = _ref2.endAdornment,
|
|
240
|
+
readOnly = _ref2.readOnly,
|
|
241
|
+
_ref2$overflowStrateg = _ref2.overflowStrategy,
|
|
242
|
+
overflowStrategy = _ref2$overflowStrateg === void 0 ? 'truncate' : _ref2$overflowStrateg;
|
|
231
243
|
var theme$1 = theme.useTheme();
|
|
232
|
-
var overflowStyles = text.useOverflowStrategy(
|
|
244
|
+
var overflowStyles = text.useOverflowStrategy(overflowStrategy);
|
|
233
245
|
var focusRingStyles = a11y.useFocusRing({
|
|
234
246
|
always: true
|
|
235
247
|
});
|
|
236
248
|
var textStyles = text.useText({
|
|
237
249
|
baseline: false,
|
|
238
|
-
tone: disabled ? '
|
|
250
|
+
tone: disabled || readOnly ? 'field' : 'neutral',
|
|
239
251
|
size: 'standard',
|
|
240
252
|
weight: 'regular'
|
|
241
253
|
});
|
|
@@ -251,7 +263,7 @@ var useInputStyles = function useInputStyles(_ref2) {
|
|
|
251
263
|
width: 'full'
|
|
252
264
|
}, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typographyStyles), responsiveStyles), overflowStyles), {}, {
|
|
253
265
|
':enabled': {
|
|
254
|
-
':focus + [data-focus-indicator]': _objectSpread({
|
|
266
|
+
':focus + [data-focus-indicator]': (_theme$components$tex = (_theme$components$tex2 = theme$1.components.textInput) === null || _theme$components$tex2 === void 0 ? void 0 : _theme$components$tex2.focused) !== null && _theme$components$tex !== void 0 ? _theme$components$tex : _objectSpread({
|
|
255
267
|
borderColor: theme$1.border.color.fieldAccent
|
|
256
268
|
}, focusRingStyles)
|
|
257
269
|
},
|
|
@@ -110,11 +110,12 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
110
110
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 1),
|
|
111
111
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
112
112
|
disabled = _useFieldContext2$.disabled,
|
|
113
|
-
invalid = _useFieldContext2$.invalid
|
|
113
|
+
invalid = _useFieldContext2$.invalid,
|
|
114
|
+
readOnly = _useFieldContext2$.readOnly;
|
|
114
115
|
return jsxs(Box, _objectSpread(_objectSpread({
|
|
115
116
|
borderRadius: "small",
|
|
116
117
|
position: "relative",
|
|
117
|
-
background: disabled ? 'inputDisabled' : 'input'
|
|
118
|
+
background: disabled || readOnly ? 'inputDisabled' : 'input'
|
|
118
119
|
}, boxProps), {}, {
|
|
119
120
|
children: [startAdornment, children, jsx(FocusIndicator, {
|
|
120
121
|
invalid: invalid
|
|
@@ -122,7 +123,9 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
122
123
|
}));
|
|
123
124
|
};
|
|
124
125
|
var FocusIndicator = function FocusIndicator(_ref2) {
|
|
126
|
+
var _theme$components$tex, _theme$components$tex2, _theme$components$tex3;
|
|
125
127
|
var invalid = _ref2.invalid;
|
|
128
|
+
var theme = useTheme();
|
|
126
129
|
return jsx(Box, {
|
|
127
130
|
"aria-hidden": "true",
|
|
128
131
|
as: "span",
|
|
@@ -131,14 +134,14 @@ var FocusIndicator = function FocusIndicator(_ref2) {
|
|
|
131
134
|
}
|
|
132
135
|
// Styles
|
|
133
136
|
,
|
|
134
|
-
border: invalid ? 'critical' :
|
|
135
|
-
borderRadius:
|
|
137
|
+
border: invalid ? 'critical' : (_theme$components$tex = theme.components.textInput) === null || _theme$components$tex === void 0 ? void 0 : _theme$components$tex.borderColor,
|
|
138
|
+
borderRadius: (_theme$components$tex2 = theme.components.textInput) === null || _theme$components$tex2 === void 0 ? void 0 : _theme$components$tex2.borderRadius,
|
|
136
139
|
position: "absolute",
|
|
137
140
|
bottom: 0,
|
|
138
141
|
left: 0,
|
|
139
142
|
right: 0,
|
|
140
143
|
top: 0,
|
|
141
|
-
shadow:
|
|
144
|
+
shadow: (_theme$components$tex3 = theme.components.textInput) === null || _theme$components$tex3 === void 0 ? void 0 : _theme$components$tex3.boxShadow,
|
|
142
145
|
css: css({
|
|
143
146
|
pointerEvents: 'none'
|
|
144
147
|
})
|
|
@@ -161,7 +164,7 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
161
164
|
};
|
|
162
165
|
}
|
|
163
166
|
Children.forEach(children, function (child) {
|
|
164
|
-
if (
|
|
167
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
|
165
168
|
if (child.props.placement === 'end') {
|
|
166
169
|
endAdornment = child;
|
|
167
170
|
}
|
|
@@ -176,17 +179,19 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
176
179
|
};
|
|
177
180
|
};
|
|
178
181
|
|
|
179
|
-
var _excluded = ["children", "data"];
|
|
182
|
+
var _excluded = ["children", "data", "overflowStrategy"];
|
|
180
183
|
/** Organize and emphasize information quickly and effectively in a list of text elements. */
|
|
181
184
|
var TextInput = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
182
185
|
var children = _ref.children,
|
|
183
186
|
data = _ref.data,
|
|
187
|
+
overflowStrategy = _ref.overflowStrategy,
|
|
184
188
|
consumerProps = _objectWithoutProperties(_ref, _excluded);
|
|
185
189
|
var _useFieldContext = useFieldContext(),
|
|
186
190
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
187
191
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
188
192
|
disabled = _useFieldContext2$.disabled,
|
|
189
193
|
invalid = _useFieldContext2$.invalid,
|
|
194
|
+
readOnly = _useFieldContext2$.readOnly,
|
|
190
195
|
a11yProps = _useFieldContext2[1];
|
|
191
196
|
var _childrenToAdornments = childrenToAdornments(children),
|
|
192
197
|
startAdornment = _childrenToAdornments.startAdornment,
|
|
@@ -195,7 +200,9 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
195
200
|
disabled: disabled,
|
|
196
201
|
invalid: invalid,
|
|
197
202
|
startAdornment: Boolean(startAdornment),
|
|
198
|
-
endAdornment: Boolean(endAdornment)
|
|
203
|
+
endAdornment: Boolean(endAdornment),
|
|
204
|
+
readOnly: readOnly,
|
|
205
|
+
overflowStrategy: overflowStrategy
|
|
199
206
|
}),
|
|
200
207
|
_useInputStyles2 = _slicedToArray(_useInputStyles, 2),
|
|
201
208
|
boxProps = _useInputStyles2[0],
|
|
@@ -210,6 +217,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
210
217
|
css: css(inputStyles),
|
|
211
218
|
data: data,
|
|
212
219
|
disabled: disabled,
|
|
220
|
+
readOnly: readOnly,
|
|
213
221
|
ref: forwardedRef
|
|
214
222
|
}))
|
|
215
223
|
});
|
|
@@ -221,17 +229,21 @@ TextInput.displayName = 'TextInput';
|
|
|
221
229
|
* item is a CSS object to be passed to Emotion's `css` function
|
|
222
230
|
**/
|
|
223
231
|
var useInputStyles = function useInputStyles(_ref2) {
|
|
232
|
+
var _theme$components$tex, _theme$components$tex2;
|
|
224
233
|
var disabled = _ref2.disabled,
|
|
225
234
|
startAdornment = _ref2.startAdornment,
|
|
226
|
-
endAdornment = _ref2.endAdornment
|
|
235
|
+
endAdornment = _ref2.endAdornment,
|
|
236
|
+
readOnly = _ref2.readOnly,
|
|
237
|
+
_ref2$overflowStrateg = _ref2.overflowStrategy,
|
|
238
|
+
overflowStrategy = _ref2$overflowStrateg === void 0 ? 'truncate' : _ref2$overflowStrateg;
|
|
227
239
|
var theme = useTheme();
|
|
228
|
-
var overflowStyles = useOverflowStrategy(
|
|
240
|
+
var overflowStyles = useOverflowStrategy(overflowStrategy);
|
|
229
241
|
var focusRingStyles = useFocusRing({
|
|
230
242
|
always: true
|
|
231
243
|
});
|
|
232
244
|
var textStyles = useText({
|
|
233
245
|
baseline: false,
|
|
234
|
-
tone: disabled ? '
|
|
246
|
+
tone: disabled || readOnly ? 'field' : 'neutral',
|
|
235
247
|
size: 'standard',
|
|
236
248
|
weight: 'regular'
|
|
237
249
|
});
|
|
@@ -247,7 +259,7 @@ var useInputStyles = function useInputStyles(_ref2) {
|
|
|
247
259
|
width: 'full'
|
|
248
260
|
}, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typographyStyles), responsiveStyles), overflowStyles), {}, {
|
|
249
261
|
':enabled': {
|
|
250
|
-
':focus + [data-focus-indicator]': _objectSpread({
|
|
262
|
+
':focus + [data-focus-indicator]': (_theme$components$tex = (_theme$components$tex2 = theme.components.textInput) === null || _theme$components$tex2 === void 0 ? void 0 : _theme$components$tex2.focused) !== null && _theme$components$tex !== void 0 ? _theme$components$tex : _objectSpread({
|
|
251
263
|
borderColor: theme.border.color.fieldAccent
|
|
252
264
|
}, focusRingStyles)
|
|
253
265
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/text-input",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"homepage": "https://github.com/brighte-labs/spark-web#readme",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.25.0",
|
|
19
19
|
"@emotion/react": "^11.14.0",
|
|
20
|
-
"@spark-web/a11y": "^5.3.0
|
|
21
|
-
"@spark-web/box": "^6.0.0
|
|
22
|
-
"@spark-web/text": "^5.3.0
|
|
23
|
-
"@spark-web/utils": "^5.1.0
|
|
20
|
+
"@spark-web/a11y": "^5.3.0",
|
|
21
|
+
"@spark-web/box": "^6.0.0",
|
|
22
|
+
"@spark-web/text": "^5.3.0",
|
|
23
|
+
"@spark-web/utils": "^5.1.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@spark-web/field": "^5.
|
|
27
|
-
"@spark-web/theme": "^5.
|
|
26
|
+
"@spark-web/field": "^5.3.0",
|
|
27
|
+
"@spark-web/theme": "^5.13.0",
|
|
28
28
|
"@types/react": "^19.1.0",
|
|
29
29
|
"react": "^19.1.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@spark-web/field": "^5.
|
|
33
|
-
"@spark-web/theme": "^5.
|
|
34
|
-
"react": "
|
|
32
|
+
"@spark-web/field": "^5.3.0",
|
|
33
|
+
"@spark-web/theme": "^5.13.0",
|
|
34
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=14"
|