@coveord/plasma-mantine 57.0.0 → 57.2.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/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-test.log +102 -105
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/ActionIcon/ActionIcon.d.ts +6 -2
- package/dist/cjs/components/ActionIcon/ActionIcon.d.ts.map +1 -1
- package/dist/cjs/components/ActionIcon/ActionIcon.js.map +1 -1
- package/dist/cjs/components/AppShell/AppShell.d.ts +8 -1
- package/dist/cjs/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/cjs/components/AppShell/AppShell.js +27 -1
- package/dist/cjs/components/AppShell/AppShell.js.map +1 -1
- package/dist/cjs/components/AppShell/AppShell.module.css +4 -0
- package/dist/cjs/components/Button/Button.d.ts +6 -2
- package/dist/cjs/components/Button/Button.d.ts.map +1 -1
- package/dist/cjs/components/Button/Button.js.map +1 -1
- package/dist/cjs/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +2 -2
- package/dist/cjs/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/cjs/components/DateTimeRangePicker/DateTimeRangePicker.js +12 -7
- package/dist/cjs/components/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/cjs/components/DateTimeRangePicker/EditableDateTimeRangePicker.d.ts +9 -1
- package/dist/cjs/components/DateTimeRangePicker/EditableDateTimeRangePicker.d.ts.map +1 -1
- package/dist/cjs/components/DateTimeRangePicker/EditableDateTimeRangePicker.js +5 -1
- package/dist/cjs/components/DateTimeRangePicker/EditableDateTimeRangePicker.js.map +1 -1
- package/dist/cjs/hooks/useClickWithLoading.d.ts +8 -1
- package/dist/cjs/hooks/useClickWithLoading.d.ts.map +1 -1
- package/dist/cjs/hooks/useClickWithLoading.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles/AppShell.module.css +4 -0
- package/dist/cjs/styles/Input.module.css +1 -3
- package/dist/cjs/styles/NumberInput.module.css +2 -0
- package/dist/cjs/styles/Tooltip.module.css +1 -1
- package/dist/cjs/theme/Theme.d.ts.map +1 -1
- package/dist/cjs/theme/Theme.js +14 -2
- package/dist/cjs/theme/Theme.js.map +1 -1
- package/dist/esm/components/ActionIcon/ActionIcon.d.ts +6 -2
- package/dist/esm/components/ActionIcon/ActionIcon.d.ts.map +1 -1
- package/dist/esm/components/ActionIcon/ActionIcon.js.map +1 -1
- package/dist/esm/components/AppShell/AppShell.d.ts +8 -1
- package/dist/esm/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/esm/components/AppShell/AppShell.js +15 -3
- package/dist/esm/components/AppShell/AppShell.js.map +1 -1
- package/dist/esm/components/AppShell/AppShell.module.css +4 -0
- package/dist/esm/components/Button/Button.d.ts +6 -2
- package/dist/esm/components/Button/Button.d.ts.map +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +2 -2
- package/dist/esm/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/esm/components/DateTimeRangePicker/DateTimeRangePicker.js +2 -3
- package/dist/esm/components/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/esm/components/DateTimeRangePicker/EditableDateTimeRangePicker.d.ts +9 -1
- package/dist/esm/components/DateTimeRangePicker/EditableDateTimeRangePicker.d.ts.map +1 -1
- package/dist/esm/components/DateTimeRangePicker/EditableDateTimeRangePicker.js +5 -1
- package/dist/esm/components/DateTimeRangePicker/EditableDateTimeRangePicker.js.map +1 -1
- package/dist/esm/hooks/useClickWithLoading.d.ts +8 -1
- package/dist/esm/hooks/useClickWithLoading.d.ts.map +1 -1
- package/dist/esm/hooks/useClickWithLoading.js.map +1 -1
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styles/AppShell.module.css +4 -0
- package/dist/esm/styles/Input.module.css +1 -3
- package/dist/esm/styles/NumberInput.module.css +2 -0
- package/dist/esm/styles/Tooltip.module.css +1 -1
- package/dist/esm/theme/Theme.d.ts.map +1 -1
- package/dist/esm/theme/Theme.js +14 -2
- package/dist/esm/theme/Theme.js.map +1 -1
- package/package.json +3 -3
- package/src/components/ActionIcon/ActionIcon.tsx +7 -4
- package/src/components/AppShell/AppShell.module.css +4 -0
- package/src/components/AppShell/AppShell.tsx +27 -0
- package/src/components/Button/Button.tsx +7 -4
- package/src/components/Button/__tests__/Button.spec.tsx +42 -0
- package/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx +6 -9
- package/src/components/DateTimeRangePicker/EditableDateTimeRangePicker.tsx +14 -0
- package/src/components/DateTimeRangePicker/__tests__/EditableDateTimeRangePicker.spec.tsx +15 -0
- package/src/hooks/useClickWithLoading.ts +13 -1
- package/src/index.ts +4 -3
- package/src/styles/AppShell.module.css +4 -0
- package/src/styles/Input.module.css +1 -3
- package/src/styles/NumberInput.module.css +2 -0
- package/src/styles/Tooltip.module.css +1 -1
- package/src/theme/Theme.tsx +8 -1
- package/src/components/AppShell/AppShell.ts +0 -11
|
@@ -5,7 +5,10 @@ import {DatesRangeValue, DateStringValue} from '@mantine/dates';
|
|
|
5
5
|
import {DateRangePickerPreset, DateRangePickerPresetSelect} from '../DateRangePicker/DateRangePickerPresetSelect.js';
|
|
6
6
|
import {EditableDateTimeRangePicker, EditableDateTimeRangePickerProps} from './EditableDateTimeRangePicker.js';
|
|
7
7
|
|
|
8
|
-
interface DateTimeRangePickerProps extends Pick<
|
|
8
|
+
interface DateTimeRangePickerProps extends Pick<
|
|
9
|
+
EditableDateTimeRangePickerProps,
|
|
10
|
+
'startProps' | 'endProps' | 'dateFormat' | 'timePickerFormat'
|
|
11
|
+
> {
|
|
9
12
|
/** Default value for uncontrolled input */
|
|
10
13
|
defaultValue?: DatesRangeValue<DateStringValue | null>;
|
|
11
14
|
/** Value for controlled input */
|
|
@@ -30,8 +33,7 @@ export const DateTimeRangePicker = ({
|
|
|
30
33
|
value,
|
|
31
34
|
defaultValue,
|
|
32
35
|
onChange,
|
|
33
|
-
|
|
34
|
-
endProps,
|
|
36
|
+
...otherProps
|
|
35
37
|
}: DateTimeRangePickerProps) => {
|
|
36
38
|
const [_value, handleChange] = useUncontrolled<DatesRangeValue<DateStringValue | null>>({
|
|
37
39
|
value,
|
|
@@ -42,12 +44,7 @@ export const DateTimeRangePicker = ({
|
|
|
42
44
|
|
|
43
45
|
return (
|
|
44
46
|
<Group align="center">
|
|
45
|
-
<EditableDateTimeRangePicker
|
|
46
|
-
value={_value}
|
|
47
|
-
onChange={handleChange}
|
|
48
|
-
startProps={startProps}
|
|
49
|
-
endProps={endProps}
|
|
50
|
-
/>
|
|
47
|
+
<EditableDateTimeRangePicker value={_value} onChange={handleChange} {...otherProps} />
|
|
51
48
|
{presets && (
|
|
52
49
|
<DateRangePickerPresetSelect
|
|
53
50
|
presets={presets}
|
|
@@ -3,6 +3,14 @@ import dayjs from 'dayjs';
|
|
|
3
3
|
|
|
4
4
|
export interface EditableDateTimeRangePickerProps {
|
|
5
5
|
value: DatesRangeValue<DateStringValue | null>;
|
|
6
|
+
/**
|
|
7
|
+
* The format of the date in the input
|
|
8
|
+
*/
|
|
9
|
+
dateFormat?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The format of the time in the time picker, either 12h or 24h
|
|
12
|
+
*/
|
|
13
|
+
timePickerFormat?: '12h' | '24h';
|
|
6
14
|
onChange?(value: DatesRangeValue<DateStringValue | null>): void;
|
|
7
15
|
/**
|
|
8
16
|
* Props for the start input
|
|
@@ -16,7 +24,9 @@ export interface EditableDateTimeRangePickerProps {
|
|
|
16
24
|
|
|
17
25
|
export const EditableDateTimeRangePicker = ({
|
|
18
26
|
value,
|
|
27
|
+
dateFormat,
|
|
19
28
|
onChange,
|
|
29
|
+
timePickerFormat = '12h',
|
|
20
30
|
startProps = {},
|
|
21
31
|
endProps = {},
|
|
22
32
|
}: EditableDateTimeRangePickerProps) => {
|
|
@@ -35,9 +45,11 @@ export const EditableDateTimeRangePicker = ({
|
|
|
35
45
|
label="Start"
|
|
36
46
|
value={value?.[0]}
|
|
37
47
|
onChange={onStartDateChange}
|
|
48
|
+
valueFormat={dateFormat}
|
|
38
49
|
w={150}
|
|
39
50
|
styles={{...startProps.styles}}
|
|
40
51
|
timePickerProps={{
|
|
52
|
+
format: timePickerFormat,
|
|
41
53
|
popoverProps: {withinPortal: false},
|
|
42
54
|
}}
|
|
43
55
|
/>
|
|
@@ -47,9 +59,11 @@ export const EditableDateTimeRangePicker = ({
|
|
|
47
59
|
value={value?.[1]}
|
|
48
60
|
minDate={value?.[0]}
|
|
49
61
|
onChange={(endDate) => onChange?.([value?.[0], endDate])}
|
|
62
|
+
valueFormat={dateFormat}
|
|
50
63
|
w={150}
|
|
51
64
|
styles={{...endProps.styles}}
|
|
52
65
|
timePickerProps={{
|
|
66
|
+
format: timePickerFormat,
|
|
53
67
|
popoverProps: {withinPortal: false},
|
|
54
68
|
}}
|
|
55
69
|
/>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {render, screen} from '@test-utils';
|
|
2
|
+
import {EditableDateTimeRangePicker} from '../EditableDateTimeRangePicker';
|
|
3
|
+
|
|
4
|
+
describe('EditableDateTimeRangePicker', () => {
|
|
5
|
+
it('renders start and end date in correct format', () => {
|
|
6
|
+
render(
|
|
7
|
+
<EditableDateTimeRangePicker
|
|
8
|
+
value={['2026-03-01T10:00:00Z', '2026-03-02T11:30:00Z']}
|
|
9
|
+
dateFormat="DD/MM/YYYY hh:mm A"
|
|
10
|
+
/>,
|
|
11
|
+
);
|
|
12
|
+
expect(screen.getByRole('button', {name: 'Start'})).toHaveTextContent('01/03/2026 10:00 AM');
|
|
13
|
+
expect(screen.getByRole('button', {name: 'End'})).toHaveTextContent('02/03/2026 11:30 AM');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import {MouseEvent, MouseEventHandler, useState} from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A click handler that supports:
|
|
5
|
+
* - Standard MouseEventHandler (receives event, returns void)
|
|
6
|
+
* - Async handlers (receives event, returns Promise)
|
|
7
|
+
* - Parameterless handlers (no event parameter)
|
|
8
|
+
*/
|
|
9
|
+
export type ClickHandler<T = HTMLButtonElement> =
|
|
10
|
+
| MouseEventHandler<T>
|
|
11
|
+
| ((event: MouseEvent<T>) => Promise<void>)
|
|
12
|
+
| (() => void)
|
|
13
|
+
| (() => Promise<void>);
|
|
14
|
+
|
|
15
|
+
export const useClickWithLoading = (handler?: ClickHandler<HTMLButtonElement>) => {
|
|
4
16
|
const [isLoading, setIsLoading] = useState(false);
|
|
5
17
|
|
|
6
18
|
const handleClick = async (event: MouseEvent<HTMLButtonElement>) => {
|
package/src/index.ts
CHANGED
|
@@ -75,6 +75,7 @@ export * from './components/Burger/Burger.js';
|
|
|
75
75
|
// Button - override Mantine Button
|
|
76
76
|
export {Button, type ButtonProps} from './components/Button/Button.js';
|
|
77
77
|
export {type ButtonWithDisabledTooltipProps} from './components/Button/ButtonWithDisabledTooltip.js';
|
|
78
|
+
export {type ClickHandler} from './hooks/useClickWithLoading.js';
|
|
78
79
|
|
|
79
80
|
// Card
|
|
80
81
|
export * from './components/Card/Card.js';
|
|
@@ -111,16 +112,16 @@ export * from './components/Collapse/Collapse.js';
|
|
|
111
112
|
|
|
112
113
|
// Collection
|
|
113
114
|
export * from './components/Collection/Collection.js';
|
|
114
|
-
export {enhanceWithCollectionProps} from './components/Collection/enhanceWithCollectionProps.js';
|
|
115
115
|
export type {
|
|
116
|
-
CollectionColumnDef,
|
|
117
116
|
CollectionCellContext,
|
|
117
|
+
CollectionColumnDef,
|
|
118
118
|
CollectionHeaderContext,
|
|
119
119
|
} from './components/Collection/CollectionColumn.types.js';
|
|
120
|
+
export {enhanceWithCollectionProps} from './components/Collection/enhanceWithCollectionProps.js';
|
|
120
121
|
export type {
|
|
121
122
|
CollectionLayout,
|
|
122
|
-
CollectionLayoutHeaderProps,
|
|
123
123
|
CollectionLayoutBodyProps,
|
|
124
|
+
CollectionLayoutHeaderProps,
|
|
124
125
|
} from './components/Collection/layouts/CollectionLayout.types.js';
|
|
125
126
|
|
|
126
127
|
// Color Input
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
.wrapper {
|
|
2
|
-
--input-section-color: var(--mantine-color-placeholder);
|
|
3
|
-
|
|
4
2
|
@mixin light {
|
|
5
3
|
--input-disabled-color: var(--mantine-color-disabled-color);
|
|
6
4
|
|
|
@@ -39,6 +37,6 @@
|
|
|
39
37
|
|
|
40
38
|
.section {
|
|
41
39
|
> svg {
|
|
42
|
-
color: var(--mantine-color-
|
|
40
|
+
color: var(--mantine-color-dimmed);
|
|
43
41
|
}
|
|
44
42
|
}
|
package/src/theme/Theme.tsx
CHANGED
|
@@ -70,6 +70,7 @@ import {Accordion} from '../components/Accordion/Accordion.js';
|
|
|
70
70
|
import {CheckboxIcon} from '../components/CheckboxIcon/CheckboxIcon.js';
|
|
71
71
|
import {CircleLoader} from '../components/CircleLoader/CircleLoader.js';
|
|
72
72
|
import {InfoToken} from '../components/InfoToken/InfoToken.js';
|
|
73
|
+
import AppShellClasses from '../styles/AppShell.module.css';
|
|
73
74
|
import AccordionClasses from '../styles/Accordion.module.css';
|
|
74
75
|
import ActionIconClasses from '../styles/ActionIcon.module.css';
|
|
75
76
|
import AlertClasses from '../styles/Alert.module.css';
|
|
@@ -188,6 +189,13 @@ export const plasmaTheme: MantineThemeOverride = createTheme({
|
|
|
188
189
|
classNames: ActionIconClasses,
|
|
189
190
|
}),
|
|
190
191
|
AppShell: AppShell.extend({
|
|
192
|
+
classNames: AppShellClasses,
|
|
193
|
+
defaultProps: {
|
|
194
|
+
header: {height: 60},
|
|
195
|
+
navbar: {width: 240, breakpoint: 0},
|
|
196
|
+
layout: 'alt',
|
|
197
|
+
withBorder: false,
|
|
198
|
+
},
|
|
191
199
|
vars: (theme) =>
|
|
192
200
|
({
|
|
193
201
|
root: {'--app-shell-border-color': theme.colors.gray[2]},
|
|
@@ -539,7 +547,6 @@ export const plasmaTheme: MantineThemeOverride = createTheme({
|
|
|
539
547
|
multiline: true,
|
|
540
548
|
withArrow: true,
|
|
541
549
|
zIndex: 10000,
|
|
542
|
-
color: PlasmaColors.violet[9],
|
|
543
550
|
},
|
|
544
551
|
classNames: TooltipClasses,
|
|
545
552
|
}),
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {AppShell} from '@mantine/core';
|
|
2
|
-
|
|
3
|
-
AppShell.displayName = 'AppShell';
|
|
4
|
-
AppShell.Header.displayName = 'AppShell.Header';
|
|
5
|
-
AppShell.Navbar.displayName = 'AppShell.Navbar';
|
|
6
|
-
AppShell.Main.displayName = 'AppShell.Main';
|
|
7
|
-
AppShell.Aside.displayName = 'AppShell.Aside';
|
|
8
|
-
AppShell.Footer.displayName = 'AppShell.Footer';
|
|
9
|
-
AppShell.Section.displayName = 'AppShell.Section';
|
|
10
|
-
|
|
11
|
-
export {AppShell, type AppShellFactory, type AppShellProps} from '@mantine/core';
|