@dxc-technology/halstack-react 0.0.0-2c43bcf → 0.0.0-2c7db3b
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/HalstackContext.d.ts +23 -0
- package/HalstackContext.js +26 -16
- package/common/coreTokens.d.ts +0 -1
- package/common/coreTokens.js +0 -1
- package/common/variables.d.ts +29 -0
- package/common/variables.js +25 -2
- package/contextual-menu/ContextualMenu.js +56 -8
- package/contextual-menu/ContextualMenu.stories.tsx +50 -51
- package/contextual-menu/ContextualMenu.test.js +108 -66
- package/contextual-menu/GroupItem.js +9 -9
- package/contextual-menu/ItemAction.d.ts +1 -1
- package/contextual-menu/ItemAction.js +52 -15
- package/contextual-menu/SingleItem.d.ts +1 -1
- package/contextual-menu/SingleItem.js +14 -14
- package/contextual-menu/types.d.ts +9 -6
- package/divider/Divider.stories.tsx +2 -1
- package/icon/Icon.stories.tsx +1 -1
- package/number-input/NumberInput.js +5 -2
- package/number-input/NumberInput.stories.tsx +9 -0
- package/package.json +4 -3
- package/password-input/PasswordInput.js +6 -3
- package/password-input/PasswordInput.stories.tsx +9 -0
- package/resultset-table/ResultsetTable.js +33 -9
- package/resultset-table/ResultsetTable.stories.tsx +1 -1
- package/resultset-table/ResultsetTable.test.js +101 -30
- package/select/Select.js +3 -1
- package/select/Select.stories.tsx +10 -1
- package/text-input/TextInput.js +3 -1
- package/text-input/TextInput.stories.tsx +9 -0
- package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
- package/tooltip/Tooltip.accessibility.test.js +144 -0
- package/tooltip/Tooltip.d.ts +4 -0
- package/tooltip/Tooltip.js +50 -0
- package/tooltip/Tooltip.stories.tsx +111 -0
- package/tooltip/Tooltip.test.d.ts +1 -0
- package/tooltip/Tooltip.test.js +112 -0
- package/tooltip/types.d.ts +16 -0
- package/tooltip/types.js +5 -0
- package/useTheme.d.ts +23 -0
package/HalstackContext.d.ts
CHANGED
|
@@ -219,6 +219,29 @@ declare const HalstackContext: React.Context<DeepPartial<{
|
|
|
219
219
|
focusBorderThickness: string;
|
|
220
220
|
focusBorderRadius: string;
|
|
221
221
|
};
|
|
222
|
+
contextualMenu: {
|
|
223
|
+
fontFamily: string;
|
|
224
|
+
backgroundColor: string;
|
|
225
|
+
borderColor: string;
|
|
226
|
+
menuItemFontColor: string;
|
|
227
|
+
menuItemFontSize: string;
|
|
228
|
+
menuItemFontStyle: string;
|
|
229
|
+
menuItemFontWeight: string;
|
|
230
|
+
menuItemLineHeight: string;
|
|
231
|
+
hoverMenuItemBackgroundColor: string;
|
|
232
|
+
activeMenuItemBackgroundColor: string;
|
|
233
|
+
selectedMenuItemBackgroundColor: string;
|
|
234
|
+
hoverSelectedMenuItemBackgroundColor: string;
|
|
235
|
+
activeSelectedMenuItemBackgroundColor: string;
|
|
236
|
+
selectedMenuItemFontWeight: string;
|
|
237
|
+
sectionTitleFontColor: string;
|
|
238
|
+
sectionTitleFontSize: string;
|
|
239
|
+
sectionTitleFontStyle: string;
|
|
240
|
+
sectionTitleFontWeight: string;
|
|
241
|
+
sectionTitleLineHeight: string;
|
|
242
|
+
iconColor: string;
|
|
243
|
+
iconSize: string;
|
|
244
|
+
};
|
|
222
245
|
dateInput: {
|
|
223
246
|
pickerBackgroundColor: string;
|
|
224
247
|
pickerFontColor: string;
|
package/HalstackContext.js
CHANGED
|
@@ -54,7 +54,7 @@ var parseAdvancedTheme = function parseAdvancedTheme(advancedTheme) {
|
|
|
54
54
|
return allTokensCopy;
|
|
55
55
|
};
|
|
56
56
|
var parseTheme = function parseTheme(theme) {
|
|
57
|
-
var _theme$alert$baseColo, _theme$alert, _theme$alert$accentCo, _theme$alert2, _theme$alert$accentCo2, _theme$alert3, _theme$alert$overlayC, _theme$alert4, _theme$accordion$assi, _theme$accordion, _theme$accordion$titl, _theme$accordion2, _theme$accordion$acce, _theme$accordion3, _theme$accordion$acce2, _theme$accordion4, _addLightness, _theme$accordion5, _theme$box$baseColor, _theme$box, _theme$button$primary, _theme$button, _theme$button$baseCol, _theme$button2, _theme$button$baseCol2, _theme$button3, _theme$button$seconda, _theme$button4, _theme$button$baseCol3, _theme$button5, _theme$button$baseCol4, _theme$button6, _theme$button$baseCol5, _theme$button7, _subLightness, _theme$button8, _subLightness2, _theme$button9, _subLightness3, _theme$button10, _addLightness2, _theme$button11, _addLightness3, _theme$button12, _theme$checkbox$baseC, _theme$checkbox, _theme$checkbox$baseC2, _theme$checkbox2, _theme$checkbox$check, _theme$checkbox3, _theme$checkbox$fontC, _theme$checkbox4, _subLightness4, _theme$checkbox5, _subLightness5, _theme$checkbox6, _theme$chip$baseColor, _theme$chip, _theme$chip$fontColor, _theme$chip2, _theme$chip$iconColor, _theme$chip3, _subLightness6, _theme$chip4, _subLightness7, _theme$chip5, _theme$dateInput$base, _theme$dateInput, _theme$dateInput$sele, _theme$dateInput2,
|
|
57
|
+
var _theme$alert$baseColo, _theme$alert, _theme$alert$accentCo, _theme$alert2, _theme$alert$accentCo2, _theme$alert3, _theme$alert$overlayC, _theme$alert4, _theme$accordion$assi, _theme$accordion, _theme$accordion$titl, _theme$accordion2, _theme$accordion$acce, _theme$accordion3, _theme$accordion$acce2, _theme$accordion4, _addLightness, _theme$accordion5, _theme$box$baseColor, _theme$box, _theme$button$primary, _theme$button, _theme$button$baseCol, _theme$button2, _theme$button$baseCol2, _theme$button3, _theme$button$seconda, _theme$button4, _theme$button$baseCol3, _theme$button5, _theme$button$baseCol4, _theme$button6, _theme$button$baseCol5, _theme$button7, _subLightness, _theme$button8, _subLightness2, _theme$button9, _subLightness3, _theme$button10, _addLightness2, _theme$button11, _addLightness3, _theme$button12, _theme$checkbox$baseC, _theme$checkbox, _theme$checkbox$baseC2, _theme$checkbox2, _theme$checkbox$check, _theme$checkbox3, _theme$checkbox$fontC, _theme$checkbox4, _subLightness4, _theme$checkbox5, _subLightness5, _theme$checkbox6, _theme$chip$baseColor, _theme$chip, _theme$chip$fontColor, _theme$chip2, _theme$chip$iconColor, _theme$chip3, _subLightness6, _theme$chip4, _subLightness7, _theme$chip5, _theme$contextualMenu, _theme$contextualMenu2, _subLightness8, _theme$contextualMenu3, _subLightness9, _theme$contextualMenu4, _theme$contextualMenu5, _theme$contextualMenu6, _subLightness10, _theme$contextualMenu7, _subLightness11, _theme$contextualMenu8, _theme$contextualMenu9, _theme$contextualMenu10, _theme$contextualMenu11, _theme$contextualMenu12, _theme$contextualMenu13, _theme$contextualMenu14, _theme$dateInput$base, _theme$dateInput, _theme$dateInput$sele, _theme$dateInput2, _subLightness12, _theme$dateInput3, _theme$dateInput$sele2, _theme$dateInput4, _theme$dateInput$base2, _theme$dateInput5, _subLightness13, _theme$dateInput6, _theme$dateInput$sele3, _theme$dateInput7, _addLightness4, _theme$dateInput8, _addLightness5, _theme$dateInput9, _addLightness6, _theme$dateInput10, _theme$dialog$baseCol, _theme$dialog, _theme$dialog$closeIc, _theme$dialog2, _theme$dialog$overlay, _theme$dialog3, _theme$dropdown$baseC, _theme$dropdown, _theme$dropdown$fontC, _theme$dropdown2, _theme$dropdown$fontC2, _theme$dropdown3, _theme$dropdown$fontC3, _theme$dropdown4, _theme$dropdown$optio, _theme$dropdown5, _theme$dropdown$optio2, _theme$dropdown6, _subLightness14, _theme$dropdown7, _subLightness15, _theme$dropdown8, _subLightness16, _theme$dropdown9, _subLightness17, _theme$dropdown10, _theme$fileInput$font, _theme$fileInput, _theme$fileInput$font2, _theme$fileInput2, _theme$fileInput$font3, _theme$fileInput3, _theme$fileInput$font4, _theme$fileInput4, _theme$footer$baseCol, _theme$footer, _theme$footer$fontCol, _theme$footer2, _theme$footer$fontCol2, _theme$footer3, _theme$footer$fontCol3, _theme$footer4, _theme$footer$accentC, _theme$footer5, _theme$footer$logo, _theme$footer6, _theme$header$baseCol, _theme$header, _theme$header$accentC, _theme$header2, _theme$header$menuBas, _theme$header3, _theme$header$fontCol, _theme$header4, _theme$header$hamburg, _theme$header5, _addLightness7, _theme$header6, _theme$header$logo, _theme$header7, _theme$header$logoRes, _theme$header8, _theme$header$content, _theme$header9, _theme$header$overlay, _theme$header10, _theme$link$baseColor, _theme$link, _theme$link$baseColor2, _theme$link2, _theme$navTabs$baseCo, _theme$navTabs, _theme$navTabs$baseCo2, _theme$navTabs2, _theme$navTabs$baseCo3, _theme$navTabs3, _theme$navTabs$baseCo4, _theme$navTabs4, _theme$navTabs$accent, _theme$navTabs5, _addLightness8, _theme$navTabs6, _addLightness9, _theme$navTabs7, _theme$paginator$base, _theme$paginator, _theme$paginator$font, _theme$paginator2, _theme$progressBar$ac, _theme$progressBar, _theme$progressBar$ba, _theme$progressBar2, _theme$progressBar$fo, _theme$progressBar3, _theme$progressBar$fo2, _theme$progressBar4, _theme$progressBar$fo3, _theme$progressBar5, _theme$progressBar$ov, _theme$progressBar6, _theme$progressBar$ov2, _theme$progressBar7, _theme$quickNav$fontC, _theme$quickNav, _theme$quickNav$accen, _theme$quickNav2, _theme$radioGroup$bas, _theme$radioGroup, _theme$radioGroup$fon, _theme$radioGroup2, _theme$radioGroup$fon2, _theme$radioGroup3, _theme$radioGroup$fon3, _theme$radioGroup4, _subLightness18, _theme$radioGroup5, _subLightness19, _theme$radioGroup6, _theme$select$selecte, _theme$select, _theme$select$fontCol, _theme$select2, _theme$select$fontCol2, _theme$select3, _theme$select$fontCol3, _theme$select4, _theme$select$optionF, _theme$select5, _addLightness10, _theme$select6, _theme$select$fontCol4, _theme$select7, _theme$select$hoverBo, _theme$select8, _subLightness20, _theme$select9, _subLightness21, _theme$select10, _theme$sidenav$baseCo, _theme$sidenav, _theme$slider$fontCol, _theme$slider, _theme$slider$fontCol2, _theme$slider2, _theme$slider$fontCol3, _theme$slider3, _theme$slider$baseCol, _theme$slider4, _theme$slider$baseCol2, _theme$slider5, _theme$slider$baseCol3, _theme$slider6, _theme$slider$baseCol4, _theme$slider7, _theme$slider$totalLi, _theme$slider8, _subLightness22, _theme$slider9, _subLightness23, _theme$slider10, _theme$spinner$accent, _theme$spinner, _theme$spinner$baseCo, _theme$spinner2, _theme$spinner$overla, _theme$spinner3, _theme$spinner$fontCo, _theme$spinner4, _theme$spinner$fontCo2, _theme$spinner5, _theme$spinner$overla2, _theme$spinner6, _theme$spinner$overla3, _theme$spinner7, _theme$switch$checked, _theme$switch, _theme$switch$fontCol, _theme$switch2, _addLightness11, _theme$switch3, _theme$table$baseColo, _theme$table, _theme$table$headerFo, _theme$table2, _theme$table$cellFont, _theme$table3, _theme$table$headerFo2, _theme$table4, _theme$tabs$baseColor, _theme$tabs, _theme$tabs$baseColor2, _theme$tabs2, _theme$tabs$baseColor3, _theme$tabs3, _theme$tabs$baseColor4, _theme$tabs4, _addLightness12, _theme$tabs5, _addLightness13, _theme$tabs6, _theme$tag$fontColor, _theme$tag, _theme$tag$iconColor, _theme$tag2, _theme$textInput$font, _theme$textInput, _theme$textInput$font2, _theme$textInput2, _theme$textInput$font3, _theme$textInput3, _theme$textInput$font4, _theme$textInput4, _theme$textInput$font5, _theme$textInput5, _theme$textInput$font6, _theme$textInput6, _theme$textInput$font7, _theme$textInput7, _theme$textInput$hove, _theme$textInput8, _addLightness14, _theme$textInput9, _addLightness15, _theme$textInput10, _addLightness16, _theme$textInput11, _theme$textarea$fontC, _theme$textarea, _theme$textarea$fontC2, _theme$textarea2, _theme$textarea$fontC3, _theme$textarea3, _theme$textarea$hover, _theme$textarea4, _addLightness17, _theme$textarea5, _theme$toggleGroup$se, _theme$toggleGroup, _theme$toggleGroup$se2, _theme$toggleGroup2, _theme$toggleGroup$un, _theme$toggleGroup3, _theme$toggleGroup$se3, _theme$toggleGroup4, _theme$toggleGroup$un2, _theme$toggleGroup5, _subLightness24, _theme$toggleGroup6, _subLightness25, _theme$toggleGroup7, _addLightness18, _theme$toggleGroup8, _addLightness19, _theme$toggleGroup9, _subLightness26, _theme$toggleGroup10, _theme$wizard$baseCol, _theme$wizard, _theme$wizard$selecte, _theme$wizard2, _theme$wizard$baseCol2, _theme$wizard3, _theme$wizard$fontCol, _theme$wizard4, _theme$wizard$fontCol2, _theme$wizard5, _theme$wizard$fontCol3, _theme$wizard6, _theme$wizard$fontCol4, _theme$wizard7, _addLightness20, _theme$wizard8, _addLightness21, _theme$wizard9, _addLightness22, _theme$wizard10, _addLightness23, _theme$wizard11;
|
|
58
58
|
var componentTokensCopy = JSON.parse(JSON.stringify(_variables.componentTokens));
|
|
59
59
|
var alertTokens = componentTokensCopy.alert;
|
|
60
60
|
alertTokens.infoBackgroundColor = (_theme$alert$baseColo = theme === null || theme === void 0 ? void 0 : (_theme$alert = theme.alert) === null || _theme$alert === void 0 ? void 0 : _theme$alert.baseColor) !== null && _theme$alert$baseColo !== void 0 ? _theme$alert$baseColo : alertTokens.infoBackgroundColor;
|
|
@@ -95,13 +95,23 @@ var parseTheme = function parseTheme(theme) {
|
|
|
95
95
|
chipTokens.iconColor = (_theme$chip$iconColor = theme === null || theme === void 0 ? void 0 : (_theme$chip3 = theme.chip) === null || _theme$chip3 === void 0 ? void 0 : _theme$chip3.iconColor) !== null && _theme$chip$iconColor !== void 0 ? _theme$chip$iconColor : chipTokens.iconColor;
|
|
96
96
|
chipTokens.hoverIconColor = (_subLightness6 = subLightness(10, theme === null || theme === void 0 ? void 0 : (_theme$chip4 = theme.chip) === null || _theme$chip4 === void 0 ? void 0 : _theme$chip4.iconColor)) !== null && _subLightness6 !== void 0 ? _subLightness6 : chipTokens.hoverIconColor;
|
|
97
97
|
chipTokens.activeIconColor = (_subLightness7 = subLightness(30, theme === null || theme === void 0 ? void 0 : (_theme$chip5 = theme.chip) === null || _theme$chip5 === void 0 ? void 0 : _theme$chip5.iconColor)) !== null && _subLightness7 !== void 0 ? _subLightness7 : chipTokens.activeIconColor;
|
|
98
|
+
var contextualMenu = componentTokensCopy.contextualMenu;
|
|
99
|
+
contextualMenu.selectedMenuItemBackgroundColor = (_theme$contextualMenu = theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu2 = theme.contextualMenu) === null || _theme$contextualMenu2 === void 0 ? void 0 : _theme$contextualMenu2.accentColor) !== null && _theme$contextualMenu !== void 0 ? _theme$contextualMenu : contextualMenu.selectedMenuItemBackgroundColor;
|
|
100
|
+
contextualMenu.hoverSelectedMenuItemBackgroundColor = (_subLightness8 = subLightness(5, theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu3 = theme.contextualMenu) === null || _theme$contextualMenu3 === void 0 ? void 0 : _theme$contextualMenu3.accentColor)) !== null && _subLightness8 !== void 0 ? _subLightness8 : contextualMenu.hoverSelectedMenuItemBackgroundColor;
|
|
101
|
+
contextualMenu.activeSelectedMenuItemBackgroundColor = (_subLightness9 = subLightness(5, theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu4 = theme.contextualMenu) === null || _theme$contextualMenu4 === void 0 ? void 0 : _theme$contextualMenu4.accentColor)) !== null && _subLightness9 !== void 0 ? _subLightness9 : contextualMenu.activeSelectedMenuItemBackgroundColor;
|
|
102
|
+
contextualMenu.backgroundColor = (_theme$contextualMenu5 = theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu6 = theme.contextualMenu) === null || _theme$contextualMenu6 === void 0 ? void 0 : _theme$contextualMenu6.baseColor) !== null && _theme$contextualMenu5 !== void 0 ? _theme$contextualMenu5 : contextualMenu.backgroundColor;
|
|
103
|
+
contextualMenu.hoverMenuItemBackgroundColor = (_subLightness10 = subLightness(5, theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu7 = theme.contextualMenu) === null || _theme$contextualMenu7 === void 0 ? void 0 : _theme$contextualMenu7.baseColor)) !== null && _subLightness10 !== void 0 ? _subLightness10 : contextualMenu.hoverMenuItemBackgroundColor;
|
|
104
|
+
contextualMenu.activeMenuItemBackgroundColor = (_subLightness11 = subLightness(5, theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu8 = theme.contextualMenu) === null || _theme$contextualMenu8 === void 0 ? void 0 : _theme$contextualMenu8.baseColor)) !== null && _subLightness11 !== void 0 ? _subLightness11 : contextualMenu.activeMenuItemBackgroundColor;
|
|
105
|
+
contextualMenu.menuItemFontColor = (_theme$contextualMenu9 = theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu10 = theme.contextualMenu) === null || _theme$contextualMenu10 === void 0 ? void 0 : _theme$contextualMenu10.fontColor) !== null && _theme$contextualMenu9 !== void 0 ? _theme$contextualMenu9 : contextualMenu.menuItemFontColor;
|
|
106
|
+
contextualMenu.sectionTitleFontColor = (_theme$contextualMenu11 = theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu12 = theme.contextualMenu) === null || _theme$contextualMenu12 === void 0 ? void 0 : _theme$contextualMenu12.fontColor) !== null && _theme$contextualMenu11 !== void 0 ? _theme$contextualMenu11 : contextualMenu.sectionTitleFontColor;
|
|
107
|
+
contextualMenu.iconColor = (_theme$contextualMenu13 = theme === null || theme === void 0 ? void 0 : (_theme$contextualMenu14 = theme.contextualMenu) === null || _theme$contextualMenu14 === void 0 ? void 0 : _theme$contextualMenu14.iconColor) !== null && _theme$contextualMenu13 !== void 0 ? _theme$contextualMenu13 : contextualMenu.iconColor;
|
|
98
108
|
var dateTokens = componentTokensCopy.dateInput;
|
|
99
109
|
dateTokens.pickerSelectedBackgroundColor = (_theme$dateInput$base = theme === null || theme === void 0 ? void 0 : (_theme$dateInput = theme.dateInput) === null || _theme$dateInput === void 0 ? void 0 : _theme$dateInput.baseColor) !== null && _theme$dateInput$base !== void 0 ? _theme$dateInput$base : dateTokens.pickerSelectedBackgroundColor;
|
|
100
110
|
dateTokens.pickerSelectedFontColor = (_theme$dateInput$sele = theme === null || theme === void 0 ? void 0 : (_theme$dateInput2 = theme.dateInput) === null || _theme$dateInput2 === void 0 ? void 0 : _theme$dateInput2.selectedFontColor) !== null && _theme$dateInput$sele !== void 0 ? _theme$dateInput$sele : dateTokens.pickerSelectedFontColor;
|
|
101
|
-
dateTokens.pickerActiveBackgroundColor = (
|
|
111
|
+
dateTokens.pickerActiveBackgroundColor = (_subLightness12 = subLightness(8, theme === null || theme === void 0 ? void 0 : (_theme$dateInput3 = theme.dateInput) === null || _theme$dateInput3 === void 0 ? void 0 : _theme$dateInput3.baseColor)) !== null && _subLightness12 !== void 0 ? _subLightness12 : dateTokens.pickerActiveBackgroundColor;
|
|
102
112
|
dateTokens.pickerActiveFontColor = (_theme$dateInput$sele2 = theme === null || theme === void 0 ? void 0 : (_theme$dateInput4 = theme.dateInput) === null || _theme$dateInput4 === void 0 ? void 0 : _theme$dateInput4.selectedFontColor) !== null && _theme$dateInput$sele2 !== void 0 ? _theme$dateInput$sele2 : dateTokens.pickerActiveFontColor;
|
|
103
113
|
dateTokens.pickerCurrentYearFontColor = (_theme$dateInput$base2 = theme === null || theme === void 0 ? void 0 : (_theme$dateInput5 = theme.dateInput) === null || _theme$dateInput5 === void 0 ? void 0 : _theme$dateInput5.baseColor) !== null && _theme$dateInput$base2 !== void 0 ? _theme$dateInput$base2 : dateTokens.pickerCurrentYearFontColor;
|
|
104
|
-
dateTokens.pickerHeaderActiveBackgroundColor = (
|
|
114
|
+
dateTokens.pickerHeaderActiveBackgroundColor = (_subLightness13 = subLightness(8, theme === null || theme === void 0 ? void 0 : (_theme$dateInput6 = theme.dateInput) === null || _theme$dateInput6 === void 0 ? void 0 : _theme$dateInput6.baseColor)) !== null && _subLightness13 !== void 0 ? _subLightness13 : dateTokens.pickerHeaderActiveBackgroundColor;
|
|
105
115
|
dateTokens.pickerHeaderActiveFontColor = (_theme$dateInput$sele3 = theme === null || theme === void 0 ? void 0 : (_theme$dateInput7 = theme.dateInput) === null || _theme$dateInput7 === void 0 ? void 0 : _theme$dateInput7.selectedFontColor) !== null && _theme$dateInput$sele3 !== void 0 ? _theme$dateInput$sele3 : dateTokens.pickerHeaderActiveFontColor;
|
|
106
116
|
dateTokens.pickerHoverBackgroundColor = (_addLightness4 = addLightness(52, theme === null || theme === void 0 ? void 0 : (_theme$dateInput8 = theme.dateInput) === null || _theme$dateInput8 === void 0 ? void 0 : _theme$dateInput8.baseColor)) !== null && _addLightness4 !== void 0 ? _addLightness4 : dateTokens.pickerHoverBackgroundColor;
|
|
107
117
|
dateTokens.pickerCurrentDateBorderColor = (_addLightness5 = addLightness(42, theme === null || theme === void 0 ? void 0 : (_theme$dateInput9 = theme.dateInput) === null || _theme$dateInput9 === void 0 ? void 0 : _theme$dateInput9.baseColor)) !== null && _addLightness5 !== void 0 ? _addLightness5 : dateTokens.pickerCurrentDateBorderColor;
|
|
@@ -117,10 +127,10 @@ var parseTheme = function parseTheme(theme) {
|
|
|
117
127
|
dropdownTokens.caretIconColor = (_theme$dropdown$fontC3 = theme === null || theme === void 0 ? void 0 : (_theme$dropdown4 = theme.dropdown) === null || _theme$dropdown4 === void 0 ? void 0 : _theme$dropdown4.fontColor) !== null && _theme$dropdown$fontC3 !== void 0 ? _theme$dropdown$fontC3 : dropdownTokens.caretIconColor;
|
|
118
128
|
dropdownTokens.optionFontColor = (_theme$dropdown$optio = theme === null || theme === void 0 ? void 0 : (_theme$dropdown5 = theme.dropdown) === null || _theme$dropdown5 === void 0 ? void 0 : _theme$dropdown5.optionFontColor) !== null && _theme$dropdown$optio !== void 0 ? _theme$dropdown$optio : dropdownTokens.optionFontColor;
|
|
119
129
|
dropdownTokens.optionIconColor = (_theme$dropdown$optio2 = theme === null || theme === void 0 ? void 0 : (_theme$dropdown6 = theme.dropdown) === null || _theme$dropdown6 === void 0 ? void 0 : _theme$dropdown6.optionFontColor) !== null && _theme$dropdown$optio2 !== void 0 ? _theme$dropdown$optio2 : dropdownTokens.optionIconColor;
|
|
120
|
-
dropdownTokens.hoverButtonBackgroundColor = (
|
|
121
|
-
dropdownTokens.activeButtonBackgroundColor = (
|
|
122
|
-
dropdownTokens.hoverOptionBackgroundColor = (
|
|
123
|
-
dropdownTokens.activeOptionBackgroundColor = (
|
|
130
|
+
dropdownTokens.hoverButtonBackgroundColor = (_subLightness14 = subLightness(5, theme === null || theme === void 0 ? void 0 : (_theme$dropdown7 = theme.dropdown) === null || _theme$dropdown7 === void 0 ? void 0 : _theme$dropdown7.baseColor)) !== null && _subLightness14 !== void 0 ? _subLightness14 : dropdownTokens.hoverButtonBackgroundColor;
|
|
131
|
+
dropdownTokens.activeButtonBackgroundColor = (_subLightness15 = subLightness(12, theme === null || theme === void 0 ? void 0 : (_theme$dropdown8 = theme.dropdown) === null || _theme$dropdown8 === void 0 ? void 0 : _theme$dropdown8.baseColor)) !== null && _subLightness15 !== void 0 ? _subLightness15 : dropdownTokens.activeButtonBackgroundColor;
|
|
132
|
+
dropdownTokens.hoverOptionBackgroundColor = (_subLightness16 = subLightness(5, theme === null || theme === void 0 ? void 0 : (_theme$dropdown9 = theme.dropdown) === null || _theme$dropdown9 === void 0 ? void 0 : _theme$dropdown9.baseColor)) !== null && _subLightness16 !== void 0 ? _subLightness16 : dropdownTokens.hoverOptionBackgroundColor;
|
|
133
|
+
dropdownTokens.activeOptionBackgroundColor = (_subLightness17 = subLightness(20, theme === null || theme === void 0 ? void 0 : (_theme$dropdown10 = theme.dropdown) === null || _theme$dropdown10 === void 0 ? void 0 : _theme$dropdown10.baseColor)) !== null && _subLightness17 !== void 0 ? _subLightness17 : dropdownTokens.activeOptionBackgroundColor;
|
|
124
134
|
var fileInputTokens = componentTokensCopy.fileInput;
|
|
125
135
|
fileInputTokens.labelFontColor = (_theme$fileInput$font = theme === null || theme === void 0 ? void 0 : (_theme$fileInput = theme.fileInput) === null || _theme$fileInput === void 0 ? void 0 : _theme$fileInput.fontColor) !== null && _theme$fileInput$font !== void 0 ? _theme$fileInput$font : fileInputTokens.labelFontColor;
|
|
126
136
|
fileInputTokens.helperTextFontColor = (_theme$fileInput$font2 = theme === null || theme === void 0 ? void 0 : (_theme$fileInput2 = theme.fileInput) === null || _theme$fileInput2 === void 0 ? void 0 : _theme$fileInput2.fontColor) !== null && _theme$fileInput$font2 !== void 0 ? _theme$fileInput$font2 : fileInputTokens.helperTextFontColor;
|
|
@@ -174,8 +184,8 @@ var parseTheme = function parseTheme(theme) {
|
|
|
174
184
|
radioGroupTokens.labelFontColor = (_theme$radioGroup$fon = theme === null || theme === void 0 ? void 0 : (_theme$radioGroup2 = theme.radioGroup) === null || _theme$radioGroup2 === void 0 ? void 0 : _theme$radioGroup2.fontColor) !== null && _theme$radioGroup$fon !== void 0 ? _theme$radioGroup$fon : radioGroupTokens.labelFontColor;
|
|
175
185
|
radioGroupTokens.helperTextFontColor = (_theme$radioGroup$fon2 = theme === null || theme === void 0 ? void 0 : (_theme$radioGroup3 = theme.radioGroup) === null || _theme$radioGroup3 === void 0 ? void 0 : _theme$radioGroup3.fontColor) !== null && _theme$radioGroup$fon2 !== void 0 ? _theme$radioGroup$fon2 : radioGroupTokens.helperTextFontColor;
|
|
176
186
|
radioGroupTokens.radioInputLabelFontColor = (_theme$radioGroup$fon3 = theme === null || theme === void 0 ? void 0 : (_theme$radioGroup4 = theme.radioGroup) === null || _theme$radioGroup4 === void 0 ? void 0 : _theme$radioGroup4.fontColor) !== null && _theme$radioGroup$fon3 !== void 0 ? _theme$radioGroup$fon3 : radioGroupTokens.radioInputLabelFontColor;
|
|
177
|
-
radioGroupTokens.hoverRadioInputColor = (
|
|
178
|
-
radioGroupTokens.activeRadioInputColor = (
|
|
187
|
+
radioGroupTokens.hoverRadioInputColor = (_subLightness18 = subLightness(10, theme === null || theme === void 0 ? void 0 : (_theme$radioGroup5 = theme.radioGroup) === null || _theme$radioGroup5 === void 0 ? void 0 : _theme$radioGroup5.baseColor)) !== null && _subLightness18 !== void 0 ? _subLightness18 : radioGroupTokens.radioInputColor;
|
|
188
|
+
radioGroupTokens.activeRadioInputColor = (_subLightness19 = subLightness(25, theme === null || theme === void 0 ? void 0 : (_theme$radioGroup6 = theme.radioGroup) === null || _theme$radioGroup6 === void 0 ? void 0 : _theme$radioGroup6.baseColor)) !== null && _subLightness19 !== void 0 ? _subLightness19 : radioGroupTokens.radioInputColor;
|
|
179
189
|
var selectTokens = componentTokensCopy.select;
|
|
180
190
|
selectTokens.selectedListOptionBackgroundColor = (_theme$select$selecte = theme === null || theme === void 0 ? void 0 : (_theme$select = theme.select) === null || _theme$select === void 0 ? void 0 : _theme$select.selectedOptionBackgroundColor) !== null && _theme$select$selecte !== void 0 ? _theme$select$selecte : selectTokens.selectedListOptionBackgroundColor;
|
|
181
191
|
selectTokens.valueFontColor = (_theme$select$fontCol = theme === null || theme === void 0 ? void 0 : (_theme$select2 = theme.select) === null || _theme$select2 === void 0 ? void 0 : _theme$select2.fontColor) !== null && _theme$select$fontCol !== void 0 ? _theme$select$fontCol : selectTokens.valueFontColor;
|
|
@@ -185,8 +195,8 @@ var parseTheme = function parseTheme(theme) {
|
|
|
185
195
|
selectTokens.placeholderFontColor = (_addLightness10 = addLightness(30, theme === null || theme === void 0 ? void 0 : (_theme$select6 = theme.select) === null || _theme$select6 === void 0 ? void 0 : _theme$select6.fontColor)) !== null && _addLightness10 !== void 0 ? _addLightness10 : selectTokens.placeholderFontColor;
|
|
186
196
|
selectTokens.collapseIndicatorColor = (_theme$select$fontCol4 = theme === null || theme === void 0 ? void 0 : (_theme$select7 = theme.select) === null || _theme$select7 === void 0 ? void 0 : _theme$select7.fontColor) !== null && _theme$select$fontCol4 !== void 0 ? _theme$select$fontCol4 : selectTokens.collapseIndicatorColor;
|
|
187
197
|
selectTokens.hoverInputBorderColor = (_theme$select$hoverBo = theme === null || theme === void 0 ? void 0 : (_theme$select8 = theme.select) === null || _theme$select8 === void 0 ? void 0 : _theme$select8.hoverBorderColor) !== null && _theme$select$hoverBo !== void 0 ? _theme$select$hoverBo : selectTokens.hoverInputBorderColor;
|
|
188
|
-
selectTokens.selectedHoverListOptionBackgroundColor = (
|
|
189
|
-
selectTokens.selectedActiveListOptionBackgroundColor = (
|
|
198
|
+
selectTokens.selectedHoverListOptionBackgroundColor = (_subLightness20 = subLightness(5, theme === null || theme === void 0 ? void 0 : (_theme$select9 = theme.select) === null || _theme$select9 === void 0 ? void 0 : _theme$select9.selectedOptionBackgroundColor)) !== null && _subLightness20 !== void 0 ? _subLightness20 : selectTokens.selectedHoverListOptionBackgroundColor;
|
|
199
|
+
selectTokens.selectedActiveListOptionBackgroundColor = (_subLightness21 = subLightness(15, theme === null || theme === void 0 ? void 0 : (_theme$select10 = theme.select) === null || _theme$select10 === void 0 ? void 0 : _theme$select10.selectedOptionBackgroundColor)) !== null && _subLightness21 !== void 0 ? _subLightness21 : selectTokens.selectedActiveListOptionBackgroundColor;
|
|
190
200
|
var sideNavTokens = componentTokensCopy.sidenav;
|
|
191
201
|
sideNavTokens.backgroundColor = (_theme$sidenav$baseCo = theme === null || theme === void 0 ? void 0 : (_theme$sidenav = theme.sidenav) === null || _theme$sidenav === void 0 ? void 0 : _theme$sidenav.baseColor) !== null && _theme$sidenav$baseCo !== void 0 ? _theme$sidenav$baseCo : sideNavTokens.backgroundColor;
|
|
192
202
|
var sliderTokens = componentTokensCopy.slider;
|
|
@@ -198,8 +208,8 @@ var parseTheme = function parseTheme(theme) {
|
|
|
198
208
|
sliderTokens.tickBackgroundColor = (_theme$slider$baseCol3 = theme === null || theme === void 0 ? void 0 : (_theme$slider6 = theme.slider) === null || _theme$slider6 === void 0 ? void 0 : _theme$slider6.baseColor) !== null && _theme$slider$baseCol3 !== void 0 ? _theme$slider$baseCol3 : sliderTokens.tickBackgroundColor;
|
|
199
209
|
sliderTokens.trackLineColor = (_theme$slider$baseCol4 = theme === null || theme === void 0 ? void 0 : (_theme$slider7 = theme.slider) === null || _theme$slider7 === void 0 ? void 0 : _theme$slider7.baseColor) !== null && _theme$slider$baseCol4 !== void 0 ? _theme$slider$baseCol4 : sliderTokens.trackLineColor;
|
|
200
210
|
sliderTokens.totalLineColor = (_theme$slider$totalLi = theme === null || theme === void 0 ? void 0 : (_theme$slider8 = theme.slider) === null || _theme$slider8 === void 0 ? void 0 : _theme$slider8.totalLineColor) !== null && _theme$slider$totalLi !== void 0 ? _theme$slider$totalLi : sliderTokens.totalLineColor;
|
|
201
|
-
sliderTokens.hoverThumbBackgroundColor = (
|
|
202
|
-
sliderTokens.activeThumbBackgroundColor = (
|
|
211
|
+
sliderTokens.hoverThumbBackgroundColor = (_subLightness22 = subLightness(15, theme === null || theme === void 0 ? void 0 : (_theme$slider9 = theme.slider) === null || _theme$slider9 === void 0 ? void 0 : _theme$slider9.baseColor)) !== null && _subLightness22 !== void 0 ? _subLightness22 : sliderTokens.thumbBackgroundColor;
|
|
212
|
+
sliderTokens.activeThumbBackgroundColor = (_subLightness23 = subLightness(15, theme === null || theme === void 0 ? void 0 : (_theme$slider10 = theme.slider) === null || _theme$slider10 === void 0 ? void 0 : _theme$slider10.baseColor)) !== null && _subLightness23 !== void 0 ? _subLightness23 : sliderTokens.thumbBackgroundColor;
|
|
203
213
|
var spinnerTokens = componentTokensCopy.spinner;
|
|
204
214
|
spinnerTokens.trackCircleColor = (_theme$spinner$accent = theme === null || theme === void 0 ? void 0 : (_theme$spinner = theme.spinner) === null || _theme$spinner === void 0 ? void 0 : _theme$spinner.accentColor) !== null && _theme$spinner$accent !== void 0 ? _theme$spinner$accent : spinnerTokens.trackCircleColor;
|
|
205
215
|
spinnerTokens.totalCircleColor = (_theme$spinner$baseCo = theme === null || theme === void 0 ? void 0 : (_theme$spinner2 = theme.spinner) === null || _theme$spinner2 === void 0 ? void 0 : _theme$spinner2.baseColor) !== null && _theme$spinner$baseCo !== void 0 ? _theme$spinner$baseCo : spinnerTokens.totalCircleColor;
|
|
@@ -251,11 +261,11 @@ var parseTheme = function parseTheme(theme) {
|
|
|
251
261
|
toggleGroupTokens.unselectedBackgroundColor = (_theme$toggleGroup$un = theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup3 = theme.toggleGroup) === null || _theme$toggleGroup3 === void 0 ? void 0 : _theme$toggleGroup3.unselectedBaseColor) !== null && _theme$toggleGroup$un !== void 0 ? _theme$toggleGroup$un : toggleGroupTokens.unselectedBackgroundColor;
|
|
252
262
|
toggleGroupTokens.unselectedActiveBackgroundColor = (_theme$toggleGroup$se3 = theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup4 = theme.toggleGroup) === null || _theme$toggleGroup4 === void 0 ? void 0 : _theme$toggleGroup4.selectedBaseColor) !== null && _theme$toggleGroup$se3 !== void 0 ? _theme$toggleGroup$se3 : toggleGroupTokens.unselectedActiveBackgroundColor;
|
|
253
263
|
toggleGroupTokens.unselectedFontColor = (_theme$toggleGroup$un2 = theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup5 = theme.toggleGroup) === null || _theme$toggleGroup5 === void 0 ? void 0 : _theme$toggleGroup5.unselectedFontColor) !== null && _theme$toggleGroup$un2 !== void 0 ? _theme$toggleGroup$un2 : toggleGroupTokens.unselectedFontColor;
|
|
254
|
-
toggleGroupTokens.selectedHoverBackgroundColor = (
|
|
255
|
-
toggleGroupTokens.selectedActiveBackgroundColor = (
|
|
264
|
+
toggleGroupTokens.selectedHoverBackgroundColor = (_subLightness24 = subLightness(8, theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup6 = theme.toggleGroup) === null || _theme$toggleGroup6 === void 0 ? void 0 : _theme$toggleGroup6.selectedBaseColor)) !== null && _subLightness24 !== void 0 ? _subLightness24 : toggleGroupTokens.selectedHoverBackgroundColor;
|
|
265
|
+
toggleGroupTokens.selectedActiveBackgroundColor = (_subLightness25 = subLightness(18, theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup7 = theme.toggleGroup) === null || _theme$toggleGroup7 === void 0 ? void 0 : _theme$toggleGroup7.selectedBaseColor)) !== null && _subLightness25 !== void 0 ? _subLightness25 : toggleGroupTokens.selectedActiveBackgroundColor;
|
|
256
266
|
toggleGroupTokens.selectedDisabledBackgroundColor = (_addLightness18 = addLightness(57, theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup8 = theme.toggleGroup) === null || _theme$toggleGroup8 === void 0 ? void 0 : _theme$toggleGroup8.selectedBaseColor)) !== null && _addLightness18 !== void 0 ? _addLightness18 : toggleGroupTokens.selectedDisabledBackgroundColor;
|
|
257
267
|
toggleGroupTokens.selectedDisabledFontColor = (_addLightness19 = addLightness(42, theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup9 = theme.toggleGroup) === null || _theme$toggleGroup9 === void 0 ? void 0 : _theme$toggleGroup9.selectedBaseColor)) !== null && _addLightness19 !== void 0 ? _addLightness19 : toggleGroupTokens.selectedDisabledFontColor;
|
|
258
|
-
toggleGroupTokens.unselectedHoverBackgroundColor = (
|
|
268
|
+
toggleGroupTokens.unselectedHoverBackgroundColor = (_subLightness26 = subLightness(10, theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup10 = theme.toggleGroup) === null || _theme$toggleGroup10 === void 0 ? void 0 : _theme$toggleGroup10.unselectedBaseColor)) !== null && _subLightness26 !== void 0 ? _subLightness26 : toggleGroupTokens.unselectedHoverBackgroundColor;
|
|
259
269
|
var wizardTokens = componentTokensCopy.wizard;
|
|
260
270
|
wizardTokens.selectedStepBackgroundColor = (_theme$wizard$baseCol = theme === null || theme === void 0 ? void 0 : (_theme$wizard = theme.wizard) === null || _theme$wizard === void 0 ? void 0 : _theme$wizard.baseColor) !== null && _theme$wizard$baseCol !== void 0 ? _theme$wizard$baseCol : wizardTokens.selectedStepBackgroundColor;
|
|
261
271
|
wizardTokens.selectedStepFontColor = (_theme$wizard$selecte = theme === null || theme === void 0 ? void 0 : (_theme$wizard2 = theme.wizard) === null || _theme$wizard2 === void 0 ? void 0 : _theme$wizard2.selectedStepFontColor) !== null && _theme$wizard$selecte !== void 0 ? _theme$wizard$selecte : wizardTokens.selectedStepFontColor;
|
package/common/coreTokens.d.ts
CHANGED
package/common/coreTokens.js
CHANGED
|
@@ -136,7 +136,6 @@ var CoreTokens = _objectSpread(_objectSpread(_objectSpread({}, CoreColorTokens),
|
|
|
136
136
|
inherit: "inherit",
|
|
137
137
|
// Typography
|
|
138
138
|
type_sans: "Open Sans, sans-serif",
|
|
139
|
-
type_scale_root: "16px",
|
|
140
139
|
type_scale_08: "3.75rem",
|
|
141
140
|
type_scale_07: "2.5rem",
|
|
142
141
|
type_scale_06: "2rem",
|
package/common/variables.d.ts
CHANGED
|
@@ -217,6 +217,29 @@ export declare const componentTokens: {
|
|
|
217
217
|
focusBorderThickness: string;
|
|
218
218
|
focusBorderRadius: string;
|
|
219
219
|
};
|
|
220
|
+
contextualMenu: {
|
|
221
|
+
fontFamily: string;
|
|
222
|
+
backgroundColor: string;
|
|
223
|
+
borderColor: string;
|
|
224
|
+
menuItemFontColor: string;
|
|
225
|
+
menuItemFontSize: string;
|
|
226
|
+
menuItemFontStyle: string;
|
|
227
|
+
menuItemFontWeight: string;
|
|
228
|
+
menuItemLineHeight: string;
|
|
229
|
+
hoverMenuItemBackgroundColor: string;
|
|
230
|
+
activeMenuItemBackgroundColor: string;
|
|
231
|
+
selectedMenuItemBackgroundColor: string;
|
|
232
|
+
hoverSelectedMenuItemBackgroundColor: string;
|
|
233
|
+
activeSelectedMenuItemBackgroundColor: string;
|
|
234
|
+
selectedMenuItemFontWeight: string;
|
|
235
|
+
sectionTitleFontColor: string;
|
|
236
|
+
sectionTitleFontSize: string;
|
|
237
|
+
sectionTitleFontStyle: string;
|
|
238
|
+
sectionTitleFontWeight: string;
|
|
239
|
+
sectionTitleLineHeight: string;
|
|
240
|
+
iconColor: string;
|
|
241
|
+
iconSize: string;
|
|
242
|
+
};
|
|
220
243
|
dateInput: {
|
|
221
244
|
pickerBackgroundColor: string;
|
|
222
245
|
pickerFontColor: string;
|
|
@@ -1172,6 +1195,12 @@ export type OpinionatedTheme = {
|
|
|
1172
1195
|
fontColor: string;
|
|
1173
1196
|
iconColor: string;
|
|
1174
1197
|
};
|
|
1198
|
+
contextualMenu: {
|
|
1199
|
+
accentColor: string;
|
|
1200
|
+
baseColor: string;
|
|
1201
|
+
fontColor: string;
|
|
1202
|
+
iconColor: string;
|
|
1203
|
+
};
|
|
1175
1204
|
dateInput: {
|
|
1176
1205
|
baseColor: string;
|
|
1177
1206
|
selectedFontColor: string;
|
package/common/variables.js
CHANGED
|
@@ -225,6 +225,29 @@ var componentTokens = exports.componentTokens = {
|
|
|
225
225
|
focusBorderThickness: _coreTokens["default"].border_width_2,
|
|
226
226
|
focusBorderRadius: _coreTokens["default"].border_radius_medium
|
|
227
227
|
},
|
|
228
|
+
contextualMenu: {
|
|
229
|
+
fontFamily: _coreTokens["default"].type_sans,
|
|
230
|
+
backgroundColor: _coreTokens["default"].color_white,
|
|
231
|
+
borderColor: _coreTokens["default"].color_grey_200,
|
|
232
|
+
menuItemFontColor: _coreTokens["default"].color_grey_900,
|
|
233
|
+
menuItemFontSize: _coreTokens["default"].type_scale_02,
|
|
234
|
+
menuItemFontStyle: _coreTokens["default"].type_normal,
|
|
235
|
+
menuItemFontWeight: _coreTokens["default"].type_regular,
|
|
236
|
+
menuItemLineHeight: "24px",
|
|
237
|
+
hoverMenuItemBackgroundColor: _coreTokens["default"].color_grey_100,
|
|
238
|
+
activeMenuItemBackgroundColor: _coreTokens["default"].color_grey_100,
|
|
239
|
+
selectedMenuItemBackgroundColor: _coreTokens["default"].color_purple_100,
|
|
240
|
+
hoverSelectedMenuItemBackgroundColor: _coreTokens["default"].color_purple_200,
|
|
241
|
+
activeSelectedMenuItemBackgroundColor: _coreTokens["default"].color_purple_200,
|
|
242
|
+
selectedMenuItemFontWeight: _coreTokens["default"].type_semibold,
|
|
243
|
+
sectionTitleFontColor: _coreTokens["default"].color_grey_900,
|
|
244
|
+
sectionTitleFontSize: _coreTokens["default"].type_scale_03,
|
|
245
|
+
sectionTitleFontStyle: _coreTokens["default"].type_normal,
|
|
246
|
+
sectionTitleFontWeight: _coreTokens["default"].type_semibold,
|
|
247
|
+
sectionTitleLineHeight: "24px",
|
|
248
|
+
iconColor: _coreTokens["default"].color_grey_900,
|
|
249
|
+
iconSize: "16px"
|
|
250
|
+
},
|
|
228
251
|
dateInput: {
|
|
229
252
|
pickerBackgroundColor: _coreTokens["default"].color_white,
|
|
230
253
|
pickerFontColor: _coreTokens["default"].color_black,
|
|
@@ -301,7 +324,7 @@ var componentTokens = exports.componentTokens = {
|
|
|
301
324
|
hoverOptionBackgroundColor: _coreTokens["default"].color_grey_100,
|
|
302
325
|
activeOptionBackgroundColor: _coreTokens["default"].color_grey_300,
|
|
303
326
|
optionFontFamily: _coreTokens["default"].type_sans,
|
|
304
|
-
optionFontSize: _coreTokens["default"].
|
|
327
|
+
optionFontSize: _coreTokens["default"].type_scale_03,
|
|
305
328
|
optionFontStyle: _coreTokens["default"].type_normal,
|
|
306
329
|
optionFontWeight: _coreTokens["default"].type_regular,
|
|
307
330
|
optionFontColor: _coreTokens["default"].color_black,
|
|
@@ -830,7 +853,7 @@ var componentTokens = exports.componentTokens = {
|
|
|
830
853
|
disabledLabelFontColor: _coreTokens["default"].color_grey_500,
|
|
831
854
|
disabledLabelFontStyle: _coreTokens["default"].type_normal,
|
|
832
855
|
labelFontFamily: _coreTokens["default"].type_sans,
|
|
833
|
-
labelFontSize: _coreTokens["default"].
|
|
856
|
+
labelFontSize: _coreTokens["default"].type_scale_03,
|
|
834
857
|
labelFontStyle: _coreTokens["default"].type_normal,
|
|
835
858
|
labelFontWeight: _coreTokens["default"].type_regular,
|
|
836
859
|
labelFontColor: _coreTokens["default"].color_black,
|
|
@@ -10,11 +10,12 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _styledComponents =
|
|
13
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
14
14
|
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
15
15
|
var _Divider = _interopRequireDefault(require("../divider/Divider"));
|
|
16
16
|
var _Inset = _interopRequireDefault(require("../inset/Inset"));
|
|
17
17
|
var _MenuItem = _interopRequireDefault(require("./MenuItem"));
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
18
19
|
var _templateObject, _templateObject2, _templateObject3;
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -48,15 +49,20 @@ var DxcContextualMenu = function DxcContextualMenu(_ref) {
|
|
|
48
49
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
49
50
|
selectedItemId = _useState2[0],
|
|
50
51
|
setSelectedItemId = _useState2[1];
|
|
52
|
+
var contextualMenuRef = (0, _react.useRef)(null);
|
|
51
53
|
var itemsWithId = (0, _react.useMemo)(function () {
|
|
52
54
|
return addIdToItems(items);
|
|
53
55
|
}, [items]);
|
|
56
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
54
57
|
var renderSection = function renderSection(section, currentSectionIndex, length) {
|
|
55
58
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, {
|
|
56
59
|
key: "section-".concat(currentSectionIndex)
|
|
57
60
|
}, /*#__PURE__*/_react["default"].createElement("li", {
|
|
58
|
-
role: "group"
|
|
59
|
-
|
|
61
|
+
role: "group",
|
|
62
|
+
"aria-labelledby": section.title
|
|
63
|
+
}, section.title != null && /*#__PURE__*/_react["default"].createElement(Title, {
|
|
64
|
+
id: section.title
|
|
65
|
+
}, section.title), /*#__PURE__*/_react["default"].createElement(SectionList, null, section.items.map(function (item, index) {
|
|
60
66
|
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
61
67
|
item: item,
|
|
62
68
|
key: "".concat(item.label, "-").concat(index)
|
|
@@ -68,8 +74,26 @@ var DxcContextualMenu = function DxcContextualMenu(_ref) {
|
|
|
68
74
|
color: "lightGrey"
|
|
69
75
|
})));
|
|
70
76
|
};
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
var _useState3 = (0, _react.useState)(true),
|
|
78
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
79
|
+
firstUpdate = _useState4[0],
|
|
80
|
+
setFirstUpdate = _useState4[1];
|
|
81
|
+
(0, _react.useLayoutEffect)(function () {
|
|
82
|
+
if (selectedItemId !== -1 && firstUpdate) {
|
|
83
|
+
var _contextualMenuEl$scr;
|
|
84
|
+
var contextualMenuEl = contextualMenuRef === null || contextualMenuRef === void 0 ? void 0 : contextualMenuRef.current;
|
|
85
|
+
var selectedItemEl = contextualMenuEl === null || contextualMenuEl === void 0 ? void 0 : contextualMenuEl.querySelector("[aria-selected='true']");
|
|
86
|
+
contextualMenuEl === null || contextualMenuEl === void 0 ? void 0 : (_contextualMenuEl$scr = contextualMenuEl.scrollTo) === null || _contextualMenuEl$scr === void 0 ? void 0 : _contextualMenuEl$scr.call(contextualMenuEl, {
|
|
87
|
+
top: (selectedItemEl === null || selectedItemEl === void 0 ? void 0 : selectedItemEl.offsetTop) - (contextualMenuEl === null || contextualMenuEl === void 0 ? void 0 : contextualMenuEl.clientHeight) / 2
|
|
88
|
+
});
|
|
89
|
+
setFirstUpdate(false);
|
|
90
|
+
}
|
|
91
|
+
}, [firstUpdate, selectedItemId]);
|
|
92
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
93
|
+
theme: colorsTheme.contextualMenu
|
|
94
|
+
}, /*#__PURE__*/_react["default"].createElement(ContextualMenu, {
|
|
95
|
+
role: "menu",
|
|
96
|
+
ref: contextualMenuRef
|
|
73
97
|
}, /*#__PURE__*/_react["default"].createElement(ContextualMenuContext.Provider, {
|
|
74
98
|
value: {
|
|
75
99
|
selectedItemId: selectedItemId,
|
|
@@ -80,9 +104,33 @@ var DxcContextualMenu = function DxcContextualMenu(_ref) {
|
|
|
80
104
|
item: item,
|
|
81
105
|
key: "".concat(item.label, "-").concat(index)
|
|
82
106
|
});
|
|
83
|
-
})));
|
|
107
|
+
}))));
|
|
84
108
|
};
|
|
85
|
-
var ContextualMenu = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n margin: 0;\n border: 1px solid ", ";\n border-radius: 0.25rem;\n padding: ", " ", ";\n display: grid;\n gap: ", ";\n min-width: 248px;\n max-height: 100%;\n background-color: ", ";\n overflow-y: auto;\n &::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 0.25rem;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 0.25rem;\n }\n"])),
|
|
109
|
+
var ContextualMenu = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n margin: 0;\n border: 1px solid ", ";\n border-radius: 0.25rem;\n padding: ", " ", ";\n display: grid;\n gap: ", ";\n min-width: 248px;\n max-height: 100%;\n background-color: ", ";\n overflow-y: auto;\n &::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 0.25rem;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 0.25rem;\n }\n"])), function (_ref2) {
|
|
110
|
+
var theme = _ref2.theme;
|
|
111
|
+
return theme.borderColor;
|
|
112
|
+
}, _coreTokens["default"].spacing_16, _coreTokens["default"].spacing_8, _coreTokens["default"].spacing_4, function (_ref3) {
|
|
113
|
+
var theme = _ref3.theme;
|
|
114
|
+
return theme.backgroundColor;
|
|
115
|
+
}, _coreTokens["default"].color_grey_700, _coreTokens["default"].color_grey_300);
|
|
86
116
|
var SectionList = _styledComponents["default"].ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: ", ";\n"])), _coreTokens["default"].spacing_4);
|
|
87
|
-
var Title = _styledComponents["default"].
|
|
117
|
+
var Title = _styledComponents["default"].h2(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0 0 ", " 0;\n padding: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), _coreTokens["default"].spacing_4, _coreTokens["default"].spacing_4, function (_ref4) {
|
|
118
|
+
var theme = _ref4.theme;
|
|
119
|
+
return theme.sectionTitleFontColor;
|
|
120
|
+
}, function (_ref5) {
|
|
121
|
+
var theme = _ref5.theme;
|
|
122
|
+
return theme.fontFamily;
|
|
123
|
+
}, function (_ref6) {
|
|
124
|
+
var theme = _ref6.theme;
|
|
125
|
+
return theme.sectionTitleFontSize;
|
|
126
|
+
}, function (_ref7) {
|
|
127
|
+
var theme = _ref7.theme;
|
|
128
|
+
return theme.sectionTitleFontStyle;
|
|
129
|
+
}, function (_ref8) {
|
|
130
|
+
var theme = _ref8.theme;
|
|
131
|
+
return theme.sectionTitleFontWeight;
|
|
132
|
+
}, function (_ref9) {
|
|
133
|
+
var theme = _ref9.theme;
|
|
134
|
+
return theme.sectionTitleLineHeight;
|
|
135
|
+
});
|
|
88
136
|
var _default = exports["default"] = DxcContextualMenu;
|
|
@@ -4,10 +4,11 @@ import DxcContextualMenu, { ContextualMenuContext } from "./ContextualMenu";
|
|
|
4
4
|
import DxcContainer from "../container/Container";
|
|
5
5
|
import SingleItem from "./SingleItem";
|
|
6
6
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
7
|
-
import { userEvent, within } from "@storybook/test";
|
|
8
7
|
import DxcBadge from "../badge/Badge";
|
|
9
8
|
import { disabledRules } from "../../test/accessibility/rules/specific/contextual-menu/disabledRules";
|
|
10
9
|
import preview from "../../.storybook/preview";
|
|
10
|
+
import { ThemeProvider } from "styled-components";
|
|
11
|
+
import useTheme from "../useTheme";
|
|
11
12
|
|
|
12
13
|
export default {
|
|
13
14
|
title: "Contextual Menu",
|
|
@@ -29,7 +30,7 @@ const items = [{ label: "Item 1" }, { label: "Item 2" }, { label: "Item 3" }, {
|
|
|
29
30
|
|
|
30
31
|
const sections = [
|
|
31
32
|
{
|
|
32
|
-
title: "
|
|
33
|
+
title: "Section title",
|
|
33
34
|
items: [{ label: "Approved locations" }, { label: "Approved locations" }, { label: "Approved locations" }],
|
|
34
35
|
},
|
|
35
36
|
{
|
|
@@ -54,7 +55,7 @@ const groupItems = [
|
|
|
54
55
|
icon: "bookmark",
|
|
55
56
|
badge: <DxcBadge color="purple" label="Experimental" />,
|
|
56
57
|
},
|
|
57
|
-
{ label: "Selected Item 3" },
|
|
58
|
+
{ label: "Selected Item 3", selectedByDefault: true },
|
|
58
59
|
],
|
|
59
60
|
},
|
|
60
61
|
],
|
|
@@ -77,7 +78,7 @@ const itemsWithIcon = [
|
|
|
77
78
|
{
|
|
78
79
|
label: "Item 1",
|
|
79
80
|
icon: (
|
|
80
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">
|
|
81
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" fill="currentColor">
|
|
81
82
|
<path d="M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z" />
|
|
82
83
|
</svg>
|
|
83
84
|
),
|
|
@@ -114,7 +115,7 @@ const sectionsWithScroll = [
|
|
|
114
115
|
{ label: "Approved locations" },
|
|
115
116
|
{ label: "Approved locations" },
|
|
116
117
|
{ label: "Approved locations" },
|
|
117
|
-
{ label: "Approved locations" },
|
|
118
|
+
{ label: "Approved locations", selectedByDefault: true },
|
|
118
119
|
],
|
|
119
120
|
},
|
|
120
121
|
];
|
|
@@ -124,7 +125,7 @@ const itemsWithTruncatedText = [
|
|
|
124
125
|
label: "Item with a very long label that should be truncated",
|
|
125
126
|
badge: <DxcBadge color="green" label="New" />,
|
|
126
127
|
icon: (
|
|
127
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">
|
|
128
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" fill="currentColor">
|
|
128
129
|
<path d="M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z" />
|
|
129
130
|
</svg>
|
|
130
131
|
),
|
|
@@ -135,7 +136,7 @@ const itemsWithTruncatedText = [
|
|
|
135
136
|
},
|
|
136
137
|
];
|
|
137
138
|
|
|
138
|
-
const
|
|
139
|
+
export const Chromatic = () => (
|
|
139
140
|
<>
|
|
140
141
|
<Title title="Default" theme="light" level={3} />
|
|
141
142
|
<ExampleContainer>
|
|
@@ -171,7 +172,7 @@ const ContextualMenu = () => (
|
|
|
171
172
|
<DxcContextualMenu items={itemsWithTruncatedText} />
|
|
172
173
|
</DxcContainer>
|
|
173
174
|
</ExampleContainer>
|
|
174
|
-
<Title title="With scroll" theme="light" level={3} />
|
|
175
|
+
<Title title="With auto-scroll" theme="light" level={3} />
|
|
175
176
|
<ExampleContainer>
|
|
176
177
|
<DxcContainer height="300px" width="300px">
|
|
177
178
|
<DxcContextualMenu items={sectionsWithScroll} />
|
|
@@ -186,47 +187,45 @@ const ContextualMenu = () => (
|
|
|
186
187
|
</>
|
|
187
188
|
);
|
|
188
189
|
|
|
189
|
-
export const
|
|
190
|
-
|
|
191
|
-
const canvas = within(canvasElement);
|
|
192
|
-
await userEvent.click(canvas.getByText("Grouped Item 1"));
|
|
193
|
-
await userEvent.click(canvas.getByText("Grouped Item 2"));
|
|
194
|
-
await userEvent.click(canvas.getByText("Selected Item 3"));
|
|
195
|
-
};
|
|
190
|
+
export const SingleItemStates = () => {
|
|
191
|
+
const colorsTheme = useTheme();
|
|
196
192
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
193
|
+
return (
|
|
194
|
+
<ThemeProvider theme={colorsTheme.contextualMenu}>
|
|
195
|
+
<DxcContainer width="300px">
|
|
196
|
+
<ContextualMenuContext.Provider value={{ selectedItemId: -1, setSelectedItemId: () => {} }}>
|
|
197
|
+
<Title title="Default" theme="light" level={3} />
|
|
198
|
+
<ExampleContainer>
|
|
199
|
+
<SingleItem {...items[0]} id={0} depthLevel={0} />
|
|
200
|
+
</ExampleContainer>
|
|
201
|
+
<Title title="Focus" theme="light" level={3} />
|
|
202
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
203
|
+
<SingleItem {...items[0]} id={0} depthLevel={0} />
|
|
204
|
+
</ExampleContainer>
|
|
205
|
+
<Title title="Hover" theme="light" level={3} />
|
|
206
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
207
|
+
<SingleItem {...items[0]} id={0} depthLevel={0} />
|
|
208
|
+
</ExampleContainer>
|
|
209
|
+
<Title title="Active" theme="light" level={3} />
|
|
210
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
211
|
+
<SingleItem {...items[0]} id={0} depthLevel={0} />
|
|
212
|
+
</ExampleContainer>
|
|
213
|
+
</ContextualMenuContext.Provider>
|
|
214
|
+
<ContextualMenuContext.Provider value={{ selectedItemId: 0, setSelectedItemId: () => {} }}>
|
|
215
|
+
<Title title="Selected" theme="light" level={3} />
|
|
216
|
+
<ExampleContainer>
|
|
217
|
+
<SingleItem {...items[0]} id={0} depthLevel={0} />
|
|
218
|
+
</ExampleContainer>
|
|
219
|
+
<Title title="Selected hover" theme="light" level={3} />
|
|
220
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
221
|
+
<SingleItem {...items[0]} id={0} depthLevel={0} />
|
|
222
|
+
</ExampleContainer>
|
|
223
|
+
<Title title="Selected active" theme="light" level={3} />
|
|
224
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
225
|
+
<SingleItem {...items[0]} id={0} depthLevel={0} />
|
|
226
|
+
</ExampleContainer>
|
|
227
|
+
</ContextualMenuContext.Provider>
|
|
228
|
+
</DxcContainer>
|
|
229
|
+
</ThemeProvider>
|
|
230
|
+
);
|
|
231
|
+
};
|