carbon-react 106.6.1 → 106.6.4
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/__spec_helper__/expect.d.ts +8 -1
- package/esm/__spec_helper__/expect.js +1 -5
- package/esm/__spec_helper__/test-utils.d.ts +71 -33
- package/esm/__spec_helper__/test-utils.js +63 -65
- package/esm/components/action-popover/action-popover-context.d.ts +7 -2
- package/esm/components/action-popover/action-popover-context.js +1 -1
- package/esm/components/action-popover/action-popover-divider/action-popover-divider.component.d.ts +1 -1
- package/esm/components/action-popover/action-popover-item/action-popover-item.component.d.ts +28 -41
- package/esm/components/action-popover/action-popover-item/action-popover-item.component.js +99 -118
- package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +35 -2
- package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.js +42 -53
- package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.d.ts +20 -18
- package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.js +13 -5
- package/esm/components/action-popover/action-popover-test.stories.js +76 -0
- package/esm/components/action-popover/action-popover.component.d.ts +30 -53
- package/esm/components/action-popover/action-popover.component.js +205 -67
- package/esm/components/action-popover/action-popover.style.d.ts +17 -11
- package/esm/components/action-popover/action-popover.style.js +20 -26
- package/esm/components/action-popover/index.d.ts +9 -5
- package/esm/components/box/box.component.d.ts +12 -1
- package/esm/components/box/box.component.js +12 -23
- package/esm/components/box/box.config.d.ts +10 -12
- package/esm/components/box/index.d.ts +2 -1
- package/esm/components/button-bar/button-bar-test.stories.js +122 -0
- package/esm/components/button-bar/button-bar.component.d.ts +12 -15
- package/esm/components/button-bar/button-bar.component.js +331 -33
- package/esm/components/button-bar/button-bar.config.d.ts +2 -2
- package/esm/components/button-bar/button-bar.style.d.ts +4 -4
- package/esm/components/button-bar/button-bar.style.js +18 -33
- package/esm/components/button-bar/index.d.ts +2 -1
- package/esm/components/dismissible-box/dismissible-box.style.d.ts +1 -2
- package/esm/components/drawer/drawer.style.d.ts +1 -2
- package/esm/components/duelling-picklist/picklist/picklist.style.d.ts +2 -3
- package/esm/components/flat-table/flat-table.style.d.ts +1 -2
- package/esm/components/form/form.component.js +2 -1
- package/esm/components/link/link.component.js +1 -5
- package/esm/components/menu/__internal__/spec-helper/index.js +2 -1
- package/esm/components/menu/__internal__/submenu/submenu.component.js +21 -4
- package/esm/components/menu/menu.component.js +2 -1
- package/esm/components/menu/scrollable-block/scrollable-block.component.js +4 -2
- package/esm/components/modal/modal.component.js +3 -60
- package/esm/components/toast/toast.component.js +3 -13
- package/esm/hooks/__internal__/useModalManager/index.d.ts +1 -0
- package/esm/hooks/__internal__/useModalManager/index.js +1 -0
- package/esm/hooks/__internal__/useModalManager/useModalManager.d.ts +3 -0
- package/esm/hooks/__internal__/useModalManager/useModalManager.js +66 -0
- package/lib/__spec_helper__/expect.d.ts +8 -1
- package/lib/__spec_helper__/expect.js +2 -4
- package/lib/__spec_helper__/test-utils.d.ts +71 -33
- package/lib/__spec_helper__/test-utils.js +63 -65
- package/lib/components/action-popover/action-popover-context.d.ts +7 -2
- package/lib/components/action-popover/action-popover-context.js +1 -1
- package/lib/components/action-popover/action-popover-divider/action-popover-divider.component.d.ts +1 -1
- package/lib/components/action-popover/action-popover-item/action-popover-item.component.d.ts +28 -41
- package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +100 -119
- package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +35 -2
- package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.js +44 -55
- package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.d.ts +20 -18
- package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.component.js +13 -5
- package/lib/components/action-popover/action-popover-test.stories.js +95 -0
- package/lib/components/action-popover/action-popover.component.d.ts +30 -53
- package/lib/components/action-popover/action-popover.component.js +206 -71
- package/lib/components/action-popover/action-popover.style.d.ts +17 -11
- package/lib/components/action-popover/action-popover.style.js +21 -28
- package/lib/components/action-popover/index.d.ts +9 -5
- package/lib/components/box/box.component.d.ts +12 -1
- package/lib/components/box/box.component.js +13 -26
- package/lib/components/box/box.config.d.ts +10 -12
- package/lib/components/box/index.d.ts +2 -1
- package/lib/components/button-bar/button-bar-test.stories.js +145 -0
- package/lib/components/button-bar/button-bar.component.d.ts +12 -15
- package/lib/components/button-bar/button-bar.component.js +336 -35
- package/lib/components/button-bar/button-bar.config.d.ts +2 -2
- package/lib/components/button-bar/button-bar.style.d.ts +4 -4
- package/lib/components/button-bar/button-bar.style.js +18 -35
- package/lib/components/button-bar/index.d.ts +2 -1
- package/lib/components/dismissible-box/dismissible-box.style.d.ts +1 -2
- package/lib/components/drawer/drawer.style.d.ts +1 -2
- package/lib/components/duelling-picklist/picklist/picklist.style.d.ts +2 -3
- package/lib/components/flat-table/flat-table.style.d.ts +1 -2
- package/lib/components/form/form.component.js +2 -1
- package/lib/components/link/link.component.js +1 -5
- package/lib/components/menu/__internal__/spec-helper/index.js +2 -1
- package/lib/components/menu/__internal__/submenu/submenu.component.js +21 -4
- package/lib/components/menu/menu.component.js +2 -1
- package/lib/components/menu/scrollable-block/scrollable-block.component.js +4 -2
- package/lib/components/modal/modal.component.js +3 -62
- package/lib/components/toast/toast.component.js +4 -17
- package/lib/hooks/__internal__/useModalManager/index.d.ts +1 -0
- package/lib/hooks/__internal__/useModalManager/index.js +15 -0
- package/lib/hooks/__internal__/useModalManager/package.json +6 -0
- package/lib/hooks/__internal__/useModalManager/useModalManager.d.ts +3 -0
- package/lib/hooks/__internal__/useModalManager/useModalManager.js +79 -0
- package/package.json +5 -1
- package/esm/components/action-popover/action-popover-divider/action-popover-divider.d.ts +0 -12
- package/esm/components/action-popover/action-popover-item/action-popover-item.d.ts +0 -26
- package/esm/components/action-popover/action-popover-menu/action-popover-menu.d.ts +0 -33
- package/esm/components/action-popover/action-popover-menu-button/action-popover-menu-button.d.ts +0 -13
- package/esm/components/action-popover/action-popover.d.ts +0 -39
- package/esm/components/box/box.d.ts +0 -31
- package/esm/components/button-bar/button-bar.d.ts +0 -24
- package/lib/components/action-popover/action-popover-divider/action-popover-divider.d.ts +0 -12
- package/lib/components/action-popover/action-popover-item/action-popover-item.d.ts +0 -26
- package/lib/components/action-popover/action-popover-menu/action-popover-menu.d.ts +0 -33
- package/lib/components/action-popover/action-popover-menu-button/action-popover-menu-button.d.ts +0 -13
- package/lib/components/action-popover/action-popover.d.ts +0 -39
- package/lib/components/box/box.d.ts +0 -31
- package/lib/components/button-bar/button-bar.d.ts +0 -24
|
@@ -21,6 +21,11 @@ var _themes = require("../style/themes");
|
|
|
21
21
|
|
|
22
22
|
var _mockMatchMedia = require("./mock-match-media");
|
|
23
23
|
|
|
24
|
+
/* eslint-disable jest/no-conditional-expect */
|
|
25
|
+
|
|
26
|
+
/* eslint-disable jest/no-identical-title */
|
|
27
|
+
|
|
28
|
+
/* eslint-disable jest/no-export */
|
|
24
29
|
const isUpper = char => char.toUpperCase() === char;
|
|
25
30
|
|
|
26
31
|
const humpToDash = (acc, char) => `${acc}${isUpper(char) ? `-${char.toLowerCase()}` : char}`;
|
|
@@ -51,27 +56,24 @@ const dispatchKeyPress = code => {
|
|
|
51
56
|
};
|
|
52
57
|
|
|
53
58
|
const keyMap = {
|
|
54
|
-
UpArrow:
|
|
55
|
-
DownArrow:
|
|
56
|
-
RightArrow:
|
|
57
|
-
LeftArrow:
|
|
58
|
-
Enter:
|
|
59
|
-
Tab:
|
|
60
|
-
Space:
|
|
61
|
-
Escape:
|
|
62
|
-
End:
|
|
63
|
-
Home:
|
|
64
|
-
D:
|
|
65
|
-
E:
|
|
66
|
-
P:
|
|
67
|
-
Z:
|
|
68
|
-
1:
|
|
59
|
+
UpArrow: 38,
|
|
60
|
+
DownArrow: 40,
|
|
61
|
+
RightArrow: 39,
|
|
62
|
+
LeftArrow: 37,
|
|
63
|
+
Enter: 13,
|
|
64
|
+
Tab: 9,
|
|
65
|
+
Space: 32,
|
|
66
|
+
Escape: 27,
|
|
67
|
+
End: 35,
|
|
68
|
+
Home: 36,
|
|
69
|
+
D: 68,
|
|
70
|
+
E: 69,
|
|
71
|
+
P: 80,
|
|
72
|
+
Z: 90,
|
|
73
|
+
1: 49
|
|
69
74
|
};
|
|
70
|
-
|
|
71
|
-
const repeat = action => (n = 1) => makeArrayKeys(n).forEach(() => action());
|
|
72
|
-
|
|
73
75
|
const keyboard = Object.keys(keyMap).reduce((acc, key) => {
|
|
74
|
-
acc[`press${key}`] = () =>
|
|
76
|
+
acc[`press${key}`] = () => dispatchKeyPress(keyMap[key]);
|
|
75
77
|
|
|
76
78
|
return acc;
|
|
77
79
|
}, {}); // Build an object of Enzyme simulate helpers
|
|
@@ -88,7 +90,7 @@ const keydown = Object.keys(keyMap).reduce((acc, key) => {
|
|
|
88
90
|
target.simulate("keydown", {
|
|
89
91
|
shiftKey,
|
|
90
92
|
key,
|
|
91
|
-
which:
|
|
93
|
+
which: keyMap[key]
|
|
92
94
|
});
|
|
93
95
|
};
|
|
94
96
|
|
|
@@ -162,18 +164,19 @@ const backgroundProps = [["background", "background", "lightblue url('foo.jpg')
|
|
|
162
164
|
|
|
163
165
|
const getDefaultValue = value => {
|
|
164
166
|
const spaceArrayLength = _baseTheme.space.length - 1;
|
|
167
|
+
if (value === undefined) return value;
|
|
165
168
|
const parsedValue = +value;
|
|
166
169
|
|
|
167
|
-
if (typeof value === "string" &&
|
|
170
|
+
if (typeof value === "string" && parsedValue > spaceArrayLength) {
|
|
168
171
|
return `${value}px`;
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
if (parsedValue <= spaceArrayLength) {
|
|
172
|
-
return _baseTheme.space[
|
|
175
|
+
return _baseTheme.space[parsedValue];
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
if (parsedValue > spaceArrayLength) {
|
|
176
|
-
return `${
|
|
179
|
+
return `${parsedValue * 8}px`;
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
return value;
|
|
@@ -194,18 +197,18 @@ const testStyledSystemMargin = (component, defaults, styleContainer, assertOpts)
|
|
|
194
197
|
let marginBottom;
|
|
195
198
|
|
|
196
199
|
if (defaults) {
|
|
197
|
-
margin = getDefaultValue(defaults.m
|
|
198
|
-
marginLeft = getDefaultValue(defaults.ml || defaults.mx
|
|
199
|
-
marginRight = getDefaultValue(defaults.mr || defaults.mx
|
|
200
|
-
marginTop = getDefaultValue(defaults.mt || defaults.my
|
|
201
|
-
marginBottom = getDefaultValue(defaults.mb || defaults.my
|
|
202
|
-
|
|
200
|
+
margin = getDefaultValue(defaults.m);
|
|
201
|
+
marginLeft = getDefaultValue(defaults.ml || defaults.mx);
|
|
202
|
+
marginRight = getDefaultValue(defaults.mr || defaults.mx);
|
|
203
|
+
marginTop = getDefaultValue(defaults.mt || defaults.my);
|
|
204
|
+
marginBottom = getDefaultValue(defaults.mb || defaults.my);
|
|
205
|
+
assertStyleMatch({
|
|
203
206
|
margin,
|
|
204
207
|
marginLeft,
|
|
205
208
|
marginRight,
|
|
206
209
|
marginTop,
|
|
207
210
|
marginBottom
|
|
208
|
-
}, StyleElement, assertOpts)
|
|
211
|
+
}, StyleElement, assertOpts);
|
|
209
212
|
} else {
|
|
210
213
|
expect(StyleElement).not.toHaveStyleRule("marginLeft");
|
|
211
214
|
expect(StyleElement).not.toHaveStyleRule("marginRight");
|
|
@@ -217,15 +220,14 @@ const testStyledSystemMargin = (component, defaults, styleContainer, assertOpts)
|
|
|
217
220
|
});
|
|
218
221
|
describe.each(marginProps)('when a custom spacing is specified using the "%s" styled system props', (styledSystemProp, propName) => {
|
|
219
222
|
it(`then that ${propName} should have been set correctly`, () => {
|
|
220
|
-
let wrapper = (0, _enzyme.mount)(component());
|
|
221
223
|
const props = {
|
|
222
224
|
[styledSystemProp]: 2
|
|
223
225
|
};
|
|
224
|
-
wrapper = (0, _enzyme.mount)(component({ ...props
|
|
226
|
+
const wrapper = (0, _enzyme.mount)(component({ ...props
|
|
225
227
|
}));
|
|
226
|
-
|
|
228
|
+
assertStyleMatch({
|
|
227
229
|
[propName]: "var(--spacing200)"
|
|
228
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts)
|
|
230
|
+
}, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts);
|
|
229
231
|
});
|
|
230
232
|
});
|
|
231
233
|
};
|
|
@@ -245,18 +247,18 @@ const testStyledSystemPadding = (component, defaults, styleContainer, assertOpts
|
|
|
245
247
|
let paddingBottom;
|
|
246
248
|
|
|
247
249
|
if (defaults) {
|
|
248
|
-
padding = getDefaultValue(defaults.p
|
|
249
|
-
paddingLeft = getDefaultValue(defaults.pl || defaults.px
|
|
250
|
-
paddingRight = getDefaultValue(defaults.pr || defaults.px
|
|
251
|
-
paddingTop = getDefaultValue(defaults.pt || defaults.py
|
|
252
|
-
paddingBottom = getDefaultValue(defaults.pb || defaults.py
|
|
253
|
-
|
|
250
|
+
padding = getDefaultValue(defaults.p);
|
|
251
|
+
paddingLeft = getDefaultValue(defaults.pl || defaults.px);
|
|
252
|
+
paddingRight = getDefaultValue(defaults.pr || defaults.px);
|
|
253
|
+
paddingTop = getDefaultValue(defaults.pt || defaults.py);
|
|
254
|
+
paddingBottom = getDefaultValue(defaults.pb || defaults.py);
|
|
255
|
+
assertStyleMatch({
|
|
254
256
|
padding,
|
|
255
257
|
paddingLeft,
|
|
256
258
|
paddingRight,
|
|
257
259
|
paddingTop,
|
|
258
260
|
paddingBottom
|
|
259
|
-
}, StyleElement, assertOpts)
|
|
261
|
+
}, StyleElement, assertOpts);
|
|
260
262
|
} else {
|
|
261
263
|
expect(StyleElement).not.toHaveStyleRule("paddingLeft");
|
|
262
264
|
expect(StyleElement).not.toHaveStyleRule("paddingRight");
|
|
@@ -268,15 +270,14 @@ const testStyledSystemPadding = (component, defaults, styleContainer, assertOpts
|
|
|
268
270
|
});
|
|
269
271
|
describe.each(paddingProps)('when a custom spacing is specified using the "%s" styled system props', (styledSystemProp, propName) => {
|
|
270
272
|
it(`then that ${propName} should have been set correctly`, () => {
|
|
271
|
-
let wrapper = (0, _enzyme.mount)(component());
|
|
272
273
|
const props = {
|
|
273
274
|
[styledSystemProp]: 2
|
|
274
275
|
};
|
|
275
|
-
wrapper = (0, _enzyme.mount)(component({ ...props
|
|
276
|
+
const wrapper = (0, _enzyme.mount)(component({ ...props
|
|
276
277
|
}));
|
|
277
|
-
|
|
278
|
+
assertStyleMatch({
|
|
278
279
|
[propName]: "var(--spacing200)"
|
|
279
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts)
|
|
280
|
+
}, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts);
|
|
280
281
|
});
|
|
281
282
|
});
|
|
282
283
|
};
|
|
@@ -293,14 +294,14 @@ exports.testStyledSystemSpacing = testStyledSystemSpacing;
|
|
|
293
294
|
const testStyledSystemColor = (component, styleContainer) => {
|
|
294
295
|
describe.each(colorProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
295
296
|
it(`then ${propName} should have been set correctly`, () => {
|
|
296
|
-
let wrapper = (0, _enzyme.mount)(component());
|
|
297
297
|
const props = {
|
|
298
298
|
[styledSystemProp]: value
|
|
299
299
|
};
|
|
300
|
-
wrapper = (0, _enzyme.mount)(component({ ...props
|
|
301
|
-
}));
|
|
300
|
+
const wrapper = (0, _enzyme.mount)(component({ ...props
|
|
301
|
+
}));
|
|
302
|
+
const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper; // Some props need to have camelcase so used toHaveStyleRule rather than assertStyleMatch
|
|
302
303
|
|
|
303
|
-
expect(
|
|
304
|
+
expect(StyleElement).toHaveStyleRule(propName, value);
|
|
304
305
|
});
|
|
305
306
|
});
|
|
306
307
|
};
|
|
@@ -311,13 +312,13 @@ const testStyledSystemWidth = (component, styleContainer) => {
|
|
|
311
312
|
describe("when a width prop is specified using styled system props", () => {
|
|
312
313
|
it("then width should have been set correctly", () => {
|
|
313
314
|
const [styledSystemProp, propName, value] = widthProps;
|
|
314
|
-
let wrapper = (0, _enzyme.mount)(component());
|
|
315
315
|
const props = {
|
|
316
316
|
[styledSystemProp]: value
|
|
317
317
|
};
|
|
318
|
-
wrapper = (0, _enzyme.mount)(component({ ...props
|
|
318
|
+
const wrapper = (0, _enzyme.mount)(component({ ...props
|
|
319
319
|
}));
|
|
320
|
-
|
|
320
|
+
const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
|
|
321
|
+
expect(StyleElement).toHaveStyleRule(propName, value);
|
|
321
322
|
});
|
|
322
323
|
});
|
|
323
324
|
};
|
|
@@ -327,14 +328,14 @@ exports.testStyledSystemWidth = testStyledSystemWidth;
|
|
|
327
328
|
const testStyledSystemLayout = (component, styleContainer) => {
|
|
328
329
|
describe.each(layoutProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
329
330
|
it(`then ${propName} should have been set correctly`, () => {
|
|
330
|
-
let wrapper = (0, _enzyme.mount)(component());
|
|
331
331
|
const props = {
|
|
332
332
|
[styledSystemProp]: value
|
|
333
333
|
};
|
|
334
|
-
wrapper = (0, _enzyme.mount)(component({ ...props
|
|
335
|
-
}));
|
|
334
|
+
const wrapper = (0, _enzyme.mount)(component({ ...props
|
|
335
|
+
}));
|
|
336
|
+
const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper; // Some props need to have camelcase so used toHaveStyleRule rather than assertStyleMatch
|
|
336
337
|
|
|
337
|
-
expect(
|
|
338
|
+
expect(StyleElement).toHaveStyleRule(propName, value);
|
|
338
339
|
});
|
|
339
340
|
});
|
|
340
341
|
};
|
|
@@ -344,15 +345,13 @@ exports.testStyledSystemLayout = testStyledSystemLayout;
|
|
|
344
345
|
const testStyledSystemFlexBox = (component, styleContainer) => {
|
|
345
346
|
describe.each(flexBoxProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
346
347
|
it(`then ${propName} should have been set correctly`, () => {
|
|
347
|
-
let wrapper = (0, _enzyme.mount)(component());
|
|
348
348
|
const props = {
|
|
349
349
|
[styledSystemProp]: value
|
|
350
350
|
};
|
|
351
|
-
wrapper = (0, _enzyme.mount)(component(
|
|
352
|
-
|
|
353
|
-
expect(assertStyleMatch({
|
|
351
|
+
const wrapper = (0, _enzyme.mount)(component(props));
|
|
352
|
+
assertStyleMatch({
|
|
354
353
|
[propName]: value
|
|
355
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper)
|
|
354
|
+
}, styleContainer ? styleContainer(wrapper) : wrapper);
|
|
356
355
|
});
|
|
357
356
|
});
|
|
358
357
|
};
|
|
@@ -362,15 +361,14 @@ exports.testStyledSystemFlexBox = testStyledSystemFlexBox;
|
|
|
362
361
|
const testStyledSystemBackground = (component, styleContainer) => {
|
|
363
362
|
describe.each(backgroundProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
364
363
|
it(`then ${propName} should have been set correctly`, () => {
|
|
365
|
-
let wrapper = (0, _enzyme.mount)(component());
|
|
366
364
|
const props = {
|
|
367
365
|
[styledSystemProp]: value
|
|
368
366
|
};
|
|
369
|
-
wrapper = (0, _enzyme.mount)(component({ ...props
|
|
367
|
+
const wrapper = (0, _enzyme.mount)(component({ ...props
|
|
370
368
|
}));
|
|
371
|
-
|
|
369
|
+
assertStyleMatch({
|
|
372
370
|
[styledSystemProp]: value
|
|
373
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper)
|
|
371
|
+
}, styleContainer ? styleContainer(wrapper) : wrapper);
|
|
374
372
|
});
|
|
375
373
|
});
|
|
376
374
|
}; // this util will catch that a console output occurred without polluting the output when running the unit tests
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
export default ActionPopoverContext;
|
|
2
|
-
declare const ActionPopoverContext: React.Context<{}>;
|
|
3
1
|
import React from "react";
|
|
2
|
+
declare type ActionPopoverContextType = {
|
|
3
|
+
setOpenPopover: (isOpen: boolean) => void;
|
|
4
|
+
focusButton: () => void;
|
|
5
|
+
isOpenPopover: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const ActionPopoverContext: React.Context<ActionPopoverContextType | null>;
|
|
8
|
+
export default ActionPopoverContext;
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
-
const ActionPopoverContext = /*#__PURE__*/_react.default.createContext(
|
|
12
|
+
const ActionPopoverContext = /*#__PURE__*/_react.default.createContext(null);
|
|
13
13
|
|
|
14
14
|
var _default = ActionPopoverContext;
|
|
15
15
|
exports.default = _default;
|
package/lib/components/action-popover/action-popover-item/action-popover-item.component.d.ts
CHANGED
|
@@ -1,42 +1,29 @@
|
|
|
1
|
-
export default ActionPopoverItem;
|
|
2
|
-
export function MenuItem({ children, icon, disabled, onClick: onClickProp, submenu, theme, placement, focusItem, download, href, horizontalAlignment, ...rest }: {
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
children: any;
|
|
5
|
-
icon: any;
|
|
6
|
-
disabled?: boolean | undefined;
|
|
7
|
-
onClick: any;
|
|
8
|
-
submenu: any;
|
|
9
|
-
theme: any;
|
|
10
|
-
placement?: string | undefined;
|
|
11
|
-
focusItem: any;
|
|
12
|
-
download: any;
|
|
13
|
-
href: any;
|
|
14
|
-
horizontalAlignment: any;
|
|
15
|
-
}): JSX.Element;
|
|
16
|
-
export namespace MenuItem {
|
|
17
|
-
namespace propTypes {
|
|
18
|
-
const children: PropTypes.Validator<string>;
|
|
19
|
-
const disabled: PropTypes.Requireable<boolean>;
|
|
20
|
-
const icon: PropTypes.Requireable<string>;
|
|
21
|
-
const onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
-
const download: PropTypes.Requireable<boolean>;
|
|
23
|
-
const href: PropTypes.Requireable<string>;
|
|
24
|
-
/** Submenu component for item */
|
|
25
|
-
function submenu(props: any, propName: any, componentName: any): Error | undefined;
|
|
26
|
-
/** Submenu component for item */
|
|
27
|
-
function submenu(props: any, propName: any, componentName: any): Error | undefined;
|
|
28
|
-
const placement: PropTypes.Requireable<string>;
|
|
29
|
-
const focusItem: PropTypes.Requireable<boolean>;
|
|
30
|
-
const horizontalAlignment: PropTypes.Requireable<string>;
|
|
31
|
-
}
|
|
32
|
-
const displayName: string;
|
|
33
|
-
}
|
|
34
|
-
declare const ActionPopoverItem: React.ForwardRefExoticComponent<{
|
|
35
|
-
[x: string]: any;
|
|
36
|
-
[x: number]: any;
|
|
37
|
-
[x: symbol]: any;
|
|
38
|
-
} & {
|
|
39
|
-
theme?: any;
|
|
40
|
-
}>;
|
|
41
|
-
import PropTypes from "prop-types";
|
|
42
1
|
import React from "react";
|
|
2
|
+
import { IconType } from "../../icon";
|
|
3
|
+
export interface ActionPopoverItemProps {
|
|
4
|
+
/** The text label to display for this Item */
|
|
5
|
+
children: string;
|
|
6
|
+
/** Flag to indicate if item is disabled */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** allows to provide download prop that works dependent with href */
|
|
9
|
+
download?: boolean;
|
|
10
|
+
/** allows to provide href prop */
|
|
11
|
+
href?: string;
|
|
12
|
+
/** The name of the icon to display next to the label */
|
|
13
|
+
icon?: IconType;
|
|
14
|
+
/** Callback to run when item is clicked */
|
|
15
|
+
onClick?: (ev: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
16
|
+
/** Submenu component for item */
|
|
17
|
+
submenu?: React.ReactNode;
|
|
18
|
+
/** @ignore @private */
|
|
19
|
+
placement?: "top" | "bottom";
|
|
20
|
+
/** @ignore @private */
|
|
21
|
+
focusItem?: boolean;
|
|
22
|
+
/** @ignore @private */
|
|
23
|
+
horizontalAlignment?: "left" | "right";
|
|
24
|
+
}
|
|
25
|
+
export declare const ActionPopoverItem: {
|
|
26
|
+
({ children, icon, disabled, onClick: onClickProp, submenu, placement, focusItem, download, href, horizontalAlignment, ...rest }: ActionPopoverItemProps): JSX.Element;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
export default ActionPopoverItem;
|