@ark-ui/react 0.4.0 → 0.6.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 (59) hide show
  1. package/README.md +1 -0
  2. package/dist/accordion/index.d.ts +0 -1
  3. package/dist/avatar/avatar-context.cjs +14 -0
  4. package/dist/avatar/avatar-context.d.ts +22 -0
  5. package/dist/avatar/avatar-context.mjs +9 -0
  6. package/dist/avatar/avatar-fallback.cjs +17 -0
  7. package/dist/avatar/avatar-fallback.d.ts +271 -0
  8. package/dist/avatar/avatar-fallback.mjs +13 -0
  9. package/dist/avatar/avatar-image.cjs +17 -0
  10. package/dist/avatar/avatar-image.d.ts +282 -0
  11. package/dist/avatar/avatar-image.mjs +13 -0
  12. package/dist/avatar/avatar.anatomy.cjs +9 -0
  13. package/dist/avatar/avatar.anatomy.d.ts +2 -0
  14. package/dist/avatar/avatar.anatomy.mjs +5 -0
  15. package/dist/avatar/avatar.cjs +25 -0
  16. package/dist/{accordion/accordion-icon.d.ts → avatar/avatar.d.ts} +8 -5
  17. package/dist/avatar/avatar.mjs +21 -0
  18. package/dist/avatar/index.d.ts +4 -0
  19. package/dist/avatar/use-avatar.cjs +40 -0
  20. package/dist/avatar/use-avatar.d.ts +15 -0
  21. package/dist/avatar/use-avatar.mjs +17 -0
  22. package/dist/checkbox/checkbox-input.d.ts +3 -3
  23. package/dist/color-picker/color-picker-channel-input.d.ts +3 -3
  24. package/dist/combobox/combobox-input.d.ts +3 -3
  25. package/dist/date-picker/date-picker-input.d.ts +3 -3
  26. package/dist/date-picker/date-picker-view-trigger.cjs +1 -1
  27. package/dist/date-picker/date-picker-view-trigger.mjs +1 -1
  28. package/dist/date-picker/date-picker-year-cell.d.ts +3 -1
  29. package/dist/editable/editable-input.d.ts +3 -3
  30. package/dist/index.cjs +8 -2
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.mjs +4 -1
  33. package/dist/number-input/number-input-field.d.ts +3 -3
  34. package/dist/pagination/pagination.cjs +1 -0
  35. package/dist/pagination/pagination.d.ts +1 -0
  36. package/dist/pagination/pagination.mjs +1 -0
  37. package/dist/pagination/use-pagination.cjs +8 -3
  38. package/dist/pagination/use-pagination.d.ts +3 -1
  39. package/dist/pagination/use-pagination.mjs +8 -3
  40. package/dist/pin-input/pin-input-field.d.ts +3 -3
  41. package/dist/pressable/pressable.cjs +1 -0
  42. package/dist/pressable/pressable.d.ts +1 -0
  43. package/dist/pressable/pressable.mjs +1 -0
  44. package/dist/radio-group/radio-input.d.ts +3 -3
  45. package/dist/rating-group/rating-group.d.ts +3 -3
  46. package/dist/slider/slider.d.ts +1 -1
  47. package/dist/splitter/splitter-context.d.ts +4 -6
  48. package/dist/splitter/splitter.cjs +18 -12
  49. package/dist/splitter/splitter.d.ts +12 -4
  50. package/dist/splitter/splitter.mjs +18 -12
  51. package/dist/splitter/use-splitter.cjs +28 -4
  52. package/dist/splitter/use-splitter.d.ts +10 -9
  53. package/dist/splitter/use-splitter.mjs +10 -5
  54. package/dist/switch/switch-input.d.ts +3 -3
  55. package/dist/tags-input/tag-input.d.ts +3 -3
  56. package/package.json +66 -59
  57. package/LICENSE +0 -21
  58. package/dist/accordion/accordion-icon.cjs +0 -24
  59. package/dist/accordion/accordion-icon.mjs +0 -20
package/dist/index.cjs CHANGED
@@ -6,10 +6,13 @@ const anatomy = require('@zag-js/anatomy');
6
6
  const react = require('@zag-js/react');
7
7
  const accordion = require('./accordion/accordion.cjs');
