carbon-react 110.2.3 → 110.4.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 (87) hide show
  1. package/esm/__internal__/radio-button-mapper/index.d.ts +2 -0
  2. package/esm/__internal__/radio-button-mapper/index.js +1 -0
  3. package/esm/__internal__/radio-button-mapper/radio-button-mapper.d.ts +21 -0
  4. package/esm/__internal__/sticky-footer/index.d.ts +1 -0
  5. package/esm/__internal__/sticky-footer/sticky-footer.component.d.ts +15 -0
  6. package/esm/__internal__/sticky-footer/sticky-footer.style.d.ts +2 -0
  7. package/esm/__internal__/utils/helpers/tags/index.d.ts +1 -0
  8. package/esm/__spec_helper__/mock-resize-observer.d.ts +1 -1
  9. package/esm/__spec_helper__/mock-resize-observer.js +2 -2
  10. package/esm/components/button-toggle/button-toggle.component.d.ts +3 -3
  11. package/esm/components/button-toggle/button-toggle.component.js +21 -20
  12. package/esm/components/button-toggle/button-toggle.style.d.ts +1 -1
  13. package/esm/components/button-toggle-group/button-toggle-group.component.d.ts +45 -0
  14. package/esm/components/button-toggle-group/button-toggle-group.component.js +187 -92
  15. package/esm/components/button-toggle-group/button-toggle-group.style.d.ts +4 -0
  16. package/esm/components/button-toggle-group/button-toggle-group.style.js +2 -2
  17. package/esm/components/button-toggle-group/index.d.ts +2 -1
  18. package/esm/components/definition-list/dd.component.d.ts +4 -1
  19. package/esm/components/definition-list/dd.component.js +1 -0
  20. package/esm/components/definition-list/dl.component.d.ts +4 -1
  21. package/esm/components/definition-list/dl.component.js +1 -0
  22. package/esm/components/definition-list/dt.component.d.ts +4 -1
  23. package/esm/components/definition-list/dt.component.js +1 -0
  24. package/esm/components/drawer/drawer.component.d.ts +37 -0
  25. package/esm/components/drawer/drawer.component.js +43 -54
  26. package/esm/components/drawer/drawer.style.d.ts +27 -0
  27. package/esm/components/drawer/drawer.style.js +2 -2
  28. package/esm/components/drawer/index.d.ts +2 -1
  29. package/esm/components/drawer/index.js +1 -2
  30. package/esm/components/menu/__internal__/submenu/submenu.component.js +22 -4
  31. package/esm/components/menu/menu-item/menu-item.component.js +6 -1
  32. package/esm/components/menu/menu-item/menu-item.d.ts +4 -0
  33. package/esm/components/menu/menu-item/menu-item.style.js +158 -149
  34. package/esm/components/menu/scrollable-block/scrollable-block.component.js +21 -5
  35. package/esm/components/menu/scrollable-block/scrollable-block.d.ts +6 -0
  36. package/esm/components/menu/scrollable-block/scrollable-block.style.js +1 -1
  37. package/esm/components/tabs/__internal__/tabs-header/tabs-header.style.d.ts +6 -0
  38. package/esm/components/tabs/tab/tab.style.d.ts +2 -0
  39. package/esm/components/tabs/tabs.style.d.ts +2 -0
  40. package/lib/__internal__/radio-button-mapper/index.d.ts +2 -0
  41. package/lib/{components/button-toggle-group/documentation → __internal__/radio-button-mapper}/index.js +2 -2
  42. package/lib/__internal__/radio-button-mapper/package.json +6 -0
  43. package/lib/__internal__/radio-button-mapper/radio-button-mapper.d.ts +21 -0
  44. package/lib/__internal__/sticky-footer/index.d.ts +1 -0
  45. package/lib/__internal__/sticky-footer/sticky-footer.component.d.ts +15 -0
  46. package/lib/__internal__/sticky-footer/sticky-footer.style.d.ts +2 -0
  47. package/lib/__internal__/utils/helpers/tags/index.d.ts +1 -0
  48. package/lib/__spec_helper__/mock-resize-observer.d.ts +1 -1
  49. package/lib/__spec_helper__/mock-resize-observer.js +2 -2
  50. package/lib/components/button-toggle/button-toggle.component.d.ts +3 -3
  51. package/lib/components/button-toggle/button-toggle.component.js +22 -20
  52. package/lib/components/button-toggle/button-toggle.style.d.ts +1 -1
  53. package/lib/components/button-toggle-group/button-toggle-group.component.d.ts +45 -0
  54. package/lib/components/button-toggle-group/button-toggle-group.component.js +190 -93
  55. package/lib/components/button-toggle-group/button-toggle-group.style.d.ts +4 -0
  56. package/lib/components/button-toggle-group/button-toggle-group.style.js +2 -2
  57. package/lib/components/button-toggle-group/index.d.ts +2 -1
  58. package/lib/components/definition-list/dd.component.d.ts +4 -1
  59. package/lib/components/definition-list/dd.component.js +1 -0
  60. package/lib/components/definition-list/dl.component.d.ts +4 -1
  61. package/lib/components/definition-list/dl.component.js +1 -0
  62. package/lib/components/definition-list/dt.component.d.ts +4 -1
  63. package/lib/components/definition-list/dt.component.js +1 -0
  64. package/lib/components/drawer/drawer.component.d.ts +37 -0
  65. package/lib/components/drawer/drawer.component.js +43 -55
  66. package/lib/components/drawer/drawer.style.d.ts +27 -0
  67. package/lib/components/drawer/drawer.style.js +3 -3
  68. package/lib/components/drawer/index.d.ts +2 -1
  69. package/lib/components/menu/__internal__/submenu/submenu.component.js +23 -4
  70. package/lib/components/menu/menu-item/menu-item.component.js +6 -1
  71. package/lib/components/menu/menu-item/menu-item.d.ts +4 -0
  72. package/lib/components/menu/menu-item/menu-item.style.js +158 -149
  73. package/lib/components/menu/scrollable-block/scrollable-block.component.js +22 -5
  74. package/lib/components/menu/scrollable-block/scrollable-block.d.ts +6 -0
  75. package/lib/components/menu/scrollable-block/scrollable-block.style.js +1 -1
  76. package/lib/components/tabs/__internal__/tabs-header/tabs-header.style.d.ts +6 -0
  77. package/lib/components/tabs/tab/tab.style.d.ts +2 -0
  78. package/lib/components/tabs/tabs.style.d.ts +2 -0
  79. package/package.json +1 -1
  80. package/esm/components/button-toggle-group/__definition__.js +0 -38
  81. package/esm/components/button-toggle-group/button-toggle-group.d.ts +0 -58
  82. package/esm/components/button-toggle-group/documentation/index.js +0 -1
  83. package/esm/components/drawer/drawer.d.ts +0 -44
  84. package/lib/components/button-toggle-group/__definition__.js +0 -50
  85. package/lib/components/button-toggle-group/button-toggle-group.d.ts +0 -58
  86. package/lib/components/button-toggle-group/documentation/package.json +0 -6
  87. package/lib/components/drawer/drawer.d.ts +0 -44
