@spark-web/text-input 5.3.0 → 6.0.0-rc.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
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @spark-web/text-input
|
|
2
2
|
|
|
3
|
+
## 6.0.0-rc.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- update react version and other packages
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @spark-web/field@5.2.0-rc.0
|
|
13
|
+
- @spark-web/theme@5.12.0-rc.0
|
|
14
|
+
- @spark-web/utils@5.1.0-rc.0
|
|
15
|
+
- @spark-web/a11y@5.3.0-rc.0
|
|
16
|
+
- @spark-web/text@5.3.0-rc.0
|
|
17
|
+
- @spark-web/box@6.0.0-rc.0
|
|
18
|
+
|
|
3
19
|
## 5.3.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { FieldState } from '@spark-web/field';
|
|
2
|
-
import type { TextOverflowStrategy } from '@spark-web/text';
|
|
3
2
|
import type { DataAttributeMap } from '@spark-web/utils/internal';
|
|
4
3
|
import type { InputHTMLAttributes } from 'react';
|
|
5
4
|
import type { AdornmentsAsChildren } from "./children-to-adornments.js";
|
|
6
5
|
declare type ValidTypes = 'text' | 'password' | 'email' | 'search' | 'number' | 'tel' | 'url';
|
|
7
6
|
declare type ValidModes = 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
|
|
8
|
-
declare type NativeInputProps = Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'onBlur' | 'onChange' | 'onFocus' | 'placeholder' | 'value' | 'required'
|
|
7
|
+
declare type NativeInputProps = Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'onBlur' | 'onChange' | 'onFocus' | 'placeholder' | 'value' | 'required'>;
|
|
9
8
|
export declare type TextInputProps = {
|
|
10
9
|
/** Sets data attributes for the element. */
|
|
11
10
|
data?: DataAttributeMap;
|
|
@@ -23,8 +22,6 @@ export declare type TextInputProps = {
|
|
|
23
22
|
* otherwise it will not be rendered.
|
|
24
23
|
*/
|
|
25
24
|
children?: AdornmentsAsChildren;
|
|
26
|
-
/** Manage how text behaves with regard to overflow. */
|
|
27
|
-
overflowStrategy?: TextOverflowStrategy;
|
|
28
25
|
} & NativeInputProps;
|
|
29
26
|
/** Organize and emphasize information quickly and effectively in a list of text elements. */
|
|
30
27
|
export declare const TextInput: import("react").ForwardRefExoticComponent<{
|
|
@@ -44,42 +41,34 @@ export declare const TextInput: import("react").ForwardRefExoticComponent<{
|
|
|
44
41
|
* otherwise it will not be rendered.
|
|
45
42
|
*/
|
|
46
43
|
children?: AdornmentsAsChildren;
|
|
47
|
-
/** Manage how text behaves with regard to overflow. */
|
|
48
|
-
overflowStrategy?: "truncate" | "nowrap" | "breakword" | undefined;
|
|
49
44
|
} & NativeInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
50
45
|
export declare type UseInputStylesProps = FieldState & {
|
|
51
46
|
startAdornment?: boolean;
|
|
52
47
|
endAdornment?: boolean;
|
|
53
|
-
readOnly?: boolean;
|
|
54
|
-
overflowStrategy?: TextOverflowStrategy;
|
|
55
48
|
};
|
|
56
49
|
/**
|
|
57
50
|
* Returns a tuple where the first item is an object of props to spread onto the
|
|
58
51
|
* underlying Box component that our inputs are created with, and the second
|
|
59
52
|
* item is a CSS object to be passed to Emotion's `css` function
|
|
60
53
|
**/
|
|
61
|
-
export declare const useInputStyles: ({ disabled, startAdornment, endAdornment,
|
|
54
|
+
export declare const useInputStyles: ({ disabled, startAdornment, endAdornment, }: UseInputStylesProps) => readonly [{
|
|
62
55
|
readonly flex: 1;
|
|
63
56
|
readonly position: "relative";
|
|
64
57
|
readonly height: "medium";
|
|
65
|
-
readonly paddingLeft: "
|
|
66
|
-
readonly paddingRight: "
|
|
58
|
+
readonly paddingLeft: "medium" | "none";
|
|
59
|
+
readonly paddingRight: "medium" | "none";
|
|
67
60
|
readonly width: "full";
|
|
68
61
|
}, {
|
|
69
62
|
readonly ':enabled': {
|
|
70
63
|
readonly ':focus + [data-focus-indicator]': {
|
|
71
|
-
boxShadow
|
|
72
|
-
outline
|
|
73
|
-
outlineOffset
|
|
64
|
+
readonly boxShadow: string;
|
|
65
|
+
readonly outline: string;
|
|
66
|
+
readonly outlineOffset: string;
|
|
67
|
+
readonly borderColor: string;
|
|
74
68
|
} | {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
borderColor: string;
|
|
79
|
-
} | {
|
|
80
|
-
outline: string;
|
|
81
|
-
outlineOffset: string;
|
|
82
|
-
borderColor: string;
|
|
69
|
+
readonly outline: string;
|
|
70
|
+
readonly outlineOffset: string;
|
|
71
|
+
readonly borderColor: string;
|
|
83
72
|
};
|
|
84
73
|
};
|
|
85
74
|
readonly ':focus': {
|
|
@@ -1046,18 +1035,14 @@ export declare const useInputStyles: ({ disabled, startAdornment, endAdornment,
|
|
|
1046
1035
|
} | {
|
|
1047
1036
|
readonly ':enabled': {
|
|
1048
1037
|
readonly ':focus + [data-focus-indicator]': {
|
|
1049
|
-
boxShadow
|
|
1050
|
-
outline
|
|
1051
|
-
outlineOffset
|
|
1052
|
-
|
|
1053
|
-
boxShadow: string;
|
|
1054
|
-
outline: string;
|
|
1055
|
-
outlineOffset: string;
|
|
1056
|
-
borderColor: string;
|
|
1038
|
+
readonly boxShadow: string;
|
|
1039
|
+
readonly outline: string;
|
|
1040
|
+
readonly outlineOffset: string;
|
|
1041
|
+
readonly borderColor: string;
|
|
1057
1042
|
} | {
|
|
1058
|
-
outline: string;
|
|
1059
|
-
outlineOffset: string;
|
|
1060
|
-
borderColor: string;
|
|
1043
|
+
readonly outline: string;
|
|
1044
|
+
readonly outlineOffset: string;
|
|
1045
|
+
readonly borderColor: string;
|
|
1061
1046
|
};
|
|
1062
1047
|
};
|
|
1063
1048
|
readonly ':focus': {
|
|
@@ -2024,18 +2009,14 @@ export declare const useInputStyles: ({ disabled, startAdornment, endAdornment,
|
|
|
2024
2009
|
} | {
|
|
2025
2010
|
readonly ':enabled': {
|
|
2026
2011
|
readonly ':focus + [data-focus-indicator]': {
|
|
2027
|
-
boxShadow
|
|
2028
|
-
outline
|
|
2029
|
-
outlineOffset
|
|
2030
|
-
|
|
2031
|
-
boxShadow: string;
|
|
2032
|
-
outline: string;
|
|
2033
|
-
outlineOffset: string;
|
|
2034
|
-
borderColor: string;
|
|
2012
|
+
readonly boxShadow: string;
|
|
2013
|
+
readonly outline: string;
|
|
2014
|
+
readonly outlineOffset: string;
|
|
2015
|
+
readonly borderColor: string;
|
|
2035
2016
|
} | {
|
|
2036
|
-
outline: string;
|
|
2037
|
-
outlineOffset: string;
|
|
2038
|
-
borderColor: string;
|
|
2017
|
+
readonly outline: string;
|
|
2018
|
+
readonly outlineOffset: string;
|
|
2019
|
+
readonly borderColor: string;
|
|
2039
2020
|
};
|
|
2040
2021
|
};
|
|
2041
2022
|
readonly ':focus': {
|
|
@@ -114,12 +114,11 @@ 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
|
|
118
|
-
readOnly = _useFieldContext2$.readOnly;
|
|
117
|
+
invalid = _useFieldContext2$.invalid;
|
|
119
118
|
return jsxRuntime.jsxs(box.Box, _objectSpread(_objectSpread({
|
|
120
119
|
borderRadius: "small",
|
|
121
120
|
position: "relative",
|
|
122
|
-
background: disabled
|
|
121
|
+
background: disabled ? 'inputDisabled' : 'input'
|
|
123
122
|
}, boxProps), {}, {
|
|
124
123
|
children: [startAdornment, children, jsxRuntime.jsx(FocusIndicator, {
|
|
125
124
|
invalid: invalid
|
|
@@ -128,7 +127,6 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
128
127
|
};
|
|
129
128
|
var FocusIndicator = function FocusIndicator(_ref2) {
|
|
130
129
|
var invalid = _ref2.invalid;
|
|
131
|
-
var theme$1 = theme.useTheme();
|
|
132
130
|
return jsxRuntime.jsx(box.Box, {
|
|
133
131
|
"aria-hidden": "true",
|
|
134
132
|
as: "span",
|
|
@@ -137,14 +135,14 @@ var FocusIndicator = function FocusIndicator(_ref2) {
|
|
|
137
135
|
}
|
|
138
136
|
// Styles
|
|
139
137
|
,
|
|
140
|
-
border: invalid ? 'critical' :
|
|
141
|
-
borderRadius:
|
|
138
|
+
border: invalid ? 'critical' : 'field',
|
|
139
|
+
borderRadius: "small",
|
|
142
140
|
position: "absolute",
|
|
143
141
|
bottom: 0,
|
|
144
142
|
left: 0,
|
|
145
143
|
right: 0,
|
|
146
144
|
top: 0,
|
|
147
|
-
shadow:
|
|
145
|
+
shadow: "small",
|
|
148
146
|
css: react$1.css({
|
|
149
147
|
pointerEvents: 'none'
|
|
150
148
|
})
|
|
@@ -182,19 +180,17 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
182
180
|
};
|
|
183
181
|
};
|
|
184
182
|
|
|
185
|
-
var _excluded = ["children", "data"
|
|
183
|
+
var _excluded = ["children", "data"];
|
|
186
184
|
/** Organize and emphasize information quickly and effectively in a list of text elements. */
|
|
187
185
|
var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
188
186
|
var children = _ref.children,
|
|
189
187
|
data = _ref.data,
|
|
190
|
-
overflowStrategy = _ref.overflowStrategy,
|
|
191
188
|
consumerProps = _objectWithoutProperties(_ref, _excluded);
|
|
192
189
|
var _useFieldContext = field.useFieldContext(),
|
|
193
190
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
194
191
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
195
192
|
disabled = _useFieldContext2$.disabled,
|
|
196
193
|
invalid = _useFieldContext2$.invalid,
|
|
197
|
-
readOnly = _useFieldContext2$.readOnly,
|
|
198
194
|
a11yProps = _useFieldContext2[1];
|
|
199
195
|
var _childrenToAdornments = childrenToAdornments(children),
|
|
200
196
|
startAdornment = _childrenToAdornments.startAdornment,
|
|
@@ -203,9 +199,7 @@ var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
203
199
|
disabled: disabled,
|
|
204
200
|
invalid: invalid,
|
|
205
201
|
startAdornment: Boolean(startAdornment),
|
|
206
|
-
endAdornment: Boolean(endAdornment)
|
|
207
|
-
readOnly: readOnly,
|
|
208
|
-
overflowStrategy: overflowStrategy
|
|
202
|
+
endAdornment: Boolean(endAdornment)
|
|
209
203
|
}),
|
|
210
204
|
_useInputStyles2 = _slicedToArray(_useInputStyles, 2),
|
|
211
205
|
boxProps = _useInputStyles2[0],
|
|
@@ -220,7 +214,6 @@ var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
220
214
|
css: react$1.css(inputStyles),
|
|
221
215
|
data: data,
|
|
222
216
|
disabled: disabled,
|
|
223
|
-
readOnly: readOnly,
|
|
224
217
|
ref: forwardedRef
|
|
225
218
|
}))
|
|
226
219
|
});
|
|
@@ -232,21 +225,17 @@ TextInput.displayName = 'TextInput';
|
|
|
232
225
|
* item is a CSS object to be passed to Emotion's `css` function
|
|
233
226
|
**/
|
|
234
227
|
var useInputStyles = function useInputStyles(_ref2) {
|
|
235
|
-
var _theme$components$tex;
|
|
236
228
|
var disabled = _ref2.disabled,
|
|
237
229
|
startAdornment = _ref2.startAdornment,
|
|
238
|
-
endAdornment = _ref2.endAdornment
|
|
239
|
-
readOnly = _ref2.readOnly,
|
|
240
|
-
_ref2$overflowStrateg = _ref2.overflowStrategy,
|
|
241
|
-
overflowStrategy = _ref2$overflowStrateg === void 0 ? 'truncate' : _ref2$overflowStrateg;
|
|
230
|
+
endAdornment = _ref2.endAdornment;
|
|
242
231
|
var theme$1 = theme.useTheme();
|
|
243
|
-
var overflowStyles = text.useOverflowStrategy(
|
|
232
|
+
var overflowStyles = text.useOverflowStrategy('truncate');
|
|
244
233
|
var focusRingStyles = a11y.useFocusRing({
|
|
245
234
|
always: true
|
|
246
235
|
});
|
|
247
236
|
var textStyles = text.useText({
|
|
248
237
|
baseline: false,
|
|
249
|
-
tone: disabled
|
|
238
|
+
tone: disabled ? 'disabled' : 'neutral',
|
|
250
239
|
size: 'standard',
|
|
251
240
|
weight: 'regular'
|
|
252
241
|
});
|
|
@@ -262,7 +251,7 @@ var useInputStyles = function useInputStyles(_ref2) {
|
|
|
262
251
|
width: 'full'
|
|
263
252
|
}, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typographyStyles), responsiveStyles), overflowStyles), {}, {
|
|
264
253
|
':enabled': {
|
|
265
|
-
':focus + [data-focus-indicator]':
|
|
254
|
+
':focus + [data-focus-indicator]': _objectSpread({
|
|
266
255
|
borderColor: theme$1.border.color.fieldAccent
|
|
267
256
|
}, focusRingStyles)
|
|
268
257
|
},
|
|
@@ -114,12 +114,11 @@ 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
|
|
118
|
-
readOnly = _useFieldContext2$.readOnly;
|
|
117
|
+
invalid = _useFieldContext2$.invalid;
|
|
119
118
|
return jsxRuntime.jsxs(box.Box, _objectSpread(_objectSpread({
|
|
120
119
|
borderRadius: "small",
|
|
121
120
|
position: "relative",
|
|
122
|
-
background: disabled
|
|
121
|
+
background: disabled ? 'inputDisabled' : 'input'
|
|
123
122
|
}, boxProps), {}, {
|
|
124
123
|
children: [startAdornment, children, jsxRuntime.jsx(FocusIndicator, {
|
|
125
124
|
invalid: invalid
|
|
@@ -128,7 +127,6 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
128
127
|
};
|
|
129
128
|
var FocusIndicator = function FocusIndicator(_ref2) {
|
|
130
129
|
var invalid = _ref2.invalid;
|
|
131
|
-
var theme$1 = theme.useTheme();
|
|
132
130
|
return jsxRuntime.jsx(box.Box, {
|
|
133
131
|
"aria-hidden": "true",
|
|
134
132
|
as: "span",
|
|
@@ -137,14 +135,14 @@ var FocusIndicator = function FocusIndicator(_ref2) {
|
|
|
137
135
|
}
|
|
138
136
|
// Styles
|
|
139
137
|
,
|
|
140
|
-
border: invalid ? 'critical' :
|
|
141
|
-
borderRadius:
|
|
138
|
+
border: invalid ? 'critical' : 'field',
|
|
139
|
+
borderRadius: "small",
|
|
142
140
|
position: "absolute",
|
|
143
141
|
bottom: 0,
|
|
144
142
|
left: 0,
|
|
145
143
|
right: 0,
|
|
146
144
|
top: 0,
|
|
147
|
-
shadow:
|
|
145
|
+
shadow: "small",
|
|
148
146
|
css: react$1.css({
|
|
149
147
|
pointerEvents: 'none'
|
|
150
148
|
})
|
|
@@ -182,19 +180,17 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
182
180
|
};
|
|
183
181
|
};
|
|
184
182
|
|
|
185
|
-
var _excluded = ["children", "data"
|
|
183
|
+
var _excluded = ["children", "data"];
|
|
186
184
|
/** Organize and emphasize information quickly and effectively in a list of text elements. */
|
|
187
185
|
var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
188
186
|
var children = _ref.children,
|
|
189
187
|
data = _ref.data,
|
|
190
|
-
overflowStrategy = _ref.overflowStrategy,
|
|
191
188
|
consumerProps = _objectWithoutProperties(_ref, _excluded);
|
|
192
189
|
var _useFieldContext = field.useFieldContext(),
|
|
193
190
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
194
191
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
195
192
|
disabled = _useFieldContext2$.disabled,
|
|
196
193
|
invalid = _useFieldContext2$.invalid,
|
|
197
|
-
readOnly = _useFieldContext2$.readOnly,
|
|
198
194
|
a11yProps = _useFieldContext2[1];
|
|
199
195
|
var _childrenToAdornments = childrenToAdornments(children),
|
|
200
196
|
startAdornment = _childrenToAdornments.startAdornment,
|
|
@@ -203,9 +199,7 @@ var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
203
199
|
disabled: disabled,
|
|
204
200
|
invalid: invalid,
|
|
205
201
|
startAdornment: Boolean(startAdornment),
|
|
206
|
-
endAdornment: Boolean(endAdornment)
|
|
207
|
-
readOnly: readOnly,
|
|
208
|
-
overflowStrategy: overflowStrategy
|
|
202
|
+
endAdornment: Boolean(endAdornment)
|
|
209
203
|
}),
|
|
210
204
|
_useInputStyles2 = _slicedToArray(_useInputStyles, 2),
|
|
211
205
|
boxProps = _useInputStyles2[0],
|
|
@@ -220,7 +214,6 @@ var TextInput = /*#__PURE__*/react.forwardRef(function (_ref, forwardedRef) {
|
|
|
220
214
|
css: react$1.css(inputStyles),
|
|
221
215
|
data: data,
|
|
222
216
|
disabled: disabled,
|
|
223
|
-
readOnly: readOnly,
|
|
224
217
|
ref: forwardedRef
|
|
225
218
|
}))
|
|
226
219
|
});
|
|
@@ -232,21 +225,17 @@ TextInput.displayName = 'TextInput';
|
|
|
232
225
|
* item is a CSS object to be passed to Emotion's `css` function
|
|
233
226
|
**/
|
|
234
227
|
var useInputStyles = function useInputStyles(_ref2) {
|
|
235
|
-
var _theme$components$tex;
|
|
236
228
|
var disabled = _ref2.disabled,
|
|
237
229
|
startAdornment = _ref2.startAdornment,
|
|
238
|
-
endAdornment = _ref2.endAdornment
|
|
239
|
-
readOnly = _ref2.readOnly,
|
|
240
|
-
_ref2$overflowStrateg = _ref2.overflowStrategy,
|
|
241
|
-
overflowStrategy = _ref2$overflowStrateg === void 0 ? 'truncate' : _ref2$overflowStrateg;
|
|
230
|
+
endAdornment = _ref2.endAdornment;
|
|
242
231
|
var theme$1 = theme.useTheme();
|
|
243
|
-
var overflowStyles = text.useOverflowStrategy(
|
|
232
|
+
var overflowStyles = text.useOverflowStrategy('truncate');
|
|
244
233
|
var focusRingStyles = a11y.useFocusRing({
|
|
245
234
|
always: true
|
|
246
235
|
});
|
|
247
236
|
var textStyles = text.useText({
|
|
248
237
|
baseline: false,
|
|
249
|
-
tone: disabled
|
|
238
|
+
tone: disabled ? 'disabled' : 'neutral',
|
|
250
239
|
size: 'standard',
|
|
251
240
|
weight: 'regular'
|
|
252
241
|
});
|
|
@@ -262,7 +251,7 @@ var useInputStyles = function useInputStyles(_ref2) {
|
|
|
262
251
|
width: 'full'
|
|
263
252
|
}, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typographyStyles), responsiveStyles), overflowStyles), {}, {
|
|
264
253
|
':enabled': {
|
|
265
|
-
':focus + [data-focus-indicator]':
|
|
254
|
+
':focus + [data-focus-indicator]': _objectSpread({
|
|
266
255
|
borderColor: theme$1.border.color.fieldAccent
|
|
267
256
|
}, focusRingStyles)
|
|
268
257
|
},
|
|
@@ -110,12 +110,11 @@ 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
|
|
114
|
-
readOnly = _useFieldContext2$.readOnly;
|
|
113
|
+
invalid = _useFieldContext2$.invalid;
|
|
115
114
|
return jsxs(Box, _objectSpread(_objectSpread({
|
|
116
115
|
borderRadius: "small",
|
|
117
116
|
position: "relative",
|
|
118
|
-
background: disabled
|
|
117
|
+
background: disabled ? 'inputDisabled' : 'input'
|
|
119
118
|
}, boxProps), {}, {
|
|
120
119
|
children: [startAdornment, children, jsx(FocusIndicator, {
|
|
121
120
|
invalid: invalid
|
|
@@ -124,7 +123,6 @@ var InputContainer = function InputContainer(_ref) {
|
|
|
124
123
|
};
|
|
125
124
|
var FocusIndicator = function FocusIndicator(_ref2) {
|
|
126
125
|
var invalid = _ref2.invalid;
|
|
127
|
-
var theme = useTheme();
|
|
128
126
|
return jsx(Box, {
|
|
129
127
|
"aria-hidden": "true",
|
|
130
128
|
as: "span",
|
|
@@ -133,14 +131,14 @@ var FocusIndicator = function FocusIndicator(_ref2) {
|
|
|
133
131
|
}
|
|
134
132
|
// Styles
|
|
135
133
|
,
|
|
136
|
-
border: invalid ? 'critical' :
|
|
137
|
-
borderRadius:
|
|
134
|
+
border: invalid ? 'critical' : 'field',
|
|
135
|
+
borderRadius: "small",
|
|
138
136
|
position: "absolute",
|
|
139
137
|
bottom: 0,
|
|
140
138
|
left: 0,
|
|
141
139
|
right: 0,
|
|
142
140
|
top: 0,
|
|
143
|
-
shadow:
|
|
141
|
+
shadow: "small",
|
|
144
142
|
css: css({
|
|
145
143
|
pointerEvents: 'none'
|
|
146
144
|
})
|
|
@@ -178,19 +176,17 @@ var childrenToAdornments = function childrenToAdornments(children) {
|
|
|
178
176
|
};
|
|
179
177
|
};
|
|
180
178
|
|
|
181
|
-
var _excluded = ["children", "data"
|
|
179
|
+
var _excluded = ["children", "data"];
|
|
182
180
|
/** Organize and emphasize information quickly and effectively in a list of text elements. */
|
|
183
181
|
var TextInput = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
184
182
|
var children = _ref.children,
|
|
185
183
|
data = _ref.data,
|
|
186
|
-
overflowStrategy = _ref.overflowStrategy,
|
|
187
184
|
consumerProps = _objectWithoutProperties(_ref, _excluded);
|
|
188
185
|
var _useFieldContext = useFieldContext(),
|
|
189
186
|
_useFieldContext2 = _slicedToArray(_useFieldContext, 2),
|
|
190
187
|
_useFieldContext2$ = _useFieldContext2[0],
|
|
191
188
|
disabled = _useFieldContext2$.disabled,
|
|
192
189
|
invalid = _useFieldContext2$.invalid,
|
|
193
|
-
readOnly = _useFieldContext2$.readOnly,
|
|
194
190
|
a11yProps = _useFieldContext2[1];
|
|
195
191
|
var _childrenToAdornments = childrenToAdornments(children),
|
|
196
192
|
startAdornment = _childrenToAdornments.startAdornment,
|
|
@@ -199,9 +195,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
199
195
|
disabled: disabled,
|
|
200
196
|
invalid: invalid,
|
|
201
197
|
startAdornment: Boolean(startAdornment),
|
|
202
|
-
endAdornment: Boolean(endAdornment)
|
|
203
|
-
readOnly: readOnly,
|
|
204
|
-
overflowStrategy: overflowStrategy
|
|
198
|
+
endAdornment: Boolean(endAdornment)
|
|
205
199
|
}),
|
|
206
200
|
_useInputStyles2 = _slicedToArray(_useInputStyles, 2),
|
|
207
201
|
boxProps = _useInputStyles2[0],
|
|
@@ -216,7 +210,6 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
|
216
210
|
css: css(inputStyles),
|
|
217
211
|
data: data,
|
|
218
212
|
disabled: disabled,
|
|
219
|
-
readOnly: readOnly,
|
|
220
213
|
ref: forwardedRef
|
|
221
214
|
}))
|
|
222
215
|
});
|
|
@@ -228,21 +221,17 @@ TextInput.displayName = 'TextInput';
|
|
|
228
221
|
* item is a CSS object to be passed to Emotion's `css` function
|
|
229
222
|
**/
|
|
230
223
|
var useInputStyles = function useInputStyles(_ref2) {
|
|
231
|
-
var _theme$components$tex;
|
|
232
224
|
var disabled = _ref2.disabled,
|
|
233
225
|
startAdornment = _ref2.startAdornment,
|
|
234
|
-
endAdornment = _ref2.endAdornment
|
|
235
|
-
readOnly = _ref2.readOnly,
|
|
236
|
-
_ref2$overflowStrateg = _ref2.overflowStrategy,
|
|
237
|
-
overflowStrategy = _ref2$overflowStrateg === void 0 ? 'truncate' : _ref2$overflowStrateg;
|
|
226
|
+
endAdornment = _ref2.endAdornment;
|
|
238
227
|
var theme = useTheme();
|
|
239
|
-
var overflowStyles = useOverflowStrategy(
|
|
228
|
+
var overflowStyles = useOverflowStrategy('truncate');
|
|
240
229
|
var focusRingStyles = useFocusRing({
|
|
241
230
|
always: true
|
|
242
231
|
});
|
|
243
232
|
var textStyles = useText({
|
|
244
233
|
baseline: false,
|
|
245
|
-
tone: disabled
|
|
234
|
+
tone: disabled ? 'disabled' : 'neutral',
|
|
246
235
|
size: 'standard',
|
|
247
236
|
weight: 'regular'
|
|
248
237
|
});
|
|
@@ -258,7 +247,7 @@ var useInputStyles = function useInputStyles(_ref2) {
|
|
|
258
247
|
width: 'full'
|
|
259
248
|
}, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typographyStyles), responsiveStyles), overflowStyles), {}, {
|
|
260
249
|
':enabled': {
|
|
261
|
-
':focus + [data-focus-indicator]':
|
|
250
|
+
':focus + [data-focus-indicator]': _objectSpread({
|
|
262
251
|
borderColor: theme.border.color.fieldAccent
|
|
263
252
|
}, focusRingStyles)
|
|
264
253
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-web/text-input",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-rc.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.0.0",
|
|
21
|
-
"@spark-web/box": "^
|
|
22
|
-
"@spark-web/text": "^5.0.0",
|
|
23
|
-
"@spark-web/utils": "^5.0.0"
|
|
20
|
+
"@spark-web/a11y": "^5.3.0-rc.0",
|
|
21
|
+
"@spark-web/box": "^6.0.0-rc.0",
|
|
22
|
+
"@spark-web/text": "^5.3.0-rc.0",
|
|
23
|
+
"@spark-web/utils": "^5.1.0-rc.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@spark-web/field": "^5.
|
|
27
|
-
"@spark-web/theme": "^5.
|
|
28
|
-
"@types/react": "^
|
|
29
|
-
"react": "^
|
|
26
|
+
"@spark-web/field": "^5.2.0-rc.0",
|
|
27
|
+
"@spark-web/theme": "^5.12.0-rc.0",
|
|
28
|
+
"@types/react": "^19.1.0",
|
|
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.2.0-rc.0",
|
|
33
|
+
"@spark-web/theme": "^5.12.0-rc.0",
|
|
34
|
+
"react": ">=19.1.0"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=14"
|