grommet 2.29.1 → 2.31.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/components/Anchor/Anchor.js +12 -5
- package/components/Anchor/StyledAnchor.js +6 -3
- package/components/Button/Badge.js +42 -43
- package/components/Button/Button.js +21 -14
- package/components/Button/StyledButton.js +4 -2
- package/components/Button/StyledButtonKind.js +25 -9
- package/components/Button/index.d.ts +2 -0
- package/components/Button/propTypes.js +1 -0
- package/components/Calendar/Calendar.js +14 -6
- package/components/CheckBox/index.d.ts +1 -1
- package/components/Data/DataForm.js +97 -26
- package/components/Data/stories/Cards.js +1 -1
- package/components/Data/stories/Complex.js +84 -0
- package/components/Data/stories/Controlled.js +1 -1
- package/components/Data/stories/DataTable.js +11 -4
- package/components/Data/stories/Infinite.js +1 -1
- package/components/Data/stories/Inline.js +7 -2
- package/components/Data/stories/List.js +1 -1
- package/components/Data/stories/Simple.js +1 -1
- package/components/Data/stories/SpaceX.js +1 -1
- package/components/Data/stories/StarWars.js +18 -24
- package/components/Data/stories/Views.js +1 -1
- package/components/DataFilter/DataFilter.js +32 -42
- package/components/DataFilter/stories/Simple.js +7 -4
- package/components/DataFilters/DataFilters.js +76 -32
- package/components/DataFilters/index.d.ts +1 -0
- package/components/DataFilters/propTypes.js +2 -1
- package/components/DataFilters/stories/Drop.js +7 -4
- package/components/DataFilters/stories/Inline.js +24 -6
- package/components/DataFilters/stories/Layer.js +46 -0
- package/components/DataFilters/stories/Simple.js +7 -4
- package/components/DataSearch/DataSearch.js +57 -9
- package/components/DataSearch/index.d.ts +10 -1
- package/components/DataSearch/propTypes.js +6 -1
- package/components/DataSearch/stories/Drop.js +42 -0
- package/components/DataSearch/stories/Responsive.js +42 -0
- package/components/DataSearch/stories/Simple.js +5 -2
- package/components/DataSort/DataSort.js +61 -12
- package/components/DataSort/index.d.ts +4 -8
- package/components/DataSort/propTypes.js +9 -2
- package/components/DataSort/stories/Drop.js +41 -0
- package/components/DataSort/stories/Simple.js +9 -5
- package/components/DataSummary/stories/Simple.js +7 -4
- package/components/DataTable/GroupedBody.js +1 -0
- package/components/DataTable/StyledDataTable.js +2 -2
- package/components/DataTableColumns/DataTableColumns.js +2 -1
- package/components/DataTableColumns/stories/Simple.js +9 -5
- package/components/DataView/DataView.js +22 -7
- package/components/DataView/stories/Simple.js +8 -5
- package/components/DateInput/DateInput.js +2 -1
- package/components/Distribution/Distribution.js +1 -1
- package/components/Drop/DropContainer.js +32 -79
- package/components/Drop/stories/Overflow.js +1 -0
- package/components/DropButton/DropButton.js +1 -1
- package/components/Form/stories/Controlled.js +11 -2
- package/components/Form/stories/ControlledInput.js +13 -2
- package/components/Form/stories/ControlledInputLazy.js +13 -2
- package/components/Form/stories/ControlledLazy.js +13 -2
- package/components/Form/stories/FieldWithChildren.js +13 -2
- package/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/components/Form/stories/Uncontrolled.js +15 -2
- package/components/Form/stories/ValidateOnChange.js +6 -0
- package/components/Form/stories/ValidateOnMount.js +4 -0
- package/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/components/Layer/LayerContainer.js +1 -1
- package/components/Layer/StyledLayer.js +3 -1
- package/components/MaskedInput/MaskedInput.js +3 -2
- package/components/MaskedInput/StyledMaskedInput.js +2 -1
- package/components/Notification/Notification.js +7 -3
- package/components/PageHeader/PageHeader.js +6 -4
- package/components/Pagination/Pagination.js +8 -0
- package/components/Pagination/StyledPageControl.js +3 -1
- package/components/Paragraph/Paragraph.js +18 -6
- package/components/Paragraph/stories/All.js +5 -1
- package/components/SelectMultiple/SelectMultiple.js +11 -10
- package/components/SelectMultiple/SelectMultipleContainer.js +16 -13
- package/components/SelectMultiple/stories/Help.js +49 -0
- package/components/Tabs/Tabs.js +2 -1
- package/components/Text/Text.js +9 -1
- package/components/Text/TextContext.js +8 -0
- package/components/TextInput/StyledTextInput.js +5 -2
- package/components/TextInput/TextInput.js +7 -4
- package/components/TextInput/index.d.ts +3 -1
- package/components/TextInput/propTypes.js +3 -1
- package/components/Toolbar/stories/Simple.js +1 -1
- package/components/WorldMap/WorldMap.js +17 -14
- package/es6/components/Anchor/Anchor.js +13 -6
- package/es6/components/Anchor/StyledAnchor.js +6 -3
- package/es6/components/Button/Badge.js +43 -44
- package/es6/components/Button/Button.js +22 -15
- package/es6/components/Button/StyledButton.js +5 -3
- package/es6/components/Button/StyledButtonKind.js +26 -10
- package/es6/components/Button/index.d.ts +2 -0
- package/es6/components/Button/propTypes.js +2 -1
- package/es6/components/Calendar/Calendar.js +14 -6
- package/es6/components/CheckBox/index.d.ts +1 -1
- package/es6/components/Data/DataForm.js +97 -26
- package/es6/components/Data/stories/Cards.js +1 -1
- package/es6/components/Data/stories/Complex.js +78 -0
- package/es6/components/Data/stories/Controlled.js +1 -1
- package/es6/components/Data/stories/DataTable.js +12 -5
- package/es6/components/Data/stories/Infinite.js +1 -1
- package/es6/components/Data/stories/Inline.js +7 -2
- package/es6/components/Data/stories/List.js +1 -1
- package/es6/components/Data/stories/Simple.js +1 -1
- package/es6/components/Data/stories/SpaceX.js +1 -1
- package/es6/components/Data/stories/StarWars.js +18 -24
- package/es6/components/Data/stories/Views.js +1 -1
- package/es6/components/DataFilter/DataFilter.js +32 -42
- package/es6/components/DataFilter/stories/Simple.js +8 -5
- package/es6/components/DataFilters/DataFilters.js +76 -32
- package/es6/components/DataFilters/index.d.ts +1 -0
- package/es6/components/DataFilters/propTypes.js +2 -1
- package/es6/components/DataFilters/stories/Drop.js +8 -5
- package/es6/components/DataFilters/stories/Inline.js +25 -7
- package/es6/components/DataFilters/stories/Layer.js +40 -0
- package/es6/components/DataFilters/stories/Simple.js +8 -5
- package/es6/components/DataSearch/DataSearch.js +58 -10
- package/es6/components/DataSearch/index.d.ts +10 -1
- package/es6/components/DataSearch/propTypes.js +5 -1
- package/es6/components/DataSearch/stories/Drop.js +36 -0
- package/es6/components/DataSearch/stories/Responsive.js +36 -0
- package/es6/components/DataSearch/stories/Simple.js +6 -3
- package/es6/components/DataSort/DataSort.js +62 -13
- package/es6/components/DataSort/index.d.ts +4 -8
- package/es6/components/DataSort/propTypes.js +8 -2
- package/es6/components/DataSort/stories/Drop.js +35 -0
- package/es6/components/DataSort/stories/Simple.js +10 -6
- package/es6/components/DataSummary/stories/Simple.js +8 -5
- package/es6/components/DataTable/GroupedBody.js +1 -0
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DataTableColumns/DataTableColumns.js +2 -1
- package/es6/components/DataTableColumns/stories/Simple.js +10 -6
- package/es6/components/DataView/DataView.js +22 -7
- package/es6/components/DataView/stories/Simple.js +9 -6
- package/es6/components/DateInput/DateInput.js +2 -1
- package/es6/components/Distribution/Distribution.js +1 -1
- package/es6/components/Drop/DropContainer.js +34 -81
- package/es6/components/Drop/stories/Overflow.js +1 -0
- package/es6/components/DropButton/DropButton.js +1 -1
- package/es6/components/Form/stories/Controlled.js +11 -2
- package/es6/components/Form/stories/ControlledInput.js +13 -2
- package/es6/components/Form/stories/ControlledInputLazy.js +13 -2
- package/es6/components/Form/stories/ControlledLazy.js +13 -2
- package/es6/components/Form/stories/FieldWithChildren.js +13 -2
- package/es6/components/Form/stories/FieldWithComponentProp.js +17 -1
- package/es6/components/Form/stories/Uncontrolled.js +15 -2
- package/es6/components/Form/stories/ValidateOnChange.js +6 -0
- package/es6/components/Form/stories/ValidateOnMount.js +4 -0
- package/es6/components/Form/stories/typescript/TypedForm.tsx +25 -3
- package/es6/components/Layer/LayerContainer.js +1 -1
- package/es6/components/Layer/StyledLayer.js +3 -1
- package/es6/components/MaskedInput/MaskedInput.js +4 -3
- package/es6/components/MaskedInput/StyledMaskedInput.js +2 -1
- package/es6/components/Notification/Notification.js +7 -3
- package/es6/components/PageHeader/PageHeader.js +6 -4
- package/es6/components/Pagination/Pagination.js +8 -0
- package/es6/components/Pagination/StyledPageControl.js +3 -1
- package/es6/components/Paragraph/Paragraph.js +19 -7
- package/es6/components/Paragraph/stories/All.js +5 -1
- package/es6/components/SelectMultiple/SelectMultiple.js +11 -10
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +16 -13
- package/es6/components/SelectMultiple/stories/Help.js +42 -0
- package/es6/components/Tabs/Tabs.js +2 -1
- package/es6/components/Text/Text.js +10 -2
- package/es6/components/Text/TextContext.js +2 -0
- package/es6/components/TextInput/StyledTextInput.js +6 -3
- package/es6/components/TextInput/TextInput.js +8 -5
- package/es6/components/TextInput/index.d.ts +3 -1
- package/es6/components/TextInput/propTypes.js +3 -1
- package/es6/components/Toolbar/stories/Simple.js +1 -1
- package/es6/components/WorldMap/WorldMap.js +17 -14
- package/es6/languages/default.json +7 -2
- package/es6/themes/base.d.ts +34 -0
- package/es6/themes/base.js +37 -1
- package/es6/utils/DOM.js +1 -1
- package/es6/utils/background.js +9 -1
- package/es6/utils/colors.js +2 -2
- package/es6/utils/general-prop-types.js +1 -1
- package/es6/utils/icon.js +7 -0
- package/es6/utils/index.d.ts +7 -1
- package/es6/utils/index.js +1 -0
- package/es6/utils/styles.js +10 -0
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +7 -2
- package/package.json +41 -39
- package/themes/base.d.ts +34 -0
- package/themes/base.js +37 -1
- package/utils/DOM.js +1 -1
- package/utils/background.js +8 -0
- package/utils/colors.js +3 -1
- package/utils/general-prop-types.js +1 -1
- package/utils/icon.js +12 -0
- package/utils/index.d.ts +7 -1
- package/utils/index.js +6 -0
- package/utils/styles.js +12 -1
package/es6/themes/base.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
PropsOf,
|
|
26
26
|
AlignContentType,
|
|
27
27
|
SkeletonColorsType,
|
|
28
|
+
AlignSelfType,
|
|
28
29
|
} from '../utils';
|
|
29
30
|
|
|
30
31
|
import { AnchorProps } from '../components/Anchor/index';
|
|
@@ -147,7 +148,9 @@ interface ButtonKindType {
|
|
|
147
148
|
}
|
|
148
149
|
| boolean;
|
|
149
150
|
color?: ColorType;
|
|
151
|
+
direction?: DirectionType;
|
|
150
152
|
font?: {
|
|
153
|
+
size?: string;
|
|
151
154
|
weight?: number | string;
|
|
152
155
|
};
|
|
153
156
|
icon?: React.ReactNode | Icon;
|
|
@@ -161,6 +164,7 @@ interface ButtonKindType {
|
|
|
161
164
|
|
|
162
165
|
interface ButtonType {
|
|
163
166
|
badge?: {
|
|
167
|
+
align?: 'container';
|
|
164
168
|
container?: {
|
|
165
169
|
background?: BackgroundType;
|
|
166
170
|
pad?: PadType;
|
|
@@ -223,6 +227,9 @@ interface ButtonType {
|
|
|
223
227
|
vertical?: string;
|
|
224
228
|
horizontal?: string;
|
|
225
229
|
};
|
|
230
|
+
iconOnly?: {
|
|
231
|
+
pad?: string | { horizontal?: string; vertical?: string };
|
|
232
|
+
};
|
|
226
233
|
};
|
|
227
234
|
medium?: {
|
|
228
235
|
border?: {
|
|
@@ -232,6 +239,9 @@ interface ButtonType {
|
|
|
232
239
|
vertical?: string;
|
|
233
240
|
horizontal?: string;
|
|
234
241
|
};
|
|
242
|
+
iconOnly?: {
|
|
243
|
+
pad?: string | { horizontal?: string; vertical?: string };
|
|
244
|
+
};
|
|
235
245
|
};
|
|
236
246
|
large?: {
|
|
237
247
|
border?: {
|
|
@@ -241,6 +251,9 @@ interface ButtonType {
|
|
|
241
251
|
vertical?: string;
|
|
242
252
|
horizontal?: string;
|
|
243
253
|
};
|
|
254
|
+
iconOnly?: {
|
|
255
|
+
pad?: string | { horizontal?: string; vertical?: string };
|
|
256
|
+
};
|
|
244
257
|
};
|
|
245
258
|
};
|
|
246
259
|
skeleton?: SkeletonProps;
|
|
@@ -480,6 +493,20 @@ export interface ThemeType {
|
|
|
480
493
|
textDecoration?: string;
|
|
481
494
|
};
|
|
482
495
|
textDecoration?: string;
|
|
496
|
+
size?: {
|
|
497
|
+
medium?: {
|
|
498
|
+
color?: ColorType;
|
|
499
|
+
fontWeight?: number;
|
|
500
|
+
textDecoration?: string;
|
|
501
|
+
};
|
|
502
|
+
[x: string]:
|
|
503
|
+
| {
|
|
504
|
+
color?: ColorType;
|
|
505
|
+
fontWeight?: number;
|
|
506
|
+
textDecoration?: string;
|
|
507
|
+
}
|
|
508
|
+
| undefined;
|
|
509
|
+
};
|
|
483
510
|
};
|
|
484
511
|
avatar?: {
|
|
485
512
|
size?: {
|
|
@@ -515,18 +542,21 @@ export interface ThemeType {
|
|
|
515
542
|
};
|
|
516
543
|
extend?: ExtendType;
|
|
517
544
|
small?: {
|
|
545
|
+
title?: TextProps;
|
|
518
546
|
fontSize?: string;
|
|
519
547
|
lineHeight?: number;
|
|
520
548
|
daySize?: string;
|
|
521
549
|
slideDuration?: string;
|
|
522
550
|
};
|
|
523
551
|
medium?: {
|
|
552
|
+
title?: TextProps;
|
|
524
553
|
fontSize?: string;
|
|
525
554
|
lineHeight?: number;
|
|
526
555
|
daySize?: string;
|
|
527
556
|
slideDuration?: string;
|
|
528
557
|
};
|
|
529
558
|
large?: {
|
|
559
|
+
title?: TextProps;
|
|
530
560
|
fontSize?: string;
|
|
531
561
|
lineHeight?: number;
|
|
532
562
|
daySize?: string;
|
|
@@ -999,6 +1029,8 @@ export interface ThemeType {
|
|
|
999
1029
|
};
|
|
1000
1030
|
icon?: {
|
|
1001
1031
|
extend?: ExtendType;
|
|
1032
|
+
disableScaleDown?: boolean;
|
|
1033
|
+
matchSize?: boolean;
|
|
1002
1034
|
size?: {
|
|
1003
1035
|
small?: string;
|
|
1004
1036
|
medium?: string;
|
|
@@ -1021,6 +1053,7 @@ export interface ThemeType {
|
|
|
1021
1053
|
extend?: ExtendType;
|
|
1022
1054
|
overlay?: {
|
|
1023
1055
|
background?: BackgroundType;
|
|
1056
|
+
backdropFilter?: string;
|
|
1024
1057
|
};
|
|
1025
1058
|
responsiveBreakpoint?: string;
|
|
1026
1059
|
zIndex?: string;
|
|
@@ -1483,6 +1516,7 @@ export interface ThemeType {
|
|
|
1483
1516
|
extend?: ExtendType;
|
|
1484
1517
|
gap?: GapType;
|
|
1485
1518
|
header?: {
|
|
1519
|
+
alignSelf?: AlignSelfType;
|
|
1486
1520
|
background?: BackgroundType;
|
|
1487
1521
|
border?: {
|
|
1488
1522
|
side?: string;
|
package/es6/themes/base.js
CHANGED
|
@@ -352,6 +352,11 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
352
352
|
full: '100%'
|
|
353
353
|
}
|
|
354
354
|
},
|
|
355
|
+
// icon: {
|
|
356
|
+
// extennd: undefined,
|
|
357
|
+
// matchSize: undefined,
|
|
358
|
+
// size: undefined,
|
|
359
|
+
// },
|
|
355
360
|
accordion: {
|
|
356
361
|
panel: {
|
|
357
362
|
// border: {
|
|
@@ -402,6 +407,13 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
402
407
|
// fontWeight: undefined,
|
|
403
408
|
// extend: undefined,
|
|
404
409
|
}
|
|
410
|
+
// size: {
|
|
411
|
+
// medium: {
|
|
412
|
+
// color: undefined,
|
|
413
|
+
// fontWeight: undefined,
|
|
414
|
+
// textDecoration: undefined,
|
|
415
|
+
// },
|
|
416
|
+
// },
|
|
405
417
|
// extend: undefined,
|
|
406
418
|
},
|
|
407
419
|
|
|
@@ -459,6 +471,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
459
471
|
|
|
460
472
|
button: {
|
|
461
473
|
badge: {
|
|
474
|
+
// align: undefined,,
|
|
462
475
|
container: {
|
|
463
476
|
background: 'brand'
|
|
464
477
|
// pad: undefined,
|
|
@@ -487,6 +500,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
487
500
|
// 4px
|
|
488
501
|
horizontal: baseSpacing - borderWidth * 2 + "px" // 20px,
|
|
489
502
|
}
|
|
503
|
+
// iconOnly: {
|
|
504
|
+
// pad: undefined,
|
|
505
|
+
// },
|
|
490
506
|
},
|
|
491
507
|
|
|
492
508
|
medium: {
|
|
@@ -499,6 +515,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
499
515
|
// 4px
|
|
500
516
|
horizontal: baseSpacing - borderWidth + "px" // 22px
|
|
501
517
|
}
|
|
518
|
+
// iconOnly: {
|
|
519
|
+
// pad: undefined,
|
|
520
|
+
// },
|
|
502
521
|
},
|
|
503
522
|
|
|
504
523
|
large: {
|
|
@@ -511,6 +530,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
511
530
|
// 8px
|
|
512
531
|
horizontal: baseSpacing + borderWidth * 4 + "px" // 32px,
|
|
513
532
|
}
|
|
533
|
+
// iconOnly: {
|
|
534
|
+
// pad: undefined,
|
|
535
|
+
// },
|
|
514
536
|
}
|
|
515
537
|
},
|
|
516
538
|
|
|
@@ -524,7 +546,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
524
546
|
// background: undefined,
|
|
525
547
|
// border: undefined,
|
|
526
548
|
// color: undefined,
|
|
549
|
+
// direction: undefined,
|
|
527
550
|
// font: {
|
|
551
|
+
// size: undefined,
|
|
528
552
|
// weight: undefined,
|
|
529
553
|
// },
|
|
530
554
|
// icon: undefined,
|
|
@@ -537,11 +561,13 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
537
561
|
// },
|
|
538
562
|
// primary: {
|
|
539
563
|
// font: {
|
|
564
|
+
// size: undefined,
|
|
540
565
|
// weight: undefined,
|
|
541
566
|
// },
|
|
542
567
|
// background: undefined,
|
|
543
568
|
// border: undefined,
|
|
544
569
|
// color: undefined,
|
|
570
|
+
// direction: undefined,
|
|
545
571
|
// icon: undefined,
|
|
546
572
|
// padding: {
|
|
547
573
|
// vertical: undefined,
|
|
@@ -552,11 +578,13 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
552
578
|
// },
|
|
553
579
|
// secondary: {
|
|
554
580
|
// font: {
|
|
581
|
+
// size: undefined,
|
|
555
582
|
// weight: undefined,
|
|
556
583
|
// },
|
|
557
584
|
// background: undefined,
|
|
558
585
|
// border: undefined,
|
|
559
586
|
// color: undefined,
|
|
587
|
+
// direction: undefined,
|
|
560
588
|
// icon: undefined,
|
|
561
589
|
// padding: {
|
|
562
590
|
// vertical: undefined,
|
|
@@ -569,6 +597,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
569
597
|
// background: undefined,
|
|
570
598
|
// border: undefined,
|
|
571
599
|
// color: undefined,
|
|
600
|
+
// direction: undefined,
|
|
572
601
|
// icon: undefined,
|
|
573
602
|
// padding: {
|
|
574
603
|
// vertical: undefined,
|
|
@@ -625,18 +654,21 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
625
654
|
calendar: {
|
|
626
655
|
// daySize must align with global.size
|
|
627
656
|
small: {
|
|
657
|
+
// title: {},
|
|
628
658
|
fontSize: baseFontSize - fontScale + "px",
|
|
629
659
|
lineHeight: 1.375,
|
|
630
660
|
daySize: baseSpacing * 8 / 7 + "px",
|
|
631
661
|
slideDuration: '0.2s'
|
|
632
662
|
},
|
|
633
663
|
medium: {
|
|
664
|
+
// title: {},
|
|
634
665
|
fontSize: baseFontSize + "px",
|
|
635
666
|
lineHeight: 1.45,
|
|
636
667
|
daySize: baseSpacing * 16 / 7 + "px",
|
|
637
668
|
slideDuration: '0.5s'
|
|
638
669
|
},
|
|
639
670
|
large: {
|
|
671
|
+
// title: {},
|
|
640
672
|
fontSize: baseFontSize + 3 * fontScale + "px",
|
|
641
673
|
lineHeight: 1.11,
|
|
642
674
|
daySize: baseSpacing * 32 / 7 + "px",
|
|
@@ -1161,7 +1193,8 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1161
1193
|
weight: 600,
|
|
1162
1194
|
skeleton: {
|
|
1163
1195
|
width: {
|
|
1164
|
-
min: '
|
|
1196
|
+
min: '150px',
|
|
1197
|
+
max: '200px'
|
|
1165
1198
|
}
|
|
1166
1199
|
}
|
|
1167
1200
|
},
|
|
@@ -1182,7 +1215,9 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1182
1215
|
// extend: undefined,
|
|
1183
1216
|
overlay: {
|
|
1184
1217
|
background: 'rgba(0, 0, 0, 0.5)'
|
|
1218
|
+
// backdropFilter: undefined,
|
|
1185
1219
|
},
|
|
1220
|
+
|
|
1186
1221
|
responsiveBreakpoint: 'small',
|
|
1187
1222
|
// when Layer takes over the full screen
|
|
1188
1223
|
zIndex: '20'
|
|
@@ -1926,6 +1961,7 @@ export var generate = function generate(baseSpacing, scale) {
|
|
|
1926
1961
|
// extend: undefined,
|
|
1927
1962
|
// gap: undefined,
|
|
1928
1963
|
header: {
|
|
1964
|
+
// alignSelf: undefined,
|
|
1929
1965
|
// background: undefined,
|
|
1930
1966
|
// border: {
|
|
1931
1967
|
// side: undefined,
|
package/es6/utils/DOM.js
CHANGED
|
@@ -59,7 +59,7 @@ export var containsFocus = function containsFocus(node) {
|
|
|
59
59
|
return !!element;
|
|
60
60
|
};
|
|
61
61
|
export var withinDropPortal = function withinDropPortal(node, portalContext) {
|
|
62
|
-
var root = node.getRootNode();
|
|
62
|
+
var root = node == null ? void 0 : node.getRootNode();
|
|
63
63
|
var element = node;
|
|
64
64
|
var portalId;
|
|
65
65
|
while (element && element !== root) {
|
package/es6/utils/background.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
import { colorIsDark, getRGBA, normalizeColor } from './colors';
|
|
2
|
+
import { colorIsDark, getRGBA, normalizeColor, canExtractRGBArray, getRGBArray } from './colors';
|
|
3
3
|
|
|
4
4
|
// evalStyle() converts a styled-components item into a string
|
|
5
5
|
var evalStyle = function evalStyle(arg, theme) {
|
|
@@ -123,8 +123,16 @@ export var backgroundAndTextColors = function backgroundAndTextColors(background
|
|
|
123
123
|
} else {
|
|
124
124
|
backgroundColor = normalizeBackgroundColor(background, theme);
|
|
125
125
|
var _shade = darkContext(backgroundColor, theme);
|
|
126
|
+
var transparent;
|
|
127
|
+
if (backgroundColor && canExtractRGBArray(backgroundColor)) {
|
|
128
|
+
var colorArray = getRGBArray(backgroundColor);
|
|
129
|
+
// check if the alpha value is less than 0.5
|
|
130
|
+
if (colorArray[3] < 0.5) transparent = true;
|
|
131
|
+
}
|
|
126
132
|
if (_shade) {
|
|
127
133
|
textColor = normalizeColor(text[_shade] || text, theme, _shade === 'dark');
|
|
134
|
+
} else if (transparent && text) {
|
|
135
|
+
textColor = normalizeColor(text, theme);
|
|
128
136
|
} else {
|
|
129
137
|
// If we can't determine the shade, we assume this isn't a simple color.
|
|
130
138
|
// It could be a gradient. backgroundStyle() will take care of that case.
|
package/es6/utils/colors.js
CHANGED
|
@@ -68,10 +68,10 @@ var rgbExp = /^rgba?\(\s?([0-9]*)\s?,\s?([0-9]*)\s?,\s?([0-9]*)\s?\)/;
|
|
|
68
68
|
var rgbaExp = /^rgba?\(\s?([0-9]*)\s?,\s?([0-9]*)\s?,\s?([0-9]*)\s?,\s?([.0-9]*)\s?\)/;
|
|
69
69
|
// e.g. hsl(240, 60%, 50%)
|
|
70
70
|
var hslExp = /^hsla?\(\s?([0-9]*)\s?,\s?([0-9]*)%?\s?,\s?([0-9]*)%?\s?.*?\)/;
|
|
71
|
-
var canExtractRGBArray = function canExtractRGBArray(color) {
|
|
71
|
+
export var canExtractRGBArray = function canExtractRGBArray(color) {
|
|
72
72
|
return hexExp.test(color) || rgbExp.test(color) || rgbaExp.test(color) || hslExp.test(color);
|
|
73
73
|
};
|
|
74
|
-
var getRGBArray = function getRGBArray(color) {
|
|
74
|
+
export var getRGBArray = function getRGBArray(color) {
|
|
75
75
|
if (hexExp.test(color)) {
|
|
76
76
|
var _parseHexToRGB = parseHexToRGB(color),
|
|
77
77
|
red = _parseHexToRGB[0],
|
|
@@ -75,7 +75,7 @@ export var skeletonPropType = PropTypes.oneOfType([PropTypes.bool, PropTypes.sha
|
|
|
75
75
|
depth: PropTypes.number,
|
|
76
76
|
message: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
77
77
|
start: PropTypes.string,
|
|
78
|
-
end: PropTypes.
|
|
78
|
+
end: PropTypes.string
|
|
79
79
|
})])
|
|
80
80
|
})]);
|
|
81
81
|
var dimSizeType = PropTypes.oneOf(['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge']);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { cloneElement } from 'react';
|
|
2
|
+
export var useSizedIcon = function useSizedIcon(icon, size, theme) {
|
|
3
|
+
var _theme$icon;
|
|
4
|
+
return icon && theme != null && (_theme$icon = theme.icon) != null && _theme$icon.matchSize && !icon.props.size ? /*#__PURE__*/cloneElement(icon, {
|
|
5
|
+
size: size
|
|
6
|
+
}) : icon;
|
|
7
|
+
};
|
package/es6/utils/index.d.ts
CHANGED
|
@@ -128,7 +128,13 @@ export type AlignContentType =
|
|
|
128
128
|
| 'start'
|
|
129
129
|
| 'stretch'
|
|
130
130
|
| string;
|
|
131
|
-
export type AlignSelfType =
|
|
131
|
+
export type AlignSelfType =
|
|
132
|
+
| 'start'
|
|
133
|
+
| 'center'
|
|
134
|
+
| 'end'
|
|
135
|
+
| 'stretch'
|
|
136
|
+
| 'baseline'
|
|
137
|
+
| string;
|
|
132
138
|
export type AnimateType = boolean;
|
|
133
139
|
export interface BackgroundObject {
|
|
134
140
|
color?: ColorType;
|
package/es6/utils/index.js
CHANGED
package/es6/utils/styles.js
CHANGED
|
@@ -245,6 +245,16 @@ export var inputStyle = css(["box-sizing:border-box;", " font-family:inherit;bor
|
|
|
245
245
|
}, controlBorderStyle, placeholderStyle, function (props) {
|
|
246
246
|
return props.theme.global.input.extend;
|
|
247
247
|
});
|
|
248
|
+
|
|
249
|
+
// Apply padding on input to create space for icon.
|
|
250
|
+
// When theme.icon.matchSize is true, the space for the
|
|
251
|
+
// icon should equal the icon dimension + 12px (edgeSize.medium)
|
|
252
|
+
// to ensure there is reasonable space between the icon and value or placeholder
|
|
253
|
+
export var inputPadForIcon = css(["", ""], function (props) {
|
|
254
|
+
var _props$theme, _props$theme$icon, _props$theme$icon2, _props$theme$icon2$si;
|
|
255
|
+
var pad = (_props$theme = props.theme) != null && (_props$theme$icon = _props$theme.icon) != null && _props$theme$icon.matchSize ? parseMetricToNum((_props$theme$icon2 = props.theme.icon) == null ? void 0 : (_props$theme$icon2$si = _props$theme$icon2.size) == null ? void 0 : _props$theme$icon2$si[(props == null ? void 0 : props.size) || 'medium']) + parseMetricToNum(props.theme.global.edgeSize.medium) + "px" : props.theme.global.edgeSize.large;
|
|
256
|
+
return props.reverse ? "padding-right: " + pad + ";" : "padding-left: " + pad + ";";
|
|
257
|
+
});
|
|
248
258
|
export var overflowStyle = function overflowStyle(overflowProp) {
|
|
249
259
|
if (typeof overflowProp === 'string') {
|
|
250
260
|
return css(["overflow:", ";"], overflowProp);
|