@ark-ui/react 0.13.1 → 0.14.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 (121) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/accordion/accordion-context.d.ts +2 -9
  3. package/accordion/accordion.cjs +3 -2
  4. package/accordion/accordion.d.ts +2 -2
  5. package/accordion/accordion.mjs +3 -2
  6. package/accordion/index.d.ts +4 -4
  7. package/accordion/use-accordion.d.ts +2 -7
  8. package/avatar/avatar-context.d.ts +2 -9
  9. package/avatar/use-avatar.d.ts +2 -7
  10. package/carousel/carousel-context.d.ts +2 -9
  11. package/carousel/carousel.d.ts +3 -3
  12. package/carousel/index.d.ts +7 -12
  13. package/carousel/use-carousel.d.ts +2 -7
  14. package/checkbox/checkbox-context.d.ts +2 -9
  15. package/checkbox/checkbox.d.ts +3 -3
  16. package/checkbox/index.d.ts +7 -13
  17. package/checkbox/use-checkbox.d.ts +2 -7
  18. package/color-picker/color-picker-context.d.ts +2 -9
  19. package/color-picker/use-color-picker.d.ts +2 -7
  20. package/combobox/combobox-context.d.ts +2 -9
  21. package/combobox/combobox.cjs +0 -1
  22. package/combobox/combobox.d.ts +1 -1
  23. package/combobox/combobox.mjs +0 -1
  24. package/combobox/index.d.ts +7 -12
  25. package/combobox/use-combobox.d.ts +2 -7
  26. package/compose-refs.cjs +0 -1
  27. package/compose-refs.mjs +0 -1
  28. package/date-picker/date-picker-context.d.ts +2 -9
  29. package/date-picker/use-date-picker.d.ts +2 -7
  30. package/dialog/dialog-context.d.ts +2 -9
  31. package/dialog/use-dialog.d.ts +2 -7
  32. package/editable/editable-context.d.ts +2 -9
  33. package/editable/editable.d.ts +3 -3
  34. package/editable/index.d.ts +7 -12
  35. package/editable/use-editable.d.ts +2 -7
  36. package/factory.cjs +2 -2
  37. package/factory.mjs +1 -1
  38. package/hover-card/hover-card-context.d.ts +2 -9
  39. package/hover-card/use-hover-card.d.ts +2 -7
  40. package/index.cjs +0 -2
  41. package/index.mjs +0 -1
  42. package/menu/index.d.ts +2 -2
  43. package/menu/menu-item.d.ts +5 -8
  44. package/menu/use-menu.d.ts +1 -1
  45. package/number-input/index.d.ts +2 -2
  46. package/number-input/number-input-context.d.ts +2 -9
  47. package/number-input/number-input.d.ts +1 -1
  48. package/number-input/use-number-input.d.ts +2 -7
  49. package/package.json +49 -48
  50. package/pagination/index.d.ts +5 -11
  51. package/pagination/pagination-context.d.ts +2 -9
  52. package/pagination/pagination.d.ts +2 -2
  53. package/pagination/use-pagination.d.ts +2 -7
  54. package/pin-input/index.d.ts +2 -2
  55. package/pin-input/pin-input-context.d.ts +2 -9
  56. package/pin-input/pin-input.d.ts +1 -1
  57. package/pin-input/use-pin-input.d.ts +2 -7
  58. package/popover/popover-context.d.ts +2 -9
  59. package/popover/use-popover.d.ts +2 -7
  60. package/presence/use-presence.d.ts +1 -1
  61. package/pressable/use-pressable.d.ts +2 -7
  62. package/radio-group/index.d.ts +2 -2
  63. package/radio-group/radio-group-context.d.ts +2 -9
  64. package/radio-group/radio-group.d.ts +1 -1
  65. package/radio-group/use-radio-group.d.ts +2 -7
  66. package/range-slider/index.d.ts +8 -16
  67. package/range-slider/range-slider-context.d.ts +2 -9
  68. package/range-slider/range-slider.cjs +3 -0
  69. package/range-slider/range-slider.d.ts +1 -1
  70. package/range-slider/range-slider.mjs +3 -0
  71. package/range-slider/use-range-slider.d.ts +2 -7
  72. package/rating-group/index.d.ts +6 -8
  73. package/rating-group/rating-group-context.d.ts +2 -9
  74. package/rating-group/rating-group-control.d.ts +2 -2
  75. package/rating-group/rating-group.d.ts +1 -1
  76. package/rating-group/use-rating-group.d.ts +2 -7
  77. package/segment-group/index.d.ts +2 -2
  78. package/segment-group/segment-group-context.d.ts +2 -9
  79. package/segment-group/segment-group.d.ts +1 -1
  80. package/segment-group/use-segment-group.d.ts +2 -7
  81. package/select/select-context.d.ts +2 -9
  82. package/select/use-select.d.ts +2 -7
  83. package/slider/index.d.ts +5 -15
  84. package/slider/slider-context.d.ts +2 -9
  85. package/slider/slider.cjs +2 -0
  86. package/slider/slider.mjs +2 -0
  87. package/slider/use-slider.d.ts +2 -7
  88. package/splitter/index.d.ts +7 -12
  89. package/splitter/splitter-context.d.ts +2 -9
  90. package/splitter/splitter.d.ts +1 -1
  91. package/splitter/use-splitter.d.ts +2 -7
  92. package/switch/index.cjs +0 -3
  93. package/switch/index.d.ts +6 -19
  94. package/switch/index.mjs +1 -3
  95. package/switch/switch-context.d.ts +2 -9
  96. package/switch/switch-control.cjs +5 -2
  97. package/switch/switch-control.mjs +6 -3
  98. package/switch/switch.d.ts +2 -2
  99. package/switch/use-switch.d.ts +2 -7
  100. package/tabs/index.d.ts +2 -2
  101. package/tabs/tabs-context.d.ts +2 -9
  102. package/tabs/tabs.d.ts +1 -1
  103. package/tabs/use-tabs.cjs +21 -2
  104. package/tabs/use-tabs.d.ts +5 -10
  105. package/tabs/use-tabs.mjs +3 -3
  106. package/tags-input/index.d.ts +2 -2
  107. package/tags-input/tags-input-context.d.ts +2 -9
  108. package/tags-input/tags-input.cjs +1 -2
  109. package/tags-input/tags-input.d.ts +2 -2
  110. package/tags-input/tags-input.mjs +1 -2
  111. package/tags-input/use-tags-input.d.ts +2 -7
  112. package/toast/index.d.ts +1 -1
  113. package/toast/toast-group.d.ts +2 -2
  114. package/toast/toast-item-context.d.ts +2 -9
  115. package/toast/toast-provider.d.ts +2 -57
  116. package/toast/use-toast-item.d.ts +2 -7
  117. package/tooltip/tooltip-context.d.ts +2 -9
  118. package/tooltip/use-tooltip.d.ts +2 -7
  119. package/switch/switch-input.cjs +0 -19
  120. package/switch/switch-input.d.ts +0 -8
  121. package/switch/switch-input.mjs +0 -15
