@telus-uds/components-base 1.21.0 → 1.23.0

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 (42) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/component-docs.json +470 -1
  3. package/lib/Button/ButtonGroup.js +9 -0
  4. package/lib/Checkbox/CheckboxGroup.js +2 -0
  5. package/lib/ExpandCollapse/Control.js +3 -1
  6. package/lib/Feedback/Feedback.js +5 -2
  7. package/lib/Fieldset/Fieldset.js +42 -13
  8. package/lib/Fieldset/FieldsetContainer.js +9 -3
  9. package/lib/List/PressableListItemBase.js +1 -0
  10. package/lib/QuickLinksFeature/QuickLinksFeature.js +91 -0
  11. package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +157 -0
  12. package/lib/QuickLinksFeature/index.js +16 -0
  13. package/lib/Radio/RadioGroup.js +5 -1
  14. package/lib/RadioCard/RadioCardGroup.js +2 -0
  15. package/lib/index.js +9 -0
  16. package/lib-module/Button/ButtonGroup.js +9 -0
  17. package/lib-module/Checkbox/CheckboxGroup.js +2 -0
  18. package/lib-module/ExpandCollapse/Control.js +3 -1
  19. package/lib-module/Feedback/Feedback.js +5 -2
  20. package/lib-module/Fieldset/Fieldset.js +39 -12
  21. package/lib-module/Fieldset/FieldsetContainer.js +9 -3
  22. package/lib-module/List/PressableListItemBase.js +1 -0
  23. package/lib-module/QuickLinksFeature/QuickLinksFeature.js +69 -0
  24. package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +130 -0
  25. package/lib-module/QuickLinksFeature/index.js +4 -0
  26. package/lib-module/Radio/RadioGroup.js +5 -1
  27. package/lib-module/RadioCard/RadioCardGroup.js +2 -0
  28. package/lib-module/index.js +1 -0
  29. package/package.json +2 -2
  30. package/src/Button/ButtonGroup.jsx +10 -0
  31. package/src/Checkbox/CheckboxGroup.jsx +2 -0
  32. package/src/ExpandCollapse/Control.jsx +3 -2
  33. package/src/Feedback/Feedback.jsx +11 -3
  34. package/src/Fieldset/Fieldset.jsx +45 -13
  35. package/src/Fieldset/FieldsetContainer.jsx +29 -12
  36. package/src/List/PressableListItemBase.jsx +1 -0
  37. package/src/QuickLinksFeature/QuickLinksFeature.jsx +65 -0
  38. package/src/QuickLinksFeature/QuickLinksFeatureItem.jsx +114 -0
  39. package/src/QuickLinksFeature/index.js +6 -0
  40. package/src/Radio/RadioGroup.jsx +5 -3
  41. package/src/RadioCard/RadioCardGroup.jsx +2 -0
  42. package/src/index.js +1 -0
@@ -9,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
13
+
12
14
  var _Feedback = _interopRequireDefault(require("../Feedback"));
13
15
 
14
16
  var _utils = require("../utils");
@@ -21,8 +23,6 @@ var _InputLabel = _interopRequireDefault(require("../InputLabel"));
21
23
 
22
24
  var _useInputSupports = _interopRequireDefault(require("../InputSupports/useInputSupports"));
23
25
 
24
- var _Legend = _interopRequireDefault(require("./Legend"));
25
-
26
26
  var _jsxRuntime = require("react/jsx-runtime");
27
27
 
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -44,6 +44,8 @@ const Fieldset = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
44
44
  feedback,
45
45
  feedbackPosition = 'top',
46
46
  validation,
47
+ showIcon = false,
48
+ showErrorBorder = false,
47
49
  legend,
48
50
  hint,
49
51
  hintPosition,
@@ -64,20 +66,19 @@ const Fieldset = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
64
66
  label: legend,
65
67
  validation
66
68
  });
67
- const legendContent = legend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Legend.default, {
68
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputLabel.default, {
69
- copy: copy,
70
- label: legend,
71
- hint: hint,
72
- hintPosition: hintPosition,
73
- hintId: hintId,
74
- tooltip: tooltip
75
- })
69
+ const legendContent = legend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputLabel.default, {
70
+ copy: copy,
71
+ label: legend,
72
+ hint: hint,
73
+ hintPosition: hintPosition,
74
+ hintId: hintId,
75
+ tooltip: tooltip
76
76
  });
