@dxc-technology/halstack-react 0.0.0-b39a2d8 → 0.0.0-b3e1a2f

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 (162) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -4
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +5 -8
  5. package/V3Select/V3Select.js +2 -2
  6. package/V3Textarea/V3Textarea.js +2 -2
  7. package/accordion/Accordion.js +2 -2
  8. package/accordion/Accordion.stories.tsx +307 -0
  9. package/accordion/types.d.ts +1 -1
  10. package/accordion-group/AccordionGroup.js +2 -2
  11. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  12. package/accordion-group/types.d.ts +1 -1
  13. package/alert/Alert.js +2 -2
  14. package/badge/Badge.js +1 -1
  15. package/bleed/Bleed.d.ts +3 -0
  16. package/bleed/Bleed.js +84 -0
  17. package/bleed/Bleed.stories.tsx +342 -0
  18. package/bleed/types.d.ts +13 -0
  19. package/bleed/types.js +5 -0
  20. package/box/Box.js +2 -2
  21. package/button/Button.d.ts +1 -1
  22. package/button/Button.js +13 -19
  23. package/button/Button.stories.tsx +6 -8
  24. package/button/types.d.ts +5 -9
  25. package/card/Card.js +1 -1
  26. package/card/Card.stories.tsx +1 -1
  27. package/checkbox/Checkbox.js +2 -2
  28. package/checkbox/types.d.ts +1 -1
  29. package/chip/Chip.d.ts +4 -0
  30. package/chip/Chip.js +5 -27
  31. package/chip/types.d.ts +53 -0
  32. package/chip/types.js +5 -0
  33. package/common/variables.js +57 -22
  34. package/date/Date.js +1 -1
  35. package/date-input/DateInput.js +10 -13
  36. package/dialog/Dialog.js +4 -3
  37. package/dropdown/Dropdown.js +1 -1
  38. package/dropdown/Dropdown.stories.tsx +247 -0
  39. package/dropdown/types.d.ts +1 -1
  40. package/file-input/FileInput.d.ts +1 -1
  41. package/file-input/FileInput.js +160 -81
  42. package/file-input/FileInput.stories.tsx +507 -0
  43. package/file-input/FileItem.js +8 -6
  44. package/file-input/types.d.ts +32 -7
  45. package/footer/Footer.d.ts +1 -1
  46. package/footer/Footer.js +12 -18
  47. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  48. package/footer/Icons.d.ts +2 -0
  49. package/footer/Icons.js +3 -3
  50. package/footer/types.d.ts +21 -17
  51. package/header/Header.js +2 -2
  52. package/header/Icons.d.ts +2 -0
  53. package/heading/Heading.js +1 -1
  54. package/heading/Heading.stories.tsx +54 -0
  55. package/input-text/InputText.js +2 -2
  56. package/inset/Inset.d.ts +3 -0
  57. package/inset/Inset.js +84 -0
  58. package/inset/Inset.stories.tsx +229 -0
  59. package/inset/types.d.ts +13 -0
  60. package/inset/types.js +5 -0
  61. package/layout/ApplicationLayout.d.ts +10 -0
  62. package/layout/ApplicationLayout.js +9 -19
  63. package/layout/ApplicationLayout.stories.tsx +171 -0
  64. package/layout/types.d.ts +57 -0
  65. package/layout/types.js +5 -0
  66. package/link/Link.js +1 -1
  67. package/list/List.d.ts +4 -0
  68. package/list/List.js +47 -0
  69. package/list/List.stories.tsx +95 -0
  70. package/list/types.d.ts +7 -0
  71. package/list/types.js +5 -0
  72. package/main.d.ts +7 -3
  73. package/main.js +34 -2
  74. package/number-input/NumberInput.js +3 -6
  75. package/number-input/NumberInputContext.d.ts +4 -0
  76. package/number-input/NumberInputContext.js +5 -2
  77. package/number-input/numberInputContextTypes.d.ts +19 -0
  78. package/number-input/numberInputContextTypes.js +5 -0
  79. package/package.json +4 -2
  80. package/paginator/Paginator.js +2 -8
  81. package/password-input/PasswordInput.js +19 -18
  82. package/password-input/PasswordInput.stories.tsx +3 -3
  83. package/password-input/types.d.ts +17 -10
  84. package/progress-bar/ProgressBar.js +4 -4
  85. package/radio/Radio.js +2 -2
  86. package/radio-group/Radio.d.ts +4 -0
  87. package/radio-group/Radio.js +130 -0
  88. package/radio-group/RadioGroup.d.ts +4 -0
  89. package/radio-group/RadioGroup.js +268 -0
  90. package/radio-group/RadioGroup.stories.tsx +79 -0
  91. package/radio-group/types.d.ts +36 -0
  92. package/radio-group/types.js +5 -0
  93. package/resultsetTable/ResultsetTable.d.ts +4 -0
  94. package/resultsetTable/ResultsetTable.js +5 -28
  95. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  96. package/resultsetTable/types.d.ts +67 -0
  97. package/resultsetTable/types.js +5 -0
  98. package/row/Row.d.ts +3 -0
  99. package/row/Row.js +127 -0
  100. package/row/Row.stories.tsx +237 -0
  101. package/row/types.d.ts +10 -0
  102. package/row/types.js +5 -0
  103. package/select/Select.d.ts +4 -0
  104. package/select/Select.js +20 -22
  105. package/select/types.d.ts +170 -0
  106. package/select/types.js +5 -0
  107. package/sidenav/Sidenav.js +2 -2
  108. package/sidenav/Sidenav.stories.tsx +182 -0
  109. package/slider/Slider.js +4 -4
  110. package/spinner/Spinner.js +2 -2
  111. package/spinner/Spinner.stories.jsx +1 -0
  112. package/stack/Stack.d.ts +3 -0
  113. package/stack/Stack.js +97 -0
  114. package/stack/Stack.stories.tsx +164 -0
  115. package/stack/types.d.ts +9 -0
  116. package/stack/types.js +5 -0
  117. package/switch/Switch.js +2 -2
  118. package/switch/Switch.stories.tsx +1 -1
  119. package/table/Table.js +3 -3
  120. package/table/Table.stories.jsx +2 -1
  121. package/tabs/Tabs.js +11 -9
  122. package/tabs/Tabs.stories.tsx +120 -0
  123. package/tabs/types.d.ts +23 -15
  124. package/tag/Tag.js +1 -1
  125. package/tag/Tag.stories.tsx +1 -1
  126. package/text/Text.d.ts +7 -0
  127. package/text/Text.js +30 -0
  128. package/text/Text.stories.tsx +19 -0
  129. package/text-input/TextInput.d.ts +4 -0
  130. package/text-input/TextInput.js +54 -85
  131. package/text-input/TextInput.stories.tsx +456 -0
  132. package/text-input/types.d.ts +159 -0
  133. package/text-input/types.js +5 -0
  134. package/textarea/Textarea.d.ts +4 -0
  135. package/textarea/Textarea.js +27 -60
  136. package/textarea/Textarea.stories.jsx +4 -3
  137. package/textarea/types.d.ts +130 -0
  138. package/textarea/types.js +5 -0
  139. package/toggle/Toggle.js +1 -1
  140. package/toggle-group/ToggleGroup.d.ts +4 -0
  141. package/toggle-group/ToggleGroup.js +16 -45
  142. package/toggle-group/ToggleGroup.stories.tsx +23 -28
  143. package/toggle-group/types.d.ts +97 -0
  144. package/toggle-group/types.js +5 -0
  145. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  146. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  147. package/upload/file-upload/FileToUpload.js +1 -1
  148. package/upload/files-upload/FilesToUpload.js +1 -1
  149. package/upload/transaction/Transaction.js +2 -2
  150. package/upload/transactions/Transactions.js +1 -1
  151. package/useTheme.d.ts +2 -0
  152. package/useTheme.js +1 -1
  153. package/wizard/Wizard.js +59 -9
  154. package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
  155. package/wizard/types.d.ts +3 -7
  156. package/chip/index.d.ts +0 -22
  157. package/resultsetTable/index.d.ts +0 -19
  158. package/select/index.d.ts +0 -131
  159. package/text-input/index.d.ts +0 -135
  160. package/textarea/index.d.ts +0 -117
  161. package/toggle-group/index.d.ts +0 -21
  162. package/wizard/Icons.js +0 -65
