@dxc-technology/halstack-react 0.0.0-d30020b → 0.0.0-d3554d7

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.
Files changed (78) hide show
  1. package/ThemeContext.d.ts +4 -9
  2. package/ThemeContext.js +32 -32
  3. package/accordion/Accordion.test.js +57 -0
  4. package/accordion-group/AccordionGroup.test.js +133 -0
  5. package/alert/Alert.test.js +92 -0
  6. package/badge/Badge.d.ts +4 -0
  7. package/badge/types.d.ts +4 -0
  8. package/badge/types.js +5 -0
  9. package/box/Box.test.js +18 -0
  10. package/button/Button.test.js +35 -0
  11. package/card/Card.test.js +50 -0
  12. package/checkbox/Checkbox.test.js +65 -0
  13. package/chip/Chip.test.js +56 -0
  14. package/common/variables.js +0 -238
  15. package/date-input/DateInput.test.js +469 -0
  16. package/dialog/Dialog.test.js +40 -0
  17. package/dropdown/Dropdown.test.js +189 -0
  18. package/file-input/FileInput.test.js +457 -0
  19. package/footer/Footer.test.js +109 -0
  20. package/header/Header.test.js +63 -0
  21. package/heading/Heading.test.js +186 -0
  22. package/link/Link.test.js +91 -0
  23. package/main.d.ts +3 -6
  24. package/main.js +12 -36
  25. package/number-input/NumberInput.test.js +508 -0
  26. package/package.json +1 -1
  27. package/paginator/Paginator.test.js +266 -0
  28. package/password-input/PasswordInput.test.js +183 -0
  29. package/progress-bar/ProgressBar.test.js +65 -0
  30. package/radio/Radio.test.js +71 -0
  31. package/radio-group/Radio.d.ts +1 -1
  32. package/radio-group/Radio.js +24 -23
  33. package/radio-group/RadioGroup.js +38 -32
  34. package/radio-group/RadioGroup.stories.tsx +57 -40
  35. package/radio-group/RadioGroup.test.js +518 -72
  36. package/radio-group/types.d.ts +3 -2
  37. package/resultsetTable/ResultsetTable.test.js +306 -0
  38. package/select/Select.js +7 -1
  39. package/select/Select.stories.tsx +72 -62
  40. package/select/Select.test.js +1900 -0
  41. package/sidenav/Sidenav.test.js +56 -0
  42. package/slider/Slider.test.js +129 -0
  43. package/spinner/Spinner.test.js +64 -0
  44. package/switch/Switch.test.js +73 -0
  45. package/table/Table.test.js +26 -0
  46. package/tabs/Tabs.test.js +123 -0
  47. package/tag/Tag.test.js +60 -0
  48. package/text-input/TextInput.js +5 -3
  49. package/text-input/TextInput.stories.tsx +20 -2
  50. package/text-input/TextInput.test.js +1691 -0
  51. package/textarea/Textarea.js +5 -3
  52. package/textarea/Textarea.stories.jsx +30 -9
  53. package/textarea/Textarea.test.js +436 -0
  54. package/toggle-group/ToggleGroup.test.js +125 -0
  55. package/wizard/Wizard.test.js +128 -0
  56. package/V3Select/V3Select.js +0 -455
  57. package/V3Select/index.d.ts +0 -27
  58. package/V3Textarea/V3Textarea.js +0 -260
  59. package/V3Textarea/index.d.ts +0 -27
  60. package/date/Date.js +0 -373
  61. package/date/index.d.ts +0 -27
  62. package/input-text/Icons.js +0 -22
  63. package/input-text/InputText.js +0 -611
  64. package/input-text/index.d.ts +0 -36
  65. package/toggle/Toggle.js +0 -186
  66. package/toggle/index.d.ts +0 -21
  67. package/upload/Upload.js +0 -201
  68. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  69. package/upload/buttons-upload/Icons.js +0 -40
  70. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  71. package/upload/dragAndDropArea/Icons.js +0 -39
  72. package/upload/file-upload/FileToUpload.js +0 -115
  73. package/upload/file-upload/Icons.js +0 -66
  74. package/upload/files-upload/FilesToUpload.js +0 -109
  75. package/upload/index.d.ts +0 -15
  76. package/upload/transaction/Icons.js +0 -160
  77. package/upload/transaction/Transaction.js +0 -104
  78. package/upload/transactions/Transactions.js +0 -94
@@ -28,14 +28,16 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
28
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
29
29
 