package/switch/index.d.ts CHANGED
@@ -1,12 +1,10 @@
1
- import { PublicApi } from '@zag-js/switch';
2
- import { UseSwitchProps } from './use-switch';
1
+ import { UseSwitchProps, UseSwitchReturn } from './use-switch';
3
2
  import { Assign } from '../types';
4
- import { ForwardRefExoticComponent, DetailedHTMLProps, LabelHTMLAttributes, RefObject, ReactNode, HTMLAttributes, CSSProperties, RefAttributes, InputHTMLAttributes } from 'react';
3
+ import { ForwardRefExoticComponent, DetailedHTMLProps, LabelHTMLAttributes, RefObject, ReactNode, RefAttributes, HTMLAttributes } from 'react';
5
4
  /// <reference types="react" />
6
5
  import { type SwitchProps } from './switch';
7
6
  import { useSwitchContext } from './switch-context';
8
7
  import { SwitchControl, type SwitchControlProps } from './switch-control';
9
- import { SwitchInput, type SwitchInputProps } from './switch-input';
10
8
  import { SwitchLabel, type SwitchLabelProps } from './switch-label';
11
9
  import { SwitchThumb, type SwitchThumbProps } from './switch-thumb';
12
10
  import { switchAnatomy } from './switch.anatomy';
@@ -15,31 +13,20 @@ declare const Switch: ForwardRefExoticComponent<Omit<Assign<Omit<Omit<DetailedHT
15
13
  } & {
16
14
  asChild?: boolean | undefined;
17
15
  }, "ref">, UseSwitchProps>, "children"> & {
18
- children: ReactNode | ((pages: PublicApi<JSX.IntrinsicElements & {
19
- element: HTMLAttributes<HTMLElement>;
20
- style: CSSProperties;
21
- }>) => ReactNode);
16
+ children?: ReactNode | ((pages: UseSwitchReturn) => ReactNode);
22
17
  } & RefAttributes<HTMLLabelElement>> & {
23
18
  Root: ForwardRefExoticComponent<Omit<Assign<Omit<Omit<DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
24
19
  ref?: ((instance: HTMLLabelElement | null) => void) | RefObject<HTMLLabelElement> | null | undefined;
25
20
  } & {
26
21
  asChild?: boolean | undefined;
27
22
  }, "ref">, UseSwitchProps>, "children"> & {
28
- children: ReactNode | ((pages: PublicApi<JSX.IntrinsicElements & {
29
- element: HTMLAttributes<HTMLElement>;
30
- style: CSSProperties;
31
- }>) => ReactNode);
23
+ children?: ReactNode | ((pages: UseSwitchReturn) => ReactNode);
32
24
  } & RefAttributes<HTMLLabelElement>>;
33
25
  Control: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
34
26
  ref?: RefObject<HTMLSpanElement> | ((instance: HTMLSpanElement | null) => void) | null | undefined;