8
8
  const accordionContent = require('./accordion/accordion-content.cjs');
9
- const accordionIcon = require('./accordion/accordion-icon.cjs');
10
9
  const accordionItem = require('./accordion/accordion-item.cjs');
11
10
  const accordionTrigger = require('./accordion/accordion-trigger.cjs');
12
11
  const accordion$1 = require('@zag-js/accordion');
12
+ const avatar = require('./avatar/avatar.cjs');
13
+ const avatarFallback = require('./avatar/avatar-fallback.cjs');
14
+ const avatarImage = require('./avatar/avatar-image.cjs');
15
+ const avatar_anatomy = require('./avatar/avatar.anatomy.cjs');
13
16
  const carousel = require('./carousel/carousel.cjs');
14
17
  const carouselControl = require('./carousel/carousel-control.cjs');
15
18
  const carouselNextSlideTrigger = require('./carousel/carousel-next-slide-trigger.cjs');
@@ -239,13 +242,16 @@ Object.defineProperty(exports, 'Portal', {
239
242
  });
240
243
  exports.Accordion = accordion.Accordion;
241
244
  exports.AccordionContent = accordionContent.AccordionContent;
242
- exports.AccordionIcon = accordionIcon.AccordionIcon;
243
245
  exports.AccordionItem = accordionItem.AccordionItem;
244
246
  exports.AccordionTrigger = accordionTrigger.AccordionTrigger;
245
247
  Object.defineProperty(exports, 'accordionAnatomy', {
246
248
  enumerable: true,
247
249
  get: () => accordion$1.anatomy
248
250
  });
251
+ exports.Avatar = avatar.Avatar;
252
+ exports.AvatarFallback = avatarFallback.AvatarFallback;
253
+ exports.AvatarImage = avatarImage.AvatarImage;
254
+ exports.avatarAnatomy = avatar_anatomy.avatarAnatomy;
249
255
  exports.Carousel = carousel.Carousel;
250
256
  exports.CarouselControl = carouselControl.CarouselControl;
251
257
  exports.CarouselNextSlideTrigger = carouselNextSlideTrigger.CarouselNextSlideTrigger;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { createAnatomy } from '@zag-js/anatomy';
2
2
  export { Portal, type PortalProps } from '@zag-js/react';
3
3
  export * from './accordion';
4
+ export * from './avatar';
4
5
  export * from './carousel';
5
6
  export * from './checkbox';
6
7
  export * from './color-picker';
package/dist/index.mjs CHANGED
@@ -2,10 +2,13 @@ export { createAnatomy } from '@zag-js/anatomy';
2
2
  export { Portal } from '@zag-js/react';
3
3
  export { Accordion } from './accordion/accordion.mjs';
4
4
  export { AccordionContent } from './accordion/accordion-content.mjs';
5
- export { AccordionIcon } from './accordion/accordion-icon.mjs';
6
5
  export { AccordionItem } from './accordion/accordion-item.mjs';
7
6
  export { AccordionTrigger } from './accordion/accordion-trigger.mjs';
8
7
  export { anatomy as accordionAnatomy } from '@zag-js/accordion';
8
+ export { Avatar } from './avatar/avatar.mjs';
9
+ export { AvatarFallback } from './avatar/avatar-fallback.mjs';
10
+ export { AvatarImage } from './avatar/avatar-image.mjs';
11
+ export { avatarAnatomy } from './avatar/avatar.anatomy.mjs';
9
12
  export { Carousel } from './carousel/carousel.mjs';
10
13
  export { CarouselControl } from './carousel/carousel-control.mjs';
11
14
  export { CarouselNextSlideTrigger } from './carousel/carousel-next-slide-trigger.mjs';
@@ -290,13 +290,13 @@ export declare const NumberInputField: ForwardRefExoticComponent<{
290
290
  onTransitionEndCapture?: TransitionEventHandler<HTMLInputElement> | undefined;
291
291
  type?: HTMLInputTypeAttribute | undefined;
292
292
  step?: string | number | undefined;
293
- required?: boolean | undefined;
294
293
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
295
- enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
296
294
  height?: string | number | undefined;
295
+ width?: string | number | undefined;
296
+ required?: boolean | undefined;
297
+ enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
297
298
  max?: string | number | undefined;
298
299
  min?: string | number | undefined;
299
300
  readOnly?: boolean | undefined;
300
301
  size?: number | undefined;
301
- width?: string | number | undefined;
302
302
  }>;
