superdesk-ui-framework 5.1.2 → 5.1.3
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/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/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 +2952 -2250
- package/dist/superdesk-ui.bundle.css +127 -53
- package/dist/superdesk-ui.bundle.js +1930 -1739
- 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/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';
|