@rovula/ui 0.1.1 → 0.1.2
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/cjs/bundle.css +64 -0
- package/dist/cjs/bundle.js +1564 -1570
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +1 -0
- package/dist/cjs/types/components/InputFilter/InputFilter.stories.d.ts +1 -0
- package/dist/cjs/types/components/MaskedTextInput/MaskedTextInput.d.ts +1 -0
- package/dist/cjs/types/components/MaskedTextInput/MaskedTextInput.stories.d.ts +2 -0
- package/dist/cjs/types/components/PasswordInput/PasswordInput.stories.d.ts +1 -0
- package/dist/cjs/types/components/Search/Search.stories.d.ts +1 -0
- package/dist/cjs/types/components/TextInput/TextInput.d.ts +2 -0
- package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +10 -0
- package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +15 -0
- package/dist/components/PasswordInput/PasswordInput.js +2 -2
- package/dist/components/TextArea/TextArea.styles.js +1 -1
- package/dist/components/TextInput/TextInput.js +33 -24
- package/dist/components/TextInput/TextInput.stories.js +14 -2
- package/dist/components/TextInput/TextInput.styles.js +25 -10
- package/dist/esm/bundle.css +64 -0
- package/dist/esm/bundle.js +1564 -1570
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +1 -0
- package/dist/esm/types/components/InputFilter/InputFilter.stories.d.ts +1 -0
- package/dist/esm/types/components/MaskedTextInput/MaskedTextInput.d.ts +1 -0
- package/dist/esm/types/components/MaskedTextInput/MaskedTextInput.stories.d.ts +2 -0
- package/dist/esm/types/components/PasswordInput/PasswordInput.stories.d.ts +1 -0
- package/dist/esm/types/components/Search/Search.stories.d.ts +1 -0
- package/dist/esm/types/components/TextInput/TextInput.d.ts +2 -0
- package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +10 -0
- package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +15 -0
- package/dist/index.d.ts +3 -0
- package/dist/src/theme/global.css +83 -0
- package/package.json +1 -1
- package/src/components/PasswordInput/PasswordInput.tsx +2 -2
- package/src/components/TextArea/TextArea.styles.ts +1 -1
- package/src/components/TextInput/TextInput.stories.tsx +60 -2
- package/src/components/TextInput/TextInput.styles.ts +36 -19
- package/src/components/TextInput/TextInput.tsx +83 -55
|
@@ -364,6 +364,7 @@ declare const meta: {
|
|
|
364
364
|
src?: string | undefined | undefined;
|
|
365
365
|
iconMode?: "flat" | "solid" | undefined;
|
|
366
366
|
keepCloseIconOnValue?: boolean | undefined;
|
|
367
|
+
keepFooterSpace?: boolean | undefined;
|
|
367
368
|
labelClassName?: string | undefined;
|
|
368
369
|
classes?: {
|
|
369
370
|
iconWrapper?: string;
|
|
@@ -351,6 +351,7 @@ declare const meta: {
|
|
|
351
351
|
src?: string | undefined | undefined;
|
|
352
352
|
iconMode?: "flat" | "solid" | undefined;
|
|
353
353
|
keepCloseIconOnValue?: boolean | undefined;
|
|
354
|
+
keepFooterSpace?: boolean | undefined;
|
|
354
355
|
labelClassName?: string | undefined;
|
|
355
356
|
classes?: {
|
|
356
357
|
iconWrapper?: string;
|
|
@@ -46,6 +46,7 @@ export declare const MaskedTextInput: React.ForwardRefExoticComponent<{
|
|
|
46
46
|
required?: boolean;
|
|
47
47
|
isFloatingLabel?: boolean;
|
|
48
48
|
keepCloseIconOnValue?: boolean;
|
|
49
|
+
keepFooterSpace?: boolean;
|
|
49
50
|
hasClearIcon?: boolean;
|
|
50
51
|
hasSearchIcon?: boolean;
|
|
51
52
|
startIcon?: React.ReactNode;
|
|
@@ -17,6 +17,7 @@ declare const meta: {
|
|
|
17
17
|
required?: boolean;
|
|
18
18
|
isFloatingLabel?: boolean;
|
|
19
19
|
keepCloseIconOnValue?: boolean;
|
|
20
|
+
keepFooterSpace?: boolean;
|
|
20
21
|
hasClearIcon?: boolean;
|
|
21
22
|
hasSearchIcon?: boolean;
|
|
22
23
|
startIcon?: React.ReactNode;
|
|
@@ -63,6 +64,7 @@ declare const meta: {
|
|
|
63
64
|
required?: boolean | undefined;
|
|
64
65
|
isFloatingLabel?: boolean | undefined;
|
|
65
66
|
keepCloseIconOnValue?: boolean | undefined;
|
|
67
|
+
keepFooterSpace?: boolean | undefined;
|
|
66
68
|
hasClearIcon?: boolean | undefined;
|
|
67
69
|
hasSearchIcon?: boolean | undefined;
|
|
68
70
|
startIcon?: React.ReactNode;
|
|
@@ -320,6 +320,7 @@ declare const meta: {
|
|
|
320
320
|
helperText?: string | undefined;
|
|
321
321
|
errorMessage?: string | undefined;
|
|
322
322
|
keepCloseIconOnValue?: boolean | undefined;
|
|
323
|
+
keepFooterSpace?: boolean | undefined;
|
|
323
324
|
labelClassName?: string | undefined;
|
|
324
325
|
classes?: {
|
|
325
326
|
iconWrapper?: string;
|
|
@@ -345,6 +345,7 @@ declare const meta: {
|
|
|
345
345
|
src?: string | undefined | undefined;
|
|
346
346
|
iconMode?: "flat" | "solid" | undefined;
|
|
347
347
|
keepCloseIconOnValue?: boolean | undefined;
|
|
348
|
+
keepFooterSpace?: boolean | undefined;
|
|
348
349
|
labelClassName?: string | undefined;
|
|
349
350
|
classes?: {
|
|
350
351
|
iconWrapper?: string;
|
|
@@ -15,6 +15,7 @@ export type InputProps = {
|
|
|
15
15
|
required?: boolean;
|
|
16
16
|
isFloatingLabel?: boolean;
|
|
17
17
|
keepCloseIconOnValue?: boolean;
|
|
18
|
+
keepFooterSpace?: boolean;
|
|
18
19
|
hasClearIcon?: boolean;
|
|
19
20
|
hasSearchIcon?: boolean;
|
|
20
21
|
startIcon?: ReactNode;
|
|
@@ -49,6 +50,7 @@ export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
|
49
50
|
required?: boolean;
|
|
50
51
|
isFloatingLabel?: boolean;
|
|
51
52
|
keepCloseIconOnValue?: boolean;
|
|
53
|
+
keepFooterSpace?: boolean;
|
|
52
54
|
hasClearIcon?: boolean;
|
|
53
55
|
hasSearchIcon?: boolean;
|
|
54
56
|
startIcon?: ReactNode;
|
|
@@ -17,6 +17,7 @@ declare const meta: {
|
|
|
17
17
|
required?: boolean;
|
|
18
18
|
isFloatingLabel?: boolean;
|
|
19
19
|
keepCloseIconOnValue?: boolean;
|
|
20
|
+
keepFooterSpace?: boolean;
|
|
20
21
|
hasClearIcon?: boolean;
|
|
21
22
|
hasSearchIcon?: boolean;
|
|
22
23
|
startIcon?: React.ReactNode;
|
|
@@ -55,6 +56,7 @@ declare const meta: {
|
|
|
55
56
|
required?: boolean | undefined;
|
|
56
57
|
isFloatingLabel?: boolean | undefined;
|
|
57
58
|
keepCloseIconOnValue?: boolean | undefined;
|
|
59
|
+
keepFooterSpace?: boolean | undefined;
|
|
58
60
|
hasClearIcon?: boolean | undefined;
|
|
59
61
|
hasSearchIcon?: boolean | undefined;
|
|
60
62
|
startIcon?: React.ReactNode;
|
|
@@ -396,3 +398,11 @@ export declare const CustomIcon: {
|
|
|
396
398
|
};
|
|
397
399
|
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
398
400
|
};
|
|
401
|
+
export declare const KeepFooterSpace: {
|
|
402
|
+
args: {
|
|
403
|
+
label: string;
|
|
404
|
+
fullwidth: boolean;
|
|
405
|
+
keepFooterSpace: boolean;
|
|
406
|
+
};
|
|
407
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
408
|
+
};
|
|
@@ -23,6 +23,21 @@ export declare const helperTextVariant: (props?: ({
|
|
|
23
23
|
disabled?: boolean | null | undefined;
|
|
24
24
|
error?: boolean | null | undefined;
|
|
25
25
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
26
|
+
export declare const inlineEndIconWrapperVariant: (props?: ({
|
|
27
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
28
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
29
|
+
export declare const inlineStartIconWrapperVariant: (props?: ({
|
|
30
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
31
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
32
|
+
export declare const iconActionVariant: (props?: ({
|
|
33
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
34
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
35
|
+
export declare const segmentedIconWrapperVariant: (props?: ({
|
|
36
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
37
|
+
rounded?: "none" | "normal" | "full" | null | undefined;
|
|
38
|
+
error?: boolean | null | undefined;
|
|
39
|
+
position?: "end" | "start" | null | undefined;
|
|
40
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
26
41
|
export declare const iconWrapperVariant: (props?: ({
|
|
27
42
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
28
43
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ type InputProps = {
|
|
|
60
60
|
required?: boolean;
|
|
61
61
|
isFloatingLabel?: boolean;
|
|
62
62
|
keepCloseIconOnValue?: boolean;
|
|
63
|
+
keepFooterSpace?: boolean;
|
|
63
64
|
hasClearIcon?: boolean;
|
|
64
65
|
hasSearchIcon?: boolean;
|
|
65
66
|
startIcon?: ReactNode;
|
|
@@ -94,6 +95,7 @@ declare const TextInput: React__default.ForwardRefExoticComponent<{
|
|
|
94
95
|
required?: boolean;
|
|
95
96
|
isFloatingLabel?: boolean;
|
|
96
97
|
keepCloseIconOnValue?: boolean;
|
|
98
|
+
keepFooterSpace?: boolean;
|
|
97
99
|
hasClearIcon?: boolean;
|
|
98
100
|
hasSearchIcon?: boolean;
|
|
99
101
|
startIcon?: ReactNode;
|
|
@@ -144,6 +146,7 @@ declare const MaskedTextInput: React__default.ForwardRefExoticComponent<{
|
|
|
144
146
|
required?: boolean;
|
|
145
147
|
isFloatingLabel?: boolean;
|
|
146
148
|
keepCloseIconOnValue?: boolean;
|
|
149
|
+
keepFooterSpace?: boolean;
|
|
147
150
|
hasClearIcon?: boolean;
|
|
148
151
|
hasSearchIcon?: boolean;
|
|
149
152
|
startIcon?: React__default.ReactNode;
|
|
@@ -3969,6 +3969,10 @@ input[type=number] {
|
|
|
3969
3969
|
margin-bottom: 0.25rem;
|
|
3970
3970
|
}
|
|
3971
3971
|
|
|
3972
|
+
.mb-2 {
|
|
3973
|
+
margin-bottom: 0.5rem;
|
|
3974
|
+
}
|
|
3975
|
+
|
|
3972
3976
|
.ml-2 {
|
|
3973
3977
|
margin-left: 0.5rem;
|
|
3974
3978
|
}
|
|
@@ -4256,6 +4260,10 @@ input[type=number] {
|
|
|
4256
4260
|
min-height: 2.5rem;
|
|
4257
4261
|
}
|
|
4258
4262
|
|
|
4263
|
+
.min-h-\[14px\] {
|
|
4264
|
+
min-height: 14px;
|
|
4265
|
+
}
|
|
4266
|
+
|
|
4259
4267
|
.min-h-screen {
|
|
4260
4268
|
min-height: 100vh;
|
|
4261
4269
|
}
|
|
@@ -4597,6 +4605,10 @@ input[type=number] {
|
|
|
4597
4605
|
gap: 1.5rem;
|
|
4598
4606
|
}
|
|
4599
4607
|
|
|
4608
|
+
.gap-8 {
|
|
4609
|
+
gap: 2rem;
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4600
4612
|
.gap-\[2px\] {
|
|
4601
4613
|
gap: 2px;
|
|
4602
4614
|
}
|
|
@@ -5100,6 +5112,10 @@ input[type=number] {
|
|
|
5100
5112
|
background-color: rgb(var(--navbar-bg-color));
|
|
5101
5113
|
}
|
|
5102
5114
|
|
|
5115
|
+
.bg-\[var\(--base-color-popup\)\] {
|
|
5116
|
+
background-color: var(--base-color-popup);
|
|
5117
|
+
}
|
|
5118
|
+
|
|
5103
5119
|
.bg-\[var\(--dropdown-menu-default-bg\)\] {
|
|
5104
5120
|
background-color: var(--dropdown-menu-default-bg);
|
|
5105
5121
|
}
|
|
@@ -6792,6 +6808,10 @@ input[type=number] {
|
|
|
6792
6808
|
fill: color-mix(in srgb, var(--input-color-disable-stroke) calc(100% * 1), transparent);
|
|
6793
6809
|
}
|
|
6794
6810
|
|
|
6811
|
+
.fill-none {
|
|
6812
|
+
fill: none;
|
|
6813
|
+
}
|
|
6814
|
+
|
|
6795
6815
|
.fill-primary {
|
|
6796
6816
|
fill: color-mix(in srgb, var(--state-color-primary-default) calc(100% * 1), transparent);
|
|
6797
6817
|
}
|
|
@@ -6816,10 +6836,22 @@ input[type=number] {
|
|
|
6816
6836
|
stroke: color-mix(in srgb, var(--input-color-default-stroke) calc(100% * 1), transparent);
|
|
6817
6837
|
}
|
|
6818
6838
|
|
|
6839
|
+
.stroke-input-default-text {
|
|
6840
|
+
stroke: color-mix(in srgb, var(--input-color-default-text) calc(100% * 1), transparent);
|
|
6841
|
+
}
|
|
6842
|
+
|
|
6819
6843
|
.stroke-input-disable-stroke {
|
|
6820
6844
|
stroke: color-mix(in srgb, var(--input-color-disable-stroke) calc(100% * 1), transparent);
|
|
6821
6845
|
}
|
|
6822
6846
|
|
|
6847
|
+
.stroke-input-error {
|
|
6848
|
+
stroke: color-mix(in srgb, var(--input-color-error) calc(100% * 1), transparent);
|
|
6849
|
+
}
|
|
6850
|
+
|
|
6851
|
+
.stroke-input-filled-text {
|
|
6852
|
+
stroke: color-mix(in srgb, var(--input-color-filled-text) calc(100% * 1), transparent);
|
|
6853
|
+
}
|
|
6854
|
+
|
|
6823
6855
|
.stroke-primary-default {
|
|
6824
6856
|
stroke: color-mix(in srgb, var(--state-color-primary-default) calc(100% * 1), transparent);
|
|
6825
6857
|
}
|
|
@@ -8490,6 +8522,14 @@ input[type=number] {
|
|
|
8490
8522
|
fill: color-mix(in srgb, var(--input-color-default-text) calc(100% * 1), transparent);
|
|
8491
8523
|
}
|
|
8492
8524
|
|
|
8525
|
+
.hover\:stroke-input-active-stroke:hover {
|
|
8526
|
+
stroke: color-mix(in srgb, var(--input-color-active-stroke) calc(100% * 1), transparent);
|
|
8527
|
+
}
|
|
8528
|
+
|
|
8529
|
+
.hover\:stroke-input-filled-text:hover {
|
|
8530
|
+
stroke: color-mix(in srgb, var(--input-color-filled-text) calc(100% * 1), transparent);
|
|
8531
|
+
}
|
|
8532
|
+
|
|
8493
8533
|
.hover\:text-\[var\(--dropdown-menu-hover-text\)\]:hover {
|
|
8494
8534
|
color: var(--dropdown-menu-hover-text);
|
|
8495
8535
|
}
|
|
@@ -8658,6 +8698,11 @@ input[type=number] {
|
|
|
8658
8698
|
--tw-ring-color: color-mix(in srgb, var(--input-color-disable-stroke) calc(100% * var(--tw-ring-opacity, 1)), transparent);
|
|
8659
8699
|
}
|
|
8660
8700
|
|
|
8701
|
+
.hover\:ring-input-error:hover {
|
|
8702
|
+
--tw-ring-opacity: 1;
|
|
8703
|
+
--tw-ring-color: color-mix(in srgb, var(--input-color-error) calc(100% * var(--tw-ring-opacity, 1)), transparent);
|
|
8704
|
+
}
|
|
8705
|
+
|
|
8661
8706
|
.hover\:placeholder\:text-input-disable-text:hover::-moz-placeholder {
|
|
8662
8707
|
--tw-text-opacity: 1;
|
|
8663
8708
|
color: color-mix(in srgb, var(--input-color-disable-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
@@ -9151,6 +9196,10 @@ input[type=number] {
|
|
|
9151
9196
|
fill: color-mix(in srgb, var(--button-warning-solid-active-text) calc(100% * 1), transparent);
|
|
9152
9197
|
}
|
|
9153
9198
|
|
|
9199
|
+
.active\:stroke-input-filled-text:active {
|
|
9200
|
+
stroke: color-mix(in srgb, var(--input-color-filled-text) calc(100% * 1), transparent);
|
|
9201
|
+
}
|
|
9202
|
+
|
|
9154
9203
|
.active\:text-action-button-icon-active-pressed:active {
|
|
9155
9204
|
--tw-text-opacity: 1;
|
|
9156
9205
|
color: color-mix(in srgb, var(--action-button-icon-active-pressed-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
@@ -9897,6 +9946,11 @@ input[type=number] {
|
|
|
9897
9946
|
stroke: color-mix(in srgb, var(--state-color-primary-hover) calc(100% * 1), transparent);
|
|
9898
9947
|
}
|
|
9899
9948
|
|
|
9949
|
+
.peer:focus ~ .peer-focus\:text-input-default-text {
|
|
9950
|
+
--tw-text-opacity: 1;
|
|
9951
|
+
color: color-mix(in srgb, var(--input-color-default-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
9952
|
+
}
|
|
9953
|
+
|
|
9900
9954
|
.peer:focus ~ .peer-focus\:text-input-filled-text {
|
|
9901
9955
|
--tw-text-opacity: 1;
|
|
9902
9956
|
color: color-mix(in srgb, var(--input-color-filled-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
@@ -9914,6 +9968,10 @@ input[type=number] {
|
|
|
9914
9968
|
font-weight: var(--label-label2-weight, 400);
|
|
9915
9969
|
}
|
|
9916
9970
|
|
|
9971
|
+
.peer:active ~ .peer-active\:fill-input-filled-text {
|
|
9972
|
+
fill: color-mix(in srgb, var(--input-color-filled-text) calc(100% * 1), transparent);
|
|
9973
|
+
}
|
|
9974
|
+
|
|
9917
9975
|
.peer:disabled ~ .peer-disabled\:cursor-not-allowed {
|
|
9918
9976
|
cursor: not-allowed;
|
|
9919
9977
|
}
|
|
@@ -10624,6 +10682,31 @@ input[type=number] {
|
|
|
10624
10682
|
height: 32px;
|
|
10625
10683
|
}
|
|
10626
10684
|
|
|
10685
|
+
.\[\&_svg\]\:text-input-default-text svg {
|
|
10686
|
+
--tw-text-opacity: 1;
|
|
10687
|
+
color: color-mix(in srgb, var(--input-color-default-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
10688
|
+
}
|
|
10689
|
+
|
|
10690
|
+
.peer:hover ~ .peer-hover\:\[\&_svg\]\:text-input-filled-text svg {
|
|
10691
|
+
--tw-text-opacity: 1;
|
|
10692
|
+
color: color-mix(in srgb, var(--input-color-filled-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
10693
|
+
}
|
|
10694
|
+
|
|
10695
|
+
.peer:focus ~ .peer-focus\:\[\&_svg\]\:text-input-filled-text svg {
|
|
10696
|
+
--tw-text-opacity: 1;
|
|
10697
|
+
color: color-mix(in srgb, var(--input-color-filled-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
10698
|
+
}
|
|
10699
|
+
|
|
10700
|
+
.peer:active ~ .peer-active\:\[\&_svg\]\:text-input-filled-text svg {
|
|
10701
|
+
--tw-text-opacity: 1;
|
|
10702
|
+
color: color-mix(in srgb, var(--input-color-filled-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
10703
|
+
}
|
|
10704
|
+
|
|
10705
|
+
.peer:disabled ~ .peer-disabled\:\[\&_svg\]\:text-input-disable-stroke svg {
|
|
10706
|
+
--tw-text-opacity: 1;
|
|
10707
|
+
color: color-mix(in srgb, var(--input-color-disable-stroke) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
10708
|
+
}
|
|
10709
|
+
|
|
10627
10710
|
.\[\&_tr\:last-child\]\:border-0 tr:last-child {
|
|
10628
10711
|
border-width: 0px;
|
|
10629
10712
|
}
|
package/package.json
CHANGED
|
@@ -26,8 +26,8 @@ export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const toggleIcon = visible
|
|
29
|
-
? showIcon ?? <Icon name="eye" type="lucide" size="inherit" className="size-full" aria-label="Hide password" />
|
|
30
|
-
: hideIcon ?? <Icon name="eye-closed" type="lucide" size="inherit" className="size-full" aria-label="Show password" />;
|
|
29
|
+
? showIcon ?? <Icon name="eye" type="lucide" size="inherit" className="size-full stroke-input-default-stroke hover:stroke-input-active-stroke" aria-label="Hide password" />
|
|
30
|
+
: hideIcon ?? <Icon name="eye-closed" type="lucide" size="inherit" className="size-full stroke-input-default-stroke hover:stroke-input-active-stroke" aria-label="Show password" />;
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<TextInput
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
1
|
+
import React, { useRef, useState } from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import TextInput from "./TextInput";
|
|
4
4
|
import { CalendarIcon } from "@heroicons/react/16/solid";
|
|
@@ -15,7 +15,7 @@ const meta = {
|
|
|
15
15
|
},
|
|
16
16
|
decorators: [
|
|
17
17
|
(Story) => (
|
|
18
|
-
<div className="p-5 flex w-full bg-[
|
|
18
|
+
<div className="p-5 flex h-full w-full bg-[var(--base-color-popup)] ">
|
|
19
19
|
<Story />
|
|
20
20
|
</div>
|
|
21
21
|
),
|
|
@@ -207,3 +207,61 @@ export const CustomIcon = {
|
|
|
207
207
|
);
|
|
208
208
|
},
|
|
209
209
|
} satisfies StoryObj;
|
|
210
|
+
|
|
211
|
+
const KeepFooterSpaceDemo = () => {
|
|
212
|
+
const [hasError, setHasError] = useState(false);
|
|
213
|
+
return (
|
|
214
|
+
<div className="flex flex-col gap-8 w-full max-w-md">
|
|
215
|
+
<p className="text-sm text-text-grey-dark">
|
|
216
|
+
Use <code>keepFooterSpace</code> to always reserve space for the
|
|
217
|
+
footer/helper area, preventing layout shift when an error or helper text
|
|
218
|
+
is shown or hidden.
|
|
219
|
+
</p>
|
|
220
|
+
<div className="flex flex-col gap-4">
|
|
221
|
+
<label className="flex items-center gap-2 cursor-pointer">
|
|
222
|
+
<input
|
|
223
|
+
type="checkbox"
|
|
224
|
+
checked={hasError}
|
|
225
|
+
onChange={(e) => setHasError(e.target.checked)}
|
|
226
|
+
/>
|
|
227
|
+
Show error message
|
|
228
|
+
</label>
|
|
229
|
+
<div className="flex flex-col">
|
|
230
|
+
<div>
|
|
231
|
+
<h4 className="text-sm font-medium mb-2 text-text-grey-dark">
|
|
232
|
+
With keepFooterSpace (layout stays stable)
|
|
233
|
+
</h4>
|
|
234
|
+
<TextInput
|
|
235
|
+
id="with-keep"
|
|
236
|
+
label="Email"
|
|
237
|
+
keepFooterSpace
|
|
238
|
+
error={hasError}
|
|
239
|
+
errorMessage={hasError ? "Please enter a valid email address" : undefined}
|
|
240
|
+
/>
|
|
241
|
+
</div>
|
|
242
|
+
<div>
|
|
243
|
+
<h4 className="text-sm font-medium mb-2 text-text-grey-dark">
|
|
244
|
+
Without keepFooterSpace (layout shifts when error appears)
|
|
245
|
+
</h4>
|
|
246
|
+
<TextInput
|
|
247
|
+
id="no-keep"
|
|
248
|
+
label="Email"
|
|
249
|
+
error={hasError}
|
|
250
|
+
errorMessage={hasError ? "Please enter a valid email address" : undefined}
|
|
251
|
+
/>
|
|
252
|
+
</div>
|
|
253
|
+
<div></div>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export const KeepFooterSpace = {
|
|
261
|
+
args: {
|
|
262
|
+
label: "Email",
|
|
263
|
+
fullwidth: true,
|
|
264
|
+
keepFooterSpace: true,
|
|
265
|
+
},
|
|
266
|
+
render: () => <KeepFooterSpaceDemo />,
|
|
267
|
+
} satisfies StoryObj;
|
|
@@ -39,7 +39,7 @@ export const inputVariant = cva(
|
|
|
39
39
|
],
|
|
40
40
|
},
|
|
41
41
|
error: {
|
|
42
|
-
true: "ring-input-error focus:ring-input-error",
|
|
42
|
+
true: "ring-input-error hover:ring-input-error focus:ring-input-error",
|
|
43
43
|
},
|
|
44
44
|
hasClearIcon: {
|
|
45
45
|
true: "",
|
|
@@ -132,13 +132,13 @@ export const inputVariant = cva(
|
|
|
132
132
|
leftSectionIcon: false, // TODO function style
|
|
133
133
|
rightSectionIcon: false,
|
|
134
134
|
},
|
|
135
|
-
}
|
|
135
|
+
},
|
|
136
136
|
);
|
|
137
137
|
|
|
138
138
|
export const labelVariant = cva(
|
|
139
139
|
[
|
|
140
140
|
"absolute block duration-450 transition-all px-[2px] text-input-default-text",
|
|
141
|
-
"peer-focus:text-input-
|
|
141
|
+
"peer-focus:text-input-default-text peer-focus:bg-input-label-bg", // TODO bg
|
|
142
142
|
],
|
|
143
143
|
{
|
|
144
144
|
variants: {
|
|
@@ -337,11 +337,11 @@ export const labelVariant = cva(
|
|
|
337
337
|
hasLeftSectionIcon: false,
|
|
338
338
|
isFloatingLabel: true,
|
|
339
339
|
},
|
|
340
|
-
}
|
|
340
|
+
},
|
|
341
341
|
);
|
|
342
342
|
|
|
343
343
|
export const helperTextVariant = cva(
|
|
344
|
-
["
|
|
344
|
+
["typography-small1 flex flex-row items-center gap-1"],
|
|
345
345
|
{
|
|
346
346
|
variants: {
|
|
347
347
|
size: {
|
|
@@ -362,12 +362,22 @@ export const helperTextVariant = cva(
|
|
|
362
362
|
disabled: false,
|
|
363
363
|
error: false,
|
|
364
364
|
},
|
|
365
|
-
}
|
|
365
|
+
},
|
|
366
366
|
);
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
const iconInteractiveColorStateClasses = [
|
|
369
|
+
"fill-input-default-text",
|
|
370
|
+
"peer-hover:fill-input-filled-text peer-focus:fill-input-filled-text peer-active:fill-input-filled-text",
|
|
371
|
+
"peer-disabled:fill-input-disable-stroke",
|
|
372
|
+
"[&_svg]:text-input-default-text",
|
|
373
|
+
"peer-hover:[&_svg]:text-input-filled-text peer-focus:[&_svg]:text-input-filled-text peer-active:[&_svg]:text-input-filled-text",
|
|
374
|
+
"peer-disabled:[&_svg]:text-input-disable-stroke",
|
|
375
|
+
];
|
|
376
|
+
|
|
377
|
+
export const inlineEndIconWrapperVariant = cva(
|
|
369
378
|
[
|
|
370
379
|
"absolute inset-y-0 right-0 items-center justify-center hidden peer-focus:flex",
|
|
380
|
+
...iconInteractiveColorStateClasses,
|
|
371
381
|
],
|
|
372
382
|
{
|
|
373
383
|
variants: {
|
|
@@ -380,11 +390,14 @@ export const iconWrapperVariant = cva(
|
|
|
380
390
|
defaultVariants: {
|
|
381
391
|
size: "md",
|
|
382
392
|
},
|
|
383
|
-
}
|
|
393
|
+
},
|
|
384
394
|
);
|
|
385
395
|
|
|
386
|
-
export const
|
|
387
|
-
[
|
|
396
|
+
export const inlineStartIconWrapperVariant = cva(
|
|
397
|
+
[
|
|
398
|
+
"absolute inset-y-0 left-0 items-center justify-center flex",
|
|
399
|
+
...iconInteractiveColorStateClasses,
|
|
400
|
+
],
|
|
388
401
|
{
|
|
389
402
|
variants: {
|
|
390
403
|
size: {
|
|
@@ -396,13 +409,11 @@ export const iconSearchWrapperVariant = cva(
|
|
|
396
409
|
defaultVariants: {
|
|
397
410
|
size: "md",
|
|
398
411
|
},
|
|
399
|
-
}
|
|
412
|
+
},
|
|
400
413
|
);
|
|
401
414
|
|
|
402
|
-
export const
|
|
403
|
-
[
|
|
404
|
-
"cursor-pointer z-50 fill-input-active-stroke hover:fill-input-default-text",
|
|
405
|
-
],
|
|
415
|
+
export const iconActionVariant = cva(
|
|
416
|
+
["cursor-pointer z-50"],
|
|
406
417
|
{
|
|
407
418
|
variants: {
|
|
408
419
|
size: {
|
|
@@ -414,14 +425,14 @@ export const iconVariant = cva(
|
|
|
414
425
|
defaultVariants: {
|
|
415
426
|
size: "md",
|
|
416
427
|
},
|
|
417
|
-
}
|
|
428
|
+
},
|
|
418
429
|
);
|
|
419
430
|
|
|
420
|
-
export const
|
|
431
|
+
export const segmentedIconWrapperVariant = cva(
|
|
421
432
|
[
|
|
422
433
|
"cursor-pointer",
|
|
423
434
|
"absolute items-center justify-center flex",
|
|
424
|
-
|
|
435
|
+
...iconInteractiveColorStateClasses,
|
|
425
436
|
],
|
|
426
437
|
{
|
|
427
438
|
variants: {
|
|
@@ -499,5 +510,11 @@ export const sectionIconWrapperVariant = cva(
|
|
|
499
510
|
error: false,
|
|
500
511
|
position: "end",
|
|
501
512
|
},
|
|
502
|
-
}
|
|
513
|
+
},
|
|
503
514
|
);
|
|
515
|
+
|
|
516
|
+
// Backward-compatible aliases (can be removed in a future major version)
|
|
517
|
+
export const iconWrapperVariant = inlineEndIconWrapperVariant;
|
|
518
|
+
export const iconSearchWrapperVariant = inlineStartIconWrapperVariant;
|
|
519
|
+
export const iconVariant = iconActionVariant;
|
|
520
|
+
export const sectionIconWrapperVariant = segmentedIconWrapperVariant;
|