@@ -32,6 +32,7 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
32
32
  clickToOpen,
33
33
  maxWidth,
34
34
  inFullscreenView,
35
+ overrideColor,
35
36
  as
36
37
  }) => (0, _styledComponents.css)`
37
38
  display: inline-block;
@@ -40,43 +41,51 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
40
41
  height: 40px;
41
42
  position: relative;
42
43
  cursor: pointer;
43
- background-color: ${_menu.default[menuType].background};
44
+ ${!overrideColor && (0, _styledComponents.css)`
45
+ background-color: ${_menu.default[menuType].background};
46
+ `}};
47
+
48
+ ${overrideColor && (0, _styledComponents.css)`
49
+ &&&& {
50
+ background-color: ${variant === "alternate" ? _menu.default[menuType].alternate : _menu.default[menuType].submenuItemBackground};
51
+ }
52
+ `}
44
53
 
45
54
  ${!inFullscreenView && (0, _styledComponents.css)`
46
- max-width: inherit;
47
-
48
- a,
49
- button {
50
- ${maxWidth && (0, _styledComponents.css)`
51
- box-sizing: border-box;
52
- max-width: inherit;
53
- text-overflow: ellipsis;
54
- overflow: hidden;
55
- white-space: nowrap;
56
- vertical-align: bottom;
57
- `}
58
- }
59
-
60
- a:focus,
61
- button:focus {
62
- box-shadow: inset 0 0 0 var(--borderWidth300)
63
- var(--colorsSemanticFocus500);
64
- background-color: ${_menu.default[menuType].background};
65
- color: ${_menu.default[menuType].color};
66
- z-index: 1;
67
- position: relative;
68
- }
55
+ max-width: inherit;
56
+
57
+ a,
58
+ button {
59
+ ${maxWidth && (0, _styledComponents.css)`
60
+ box-sizing: border-box;
61
+ max-width: inherit;
62
+ text-overflow: ellipsis;
63
+ overflow: hidden;
64
+ white-space: nowrap;
65
+ vertical-align: bottom;
66
+ `}
67
+ }
69
68
 
