@dxc-technology/halstack-react 0.0.0-1b3d457 → 0.0.0-1b8b460
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 -8
- package/accordion/types.d.ts +1 -0
- package/accordion-group/types.d.ts +1 -0
- package/box/types.d.ts +1 -0
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +16 -16
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/types.d.ts +4 -0
- package/common/variables.js +129 -125
- 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 +4 -4
- package/dialog/Dialog.stories.tsx +56 -0
- package/dialog/types.d.ts +1 -0
- package/dropdown/Dropdown.js +37 -33
- package/dropdown/Dropdown.test.js +19 -25
- package/dropdown/DropdownMenuItem.js +1 -1
- 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 +1 -1
- package/flex/Flex.js +31 -19
- package/flex/types.d.ts +14 -3
- package/footer/types.d.ts +1 -0
- package/header/types.d.ts +1 -0
- package/link/Link.js +1 -1
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +7 -12
- package/paginator/Paginator.js +2 -2
- package/paginator/Paginator.test.js +1 -1
- package/password-input/PasswordInput.test.js +13 -12
- package/quick-nav/QuickNav.js +11 -12
- package/quick-nav/QuickNav.stories.tsx +97 -19
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +15 -13
- 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 +23 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Select.js +3 -1
- package/select/Select.stories.tsx +2 -5
- package/select/Select.test.js +267 -209
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +15 -11
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +2 -2
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +93 -82
- package/switch/Switch.test.js +26 -13
- package/switch/types.d.ts +6 -1
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tabs.js +3 -3
- package/tabs/Tabs.stories.tsx +0 -1
- package/tabs-nav/Tab.js +1 -1
- package/text-input/Suggestion.js +32 -5
- package/text-input/TextInput.js +165 -151
- package/text-input/TextInput.stories.tsx +6 -1
- package/text-input/TextInput.test.js +658 -647
- package/text-input/types.d.ts +5 -0
- package/common/RequiredComponent.js +0 -32
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,8 +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;
|
|
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;
|
|
172
171
|
var radioGroupTokens = componentTokensCopy.radioGroup;
|
|
173
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;
|
|
174
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;
|
|
@@ -242,12 +241,12 @@ var parseTheme = function parseTheme(theme) {
|
|
|
242
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;
|
|
243
242
|
var wizardTokens = componentTokensCopy.wizard;
|
|
244
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;
|
|
245
|
-
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;
|
|
246
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;
|
|
247
|
-
wizardTokens.visitedLabelFontColor = (_theme$wizard$
|
|
248
|
-
wizardTokens.selectedLabelFontColor = (_theme$wizard$
|
|
249
|
-
wizardTokens.visitedHelperTextFontColor = (_theme$wizard$
|
|
250
|
-
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;
|
|
251
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;
|
|
252
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;
|
|
253
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/types.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -31,6 +31,7 @@ export declare type AccordionPropsType = {
|
|
|
31
31
|
*/
|
|
32
32
|
disabled?: boolean;
|
|
33
33
|
/**
|
|
34
|
+
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
34
35
|
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
35
36
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
36
37
|
*/
|
package/box/types.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ declare type Props = {
|
|
|
31
31
|
*/
|
|
32
32
|
margin?: Space | Margin;
|
|
33
33
|
/**
|
|
34
|
+
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
34
35
|
* Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
35
36
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
36
37
|
*/
|
package/card/types.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare type Props = {
|
|
|
47
47
|
*/
|
|
48
48
|
margin?: Space | Size;
|
|
49
49
|
/**
|
|
50
|
+
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
50
51
|
* Size of the padding to be applied to the content area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
51
52
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
52
53
|
*/
|
package/checkbox/Checkbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import CheckboxPropsType from "./types";
|
|
3
|
-
declare const DxcCheckbox:
|
|
3
|
+
declare const DxcCheckbox: React.ForwardRefExoticComponent<CheckboxPropsType & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default DxcCheckbox;
|
package/checkbox/Checkbox.js
CHANGED
|
@@ -46,7 +46,7 @@ var checkedIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
46
46
|
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
47
47
|
}));
|
|
48
48
|
|
|
49
|
-
var DxcCheckbox = function
|
|
49
|
+
var DxcCheckbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
50
50
|
var checked = _ref.checked,
|
|
51
51
|
_ref$defaultChecked = _ref.defaultChecked,
|
|
52
52
|
defaultChecked = _ref$defaultChecked === void 0 ? false : _ref$defaultChecked,
|
|
@@ -96,7 +96,6 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
96
96
|
var handleKeyboard = function handleKeyboard(event) {
|
|
97
97
|
switch (event.key) {
|
|
98
98
|
case " ":
|
|
99
|
-
case "Space":
|
|
100
99
|
event.preventDefault();
|
|
101
100
|
handleCheckboxChange();
|
|
102
101
|
}
|
|
@@ -110,7 +109,8 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
110
109
|
margin: margin,
|
|
111
110
|
size: size,
|
|
112
111
|
checked: checked !== null && checked !== void 0 ? checked : innerChecked,
|
|
113
|
-
backgroundType: backgroundType
|
|
112
|
+
backgroundType: backgroundType,
|
|
113
|
+
ref: ref
|
|
114
114
|
}, label && labelPosition === "before" && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
115
115
|
id: labelId,
|
|
116
116
|
disabled: disabled,
|
|
@@ -140,7 +140,7 @@ var DxcCheckbox = function DxcCheckbox(_ref) {
|
|
|
140
140
|
disabled: disabled,
|
|
141
141
|
backgroundType: backgroundType
|
|
142
142
|
}, optional && "".concat(translatedLabels.formFields.optionalLabel, " "), label)));
|
|
143
|
-
};
|
|
143
|
+
});
|
|
144
144
|
|
|
145
145
|
var sizes = {
|
|
146
146
|
small: "120px",
|
|
@@ -174,7 +174,7 @@ var getDisabledColor = function getDisabledColor(props, element) {
|
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
var
|
|
177
|
+
var getEnabledColor = function getEnabledColor(props, element) {
|
|
178
178
|
switch (element) {
|
|
179
179
|
case "check":
|
|
180
180
|
return props.backgroundType && props.backgroundType === "dark" ? props.theme.checkColorOnDark : props.theme.checkColor;
|
|
@@ -197,7 +197,7 @@ var getNotDisabledColor = function getNotDisabledColor(props, element) {
|
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
200
|
-
return props.disabled ? getDisabledColor(props, "label") :
|
|
200
|
+
return props.disabled ? getDisabledColor(props, "label") : getEnabledColor(props, "label");
|
|
201
201
|
}, function (props) {
|
|
202
202
|
return props.theme.fontFamily;
|
|
203
203
|
}, function (props) {
|
|
@@ -210,19 +210,21 @@ var ValueInput = _styledComponents["default"].input(_templateObject2 || (_templa
|
|
|
210
210
|
|
|
211
211
|
var CheckboxContainer = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
|
|
212
212
|
|
|
213
|
-
var Checkbox = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 18px;\n width: 18px;\n border: solid
|
|
214
|
-
return props.disabled ? getDisabledColor(props, "border") :
|
|
213
|
+
var Checkbox = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 18px;\n width: 18px;\n border: 2px solid\n ", ";\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n\n &:focus {\n outline: 2px solid\n ", ";\n outline-offset: 2px;\n }\n svg {\n position: absolute;\n width: 22px;\n height: 22px;\n }\n ", "\n"])), function (props) {
|
|
214
|
+
return props.disabled ? getDisabledColor(props, "border") : getEnabledColor(props, "border");
|
|
215
215
|
}, function (props) {
|
|
216
|
-
return props.checked ? props.disabled ? getDisabledColor(props, "check") :
|
|
216
|
+
return props.checked ? props.disabled ? getDisabledColor(props, "check") : getEnabledColor(props, "check") : "transparent";
|
|
217
217
|
}, function (props) {
|
|
218
|
-
return props.disabled ? getDisabledColor(props, "background") :
|
|
218
|
+
return props.disabled ? getDisabledColor(props, "background") : getEnabledColor(props, "background");
|
|
219
219
|
}, function (props) {
|
|
220
220
|
return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
|
|
221
221
|
}, function (props) {
|
|
222
222
|
return props.disabled && "pointer-events: none;";
|
|
223
223
|
});
|
|
224
224
|
|
|
225
|
-
var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n
|
|
225
|
+
var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n cursor: ", ";\n\n &:hover ", " {\n border: 2px solid\n ", ";\n background-color: ", ";\n color: ", ";\n }\n"])), function (props) {
|
|
226
|
+
return props.theme.checkLabelSpacing;
|
|
227
|
+
}, function (props) {
|
|
226
228
|
return calculateWidth(props.margin, props.size);
|
|
227
229
|
}, function (props) {
|
|
228
230
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -236,14 +238,12 @@ var MainContainer = _styledComponents["default"].div(_templateObject5 || (_templ
|
|
|
236
238
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
237
239
|
}, function (props) {
|
|
238
240
|
return props.disabled ? "not-allowed" : "pointer";
|
|
239
|
-
}, function (props) {
|
|
240
|
-
return props.theme.checkLabelSpacing;
|
|
241
241
|
}, Checkbox, function (props) {
|
|
242
|
-
return props.disabled ? getDisabledColor(props, "border") :
|
|
242
|
+
return props.disabled ? getDisabledColor(props, "border") : getEnabledColor(props, "hoverBorder");
|
|
243
243
|
}, function (props) {
|
|
244
|
-
return props.checked ? props.disabled ? getDisabledColor(props, "check") :
|
|
244
|
+
return props.checked ? props.disabled ? getDisabledColor(props, "check") : getEnabledColor(props, "check") : "transparent";
|
|
245
245
|
}, function (props) {
|
|
246
|
-
return props.disabled ? getDisabledColor(props, "background") :
|
|
246
|
+
return props.disabled ? getDisabledColor(props, "background") : getEnabledColor(props, "hoverBackground");
|
|
247
247
|
});
|
|
248
248
|
|
|
249
249
|
var _default = DxcCheckbox;
|
|
@@ -4,7 +4,7 @@ import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
6
|
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
7
|
-
import
|
|
7
|
+
import styled from "styled-components";
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
title: "Checkbox",
|
|
@@ -17,29 +17,33 @@ const Checkbox = () => (
|
|
|
17
17
|
<Title title="Default" theme="light" level={4} />
|
|
18
18
|
<DxcCheckbox label="Checkbox" />
|
|
19
19
|
</ExampleContainer>
|
|
20
|
-
<ExampleContainer>
|
|
21
|
-
<Title title="Focused" theme="light" level={4} />
|
|
22
|
-
<DxcCheckbox label="Focused" />
|
|
23
|
-
</ExampleContainer>
|
|
24
20
|
<ExampleContainer>
|
|
25
21
|
<Title title="Checked" theme="light" level={4} />
|
|
26
22
|
<DxcCheckbox label="Checkbox" defaultChecked />
|
|
27
23
|
</ExampleContainer>
|
|
28
24
|
<ExampleContainer>
|
|
29
|
-
<Title title="
|
|
30
|
-
<DxcCheckbox label="Checkbox"
|
|
25
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
26
|
+
<DxcCheckbox label="Checkbox" disabled />
|
|
31
27
|
</ExampleContainer>
|
|
32
28
|
<ExampleContainer>
|
|
33
|
-
<Title title="Disabled and
|
|
34
|
-
<DxcCheckbox label="Checkbox" disabled defaultChecked />
|
|
29
|
+
<Title title="Disabled, checked and optional" theme="light" level={4} />
|
|
30
|
+
<DxcCheckbox label="Checkbox" disabled defaultChecked optional />
|
|
35
31
|
</ExampleContainer>
|
|
36
|
-
<ExampleContainer>
|
|
37
|
-
<Title title="
|
|
38
|
-
<DxcCheckbox label="
|
|
32
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
33
|
+
<Title title="Focused" theme="light" level={4} />
|
|
34
|
+
<DxcCheckbox label="Focused" />
|
|
35
|
+
</ExampleContainer>
|
|
36
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
37
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
38
|
+
<DxcCheckbox label="Hovered" />
|
|
39
|
+
</ExampleContainer>
|
|
40
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
41
|
+
<Title title="Hovered and checked" theme="light" level={4} />
|
|
42
|
+
<DxcCheckbox label="Hovered" defaultChecked />
|
|
39
43
|
</ExampleContainer>
|
|
40
44
|
<ExampleContainer>
|
|
41
|
-
<Title title="
|
|
42
|
-
<DxcCheckbox label="Checkbox"
|
|
45
|
+
<Title title="Optional" theme="light" level={4} />
|
|
46
|
+
<DxcCheckbox label="Checkbox" optional />
|
|
43
47
|
</ExampleContainer>
|
|
44
48
|
<ExampleContainer>
|
|
45
49
|
<Title title="Label after" theme="light" level={4} />
|
|
@@ -53,25 +57,9 @@ const Checkbox = () => (
|
|
|
53
57
|
<Title title="Optional with label after" theme="light" level={4} />
|
|
54
58
|
<DxcCheckbox label="Checkbox" optional labelPosition="after" />
|
|
55
59
|
</ExampleContainer>
|
|
56
|
-
<ExampleContainer>
|
|
57
|
-
<Title title="Disabled and checked with label after" theme="light" level={4} />
|
|
58
|
-
<DxcCheckbox label="Checkbox" disabled defaultChecked labelPosition="after" />
|
|
59
|
-
</ExampleContainer>
|
|
60
60
|
<ExampleContainer>
|
|
61
61
|
<Title title="Disabled and optional with label after" theme="light" level={4} />
|
|
62
|
-
<DxcCheckbox label="Checkbox" disabled
|
|
63
|
-
</ExampleContainer>
|
|
64
|
-
<ExampleContainer>
|
|
65
|
-
<Title title="Disabled, optional and checked with label after" theme="light" level={4} />
|
|
66
|
-
<DxcCheckbox label="Checkbox" disabled optional defaultChecked labelPosition="after" />
|
|
67
|
-
</ExampleContainer>
|
|
68
|
-
<ExampleContainer pseudoState="pseudo-hover">
|
|
69
|
-
<Title title="Hovered" theme="light" level={4} />
|
|
70
|
-
<DxcCheckbox label="Hovered" />
|
|
71
|
-
</ExampleContainer>
|
|
72
|
-
<ExampleContainer pseudoState="pseudo-hover">
|
|
73
|
-
<Title title="Hovered and checked" theme="light" level={4} />
|
|
74
|
-
<DxcCheckbox label="Hovered" defaultChecked />
|
|
62
|
+
<DxcCheckbox label="Checkbox" disabled labelPosition="after" optional />
|
|
75
63
|
</ExampleContainer>
|
|
76
64
|
<BackgroundColorProvider color="#333333">
|
|
77
65
|
<DarkContainer>
|
|
@@ -84,20 +72,28 @@ const Checkbox = () => (
|
|
|
84
72
|
<DxcCheckbox label="Checkbox" defaultChecked />
|
|
85
73
|
</ExampleContainer>
|
|
86
74
|
<ExampleContainer>
|
|
87
|
-
<Title title="
|
|
88
|
-
<DxcCheckbox label="Checkbox"
|
|
75
|
+
<Title title="Disabled" theme="dark" level={4} />
|
|
76
|
+
<DxcCheckbox label="Checkbox" disabled />
|
|
89
77
|
</ExampleContainer>
|
|
90
78
|
<ExampleContainer>
|
|
91
|
-
<Title title="Disabled and
|
|
92
|
-
<DxcCheckbox label="Checkbox" disabled defaultChecked />
|
|
79
|
+
<Title title="Disabled, checked and optional" theme="dark" level={4} />
|
|
80
|
+
<DxcCheckbox label="Checkbox" disabled defaultChecked optional />
|
|
93
81
|
</ExampleContainer>
|
|
94
|
-
<ExampleContainer>
|
|
95
|
-
<Title title="
|
|
96
|
-
<DxcCheckbox label="
|
|
82
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
83
|
+
<Title title="Focused" theme="dark" level={4} />
|
|
84
|
+
<DxcCheckbox label="Focused" />
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
87
|
+
<Title title="Hovered" theme="dark" level={4} />
|
|
88
|
+
<DxcCheckbox label="Hovered" />
|
|
89
|
+
</ExampleContainer>
|
|
90
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
91
|
+
<Title title="Hovered and checked" theme="dark" level={4} />
|
|
92
|
+
<DxcCheckbox label="Hovered" defaultChecked />
|
|
97
93
|
</ExampleContainer>
|
|
98
94
|
<ExampleContainer>
|
|
99
|
-
<Title title="
|
|
100
|
-
<DxcCheckbox label="Checkbox"
|
|
95
|
+
<Title title="Optional" theme="dark" level={4} />
|
|
96
|
+
<DxcCheckbox label="Checkbox" optional />
|
|
101
97
|
</ExampleContainer>
|
|
102
98
|
<ExampleContainer>
|
|
103
99
|
<Title title="Label after" theme="dark" level={4} />
|
|
@@ -111,25 +107,9 @@ const Checkbox = () => (
|
|
|
111
107
|
<Title title="Optional with label after" theme="dark" level={4} />
|
|
112
108
|
<DxcCheckbox label="Checkbox" optional labelPosition="after" />
|
|
113
109
|
</ExampleContainer>
|
|
114
|
-
<ExampleContainer>
|
|
115
|
-
<Title title="Disabled and checked with label after" theme="dark" level={4} />
|
|
116
|
-
<DxcCheckbox label="Checkbox" disabled defaultChecked labelPosition="after" />
|
|
117
|
-
</ExampleContainer>
|
|
118
110
|
<ExampleContainer>
|
|
119
111
|
<Title title="Disabled and optional with label after" theme="dark" level={4} />
|
|
120
|
-
<DxcCheckbox label="Checkbox" disabled
|
|
121
|
-
</ExampleContainer>
|
|
122
|
-
<ExampleContainer>
|
|
123
|
-
<Title title="Disabled, optional and checked with label after" theme="dark" level={4} />
|
|
124
|
-
<DxcCheckbox label="Checkbox" disabled optional defaultChecked labelPosition="after" />
|
|
125
|
-
</ExampleContainer>
|
|
126
|
-
<ExampleContainer pseudoState="pseudo-hover">
|
|
127
|
-
<Title title="Hovered" theme="dark" level={4} />
|
|
128
|
-
<DxcCheckbox label="Hovered" />
|
|
129
|
-
</ExampleContainer>
|
|
130
|
-
<ExampleContainer pseudoState="pseudo-hover">
|
|
131
|
-
<Title title="Hovered and checked" theme="dark" level={4} />
|
|
132
|
-
<DxcCheckbox label="Hovered" defaultChecked />
|
|
112
|
+
<DxcCheckbox label="Checkbox" disabled labelPosition="after" optional />
|
|
133
113
|
</ExampleContainer>
|
|
134
114
|
</DarkContainer>
|
|
135
115
|
</BackgroundColorProvider>
|
|
@@ -178,11 +158,51 @@ const Checkbox = () => (
|
|
|
178
158
|
<Title title="Xxlarge" theme="light" level={4} />
|
|
179
159
|
<DxcCheckbox label="Xxlarge" margin="xxlarge" />
|
|
180
160
|
</ExampleContainer>
|
|
161
|
+
<ExampleContainer>
|
|
162
|
+
<Title title="Overflow container" theme="light" level={4} />
|
|
163
|
+
<ScrollableContainer id="scroll-container">
|
|
164
|
+
<DxcCheckbox label="Checkbox" defaultChecked />
|
|
165
|
+
<DxcCheckbox label="Checkbox" defaultChecked />
|
|
166
|
+
<DxcCheckbox label="Checkbox" />
|
|
167
|
+
<DxcCheckbox label="Checkbox" defaultChecked />
|
|
168
|
+
<DxcCheckbox label="Checkbox" />
|
|
169
|
+
<DxcCheckbox label="Checkbox" />
|
|
170
|
+
<DxcCheckbox label="Checkbox" />
|
|
171
|
+
<DxcCheckbox label="Checkbox" defaultChecked />
|
|
172
|
+
</ScrollableContainer>
|
|
173
|
+
</ExampleContainer>
|
|
174
|
+
<ExampleContainer>
|
|
175
|
+
<Title title="Label overflow" theme="light" level={4} />
|
|
176
|
+
<SmallContainer>
|
|
177
|
+
<DxcCheckbox label="Very long label to check its overflowing" defaultChecked />
|
|
178
|
+
<DxcCheckbox label="Very long label to check its overflowing" labelPosition="after" />
|
|
179
|
+
</SmallContainer>
|
|
180
|
+
</ExampleContainer>
|
|
181
181
|
</>
|
|
182
182
|
);
|
|
183
183
|
|
|
184
184
|
export const Chromatic = Checkbox.bind({});
|
|
185
|
+
|
|
185
186
|
Chromatic.play = async () => {
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
const listEl = document.getElementById("scroll-container");
|
|
188
|
+
listEl?.scrollTo?.({ top: 50 });
|
|
188
189
|
};
|
|
190
|
+
|
|
191
|
+
const ScrollableContainer = styled.div`
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
gap: 14px;
|
|
195
|
+
width: 200px;
|
|
196
|
+
height: 200px;
|
|
197
|
+
border: 1px solid #000;
|
|
198
|
+
padding: 14px;
|
|
199
|
+
overflow: auto;
|
|
200
|
+
`;
|
|
201
|
+
|
|
202
|
+
const SmallContainer = styled.div`
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
gap: 14px;
|
|
206
|
+
width: 150px;
|
|
207
|
+
height: 150px;
|
|
208
|
+
`;
|