@ark-ui/react 4.4.4 → 4.5.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.
Files changed (33) hide show
  1. package/dist/components/collection.cjs +2 -0
  2. package/dist/components/collection.js +3 -2
  3. package/dist/components/color-picker/color-picker-root.cjs +2 -0
  4. package/dist/components/color-picker/color-picker-root.js +2 -0
  5. package/dist/components/color-picker/use-color-picker.cjs +1 -0
  6. package/dist/components/color-picker/use-color-picker.js +1 -0
  7. package/dist/components/date-picker/date-picker-root.cjs +0 -1
  8. package/dist/components/date-picker/date-picker-root.js +0 -1
  9. package/dist/components/file-upload/file-upload.d.cts +1 -1
  10. package/dist/components/file-upload/file-upload.d.ts +1 -1
  11. package/dist/components/file-upload/index.d.cts +1 -1
  12. package/dist/components/file-upload/index.d.ts +1 -1
  13. package/dist/components/index.cjs +1 -0
  14. package/dist/components/index.js +1 -1
  15. package/dist/components/number-input/use-number-input.cjs +2 -1
  16. package/dist/components/number-input/use-number-input.js +2 -1
  17. package/dist/components/presence/use-presence.cjs +4 -1
  18. package/dist/components/presence/use-presence.js +4 -1
  19. package/dist/components/tree-view/index.cjs +1 -0
  20. package/dist/components/tree-view/index.d.cts +5 -5
  21. package/dist/components/tree-view/index.d.ts +5 -5
  22. package/dist/components/tree-view/index.js +1 -1
  23. package/dist/index.cjs +1 -0
  24. package/dist/index.js +1 -1
  25. package/dist/providers/environment/index.d.cts +5 -1
  26. package/dist/providers/environment/index.d.ts +5 -1
  27. package/dist/providers/environment/use-environment-context.d.cts +2 -2
  28. package/dist/providers/environment/use-environment-context.d.ts +2 -2
  29. package/dist/utils/use-debounce.cjs +21 -0
  30. package/dist/utils/use-debounce.d.cts +1 -0
  31. package/dist/utils/use-debounce.d.ts +1 -0
  32. package/dist/utils/use-debounce.js +17 -0
  33. package/package.json +65 -64
@@ -7,6 +7,8 @@ const core = require('@zag-js/core');
7
7
 
8
8
  const createListCollection = (options) => core.ref(new collection.ListCollection(options));
9
9
  const createTreeCollection = (options) => core.ref(new collection.TreeCollection(options));
10
+ const createFileTreeCollection = (paths) => core.ref(collection.filePathToTree(paths));
10
11
 
12
+ exports.createFileTreeCollection = createFileTreeCollection;
11
13
  exports.createListCollection = createListCollection;
12
14
  exports.createTreeCollection = createTreeCollection;
@@ -1,7 +1,8 @@
1
- import { ListCollection, TreeCollection } from '@zag-js/collection';
1
+ import { ListCollection, TreeCollection, filePathToTree } from '@zag-js/collection';
2
2
  import { ref } from '@zag-js/core';
3
3
 
4
4
  const createListCollection = (options) => ref(new ListCollection(options));
5
5
  const createTreeCollection = (options) => ref(new TreeCollection(options));
6
+ const createFileTreeCollection = (paths) => ref(filePathToTree(paths));
6
7
 
