@dxc-technology/halstack-react 0.0.0-59568e7 → 0.0.0-5aa300b
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.js +7 -11
- package/accordion/Accordion.js +117 -104
- package/accordion/Accordion.stories.tsx +54 -15
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +2 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +23 -33
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +50 -70
- package/button/Button.stories.tsx +61 -1
- package/button/types.d.ts +7 -7
- package/card/Card.js +34 -36
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/Chip.js +11 -23
- package/chip/Chip.stories.tsx +41 -9
- package/chip/types.d.ts +1 -1
- package/common/variables.js +186 -158
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +77 -222
- package/date-input/DateInput.stories.tsx +30 -17
- package/date-input/DateInput.test.js +411 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +53 -0
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +247 -249
- package/dropdown/Dropdown.stories.tsx +135 -64
- package/dropdown/Dropdown.test.js +504 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +38 -10
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/{radio → flex}/types.js +0 -0
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +70 -117
- package/layout/ApplicationLayout.stories.tsx +84 -93
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +18 -33
- package/link/Link.d.ts +2 -2
- package/link/Link.js +24 -50
- package/link/Link.stories.tsx +13 -6
- package/link/types.d.ts +3 -4
- package/main.d.ts +6 -9
- package/main.js +32 -56
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -20
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +6 -12
- package/paginator/Paginator.test.js +43 -1
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +25 -20
- package/quick-nav/QuickNav.stories.tsx +131 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +23 -22
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +65 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +53 -7
- package/select/Option.js +8 -10
- package/select/Select.js +43 -43
- package/select/Select.stories.tsx +225 -136
- package/select/Select.test.js +363 -250
- package/select/types.d.ts +2 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +182 -52
- package/sidenav/Sidenav.stories.tsx +163 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +2 -2
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +133 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +81 -5
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +172 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +128 -0
- package/tabs-nav/types.d.ts +53 -0
- package/{row → tabs-nav}/types.js +0 -0
- package/tag/Tag.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +38 -9
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +195 -292
- package/text-input/TextInput.stories.tsx +211 -185
- package/text-input/TextInput.test.js +737 -725
- package/text-input/types.d.ts +22 -3
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/{stack → typography}/types.js +0 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
package/HalstackContext.js
CHANGED
|
@@ -85,7 +85,7 @@ var parseAdvancedTheme = function parseAdvancedTheme(advancedTheme) {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
var parseTheme = function parseTheme(theme) {
|
|
88
|
-
var _theme$accordion$font, _theme$accordion, _theme$accordion$font2, _theme$accordion2, _theme$accordion$acce, _theme$accordion3, _theme$accordion$acce2, _theme$accordion4, _theme$accordion$acce3, _theme$accordion5, _setOpacity, _theme$accordion6, _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, _addLightness, _theme$button11, _addLightness2, _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$fontColor2, _theme$chip3, _theme$dateInput$sele, _theme$dateInput, _theme$dateInput$sele2, _theme$dateInput2, _setOpacity2, _theme$dateInput3, _theme$dropdown$baseC, _theme$dropdown, _theme$dropdown$fontC, _theme$dropdown2, _theme$dropdown$optio, _theme$dropdown3, _theme$dropdown$optio2, _theme$dropdown4, _setOpacity3, _theme$dropdown5, _setOpacity4, _theme$dropdown6, _setOpacity5, _theme$dropdown7, _setOpacity6, _theme$dropdown8, _theme$dropdown$fontC2, _theme$dropdown9, _theme$dropdown$fontC3, _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, _setOpacity7, _theme$header6, _theme$header$logo, _theme$header7, _theme$header$logoRes, _theme$header8, _theme$header$content, _theme$header9, _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$quickNav$fontC, _theme$quickNav,
|
|
88
|
+
var _theme$accordion$font, _theme$accordion, _theme$accordion$font2, _theme$accordion2, _theme$accordion$acce, _theme$accordion3, _theme$accordion$acce2, _theme$accordion4, _theme$accordion$acce3, _theme$accordion5, _setOpacity, _theme$accordion6, _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, _addLightness, _theme$button11, _addLightness2, _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$fontColor2, _theme$chip3, _theme$dateInput$sele, _theme$dateInput, _theme$dateInput$sele2, _theme$dateInput2, _setOpacity2, _theme$dateInput3, _theme$dropdown$baseC, _theme$dropdown, _theme$dropdown$fontC, _theme$dropdown2, _theme$dropdown$optio, _theme$dropdown3, _theme$dropdown$optio2, _theme$dropdown4, _setOpacity3, _theme$dropdown5, _setOpacity4, _theme$dropdown6, _setOpacity5, _theme$dropdown7, _setOpacity6, _theme$dropdown8, _theme$dropdown$fontC2, _theme$dropdown9, _theme$dropdown$fontC3, _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, _setOpacity7, _theme$header6, _theme$header$logo, _theme$header7, _theme$header$logoRes, _theme$header8, _theme$header$content, _theme$header9, _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$quickNav$fontC, _theme$quickNav, _setOpacity8, _theme$quickNav2, _theme$radioGroup$bas, _theme$radioGroup, _theme$radioGroup$fon, _theme$radioGroup2, _theme$radioGroup$fon2, _theme$radioGroup3, _theme$radioGroup$fon3, _theme$radioGroup4, _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, _setOpacity9, _theme$select6, _theme$select$fontCol4, _theme$select7, _subLightness6, _theme$select8, _subLightness7, _theme$select9, _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, _subLightness8, _theme$slider8, _subLightness9, _theme$slider9, _setOpacity10, _theme$slider10, _theme$spinner$accent, _theme$spinner, _theme$spinner$baseCo, _theme$spinner2, _theme$spinner$fontCo, _theme$spinner3, _theme$spinner$fontCo2, _theme$spinner4, _theme$switch$checked, _theme$switch, _theme$switch$fontCol, _theme$switch2, _setOpacity11, _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, _addLightness3, _theme$tabs5, _addLightness4, _theme$tabs6, _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, _setOpacity12, _theme$textInput8, _setOpacity13, _theme$textInput9, _setOpacity14, _theme$textInput10, _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, _subLightness10, _theme$toggleGroup6, _subLightness11, _theme$toggleGroup7, _addLightness5, _theme$toggleGroup8, _addLightness6, _theme$toggleGroup9, _subLightness12, _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, _setOpacity15, _theme$wizard8, _setOpacity16, _theme$wizard9, _setOpacity17, _theme$wizard10, _setOpacity18, _theme$wizard11;
|
|
89
89
|
|
|
90
90
|
var componentTokensCopy = JSON.parse(JSON.stringify(_variables.componentTokens));
|
|
91
91
|
var accordionTokens = componentTokensCopy.accordion;
|
|
@@ -167,11 +167,7 @@ var parseTheme = function parseTheme(theme) {
|
|
|
167
167
|
progressBarTokens.helperTextFontColor = (_theme$progressBar$fo3 = theme === null || theme === void 0 ? void 0 : (_theme$progressBar5 = theme.progressBar) === null || _theme$progressBar5 === void 0 ? void 0 : _theme$progressBar5.fontColor) !== null && _theme$progressBar$fo3 !== void 0 ? _theme$progressBar$fo3 : progressBarTokens.helperTextFontColor;
|
|
168
168
|
var quickNavTokens = componentTokensCopy.quickNav;
|
|
169
169
|
quickNavTokens.fontColor = (_theme$quickNav$fontC = theme === null || theme === void 0 ? void 0 : (_theme$quickNav = theme.quickNav) === null || _theme$quickNav === void 0 ? void 0 : _theme$quickNav.fontColor) !== null && _theme$quickNav$fontC !== void 0 ? _theme$quickNav$fontC : quickNavTokens.fontColor;
|
|
170
|
-
quickNavTokens.
|
|
171
|
-
quickNavTokens.hoverFontColor = (_setOpacity8 = setOpacity(theme === null || theme === void 0 ? void 0 : (_theme$quickNav3 = theme.quickNav) === null || _theme$quickNav3 === void 0 ? void 0 : _theme$quickNav3.accentColor, 0.7)) !== null && _setOpacity8 !== void 0 ? _setOpacity8 : quickNavTokens.hoverFontColor;
|
|
172
|
-
var radioTokens = componentTokensCopy.radio;
|
|
173
|
-
radioTokens.color = (_theme$radio$baseColo = theme === null || theme === void 0 ? void 0 : (_theme$radio = theme.radio) === null || _theme$radio === void 0 ? void 0 : _theme$radio.baseColor) !== null && _theme$radio$baseColo !== void 0 ? _theme$radio$baseColo : radioTokens.color;
|
|
174
|
-
radioTokens.fontColor = (_theme$radio$fontColo = theme === null || theme === void 0 ? void 0 : (_theme$radio2 = theme.radio) === null || _theme$radio2 === void 0 ? void 0 : _theme$radio2.fontColor) !== null && _theme$radio$fontColo !== void 0 ? _theme$radio$fontColo : radioTokens.color;
|
|
170
|
+
quickNavTokens.hoverFontColor = (_setOpacity8 = setOpacity(theme === null || theme === void 0 ? void 0 : (_theme$quickNav2 = theme.quickNav) === null || _theme$quickNav2 === void 0 ? void 0 : _theme$quickNav2.accentColor, 0.7)) !== null && _setOpacity8 !== void 0 ? _setOpacity8 : quickNavTokens.hoverFontColor;
|
|
175
171
|
var radioGroupTokens = componentTokensCopy.radioGroup;
|
|
176
172
|
radioGroupTokens.radioInputColor = (_theme$radioGroup$bas = theme === null || theme === void 0 ? void 0 : (_theme$radioGroup = theme.radioGroup) === null || _theme$radioGroup === void 0 ? void 0 : _theme$radioGroup.baseColor) !== null && _theme$radioGroup$bas !== void 0 ? _theme$radioGroup$bas : radioGroupTokens.radioInputColor;
|
|
177
173
|
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;
|
|
@@ -245,12 +241,12 @@ var parseTheme = function parseTheme(theme) {
|
|
|
245
241
|
toggleGroupTokens.unselectedHoverBackgroundColor = (_subLightness12 = subLightness(theme === null || theme === void 0 ? void 0 : (_theme$toggleGroup10 = theme.toggleGroup) === null || _theme$toggleGroup10 === void 0 ? void 0 : _theme$toggleGroup10.unselectedBaseColor, 8)) !== null && _subLightness12 !== void 0 ? _subLightness12 : toggleGroupTokens.unselectedHoverBackgroundColor;
|
|
246
242
|
var wizardTokens = componentTokensCopy.wizard;
|
|
247
243
|
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;
|
|
248
|
-
wizardTokens.selectedStepFontColor = (_theme$wizard$
|
|
244
|
+
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.selectedFontColor) !== null && _theme$wizard$selecte !== void 0 ? _theme$wizard$selecte : wizardTokens.selectedStepFontColor;
|
|
249
245
|
wizardTokens.selectedStepBorderColor = (_theme$wizard$baseCol2 = theme === null || theme === void 0 ? void 0 : (_theme$wizard3 = theme.wizard) === null || _theme$wizard3 === void 0 ? void 0 : _theme$wizard3.baseColor) !== null && _theme$wizard$baseCol2 !== void 0 ? _theme$wizard$baseCol2 : wizardTokens.selectedStepBorderColor;
|
|
250
|
-
wizardTokens.visitedLabelFontColor = (_theme$wizard$
|
|
251
|
-
wizardTokens.selectedLabelFontColor = (_theme$wizard$
|
|
252
|
-
wizardTokens.visitedHelperTextFontColor = (_theme$wizard$
|
|
253
|
-
wizardTokens.selectedHelperTextFontColor = (_theme$wizard$
|
|
246
|
+
wizardTokens.visitedLabelFontColor = (_theme$wizard$fontCol = theme === null || theme === void 0 ? void 0 : (_theme$wizard4 = theme.wizard) === null || _theme$wizard4 === void 0 ? void 0 : _theme$wizard4.fontColor) !== null && _theme$wizard$fontCol !== void 0 ? _theme$wizard$fontCol : wizardTokens.visitedLabelFontColor;
|
|
247
|
+
wizardTokens.selectedLabelFontColor = (_theme$wizard$fontCol2 = theme === null || theme === void 0 ? void 0 : (_theme$wizard5 = theme.wizard) === null || _theme$wizard5 === void 0 ? void 0 : _theme$wizard5.fontColor) !== null && _theme$wizard$fontCol2 !== void 0 ? _theme$wizard$fontCol2 : wizardTokens.selectedLabelFontColor;
|
|
248
|
+
wizardTokens.visitedHelperTextFontColor = (_theme$wizard$fontCol3 = theme === null || theme === void 0 ? void 0 : (_theme$wizard6 = theme.wizard) === null || _theme$wizard6 === void 0 ? void 0 : _theme$wizard6.fontColor) !== null && _theme$wizard$fontCol3 !== void 0 ? _theme$wizard$fontCol3 : wizardTokens.visitedHelperTextFontColor;
|
|
249
|
+
wizardTokens.selectedHelperTextFontColor = (_theme$wizard$fontCol4 = theme === null || theme === void 0 ? void 0 : (_theme$wizard7 = theme.wizard) === null || _theme$wizard7 === void 0 ? void 0 : _theme$wizard7.fontColor) !== null && _theme$wizard$fontCol4 !== void 0 ? _theme$wizard$fontCol4 : wizardTokens.selectedHelperTextFontColor;
|
|
254
250
|
wizardTokens.unvisitedStepBorderColor = (_setOpacity15 = setOpacity(theme === null || theme === void 0 ? void 0 : (_theme$wizard8 = theme.wizard) === null || _theme$wizard8 === void 0 ? void 0 : _theme$wizard8.fontColor, 0.6)) !== null && _setOpacity15 !== void 0 ? _setOpacity15 : wizardTokens.unvisitedStepBorderColor;
|
|
255
251
|
wizardTokens.unvisitedStepFontColor = (_setOpacity16 = setOpacity(theme === null || theme === void 0 ? void 0 : (_theme$wizard9 = theme.wizard) === null || _theme$wizard9 === void 0 ? void 0 : _theme$wizard9.fontColor, 0.6)) !== null && _setOpacity16 !== void 0 ? _setOpacity16 : wizardTokens.unvisitedStepFontColor;
|
|
256
252
|
wizardTokens.unvisitedLabelFontColor = (_setOpacity17 = setOpacity(theme === null || theme === void 0 ? void 0 : (_theme$wizard10 = theme.wizard) === null || _theme$wizard10 === void 0 ? void 0 : _theme$wizard10.fontColor, 0.6)) !== null && _setOpacity17 !== void 0 ? _setOpacity17 : wizardTokens.unvisitedLabelFontColor;
|
package/accordion/Accordion.js
CHANGED
|
@@ -19,14 +19,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _ExpansionPanel = _interopRequireDefault(require("@material-ui/core/ExpansionPanel"));
|
|
23
|
-
|
|
24
|
-
var _ExpansionPanelSummary = _interopRequireDefault(require("@material-ui/core/ExpansionPanelSummary"));
|
|
25
|
-
|
|
26
|
-
var _ExpansionPanelDetails = _interopRequireDefault(require("@material-ui/core/ExpansionPanelDetails"));
|
|
27
|
-
|
|
28
|
-
var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
|
|
29
|
-
|
|
30
22
|
var _utils = require("../common/utils.js");
|
|
31
23
|
|
|
32
24
|
var _variables = require("../common/variables.js");
|
|
@@ -35,12 +27,34 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
35
27
|
|
|
36
28
|
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
37
29
|
|
|
38
|
-
var
|
|
30
|
+
var _Typography = _interopRequireDefault(require("../typography/Typography"));
|
|
31
|
+
|
|
32
|
+
var _uuid = require("uuid");
|
|
33
|
+
|
|
34
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
39
35
|
|
|
40
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
37
|
|
|
42
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
39
|
|
|
40
|
+
var expandLess = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
41
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
+
height: "24",
|
|
43
|
+
width: "24",
|
|
44
|
+
fill: "currentColor"
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
46
|
+
d: "m7.4 15.375-1.4-1.4 6-6 6 6-1.4 1.4-4.6-4.6Z"
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
var expandMore = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
50
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
51
|
+
height: "24",
|
|
52
|
+
width: "24",
|
|
53
|
+
fill: "currentColor"
|
|
54
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
55
|
+
d: "m12 15.375-6-6 1.4-1.4 4.6 4.6 4.6-4.6 1.4 1.4Z"
|
|
56
|
+
}));
|
|
57
|
+
|
|
44
58
|
var DxcAccordion = function DxcAccordion(_ref) {
|
|
45
59
|
var _ref$label = _ref.label,
|
|
46
60
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
@@ -58,57 +72,88 @@ var DxcAccordion = function DxcAccordion(_ref) {
|
|
|
58
72
|
_ref$tabIndex = _ref.tabIndex,
|
|
59
73
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
60
74
|
|
|
61
|
-
var _useState = (0, _react.useState)(
|
|
62
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState,
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
var _useState = (0, _react.useState)((0, _uuid.v4)()),
|
|
76
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
77
|
+
id = _useState2[0];
|
|
78
|
+
|
|
79
|
+
var _useState3 = (0, _react.useState)(defaultIsExpanded !== null && defaultIsExpanded !== void 0 ? defaultIsExpanded : false),
|
|
80
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
81
|
+
innerIsExpanded = _useState4[0],
|
|
82
|
+
setInnerIsExpanded = _useState4[1];
|
|
65
83
|
|
|
66
84
|
var colorsTheme = (0, _useTheme["default"])();
|
|
67
85
|
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
setInnerIsExpanded(!innerIsExpanded);
|
|
71
|
-
}
|
|
86
|
+
var handleAccordionState = function handleAccordionState() {
|
|
87
|
+
var _isExpanded;
|
|
72
88
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
89
|
+
isExpanded !== null && isExpanded !== void 0 ? isExpanded : setInnerIsExpanded(function (innerIsExpanded) {
|
|
90
|
+
return !innerIsExpanded;
|
|
91
|
+
});
|
|
92
|
+
onChange === null || onChange === void 0 ? void 0 : onChange((_isExpanded = !isExpanded) !== null && _isExpanded !== void 0 ? _isExpanded : !innerIsExpanded);
|
|
76
93
|
};
|
|
77
94
|
|
|
78
95
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
79
96
|
theme: colorsTheme.accordion
|
|
80
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
97
|
+
}, /*#__PURE__*/_react["default"].createElement(AccordionContainer, {
|
|
98
|
+
isExpanded: isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded,
|
|
81
99
|
padding: padding,
|
|
82
|
-
margin: margin
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
100
|
+
margin: margin
|
|
101
|
+
}, /*#__PURE__*/_react["default"].createElement(AccordionHeader, null, /*#__PURE__*/_react["default"].createElement(AccordionTrigger, {
|
|
102
|
+
id: "accordion-".concat(id),
|
|
103
|
+
onClick: disabled ? undefined : handleAccordionState,
|
|
86
104
|
disabled: disabled,
|
|
87
|
-
|
|
88
|
-
expanded: isExpanded
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
tabIndex: disabled ? -1 : tabIndex
|
|
105
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
106
|
+
"aria-expanded": isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded,
|
|
107
|
+
"aria-controls": "accordion-panel-".concat(id),
|
|
108
|
+
isExpanded: isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded
|
|
92
109
|
}, /*#__PURE__*/_react["default"].createElement(AccordionInfo, {
|
|
93
110
|
disabled: disabled
|
|
94
|
-
}, icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
111
|
+
}, /*#__PURE__*/_react["default"].createElement(AccordionLabel, null, icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
95
112
|
disabled: disabled
|
|
96
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(
|
|
113
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
97
114
|
src: icon
|
|
98
|
-
}) : icon), /*#__PURE__*/_react["default"].createElement(
|
|
115
|
+
}) : icon), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
116
|
+
color: disabled ? colorsTheme.accordion.disabledTitleLabelFontColor : colorsTheme.accordion.titleLabelFontColor,
|
|
117
|
+
fontFamily: colorsTheme.accordion.titleLabelFontFamily,
|
|
118
|
+
fontSize: colorsTheme.accordion.titleLabelFontSize,
|
|
119
|
+
fontStyle: colorsTheme.accordion.titleLabelFontStyle,
|
|
120
|
+
fontWeight: colorsTheme.accordion.titleLabelFontWeight,
|
|
121
|
+
lineHeight: "1.5em"
|
|
122
|
+
}, label)), assistiveText && /*#__PURE__*/_react["default"].createElement(AccordionAssistiveText, {
|
|
99
123
|
disabled: disabled
|
|
100
|
-
},
|
|
124
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
125
|
+
color: disabled ? colorsTheme.accordion.disabledAssistiveTextFontColor : colorsTheme.accordion.assistiveTextFontColor,
|
|
126
|
+
fontFamily: colorsTheme.accordion.assistiveTextFontFamily,
|
|
127
|
+
fontSize: colorsTheme.accordion.assistiveTextFontSize,
|
|
128
|
+
fontStyle: colorsTheme.accordion.assistiveTextFontStyle,
|
|
129
|
+
fontWeight: colorsTheme.accordion.assistiveTextFontWeight,
|
|
130
|
+
letterSpacing: colorsTheme.accordion.assistiveTextLetterSpacing,
|
|
131
|
+
lineHeight: "1.5em"
|
|
132
|
+
}, assistiveText))), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
101
133
|
disabled: disabled
|
|
134
|
+
}, (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) ? expandLess : expandMore))), (isExpanded !== null && isExpanded !== void 0 ? isExpanded : innerIsExpanded) && /*#__PURE__*/_react["default"].createElement(AccordionPanel, {
|
|
135
|
+
id: "accordion-panel-".concat(id),
|
|
136
|
+
role: "region",
|
|
137
|
+
"aria-labelledby": "accordion-".concat(id),
|
|
138
|
+
padding: padding
|
|
102
139
|
}, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
103
140
|
color: colorsTheme.accordion.backgroundColor
|
|
104
|
-
}, children))))
|
|
141
|
+
}, children))));
|
|
105
142
|
};
|
|
106
143
|
|
|
107
144
|
var calculateWidth = function calculateWidth(margin) {
|
|
108
145
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
109
146
|
};
|
|
110
147
|
|
|
111
|
-
var
|
|
148
|
+
var AccordionContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n background-color: ", ";\n border-radius: ", ";\n ", "\n box-shadow: ", ";\n min-width: 280px;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: ", ";\n"])), function (props) {
|
|
149
|
+
return props.theme.backgroundColor;
|
|
150
|
+
}, function (props) {
|
|
151
|
+
return props.theme.borderRadius;
|
|
152
|
+
}, function (props) {
|
|
153
|
+
return props.isExpanded && "border-bottom-left-radius: 0; border-bottom-right-radius: 0;";
|
|
154
|
+
}, function (props) {
|
|
155
|
+
return "".concat(props.theme.boxShadowOffsetX, " ").concat(props.theme.boxShadowOffsetY, " ").concat(props.theme.boxShadowBlur, " ").concat(props.theme.boxShadowColor);
|
|
156
|
+
}, function (props) {
|
|
112
157
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
113
158
|
}, function (props) {
|
|
114
159
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -120,33 +165,27 @@ var DXCAccordion = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
120
165
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
121
166
|
}, function (props) {
|
|
122
167
|
return calculateWidth(props.margin);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}, function (props) {
|
|
128
|
-
return "".concat(props.theme.boxShadowOffsetX, " ").concat(props.theme.boxShadowOffsetY, " ").concat(props.theme.boxShadowBlur, " ").concat(props.theme.boxShadowColor);
|
|
129
|
-
}, function (props) {
|
|
130
|
-
return props.theme.borderRadius;
|
|
131
|
-
}, function (props) {
|
|
132
|
-
return props.theme.borderRadius;
|
|
133
|
-
}, function (props) {
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
var AccordionHeader = _styledComponents["default"].h3(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n min-height: 48px;\n margin: 0;\n"])));
|
|
171
|
+
|
|
172
|
+
var AccordionTrigger = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 24px;\n width: 100%;\n background-color: transparent;\n border: none;\n border-radius: ", ";\n ", "\n padding: 12px 16px;\n cursor: ", ";\n\n :focus {\n outline: ", ";\n }\n :hover:enabled {\n background-color: ", ";\n }\n :active:enabled {\n background-color: ", ";\n }\n"])), function (props) {
|
|
134
173
|
return props.theme.borderRadius;
|
|
135
174
|
}, function (props) {
|
|
136
|
-
return props.
|
|
137
|
-
}, function (props) {
|
|
138
|
-
return props.theme.focusBorderStyle;
|
|
175
|
+
return props.isExpanded && "border-bottom-left-radius: 0; border-bottom-right-radius: 0;";
|
|
139
176
|
}, function (props) {
|
|
140
|
-
return props.
|
|
177
|
+
return props.disabled ? "not-allowed" : "pointer";
|
|
141
178
|
}, function (props) {
|
|
142
|
-
return props.theme.
|
|
179
|
+
return "".concat(props.theme.focusBorderColor, " ").concat(props.theme.focusBorderStyle, " ").concat(props.theme.focusBorderThickness);
|
|
143
180
|
}, function (props) {
|
|
144
181
|
return "".concat(props.theme.hoverBackgroundColor);
|
|
145
182
|
}, function (props) {
|
|
146
183
|
return "".concat(props.theme.hoverBackgroundColor);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
var AccordionInfo = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
187
|
+
|
|
188
|
+
var AccordionLabel = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding-top: ", ";\n padding-bottom: ", ";\n padding-right: ", ";\n padding-left: ", ";\n"])), function (props) {
|
|
150
189
|
return props.theme.titleLabelPaddingTop;
|
|
151
190
|
}, function (props) {
|
|
152
191
|
return props.theme.titleLabelPaddingBottom;
|
|
@@ -154,73 +193,47 @@ var DXCAccordion = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
154
193
|
return props.theme.titleLabelPaddingRight;
|
|
155
194
|
}, function (props) {
|
|
156
195
|
return props.theme.titleLabelPaddingLeft;
|
|
157
|
-
}, function (props) {
|
|
158
|
-
return props.disabled ? props.theme.disabledArrowColor : props.theme.arrowColor;
|
|
159
|
-
}, function (props) {
|
|
160
|
-
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
|
|
161
|
-
}, function (props) {
|
|
162
|
-
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
163
|
-
}, function (props) {
|
|
164
|
-
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.right ? _variables.spaces[props.padding.right] : "";
|
|
165
|
-
}, function (props) {
|
|
166
|
-
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
|
|
167
|
-
}, function (props) {
|
|
168
|
-
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
169
196
|
});
|
|
170
197
|
|
|
171
|
-
var
|
|
172
|
-
return props.theme.
|
|
173
|
-
}, function (props) {
|
|
174
|
-
return props.theme.titlePaddingRight;
|
|
175
|
-
}, function (props) {
|
|
176
|
-
return props.theme.titleLabelFontFamily;
|
|
198
|
+
var IconContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-left: ", ";\n margin-right: ", ";\n color: ", ";\n\n svg,\n img {\n height: ", ";\n width: ", ";\n }\n"])), function (props) {
|
|
199
|
+
return props.theme.iconMarginLeft;
|
|
177
200
|
}, function (props) {
|
|
178
|
-
return props.theme.
|
|
201
|
+
return props.theme.iconMarginRigth;
|
|
179
202
|
}, function (props) {
|
|
180
|
-
return props.theme.
|
|
203
|
+
return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
|
|
181
204
|
}, function (props) {
|
|
182
|
-
return props.theme.
|
|
205
|
+
return props.theme.iconSize;
|
|
183
206
|
}, function (props) {
|
|
184
|
-
return props.
|
|
207
|
+
return props.theme.iconSize;
|
|
185
208
|
});
|
|
186
209
|
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
var AccordionAssistiveText = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n padding-left: ", ";\n padding-right: ", ";\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: ", ";\n text-align: end;\n"])), function (props) {
|
|
210
|
+
var AccordionAssistiveText = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n min-width: ", ";\n padding-left: ", ";\n padding-right: ", ";\n"])), function (props) {
|
|
211
|
+
return props.theme.assistiveTextMinWidth;
|
|
212
|
+
}, function (props) {
|
|
192
213
|
return props.theme.assistiveTextPaddingLeft;
|
|
193
214
|
}, function (props) {
|
|
194
215
|
return props.theme.assistiveTextPaddingRight;
|
|
195
|
-
}, function (props) {
|
|
196
|
-
return props.theme.assistiveTextFontSize;
|
|
197
|
-
}, function (props) {
|
|
198
|
-
return props.theme.assistiveTextFontFamily;
|
|
199
|
-
}, function (props) {
|
|
200
|
-
return props.theme.assistiveTextFontStyle;
|
|
201
|
-
}, function (props) {
|
|
202
|
-
return props.theme.assistiveTextFontWeight;
|
|
203
|
-
}, function (props) {
|
|
204
|
-
return props.disabled ? props.theme.disabledAssistiveTextFontColor : props.theme.assistiveTextFontColor;
|
|
205
|
-
}, function (props) {
|
|
206
|
-
return props.theme.assistiveTextLetterSpacing;
|
|
207
|
-
}, function (props) {
|
|
208
|
-
return props.theme.assistiveTextMinWidth;
|
|
209
216
|
});
|
|
210
217
|
|
|
211
|
-
var
|
|
212
|
-
return props.theme.
|
|
218
|
+
var CollapseIndicator = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n color: ", ";\n"])), function (props) {
|
|
219
|
+
return props.disabled ? props.theme.disabledArrowColor : props.theme.arrowColor;
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
var AccordionPanel = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (props) {
|
|
223
|
+
return props.theme.borderRadius;
|
|
213
224
|
}, function (props) {
|
|
214
|
-
return props.theme.
|
|
225
|
+
return props.theme.borderRadius;
|
|
215
226
|
}, function (props) {
|
|
216
|
-
return props.
|
|
227
|
+
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
|
|
217
228
|
}, function (props) {
|
|
218
|
-
return props.
|
|
229
|
+
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
219
230
|
}, function (props) {
|
|
220
|
-
return props.
|
|
231
|
+
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.right ? _variables.spaces[props.padding.right] : "";
|
|
232
|
+
}, function (props) {
|
|
233
|
+
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
|
|
234
|
+
}, function (props) {
|
|
235
|
+
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
221
236
|
});
|
|
222
237
|
|
|
223
|
-
var AccordionIcon = _styledComponents["default"].img(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
224
|
-
|
|
225
238
|
var _default = DxcAccordion;
|
|
226
239
|
exports["default"] = _default;
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
const folderIcon = (
|
|
16
16
|
<svg
|
|
17
17
|
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
-
|
|
18
|
+
enableBackground="new 0 0 24 24"
|
|
19
19
|
height="24px"
|
|
20
20
|
viewBox="0 0 24 24"
|
|
21
21
|
width="24px"
|
|
@@ -30,10 +30,33 @@ const folderIcon = (
|
|
|
30
30
|
</svg>
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
-
const
|
|
34
|
-
<svg xmlns="http://www.w3.org/2000/svg"
|
|
35
|
-
<path d="
|
|
36
|
-
|
|
33
|
+
const smallIcon = (
|
|
34
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
|
|
35
|
+
<path d="m7.646 18.333-.313-2.625q-.208-.125-.458-.27-.25-.146-.458-.271l-2.438 1.021-2.354-4.063 2.083-1.583V9.458L1.625 7.875l2.354-4.063 2.438 1.021q.208-.125.458-.27.25-.146.458-.271l.313-2.625h4.708l.313 2.625q.208.125.458.271.25.145.458.27l2.438-1.021 2.354 4.063-2.063 1.583v1.084l2.063 1.583-2.354 4.063-2.438-1.021q-.208.125-.458.271-.25.145-.458.27l-.313 2.625ZM10 12.979q1.229 0 2.104-.875T12.979 10q0-1.229-.875-2.104T10 7.021q-1.229 0-2.104.875T7.021 10q0 1.229.875 2.104t2.104.875Zm0-1.75q-.5 0-.865-.364-.364-.365-.364-.865t.364-.865q.365-.364.865-.364t.865.364q.364.365.364.865t-.364.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.166q.605-.167 1.167-.5.562-.334 1.021-.792l2.021.854.833-1.375-1.771-1.354q.104-.292.146-.604.042-.313.042-.646 0-.292-.042-.594t-.125-.635l1.771-1.375-.834-1.375-2.02.875q-.48-.479-1.032-.802-.552-.323-1.156-.49l-.271-2.187H9.167l-.271 2.187q-.604.167-1.156.49-.552.323-1.011.781l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.459.458 1.011.781.552.323 1.156.49Z" />
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const facebookIcon = (
|
|
40
|
+
<svg
|
|
41
|
+
version="1.1"
|
|
42
|
+
id="Capa_1"
|
|
43
|
+
x="0px"
|
|
44
|
+
y="0px"
|
|
45
|
+
width="438.536px"
|
|
46
|
+
height="438.536px"
|
|
47
|
+
viewBox="0 0 438.536 438.536"
|
|
48
|
+
fill="currentColor"
|
|
49
|
+
>
|
|
50
|
+
<g>
|
|
51
|
+
<path
|
|
52
|
+
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
53
|
+
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
54
|
+
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
55
|
+
C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
|
|
56
|
+
c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
|
|
57
|
+
c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
58
|
+
/>
|
|
59
|
+
</g>
|
|
37
60
|
</svg>
|
|
38
61
|
);
|
|
39
62
|
|
|
@@ -78,8 +101,30 @@ export const Chromatic = () => (
|
|
|
78
101
|
</DxcAccordion>
|
|
79
102
|
</ExampleContainer>
|
|
80
103
|
<ExampleContainer>
|
|
81
|
-
<Title title="With
|
|
82
|
-
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon={
|
|
104
|
+
<Title title="With smaller icon" theme="light" level={4} />
|
|
105
|
+
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon={smallIcon}>
|
|
106
|
+
<div>
|
|
107
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
108
|
+
lobortis eget.
|
|
109
|
+
</div>
|
|
110
|
+
</DxcAccordion>
|
|
111
|
+
</ExampleContainer>
|
|
112
|
+
<ExampleContainer>
|
|
113
|
+
<Title title="With bigger icon (SVG)" theme="light" level={4} />
|
|
114
|
+
<DxcAccordion label="Accordion" assistiveText="Assistive text" icon={facebookIcon}>
|
|
115
|
+
<div>
|
|
116
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
117
|
+
lobortis eget.
|
|
118
|
+
</div>
|
|
119
|
+
</DxcAccordion>
|
|
120
|
+
</ExampleContainer>
|
|
121
|
+
<ExampleContainer>
|
|
122
|
+
<Title title="With bigger icon (image)" theme="light" level={4} />
|
|
123
|
+
<DxcAccordion
|
|
124
|
+
label="Accordion"
|
|
125
|
+
assistiveText="Assistive text"
|
|
126
|
+
icon="https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png"
|
|
127
|
+
>
|
|
83
128
|
<div>
|
|
84
129
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo
|
|
85
130
|
lobortis eget.
|
|
@@ -133,14 +178,8 @@ export const Chromatic = () => (
|
|
|
133
178
|
icon={folderIcon}
|
|
134
179
|
padding="medium"
|
|
135
180
|
>
|
|
136
|
-
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
137
|
-
<DxcTextInput
|
|
138
|
-
label="Label"
|
|
139
|
-
helperText="HelperText"
|
|
140
|
-
placeholder="Placeholder"
|
|
141
|
-
size="fillParent"
|
|
142
|
-
margin={{ bottom: "medium" }}
|
|
143
|
-
/>
|
|
181
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "36px" }}>
|
|
182
|
+
<DxcTextInput label="Label" helperText="HelperText" placeholder="Placeholder" size="fillParent" />
|
|
144
183
|
<DxcButton label="Submit" size="medium" />
|
|
145
184
|
</div>
|
|
146
185
|
</DxcAccordion>
|
|
@@ -9,20 +9,19 @@ var _react2 = require("@testing-library/react");
|
|
|
9
9
|
var _Accordion = _interopRequireDefault(require("./Accordion"));
|
|
10
10
|
|
|
11
11
|
describe("Accordion component tests", function () {
|
|
12
|
-
test("
|
|
13
|
-
var onChange = jest.fn();
|
|
14
|
-
|
|
12
|
+
test("Renders with correct aria accessibility attributes", function () {
|
|
15
13
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
|
|
16
14
|
label: "Accordion",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getByText = _render.getByText;
|
|
15
|
+
defaultIsExpanded: true
|
|
16
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "test-expanded"))),
|
|
17
|
+
getByRole = _render.getByRole;
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
var accordion = getByRole("button");
|
|
20
|
+
var panel = getByRole("region");
|
|
21
|
+
expect(accordion.getAttribute("aria-controls")).toBe(panel.id);
|
|
22
|
+
expect(panel.getAttribute("aria-labelledby")).toBe(accordion.id);
|
|
24
23
|
});
|
|
25
|
-
test("
|
|
24
|
+
test("Renders expanded by default when it is uncontrolled", function () {
|
|
26
25
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Accordion["default"], {
|
|
27
26
|
label: "Accordion",
|
|
28
27
|
defaultIsExpanded: true
|
package/accordion/types.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
declare type Margin = {
|
|
2
|
+
export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
export declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type Padding = {
|
|
9
|
+
export declare type Padding = {
|
|
10
10
|
top?: Space;
|
|
11
11
|
bottom?: Space;
|
|
12
12
|
left?: Space;
|
|
13
13
|
right?: Space;
|
|
14
14
|
};
|
|
15
|
-
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
15
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
16
16
|
declare type Props = {
|
|
17
17
|
/**
|
|
18
18
|
* The panel label.
|
|
@@ -56,6 +56,7 @@ declare type Props = {
|
|
|
56
56
|
*/
|
|
57
57
|
margin?: Space | Margin;
|
|
58
58
|
/**
|
|
59
|
+
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
59
60
|
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
60
61
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
61
62
|
*/
|
|
@@ -98,6 +98,7 @@ var DxcAccordionGroup = function DxcAccordionGroup(_ref2) {
|
|
|
98
98
|
return child.type === AccordionGroupAccordion;
|
|
99
99
|
}).map(function (accordion, index) {
|
|
100
100
|
return /*#__PURE__*/_react["default"].createElement(AccordionGroupAccordionContext.Provider, {
|
|
101
|
+
key: "accordion-".concat(index),
|
|
101
102
|
value: _objectSpread({
|
|
102
103
|
index: index
|
|
103
104
|
}, contextValue)
|
|
@@ -111,7 +112,7 @@ var calculateWidth = function calculateWidth(margin) {
|
|
|
111
112
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
112
113
|
};
|
|
113
114
|
|
|
114
|
-
var AccordionGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
115
|
+
var AccordionGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n\n > div:not(:last-of-type):not(:only-of-type) {\n border-bottom: ", ";\n border-color: ", ";\n }\n > div:not(:first-of-type):not(:last-of-type):not(:only-of-type) {\n border-radius: 0;\n & > h3 > button {\n border-radius: 0;\n }\n }\n > div:first-of-type:not(:only-of-type) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n\n & > h3 > button {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n }\n > div:last-of-type:not(:only-of-type) {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n\n & > h3 > button {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n }\n"])), function (props) {
|
|
115
116
|
return calculateWidth(props.margin);
|
|
116
117
|
}, function (_ref3) {
|
|
117
118
|
var margin = _ref3.margin;
|
|
@@ -138,26 +139,6 @@ var AccordionGroupContainer = _styledComponents["default"].div(_templateObject |
|
|
|
138
139
|
return props.theme.borderRadius;
|
|
139
140
|
}, function (props) {
|
|
140
141
|
return props.theme.borderRadius;
|
|
141
|
-
}, function (props) {
|
|
142
|
-
return "".concat(props.theme.accordionGroupSeparatorBorderThickness, " ").concat(props.theme.accordionGroupSeparatorBorderStyle);
|
|
143
|
-
}, function (props) {
|
|
144
|
-
return props.theme.accordionGroupSeparatorBorderColor;
|
|
145
|
-
}, function (props) {
|
|
146
|
-
return props.theme.borderRadius;
|
|
147
|
-
}, function (props) {
|
|
148
|
-
return props.theme.borderRadius;
|
|
149
|
-
}, function (props) {
|
|
150
|
-
return props.theme.borderRadius;
|
|
151
|
-
}, function (props) {
|
|
152
|
-
return props.theme.borderRadius;
|
|
153
|
-
}, function (props) {
|
|
154
|
-
return props.theme.borderRadius;
|
|
155
|
-
}, function (props) {
|
|
156
|
-
return props.theme.borderRadius;
|
|
157
|
-
}, function (props) {
|
|
158
|
-
return props.theme.borderRadius;
|
|
159
|
-
}, function (props) {
|
|
160
|
-
return props.theme.borderRadius;
|
|
161
142
|
}, function (props) {
|
|
162
143
|
return props.theme.borderRadius;
|
|
163
144
|
}, function (props) {
|