carbon-react 109.3.3 → 109.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 (97) hide show
  1. package/esm/__internal__/fieldset/fieldset.component.d.ts +25 -0
  2. package/esm/__internal__/fieldset/fieldset.component.js +167 -50
  3. package/esm/__internal__/fieldset/fieldset.style.d.ts +13 -0
  4. package/esm/__internal__/fieldset/fieldset.style.js +0 -10
  5. package/esm/__internal__/fieldset/index.d.ts +2 -1
  6. package/esm/__internal__/full-screen-heading/full-screen-heading.component.d.ts +7 -0
  7. package/esm/__internal__/full-screen-heading/full-screen-heading.component.js +7 -3
  8. package/esm/__internal__/full-screen-heading/full-screen-heading.style.d.ts +6 -0
  9. package/esm/__internal__/full-screen-heading/index.d.ts +2 -0
  10. package/esm/__internal__/popover/index.d.ts +2 -1
  11. package/esm/__internal__/popover/popover.component.d.ts +18 -0
  12. package/esm/__internal__/popover/popover.component.js +23 -21
  13. package/esm/__internal__/popover/popover.style.d.ts +2 -0
  14. package/esm/components/box/box.component.d.ts +3 -0
  15. package/esm/components/box/box.component.js +6 -0
  16. package/esm/components/button/button.component.d.ts +2 -0
  17. package/esm/components/button/button.component.js +2 -0
  18. package/esm/components/heading/heading.style.d.ts +15 -0
  19. package/esm/components/multi-action-button/multi-action-button.component.js +1 -0
  20. package/esm/components/pager/pager.component.js +1 -1
  21. package/esm/components/pager/pager.style.js +1 -1
  22. package/esm/components/pages/index.d.ts +4 -2
  23. package/esm/components/pages/page/index.d.ts +2 -0
  24. package/esm/components/pages/page/index.js +1 -0
  25. package/esm/components/pages/page/page.component.d.ts +15 -0
  26. package/esm/components/pages/page/page.component.js +174 -19
  27. package/esm/components/pages/page/page.style.d.ts +3 -0
  28. package/esm/components/pages/page/page.style.js +5 -1
  29. package/esm/components/pages/pages.component.d.ts +23 -0
  30. package/esm/components/pages/pages.component.js +50 -13
  31. package/esm/components/pages/pages.config.d.ts +3 -0
  32. package/esm/components/pages/pages.style.d.ts +3 -0
  33. package/esm/components/pages/pages.style.js +2 -2
  34. package/esm/components/select/multi-select/multi-select.component.js +36 -34
  35. package/esm/components/split-button/index.d.ts +2 -2
  36. package/esm/components/split-button/split-button-children.style.d.ts +8 -0
  37. package/esm/components/split-button/split-button-children.style.js +3 -4
  38. package/esm/components/split-button/split-button-toggle.style.d.ts +10 -0
  39. package/esm/components/split-button/split-button.component.d.ts +29 -0
  40. package/esm/components/split-button/split-button.component.js +534 -87
  41. package/esm/components/split-button/split-button.config.d.ts +4 -0
  42. package/esm/components/split-button/split-button.style.d.ts +2 -0
  43. package/lib/__internal__/fieldset/fieldset.component.d.ts +25 -0
  44. package/lib/__internal__/fieldset/fieldset.component.js +167 -53
  45. package/lib/__internal__/fieldset/fieldset.style.d.ts +13 -0
  46. package/lib/__internal__/fieldset/fieldset.style.js +1 -12
  47. package/lib/__internal__/fieldset/index.d.ts +2 -1
  48. package/lib/__internal__/full-screen-heading/full-screen-heading.component.d.ts +7 -0
  49. package/lib/__internal__/full-screen-heading/full-screen-heading.component.js +7 -3
  50. package/lib/__internal__/full-screen-heading/full-screen-heading.style.d.ts +6 -0
  51. package/lib/__internal__/full-screen-heading/index.d.ts +2 -0
  52. package/lib/__internal__/popover/index.d.ts +2 -1
  53. package/lib/__internal__/popover/popover.component.d.ts +18 -0
  54. package/lib/__internal__/popover/popover.component.js +24 -22
  55. package/lib/__internal__/popover/popover.style.d.ts +2 -0
  56. package/lib/components/box/box.component.d.ts +3 -0
  57. package/lib/components/box/box.component.js +6 -0
  58. package/lib/components/button/button.component.d.ts +2 -0
  59. package/lib/components/button/button.component.js +2 -0
  60. package/lib/components/heading/heading.style.d.ts +15 -0
  61. package/lib/components/multi-action-button/multi-action-button.component.js +1 -0
  62. package/lib/components/pager/pager.component.js +1 -1
  63. package/lib/components/pager/pager.style.js +1 -1
  64. package/lib/components/pages/index.d.ts +4 -2
  65. package/lib/components/pages/page/index.d.ts +2 -0
  66. package/lib/components/pages/page/index.js +15 -0
  67. package/lib/components/pages/page/package.json +5 -2
  68. package/lib/components/pages/page/page.component.d.ts +15 -0
  69. package/lib/components/pages/page/page.component.js +175 -19
  70. package/lib/components/pages/page/page.style.d.ts +3 -0
  71. package/lib/components/pages/page/page.style.js +6 -1
  72. package/lib/components/pages/pages.component.d.ts +23 -0
  73. package/lib/components/pages/pages.component.js +50 -13
  74. package/lib/components/pages/pages.config.d.ts +3 -0
  75. package/lib/components/pages/pages.style.d.ts +3 -0
  76. package/lib/components/pages/pages.style.js +2 -2
  77. package/lib/components/select/multi-select/multi-select.component.js +36 -34
  78. package/lib/components/split-button/index.d.ts +2 -2
  79. package/lib/components/split-button/split-button-children.style.d.ts +8 -0
  80. package/lib/components/split-button/split-button-children.style.js +3 -4
  81. package/lib/components/split-button/split-button-toggle.style.d.ts +10 -0
  82. package/lib/components/split-button/split-button.component.d.ts +29 -0
  83. package/lib/components/split-button/split-button.component.js +535 -89
  84. package/lib/components/split-button/split-button.config.d.ts +4 -0
  85. package/lib/components/split-button/split-button.style.d.ts +2 -0
  86. package/package.json +1 -1
  87. package/esm/__internal__/fieldset/fieldset.d.ts +0 -37
  88. package/esm/__internal__/popover/popover.d.ts +0 -46
  89. package/esm/components/pages/page/package.json +0 -3
  90. package/esm/components/pages/page/page.d.ts +0 -12
  91. package/esm/components/pages/pages.d.ts +0 -23
  92. package/esm/components/split-button/split-button.d.ts +0 -29
  93. package/lib/__internal__/fieldset/fieldset.d.ts +0 -37
  94. package/lib/__internal__/popover/popover.d.ts +0 -46
  95. package/lib/components/pages/page/page.d.ts +0 -12
  96. package/lib/components/pages/pages.d.ts +0 -23
  97. package/lib/components/split-button/split-button.d.ts +0 -29
