@commercetools-uikit/design-system 15.11.2 → 15.12.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/dist/commercetools-uikit-design-system.cjs.dev.js +55 -31
- package/dist/commercetools-uikit-design-system.cjs.prod.js +55 -31
- package/dist/commercetools-uikit-design-system.esm.js +56 -32
- package/dist/declarations/src/design-tokens.d.ts +34 -3
- package/materials/custom-properties.css +12 -1
- package/materials/custom-properties.json +12 -1
- package/materials/internals/definition.yaml +71 -3
- package/package.json +5 -4
|
@@ -19,6 +19,7 @@ var react = require('react');
|
|
|
19
19
|
var isObject = require('lodash/isObject');
|
|
20
20
|
var merge = require('lodash/merge');
|
|
21
21
|
var isEqual = require('lodash/isEqual');
|
|
22
|
+
var hooks = require('@commercetools-uikit/hooks');
|
|
22
23
|
var _Object$fromEntries = require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
|
|
23
24
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
24
25
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
@@ -181,6 +182,7 @@ var themes = {
|
|
|
181
182
|
breakPointBiggerdesktop: '1280px',
|
|
182
183
|
breakPointGiantdesktop: '1680px',
|
|
183
184
|
breakPointJumbodesktop: '1920px',
|
|
185
|
+
alignItemsForSelectInputTag: 'unset',
|
|
184
186
|
backgroundColorForButtonWhenActive: '#fff',
|
|
185
187
|
backgroundColorForButtonWhenHovered: '#fff',
|
|
186
188
|
backgroundColorForButtonAsPrimaryWhenActive: '#00b39e',
|
|
@@ -229,6 +231,7 @@ var themes = {
|
|
|
229
231
|
borderForCardWhenRaised: 'none',
|
|
230
232
|
borderForCollapsiblePanelHeaderIconWhenDisabled: '1px solid var(--color-neutral)',
|
|
231
233
|
borderForViewSwitcher: 'none',
|
|
234
|
+
borderForSelectInputTag: 'none',
|
|
232
235
|
borderColorForInput: 'hsl(0, 0%, 60%)',
|
|
233
236
|
borderColorForInputWhenFocused: '#00b39e',
|
|
234
237
|
borderColorForInputWhenDisabled: '#ccc',
|
|
@@ -315,12 +318,14 @@ var themes = {
|
|
|
315
318
|
fontColorForContentNotificationIconWhenSuccess: '#fff',
|
|
316
319
|
fontColorForContentNotificationIconWhenInfo: '#fff',
|
|
317
320
|
fontColorForSearchInputIcon: '#1a1a1a',
|
|
318
|
-
fontColorForSearchInputIconWhenHovered: '#
|
|
321
|
+
fontColorForSearchInputIconWhenHovered: '#00b39e',
|
|
319
322
|
fontColorForSelectInputIcon: '#1a1a1a',
|
|
320
323
|
fontColorForSelectInputWhenError: '#1a1a1a',
|
|
321
324
|
fontColorForSelectInputWhenWarning: '#1a1a1a',
|
|
322
325
|
fontColorForSelectInputIconWhenError: '#1a1a1a',
|
|
323
326
|
fontColorForSelectInputIconWhenWarning: '#1a1a1a',
|
|
327
|
+
fontColorForMoneyInputCurrencyDropdownIndicator: '#1a1a1a',
|
|
328
|
+
fontColorForSearchInputIconWhenReadonly: 'hsl(0, 0%, 60%)',
|
|
324
329
|
heightForButtonAsBig: '32px',
|
|
325
330
|
heightForButtonAsSmall: '24px',
|
|
326
331
|
heightForButtonAsIconAsBig: '32px',
|
|
@@ -329,7 +334,9 @@ var themes = {
|
|
|
329
334
|
heightForInput: '32px',
|
|
330
335
|
heightForViewSwitcher: '32px',
|
|
331
336
|
heightForViewSwitcherWhenCondensed: '24px',
|
|
337
|
+
heightForSelectInputTag: '26px',
|
|
332
338
|
widthForAvatarAsMedium: '48px',
|
|
339
|
+
minWidthForMoneyInputCurrencyDropdown: '72px',
|
|
333
340
|
placeholderFontColorForInput: 'hsl(0, 0%, 60%)',
|
|
334
341
|
fontSizeForButton: '1rem',
|
|
335
342
|
fontSizeForInput: '1rem',
|
|
@@ -350,6 +357,7 @@ var themes = {
|
|
|
350
357
|
fontSizeForAvatarAsBig: '3rem',
|
|
351
358
|
fontSizeForLocalizedMultilineTextInputLabel: '0.9231rem',
|
|
352
359
|
fontSizeForContentNotification: '1rem',
|
|
360
|
+
fontSizeForSelectInputTag: '0.9231rem',
|
|
353
361
|
iconColorForDatetimeInputIcon: '#1a1a1a',
|
|
354
362
|
iconColorForDatetimeInputIconWhenHovered: '#f16d0e',
|
|
355
363
|
lineHeightForTextAsH1: 'inherit',
|
|
@@ -374,6 +382,9 @@ var themes = {
|
|
|
374
382
|
marginForGroupHeadingSelectInputOptions: '4px',
|
|
375
383
|
marginForSelectInputIcon: '4px',
|
|
376
384
|
marginLeftForSelectInputIcon: 'inherit',
|
|
385
|
+
marginRightForMoneyInputPrecisionBadge: '4px',
|
|
386
|
+
marginRightForSearchInputIcon: '8px',
|
|
387
|
+
marginRightForClearInputIcon: '4px',
|
|
377
388
|
paddingForStamp: 'var(--spacing-10) var(--spacing-20)',
|
|
378
389
|
paddingForStampAsCondensed: '1px var(--spacing-10)',
|
|
379
390
|
paddingForTag: '5px var(--spacing-20)',
|
|
@@ -406,6 +417,7 @@ var themes = {
|
|
|
406
417
|
paddingBottomForSelectInputOptions: '4px',
|
|
407
418
|
paddingForGroupHeadingSelectInputOptions: '8px',
|
|
408
419
|
paddingForSelectInputMenu: 'inherit',
|
|
420
|
+
paddingForMoneyInputCurrencyDropdown: '0 var(--spacing-20)',
|
|
409
421
|
shadowForButton: '0 -1px 1.5px 0 rgba(0, 0, 0, 0.12), 0 1px 1px 0 rgba(0, 0, 0, 0.24)',
|
|
410
422
|
shadowForButtonWhenFocused: '0 1px 9.5px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24)',
|
|
411
423
|
shadowForButtonWhenHovered: '0 1px 9.5px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24)',
|
|
@@ -433,6 +445,7 @@ var themes = {
|
|
|
433
445
|
test: {
|
|
434
446
|
colorPrimary: '#00b39e',
|
|
435
447
|
fontFamily: "'Inter', system-ui",
|
|
448
|
+
alignItemsForSelectInputTag: 'center',
|
|
436
449
|
backgroundColorForButtonWhenActive: 'hsl(0deg 0% 10% / 10%)',
|
|
437
450
|
backgroundColorForButtonWhenHovered: 'hsl(0deg 0% 10% / 5%)',
|
|
438
451
|
backgroundColorForButtonAsPrimaryWhenActive: '#15A390',
|
|
@@ -475,6 +488,7 @@ var themes = {
|
|
|
475
488
|
borderForCardWhenRaised: '1px solid var(--color-neutral-90)',
|
|
476
489
|
borderForCollapsiblePanelHeaderIconWhenDisabled: 'none',
|
|
477
490
|
borderForViewSwitcher: '1px solid var(--color-neutral)',
|
|
491
|
+
borderForSelectInputTag: '1px solid var(--color-neutral-85)',
|
|
478
492
|
borderColorForInput: '#ccc',
|
|
479
493
|
borderColorForInputWhenDisabled: '#ccc',
|
|
480
494
|
borderColorForInputWhenHovered: '#ccc',
|
|
@@ -540,12 +554,12 @@ var themes = {
|
|
|
540
554
|
fontColorForClearInputIconWhenHovered: '#e60050',
|
|
541
555
|
fontColorForClearInputIcon: 'hsl(0, 0%, 40%)',
|
|
542
556
|
fontColorForSearchInputIcon: 'hsl(0, 0%, 60%)',
|
|
543
|
-
fontColorForSearchInputIconWhenHovered: '#00b39e',
|
|
544
557
|
fontColorForSelectInputIcon: 'hsl(0, 0%, 60%)',
|
|
545
558
|
fontColorForSelectInputWhenError: '#e60050',
|
|
546
559
|
fontColorForSelectInputWhenWarning: '#f16d0e',
|
|
547
560
|
fontColorForSelectInputIconWhenError: '#e60050',
|
|
548
561
|
fontColorForSelectInputIconWhenWarning: '#f16d0e',
|
|
562
|
+
fontColorForMoneyInputCurrencyDropdownIndicator: 'hsl(0, 0%, 40%)',
|
|
549
563
|
fontSizeForInput: '1rem',
|
|
550
564
|
fontSizeForTextAsH1: '1.5rem',
|
|
551
565
|
fontSizeForTextAsH2: '1.25rem',
|
|
@@ -564,6 +578,7 @@ var themes = {
|
|
|
564
578
|
fontSizeForAvatarAsMedium: '1rem',
|
|
565
579
|
fontSizeForAvatarAsBig: '2.5rem',
|
|
566
580
|
fontSizeForLocalizedMultilineTextInputLabel: '1rem',
|
|
581
|
+
fontSizeForSelectInputTag: '1rem',
|
|
567
582
|
lineHeightForTextAsH1: '2.125rem',
|
|
568
583
|
lineHeightForTextAsH2: '1.75rem',
|
|
569
584
|
lineHeightForTextAsH3: '1.5rem',
|
|
@@ -588,15 +603,20 @@ var themes = {
|
|
|
588
603
|
heightForInput: '40px',
|
|
589
604
|
heightForViewSwitcher: '40px',
|
|
590
605
|
heightForViewSwitcherWhenCondensed: '32px',
|
|
606
|
+
heightForSelectInputTag: '32px',
|
|
591
607
|
iconColorForDatetimeInputIcon: 'hsl(0, 0%, 40%)',
|
|
592
608
|
iconColorForDatetimeInputIconWhenHovered: '#e60050',
|
|
593
609
|
widthForAvatarAsMedium: '40px',
|
|
610
|
+
minWidthForMoneyInputCurrencyDropdown: '80px',
|
|
594
611
|
marginForTableHeader: '16px',
|
|
595
612
|
marginForTableCellAsCondensed: '8px',
|
|
596
613
|
marginForViewSwitcherIcon: '0 var(--spacing-20) 0 0',
|
|
597
614
|
marginForGroupHeadingSelectInputOptions: '8px',
|
|
598
615
|
marginForSelectInputIcon: '8px',
|
|
599
616
|
marginLeftForSelectInputIcon: '8px',
|
|
617
|
+
marginRightForMoneyInputPrecisionBadge: '12px',
|
|
618
|
+
marginRightForSearchInputIcon: '12px',
|
|
619
|
+
marginRightForClearInputIcon: '8px',
|
|
600
620
|
paddingForStamp: '4px 12px',
|
|
601
621
|
paddingForStampAsCondensed: '0 var(--spacing-20)',
|
|
602
622
|
paddingForTag: '2px 12px',
|
|
@@ -629,6 +649,7 @@ var themes = {
|
|
|
629
649
|
paddingBottomForSelectInputOptions: '8px',
|
|
630
650
|
paddingForGroupHeadingSelectInputOptions: '16px',
|
|
631
651
|
paddingForSelectInputMenu: 'var(--spacing-10) 0',
|
|
652
|
+
paddingForMoneyInputCurrencyDropdown: '0 12px',
|
|
632
653
|
shadowForButton: 'none',
|
|
633
654
|
shadowForButtonWhenFocused: 'none',
|
|
634
655
|
shadowForButtonWhenHovered: 'none',
|
|
@@ -772,6 +793,7 @@ var designTokens = {
|
|
|
772
793
|
breakPointBiggerdesktop: 'var(--break-point-biggerdesktop, 1280px)',
|
|
773
794
|
breakPointGiantdesktop: 'var(--break-point-giantdesktop, 1680px)',
|
|
774
795
|
breakPointJumbodesktop: 'var(--break-point-jumbodesktop, 1920px)',
|
|
796
|
+
alignItemsForSelectInputTag: 'var(--align-items-for-select-input-tag, unset)',
|
|
775
797
|
backgroundColorForButtonWhenActive: 'var(--background-color-for-button-when-active, #fff)',
|
|
776
798
|
backgroundColorForButtonWhenHovered: 'var(--background-color-for-button-when-hovered, #fff)',
|
|
777
799
|
backgroundColorForButtonAsPrimaryWhenActive: 'var(--background-color-for-button-as-primary-when-active, #00b39e)',
|
|
@@ -820,6 +842,7 @@ var designTokens = {
|
|
|
820
842
|
borderForCardWhenRaised: 'var(--border-for-card-when-raised, none)',
|
|
821
843
|
borderForCollapsiblePanelHeaderIconWhenDisabled: 'var(--border-for-collapsible-panel-header-icon-when-disabled, 1px solid var(--color-neutral))',
|
|
822
844
|
borderForViewSwitcher: 'var(--border-for-view-switcher, none)',
|
|
845
|
+
borderForSelectInputTag: 'var(--border-for-select-input-tag, none)',
|
|
823
846
|
borderColorForInput: 'var(--border-color-for-input, hsl(0, 0%, 60%))',
|
|
824
847
|
borderColorForInputWhenFocused: 'var(--border-color-for-input-when-focused, #00b39e)',
|
|
825
848
|
borderColorForInputWhenDisabled: 'var(--border-color-for-input-when-disabled, #ccc)',
|
|
@@ -906,12 +929,14 @@ var designTokens = {
|
|
|
906
929
|
fontColorForContentNotificationIconWhenSuccess: 'var(--font-color-for-content-notification-icon-when-success, #fff)',
|
|
907
930
|
fontColorForContentNotificationIconWhenInfo: 'var(--font-color-for-content-notification-icon-when-info, #fff)',
|
|
908
931
|
fontColorForSearchInputIcon: 'var(--font-color-for-search-input-icon, #1a1a1a)',
|
|
909
|
-
fontColorForSearchInputIconWhenHovered: 'var(--font-color-for-search-input-icon-when-hovered, #
|
|
932
|
+
fontColorForSearchInputIconWhenHovered: 'var(--font-color-for-search-input-icon-when-hovered, #00b39e)',
|
|
910
933
|
fontColorForSelectInputIcon: 'var(--font-color-for-select-input-icon, #1a1a1a)',
|
|
911
934
|
fontColorForSelectInputWhenError: 'var(--font-color-for-select-input-when-error, #1a1a1a)',
|
|
912
935
|
fontColorForSelectInputWhenWarning: 'var(--font-color-for-select-input-when-warning, #1a1a1a)',
|
|
913
936
|
fontColorForSelectInputIconWhenError: 'var(--font-color-for-select-input-icon-when-error, #1a1a1a)',
|
|
914
937
|
fontColorForSelectInputIconWhenWarning: 'var(--font-color-for-select-input-icon-when-warning, #1a1a1a)',
|
|
938
|
+
fontColorForMoneyInputCurrencyDropdownIndicator: 'var(--font-color-for-money-input-currency-dropdown-indicator, #1a1a1a)',
|
|
939
|
+
fontColorForSearchInputIconWhenReadonly: 'var(--font-color-for-search-input-icon-when-readonly, hsl(0, 0%, 60%))',
|
|
915
940
|
heightForButtonAsBig: 'var(--height-for-button-as-big, 32px)',
|
|
916
941
|
heightForButtonAsSmall: 'var(--height-for-button-as-small, 24px)',
|
|
917
942
|
heightForButtonAsIconAsBig: 'var(--height-for-button-as-icon-as-big, 32px)',
|
|
@@ -920,7 +945,9 @@ var designTokens = {
|
|
|
920
945
|
heightForInput: 'var(--height-for-input, 32px)',
|
|
921
946
|
heightForViewSwitcher: 'var(--height-for-view-switcher, 32px)',
|
|
922
947
|
heightForViewSwitcherWhenCondensed: 'var(--height-for-view-switcher-when-condensed, 24px)',
|
|
948
|
+
heightForSelectInputTag: 'var(--height-for-select-input-tag, 26px)',
|
|
923
949
|
widthForAvatarAsMedium: 'var(--width-for-avatar-as-medium, 48px)',
|
|
950
|
+
minWidthForMoneyInputCurrencyDropdown: 'var(--min-width-for-money-input-currency-dropdown, 72px)',
|
|
924
951
|
placeholderFontColorForInput: 'var(--placeholder-font-color-for-input, hsl(0, 0%, 60%))',
|
|
925
952
|
fontSizeForButton: 'var(--font-size-for-button, 1rem)',
|
|
926
953
|
fontSizeForInput: 'var(--font-size-for-input, 1rem)',
|
|
@@ -941,6 +968,7 @@ var designTokens = {
|
|
|
941
968
|
fontSizeForAvatarAsBig: 'var(--font-size-for-avatar-as-big, 3rem)',
|
|
942
969
|
fontSizeForLocalizedMultilineTextInputLabel: 'var(--font-size-for-localized-multiline-text-input-label, 0.9231rem)',
|
|
943
970
|
fontSizeForContentNotification: 'var(--font-size-for-content-notification, 1rem)',
|
|
971
|
+
fontSizeForSelectInputTag: 'var(--font-size-for-select-input-tag, 0.9231rem)',
|
|
944
972
|
iconColorForDatetimeInputIcon: 'var(--icon-color-for-datetime-input-icon, #1a1a1a)',
|
|
945
973
|
iconColorForDatetimeInputIconWhenHovered: 'var(--icon-color-for-datetime-input-icon-when-hovered, #f16d0e)',
|
|
946
974
|
lineHeightForTextAsH1: 'var(--line-height-for-text-as-h-1, inherit)',
|
|
@@ -965,6 +993,9 @@ var designTokens = {
|
|
|
965
993
|
marginForGroupHeadingSelectInputOptions: 'var(--margin-for-group-heading-select-input-options, 4px)',
|
|
966
994
|
marginForSelectInputIcon: 'var(--margin-for-select-input-icon, 4px)',
|
|
967
995
|
marginLeftForSelectInputIcon: 'var(--margin-left-for-select-input-icon, inherit)',
|
|
996
|
+
marginRightForMoneyInputPrecisionBadge: 'var(--margin-right-for-money-input-precision-badge, 4px)',
|
|
997
|
+
marginRightForSearchInputIcon: 'var(--margin-right-for-search-input-icon, 8px)',
|
|
998
|
+
marginRightForClearInputIcon: 'var(--margin-right-for-clear-input-icon, 4px)',
|
|
968
999
|
paddingForStamp: 'var(--padding-for-stamp, var(--spacing-10) var(--spacing-20))',
|
|
969
1000
|
paddingForStampAsCondensed: 'var(--padding-for-stamp-as-condensed, 1px var(--spacing-10))',
|
|
970
1001
|
paddingForTag: 'var(--padding-for-tag, 5px var(--spacing-20))',
|
|
@@ -997,6 +1028,7 @@ var designTokens = {
|
|
|
997
1028
|
paddingBottomForSelectInputOptions: 'var(--padding-bottom-for-select-input-options, 4px)',
|
|
998
1029
|
paddingForGroupHeadingSelectInputOptions: 'var(--padding-for-group-heading-select-input-options, 8px)',
|
|
999
1030
|
paddingForSelectInputMenu: 'var(--padding-for-select-input-menu, inherit)',
|
|
1031
|
+
paddingForMoneyInputCurrencyDropdown: 'var(--padding-for-money-input-currency-dropdown, 0 var(--spacing-20))',
|
|
1000
1032
|
shadowForButton: 'var(--shadow-for-button, 0 -1px 1.5px 0 rgba(0, 0, 0, 0.12), 0 1px 1px 0 rgba(0, 0, 0, 0.24))',
|
|
1001
1033
|
shadowForButtonWhenFocused: 'var(--shadow-for-button-when-focused, 0 1px 9.5px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24))',
|
|
1002
1034
|
shadowForButtonWhenHovered: 'var(--shadow-for-button-when-hovered, 0 1px 9.5px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24))',
|
|
@@ -1165,12 +1197,18 @@ var useTheme = function useTheme() {
|
|
|
1165
1197
|
setTheme = _useState2[1];
|
|
1166
1198
|
|
|
1167
1199
|
var parentSelectorRef = react.useRef(parentSelector);
|
|
1168
|
-
var
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1200
|
+
var mutationChangeCallback = react.useCallback(function (mutationList) {
|
|
1201
|
+
// We expect only a single element in the mutation list as we configured the
|
|
1202
|
+
// observer to only listen to `data-theme` changes.
|
|
1203
|
+
var _mutationList = _slicedToArray(mutationList, 1),
|
|
1204
|
+
mutationEvent = _mutationList[0];
|
|
1205
|
+
|
|
1206
|
+
setTheme(mutationEvent.target.dataset.theme);
|
|
1207
|
+
}, []);
|
|
1208
|
+
hooks.useMutationObserver(parentSelector(), mutationChangeCallback, {
|
|
1209
|
+
attributes: true,
|
|
1210
|
+
attributeFilter: ['data-theme']
|
|
1211
|
+
});
|
|
1174
1212
|
|
|
1175
1213
|
var themedValue = function themedValue(defaultThemeValue, newThemeValue) {
|
|
1176
1214
|
return theme === 'default' ? defaultThemeValue : newThemeValue;
|
|
@@ -1179,30 +1217,16 @@ var useTheme = function useTheme() {
|
|
|
1179
1217
|
|
|
1180
1218
|
|
|
1181
1219
|
react.useEffect(function () {
|
|
1182
|
-
var
|
|
1183
|
-
var observer = observerRef.current;
|
|
1184
|
-
|
|
1185
|
-
if (themeDomNode) {
|
|
1186
|
-
// We need to read the current theme after the provider is rendered
|
|
1187
|
-
// to have the actual selected theme (calculated client-side) in the
|
|
1188
|
-
// hook local state
|
|
1189
|
-
var nextTheme = themeDomNode.dataset.theme;
|
|
1190
|
-
|
|
1191
|
-
if (nextTheme) {
|
|
1192
|
-
setTheme(nextTheme);
|
|
1193
|
-
} // We observe the theme DOM node for changes in its `data-theme`
|
|
1194
|
-
// attribute, which is the one we update in the `applyTheme` function
|
|
1220
|
+
var _parentSelectorRef$cu;
|
|
1195
1221
|
|
|
1222
|
+
// We need to read the current theme after the provider is rendered
|
|
1223
|
+
// to have the actual selected theme (calculated client-side) in the
|
|
1224
|
+
// hook local state
|
|
1225
|
+
var nextTheme = (_parentSelectorRef$cu = parentSelectorRef.current()) === null || _parentSelectorRef$cu === void 0 ? void 0 : _parentSelectorRef$cu.dataset.theme;
|
|
1196
1226
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
attributeFilter: ['data-theme']
|
|
1200
|
-
});
|
|
1227
|
+
if (nextTheme) {
|
|
1228
|
+
setTheme(nextTheme);
|
|
1201
1229
|
}
|
|
1202
|
-
|
|
1203
|
-
return function () {
|
|
1204
|
-
return observer.disconnect();
|
|
1205
|
-
};
|
|
1206
1230
|
}, []);
|
|
1207
1231
|
return {
|
|
1208
1232
|
theme: theme,
|
|
@@ -1220,7 +1244,7 @@ var withThemeContext = function withThemeContext(WrappedComponent) {
|
|
|
1220
1244
|
};
|
|
1221
1245
|
|
|
1222
1246
|
// NOTE: This string will be replaced on build time with the package version.
|
|
1223
|
-
var version = "15.
|
|
1247
|
+
var version = "15.12.0";
|
|
1224
1248
|
|
|
1225
1249
|
exports.ThemeProvider = ThemeProvider;
|
|
1226
1250
|
exports.customProperties = designTokens$1;
|
|
@@ -19,6 +19,7 @@ var react = require('react');
|
|
|
19
19
|
var isObject = require('lodash/isObject');
|
|
20
20
|
var merge = require('lodash/merge');
|
|
21
21
|
var isEqual = require('lodash/isEqual');
|
|
22
|
+
var hooks = require('@commercetools-uikit/hooks');
|
|
22
23
|
var _Object$fromEntries = require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
|
|
23
24
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
24
25
|
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
@@ -181,6 +182,7 @@ var themes = {
|
|
|
181
182
|
breakPointBiggerdesktop: '1280px',
|
|
182
183
|
breakPointGiantdesktop: '1680px',
|
|
183
184
|
breakPointJumbodesktop: '1920px',
|
|
185
|
+
alignItemsForSelectInputTag: 'unset',
|
|
184
186
|
backgroundColorForButtonWhenActive: '#fff',
|
|
185
187
|
backgroundColorForButtonWhenHovered: '#fff',
|
|
186
188
|
backgroundColorForButtonAsPrimaryWhenActive: '#00b39e',
|
|
@@ -229,6 +231,7 @@ var themes = {
|
|
|
229
231
|
borderForCardWhenRaised: 'none',
|
|
230
232
|
borderForCollapsiblePanelHeaderIconWhenDisabled: '1px solid var(--color-neutral)',
|
|
231
233
|
borderForViewSwitcher: 'none',
|
|
234
|
+
borderForSelectInputTag: 'none',
|
|
232
235
|
borderColorForInput: 'hsl(0, 0%, 60%)',
|
|
233
236
|
borderColorForInputWhenFocused: '#00b39e',
|
|
234
237
|
borderColorForInputWhenDisabled: '#ccc',
|
|
@@ -315,12 +318,14 @@ var themes = {
|
|
|
315
318
|
fontColorForContentNotificationIconWhenSuccess: '#fff',
|
|
316
319
|
fontColorForContentNotificationIconWhenInfo: '#fff',
|
|
317
320
|
fontColorForSearchInputIcon: '#1a1a1a',
|
|
318
|
-
fontColorForSearchInputIconWhenHovered: '#
|
|
321
|
+
fontColorForSearchInputIconWhenHovered: '#00b39e',
|
|
319
322
|
fontColorForSelectInputIcon: '#1a1a1a',
|
|
320
323
|
fontColorForSelectInputWhenError: '#1a1a1a',
|
|
321
324
|
fontColorForSelectInputWhenWarning: '#1a1a1a',
|
|
322
325
|
fontColorForSelectInputIconWhenError: '#1a1a1a',
|
|
323
326
|
fontColorForSelectInputIconWhenWarning: '#1a1a1a',
|
|
327
|
+
fontColorForMoneyInputCurrencyDropdownIndicator: '#1a1a1a',
|
|
328
|
+
fontColorForSearchInputIconWhenReadonly: 'hsl(0, 0%, 60%)',
|
|
324
329
|
heightForButtonAsBig: '32px',
|
|
325
330
|
heightForButtonAsSmall: '24px',
|
|
326
331
|
heightForButtonAsIconAsBig: '32px',
|
|
@@ -329,7 +334,9 @@ var themes = {
|
|
|
329
334
|
heightForInput: '32px',
|
|
330
335
|
heightForViewSwitcher: '32px',
|
|
331
336
|
heightForViewSwitcherWhenCondensed: '24px',
|
|
337
|
+
heightForSelectInputTag: '26px',
|
|
332
338
|
widthForAvatarAsMedium: '48px',
|
|
339
|
+
minWidthForMoneyInputCurrencyDropdown: '72px',
|
|
333
340
|
placeholderFontColorForInput: 'hsl(0, 0%, 60%)',
|
|
334
341
|
fontSizeForButton: '1rem',
|
|
335
342
|
fontSizeForInput: '1rem',
|
|
@@ -350,6 +357,7 @@ var themes = {
|
|
|
350
357
|
fontSizeForAvatarAsBig: '3rem',
|
|
351
358
|
fontSizeForLocalizedMultilineTextInputLabel: '0.9231rem',
|
|
352
359
|
fontSizeForContentNotification: '1rem',
|
|
360
|
+
fontSizeForSelectInputTag: '0.9231rem',
|
|
353
361
|
iconColorForDatetimeInputIcon: '#1a1a1a',
|
|
354
362
|
iconColorForDatetimeInputIconWhenHovered: '#f16d0e',
|
|
355
363
|
lineHeightForTextAsH1: 'inherit',
|
|
@@ -374,6 +382,9 @@ var themes = {
|
|
|
374
382
|
marginForGroupHeadingSelectInputOptions: '4px',
|
|
375
383
|
marginForSelectInputIcon: '4px',
|
|
376
384
|
marginLeftForSelectInputIcon: 'inherit',
|
|
385
|
+
marginRightForMoneyInputPrecisionBadge: '4px',
|
|
386
|
+
marginRightForSearchInputIcon: '8px',
|
|
387
|
+
marginRightForClearInputIcon: '4px',
|
|
377
388
|
paddingForStamp: 'var(--spacing-10) var(--spacing-20)',
|
|
378
389
|
paddingForStampAsCondensed: '1px var(--spacing-10)',
|
|
379
390
|
paddingForTag: '5px var(--spacing-20)',
|
|
@@ -406,6 +417,7 @@ var themes = {
|
|
|
406
417
|
paddingBottomForSelectInputOptions: '4px',
|
|
407
418
|
paddingForGroupHeadingSelectInputOptions: '8px',
|
|
408
419
|
paddingForSelectInputMenu: 'inherit',
|
|
420
|
+
paddingForMoneyInputCurrencyDropdown: '0 var(--spacing-20)',
|
|
409
421
|
shadowForButton: '0 -1px 1.5px 0 rgba(0, 0, 0, 0.12), 0 1px 1px 0 rgba(0, 0, 0, 0.24)',
|
|
410
422
|
shadowForButtonWhenFocused: '0 1px 9.5px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24)',
|
|
411
423
|
shadowForButtonWhenHovered: '0 1px 9.5px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24)',
|
|
@@ -433,6 +445,7 @@ var themes = {
|
|
|
433
445
|
test: {
|
|
434
446
|
colorPrimary: '#00b39e',
|
|
435
447
|
fontFamily: "'Inter', system-ui",
|
|
448
|
+
alignItemsForSelectInputTag: 'center',
|
|
436
449
|
backgroundColorForButtonWhenActive: 'hsl(0deg 0% 10% / 10%)',
|
|
437
450
|
backgroundColorForButtonWhenHovered: 'hsl(0deg 0% 10% / 5%)',
|
|
438
451
|
backgroundColorForButtonAsPrimaryWhenActive: '#15A390',
|
|
@@ -475,6 +488,7 @@ var themes = {
|
|
|
475
488
|
borderForCardWhenRaised: '1px solid var(--color-neutral-90)',
|
|
476
489
|
borderForCollapsiblePanelHeaderIconWhenDisabled: 'none',
|
|
477
490
|
borderForViewSwitcher: '1px solid var(--color-neutral)',
|
|
491
|
+
borderForSelectInputTag: '1px solid var(--color-neutral-85)',
|
|
478
492
|
borderColorForInput: '#ccc',
|
|
479
493
|
borderColorForInputWhenDisabled: '#ccc',
|
|
480
494
|
borderColorForInputWhenHovered: '#ccc',
|
|
@@ -540,12 +554,12 @@ var themes = {
|
|
|
540
554
|
fontColorForClearInputIconWhenHovered: '#e60050',
|
|
541
555
|
fontColorForClearInputIcon: 'hsl(0, 0%, 40%)',
|
|
542
556
|
fontColorForSearchInputIcon: 'hsl(0, 0%, 60%)',
|
|
543
|
-
fontColorForSearchInputIconWhenHovered: '#00b39e',
|
|
544
557
|
fontColorForSelectInputIcon: 'hsl(0, 0%, 60%)',
|
|
545
558
|
fontColorForSelectInputWhenError: '#e60050',
|
|
546
559
|
fontColorForSelectInputWhenWarning: '#f16d0e',
|
|
547
560
|
fontColorForSelectInputIconWhenError: '#e60050',
|
|
548
561
|
fontColorForSelectInputIconWhenWarning: '#f16d0e',
|
|
562
|
+
fontColorForMoneyInputCurrencyDropdownIndicator: 'hsl(0, 0%, 40%)',
|
|
549
563
|
fontSizeForInput: '1rem',
|
|
550
564
|
fontSizeForTextAsH1: '1.5rem',
|
|
551
565
|
fontSizeForTextAsH2: '1.25rem',
|
|
@@ -564,6 +578,7 @@ var themes = {
|
|
|
564
578
|
fontSizeForAvatarAsMedium: '1rem',
|
|
565
579
|
fontSizeForAvatarAsBig: '2.5rem',
|
|
566
580
|
fontSizeForLocalizedMultilineTextInputLabel: '1rem',
|
|
581
|
+
fontSizeForSelectInputTag: '1rem',
|
|
567
582
|
lineHeightForTextAsH1: '2.125rem',
|
|
568
583
|
lineHeightForTextAsH2: '1.75rem',
|
|
569
584
|
lineHeightForTextAsH3: '1.5rem',
|
|
@@ -588,15 +603,20 @@ var themes = {
|
|
|
588
603
|
heightForInput: '40px',
|
|
589
604
|
heightForViewSwitcher: '40px',
|
|
590
605
|
heightForViewSwitcherWhenCondensed: '32px',
|
|
606
|
+
heightForSelectInputTag: '32px',
|
|
591
607
|
iconColorForDatetimeInputIcon: 'hsl(0, 0%, 40%)',
|
|
592
608
|
iconColorForDatetimeInputIconWhenHovered: '#e60050',
|
|
593
609
|
widthForAvatarAsMedium: '40px',
|
|
610
|
+
minWidthForMoneyInputCurrencyDropdown: '80px',
|
|
594
611
|
marginForTableHeader: '16px',
|
|
595
612
|
marginForTableCellAsCondensed: '8px',
|
|
596
613
|
marginForViewSwitcherIcon: '0 var(--spacing-20) 0 0',
|
|
597
614
|
marginForGroupHeadingSelectInputOptions: '8px',
|
|
598
615
|
marginForSelectInputIcon: '8px',
|
|
599
616
|
marginLeftForSelectInputIcon: '8px',
|
|
617
|
+
marginRightForMoneyInputPrecisionBadge: '12px',
|
|
618
|
+
marginRightForSearchInputIcon: '12px',
|
|
619
|
+
marginRightForClearInputIcon: '8px',
|
|
600
620
|
paddingForStamp: '4px 12px',
|
|
601
621
|
paddingForStampAsCondensed: '0 var(--spacing-20)',
|
|
602
622
|
paddingForTag: '2px 12px',
|
|
@@ -629,6 +649,7 @@ var themes = {
|
|
|
629
649
|
paddingBottomForSelectInputOptions: '8px',
|
|
630
650
|
paddingForGroupHeadingSelectInputOptions: '16px',
|
|
631
651
|
paddingForSelectInputMenu: 'var(--spacing-10) 0',
|
|
652
|
+
paddingForMoneyInputCurrencyDropdown: '0 12px',
|
|
632
653
|
shadowForButton: 'none',
|
|
633
654
|
shadowForButtonWhenFocused: 'none',
|
|
634
655
|
shadowForButtonWhenHovered: 'none',
|
|
@@ -772,6 +793,7 @@ var designTokens = {
|
|
|
772
793
|
breakPointBiggerdesktop: 'var(--break-point-biggerdesktop, 1280px)',
|
|
773
794
|
breakPointGiantdesktop: 'var(--break-point-giantdesktop, 1680px)',
|
|
774
795
|
breakPointJumbodesktop: 'var(--break-point-jumbodesktop, 1920px)',
|
|
796
|
+
alignItemsForSelectInputTag: 'var(--align-items-for-select-input-tag, unset)',
|
|
775
797
|
backgroundColorForButtonWhenActive: 'var(--background-color-for-button-when-active, #fff)',
|
|
776
798
|
backgroundColorForButtonWhenHovered: 'var(--background-color-for-button-when-hovered, #fff)',
|
|
777
799
|
backgroundColorForButtonAsPrimaryWhenActive: 'var(--background-color-for-button-as-primary-when-active, #00b39e)',
|
|
@@ -820,6 +842,7 @@ var designTokens = {
|
|
|
820
842
|
borderForCardWhenRaised: 'var(--border-for-card-when-raised, none)',
|
|
821
843
|
borderForCollapsiblePanelHeaderIconWhenDisabled: 'var(--border-for-collapsible-panel-header-icon-when-disabled, 1px solid var(--color-neutral))',
|
|
822
844
|
borderForViewSwitcher: 'var(--border-for-view-switcher, none)',
|
|
845
|
+
borderForSelectInputTag: 'var(--border-for-select-input-tag, none)',
|
|
823
846
|
borderColorForInput: 'var(--border-color-for-input, hsl(0, 0%, 60%))',
|
|
824
847
|
borderColorForInputWhenFocused: 'var(--border-color-for-input-when-focused, #00b39e)',
|
|
825
848
|
borderColorForInputWhenDisabled: 'var(--border-color-for-input-when-disabled, #ccc)',
|
|
@@ -906,12 +929,14 @@ var designTokens = {
|
|
|
906
929
|
fontColorForContentNotificationIconWhenSuccess: 'var(--font-color-for-content-notification-icon-when-success, #fff)',
|
|
907
930
|
fontColorForContentNotificationIconWhenInfo: 'var(--font-color-for-content-notification-icon-when-info, #fff)',
|
|
908
931
|
fontColorForSearchInputIcon: 'var(--font-color-for-search-input-icon, #1a1a1a)',
|
|
909
|
-
fontColorForSearchInputIconWhenHovered: 'var(--font-color-for-search-input-icon-when-hovered, #
|
|
932
|
+
fontColorForSearchInputIconWhenHovered: 'var(--font-color-for-search-input-icon-when-hovered, #00b39e)',
|
|
910
933
|
fontColorForSelectInputIcon: 'var(--font-color-for-select-input-icon, #1a1a1a)',
|
|
911
934
|
fontColorForSelectInputWhenError: 'var(--font-color-for-select-input-when-error, #1a1a1a)',
|
|
912
935
|
fontColorForSelectInputWhenWarning: 'var(--font-color-for-select-input-when-warning, #1a1a1a)',
|
|
913
936
|
fontColorForSelectInputIconWhenError: 'var(--font-color-for-select-input-icon-when-error, #1a1a1a)',
|
|
914
937
|
fontColorForSelectInputIconWhenWarning: 'var(--font-color-for-select-input-icon-when-warning, #1a1a1a)',
|
|
938
|
+
fontColorForMoneyInputCurrencyDropdownIndicator: 'var(--font-color-for-money-input-currency-dropdown-indicator, #1a1a1a)',
|
|
939
|
+
fontColorForSearchInputIconWhenReadonly: 'var(--font-color-for-search-input-icon-when-readonly, hsl(0, 0%, 60%))',
|
|
915
940
|
heightForButtonAsBig: 'var(--height-for-button-as-big, 32px)',
|
|
916
941
|
heightForButtonAsSmall: 'var(--height-for-button-as-small, 24px)',
|
|
917
942
|
heightForButtonAsIconAsBig: 'var(--height-for-button-as-icon-as-big, 32px)',
|
|
@@ -920,7 +945,9 @@ var designTokens = {
|
|
|
920
945
|
heightForInput: 'var(--height-for-input, 32px)',
|
|
921
946
|
heightForViewSwitcher: 'var(--height-for-view-switcher, 32px)',
|
|
922
947
|
heightForViewSwitcherWhenCondensed: 'var(--height-for-view-switcher-when-condensed, 24px)',
|
|
948
|
+
heightForSelectInputTag: 'var(--height-for-select-input-tag, 26px)',
|
|
923
949
|
widthForAvatarAsMedium: 'var(--width-for-avatar-as-medium, 48px)',
|
|
950
|
+
minWidthForMoneyInputCurrencyDropdown: 'var(--min-width-for-money-input-currency-dropdown, 72px)',
|
|
924
951
|
placeholderFontColorForInput: 'var(--placeholder-font-color-for-input, hsl(0, 0%, 60%))',
|
|
925
952
|
fontSizeForButton: 'var(--font-size-for-button, 1rem)',
|
|
926
953
|
fontSizeForInput: 'var(--font-size-for-input, 1rem)',
|
|
@@ -941,6 +968,7 @@ var designTokens = {
|
|
|
941
968
|
fontSizeForAvatarAsBig: 'var(--font-size-for-avatar-as-big, 3rem)',
|
|
942
969
|
fontSizeForLocalizedMultilineTextInputLabel: 'var(--font-size-for-localized-multiline-text-input-label, 0.9231rem)',
|
|
943
970
|
fontSizeForContentNotification: 'var(--font-size-for-content-notification, 1rem)',
|
|
971
|
+
fontSizeForSelectInputTag: 'var(--font-size-for-select-input-tag, 0.9231rem)',
|
|
944
972
|
iconColorForDatetimeInputIcon: 'var(--icon-color-for-datetime-input-icon, #1a1a1a)',
|
|
945
973
|
iconColorForDatetimeInputIconWhenHovered: 'var(--icon-color-for-datetime-input-icon-when-hovered, #f16d0e)',
|
|
946
974
|
lineHeightForTextAsH1: 'var(--line-height-for-text-as-h-1, inherit)',
|
|
@@ -965,6 +993,9 @@ var designTokens = {
|
|
|
965
993
|
marginForGroupHeadingSelectInputOptions: 'var(--margin-for-group-heading-select-input-options, 4px)',
|
|
966
994
|
marginForSelectInputIcon: 'var(--margin-for-select-input-icon, 4px)',
|
|
967
995
|
marginLeftForSelectInputIcon: 'var(--margin-left-for-select-input-icon, inherit)',
|
|
996
|
+
marginRightForMoneyInputPrecisionBadge: 'var(--margin-right-for-money-input-precision-badge, 4px)',
|
|
997
|
+
marginRightForSearchInputIcon: 'var(--margin-right-for-search-input-icon, 8px)',
|
|
998
|
+
marginRightForClearInputIcon: 'var(--margin-right-for-clear-input-icon, 4px)',
|
|
968
999
|
paddingForStamp: 'var(--padding-for-stamp, var(--spacing-10) var(--spacing-20))',
|
|
969
1000
|
paddingForStampAsCondensed: 'var(--padding-for-stamp-as-condensed, 1px var(--spacing-10))',
|
|
970
1001
|
paddingForTag: 'var(--padding-for-tag, 5px var(--spacing-20))',
|
|
@@ -997,6 +1028,7 @@ var designTokens = {
|
|
|
997
1028
|
paddingBottomForSelectInputOptions: 'var(--padding-bottom-for-select-input-options, 4px)',
|
|
998
1029
|
paddingForGroupHeadingSelectInputOptions: 'var(--padding-for-group-heading-select-input-options, 8px)',
|
|
999
1030
|
paddingForSelectInputMenu: 'var(--padding-for-select-input-menu, inherit)',
|
|
1031
|
+
paddingForMoneyInputCurrencyDropdown: 'var(--padding-for-money-input-currency-dropdown, 0 var(--spacing-20))',
|
|
1000
1032
|
shadowForButton: 'var(--shadow-for-button, 0 -1px 1.5px 0 rgba(0, 0, 0, 0.12), 0 1px 1px 0 rgba(0, 0, 0, 0.24))',
|
|
1001
1033
|
shadowForButtonWhenFocused: 'var(--shadow-for-button-when-focused, 0 1px 9.5px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24))',
|
|
1002
1034
|
shadowForButtonWhenHovered: 'var(--shadow-for-button-when-hovered, 0 1px 9.5px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24))',
|
|
@@ -1165,12 +1197,18 @@ var useTheme = function useTheme() {
|
|
|
1165
1197
|
setTheme = _useState2[1];
|
|
1166
1198
|
|
|
1167
1199
|
var parentSelectorRef = react.useRef(parentSelector);
|
|
1168
|
-
var
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1200
|
+
var mutationChangeCallback = react.useCallback(function (mutationList) {
|
|
1201
|
+
// We expect only a single element in the mutation list as we configured the
|
|
1202
|
+
// observer to only listen to `data-theme` changes.
|
|
1203
|
+
var _mutationList = _slicedToArray(mutationList, 1),
|
|
1204
|
+
mutationEvent = _mutationList[0];
|
|
1205
|
+
|
|
1206
|
+
setTheme(mutationEvent.target.dataset.theme);
|
|
1207
|
+
}, []);
|
|
1208
|
+
hooks.useMutationObserver(parentSelector(), mutationChangeCallback, {
|
|
1209
|
+
attributes: true,
|
|
1210
|
+
attributeFilter: ['data-theme']
|
|
1211
|
+
});
|
|
1174
1212
|
|
|
1175
1213
|
var themedValue = function themedValue(defaultThemeValue, newThemeValue) {
|
|
1176
1214
|
return theme === 'default' ? defaultThemeValue : newThemeValue;
|
|
@@ -1179,30 +1217,16 @@ var useTheme = function useTheme() {
|
|
|
1179
1217
|
|
|
1180
1218
|
|
|
1181
1219
|
react.useEffect(function () {
|
|
1182
|
-
var
|
|
1183
|
-
var observer = observerRef.current;
|
|
1184
|
-
|
|
1185
|
-
if (themeDomNode) {
|
|
1186
|
-
// We need to read the current theme after the provider is rendered
|
|
1187
|
-
// to have the actual selected theme (calculated client-side) in the
|
|
1188
|
-
// hook local state
|
|
1189
|
-
var nextTheme = themeDomNode.dataset.theme;
|
|
1190
|
-
|
|
1191
|
-
if (nextTheme) {
|
|
1192
|
-
setTheme(nextTheme);
|
|
1193
|
-
} // We observe the theme DOM node for changes in its `data-theme`
|
|
1194
|
-
// attribute, which is the one we update in the `applyTheme` function
|
|
1220
|
+
var _parentSelectorRef$cu;
|
|
1195
1221
|
|
|
1222
|
+
// We need to read the current theme after the provider is rendered
|
|
1223
|
+
// to have the actual selected theme (calculated client-side) in the
|
|
1224
|
+
// hook local state
|
|
1225
|
+
var nextTheme = (_parentSelectorRef$cu = parentSelectorRef.current()) === null || _parentSelectorRef$cu === void 0 ? void 0 : _parentSelectorRef$cu.dataset.theme;
|
|
1196
1226
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
attributeFilter: ['data-theme']
|
|
1200
|
-
});
|
|
1227
|
+
if (nextTheme) {
|
|
1228
|
+
setTheme(nextTheme);
|
|
1201
1229
|
}
|
|
1202
|
-
|
|
1203
|
-
return function () {
|
|
1204
|
-
return observer.disconnect();
|
|
1205
|
-
};
|
|
1206
1230
|
}, []);
|
|
1207
1231
|
return {
|
|
1208
1232
|
theme: theme,
|
|
@@ -1220,7 +1244,7 @@ var withThemeContext = function withThemeContext(WrappedComponent) {
|
|
|
1220
1244
|
};
|
|
1221
1245
|
|
|
1222
1246
|
// NOTE: This string will be replaced on build time with the package version.
|
|
1223
|
-
var version = "15.
|
|
1247
|
+
var version = "15.12.0";
|
|
1224
1248
|
|
|
1225
1249
|
exports.ThemeProvider = ThemeProvider;
|
|
1226
1250
|
exports.customProperties = designTokens$1;
|