70
- a:hover,
71
- button:hover {
72
- background-color: var(--colorsComponentsMenuAutumnStandard600);
73
- color: var(--colorsComponentsMenuYang100);
69
+ a:focus,
70
+ button:focus {
71
+ box-shadow: inset 0 0 0 var(--borderWidth300)
72
+ var(--colorsSemanticFocus500);
73
+ background-color: ${_menu.default[menuType].background};
74
+ color: ${_menu.default[menuType].color};
75
+ z-index: 1;
76
+ position: relative;
77
+ }
74
78
 
75
- [data-component="icon"] {
79
+ a:hover,
80
+ button:hover {
81
+ background-color: var(--colorsComponentsMenuAutumnStandard600);
76
82
  color: var(--colorsComponentsMenuYang100);
83
+
84
+ [data-component="icon"] {
85
+ color: var(--colorsComponentsMenuYang100);
86
+ }
77
87
  }
78
- }
79
- `}
88
+ `}
80
89
 
81
90
  a,
82
91
  ${_link.StyledLink} a,
@@ -109,159 +118,159 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
109
118
  }
110
119
 
111
120
  ${selected && (0, _styledComponents.css)`
112
- background-color: ${_menu.default[menuType].selected};
113
-
114
- a:focus,
115
- button:focus {
116
121
  background-color: ${_menu.default[menuType].selected};
117
- }
118
122
 
119
- a:hover,
120
- button:hover {
121
- background-color: var(--colorsComponentsMenuAutumnStandard600);
122
- }
123
- `}
123
+ a:focus,
124
+ button:focus {
125
+ background-color: ${_menu.default[menuType].selected};
126
+ }
127
+
128
+ a:hover,
129
+ button:hover {
130
+ background-color: var(--colorsComponentsMenuAutumnStandard600);
131
+ }
132
+ `}
124
133
 
125
134
  ${variant === "alternate" && !inFullscreenView && (0, _styledComponents.css)`
126
- &&& {
127
- background-color: ${_menu.default[menuType].alternate};
128
- }
135
+ &&& {
136
+ background-color: ${_menu.default[menuType].alternate};
137
+ }
129
138
 
130
- &&& a:focus,
131
- &&& button:focus {
132
- background-color: ${_menu.default[menuType].alternate};
133
- }
139
+ &&& a:focus,
140
+ &&& button:focus {
141
+ background-color: ${_menu.default[menuType].alternate};
142
+ }
134
143
 