35
27
  } & {
36
28
  asChild?: boolean | undefined;
37
29
  }, "ref"> & RefAttributes<HTMLSpanElement>>;
38
- Input: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
39
- ref?: ((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined;
40
- } & {
41
- asChild?: boolean | undefined;
42
- }, "ref"> & RefAttributes<HTMLInputElement>>;
43
30
  Label: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
44
31
  ref?: RefObject<HTMLSpanElement> | ((instance: HTMLSpanElement | null) => void) | null | undefined;
45
32
  } & {
@@ -51,5 +38,5 @@ declare const Switch: ForwardRefExoticComponent<Omit<Assign<Omit<Omit<DetailedHT
51
38
  asChild?: boolean | undefined;
52
39
  }, "ref"> & RefAttributes<HTMLSpanElement>>;
53
40
  };
54
- export { Switch, SwitchControl, SwitchInput, SwitchLabel, SwitchThumb, switchAnatomy, useSwitchContext, };
55
- export type { SwitchControlProps, SwitchInputProps, SwitchLabelProps, SwitchProps, SwitchThumbProps, };
41
+ export { Switch, SwitchControl, SwitchLabel, SwitchThumb, switchAnatomy, useSwitchContext };
42
+ export type { SwitchControlProps, SwitchLabelProps, SwitchProps, SwitchThumbProps };
package/switch/index.mjs CHANGED
@@ -2,7 +2,6 @@
2
2
  import { Switch as Switch$1 } from './switch.mjs';
3
3
  export { useSwitchContext } from './switch-context.mjs';
4
4
  import { SwitchControl } from './switch-control.mjs';
5
- import { SwitchInput } from './switch-input.mjs';
6
5
  import { SwitchLabel } from './switch-label.mjs';
7
6
  import { SwitchThumb } from './switch-thumb.mjs';
8
7
  export { anatomy as switchAnatomy } from '@zag-js/switch';
@@ -10,9 +9,8 @@ export { anatomy as switchAnatomy } from '@zag-js/switch';
10
9
  const Switch = Object.assign(Switch$1, {
11
10
  Root: Switch$1,
12
11
  Control: SwitchControl,
13
- Input: SwitchInput,
14
12
  Label: SwitchLabel,
15
13
  Thumb: SwitchThumb
16
14
  });
17
15
 
18
- export { Switch, SwitchControl, SwitchInput, SwitchLabel, SwitchThumb };
16
+ export { Switch, SwitchControl, SwitchLabel, SwitchThumb };
@@ -1,12 +1,5 @@
1
- import { PublicApi } from '@zag-js/switch';
2
- import { Provider, HTMLAttributes, CSSProperties } from 'react';
1
+ import { Provider } from 'react';
3
2
  /// <reference types="react" />
4
3
  import { type UseSwitchReturn } from './use-switch';
5
4
  export type SwitchContext = UseSwitchReturn;
6
- export declare const SwitchProvider: Provider<PublicApi<JSX.IntrinsicElements & {
7
- element: HTMLAttributes<HTMLElement>;
8
- style: CSSProperties;
9
- }>>, useSwitchContext: () => PublicApi<JSX.IntrinsicElements & {
10
- element: HTMLAttributes<HTMLElement>;
11
- style: CSSProperties;
12
- }>;
5
+ export declare const SwitchProvider: Provider<UseSwitchReturn>, useSwitchContext: () => UseSwitchReturn;
@@ -10,9 +10,12 @@ const factory = require('../factory.cjs');
10
10
  const switchContext = require('./switch-context.cjs');
11
11
 
12
12
  const SwitchControl = react.forwardRef((props, ref) => {
13
- const { controlProps } = switchContext.useSwitchContext();
13
+ const { controlProps, hiddenInputProps } = switchContext.useSwitchContext();
14
14
  const mergedProps = react$1.mergeProps(controlProps, props);
15
- return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.span, { ...mergedProps, ref });
15
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16
+ /* @__PURE__ */ jsxRuntime.jsx(factory.ark.span, { ...mergedProps, ref }),
17
+ /* @__PURE__ */ jsxRuntime.jsx("input", { ...hiddenInputProps })
18
+ ] });
16
19
  });
17
20
  SwitchControl.displayName = "SwitchControl";
18
21
 
@@ -1,14 +1,17 @@
1
1
  'use client';
2
- import { jsx } from 'react/jsx-runtime';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { mergeProps } from '@zag-js/react';
4
4
  import { forwardRef } from 'react';
5
5
  import { ark } from '../factory.mjs';
6
6
  import { useSwitchContext } from './switch-context.mjs';
7
7
 
8
8
  const SwitchControl = forwardRef((props, ref) => {
9
- const { controlProps } = useSwitchContext();
9
+ const { controlProps, hiddenInputProps } = useSwitchContext();
10
10
  const mergedProps = mergeProps(controlProps, props);
11
- return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });
11
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref }),
13
+ /* @__PURE__ */ jsx("input", { ...hiddenInputProps })
14
+ ] });
12
15
  });
13
16
  SwitchControl.displayName = "SwitchControl";