77
77
  const feedbackContent = feedback && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Feedback.default, {
78
78
  id: feedbackId,
79
79
  title: feedback,
80
- validation: validation
80
+ validation: validation,
81
+ showFeedbackIcon: showIcon
81
82
  }); // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
82
83
  // and on MacOS voiceover, radiogroup -> radio. To allow elements to be direct children of the
83
84
  // fieldset as much as possible, but also allow different spacing within content and between
@@ -91,14 +92,32 @@ const Fieldset = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
91
92
  space,
92
93
  preserveFragments: true
93
94
  });
95
+ const borderStyle = validation === 'error' && showErrorBorder && staticStyles.errorBorder || staticStyles.noBorder;
94
96
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FieldsetContainer.default, {
95
97
  ref: ref,
96
98
  inactive: inactive,
97
99
  accessibilityRole: accessibilityRole,
98
100
  name: fieldsetName,
101
+ borderStyle: borderStyle,
102
+ showBorderStyle: showErrorBorder,
99
103
  children: stackedContent
100
104
  });
101
105
  });
106
+
107
+ const staticStyles = _StyleSheet.default.create({
108
+ errorBorder: {
109
+ border: true,
110
+ borderWidth: 1,
111
+ borderColor: 'red',
112
+ borderRadius: 10,
113
+ padding: 8
114
+ },
115
+ noBorder: {
116
+ padding: 9,
117
+ border: 'unset'
118
+ }
119
+ });
120
+
102
121
  Fieldset.displayName = 'Fieldset';
103
122
  Fieldset.propTypes = {
104
123
  children: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
@@ -165,7 +184,17 @@ Fieldset.propTypes = {
165
184
  /**
166
185
  * Use to visually mark an input as valid or invalid.
167
186
  */
168
- validation: _propTypes.default.oneOf(['error', 'success'])
187
+ validation: _propTypes.default.oneOf(['error', 'success']),
188
+
189
+ /**
190
+ * Use to show error or success icon in the feedback
191
+ */
192
+ showIcon: _propTypes.default.bool,
193
+
194
+ /**
195
+ * Use to show border in case of error for a group of components
196
+ */
197
+ showErrorBorder: _propTypes.default.bool
169
198
  };
170
199
  var _default = Fieldset;
171
200
  exports.default = _default;
@@ -27,12 +27,16 @@ const FieldsetContainer = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
27
27
  children,
28
28
  inactive,
29
29
  accessibilityRole,
30
- name: fieldsetName
30
+ name: fieldsetName,
31
+ showBorderStyle = false,
32
+ borderStyle
31
33
  } = _ref;