135
- &&& a:hover,
136
- &&& button:hover {
137
- background-color: ${_menu.default[menuType].alternateHover};
138
- }
139
- `}
144
+ &&& a:hover,
145
+ &&& button:hover {
146
+ background-color: ${_menu.default[menuType].alternateHover};
147
+ }
148
+ `}
140
149
 
141
150
  ${isOpen && (0, _styledComponents.css)`
142
- a,
143
- button {
144
- background-color: ${_menu.default[menuType].submenuItemBackground};
145
- color: ${_menu.default[menuType].color};
146
- }
147
- `}
151
+ a,
152
+ button {
153
+ background-color: ${_menu.default[menuType].submenuItemBackground};
154
+ color: ${_menu.default[menuType].color};
155
+ }
156
+ `}
148
157
 
149
158
  ${hasSubmenu && (0, _styledComponents.css)`
150
- background-color: ${_menu.default[menuType].submenuBackground};
151
-
152
- a:focus,
153
- button:focus {
154
159
  background-color: ${_menu.default[menuType].submenuBackground};
155
- color: ${_menu.default[menuType].color};
156
160
 
157
- [data-component="icon"] {
161
+ a:focus,
162
+ button:focus {
163
+ background-color: ${_menu.default[menuType].submenuBackground};
158
164
  color: ${_menu.default[menuType].color};
165
+
166
+ [data-component="icon"] {
167
+ color: ${_menu.default[menuType].color};
168
+ }
169
+
170
+ ${clickToOpen && isOpen && (0, _styledComponents.css)`
171
+ background-color: ${_menu.default[menuType].submenuOpenedBackground};
172
+ `}
159
173
  }
160
174
 
161
- ${clickToOpen && isOpen && (0, _styledComponents.css)`
175
+ a:hover,
176
+ button:hover {
162
177
  background-color: ${_menu.default[menuType].submenuOpenedBackground};
163
- `}
164
- }
178
+ color: var(--colorsComponentsMenuYang100);
165
179
 
166
- a:hover,
167
- button:hover {
168
- background-color: ${_menu.default[menuType].submenuOpenedBackground};
169
- color: var(--colorsComponentsMenuYang100);
180
+ ${!(href || clickToOpen) && (0, _styledComponents.css)`
181
+ cursor: default;
182
+ background-color: ${_menu.default[menuType].submenuItemBackground};
183
+ color: ${_menu.default[menuType].color};
184
+ `}
170
185
 
171
- ${!(href || clickToOpen) && (0, _styledComponents.css)`
172
- cursor: default;
173
- background-color: ${_menu.default[menuType].submenuItemBackground};
174
- color: ${_menu.default[menuType].color};
175
- `}
176
-
177
- [data-component="icon"] {
178
- color: ${_menu.default[menuType].color};
186
+ [data-component="icon"] {
187
+ color: ${_menu.default[menuType].color};
188
+ }
179
189
  }
180
- }
181
190
 
182
- ${selected && (0, _styledComponents.css)`
183
- background-color: ${_menu.default[menuType].submenuSelected};
184
-
185
- a:focus,
186
- button:focus {
191
+ ${selected && (0, _styledComponents.css)`
187
192
  background-color: ${_menu.default[menuType].submenuSelected};
188
- }
189
193
 
190
- a:hover,
191
- button:hover {
192
- background-color: var(--colorsComponentsMenuAutumnStandard600);
193
- color: var(--colorsComponentsMenuYang100);
194
- }
195
- `}
194
+ a:focus,
195
+ button:focus {
196
+ background-color: ${_menu.default[menuType].submenuSelected};
197
+ }
196
198
 
197
- ${showDropdownArrow && (0, _styledComponents.css)`
198
- > a,
199
- > button {
200
- padding-right: 32px;
201
- }
199
+ a:hover,
200
+ button:hover {
201
+ background-color: var(--colorsComponentsMenuAutumnStandard600);
202
+ color: var(--colorsComponentsMenuYang100);
203
+ }
204
+ `}
202
205
 
203
- a::before,
204
- button::before {
205
- display: block;
206
- margin-top: -2px;
207
- pointer-events: none;
208
- position: absolute;
209
- right: 16px;
210
- top: 50%;
211
- z-index: 2;
212
- content: "";
213
- width: 0;
214
- height: 0;
215
- border-top: 5px solid ${_menu.default[menuType].text};
216
- border-right: 4px solid transparent;
217
- border-bottom: 4px solid transparent;
218
- border-left: 4px solid transparent;
219
- }
220
- `};
221
- `}
206
+ ${showDropdownArrow && (0, _styledComponents.css)`
207
+ > a,
208
+ > button {
209
+ padding-right: 32px;
210
+ }
211
+
212
+ a::before,
213
+ button::before {
214
+ display: block;
215
+ margin-top: -2px;
216
+ pointer-events: none;
217
+ position: absolute;
218
+ right: 16px;
219
+ top: 50%;
220
+ z-index: 2;
221
+ content: "";
222
+ width: 0;
223
+ height: 0;
224
+ border-top: 5px solid ${_menu.default[menuType].text};
225
+ border-right: 4px solid transparent;
226
+ border-bottom: 4px solid transparent;
227
+ border-left: 4px solid transparent;
228
+ }
229
+ `}
230
+ `}
222
231
 