14
17
 
@@ -4,12 +4,12 @@ import { ark } from '../factory';
4
4
  import type { Assign } from '../types';
5
5
  import { type UseSwitchProps, type UseSwitchReturn } from './use-switch';
6
6
  export type SwitchProps = Assign<Assign<ComponentPropsWithoutRef<typeof ark.label>, UseSwitchProps>, {
7
- children: ReactNode | ((pages: UseSwitchReturn) => ReactNode);
7
+ children?: ReactNode | ((pages: UseSwitchReturn) => ReactNode);
8
8
  }>;
9
9
  export declare const Switch: ForwardRefExoticComponent<Omit<Assign<Omit<Omit<DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
10
10
  ref?: ((instance: HTMLLabelElement | null) => void) | RefObject<HTMLLabelElement> | null | undefined;
11
11
  } & {
12
12
  asChild?: boolean | undefined;
13
13
  }, "ref">, UseSwitchProps>, "children"> & {
14
- children: ReactNode | ((pages: UseSwitchReturn) => ReactNode);
14
+ children?: ReactNode | ((pages: UseSwitchReturn) => ReactNode);
15
15
  } & RefAttributes<HTMLLabelElement>>;
@@ -1,12 +1,7 @@
1
- import { HTMLAttributes, CSSProperties } from 'react';
2
- /// <reference types="react" />
3
1
  import * as zagSwitch from '@zag-js/switch';
4
2
  import { type Optional } from '../types';
5
3
  export type UseSwitchProps = Optional<zagSwitch.Context, 'id'> & {
6
4
  defaultChecked?: boolean;
7
5
  };
8
- export declare const useSwitch: (props: UseSwitchProps) => zagSwitch.PublicApi<JSX.IntrinsicElements & {
9
- element: HTMLAttributes<HTMLElement>;
10
- style: CSSProperties;
11
- }>;
12
- export type UseSwitchReturn = ReturnType<typeof useSwitch>;
6
+ export type UseSwitchReturn = zagSwitch.Api;
7
+ export declare const useSwitch: (props: UseSwitchProps) => UseSwitchReturn;
package/tabs/index.d.ts CHANGED
@@ -13,14 +13,14 @@ declare const Tabs: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLProps<H
13
13
  ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
14
14
  } & {
15
15
  asChild?: boolean | undefined;
16
- }, "ref">, "value" | "getRootNode" | "id" | "ids" | "orientation" | "onFocus" | "onChange" | "defaultValue" | "dir" | "loop" | "translations" | "activationMode" | "onDelete"> & Pick<Partial<Context>, "id"> & Omit<Context, "id"> & {
16
+ }, "ref">, "value" | "getRootNode" | "id" | "ids" | "defaultValue" | "dir" | "onFocus" | "onChange" | "orientation" | "loop" | "translations" | "activationMode" | "onDelete"> & Pick<Partial<Context>, "id"> & Omit<Context, "id"> & {
17
17
  defaultValue?: string | null | undefined;
18
18
  } & RefAttributes<HTMLDivElement>> & {
19
19
  Root: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
20
20
  ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
21
21
  } & {
22
22
  asChild?: boolean | undefined;
23
- }, "ref">, "value" | "getRootNode" | "id" | "ids" | "orientation" | "onFocus" | "onChange" | "defaultValue" | "dir" | "loop" | "translations" | "activationMode" | "onDelete"> & Pick<Partial<Context>, "id"> & Omit<Context, "id"> & {
23
+ }, "ref">, "value" | "getRootNode" | "id" | "ids" | "defaultValue" | "dir" | "onFocus" | "onChange" | "orientation" | "loop" | "translations" | "activationMode" | "onDelete"> & Pick<Partial<Context>, "id"> & Omit<Context, "id"> & {
24
24
  defaultValue?: string | null | undefined;
25
25
  } & RefAttributes<HTMLDivElement>>;
26
26
  Content: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -1,12 +1,5 @@
1
- import { PublicApi } from '@zag-js/tabs';
2
- import { Provider, HTMLAttributes, CSSProperties } from 'react';
1
+ import { Provider } from 'react';
3
2
  /// <reference types="react" />
4
3
  import { type UseTabsReturn } from './use-tabs';
5
4
  export type TabsContext = UseTabsReturn;
6
- export declare const TabsProvider: Provider<PublicApi<JSX.IntrinsicElements & {
7
- element: HTMLAttributes<HTMLElement>;
8
- style: CSSProperties;
9
- }>>, useTabsContext: () => PublicApi<JSX.IntrinsicElements & {
10
- element: HTMLAttributes<HTMLElement>;
11
- style: CSSProperties;
12
- }>;
5
+ export declare const TabsProvider: Provider<UseTabsReturn>, useTabsContext: () => UseTabsReturn;
package/tabs/tabs.d.ts CHANGED
@@ -8,6 +8,6 @@ export declare const Tabs: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTML
8
8
  ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
