@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
package/text/Text.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
function Text(_ref) {
|
|
19
|
+
var _ref$as = _ref.as,
|
|
20
|
+
as = _ref$as === void 0 ? "span" : _ref$as,
|
|
21
|
+
children = _ref.children;
|
|
22
|
+
return /*#__PURE__*/_react["default"].createElement(StyledText, {
|
|
23
|
+
as: as
|
|
24
|
+
}, children);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var StyledText = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px;\n font-family: Open Sans, sans-serif;\n"])));
|
|
28
|
+
|
|
29
|
+
var _default = Text;
|
|
30
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import DxcText from "./Text";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Text",
|
|
7
|
+
component: DxcText,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Chromatic = () => (
|
|
11
|
+
<>
|
|
12
|
+
<Title title="Two texts as span" theme="light" level={4} />
|
|
13
|
+
<DxcText>Text 1.</DxcText>
|
|
14
|
+
<DxcText>Text 2.</DxcText>
|
|
15
|
+
<Title title="Two texts as p" theme="light" level={4} />
|
|
16
|
+
<DxcText as="p">Text 1.</DxcText>
|
|
17
|
+
<DxcText as="p">Text 2.</DxcText>
|
|
18
|
+
</>
|
|
19
|
+
);
|
package/text-input/TextInput.js
CHANGED
|
@@ -132,13 +132,11 @@ var getLastOptionIndex = function getLastOptionIndex(filteredSuggestions) {
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
135
|
-
var
|
|
136
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
135
|
+
var label = _ref.label,
|
|
137
136
|
_ref$name = _ref.name,
|
|
138
137
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
139
138
|
value = _ref.value,
|
|
140
|
-
|
|
141
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
139
|
+
helperText = _ref.helperText,
|
|
142
140
|
_ref$placeholder = _ref.placeholder,
|
|
143
141
|
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
144
142
|
action = _ref.action,
|
|
@@ -154,8 +152,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
154
152
|
suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
|
|
155
153
|
onChange = _ref.onChange,
|
|
156
154
|
onBlur = _ref.onBlur,
|
|
157
|
-
|
|
158
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
155
|
+
error = _ref.error,
|
|
159
156
|
suggestions = _ref.suggestions,
|
|
160
157
|
pattern = _ref.pattern,
|
|
161
158
|
minLength = _ref.minLength,
|
|
@@ -500,11 +497,12 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
500
497
|
margin: margin,
|
|
501
498
|
ref: ref,
|
|
502
499
|
size: size
|
|
503
|
-
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
500
|
+
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
504
501
|
htmlFor: inputId,
|
|
505
502
|
disabled: disabled,
|
|
506
|
-
backgroundType: backgroundType
|
|
507
|
-
|
|
503
|
+
backgroundType: backgroundType,
|
|
504
|
+
helperText: helperText
|
|
505
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
508
506
|
disabled: disabled,
|
|
509
507
|
backgroundType: backgroundType
|
|
510
508
|
}, helperText), /*#__PURE__*/_react["default"].createElement(InputContainer, {
|
|
@@ -550,7 +548,9 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
550
548
|
backgroundType: backgroundType,
|
|
551
549
|
"aria-label": "Error"
|
|
552
550
|
}, textInputIcons.error), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
553
|
-
onClick:
|
|
551
|
+
onClick: function onClick() {
|
|
552
|
+
return handleClearActionOnClick();
|
|
553
|
+
},
|
|
554
554
|
onMouseDown: function onMouseDown(event) {
|
|
555
555
|
event.stopPropagation();
|
|
556
556
|
},
|
|
@@ -561,7 +561,9 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
561
561
|
}, textInputIcons.clear), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(Action, {
|
|
562
562
|
ref: actionRef,
|
|
563
563
|
disabled: disabled,
|
|
564
|
-
onClick:
|
|
564
|
+
onClick: function onClick() {
|
|
565
|
+
return handleDecrementActionOnClick();
|
|
566
|
+
},
|
|
565
567
|
onMouseDown: function onMouseDown(event) {
|
|
566
568
|
event.stopPropagation();
|
|
567
569
|
},
|
|
@@ -572,7 +574,9 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
572
574
|
}, textInputIcons.decrement), /*#__PURE__*/_react["default"].createElement(Action, {
|
|
573
575
|
ref: actionRef,
|
|
574
576
|
disabled: disabled,
|
|
575
|
-
onClick:
|
|
577
|
+
onClick: function onClick() {
|
|
578
|
+
return handleIncrementActionOnClick();
|
|
579
|
+
},
|
|
576
580
|
onMouseDown: function onMouseDown(event) {
|
|
577
581
|
event.stopPropagation();
|
|
578
582
|
},
|
|
@@ -583,7 +587,9 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
583
587
|
}, textInputIcons.increment)) : action && /*#__PURE__*/_react["default"].createElement(Action, {
|
|
584
588
|
ref: actionRef,
|
|
585
589
|
disabled: disabled,
|
|
586
|
-
onClick:
|
|
590
|
+
onClick: function onClick() {
|
|
591
|
+
return action.onClick();
|
|
592
|
+
},
|
|
587
593
|
onMouseDown: function onMouseDown(event) {
|
|
588
594
|
event.stopPropagation();
|
|
589
595
|
},
|
|
@@ -613,7 +619,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
613
619
|
});
|
|
614
620
|
}), isSearching && /*#__PURE__*/_react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && /*#__PURE__*/_react["default"].createElement(SuggestionsError, null, /*#__PURE__*/_react["default"].createElement(SuggestionsErrorIcon, {
|
|
615
621
|
backgroundType: backgroundType
|
|
616
|
-
}, textInputIcons.error), "Error fetching data"))), !disabled && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
622
|
+
}, textInputIcons.error), "Error fetching data"))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
617
623
|
id: errorId,
|
|
618
624
|
backgroundType: backgroundType
|
|
619
625
|
}, error)));
|
|
@@ -644,7 +650,7 @@ var DxcInput = _styledComponents["default"].div(_templateObject || (_templateObj
|
|
|
644
650
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
645
651
|
});
|
|
646
652
|
|
|
647
|
-
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
653
|
+
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
648
654
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
649
655
|
}, function (props) {
|
|
650
656
|
return props.theme.fontFamily;
|
|
@@ -656,13 +662,15 @@ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObj
|
|
|
656
662
|
return props.theme.labelFontWeight;
|
|
657
663
|
}, function (props) {
|
|
658
664
|
return props.theme.labelLineHeight;
|
|
665
|
+
}, function (props) {
|
|
666
|
+
return !props.helperText && "margin-bottom: 0.25rem";
|
|
659
667
|
});
|
|
660
668
|
|
|
661
669
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
662
670
|
return props.theme.optionalLabelFontWeight;
|
|
663
671
|
});
|
|
664
672
|
|
|
665
|
-
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
673
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
666
674
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
|
|
667
675
|
}, function (props) {
|
|
668
676
|
return props.theme.fontFamily;
|
|
@@ -676,9 +684,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
676
684
|
return props.theme.helperTextLineHeight;
|
|
677
685
|
});
|
|
678
686
|
|
|
679
|
-
var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n
|
|
680
|
-
return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
|
|
681
|
-
}, function (props) {
|
|
687
|
+
var InputContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
|
|
682
688
|
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
683
689
|
}, function (props) {
|
|
684
690
|
if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
|
|
@@ -738,7 +744,7 @@ var ErrorIcon = _styledComponents["default"].span(_templateObject11 || (_templat
|
|
|
738
744
|
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
739
745
|
});
|
|
740
746
|
|
|
741
|
-
var Error = _styledComponents["default"].span(_templateObject12 || (_templateObject12 = (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"])), function (props) {
|
|
747
|
+
var Error = _styledComponents["default"].span(_templateObject12 || (_templateObject12 = (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.25rem;\n"])), function (props) {
|
|
742
748
|
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
743
749
|
}, function (props) {
|
|
744
750
|
return props.theme.fontFamily;
|
|
@@ -262,14 +262,14 @@ export const Chromatic = () => (
|
|
|
262
262
|
);
|
|
263
263
|
|
|
264
264
|
const FocusedActionTextInput = () => (
|
|
265
|
-
<ExampleContainer>
|
|
265
|
+
<ExampleContainer expanded>
|
|
266
266
|
<Title title="Focused action" theme="light" level={4} />
|
|
267
267
|
<DxcTextInput label="Text input" action={action} clearable />
|
|
268
268
|
</ExampleContainer>
|
|
269
269
|
);
|
|
270
270
|
|
|
271
271
|
const ActivedActionTextInput = () => (
|
|
272
|
-
<ExampleContainer pseudoState="pseudo-active">
|
|
272
|
+
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
273
273
|
<Title title="Actived action" theme="light" level={4} />
|
|
274
274
|
<DxcTextInput label="Text input" action={action} clearable />
|
|
275
275
|
</ExampleContainer>
|
|
@@ -306,7 +306,7 @@ const ActivedOptionAutosuggest = () => (
|
|
|
306
306
|
const FocusedActionTextInputOnDark = () => (
|
|
307
307
|
<BackgroundColorProvider color="#333333">
|
|
308
308
|
<DarkContainer>
|
|
309
|
-
<ExampleContainer>
|
|
309
|
+
<ExampleContainer expanded>
|
|
310
310
|
<Title title="Focused action" theme="dark" level={4} />
|
|
311
311
|
<DxcTextInput label="Text input" action={action} clearable />
|
|
312
312
|
</ExampleContainer>
|
|
@@ -317,7 +317,7 @@ const FocusedActionTextInputOnDark = () => (
|
|
|
317
317
|
const ActivedActionTextInputOnDark = () => (
|
|
318
318
|
<BackgroundColorProvider color="#333333">
|
|
319
319
|
<DarkContainer>
|
|
320
|
-
<ExampleContainer pseudoState="pseudo-active">
|
|
320
|
+
<ExampleContainer pseudoState="pseudo-active" expanded>
|
|
321
321
|
<Title title="Actived action" theme="dark" level={4} />
|
|
322
322
|
<DxcTextInput label="Text input" action={action} clearable />
|
|
323
323
|
</ExampleContainer>
|
package/text-input/types.d.ts
CHANGED
package/textarea/Textarea.js
CHANGED
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
@@ -25,8 +23,6 @@ var _utils = require("../common/utils.js");
|
|
|
25
23
|
|
|
26
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
27
25
|
|
|
28
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
|
-
|
|
30
26
|
var _variables = require("../common/variables.js");
|
|
31
27
|
|
|
32
28
|
var _uuid = require("uuid");
|
|
@@ -52,13 +48,11 @@ var patternMatch = function patternMatch(pattern, value) {
|
|
|
52
48
|
};
|
|
53
49
|
|
|
54
50
|
var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
55
|
-
var
|
|
56
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
51
|
+
var label = _ref.label,
|
|
57
52
|
_ref$name = _ref.name,
|
|
58
53
|
name = _ref$name === void 0 ? "" : _ref$name,
|
|
59
54
|
value = _ref.value,
|
|
60
|
-
|
|
61
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
55
|
+
helperText = _ref.helperText,
|
|
62
56
|
_ref$placeholder = _ref.placeholder,
|
|
63
57
|
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
64
58
|
_ref$disabled = _ref.disabled,
|
|
@@ -71,8 +65,7 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
71
65
|
rows = _ref$rows === void 0 ? 4 : _ref$rows,
|
|
72
66
|
onChange = _ref.onChange,
|
|
73
67
|
onBlur = _ref.onBlur,
|
|
74
|
-
|
|
75
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
68
|
+
error = _ref.error,
|
|
76
69
|
pattern = _ref.pattern,
|
|
77
70
|
minLength = _ref.minLength,
|
|
78
71
|
maxLength = _ref.maxLength,
|
|
@@ -162,11 +155,12 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
162
155
|
margin: margin,
|
|
163
156
|
size: size,
|
|
164
157
|
ref: ref
|
|
165
|
-
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
158
|
+
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
166
159
|
htmlFor: textareaId,
|
|
167
160
|
disabled: disabled,
|
|
168
|
-
backgroundType: backgroundType
|
|
169
|
-
|
|
161
|
+
backgroundType: backgroundType,
|
|
162
|
+
helperText: helperText
|
|
163
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
170
164
|
disabled: disabled,
|
|
171
165
|
backgroundType: backgroundType
|
|
172
166
|
}, helperText), /*#__PURE__*/_react["default"].createElement(Textarea, {
|
|
@@ -189,7 +183,7 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
189
183
|
"aria-invalid": error ? "true" : "false",
|
|
190
184
|
"aria-describedby": error ? errorId : undefined,
|
|
191
185
|
"aria-required": optional ? "false" : "true"
|
|
192
|
-
}), !disabled && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
186
|
+
}), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
193
187
|
id: errorId,
|
|
194
188
|
backgroundType: backgroundType
|
|
195
189
|
}, error)));
|
|
@@ -220,7 +214,7 @@ var TextareaContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
220
214
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
221
215
|
});
|
|
222
216
|
|
|
223
|
-
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
217
|
+
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
224
218
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
225
219
|
}, function (props) {
|
|
226
220
|
return props.theme.fontFamily;
|
|
@@ -232,13 +226,15 @@ var Label = _styledComponents["default"].label(_templateObject2 || (_templateObj
|
|
|
232
226
|
return props.theme.labelFontWeight;
|
|
233
227
|
}, function (props) {
|
|
234
228
|
return props.theme.labelLineHeight;
|
|
229
|
+
}, function (props) {
|
|
230
|
+
return !props.helperText && "margin-bottom: 0.25rem";
|
|
235
231
|
});
|
|
236
232
|
|
|
237
233
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
238
234
|
return props.theme.optionalLabelFontWeight;
|
|
239
235
|
});
|
|
240
236
|
|
|
241
|
-
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
237
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
242
238
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
|
|
243
239
|
}, function (props) {
|
|
244
240
|
return props.theme.fontFamily;
|
|
@@ -252,12 +248,10 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
|
|
|
252
248
|
return props.theme.helperTextLineHeight;
|
|
253
249
|
});
|
|
254
250
|
|
|
255
|
-
var Textarea = _styledComponents["default"].textarea(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n ", "\n\n
|
|
251
|
+
var Textarea = _styledComponents["default"].textarea(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n ", "\n\n padding: 0.5rem 1rem;\n box-shadow: 0 0 0 2px transparent;\n border-radius: 0.25rem;\n border: 1px solid\n ", ";\n ", "\n\n ", ";\n ", ";\n\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n\n ::placeholder {\n color: ", ";\n }\n"])), function (props) {
|
|
256
252
|
if (props.verticalGrow === "none") return "resize: none;";else if (props.verticalGrow === "auto") return "resize: none; overflow: hidden;";else if (props.verticalGrow === "manual") return "resize: vertical;";else return "resize: none;";
|
|
257
253
|
}, function (props) {
|
|
258
254
|
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");else return "background-color: transparent;";
|
|
259
|
-
}, function (props) {
|
|
260
|
-
return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
|
|
261
255
|
}, function (props) {
|
|
262
256
|
if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
|
|
263
257
|
}, function (props) {
|
|
@@ -280,37 +274,11 @@ var Textarea = _styledComponents["default"].textarea(_templateObject5 || (_templ
|
|
|
280
274
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
|
|
281
275
|
});
|
|
282
276
|
|
|
283
|
-
var Error = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n min-height: 1.5em;\n line-height: 1.5em;\n"])), function (props) {
|
|
277
|
+
var Error = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n min-height: 1.5em;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
284
278
|
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
285
279
|
}, function (props) {
|
|
286
280
|
return props.theme.fontFamily;
|
|
287
281
|
});
|
|
288
282
|
|
|
289
|
-
DxcTextarea.propTypes = {
|
|
290
|
-
label: _propTypes["default"].string,
|
|
291
|
-
name: _propTypes["default"].string,
|
|
292
|
-
value: _propTypes["default"].string,
|
|
293
|
-
helperText: _propTypes["default"].string,
|
|
294
|
-
placeholder: _propTypes["default"].string,
|
|
295
|
-
verticalGrow: _propTypes["default"].oneOf(["auto", "none", "manual"]),
|
|
296
|
-
rows: _propTypes["default"].number,
|
|
297
|
-
minLength: _propTypes["default"].number,
|
|
298
|
-
maxLength: _propTypes["default"].number,
|
|
299
|
-
pattern: _propTypes["default"].string,
|
|
300
|
-
disabled: _propTypes["default"].bool,
|
|
301
|
-
optional: _propTypes["default"].bool,
|
|
302
|
-
onChange: _propTypes["default"].func,
|
|
303
|
-
onBlur: _propTypes["default"].func,
|
|
304
|
-
error: _propTypes["default"].string,
|
|
305
|
-
autocomplete: _propTypes["default"].string,
|
|
306
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
307
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
308
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
309
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
310
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
311
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
312
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
313
|
-
tabIndex: _propTypes["default"].number
|
|
314
|
-
};
|
|
315
283
|
var _default = DxcTextarea;
|
|
316
284
|
exports["default"] = _default;
|
|
@@ -105,15 +105,15 @@ export const Chromatic = () => (
|
|
|
105
105
|
<Title title="Margins" theme="light" level={2} />
|
|
106
106
|
<ExampleContainer>
|
|
107
107
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
108
|
-
<DxcTextarea label="
|
|
108
|
+
<DxcTextarea label="Xxsmall" margin="xxsmall" />
|
|
109
109
|
</ExampleContainer>
|
|
110
110
|
<ExampleContainer>
|
|
111
111
|
<Title title="Xsmall margin" theme="light" level={4} />
|
|
112
|
-
<DxcTextarea label="
|
|
112
|
+
<DxcTextarea label="xsmall" margin="xsmall" />
|
|
113
113
|
</ExampleContainer>
|
|
114
114
|
<ExampleContainer>
|
|
115
115
|
<Title title="Small margin" theme="light" level={4} />
|
|
116
|
-
<DxcTextarea label="
|
|
116
|
+
<DxcTextarea label="small" margin="small" />
|
|
117
117
|
</ExampleContainer>
|
|
118
118
|
<ExampleContainer>
|
|
119
119
|
<Title title="Medium margin" theme="light" level={4} />
|
|
@@ -130,6 +130,7 @@ export const Chromatic = () => (
|
|
|
130
130
|
<ExampleContainer>
|
|
131
131
|
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
132
132
|
<DxcTextarea label="Xxlarge" margin="xxlarge" />
|
|
133
|
+
<hr />
|
|
133
134
|
</ExampleContainer>
|
|
134
135
|
</>
|
|
135
136
|
);
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
declare type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* Text to be placed above the textarea.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Name attribute of the textarea element.
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Value of the textarea. If undefined, the component will be uncontrolled and the value will be managed internally.
|
|
19
|
+
*/
|
|
20
|
+
value?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Helper text to be placed above the textarea.
|
|
23
|
+
*/
|
|
24
|
+
helperText?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Text to be put as placeholder of the textarea.
|
|
27
|
+
*/
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/**
|
|
30
|
+
* If true, the component will be disabled.
|
|
31
|
+
*/
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* If true, the textarea will be optional, showing '(Optional)'
|
|
35
|
+
* next to the label. Otherwise, the field will be considered required
|
|
36
|
+
* and an error will be passed as a parameter to the OnBlur and onChange functions
|
|
37
|
+
* when it has not been filled.
|
|
38
|
+
*/
|
|
39
|
+
optional?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Defines the textarea's ability to resize vertically. It can be:
|
|
42
|
+
* - 'auto': The textarea grows or shrinks automatically in order to fit the content.
|
|
43
|
+
* - 'manual': The height of the textarea is enabled to be manually modified.
|
|
44
|
+
* - 'none': The textarea has a fixed height and can't be modified.
|
|
45
|
+
*/
|
|
46
|
+
verticalGrow?: "auto" | "manual" | "none";
|
|
47
|
+
/**
|
|
48
|
+
* Number of rows of the textarea.
|
|
49
|
+
*/
|
|
50
|
+
rows?: number;
|
|
51
|
+
/**
|
|
52
|
+
* This function will be called when the user types within the textarea.
|
|
53
|
+
* An object including the current value and the error (if the value
|
|
54
|
+
* entered is not valid) will be passed to this function.
|
|
55
|
+
* If there is no error, error will be null.
|
|
56
|
+
*/
|
|
57
|
+
onChange?: (val: {
|
|
58
|
+
value: string;
|
|
59
|
+
error: string | null;
|
|
60
|
+
}) => void;
|
|
61
|
+
/**
|
|
62
|
+
* This function will be called when the textarea loses the focus. An
|
|
63
|
+
* object including the textarea value and the error (if the value entered
|
|
64
|
+
* is not valid) will be passed to this function. If there is no error,
|
|
65
|
+
* error will be null.
|
|
66
|
+
*/
|
|
67
|
+
onBlur?: (val: {
|
|
68
|
+
value: string;
|
|
69
|
+
error: string | null;
|
|
70
|
+
}) => void;
|
|
71
|
+
/**
|
|
72
|
+
* If it is defined, the component will change its appearance, showing
|
|
73
|
+
* the error below the textarea. If it is not defined, the error
|
|
74
|
+
* messages will be managed internally, but never displayed on its own.
|
|
75
|
+
*/
|
|
76
|
+
error?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Regular expression that defines the valid format allowed by the
|
|
79
|
+
* textarea. This will be checked both when the textarea loses the focus
|
|
80
|
+
* and while typing within it. If the string entered does not match the
|
|
81
|
+
* pattern, the onBlur and onChange functions will be called with the
|
|
82
|
+
* current value and an internal error informing that this value does not
|
|
83
|
+
* match the pattern. If the pattern is met, the error parameter of both
|
|
84
|
+
* events will be null.
|
|
85
|
+
*/
|
|
86
|
+
pattern?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Specifies the minimun length allowed by the textarea.
|
|
89
|
+
* This will be checked both when the textarea loses the
|
|
90
|
+
* focus and while typing within it. If the string entered does not
|
|
91
|
+
* comply the minimum length, the onBlur and onChange functions will be called
|
|
92
|
+
* with the current value and an internal error informing that the value
|
|
93
|
+
* length does not comply the specified range. If a valid length is
|
|
94
|
+
* reached, the error parameter of both events will be null.
|
|
95
|
+
*/
|
|
96
|
+
minLength?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Specifies the maximum length allowed by the textarea.
|
|
99
|
+
* This will be checked both when the textarea loses the
|
|
100
|
+
* focus and while typing within it. If the string entered does not
|
|
101
|
+
* comply the maximum length, the onBlur and onChange functions will be called
|
|
102
|
+
* with the current value and an internal error informing that the value
|
|
103
|
+
* length does not comply the specified range. If a valid length is
|
|
104
|
+
* reached, the error parameter of both events will be null.
|
|
105
|
+
*/
|
|
106
|
+
maxLength?: number;
|
|
107
|
+
/**
|
|
108
|
+
* HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the textarea value.
|
|
109
|
+
* Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
|
|
110
|
+
*/
|
|
111
|
+
autocomplete?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
114
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
115
|
+
*/
|
|
116
|
+
margin?: Space | Margin;
|
|
117
|
+
/**
|
|
118
|
+
* Size of the component ('small' | 'medium' | 'large' | 'fillParent').
|
|
119
|
+
*/
|
|
120
|
+
size?: "small" | "medium" | "large" | "fillParent";
|
|
121
|
+
/**
|
|
122
|
+
* Value of the tabindex attribute.
|
|
123
|
+
*/
|
|
124
|
+
tabIndex?: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Reference to the component.
|
|
128
|
+
*/
|
|
129
|
+
export declare type RefType = HTMLDivElement;
|
|
130
|
+
export default Props;
|
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -46,7 +46,7 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
46
46
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
47
47
|
var colorsTheme = (0, _useTheme["default"])();
|
|
48
48
|
|
|
49
|
-
var _useState = (0, _react.useState)(multiple ? [] :
|
|
49
|
+
var _useState = (0, _react.useState)(multiple ? [] : -1),
|
|
50
50
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
51
51
|
selectedValue = _useState2[0],
|
|
52
52
|
setSelectedValue = _useState2[1];
|
|
@@ -85,7 +85,7 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
85
85
|
} else newSelectedOptions.push(selectedOption);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(multiple ? newSelectedOptions : selectedOption);
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
var handleKeyPress = function handleKeyPress(event, optionValue) {
|
|
@@ -108,16 +108,16 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
108
108
|
role: multiple ? "group" : "radiogroup"
|
|
109
109
|
}, options.map(function (option, i) {
|
|
110
110
|
return /*#__PURE__*/_react["default"].createElement(ToggleContainer, {
|
|
111
|
-
selected: multiple ? value ? value.includes(option.value) : selectedValue.includes(option.value) : value ? option.value === value : option.value === selectedValue,
|
|
111
|
+
selected: multiple && Array.isArray(value) ? value ? value.includes(option.value) : Array.isArray(selectedValue) && selectedValue.includes(option.value) : value ? option.value === value : option.value === selectedValue,
|
|
112
112
|
role: multiple ? "switch" : "radio",
|
|
113
|
-
"aria-checked": multiple ? value ? value.includes(option.value) : selectedValue.includes(option.value) : value ? option.value === value : option.value === selectedValue,
|
|
113
|
+
"aria-checked": multiple && Array.isArray(value) ? value ? value.includes(option.value) : Array.isArray(selectedValue) && selectedValue.includes(option.value) : value ? option.value === value : option.value === selectedValue,
|
|
114
114
|
tabIndex: !disabled ? tabIndex : -1,
|
|
115
115
|
onClick: function onClick() {
|
|
116
116
|
return !disabled && handleToggleChange(option.value);
|
|
117
117
|
},
|
|
118
118
|
isFirst: i === 0,
|
|
119
119
|
isLast: i === options.length - 1,
|
|
120
|
-
isIcon: option.
|
|
120
|
+
isIcon: option.icon,
|
|
121
121
|
optionLabel: option.label,
|
|
122
122
|
disabled: disabled,
|
|
123
123
|
onKeyPress: function onKeyPress(event) {
|
|
@@ -126,10 +126,9 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
126
126
|
key: "toggle-".concat(i, "-").concat(option.label)
|
|
127
127
|
}, /*#__PURE__*/_react["default"].createElement(OptionContent, null, option.icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
128
128
|
optionLabel: option.label
|
|
129
|
-
},
|
|
130
|
-
src: option.
|
|
131
|
-
|
|
132
|
-
}), option.label && /*#__PURE__*/_react["default"].createElement(LabelContainer, null, option.label)));
|
|
129
|
+
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
130
|
+
src: option.icon
|
|
131
|
+
}) : option.icon), option.label && /*#__PURE__*/_react["default"].createElement(LabelContainer, null, option.label)));
|
|
133
132
|
}))));
|
|
134
133
|
};
|
|
135
134
|
|
|
@@ -203,11 +202,9 @@ var LabelContainer = _styledComponents["default"].span(_templateObject6 || (_tem
|
|
|
203
202
|
return props.theme.optionLabelFontWeight;
|
|
204
203
|
});
|
|
205
204
|
|
|
206
|
-
var OptionContent = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n"])));
|
|
205
|
+
var OptionContent = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"])));
|
|
207
206
|
|
|
208
|
-
var Icon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["
|
|
209
|
-
return props.optionLabel && props.theme.iconMarginRight;
|
|
210
|
-
});
|
|
207
|
+
var Icon = _styledComponents["default"].img(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
211
208
|
|
|
212
209
|
var IconContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: ", ";\n height: 24px;\n width: 24px;\n overflow: hidden;\n display: flex;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
213
210
|
return props.optionLabel && props.theme.iconMarginRight;
|