@@ -0,0 +1,237 @@
1
+ import React from "react";
2
+ import Title from "../../.storybook/components/Title";
3
+ import styled from "styled-components";
4
+ import DxcRow from "./Row";
5
+
6
+ export default {
7
+ title: "Row",
8
+ component: DxcRow,
9
+ };
10
+
11
+ export const Chromatic = () => (
12
+ <>
13
+ <Title title="Default" theme="light" level={4} />
14
+ <Container>
15
+ <DxcRow>
16
+ <Placeholder></Placeholder>
17
+ <Placeholder></Placeholder>
18
+ <Placeholder></Placeholder>
19
+ </DxcRow>
20
+ </Container>
21
+ <Title title="Justify = center" theme="light" level={4} />
22
+ <Container>
23
+ <DxcRow justify="center">
24
+ <Placeholder></Placeholder>
25
+ <Placeholder></Placeholder>
26
+ <Placeholder></Placeholder>
27
+ </DxcRow>
28
+ </Container>
29
+ <Title title="Justify = end" theme="light" level={4} />
30
+ <Container>
31
+ <DxcRow justify="end">
32
+ <Placeholder></Placeholder>
33
+ <Placeholder></Placeholder>
34
+ <Placeholder></Placeholder>
35
+ </DxcRow>
36
+ </Container>
37
+ <Title title="Justify = spaceAround" theme="light" level={4} />
38
+ <Container>
39
+ <DxcRow justify="spaceAround">
40
+ <Placeholder></Placeholder>
41
+ <Placeholder></Placeholder>
42
+ <Placeholder></Placeholder>
43
+ </DxcRow>
44
+ </Container>
45
+ <Title title="Justify = spaceBetween" theme="light" level={4} />
46
+ <Container>
47
+ <DxcRow justify="spaceBetween">
48
+ <Placeholder></Placeholder>
49
+ <Placeholder></Placeholder>
50
+ <Placeholder></Placeholder>
51
+ </DxcRow>
52
+ </Container>
53
+ <Title title="Justify = spaceEvenly" theme="light" level={4} />
54
+ <Container>
55
+ <DxcRow justify="spaceEvenly">
56
+ <Placeholder></Placeholder>
57
+ <Placeholder></Placeholder>
58
+ <Placeholder></Placeholder>
59
+ </DxcRow>
60
+ </Container>
61
+ <Title title="Justify = start" theme="light" level={4} />
62
+ <Container>
63
+ <DxcRow justify="start">
64
+ <Placeholder></Placeholder>
65
+ <Placeholder></Placeholder>
66
+ <Placeholder></Placeholder>
67
+ </DxcRow>
68
+ </Container>
69
+ <Title title="Align = baseline" theme="light" level={4} />
70
+ <Container>
71
+ <DxcRow align="baseline">
72
+ <Placeholder paddingTop={20}>test</Placeholder>
73
+ <Placeholder>test</Placeholder>
74
+ <Placeholder paddingBottom={60}>test</Placeholder>
75
+ </DxcRow>
76
+ </Container>
77
+ <Title title="Align = center" theme="light" level={4} />
78
+ <Container>
79
+ <DxcRow align="center">
80
+ <Placeholder paddingTop={20}></Placeholder>
81
+ <Placeholder></Placeholder>
82
+ <Placeholder paddingTop={60}></Placeholder>
83
+ </DxcRow>
84
+ </Container>
85
+ <Title title="Align = end" theme="light" level={4} />
86
+ <Container>
87
+ <DxcRow align="end">
88
+ <Placeholder paddingTop={20}></Placeholder>
89
+ <Placeholder></Placeholder>
90
+ <Placeholder paddingTop={60}></Placeholder>
91
+ </DxcRow>
92
+ </Container>
93
+ <Title title="Align = start" theme="light" level={4} />
94
+ <Container>
95
+ <DxcRow align="start">
96
+ <Placeholder paddingTop={20}></Placeholder>
97
+ <Placeholder></Placeholder>
98
+ <Placeholder paddingTop={60}></Placeholder>
99
+ </DxcRow>
100
+ </Container>
101
+ <Title title="Align = stretch" theme="light" level={4} />
102
+ <Container>
103
+ <DxcRow align="stretch">
104
+ <Placeholder paddingTop={20}></Placeholder>
105
+ <Placeholder></Placeholder>
106
+ <Placeholder paddingTop={60}></Placeholder>
107
+ </DxcRow>
108
+ </Container>
109
+ <Title title="gutter = xxxsmall" theme="light" level={4} />
110
+ <Container>
111
+ <DxcRow gutter="xxxsmall">
112
+ <Placeholder></Placeholder>
113
+ <Placeholder></Placeholder>
114
+ <Placeholder></Placeholder>
115
+ </DxcRow>
116
+ </Container>
117
+ <Title title="gutter = xxsmall" theme="light" level={4} />
118
+ <Container>
119
+ <DxcRow gutter="xxsmall">
120
+ <Placeholder></Placeholder>
121
+ <Placeholder></Placeholder>
122
+ <Placeholder></Placeholder>
123
+ </DxcRow>
124
+ </Container>
125
+ <Title title="gutter = xsmall" theme="light" level={4} />
126
+ <Container>
127
+ <DxcRow gutter="xsmall">
128
+ <Placeholder></Placeholder>
129
+ <Placeholder></Placeholder>
130
+ <Placeholder></Placeholder>
131
+ </DxcRow>
132
+ </Container>
133
+ <Title title="gutter = small" theme="light" level={4} />
134
+ <Container>
135
+ <DxcRow gutter="small">
136
+ <Placeholder></Placeholder>
137
+ <Placeholder></Placeholder>
138
+ <Placeholder></Placeholder>
139
+ </DxcRow>
140
+ </Container>
141
+ <Title title="gutter = medium" theme="light" level={4} />
142
+ <Container>
143
+ <DxcRow gutter="medium">
144
+ <Placeholder></Placeholder>
145
+ <Placeholder></Placeholder>
146
+ <Placeholder></Placeholder>
147
+ </DxcRow>
148
+ </Container>
149
+ <Title title="gutter = large" theme="light" level={4} />
150
+ <Container>
151
+ <DxcRow gutter="large">
152
+ <Placeholder></Placeholder>
153
+ <Placeholder></Placeholder>
154
+ <Placeholder></Placeholder>
155
+ </DxcRow>
156
+ </Container>
157
+ <Title title="gutter = xlarge" theme="light" level={4} />
158
+ <Container>
159
+ <DxcRow gutter="xlarge">
160
+ <Placeholder></Placeholder>
161
+ <Placeholder></Placeholder>
162
+ <Placeholder></Placeholder>
163
+ </DxcRow>
164
+ </Container>
165
+ <Title title="gutter = xxlarge" theme="light" level={4} />
166
+ <Container>
167
+ <DxcRow gutter="xxlarge">
168
+ <Placeholder></Placeholder>
169
+ <Placeholder></Placeholder>
170
+ <Placeholder></Placeholder>
171
+ </DxcRow>
172
+ </Container>
173
+ <Title title="gutter = xxxlarge" theme="light" level={4} />
174
+ <Container>
175
+ <DxcRow gutter="xxxlarge">
176
+ <Placeholder></Placeholder>
177
+ <Placeholder></Placeholder>
178
+ <Placeholder></Placeholder>
179
+ </DxcRow>
180
+ </Container>
181
+ <Title title="gutter = none" theme="light" level={4} />
182
+ <Container>
183
+ <DxcRow gutter="none">
184
+ <Placeholder></Placeholder>
185
+ <Placeholder></Placeholder>
186
+ <Placeholder></Placeholder>
187
+ </DxcRow>
188
+ </Container>
189
+ <Title title="reverse = false" theme="light" level={4} />
190
+ <Container>
191
+ <DxcRow reverse={false}>
192
+ <Placeholder>1</Placeholder>
193
+ <Placeholder>2</Placeholder>
194
+ <Placeholder>3</Placeholder>
195
+ </DxcRow>
196
+ </Container>
197
+ <Title title="reverse = true" theme="light" level={4} />
198
+ <Container>
199
+ <DxcRow reverse={true}>
200
+ <Placeholder>1</Placeholder>
201
+ <Placeholder>2</Placeholder>
202
+ <Placeholder>3</Placeholder>
203
+ </DxcRow>
204
+ </Container>
205
+ <Title title="wrap = true" theme="light" level={4} />
206
+ <Container width={300}>
207
+ <DxcRow wrap={true}>
208
+ <Placeholder>1</Placeholder>
209
+ <Placeholder>2</Placeholder>
210
+ <Placeholder>3</Placeholder>
211
+ </DxcRow>
212
+ </Container>
213
+ <Title title="wrap = false" theme="light" level={4} />
214
+ <Container width={300}>
215
+ <DxcRow wrap={false}>
216
+ <Placeholder>1</Placeholder>
217
+ <Placeholder>2</Placeholder>
218
+ <Placeholder>3</Placeholder>
219
+ </DxcRow>
220
+ </Container>
221
+ </>
222
+ );
223
+
224
+ const Container = styled.div`
225
+ background: #f2eafa;
226
+ padding: 10px;
227
+ width: ${({ width }) => (width ? `${width}px` : "unset")};
228
+ `;
229
+
230
+ const Placeholder = styled.div`
231
+ min-height: 40px;
232
+ min-width: 120px;
233
+ border: 1px solid #a46ede;
234
+ background-color: #e5d5f6;
235
+ padding-top: ${({ paddingTop }) => `${paddingTop ?? 0}px`};
236
+ padding-bottom: ${({ paddingBottom }) => `${paddingBottom ?? 0}px`};
237
+ `;
package/row/types.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ gutter?: "none" | "xxxsmall" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
4
+ align?: "start" | "center" | "end" | "baseline" | "stretch";
5
+ justify?: "start" | "center" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly";
6
+ wrap?: boolean;
7
+ reverse?: boolean;
8
+ children: React.ReactNode;
9
+ };
10
+ export default Props;
package/row/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import SelectPropsType from "./types";
3
+ declare const DxcSelect: React.ForwardRefExoticComponent<SelectPropsType & React.RefAttributes<HTMLDivElement>>;
4
+ export default DxcSelect;
package/select/Select.js CHANGED
@@ -21,7 +21,7 @@ var _react = _interopRequireWildcard(require("react"));
21
21
 