34
+ // If needs border for error design or reset the component style
35
+ const styleContainer = showBorderStyle ? borderStyle : _cssReset.default;
32
36
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("fieldset", {
33
37
  ref: ref,
34
38
  disabled: inactive,
35
- style: _cssReset.default,
39
+ style: styleContainer,
36
40
  role: accessibilityRole,
37
41
  name: fieldsetName,
38
42
  children: children
@@ -43,7 +47,9 @@ FieldsetContainer.propTypes = {
43
47
  accessibilityRole: _propTypes.default.string,
44
48
  children: _propTypes.default.node,
45
49
  inactive: _propTypes.default.bool,
46
- name: _propTypes.default.string
50
+ name: _propTypes.default.string,
51
+ showBorderStyle: _propTypes.default.bool,
52
+ borderStyle: _propTypes.default.object
47
53
  };
48
54
  var _default = FieldsetContainer;
49
55
  exports.default = _default;
@@ -132,6 +132,7 @@ const staticStyles = _StyleSheet.default.create({
132
132
  PressableListItemBase.propTypes = { ..._utils.withLinkRouter.propTypes,
133
133
  href: _propTypes.default.string,
134
134
  onPress: _propTypes.default.func,
135
+ // eslint-disable-next-line react/forbid-prop-types
135
136
  tokens: _propTypes.default.any,
136
137
  icon: _propTypes.default.elementType,
137
138
  children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _StackView = require("../StackView");
13
+
14
+ var _ThemeProvider = require("../ThemeProvider");
15
+
16
+ var _utils = require("../utils");
17
+
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ 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; }
25
+
26
+ // pass through and type relevant system props - add more sets for interactive components
27
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
28
+
29
+ const isQuickListItem = element => {
30
+ var _element$type, _element$type2;
31
+
32
+ const elementName = (element === null || element === void 0 ? void 0 : (_element$type = element.type) === null || _element$type === void 0 ? void 0 : _element$type.displayName) || (element === null || element === void 0 ? void 0 : (_element$type2 = element.type) === null || _element$type2 === void 0 ? void 0 : _element$type2.name);
33
+ return Boolean(elementName.match(/QuickLinksFeatureItem/));
34
+ };
35
+ /**
36
+ * QuickLinksFeature renders a list of interactive items.
37
+ * - This is the base component that is used as a wrapper and accepts a List of `QuickLinksFeature.Item`
38
+ */
39
+
40
+
41
+ const QuickLinksFeature = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
42
+ let {
43
+ tokens,
44
+ variant,
45
+ tag = 'ul',
46
+ children,
47
+ ...rest
48
+ } = _ref;
49
+ const {
50
+ stackGap,
51
+ stackJustify,
52
+ stackSpace
53
+ } = (0, _ThemeProvider.useThemeTokens)('QuickLinksFeature', tokens, variant);
54
+
55
+ const items = _react.Children.map(children, child => {
56
+ if (isQuickListItem(child)) {
57
+ return /*#__PURE__*/(0, _react.cloneElement)(child, child.props);
58
+ }
59
+
60
+ return null;
61
+ });
62
+
63
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
64
+ space: stackSpace,
65
+ gap: stackGap,
66
+ tokens: {
67
+ justifyContent: stackJustify
68
+ },
69
+ tag: tag,
70
+ ref: ref,
71
+ ...selectProps(rest),
72
+ children: items
73
+ });
74
+ });
75
+ QuickLinksFeature.displayName = 'QuickLinksFeature';
76
+ QuickLinksFeature.propTypes = { ...selectedSystemPropTypes,
77
+ tokens: (0, _utils.getTokensPropType)('QuickLinksFeature'),
78
+ variant: _utils.variantProp.propType,
79
+
80
+ /**
81
+ * Default wrapper tag, by default it's "ul"
82
+ */
83
+ tag: _propTypes.default.string,
84
+
85
+ /**
86
+ * QuickLinksFeature.Item component
87
+ */
88
+ children: _propTypes.default.node
89
+ };
90
+ var _default = QuickLinksFeature;
91
+ exports.default = _default;
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _Image = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Image"));
13
+
14
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
15
+
16
+ var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
17
+
18
+ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
19
+
20
+ var _utils = require("../utils");
21
+
22
+ var _ViewportProvider = require("../ViewportProvider");
23
+
24
+ var _ThemeProvider = require("../ThemeProvider");
25
+
26
+ var _Link = require("../Link");
27
+
28
+ var _StackView = require("../StackView");
29
+
30
+ var _jsxRuntime = require("react/jsx-runtime");
31
+
32
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
+
34
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
+
36
+ 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; }
37
+
38
+ // pass through and type relevant system props - add more sets for interactive components
39
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.linkProps]);
40
+
41
+ const selectImageStyle = imageDimension => ({
42
+ width: imageDimension,
43
+ height: imageDimension,
44
+ ..._Platform.default.select({
45
+ // TODO: https://github.com/telus/universal-design-system/issues/487
46
+ web: {
47
+ transition: 'width 200ms, height 200ms'
48
+ }
49
+ })
50
+ });
51
+
52
+ const selectContainerStyle = _ref => {
53
+ let {
54
+ contentMaxDimension,
55
+ textAlign
56
+ } = _ref;
57
+ return {
58
+ textAlign,
59
+ width: contentMaxDimension,
60
+ overflow: 'hidden'
61
+ };
62
+ };
63
+
64
+ const selectImageContainerStyle = contentMaxDimension => ({
65
+ width: contentMaxDimension,
66
+ height: contentMaxDimension,
67
+ justifyContent: 'center',
68
+ alignItems: 'center'
69
+ });
70
+ /**
71
+ * Component export along with QuickLinksFeature to be used as children
72
+ *
73
+ * It will receive a image source and a accessibility label and will render a link accordingly with the theme tokens
74
+ */
75
+
76
+
77
+ const QuickLinksFeatureItem = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
78
+ let {
79
+ tokens,
80
+ variant,
81
+ children,
82
+ imageAccessibilityLabel,
83
+ imageSource,
84
+ ...rest
85
+ } = _ref2;
86
+ const viewport = (0, _ViewportProvider.useViewport)();
87
+ const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('QuickLinksFeatureItem', tokens, variant);
88
+ const [hover, setHover] = (0, _react.useState)(false);
89
+ const {
90
+ contentDirection,
91
+ contentSpace,
92
+ contentAlignItems,
93
+ contentMaxDimension,
94
+ imageDimension,
95
+ textAlign
96
+ } = getTokens({
97
+ viewport,
98
+ hover
99
+ });
100
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.Link, {
101
+ ref: ref,
102
+ tokens: state => {
103
+ setHover(state.hover);
104
+ return getTokens(state);
105
+ },
106
+ ...selectProps(rest),
107
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
108
+ style: selectContainerStyle({
109
+ contentMaxDimension,
110
+ textAlign
111
+ }),
112
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.StackWrap, {
113
+ direction: contentDirection,
114
+ space: contentSpace,
115
+ tokens: {
116
+ alignItems: contentAlignItems
117
+ },
118
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
119
+ style: selectImageContainerStyle(contentMaxDimension),
120
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
121
+ accessibilityIgnoresInvertColors: true,
122
+ imageAccessibilityLabel: imageAccessibilityLabel,
123
+ source: imageSource,
124
+ style: selectImageStyle(imageDimension)
125
+ })
126
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
127
+ children: children
128
+ })]
129
+ })
130
+ })
131
+ });
132
+ });
133
+ QuickLinksFeatureItem.displayName = 'QuickLinksFeatureItem';
134
+ QuickLinksFeatureItem.propTypes = { ..._utils.withLinkRouter.propTypes,
135
+ ...selectedSystemPropTypes,
136
+ tokens: (0, _utils.getTokensPropType)('QuickLinksFeatureItem'),
137
+ variant: _utils.variantProp.propType,
138
+
139
+ /**
140
+ * Text which will be rendered within the Link
141
+ */
142
+ children: _propTypes.default.node.isRequired,
143
+
144
+ /**
145
+ * Image accessibility label
146
+ */
147
+ imageAccessibilityLabel: _propTypes.default.string.isRequired,
148
+
149
+ /**
150
+ * Image node or Image url
151
+ */
152
+ imageSource: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired
153
+ };
154
+
155
+ var _default = (0, _utils.withLinkRouter)(QuickLinksFeatureItem);
156
+
157
+ exports.default = _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _QuickLinksFeature = _interopRequireDefault(require("./QuickLinksFeature"));
9
+
10
+ var _QuickLinksFeatureItem = _interopRequireDefault(require("./QuickLinksFeatureItem"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ _QuickLinksFeature.default.Item = _QuickLinksFeatureItem.default;
15
+ var _default = _QuickLinksFeature.default;
16
+ exports.default = _default;
@@ -131,6 +131,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
131
131
  id,
132
132
  onChange: itemOnChange,
133
133
  ref: itemRef,
134
+ description,
134
135
  ...itemRest
135
136
  } = _ref2;
136
137
  const radioId = id || "Radio[".concat(index, "]");
@@ -142,7 +143,6 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
142
143
  };
