@mantine/schedule 9.0.0 → 9.0.1
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/cjs/components/DayView/DayView.cjs +4 -2
- package/cjs/components/DayView/DayView.cjs.map +1 -1
- package/cjs/components/MonthView/MonthView.cjs +2 -1
- package/cjs/components/MonthView/MonthView.cjs.map +1 -1
- package/cjs/components/WeekView/WeekView.cjs +4 -2
- package/cjs/components/WeekView/WeekView.cjs.map +1 -1
- package/cjs/components/YearView/YearView.cjs.map +1 -1
- package/cjs/hooks/use-auto-scroll-on-drag.cjs +5 -10
- package/cjs/hooks/use-auto-scroll-on-drag.cjs.map +1 -1
- package/cjs/hooks/use-drag-drop-handlers.cjs +13 -8
- package/cjs/hooks/use-drag-drop-handlers.cjs.map +1 -1
- package/cjs/hooks/use-event-resize.cjs +3 -4
- package/cjs/hooks/use-event-resize.cjs.map +1 -1
- package/cjs/hooks/use-slot-drag-select.cjs +2 -3
- package/cjs/hooks/use-slot-drag-select.cjs.map +1 -1
- package/esm/components/DayView/DayView.mjs +4 -2
- package/esm/components/DayView/DayView.mjs.map +1 -1
- package/esm/components/MonthView/MonthView.mjs +2 -1
- package/esm/components/MonthView/MonthView.mjs.map +1 -1
- package/esm/components/WeekView/WeekView.mjs +4 -2
- package/esm/components/WeekView/WeekView.mjs.map +1 -1
- package/esm/components/YearView/YearView.mjs.map +1 -1
- package/esm/hooks/use-auto-scroll-on-drag.mjs +6 -11
- package/esm/hooks/use-auto-scroll-on-drag.mjs.map +1 -1
- package/esm/hooks/use-drag-drop-handlers.mjs +14 -9
- package/esm/hooks/use-drag-drop-handlers.mjs.map +1 -1
- package/esm/hooks/use-event-resize.mjs +4 -5
- package/esm/hooks/use-event-resize.mjs.map +1 -1
- package/esm/hooks/use-slot-drag-select.mjs +3 -4
- package/esm/hooks/use-slot-drag-select.mjs.map +1 -1
- package/lib/components/DayView/DayView.d.ts +6 -0
- package/lib/components/DayView/index.d.ts +0 -6
- package/lib/components/MonthView/MonthView.d.ts +6 -0
- package/lib/components/MonthView/index.d.ts +0 -6
- package/lib/components/WeekView/WeekView.d.ts +6 -0
- package/lib/components/WeekView/index.d.ts +0 -6
- package/lib/components/YearView/YearView.d.ts +6 -0
- package/lib/components/YearView/index.d.ts +0 -6
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slot-drag-select.mjs","names":[],"sources":["../../src/hooks/use-slot-drag-select.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\ninterface DragState {\n group: string;\n startIndex: number;\n currentIndex: number;\n}\n\ninterface SelectedRange {\n group: string;\n start: number;\n end: number;\n}\n\ninterface UseSlotDragSelectInput {\n enabled?: boolean;\n onDragEnd?: (startIndex: number, endIndex: number, group: string) => void;\n}\n\nexport function useSlotDragSelect({ enabled = true, onDragEnd }: UseSlotDragSelectInput) {\n const [selectedRange, setSelectedRange] = useState<SelectedRange | null>(null);\n const dragRef = useRef<DragState | null>(null);\n const
|
|
1
|
+
{"version":3,"file":"use-slot-drag-select.mjs","names":[],"sources":["../../src/hooks/use-slot-drag-select.ts"],"sourcesContent":["import { useCallback, useEffect, useEffectEvent, useRef, useState } from 'react';\n\ninterface DragState {\n group: string;\n startIndex: number;\n currentIndex: number;\n}\n\ninterface SelectedRange {\n group: string;\n start: number;\n end: number;\n}\n\ninterface UseSlotDragSelectInput {\n enabled?: boolean;\n onDragEnd?: (startIndex: number, endIndex: number, group: string) => void;\n}\n\nexport function useSlotDragSelect({ enabled = true, onDragEnd }: UseSlotDragSelectInput) {\n const [selectedRange, setSelectedRange] = useState<SelectedRange | null>(null);\n const dragRef = useRef<DragState | null>(null);\n const stableOnDragEnd = useEffectEvent(onDragEnd || (() => {}));\n\n const handleSlotPointerDown = useCallback(\n (_event: React.PointerEvent<HTMLButtonElement>, index: number, group: string) => {\n if (!enabled) {\n return;\n }\n dragRef.current = { group, startIndex: index, currentIndex: index };\n setSelectedRange({ group, start: index, end: index });\n },\n [enabled]\n );\n\n const isDragging = selectedRange !== null;\n\n useEffect(() => {\n if (!isDragging) {\n return undefined;\n }\n\n const savedUserSelect = document.body.style.userSelect;\n document.body.style.userSelect = 'none';\n\n const handlePointerMove = (e: PointerEvent) => {\n if (!dragRef.current) {\n return;\n }\n\n const elements = document.elementsFromPoint(e.clientX, e.clientY);\n for (const el of elements) {\n const indexAttr = (el as HTMLElement).getAttribute?.('data-drag-slot-index');\n const groupAttr = (el as HTMLElement).getAttribute?.('data-drag-slot-group');\n if (indexAttr != null && groupAttr != null) {\n if (groupAttr === dragRef.current.group) {\n const newIndex = Number(indexAttr);\n if (!isNaN(newIndex) && newIndex !== dragRef.current.currentIndex) {\n dragRef.current.currentIndex = newIndex;\n setSelectedRange({\n group: groupAttr,\n start: Math.min(dragRef.current.startIndex, newIndex),\n end: Math.max(dragRef.current.startIndex, newIndex),\n });\n }\n }\n break;\n }\n }\n };\n\n const handlePointerUp = () => {\n if (dragRef.current) {\n const { startIndex, currentIndex, group } = dragRef.current;\n if (startIndex !== currentIndex) {\n stableOnDragEnd(\n Math.min(startIndex, currentIndex),\n Math.max(startIndex, currentIndex),\n group\n );\n }\n }\n dragRef.current = null;\n setSelectedRange(null);\n };\n\n document.addEventListener('pointermove', handlePointerMove);\n document.addEventListener('pointerup', handlePointerUp);\n\n return () => {\n document.body.style.userSelect = savedUserSelect;\n document.removeEventListener('pointermove', handlePointerMove);\n document.removeEventListener('pointerup', handlePointerUp);\n };\n }, [isDragging]);\n\n const isSlotSelected = useCallback(\n (index: number, group: string): boolean => {\n if (!selectedRange || selectedRange.group !== group) {\n return false;\n }\n return index >= selectedRange.start && index <= selectedRange.end;\n },\n [selectedRange]\n );\n\n return {\n handleSlotPointerDown,\n isSlotSelected,\n isDragging,\n };\n}\n"],"mappings":";;;AAmBA,SAAgB,kBAAkB,EAAE,UAAU,MAAM,aAAqC;CACvF,MAAM,CAAC,eAAe,oBAAoB,SAA+B,KAAK;CAC9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AiB,eAAe,kBAAkB;AAC3D,WAAS,iBAAiB,aAAa,gBAAgB;AAEvD,eAAa;AACX,YAAS,KAAK,MAAM,aAAa;AACjC,YAAS,oBAAoB,eAAe,kBAAkB;AAC9D,YAAS,oBAAoB,aAAa,gBAAgB;;IAE3D,CAAC,WAAW,CAAC;AAYhB,QAAO;EACL;EACA,gBAZqB,aACpB,OAAe,UAA2B;AACzC,OAAI,CAAC,iBAAiB,cAAc,UAAU,MAC5C,QAAO;AAET,UAAO,SAAS,cAAc,SAAS,SAAS,cAAc;KAEhE,CAAC,cAAc,CAChB;EAKC;EACD"}
|
|
@@ -135,3 +135,9 @@ export declare const DayView: import("@mantine/core").MantineComponent<{
|
|
|
135
135
|
stylesNames: DayViewStylesNames;
|
|
136
136
|
vars: DayViewCssVariables;
|
|
137
137
|
}>;
|
|
138
|
+
export declare namespace DayView {
|
|
139
|
+
type Props = DayViewProps;
|
|
140
|
+
type Factory = DayViewFactory;
|
|
141
|
+
type StylesNames = DayViewStylesNames;
|
|
142
|
+
type CssVariables = DayViewCssVariables;
|
|
143
|
+
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { DayViewCssVariables, DayViewFactory, DayViewProps, DayViewStylesNames } from './DayView';
|
|
2
2
|
export { DayView } from './DayView';
|
|
3
3
|
export type { DayViewProps, DayViewFactory, DayViewStylesNames, DayViewCssVariables };
|
|
4
|
-
export declare namespace DayView {
|
|
5
|
-
type Props = DayViewProps;
|
|
6
|
-
type Factory = DayViewFactory;
|
|
7
|
-
type StylesNames = DayViewStylesNames;
|
|
8
|
-
type CssVariables = DayViewCssVariables;
|
|
9
|
-
}
|
|
@@ -112,3 +112,9 @@ export declare const MonthView: import("@mantine/core").MantineComponent<{
|
|
|
112
112
|
stylesNames: MonthViewStylesNames;
|
|
113
113
|
vars: MonthViewCssVariables;
|
|
114
114
|
}>;
|
|
115
|
+
export declare namespace MonthView {
|
|
116
|
+
type Props = MonthViewProps;
|
|
117
|
+
type Factory = MonthViewFactory;
|
|
118
|
+
type StylesNames = MonthViewStylesNames;
|
|
119
|
+
type CssVariables = MonthViewCssVariables;
|
|
120
|
+
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { MonthViewCssVariables, MonthViewFactory, MonthViewProps, MonthViewStylesNames } from './MonthView';
|
|
2
2
|
export { MonthView } from './MonthView';
|
|
3
3
|
export type { MonthViewProps, MonthViewFactory, MonthViewStylesNames, MonthViewCssVariables };
|
|
4
|
-
export declare namespace MonthView {
|
|
5
|
-
type Props = MonthViewProps;
|
|
6
|
-
type Factory = MonthViewFactory;
|
|
7
|
-
type StylesNames = MonthViewStylesNames;
|
|
8
|
-
type CssVariables = MonthViewCssVariables;
|
|
9
|
-
}
|
|
@@ -148,3 +148,9 @@ export declare const WeekView: import("@mantine/core").MantineComponent<{
|
|
|
148
148
|
stylesNames: WeekViewStylesNames;
|
|
149
149
|
vars: WeekViewCssVariables;
|
|
150
150
|
}>;
|
|
151
|
+
export declare namespace WeekView {
|
|
152
|
+
type Props = WeekViewProps;
|
|
153
|
+
type Factory = WeekViewFactory;
|
|
154
|
+
type StylesNames = WeekViewStylesNames;
|
|
155
|
+
type CssVariables = WeekViewCssVariables;
|
|
156
|
+
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { WeekViewCssVariables, WeekViewFactory, WeekViewProps, WeekViewStylesNames } from './WeekView';
|
|
2
2
|
export { WeekView } from './WeekView';
|
|
3
3
|
export type { WeekViewProps, WeekViewFactory, WeekViewStylesNames, WeekViewCssVariables };
|
|
4
|
-
export declare namespace WeekView {
|
|
5
|
-
type Props = WeekViewProps;
|
|
6
|
-
type Factory = WeekViewFactory;
|
|
7
|
-
type StylesNames = WeekViewStylesNames;
|
|
8
|
-
type CssVariables = WeekViewCssVariables;
|
|
9
|
-
}
|
|
@@ -51,3 +51,9 @@ export declare const YearView: import("@mantine/core").MantineComponent<{
|
|
|
51
51
|
stylesNames: YearViewStylesNames;
|
|
52
52
|
vars: YearViewCssVariables;
|
|
53
53
|
}>;
|
|
54
|
+
export declare namespace YearView {
|
|
55
|
+
type Props = YearViewProps;
|
|
56
|
+
type Factory = YearViewFactory;
|
|
57
|
+
type StylesNames = YearViewStylesNames;
|
|
58
|
+
type CssVariables = YearViewCssVariables;
|
|
59
|
+
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { YearViewCssVariables, YearViewFactory, YearViewProps, YearViewStylesNames } from './YearView';
|
|
2
2
|
export { YearView } from './YearView';
|
|
3
3
|
export type { YearViewProps, YearViewFactory, YearViewStylesNames, YearViewCssVariables };
|
|
4
|
-
export declare namespace YearView {
|
|
5
|
-
type Props = YearViewProps;
|
|
6
|
-
type Factory = YearViewFactory;
|
|
7
|
-
type StylesNames = YearViewStylesNames;
|
|
8
|
-
type CssVariables = YearViewCssVariables;
|
|
9
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine/schedule",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Schedule Mantine component",
|
|
5
5
|
"homepage": "https://mantine.dev/",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"directory": "packages/@mantine/schedule"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@mantine/core": "9.0.
|
|
39
|
-
"@mantine/dates": "9.0.
|
|
40
|
-
"@mantine/hooks": "9.0.
|
|
38
|
+
"@mantine/core": "9.0.1",
|
|
39
|
+
"@mantine/dates": "9.0.1",
|
|
40
|
+
"@mantine/hooks": "9.0.1",
|
|
41
41
|
"react": "^19.2.0",
|
|
42
42
|
"react-dom": "^19.2.0"
|
|
43
43
|
},
|