@@ -7,30 +7,36 @@ import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
7
7
  import FullScreenHeading from "../../../__internal__/full-screen-heading";
8
8
  import Box from "../../box";
9
9
  import { StyledPage, StyledPageContent } from "./page.style";
10
+ import { filterStyledSystemPaddingProps } from "../../../style/utils";
10
11
 
11
12
  const Page = ({
12
13
  title,
13
14
  children,
14
- ...props
15
+ ...rest
15
16
  }) => {
16
- const styledPageNodeRef = useRef();
17
+ const styledPageNodeRef = useRef(null);
18
+ const {
19
+ transitionName
20
+ } = rest;
17
21
  return /*#__PURE__*/React.createElement(CSSTransition, _extends({
18
22
  className: "carbon-carousel__transition",
19
23
  timeout: {
20
24
  appear: 0,
21
25
  enter: 0,
22
26
  exit: 0
23
- } // eslint-disable-next-line react/prop-types
24
- ,
25
- classNames: props.transitionName(),
27
+ }
28
+ }, transitionName && {
29
+ classNames: transitionName()
30
+ }, {
26
31
  nodeRef: styledPageNodeRef
27
- }, props), /*#__PURE__*/React.createElement(StyledPage, _extends({}, tagComponent("page", props), {
32
+ }, rest), /*#__PURE__*/React.createElement(StyledPage, _extends({}, tagComponent("page", rest), {
28
33
  ref: styledPageNodeRef
29
34
  }), /*#__PURE__*/React.createElement(FullScreenHeading, {
30
- hasContent: title
31
- }, title), /*#__PURE__*/React.createElement(StyledPageContent, {
32
- "data-element": "carbon-page-content"
33
- }, /*#__PURE__*/React.createElement(Box, {
35
+ hasContent: true
36
+ }, title), /*#__PURE__*/React.createElement(StyledPageContent, _extends({
37
+ "data-element": "carbon-page-content",
38
+ p: "30px 40px"
39
+ }, filterStyledSystemPaddingProps(rest)), /*#__PURE__*/React.createElement(Box, {
34
40
  boxSizing: "border-box",
35
41
  maxWidth: "100%",
36
42
  minWidth: "auto",
@@ -40,14 +46,163 @@ const Page = ({
40
46
  };
41
47
 
42
48
  Page.propTypes = {
43
- /**
44
- * The title for the page, normally a Heading component.
45
- */
46
- title: PropTypes.node.isRequired,
47
-
48
- /**
49
- * This component supports children.
50
- */
51
- children: PropTypes.node.isRequired
49
+ "children": PropTypes.node,
50
+ "p": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
51
+ "__@toStringTag": PropTypes.string.isRequired,
52
+ "description": PropTypes.string,
53
+ "toString": PropTypes.func.isRequired,
54
+ "valueOf": PropTypes.func.isRequired
55
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
56
+ "__@toStringTag": PropTypes.string.isRequired,
57
+ "description": PropTypes.string,
58
+ "toString": PropTypes.func.isRequired,
59
+ "valueOf": PropTypes.func.isRequired
60
+ }), PropTypes.string]),
61
+ "padding": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
62
+ "__@toStringTag": PropTypes.string.isRequired,
63
+ "description": PropTypes.string,
64
+ "toString": PropTypes.func.isRequired,
65
+ "valueOf": PropTypes.func.isRequired
66
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
67
+ "__@toStringTag": PropTypes.string.isRequired,
68
+ "description": PropTypes.string,
69
+ "toString": PropTypes.func.isRequired,
70
+ "valueOf": PropTypes.func.isRequired
71
+ }), PropTypes.string]),
72
+ "paddingBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
73
+ "__@toStringTag": PropTypes.string.isRequired,
74
+ "description": PropTypes.string,
75
+ "toString": PropTypes.func.isRequired,
76
+ "valueOf": PropTypes.func.isRequired
77
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
78
+ "__@toStringTag": PropTypes.string.isRequired,
79
+ "description": PropTypes.string,
80
+ "toString": PropTypes.func.isRequired,
81
+ "valueOf": PropTypes.func.isRequired
82
+ }), PropTypes.string]),
83
+ "paddingLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
84
+ "__@toStringTag": PropTypes.string.isRequired,
85
+ "description": PropTypes.string,
86
+ "toString": PropTypes.func.isRequired,
87
+ "valueOf": PropTypes.func.isRequired
88
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
89
+ "__@toStringTag": PropTypes.string.isRequired,
90
+ "description": PropTypes.string,
91
+ "toString": PropTypes.func.isRequired,
92
+ "valueOf": PropTypes.func.isRequired
93
+ }), PropTypes.string]),
94
+ "paddingRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
95
+ "__@toStringTag": PropTypes.string.isRequired,
96
+ "description": PropTypes.string,
97
+ "toString": PropTypes.func.isRequired,
98
+ "valueOf": PropTypes.func.isRequired
99
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
100
+ "__@toStringTag": PropTypes.string.isRequired,
101
+ "description": PropTypes.string,
102
+ "toString": PropTypes.func.isRequired,
103
+ "valueOf": PropTypes.func.isRequired
104
+ }), PropTypes.string]),
105
+ "paddingTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
106
+ "__@toStringTag": PropTypes.string.isRequired,
107
+ "description": PropTypes.string,
108
+ "toString": PropTypes.func.isRequired,
109
+ "valueOf": PropTypes.func.isRequired
110
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
111
+ "__@toStringTag": PropTypes.string.isRequired,
112
+ "description": PropTypes.string,
113
+ "toString": PropTypes.func.isRequired,
114
+ "valueOf": PropTypes.func.isRequired
115
+ }), PropTypes.string]),
116
+ "paddingX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
117
+ "__@toStringTag": PropTypes.string.isRequired,
118
+ "description": PropTypes.string,
119
+ "toString": PropTypes.func.isRequired,
120
+ "valueOf": PropTypes.func.isRequired
121
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
122
+ "__@toStringTag": PropTypes.string.isRequired,
123
+ "description": PropTypes.string,
124
+ "toString": PropTypes.func.isRequired,
125
+ "valueOf": PropTypes.func.isRequired
126
+ }), PropTypes.string]),
127
+ "paddingY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
128
+ "__@toStringTag": PropTypes.string.isRequired,
129
+ "description": PropTypes.string,
130
+ "toString": PropTypes.func.isRequired,
131
+ "valueOf": PropTypes.func.isRequired
132
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
133
+ "__@toStringTag": PropTypes.string.isRequired,
134
+ "description": PropTypes.string,
135
+ "toString": PropTypes.func.isRequired,
136
+ "valueOf": PropTypes.func.isRequired
137
+ }), PropTypes.string]),
138
+ "pb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
139
+ "__@toStringTag": PropTypes.string.isRequired,
140
+ "description": PropTypes.string,
141
+ "toString": PropTypes.func.isRequired,
142
+ "valueOf": PropTypes.func.isRequired
143
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
144
+ "__@toStringTag": PropTypes.string.isRequired,
145
+ "description": PropTypes.string,
146
+ "toString": PropTypes.func.isRequired,
147
+ "valueOf": PropTypes.func.isRequired
148
+ }), PropTypes.string]),
149
+ "pl": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
150
+ "__@toStringTag": PropTypes.string.isRequired,
151
+ "description": PropTypes.string,
152
+ "toString": PropTypes.func.isRequired,
153
+ "valueOf": PropTypes.func.isRequired
154
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
155
+ "__@toStringTag": PropTypes.string.isRequired,
156
+ "description": PropTypes.string,
157
+ "toString": PropTypes.func.isRequired,
158
+ "valueOf": PropTypes.func.isRequired
159
+ }), PropTypes.string]),
160
+ "pr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
161
+ "__@toStringTag": PropTypes.string.isRequired,
162
+ "description": PropTypes.string,
163
+ "toString": PropTypes.func.isRequired,
164
+ "valueOf": PropTypes.func.isRequired
165
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
166
+ "__@toStringTag": PropTypes.string.isRequired,
167
+ "description": PropTypes.string,
168
+ "toString": PropTypes.func.isRequired,
169
+ "valueOf": PropTypes.func.isRequired
170
+ }), PropTypes.string]),
171
+ "pt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
172
+ "__@toStringTag": PropTypes.string.isRequired,
173
+ "description": PropTypes.string,
174
+ "toString": PropTypes.func.isRequired,
175
+ "valueOf": PropTypes.func.isRequired
176
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
177
+ "__@toStringTag": PropTypes.string.isRequired,
178
+ "description": PropTypes.string,
179
+ "toString": PropTypes.func.isRequired,
180
+ "valueOf": PropTypes.func.isRequired
181
+ }), PropTypes.string]),
182
+ "px": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
183
+ "__@toStringTag": PropTypes.string.isRequired,
184
+ "description": PropTypes.string,
185
+ "toString": PropTypes.func.isRequired,
186
+ "valueOf": PropTypes.func.isRequired
187
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
188
+ "__@toStringTag": PropTypes.string.isRequired,
189
+ "description": PropTypes.string,
190
+ "toString": PropTypes.func.isRequired,
191
+ "valueOf": PropTypes.func.isRequired
192
+ }), PropTypes.string]),
193
+ "py": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
194
+ "__@toStringTag": PropTypes.string.isRequired,
195
+ "description": PropTypes.string,
196
+ "toString": PropTypes.func.isRequired,
197
+ "valueOf": PropTypes.func.isRequired
198
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
199
+ "__@toStringTag": PropTypes.string.isRequired,
200
+ "description": PropTypes.string,
201
+ "toString": PropTypes.func.isRequired,
202
+ "valueOf": PropTypes.func.isRequired
203
+ }), PropTypes.string]),
204
+ "title": PropTypes.node,
205
+ "transitionName": PropTypes.func
52
206
  };
