allaw-ui 3.8.0 → 3.8.1
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/selects/Select.d.ts +1 -0
- package/dist/components/atoms/selects/Select.js +10 -10
- package/dist/components/atoms/selects/Select.module.css +12 -0
- package/dist/components/atoms/selects/Select.stories.d.ts +15 -7
- package/dist/components/atoms/selects/Select.stories.js +26 -0
- package/package.json +1 -1
|
@@ -14,21 +14,21 @@ import "../../../styles/global.css";
|
|
|
14
14
|
import TinyInfo from "../typography/TinyInfo";
|
|
15
15
|
function Select(_a, ref) {
|
|
16
16
|
var _b;
|
|
17
|
-
var items = _a.items, selectedItem = _a.selectedItem, _c = _a.placeholder, placeholder = _c === void 0 ? "Choisir..." : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, _f = _a.showError, showError = _f === void 0 ? false : _f, _g = _a.width, width = _g === void 0 ? 100 : _g, maxItems = _a.maxItems, onChange = _a.onChange, onError = _a.onError;
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
17
|
+
var items = _a.items, selectedItem = _a.selectedItem, _c = _a.placeholder, placeholder = _c === void 0 ? "Choisir..." : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, _f = _a.showError, showError = _f === void 0 ? false : _f, _g = _a.width, width = _g === void 0 ? 100 : _g, maxItems = _a.maxItems, _h = _a.requireAttention, requireAttention = _h === void 0 ? false : _h, onChange = _a.onChange, onError = _a.onError;
|
|
18
|
+
var _j = useState(false), isOpen = _j[0], setIsOpen = _j[1];
|
|
19
|
+
var _k = useState((multiple ? selectedItem || [] : selectedItem || "")), selected = _k[0], setSelected = _k[1];
|
|
20
|
+
var _l = useState(""), error = _l[0], setError = _l[1];
|
|
21
21
|
var selectRef = useRef(null);
|
|
22
22
|
var listRef = useRef(null);
|
|
23
23
|
var tagContainerRef = useRef(null);
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
24
|
+
var _m = useState([]), visibleTags = _m[0], setVisibleTags = _m[1];
|
|
25
|
+
var _o = useState(0), hiddenCount = _o[0], setHiddenCount = _o[1];
|
|
26
|
+
var _p = useState({
|
|
27
27
|
top: 0,
|
|
28
28
|
left: 0,
|
|
29
29
|
width: 0,
|
|
30
|
-
}), listPosition =
|
|
31
|
-
var
|
|
30
|
+
}), listPosition = _p[0], setListPosition = _p[1];
|
|
31
|
+
var _q = useState("bottom"), placement = _q[0], setPlacement = _q[1];
|
|
32
32
|
useEffect(function () {
|
|
33
33
|
setSelected((multiple ? selectedItem || [] : selectedItem || ""));
|
|
34
34
|
}, [selectedItem, multiple]);
|
|
@@ -226,7 +226,7 @@ function Select(_a, ref) {
|
|
|
226
226
|
validate: function () { return validateSelect(selected); },
|
|
227
227
|
}); });
|
|
228
228
|
return (React.createElement("div", { ref: selectRef, className: "".concat(styles.selectContainer, " ").concat(isOpen ? styles.selectPressed : ""), style: { width: "".concat(width, "%") } },
|
|
229
|
-
React.createElement("button", { type: "button", className: "".concat(styles.select, " ").concat(isOpen ? styles.selectPressed : styles.selectDefault, " ").concat(multiple ? styles.selectMultiple : styles.selectSingle), onClick: toggleOpen, style: { width: "100%" } },
|
|
229
|
+
React.createElement("button", { type: "button", className: "".concat(styles.select, " ").concat(isOpen ? styles.selectPressed : styles.selectDefault, " ").concat(multiple ? styles.selectMultiple : styles.selectSingle, " ").concat(requireAttention ? styles.selectRequireAttention : ""), onClick: toggleOpen, style: { width: "100%" } },
|
|
230
230
|
React.createElement("span", { className: styles.selectText }, Array.isArray(selected) && selected.length > 0
|
|
231
231
|
? renderTags(selected)
|
|
232
232
|
: !Array.isArray(selected) && selected
|
|
@@ -184,3 +184,15 @@
|
|
|
184
184
|
.selectSingle {
|
|
185
185
|
padding: 8px 16px;
|
|
186
186
|
}
|
|
187
|
+
|
|
188
|
+
.selectRequireAttention {
|
|
189
|
+
border-color: #25beeb !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.selectRequireAttention:hover {
|
|
193
|
+
border-color: #1d9cc9 !important;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.selectRequireAttention:focus {
|
|
197
|
+
border-color: #1d9cc9 !important;
|
|
198
|
+
}
|
|
@@ -32,35 +32,42 @@ declare namespace _default {
|
|
|
32
32
|
}
|
|
33
33
|
export { control_3 as control };
|
|
34
34
|
}
|
|
35
|
-
namespace
|
|
35
|
+
namespace requireAttention {
|
|
36
36
|
export namespace control_4 {
|
|
37
37
|
let type_4: string;
|
|
38
38
|
export { type_4 as type };
|
|
39
39
|
}
|
|
40
40
|
export { control_4 as control };
|
|
41
41
|
}
|
|
42
|
-
namespace
|
|
42
|
+
namespace selectedItem {
|
|
43
43
|
export namespace control_5 {
|
|
44
44
|
let type_5: string;
|
|
45
45
|
export { type_5 as type };
|
|
46
|
-
export let min: number;
|
|
47
46
|
}
|
|
48
47
|
export { control_5 as control };
|
|
49
48
|
}
|
|
49
|
+
namespace maxItems {
|
|
50
|
+
export namespace control_6 {
|
|
51
|
+
let type_6: string;
|
|
52
|
+
export { type_6 as type };
|
|
53
|
+
export let min: number;
|
|
54
|
+
}
|
|
55
|
+
export { control_6 as control };
|
|
56
|
+
}
|
|
50
57
|
namespace onChange {
|
|
51
58
|
namespace table {
|
|
52
59
|
let disable: boolean;
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
namespace width {
|
|
56
|
-
export namespace
|
|
57
|
-
let
|
|
58
|
-
export {
|
|
63
|
+
export namespace control_7 {
|
|
64
|
+
let type_7: string;
|
|
65
|
+
export { type_7 as type };
|
|
59
66
|
let min_1: number;
|
|
60
67
|
export { min_1 as min };
|
|
61
68
|
export let max: number;
|
|
62
69
|
}
|
|
63
|
-
export {
|
|
70
|
+
export { control_7 as control };
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
73
|
export namespace parameters {
|
|
@@ -92,4 +99,5 @@ export const Pressed: any;
|
|
|
92
99
|
export const Multiple: any;
|
|
93
100
|
export const Required: any;
|
|
94
101
|
export const CustomWidth: any;
|
|
102
|
+
export const RequireAttention: any;
|
|
95
103
|
import Select from "./Select";
|
|
@@ -40,6 +40,11 @@ export default {
|
|
|
40
40
|
type: "boolean",
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
|
+
requireAttention: {
|
|
44
|
+
control: {
|
|
45
|
+
type: "boolean",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
43
48
|
selectedItem: {
|
|
44
49
|
control: {
|
|
45
50
|
type: "text",
|
|
@@ -109,6 +114,7 @@ Default.args = {
|
|
|
109
114
|
placeholder: "Select...",
|
|
110
115
|
multiple: false,
|
|
111
116
|
isRequired: false,
|
|
117
|
+
requireAttention: false,
|
|
112
118
|
width: 100,
|
|
113
119
|
};
|
|
114
120
|
export var Pressed = Template.bind({});
|
|
@@ -125,6 +131,7 @@ Pressed.args = {
|
|
|
125
131
|
placeholder: "Select...",
|
|
126
132
|
multiple: false,
|
|
127
133
|
isRequired: false,
|
|
134
|
+
requireAttention: false,
|
|
128
135
|
};
|
|
129
136
|
export var Multiple = Template.bind({});
|
|
130
137
|
Multiple.args = {
|
|
@@ -140,6 +147,7 @@ Multiple.args = {
|
|
|
140
147
|
placeholder: "Select...",
|
|
141
148
|
multiple: true,
|
|
142
149
|
isRequired: false,
|
|
150
|
+
requireAttention: false,
|
|
143
151
|
maxItems: 3,
|
|
144
152
|
};
|
|
145
153
|
export var Required = Template.bind({});
|
|
@@ -156,6 +164,24 @@ Required.args = {
|
|
|
156
164
|
placeholder: "Select...",
|
|
157
165
|
multiple: false,
|
|
158
166
|
isRequired: true,
|
|
167
|
+
requireAttention: false,
|
|
159
168
|
};
|
|
160
169
|
export var CustomWidth = Template.bind({});
|
|
161
170
|
CustomWidth.args = __assign(__assign({}, Default.args), { width: 50 });
|
|
171
|
+
export var RequireAttention = Template.bind({});
|
|
172
|
+
RequireAttention.args = {
|
|
173
|
+
items: [
|
|
174
|
+
{ label: "Lundi 12 août", value: "lundi-12-aout" },
|
|
175
|
+
{ label: "Mardi 13 août", value: "mardi-13-aout" },
|
|
176
|
+
{ label: "Mercredi 14 août", value: "mercredi-14-aout" },
|
|
177
|
+
{ label: "Jeudi 15 août", value: "jeudi-15-aout" },
|
|
178
|
+
{ label: "Vendredi 16 août", value: "vendredi-16-aout" },
|
|
179
|
+
{ label: "Samedi 17 août", value: "samedi-17-aout" },
|
|
180
|
+
],
|
|
181
|
+
selectedItem: "",
|
|
182
|
+
placeholder: "Choisir une date...",
|
|
183
|
+
multiple: false,
|
|
184
|
+
isRequired: false,
|
|
185
|
+
requireAttention: true,
|
|
186
|
+
width: 100,
|
|
187
|
+
};
|