superdesk-ui-framework 5.1.5 → 5.2.0
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/.github/workflows/publish-to-npm.yml +10 -3
- package/app/styles/_helpers.scss +18 -62
- package/app/styles/_simple-list.scss +10 -4
- package/app/styles/form-elements/_forms-general.scss +146 -2
- package/app-typescript/components/Form/FormGroupItem.tsx +37 -0
- package/app-typescript/components/Form/FormGroupV2.tsx +40 -0
- package/app-typescript/components/Form/FormLayout.tsx +57 -0
- package/app-typescript/components/Form/index.tsx +3 -0
- package/app-typescript/components/TreeMenu.tsx +84 -86
- package/app-typescript/components/TreeSelect/TreeSelect.tsx +118 -141
- package/dist/components/FormLayout.tsx +1039 -0
- package/dist/components/Index.tsx +5 -0
- package/dist/examples.bundle.css +1 -1
- package/dist/examples.bundle.js +2957 -2272
- package/dist/superdesk-ui.bundle.css +127 -53
- package/dist/superdesk-ui.bundle.js +1935 -1761
- package/dist/vendor.bundle.js +13 -13
- package/package.json +1 -1
- package/react/components/Form/FormGroupItem.d.ts +18 -0
- package/react/components/Form/FormGroupItem.js +52 -0
- package/react/components/Form/FormGroupV2.d.ts +16 -0
- package/react/components/Form/FormGroupV2.js +53 -0
- package/react/components/Form/FormLayout.d.ts +26 -0
- package/react/components/Form/FormLayout.js +57 -0
- package/react/components/Form/index.d.ts +3 -0
- package/react/components/Form/index.js +7 -1
- package/react/components/TreeMenu.js +2 -2
- package/react/components/TreeSelect/TreeSelect.d.ts +0 -1
- package/react/components/TreeSelect/TreeSelect.js +3 -20
|
@@ -26,16 +26,23 @@ jobs:
|
|
|
26
26
|
- run: npm run build
|
|
27
27
|
- uses: JS-DevTools/npm-publish@v3
|
|
28
28
|
id: publish
|
|
29
|
+
continue-on-error: true
|
|
29
30
|
with:
|
|
30
31
|
token: ${{ secrets.NPM_TOKEN }}
|
|
31
32
|
|
|
33
|
+
- name: Check publish result
|
|
34
|
+
if: steps.publish.outcome == 'failure'
|
|
35
|
+
run: |
|
|
36
|
+
echo "::notice::Package was not published. Version may already exist on npm."
|
|
37
|
+
exit 0
|
|
38
|
+
|
|
32
39
|
- name: Get package version
|
|
33
|
-
if: steps.publish.outputs.type != 'none'
|
|
40
|
+
if: steps.publish.outputs.type != 'none' && steps.publish.outcome == 'success'
|
|
34
41
|
id: package-version
|
|
35
42
|
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
|
36
43
|
|
|
37
44
|
- name: Create Git tag
|
|
38
|
-
if: steps.publish.outputs.type != 'none'
|
|
45
|
+
if: steps.publish.outputs.type != 'none' && steps.publish.outcome == 'success'
|
|
39
46
|
run: |
|
|
40
47
|
git config user.name "github-actions[bot]"
|
|
41
48
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
@@ -43,7 +50,7 @@ jobs:
|
|
|
43
50
|
git push origin "v${{ steps.package-version.outputs.version }}"
|
|
44
51
|
|
|
45
52
|
- name: Create GitHub Release
|
|
46
|
-
if: steps.publish.outputs.type != 'none'
|
|
53
|
+
if: steps.publish.outputs.type != 'none' && steps.publish.outcome == 'success'
|
|
47
54
|
uses: softprops/action-gh-release@v1
|
|
48
55
|
with:
|
|
49
56
|
tag_name: v${{ steps.package-version.outputs.version }}
|
package/app/styles/_helpers.scss
CHANGED
|
@@ -346,7 +346,7 @@ h6 {
|
|
|
346
346
|
white-space: nowrap;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
// FONT FAMILY
|
|
349
|
+
// FONT FAMILY (DEPRECATED)
|
|
350
350
|
.sd-text__serif,
|
|
351
351
|
.sd-text--serif {
|
|
352
352
|
font-family: $baseFontFamilySerif;
|
|
@@ -358,6 +358,23 @@ h6 {
|
|
|
358
358
|
font-family: $baseFontFamilyMono;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
// FONT FAMILY VARIABLES -------------------------------------------------------------------------
|
|
362
|
+
// Use these utility classes to change the font family of the text. Useful for overriding the font family of the text.
|
|
363
|
+
.font-primary {
|
|
364
|
+
font-family: var(--font-primary);
|
|
365
|
+
}
|
|
366
|
+
.font-secondary {
|
|
367
|
+
font-family: var(--font-secondary);
|
|
368
|
+
}
|
|
369
|
+
.font-mono {
|
|
370
|
+
font-family: var(--font-mono);
|
|
371
|
+
}
|
|
372
|
+
.font-alt {
|
|
373
|
+
font-family: var(--font-alt);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
361
378
|
// WHITESPACE
|
|
362
379
|
.sd-whitespace--normal,
|
|
363
380
|
.whitespace-normal {
|
|
@@ -2195,65 +2212,4 @@ h6 {
|
|
|
2195
2212
|
container-type: inline-size;
|
|
2196
2213
|
container-name: left-panel;
|
|
2197
2214
|
}
|
|
2198
|
-
@container left-panel (width <= 900px) {
|
|
2199
|
-
.new-form-layout {
|
|
2200
|
-
--form-group-gap: var(--gap-3);
|
|
2201
|
-
--form-padding: var(--space--3);
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
@container left-panel (width<= 500px) {
|
|
2205
|
-
.new-form-layout {
|
|
2206
|
-
--form-group-gap: var(--gap-1-5);
|
|
2207
|
-
--form-padding: var(--space--2);
|
|
2208
|
-
--form-layout-gap: var(--gap-2);
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
// ------------------------------------------------------------------------
|
|
2212
|
-
|
|
2213
|
-
.new-form-layout {
|
|
2214
|
-
--form-group-gap: var(--gap-5);
|
|
2215
|
-
--form-layout-gap: var(--gap-4);
|
|
2216
|
-
--form-padding: var(--space--5);
|
|
2217
|
-
--form-heading-font-size: clamp(1.8rem, 4cqi, 2.4rem);
|
|
2218
|
-
padding: var(--form-padding);
|
|
2219
|
-
display: flex;
|
|
2220
|
-
flex-direction: column;
|
|
2221
|
-
gap: var(--form-layout-gap);
|
|
2222
|
-
background-color: var(--color-surface-base);
|
|
2223
|
-
border-radius: var(--b-radius--large);
|
|
2224
|
-
border: 1px solid var(--color-line-light);
|
|
2225
|
-
.new-form-heading {
|
|
2226
|
-
font-family: $baseFontFamilySerif;
|
|
2227
|
-
font-weight: 900;
|
|
2228
|
-
font-size: var(--form-heading-font-size);
|
|
2229
|
-
line-height: 1.2;
|
|
2230
|
-
}
|
|
2231
|
-
legend {
|
|
2232
|
-
float: left;
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
.new-form-group {
|
|
2236
|
-
display: flex;
|
|
2237
|
-
gap: var(--form-group-gap);
|
|
2238
|
-
&.new-form-group--grid {
|
|
2239
|
-
display: grid;
|
|
2240
|
-
grid-template-columns: repeat(4, 1fr);
|
|
2241
|
-
gap: var(--form-group-gap);
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
.new-form-group-item {
|
|
2245
|
-
display: flex;
|
|
2246
|
-
flex-direction: column;
|
|
2247
|
-
flex-grow: 1;
|
|
2248
|
-
&.new-form-group-item--span-2 {
|
|
2249
|
-
grid-column: span 2;
|
|
2250
|
-
}
|
|
2251
|
-
&.new-form-group-item--span-3 {
|
|
2252
|
-
grid-column: span 3;
|
|
2253
|
-
}
|
|
2254
|
-
&.new-form-group-item--span-4 {
|
|
2255
|
-
grid-column: span 4;
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
|
|
2259
2215
|
|
|
@@ -8,7 +8,7 @@ $simple-list-border-color: $neutral-border-color;
|
|
|
8
8
|
align-self: stretch;
|
|
9
9
|
|
|
10
10
|
.simple-list__item {
|
|
11
|
-
padding:
|
|
11
|
+
padding: var(--space--1) 0;
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-direction: row;
|
|
14
14
|
align-items: center;
|
|
@@ -87,7 +87,7 @@ $simple-list-border-color: $neutral-border-color;
|
|
|
87
87
|
|
|
88
88
|
.simple-list--dotted {
|
|
89
89
|
.simple-list__item {
|
|
90
|
-
padding:
|
|
90
|
+
padding: var(--space--1) 0;
|
|
91
91
|
border-block-end: 1px dotted $simple-list-border-color;
|
|
92
92
|
|
|
93
93
|
&:first-child {
|
|
@@ -111,19 +111,25 @@ $simple-list-border-color: $neutral-border-color;
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
|
|
115
114
|
.simple-list--comfortable {
|
|
116
115
|
.simple-list__item {
|
|
117
116
|
padding: 1.2rem 0;
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
|
|
120
|
+
.simple-list--comfortable {
|
|
121
|
+
.simple-list__item {
|
|
122
|
+
padding: var(--space--1-5) 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
121
126
|
.simple-list--loose {
|
|
122
127
|
.simple-list__item {
|
|
123
|
-
padding: 2
|
|
128
|
+
padding: var(--space--2) 0;
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
|
|
132
|
+
|
|
127
133
|
.simple-list--no-padding {
|
|
128
134
|
padding: 0 0 2rem 0;
|
|
129
135
|
}
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
|
|
300
300
|
|
|
301
301
|
|
|
302
|
-
/// ----------------------------
|
|
302
|
+
/// ---------------------------- FORM LAYOUT (Do not use anymore) --------------------------- ///
|
|
303
303
|
|
|
304
304
|
.form__group-new {
|
|
305
305
|
display: flex;
|
|
@@ -388,8 +388,152 @@
|
|
|
388
388
|
margin-block-end: $sd-base-increment * 1.5;
|
|
389
389
|
line-height: 1;
|
|
390
390
|
color: var(--color-label-text);
|
|
391
|
-
//text-transform: uppercase;
|
|
392
391
|
font-weight: 500;
|
|
393
392
|
letter-spacing: 0.02em;
|
|
394
393
|
}
|
|
395
394
|
}
|
|
395
|
+
/// -------------------------- FORM LAYOUT (Do not use anymore) END ------------------------ ///
|
|
396
|
+
/// ----------------------------------------------------------------------------------------- ///
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
/// ---------------------------- NEW FORM LAYOUT !!! USE THIS ONE INSTEAD OF THE OLD ONE ---------------------------- ///
|
|
400
|
+
|
|
401
|
+
.form-layout {
|
|
402
|
+
container-type: inline-size;
|
|
403
|
+
container-name: form-container;
|
|
404
|
+
--form-layout-row-gap: var(--gap-4);
|
|
405
|
+
--form-padding: 0;
|
|
406
|
+
--form-heading-font-size: clamp(1.8rem, 4cqi, 2.1rem);
|
|
407
|
+
--form-heading-margin: 0;
|
|
408
|
+
padding: var(--form-padding);
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-direction: column;
|
|
411
|
+
row-gap: var(--form-layout-row-gap);
|
|
412
|
+
width: 100%;
|
|
413
|
+
.form-heading-new {
|
|
414
|
+
font-family: $baseFontFamilySerif;
|
|
415
|
+
font-weight: 900;
|
|
416
|
+
font-size: var(--form-heading-font-size);
|
|
417
|
+
line-height: 1.1;
|
|
418
|
+
margin-block-end: var(--form-heading-margin);
|
|
419
|
+
}
|
|
420
|
+
legend {
|
|
421
|
+
float: left;
|
|
422
|
+
}
|
|
423
|
+
&.form-layout--compact {
|
|
424
|
+
--form-layout-row-gap: var(--gap-2);
|
|
425
|
+
}
|
|
426
|
+
&.form-layout--standard {
|
|
427
|
+
--form-layout-row-gap: var(--gap-4);
|
|
428
|
+
}
|
|
429
|
+
&.form-layout--relaxed {
|
|
430
|
+
--form-layout-row-gap: var(--gap-5);
|
|
431
|
+
}
|
|
432
|
+
&.form-layout--preserve-spaces {
|
|
433
|
+
--form-layout-row-gap: var(--gap-1-5);
|
|
434
|
+
--form-heading-margin: var(--space--2);
|
|
435
|
+
.sd-input .sd-input__message-box {
|
|
436
|
+
min-height: var(--space--3);
|
|
437
|
+
}
|
|
438
|
+
&.form-layout--compact {
|
|
439
|
+
--form-layout-row-gap: var(--gap-0-5);
|
|
440
|
+
--form-heading-margin: var(--space--2);
|
|
441
|
+
}
|
|
442
|
+
&.form-layout--standard {
|
|
443
|
+
--form-layout-row-gap: var(--gap-1-5);
|
|
444
|
+
--form-heading-margin: var(--space--2);
|
|
445
|
+
}
|
|
446
|
+
&.form-layout--relaxed {
|
|
447
|
+
--form-layout-row-gap: var(--gap-2);
|
|
448
|
+
--form-heading-margin: var(--space--1);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
&.form-layout--mb-none {
|
|
452
|
+
margin-block-end: 0;
|
|
453
|
+
}
|
|
454
|
+
&.form-layout--mb-spaces {
|
|
455
|
+
margin-block-end: var(--form-layout-row-gap);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.form-group {
|
|
460
|
+
--form-group-col-gap: var(--gap-5);
|
|
461
|
+
display: flex;
|
|
462
|
+
row-gap: var(--form-layout-row-gap);
|
|
463
|
+
column-gap: var(--form-group-col-gap);
|
|
464
|
+
&.form-group--grid {
|
|
465
|
+
display: grid;
|
|
466
|
+
grid-template-columns: repeat(4, 1fr);
|
|
467
|
+
}
|
|
468
|
+
.form-group__text-block {
|
|
469
|
+
min-height: var(--form-element-height-default);
|
|
470
|
+
color: inherit;
|
|
471
|
+
font-size: 1.3rem;
|
|
472
|
+
display: inline-flex;
|
|
473
|
+
align-items: center;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.form-group__wrapper {
|
|
478
|
+
display: flex;
|
|
479
|
+
flex-direction: column;
|
|
480
|
+
width: 100%;
|
|
481
|
+
row-gap: var(--form-layout-row-gap);
|
|
482
|
+
.form-group__label {
|
|
483
|
+
font-size: 1.6rem;
|
|
484
|
+
font-weight: 500;
|
|
485
|
+
color: var(--color-text);
|
|
486
|
+
line-height: 1;
|
|
487
|
+
margin-block-end: var(--space--0-5);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.form-group-item {
|
|
492
|
+
display: flex;
|
|
493
|
+
flex-direction: column;
|
|
494
|
+
flex-grow: 1;
|
|
495
|
+
min-height: var(--form-element-height-default);
|
|
496
|
+
&.form-group-item--span-2 {
|
|
497
|
+
grid-column: span 2;
|
|
498
|
+
}
|
|
499
|
+
&.form-group-item--span-3 {
|
|
500
|
+
grid-column: span 3;
|
|
501
|
+
}
|
|
502
|
+
&.form-group-item--span-4 {
|
|
503
|
+
grid-column: span 4;
|
|
504
|
+
}
|
|
505
|
+
&.form-group-item--auto-width {
|
|
506
|
+
flex-grow: 0;
|
|
507
|
+
min-width: 0;
|
|
508
|
+
flex-basis: auto;
|
|
509
|
+
}
|
|
510
|
+
> *:not(.sd-input):not(.form-group-item__inner):not(.sd-check__group-new) {
|
|
511
|
+
margin-block-start: 1.6rem;
|
|
512
|
+
}
|
|
513
|
+
.form-group-item__inner {
|
|
514
|
+
display: flex;
|
|
515
|
+
gap: var(--space--1);
|
|
516
|
+
align-items: flex-start;
|
|
517
|
+
> *:not(.sd-input) {
|
|
518
|
+
margin-block-start: 1.6rem;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.form-group-item--auto-width {
|
|
524
|
+
flex-grow: 0;
|
|
525
|
+
min-width: 0;
|
|
526
|
+
flex-basis: auto;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
@container form-container (width <= 900px) {
|
|
530
|
+
.form-group {
|
|
531
|
+
--form-group-col-gap: var(--gap-3);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
@container form-container (width<= 500px) {
|
|
536
|
+
.form-group {
|
|
537
|
+
--form-group-col-gap: var(--gap-1-5);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
interface IProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Defaults to `false`. Only works with `flex` based FormGroupV2.
|
|
9
|
+
*/
|
|
10
|
+
autoWidth?: boolean;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Defaults to `4` (full width). Only works with `grid` based FormGroupV2.
|
|
14
|
+
*/
|
|
15
|
+
colSpan?: 1 | 2 | 3 | 4;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Additional CSS class names to apply to the form group item.
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const FormGroupItem: React.FC<IProps> = React.memo(({children, autoWidth, colSpan, className}) => {
|
|
24
|
+
const classes = classNames(
|
|
25
|
+
'form-group-item',
|
|
26
|
+
{
|
|
27
|
+
'form-group-item--auto-width': autoWidth,
|
|
28
|
+
'form-group-item--span-1': colSpan === 1,
|
|
29
|
+
'form-group-item--span-2': colSpan === 2,
|
|
30
|
+
'form-group-item--span-3': colSpan === 3,
|
|
31
|
+
'form-group-item--span-4': colSpan === 4 || !colSpan,
|
|
32
|
+
},
|
|
33
|
+
className,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return <div className={classes}>{children}</div>;
|
|
37
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
interface IProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Defaults to `false`.
|
|
9
|
+
*/
|
|
10
|
+
inlineLabels?: boolean;
|
|
11
|
+
|
|
12
|
+
rowLabel?: string;
|
|
13
|
+
grid?: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Additional CSS class names to apply to the form group.
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const FormGroupV2: React.FC<IProps> = React.memo(({children, rowLabel, grid, className}) => {
|
|
22
|
+
const classes = classNames(
|
|
23
|
+
'form-group',
|
|
24
|
+
{
|
|
25
|
+
'form-group--grid': grid,
|
|
26
|
+
},
|
|
27
|
+
className,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (rowLabel) {
|
|
31
|
+
return (
|
|
32
|
+
<div className="form-group__wrapper">
|
|
33
|
+
<label className="form-group__label">{rowLabel}</label>
|
|
34
|
+
<div className={classes}>{children}</div>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return <div className={classes}>{children}</div>;
|
|
40
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
interface IProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Spacing between form elements. Defaults to `standard`.
|
|
9
|
+
*/
|
|
10
|
+
spaces?: 'compact' | 'standard' | 'relaxed';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Bottom margin for the form layout. `spaces` adds a bottom margin equal to the row gap. Defaults to `none`.
|
|
14
|
+
*/
|
|
15
|
+
marginBottom?: 'none' | 'spaces';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Optional legend for the form layout/fieldset. Can be used to group items together.
|
|
19
|
+
*/
|
|
20
|
+
legend?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Additional CSS class names to apply to the form layout.
|
|
24
|
+
*/
|
|
25
|
+
className?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reserve space for info text on input fields regardless of whether they are present.
|
|
29
|
+
*/
|
|
30
|
+
preserveSpaces?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const FormLayout: React.FC<IProps> = React.memo(
|
|
34
|
+
({children, spaces = 'standard', marginBottom = 'none', legend, className, preserveSpaces}) => {
|
|
35
|
+
const hasLabel = legend && legend.trim() !== '';
|
|
36
|
+
const classes = classNames(
|
|
37
|
+
'form-layout',
|
|
38
|
+
{
|
|
39
|
+
[`form-layout--${spaces}`]: spaces,
|
|
40
|
+
[`form-layout--mb-${marginBottom}`]: marginBottom,
|
|
41
|
+
'form-layout--preserve-spaces': preserveSpaces,
|
|
42
|
+
},
|
|
43
|
+
className,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (hasLabel) {
|
|
47
|
+
return (
|
|
48
|
+
<fieldset className={classes}>
|
|
49
|
+
<legend className="form-heading-new">{legend}</legend>
|
|
50
|
+
{children}
|
|
51
|
+
</fieldset>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return <div className={classes}>{children}</div>;
|
|
56
|
+
},
|
|
57
|
+
);
|
|
@@ -7,3 +7,6 @@ export {InputWrapper} from './InputWrapper';
|
|
|
7
7
|
export {InputBase} from './InputBase';
|
|
8
8
|
export {InputNew} from './InputNew';
|
|
9
9
|
export {FormRowNew} from './FormRowNew';
|
|
10
|
+
export {FormLayout} from './FormLayout';
|
|
11
|
+
export {FormGroupV2} from './FormGroupV2';
|
|
12
|
+
export {FormGroupItem} from './FormGroupItem';
|
|
@@ -374,104 +374,102 @@ export class TreeMenu<T> extends React.Component<IProps<T>, IState<T>> {
|
|
|
374
374
|
<div ref={this.treeMenuRef}>
|
|
375
375
|
<div ref={this.openDropdownRef}>{this.props.children(this.toggle)}</div>
|
|
376
376
|
|
|
377
|
-
{this.state.openDropdown
|
|
378
|
-
<
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
>
|
|
386
|
-
<div
|
|
377
|
+
<WithPortal active={this.state.openDropdown} data-test-id="tree-menu-popover">
|
|
378
|
+
<div
|
|
379
|
+
ref={this.dropdownRef}
|
|
380
|
+
className="autocomplete autocomplete--multi-select autocomplete--fixed-width"
|
|
381
|
+
style={{
|
|
382
|
+
zIndex: this.zIndex,
|
|
383
|
+
}}
|
|
384
|
+
>
|
|
385
|
+
<div className="autocomplete__header">
|
|
386
|
+
<div
|
|
387
|
+
className="autocomplete__icon"
|
|
388
|
+
onClick={() => {
|
|
389
|
+
this.backButton();
|
|
390
|
+
}}
|
|
391
|
+
>
|
|
392
|
+
<Icon name="search" className="search"></Icon>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
<div className="autocomplete__filter">
|
|
396
|
+
<input
|
|
397
|
+
className="autocomplete__input"
|
|
398
|
+
type="text"
|
|
399
|
+
placeholder={this.props.searchPlaceholder}
|
|
400
|
+
ref={this.inputRef}
|
|
401
|
+
value={this.state.searchFieldValue}
|
|
402
|
+
onChange={(event) => {
|
|
403
|
+
this.setState({searchFieldValue: event.target.value});
|
|
404
|
+
this.popperInstance?.update();
|
|
405
|
+
}}
|
|
406
|
+
/>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
{this.state.activeTree.length > 0 && this.state.buttonValue != null && (
|
|
411
|
+
<div className="autocomplete__category-header">
|
|
387
412
|
<div
|
|
388
413
|
className="autocomplete__icon"
|
|
389
414
|
onClick={() => {
|
|
390
415
|
this.backButton();
|
|
391
416
|
}}
|
|
392
417
|
>
|
|
393
|
-
<Icon name="
|
|
418
|
+
<Icon name="arrow-left" className="arrow-left"></Icon>
|
|
394
419
|
</div>
|
|
395
420
|
|
|
396
421
|
<div className="autocomplete__filter">
|
|
397
|
-
<
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
value={this.state.searchFieldValue}
|
|
403
|
-
onChange={(event) => {
|
|
404
|
-
this.setState({searchFieldValue: event.target.value});
|
|
405
|
-
this.popperInstance?.update();
|
|
406
|
-
}}
|
|
407
|
-
/>
|
|
422
|
+
<button className="autocomplete__category-title">
|
|
423
|
+
{this.props.optionTemplate
|
|
424
|
+
? this.props.optionTemplate(this.state.buttonValue.value)
|
|
425
|
+
: this.props.getLabel(this.state.buttonValue.value)}
|
|
426
|
+
</button>
|
|
408
427
|
</div>
|
|
409
428
|
</div>
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
{
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
handleTree={this.handleTree}
|
|
444
|
-
onClick={() => {
|
|
445
|
-
onSelect(option);
|
|
446
|
-
}}
|
|
447
|
-
disabledItem={disabledItem(option)}
|
|
448
|
-
getBorderColor={this.props.getBorderColor}
|
|
449
|
-
getBackgroundColor={this.props.getBackgroundColor}
|
|
450
|
-
getId={this.props.getId}
|
|
451
|
-
optionTemplate={this.props.optionTemplate}
|
|
452
|
-
getLabel={this.props.getLabel}
|
|
453
|
-
onKeyDown={() =>
|
|
454
|
-
this.setState({
|
|
455
|
-
buttonTarget: [
|
|
456
|
-
...this.state.buttonTarget,
|
|
457
|
-
this.props.getId(option.value),
|
|
458
|
-
],
|
|
459
|
-
})
|
|
460
|
-
}
|
|
461
|
-
/>
|
|
462
|
-
))}
|
|
463
|
-
</ul>
|
|
464
|
-
) : null
|
|
465
|
-
) : (
|
|
466
|
-
<ul className="suggestion-list suggestion-list--multi-select" ref={this.ref}>
|
|
467
|
-
{this.filteredItem(
|
|
468
|
-
this.props.singleLevelSearch ? this.state.options : this.state.filterArr,
|
|
469
|
-
)}
|
|
429
|
+
)}
|
|
430
|
+
|
|
431
|
+
{this.state.searchFieldValue === '' ? (
|
|
432
|
+
this.props.getOptions ? (
|
|
433
|
+
<ul
|
|
434
|
+
ref={this.ref}
|
|
435
|
+
className="suggestion-list suggestion-list--multi-select"
|
|
436
|
+
role="tree"
|
|
437
|
+
>
|
|
438
|
+
{this.state.options.map((option, i: React.Key | undefined) => (
|
|
439
|
+
<TreeSelectItem
|
|
440
|
+
key={i}
|
|
441
|
+
option={option}
|
|
442
|
+
handleTree={this.handleTree}
|
|
443
|
+
onClick={() => {
|
|
444
|
+
onSelect(option);
|
|
445
|
+
}}
|
|
446
|
+
disabledItem={disabledItem(option)}
|
|
447
|
+
getBorderColor={this.props.getBorderColor}
|
|
448
|
+
getBackgroundColor={this.props.getBackgroundColor}
|
|
449
|
+
getId={this.props.getId}
|
|
450
|
+
optionTemplate={this.props.optionTemplate}
|
|
451
|
+
getLabel={this.props.getLabel}
|
|
452
|
+
onKeyDown={() =>
|
|
453
|
+
this.setState({
|
|
454
|
+
buttonTarget: [
|
|
455
|
+
...this.state.buttonTarget,
|
|
456
|
+
this.props.getId(option.value),
|
|
457
|
+
],
|
|
458
|
+
})
|
|
459
|
+
}
|
|
460
|
+
/>
|
|
461
|
+
))}
|
|
470
462
|
</ul>
|
|
471
|
-
)
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
463
|
+
) : null
|
|
464
|
+
) : (
|
|
465
|
+
<ul className="suggestion-list suggestion-list--multi-select" ref={this.ref}>
|
|
466
|
+
{this.filteredItem(
|
|
467
|
+
this.props.singleLevelSearch ? this.state.options : this.state.filterArr,
|
|
468
|
+
)}
|
|
469
|
+
</ul>
|
|
470
|
+
)}
|
|
471
|
+
</div>
|
|
472
|
+
</WithPortal>
|
|
475
473
|
</div>
|
|
476
474
|
);
|
|
477
475
|
}
|