22
22
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
23
 
24
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
24
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
25
25
 
26
26
  var _variables = require("../common/variables.js");
27
27
 
@@ -153,7 +153,7 @@ var getLastOptionIndex = function getLastOptionIndex(options, filteredOptions, s
153
153
 
154
154
  var getSelectedOption = function getSelectedOption(options, multiple, optional, optionalEmptyOption, value, innerValue) {
155
155
  var val = value !== null && value !== void 0 ? value : innerValue;
156
- var selectedOption = multiple ? [] : "";
156
+ var selectedOption = multiple ? [] : {};
157
157
  var singleSelectionIndex;
158
158
 
159
159
  if (multiple) {
@@ -201,14 +201,12 @@ var getSelectedOption = function getSelectedOption(options, multiple, optional,
201
201
  var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
202
202
  var _selectedOption$label;
203
203
 
204
- var _ref$label = _ref.label,
205
- label = _ref$label === void 0 ? "" : _ref$label,
204
+ var label = _ref.label,
206
205
  _ref$name = _ref.name,
207
206
  name = _ref$name === void 0 ? "" : _ref$name,
208
207
  value = _ref.value,
209
208
  options = _ref.options,
210
- _ref$helperText = _ref.helperText,
211
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
209
+ helperText = _ref.helperText,
212
210
  _ref$placeholder = _ref.placeholder,
213
211
  placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
214
212
  _ref$disabled = _ref.disabled,
@@ -221,8 +219,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
221
219
  multiple = _ref$multiple === void 0 ? false : _ref$multiple,
222
220
  onChange = _ref.onChange,
223
221
  onBlur = _ref.onBlur,
224
- _ref$error = _ref.error,
225
- error = _ref$error === void 0 ? "" : _ref$error,
222
+ error = _ref.error,
226
223
  margin = _ref.margin,
227
224
  _ref$size = _ref.size,
228
225
  size = _ref$size === void 0 ? "medium" : _ref$size,
@@ -549,13 +546,14 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
549
546
  margin: margin,
550
547
  size: size,
551
548
  ref: ref
552
- }, /*#__PURE__*/_react["default"].createElement(Label, {
549
+ }, label && /*#__PURE__*/_react["default"].createElement(Label, {
553
550
  id: selectLabelId,
554
551
  disabled: disabled,
555
552
  onClick: function onClick() {
556
553
  selectContainerRef.current.focus();
557
- }
558
- }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), /*#__PURE__*/_react["default"].createElement(HelperText, {
554
+ },
555
+ helperText: helperText
556
+ }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, "(Optional)")), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
559
557
  disabled: disabled
560
558
  }, helperText), /*#__PURE__*/_react["default"].createElement(Select, {
561
559
  id: selectId,
@@ -585,8 +583,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
585
583
  },
586
584
  onClick: handleClearOptionsActionOnClick,
587
585
  tabIndex: -1,
588
- title: "Clear selected options",
589
- "aria-label": "Clear selected options"
586
+ title: "Clear selection",
587
+ "aria-label": "Clear selection"
590
588
  }, selectIcons.clear)), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