30
30
  var DxcRadio = function DxcRadio(_ref) {
31
+ var _option$disabled;
32
+
31
33
  var option = _ref.option,
32
34
  currentValue = _ref.currentValue,
33
- _onClick = _ref.onClick,
34
- onFocus = _ref.onFocus,
35
+ onClick = _ref.onClick,
35
36
  error = _ref.error,
36
37
  disabled = _ref.disabled,
37
38
  focused = _ref.focused,
38
- readonly = _ref.readonly;
39
+ readonly = _ref.readonly,
40
+ tabIndex = _ref.tabIndex;
39
41
 
40
42
  var _useState = (0, _react.useState)("radio-".concat((0, _uuid.v4)())),
41
43
  _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
@@ -43,7 +45,13 @@ var DxcRadio = function DxcRadio(_ref) {
43
45
 
44
46
  var ref = (0, _react.useRef)(null);
45
47
  var colorsTheme = (0, _useTheme["default"])();
46
- var checked = option.value === currentValue;
48
+
49
+ var handleOnClick = function handleOnClick() {
50
+ var _ref$current;
51
+
52
+ onClick();
53
+ focused && document.activeElement !== (ref === null || ref === void 0 ? void 0 : ref.current) && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
54
+ };
47
55
 
48
56
  var _useState3 = (0, _react.useState)(true),
49
57
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
@@ -51,7 +59,7 @@ var DxcRadio = function DxcRadio(_ref) {
51
59
  setFirstUpdate = _useState4[1];
52
60
 
53
61
  (0, _react.useLayoutEffect)(function () {
54
- var _ref$current;
62
+ var _ref$current2;
55
63
 
56
64
  // Don't apply in the first render
57
65
  if (firstUpdate) {
@@ -59,7 +67,7 @@ var DxcRadio = function DxcRadio(_ref) {
59
67
  return;
60
68
  }
61
69
 
62
- focused && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
70
+ focused && (ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus());
63
71
  }, [focused]);
64
72
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
65
73
  theme: colorsTheme.radioGroup
@@ -68,28 +76,21 @@ var DxcRadio = function DxcRadio(_ref) {
68
76
  disabled: disabled,
69
77
  readonly: readonly,
70
78
  onMouseDown: function onMouseDown(event) {
71
- // Prevents div's onclick from stealing the radio button's focus
79
+ // Prevents div's onClick from stealing the radio input's focus
72
80
  event.preventDefault();
73
81
  },
74
- onClick: function onClick() {
75
- var _ref$current2;
76
-
77
- ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
78
-
79
- _onClick();
80
- }
82
+ onClick: handleOnClick
81
83
  }, /*#__PURE__*/_react["default"].createElement(RadioInputContainer, null, /*#__PURE__*/_react["default"].createElement(RadioInput, {
82
84
  error: error,
83
85
  disabled: disabled,
84
86
  readonly: readonly,
85
- onFocus: onFocus,
86
87
  role: "radio",
87
- "aria-checked": checked,
88
- "aria-disabled": option.disabled,
88
+ "aria-checked": option.value === currentValue,
89
+ "aria-disabled": (_option$disabled = option.disabled) !== null && _option$disabled !== void 0 ? _option$disabled : false,
89
90
  "aria-labelledby": radioLabelId,
90
- tabIndex: disabled ? -1 : focused ? 0 : -1,
91
+ tabIndex: disabled ? -1 : focused ? tabIndex : -1,
91
92
  ref: ref
92
- }, checked && /*#__PURE__*/_react["default"].createElement(Dot, {
93
+ }, option.value === currentValue && /*#__PURE__*/_react["default"].createElement(Dot, {
93
94
  disabled: disabled,
94
95
  readonly: readonly,
95
96
  error: error
@@ -101,18 +102,18 @@ var DxcRadio = function DxcRadio(_ref) {
101
102
 
102
103
  var RadioMainContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n"])));
103
104
 
104
- var RadioContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n cursor: ", ";\n \n ", "\n"])), function (props) {
105
+ var RadioContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n cursor: ", ";\n\n ", "\n"])), function (props) {
105
106
  return props.disabled ? "not-allowed" : props.readonly ? "default" : "pointer";
106
107
  }, function (props) {
107
- return !props.disabled && "\n &:hover {\n & > div > div { \n border-color: ".concat(props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor, ";\n & > span {\n background-color: ").concat(props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor, ";\n }\n };\n }\n &:active {\n & > div > div {\n border-color: ").concat(props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor, ";\n & > span {\n background-color: ").concat(props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor, ";\n }\n }\n }\n ");
108
+ return !props.disabled ? "\n &:hover {\n & > div > div { \n border-color: ".concat(props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor, ";\n & > span {\n background-color: ").concat(props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor, ";\n }\n };\n }\n &:active {\n & > div > div {\n border-color: ").concat(props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor, ";\n & > span {\n background-color: ").concat(props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor, ";\n }\n }\n }\n ") : "pointer-events: none;";
108
109
  });
109
110
 
110
111
  var RadioInputContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
111
112
 
112
- var RadioInput = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n border: 2px solid\n ", ";\n border-radius: 50%;\n box-shadow: 0 0 0 2px transparent;\n\n ", "\n"])), function (props) {
113
+ var RadioInput = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n border: 2px solid\n ", ";\n border-radius: 50%;\n\n ", "\n"])), function (props) {
113
114
  if (props.disabled) return props.theme.disabledRadioInputColor;else if (props.error) return props.theme.errorRadioInputColor;else if (props.readonly) return props.theme.readonlyRadioInputColor;else return props.theme.radioInputColor;
114
115
  }, function (props) {
115
- return !props.disabled ? "&:focus {\n outline: 2px solid ".concat(props.theme.focusBorderColor, ";\n outline-offset: 1px;\n }\n &:focus-visible {\n outline: 2px solid ").concat(props.theme.focusBorderColor, ";\n outline-offset: 1px;\n }\n ") : "\n pointer-events: none;\n :focus-visible {\n outline: none;\n }\n ";
116
+ return !props.disabled ? "&:focus {\n outline: 2px solid ".concat(props.theme.focusBorderColor, ";\n outline-offset: 1px;\n }\n &:focus-visible {\n outline: 2px solid ").concat(props.theme.focusBorderColor, ";\n outline-offset: 1px;\n }\n ") : "\n :focus-visible {\n outline: none;\n }\n ";
116
117
  });
117
118
 
118
119
  var Dot = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background-color: ", ";\n"])), function (props) {
@@ -57,7 +57,9 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
57
57
  value = _ref.value,
58
58
  onChange = _ref.onChange,
59
59
  onBlur = _ref.onBlur,
60
- error = _ref.error;
60
+ error = _ref.error,
61
+ _ref$tabIndex = _ref.tabIndex,
62
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
61
63
 
62
64
  var _useState = (0, _react.useState)("radio-group-".concat((0, _uuid.v4)())),
63
65
  _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
@@ -102,42 +104,46 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
102
104
 
103
105
  var handleOnBlur = function handleOnBlur(e) {
104
106
  // If the radio group loses the focus to an element not contained inside it...
105
- !e.currentTarget.contains(e.relatedTarget) && setFirstTimeFocus(true);
106
- var currentValue = value !== null && value !== void 0 ? value : innerValue;
107
- !optional && !Boolean(currentValue) ? onBlur === null || onBlur === void 0 ? void 0 : onBlur({
108
- value: currentValue,
109
- error: "This field is required. Please, choose an option."
110
- }) : onBlur === null || onBlur === void 0 ? void 0 : onBlur({
111
- value: currentValue
112
- });
107
+ if (!e.currentTarget.contains(e.relatedTarget)) {
108
+ setFirstTimeFocus(true);
109
+ var currentValue = value !== null && value !== void 0 ? value : innerValue;
110
+ !optional && !Boolean(currentValue) ? onBlur === null || onBlur === void 0 ? void 0 : onBlur({
111
+ value: currentValue,
112
+ error: "This field is required. Please, choose an option."
113
+ }) : onBlur === null || onBlur === void 0 ? void 0 : onBlur({
114
+ value: currentValue
115
+ });
116
+ }
117
+ };
118
+
119
+ var handleOnFocus = function handleOnFocus() {
120
+ firstTimeFocus && setFirstTimeFocus(false);
113
121
  };
114
122
 
115
123
  var setPreviousRadioChecked = function setPreviousRadioChecked() {
116
- if (!disabled) {
117
- setCurrentFocusIndex(function (currentFocusIndex) {
118
- var index = currentFocusIndex === 0 ? innerOptions.length - 1 : currentFocusIndex - 1;
124
+ setCurrentFocusIndex(function (currentFocusIndex) {
125
+ var index = currentFocusIndex === 0 ? innerOptions.length - 1 : currentFocusIndex - 1;
119
126
 
120
- while (innerOptions[index].disabled) {
121
- index = index === 0 ? innerOptions.length - 1 : index - 1;
122
- }
127
+ while (innerOptions[index].disabled) {
128
+ index = index === 0 ? innerOptions.length - 1 : index - 1;
129
+ }
123
130
 
124
- return index;
125
- });
126
- }
131
+ handleOnChange(innerOptions[index].value);
132
+ return index;
133
+ });
127
134
  };
128
135
 
129
136
  var setNextRadioChecked = function setNextRadioChecked() {
130
- if (!disabled) {
131
- setCurrentFocusIndex(function (currentFocusIndex) {
132
- var index = currentFocusIndex === innerOptions.length - 1 ? 0 : currentFocusIndex + 1;
137
+ setCurrentFocusIndex(function (currentFocusIndex) {
138
+ var index = currentFocusIndex === innerOptions.length - 1 ? 0 : currentFocusIndex + 1;
133
139
 
134
- while (innerOptions[index].disabled) {
135
- index = index === innerOptions.length - 1 ? 0 : index + 1;
136
- }
140
+ while (innerOptions[index].disabled) {
141
+ index = index === innerOptions.length - 1 ? 0 : index + 1;
142
+ }
137
143
 
138
- return index;
139
- });
140
- }
144
+ handleOnChange(innerOptions[index].value);
145
+ return index;
146
+ });
141
147
  };
142
148
 
143
149
  var handleOnKeyDown = function handleOnKeyDown(event) {
@@ -180,6 +186,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
180
186
  disabled: disabled
181
187
  }, helperText), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
182
188
  onBlur: handleOnBlur,
189
+ onFocus: handleOnFocus,
183
190
  onKeyDown: handleOnKeyDown,
184
191
  stacking: stacking,
185
192
  role: "radiogroup",
@@ -187,7 +194,8 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
187
194
  "aria-labelledby": radioGroupLabelId,
188
195
  "aria-invalid": error ? "true" : "false",
189
196
  "aria-errormessage": error ? errorId : undefined,
190
- "aria-required": !optional
197
+ "aria-required": !disabled && !readonly && !optional,
198
+ "aria-readonly": readonly
191
199
  }, /*#__PURE__*/_react["default"].createElement(ValueInput, {
192
200
  name: name,
193
201
  value: value !== null && value !== void 0 ? value : innerValue,
@@ -201,13 +209,11 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
201
209
  handleOnChange(option.value);
202
210
  setCurrentFocusIndex(index);
203
211
  },
204
- onFocus: function onFocus() {
205
- !firstTimeFocus ? handleOnChange(option.value) : setFirstTimeFocus(false);
206
- },
207
212
  error: error,
208
213
  disabled: option.disabled || disabled,
209
214
  focused: currentFocusIndex === index,
210
- readonly: readonly
215
+ readonly: readonly,
216
+ tabIndex: tabIndex
211
217
  });
212
218
  })), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