223
232
  ${isSearch && (0, _styledComponents.css)`
224
- padding: 2px 16px;
225
- `}
233
+ padding: 2px 16px;
234
+ `}
226
235
 
227
236
  ${inFullscreenView && (0, _styledComponents.css)`
228
- ${as === "div" && (0, _styledComponents.css)`
229
- cursor: default;
230
- padding: 0 16px;
237
+ ${as === "div" && (0, _styledComponents.css)`
238
+ cursor: default;
239
+ padding: 0 16px;
231
240
 
232
- :hover {
233
- background: transparent;
234
- }
235
- `}
241
+ :hover {
242
+ background: transparent;
243
+ }
244
+ `}
236
245
 
237
- a,
246
+ a,
238
247
  ${_link.StyledLink} a,
239
248
  button,
240
249
  ${_link.StyledLink} button {
241
- width: 100vw;
242
- box-sizing: border-box;
243
- }
244
-
245
- a:focus,
246
- button:focus {
247
- box-shadow: inset 0 0 0 var(--borderWidth300)
248
- var(--colorsSemanticFocus500);
249
- z-index: 1;
250
- position: relative;
251
- }
252
-
253
- a:focus,
254
- a:hover,
255
- button:focus,
256
- button:hover {
257
- background-color: var(--colorsComponentsMenuAutumnStandard600);
258
- color: var(--colorsComponentsMenuYang100);
259
-
260
- [data-component="icon"] {
250
+ width: 100vw;
251
+ box-sizing: border-box;
252
+ }
253
+
254
+ a:focus,
255
+ button:focus {
256
+ box-shadow: inset 0 0 0 var(--borderWidth300)
257
+ var(--colorsSemanticFocus500);
258
+ z-index: 1;
259
+ position: relative;
260
+ }
261
+
262
+ a:focus,
263
+ a:hover,
264
+ button:focus,
265
+ button:hover {
266
+ background-color: var(--colorsComponentsMenuAutumnStandard600);
261
267
  color: var(--colorsComponentsMenuYang100);
268
+
269
+ [data-component="icon"] {
270
+ color: var(--colorsComponentsMenuYang100);
271
+ }
262
272
  }
263
- }
264
- `}
273
+ `}
265
274
  `}
266
275
  `;
267
276
  var _default = StyledMenuItemWrapper;
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _menu = _interopRequireDefault(require("../menu.context"));
13
13
 
14
+ var _menuItem = _interopRequireDefault(require("../menu-item"));
15
+
14
16
  var _submenu = _interopRequireDefault(require("../__internal__/submenu/submenu.context"));