591
589
  name: name,
592
590
  value: multiple ? (value !== null && value !== void 0 ? value : innerValue).join(", ") : value !== null && value !== void 0 ? value : innerValue,
@@ -615,8 +613,8 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
615
613
  },
616
614
  onClick: handleClearSearchActionOnClick,
617
615
  tabIndex: -1,
618
- title: "Clear search text",
619
- "aria-label": "Clear search text"
616
+ title: "Clear search",
617
+ "aria-label": "Clear search"
620
618
  }, selectIcons.clear), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
621
619
  disabled: disabled
622
620
  }, isOpen ? selectIcons.arrowUp : selectIcons.arrowDown), isOpen && /*#__PURE__*/_react["default"].createElement(OptionsList, {
@@ -633,7 +631,7 @@ var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
633
631
  }, searchable && (filteredOptions.length === 0 || !filteredGroupsHaveOptions()) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, selectIcons.searchOff), "No matches found") : optional && !multiple && /*#__PURE__*/_react["default"].createElement(Option, {
634
632
  option: optionalEmptyOption,
635
633
  index: 0
636
- }), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && /*#__PURE__*/_react["default"].createElement(Error, null, error)));
634
+ }), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, null, error)));
637
635
  });
638
636
 
639
637
  var sizes = {
@@ -661,7 +659,7 @@ var SelectContainer = _styledComponents["default"].div(_templateObject || (_temp
661
659
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
662
660
  });
663
661
 
664
- 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 cursor: default;\n"])), function (props) {
662
+ 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 cursor: default;\n ", "\n"])), function (props) {
665
663
  return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
666
664
  }, function (props) {
667
665
  return props.theme.fontFamily;
@@ -673,13 +671,15 @@ var Label = _styledComponents["default"].span(_templateObject2 || (_templateObje
673
671
  return props.theme.labelFontWeight;
674
672
  }, function (props) {
675
673
  return props.theme.labelLineHeight;
674
+ }, function (props) {
675
+ return !props.helperText && "margin-bottom: 0.25rem";
676
676
  });
677
677
 
678
678
  var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
679
679
  return props.theme.optionalLabelFontWeight;
680
680
  });