7
- export { createListCollection, createTreeCollection };
8
+ export { createFileTreeCollection, createListCollection, createTreeCollection };
@@ -27,6 +27,7 @@ const ColorPickerRoot = react.forwardRef((props, ref) => {
27
27
  "id",
28
28
  "ids",
29
29
  "initialFocusEl",
30
+ "invalid",
30
31
  "name",
31
32
  "name",
32
33
  "onFocusOutside",
@@ -37,6 +38,7 @@ const ColorPickerRoot = react.forwardRef((props, ref) => {
37
38
  "onValueChange",
38
39
  "onValueChangeEnd",
39
40
  "open",
41
+ "openAutoFocus",
40
42
  "positioning",
41
43
  "readOnly",
42
44
  "required",
@@ -23,6 +23,7 @@ const ColorPickerRoot = forwardRef((props, ref) => {
23
23
  "id",
24
24
  "ids",
25
25
  "initialFocusEl",
26
+ "invalid",
26
27
  "name",
27
28
  "name",
28
29
  "onFocusOutside",
@@ -33,6 +34,7 @@ const ColorPickerRoot = forwardRef((props, ref) => {
33
34
  "onValueChange",
34
35
  "onValueChangeEnd",
35
36
  "open",
37
+ "openAutoFocus",
36
38
  "positioning",
37
39
  "readOnly",
38
40
  "required",
@@ -42,6 +42,7 @@ const useColorPicker = (props = {}) => {
42
42
  },
43
43
  dir,
44
44
  disabled: field?.disabled,
45
+ invalid: field?.invalid,
45
46
  readOnly: field?.readOnly,
46
47
  required: field?.required,
47
48
  getRootNode,
@@ -19,6 +19,7 @@ const useColorPicker = (props = {}) => {
19
19
  },
20
20
  dir,
21
21
  disabled: field?.disabled,
22
+ invalid: field?.invalid,
22
23
  readOnly: field?.readOnly,
23
24
  required: field?.required,
24
25
  getRootNode,
@@ -31,7 +31,6 @@ const DatePickerRoot = react.forwardRef((props, ref) => {
31
31
  "locale",
32
32
  "max",
33
33
  "min",
34
- "modal",
35
34
  "name",
36
35
  "numOfMonths",
37
36
  "onFocusChange",
@@ -27,7 +27,6 @@ const DatePickerRoot = forwardRef((props, ref) => {
27
27
  "locale",
28
28
  "max",
29
29
  "min",
30
- "modal",
31
30
  "name",
32
31
  "numOfMonths",
33
32
  "onFocusChange",
@@ -1,4 +1,4 @@
1
- export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails } from '@zag-js/file-upload';
1
+ export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails, FileValidateDetails, } from '@zag-js/file-upload';
2
2
  export { FileUploadClearTrigger as ClearTrigger, type FileUploadClearTriggerBaseProps as ClearTriggerBaseProps, type FileUploadClearTriggerProps as ClearTriggerProps, } from './file-upload-clear-trigger';
3
3
  export { FileUploadContext as Context, type FileUploadContextProps as ContextProps, } from './file-upload-context';
4
4
  export { FileUploadDropzone as Dropzone, type FileUploadDropzoneBaseProps as DropzoneBaseProps, type FileUploadDropzoneProps as DropzoneProps, } from './file-upload-dropzone';
@@ -1,4 +1,4 @@
1
- export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails } from '@zag-js/file-upload';
1
+ export type { FileAcceptDetails, FileChangeDetails, FileRejectDetails, FileValidateDetails, } from '@zag-js/file-upload';
2
2
  export { FileUploadClearTrigger as ClearTrigger, type FileUploadClearTriggerBaseProps as ClearTriggerBaseProps, type FileUploadClearTriggerProps as ClearTriggerProps, } from './file-upload-clear-trigger';
3
3
  export { FileUploadContext as Context, type FileUploadContextProps as ContextProps, } from './file-upload-context';
4
4
  export { FileUploadDropzone as Dropzone, type FileUploadDropzoneBaseProps as DropzoneBaseProps, type FileUploadDropzoneProps as DropzoneProps, } from './file-upload-dropzone';
@@ -1,4 +1,4 @@
1
- export type { FileAcceptDetails as FileUploadFileAcceptDetails, FileChangeDetails as FileUploadFileChangeDetails, FileRejectDetails as FileUploadFileRejectDetails, } from '@zag-js/file-upload';
1
+ export type { FileAcceptDetails as FileUploadFileAcceptDetails, FileChangeDetails as FileUploadFileChangeDetails, FileRejectDetails as FileUploadFileRejectDetails, FileValidateDetails as FileUploadFileValidateDetails, } from '@zag-js/file-upload';
2
2
  export { FileUploadClearTrigger, type FileUploadClearTriggerBaseProps, type FileUploadClearTriggerProps, } from './file-upload-clear-trigger';
3
3
  export { FileUploadContext, type FileUploadContextProps } from './file-upload-context';
4
4
  export { FileUploadDropzone, type FileUploadDropzoneBaseProps, type FileUploadDropzoneProps, } from './file-upload-dropzone';
@@ -1,4 +1,4 @@
1
- export type { FileAcceptDetails as FileUploadFileAcceptDetails, FileChangeDetails as FileUploadFileChangeDetails, FileRejectDetails as FileUploadFileRejectDetails, } from '@zag-js/file-upload';
1
+ export type { FileAcceptDetails as FileUploadFileAcceptDetails, FileChangeDetails as FileUploadFileChangeDetails, FileRejectDetails as FileUploadFileRejectDetails, FileValidateDetails as FileUploadFileValidateDetails, } from '@zag-js/file-upload';
2
2
  export { FileUploadClearTrigger, type FileUploadClearTriggerBaseProps, type FileUploadClearTriggerProps, } from './file-upload-clear-trigger';
3
3
  export { FileUploadContext, type FileUploadContextProps } from './file-upload-context';
4
4
  export { FileUploadDropzone, type FileUploadDropzoneBaseProps, type FileUploadDropzoneProps, } from './file-upload-dropzone';
@@ -724,6 +724,7 @@ exports.colorPickerAnatomy = colorPicker_anatomy.colorPickerAnatomy;
724
724
  exports.useColorPicker = useColorPicker.useColorPicker;
725
725
  exports.useColorPickerContext = useColorPickerContext.useColorPickerContext;
726
726
  exports.ColorPicker = colorPicker$1;
727
+ exports.createFileTreeCollection = collection.createFileTreeCollection;
727
728
  exports.createListCollection = collection.createListCollection;
728
729
  exports.createTreeCollection = collection.createTreeCollection;
729
730
  exports.ComboboxClearTrigger = comboboxClearTrigger.ComboboxClearTrigger;
@@ -108,7 +108,7 @@ export { useColorPicker } from './color-picker/use-color-picker.js';
108
108
  export { useColorPickerContext } from './color-picker/use-color-picker-context.js';
109
109
  import * as colorPicker from './color-picker/color-picker.js';
110
110
  export { colorPicker as ColorPicker };
111
- export { createListCollection, createTreeCollection } from './collection.js';
111
+ export { createFileTreeCollection, createListCollection, createTreeCollection } from './collection.js';
112
112
  export { ComboboxClearTrigger } from './combobox/combobox-clear-trigger.js';
113
113
  export { ComboboxContent } from './combobox/combobox-content.js';
114
114
  export { ComboboxContext } from './combobox/combobox-context.js';
@@ -32,7 +32,7 @@ const numberInput__namespace = /*#__PURE__*/_interopNamespaceDefault(numberInput
32
32
 
33
33
  const useNumberInput = (props = {}) => {
34
34
  const { getRootNode } = useEnvironmentContext.useEnvironmentContext();
35
- const { dir } = useLocaleContext.useLocaleContext();
35
+ const { dir, locale } = useLocaleContext.useLocaleContext();
36
36
  const field = useFieldContext.useFieldContext();
37
37
  const initialContext = {
38
38
  id: react.useId(),
@@ -45,6 +45,7 @@ const useNumberInput = (props = {}) => {
45
45
  required: field?.required,
46
46
  invalid: field?.invalid,
47
47
  dir,
48
+ locale,
48
49
  getRootNode,
49
50
  value: props.defaultValue,
50
51
  ...props
@@ -9,7 +9,7 @@ import { useFieldContext } from '../field/use-field-context.js';
9
9
 
10
10
  const useNumberInput = (props = {}) => {
11
11
  const { getRootNode } = useEnvironmentContext();
12
- const { dir } = useLocaleContext();
12
+ const { dir, locale } = useLocaleContext();
13
13
  const field = useFieldContext();
14
14
  const initialContext = {
15
15
  id: useId(),
@@ -22,6 +22,7 @@ const useNumberInput = (props = {}) => {
22
22
  required: field?.required,
23
23
  invalid: field?.invalid,
24
24
  dir,
25
+ locale,
25
26
  getRootNode,
26
27
  value: props.defaultValue,
27
28
  ...props
@@ -6,6 +6,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6
6
  const presence = require('@zag-js/presence');
7
7
  const react$1 = require('@zag-js/react');
8
8
  const react = require('react');
9
+ const useDebounce = require('../../utils/use-debounce.cjs');
9
10
  const useEvent = require('../../utils/use-event.cjs');
10
11
 
11
12
  function _interopNamespaceDefault(e) {
@@ -30,8 +31,10 @@ const presence__namespace = /*#__PURE__*/_interopNamespaceDefault(presence);
30
31
  const usePresence = (props) => {
31
32
  const { lazyMount, unmountOnExit, ...rest } = props;
32
33
  const wasEverPresent = react.useRef(false);
34
+ const present = useDebounce.useDebounce(props.present, 0);
33
35
  const context = {
34
36
  ...rest,
37
+ present,
35
38
  onExitComplete: useEvent.useEvent(props.onExitComplete)
36
39
  };
37
40
  const [state, send] = react$1.useMachine(presence__namespace.machine(context), { context });
@@ -41,7 +44,7 @@ const usePresence = (props) => {
41
44
  }
42
45
  const unmounted = !api.present && !wasEverPresent.current && lazyMount || unmountOnExit && !api.present && wasEverPresent.current;
43
46
  const getPresenceProps = () => ({
44
- "data-state": props.present ? "open" : "closed",
47
+ "data-state": present ? "open" : "closed",
45
48
  hidden: !api.present
46
49
  });
47
50
  return {
@@ -2,13 +2,16 @@
2
2
  import * as presence from '@zag-js/presence';
3
3
  import { useMachine, normalizeProps } from '@zag-js/react';
4
4
  import { useRef } from 'react';
5
+ import { useDebounce } from '../../utils/use-debounce.js';
5
6
  import { useEvent } from '../../utils/use-event.js';
6
7
 
7
8
  const usePresence = (props) => {
8
9
  const { lazyMount, unmountOnExit, ...rest } = props;
9
10
  const wasEverPresent = useRef(false);
11
+ const present = useDebounce(props.present, 0);
10
12
  const context = {
11
13
  ...rest,
14
+ present,
12
15
  onExitComplete: useEvent(props.onExitComplete)
13
16
  };
14
17
  const [state, send] = useMachine(presence.machine(context), { context });
@@ -18,7 +21,7 @@ const usePresence = (props) => {
18
21
  }
19
22
  const unmounted = !api.present && !wasEverPresent.current && lazyMount || unmountOnExit && !api.present && wasEverPresent.current;
20
23
  const getPresenceProps = () => ({
21
- "data-state": props.present ? "open" : "closed",
24
+ "data-state": present ? "open" : "closed",
22
25
  hidden: !api.present
23
26
  });
24
27
  return {
@@ -26,6 +26,7 @@ const treeView = require('@zag-js/tree-view');
26
26
 
27
27
 
28
28
 
29
+ exports.createFileTreeCollection = collection.createFileTreeCollection;
29
30
  exports.createTreeCollection = collection.createTreeCollection;
30
31
  exports.TreeViewBranch = treeViewBranch.TreeViewBranch;
31
32
  exports.TreeViewBranchContent = treeViewBranchContent.TreeViewBranchContent;
@@ -1,5 +1,5 @@
1
1
  export type { ExpandedChangeDetails as TreeViewExpandedChangeDetails, FocusChangeDetails as TreeViewFocusChangeDetails, SelectionChangeDetails as TreeViewSelectionChangeDetails, } from '@zag-js/tree-view';
2
- export { createTreeCollection, type TreeNode } from '../collection';
2
+ export { createFileTreeCollection, createTreeCollection, type TreeCollection, type TreeNode, } from '../collection';
3
3
  export { TreeViewBranch, type TreeViewBranchBaseProps, type TreeViewBranchProps, } from './tree-view-branch';
4
4
  export { TreeViewBranchContent, type TreeViewBranchContentBaseProps, type TreeViewBranchContentProps, } from './tree-view-branch-content';
5
5
  export { TreeViewBranchControl, type TreeViewBranchControlBaseProps, type TreeViewBranchControlProps, } from './tree-view-branch-control';
@@ -8,15 +8,15 @@ export { TreeViewBranchIndicator, type TreeViewBranchIndicatorBaseProps, type Tr
8
8
  export { TreeViewBranchText, type TreeViewBranchTextBaseProps, type TreeViewBranchTextProps, } from './tree-view-branch-text';
9
9
  export { TreeViewBranchTrigger, type TreeViewBranchTriggerBaseProps, type TreeViewBranchTriggerProps, } from './tree-view-branch-trigger';
10
10
  export { TreeViewContext, type TreeViewContextProps } from './tree-view-context';
11
- export { TreeViewItem, type TreeViewItemBaseProps, type TreeViewItemProps, } from './tree-view-item';
11
+ export { TreeViewItem, type TreeViewItemBaseProps, type TreeViewItemProps } from './tree-view-item';
12
12
  export { TreeViewItemIndicator, type TreeViewItemIndicatorBaseProps, type TreeViewItemIndicatorProps, } from './tree-view-item-indicator';
13
13
  export { TreeViewItemText, type TreeViewItemTextBaseProps, type TreeViewItemTextProps, } from './tree-view-item-text';
14
14
  export { TreeViewLabel, type TreeViewLabelBaseProps, type TreeViewLabelProps, } from './tree-view-label';
15
- export { TreeViewNodeContext, type TreeViewNodeContextProps, } from './tree-view-node-context';
15
+ export { TreeViewNodeContext, type TreeViewNodeContextProps } from './tree-view-node-context';
16
16
  export { TreeViewNodeProvider, type TreeViewNodeProviderBaseProps, type TreeViewNodeProviderProps, } from './tree-view-node-provider';
17
- export { TreeViewRoot, type TreeViewRootBaseProps, type TreeViewRootProps, } from './tree-view-root';
17
+ export { TreeViewRoot, type TreeViewRootBaseProps, type TreeViewRootProps } from './tree-view-root';
18
18
  export { TreeViewRootProvider, type TreeViewRootProviderBaseProps, type TreeViewRootProviderProps, } from './tree-view-root-provider';
19
- export { TreeViewTree, type TreeViewTreeBaseProps, type TreeViewTreeProps, } from './tree-view-tree';
19
+ export { TreeViewTree, type TreeViewTreeBaseProps, type TreeViewTreeProps } from './tree-view-tree';
20
20
  export { treeViewAnatomy } from './tree-view.anatomy';
21
21
  export { useTreeView, type UseTreeViewProps, type UseTreeViewReturn } from './use-tree-view';
22
22
  export * as TreeView from './tree-view';
@@ -1,5 +1,5 @@
1
1
  export type { ExpandedChangeDetails as TreeViewExpandedChangeDetails, FocusChangeDetails as TreeViewFocusChangeDetails, SelectionChangeDetails as TreeViewSelectionChangeDetails, } from '@zag-js/tree-view';
2
- export { createTreeCollection, type TreeNode } from '../collection';
2
+ export { createFileTreeCollection, createTreeCollection, type TreeCollection, type TreeNode, } from '../collection';
3
3
  export { TreeViewBranch, type TreeViewBranchBaseProps, type TreeViewBranchProps, } from './tree-view-branch';
4
4
  export { TreeViewBranchContent, type TreeViewBranchContentBaseProps, type TreeViewBranchContentProps, } from './tree-view-branch-content';
5
5
  export { TreeViewBranchControl, type TreeViewBranchControlBaseProps, type TreeViewBranchControlProps, } from './tree-view-branch-control';
@@ -8,15 +8,15 @@ export { TreeViewBranchIndicator, type TreeViewBranchIndicatorBaseProps, type Tr
8
8
  export { TreeViewBranchText, type TreeViewBranchTextBaseProps, type TreeViewBranchTextProps, } from './tree-view-branch-text';
9
9
  export { TreeViewBranchTrigger, type TreeViewBranchTriggerBaseProps, type TreeViewBranchTriggerProps, } from './tree-view-branch-trigger';
10
10
  export { TreeViewContext, type TreeViewContextProps } from './tree-view-context';
11
- export { TreeViewItem, type TreeViewItemBaseProps, type TreeViewItemProps, } from './tree-view-item';
11
+ export { TreeViewItem, type TreeViewItemBaseProps, type TreeViewItemProps } from './tree-view-item';
12
12
  export { TreeViewItemIndicator, type TreeViewItemIndicatorBaseProps, type TreeViewItemIndicatorProps, } from './tree-view-item-indicator';
13
13
  export { TreeViewItemText, type TreeViewItemTextBaseProps, type TreeViewItemTextProps, } from './tree-view-item-text';
14
14
  export { TreeViewLabel, type TreeViewLabelBaseProps, type TreeViewLabelProps, } from './tree-view-label';
15
- export { TreeViewNodeContext, type TreeViewNodeContextProps, } from './tree-view-node-context';
15
+ export { TreeViewNodeContext, type TreeViewNodeContextProps } from './tree-view-node-context';
16
16
  export { TreeViewNodeProvider, type TreeViewNodeProviderBaseProps, type TreeViewNodeProviderProps, } from './tree-view-node-provider';
17
- export { TreeViewRoot, type TreeViewRootBaseProps, type TreeViewRootProps, } from './tree-view-root';
17
+ export { TreeViewRoot, type TreeViewRootBaseProps, type TreeViewRootProps } from './tree-view-root';
18
18
  export { TreeViewRootProvider, type TreeViewRootProviderBaseProps, type TreeViewRootProviderProps, } from './tree-view-root-provider';
19
- export { TreeViewTree, type TreeViewTreeBaseProps, type TreeViewTreeProps, } from './tree-view-tree';
19
+ export { TreeViewTree, type TreeViewTreeBaseProps, type TreeViewTreeProps } from './tree-view-tree';
20
20
  export { treeViewAnatomy } from './tree-view.anatomy';
21
21
  export { useTreeView, type UseTreeViewProps, type UseTreeViewReturn } from './use-tree-view';
22
22
  export * as TreeView from './tree-view';
@@ -1,4 +1,4 @@
1
- export { createTreeCollection } from '../collection.js';
1
+ export { createFileTreeCollection, createTreeCollection } from '../collection.js';
2
2
  export { TreeViewBranch } from './tree-view-branch.js';
3
3
  export { TreeViewBranchContent } from './tree-view-branch-content.js';
4
4
  export { TreeViewBranchControl } from './tree-view-branch-control.js';
package/dist/index.cjs CHANGED
@@ -728,6 +728,7 @@ exports.colorPickerAnatomy = colorPicker_anatomy.colorPickerAnatomy;
728
728
  exports.useColorPicker = useColorPicker.useColorPicker;
729
729
  exports.useColorPickerContext = useColorPickerContext.useColorPickerContext;
730
730
  exports.ColorPicker = colorPicker$1;
731
+ exports.createFileTreeCollection = collection.createFileTreeCollection;
731
732
  exports.createListCollection = collection.createListCollection;
732
733
  exports.createTreeCollection = collection.createTreeCollection;
733
734
  exports.ComboboxClearTrigger = comboboxClearTrigger.ComboboxClearTrigger;
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ export { useColorPicker } from './components/color-picker/use-color-picker.js';
108
108
  export { useColorPickerContext } from './components/color-picker/use-color-picker-context.js';
109
109
  import * as colorPicker from './components/color-picker/color-picker.js';
110
110
  export { colorPicker as ColorPicker };
111
- export { createListCollection, createTreeCollection } from './components/collection.js';
111
+ export { createFileTreeCollection, createListCollection, createTreeCollection } from './components/collection.js';
112
112
  export { ComboboxClearTrigger } from './components/combobox/combobox-clear-trigger.js';
113
113
  export { ComboboxContent } from './components/combobox/combobox-content.js';
114
114
  export { ComboboxContext } from './components/combobox/combobox-context.js';
@@ -1,2 +1,6 @@
1
1
  export { EnvironmentProvider, type EnvironmentProviderProps } from './environment-provider';
2
- export { useEnvironmentContext, type EnvironmentContext, type RootNode, } from './use-environment-context';
2
+ export { useEnvironmentContext, type UseEnvironmentContext,
3
+ /**
4
+ * @deprecated Use `UseEnvironmentContext` instead.
5
+ */
6
+ type UseEnvironmentContext as EnvironmentContext, type RootNode, } from './use-environment-context';
@@ -1,2 +1,6 @@
1
1
  export { EnvironmentProvider, type EnvironmentProviderProps } from './environment-provider';
2
- export { useEnvironmentContext, type EnvironmentContext, type RootNode, } from './use-environment-context';
2
+ export { useEnvironmentContext, type UseEnvironmentContext,
3
+ /**
4
+ * @deprecated Use `UseEnvironmentContext` instead.
5
+ */
6
+ type UseEnvironmentContext as EnvironmentContext, type RootNode, } from './use-environment-context';
@@ -1,6 +1,6 @@
1
1
  import { Provider } from 'react';
2
2
  export type RootNode = ShadowRoot | Document | Node;
3
- export interface EnvironmentContext {
3
+ export interface UseEnvironmentContext {
4
4
  /**
5
5
  * The root node of the application.
6
6
  * This is used to determine the window and document objects.
@@ -15,4 +15,4 @@ export interface EnvironmentContext {
15
15
  */
16
16
  getWindow(): Window & typeof globalThis;
17
17
  }
18
- export declare const EnvironmentContextProvider: Provider<EnvironmentContext>, useEnvironmentContext: () => EnvironmentContext;
18
+ export declare const EnvironmentContextProvider: Provider<UseEnvironmentContext>, useEnvironmentContext: () => UseEnvironmentContext;
@@ -1,6 +1,6 @@
1
1
  import { Provider } from 'react';
2
2
  export type RootNode = ShadowRoot | Document | Node;
3
- export interface EnvironmentContext {
3
+ export interface UseEnvironmentContext {
4
4
  /**
5
5
  * The root node of the application.
6
6
  * This is used to determine the window and document objects.
@@ -15,4 +15,4 @@ export interface EnvironmentContext {
15
15
  */
16
16
  getWindow(): Window & typeof globalThis;
17
17
  }
18
- export declare const EnvironmentContextProvider: Provider<EnvironmentContext>, useEnvironmentContext: () => EnvironmentContext;
18
+ export declare const EnvironmentContextProvider: Provider<UseEnvironmentContext>, useEnvironmentContext: () => UseEnvironmentContext;
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
+
6
+ const react = require('react');
7
+
8
+ function useDebounce(value, delay) {
9
+ const [debouncedValue, setDebouncedValue] = react.useState(value);
10
+ react.useEffect(() => {
11
+ const timer = setTimeout(() => {
12
+ setDebouncedValue(value);
13
+ }, delay);
14
+ return () => {
15
+ clearTimeout(timer);
16
+ };
17
+ }, [value, delay]);
18
+ return debouncedValue;
19
+ }
20
+
21
+ exports.useDebounce = useDebounce;
@@ -0,0 +1 @@
1
+ export declare function useDebounce<T>(value: T, delay: number): T;
@@ -0,0 +1 @@
1
+ export declare function useDebounce<T>(value: T, delay: number): T;
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+ import { useState, useEffect } from 'react';
3
+
4
+ function useDebounce(value, delay) {
5
+ const [debouncedValue, setDebouncedValue] = useState(value);
6
+ useEffect(() => {
7
+ const timer = setTimeout(() => {
8
+ setDebouncedValue(value);
9
+ }, delay);
10
+ return () => {
11
+ clearTimeout(timer);
12
+ };
13
+ }, [value, delay]);
14
+ return debouncedValue;
15
+ }
16
+
17
+ export { useDebounce };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ark-ui/react",
3
- "version": "4.4.4",
3
+ "version": "4.5.0",
4
4
  "description": "A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.",
5
5
  "keywords": [
6
6
  "accordion",
@@ -134,6 +134,7 @@
134
134
  },
135
135
  "scripts": {
136
136
  "build": "vite build",
137
+ "dev": "bun run storybook",
137
138
  "lint": "biome lint ./src",
138
139
  "test": "vitest",
139
140
  "test:ci": "vitest --run",
@@ -159,88 +160,88 @@
159
160
  },
160
161
  "sideEffects": false,
161
162
  "dependencies": {
162
- "@internationalized/date": "3.5.6",
163
- "@zag-js/accordion": "0.77.1",
164
- "@zag-js/anatomy": "0.77.1",
165
- "@zag-js/auto-resize": "0.77.1",
166
- "@zag-js/avatar": "0.77.1",
167
- "@zag-js/carousel": "0.77.1",
168
- "@zag-js/checkbox": "0.77.1",
169
- "@zag-js/clipboard": "0.77.1",
170
- "@zag-js/collapsible": "0.77.1",
171
- "@zag-js/collection": "0.77.1",
172
- "@zag-js/color-picker": "0.77.1",
173
- "@zag-js/color-utils": "0.77.1",
174
- "@zag-js/combobox": "0.77.1",
175
- "@zag-js/core": "0.77.1",
176
- "@zag-js/date-picker": "0.77.1",
177
- "@zag-js/date-utils": "0.77.1",
178
- "@zag-js/dialog": "0.77.1",
179
- "@zag-js/dom-query": "0.77.1",
180
- "@zag-js/editable": "0.77.1",
181
- "@zag-js/file-upload": "0.77.1",
182
- "@zag-js/file-utils": "0.77.1",
183
- "@zag-js/highlight-word": "0.77.1",
184
- "@zag-js/hover-card": "0.77.1",
185
- "@zag-js/i18n-utils": "0.77.1",
186
- "@zag-js/menu": "0.77.1",
187
- "@zag-js/number-input": "0.77.1",
188
- "@zag-js/pagination": "0.77.1",
189
- "@zag-js/pin-input": "0.77.1",
190
- "@zag-js/popover": "0.77.1",
191
- "@zag-js/presence": "0.77.1",
192
- "@zag-js/progress": "0.77.1",
193
- "@zag-js/qr-code": "0.77.1",
194
- "@zag-js/radio-group": "0.77.1",
195
- "@zag-js/rating-group": "0.77.1",
196
- "@zag-js/react": "0.77.1",
197
- "@zag-js/select": "0.77.1",
198
- "@zag-js/signature-pad": "0.77.1",
199
- "@zag-js/slider": "0.77.1",
200
- "@zag-js/splitter": "0.77.1",
201
- "@zag-js/steps": "0.77.1",
202
- "@zag-js/switch": "0.77.1",
203
- "@zag-js/tabs": "0.77.1",
204
- "@zag-js/tags-input": "0.77.1",
205
- "@zag-js/time-picker": "0.77.1",
206
- "@zag-js/timer": "0.77.1",
207
- "@zag-js/toast": "0.77.1",
208
- "@zag-js/toggle-group": "0.77.1",
209
- "@zag-js/tooltip": "0.77.1",
210
- "@zag-js/tree-view": "0.77.1",
211
- "@zag-js/types": "0.77.1"
163
+ "@internationalized/date": "3.6.0",
164
+ "@zag-js/accordion": "0.78.2",
165
+ "@zag-js/anatomy": "0.78.2",
166
+ "@zag-js/auto-resize": "0.78.2",
167
+ "@zag-js/avatar": "0.78.2",
168
+ "@zag-js/carousel": "0.78.2",
169
+ "@zag-js/checkbox": "0.78.2",
170
+ "@zag-js/clipboard": "0.78.2",
171
+ "@zag-js/collapsible": "0.78.2",
172
+ "@zag-js/collection": "0.78.2",
173
+ "@zag-js/color-picker": "0.78.2",
174
+ "@zag-js/color-utils": "0.78.2",
175
+ "@zag-js/combobox": "0.78.2",
176
+ "@zag-js/core": "0.78.2",
177
+ "@zag-js/date-picker": "0.78.2",
178
+ "@zag-js/date-utils": "0.78.2",
179
+ "@zag-js/dialog": "0.78.2",
180
+ "@zag-js/dom-query": "0.78.2",
181
+ "@zag-js/editable": "0.78.2",
182
+ "@zag-js/file-upload": "0.78.2",
183
+ "@zag-js/file-utils": "0.78.2",
184
+ "@zag-js/highlight-word": "0.78.2",
185
+ "@zag-js/hover-card": "0.78.2",
186
+ "@zag-js/i18n-utils": "0.78.2",
187
+ "@zag-js/menu": "0.78.2",
188
+ "@zag-js/number-input": "0.78.2",
189
+ "@zag-js/pagination": "0.78.2",
190
+ "@zag-js/pin-input": "0.78.2",
191
+ "@zag-js/popover": "0.78.2",
192
+ "@zag-js/presence": "0.78.2",
193
+ "@zag-js/progress": "0.78.2",
194
+ "@zag-js/qr-code": "0.78.2",
195
+ "@zag-js/radio-group": "0.78.2",
196
+ "@zag-js/rating-group": "0.78.2",
197
+ "@zag-js/react": "0.78.2",
198
+ "@zag-js/select": "0.78.2",
199
+ "@zag-js/signature-pad": "0.78.2",
200
+ "@zag-js/slider": "0.78.2",
201
+ "@zag-js/splitter": "0.78.2",
202
+ "@zag-js/steps": "0.78.2",
203
+ "@zag-js/switch": "0.78.2",
204
+ "@zag-js/tabs": "0.78.2",
205
+ "@zag-js/tags-input": "0.78.2",
206
+ "@zag-js/time-picker": "0.78.2",
207
+ "@zag-js/timer": "0.78.2",
208
+ "@zag-js/toast": "0.78.2",
209
+ "@zag-js/toggle-group": "0.78.2",
210
+ "@zag-js/tooltip": "0.78.2",
211
+ "@zag-js/tree-view": "0.78.2",
212
+ "@zag-js/types": "0.78.2"
212
213
  },
213
214
  "devDependencies": {
214
215
  "@biomejs/biome": "1.9.4",
215
216
  "@release-it/keep-a-changelog": "5.0.0",
216
- "@storybook/addon-a11y": "8.4.4",
217
- "@storybook/addon-essentials": "8.4.4",
218
- "@storybook/react-vite": "8.4.4",
219
- "@storybook/react": "8.4.4",
217
+ "@storybook/addon-a11y": "8.4.7",
218
+ "@storybook/addon-essentials": "8.4.7",
219
+ "@storybook/react-vite": "8.4.7",
220
+ "@storybook/react": "8.4.7",
220
221
  "@testing-library/dom": "10.4.0",
221
- "@testing-library/jest-dom": "6.6.1",
222
+ "@testing-library/jest-dom": "6.6.3",
222
223
  "@testing-library/react": "16.0.1",
223
224
  "@testing-library/user-event": "14.5.2",
224
225
  "@types/jsdom": "21.1.7",
225
- "@types/react": "18.3.12",
226
- "@types/react-dom": "18.3.1",
227
- "@vitejs/plugin-react": "4.3.3",
228
- "@zag-js/stringify-state": "0.77.1",
226
+ "@types/react": "18.3.16",
227
+ "@types/react-dom": "18.3.5",
228
+ "@vitejs/plugin-react": "4.3.4",
229
+ "@zag-js/stringify-state": "0.78.2",
229
230
  "clean-package": "2.2.0",
230
231
  "globby": "14.0.2",
231
232
  "jsdom": "25.0.1",
232
- "lucide-react": "0.460.0",
233
+ "lucide-react": "0.462.0",
233
234
  "react": "18.3.1",
234
235
  "react-dom": "18.3.1",
235
236
  "react-frame-component": "5.2.7",
236
- "react-hook-form": "7.53.2",
237
+ "react-hook-form": "7.54.0",
237
238
  "release-it": "17.10.0",
238
239
  "resize-observer-polyfill": "1.5.1",
239
- "storybook": "8.4.4",
240
+ "storybook": "8.4.7",
240
241
  "typescript": "5.6.3",
241
242
  "vite": "5.4.11",
242
243
  "vite-plugin-dts": "4.3.0",
243
- "vitest": "2.1.5",
244
+ "vitest": "2.1.8",
244
245
  "vitest-axe": "1.0.0-pre.3"
245
246
  },
246
247
  "peerDependencies": {