allaw-ui 3.2.1 → 3.2.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/components/atoms/inputs/TextArea.css +6 -1
- package/dist/components/atoms/inputs/TextArea.d.ts +1 -0
- package/dist/components/atoms/inputs/TextArea.js +8 -5
- package/dist/components/atoms/inputs/TextArea.stories.d.ts +31 -6
- package/dist/components/atoms/inputs/TextArea.stories.js +28 -0
- package/package.json +1 -1
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
width: 100%;
|
|
29
29
|
padding-left: 4px;
|
|
30
30
|
resize: vertical;
|
|
31
|
-
min-height: 100px;
|
|
31
|
+
min-height: 100px; /* Hauteur minimale par défaut, peut être remplacée via props */
|
|
32
32
|
max-height: 400px; /* Hauteur maximale par défaut */
|
|
33
33
|
overflow-y: auto; /* Ajoute une barre de défilement verticale si nécessaire */
|
|
34
|
+
transition: min-height 0.3s ease-in-out; /* Transition fluide pour les changements de hauteur */
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
/* Style default */
|
|
@@ -82,8 +83,10 @@
|
|
|
82
83
|
font-size: 16px;
|
|
83
84
|
line-height: 24px;
|
|
84
85
|
padding: 8px;
|
|
86
|
+
min-height: 100px; /* Hauteur minimale par défaut, peut être remplacée via props */
|
|
85
87
|
max-height: 400px; /* Hauteur maximale par défaut */
|
|
86
88
|
overflow-y: auto; /* Ajoute une barre de défilement verticale si nécessaire */
|
|
89
|
+
transition: min-height 0.3s ease-in-out; /* Transition fluide pour les changements de hauteur */
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
.text-area-variation {
|
|
@@ -120,8 +123,10 @@
|
|
|
120
123
|
border: none;
|
|
121
124
|
outline: none;
|
|
122
125
|
color: var(--noir);
|
|
126
|
+
min-height: 100px; /* Hauteur minimale par défaut, peut être remplacée via props */
|
|
123
127
|
max-height: 400px; /* Hauteur maximale par défaut */
|
|
124
128
|
overflow-y: auto; /* Ajoute une barre de défilement verticale si nécessaire */
|
|
129
|
+
transition: min-height 0.3s ease-in-out; /* Transition fluide pour les changements de hauteur */
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
.text-area-variation .text-area-icon-button {
|
|
@@ -13,6 +13,7 @@ export interface TextAreaProps {
|
|
|
13
13
|
value?: string;
|
|
14
14
|
error?: string;
|
|
15
15
|
maxHeight?: number;
|
|
16
|
+
minHeight?: number;
|
|
16
17
|
variant?: "bold" | "semiBold" | "medium";
|
|
17
18
|
color?: "bleu-allaw" | "mid-grey" | "dark-grey" | "noir" | "pure-white" | "grey-venom" | "venom-grey-dark";
|
|
18
19
|
dataCy?: string;
|
|
@@ -6,10 +6,10 @@ import { commonRegex } from "../../../utils/regex";
|
|
|
6
6
|
import TinyInfo from "../typography/TinyInfo";
|
|
7
7
|
import Paragraph from "../typography/Paragraph";
|
|
8
8
|
var TextArea = forwardRef(function (_a, ref) {
|
|
9
|
-
var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, placeholder = _a.placeholder, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, propError = _a.error, _d = _a.maxHeight, maxHeight = _d === void 0 ? 400 : _d, _e = _a.variant, variant =
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
9
|
+
var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, placeholder = _a.placeholder, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, propError = _a.error, _d = _a.maxHeight, maxHeight = _d === void 0 ? 400 : _d, _e = _a.minHeight, minHeight = _e === void 0 ? 100 : _e, _f = _a.variant, variant = _f === void 0 ? "medium" : _f, _g = _a.color, color = _g === void 0 ? "noir" : _g, dataCy = _a.dataCy;
|
|
10
|
+
var _h = useState(propValue || ""), value = _h[0], setValue = _h[1];
|
|
11
|
+
var _j = useState(propError || ""), error = _j[0], setError = _j[1];
|
|
12
|
+
var _k = useState(false), isTouched = _k[0], setIsTouched = _k[1];
|
|
13
13
|
var textareaRef = useRef(null);
|
|
14
14
|
useEffect(function () {
|
|
15
15
|
setValue(propValue || "");
|
|
@@ -58,7 +58,10 @@ var TextArea = forwardRef(function (_a, ref) {
|
|
|
58
58
|
"*"))),
|
|
59
59
|
React.createElement("div", { className: "text-area-container" },
|
|
60
60
|
React.createElement("div", { className: "text-area-input", "data-cy": dataCy || "text-area" },
|
|
61
|
-
React.createElement("textarea", { ref: textareaRef, placeholder: placeholder, className: "text-area-placeholder", value: value, onChange: handleChange, onBlur: handleBlur, style: {
|
|
61
|
+
React.createElement("textarea", { ref: textareaRef, placeholder: placeholder, className: "text-area-placeholder", value: value, onChange: handleChange, onBlur: handleBlur, style: {
|
|
62
|
+
maxHeight: "".concat(maxHeight, "px"),
|
|
63
|
+
minHeight: "".concat(minHeight, "px"),
|
|
64
|
+
} })),
|
|
62
65
|
error && isTouched && (React.createElement("div", { className: "error-message" },
|
|
63
66
|
React.createElement(TinyInfo, { variant: "medium12", color: "actions-error", text: error }))))));
|
|
64
67
|
});
|
|
@@ -33,23 +33,47 @@ declare namespace _default {
|
|
|
33
33
|
}
|
|
34
34
|
export { control_3 as control };
|
|
35
35
|
}
|
|
36
|
-
namespace
|
|
36
|
+
namespace minHeight {
|
|
37
37
|
export namespace control_4 {
|
|
38
38
|
let type_3: string;
|
|
39
39
|
export { type_3 as type };
|
|
40
|
+
let min_1: number;
|
|
41
|
+
export { min_1 as min };
|
|
42
|
+
let max_1: number;
|
|
43
|
+
export { max_1 as max };
|
|
44
|
+
let step_1: number;
|
|
45
|
+
export { step_1 as step };
|
|
46
|
+
}
|
|
47
|
+
export { control_4 as control };
|
|
48
|
+
export let description: string;
|
|
49
|
+
export namespace table {
|
|
50
|
+
export namespace type_4 {
|
|
51
|
+
let summary: string;
|
|
52
|
+
}
|
|
53
|
+
export { type_4 as type };
|
|
54
|
+
export namespace defaultValue {
|
|
55
|
+
let summary_1: number;
|
|
56
|
+
export { summary_1 as summary };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
namespace variant {
|
|
61
|
+
export namespace control_5 {
|
|
62
|
+
let type_5: string;
|
|
63
|
+
export { type_5 as type };
|
|
40
64
|
let options_1: string[];
|
|
41
65
|
export { options_1 as options };
|
|
42
66
|
}
|
|
43
|
-
export {
|
|
67
|
+
export { control_5 as control };
|
|
44
68
|
}
|
|
45
69
|
namespace color {
|
|
46
|
-
export namespace
|
|
47
|
-
let
|
|
48
|
-
export {
|
|
70
|
+
export namespace control_6 {
|
|
71
|
+
let type_6: string;
|
|
72
|
+
export { type_6 as type };
|
|
49
73
|
let options_2: string[];
|
|
50
74
|
export { options_2 as options };
|
|
51
75
|
}
|
|
52
|
-
export {
|
|
76
|
+
export { control_6 as control };
|
|
53
77
|
}
|
|
54
78
|
}
|
|
55
79
|
export namespace parameters {
|
|
@@ -67,4 +91,5 @@ export default _default;
|
|
|
67
91
|
export const Default: any;
|
|
68
92
|
export const Variation: any;
|
|
69
93
|
export const WithValidation: any;
|
|
94
|
+
export const LargeMinHeight: any;
|
|
70
95
|
import TextArea from "./TextArea";
|
|
@@ -43,6 +43,19 @@ export default {
|
|
|
43
43
|
step: 50,
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
|
+
minHeight: {
|
|
47
|
+
control: {
|
|
48
|
+
type: "number",
|
|
49
|
+
min: 50,
|
|
50
|
+
max: 500,
|
|
51
|
+
step: 10,
|
|
52
|
+
},
|
|
53
|
+
description: "Hauteur minimale du TextArea en pixels",
|
|
54
|
+
table: {
|
|
55
|
+
type: { summary: "number" },
|
|
56
|
+
defaultValue: { summary: 100 },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
46
59
|
variant: {
|
|
47
60
|
control: {
|
|
48
61
|
type: "select",
|
|
@@ -89,6 +102,7 @@ Default.args = {
|
|
|
89
102
|
style: "default",
|
|
90
103
|
isRequired: false,
|
|
91
104
|
maxHeight: 400,
|
|
105
|
+
minHeight: 100,
|
|
92
106
|
variant: "medium",
|
|
93
107
|
color: "noir",
|
|
94
108
|
};
|
|
@@ -100,6 +114,7 @@ Variation.args = {
|
|
|
100
114
|
style: "variation",
|
|
101
115
|
isRequired: true,
|
|
102
116
|
maxHeight: 400,
|
|
117
|
+
minHeight: 100,
|
|
103
118
|
};
|
|
104
119
|
export var WithValidation = Template.bind({});
|
|
105
120
|
WithValidation.args = {
|
|
@@ -110,4 +125,17 @@ WithValidation.args = {
|
|
|
110
125
|
isRequired: true,
|
|
111
126
|
validate: "email",
|
|
112
127
|
maxHeight: 400,
|
|
128
|
+
minHeight: 100,
|
|
129
|
+
};
|
|
130
|
+
export var LargeMinHeight = Template.bind({});
|
|
131
|
+
LargeMinHeight.args = {
|
|
132
|
+
name: "largeTextArea",
|
|
133
|
+
title: "Description détaillée",
|
|
134
|
+
placeholder: "Entrez une description détaillée",
|
|
135
|
+
style: "default",
|
|
136
|
+
isRequired: false,
|
|
137
|
+
maxHeight: 400,
|
|
138
|
+
minHeight: 200,
|
|
139
|
+
variant: "medium",
|
|
140
|
+
color: "noir",
|
|
113
141
|
};
|