681
681
 
682
- 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"])), function (props) {
682
+ 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: 0.25rem;\n"])), function (props) {
683
683
  return props.disabled ? props.theme.disabledColor : props.theme.helperTextFontColor;
684
684
  }, function (props) {
685
685
  return props.theme.fontFamily;
@@ -693,9 +693,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
693
693
  return props.theme.helperTextLineHeight;
694
694
  });
695
695
 
696
- var Select = _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 margin: ", ";\n padding: 0 0.5rem;\n outline: none;\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) {
697
- return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
698
- }, function (props) {
696
+ var Select = _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 outline: none;\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) {
699
697
  return props.disabled && "background-color: ".concat(props.theme.disabledInputBackgroundColor);
700
698
  }, function (props) {
701
699
  return props.disabled ? props.theme.disabledInputBorderColor : props.theme.enabledInputBorderColor;
@@ -773,7 +771,7 @@ var ErrorIcon = _styledComponents["default"].span(_templateObject13 || (_templat
773
771
  return props.theme.errorIconColor;
774
772
  });
775
773
 
776
- var Error = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n"])), function (props) {
774
+ var Error = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (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) {
777
775
  return props.theme.errorMessageColor;
778
776
  }, function (props) {
779
777
  return props.theme.fontFamily;
@@ -0,0 +1,170 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type SVG = React.SVGProps<SVGSVGElement>;
10
+ declare type OptionGroup = {
11
+ /**
12
+ * Label of the group to be shown in the select's listbox.
13
+ */
14
+ label: string;
15
+ /**
16
+ * List of the grouped options.
17
+ */
18
+ options: Option[];
19
+ };
20
+ declare type Option = {
21
+ /**
22
+ * Element used as the icon that will be placed before the option label.
23
+ * It can be a url of an image or an inline SVG. If the url option
24
+ * is the chosen one, take into account that the component's
25
+ * color styling tokens will not be applied to the image.
26
+ */
27
+ icon?: string | SVG;
28
+ /**
29
+ * Label of the option to be shown in the select's listbox.
30
+ */
31
+ label: string;
32
+ /**
33
+ * Value of the option. It should be unique and
34
+ * not an empty string, which is reserved to the empty option added
35
+ * by optional prop.
36
+ */
37
+ value: string;
38
+ };
39
+ declare type CommonProps = {
40
+ /**
41
+ * Text to be placed above the select.
42
+ */
43
+ label?: string;
44
+ /**
45
+ * Name attribute of the input element. This attribute will allow users
46
+ * to find the component's value during the submit event. In this event,
47
+ * the component's value will always be a regular string, for both single
48
+ * and multiple selection modes, been in the first one a single option
49
+ * value and in the multiple variant more than one option value,
50
+ * separated by commas.
51
+ */
52
+ name?: string;
53
+ /**
54
+ * An array of objects representing the selectable options.
55
+ */
56
+ options?: Option[] | OptionGroup[];
57
+ /**
58
+ * Helper text to be placed above the select.
59
+ */
60
+ helperText?: string;
61
+ /**
62
+ * Text to be put as placeholder of the select.
63
+ */
64
+ placeholder?: string;
65
+ /**
66
+ * If true, the component will be disabled.
67
+ */
68
+ disabled?: boolean;
69
+ /**
70
+ * If true, the select will be optional, showing '(Optional)'
71
+ * next to the label and adding a default first option with an empty string as value,
72
+ * been the placeholder (if defined) its label. Otherwise, the field will be
73
+ * considered required and an error will be passed as a parameter to the
74
+ * OnBlur and onChange functions if an option wasn't selected.
75
+ */
76
+ optional?: boolean;
77
+ /**
78
+ * If true, enables search functionality.
79
+ */
80
+ searchable?: boolean;
81
+ /**
82
+ * If it is defined, the component will change its appearance, showing
83
+ * the error below the select component. If it is not defined, the error
84
+ * messages will be managed internally, but never displayed on its own.
85
+ */
86
+ error?: string;
87
+ /**
88
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
89
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
90
+ */
91
+ margin?: Space | Margin;
92
+ /**
93
+ * Size of the component.
94
+ */
95
+ size?: "small" | "medium" | "large" | "fillParent";
96
+ /**
97
+ * Value of the tabindex attribute.
98
+ */
99
+ tabIndex?: number;
100
+ };
101
+ declare type SingleSelect = CommonProps & {
102
+ /**
103
+ * If true, the select component will support multiple selected options.
104
+ * In that case, value will be an array of strings with each selected
105
+ * option value.
106
+ */
107
+ multiple?: false;
108
+ /**
109
+ * Value of the select. If undefined, the component will be uncontrolled
110
+ * and the value will be managed internally by the component.
111
+ */
112
+ value?: string;
113
+ /**
114
+ * This function will be called when the user selects an option.
115
+ * An object including the current value and the error (if the value entered is not valid)
116
+ * will be passed to this function. If there is no error, error will be null.
117
+ */
118
+ onChange?: (val: {
119
+ value: string;
120
+ error: string;
121
+ }) => void;
122
+ /**
123
+ * This function will be called when the select loses the focus. An
124
+ * object including the value and the error (if the value
125
+ * selected is not valid) will be passed to this function. If there is no error,
126
+ * error will be null.
127
+ */
128
+ onBlur?: (val: {
129
+ value: string;
130
+ error: string;
131
+ }) => void;
132
+ };
133
+ declare type MultipleSelect = CommonProps & {
134
+ /**
135
+ * If true, the select component will support multiple selected options.
136
+ * In that case, value will be an array of strings with each selected
137
+ * option value.
138
+ */
139
+ multiple: true;
140
+ /**
141
+ * Value of the select. If undefined, the component will be uncontrolled
142
+ * and the value will be managed internally by the component.
143
+ */
144
+ value?: string[];
145
+ /**
146
+ * This function will be called when the user selects an option.
147
+ * An object including the current selected values and the error (if the value entered is not valid)
148
+ * will be passed to this function. If there is no error, error will be null.
149
+ */
150
+ onChange?: (val: {
151
+ value: string[];
152
+ error: string;
153
+ }) => void;
154
+ /**
155
+ * This function will be called when the select loses the focus. An
156
+ * object including the selected values and the error (if the value
157
+ * selected is not valid) will be passed to this function. If there is no error,
158
+ * error will be null.
159
+ */
160
+ onBlur?: (val: {
161
+ value: string[];
162
+ error: string;
163
+ }) => void;
164
+ };
165
+ declare type Props = SingleSelect | MultipleSelect;
166
+ /**
167
+ * Reference to the component.
168
+ */
169
+ export declare type RefType = HTMLDivElement;
170
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -17,9 +17,9 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
17
 
18
18
  var _variables = require("../common/variables.js");
19
19
 
20
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
20
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
21
21
 
22
- var _BackgroundColorContext = require("../BackgroundColorContext.js");
22
+ var _BackgroundColorContext = require("../BackgroundColorContext");
23
23
 
24
24
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
25
25