143
144
 
144
145
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Radio.default, {
145
- error: validation === 'error',
146
146
  ref: itemRef,
147
147
  id: radioId,
148
148
  checked: isChecked,
@@ -152,6 +152,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
152
152
  name: inputGroupName,
153
153
  tokens: radioTokens,
154
154
  variant: variant,
155
+ description: description,
155
156
  ...selectItemProps(itemRest)
156
157
  }, radioId);
157
158
  });
@@ -167,6 +168,8 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
167
168
  feedback: feedback,
168
169
  inactive: inactive,
169
170
  validation: validation,
171
+ showIcon: true,
172
+ showErrorBorder: true,
170
173
  accessibilityRole: "radiogroup",
171
174
  ...selectProps(rest),
172
175
  children: (0, _StackView.getStackedContent)(radios, {
@@ -205,6 +208,7 @@ RadioGroup.propTypes = { ...selectedSystemPropTypes,
205
208
  label: _propTypes.default.string,
206
209
  id: _propTypes.default.string,
207
210
  onChange: _propTypes.default.func,
211
+ description: _propTypes.default.string,
208
212
  ref: _airbnbPropTypes.default.ref()
209
213
  })),
210
214
 
@@ -142,6 +142,8 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
142
142
  feedback: feedback,
143
143
  inactive: inactive || readOnly,
144
144
  validation: validation,
145
+ showErrorBorder: true,
146
+ showIcon: true,
145
147
  accessibilityRole: "radiogroup",
146
148
  ...selectProps(rest),
