@pareto-engineering/design-system 4.0.0-alpha.73 → 4.0.0-alpha.75
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/a/DatePicker/DatePicker.js +162 -0
- package/dist/cjs/a/DatePicker/index.js +13 -0
- package/dist/cjs/a/DatePicker/styles.scss +380 -0
- package/dist/cjs/a/XMLEditor/XMLEditor.js +5 -0
- package/dist/cjs/a/index.js +8 -1
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +33 -42
- package/dist/cjs/f/fields/SelectInput/common/Menu/Menu.js +83 -0
- package/dist/cjs/f/fields/SelectInput/common/Menu/index.js +13 -0
- package/dist/cjs/f/fields/SelectInput/common/Multiple/Multiple.js +244 -0
- package/dist/cjs/f/fields/SelectInput/common/Multiple/index.js +13 -0
- package/dist/cjs/f/fields/SelectInput/common/Single/Single.js +104 -0
- package/dist/cjs/f/fields/SelectInput/common/Single/index.js +13 -0
- package/dist/cjs/f/fields/SelectInput/common/index.js +26 -0
- package/dist/cjs/f/fields/SelectInput/styles.scss +149 -45
- package/dist/es/a/DatePicker/DatePicker.js +154 -0
- package/dist/es/a/DatePicker/index.js +2 -0
- package/dist/es/a/DatePicker/styles.scss +380 -0
- package/dist/es/a/XMLEditor/XMLEditor.js +5 -0
- package/dist/es/a/index.js +2 -1
- package/dist/es/f/fields/SelectInput/SelectInput.js +31 -42
- package/dist/es/f/fields/SelectInput/common/Menu/Menu.js +73 -0
- package/dist/es/f/fields/SelectInput/common/Menu/index.js +2 -0
- package/dist/es/f/fields/SelectInput/common/Multiple/Multiple.js +235 -0
- package/dist/es/f/fields/SelectInput/common/Multiple/index.js +2 -0
- package/dist/es/f/fields/SelectInput/common/Single/Single.js +96 -0
- package/dist/es/f/fields/SelectInput/common/Single/index.js +2 -0
- package/dist/es/f/fields/SelectInput/common/index.js +3 -0
- package/dist/es/f/fields/SelectInput/styles.scss +149 -45
- package/package.json +3 -2
- package/src/stories/a/DatePicker.stories.jsx +88 -0
- package/src/stories/f/SelectInput.stories.jsx +15 -0
- package/src/ui/a/DatePicker/DatePicker.jsx +201 -0
- package/src/ui/a/DatePicker/index.js +2 -0
- package/src/ui/a/DatePicker/styles.scss +380 -0
- package/src/ui/a/XMLEditor/XMLEditor.jsx +6 -0
- package/src/ui/a/index.js +1 -0
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +34 -47
- package/src/ui/f/fields/SelectInput/common/Menu/Menu.jsx +103 -0
- package/src/ui/f/fields/SelectInput/common/Menu/index.js +2 -0
- package/src/ui/f/fields/SelectInput/common/Multiple/Multiple.jsx +288 -0
- package/src/ui/f/fields/SelectInput/common/Multiple/index.js +2 -0
- package/src/ui/f/fields/SelectInput/common/Single/Single.jsx +125 -0
- package/src/ui/f/fields/SelectInput/common/Single/index.js +2 -0
- package/src/ui/f/fields/SelectInput/common/index.js +3 -0
- package/src/ui/f/fields/SelectInput/styles.scss +149 -45
- package/tests/__snapshots__/Storyshots.test.js.snap +7559 -398
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
/* stylelint-disable max-nesting-depth -- needed here */
|
|
3
|
+
/* stylelint-disable selector-class-pattern -- needed here */
|
|
4
|
+
/* stylelint-disable selector-max-compound-selectors -- needed here */
|
|
5
|
+
/* stylelint-disable declaration-no-important -- needed here */
|
|
6
|
+
/* stylelint-disable font-weight-notation -- needed here */
|
|
7
|
+
/* stylelint-disable declaration-block-no-duplicate-properties -- needed here */
|
|
8
|
+
|
|
9
|
+
@use "@pareto-engineering/bem";
|
|
10
|
+
|
|
11
|
+
$default-background: var(--background-far);
|
|
12
|
+
$default-border: var(--theme-default-input-border);
|
|
13
|
+
$default-input-border-radius: var(--theme-default-input-border-radius);
|
|
14
|
+
$default-padding: .55em .75em;
|
|
15
|
+
$default-spacing-size: calc(var(--gap) / 2);
|
|
16
|
+
$rdp-cell-size: 40px;
|
|
17
|
+
$rdp-caption-font-size: 1em;
|
|
18
|
+
$rdp-accent-color: var(--hard-interactive);
|
|
19
|
+
$rdp-outline: 2px solid var(--hard-interactive);
|
|
20
|
+
$rdp-selected-color: var(--on-interactive);
|
|
21
|
+
|
|
22
|
+
.#{bem.$base}.date-picker {
|
|
23
|
+
/* Hide elements for devices that are not screen readers */
|
|
24
|
+
.rdp-vhidden {
|
|
25
|
+
appearance: none;
|
|
26
|
+
appearance: none;
|
|
27
|
+
appearance: none;
|
|
28
|
+
background: transparent;
|
|
29
|
+
border: 0;
|
|
30
|
+
border: 0 !important;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
33
|
+
height: 1px !important;
|
|
34
|
+
margin: 0;
|
|
35
|
+
overflow: hidden !important;
|
|
36
|
+
padding: 0;
|
|
37
|
+
padding: 0 !important;
|
|
38
|
+
position: absolute !important;
|
|
39
|
+
top: 0;
|
|
40
|
+
width: 1px !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Buttons */
|
|
44
|
+
.rdp-button_reset {
|
|
45
|
+
appearance: none;
|
|
46
|
+
appearance: none;
|
|
47
|
+
appearance: none;
|
|
48
|
+
background: none;
|
|
49
|
+
color: inherit;
|
|
50
|
+
cursor: default;
|
|
51
|
+
font: inherit;
|
|
52
|
+
margin: 0;
|
|
53
|
+
padding: 0;
|
|
54
|
+
position: relative;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.rdp-button_reset:focus-visible {
|
|
58
|
+
/* Make sure to reset outline only when :focus-visible is supported */
|
|
59
|
+
outline: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rdp-button {
|
|
63
|
+
border: 2px solid transparent;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.rdp-button[disabled]:not(.rdp-day_selected) {
|
|
67
|
+
opacity: .25;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.rdp-button:not([disabled]) {
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.rdp-button:focus-visible:not([disabled]) {
|
|
75
|
+
background-color: $default-background;
|
|
76
|
+
border: $rdp-outline;
|
|
77
|
+
color: inherit;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.rdp-button:hover:not([disabled]):not(.rdp-day_selected) {
|
|
81
|
+
background-color: $default-background;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.rdp-months {
|
|
85
|
+
display: flex;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.rdp-month {
|
|
89
|
+
margin: 0 1em;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.rdp-month:first-child {
|
|
93
|
+
margin-left: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.rdp-month:last-child {
|
|
97
|
+
margin-right: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.rdp-table {
|
|
101
|
+
background-color: $default-background;
|
|
102
|
+
border-collapse: collapse;
|
|
103
|
+
margin: 0;
|
|
104
|
+
max-width: calc($rdp-cell-size * 7);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.rdp-with_weeknumber .rdp-table {
|
|
108
|
+
border-collapse: collapse;
|
|
109
|
+
max-width: calc($rdp-cell-size * 8);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.rdp-caption {
|
|
113
|
+
align-items: center;
|
|
114
|
+
background-color: $default-background;
|
|
115
|
+
display: flex;
|
|
116
|
+
justify-content: space-between;
|
|
117
|
+
padding: 0;
|
|
118
|
+
text-align: left;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.rdp-multiple_months .rdp-caption {
|
|
122
|
+
display: block;
|
|
123
|
+
position: relative;
|
|
124
|
+
text-align: center;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.rdp-caption_dropdowns {
|
|
128
|
+
display: inline-flex;
|
|
129
|
+
position: relative;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.rdp-caption_label {
|
|
133
|
+
align-items: center;
|
|
134
|
+
border: 0;
|
|
135
|
+
border: 2px solid transparent;
|
|
136
|
+
color: var(--heading);
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
font-family: inherit;
|
|
139
|
+
font-size: $rdp-caption-font-size;
|
|
140
|
+
font-weight: bold;
|
|
141
|
+
margin: 0;
|
|
142
|
+
padding: 0 .25em;
|
|
143
|
+
position: relative;
|
|
144
|
+
white-space: nowrap;
|
|
145
|
+
z-index: 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.rdp-nav {
|
|
149
|
+
white-space: nowrap;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.rdp-multiple_months .rdp-caption_start .rdp-nav {
|
|
153
|
+
left: 0;
|
|
154
|
+
position: absolute;
|
|
155
|
+
top: 50%;
|
|
156
|
+
transform: translateY(-50%);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.rdp-multiple_months .rdp-caption_end .rdp-nav {
|
|
160
|
+
position: absolute;
|
|
161
|
+
right: 0;
|
|
162
|
+
top: 50%;
|
|
163
|
+
transform: translateY(-50%);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.rdp-nav_button {
|
|
167
|
+
align-items: center;
|
|
168
|
+
border-radius: 100%;
|
|
169
|
+
display: inline-flex;
|
|
170
|
+
height: $rdp-cell-size;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
padding: .25em;
|
|
173
|
+
width: $rdp-cell-size;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* ---------- */
|
|
177
|
+
|
|
178
|
+
/* Dropdowns */
|
|
179
|
+
|
|
180
|
+
/* ---------- */
|
|
181
|
+
|
|
182
|
+
.rdp-dropdown_year,
|
|
183
|
+
.rdp-dropdown_month {
|
|
184
|
+
align-items: center;
|
|
185
|
+
display: inline-flex;
|
|
186
|
+
position: relative;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.rdp-dropdown {
|
|
190
|
+
appearance: none;
|
|
191
|
+
background-color: transparent;
|
|
192
|
+
border: none;
|
|
193
|
+
bottom: 0;
|
|
194
|
+
cursor: inherit;
|
|
195
|
+
font-family: inherit;
|
|
196
|
+
font-size: inherit;
|
|
197
|
+
left: 0;
|
|
198
|
+
line-height: inherit;
|
|
199
|
+
margin: 0;
|
|
200
|
+
opacity: 0;
|
|
201
|
+
padding: 0;
|
|
202
|
+
position: absolute;
|
|
203
|
+
top: 0;
|
|
204
|
+
width: 100%;
|
|
205
|
+
z-index: 2;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.rdp-dropdown[disabled] {
|
|
209
|
+
color: unset;
|
|
210
|
+
opacity: unset;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label {
|
|
214
|
+
background-color: $default-background;
|
|
215
|
+
border: $rdp-outline;
|
|
216
|
+
border-radius: 6px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.rdp-dropdown_icon {
|
|
220
|
+
margin: 0 0 0 5px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.rdp-head {
|
|
224
|
+
border: 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.rdp-head_row,
|
|
228
|
+
.rdp-row {
|
|
229
|
+
height: 100%;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.rdp-head_cell {
|
|
233
|
+
font-size: .75em;
|
|
234
|
+
font-weight: 700;
|
|
235
|
+
height: 100%;
|
|
236
|
+
height: $rdp-cell-size;
|
|
237
|
+
padding: 0;
|
|
238
|
+
text-align: center;
|
|
239
|
+
text-transform: uppercase;
|
|
240
|
+
vertical-align: middle;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.rdp-tbody {
|
|
244
|
+
border: 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.rdp-tfoot {
|
|
248
|
+
margin: .5em;
|
|
249
|
+
|
|
250
|
+
.default-footer {
|
|
251
|
+
display: flex;
|
|
252
|
+
flex-direction: column;
|
|
253
|
+
|
|
254
|
+
>.footer-text {
|
|
255
|
+
align-self: center;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
>.time-label {
|
|
259
|
+
align-items: center;
|
|
260
|
+
align-self: first baseline;
|
|
261
|
+
color: var(--heading);
|
|
262
|
+
display: flex;
|
|
263
|
+
margin: 0;
|
|
264
|
+
padding: $default-spacing-size;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
>.time-inputs {
|
|
268
|
+
:not(.multiple) {
|
|
269
|
+
margin-left: $default-spacing-size;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&.multiple {
|
|
273
|
+
align-items: center;
|
|
274
|
+
align-self: center;
|
|
275
|
+
display: flex;
|
|
276
|
+
gap: $default-spacing-size;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
>input[type="time"] {
|
|
280
|
+
background-color: $default-background;
|
|
281
|
+
border: $default-border;
|
|
282
|
+
border-radius: $default-input-border-radius;
|
|
283
|
+
color: var(--paragraph);
|
|
284
|
+
outline: none;
|
|
285
|
+
padding: $default-padding;
|
|
286
|
+
|
|
287
|
+
&::-webkit-calendar-picker-indicator {
|
|
288
|
+
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAyMCAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE5IDEuNUwxMCAxMC41TDEgMS41IiBzdHJva2U9IiM0QzRENTMiIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
|
|
289
|
+
background-position: calc(100% - $default-spacing-size / 2);
|
|
290
|
+
background-repeat: no-repeat;
|
|
291
|
+
background-size: $default-spacing-size;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.rdp-cell {
|
|
299
|
+
height: 100%;
|
|
300
|
+
height: $rdp-cell-size;
|
|
301
|
+
padding: 0;
|
|
302
|
+
text-align: center;
|
|
303
|
+
width: $rdp-cell-size;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.rdp-weeknumber {
|
|
307
|
+
font-size: .75em;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.rdp-weeknumber,
|
|
311
|
+
.rdp-day {
|
|
312
|
+
align-items: center;
|
|
313
|
+
border: 2px solid transparent;
|
|
314
|
+
border-radius: 100%;
|
|
315
|
+
box-sizing: border-box;
|
|
316
|
+
display: flex;
|
|
317
|
+
height: $rdp-cell-size;
|
|
318
|
+
justify-content: center;
|
|
319
|
+
margin: 0;
|
|
320
|
+
max-width: $rdp-cell-size;
|
|
321
|
+
overflow: hidden;
|
|
322
|
+
width: $rdp-cell-size;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.rdp-day_today:not(.rdp-day_outside) {
|
|
326
|
+
font-weight: bold;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.rdp-day_selected,
|
|
330
|
+
.rdp-day_selected:focus-visible,
|
|
331
|
+
.rdp-day_selected:hover {
|
|
332
|
+
background-color: $rdp-accent-color;
|
|
333
|
+
color: $rdp-selected-color;
|
|
334
|
+
opacity: 1;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.rdp-day_outside {
|
|
338
|
+
opacity: .5;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.rdp-day_selected:focus-visible {
|
|
342
|
+
/* Since the background is the same use again the outline */
|
|
343
|
+
outline: $rdp-outline;
|
|
344
|
+
outline-offset: 2px;
|
|
345
|
+
z-index: 1;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.rdp:not([dir="rtl"]) .rdp-day_range_start:not(.rdp-day_range_end) {
|
|
349
|
+
border-bottom-right-radius: 0;
|
|
350
|
+
border-top-right-radius: 0;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.rdp:not([dir="rtl"]) .rdp-day_range_end:not(.rdp-day_range_start) {
|
|
354
|
+
border-bottom-left-radius: 0;
|
|
355
|
+
border-top-left-radius: 0;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.rdp[dir="rtl"] .rdp-day_range_start:not(.rdp-day_range_end) {
|
|
359
|
+
border-bottom-left-radius: 0;
|
|
360
|
+
border-top-left-radius: 0;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.rdp[dir="rtl"] .rdp-day_range_end:not(.rdp-day_range_start) {
|
|
364
|
+
border-bottom-right-radius: 0;
|
|
365
|
+
border-top-right-radius: 0;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.rdp-day_range_end.rdp-day_range_start {
|
|
369
|
+
border-radius: 100%;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.rdp-day_range_middle {
|
|
373
|
+
background-color: var(--interactive);
|
|
374
|
+
border-radius: 0;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.rdp-nav_icon {
|
|
378
|
+
color: var(--ui-icons);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
@@ -27,6 +27,7 @@ const XMLEditor = ({
|
|
|
27
27
|
gutterWidth,
|
|
28
28
|
config,
|
|
29
29
|
onChange,
|
|
30
|
+
onBlur,
|
|
30
31
|
stopPropagationKeys
|
|
31
32
|
}) => {
|
|
32
33
|
const editorRef = useRef();
|
|
@@ -36,6 +37,10 @@ const XMLEditor = ({
|
|
|
36
37
|
extensions: [keymap.of(defaultKeymap), indentOnInput(), lineNumbers(), bracketMatching(), foldGutter(), drawSelection(), highlightActiveLine(), highlightActiveLineGutter(), highlightSpecialChars(), dropCursor(), rectangularSelection(), crosshairCursor(), xml(), theme, EditorState.readOnly.of(readOnly), EditorView.updateListener.of(view => {
|
|
37
38
|
onChange(view);
|
|
38
39
|
// view.state.doc.toString() to receive the current content in the editor.
|
|
40
|
+
}), EditorView.focusChangeEffect.of((state, focused) => {
|
|
41
|
+
if (!focused) {
|
|
42
|
+
onBlur?.(state);
|
|
43
|
+
}
|
|
39
44
|
}), EditorView.domEventHandlers({
|
|
40
45
|
keydown(e) {
|
|
41
46
|
if (stopPropagationKeys?.includes(e.key)) {
|
package/dist/es/a/index.js
CHANGED
|
@@ -24,4 +24,5 @@ export { TextSteps } from "./TextSteps";
|
|
|
24
24
|
export { Removable } from "./Removable";
|
|
25
25
|
export { ToggleSwitch } from "./ToggleSwitch";
|
|
26
26
|
export { XMLEditor } from "./XMLEditor";
|
|
27
|
-
export { LexicalPreview } from "./LexicalPreview";
|
|
27
|
+
export { LexicalPreview } from "./LexicalPreview";
|
|
28
|
+
export { DatePicker } from "./DatePicker";
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { memo } from 'react';
|
|
5
|
-
import { useField } from 'formik';
|
|
6
4
|
import PropTypes from 'prop-types';
|
|
7
5
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
8
|
-
import { LoadingCircle } from "../../../a";
|
|
9
|
-
import { FormLabel, FormDescription } from "../../common";
|
|
10
6
|
import "./styles.scss";
|
|
7
|
+
import { Single, Multiple } from "./common";
|
|
11
8
|
|
|
12
9
|
// Local Definitions
|
|
13
10
|
|
|
@@ -31,49 +28,33 @@ const SelectInput = ({
|
|
|
31
28
|
description,
|
|
32
29
|
disabled,
|
|
33
30
|
isLoading,
|
|
34
|
-
autoComplete
|
|
31
|
+
autoComplete,
|
|
32
|
+
placeholder,
|
|
33
|
+
getTagColor,
|
|
34
|
+
multiple
|
|
35
35
|
// ...otherProps
|
|
36
36
|
}) => {
|
|
37
|
-
const
|
|
37
|
+
const inputProps = {
|
|
38
38
|
name,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
label,
|
|
40
|
+
labelColor,
|
|
41
|
+
color,
|
|
42
|
+
options,
|
|
43
|
+
validate,
|
|
44
|
+
optional,
|
|
45
|
+
description,
|
|
46
|
+
disabled,
|
|
47
|
+
isLoading,
|
|
48
|
+
placeholder,
|
|
49
|
+
getTagColor,
|
|
50
|
+
autoComplete
|
|
51
|
+
};
|
|
52
|
+
const Input = multiple ? Multiple : Single;
|
|
41
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
42
54
|
id: id,
|
|
43
55
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
44
56
|
style: style
|
|
45
|
-
}, /*#__PURE__*/React.createElement(
|
|
46
|
-
name: name,
|
|
47
|
-
color: labelColor,
|
|
48
|
-
optional: optional
|
|
49
|
-
// {...otherProps}
|
|
50
|
-
}, label), /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
className: `select-wrapper${disabled ? ' disabled' : ''}`
|
|
52
|
-
}, /*#__PURE__*/React.createElement("select", _extends({
|
|
53
|
-
className: `input y-${color}`
|
|
54
|
-
}, field, {
|
|
55
|
-
value: field.value || '',
|
|
56
|
-
id: name,
|
|
57
|
-
disabled: disabled,
|
|
58
|
-
autoComplete: autoComplete
|
|
59
|
-
}), options.map(option => {
|
|
60
|
-
// i.e if option is a string like "blah", return { value: "blah", label: "blah" }
|
|
61
|
-
const newOption = typeof option === 'string' ? {
|
|
62
|
-
value: option,
|
|
63
|
-
label: option
|
|
64
|
-
} : option;
|
|
65
|
-
return /*#__PURE__*/React.createElement("option", {
|
|
66
|
-
key: newOption.value,
|
|
67
|
-
value: newOption.value,
|
|
68
|
-
disabled: newOption?.disabled || false
|
|
69
|
-
}, newOption.label);
|
|
70
|
-
})), isLoading && /*#__PURE__*/React.createElement(LoadingCircle, {
|
|
71
|
-
className: "x-main"
|
|
72
|
-
})), /*#__PURE__*/React.createElement(FormDescription, {
|
|
73
|
-
className: "s-1",
|
|
74
|
-
description: description,
|
|
75
|
-
name: name
|
|
76
|
-
}));
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Input, inputProps));
|
|
77
58
|
};
|
|
78
59
|
SelectInput.propTypes = {
|
|
79
60
|
/**
|
|
@@ -135,10 +116,18 @@ SelectInput.propTypes = {
|
|
|
135
116
|
/**
|
|
136
117
|
* Whether the input is optional or not
|
|
137
118
|
*/
|
|
138
|
-
optional: PropTypes.bool
|
|
119
|
+
optional: PropTypes.bool,
|
|
120
|
+
/**
|
|
121
|
+
* Whether the select input should allow multiple selections
|
|
122
|
+
*/
|
|
123
|
+
multiple: PropTypes.bool,
|
|
124
|
+
/**
|
|
125
|
+
* The placeholder of the select input
|
|
126
|
+
*/
|
|
127
|
+
placeholder: PropTypes.string
|
|
139
128
|
};
|
|
140
129
|
SelectInput.defaultProps = {
|
|
141
130
|
disabled: false,
|
|
142
|
-
|
|
131
|
+
multiple: false
|
|
143
132
|
};
|
|
144
133
|
export default /*#__PURE__*/memo(SelectInput);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem/exports';
|
|
6
|
+
|
|
7
|
+
// Local Definitions
|
|
8
|
+
|
|
9
|
+
const baseClassName = styleNames.base;
|
|
10
|
+
const componentClassName = 'menu';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This is the component description.
|
|
14
|
+
*/
|
|
15
|
+
const Menu = /*#__PURE__*/React.forwardRef(({
|
|
16
|
+
id,
|
|
17
|
+
className: userClassName,
|
|
18
|
+
style,
|
|
19
|
+
items,
|
|
20
|
+
isOpen,
|
|
21
|
+
highlightedIndex,
|
|
22
|
+
getItemProps,
|
|
23
|
+
...otherProps
|
|
24
|
+
}, ref) => /*#__PURE__*/React.createElement("ul", _extends({
|
|
25
|
+
id: id,
|
|
26
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
27
|
+
style: style,
|
|
28
|
+
ref: ref
|
|
29
|
+
}, otherProps), isOpen && items.map((item, index) => /*#__PURE__*/React.createElement("li", _extends({
|
|
30
|
+
key: item.label
|
|
31
|
+
}, getItemProps({
|
|
32
|
+
item,
|
|
33
|
+
index
|
|
34
|
+
}), {
|
|
35
|
+
className: ['item', highlightedIndex === index && styleNames.modifierActive].filter(Boolean).join(' ')
|
|
36
|
+
}), /*#__PURE__*/React.createElement("p", null, item.label)))));
|
|
37
|
+
Menu.propTypes = {
|
|
38
|
+
/**
|
|
39
|
+
* The HTML id for this element
|
|
40
|
+
*/
|
|
41
|
+
id: PropTypes.string,
|
|
42
|
+
/**
|
|
43
|
+
* The HTML class names for this element
|
|
44
|
+
*/
|
|
45
|
+
className: PropTypes.string,
|
|
46
|
+
/**
|
|
47
|
+
* The React-written, css properties for this element.
|
|
48
|
+
*/
|
|
49
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
50
|
+
/**
|
|
51
|
+
* The items to be displayed in the menu
|
|
52
|
+
*/
|
|
53
|
+
items: PropTypes.arrayOf(PropTypes.shape({
|
|
54
|
+
value: PropTypes.string,
|
|
55
|
+
label: PropTypes.string
|
|
56
|
+
})),
|
|
57
|
+
/**
|
|
58
|
+
* Whether or not the menu is open
|
|
59
|
+
*/
|
|
60
|
+
isOpen: PropTypes.bool,
|
|
61
|
+
/**
|
|
62
|
+
* The index of the highlighted item
|
|
63
|
+
*/
|
|
64
|
+
highlightedIndex: PropTypes.number,
|
|
65
|
+
/**
|
|
66
|
+
* The function to get the item props
|
|
67
|
+
*/
|
|
68
|
+
getItemProps: PropTypes.func
|
|
69
|
+
};
|
|
70
|
+
Menu.defaultProps = {
|
|
71
|
+
// someProp:false
|
|
72
|
+
};
|
|
73
|
+
export default Menu;
|