@coveord/plasma-mantine 49.1.1 → 49.1.2
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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +9 -9
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/button/Button.js +16 -8
- package/dist/cjs/components/button/Button.js.map +1 -1
- package/dist/cjs/components/button/ButtonWithDisabledTooltip.js +17 -36
- package/dist/cjs/components/button/ButtonWithDisabledTooltip.js.map +1 -1
- package/dist/cjs/components/inline-confirm/InlineConfirm.js +2 -0
- package/dist/cjs/components/inline-confirm/InlineConfirm.js.map +1 -1
- package/dist/cjs/components/inline-confirm/InlineConfirmButton.js +16 -11
- package/dist/cjs/components/inline-confirm/InlineConfirmButton.js.map +1 -1
- package/dist/cjs/components/inline-confirm/InlineConfirmMenuItem.js +33 -0
- package/dist/cjs/components/inline-confirm/InlineConfirmMenuItem.js.map +1 -0
- package/dist/cjs/components/menu/Menu.js +17 -6
- package/dist/cjs/components/menu/Menu.js.map +1 -1
- package/dist/cjs/theme/Theme.js +9 -2
- package/dist/cjs/theme/Theme.js.map +1 -1
- package/dist/definitions/components/button/Button.d.ts +1 -2
- package/dist/definitions/components/button/Button.d.ts.map +1 -1
- package/dist/definitions/components/button/ButtonWithDisabledTooltip.d.ts +10 -9
- package/dist/definitions/components/button/ButtonWithDisabledTooltip.d.ts.map +1 -1
- package/dist/definitions/components/inline-confirm/InlineConfirm.d.ts +2 -0
- package/dist/definitions/components/inline-confirm/InlineConfirm.d.ts.map +1 -1
- package/dist/definitions/components/inline-confirm/InlineConfirmButton.d.ts +4 -4
- package/dist/definitions/components/inline-confirm/InlineConfirmButton.d.ts.map +1 -1
- package/dist/definitions/components/inline-confirm/InlineConfirmMenuItem.d.ts +8 -0
- package/dist/definitions/components/inline-confirm/InlineConfirmMenuItem.d.ts.map +1 -0
- package/dist/definitions/components/menu/Menu.d.ts.map +1 -1
- package/dist/definitions/theme/Theme.d.ts.map +1 -1
- package/dist/esm/components/button/Button.js +17 -9
- package/dist/esm/components/button/Button.js.map +1 -1
- package/dist/esm/components/button/ButtonWithDisabledTooltip.js +18 -37
- package/dist/esm/components/button/ButtonWithDisabledTooltip.js.map +1 -1
- package/dist/esm/components/inline-confirm/InlineConfirm.js +2 -0
- package/dist/esm/components/inline-confirm/InlineConfirm.js.map +1 -1
- package/dist/esm/components/inline-confirm/InlineConfirmButton.js +16 -11
- package/dist/esm/components/inline-confirm/InlineConfirmButton.js.map +1 -1
- package/dist/esm/components/inline-confirm/InlineConfirmMenuItem.js +23 -0
- package/dist/esm/components/inline-confirm/InlineConfirmMenuItem.js.map +1 -0
- package/dist/esm/components/menu/Menu.js +17 -6
- package/dist/esm/components/menu/Menu.js.map +1 -1
- package/dist/esm/theme/Theme.js +9 -2
- package/dist/esm/theme/Theme.js.map +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.tsx +12 -18
- package/src/components/button/ButtonWithDisabledTooltip.tsx +17 -38
- package/src/components/button/__tests__/ButtonWithDisabledTooltip.spec.tsx +22 -28
- package/src/components/inline-confirm/InlineConfirm.tsx +3 -0
- package/src/components/inline-confirm/InlineConfirmButton.tsx +15 -11
- package/src/components/inline-confirm/InlineConfirmMenuItem.tsx +21 -0
- package/src/components/inline-confirm/__tests__/InlineConfirm.spec.tsx +25 -0
- package/src/components/menu/Menu.tsx +13 -4
- package/src/theme/Theme.tsx +7 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Menu} from '@mantine/core';
|
|
1
2
|
import {render, screen, userEvent} from '@test-utils';
|
|
2
3
|
|
|
3
4
|
import {InlineConfirm} from '../InlineConfirm';
|
|
@@ -25,6 +26,30 @@ describe('InlineConfirm', () => {
|
|
|
25
26
|
expect(onClickSpy).toHaveBeenCalledTimes(1);
|
|
26
27
|
});
|
|
27
28
|
|
|
29
|
+
it('calls the onClick prop when clicking on the menu item', async () => {
|
|
30
|
+
const user = userEvent.setup({delay: null});
|
|
31
|
+
const onClickSpy = jest.fn();
|
|
32
|
+
render(
|
|
33
|
+
<InlineConfirm>
|
|
34
|
+
<Menu>
|
|
35
|
+
<Menu.Target>
|
|
36
|
+
<button>open menu</button>
|
|
37
|
+
</Menu.Target>
|
|
38
|
+
<Menu.Dropdown>
|
|
39
|
+
<InlineConfirm.MenuItem id="delete" onClick={onClickSpy}>
|
|
40
|
+
Delete
|
|
41
|
+
</InlineConfirm.MenuItem>
|
|
42
|
+
</Menu.Dropdown>
|
|
43
|
+
</Menu>
|
|
44
|
+
</InlineConfirm>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
await user.click(screen.getByRole('button', {name: /open menu/i}));
|
|
48
|
+
await user.click(screen.getByRole('menuitem', {name: /delete/i}));
|
|
49
|
+
|
|
50
|
+
expect(onClickSpy).toHaveBeenCalledTimes(1);
|
|
51
|
+
});
|
|
52
|
+
|
|
28
53
|
it('replace the children with a prompt when clicking on a button which requires confirmation', async () => {
|
|
29
54
|
const user = userEvent.setup({delay: null});
|
|
30
55
|
render(
|
|
@@ -2,13 +2,22 @@ import {Menu as MantineMenu, MenuItemProps as MantineMenuItemProps} from '@manti
|
|
|
2
2
|
import {forwardRef} from 'react';
|
|
3
3
|
|
|
4
4
|
import {createPolymorphicComponent, overrideComponent} from '../../utils';
|
|
5
|
-
import {
|
|
5
|
+
import {ButtonWithDisabledTooltipProps} from '../button';
|
|
6
|
+
import {ButtonWithDisabledTooltip} from '../button/ButtonWithDisabledTooltip';
|
|
6
7
|
|
|
7
8
|
export interface MenuItemProps extends MantineMenuItemProps, ButtonWithDisabledTooltipProps {}
|
|
8
9
|
|
|
9
|
-
const _MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const _MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(
|
|
11
|
+
({disabledTooltip, disabled, disabledTooltipProps, ...others}, ref) => (
|
|
12
|
+
<ButtonWithDisabledTooltip
|
|
13
|
+
disabled={disabled}
|
|
14
|
+
disabledTooltip={disabledTooltip}
|
|
15
|
+
disabledTooltipProps={disabledTooltipProps}
|
|
16
|
+
>
|
|
17
|
+
<MantineMenu.Item ref={ref} disabled={disabled} {...others} />
|
|
18
|
+
</ButtonWithDisabledTooltip>
|
|
19
|
+
)
|
|
20
|
+
);
|
|
12
21
|
|
|
13
22
|
const MenuItem = createPolymorphicComponent<'button', MenuItemProps>(_MenuItem);
|
|
14
23
|
|
package/src/theme/Theme.tsx
CHANGED
|
@@ -112,6 +112,7 @@ export const plasmaTheme: MantineThemeOverride = {
|
|
|
112
112
|
color: 'navy',
|
|
113
113
|
withArrow: true,
|
|
114
114
|
withinPortal: true,
|
|
115
|
+
multiline: true,
|
|
115
116
|
},
|
|
116
117
|
},
|
|
117
118
|
Breadcrumbs: {
|
|
@@ -183,6 +184,12 @@ export const plasmaTheme: MantineThemeOverride = {
|
|
|
183
184
|
ColorSwatch: {
|
|
184
185
|
defaultProps: {
|
|
185
186
|
size: 8,
|
|
187
|
+
withShadow: false,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
MenuItem: {
|
|
191
|
+
defaultProps: {
|
|
192
|
+
fw: 300,
|
|
186
193
|
},
|
|
187
194
|
},
|
|
188
195
|
},
|