9
9
  } & {
10
10
  asChild?: boolean | undefined;
11
- }, "ref">, "value" | "getRootNode" | "id" | "ids" | "orientation" | "onFocus" | "onChange" | "defaultValue" | "dir" | "loop" | "translations" | "activationMode" | "onDelete"> & Pick<Partial<Context>, "id"> & Omit<Context, "id"> & {
11
+ }, "ref">, "value" | "getRootNode" | "id" | "ids" | "defaultValue" | "dir" | "onFocus" | "onChange" | "orientation" | "loop" | "translations" | "activationMode" | "onDelete"> & Pick<Partial<Context>, "id"> & Omit<Context, "id"> & {
12
12
  defaultValue?: string | null | undefined;
13
13
  } & RefAttributes<HTMLDivElement>>;
package/tabs/use-tabs.cjs CHANGED
@@ -9,6 +9,25 @@ const react = require('react');
9
9
  require('../environment/index.cjs');
10
10
  const environmentContext = require('../environment/environment-context.cjs');
11
11
 
12
+ function _interopNamespaceDefault(e) {
13
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
14
+ if (e) {
15
+ for (const k in e) {
16
+ if (k !== 'default') {
17
+ const d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: () => e[k]
21
+ });
22
+ }
23
+ }
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ const tabs__namespace = /*#__PURE__*/_interopNamespaceDefault(tabs);
30
+
12
31
  const useTabs = (props) => {
13
32
  const getRootNode = environmentContext.useEnvironmentContext();
14
33
  const initialContext = {
@@ -21,8 +40,8 @@ const useTabs = (props) => {
21
40
  ...initialContext,
22
41
  value: props.value
23
42
  };
24
- const [state, send] = react$1.useMachine(tabs.machine(initialContext), { context });
25
- return tabs.connect(state, send, react$1.normalizeProps);
43
+ const [state, send] = react$1.useMachine(tabs__namespace.machine(initialContext), { context });
44
+ return tabs__namespace.connect(state, send, react$1.normalizeProps);
26
45
  };
27
46
 
28
47
  exports.useTabs = useTabs;
@@ -1,12 +1,7 @@
1
- import { HTMLAttributes, CSSProperties } from 'react';
2
- /// <reference types="react" />
3
- import { PublicApi, type Context } from '@zag-js/tabs';
1
+ import * as tabs from '@zag-js/tabs';
4
2
  import { type Optional } from '../types';
5
- export type UseTabsProps = Optional<Context, 'id'> & {
6
- defaultValue?: Context['value'];
3
+ export type UseTabsProps = Optional<tabs.Context, 'id'> & {
4
+ defaultValue?: tabs.Context['value'];
7
5
  };
8
- export type UseTabsReturn = ReturnType<typeof useTabs>;
9
- export declare const useTabs: (props: UseTabsProps) => PublicApi<JSX.IntrinsicElements & {
10
- element: HTMLAttributes<HTMLElement>;
11
- style: CSSProperties;
12
- }>;
6
+ export type UseTabsReturn = tabs.Api;
7
+ export declare const useTabs: (props: UseTabsProps) => UseTabsReturn;
package/tabs/use-tabs.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useMachine, normalizeProps } from '@zag-js/react';
3
- import { machine, connect } from '@zag-js/tabs';
3
+ import * as tabs from '@zag-js/tabs';
4
4
  import { useId } from 'react';
5
5
  import '../environment/index.mjs';
6
6
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
@@ -17,8 +17,8 @@ const useTabs = (props) => {
17
17
  ...initialContext,
18
18
  value: props.value
19
19
  };
20
- const [state, send] = useMachine(machine(initialContext), { context });
21
- return connect(state, send, normalizeProps);
20
+ const [state, send] = useMachine(tabs.machine(initialContext), { context });
21
+ return tabs.connect(state, send, normalizeProps);
22
22
  };
23
23
 
24
24
  export { useTabs };
