@phillips/seldon 1.172.0 → 1.173.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.
|
@@ -4,6 +4,14 @@ export interface InputProps extends Omit<React.ComponentProps<'input'>, 'size'>
|
|
|
4
4
|
* Optional className to be applied to the `<input>` node
|
|
5
5
|
*/
|
|
6
6
|
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional adornment to be displayed before the input value
|
|
9
|
+
*/
|
|
10
|
+
inputAdornment?: string | React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Optional position to place the adornment. Defaults to 'start'
|
|
13
|
+
*/
|
|
14
|
+
adornmentPosition?: 'start' | 'end';
|
|
7
15
|
/**
|
|
8
16
|
* Optionally provide the default value of the `<input>`. Should not be passed into controlled input!
|
|
9
17
|
*/
|
|
@@ -1,85 +1,99 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { px as t, useNormalizedInputProps as
|
|
5
|
-
const
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as z from "react";
|
|
3
|
+
import p from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { px as t, useNormalizedInputProps as F } from "../../utils/index.js";
|
|
5
|
+
const q = z.forwardRef(
|
|
6
6
|
({
|
|
7
|
-
className:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[`${t}-input--
|
|
41
|
-
[`${t}-input--
|
|
42
|
-
[`${t}-input--
|
|
43
|
-
[`${
|
|
44
|
-
[`${t}-input--
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
7
|
+
className: s,
|
|
8
|
+
inputAdornment: i,
|
|
9
|
+
adornmentPosition: l = "start",
|
|
10
|
+
defaultValue: _,
|
|
11
|
+
disabled: h,
|
|
12
|
+
hideLabel: w,
|
|
13
|
+
id: e,
|
|
14
|
+
inline: b,
|
|
15
|
+
invalid: N,
|
|
16
|
+
invalidText: f,
|
|
17
|
+
labelText: v,
|
|
18
|
+
onChange: x,
|
|
19
|
+
onClick: y,
|
|
20
|
+
placeholder: I,
|
|
21
|
+
readOnly: d,
|
|
22
|
+
size: T = "md",
|
|
23
|
+
type: u = "text",
|
|
24
|
+
value: C,
|
|
25
|
+
warn: P,
|
|
26
|
+
warnText: j,
|
|
27
|
+
isSkeletonLoading: r,
|
|
28
|
+
...o
|
|
29
|
+
}, k) => {
|
|
30
|
+
const a = F({
|
|
31
|
+
disabled: h,
|
|
32
|
+
id: e,
|
|
33
|
+
invalid: N,
|
|
34
|
+
invalidText: f,
|
|
35
|
+
readOnly: d,
|
|
36
|
+
type: u,
|
|
37
|
+
warn: P,
|
|
38
|
+
warnText: j
|
|
39
|
+
}), R = p(`${t}-${u}-input`, `${t}-input`, `${t}-input--${T}`, {
|
|
40
|
+
[`${t}-input--inline`]: b,
|
|
41
|
+
[`${t}-input--readonly`]: d,
|
|
42
|
+
[`${t}-input--disabled`]: a.disabled,
|
|
43
|
+
[`${t}-input--invalid`]: a.invalid,
|
|
44
|
+
[`${t}-input--warn`]: a.warn,
|
|
45
|
+
[`${s}__wrapper`]: s,
|
|
46
|
+
[`${t}-input--hidden`]: o.hidden
|
|
47
|
+
}), m = [
|
|
48
|
+
"text",
|
|
49
|
+
"number",
|
|
50
|
+
"password",
|
|
51
|
+
"email",
|
|
52
|
+
"tel",
|
|
53
|
+
"url",
|
|
54
|
+
"search",
|
|
55
|
+
"date",
|
|
56
|
+
"datetime-local",
|
|
57
|
+
"month",
|
|
58
|
+
"time",
|
|
59
|
+
"week"
|
|
60
|
+
].includes(a.type ?? ""), $ = {
|
|
61
|
+
className: i && m ? p(`${t}-input__wrapper__input`, s, { [`${t}-skeleton`]: r }) : p(`${t}-input__input`, s, { [`${t}-skeleton`]: r }),
|
|
62
|
+
"data-testid": e,
|
|
63
|
+
disabled: a.disabled,
|
|
64
|
+
id: e,
|
|
65
|
+
onChange: x,
|
|
66
|
+
onClick: y,
|
|
67
|
+
placeholder: r ? "" : I,
|
|
68
|
+
readOnly: d,
|
|
69
|
+
ref: k,
|
|
70
|
+
type: a.type,
|
|
71
|
+
...a.type !== "checkbox" && a.type !== "radio" ? { value: C, defaultValue: _ } : {},
|
|
72
|
+
...o
|
|
73
|
+
};
|
|
74
|
+
return /* @__PURE__ */ c("div", { className: R, children: [
|
|
75
|
+
/* @__PURE__ */ n(
|
|
48
76
|
"label",
|
|
49
77
|
{
|
|
50
|
-
"data-testid": `label-${
|
|
51
|
-
htmlFor:
|
|
52
|
-
className:
|
|
53
|
-
[`${t}-input__label--hidden`]:
|
|
54
|
-
[`${t}-skeleton`]:
|
|
78
|
+
"data-testid": `label-${e}`,
|
|
79
|
+
htmlFor: e,
|
|
80
|
+
className: p(`${t}-input__label`, {
|
|
81
|
+
[`${t}-input__label--hidden`]: w,
|
|
82
|
+
[`${t}-skeleton`]: r
|
|
55
83
|
}),
|
|
56
|
-
children:
|
|
84
|
+
children: v
|
|
57
85
|
}
|
|
58
86
|
),
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
"
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"data-testid": a,
|
|
66
|
-
disabled: i.disabled,
|
|
67
|
-
id: a,
|
|
68
|
-
onChange: h,
|
|
69
|
-
onClick: f,
|
|
70
|
-
placeholder: l ? "" : v,
|
|
71
|
-
readOnly: e,
|
|
72
|
-
ref: I,
|
|
73
|
-
type: i.type,
|
|
74
|
-
...i.type !== "checkbox" && i.type !== "radio" ? { value: w, defaultValue: o } : {},
|
|
75
|
-
...r
|
|
76
|
-
}
|
|
77
|
-
),
|
|
78
|
-
i.validation ? i.validation : /* @__PURE__ */ d("p", { className: n(`${t}-input__validation`), children: " " })
|
|
87
|
+
i && m ? /* @__PURE__ */ c("div", { className: `${t}-input__wrapper`, "data-testid": `wrapper-${e}`, children: [
|
|
88
|
+
l === "start" && /* @__PURE__ */ n("span", { className: `${t}-input__wrapper__adornment`, id: "adornment", "data-testid": `adornment-${e}`, children: i }),
|
|
89
|
+
/* @__PURE__ */ n("input", { ...$ }),
|
|
90
|
+
l === "end" && /* @__PURE__ */ n("span", { className: `${t}-input__wrapper__adornment`, id: "adornment", "data-testid": `adornment-${e}`, children: i })
|
|
91
|
+
] }) : /* @__PURE__ */ n("input", { ...$ }),
|
|
92
|
+
a.validation ? a.validation : /* @__PURE__ */ n("p", { className: p(`${t}-input__validation`), children: " " })
|
|
79
93
|
] });
|
|
80
94
|
}
|
|
81
95
|
);
|
|
82
|
-
|
|
96
|
+
q.displayName = "Input";
|
|
83
97
|
export {
|
|
84
|
-
|
|
98
|
+
q as default
|
|
85
99
|
};
|
|
@@ -80,6 +80,17 @@ export declare const CheckboxInput: {
|
|
|
80
80
|
type: string;
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
|
+
inputAdornment: {
|
|
84
|
+
control: {
|
|
85
|
+
type: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
adornmentPosition: {
|
|
89
|
+
options: string[];
|
|
90
|
+
control: {
|
|
91
|
+
type: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
83
94
|
labelText: {
|
|
84
95
|
control: {
|
|
85
96
|
type: string;
|
|
@@ -177,6 +188,17 @@ export declare const RangeInput: {
|
|
|
177
188
|
type: string;
|
|
178
189
|
};
|
|
179
190
|
};
|
|
191
|
+
inputAdornment: {
|
|
192
|
+
control: {
|
|
193
|
+
type: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
adornmentPosition: {
|
|
197
|
+
options: string[];
|
|
198
|
+
control: {
|
|
199
|
+
type: string;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
180
202
|
labelText: {
|
|
181
203
|
control: {
|
|
182
204
|
type: string;
|
|
@@ -270,6 +292,17 @@ export declare const ControlledInput: {
|
|
|
270
292
|
type: string;
|
|
271
293
|
};
|
|
272
294
|
};
|
|
295
|
+
inputAdornment: {
|
|
296
|
+
control: {
|
|
297
|
+
type: string;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
adornmentPosition: {
|
|
301
|
+
options: string[];
|
|
302
|
+
control: {
|
|
303
|
+
type: string;
|
|
304
|
+
};
|
|
305
|
+
};
|
|
273
306
|
labelText: {
|
|
274
307
|
control: {
|
|
275
308
|
type: string;
|
|
@@ -329,6 +362,104 @@ export declare const CustomLabel: {
|
|
|
329
362
|
};
|
|
330
363
|
argTypes: {};
|
|
331
364
|
};
|
|
365
|
+
export declare const InputWithAdornment: {
|
|
366
|
+
({ playgroundWidth, ...args }: StoryProps): import("react/jsx-runtime").JSX.Element;
|
|
367
|
+
args: {
|
|
368
|
+
labelText: string;
|
|
369
|
+
playgroundWidth: number;
|
|
370
|
+
size: string;
|
|
371
|
+
inputAdornment: import("react/jsx-runtime").JSX.Element;
|
|
372
|
+
adornmentPosition: string;
|
|
373
|
+
};
|
|
374
|
+
argTypes: {
|
|
375
|
+
className: {
|
|
376
|
+
control: {
|
|
377
|
+
type: string;
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
defaultValue: {
|
|
381
|
+
control: {
|
|
382
|
+
type: string;
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
disabled: {
|
|
386
|
+
control: {
|
|
387
|
+
type: string;
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
invalid: {
|
|
391
|
+
control: {
|
|
392
|
+
type: string;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
invalidText: {
|
|
396
|
+
control: {
|
|
397
|
+
type: string;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
inputAdornment: {
|
|
401
|
+
control: {
|
|
402
|
+
type: string;
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
adornmentPosition: {
|
|
406
|
+
options: string[];
|
|
407
|
+
control: {
|
|
408
|
+
type: string;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
labelText: {
|
|
412
|
+
control: {
|
|
413
|
+
type: string;
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
onChange: {
|
|
417
|
+
action: string;
|
|
418
|
+
};
|
|
419
|
+
onClick: {
|
|
420
|
+
action: string;
|
|
421
|
+
};
|
|
422
|
+
placeholder: {
|
|
423
|
+
control: {
|
|
424
|
+
type: string;
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
playgroundWidth: {
|
|
428
|
+
control: {
|
|
429
|
+
type: string;
|
|
430
|
+
min: number;
|
|
431
|
+
max: number;
|
|
432
|
+
step: number;
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
size: {
|
|
436
|
+
options: string[];
|
|
437
|
+
control: {
|
|
438
|
+
type: string;
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
type: {
|
|
442
|
+
control: {
|
|
443
|
+
type: string;
|
|
444
|
+
};
|
|
445
|
+
};
|
|
446
|
+
value: {
|
|
447
|
+
control: {
|
|
448
|
+
type: string;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
warn: {
|
|
452
|
+
control: {
|
|
453
|
+
type: string;
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
warnText: {
|
|
457
|
+
control: {
|
|
458
|
+
type: string;
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
};
|
|
332
463
|
export declare const Playground: {
|
|
333
464
|
({ playgroundWidth, ...args }: StoryProps): import("react/jsx-runtime").JSX.Element;
|
|
334
465
|
args: {
|
|
@@ -369,6 +500,17 @@ export declare const Playground: {
|
|
|
369
500
|
type: string;
|
|
370
501
|
};
|
|
371
502
|
};
|
|
503
|
+
inputAdornment: {
|
|
504
|
+
control: {
|
|
505
|
+
type: string;
|
|
506
|
+
};
|
|
507
|
+
};
|
|
508
|
+
adornmentPosition: {
|
|
509
|
+
options: string[];
|
|
510
|
+
control: {
|
|
511
|
+
type: string;
|
|
512
|
+
};
|
|
513
|
+
};
|
|
372
514
|
labelText: {
|
|
373
515
|
control: {
|
|
374
516
|
type: string;
|
|
@@ -27,6 +27,53 @@ $lg: #{$px}-input--lg;
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
&__wrapper {
|
|
31
|
+
@include text($string2);
|
|
32
|
+
|
|
33
|
+
accent-color: $soft-black;
|
|
34
|
+
align-items: center;
|
|
35
|
+
border: 1px solid $keyline-gray;
|
|
36
|
+
border-radius: 0.1875rem;
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
font-variation-settings: 'wght' 600;
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
margin-bottom: 0.25rem;
|
|
41
|
+
padding: $padding-xsm;
|
|
42
|
+
position: relative;
|
|
43
|
+
|
|
44
|
+
&::placeholder {
|
|
45
|
+
font-variation-settings: 'wght' 400;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:focus-visible,
|
|
49
|
+
&:focus-within {
|
|
50
|
+
outline: 1px solid $pure-black;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.#{$px}-input__wrapper__input,
|
|
54
|
+
.#{$px}-input__input {
|
|
55
|
+
border: none;
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 0;
|
|
58
|
+
width: 100%;
|
|
59
|
+
|
|
60
|
+
&:focus-visible {
|
|
61
|
+
outline: none;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__adornment {
|
|
66
|
+
align-items: center;
|
|
67
|
+
display: flex;
|
|
68
|
+
margin-right: 0.25rem;
|
|
69
|
+
user-select: none;
|
|
70
|
+
user-select: none;
|
|
71
|
+
user-select: none;
|
|
72
|
+
user-select: none;
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
30
77
|
&__input {
|
|
31
78
|
@include text($string2);
|
|
32
79
|
|
|
@@ -60,7 +107,8 @@ $lg: #{$px}-input--lg;
|
|
|
60
107
|
flex-flow: row wrap;
|
|
61
108
|
gap: 1rem;
|
|
62
109
|
|
|
63
|
-
.#{$px}-input__input
|
|
110
|
+
.#{$px}-input__input,
|
|
111
|
+
.#{$px}-input__wrapper {
|
|
64
112
|
align-self: center;
|
|
65
113
|
width: unset;
|
|
66
114
|
}
|
|
@@ -72,7 +120,8 @@ $lg: #{$px}-input--lg;
|
|
|
72
120
|
cursor: default;
|
|
73
121
|
|
|
74
122
|
.#{$px}-input__label,
|
|
75
|
-
.#{$px}-input__input
|
|
123
|
+
.#{$px}-input__input,
|
|
124
|
+
.#{$px}-input__wrapper {
|
|
76
125
|
color: inherit;
|
|
77
126
|
}
|
|
78
127
|
.#{$px}-input__label:hover,
|
|
@@ -86,7 +135,8 @@ $lg: #{$px}-input--lg;
|
|
|
86
135
|
pointer-events: none;
|
|
87
136
|
|
|
88
137
|
.#{$px}-input__label,
|
|
89
|
-
.#{$px}-input__input
|
|
138
|
+
.#{$px}-input__input,
|
|
139
|
+
.#{$px}-input__wrapper {
|
|
90
140
|
cursor: default;
|
|
91
141
|
}
|
|
92
142
|
|
|
@@ -109,7 +159,8 @@ $lg: #{$px}-input--lg;
|
|
|
109
159
|
color: $pure-black;
|
|
110
160
|
}
|
|
111
161
|
|
|
112
|
-
.#{$px}-input__input
|
|
162
|
+
.#{$px}-input__input,
|
|
163
|
+
.#{$px}-input__wrapper {
|
|
113
164
|
border: 1px solid $error-red;
|
|
114
165
|
box-shadow: inset 0 0 3px 3px $error-pink;
|
|
115
166
|
|
|
@@ -117,6 +168,12 @@ $lg: #{$px}-input--lg;
|
|
|
117
168
|
outline: 1px solid $error-red;
|
|
118
169
|
}
|
|
119
170
|
}
|
|
171
|
+
|
|
172
|
+
.#{$px}-input__wrapper .#{$px}-input__input {
|
|
173
|
+
border: none;
|
|
174
|
+
box-shadow: none;
|
|
175
|
+
outline: none;
|
|
176
|
+
}
|
|
120
177
|
}
|
|
121
178
|
|
|
122
179
|
// warn
|