@ark-ui/react 0.0.0-rc-20230601121459 → 0.0.0-rc-20230601215329
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/dist/pagination/pagination.cjs +1 -0
- package/dist/pagination/pagination.d.ts +1 -0
- package/dist/pagination/pagination.mjs +1 -0
- package/dist/pagination/use-pagination.cjs +8 -3
- package/dist/pagination/use-pagination.d.ts +3 -1
- package/dist/pagination/use-pagination.mjs +8 -3
- package/dist/splitter/splitter.cjs +1 -0
- package/dist/splitter/splitter.d.ts +9 -3
- package/dist/splitter/splitter.mjs +1 -0
- package/dist/splitter/use-splitter.cjs +28 -4
- package/dist/splitter/use-splitter.d.ts +8 -6
- package/dist/splitter/use-splitter.mjs +10 -5
- package/package.json +33 -33
|
@@ -297,5 +297,6 @@ export declare const Pagination: ForwardRefExoticComponent<{
|
|
|
297
297
|
count: number;
|
|
298
298
|
pageSize?: number | undefined;
|
|
299
299
|
siblingCount?: number | undefined;
|
|
300
|
+
defaultPage?: number | undefined;
|
|
300
301
|
children: ReactNode | ((pages: UsePaginationReturn) => ReactNode);
|
|
301
302
|
}>;
|
|
@@ -28,12 +28,17 @@ const pagination__namespace = /*#__PURE__*/_interopNamespaceDefault(pagination);
|
|
|
28
28
|
|
|
29
29
|
const usePagination = (props) => {
|
|
30
30
|
const getRootNode = environmentContext.useEnvironmentContext();
|
|
31
|
-
const
|
|
31
|
+
const initialContext = {
|
|
32
32
|
id: React.useId(),
|
|
33
33
|
getRootNode,
|
|
34
|
-
...props
|
|
34
|
+
...props,
|
|
35
|
+
page: props.defaultPage
|
|
36
|
+
};
|
|
37
|
+
const context = {
|
|
38
|
+
...initialContext,
|
|
39
|
+
page: props.page
|
|
35
40
|
};
|
|
36
|
-
const [state, send] = react.useMachine(pagination__namespace.machine(
|
|
41
|
+
const [state, send] = react.useMachine(pagination__namespace.machine(initialContext), { context });
|
|
37
42
|
return pagination__namespace.connect(state, send, react.normalizeProps);
|
|
38
43
|
};
|
|
39
44
|
|
|
@@ -2,7 +2,9 @@ import type { HTMLAttributes } from 'react';
|
|
|
2
2
|
import type { PaginationRange, EllipsisProps, PageTriggerProps } from '@zag-js/pagination/dist/pagination.types';
|
|
3
3
|
import * as pagination from '@zag-js/pagination';
|
|
4
4
|
import { type Optional } from '../types';
|
|
5
|
-
export type UsePaginationProps = Optional<pagination.Context, 'id'
|
|
5
|
+
export type UsePaginationProps = Optional<pagination.Context, 'id'> & {
|
|
6
|
+
defaultPage?: pagination.Context['page'];
|
|
7
|
+
};
|
|
6
8
|
export declare const usePagination: (props: UsePaginationProps) => {
|
|
7
9
|
page: number;
|
|
8
10
|
totalPages: number;
|
|
@@ -5,12 +5,17 @@ import { useEnvironmentContext } from '../environment/environment-context.mjs';
|
|
|
5
5
|
|
|
6
6
|
const usePagination = (props) => {
|
|
7
7
|
const getRootNode = useEnvironmentContext();
|
|
8
|
-
const
|
|
8
|
+
const initialContext = {
|
|
9
9
|
id: useId(),
|
|
10
10
|
getRootNode,
|
|
11
|
-
...props
|
|
11
|
+
...props,
|
|
12
|
+
page: props.defaultPage
|
|
13
|
+
};
|
|
14
|
+
const context = {
|
|
15
|
+
...initialContext,
|
|
16
|
+
page: props.page
|
|
12
17
|
};
|
|
13
|
-
const [state, send] = useMachine(pagination.machine(
|
|
18
|
+
const [state, send] = useMachine(pagination.machine(initialContext), { context });
|
|
14
19
|
return pagination.connect(state, send, normalizeProps);
|
|
15
20
|
};
|
|
16
21
|
|
|
@@ -3,9 +3,9 @@ import type { ForwardRefExoticComponent, CSSProperties, LegacyRef, Key, AriaRole
|
|
|
3
3
|
import { type HTMLArkProps } from '../factory';
|
|
4
4
|
import type { Assign } from '../types';
|
|
5
5
|
import { type UseSplitterProps, type UseSplitterReturn } from './use-splitter';
|
|
6
|
-
export type SplitterProps = Assign<HTMLArkProps<'div'>,
|
|
6
|
+
export type SplitterProps = Assign<HTMLArkProps<'div'>, UseSplitterProps & {
|
|
7
7
|
children?: ReactNode | ((state: UseSplitterReturn) => ReactNode);
|
|
8
|
-
}
|
|
8
|
+
}>;
|
|
9
9
|
export declare const Splitter: ForwardRefExoticComponent<{
|
|
10
10
|
slot?: string | undefined;
|
|
11
11
|
style?: CSSProperties | undefined;
|
|
@@ -269,8 +269,8 @@ export declare const Splitter: ForwardRefExoticComponent<{
|
|
|
269
269
|
onAnimationIterationCapture?: AnimationEventHandler<HTMLDivElement> | undefined;
|
|
270
270
|
onTransitionEnd?: TransitionEventHandler<HTMLDivElement> | undefined;
|
|
271
271
|
onTransitionEndCapture?: TransitionEventHandler<HTMLDivElement> | undefined;
|
|
272
|
-
dir?: "ltr" | "rtl" | undefined;
|
|
273
272
|
id?: string | undefined;
|
|
273
|
+
dir?: "ltr" | "rtl" | undefined;
|
|
274
274
|
onResize?: ((details: {
|
|
275
275
|
size: {
|
|
276
276
|
id: PanelId;
|
|
@@ -313,5 +313,11 @@ export declare const Splitter: ForwardRefExoticComponent<{
|
|
|
313
313
|
}[];
|
|
314
314
|
activeHandleId: string | null;
|
|
315
315
|
}) => void) | undefined;
|
|
316
|
+
defaultSize?: {
|
|
317
|
+
id: PanelId;
|
|
318
|
+
size?: number | undefined;
|
|
319
|
+
minSize?: number | undefined;
|
|
320
|
+
maxSize?: number | undefined;
|
|
321
|
+
}[] | undefined;
|
|
316
322
|
children?: ReactNode | ((state: UseSplitterReturn) => ReactNode);
|
|
317
323
|
}>;
|
|
@@ -7,15 +7,39 @@ const splitter = require('@zag-js/splitter');
|
|
|
7
7
|
const React = require('react');
|
|
8
8
|
const environmentContext = require('../environment/environment-context.cjs');
|
|
9
9
|
|
|
10
|
+
function _interopNamespaceDefault(e) {
|
|
11
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
12
|
+
if (e) {
|
|
13
|
+
for (const k in e) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: () => e[k]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const splitter__namespace = /*#__PURE__*/_interopNamespaceDefault(splitter);
|
|
28
|
+
|
|
10
29
|
const useSplitter = (props) => {
|
|
11
30
|
const getRootNode = environmentContext.useEnvironmentContext();
|
|
12
|
-
const
|
|
31
|
+
const initialContext = {
|
|
13
32
|
id: React.useId(),
|
|
14
33
|
getRootNode,
|
|
15
|
-
...props
|
|
34
|
+
...props,
|
|
35
|
+
size: props.defaultSize
|
|
36
|
+
};
|
|
37
|
+
const context = {
|
|
38
|
+
...initialContext,
|
|
39
|
+
size: props.size
|
|
16
40
|
};
|
|
17
|
-
const [state, send] = react.useMachine(
|
|
18
|
-
return
|
|
41
|
+
const [state, send] = react.useMachine(splitter__namespace.machine(initialContext), { context });
|
|
42
|
+
return splitter__namespace.connect(state, send, react.normalizeProps);
|
|
19
43
|
};
|
|
20
44
|
|
|
21
45
|
exports.useSplitter = useSplitter;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
|
-
import type { PanelId
|
|
3
|
-
import
|
|
2
|
+
import type { PanelId } from '@zag-js/splitter/dist/splitter.types';
|
|
3
|
+
import * as splitter from '@zag-js/splitter';
|
|
4
4
|
import { type Optional } from '../types';
|
|
5
|
-
export type UseSplitterProps = Optional<Context, 'id'
|
|
5
|
+
export type UseSplitterProps = Optional<splitter.Context, 'id'> & {
|
|
6
|
+
defaultSize?: splitter.Context['size'];
|
|
7
|
+
};
|
|
6
8
|
export type UseSplitterReturn = ReturnType<typeof useSplitter>;
|
|
7
9
|
export declare const useSplitter: (props: UseSplitterProps) => {
|
|
8
10
|
isFocused: boolean;
|
|
@@ -14,7 +16,7 @@ export declare const useSplitter: (props: UseSplitterProps) => {
|
|
|
14
16
|
setToMinSize(id: PanelId): void;
|
|
15
17
|
setToMaxSize(id: PanelId): void;
|
|
16
18
|
setSize(id: PanelId, size: number): void;
|
|
17
|
-
getResizeTriggerState(props: ResizeTriggerProps): {
|
|
19
|
+
getResizeTriggerState(props: splitter.ResizeTriggerProps): {
|
|
18
20
|
isDisabled: boolean;
|
|
19
21
|
isFocused: boolean;
|
|
20
22
|
panelIds: string[];
|
|
@@ -23,6 +25,6 @@ export declare const useSplitter: (props: UseSplitterProps) => {
|
|
|
23
25
|
value: number;
|
|
24
26
|
};
|
|
25
27
|
rootProps: HTMLAttributes<HTMLElement>;
|
|
26
|
-
getPanelProps(props: PanelProps): HTMLAttributes<HTMLElement>;
|
|
27
|
-
getResizeTriggerProps(props: ResizeTriggerProps): HTMLAttributes<HTMLElement>;
|
|
28
|
+
getPanelProps(props: splitter.PanelProps): HTMLAttributes<HTMLElement>;
|
|
29
|
+
getResizeTriggerProps(props: splitter.ResizeTriggerProps): HTMLAttributes<HTMLElement>;
|
|
28
30
|
};
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { useMachine, normalizeProps } from '@zag-js/react';
|
|
2
|
-
import
|
|
2
|
+
import * as splitter from '@zag-js/splitter';
|
|
3
3
|
import { useId } from 'react';
|
|
4
4
|
import { useEnvironmentContext } from '../environment/environment-context.mjs';
|
|
5
5
|
|
|
6
6
|
const useSplitter = (props) => {
|
|
7
7
|
const getRootNode = useEnvironmentContext();
|
|
8
|
-
const
|
|
8
|
+
const initialContext = {
|
|
9
9
|
id: useId(),
|
|
10
10
|
getRootNode,
|
|
11
|
-
...props
|
|
11
|
+
...props,
|
|
12
|
+
size: props.defaultSize
|
|
13
|
+
};
|
|
14
|
+
const context = {
|
|
15
|
+
...initialContext,
|
|
16
|
+
size: props.size
|
|
12
17
|
};
|
|
13
|
-
const [state, send] = useMachine(machine(
|
|
14
|
-
return connect(state, send, normalizeProps);
|
|
18
|
+
const [state, send] = useMachine(splitter.machine(initialContext), { context });
|
|
19
|
+
return splitter.connect(state, send, normalizeProps);
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
export { useSplitter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/react",
|
|
3
|
-
"version": "0.0.0-rc-
|
|
3
|
+
"version": "0.0.0-rc-20230601215329",
|
|
4
4
|
"description": "A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,37 +50,37 @@
|
|
|
50
50
|
"url": "https://github.com/chakra-ui/ark/issues"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@zag-js/accordion": "0.10.
|
|
54
|
-
"@zag-js/anatomy": "0.10.
|
|
55
|
-
"@zag-js/avatar": "0.10.
|
|
56
|
-
"@zag-js/carousel": "0.10.
|
|
57
|
-
"@zag-js/color-picker": "0.10.
|
|
58
|
-
"@zag-js/checkbox": "0.10.
|
|
59
|
-
"@zag-js/combobox": "0.10.
|
|
60
|
-
"@zag-js/date-picker": "0.10.
|
|
61
|
-
"@zag-js/dialog": "0.10.
|
|
62
|
-
"@zag-js/editable": "0.10.
|
|
63
|
-
"@zag-js/hover-card": "0.10.
|
|
64
|
-
"@zag-js/menu": "0.10.
|
|
65
|
-
"@zag-js/number-input": "0.10.
|
|
66
|
-
"@zag-js/pagination": "0.10.
|
|
67
|
-
"@zag-js/pin-input": "0.10.
|
|
68
|
-
"@zag-js/popover": "0.10.
|
|
69
|
-
"@zag-js/pressable": "0.10.
|
|
70
|
-
"@zag-js/radio-group": "0.10.
|
|
71
|
-
"@zag-js/range-slider": "0.10.
|
|
72
|
-
"@zag-js/rating-group": "0.10.
|
|
73
|
-
"@zag-js/react": "0.10.
|
|
74
|
-
"@zag-js/select": "0.10.
|
|
75
|
-
"@zag-js/slider": "0.10.
|
|
76
|
-
"@zag-js/splitter": "0.10.
|
|
77
|
-
"@zag-js/switch": "0.10.
|
|
78
|
-
"@zag-js/tabs": "0.10.
|
|
79
|
-
"@zag-js/tags-input": "0.10.
|
|
80
|
-
"@zag-js/toast": "0.10.
|
|
81
|
-
"@zag-js/tooltip": "0.10.
|
|
82
|
-
"@zag-js/transition": "0.10.
|
|
83
|
-
"@zag-js/types": "0.10.
|
|
53
|
+
"@zag-js/accordion": "0.10.2",
|
|
54
|
+
"@zag-js/anatomy": "0.10.2",
|
|
55
|
+
"@zag-js/avatar": "0.10.2",
|
|
56
|
+
"@zag-js/carousel": "0.10.2",
|
|
57
|
+
"@zag-js/color-picker": "0.10.2",
|
|
58
|
+
"@zag-js/checkbox": "0.10.2",
|
|
59
|
+
"@zag-js/combobox": "0.10.2",
|
|
60
|
+
"@zag-js/date-picker": "0.10.2",
|
|
61
|
+
"@zag-js/dialog": "0.10.2",
|
|
62
|
+
"@zag-js/editable": "0.10.2",
|
|
63
|
+
"@zag-js/hover-card": "0.10.2",
|
|
64
|
+
"@zag-js/menu": "0.10.2",
|
|
65
|
+
"@zag-js/number-input": "0.10.2",
|
|
66
|
+
"@zag-js/pagination": "0.10.2",
|
|
67
|
+
"@zag-js/pin-input": "0.10.2",
|
|
68
|
+
"@zag-js/popover": "0.10.2",
|
|
69
|
+
"@zag-js/pressable": "0.10.2",
|
|
70
|
+
"@zag-js/radio-group": "0.10.2",
|
|
71
|
+
"@zag-js/range-slider": "0.10.2",
|
|
72
|
+
"@zag-js/rating-group": "0.10.2",
|
|
73
|
+
"@zag-js/react": "0.10.2",
|
|
74
|
+
"@zag-js/select": "0.10.2",
|
|
75
|
+
"@zag-js/slider": "0.10.2",
|
|
76
|
+
"@zag-js/splitter": "0.10.2",
|
|
77
|
+
"@zag-js/switch": "0.10.2",
|
|
78
|
+
"@zag-js/tabs": "0.10.2",
|
|
79
|
+
"@zag-js/tags-input": "0.10.2",
|
|
80
|
+
"@zag-js/toast": "0.10.2",
|
|
81
|
+
"@zag-js/tooltip": "0.10.2",
|
|
82
|
+
"@zag-js/transition": "0.10.2",
|
|
83
|
+
"@zag-js/types": "0.10.2"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@testing-library/dom": "9.3.0",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"react-dom": "18.2.0",
|
|
106
106
|
"react-frame-component": "5.2.6",
|
|
107
107
|
"resize-observer-polyfill": "1.5.1",
|
|
108
|
-
"typescript": "5.
|
|
108
|
+
"typescript": "5.1.3",
|
|
109
109
|
"vite": "4.3.9",
|
|
110
110
|
"vite-plugin-dts": "2.3.0",
|
|
111
111
|
"vitest": "0.31.4",
|