207
+ Page.displayName = "Page";
53
208
  export default Page;
@@ -0,0 +1,3 @@
1
+ declare const StyledPage: import("styled-components").StyledComponent<"article", any, {}, never>;
2
+ declare const StyledPageContent: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export { StyledPage, StyledPageContent };
@@ -1,12 +1,13 @@
1
1
  import styled from "styled-components";
2
+ import { padding } from "styled-system";
2
3
  import BaseTheme from "../../../style/themes/base";
3
4
  const StyledPage = styled.article`
4
5
  width: 100%;
5
6
  height: 100%;
6
7
  `;
7
8
  const StyledPageContent = styled.div`
9
+ ${padding}
8
10
  box-sizing: border-box;
9
- padding: 30px 40px;
10
11
  width: 100%;
11
12
  height: 100%;
12
13
  overflow-y: auto;
@@ -14,4 +15,7 @@ const StyledPageContent = styled.div`
14
15
  StyledPage.defaultProps = {
15
16
  theme: BaseTheme
16
17
  };
18
+ StyledPageContent.defaultProps = {
19
+ theme: BaseTheme
20
+ };
17
21
  export { StyledPage, StyledPageContent };
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import Page from "./page";
3
+ import { ThemeObject } from "../../style/themes/base";
4
+ export interface PagesProps {
5
+ /** [legacy] Custom className */
6
+ className?: string;
7
+ /** The selected tab on page load */
8
+ initialpageIndex?: number | string;
9
+ /** The current page's index */
10
+ pageIndex?: number | string;
11
+ /** Individual Page components */
12
+ children?: React.ReactNode;
13
+ /** Controls which transition to use (fade or slide). */
14
+ transition?: string;
15
+ /** @ignore @private */
16
+ theme?: Partial<ThemeObject>;
17
+ }
18
+ declare const Pages: {
19
+ ({ pageIndex: incomingPageIndex, initialpageIndex, transition, children, ...props }: PagesProps): JSX.Element;
20
+ displayName: string;
21
+ };
22
+ export default Pages;
23
+ export { Page };
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useRef, useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { TransitionGroup } from "react-transition-group";
4
4
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
5
- import Page from "./page/page.component";
5
+ import Page from "./page";
6
6
  import { PagesWrapperStyle, PagesContent } from "./pages.style";