147
149
  children: props => /*#__PURE__*/(0, _jsxRuntime.jsx)(StackContainer, {
package/lib/index.js CHANGED
@@ -30,6 +30,7 @@ var _exportNames = {
30
30
  Pagination: true,
31
31
  Progress: true,
32
32
  QuickLinks: true,
33
+ QuickLinksFeature: true,
33
34
  Radio: true,
34
35
  RadioCard: true,
35
36
  Responsive: true,
@@ -238,6 +239,12 @@ Object.defineProperty(exports, "QuickLinks", {
238
239
  return _QuickLinks.default;
239
240
  }
240
241
  });
242
+ Object.defineProperty(exports, "QuickLinksFeature", {
243
+ enumerable: true,
244
+ get: function () {
245
+ return _QuickLinksFeature.default;
246
+ }
247
+ });
241
248
  Object.defineProperty(exports, "Radio", {
242
249
  enumerable: true,
243
250
  get: function () {
@@ -541,6 +548,8 @@ var _Progress = _interopRequireDefault(require("./Progress"));
541
548
 
542
549
  var _QuickLinks = _interopRequireDefault(require("./QuickLinks"));
543
550
 
551
+ var _QuickLinksFeature = _interopRequireDefault(require("./QuickLinksFeature"));
552
+
544
553
  var _Radio = _interopRequireWildcard(require("./Radio"));
545
554
 
546
555
  Object.keys(_Radio).forEach(function (key) {
@@ -31,6 +31,7 @@ const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
31
31
  feedback,
32
32
  name: inputGroupName,
33
33
  copy,
34
+ iconPosition,
34
35
  accessibilityRole = maxValues === 1 ? 'radiogroup' // radiogroup is cross-platform; only web aria has generic groups
35
36
  : Platform.select({
36
37
  web: 'group',
@@ -113,6 +114,7 @@ const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
113
114
  toggleOneValue(id, event);
114
115
  };
115
116
 
117
+ const iconProp = itemRest.icon || undefined;
116
118
  const itemA11y = {
117
119
  accessibilityState: {
118
120
  checked: isSelected
@@ -130,9 +132,11 @@ const ButtonGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
130
132
  tokens: getButtonTokens,
131
133
  selected: isSelected,
132
134
  inactive: inactive,
135
+ icon: iconProp,
133
136
  ...selectItemProps({ ...itemRest,
134
137
  ...itemA11y
135
138
  }),
139
+ iconPosition: iconPosition,
136
140
  children: label
137
141
  }, id);
138
142
  })
@@ -201,6 +205,11 @@ ButtonGroup.propTypes = { ...selectedSystemPropTypes,
201
205
  */
202
206
  initialValues: PropTypes.arrayOf(PropTypes.string),
203
207
 
208
+ /**
209
+ * Defines if the icon will be displayed on the right or left side of the label.
210
+ */
211
+ iconPosition: PropTypes.oneOf(['left', 'right']),
212
+
204
213
  /**
205
214
  * Main text used to describe this group, used in Fieldset's Legend element.
206
215
  */
@@ -139,6 +139,8 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
139
139
  feedback: feedback,
140
140
  inactive: inactive,
141
141
  validation: validation,
142
+ showIcon: true,
143
+ showErrorBorder: true,
142
144
  ...selectProps(rest),
143
145
  children: getStackedContent(checkboxes, {
144
146
  space,
@@ -41,11 +41,13 @@ function selectContainerStyles(_ref) {
41
41
  function selectIconContainerStyles(_ref2) {
42
42
  let {
43
43
  iconGap,
44
+ iconPaddingTop,
44
45
  iconPosition
45
46
  } = _ref2;
46
47
  const paddingSide = iconPosition === 'right' ? 'paddingLeft' : 'paddingRight';
47
48
  return {
48
- [paddingSide]: iconGap
49
+ [paddingSide]: iconGap,
50
+ paddingTop: iconPaddingTop
49
51
  };
50
52
  }
51
53
 
@@ -84,10 +84,12 @@ const Feedback = /*#__PURE__*/forwardRef((_ref5, ref) => {
84
84
  validation,
85
85
  tokens,
86
86
  variant,
87
+ showFeedbackIcon = false,
87
88
  ...rest
88
89
  } = _ref5;
89
90
  const themeTokens = useThemeTokens('Feedback', tokens, { ...variant,
90
- validation
91
+ validation,
92
+ icon: showFeedbackIcon
91
93
  });
92
94
  const {
93
95
  space
@@ -153,7 +155,8 @@ Feedback.propTypes = { ...selectedSystemPropTypes,
153
155
  /** @ignore */
154
156
  id: PropTypes.string,
155
157
  tokens: getTokensPropType('Feedback'),
156
- variant: variantProp.propType
158
+ variant: variantProp.propType,
159
+ showFeedbackIcon: PropTypes.bool
157
160
  };
158
161
  export default Feedback;
159
162
  const staticStyles = StyleSheet.create({
@@ -1,12 +1,12 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
3
4
  import Feedback from '../Feedback';
4
5
  import { spacingProps } from '../utils';
5
6
  import FieldsetContainer from './FieldsetContainer';
6
7
  import { getStackedContent } from '../StackView';
7
8
  import InputLabel from '../InputLabel';
8
9
  import useInputSupports from '../InputSupports/useInputSupports';
9
- import Legend from './Legend';
10
10
  /**
11
11
  * An alternative to InputSupports for groups of input elements that, on web, are to be
12
12
  * wrapped in a `<fieldset>` tag, with label content displated in a `<legend>` tag.
@@ -23,6 +23,8 @@ const Fieldset = /*#__PURE__*/forwardRef((_ref, ref) => {
23
23
  feedback,
24
24
  feedbackPosition = 'top',
25
25
  validation,
26
+ showIcon = false,
27
+ showErrorBorder = false,
26
28
  legend,
27
29
  hint,
28
30
  hintPosition,
@@ -44,21 +46,20 @@ const Fieldset = /*#__PURE__*/forwardRef((_ref, ref) => {
44
46
  validation
45
47
  });
46
48
 
47
- const legendContent = legend && /*#__PURE__*/_jsx(Legend, {
48
- children: /*#__PURE__*/_jsx(InputLabel, {
49
- copy: copy,
50
- label: legend,
51
- hint: hint,
52
- hintPosition: hintPosition,
53
- hintId: hintId,
54
- tooltip: tooltip
55
- })
49
+ const legendContent = legend && /*#__PURE__*/_jsx(InputLabel, {
50
+ copy: copy,
51
+ label: legend,
52
+ hint: hint,
53
+ hintPosition: hintPosition,
54
+ hintId: hintId,
55
+ tooltip: tooltip
56
56
  });
57
57
 
58
58
  const feedbackContent = feedback && /*#__PURE__*/_jsx(Feedback, {
59
59
  id: feedbackId,
60
60
  title: feedback,
61
- validation: validation
61
+ validation: validation,
62
+ showFeedbackIcon: showIcon
62
63
  }); // Some accessibility patterns depend on elements being direct children, e.g. fieldset -> legend,
63
64
  // and on MacOS voiceover, radiogroup -> radio. To allow elements to be direct children of the
64
65
  // fieldset as much as possible, but also allow different spacing within content and between
@@ -74,14 +75,30 @@ const Fieldset = /*#__PURE__*/forwardRef((_ref, ref) => {
74
75
  space,
75
76
  preserveFragments: true
76
77
  });
78
+ const borderStyle = validation === 'error' && showErrorBorder && staticStyles.errorBorder || staticStyles.noBorder;
77
79
  return /*#__PURE__*/_jsx(FieldsetContainer, {
78
80
  ref: ref,
79
81
  inactive: inactive,
80
82
  accessibilityRole: accessibilityRole,
81
83
  name: fieldsetName,
84
+ borderStyle: borderStyle,
85
+ showBorderStyle: showErrorBorder,
82
86
  children: stackedContent
83
87
  });
84
88
  });
89
+ const staticStyles = StyleSheet.create({
90
+ errorBorder: {
91
+ border: true,
92
+ borderWidth: 1,
93
+ borderColor: 'red',
94
+ borderRadius: 10,
95
+ padding: 8
96
+ },
97
+ noBorder: {
98
+ padding: 9,
99
+ border: 'unset'
100
+ }
101
+ });
85
102
  Fieldset.displayName = 'Fieldset';
86
103
  Fieldset.propTypes = {
87
104
  children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
@@ -148,6 +165,16 @@ Fieldset.propTypes = {
148
165
  /**
149
166
  * Use to visually mark an input as valid or invalid.
150
167
  */
151
- validation: PropTypes.oneOf(['error', 'success'])
168
+ validation: PropTypes.oneOf(['error', 'success']),
169
+
170
+ /**
171
+ * Use to show error or success icon in the feedback
172
+ */
173
+ showIcon: PropTypes.bool,
174
+
175
+ /**
176
+ * Use to show border in case of error for a group of components
177
+ */
178
+ showErrorBorder: PropTypes.bool
152
179
  };
153
180
  export default Fieldset;