213
219
  id: errorId,
@@ -7,6 +7,8 @@ export default {
7
7
  component: DxcRadioGroup,
8
8
  };
9
9
 
10
+ const single_option = [{ label: "Option A", value: "A" }];
11
+
10
12
  const options = [
11
13
  { label: "Option 1", value: "1" },
12
14
  { label: "Option 2", value: "2" },
@@ -14,66 +16,81 @@ const options = [
14
16
  { label: "Option 4", value: "4" },
15
17
  ];
16
18
 
17
- const single_disabled_options = [
18
- { label: "Option 1", value: "1" },
19
- { label: "Option 2", value: "2", disabled: true },
20
- { label: "Option 3", value: "3" },
21
- ];
19
+ const single_disabled_options = [{ label: "Option A", value: "A", disabled: true }];
22
20
 
23
21
  export const Chromatic = () => (
24
22
  <>
23
+ <Title title="Radio input states" theme="light" level={2} />
25
24
  <ExampleContainer>
26
- <Title title="Label only" theme="light" level={4} />
27
- <DxcRadioGroup label="Example of a label only" options={options} />
25
+ <Title title="Enabled" theme="light" level={4} />
26
+ <DxcRadioGroup label="Example" defaultValue="A" options={single_option} />
27
+ </ExampleContainer>
28
+ <ExampleContainer pseudoState="pseudo-hover">
29
+ <Title title="Hovered" theme="light" level={4} />
30
+ <DxcRadioGroup label="Example" defaultValue="A" options={single_option} />
31
+ </ExampleContainer>
32
+ <ExampleContainer pseudoState="pseudo-active">
33
+ <Title title="Active" theme="light" level={4} />
34
+ <DxcRadioGroup label="Example" defaultValue="A" options={single_option} />
35
+ </ExampleContainer>
36
+ <ExampleContainer pseudoState="pseudo-focus">
37
+ <Title title="Focused" theme="light" level={4} />
38
+ <DxcRadioGroup label="Example" defaultValue="A" options={single_option} />
28
39
  </ExampleContainer>
29
40
  <ExampleContainer>
30
- <Title title="Column" theme="light" level={4} />
31
- <DxcRadioGroup label="Example" helperText="Helper text" options={options} defaultValue="3" />
41
+ <Title title="Disabled" theme="light" level={4} />
42
+ <DxcRadioGroup label="Example" options={single_disabled_options} defaultValue="A" />
32
43
  </ExampleContainer>
44
+ <Title title="Readonly radio input sub-states" theme="light" level={3} />
33
45
  <ExampleContainer>
34
- <Title title="Row" theme="light" level={4} />
35
- <DxcRadioGroup label="Example" helperText="Helper text" options={options} stacking="row" />
46
+ <Title title="Enabled" theme="light" level={4} />
47
+ <DxcRadioGroup label="Example" options={single_option} defaultValue="A" readonly />
48
+ </ExampleContainer>
49
+ <ExampleContainer pseudoState="pseudo-hover">
50
+ <Title title="Hovered" theme="light" level={4} />
51
+ <DxcRadioGroup label="Example" options={single_option} defaultValue="A" readonly />
52
+ </ExampleContainer>
53
+ <ExampleContainer pseudoState="pseudo-active">
54
+ <Title title="Active" theme="light" level={4} />
55
+ <DxcRadioGroup label="Example" options={single_option} defaultValue="A" readonly />
36
56
  </ExampleContainer>
57
+ <Title title="Error radio input sub-states" theme="light" level={3} />
37
58
  <ExampleContainer>
38
- <Title title="Disabled" theme="light" level={4} />
39
- <DxcRadioGroup
40
- label="Disabled"
41
- error="Error message"
42
- helperText="Helper text"
43
- options={options}
44
- disabled
45
- optional
46
- defaultValue="2"
47
- />
59
+ <Title title="Enabled" theme="light" level={4} />
60
+ <DxcRadioGroup label="Example" options={single_option} defaultValue="A" error="Error message" />
61
+ </ExampleContainer>
62
+ <ExampleContainer pseudoState="pseudo-hover">
63
+ <Title title="Hovered" theme="light" level={4} />
64
+ <DxcRadioGroup label="Example" options={single_option} defaultValue="A" readonly error="Error message" />
48
65
  </ExampleContainer>
66
+ <ExampleContainer pseudoState="pseudo-active">
67
+ <Title title="Active" theme="light" level={4} />
68
+ <DxcRadioGroup label="Example" options={single_option} defaultValue="A" readonly error="Error message" />
69
+ </ExampleContainer>
70
+ <Title title="Variants" theme="light" level={2} />
49
71
  <ExampleContainer>
50
- <Title title="Single disabled" theme="light" level={4} />
51
- <DxcRadioGroup label="Disabled" helperText="Helper text" options={single_disabled_options} defaultValue="3" />
72
+ <Title title="Column" theme="light" level={4} />
73
+ <DxcRadioGroup label="Example" helperText="Helper text" options={options} />
74
+ </ExampleContainer>
75
+ <ExampleContainer>
76
+ <Title title="Row" theme="light" level={4} />
77
+ <DxcRadioGroup label="Example" helperText="Helper text" options={options} stacking="row" />
52
78
  </ExampleContainer>
53
79
  <ExampleContainer>
54
80
  <Title title="Optional" theme="light" level={4} />
55
- <DxcRadioGroup
56
- label="Example"
57
- optionalItemLabel="No selection"
58
- optional
59
- helperText="Helper text"
60
- options={options}
61
- stacking="row"
62
- />
81
+ <DxcRadioGroup label="Example" optional helperText="Helper text" options={options} stacking="row" />
63
82
  </ExampleContainer>
64
83
  <ExampleContainer>
65
- <Title title="Error" theme="light" level={4} />
66
- <DxcRadioGroup
67
- label="Example"
68
- error="Error message"
69
- helperText="Helper text"
70
- options={options}
71
- defaultValue="2"
72
- />
84
+ <Title title="Disabled" theme="light" level={4} />
85
+ <DxcRadioGroup label="Example" helperText="Helper text" options={options} disabled />
73
86
  </ExampleContainer>
74
87
  <ExampleContainer>
75
88
  <Title title="Readonly" theme="light" level={4} />
76
- <DxcRadioGroup label="Example" readonly helperText="Helper text" options={options} defaultValue="2" />
89
+ <DxcRadioGroup label="Example" readonly helperText="Helper text" options={options} />
90
+ </ExampleContainer>
91
+ <ExampleContainer>
92
+ <Title title="Error" theme="light" level={4} />
93
+ <DxcRadioGroup label="Example" error="Error message" helperText="Helper text" options={options} />
77
94
  </ExampleContainer>
78
95
  </>
79
96
  );