@purpurds/text-field 5.6.0 → 5.8.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/dist/LICENSE.txt +6 -6
- package/dist/styles.css +1 -1
- package/dist/text-field.cjs.js +10 -10
- package/dist/text-field.cjs.js.map +1 -1
- package/dist/text-field.d.ts.map +1 -1
- package/dist/text-field.es.js +89 -87
- package/dist/text-field.es.js.map +1 -1
- package/package.json +8 -8
- package/src/text-field.module.scss +12 -12
- package/src/text-field.tsx +13 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/text-field",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/text-field.cjs.js",
|
|
6
6
|
"types": "./dist/text-field.d.ts",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"source": "src/text-field.tsx",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"classnames": "~2.5.0",
|
|
18
|
-
"@purpurds/button": "5.
|
|
19
|
-
"@purpurds/
|
|
20
|
-
"@purpurds/
|
|
21
|
-
"@purpurds/field-error-text": "5.
|
|
22
|
-
"@purpurds/
|
|
23
|
-
"@purpurds/
|
|
24
|
-
"@purpurds/tokens": "5.
|
|
18
|
+
"@purpurds/button": "5.8.0",
|
|
19
|
+
"@purpurds/field-helper-text": "5.8.0",
|
|
20
|
+
"@purpurds/label": "5.8.0",
|
|
21
|
+
"@purpurds/field-error-text": "5.8.0",
|
|
22
|
+
"@purpurds/spinner": "5.8.0",
|
|
23
|
+
"@purpurds/icon": "5.8.0",
|
|
24
|
+
"@purpurds/tokens": "5.8.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@rushstack/eslint-patch": "~1.10.0",
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
background: var(--purpur-color-background-interactive-read-only);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
&--has-clear-button {
|
|
55
|
+
padding-right: var(--purpur-spacing-25);
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
&--end-adornment {
|
|
55
59
|
padding-right: var(--purpur-spacing-150);
|
|
56
60
|
|
|
@@ -59,10 +63,6 @@
|
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
&--has-clear-button {
|
|
63
|
-
padding-right: var(--purpur-spacing-25);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
66
|
&--start-adornment {
|
|
67
67
|
padding-left: var(--purpur-spacing-150);
|
|
68
68
|
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
background: transparent;
|
|
88
88
|
|
|
89
89
|
&:hover {
|
|
90
|
-
|
|
90
|
+
~#{$root}__frame {
|
|
91
91
|
border-width: var(--purpur-border-width-sm);
|
|
92
92
|
border-color: var(--purpur-color-border-interactive-subtle-hover);
|
|
93
93
|
}
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
|
|
96
96
|
&:active:not(:disabled):not(:read-only),
|
|
97
97
|
&:focus:not(:disabled):not(:read-only) {
|
|
98
|
-
|
|
98
|
+
~#{$root}__frame {
|
|
99
99
|
outline: var(--purpur-border-width-sm) solid var(--purpur-color-border-interactive-focus);
|
|
100
100
|
outline-offset: calc(var(--purpur-spacing-10) * 2);
|
|
101
101
|
border-width: var(--purpur-border-width-xs);
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
&:disabled {
|
|
107
107
|
color: var(--purpur-color-text-weak);
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
~#{$root}__frame {
|
|
110
110
|
border-width: var(--purpur-border-width-xs);
|
|
111
111
|
border-color: var(--purpur-color-border-medium);
|
|
112
112
|
}
|
|
@@ -115,12 +115,12 @@
|
|
|
115
115
|
&:read-only:not(:disabled) {
|
|
116
116
|
color: var(--purpur-color-text-default);
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
~#{$root}__frame {
|
|
119
119
|
border-width: var(--purpur-border-width-xs);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
&:not(#{$inputRoot}--valid):not(#{$inputRoot}--error) {
|
|
123
|
-
|
|
123
|
+
~#{$root}__frame {
|
|
124
124
|
border-color: var(--purpur-color-border-medium);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -133,13 +133,13 @@
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
&#{$inputRoot}--valid {
|
|
136
|
-
|
|
136
|
+
~#{$root}__frame {
|
|
137
137
|
border-color: var(--purpur-color-border-status-success);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
&#{$inputRoot}--error:not(:hover) {
|
|
142
|
-
|
|
142
|
+
~#{$root}__frame {
|
|
143
143
|
border-color: var(--purpur-color-border-status-error);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -154,4 +154,4 @@
|
|
|
154
154
|
&__valid-icon {
|
|
155
155
|
color: var(--purpur-color-text-status-success-medium);
|
|
156
156
|
}
|
|
157
|
-
}
|
|
157
|
+
}
|
package/src/text-field.tsx
CHANGED
|
@@ -149,7 +149,7 @@ const TextFieldComponent = (
|
|
|
149
149
|
internalRef.current?.focus();
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
const
|
|
152
|
+
const localEndAdornments: ReactNode[] = [
|
|
153
153
|
loading && (
|
|
154
154
|
<Spinner
|
|
155
155
|
key="spinner"
|
|
@@ -158,13 +158,6 @@ const TextFieldComponent = (
|
|
|
158
158
|
data-testid={getTestId("spinner")}
|
|
159
159
|
/>
|
|
160
160
|
),
|
|
161
|
-
isValid && (
|
|
162
|
-
<IconCheckCircleFilled
|
|
163
|
-
key="valid-icon"
|
|
164
|
-
data-testid={getTestId("valid-icon")}
|
|
165
|
-
className={cx(`${rootClassName}__valid-icon`)}
|
|
166
|
-
/>
|
|
167
|
-
),
|
|
168
161
|
hasClearButton && (
|
|
169
162
|
<Button
|
|
170
163
|
key="clear-button"
|
|
@@ -178,14 +171,21 @@ const TextFieldComponent = (
|
|
|
178
171
|
<IconClose size="xs" />
|
|
179
172
|
</Button>
|
|
180
173
|
),
|
|
181
|
-
|
|
174
|
+
isValid && (
|
|
175
|
+
<IconCheckCircleFilled
|
|
176
|
+
key="valid-icon"
|
|
177
|
+
data-testid={getTestId("valid-icon")}
|
|
178
|
+
className={cx(`${rootClassName}__valid-icon`)}
|
|
179
|
+
/>
|
|
180
|
+
),
|
|
182
181
|
].filter((adornment) => !!adornment);
|
|
183
182
|
|
|
184
183
|
const inputContainerClassnames = cx([
|
|
185
184
|
`${rootClassName}__input-container`,
|
|
186
185
|
{
|
|
187
186
|
[`${rootClassName}__input-container--start-adornment`]: startAdornments.length,
|
|
188
|
-
[`${rootClassName}__input-container--end-adornment`]:
|
|
187
|
+
[`${rootClassName}__input-container--end-adornment`]:
|
|
188
|
+
localEndAdornments.length || endAdornment,
|
|
189
189
|
[`${rootClassName}__input-container--disabled`]: inputProps.disabled,
|
|
190
190
|
[`${rootClassName}__input-container--has-clear-button`]: hasClearButton,
|
|
191
191
|
[`${rootClassName}__input-container--readonly`]: inputProps.readOnly && !inputProps.disabled,
|
|
@@ -230,12 +230,13 @@ const TextFieldComponent = (
|
|
|
230
230
|
])}
|
|
231
231
|
/>
|
|
232
232
|
<div className={cx(`${rootClassName}__frame`)} />
|
|
233
|
-
{!!
|
|
233
|
+
{(!!localEndAdornments.length || endAdornment) && (
|
|
234
234
|
<div
|
|
235
235
|
data-testid={getTestId("end-adornments")}
|
|
236
236
|
className={cx(`${rootClassName}__adornment-container`)}
|
|
237
237
|
>
|
|
238
|
-
{
|
|
238
|
+
{localEndAdornments}
|
|
239
|
+
{endAdornment}
|
|
239
240
|
</div>
|
|
240
241
|
)}
|
|
241
242
|
</div>
|