@ark-ui/react 5.0.1 → 5.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/dist/components/download-trigger/download-trigger.cjs +36 -0
- package/dist/components/download-trigger/download-trigger.d.cts +22 -0
- package/dist/components/download-trigger/download-trigger.d.ts +22 -0
- package/dist/components/download-trigger/download-trigger.js +32 -0
- package/dist/components/download-trigger/index.cjs +9 -0
- package/dist/components/download-trigger/index.d.cts +2 -0
- package/dist/components/download-trigger/index.d.ts +2 -0
- package/dist/components/download-trigger/index.js +1 -0
- package/dist/components/field/index.cjs +2 -0
- package/dist/components/field/index.d.cts +1 -0
- package/dist/components/field/index.d.ts +1 -0
- package/dist/components/field/index.js +1 -0
- package/dist/components/index.cjs +4 -0
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/splitter/index.d.cts +1 -1
- package/dist/components/splitter/index.d.ts +1 -1
- package/dist/components/splitter/splitter-panel.cjs +1 -1
- package/dist/components/splitter/splitter-panel.js +1 -1
- package/dist/components/splitter/splitter-resize-trigger.cjs +1 -1
- package/dist/components/splitter/splitter-resize-trigger.js +1 -1
- package/dist/components/splitter/splitter-root.cjs +8 -2
- package/dist/components/splitter/splitter-root.d.cts +2 -1
- package/dist/components/splitter/splitter-root.d.ts +2 -1
- package/dist/components/splitter/splitter-root.js +8 -2
- package/dist/components/splitter/splitter.d.cts +1 -1
- package/dist/components/splitter/splitter.d.ts +1 -1
- package/dist/components/splitter/use-splitter.d.cts +1 -1
- package/dist/components/splitter/use-splitter.d.ts +1 -1
- package/dist/components/toast/toaster.cjs +1 -1
- package/dist/components/toast/toaster.js +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/@zag-js/utils/dist/index.cjs +10 -0
- package/dist/node_modules/@zag-js/utils/dist/index.js +6 -0
- package/dist/types.d.cts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils/compose-refs.cjs +16 -8
- package/dist/utils/compose-refs.d.cts +2 -1
- package/dist/utils/compose-refs.d.ts +2 -1
- package/dist/utils/compose-refs.js +16 -8
- package/package.json +65 -63
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
const fileUtils = require('@zag-js/file-utils');
|
|
7
|
+
const index = require('../../node_modules/@zag-js/utils/dist/index.cjs');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const useEnvironmentContext = require('../../providers/environment/use-environment-context.cjs');
|
|
10
|
+
const factory = require('../factory.cjs');
|
|
11
|
+
|
|
12
|
+
const DownloadTrigger = react.forwardRef((props, ref) => {
|
|
13
|
+
const { fileName, data, mimeType, ...rest } = props;
|
|
14
|
+
const { getWindow } = useEnvironmentContext.useEnvironmentContext();
|
|
15
|
+
const download = (data2) => {
|
|
16
|
+
fileUtils.downloadFile({ file: data2, name: fileName, type: mimeType, win: getWindow() });
|
|
17
|
+
};
|
|
18
|
+
const onClick = (e) => {
|
|
19
|
+
props.onClick?.(e);
|
|
20
|
+
if (e.defaultPrevented) return;
|
|
21
|
+
if (index.isFunction(data)) {
|
|
22
|
+
const maybePromise = data();
|
|
23
|
+
if (maybePromise instanceof Promise) {
|
|
24
|
+
maybePromise.then((data2) => download(data2));
|
|
25
|
+
} else {
|
|
26
|
+
download(maybePromise);
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
download(data);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ref, ...rest, type: "button", onClick });
|
|
33
|
+
});
|
|
34
|
+
DownloadTrigger.displayName = "DownloadTrigger";
|
|
35
|
+
|
|
36
|
+
exports.DownloadTrigger = DownloadTrigger;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FileMimeType } from '@zag-js/file-utils';
|
|
2
|
+
import { MaybePromise } from '../../types';
|
|
3
|
+
import { HTMLProps, PolymorphicProps } from '../factory';
|
|
4
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
5
|
+
export type DownloadableData = string | Blob | File;
|
|
6
|
+
export interface DownloadTriggerBaseProps extends PolymorphicProps {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the file to download
|
|
9
|
+
*/
|
|
10
|
+
fileName: string;
|
|
11
|
+
/**
|
|
12
|
+
* The data to download
|
|
13
|
+
*/
|
|
14
|
+
data: DownloadableData | (() => MaybePromise<DownloadableData>);
|
|
15
|
+
/**
|
|
16
|
+
* The MIME type of the data to download
|
|
17
|
+
*/
|
|
18
|
+
mimeType: FileMimeType;
|
|
19
|
+
}
|
|
20
|
+
export interface DownloadTriggerProps extends HTMLProps<'button'>, DownloadTriggerBaseProps {
|
|
21
|
+
}
|
|
22
|
+
export declare const DownloadTrigger: ForwardRefExoticComponent<DownloadTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FileMimeType } from '@zag-js/file-utils';
|
|
2
|
+
import { MaybePromise } from '../../types';
|
|
3
|
+
import { HTMLProps, PolymorphicProps } from '../factory';
|
|
4
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
5
|
+
export type DownloadableData = string | Blob | File;
|
|
6
|
+
export interface DownloadTriggerBaseProps extends PolymorphicProps {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the file to download
|
|
9
|
+
*/
|
|
10
|
+
fileName: string;
|
|
11
|
+
/**
|
|
12
|
+
* The data to download
|
|
13
|
+
*/
|
|
14
|
+
data: DownloadableData | (() => MaybePromise<DownloadableData>);
|
|
15
|
+
/**
|
|
16
|
+
* The MIME type of the data to download
|
|
17
|
+
*/
|
|
18
|
+
mimeType: FileMimeType;
|
|
19
|
+
}
|
|
20
|
+
export interface DownloadTriggerProps extends HTMLProps<'button'>, DownloadTriggerBaseProps {
|
|
21
|
+
}
|
|
22
|
+
export declare const DownloadTrigger: ForwardRefExoticComponent<DownloadTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { downloadFile } from '@zag-js/file-utils';
|
|
3
|
+
import { isFunction } from '../../node_modules/@zag-js/utils/dist/index.js';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { useEnvironmentContext } from '../../providers/environment/use-environment-context.js';
|
|
6
|
+
import { ark } from '../factory.js';
|
|
7
|
+
|
|
8
|
+
const DownloadTrigger = forwardRef((props, ref) => {
|
|
9
|
+
const { fileName, data, mimeType, ...rest } = props;
|
|
10
|
+
const { getWindow } = useEnvironmentContext();
|
|
11
|
+
const download = (data2) => {
|
|
12
|
+
downloadFile({ file: data2, name: fileName, type: mimeType, win: getWindow() });
|
|
13
|
+
};
|
|
14
|
+
const onClick = (e) => {
|
|
15
|
+
props.onClick?.(e);
|
|
16
|
+
if (e.defaultPrevented) return;
|
|
17
|
+
if (isFunction(data)) {
|
|
18
|
+
const maybePromise = data();
|
|
19
|
+
if (maybePromise instanceof Promise) {
|
|
20
|
+
maybePromise.then((data2) => download(data2));
|
|
21
|
+
} else {
|
|
22
|
+
download(maybePromise);
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
download(data);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ jsx(ark.button, { ref, ...rest, type: "button", onClick });
|
|
29
|
+
});
|
|
30
|
+
DownloadTrigger.displayName = "DownloadTrigger";
|
|
31
|
+
|
|
32
|
+
export { DownloadTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DownloadTrigger } from './download-trigger.js';
|
|
@@ -13,6 +13,7 @@ const fieldRootProvider = require('./field-root-provider.cjs');
|
|
|
13
13
|
const fieldSelect = require('./field-select.cjs');
|
|
14
14
|
const fieldTextarea = require('./field-textarea.cjs');
|
|
15
15
|
const field_anatomy = require('./field.anatomy.cjs');
|
|
16
|
+
const useField = require('./use-field.cjs');
|
|
16
17
|
const useFieldContext = require('./use-field-context.cjs');
|
|
17
18
|
const field = require('./field.cjs');
|
|
18
19
|
|
|
@@ -29,5 +30,6 @@ exports.FieldRootProvider = fieldRootProvider.FieldRootProvider;
|
|
|
29
30
|
exports.FieldSelect = fieldSelect.FieldSelect;
|
|
30
31
|
exports.FieldTextarea = fieldTextarea.FieldTextarea;
|
|
31
32
|
exports.fieldAnatomy = field_anatomy.fieldAnatomy;
|
|
33
|
+
exports.useField = useField.useField;
|
|
32
34
|
exports.useFieldContext = useFieldContext.useFieldContext;
|
|
33
35
|
exports.Field = field;
|
|
@@ -9,5 +9,6 @@ export { FieldRootProvider, type FieldRootProviderBaseProps, type FieldRootProvi
|
|
|
9
9
|
export { FieldSelect, type FieldSelectBaseProps, type FieldSelectProps } from './field-select';
|
|
10
10
|
export { FieldTextarea, type FieldTextareaBaseProps, type FieldTextareaProps } from './field-textarea';
|
|
11
11
|
export { fieldAnatomy } from './field.anatomy';
|
|
12
|
+
export { useField, type UseFieldProps, type UseFieldReturn } from './use-field';
|
|
12
13
|
export { useFieldContext, type UseFieldContext } from './use-field-context';
|
|
13
14
|
export * as Field from './field';
|
|
@@ -9,5 +9,6 @@ export { FieldRootProvider, type FieldRootProviderBaseProps, type FieldRootProvi
|
|
|
9
9
|
export { FieldSelect, type FieldSelectBaseProps, type FieldSelectProps } from './field-select';
|
|
10
10
|
export { FieldTextarea, type FieldTextareaBaseProps, type FieldTextareaProps } from './field-textarea';
|
|
11
11
|
export { fieldAnatomy } from './field.anatomy';
|
|
12
|
+
export { useField, type UseFieldProps, type UseFieldReturn } from './use-field';
|
|
12
13
|
export { useFieldContext, type UseFieldContext } from './use-field-context';
|
|
13
14
|
export * as Field from './field';
|
|
@@ -9,6 +9,7 @@ export { FieldRootProvider } from './field-root-provider.js';
|
|
|
9
9
|
export { FieldSelect } from './field-select.js';
|
|
10
10
|
export { FieldTextarea } from './field-textarea.js';
|
|
11
11
|
export { fieldAnatomy } from './field.anatomy.js';
|
|
12
|
+
export { useField } from './use-field.js';
|
|
12
13
|
export { useFieldContext } from './use-field-context.js';
|
|
13
14
|
import * as field from './field.js';
|
|
14
15
|
export { field as Field };
|
|
@@ -171,6 +171,7 @@ const dialogTrigger = require('./dialog/dialog-trigger.cjs');
|
|
|
171
171
|
const useDialog = require('./dialog/use-dialog.cjs');
|
|
172
172
|
const useDialogContext = require('./dialog/use-dialog-context.cjs');
|
|
173
173
|
const dialog$1 = require('./dialog/dialog.cjs');
|
|
174
|
+
const downloadTrigger = require('./download-trigger/download-trigger.cjs');
|
|
174
175
|
const editableArea = require('./editable/editable-area.cjs');
|
|
175
176
|
const editableCancelTrigger = require('./editable/editable-cancel-trigger.cjs');
|
|
176
177
|
const editableContext = require('./editable/editable-context.cjs');
|
|
@@ -197,6 +198,7 @@ const fieldRootProvider = require('./field/field-root-provider.cjs');
|
|
|
197
198
|
const fieldSelect = require('./field/field-select.cjs');
|
|
198
199
|
const fieldTextarea = require('./field/field-textarea.cjs');
|
|
199
200
|
const field_anatomy = require('./field/field.anatomy.cjs');
|
|
201
|
+
const useField = require('./field/use-field.cjs');
|
|
200
202
|
const useFieldContext = require('./field/use-field-context.cjs');
|
|
201
203
|
const field = require('./field/field.cjs');
|
|
202
204
|
const fieldsetContext = require('./fieldset/fieldset-context.cjs');
|
|
@@ -817,6 +819,7 @@ exports.DialogTrigger = dialogTrigger.DialogTrigger;
|
|
|
817
819
|
exports.useDialog = useDialog.useDialog;
|
|
818
820
|
exports.useDialogContext = useDialogContext.useDialogContext;
|
|
819
821
|
exports.Dialog = dialog$1;
|
|
822
|
+
exports.DownloadTrigger = downloadTrigger.DownloadTrigger;
|
|
820
823
|
exports.EditableArea = editableArea.EditableArea;
|
|
821
824
|
exports.EditableCancelTrigger = editableCancelTrigger.EditableCancelTrigger;
|
|
822
825
|
exports.EditableContext = editableContext.EditableContext;
|
|
@@ -844,6 +847,7 @@ exports.FieldRootProvider = fieldRootProvider.FieldRootProvider;
|
|
|
844
847
|
exports.FieldSelect = fieldSelect.FieldSelect;
|
|
845
848
|
exports.FieldTextarea = fieldTextarea.FieldTextarea;
|
|
846
849
|
exports.fieldAnatomy = field_anatomy.fieldAnatomy;
|
|
850
|
+
exports.useField = useField.useField;
|
|
847
851
|
exports.useFieldContext = useFieldContext.useFieldContext;
|
|
848
852
|
exports.Field = field;
|
|
849
853
|
exports.FieldsetContext = fieldsetContext.FieldsetContext;
|
package/dist/components/index.js
CHANGED
|
@@ -177,6 +177,7 @@ export { useDialog } from './dialog/use-dialog.js';
|
|
|
177
177
|
export { useDialogContext } from './dialog/use-dialog-context.js';
|
|
178
178
|
import * as dialog from './dialog/dialog.js';
|
|
179
179
|
export { dialog as Dialog };
|
|
180
|
+
export { DownloadTrigger } from './download-trigger/download-trigger.js';
|
|
180
181
|
export { EditableArea } from './editable/editable-area.js';
|
|
181
182
|
export { EditableCancelTrigger } from './editable/editable-cancel-trigger.js';
|
|
182
183
|
export { EditableContext } from './editable/editable-context.js';
|
|
@@ -204,6 +205,7 @@ export { FieldRootProvider } from './field/field-root-provider.js';
|
|
|
204
205
|
export { FieldSelect } from './field/field-select.js';
|
|
205
206
|
export { FieldTextarea } from './field/field-textarea.js';
|
|
206
207
|
export { fieldAnatomy } from './field/field.anatomy.js';
|
|
208
|
+
export { useField } from './field/use-field.js';
|
|
207
209
|
export { useFieldContext } from './field/use-field-context.js';
|
|
208
210
|
import * as field from './field/field.js';
|
|
209
211
|
export { field as Field };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ExpandCollapseDetails as SplitterExpandCollapseDetails, PanelData as SplitterPanelData, ResizeDetails as SplitterResizeDetails, ResizeEndDetails as SplitterResizeEndDetails, } from '@zag-js/splitter';
|
|
2
2
|
export { SplitterContext, type SplitterContextProps } from './splitter-context';
|
|
3
3
|
export { SplitterPanel, type SplitterPanelBaseProps, type SplitterPanelProps } from './splitter-panel';
|
|
4
4
|
export { SplitterResizeTrigger, type SplitterResizeTriggerBaseProps, type SplitterResizeTriggerProps, } from './splitter-resize-trigger';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ExpandCollapseDetails as SplitterExpandCollapseDetails, PanelData as SplitterPanelData, ResizeDetails as SplitterResizeDetails, ResizeEndDetails as SplitterResizeEndDetails, } from '@zag-js/splitter';
|
|
2
2
|
export { SplitterContext, type SplitterContextProps } from './splitter-context';
|
|
3
3
|
export { SplitterPanel, type SplitterPanelBaseProps, type SplitterPanelProps } from './splitter-panel';
|
|
4
4
|
export { SplitterResizeTrigger, type SplitterResizeTriggerBaseProps, type SplitterResizeTriggerProps, } from './splitter-resize-trigger';
|
|
@@ -11,7 +11,7 @@ const factory = require('../factory.cjs');
|
|
|
11
11
|
const useSplitterContext = require('./use-splitter-context.cjs');
|
|
12
12
|
|
|
13
13
|
const SplitterPanel = react.forwardRef((props, ref) => {
|
|
14
|
-
const [splitterPanelProps, localProps] = createSplitProps.createSplitProps()(props, ["id"
|
|
14
|
+
const [splitterPanelProps, localProps] = createSplitProps.createSplitProps()(props, ["id"]);
|
|
15
15
|
const splitter = useSplitterContext.useSplitterContext();
|
|
16
16
|
const mergedProps = react$1.mergeProps(splitter.getPanelProps(splitterPanelProps), localProps);
|
|
17
17
|
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
|
|
@@ -7,7 +7,7 @@ import { ark } from '../factory.js';
|
|
|
7
7
|
import { useSplitterContext } from './use-splitter-context.js';
|
|
8
8
|
|
|
9
9
|
const SplitterPanel = forwardRef((props, ref) => {
|
|
10
|
-
const [splitterPanelProps, localProps] = createSplitProps()(props, ["id"
|
|
10
|
+
const [splitterPanelProps, localProps] = createSplitProps()(props, ["id"]);
|
|
11
11
|
const splitter = useSplitterContext();
|
|
12
12
|
const mergedProps = mergeProps(splitter.getPanelProps(splitterPanelProps), localProps);
|
|
13
13
|
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
@@ -11,7 +11,7 @@ const factory = require('../factory.cjs');
|
|
|
11
11
|
const useSplitterContext = require('./use-splitter-context.cjs');
|
|
12
12
|
|
|
13
13
|
const SplitterResizeTrigger = react.forwardRef((props, ref) => {
|
|
14
|
-
const [triggerProps, localProps] = createSplitProps.createSplitProps()(props, ["disabled", "id"
|
|
14
|
+
const [triggerProps, localProps] = createSplitProps.createSplitProps()(props, ["disabled", "id"]);
|
|
15
15
|
const splitter = useSplitterContext.useSplitterContext();
|
|
16
16
|
const mergedProps = react$1.mergeProps(splitter.getResizeTriggerProps(triggerProps), localProps);
|
|
17
17
|
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ref, ...mergedProps });
|
|
@@ -7,7 +7,7 @@ import { ark } from '../factory.js';
|
|
|
7
7
|
import { useSplitterContext } from './use-splitter-context.js';
|
|
8
8
|
|
|
9
9
|
const SplitterResizeTrigger = forwardRef((props, ref) => {
|
|
10
|
-
const [triggerProps, localProps] = createSplitProps()(props, ["disabled", "id"
|
|
10
|
+
const [triggerProps, localProps] = createSplitProps()(props, ["disabled", "id"]);
|
|
11
11
|
const splitter = useSplitterContext();
|
|
12
12
|
const mergedProps = mergeProps(splitter.getResizeTriggerProps(triggerProps), localProps);
|
|
13
13
|
return /* @__PURE__ */ jsx(ark.button, { ref, ...mergedProps });
|
|
@@ -16,9 +16,15 @@ const SplitterRoot = react.forwardRef((props, ref) => {
|
|
|
16
16
|
"defaultSize",
|
|
17
17
|
"id",
|
|
18
18
|
"ids",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"keyboardResizeBy",
|
|
20
|
+
"nonce",
|
|
21
|
+
"onCollapse",
|
|
22
|
+
"onExpand",
|
|
23
|
+
"onResize",
|
|
24
|
+
"onResizeEnd",
|
|
25
|
+
"onResizeStart",
|
|
21
26
|
"orientation",
|
|
27
|
+
"panels",
|
|
22
28
|
"size"
|
|
23
29
|
]);
|
|
24
30
|
const splitter = useSplitter.useSplitter(useSplitterProps);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Assign } from '../../types';
|
|
1
2
|
import { HTMLProps, PolymorphicProps } from '../factory';
|
|
2
3
|
import { UseSplitterProps } from './use-splitter';
|
|
3
4
|
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
4
5
|
export interface SplitterRootBaseProps extends UseSplitterProps, PolymorphicProps {
|
|
5
6
|
}
|
|
6
|
-
export interface SplitterRootProps extends HTMLProps<'div'>, SplitterRootBaseProps {
|
|
7
|
+
export interface SplitterRootProps extends Assign<HTMLProps<'div'>, SplitterRootBaseProps> {
|
|
7
8
|
}
|
|
8
9
|
export declare const SplitterRoot: ForwardRefExoticComponent<SplitterRootProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Assign } from '../../types';
|
|
1
2
|
import { HTMLProps, PolymorphicProps } from '../factory';
|
|
2
3
|
import { UseSplitterProps } from './use-splitter';
|
|
3
4
|
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
4
5
|
export interface SplitterRootBaseProps extends UseSplitterProps, PolymorphicProps {
|
|
5
6
|
}
|
|
6
|
-
export interface SplitterRootProps extends HTMLProps<'div'>, SplitterRootBaseProps {
|
|
7
|
+
export interface SplitterRootProps extends Assign<HTMLProps<'div'>, SplitterRootBaseProps> {
|
|
7
8
|
}
|
|
8
9
|
export declare const SplitterRoot: ForwardRefExoticComponent<SplitterRootProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -12,9 +12,15 @@ const SplitterRoot = forwardRef((props, ref) => {
|
|
|
12
12
|
"defaultSize",
|
|
13
13
|
"id",
|
|
14
14
|
"ids",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"keyboardResizeBy",
|
|
16
|
+
"nonce",
|
|
17
|
+
"onCollapse",
|
|
18
|
+
"onExpand",
|
|
19
|
+
"onResize",
|
|
20
|
+
"onResizeEnd",
|
|
21
|
+
"onResizeStart",
|
|
17
22
|
"orientation",
|
|
23
|
+
"panels",
|
|
18
24
|
"size"
|
|
19
25
|
]);
|
|
20
26
|
const splitter = useSplitter(useSplitterProps);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ExpandCollapseDetails, PanelData, ResizeDetails, ResizeEndDetails } from '@zag-js/splitter';
|
|
2
2
|
export { SplitterContext as Context, type SplitterContextProps as ContextProps } from './splitter-context';
|
|
3
3
|
export { SplitterPanel as Panel, type SplitterPanelBaseProps as PanelBaseProps, type SplitterPanelProps as PanelProps, } from './splitter-panel';
|
|
4
4
|
export { SplitterResizeTrigger as ResizeTrigger, type SplitterResizeTriggerBaseProps as ResizeTriggerBaseProps, type SplitterResizeTriggerProps as ResizeTriggerProps, } from './splitter-resize-trigger';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ExpandCollapseDetails, PanelData, ResizeDetails, ResizeEndDetails } from '@zag-js/splitter';
|
|
2
2
|
export { SplitterContext as Context, type SplitterContextProps as ContextProps } from './splitter-context';
|
|
3
3
|
export { SplitterPanel as Panel, type SplitterPanelBaseProps as PanelBaseProps, type SplitterPanelProps as PanelProps, } from './splitter-panel';
|
|
4
4
|
export { SplitterResizeTrigger as ResizeTrigger, type SplitterResizeTriggerBaseProps as ResizeTriggerBaseProps, type SplitterResizeTriggerProps as ResizeTriggerProps, } from './splitter-resize-trigger';
|
|
@@ -5,4 +5,4 @@ export interface UseSplitterProps extends Optional<Omit<splitter.Props, 'dir' |
|
|
|
5
5
|
}
|
|
6
6
|
export interface UseSplitterReturn extends splitter.Api<PropTypes> {
|
|
7
7
|
}
|
|
8
|
-
export declare const useSplitter: (props
|
|
8
|
+
export declare const useSplitter: (props: UseSplitterProps) => UseSplitterReturn;
|
|
@@ -5,4 +5,4 @@ export interface UseSplitterProps extends Optional<Omit<splitter.Props, 'dir' |
|
|
|
5
5
|
}
|
|
6
6
|
export interface UseSplitterReturn extends splitter.Api<PropTypes> {
|
|
7
7
|
}
|
|
8
|
-
export declare const useSplitter: (props
|
|
8
|
+
export declare const useSplitter: (props: UseSplitterProps) => UseSplitterReturn;
|
|
@@ -39,7 +39,7 @@ const Toaster = react.forwardRef((props, ref) => {
|
|
|
39
39
|
store: toaster,
|
|
40
40
|
id: react.useId(),
|
|
41
41
|
dir: locale?.dir,
|
|
42
|
-
getRootNode:
|
|
42
|
+
getRootNode: env?.getRootNode
|
|
43
43
|
});
|
|
44
44
|
const api = toast__namespace.group.connect(service, react$1.normalizeProps);
|
|
45
45
|
const mergedProps = react$1.mergeProps(api.getGroupProps(), localProps);
|
|
@@ -16,7 +16,7 @@ const Toaster = forwardRef((props, ref) => {
|
|
|
16
16
|
store: toaster,
|
|
17
17
|
id: useId(),
|
|
18
18
|
dir: locale?.dir,
|
|
19
|
-
getRootNode:
|
|
19
|
+
getRootNode: env?.getRootNode
|
|
20
20
|
});
|
|
21
21
|
const api = toast.group.connect(service, normalizeProps);
|
|
22
22
|
const mergedProps = mergeProps(api.getGroupProps(), localProps);
|
package/dist/index.cjs
CHANGED
|
@@ -171,6 +171,7 @@ const dialogTrigger = require('./components/dialog/dialog-trigger.cjs');
|
|
|
171
171
|
const useDialog = require('./components/dialog/use-dialog.cjs');
|
|
172
172
|
const useDialogContext = require('./components/dialog/use-dialog-context.cjs');
|
|
173
173
|
const dialog$1 = require('./components/dialog/dialog.cjs');
|
|
174
|
+
const downloadTrigger = require('./components/download-trigger/download-trigger.cjs');
|
|
174
175
|
const editableArea = require('./components/editable/editable-area.cjs');
|
|
175
176
|
const editableCancelTrigger = require('./components/editable/editable-cancel-trigger.cjs');
|
|
176
177
|
const editableContext = require('./components/editable/editable-context.cjs');
|
|
@@ -197,6 +198,7 @@ const fieldRootProvider = require('./components/field/field-root-provider.cjs');
|
|
|
197
198
|
const fieldSelect = require('./components/field/field-select.cjs');
|
|
198
199
|
const fieldTextarea = require('./components/field/field-textarea.cjs');
|
|
199
200
|
const field_anatomy = require('./components/field/field.anatomy.cjs');
|
|
201
|
+
const useField = require('./components/field/use-field.cjs');
|
|
200
202
|
const useFieldContext = require('./components/field/use-field-context.cjs');
|
|
201
203
|
const field = require('./components/field/field.cjs');
|
|
202
204
|
const fieldsetContext = require('./components/fieldset/fieldset-context.cjs');
|
|
@@ -821,6 +823,7 @@ exports.DialogTrigger = dialogTrigger.DialogTrigger;
|
|
|
821
823
|
exports.useDialog = useDialog.useDialog;
|
|
822
824
|
exports.useDialogContext = useDialogContext.useDialogContext;
|
|
823
825
|
exports.Dialog = dialog$1;
|
|
826
|
+
exports.DownloadTrigger = downloadTrigger.DownloadTrigger;
|
|
824
827
|
exports.EditableArea = editableArea.EditableArea;
|
|
825
828
|
exports.EditableCancelTrigger = editableCancelTrigger.EditableCancelTrigger;
|
|
826
829
|
exports.EditableContext = editableContext.EditableContext;
|
|
@@ -848,6 +851,7 @@ exports.FieldRootProvider = fieldRootProvider.FieldRootProvider;
|
|
|
848
851
|
exports.FieldSelect = fieldSelect.FieldSelect;
|
|
849
852
|
exports.FieldTextarea = fieldTextarea.FieldTextarea;
|
|
850
853
|
exports.fieldAnatomy = field_anatomy.fieldAnatomy;
|
|
854
|
+
exports.useField = useField.useField;
|
|
851
855
|
exports.useFieldContext = useFieldContext.useFieldContext;
|
|
852
856
|
exports.Field = field;
|
|
853
857
|
exports.FieldsetContext = fieldsetContext.FieldsetContext;
|
package/dist/index.js
CHANGED
|
@@ -177,6 +177,7 @@ export { useDialog } from './components/dialog/use-dialog.js';
|
|
|
177
177
|
export { useDialogContext } from './components/dialog/use-dialog-context.js';
|
|
178
178
|
import * as dialog from './components/dialog/dialog.js';
|
|
179
179
|
export { dialog as Dialog };
|
|
180
|
+
export { DownloadTrigger } from './components/download-trigger/download-trigger.js';
|
|
180
181
|
export { EditableArea } from './components/editable/editable-area.js';
|
|
181
182
|
export { EditableCancelTrigger } from './components/editable/editable-cancel-trigger.js';
|
|
182
183
|
export { EditableContext } from './components/editable/editable-context.js';
|
|
@@ -204,6 +205,7 @@ export { FieldRootProvider } from './components/field/field-root-provider.js';
|
|
|
204
205
|
export { FieldSelect } from './components/field/field-select.js';
|
|
205
206
|
export { FieldTextarea } from './components/field/field-textarea.js';
|
|
206
207
|
export { fieldAnatomy } from './components/field/field.anatomy.js';
|
|
208
|
+
export { useField } from './components/field/use-field.js';
|
|
207
209
|
export { useFieldContext } from './components/field/use-field-context.js';
|
|
208
210
|
import * as field from './components/field/field.js';
|
|
209
211
|
export { field as Field };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
// src/array.ts
|
|
6
|
+
var isFunction = (v) => typeof v === "function";
|
|
7
|
+
var fnToString = Function.prototype.toString;
|
|
8
|
+
fnToString.call(Object);
|
|
9
|
+
|
|
10
|
+
exports.isFunction = isFunction;
|
package/dist/types.d.cts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -2,17 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
function setRef(ref, value) {
|
|
6
|
-
if (typeof ref === "function") {
|
|
7
|
-
ref(value);
|
|
8
|
-
} else if (ref !== null && ref !== void 0) {
|
|
9
|
-
ref.current = value;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
5
|
function composeRefs(...refs) {
|
|
13
6
|
return (node) => {
|
|
7
|
+
const cleanUps = [];
|
|
14
8
|
for (const ref of refs) {
|
|
15
|
-
|
|
9
|
+
if (typeof ref === "function") {
|
|
10
|
+
const cb = ref(node);
|
|
11
|
+
if (typeof cb === "function") {
|
|
12
|
+
cleanUps.push(cb);
|
|
13
|
+
}
|
|
14
|
+
} else if (ref) {
|
|
15
|
+
ref.current = node;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (cleanUps.length) {
|
|
19
|
+
return () => {
|
|
20
|
+
for (const cleanUp of cleanUps) {
|
|
21
|
+
cleanUp();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
16
24
|
}
|
|
17
25
|
};
|
|
18
26
|
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
function setRef(ref, value) {
|
|
2
|
-
if (typeof ref === "function") {
|
|
3
|
-
ref(value);
|
|
4
|
-
} else if (ref !== null && ref !== void 0) {
|
|
5
|
-
ref.current = value;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
1
|
function composeRefs(...refs) {
|
|
9
2
|
return (node) => {
|
|
3
|
+
const cleanUps = [];
|
|
10
4
|
for (const ref of refs) {
|
|
11
|
-
|
|
5
|
+
if (typeof ref === "function") {
|
|
6
|
+
const cb = ref(node);
|
|
7
|
+
if (typeof cb === "function") {
|
|
8
|
+
cleanUps.push(cb);
|
|
9
|
+
}
|
|
10
|
+
} else if (ref) {
|
|
11
|
+
ref.current = node;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (cleanUps.length) {
|
|
15
|
+
return () => {
|
|
16
|
+
for (const cleanUp of cleanUps) {
|
|
17
|
+
cleanUp();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
12
20
|
}
|
|
13
21
|
};
|
|
14
22
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0
|
|
4
|
+
"version": "5.2.0",
|
|
5
5
|
"description": "A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"accordion",
|
|
@@ -134,6 +134,7 @@
|
|
|
134
134
|
"dev": "bun run storybook",
|
|
135
135
|
"lint": "biome lint ./src",
|
|
136
136
|
"test": "vitest",
|
|
137
|
+
"test:coverage": "vitest run --coverage",
|
|
137
138
|
"test:ci": "vitest --run",
|
|
138
139
|
"typecheck": "tsc",
|
|
139
140
|
"storybook": "storybook dev -p 6006",
|
|
@@ -147,66 +148,66 @@
|
|
|
147
148
|
"sideEffects": false,
|
|
148
149
|
"dependencies": {
|
|
149
150
|
"@internationalized/date": "3.7.0",
|
|
150
|
-
"@zag-js/accordion": "1.
|
|
151
|
-
"@zag-js/anatomy": "1.
|
|
152
|
-
"@zag-js/auto-resize": "1.
|
|
153
|
-
"@zag-js/avatar": "1.
|
|
154
|
-
"@zag-js/carousel": "1.
|
|
155
|
-
"@zag-js/checkbox": "1.
|
|
156
|
-
"@zag-js/clipboard": "1.
|
|
157
|
-
"@zag-js/collapsible": "1.
|
|
158
|
-
"@zag-js/collection": "1.
|
|
159
|
-
"@zag-js/color-picker": "1.
|
|
160
|
-
"@zag-js/color-utils": "1.
|
|
161
|
-
"@zag-js/combobox": "1.
|
|
162
|
-
"@zag-js/core": "1.
|
|
163
|
-
"@zag-js/date-picker": "1.
|
|
164
|
-
"@zag-js/date-utils": "1.
|
|
165
|
-
"@zag-js/dialog": "1.
|
|
166
|
-
"@zag-js/dom-query": "1.
|
|
167
|
-
"@zag-js/editable": "1.
|
|
168
|
-
"@zag-js/file-upload": "1.
|
|
169
|
-
"@zag-js/file-utils": "1.
|
|
170
|
-
"@zag-js/focus-trap": "1.
|
|
171
|
-
"@zag-js/highlight-word": "1.
|
|
172
|
-
"@zag-js/hover-card": "1.
|
|
173
|
-
"@zag-js/i18n-utils": "1.
|
|
174
|
-
"@zag-js/menu": "1.
|
|
175
|
-
"@zag-js/number-input": "1.
|
|
176
|
-
"@zag-js/pagination": "1.
|
|
177
|
-
"@zag-js/pin-input": "1.
|
|
178
|
-
"@zag-js/popover": "1.
|
|
179
|
-
"@zag-js/presence": "1.
|
|
180
|
-
"@zag-js/progress": "1.
|
|
181
|
-
"@zag-js/qr-code": "1.
|
|
182
|
-
"@zag-js/radio-group": "1.
|
|
183
|
-
"@zag-js/rating-group": "1.
|
|
184
|
-
"@zag-js/react": "1.
|
|
185
|
-
"@zag-js/select": "1.
|
|
186
|
-
"@zag-js/signature-pad": "1.
|
|
187
|
-
"@zag-js/slider": "1.
|
|
188
|
-
"@zag-js/splitter": "1.
|
|
189
|
-
"@zag-js/steps": "1.
|
|
190
|
-
"@zag-js/switch": "1.
|
|
191
|
-
"@zag-js/tabs": "1.
|
|
192
|
-
"@zag-js/tags-input": "1.
|
|
193
|
-
"@zag-js/time-picker": "1.
|
|
194
|
-
"@zag-js/timer": "1.
|
|
195
|
-
"@zag-js/toast": "1.
|
|
196
|
-
"@zag-js/toggle": "1.
|
|
197
|
-
"@zag-js/toggle-group": "1.
|
|
198
|
-
"@zag-js/tooltip": "1.
|
|
199
|
-
"@zag-js/tour": "1.
|
|
200
|
-
"@zag-js/tree-view": "1.
|
|
201
|
-
"@zag-js/types": "1.
|
|
151
|
+
"@zag-js/accordion": "1.5.0",
|
|
152
|
+
"@zag-js/anatomy": "1.5.0",
|
|
153
|
+
"@zag-js/auto-resize": "1.5.0",
|
|
154
|
+
"@zag-js/avatar": "1.5.0",
|
|
155
|
+
"@zag-js/carousel": "1.5.0",
|
|
156
|
+
"@zag-js/checkbox": "1.5.0",
|
|
157
|
+
"@zag-js/clipboard": "1.5.0",
|
|
158
|
+
"@zag-js/collapsible": "1.5.0",
|
|
159
|
+
"@zag-js/collection": "1.5.0",
|
|
160
|
+
"@zag-js/color-picker": "1.5.0",
|
|
161
|
+
"@zag-js/color-utils": "1.5.0",
|
|
162
|
+
"@zag-js/combobox": "1.5.0",
|
|
163
|
+
"@zag-js/core": "1.5.0",
|
|
164
|
+
"@zag-js/date-picker": "1.5.0",
|
|
165
|
+
"@zag-js/date-utils": "1.5.0",
|
|
166
|
+
"@zag-js/dialog": "1.5.0",
|
|
167
|
+
"@zag-js/dom-query": "1.5.0",
|
|
168
|
+
"@zag-js/editable": "1.5.0",
|
|
169
|
+
"@zag-js/file-upload": "1.5.0",
|
|
170
|
+
"@zag-js/file-utils": "1.5.0",
|
|
171
|
+
"@zag-js/focus-trap": "1.5.0",
|
|
172
|
+
"@zag-js/highlight-word": "1.5.0",
|
|
173
|
+
"@zag-js/hover-card": "1.5.0",
|
|
174
|
+
"@zag-js/i18n-utils": "1.5.0",
|
|
175
|
+
"@zag-js/menu": "1.5.0",
|
|
176
|
+
"@zag-js/number-input": "1.5.0",
|
|
177
|
+
"@zag-js/pagination": "1.5.0",
|
|
178
|
+
"@zag-js/pin-input": "1.5.0",
|
|
179
|
+
"@zag-js/popover": "1.5.0",
|
|
180
|
+
"@zag-js/presence": "1.5.0",
|
|
181
|
+
"@zag-js/progress": "1.5.0",
|
|
182
|
+
"@zag-js/qr-code": "1.5.0",
|
|
183
|
+
"@zag-js/radio-group": "1.5.0",
|
|
184
|
+
"@zag-js/rating-group": "1.5.0",
|
|
185
|
+
"@zag-js/react": "1.5.0",
|
|
186
|
+
"@zag-js/select": "1.5.0",
|
|
187
|
+
"@zag-js/signature-pad": "1.5.0",
|
|
188
|
+
"@zag-js/slider": "1.5.0",
|
|
189
|
+
"@zag-js/splitter": "1.5.0",
|
|
190
|
+
"@zag-js/steps": "1.5.0",
|
|
191
|
+
"@zag-js/switch": "1.5.0",
|
|
192
|
+
"@zag-js/tabs": "1.5.0",
|
|
193
|
+
"@zag-js/tags-input": "1.5.0",
|
|
194
|
+
"@zag-js/time-picker": "1.5.0",
|
|
195
|
+
"@zag-js/timer": "1.5.0",
|
|
196
|
+
"@zag-js/toast": "1.5.0",
|
|
197
|
+
"@zag-js/toggle": "1.5.0",
|
|
198
|
+
"@zag-js/toggle-group": "1.5.0",
|
|
199
|
+
"@zag-js/tooltip": "1.5.0",
|
|
200
|
+
"@zag-js/tour": "1.5.0",
|
|
201
|
+
"@zag-js/tree-view": "1.5.0",
|
|
202
|
+
"@zag-js/types": "1.5.0"
|
|
202
203
|
},
|
|
203
204
|
"devDependencies": {
|
|
204
205
|
"@biomejs/biome": "1.9.4",
|
|
205
206
|
"@release-it/keep-a-changelog": "6.0.0",
|
|
206
|
-
"@storybook/addon-a11y": "8.6.
|
|
207
|
-
"@storybook/addon-essentials": "8.6.
|
|
208
|
-
"@storybook/react": "8.6.
|
|
209
|
-
"@storybook/react-vite": "8.6.
|
|
207
|
+
"@storybook/addon-a11y": "8.6.7",
|
|
208
|
+
"@storybook/addon-essentials": "8.6.7",
|
|
209
|
+
"@storybook/react": "8.6.7",
|
|
210
|
+
"@storybook/react-vite": "8.6.7",
|
|
210
211
|
"@testing-library/dom": "10.4.0",
|
|
211
212
|
"@testing-library/jest-dom": "6.6.3",
|
|
212
213
|
"@testing-library/react": "16.2.0",
|
|
@@ -215,22 +216,23 @@
|
|
|
215
216
|
"@types/react": "19.0.10",
|
|
216
217
|
"@types/react-dom": "19.0.4",
|
|
217
218
|
"@vitejs/plugin-react": "4.3.4",
|
|
218
|
-
"@zag-js/stringify-state": "1.
|
|
219
|
+
"@zag-js/stringify-state": "1.5.0",
|
|
219
220
|
"clean-package": "2.2.0",
|
|
220
221
|
"globby": "14.1.0",
|
|
221
|
-
"happy-dom": "17.4.
|
|
222
|
-
"lucide-react": "0.
|
|
222
|
+
"happy-dom": "17.4.4",
|
|
223
|
+
"lucide-react": "0.482.0",
|
|
223
224
|
"react": "19.0.0",
|
|
224
225
|
"react-dom": "19.0.0",
|
|
225
226
|
"react-frame-component": "5.2.7",
|
|
226
227
|
"react-hook-form": "7.54.2",
|
|
227
228
|
"release-it": "18.1.2",
|
|
228
229
|
"resize-observer-polyfill": "1.5.1",
|
|
229
|
-
"storybook": "8.6.
|
|
230
|
+
"storybook": "8.6.7",
|
|
230
231
|
"typescript": "5.8.2",
|
|
231
|
-
"vite": "6.2.
|
|
232
|
+
"vite": "6.2.2",
|
|
232
233
|
"vite-plugin-dts": "4.5.3",
|
|
233
|
-
"vitest": "3.0.
|
|
234
|
+
"vitest": "3.0.9",
|
|
235
|
+
"@vitest/coverage-v8": "3.0.9",
|
|
234
236
|
"vitest-axe": "1.0.0-pre.5"
|
|
235
237
|
},
|
|
236
238
|
"peerDependencies": {
|