7
7
  const NEXT = "next";
8
8
  const PREVIOUS = "previous";
@@ -29,6 +29,9 @@ const Pages = ({
29
29
  const handleVisiblePage = () => {
30
30
  let index = pageIndex;
31
31
  const visiblePage = React.Children.toArray(children)[index];
32
+ /* istanbul ignore if */
33
+
34
+ if (! /*#__PURE__*/React.isValidElement(visiblePage)) return visiblePage;
32
35
  index = visiblePage.props.id || index;
33
36
  const additionalProps = {
34
37
  transitionName,
@@ -82,18 +85,52 @@ const Pages = ({
82
85
  };
83
86
 
84
87
  Pages.propTypes = {
85
- /** [legacy] Custom className */
86
- className: PropTypes.string,
87
-
88
- /** The selected tab on page load */
89
- initialpageIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
90
- pageIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
91
-
92
- /** Individual tabs */
93
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
94
-
95
- /** Controls which transition to use. */
96
- transition: PropTypes.string
88
+ "children": PropTypes.node,
89
+ "className": PropTypes.string,
90
+ "initialpageIndex": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
91
+ "pageIndex": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
92
+ "theme": PropTypes.shape({
93
+ "colors": PropTypes.shape({
94
+ "destructive": PropTypes.shape({
95
+ "hover": PropTypes.string.isRequired
96
+ }),
97
+ "error": PropTypes.string,
98
+ "focus": PropTypes.string,
99
+ "info": PropTypes.string,
100
+ "loadingBarBackground": PropTypes.string,
101
+ "placeholder": PropTypes.string,
102
+ "primary": PropTypes.string,
103
+ "secondary": PropTypes.string,
104
+ "tertiary": PropTypes.string,
105
+ "warning": PropTypes.string,
106
+ "warningText": PropTypes.string,
107
+ "white": PropTypes.oneOf(["#FFFFFF"])
108
+ }),
109
+ "compatibility": PropTypes.object,
110
+ "disabled": PropTypes.shape({
111
+ "background": PropTypes.string.isRequired
112
+ }),
113
+ "name": PropTypes.string,
114
+ "palette": PropTypes.shape({
115
+ "blackOpacity": PropTypes.func.isRequired,
116
+ "whiteOpacity": PropTypes.func.isRequired
117
+ }),
118
+ "space": PropTypes.arrayOf(PropTypes.string),
119
+ "spacing": PropTypes.number,
120
+ "zIndex": PropTypes.shape({
121
+ "aboveAll": PropTypes.number.isRequired,
122
+ "fullScreenModal": PropTypes.number.isRequired,
123
+ "header": PropTypes.number.isRequired,
124
+ "modal": PropTypes.number.isRequired,
125
+ "nav": PropTypes.number.isRequired,
126
+ "notification": PropTypes.number.isRequired,
127
+ "overlay": PropTypes.number.isRequired,
128
+ "popover": PropTypes.number.isRequired,
129
+ "smallOverlay": PropTypes.number.isRequired
130
+ })
131
+ }),
132
+ "transition": PropTypes.string
97
133
  };
134
+ Pages.displayName = "Pages";
98
135
  export default Pages;
99
136
  export { Page };
@@ -0,0 +1,3 @@
1
+ declare const slideAnimation: import("styled-components").FlattenSimpleInterpolation;
2
+ declare const fadeAnimation: import("styled-components").FlattenSimpleInterpolation;
3
+ export { slideAnimation, fadeAnimation };
@@ -0,0 +1,3 @@
1
+ declare const PagesContent: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ declare const PagesWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export { PagesWrapperStyle, PagesContent };
@@ -19,8 +19,8 @@ const PagesWrapperStyle = styled.div`
19
19
  overflow: hidden;
20
20
  position: relative;
21
21
  }
22
- ${slideAnimation};
23
- ${fadeAnimation};
22
+ ${slideAnimation}
23
+ ${fadeAnimation}
24
24
  `;
25
25
  PagesContent.defaultProps = {
26
26
  theme: BaseTheme
@@ -64,6 +64,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
64
64
  const [highlightedValue, setHighlightedValue] = useState("");
65
65
  const [filterText, setFilterText] = useState("");
66
66
  const [placeholderOverride, setPlaceholderOverride] = useState();
67
+ const actualValue = isControlled.current ? value : selectedValue;
67
68
  const setOpen = useCallback(() => {
68
69
  setOpenState(isAlreadyOpen => {
69
70
  if (!isAlreadyOpen && onOpen) {
@@ -86,6 +87,23 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
86
87
  };
87
88
  return customEvent;
88
89
  }, [name, id]);
90
+ /* generic value update function which can be used for both controlled and uncontrolled
91
+ * components, both with and without onChange.
92
+ * It accepts a function to update the value, which is assumed to be have no side effects and therefore
93
+ * be safe to run more than once if needed. */
94
+
95
+ const updateValue = useCallback(updateFunction => {
96
+ const newValue = updateFunction(actualValue); // only call onChange if an option has been selected or deselected
97
+
98
+ if (onChange && newValue.length !== actualValue.length) {
99
+ onChange(createCustomEvent(newValue));
100
+ } // no need to update selectedValue if the component is controlled: onChange should take care of updating the value
101
+
102
+
103
+ if (!isControlled.current) {
104
+ setSelectedValue(updateFunction);
105
+ }
106
+ }, [createCustomEvent, onChange, actualValue]);
89
107
  const handleTextboxChange = useCallback(event => {
90
108
  const newValue = event.target.value;
91
109
  const match = findElementWithMatchingText(newValue, children);
@@ -99,24 +117,17 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
99
117
  setOpen();
100
118
  }, [children, setOpen]);
101
119
  const removeSelectedValue = useCallback(index => {
102
- setSelectedValue(previousValue => {
103
- isClickTriggeredBySelect.current = true;
104
-
120
+ isClickTriggeredBySelect.current = true;
121
+ updateValue(previousValue => {
105
122
  if (!previousValue.length) {
106
123
  return previousValue;
107
124
  }
108
125
 
109
126
  const newValue = [...previousValue];
110
127
  newValue.splice(index, 1);
111
-
112
- if (onChange) {
113
- onChange(createCustomEvent(newValue));
114
- return newValue;
115
- }
116
-
117
128
  return newValue;
118
129
  });
119
- }, [createCustomEvent, onChange]);
130
+ }, [updateValue]);
120
131
  const handleTextboxKeydown = useCallback(event => {
121
132
  const {
122
133
  key
@@ -142,12 +153,12 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
142
153
 
143
154
  }, [onKeyDown, readOnly, filterText, textValue, setOpen, removeSelectedValue]);
144
155
  const accessibilityLabel = useMemo(() => {
145
- return selectedValue && selectedValue.length ? React.Children.map(children, child => {
146
- return selectedValue.includes(child.props.value) ? child.props.text : false;
156
+ return actualValue && actualValue.length ? React.Children.map(children, child => {
157
+ return actualValue.includes(child.props.value) ? child.props.text : false;
147
158
  }).filter(child => child).reduce((acc, item) => {
148
159
  return acc ? `${acc}, ${item}` : item;
149
160
  }, "") : null;
150
- }, [children, selectedValue]);
161
+ }, [children, actualValue]);
151
162
  const handleGlobalClick = useCallback(event => {
152
163
  isMouseDownReported.current = false;
153
164
 
@@ -170,11 +181,11 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
170
181
  const mapValuesToPills = useMemo(() => {
171
182
  const canDelete = !disabled && !readOnly;
172
183
 
173
- if (!selectedValue.length) {
184
+ if (!actualValue.length) {
174
185
  return "";
175
186
  }
176
187
 
177
- return selectedValue.map((singleValue, index) => {
188
+ return actualValue.map((singleValue, index) => {
178
189
  const matchingOption = React.Children.toArray(children).find(child => isExpectedOption(child, singleValue));
179
190
  let pillProps = {};
180
191
 
@@ -203,22 +214,18 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
203
214
  const onChangeMissingMessage = "onChange prop required when using a controlled input element";
204
215
  !(isControlled.current === (value !== undefined)) ? process.env.NODE_ENV !== "production" ? invariant(false, modeSwitchedMessage) : invariant(false) : void 0;
205
216
  !(!isControlled.current || isControlled.current && onChange) ? process.env.NODE_ENV !== "production" ? invariant(false, onChangeMissingMessage) : invariant(false) : void 0;
206
-
207
- if (isControlled.current) {
208
- setSelectedValue(value);
209
- }
210
217
  }, [value, onChange]); // removes placeholder when a value is present
211
218
 
212
219
  useEffect(() => {
213
220
  const hasValue = value === null || value === void 0 ? void 0 : value.length;
214
- const hasSelectedValue = selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length;
221
+ const hasSelectedValue = actualValue === null || actualValue === void 0 ? void 0 : actualValue.length;
215
222
 
216
223
  if (hasValue || hasSelectedValue) {
217
224
  setPlaceholderOverride(" ");
218
225
  } else {
219
226
  setPlaceholderOverride(placeholder);
220
227
  }
221
- }, [value, selectedValue, placeholder]);
228
+ }, [value, actualValue, placeholder]);
222
229
  useEffect(() => {
223
230
  const clickEvent = "click";
224
231
  window.addEventListener(clickEvent, handleGlobalClick);
@@ -335,27 +342,22 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
335
342
  }
336
343
 
337
344
  setTextValue("");
338
- const isAlreadySelected = selectedValue.findIndex(val => isExpectedValue(val, newValue)) !== -1;
345
+ const isAlreadySelected = actualValue.findIndex(val => isExpectedValue(val, newValue)) !== -1;
339
346
 
340
347
  if (!isAlreadySelected && isControlled.current && onChange) {
341
- onChange(createCustomEvent([...selectedValue, newValue]));
348
+ onChange(createCustomEvent([...actualValue, newValue]));
342
349
  }
343
350
 
344
- setSelectedValue(previousValue => {
345
- textboxRef.focus();
346
- isMouseDownReported.current = false;
347
-
351
+ textboxRef.focus();
352
+ isMouseDownReported.current = false;
353
+ updateValue(previousValue => {
348
354
  if (isAlreadySelected) {
349
355
  return previousValue;
350
356
  }
351
357
 
352
- if (onChange) {
353
- onChange(createCustomEvent([...previousValue, newValue]));
354
- }
355
-
356
358
  return [...previousValue, newValue];
357
359
  });
358
- }, [createCustomEvent, onChange, textboxRef, selectedValue]);
360
+ }, [createCustomEvent, onChange, textboxRef, actualValue, updateValue]);
359
361
 
360
362
  function onSelectListClose() {
361
363
  setOpenState(false);
@@ -389,7 +391,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
389
391
  leftChildren: mapValuesToPills,
390
392
  inputRef: assignInput,
391
393
  formattedValue: textValue,
392
- selectedValue,
394
+ selectedValue: actualValue,
393
395
  onClick: handleTextboxClick,
394
396
  onMouseDown: handleTextboxMouseDown,
395
397
  onFocus: handleTextboxFocus,
@@ -423,7 +425,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
423
425
  listPlacement: listPlacement,
424
426
  flipEnabled: flipEnabled,
425
427
  loaderDataRole: "multi-select-list-loader",
426
- multiselectValues: selectedValue
428
+ multiselectValues: actualValue
427
429
  }, children);
428
430
  return /*#__PURE__*/React.createElement(StyledSelectMultiSelect, _extends({
429
431
  disabled: disabled,
@@ -1,2 +1,2 @@
1
- export { default } from "./split-button";
2
- export type { SplitButtonProps } from "./split-button";
1
+ export { default } from "./split-button.component";
2
+ export type { SplitButtonProps } from "./split-button.component";
@@ -0,0 +1,8 @@
1
+ import { ThemeObject } from "../../style/themes/base";
2
+ declare type StyledSplitButtonChildrenContainerProps = {
3
+ theme: ThemeObject;
4
+ align: "left" | "right";
5
+ minWidth: number;
6
+ };
7
+ declare const StyledSplitButtonChildrenContainer: import("styled-components").StyledComponent<"div", any, StyledSplitButtonChildrenContainerProps, never>;
8
+ export default StyledSplitButtonChildrenContainer;
@@ -4,12 +4,11 @@ import StyledButton from "../button/button.style";
4
4
  const StyledSplitButtonChildrenContainer = styled.div`
5
5
  ${({
6
6
  theme,
7
- align
7
+ align,
8
+ minWidth
8
9
  }) => css`
9
10
  background-color: var(--colorsActionMajorYang100);
10
- min-width: ${({
11
- minWidth
12
- }) => minWidth}px;
11
+ min-width: ${minWidth}px;
13
12
  white-space: nowrap;
14
13
  z-index: ${theme.zIndex.popover};
15
14
  box-shadow: var(--boxShadow100);
@@ -0,0 +1,10 @@
1
+ declare type StyledSplitButtonToggleProps = {
2
+ buttonType: "primary" | "secondary";
3
+ disabled: boolean;
4
+ displayed: boolean;
5
+ size: "small" | "medium" | "large";
6
+ };
7
+ declare const StyledSplitButtonToggle: import("styled-components").StyledComponent<"button", any, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("../button").ButtonProps & {
8
+ iconOnly?: boolean | undefined;
9
+ } & StyledSplitButtonToggleProps, never>;
10
+ export default StyledSplitButtonToggle;
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { MarginProps } from "styled-system";
3
+ import { IconType } from "../icon";
4
+ export interface SplitButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, MarginProps {
5
+ /** Set align of the rendered content */
6
+ align?: "left" | "right";
7
+ /** Button type: "primary" | "secondary" */
8
+ buttonType?: "primary" | "secondary";
9
+ /** The additional button to display. */
10
+ children: React.ReactNode;
11
+ /** A custom value for the data-element attribute */
12
+ "data-element"?: string;
13
+ /** A custom value for the data-role attribute */
14
+ "data-role"?: string;
15
+ /** Gives the button a disabled state. */
16
+ disabled?: boolean;
17
+ /** Defines an Icon position within the button: "before" | "after" */
18
+ iconPosition?: "before" | "after";
19
+ /** Defines an Icon type within the button */
20
+ iconType?: IconType;
21
+ /** The size of the buttons in the SplitButton. */
22
+ size?: "small" | "medium" | "large";
23
+ /** Second text child, renders under main text, only when size is "large" */
24
+ subtext?: string;
25
+ /** The text to be displayed in the SplitButton. */
26
+ text: string;
27
+ }
28
+ export declare const SplitButton: ({ align, buttonType, children, disabled, iconPosition, iconType, onClick, size, subtext, text, "data-element": dataElement, "data-role": dataRole, ...rest }: SplitButtonProps) => JSX.Element;
29
+ export default SplitButton;