@@ -17,14 +17,14 @@ declare const TagsInput: ForwardRefExoticComponent<Omit<Assign<Omit<Omit<Detaile
17
17
  } & {
18
18
  asChild?: boolean | undefined;
19
19
  }, "ref">, UseTagsInputProps>, "children"> & {
20
- children: ReactNode | ((pages: UseTagsInputProps) => ReactNode);
20
+ children?: ReactNode | ((pages: UseTagsInputProps) => ReactNode);
21
21
  } & RefAttributes<HTMLInputElement>> & {
22
22
  Root: ForwardRefExoticComponent<Omit<Assign<Omit<Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
23
23
  ref?: ((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined;
24
24
  } & {
25
25
  asChild?: boolean | undefined;
26
26
  }, "ref">, UseTagsInputProps>, "children"> & {
27
- children: ReactNode | ((pages: UseTagsInputProps) => ReactNode);
27
+ children?: ReactNode | ((pages: UseTagsInputProps) => ReactNode);
28
28
  } & RefAttributes<HTMLInputElement>>;
29
29
  ClearTrigger: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
30
30
  ref?: ((instance: HTMLButtonElement | null) => void) | RefObject<HTMLButtonElement> | null | undefined;
@@ -1,12 +1,5 @@
1
- import { PublicApi } from '@zag-js/tags-input';
2
- import { Provider, HTMLAttributes, CSSProperties } from 'react';
1
+ import { Provider } from 'react';
3
2
  /// <reference types="react" />
4
3
  import { type UseTagsInputReturn } from './use-tags-input';
5
4
  export type TagsInputContext = UseTagsInputReturn;
6
- export declare const TagsInputProvider: Provider<PublicApi<JSX.IntrinsicElements & {
7
- element: HTMLAttributes<HTMLElement>;
8
- style: CSSProperties;
9
- }>>, useTagsInputContext: () => PublicApi<JSX.IntrinsicElements & {
10
- element: HTMLAttributes<HTMLElement>;
11
- style: CSSProperties;
12
- }>;
5
+ export declare const TagsInputProvider: Provider<UseTagsInputReturn>, useTagsInputContext: () => UseTagsInputReturn;
@@ -35,12 +35,11 @@ const TagsInput = react.forwardRef((props, ref) => {
35
35
  "maxLength",
36
36
  "name",
37
37
  "onChange",
38
+ "onFocusChange",
38
39
  "onFocusOutside",
39
- "onHighlight",
40
40
  "onInteractOutside",
41
41
  "onInvalid",
42
42
  "onPointerDownOutside",
43
- "onTagUpdate",
44
43
  "readOnly",
45
44
  "translations",
46
45
  "validate",
@@ -3,12 +3,12 @@ import { ark } from '../factory';
3
3
  import { type Assign } from '../types';
4
4
  import { type UseTagsInputProps } from './use-tags-input';
5
5
  export type TagsInputProps = Assign<Assign<ComponentPropsWithoutRef<typeof ark.input>, UseTagsInputProps>, {
6
- children: ReactNode | ((pages: UseTagsInputProps) => ReactNode);
6
+ children?: ReactNode | ((pages: UseTagsInputProps) => ReactNode);
7
7
  }>;
8
8
  export declare const TagsInput: ForwardRefExoticComponent<Omit<Assign<Omit<Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
9
9
  ref?: ((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined;
10
10
  } & {
11
11
  asChild?: boolean | undefined;
12
12
  }, "ref">, UseTagsInputProps>, "children"> & {
13
- children: ReactNode | ((pages: UseTagsInputProps) => ReactNode);
13
+ children?: ReactNode | ((pages: UseTagsInputProps) => ReactNode);
14
14
  } & RefAttributes<HTMLInputElement>>;
@@ -31,12 +31,11 @@ const TagsInput = forwardRef((props, ref) => {
31
31
  "maxLength",
32
32
  "name",
33
33
  "onChange",
34
+ "onFocusChange",
34
35
  "onFocusOutside",
35
- "onHighlight",
36
36
  "onInteractOutside",
37
37
  "onInvalid",
38
38
  "onPointerDownOutside",
39
- "onTagUpdate",
40
39
  "readOnly",
41
40
  "translations",
42
41
  "validate",
@@ -1,12 +1,7 @@
1
- import { HTMLAttributes, CSSProperties } from 'react';
2
- /// <reference types="react" />
3
1
  import * as tagsInput from '@zag-js/tags-input';
4
2
  import { type Optional } from '../types';
5
3
  export type UseTagsInputProps = Optional<tagsInput.Context, 'id'> & {
6
4
  defaultValue?: tagsInput.Context['value'];
7
5
  };
8
- export declare const useTagsInput: (props: UseTagsInputProps) => tagsInput.PublicApi<JSX.IntrinsicElements & {
9
- element: HTMLAttributes<HTMLElement>;
10
- style: CSSProperties;
11
- }>;
12
- export type UseTagsInputReturn = ReturnType<typeof useTagsInput>;
6
+ export type UseTagsInputReturn = tagsInput.Api;
7
+ export declare const useTagsInput: (props: UseTagsInputProps) => UseTagsInputReturn;
package/toast/index.d.ts CHANGED
@@ -45,7 +45,7 @@ declare const Toast: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLProps<
45
45
  asChild?: boolean | undefined;
46
46
  }, "ref">, "children" | "placement"> & {
47
47
  placement: Placement;
48
- children: ReactNode | ((toasts: Service[]) => ReactNode);
48
+ children?: ReactNode | ((toasts: Service[]) => ReactNode);
49
49
  } & RefAttributes<HTMLDivElement>>;
50
50
  };
51
51
  export { Toast, ToastCloseTrigger, ToastDescription, ToastGroup, ToastPlacements, ToastProvider, ToastRoot, ToastTitle, toastAnatomy, useToast, useToastItemContext, };
@@ -4,7 +4,7 @@ import { ark } from '../factory';
4
4
  import { type Assign } from '../types';
5
5
  export type ToastGroupProps = Assign<ComponentPropsWithoutRef<typeof ark.div>, {
6
6
  placement: Placement;
7
- children: ReactNode | ((toasts: Service[]) => ReactNode);
7
+ children?: ReactNode | ((toasts: Service[]) => ReactNode);
8
8
  }>;
9
9
  export declare const ToastGroup: ForwardRefExoticComponent<Omit<Omit<Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
10
  ref?: ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined;
@@ -12,5 +12,5 @@ export declare const ToastGroup: ForwardRefExoticComponent<Omit<Omit<Omit<Detail
12
12
  asChild?: boolean | undefined;
13
13
  }, "ref">, "children" | "placement"> & {
14
14
  placement: Placement;
15
- children: ReactNode | ((toasts: Service[]) => ReactNode);
15
+ children?: ReactNode | ((toasts: Service[]) => ReactNode);
16
16
  } & RefAttributes<HTMLDivElement>>;
@@ -1,12 +1,5 @@
1
- import { PublicApi } from '@zag-js/toast';
2
- import { Provider, HTMLAttributes, CSSProperties } from 'react';
1
+ import { Provider } from 'react';
3
2
  /// <reference types="react" />
4
3
  import { type UseToastItemReturn } from './use-toast-item';
5
4
  export type ToastItemContext = UseToastItemReturn;
6
- export declare const ToastItemProvider: Provider<PublicApi<JSX.IntrinsicElements & {
7
- element: HTMLAttributes<HTMLElement>;
8
- style: CSSProperties;
9
- }>>, useToastItemContext: () => PublicApi<JSX.IntrinsicElements & {
10
- element: HTMLAttributes<HTMLElement>;
11
- style: CSSProperties;
12
- }>;
5
+ export declare const ToastItemProvider: Provider<UseToastItemReturn>, useToastItemContext: () => UseToastItemReturn;
@@ -1,66 +1,11 @@
1
1
  import { JSX } from 'react/jsx-runtime';
2
+ import { PropTypes } from '@zag-js/types';
2
3
  import * as toast from '@zag-js/toast';
3
4
  import { Provider, type PropsWithChildren } from 'react';
4
5
  import { type Optional } from '../types';
5
6
  type GroupPublicContext = Parameters<(typeof toast)['group']['machine']>[0];
6
7
  export type ToastContext = ReturnType<(typeof toast)['group']['connect']>;
7
- export declare const ToastContextProvider: Provider<{
8
- count: number;
9
- toasts: toast.Service[];
10
- toastsByPlacement: Partial<Record<toast.Placement, toast.Service[]>>;
11
- isVisible(id: string): boolean;
12
- create(options: Partial<toast.ToastOptions>): string | undefined;
13
- upsert(options: Partial<toast.ToastOptions>): string | undefined;
14
- dismiss(id?: string | undefined): void;
15
- remove(id?: string | undefined): void;
16
- dismissByPlacement(placement: toast.Placement): void;
17
- update(id: string, options: Partial<toast.ToastOptions>): string | undefined;
18
- loading(options: Partial<toast.ToastOptions>): string | undefined;
19
- success(options: Partial<toast.ToastOptions>): string | undefined;
20
- error(options: Partial<toast.ToastOptions>): string | undefined;
21
- promise<T_1>(promise: Promise<T_1>, options: {
22
- loading: toast.ToastOptions;
23
- success: toast.ToastOptions | ((arg: T_1) => toast.ToastOptions);
24
- error: toast.ToastOptions | ((arg: Error) => toast.ToastOptions);
25
- }, shared?: Partial<toast.ToastOptions> | undefined): Promise<T_1>;
26
- pause(id?: string | undefined): void;
27
- resume(id?: string | undefined): void;
28
- getGroupProps(options: {
29
- placement: toast.Placement;
30
- label?: string | undefined;
31
- }): {
32
- [x: string]: any;
33
- };
34
- subscribe(fn: (toasts: any) => void): () => void;
35
- }>, useToast: () => {
36
- count: number;
37
- toasts: toast.Service[];
38
- toastsByPlacement: Partial<Record<toast.Placement, toast.Service[]>>;
39
- isVisible(id: string): boolean;
40
- create(options: Partial<toast.ToastOptions>): string | undefined;
41
- upsert(options: Partial<toast.ToastOptions>): string | undefined;
42
- dismiss(id?: string | undefined): void;
43
- remove(id?: string | undefined): void;
44
- dismissByPlacement(placement: toast.Placement): void;
45
- update(id: string, options: Partial<toast.ToastOptions>): string | undefined;
46
- loading(options: Partial<toast.ToastOptions>): string | undefined;
47
- success(options: Partial<toast.ToastOptions>): string | undefined;
48
- error(options: Partial<toast.ToastOptions>): string | undefined;
49
- promise<T_1>(promise: Promise<T_1>, options: {
50
- loading: toast.ToastOptions;
51
- success: toast.ToastOptions | ((arg: T_1) => toast.ToastOptions);
52
- error: toast.ToastOptions | ((arg: Error) => toast.ToastOptions);
53
- }, shared?: Partial<toast.ToastOptions> | undefined): Promise<T_1>;
54
- pause(id?: string | undefined): void;
55
- resume(id?: string | undefined): void;
56
- getGroupProps(options: {
57
- placement: toast.Placement;
58
- label?: string | undefined;
59
- }): {
60
- [x: string]: any;
61
- };
62
- subscribe(fn: (toasts: any) => void): () => void;
63
- };
8
+ export declare const ToastContextProvider: Provider<toast.GroupApi<PropTypes>>, useToast: () => toast.GroupApi<PropTypes>;
64
9
  export type ToastProviderProps = PropsWithChildren & Optional<GroupPublicContext, 'id'>;
65
10
  export declare const ToastProvider: (props: ToastProviderProps) => JSX.Element;
66
11
  export {};
@@ -1,11 +1,6 @@
1
- import { HTMLAttributes, CSSProperties } from 'react';
2
- /// <reference types="react" />
3
1
  import * as toast from '@zag-js/toast';
4
2
  export type UseToastItemProps = {
5
3
  toast: toast.Service;
6
4
  };
7
- export type UseToastItemReturn = ReturnType<typeof useToastItem>;
8
- export declare const useToastItem: (props: UseToastItemProps) => toast.PublicApi<JSX.IntrinsicElements & {
9
- element: HTMLAttributes<HTMLElement>;
10
- style: CSSProperties;
11
- }>;
5
+ export type UseToastItemReturn = toast.Api;
6
+ export declare const useToastItem: (props: UseToastItemProps) => UseToastItemReturn;
@@ -1,12 +1,5 @@
1
- import { PublicApi } from '@zag-js/tooltip';
2
- import { Provider, HTMLAttributes, CSSProperties } from 'react';
1
+ import { Provider } from 'react';
3
2
  /// <reference types="react" />
4
3
  import { type UseTooltipReturn } from './use-tooltip';
5
4
  export type TooltipContext = UseTooltipReturn;
6
- export declare const TooltipProvider: Provider<PublicApi<JSX.IntrinsicElements & {
7
- element: HTMLAttributes<HTMLElement>;
8
- style: CSSProperties;
9
- }>>, useTooltipContext: () => PublicApi<JSX.IntrinsicElements & {
10
- element: HTMLAttributes<HTMLElement>;
11
- style: CSSProperties;
12
- }>;
5
+ export declare const TooltipProvider: Provider<UseTooltipReturn>, useTooltipContext: () => UseTooltipReturn;
@@ -1,10 +1,5 @@
1
- import { HTMLAttributes, CSSProperties } from 'react';
2
- /// <reference types="react" />
3
1
  import * as tooltip from '@zag-js/tooltip';
4
2
  import { type Optional } from '../types';
5
3
  export type UseTooltipProps = Optional<tooltip.Context, 'id'>;
6
- export declare const useTooltip: (props: UseTooltipProps) => tooltip.PublicApi<JSX.IntrinsicElements & {
7
- element: HTMLAttributes<HTMLElement>;
8
- style: CSSProperties;
9
- }>;
10
- export type UseTooltipReturn = ReturnType<typeof useTooltip>;
4
+ export type UseTooltipReturn = tooltip.Api;
5
+ export declare const useTooltip: (props: UseTooltipProps) => UseTooltipReturn;
@@ -1,19 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
-
6
- const jsxRuntime = require('react/jsx-runtime');
7
- const react$1 = require('@zag-js/react');
8
- const react = require('react');
9
- const factory = require('../factory.cjs');
10
- const switchContext = require('./switch-context.cjs');
11
-
12
- const SwitchInput = react.forwardRef((props, ref) => {
13
- const { inputProps } = switchContext.useSwitchContext();
14
- const mergedProps = react$1.mergeProps(inputProps, props);
15
- return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.input, { ...mergedProps, ref });
16
- });
17
- SwitchInput.displayName = "SwitchInput";
18
-
19
- exports.SwitchInput = SwitchInput;
@@ -1,8 +0,0 @@
1
- import { ForwardRefExoticComponent, DetailedHTMLProps, InputHTMLAttributes, RefObject, RefAttributes, type ComponentPropsWithoutRef } from 'react';
2
- import { ark } from '../factory';
3
- export type SwitchInputProps = ComponentPropsWithoutRef<typeof ark.input>;
4
- export declare const SwitchInput: ForwardRefExoticComponent<Omit<Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
5
- ref?: ((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined;
6
- } & {
7
- asChild?: boolean | undefined;
8
- }, "ref"> & RefAttributes<HTMLInputElement>>;
@@ -1,15 +0,0 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { mergeProps } from '@zag-js/react';
4
- import { forwardRef } from 'react';
5
- import { ark } from '../factory.mjs';
6
- import { useSwitchContext } from './switch-context.mjs';
7
-
8
- const SwitchInput = forwardRef((props, ref) => {
9
- const { inputProps } = useSwitchContext();
10
- const mergedProps = mergeProps(inputProps, props);
11
- return /* @__PURE__ */ jsx(ark.input, { ...mergedProps, ref });
12
- });
13
- SwitchInput.displayName = "SwitchInput";
14
-
15
- export { SwitchInput };