allaw-ui 0.1.55 → 0.1.58
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/buttons/TertiaryButton.d.ts +2 -1
- package/dist/components/atoms/buttons/TertiaryButton.js +2 -2
- package/dist/components/atoms/inputs/TextArea.css +8 -50
- package/dist/components/atoms/inputs/TextArea.d.ts +2 -3
- package/dist/components/atoms/inputs/TextArea.js +3 -16
- package/dist/components/atoms/selects/ComboBox.d.ts +2 -1
- package/dist/components/atoms/selects/ComboBox.js +3 -2
- package/package.json +1 -1
|
@@ -2,9 +2,10 @@ import React from "react";
|
|
|
2
2
|
import "./TertiaryButton.css";
|
|
3
3
|
import "../../../styles/global.css";
|
|
4
4
|
export interface TertiaryButtonProps {
|
|
5
|
-
startIcon?:
|
|
5
|
+
startIcon?: string;
|
|
6
6
|
label: string;
|
|
7
7
|
variant?: boolean;
|
|
8
|
+
onClick?: () => void;
|
|
8
9
|
}
|
|
9
10
|
declare const TertiaryButton: React.FC<TertiaryButtonProps>;
|
|
10
11
|
export default TertiaryButton;
|
|
@@ -2,8 +2,8 @@ import React from "react";
|
|
|
2
2
|
import "./TertiaryButton.css";
|
|
3
3
|
import "../../../styles/global.css";
|
|
4
4
|
var TertiaryButton = function (_a) {
|
|
5
|
-
var startIcon = _a.startIcon, label = _a.label, _b = _a.variant, variant = _b === void 0 ? false : _b;
|
|
6
|
-
return (React.createElement("button", { className: "tertiary-button ".concat(variant ? "tertiary-button-variant" : "tertiary-button-default") },
|
|
5
|
+
var startIcon = _a.startIcon, label = _a.label, _b = _a.variant, variant = _b === void 0 ? false : _b, onClick = _a.onClick;
|
|
6
|
+
return (React.createElement("button", { className: "tertiary-button ".concat(variant ? "tertiary-button-variant" : "tertiary-button-default"), onClick: onClick },
|
|
7
7
|
startIcon && React.createElement("span", { className: "tertiary-button-icon ".concat(startIcon) }),
|
|
8
8
|
React.createElement("span", { className: "tertiary-button-label" }, label)));
|
|
9
9
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
gap: 8px;
|
|
8
|
-
field-sizing: content;
|
|
8
|
+
/* field-sizing: content; */
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.text-area-title-container {
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
padding-left: 4px;
|
|
30
30
|
resize: vertical;
|
|
31
31
|
min-height: 100px;
|
|
32
|
+
max-height: 400px; /* Hauteur maximale par défaut */
|
|
33
|
+
overflow-y: auto; /* Ajoute une barre de défilement verticale si nécessaire */
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/* Style default */
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
justify-content: center;
|
|
40
42
|
align-items: flex-start;
|
|
41
43
|
gap: 11px;
|
|
42
|
-
field-sizing: content;
|
|
44
|
+
/* field-sizing: content; */
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
.text-area-default .text-area-container {
|
|
@@ -80,6 +82,8 @@
|
|
|
80
82
|
font-size: 16px;
|
|
81
83
|
line-height: 24px;
|
|
82
84
|
padding: 8px;
|
|
85
|
+
max-height: 400px; /* Hauteur maximale par défaut */
|
|
86
|
+
overflow-y: auto; /* Ajoute une barre de défilement verticale si nécessaire */
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
.text-area-variation {
|
|
@@ -116,6 +120,8 @@
|
|
|
116
120
|
border: none;
|
|
117
121
|
outline: none;
|
|
118
122
|
color: var(--noir);
|
|
123
|
+
max-height: 400px; /* Hauteur maximale par défaut */
|
|
124
|
+
overflow-y: auto; /* Ajoute une barre de défilement verticale si nécessaire */
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
.text-area-variation .text-area-icon-button {
|
|
@@ -144,54 +150,6 @@
|
|
|
144
150
|
padding-left: 2px;
|
|
145
151
|
}
|
|
146
152
|
|
|
147
|
-
/* Style password */
|
|
148
|
-
.text-area-password {
|
|
149
|
-
display: flex;
|
|
150
|
-
width: 100%;
|
|
151
|
-
flex-direction: column;
|
|
152
|
-
justify-content: center;
|
|
153
|
-
align-items: flex-start;
|
|
154
|
-
gap: 11px;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.text-area-password .text-area-container {
|
|
158
|
-
display: flex;
|
|
159
|
-
width: 100%;
|
|
160
|
-
flex-direction: row;
|
|
161
|
-
justify-content: space-between;
|
|
162
|
-
align-items: center;
|
|
163
|
-
border-radius: 8px;
|
|
164
|
-
border: 1px solid rgba(114, 142, 167, 1);
|
|
165
|
-
background: var(--Primary-Blanc, #fff);
|
|
166
|
-
padding: 10px;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.text-area-password .text-area-input {
|
|
170
|
-
display: flex;
|
|
171
|
-
flex: 1;
|
|
172
|
-
flex-direction: column;
|
|
173
|
-
align-items: flex-start;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.text-area-password .text-area-input textarea {
|
|
177
|
-
width: 100%;
|
|
178
|
-
border: none;
|
|
179
|
-
outline: none;
|
|
180
|
-
color: var(--noir);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.text-area-password .text-area-button {
|
|
184
|
-
color: var(--Primary-Mid-black, var(--primary-black, #171e25));
|
|
185
|
-
font-family: "Open Sans";
|
|
186
|
-
font-size: 12px;
|
|
187
|
-
font-style: normal;
|
|
188
|
-
font-weight: 600;
|
|
189
|
-
line-height: normal;
|
|
190
|
-
background: none;
|
|
191
|
-
border: none;
|
|
192
|
-
cursor: pointer;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
153
|
.text-area-error {
|
|
196
154
|
margin-top: 4px;
|
|
197
155
|
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./TextArea.css";
|
|
3
3
|
import "../../../styles/global.css";
|
|
4
|
-
import "../../../styles/icons.css";
|
|
5
4
|
import { commonRegex } from "../../../utils/regex";
|
|
6
5
|
export interface TextAreaProps {
|
|
7
6
|
title: string;
|
|
8
|
-
style?: "default" | "variation"
|
|
7
|
+
style?: "default" | "variation";
|
|
9
8
|
placeholder: string;
|
|
10
|
-
endIcon?: string;
|
|
11
9
|
isRequired?: boolean;
|
|
12
10
|
validate?: RegExp | keyof typeof commonRegex;
|
|
13
11
|
onError?: (error: string) => void;
|
|
14
12
|
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
15
13
|
value?: string;
|
|
16
14
|
error?: string;
|
|
15
|
+
maxHeight?: number;
|
|
17
16
|
}
|
|
18
17
|
export interface TextAreaRef {
|
|
19
18
|
validate: () => boolean;
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
import React, { useState, useEffect, useCallback, forwardRef, useImperativeHandle, useRef, } from "react";
|
|
3
3
|
import "./TextArea.css";
|
|
4
4
|
import "../../../styles/global.css";
|
|
5
|
-
import "../../../styles/icons.css";
|
|
6
5
|
import { commonRegex } from "../../../utils/regex";
|
|
7
6
|
import TinyInfo from "../typography/TinyInfo";
|
|
8
7
|
import Paragraph from "../typography/Paragraph";
|
|
9
8
|
var TextArea = forwardRef(function (_a, ref) {
|
|
10
|
-
var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, placeholder = _a.placeholder,
|
|
11
|
-
var _d = useState(false), isPasswordVisible = _d[0], setIsPasswordVisible = _d[1];
|
|
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;
|
|
12
10
|
var _e = useState(propValue || ""), value = _e[0], setValue = _e[1];
|
|
13
11
|
var _f = useState(propError || ""), error = _f[0], setError = _f[1];
|
|
14
12
|
var _g = useState(false), isTouched = _g[0], setIsTouched = _g[1];
|
|
@@ -52,16 +50,6 @@ var TextArea = forwardRef(function (_a, ref) {
|
|
|
52
50
|
setIsTouched(true);
|
|
53
51
|
validateTextArea();
|
|
54
52
|
};
|
|
55
|
-
var renderEndIcon = function () {
|
|
56
|
-
if (style === "variation" && endIcon) {
|
|
57
|
-
return (React.createElement("button", { className: "text-area-icon-button" },
|
|
58
|
-
React.createElement("i", { className: endIcon })));
|
|
59
|
-
}
|
|
60
|
-
if (style === "password") {
|
|
61
|
-
return (React.createElement("button", { className: "text-area-button", onClick: function () { return setIsPasswordVisible(!isPasswordVisible); } }, isPasswordVisible ? "CACHER" : "AFFICHER"));
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
};
|
|
65
53
|
return (React.createElement("div", { className: "TextArea text-area-".concat(style) },
|
|
66
54
|
React.createElement("div", { className: "text-area-title-container" },
|
|
67
55
|
React.createElement(Paragraph, { variant: "semiBold", color: "noir", text: title }),
|
|
@@ -69,9 +57,8 @@ var TextArea = forwardRef(function (_a, ref) {
|
|
|
69
57
|
"\u00A0",
|
|
70
58
|
"*"))),
|
|
71
59
|
React.createElement("div", { className: "text-area-container" },
|
|
72
|
-
React.createElement("div", { className: "text-area-input
|
|
73
|
-
React.createElement("textarea", { ref: textareaRef, placeholder: placeholder, className: "text-area-placeholder", value: value, onChange: handleChange, onBlur: handleBlur })),
|
|
74
|
-
renderEndIcon(),
|
|
60
|
+
React.createElement("div", { className: "text-area-input" },
|
|
61
|
+
React.createElement("textarea", { ref: textareaRef, placeholder: placeholder, className: "text-area-placeholder", value: value, onChange: handleChange, onBlur: handleBlur, style: { maxHeight: "".concat(maxHeight, "px") } })),
|
|
75
62
|
error && isTouched && (React.createElement("div", { className: "error-message" },
|
|
76
63
|
React.createElement(TinyInfo, { variant: "medium12", color: "actions-error", text: error }))))));
|
|
77
64
|
});
|
|
@@ -12,7 +12,8 @@ export interface ComboBoxProps {
|
|
|
12
12
|
isRequired?: boolean;
|
|
13
13
|
showError?: boolean;
|
|
14
14
|
width?: number;
|
|
15
|
-
|
|
15
|
+
onSelect?: (selected: string) => void;
|
|
16
|
+
onChange?: (value: string) => void;
|
|
16
17
|
onError?: (error: string) => void;
|
|
17
18
|
openOnMount?: boolean;
|
|
18
19
|
title?: string;
|
|
@@ -5,7 +5,7 @@ import TinyInfo from "../typography/TinyInfo";
|
|
|
5
5
|
import Paragraph from "../typography/Paragraph";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
function ComboBox(_a, ref) {
|
|
8
|
-
var items = _a.items, selectedItem = _a.selectedItem, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner..." : _b, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, _d = _a.showError, showError = _d === void 0 ? false : _d, _e = _a.width, width = _e === void 0 ? 100 : _e, onChange = _a.onChange, onError = _a.onError, _f = _a.openOnMount, openOnMount = _f === void 0 ? true : _f, title = _a.title;
|
|
8
|
+
var items = _a.items, selectedItem = _a.selectedItem, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner..." : _b, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, _d = _a.showError, showError = _d === void 0 ? false : _d, _e = _a.width, width = _e === void 0 ? 100 : _e, onSelect = _a.onSelect, onChange = _a.onChange, onError = _a.onError, _f = _a.openOnMount, openOnMount = _f === void 0 ? true : _f, title = _a.title;
|
|
9
9
|
var _g = useState(openOnMount), isOpen = _g[0], setIsOpen = _g[1];
|
|
10
10
|
var _h = useState(""), inputValue = _h[0], setInputValue = _h[1];
|
|
11
11
|
var _j = useState(items), filteredItems = _j[0], setFilteredItems = _j[1];
|
|
@@ -66,6 +66,7 @@ function ComboBox(_a, ref) {
|
|
|
66
66
|
setFilteredItems(filtered);
|
|
67
67
|
setIsInputValid(filtered.length > 0 || value === "");
|
|
68
68
|
setIsOpen(true);
|
|
69
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
69
70
|
};
|
|
70
71
|
var handleInputFocus = function () {
|
|
71
72
|
setIsOpen(true);
|
|
@@ -76,7 +77,7 @@ function ComboBox(_a, ref) {
|
|
|
76
77
|
setSelectedIndex(index);
|
|
77
78
|
setFilteredItems(items);
|
|
78
79
|
setIsOpen(false);
|
|
79
|
-
|
|
80
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(item.value);
|
|
80
81
|
validateSelect(item.value);
|
|
81
82
|
};
|
|
82
83
|
var validateSelect = function (value) {
|