15
17
 
16
18
  var _scrollableBlock = _interopRequireDefault(require("./scrollable-block.style"));
@@ -29,6 +31,8 @@ const ScrollableBlock = ({
29
31
  children,
30
32
  height,
31
33
  variant = "default",
34
+ parent,
35
+ parentVariant,
32
36
  ...rest
33
37
  }) => {
34
38
  const menuContext = (0, _react.useContext)(_menu.default);
@@ -47,14 +51,19 @@ const ScrollableBlock = ({
47
51
  return /*#__PURE__*/_react.default.createElement(_scrollableBlock.default, _extends({
48
52
  "data-component": "submenu-scrollable-block",
49
53
  menuType: menuContext.menuType,
50
- variant: variant,
51
- role: "presentation"
52
- }, rest), /*#__PURE__*/_react.default.createElement(_box.default, {
54
+ variant: variant
55
+ }, rest), parent && /*#__PURE__*/_react.default.createElement(_menuItem.default, {
56
+ overrideColor: true,
57
+ variant: parentVariant,
58
+ as: "div",
59
+ href: "#"
60
+ }, parent), /*#__PURE__*/_react.default.createElement(_box.default, {
53
61
  overflowY: "scroll",
54
62
  scrollVariant: scrollVariants[menuContext.menuType],
55
63
  height: height,
56
64
  p: 0,
57
- role: "presentation"
65
+ as: "ul",
66
+ role: "list"
58
67
  }, _react.default.Children.map(children, (child, index) => {
59
68
  let isFocused = false;
60
69
  const blockItemFocused = focusIndex >= blockIndex;
@@ -80,7 +89,15 @@ ScrollableBlock.propTypes = {
80
89
  height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
81
90
 
82
91
  /** set the colour variant for a menuType */
83
- variant: _propTypes.default.oneOf(["default", "alternate"])
92
+ variant: _propTypes.default.oneOf(["default", "alternate"]),
93
+
94
+ /** the element, if any, displayed at the top of the block to be its semantic "parent",
95
+ * but not part of the scrollable section
96
+ */
97
+ parent: _propTypes.default.node,
98
+
99
+ /** the colour variant for the parent element, if different from the variant of the block */
100
+ parentVariant: _propTypes.default.oneOf(["default", "alternate"])
84
101
  };
85
102
  var _default = ScrollableBlock;
86
103
  exports.default = _default;
@@ -7,6 +7,12 @@ export interface ScrollableBlockProps {
7
7
  height?: string | number;
8
8
  /** set the colour variant for a menuType */
9
9
  variant?: "default" | "alternate";
10
+ /** the element, if any, displayed at the top of the block to be its semantic "parent",
11
+ * but not part of the scrollable section
12
+ */
13
+ parent?: React.ReactElement;
14
+ /** the colour variant for the parent element, if different from the variant of the block */
15
+ parentVariant?: "default" | "alternate";
10
16
  }
11
17
 
12
18
  declare function ScrollableBlock(props: ScrollableBlockProps): JSX.Element;
@@ -17,7 +17,7 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
17
17
 
18
18
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
19
19
 
20
- const StyledScrollableBlock = _styledComponents.default.div`
20
+ const StyledScrollableBlock = _styledComponents.default.li`
21
21
  ${({
22
22
  menuType,
23
23
  variant
@@ -0,0 +1,6 @@
1
+ export const StyledTabsHeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export const StyledTabsHeaderList: import("styled-components").StyledComponent<"div", any, {
3
+ alternateStyling: any;
4
+ isInSidebar: any;
5
+ position: any;
6
+ }, never>;
@@ -0,0 +1,2 @@
1
+ export default StyledTab;
2
+ declare const StyledTab: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,2 @@
1
+ export default StyledTabs;
2
+ declare const StyledTabs: import("styled-components").StyledComponent<"div", any, {}, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "110.2.3",
3
+ "version": "110.4.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -1,38 +0,0 @@
1
- import ButtonToggleGroup from "./button-toggle-group.component";
2
- import Definition from "./../../../demo/utils/definition";
3
- const definition = new Definition("button-toggle-group", ButtonToggleGroup, {
4
- description: "Adds support for validation, warning and info messages on a group of Button Toggles.",
5
- designerNotes: `
6
- * Similar to [Button Toggle](/components/button-toggle), but use this component when you need your button toggles to act like a single form component, with field help and validation.
7
- * Unlike [Button Toggle](/components/button-toggle), this component doesn't require one option to be auto-selected.
8
- `,
9
- relatedComponentsNotes: `
10
- * Don't need validation on your options? [Try Button Toggle](/components/button-toggle).
11
- `,
12
- type: "form",
13
- propValues: {
14
- children: `<ButtonToggle name={ 'grouped' } id={ 'foo' } value={ 'foo' }>
15
- Foo
16
- </ButtonToggle>
17
- <ButtonToggle name={ 'grouped' } id={ 'bar' } value={ 'bar' }>
18
- Bar
19
- </ButtonToggle>
20
- <ButtonToggle name={ 'grouped' } id={ 'baz' } value={ 'baz' }>
21
- Baz
22
- </ButtonToggle>`,
23
- value: ""
24
- },
25
- propTypes: {
26
- children: "Node",
27
- className: "String",
28
- value: "String"
29
- },
30
- requiredProps: ["children"],
31
- propDescriptions: {
32
- value: "The value associated with the button toggle group.",
33
- children: "The children to render for the button toggle group."
34
- },
35
- hiddenProps: ["children", "value"]
36
- });
37
- definition.isAnInput();
38
- export default definition;
@@ -1,58 +0,0 @@
1
- import * as React from "react";
2
- import { MarginProps } from "styled-system";
3
-
4
- import { ButtonToggleProps } from "../button-toggle";
5
- import { ValidationProps } from "../../__internal__/validations";
6
-
7
- type ButtonToggle =
8
- | React.ReactElement<ButtonToggleProps>
9
- | boolean
10
- | null
11
- | undefined;
12
-
13
- export interface ButtonToggleGroupProps extends ValidationProps, MarginProps {
14
- /** Identifier used for testing purposes, applied to the root element of the component. */
15
- "data-component"?: string;
16
- /** Identifier used for testing purposes, applied to the root element of the component. */
17
- "data-element"?: string;
18
- /** Identifier used for testing purposes, applied to the root element of the component. */
19
- "data-role"?: string;
20
- /** Unique id for the root element of the component */
21
- id: string;
22
- /** Specifies the name prop to be applied to each button in the group */
23
- name: string;
24
- /** Togglable buttons to be rendered. Only accepts children of type ButtonToggle */
25
- children?: ButtonToggle | ButtonToggle[];
26
- /** When true, validation icon will be placed on label instead of being placed on the input */
27
- validationOnLabel?: boolean;
28
- /** Text for the label. */
29
- label?: string;
30
- /** Text for the labels help tooltip. */
31
- labelHelp?: React.ReactNode;
32
- /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
33
- labelSpacing?: 1 | 2;
34
- /** The percentage width of the ButtonToggleGroup. */
35
- inputWidth?: number;
36
- /** The text for the field help. */
37
- fieldHelp?: string;
38
- /** Sets the field help to inline. */
39
- fieldHelpInline?: boolean;
40
- /** Sets the label to be inline. */
41
- labelInline?: boolean;
42
- /** The percentage width of the label. */
43
- labelWidth?: number;
44
- /** The alignment for the text in the label. */
45
- labelAlign?: string;
46
- /** Callback triggered by blur event on the input. */
47
- onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
48
- /** Callback triggered by change event on the input. */
49
- onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
50
- /** The value of the Button Toggle Group */
51
- value?: string;
52
- /** Aria label for rendered help component */
53
- helpAriaLabel?: string;
54
- }
55
-
56
- declare function ButtonToggleGroup(props: ButtonToggleGroupProps): JSX.Element;
57
-
58
- export default ButtonToggleGroup;
@@ -1 +0,0 @@
1
- export { default } from "./notes.md";
@@ -1,44 +0,0 @@
1
- import * as React from "react";
2
-
3
- export interface DrawerSidebarContextProps {
4
- isInSidebar: boolean;
5
- }
6
-
7
- export interface DrawerPropTypes {
8
- /** Duration of a animation */
9
- animationDuration?: string;
10
- /** Sets color of sidebar's background */
11
- backgroundColor?: string;
12
- children: React.ReactNode;
13
- /** Set the default state of expansion of the Drawer if component is meant to be used as uncontrolled */
14
- defaultExpanded?: boolean;
15
- /** Sets the expansion state of the Drawer if component is meant to be used as controlled */
16
- expanded?: boolean;
17
- /* The (% or px) width of the expanded sidebar */
18
- expandedWidth?: string;
19
- /** Sets custom height to Drawer component */
20
- height?: string;
21
- /** Callback fired when expansion state changes */
22
- onChange?: (
23
- e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,
24
- isExpanded: boolean
25
- ) => void;
26
- /* Sidebar object either html or react component */
27
- sidebar?: React.ReactNode;
28
- /** Enables expand/collapse button that controls drawer */
29
- showControls?: boolean;
30
- /** Sets title heading of sidebar's content */
31
- title?: string;
32
- /** Content to display inside of a footer */
33
- footer?: React.ReactNode;
34
- /** Makes the header of the drawer sticky. Title prop must also be set. */
35
- stickyHeader?: boolean;
36
- /** Makes the footer of the drawer sticky. Footer prop must also be set. */
37
- stickyFooter?: boolean;
38
- }
39
-
40
- declare const DrawerSidebarContext: React.Context<DrawerSidebarContextProps>;
41
- declare function Drawer(props: DrawerPropTypes): JSX.Element;
42
-
43
- export { DrawerSidebarContext };
44
- export default Drawer;
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _buttonToggleGroup = _interopRequireDefault(require("./button-toggle-group.component"));
9
-
10
- var _definition = _interopRequireDefault(require("./../../../demo/utils/definition"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- const definition = new _definition.default("button-toggle-group", _buttonToggleGroup.default, {
15
- description: "Adds support for validation, warning and info messages on a group of Button Toggles.",
16
- designerNotes: `
17
- * Similar to [Button Toggle](/components/button-toggle), but use this component when you need your button toggles to act like a single form component, with field help and validation.
18
- * Unlike [Button Toggle](/components/button-toggle), this component doesn't require one option to be auto-selected.
19
- `,
20
- relatedComponentsNotes: `
21
- * Don't need validation on your options? [Try Button Toggle](/components/button-toggle).
22
- `,
23
- type: "form",
24
- propValues: {
25
- children: `<ButtonToggle name={ 'grouped' } id={ 'foo' } value={ 'foo' }>
26
- Foo
27
- </ButtonToggle>
28
- <ButtonToggle name={ 'grouped' } id={ 'bar' } value={ 'bar' }>
29
- Bar
30
- </ButtonToggle>
31
- <ButtonToggle name={ 'grouped' } id={ 'baz' } value={ 'baz' }>
32
- Baz
33
- </ButtonToggle>`,
34
- value: ""
35
- },
36
- propTypes: {
37
- children: "Node",
38
- className: "String",
39
- value: "String"
40
- },
41
- requiredProps: ["children"],
42
- propDescriptions: {
43
- value: "The value associated with the button toggle group.",
44
- children: "The children to render for the button toggle group."
45
- },
46
- hiddenProps: ["children", "value"]
47
- });
48
- definition.isAnInput();
49
- var _default = definition;
50
- exports.default = _default;