carbon-react 109.4.0 → 109.5.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.
- package/esm/components/icon-button/icon-button.component.d.ts +23 -0
- package/esm/components/icon-button/icon-button.component.js +168 -22
- package/esm/components/icon-button/icon-button.style.d.ts +4 -0
- package/esm/components/icon-button/index.d.ts +2 -2
- package/esm/components/pill/pill.component.d.ts +2 -2
- package/esm/components/pill/pill.component.js +7 -9
- package/esm/components/popover-container/popover-container.component.d.ts +4 -4
- package/esm/components/popover-container/popover-container.style.d.ts +3 -3
- package/lib/components/icon-button/icon-button.component.d.ts +23 -0
- package/lib/components/icon-button/icon-button.component.js +168 -25
- package/lib/components/icon-button/icon-button.style.d.ts +4 -0
- package/lib/components/icon-button/index.d.ts +2 -2
- package/lib/components/pill/pill.component.d.ts +2 -2
- package/lib/components/pill/pill.component.js +7 -9
- package/lib/components/popover-container/popover-container.component.d.ts +4 -4
- package/lib/components/popover-container/popover-container.style.d.ts +3 -3
- package/package.json +1 -1
- package/esm/components/icon-button/icon-button.d.ts +0 -18
- package/lib/components/icon-button/icon-button.d.ts +0 -18
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { IconProps } from "../icon";
|
|
4
|
+
export interface IconButtonProps extends MarginProps {
|
|
5
|
+
/** Prop to specify the aria-label of the icon-button component */
|
|
6
|
+
"aria-label"?: string;
|
|
7
|
+
/** Icon meant to be rendered, should be an Icon component */
|
|
8
|
+
children: React.ReactElement<IconProps>;
|
|
9
|
+
/** Callback triggered on blur */
|
|
10
|
+
onBlur?: (ev: React.FocusEvent<HTMLButtonElement>) => void;
|
|
11
|
+
/** Callback triggered on focus */
|
|
12
|
+
onFocus?: (ev: React.FocusEvent<HTMLButtonElement>) => void;
|
|
13
|
+
/** Callback triggered on mouse enter */
|
|
14
|
+
onMouseEnter?: (ev: React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
/** Callback triggered on mouse leave */
|
|
16
|
+
onMouseLeave?: (ev: React.MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
/** Action callback */
|
|
18
|
+
onAction: (e: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
19
|
+
/** Set the button to disabled */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
export default IconButton;
|
|
@@ -2,13 +2,10 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React, { useState, useCallback } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
5
|
import Events from "../../__internal__/utils/helpers/events";
|
|
7
6
|
import StyledIconButton from "./icon-button.style";
|
|
8
|
-
import Icon from "../icon";
|
|
9
7
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
10
8
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
11
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
12
9
|
const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
13
10
|
"aria-label": ariaLabel,
|
|
14
11
|
onAction,
|
|
@@ -16,10 +13,10 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
|
16
13
|
disabled,
|
|
17
14
|
...rest
|
|
18
15
|
}, ref) => {
|
|
19
|
-
const [internalRef, setInternalRef] = useState(
|
|
16
|
+
const [internalRef, setInternalRef] = useState();
|
|
20
17
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
21
18
|
|
|
22
|
-
const
|
|
19
|
+
const handleKeyDown = e => {
|
|
23
20
|
if (Events.isEnterKey(e) || Events.isSpaceKey(e)) {
|
|
24
21
|
e.preventDefault();
|
|
25
22
|
onAction(e);
|
|
@@ -28,7 +25,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
|
28
25
|
}
|
|
29
26
|
};
|
|
30
27
|
|
|
31
|
-
const
|
|
28
|
+
const handleOnClick = e => {
|
|
32
29
|
onAction(e);
|
|
33
30
|
};
|
|
34
31
|
|
|
@@ -40,8 +37,8 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
|
40
37
|
}, [ref]);
|
|
41
38
|
return /*#__PURE__*/React.createElement(StyledIconButton, _extends({}, rest, {
|
|
42
39
|
"aria-label": ariaLabel,
|
|
43
|
-
onKeyDown:
|
|
44
|
-
onClick:
|
|
40
|
+
onKeyDown: handleKeyDown,
|
|
41
|
+
onClick: handleOnClick,
|
|
45
42
|
ref: setRefs,
|
|
46
43
|
disabled: disabled
|
|
47
44
|
}, marginProps), /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
@@ -50,20 +47,169 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
|
50
47
|
target: internalRef
|
|
51
48
|
}, children));
|
|
52
49
|
});
|
|
53
|
-
IconButton.propTypes = {
|
|
54
|
-
|
|
55
|
-
/** Children prop is restricted to one Icon Component */
|
|
56
|
-
children: PropTypes.shape({
|
|
57
|
-
type: PropTypes.oneOf([Icon, PropTypes.element])
|
|
58
|
-
}).isRequired,
|
|
59
|
-
|
|
60
|
-
/** Callback */
|
|
61
|
-
onAction: PropTypes.func.isRequired,
|
|
62
|
-
|
|
63
|
-
/** Prop to specify the aria-label of the icon-button component */
|
|
50
|
+
IconButton.propTypes = {
|
|
64
51
|
"aria-label": PropTypes.string,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
"children": PropTypes.element.isRequired,
|
|
53
|
+
"disabled": PropTypes.bool,
|
|
54
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
55
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
56
|
+
"description": PropTypes.string,
|
|
57
|
+
"toString": PropTypes.func.isRequired,
|
|
58
|
+
"valueOf": PropTypes.func.isRequired
|
|
59
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
60
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
61
|
+
"description": PropTypes.string,
|
|
62
|
+
"toString": PropTypes.func.isRequired,
|
|
63
|
+
"valueOf": PropTypes.func.isRequired
|
|
64
|
+
}), PropTypes.string]),
|
|
65
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
66
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
67
|
+
"description": PropTypes.string,
|
|
68
|
+
"toString": PropTypes.func.isRequired,
|
|
69
|
+
"valueOf": PropTypes.func.isRequired
|
|
70
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
71
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
72
|
+
"description": PropTypes.string,
|
|
73
|
+
"toString": PropTypes.func.isRequired,
|
|
74
|
+
"valueOf": PropTypes.func.isRequired
|
|
75
|
+
}), PropTypes.string]),
|
|
76
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
77
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
78
|
+
"description": PropTypes.string,
|
|
79
|
+
"toString": PropTypes.func.isRequired,
|
|
80
|
+
"valueOf": PropTypes.func.isRequired
|
|
81
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
82
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
83
|
+
"description": PropTypes.string,
|
|
84
|
+
"toString": PropTypes.func.isRequired,
|
|
85
|
+
"valueOf": PropTypes.func.isRequired
|
|
86
|
+
}), PropTypes.string]),
|
|
87
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
88
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
89
|
+
"description": PropTypes.string,
|
|
90
|
+
"toString": PropTypes.func.isRequired,
|
|
91
|
+
"valueOf": PropTypes.func.isRequired
|
|
92
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
93
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
94
|
+
"description": PropTypes.string,
|
|
95
|
+
"toString": PropTypes.func.isRequired,
|
|
96
|
+
"valueOf": PropTypes.func.isRequired
|
|
97
|
+
}), PropTypes.string]),
|
|
98
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
99
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
100
|
+
"description": PropTypes.string,
|
|
101
|
+
"toString": PropTypes.func.isRequired,
|
|
102
|
+
"valueOf": PropTypes.func.isRequired
|
|
103
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
104
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
105
|
+
"description": PropTypes.string,
|
|
106
|
+
"toString": PropTypes.func.isRequired,
|
|
107
|
+
"valueOf": PropTypes.func.isRequired
|
|
108
|
+
}), PropTypes.string]),
|
|
109
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
110
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
111
|
+
"description": PropTypes.string,
|
|
112
|
+
"toString": PropTypes.func.isRequired,
|
|
113
|
+
"valueOf": PropTypes.func.isRequired
|
|
114
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
115
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
116
|
+
"description": PropTypes.string,
|
|
117
|
+
"toString": PropTypes.func.isRequired,
|
|
118
|
+
"valueOf": PropTypes.func.isRequired
|
|
119
|
+
}), PropTypes.string]),
|
|
120
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
121
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
122
|
+
"description": PropTypes.string,
|
|
123
|
+
"toString": PropTypes.func.isRequired,
|
|
124
|
+
"valueOf": PropTypes.func.isRequired
|
|
125
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
126
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
127
|
+
"description": PropTypes.string,
|
|
128
|
+
"toString": PropTypes.func.isRequired,
|
|
129
|
+
"valueOf": PropTypes.func.isRequired
|
|
130
|
+
}), PropTypes.string]),
|
|
131
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
132
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
133
|
+
"description": PropTypes.string,
|
|
134
|
+
"toString": PropTypes.func.isRequired,
|
|
135
|
+
"valueOf": PropTypes.func.isRequired
|
|
136
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
137
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
138
|
+
"description": PropTypes.string,
|
|
139
|
+
"toString": PropTypes.func.isRequired,
|
|
140
|
+
"valueOf": PropTypes.func.isRequired
|
|
141
|
+
}), PropTypes.string]),
|
|
142
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
143
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
144
|
+
"description": PropTypes.string,
|
|
145
|
+
"toString": PropTypes.func.isRequired,
|
|
146
|
+
"valueOf": PropTypes.func.isRequired
|
|
147
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
148
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
149
|
+
"description": PropTypes.string,
|
|
150
|
+
"toString": PropTypes.func.isRequired,
|
|
151
|
+
"valueOf": PropTypes.func.isRequired
|
|
152
|
+
}), PropTypes.string]),
|
|
153
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
154
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
155
|
+
"description": PropTypes.string,
|
|
156
|
+
"toString": PropTypes.func.isRequired,
|
|
157
|
+
"valueOf": PropTypes.func.isRequired
|
|
158
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
159
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
160
|
+
"description": PropTypes.string,
|
|
161
|
+
"toString": PropTypes.func.isRequired,
|
|
162
|
+
"valueOf": PropTypes.func.isRequired
|
|
163
|
+
}), PropTypes.string]),
|
|
164
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
165
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
166
|
+
"description": PropTypes.string,
|
|
167
|
+
"toString": PropTypes.func.isRequired,
|
|
168
|
+
"valueOf": PropTypes.func.isRequired
|
|
169
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
170
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
171
|
+
"description": PropTypes.string,
|
|
172
|
+
"toString": PropTypes.func.isRequired,
|
|
173
|
+
"valueOf": PropTypes.func.isRequired
|
|
174
|
+
}), PropTypes.string]),
|
|
175
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
176
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
177
|
+
"description": PropTypes.string,
|
|
178
|
+
"toString": PropTypes.func.isRequired,
|
|
179
|
+
"valueOf": PropTypes.func.isRequired
|
|
180
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
181
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
182
|
+
"description": PropTypes.string,
|
|
183
|
+
"toString": PropTypes.func.isRequired,
|
|
184
|
+
"valueOf": PropTypes.func.isRequired
|
|
185
|
+
}), PropTypes.string]),
|
|
186
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
187
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
188
|
+
"description": PropTypes.string,
|
|
189
|
+
"toString": PropTypes.func.isRequired,
|
|
190
|
+
"valueOf": PropTypes.func.isRequired
|
|
191
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
192
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
193
|
+
"description": PropTypes.string,
|
|
194
|
+
"toString": PropTypes.func.isRequired,
|
|
195
|
+
"valueOf": PropTypes.func.isRequired
|
|
196
|
+
}), PropTypes.string]),
|
|
197
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
198
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
199
|
+
"description": PropTypes.string,
|
|
200
|
+
"toString": PropTypes.func.isRequired,
|
|
201
|
+
"valueOf": PropTypes.func.isRequired
|
|
202
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
203
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
204
|
+
"description": PropTypes.string,
|
|
205
|
+
"toString": PropTypes.func.isRequired,
|
|
206
|
+
"valueOf": PropTypes.func.isRequired
|
|
207
|
+
}), PropTypes.string]),
|
|
208
|
+
"onAction": PropTypes.func.isRequired,
|
|
209
|
+
"onBlur": PropTypes.func,
|
|
210
|
+
"onFocus": PropTypes.func,
|
|
211
|
+
"onMouseEnter": PropTypes.func,
|
|
212
|
+
"onMouseLeave": PropTypes.func
|
|
68
213
|
};
|
|
214
|
+
IconButton.displayName = "IconButton";
|
|
69
215
|
export default IconButton;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./icon-button";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./icon-button.component";
|
|
2
|
+
export type { IconButtonProps } from "./icon-button.component";
|
|
@@ -12,9 +12,9 @@ export interface PillProps extends StyledPillProps {
|
|
|
12
12
|
/** Fills the pill background with colour. When fill is false only the border is coloured. */
|
|
13
13
|
fill?: boolean;
|
|
14
14
|
/** Callback function for when the pill is clicked. */
|
|
15
|
-
onClick?: React.
|
|
15
|
+
onClick?: (ev: React.MouseEvent<HTMLSpanElement>) => void;
|
|
16
16
|
/** Callback function for when the remove icon is clicked. */
|
|
17
|
-
onDelete?: React.
|
|
17
|
+
onDelete?: (ev: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
18
18
|
/** Sets the type of pill in use. */
|
|
19
19
|
pillRole?: "tag" | "status";
|
|
20
20
|
}
|
|
@@ -7,14 +7,6 @@ import Icon from "../icon";
|
|
|
7
7
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
8
|
import IconButton from "../icon-button";
|
|
9
9
|
|
|
10
|
-
const renderCloseIcon = onDelete => /*#__PURE__*/React.createElement(IconButton, {
|
|
11
|
-
onAction: onDelete,
|
|
12
|
-
"data-element": "close",
|
|
13
|
-
"aria-label": "close"
|
|
14
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
15
|
-
type: "cross"
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
10
|
const Pill = ({
|
|
19
11
|
wrapText,
|
|
20
12
|
borderColor,
|
|
@@ -38,7 +30,13 @@ const Pill = ({
|
|
|
38
30
|
}, tagComponent("pill", rest), {
|
|
39
31
|
maxWidth: maxWidth,
|
|
40
32
|
wrapText: wrapText
|
|
41
|
-
}, rest), children, onDelete &&
|
|
33
|
+
}, rest), children, onDelete && /*#__PURE__*/React.createElement(IconButton, {
|
|
34
|
+
onAction: onDelete,
|
|
35
|
+
"data-element": "close",
|
|
36
|
+
"aria-label": "close"
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
38
|
+
type: "cross"
|
|
39
|
+
})));
|
|
42
40
|
|
|
43
41
|
Pill.propTypes = {
|
|
44
42
|
"borderColor": PropTypes.string,
|
|
@@ -4,7 +4,7 @@ export interface RenderOpenProps {
|
|
|
4
4
|
tabIndex: number;
|
|
5
5
|
isOpen?: boolean;
|
|
6
6
|
"data-element": string;
|
|
7
|
-
onClick: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
7
|
+
onClick: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
|
|
8
8
|
ref: React.RefObject<HTMLButtonElement>;
|
|
9
9
|
"aria-label"?: string;
|
|
10
10
|
id?: string;
|
|
@@ -12,7 +12,7 @@ export interface RenderOpenProps {
|
|
|
12
12
|
export interface RenderCloseProps {
|
|
13
13
|
"data-element": string;
|
|
14
14
|
tabIndex: number;
|
|
15
|
-
onClick: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
15
|
+
onClick: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
|
|
16
16
|
ref: React.RefObject<HTMLButtonElement>;
|
|
17
17
|
"aria-label": string;
|
|
18
18
|
}
|
|
@@ -36,11 +36,11 @@ export interface PopoverContainerProps extends PaddingProps {
|
|
|
36
36
|
/** Sets the popover container dialog header name */
|
|
37
37
|
title?: string;
|
|
38
38
|
/** Callback fires when close icon clicked */
|
|
39
|
-
onClose?: (ev: React.MouseEvent<HTMLElement> | Event) => void;
|
|
39
|
+
onClose?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement> | Event) => void;
|
|
40
40
|
/** if `true` the popover-container is open */
|
|
41
41
|
open?: boolean;
|
|
42
42
|
/** Callback fires when open component is clicked */
|
|
43
|
-
onOpen?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
43
|
+
onOpen?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
|
|
44
44
|
/** if `true` the popover-container will cover open button */
|
|
45
45
|
shouldCoverButton?: boolean;
|
|
46
46
|
/** The id of the element that describe the dialog. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TransitionStatus } from "react-transition-group";
|
|
2
|
-
import IconButton from "../icon-button";
|
|
3
3
|
declare const PopoverContainerWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
declare const PopoverContainerHeaderStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
5
|
declare type PopoverContainerContentStyleProps = {
|
|
@@ -10,7 +10,7 @@ declare type AdditionalIconButtonProps = {
|
|
|
10
10
|
tabIndex?: number;
|
|
11
11
|
id?: string;
|
|
12
12
|
};
|
|
13
|
-
declare const PopoverContainerOpenIcon: import("styled-components").StyledComponent<
|
|
14
|
-
declare const PopoverContainerCloseIcon: import("styled-components").StyledComponent<
|
|
13
|
+
declare const PopoverContainerOpenIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon-button").IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, AdditionalIconButtonProps, never>;
|
|
14
|
+
declare const PopoverContainerCloseIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon-button").IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, AdditionalIconButtonProps, never>;
|
|
15
15
|
declare const PopoverContainerTitleStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
16
|
export { PopoverContainerWrapperStyle, PopoverContainerHeaderStyle, PopoverContainerContentStyle, PopoverContainerCloseIcon, PopoverContainerTitleStyle, PopoverContainerOpenIcon, };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { IconProps } from "../icon";
|
|
4
|
+
export interface IconButtonProps extends MarginProps {
|
|
5
|
+
/** Prop to specify the aria-label of the icon-button component */
|
|
6
|
+
"aria-label"?: string;
|
|
7
|
+
/** Icon meant to be rendered, should be an Icon component */
|
|
8
|
+
children: React.ReactElement<IconProps>;
|
|
9
|
+
/** Callback triggered on blur */
|
|
10
|
+
onBlur?: (ev: React.FocusEvent<HTMLButtonElement>) => void;
|
|
11
|
+
/** Callback triggered on focus */
|
|
12
|
+
onFocus?: (ev: React.FocusEvent<HTMLButtonElement>) => void;
|
|
13
|
+
/** Callback triggered on mouse enter */
|
|
14
|
+
onMouseEnter?: (ev: React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
/** Callback triggered on mouse leave */
|
|
16
|
+
onMouseLeave?: (ev: React.MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
+
/** Action callback */
|
|
18
|
+
onAction: (e: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
19
|
+
/** Set the button to disabled */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
export default IconButton;
|
|
@@ -9,14 +9,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
13
|
-
|
|
14
12
|
var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events"));
|
|
15
13
|
|
|
16
14
|
var _iconButton = _interopRequireDefault(require("./icon-button.style"));
|
|
17
15
|
|
|
18
|
-
var _icon = _interopRequireDefault(require("../icon"));
|
|
19
|
-
|
|
20
16
|
var _utils = require("../../style/utils");
|
|
21
17
|
|
|
22
18
|
var _tooltipProvider = require("../../__internal__/tooltip-provider");
|
|
@@ -29,8 +25,6 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
29
25
|
|
|
30
26
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
27
|
|
|
32
|
-
const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
|
|
33
|
-
|
|
34
28
|
const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
35
29
|
"aria-label": ariaLabel,
|
|
36
30
|
onAction,
|
|
@@ -38,10 +32,10 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
38
32
|
disabled,
|
|
39
33
|
...rest
|
|
40
34
|
}, ref) => {
|
|
41
|
-
const [internalRef, setInternalRef] = (0, _react.useState)(
|
|
35
|
+
const [internalRef, setInternalRef] = (0, _react.useState)();
|
|
42
36
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
|
|
43
37
|
|
|
44
|
-
const
|
|
38
|
+
const handleKeyDown = e => {
|
|
45
39
|
if (_events.default.isEnterKey(e) || _events.default.isSpaceKey(e)) {
|
|
46
40
|
e.preventDefault();
|
|
47
41
|
onAction(e);
|
|
@@ -50,7 +44,7 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
50
44
|
}
|
|
51
45
|
};
|
|
52
46
|
|
|
53
|
-
const
|
|
47
|
+
const handleOnClick = e => {
|
|
54
48
|
onAction(e);
|
|
55
49
|
};
|
|
56
50
|
|
|
@@ -62,8 +56,8 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
62
56
|
}, [ref]);
|
|
63
57
|
return /*#__PURE__*/_react.default.createElement(_iconButton.default, _extends({}, rest, {
|
|
64
58
|
"aria-label": ariaLabel,
|
|
65
|
-
onKeyDown:
|
|
66
|
-
onClick:
|
|
59
|
+
onKeyDown: handleKeyDown,
|
|
60
|
+
onClick: handleOnClick,
|
|
67
61
|
ref: setRefs,
|
|
68
62
|
disabled: disabled
|
|
69
63
|
}, marginProps), /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|
|
@@ -73,21 +67,170 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
73
67
|
}, children));
|
|
74
68
|
});
|
|
75
69
|
|
|
76
|
-
IconButton.propTypes = {
|
|
77
|
-
|
|
78
|
-
/** Children prop is restricted to one Icon Component */
|
|
79
|
-
children: _propTypes.default.shape({
|
|
80
|
-
type: _propTypes.default.oneOf([_icon.default, _propTypes.default.element])
|
|
81
|
-
}).isRequired,
|
|
82
|
-
|
|
83
|
-
/** Callback */
|
|
84
|
-
onAction: _propTypes.default.func.isRequired,
|
|
85
|
-
|
|
86
|
-
/** Prop to specify the aria-label of the icon-button component */
|
|
70
|
+
IconButton.propTypes = {
|
|
87
71
|
"aria-label": _propTypes.default.string,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
"children": _propTypes.default.element.isRequired,
|
|
73
|
+
"disabled": _propTypes.default.bool,
|
|
74
|
+
"m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
75
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
76
|
+
"description": _propTypes.default.string,
|
|
77
|
+
"toString": _propTypes.default.func.isRequired,
|
|
78
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
79
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
80
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
81
|
+
"description": _propTypes.default.string,
|
|
82
|
+
"toString": _propTypes.default.func.isRequired,
|
|
83
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
84
|
+
}), _propTypes.default.string]),
|
|
85
|
+
"margin": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
86
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
87
|
+
"description": _propTypes.default.string,
|
|
88
|
+
"toString": _propTypes.default.func.isRequired,
|
|
89
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
90
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
91
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
92
|
+
"description": _propTypes.default.string,
|
|
93
|
+
"toString": _propTypes.default.func.isRequired,
|
|
94
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
95
|
+
}), _propTypes.default.string]),
|
|
96
|
+
"marginBottom": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
97
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
98
|
+
"description": _propTypes.default.string,
|
|
99
|
+
"toString": _propTypes.default.func.isRequired,
|
|
100
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
101
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
102
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
103
|
+
"description": _propTypes.default.string,
|
|
104
|
+
"toString": _propTypes.default.func.isRequired,
|
|
105
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
106
|
+
}), _propTypes.default.string]),
|
|
107
|
+
"marginLeft": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
108
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
109
|
+
"description": _propTypes.default.string,
|
|
110
|
+
"toString": _propTypes.default.func.isRequired,
|
|
111
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
112
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
113
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
114
|
+
"description": _propTypes.default.string,
|
|
115
|
+
"toString": _propTypes.default.func.isRequired,
|
|
116
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
117
|
+
}), _propTypes.default.string]),
|
|
118
|
+
"marginRight": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
119
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
120
|
+
"description": _propTypes.default.string,
|
|
121
|
+
"toString": _propTypes.default.func.isRequired,
|
|
122
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
123
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
124
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
125
|
+
"description": _propTypes.default.string,
|
|
126
|
+
"toString": _propTypes.default.func.isRequired,
|
|
127
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
128
|
+
}), _propTypes.default.string]),
|
|
129
|
+
"marginTop": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
130
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
131
|
+
"description": _propTypes.default.string,
|
|
132
|
+
"toString": _propTypes.default.func.isRequired,
|
|
133
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
134
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
135
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
136
|
+
"description": _propTypes.default.string,
|
|
137
|
+
"toString": _propTypes.default.func.isRequired,
|
|
138
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
139
|
+
}), _propTypes.default.string]),
|
|
140
|
+
"marginX": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
141
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
142
|
+
"description": _propTypes.default.string,
|
|
143
|
+
"toString": _propTypes.default.func.isRequired,
|
|
144
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
145
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
146
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
147
|
+
"description": _propTypes.default.string,
|
|
148
|
+
"toString": _propTypes.default.func.isRequired,
|
|
149
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
150
|
+
}), _propTypes.default.string]),
|
|
151
|
+
"marginY": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
152
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
153
|
+
"description": _propTypes.default.string,
|
|
154
|
+
"toString": _propTypes.default.func.isRequired,
|
|
155
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
156
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
157
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
158
|
+
"description": _propTypes.default.string,
|
|
159
|
+
"toString": _propTypes.default.func.isRequired,
|
|
160
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
161
|
+
}), _propTypes.default.string]),
|
|
162
|
+
"mb": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
163
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
164
|
+
"description": _propTypes.default.string,
|
|
165
|
+
"toString": _propTypes.default.func.isRequired,
|
|
166
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
167
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
168
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
169
|
+
"description": _propTypes.default.string,
|
|
170
|
+
"toString": _propTypes.default.func.isRequired,
|
|
171
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
172
|
+
}), _propTypes.default.string]),
|
|
173
|
+
"ml": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
174
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
175
|
+
"description": _propTypes.default.string,
|
|
176
|
+
"toString": _propTypes.default.func.isRequired,
|
|
177
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
178
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
179
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
180
|
+
"description": _propTypes.default.string,
|
|
181
|
+
"toString": _propTypes.default.func.isRequired,
|
|
182
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
183
|
+
}), _propTypes.default.string]),
|
|
184
|
+
"mr": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
185
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
186
|
+
"description": _propTypes.default.string,
|
|
187
|
+
"toString": _propTypes.default.func.isRequired,
|
|
188
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
189
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
190
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
191
|
+
"description": _propTypes.default.string,
|
|
192
|
+
"toString": _propTypes.default.func.isRequired,
|
|
193
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
194
|
+
}), _propTypes.default.string]),
|
|
195
|
+
"mt": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
196
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
197
|
+
"description": _propTypes.default.string,
|
|
198
|
+
"toString": _propTypes.default.func.isRequired,
|
|
199
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
200
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
201
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
202
|
+
"description": _propTypes.default.string,
|
|
203
|
+
"toString": _propTypes.default.func.isRequired,
|
|
204
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
205
|
+
}), _propTypes.default.string]),
|
|
206
|
+
"mx": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
207
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
208
|
+
"description": _propTypes.default.string,
|
|
209
|
+
"toString": _propTypes.default.func.isRequired,
|
|
210
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
211
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
212
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
213
|
+
"description": _propTypes.default.string,
|
|
214
|
+
"toString": _propTypes.default.func.isRequired,
|
|
215
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
216
|
+
}), _propTypes.default.string]),
|
|
217
|
+
"my": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
218
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
219
|
+
"description": _propTypes.default.string,
|
|
220
|
+
"toString": _propTypes.default.func.isRequired,
|
|
221
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
222
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
223
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
224
|
+
"description": _propTypes.default.string,
|
|
225
|
+
"toString": _propTypes.default.func.isRequired,
|
|
226
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
227
|
+
}), _propTypes.default.string]),
|
|
228
|
+
"onAction": _propTypes.default.func.isRequired,
|
|
229
|
+
"onBlur": _propTypes.default.func,
|
|
230
|
+
"onFocus": _propTypes.default.func,
|
|
231
|
+
"onMouseEnter": _propTypes.default.func,
|
|
232
|
+
"onMouseLeave": _propTypes.default.func
|
|
91
233
|
};
|
|
234
|
+
IconButton.displayName = "IconButton";
|
|
92
235
|
var _default = IconButton;
|
|
93
236
|
exports.default = _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./icon-button";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./icon-button.component";
|
|
2
|
+
export type { IconButtonProps } from "./icon-button.component";
|
|
@@ -12,9 +12,9 @@ export interface PillProps extends StyledPillProps {
|
|
|
12
12
|
/** Fills the pill background with colour. When fill is false only the border is coloured. */
|
|
13
13
|
fill?: boolean;
|
|
14
14
|
/** Callback function for when the pill is clicked. */
|
|
15
|
-
onClick?: React.
|
|
15
|
+
onClick?: (ev: React.MouseEvent<HTMLSpanElement>) => void;
|
|
16
16
|
/** Callback function for when the remove icon is clicked. */
|
|
17
|
-
onDelete?: React.
|
|
17
|
+
onDelete?: (ev: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
18
18
|
/** Sets the type of pill in use. */
|
|
19
19
|
pillRole?: "tag" | "status";
|
|
20
20
|
}
|
|
@@ -21,14 +21,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
21
21
|
|
|
22
22
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
23
|
|
|
24
|
-
const renderCloseIcon = onDelete => /*#__PURE__*/_react.default.createElement(_iconButton.default, {
|
|
25
|
-
onAction: onDelete,
|
|
26
|
-
"data-element": "close",
|
|
27
|
-
"aria-label": "close"
|
|
28
|
-
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
29
|
-
type: "cross"
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
24
|
const Pill = ({
|
|
33
25
|
wrapText,
|
|
34
26
|
borderColor,
|
|
@@ -52,7 +44,13 @@ const Pill = ({
|
|
|
52
44
|
}, (0, _tags.default)("pill", rest), {
|
|
53
45
|
maxWidth: maxWidth,
|
|
54
46
|
wrapText: wrapText
|
|
55
|
-
}, rest), children, onDelete &&
|
|
47
|
+
}, rest), children, onDelete && /*#__PURE__*/_react.default.createElement(_iconButton.default, {
|
|
48
|
+
onAction: onDelete,
|
|
49
|
+
"data-element": "close",
|
|
50
|
+
"aria-label": "close"
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
52
|
+
type: "cross"
|
|
53
|
+
})));
|
|
56
54
|
|
|
57
55
|
exports.Pill = Pill;
|
|
58
56
|
Pill.propTypes = {
|
|
@@ -4,7 +4,7 @@ export interface RenderOpenProps {
|
|
|
4
4
|
tabIndex: number;
|
|
5
5
|
isOpen?: boolean;
|
|
6
6
|
"data-element": string;
|
|
7
|
-
onClick: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
7
|
+
onClick: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
|
|
8
8
|
ref: React.RefObject<HTMLButtonElement>;
|
|
9
9
|
"aria-label"?: string;
|
|
10
10
|
id?: string;
|
|
@@ -12,7 +12,7 @@ export interface RenderOpenProps {
|
|
|
12
12
|
export interface RenderCloseProps {
|
|
13
13
|
"data-element": string;
|
|
14
14
|
tabIndex: number;
|
|
15
|
-
onClick: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
15
|
+
onClick: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
|
|
16
16
|
ref: React.RefObject<HTMLButtonElement>;
|
|
17
17
|
"aria-label": string;
|
|
18
18
|
}
|
|
@@ -36,11 +36,11 @@ export interface PopoverContainerProps extends PaddingProps {
|
|
|
36
36
|
/** Sets the popover container dialog header name */
|
|
37
37
|
title?: string;
|
|
38
38
|
/** Callback fires when close icon clicked */
|
|
39
|
-
onClose?: (ev: React.MouseEvent<HTMLElement> | Event) => void;
|
|
39
|
+
onClose?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement> | Event) => void;
|
|
40
40
|
/** if `true` the popover-container is open */
|
|
41
41
|
open?: boolean;
|
|
42
42
|
/** Callback fires when open component is clicked */
|
|
43
|
-
onOpen?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
43
|
+
onOpen?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
|
|
44
44
|
/** if `true` the popover-container will cover open button */
|
|
45
45
|
shouldCoverButton?: boolean;
|
|
46
46
|
/** The id of the element that describe the dialog. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TransitionStatus } from "react-transition-group";
|
|
2
|
-
import IconButton from "../icon-button";
|
|
3
3
|
declare const PopoverContainerWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
declare const PopoverContainerHeaderStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
5
|
declare type PopoverContainerContentStyleProps = {
|
|
@@ -10,7 +10,7 @@ declare type AdditionalIconButtonProps = {
|
|
|
10
10
|
tabIndex?: number;
|
|
11
11
|
id?: string;
|
|
12
12
|
};
|
|
13
|
-
declare const PopoverContainerOpenIcon: import("styled-components").StyledComponent<
|
|
14
|
-
declare const PopoverContainerCloseIcon: import("styled-components").StyledComponent<
|
|
13
|
+
declare const PopoverContainerOpenIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon-button").IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, AdditionalIconButtonProps, never>;
|
|
14
|
+
declare const PopoverContainerCloseIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon-button").IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, AdditionalIconButtonProps, never>;
|
|
15
15
|
declare const PopoverContainerTitleStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
16
|
export { PopoverContainerWrapperStyle, PopoverContainerHeaderStyle, PopoverContainerContentStyle, PopoverContainerCloseIcon, PopoverContainerTitleStyle, PopoverContainerOpenIcon, };
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { MarginProps } from "styled-system";
|
|
3
|
-
import { IconProps } from "../icon/icon-type";
|
|
4
|
-
|
|
5
|
-
export interface IconButtonProps extends MarginProps {
|
|
6
|
-
/** Optional: alternative rendered content, displayed within <SelectList> of <Select> (eg: an icon, an image, etc) */
|
|
7
|
-
children: React.ReactElement<IconProps>;
|
|
8
|
-
/** Callback */
|
|
9
|
-
onAction: React.MouseEventHandler<HTMLButtonElement>;
|
|
10
|
-
/** Set the button to disabled */
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare function IconButton(
|
|
15
|
-
props: IconButtonProps & React.RefAttributes<HTMLButtonElement>
|
|
16
|
-
): JSX.Element;
|
|
17
|
-
|
|
18
|
-
export default IconButton;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { MarginProps } from "styled-system";
|
|
3
|
-
import { IconProps } from "../icon/icon-type";
|
|
4
|
-
|
|
5
|
-
export interface IconButtonProps extends MarginProps {
|
|
6
|
-
/** Optional: alternative rendered content, displayed within <SelectList> of <Select> (eg: an icon, an image, etc) */
|
|
7
|
-
children: React.ReactElement<IconProps>;
|
|
8
|
-
/** Callback */
|
|
9
|
-
onAction: React.MouseEventHandler<HTMLButtonElement>;
|
|
10
|
-
/** Set the button to disabled */
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare function IconButton(
|
|
15
|
-
props: IconButtonProps & React.RefAttributes<HTMLButtonElement>
|
|
16
|
-
): JSX.Element;
|
|
17
|
-
|
|
18
|
-
export default IconButton;
|