@@ -16,6 +16,7 @@ const Pagination = forwardRef.forwardRef((props, ref) => {
16
16
  props,
17
17
  [
18
18
  "count",
19
+ "defaultPage",
19
20
  "dir",
20
21
  "getRootNode",
21
22
  "id",
@@ -297,5 +297,6 @@ export declare const Pagination: ForwardRefExoticComponent<{
297
297
  count: number;
298
298
  pageSize?: number | undefined;
299
299
  siblingCount?: number | undefined;
300
+ defaultPage?: number | undefined;
300
301
  children: ReactNode | ((pages: UsePaginationReturn) => ReactNode);
301
302
  }>;
@@ -12,6 +12,7 @@ const Pagination = forwardRef((props, ref) => {
12
12
  props,
13
13
  [
14
14
  "count",
15
+ "defaultPage",
15
16
  "dir",
16
17
  "getRootNode",
17
18
  "id",
@@ -28,12 +28,17 @@ const pagination__namespace = /*#__PURE__*/_interopNamespaceDefault(pagination);
28
28
 
29
29
  const usePagination = (props) => {
30
30
  const getRootNode = environmentContext.useEnvironmentContext();
31
- const context = {
31
+ const initialContext = {
32
32
  id: React.useId(),
33
33
  getRootNode,
34
- ...props
34
+ ...props,
35
+ page: props.defaultPage
36
+ };
37
+ const context = {
38
+ ...initialContext,
39
+ page: props.page
35
40
  };
36
- const [state, send] = react.useMachine(pagination__namespace.machine(context), { context });
41
+ const [state, send] = react.useMachine(pagination__namespace.machine(initialContext), { context });
37
42
  return pagination__namespace.connect(state, send, react.normalizeProps);
38
43
  };
39
44
 
@@ -2,7 +2,9 @@ import type { HTMLAttributes } from 'react';
2
2
  import type { PaginationRange, EllipsisProps, PageTriggerProps } from '@zag-js/pagination/dist/pagination.types';
3
3
  import * as pagination from '@zag-js/pagination';
4
4
  import { type Optional } from '../types';
5
- export type UsePaginationProps = Optional<pagination.Context, 'id'>;
5
+ export type UsePaginationProps = Optional<pagination.Context, 'id'> & {
6
+ defaultPage?: pagination.Context['page'];
7
+ };
6
8
  export declare const usePagination: (props: UsePaginationProps) => {
7
9
  page: number;
8
10
  totalPages: number;
@@ -5,12 +5,17 @@ import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const usePagination = (props) => {
7
7
  const getRootNode = useEnvironmentContext();
8
- const context = {
8
+ const initialContext = {
9
9
  id: useId(),
10
10
  getRootNode,
11
- ...props
11
+ ...props,
12
+ page: props.defaultPage
13
+ };
14
+ const context = {
15
+ ...initialContext,
16
+ page: props.page
12
17
  };
13
- const [state, send] = useMachine(pagination.machine(context), { context });
18
+ const [state, send] = useMachine(pagination.machine(initialContext), { context });
14
19
  return pagination.connect(state, send, normalizeProps);
15
20
  };
16
21
 
@@ -293,14 +293,14 @@ export declare const PinInputField: ForwardRefExoticComponent<{
293
293
  onTransitionEndCapture?: TransitionEventHandler<HTMLInputElement> | undefined;
294
294
  type?: HTMLInputTypeAttribute | undefined;
295
295
  step?: string | number | undefined;
296
- required?: boolean | undefined;
297
296
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
298
- enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
299
297
  height?: string | number | undefined;
298
+ width?: string | number | undefined;
299
+ required?: boolean | undefined;
300
+ enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
300
301
  max?: string | number | undefined;
301
302
  min?: string | number | undefined;
302
303
  readOnly?: boolean | undefined;
303
304
  size?: number | undefined;
304
- width?: string | number | undefined;
305
305
  index: number;
306
306
  }>;
@@ -17,6 +17,7 @@ const Pressable = forwardRef.forwardRef((props, ref) => {
17
17
  "disabled",
18
18
  "getRootNode",
19
19
  "id",
20
+ "longPressDelay",
20
21
  "onLongPress",
21
22
  "onPress",
22
23
  "onPressEnd",
@@ -290,4 +290,5 @@ export declare const Pressable: ForwardRefExoticComponent<{
290
290
  preventFocusOnPress?: boolean | undefined;
291
291
  cancelOnPointerExit?: boolean | undefined;
292
292
  allowTextSelectionOnPress?: boolean | undefined;
293
+ longPressDelay?: number | undefined;
293
294
  }>;
@@ -13,6 +13,7 @@ const Pressable = forwardRef((props, ref) => {
13
13
  "disabled",
14
14
  "getRootNode",
15
15
  "id",
16
+ "longPressDelay",
16
17
  "onLongPress",
17
18
  "onPress",
18
19
  "onPressEnd",
@@ -290,13 +290,13 @@ export declare const RadioInput: ForwardRefExoticComponent<{
290
290
  onTransitionEndCapture?: TransitionEventHandler<HTMLInputElement> | undefined;
291
291
  type?: HTMLInputTypeAttribute | undefined;
292
292
  step?: string | number | undefined;
293
- required?: boolean | undefined;
294
293
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
295
- enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
296
294
  height?: string | number | undefined;
295
+ width?: string | number | undefined;
296
+ required?: boolean | undefined;
297
+ enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
297
298
  max?: string | number | undefined;
298
299
  min?: string | number | undefined;
299
300
  readOnly?: boolean | undefined;
300
301
  size?: number | undefined;
301
- width?: string | number | undefined;
302
302
  }>;
@@ -283,13 +283,13 @@ export declare const RatingGroup: ForwardRefExoticComponent<{
283
283
  onTransitionEndCapture?: TransitionEventHandler<HTMLInputElement> | undefined;
284
284
  type?: HTMLInputTypeAttribute | undefined;
285
285
  step?: string | number | undefined;
286
- required?: boolean | undefined;
287
286
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
288
- enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
289
287
  height?: string | number | undefined;
288
+ width?: string | number | undefined;
289
+ required?: boolean | undefined;
290
+ enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
290
291
  min?: string | number | undefined;
291
292
  size?: number | undefined;
292
- width?: string | number | undefined;
293
293
  id?: string | undefined;
294
294
  name?: string | undefined;
295
295
  value?: number | undefined;
@@ -291,6 +291,7 @@ export declare const Slider: ForwardRefExoticComponent<{
291
291
  }> | undefined;
292
292
  orientation?: "horizontal" | "vertical" | undefined;
293
293
  step?: number | undefined;
294
+ origin?: "center" | "start" | undefined;
294
295
  invalid?: boolean | undefined;
295
296
  max?: number | undefined;
296
297
  min?: number | undefined;
@@ -303,7 +304,6 @@ export declare const Slider: ForwardRefExoticComponent<{
303
304
  }) => void) | undefined;
304
305
  getAriaValueText?: ((value: number) => string) | undefined;
305
306
  thumbAlignment?: "center" | "contain" | undefined;
306
- origin?: "center" | "start" | undefined;
307
307
  focusThumbOnChange?: boolean | undefined;
308
308
  children?: ReactNode | ((context: SliderContext) => ReactNode);
309
309
  }>;
@@ -9,9 +9,8 @@ export declare const SplitterProvider: Provider<{
9
9
  min: number;
10
10
  max: number;
11
11
  } | undefined;
12
- collapse(id: PanelId): void;
13
- expand(id: PanelId): void;
14
- toggle(id: PanelId): void;
12
+ setToMinSize(id: PanelId): void;
13
+ setToMaxSize(id: PanelId): void;
15
14
  setSize(id: PanelId, size: number): void;
16
15
  getResizeTriggerState(props: ResizeTriggerProps): {
17
16
  isDisabled: boolean;
@@ -31,9 +30,8 @@ export declare const SplitterProvider: Provider<{
31
30
  min: number;
32
31
  max: number;
33
32
  } | undefined;
34
- collapse(id: PanelId): void;
35
- expand(id: PanelId): void;
36
- toggle(id: PanelId): void;
33
+ setToMinSize(id: PanelId): void;
34
+ setToMaxSize(id: PanelId): void;
37
35
  setSize(id: PanelId, size: number): void;
38
36
  getResizeTriggerState(props: ResizeTriggerProps): {
39
37
  isDisabled: boolean;
@@ -7,24 +7,30 @@ const react = require('@zag-js/react');
7
7
  const createSplitProps = require('../create-split-props.cjs');
8
8
  const factory = require('../factory.cjs');
9
9
  const forwardRef = require('../forward-ref.cjs');
10
+ const runIfFn = require('../run-if-fn.cjs');
10
11
  const splitterContext = require('./splitter-context.cjs');
11
12
  const useSplitter = require('./use-splitter.cjs');
12
13
 
13
14
  const Splitter = forwardRef.forwardRef((props, ref) => {
14
- const [useSplitterProps, divProps] = createSplitProps.createSplitProps()(props, [
15
- "dir",
16
- "getRootNode",
17
- "id",
18
- "ids",
19
- "onResize",
20
- "onResizeEnd",
21
- "onResizeStart",
22
- "orientation",
23
- "size"
24
- ]);
15
+ const [useSplitterProps, { children, ...divProps }] = createSplitProps.createSplitProps()(
16
+ props,
17
+ [
18
+ "defaultSize",
19
+ "dir",
20
+ "getRootNode",
21
+ "id",
22
+ "ids",
23
+ "onResize",
24
+ "onResizeEnd",
25
+ "onResizeStart",
26
+ "orientation",
27
+ "size"
28
+ ]
29
+ );
25
30
  const splitter = useSplitter.useSplitter(useSplitterProps);
26
31
  const mergedProps = react.mergeProps(splitter.rootProps, divProps);
27
- return /* @__PURE__ */ jsxRuntime.jsx(splitterContext.SplitterProvider, { value: splitter, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }) });
32
+ const view = runIfFn.runIfFn(children, splitter);
33
+ return /* @__PURE__ */ jsxRuntime.jsx(splitterContext.SplitterProvider, { value: splitter, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref, children: view }) });
28
34
  });
29
35
 
30
36
  exports.Splitter = Splitter;
@@ -1,11 +1,12 @@
1
1
  import type { PanelId } from '@zag-js/splitter/dist/splitter.types';
2
- import type { ForwardRefExoticComponent, ReactNode, CSSProperties, LegacyRef, Key, AriaRole, ClipboardEventHandler, CompositionEventHandler, FocusEventHandler, FormEventHandler, ReactEventHandler, KeyboardEventHandler, MouseEventHandler, DragEventHandler, TouchEventHandler, PointerEventHandler, UIEventHandler, WheelEventHandler, AnimationEventHandler, TransitionEventHandler } from 'react';
2
+ import type { ForwardRefExoticComponent, CSSProperties, LegacyRef, Key, AriaRole, ClipboardEventHandler, CompositionEventHandler, FocusEventHandler, FormEventHandler, ReactEventHandler, KeyboardEventHandler, MouseEventHandler, DragEventHandler, TouchEventHandler, PointerEventHandler, UIEventHandler, WheelEventHandler, AnimationEventHandler, TransitionEventHandler, ReactNode } from 'react';
3
3
  import { type HTMLArkProps } from '../factory';
4
4
  import type { Assign } from '../types';
5
- import { type UseSplitterProps } from './use-splitter';
6
- export type SplitterProps = Assign<HTMLArkProps<'div'>, UseSplitterProps>;
5
+ import { type UseSplitterProps, type UseSplitterReturn } from './use-splitter';
6
+ export type SplitterProps = Assign<HTMLArkProps<'div'>, UseSplitterProps & {
7
+ children?: ReactNode | ((state: UseSplitterReturn) => ReactNode);
8
+ }>;
7
9
  export declare const Splitter: ForwardRefExoticComponent<{
8
- children?: ReactNode;
9
10
  slot?: string | undefined;
10
11
  style?: CSSProperties | undefined;
11
12
  title?: string | undefined;
@@ -312,4 +313,11 @@ export declare const Splitter: ForwardRefExoticComponent<{
312
313
  }[];
313
314
  activeHandleId: string | null;
314
315
  }) => void) | undefined;
316
+ defaultSize?: {
317
+ id: PanelId;
318
+ size?: number | undefined;
319
+ minSize?: number | undefined;
320
+ maxSize?: number | undefined;
321
+ }[] | undefined;
322
+ children?: ReactNode | ((state: UseSplitterReturn) => ReactNode);
315
323
  }>;
@@ -3,24 +3,30 @@ import { mergeProps } from '@zag-js/react';
3
3
  import { createSplitProps } from '../create-split-props.mjs';
4
4
  import { ark } from '../factory.mjs';
5
5
  import { forwardRef } from '../forward-ref.mjs';
6
+ import { runIfFn } from '../run-if-fn.mjs';
6
7
  import { SplitterProvider } from './splitter-context.mjs';
7
8
  import { useSplitter } from './use-splitter.mjs';
8
9
 
9
10
  const Splitter = forwardRef((props, ref) => {
10
- const [useSplitterProps, divProps] = createSplitProps()(props, [
11
- "dir",
12
- "getRootNode",
13
- "id",
14
- "ids",
15
- "onResize",
16
- "onResizeEnd",
17
- "onResizeStart",
18
- "orientation",
19
- "size"
20
- ]);
11
+ const [useSplitterProps, { children, ...divProps }] = createSplitProps()(
12
+ props,
13
+ [
14
+ "defaultSize",
15
+ "dir",
16
+ "getRootNode",
17
+ "id",
18
+ "ids",
19
+ "onResize",
20
+ "onResizeEnd",
21
+ "onResizeStart",
22
+ "orientation",
23
+ "size"
24
+ ]
25
+ );
21
26
  const splitter = useSplitter(useSplitterProps);
22
27
  const mergedProps = mergeProps(splitter.rootProps, divProps);
23
- return /* @__PURE__ */ jsx(SplitterProvider, { value: splitter, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });
28
+ const view = runIfFn(children, splitter);
29
+ return /* @__PURE__ */ jsx(SplitterProvider, { value: splitter, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref, children: view }) });
24
30
  });
25
31
 
26
32
  export { Splitter };
@@ -7,15 +7,39 @@ const splitter = require('@zag-js/splitter');
7
7
  const React = require('react');
8
8
  const environmentContext = require('../environment/environment-context.cjs');
9
9
 
10
+ function _interopNamespaceDefault(e) {
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== 'default') {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ const splitter__namespace = /*#__PURE__*/_interopNamespaceDefault(splitter);
28
+
10
29
  const useSplitter = (props) => {
11
30
  const getRootNode = environmentContext.useEnvironmentContext();
12
- const context = {
31
+ const initialContext = {
13
32
  id: React.useId(),
14
33
  getRootNode,
15
- ...props
34
+ ...props,
35
+ size: props.defaultSize
36
+ };
37
+ const context = {
38
+ ...initialContext,
39
+ size: props.size
16
40
  };
17
- const [state, send] = react.useMachine(splitter.machine(context), { context });
18
- return splitter.connect(state, send, react.normalizeProps);
41
+ const [state, send] = react.useMachine(splitter__namespace.machine(initialContext), { context });
42
+ return splitter__namespace.connect(state, send, react.normalizeProps);
19
43
  };
20
44
 
21
45
  exports.useSplitter = useSplitter;
@@ -1,8 +1,10 @@
1
1
  import type { HTMLAttributes } from 'react';
2
- import type { PanelId, ResizeTriggerProps, PanelProps } from '@zag-js/splitter/dist/splitter.types';
3
- import { type Context } from '@zag-js/splitter';
2
+ import type { PanelId } from '@zag-js/splitter/dist/splitter.types';
3
+ import * as splitter from '@zag-js/splitter';
4
4
  import { type Optional } from '../types';
5
- export type UseSplitterProps = Optional<Context, 'id'>;
5
+ export type UseSplitterProps = Optional<splitter.Context, 'id'> & {
6
+ defaultSize?: splitter.Context['size'];
7
+ };
6
8
  export type UseSplitterReturn = ReturnType<typeof useSplitter>;
7
9
  export declare const useSplitter: (props: UseSplitterProps) => {
8
10
  isFocused: boolean;
@@ -11,11 +13,10 @@ export declare const useSplitter: (props: UseSplitterProps) => {
11
13
  min: number;
12
14
  max: number;
13
15
  } | undefined;
14
- collapse(id: PanelId): void;
15
- expand(id: PanelId): void;
16
- toggle(id: PanelId): void;
16
+ setToMinSize(id: PanelId): void;
17
+ setToMaxSize(id: PanelId): void;
17
18
  setSize(id: PanelId, size: number): void;
18
- getResizeTriggerState(props: ResizeTriggerProps): {
19
+ getResizeTriggerState(props: splitter.ResizeTriggerProps): {
19
20
  isDisabled: boolean;
20
21
  isFocused: boolean;
21
22
  panelIds: string[];
@@ -24,6 +25,6 @@ export declare const useSplitter: (props: UseSplitterProps) => {
24
25
  value: number;
25
26
  };
26
27
  rootProps: HTMLAttributes<HTMLElement>;
27
- getPanelProps(props: PanelProps): HTMLAttributes<HTMLElement>;
28
- getResizeTriggerProps(props: ResizeTriggerProps): HTMLAttributes<HTMLElement>;
28
+ getPanelProps(props: splitter.PanelProps): HTMLAttributes<HTMLElement>;
29
+ getResizeTriggerProps(props: splitter.ResizeTriggerProps): HTMLAttributes<HTMLElement>;
29
30
  };
@@ -1,17 +1,22 @@
1
1
  import { useMachine, normalizeProps } from '@zag-js/react';
2
- import { machine, connect } from '@zag-js/splitter';
2
+ import * as splitter from '@zag-js/splitter';
3
3
  import { useId } from 'react';
4
4
  import { useEnvironmentContext } from '../environment/environment-context.mjs';
5
5
 
6
6
  const useSplitter = (props) => {
7
7
  const getRootNode = useEnvironmentContext();
8
- const context = {
8
+ const initialContext = {
9
9
  id: useId(),
10
10
  getRootNode,
11
- ...props
11
+ ...props,
12
+ size: props.defaultSize
13
+ };
14
+ const context = {
15
+ ...initialContext,
16
+ size: props.size
12
17
  };
13
- const [state, send] = useMachine(machine(context), { context });
14
- return connect(state, send, normalizeProps);
18
+ const [state, send] = useMachine(splitter.machine(initialContext), { context });
19
+ return splitter.connect(state, send, normalizeProps);
15
20
  };
16
21
 
17
22
  export { useSplitter };
@@ -290,13 +290,13 @@ export declare const SwitchInput: ForwardRefExoticComponent<{
290
290
  onTransitionEndCapture?: TransitionEventHandler<HTMLInputElement> | undefined;
291
291
  type?: HTMLInputTypeAttribute | undefined;
292
292
  step?: string | number | undefined;
293
- required?: boolean | undefined;
294
293
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
295
- enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
296
294
  height?: string | number | undefined;
295
+ width?: string | number | undefined;
296
+ required?: boolean | undefined;
297
+ enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
297
298
  max?: string | number | undefined;
298
299
  min?: string | number | undefined;
299
300
  readOnly?: boolean | undefined;
300
301
  size?: number | undefined;
301
- width?: string | number | undefined;
302
302
  }>;
@@ -290,15 +290,15 @@ export declare const TagInput: ForwardRefExoticComponent<{
290
290
  onTransitionEndCapture?: TransitionEventHandler<HTMLInputElement> | undefined;
291
291
  type?: HTMLInputTypeAttribute | undefined;
292
292
  step?: string | number | undefined;
293
- required?: boolean | undefined;
294
293
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
295
- enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
296
294
  height?: string | number | undefined;
295
+ width?: string | number | undefined;
296
+ required?: boolean | undefined;
297
+ enterKeyHint?: "search" | "send" | "enter" | "done" | "go" | "next" | "previous" | undefined;
297
298
  max?: string | number | undefined;
298
299
  min?: string | number | undefined;
299
300
  readOnly?: boolean | undefined;
300
301
  size?: number | undefined;
301
- width?: string | number | undefined;
302
302
  index: string | number;
303
303
  value: string;
304
304
  disabled?: boolean | undefined;