@dxc-technology/halstack-react 0.0.0-0e90110 → 0.0.0-1021ecf
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/BackgroundColorContext.js +0 -1
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/types.d.ts +1 -1
- package/accordion-group/types.d.ts +1 -1
- package/card/Card.stories.tsx +1 -1
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.js +4 -4
- package/chip/types.d.ts +2 -2
- package/common/variables.js +55 -21
- package/date-input/DateInput.js +9 -12
- package/dialog/Dialog.js +2 -1
- package/dropdown/Dropdown.stories.tsx +247 -0
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +147 -68
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.js +2 -2
- package/file-input/types.d.ts +32 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +10 -16
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +5 -9
- package/header/Icons.d.ts +2 -0
- package/heading/Heading.stories.tsx +3 -2
- package/layout/ApplicationLayout.js +2 -1
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/list/List.d.ts +8 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/main.d.ts +5 -1
- package/main.js +32 -0
- package/number-input/NumberInput.js +3 -6
- package/package.json +4 -2
- package/paginator/Paginator.js +0 -6
- package/password-input/PasswordInput.js +12 -13
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +130 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +268 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.js +1 -1
- package/resultsetTable/ResultsetTable.stories.tsx +277 -0
- package/resultsetTable/types.d.ts +1 -1
- package/row/Row.d.ts +11 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +239 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +19 -21
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.stories.tsx +18 -1
- package/spinner/Spinner.stories.jsx +1 -0
- package/stack/Stack.d.ts +10 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +166 -0
- package/switch/Switch.stories.tsx +1 -1
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.stories.tsx +1 -0
- package/tag/Tag.stories.tsx +1 -1
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.js +26 -20
- package/text-input/TextInput.stories.tsx +4 -4
- package/text-input/types.d.ts +1 -1
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +14 -46
- package/textarea/Textarea.stories.jsx +4 -3
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.js +12 -15
- package/toggle-group/ToggleGroup.stories.tsx +23 -28
- package/toggle-group/types.d.ts +38 -25
- package/wizard/Wizard.js +58 -8
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
- package/wizard/types.d.ts +2 -6
- package/select/index.d.ts +0 -131
- package/textarea/index.d.ts +0 -127
- package/wizard/Icons.js +0 -65
|
@@ -26,19 +26,16 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
26
26
|
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; }
|
|
27
27
|
|
|
28
28
|
var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
29
|
-
var
|
|
30
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
29
|
+
var label = _ref.label,
|
|
31
30
|
_ref$name = _ref.name,
|
|
32
31
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
33
32
|
value = _ref.value,
|
|
34
|
-
|
|
35
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
33
|
+
helperText = _ref.helperText,
|
|
36
34
|
_ref$clearable = _ref.clearable,
|
|
37
35
|
clearable = _ref$clearable === void 0 ? false : _ref$clearable,
|
|
38
36
|
onChange = _ref.onChange,
|
|
39
37
|
onBlur = _ref.onBlur,
|
|
40
|
-
|
|
41
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
38
|
+
error = _ref.error,
|
|
42
39
|
pattern = _ref.pattern,
|
|
43
40
|
minLength = _ref.minLength,
|
|
44
41
|
maxLength = _ref.maxLength,
|
|
@@ -60,25 +57,27 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
60
57
|
var setInputType = function setInputType(type) {
|
|
61
58
|
var _inputRef$current, _inputRef$current$chi;
|
|
62
59
|
|
|
63
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$chi = _inputRef$current.children[2]) === null || _inputRef$current$chi === void 0 ? void 0 : _inputRef$current$chi.children[0].setAttribute("type", type);
|
|
60
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$chi = _inputRef$current.children[label && helperText ? 2 : label || helperText ? 1 : 0]) === null || _inputRef$current$chi === void 0 ? void 0 : _inputRef$current$chi.children[0].setAttribute("type", type);
|
|
64
61
|
};
|
|
65
62
|
|
|
66
63
|
var setAriaAttributes = function setAriaAttributes(ariaExpanded, ariaLabel) {
|
|
64
|
+
var inputIndex = label && helperText ? 2 : label || helperText ? 1 : 0;
|
|
65
|
+
|
|
67
66
|
if (error && clearable && value) {
|
|
68
67
|
var _inputRef$current2, _inputRef$current2$ch, _inputRef$current2$ch2, _inputRef$current3, _inputRef$current3$ch, _inputRef$current3$ch2;
|
|
69
68
|
|
|
70
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : (_inputRef$current2$ch = _inputRef$current2.children[
|
|
71
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : (_inputRef$current3$ch = _inputRef$current3.children[
|
|
69
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : (_inputRef$current2$ch = _inputRef$current2.children[inputIndex]) === null || _inputRef$current2$ch === void 0 ? void 0 : (_inputRef$current2$ch2 = _inputRef$current2$ch.children[3]) === null || _inputRef$current2$ch2 === void 0 ? void 0 : _inputRef$current2$ch2.setAttribute("aria-expanded", ariaExpanded);
|
|
70
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : (_inputRef$current3$ch = _inputRef$current3.children[inputIndex]) === null || _inputRef$current3$ch === void 0 ? void 0 : (_inputRef$current3$ch2 = _inputRef$current3$ch.children[3]) === null || _inputRef$current3$ch2 === void 0 ? void 0 : _inputRef$current3$ch2.setAttribute("aria-label", ariaLabel);
|
|
72
71
|
} else if (error || clearable && !value) {
|
|
73
72
|
var _inputRef$current4, _inputRef$current4$ch, _inputRef$current4$ch2, _inputRef$current5, _inputRef$current5$ch, _inputRef$current5$ch2;
|
|
74
73
|
|
|
75
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : (_inputRef$current4$ch = _inputRef$current4.children[
|
|
76
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : (_inputRef$current5$ch = _inputRef$current5.children[
|
|
74
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : (_inputRef$current4$ch = _inputRef$current4.children[inputIndex]) === null || _inputRef$current4$ch === void 0 ? void 0 : (_inputRef$current4$ch2 = _inputRef$current4$ch.children[2]) === null || _inputRef$current4$ch2 === void 0 ? void 0 : _inputRef$current4$ch2.setAttribute("aria-expanded", ariaExpanded);
|
|
75
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : (_inputRef$current5$ch = _inputRef$current5.children[inputIndex]) === null || _inputRef$current5$ch === void 0 ? void 0 : (_inputRef$current5$ch2 = _inputRef$current5$ch.children[2]) === null || _inputRef$current5$ch2 === void 0 ? void 0 : _inputRef$current5$ch2.setAttribute("aria-label", ariaLabel);
|
|
77
76
|
} else {
|
|
78
77
|
var _inputRef$current6, _inputRef$current6$ch, _inputRef$current6$ch2, _inputRef$current7, _inputRef$current7$ch, _inputRef$current7$ch2;
|
|
79
78
|
|
|
80
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : (_inputRef$current6$ch = _inputRef$current6.children[
|
|
81
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : (_inputRef$current7$ch = _inputRef$current7.children[
|
|
79
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : (_inputRef$current6$ch = _inputRef$current6.children[inputIndex]) === null || _inputRef$current6$ch === void 0 ? void 0 : (_inputRef$current6$ch2 = _inputRef$current6$ch.children[1]) === null || _inputRef$current6$ch2 === void 0 ? void 0 : _inputRef$current6$ch2.setAttribute("aria-expanded", ariaExpanded);
|
|
80
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : (_inputRef$current7$ch = _inputRef$current7.children[inputIndex]) === null || _inputRef$current7$ch === void 0 ? void 0 : (_inputRef$current7$ch2 = _inputRef$current7$ch.children[1]) === null || _inputRef$current7$ch2 === void 0 ? void 0 : _inputRef$current7$ch2.setAttribute("aria-label", ariaLabel);
|
|
82
81
|
}
|
|
83
82
|
};
|
|
84
83
|
|
|
@@ -53,7 +53,7 @@ export const Chromatic = () => (
|
|
|
53
53
|
<Title title="Margins" theme="light" level={2} />
|
|
54
54
|
<ExampleContainer>
|
|
55
55
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
56
|
-
<DxcPasswordInput label="
|
|
56
|
+
<DxcPasswordInput label="Xxsmall" margin="xxsmall" />
|
|
57
57
|
</ExampleContainer>
|
|
58
58
|
<ExampleContainer>
|
|
59
59
|
<Title title="Xsmall margin" theme="light" level={4} />
|
|
@@ -100,7 +100,7 @@ export const Chromatic = () => (
|
|
|
100
100
|
);
|
|
101
101
|
|
|
102
102
|
const Password = () => (
|
|
103
|
-
<ExampleContainer>
|
|
103
|
+
<ExampleContainer expanded>
|
|
104
104
|
<Title title="Show password" theme="light" level={4} />
|
|
105
105
|
<DxcPasswordInput label="Password input" value="Password" />
|
|
106
106
|
</ExampleContainer>
|
|
@@ -108,7 +108,7 @@ const Password = () => (
|
|
|
108
108
|
const PasswordDark = () => (
|
|
109
109
|
<BackgroundColorProvider color="#333333">
|
|
110
110
|
<DarkContainer>
|
|
111
|
-
<ExampleContainer>
|
|
111
|
+
<ExampleContainer expanded>
|
|
112
112
|
<Title title="Show password" theme="dark" level={4} />
|
|
113
113
|
<DxcPasswordInput label="Password input" value="Password" />
|
|
114
114
|
</ExampleContainer>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _uuid = require("uuid");
|
|
21
|
+
|
|
22
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
|
+
|
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
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
|
+
|
|
30
|
+
var DxcRadio = function DxcRadio(_ref) {
|
|
31
|
+
var option = _ref.option,
|
|
32
|
+
currentValue = _ref.currentValue,
|
|
33
|
+
_onClick = _ref.onClick,
|
|
34
|
+
onFocus = _ref.onFocus,
|
|
35
|
+
error = _ref.error,
|
|
36
|
+
disabled = _ref.disabled,
|
|
37
|
+
focused = _ref.focused,
|
|
38
|
+
readonly = _ref.readonly;
|
|
39
|
+
|
|
40
|
+
var _useState = (0, _react.useState)("radio-".concat((0, _uuid.v4)())),
|
|
41
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
42
|
+
radioLabelId = _useState2[0];
|
|
43
|
+
|
|
44
|
+
var ref = (0, _react.useRef)(null);
|
|
45
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
46
|
+
var checked = option.value === currentValue;
|
|
47
|
+
|
|
48
|
+
var _useState3 = (0, _react.useState)(true),
|
|
49
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
50
|
+
firstUpdate = _useState4[0],
|
|
51
|
+
setFirstUpdate = _useState4[1];
|
|
52
|
+
|
|
53
|
+
(0, _react.useLayoutEffect)(function () {
|
|
54
|
+
var _ref$current;
|
|
55
|
+
|
|
56
|
+
// Don't apply in the first render
|
|
57
|
+
if (firstUpdate) {
|
|
58
|
+
setFirstUpdate(false);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
focused && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
|
|
63
|
+
}, [focused]);
|
|
64
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
65
|
+
theme: colorsTheme.radioGroup
|
|
66
|
+
}, /*#__PURE__*/_react["default"].createElement(RadioContainer, null, /*#__PURE__*/_react["default"].createElement(RadioInputContainer, null, /*#__PURE__*/_react["default"].createElement(RadioInput, {
|
|
67
|
+
error: error,
|
|
68
|
+
disabled: disabled,
|
|
69
|
+
readonly: readonly,
|
|
70
|
+
onClick: _onClick,
|
|
71
|
+
onFocus: onFocus,
|
|
72
|
+
role: "radio",
|
|
73
|
+
"aria-checked": checked,
|
|
74
|
+
"aria-disabled": option.disabled,
|
|
75
|
+
"aria-labelledby": radioLabelId,
|
|
76
|
+
tabIndex: disabled ? -1 : focused ? 0 : -1,
|
|
77
|
+
ref: ref
|
|
78
|
+
}, checked && /*#__PURE__*/_react["default"].createElement(Dot, {
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
readonly: readonly,
|
|
81
|
+
error: error
|
|
82
|
+
}))), /*#__PURE__*/_react["default"].createElement(Label, {
|
|
83
|
+
id: radioLabelId,
|
|
84
|
+
onMouseDown: function onMouseDown(event) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
},
|
|
87
|
+
onClick: function onClick() {
|
|
88
|
+
var _ref$current2;
|
|
89
|
+
|
|
90
|
+
ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
|
|
91
|
+
|
|
92
|
+
_onClick();
|
|
93
|
+
},
|
|
94
|
+
disabled: disabled
|
|
95
|
+
}, option.label)));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var RadioContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n"])));
|
|
99
|
+
|
|
100
|
+
var RadioInputContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
|
|
101
|
+
|
|
102
|
+
var RadioInput = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (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) {
|
|
103
|
+
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;
|
|
104
|
+
}, function (props) {
|
|
105
|
+
return !props.disabled ? "\n &: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 &:hover {\n cursor: pointer;\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 &:active {\n cursor: pointer;\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 cursor: not-allowed;\n pointer-events: none;\n :focus-visible {\n outline: none;\n }\n ";
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
var Dot = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background-color: ", ";\n"])), function (props) {
|
|
109
|
+
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;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
var Label = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
113
|
+
return props.theme.radioInputLabelMargin;
|
|
114
|
+
}, function (props) {
|
|
115
|
+
return props.theme.fontFamily;
|
|
116
|
+
}, function (props) {
|
|
117
|
+
return props.theme.radioInputLabelFontSize;
|
|
118
|
+
}, function (props) {
|
|
119
|
+
return props.theme.radioInputLabelFontStyle;
|
|
120
|
+
}, function (props) {
|
|
121
|
+
return props.theme.radioInputLabelFontWeight;
|
|
122
|
+
}, function (props) {
|
|
123
|
+
return props.theme.radioInputLabelLineHeight;
|
|
124
|
+
}, function (props) {
|
|
125
|
+
return props.disabled ? "color: ".concat(props.theme.disabledRadioInputLabelFontColor, "; pointer-events: none;") : "cursor: pointer;";
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
var _default = /*#__PURE__*/_react["default"].memo(DxcRadio);
|
|
129
|
+
|
|
130
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
+
|
|
22
|
+
var _uuid = require("uuid");
|
|
23
|
+
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
|
+
|
|
26
|
+
var _Radio = _interopRequireDefault(require("./Radio"));
|
|
27
|
+
|
|
28
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
var getInitialFocusIndex = function getInitialFocusIndex(innerOptions, value) {
|
|
35
|
+
var initialSelectedOptionIndex = innerOptions.findIndex(function (option) {
|
|
36
|
+
return option.value === value;
|
|
37
|
+
});
|
|
38
|
+
return initialSelectedOptionIndex !== -1 ? initialSelectedOptionIndex : 0;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
42
|
+
var label = _ref.label,
|
|
43
|
+
name = _ref.name,
|
|
44
|
+
helperText = _ref.helperText,
|
|
45
|
+
options = _ref.options,
|
|
46
|
+
_ref$disabled = _ref.disabled,
|
|
47
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
48
|
+
_ref$optional = _ref.optional,
|
|
49
|
+
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
50
|
+
_ref$optionalItemLabe = _ref.optionalItemLabel,
|
|
51
|
+
optionalItemLabel = _ref$optionalItemLabe === void 0 ? "N/A" : _ref$optionalItemLabe,
|
|
52
|
+
_ref$readonly = _ref.readonly,
|
|
53
|
+
readonly = _ref$readonly === void 0 ? false : _ref$readonly,
|
|
54
|
+
_ref$stacking = _ref.stacking,
|
|
55
|
+
stacking = _ref$stacking === void 0 ? "column" : _ref$stacking,
|
|
56
|
+
defaultValue = _ref.defaultValue,
|
|
57
|
+
value = _ref.value,
|
|
58
|
+
onChange = _ref.onChange,
|
|
59
|
+
onBlur = _ref.onBlur,
|
|
60
|
+
error = _ref.error;
|
|
61
|
+
|
|
62
|
+
var _useState = (0, _react.useState)("select-".concat((0, _uuid.v4)())),
|
|
63
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
64
|
+
radioGroupId = _useState2[0];
|
|
65
|
+
|
|
66
|
+
var radioGroupLabelId = "label-".concat(radioGroupId);
|
|
67
|
+
|
|
68
|
+
var _useState3 = (0, _react.useState)(defaultValue),
|
|
69
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
70
|
+
innerValue = _useState4[0],
|
|
71
|
+
setInnerValue = _useState4[1];
|
|
72
|
+
|
|
73
|
+
var _useState5 = (0, _react.useState)(true),
|
|
74
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
75
|
+
firstTimeFocus = _useState6[0],
|
|
76
|
+
setFirstTimeFocus = _useState6[1];
|
|
77
|
+
|
|
78
|
+
var optionalItem = {
|
|
79
|
+
label: optionalItemLabel,
|
|
80
|
+
value: "",
|
|
81
|
+
disabled: disabled
|
|
82
|
+
};
|
|
83
|
+
var innerOptions = (0, _react.useMemo)(function () {
|
|
84
|
+
return optional ? [].concat((0, _toConsumableArray2["default"])(options), [optionalItem]) : options;
|
|
85
|
+
}, [optional, options]);
|
|
86
|
+
|
|
87
|
+
var _useState7 = (0, _react.useState)(getInitialFocusIndex(innerOptions, value !== null && value !== void 0 ? value : innerValue)),
|
|
88
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
89
|
+
currentFocusIndex = _useState8[0],
|
|
90
|
+
setCurrentFocusIndex = _useState8[1];
|
|
91
|
+
|
|
92
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
93
|
+
var handleOnChange = (0, _react.useCallback)(function (newValue) {
|
|
94
|
+
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
95
|
+
|
|
96
|
+
if (newValue !== currentValue && !readonly) {
|
|
97
|
+
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
98
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
99
|
+
}
|
|
100
|
+
}, [value, innerValue, setInnerValue, onChange]);
|
|
101
|
+
|
|
102
|
+
var handleOnBlur = function handleOnBlur(e) {
|
|
103
|
+
// If the radio group loses the focus to an element not contained inside it...
|
|
104
|
+
!e.currentTarget.contains(e.relatedTarget) && setFirstTimeFocus(true);
|
|
105
|
+
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
106
|
+
!optional && !Boolean(currentValue) ? onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
107
|
+
value: currentValue,
|
|
108
|
+
error: "This field is required. Please, choose an option."
|
|
109
|
+
}) : onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
110
|
+
value: currentValue
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var setPreviousRadioChecked = function setPreviousRadioChecked() {
|
|
115
|
+
if (!disabled) {
|
|
116
|
+
setCurrentFocusIndex(function (currentFocusIndex) {
|
|
117
|
+
var index = currentFocusIndex === 0 ? innerOptions.length - 1 : currentFocusIndex - 1;
|
|
118
|
+
|
|
119
|
+
while (innerOptions[index].disabled) {
|
|
120
|
+
index = index === 0 ? innerOptions.length - 1 : index - 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return index;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
var setNextRadioChecked = function setNextRadioChecked() {
|
|
129
|
+
if (!disabled) {
|
|
130
|
+
setCurrentFocusIndex(function (currentFocusIndex) {
|
|
131
|
+
var index = currentFocusIndex === innerOptions.length - 1 ? 0 : currentFocusIndex + 1;
|
|
132
|
+
|
|
133
|
+
while (innerOptions[index].disabled) {
|
|
134
|
+
index = index === innerOptions.length - 1 ? 0 : index + 1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return index;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
143
|
+
switch (event.keyCode) {
|
|
144
|
+
case 37: // arrow left
|
|
145
|
+
|
|
146
|
+
case 38:
|
|
147
|
+
// arrow up
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
setPreviousRadioChecked();
|
|
150
|
+
break;
|
|
151
|
+
|
|
152
|
+
case 39: // arrow right
|
|
153
|
+
|
|
154
|
+
case 40:
|
|
155
|
+
// arrow down
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
setNextRadioChecked();
|
|
158
|
+
break;
|
|
159
|
+
|
|
160
|
+
case 13: // enter
|
|
161
|
+
|
|
162
|
+
case 32:
|
|
163
|
+
// space
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
handleOnChange(innerOptions[currentFocusIndex].value);
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
171
|
+
theme: colorsTheme.radioGroup
|
|
172
|
+
}, /*#__PURE__*/_react["default"].createElement(RadioGroupContainer, {
|
|
173
|
+
ref: ref
|
|
174
|
+
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
175
|
+
id: radioGroupLabelId,
|
|
176
|
+
helperText: helperText,
|
|
177
|
+
disabled: disabled
|
|
178
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
179
|
+
disabled: disabled
|
|
180
|
+
}, helperText), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
|
|
181
|
+
onBlur: handleOnBlur,
|
|
182
|
+
onKeyDown: handleOnKeyDown,
|
|
183
|
+
stacking: stacking,
|
|
184
|
+
role: "radiogroup",
|
|
185
|
+
"aria-disabled": disabled,
|
|
186
|
+
"aria-labelledby": radioGroupLabelId,
|
|
187
|
+
"aria-invalid": error ? "true" : "false",
|
|
188
|
+
"aria-required": !optional
|
|
189
|
+
}, /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
190
|
+
name: name,
|
|
191
|
+
value: value !== null && value !== void 0 ? value : innerValue,
|
|
192
|
+
readOnly: true,
|
|
193
|
+
"aria-hidden": "true"
|
|
194
|
+
}), innerOptions.map(function (option, index) {
|
|
195
|
+
return /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
196
|
+
option: option,
|
|
197
|
+
currentValue: value !== null && value !== void 0 ? value : innerValue,
|
|
198
|
+
onClick: function onClick() {
|
|
199
|
+
handleOnChange(option.value);
|
|
200
|
+
setCurrentFocusIndex(index);
|
|
201
|
+
},
|
|
202
|
+
onFocus: function onFocus() {
|
|
203
|
+
!firstTimeFocus ? handleOnChange(option.value) : setFirstTimeFocus(false);
|
|
204
|
+
},
|
|
205
|
+
error: error,
|
|
206
|
+
disabled: option.disabled || disabled,
|
|
207
|
+
focused: currentFocusIndex === index,
|
|
208
|
+
readonly: readonly
|
|
209
|
+
});
|
|
210
|
+
})), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, null, error)));
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
var RadioGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n"])));
|
|
214
|
+
|
|
215
|
+
var Label = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
216
|
+
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
|
217
|
+
}, function (props) {
|
|
218
|
+
return props.theme.fontFamily;
|
|
219
|
+
}, function (props) {
|
|
220
|
+
return props.theme.labelFontSize;
|
|
221
|
+
}, function (props) {
|
|
222
|
+
return props.theme.labelFontStyle;
|
|
223
|
+
}, function (props) {
|
|
224
|
+
return props.theme.labelFontWeight;
|
|
225
|
+
}, function (props) {
|
|
226
|
+
return props.theme.labelLineHeight;
|
|
227
|
+
}, function (props) {
|
|
228
|
+
return !props.helperText && "margin-bottom: ".concat(props.theme.groupLabelMargin);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
232
|
+
return props.theme.optionalLabelFontWeight;
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: ", ";\n"])), function (props) {
|
|
236
|
+
return props.disabled ? props.theme.disabledHelperTextFontColor : props.theme.helperTextFontColor;
|
|
237
|
+
}, function (props) {
|
|
238
|
+
return props.theme.fontFamily;
|
|
239
|
+
}, function (props) {
|
|
240
|
+
return props.theme.helperTextFontSize;
|
|
241
|
+
}, function (props) {
|
|
242
|
+
return props.theme.helperTextFontStyle;
|
|
243
|
+
}, function (props) {
|
|
244
|
+
return props.theme.helperTextFontWeight;
|
|
245
|
+
}, function (props) {
|
|
246
|
+
return props.theme.helperTextLineHeight;
|
|
247
|
+
}, function (props) {
|
|
248
|
+
return props.theme.groupLabelMargin;
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
var RadioGroup = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n flex-direction: ", ";\n\n row-gap: ", ";\n column-gap: ", ";\n"])), function (props) {
|
|
252
|
+
return props.stacking;
|
|
253
|
+
}, function (props) {
|
|
254
|
+
return props.theme.groupVerticalGutter;
|
|
255
|
+
}, function (props) {
|
|
256
|
+
return props.theme.groupHorizontalGutter;
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
var ValueInput = _styledComponents["default"].input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"])));
|
|
260
|
+
|
|
261
|
+
var Error = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.5rem;\n"])), function (props) {
|
|
262
|
+
return props.theme.errorMessageColor;
|
|
263
|
+
}, function (props) {
|
|
264
|
+
return props.theme.fontFamily;
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
var _default = DxcRadioGroup;
|
|
268
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import DxcRadioGroup from "./RadioGroup";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Radio Group",
|
|
7
|
+
component: DxcRadioGroup,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const options = [
|
|
11
|
+
{ label: "Option 1", value: "1" },
|
|
12
|
+
{ label: "Option 2", value: "2" },
|
|
13
|
+
{ label: "Option 3", value: "3" },
|
|
14
|
+
{ label: "Option 4", value: "4" },
|
|
15
|
+
];
|
|
16
|
+
|
|
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
|
+
];
|
|
22
|
+
|
|
23
|
+
export const Chromatic = () => (
|
|
24
|
+
<>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Label only" theme="light" level={4} />
|
|
27
|
+
<DxcRadioGroup label="Example of label" options={options}/>
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="Column" theme="light" level={4} />
|
|
31
|
+
<DxcRadioGroup label="Example" helperText="Helper text" options={options} defaultValue="3" />
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer>
|
|
34
|
+
<Title title="Row" theme="light" level={4} />
|
|
35
|
+
<DxcRadioGroup label="Example" helperText="Helper text" options={options} stacking="row" />
|
|
36
|
+
</ExampleContainer>
|
|
37
|
+
<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
|
+
/>
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Single disabled" theme="light" level={4} />
|
|
51
|
+
<DxcRadioGroup label="Disabled" helperText="Helper text" options={single_disabled_options} defaultValue="3" />
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<ExampleContainer>
|
|
54
|
+
<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
|
+
/>
|
|
63
|
+
</ExampleContainer>
|
|
64
|
+
<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
|
+
/>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Readonly" theme="light" level={4} />
|
|
76
|
+
<DxcRadioGroup label="Example" readonly helperText="Helper text" options={options} defaultValue="2" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare type Option = {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare type RadioGroupProps = {
|
|
7
|
+
label: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
options: Option[];
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
optional?: boolean;
|
|
13
|
+
optionalItemLabel?: string;
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
stacking?: "row" | "column";
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
onBlur?: (val: {
|
|
20
|
+
value?: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
}) => void;
|
|
23
|
+
error?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare type RefType = HTMLDivElement;
|
|
26
|
+
export declare type RadioProps = {
|
|
27
|
+
option: Option;
|
|
28
|
+
currentValue?: string;
|
|
29
|
+
onClick: () => void;
|
|
30
|
+
onFocus: () => void;
|
|
31
|
+
error?: string;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
focused: boolean;
|
|
34
|
+
readonly: boolean;
|
|
35
|
+
};
|
|
36
|
+
export default RadioGroupProps;
|
|
@@ -227,7 +227,7 @@ var TitleDiv = _styledComponents["default"].div(_templateObject5 || (_templateOb
|
|
|
227
227
|
|
|
228
228
|
var TableHeader = _styledComponents["default"].th(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
229
229
|
|
|
230
|
-
var HeaderContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n width: 100%;\n"])), function (props) {
|
|
230
|
+
var HeaderContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n width: 100%;\n :focus {\n outline: #0095ff auto 1px;\n }\n"])), function (props) {
|
|
231
231
|
return props.theme.headerTextAlign === "center" ? "center" : props.theme.headerTextAlign === "right" ? "flex-end" : "flex-start";
|
|
232
232
|
});
|
|
233
233
|
|