@ark-ui/react 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +29 -16
  3. package/color-picker/color-picker.cjs +1 -1
  4. package/color-picker/color-picker.mjs +1 -1
  5. package/combobox/combobox.cjs +1 -1
  6. package/combobox/combobox.d.ts +1 -1
  7. package/combobox/combobox.mjs +1 -1
  8. package/date-picker/date-picker.cjs +2 -2
  9. package/date-picker/date-picker.mjs +2 -2
  10. package/date-picker/date-picker.stories.d.ts +1 -0
  11. package/dialog/dialog-backdrop.cjs +1 -1
  12. package/dialog/dialog-backdrop.mjs +1 -1
  13. package/dialog/dialog.cjs +2 -1
  14. package/dialog/dialog.mjs +2 -1
  15. package/editable/editable.cjs +2 -2
  16. package/editable/editable.mjs +2 -2
  17. package/factory.cjs +1 -2
  18. package/factory.d.ts +1 -1
  19. package/factory.mjs +2 -3
  20. package/factory.test.d.ts +1 -0
  21. package/file-upload/file-upload-item-preview-image.cjs +25 -0
  22. package/file-upload/file-upload-item-preview-image.d.ts +6 -0
  23. package/file-upload/file-upload-item-preview-image.mjs +21 -0
  24. package/file-upload/file-upload-item-preview.cjs +3 -9
  25. package/file-upload/file-upload-item-preview.d.ts +6 -1
  26. package/file-upload/file-upload-item-preview.mjs +4 -10
  27. package/file-upload/file-upload.cjs +6 -2
  28. package/file-upload/file-upload.mjs +6 -2
  29. package/file-upload/index.cjs +7 -5
  30. package/file-upload/index.d.ts +9 -7
  31. package/file-upload/index.mjs +7 -5
  32. package/file-upload/use-file-upload.cjs +2 -1
  33. package/file-upload/use-file-upload.mjs +2 -1
  34. package/hover-card/hover-card.cjs +2 -1
  35. package/hover-card/hover-card.mjs +2 -1
  36. package/index.cjs +8 -6
  37. package/index.mjs +4 -3
  38. package/menu/menu.cjs +4 -3
  39. package/menu/menu.mjs +2 -1
  40. package/number-input/index.cjs +3 -3
  41. package/number-input/index.d.ts +1 -1
  42. package/number-input/index.mjs +1 -1
  43. package/number-input/number-input.cjs +30 -33
  44. package/number-input/number-input.mjs +30 -33
  45. package/package.json +62 -55
  46. package/pagination/pagination-item.cjs +1 -1
  47. package/pagination/pagination-item.mjs +1 -1
  48. package/pagination/pagination.cjs +2 -2
  49. package/pagination/pagination.mjs +2 -2
  50. package/pin-input/index.cjs +3 -3
  51. package/pin-input/index.d.ts +1 -1
  52. package/pin-input/index.mjs +1 -1
  53. package/pin-input/pin-input.cjs +2 -2
  54. package/pin-input/pin-input.mjs +2 -2
  55. package/popover/popover.cjs +2 -1
  56. package/popover/popover.mjs +2 -1
  57. package/portal.cjs +2 -1
  58. package/portal.d.ts +2 -2
  59. package/portal.mjs +2 -1
  60. package/radio-group/radio-group-indicator.cjs +1 -2
  61. package/radio-group/radio-group-indicator.mjs +1 -2
  62. package/radio-group/radio-group-item.d.ts +1 -1
  63. package/radio-group/radio-group.cjs +2 -2
  64. package/radio-group/radio-group.mjs +2 -2
  65. package/rating-group/rating-group-control.cjs +2 -2
  66. package/rating-group/rating-group-control.mjs +2 -2
  67. package/rating-group/rating-group-item-context.d.ts +2 -2
  68. package/rating-group/rating-group-item.cjs +5 -4
  69. package/rating-group/rating-group-item.mjs +5 -4
  70. package/rating-group/rating-group.cjs +2 -2
  71. package/rating-group/rating-group.mjs +2 -2
  72. package/rating-group/use-rating-group.cjs +4 -4
  73. package/rating-group/use-rating-group.d.ts +4 -4
  74. package/rating-group/use-rating-group.mjs +3 -3
  75. package/segment-group/segment-group-indicator.cjs +2 -2
  76. package/segment-group/segment-group-indicator.mjs +2 -2
  77. package/segment-group/segment-group-item-context.d.ts +1 -13
  78. package/segment-group/segment-group-item-control.cjs +2 -2
  79. package/segment-group/segment-group-item-control.mjs +2 -2
  80. package/segment-group/segment-group-item-text.cjs +2 -2
  81. package/segment-group/segment-group-item-text.mjs +2 -2
  82. package/segment-group/segment-group-item.cjs +3 -3
  83. package/segment-group/segment-group-item.d.ts +3 -2
  84. package/segment-group/segment-group-item.mjs +3 -3
  85. package/segment-group/segment-group-label.cjs +2 -2
  86. package/segment-group/segment-group-label.mjs +2 -2
  87. package/segment-group/segment-group.cjs +4 -4
  88. package/segment-group/segment-group.mjs +4 -4
  89. package/select/select-item-group.cjs +2 -2
  90. package/select/select-item-group.mjs +2 -2
  91. package/select/select.cjs +1 -1
  92. package/select/select.d.ts +1 -1
  93. package/select/select.mjs +1 -1
  94. package/switch/switch.cjs +2 -2
  95. package/switch/switch.mjs +2 -2
  96. package/toast/create-toaster.cjs +2 -2
  97. package/toast/create-toaster.d.ts +1 -1
  98. package/toast/create-toaster.mjs +2 -2
  99. package/toast/index.cjs +5 -2
  100. package/toast/index.d.ts +6 -4
  101. package/toast/index.mjs +5 -3
  102. package/toast/toast-group.cjs +15 -0
  103. package/toast/toast-group.d.ts +6 -0
  104. package/toast/toast-group.mjs +11 -0
  105. package/tooltip/tooltip.cjs +2 -1
  106. package/tooltip/tooltip.mjs +2 -1
  107. package/use-is-server.cjs +16 -0
  108. package/use-is-server.d.ts +1 -0
  109. package/use-is-server.mjs +12 -0
  110. package/segment-group/segment-group.anatomy.cjs +0 -10
  111. package/segment-group/segment-group.anatomy.d.ts +0 -2
  112. package/segment-group/segment-group.anatomy.mjs +0 -6
  113. /package/number-input/{number-input-field.cjs → number-input-input.cjs} +0 -0
  114. /package/number-input/{number-input-field.d.ts → number-input-input.d.ts} +0 -0
  115. /package/number-input/{number-input-field.mjs → number-input-input.mjs} +0 -0
  116. /package/pin-input/{pin-input-field.cjs → pin-input-input.cjs} +0 -0
  117. /package/pin-input/{pin-input-field.d.ts → pin-input-input.d.ts} +0 -0
  118. /package/pin-input/{pin-input-field.mjs → pin-input-input.mjs} +0 -0
@@ -12,7 +12,7 @@ const pinInputContext = require('./pin-input-context.cjs');
12
12
  const usePinInput = require('./use-pin-input.cjs');
13
13
 
14
14
  const PinInput = react.forwardRef((props, ref) => {
15
- const [usePinInputProps, divProps] = createSplitProps.createSplitProps()(props, [
15
+ const [usePinInputProps, localProps] = createSplitProps.createSplitProps()(props, [
16
16
  "autoFocus",
17
17
  "blurOnComplete",
18
18
  "defaultValue",
@@ -37,7 +37,7 @@ const PinInput = react.forwardRef((props, ref) => {
37
37
  "value"
38
38
  ]);
39
39
  const api = usePinInput.usePinInput(usePinInputProps);
40
- const mergedProps = react$1.mergeProps(api.rootProps, divProps);
40
+ const mergedProps = react$1.mergeProps(api.rootProps, localProps);
41
41
  return /* @__PURE__ */ jsxRuntime.jsxs(pinInputContext.PinInputProvider, { value: api, children: [
42
42
  /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }),
43
43
  /* @__PURE__ */ jsxRuntime.jsx("input", { ...api.hiddenInputProps })
@@ -8,7 +8,7 @@ import { PinInputProvider } from './pin-input-context.mjs';
8
8
  import { usePinInput } from './use-pin-input.mjs';
9
9
 
10
10
  const PinInput = forwardRef((props, ref) => {
11
- const [usePinInputProps, divProps] = createSplitProps()(props, [
11
+ const [usePinInputProps, localProps] = createSplitProps()(props, [
12
12
  "autoFocus",
13
13
  "blurOnComplete",
14
14
  "defaultValue",
@@ -33,7 +33,7 @@ const PinInput = forwardRef((props, ref) => {
33
33
  "value"
34
34
  ]);
35
35
  const api = usePinInput(usePinInputProps);
36
- const mergedProps = mergeProps(api.rootProps, divProps);
36
+ const mergedProps = mergeProps(api.rootProps, localProps);
37
37
  return /* @__PURE__ */ jsxs(PinInputProvider, { value: api, children: [
38
38
  /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }),
39
39
  /* @__PURE__ */ jsx("input", { ...api.hiddenInputProps })
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
+ const react = require('@zag-js/react');
7
8
  require('react');
8
9
  require('../presence/index.cjs');
9
10
  const splitPresenceProps = require('../presence/split-presence-props.cjs');
@@ -16,7 +17,7 @@ const presenceContext = require('../presence/presence-context.cjs');
16
17
  const Popover = (props) => {
17
18
  const [presenceProps, { children, ...localProps }] = splitPresenceProps.splitPresenceProps(props);
18
19
  const api = usePopover.usePopover(localProps);
19
- const presenceApi = usePresence.usePresence({ ...presenceProps, present: api.isOpen });
20
+ const presenceApi = usePresence.usePresence(react.mergeProps({ present: api.isOpen }, presenceProps));
20
21
  const view = runIfFn.runIfFn(children, api);
21
22
  return /* @__PURE__ */ jsxRuntime.jsx(popoverContext.PopoverProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(presenceContext.PresenceProvider, { value: presenceApi, children: view }) });
22
23
  };
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
+ import { mergeProps } from '@zag-js/react';
3
4
  import 'react';
4
5
  import '../presence/index.mjs';
5
6
  import { splitPresenceProps } from '../presence/split-presence-props.mjs';
@@ -12,7 +13,7 @@ import { PresenceProvider } from '../presence/presence-context.mjs';
12
13
  const Popover = (props) => {
13
14
  const [presenceProps, { children, ...localProps }] = splitPresenceProps(props);
14
15
  const api = usePopover(localProps);
15
- const presenceApi = usePresence({ ...presenceProps, present: api.isOpen });
16
+ const presenceApi = usePresence(mergeProps({ present: api.isOpen }, presenceProps));
16
17
  const view = runIfFn(children, api);
17
18
  return /* @__PURE__ */ jsx(PopoverProvider, { value: api, children: /* @__PURE__ */ jsx(PresenceProvider, { value: presenceApi, children: view }) });
18
19
  };
package/portal.cjs CHANGED
@@ -6,11 +6,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6
6
  const react = require('react');
7
7
  const reactDom = require('react-dom');
8
8
  require('./environment/index.cjs');
9
+ const useIsServer = require('./use-is-server.cjs');
9
10
  const environmentContext = require('./environment/environment-context.cjs');
10
11
 
11
- const isServer = typeof window === "undefined";
12
12
  const Portal = (props) => {
13
13
  const { children, container, disabled } = props;
14
+ const isServer = useIsServer.useIsServer();
14
15
  const getRootNode = environmentContext.useEnvironmentContext();
15
16
  if (isServer || disabled)
16
17
  return children;
package/portal.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { ReactNode, type PropsWithChildren, type RefObject } from 'react';
1
+ import { type PropsWithChildren, type ReactNode, type ReactPortal, type RefObject } from 'react';
2
2
  export interface PortalProps {
3
3
  disabled?: boolean;
4
4
  container?: RefObject<HTMLElement>;
5
5
  }
6
- export declare const Portal: (props: PropsWithChildren<PortalProps>) => ReactNode;
6
+ export declare const Portal: (props: PropsWithChildren<PortalProps>) => ReactPortal[] | ReactNode | null | undefined;
package/portal.mjs CHANGED
@@ -2,11 +2,12 @@
2
2
  import { Children } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import './environment/index.mjs';
5
+ import { useIsServer } from './use-is-server.mjs';
5
6
  import { useEnvironmentContext } from './environment/environment-context.mjs';
6
7
 
7
- const isServer = typeof window === "undefined";
8
8
  const Portal = (props) => {
9
9
  const { children, container, disabled } = props;
10
+ const isServer = useIsServer();
10
11
  const getRootNode = useEnvironmentContext();
11
12
  if (isServer || disabled)
12
13
  return children;
@@ -4,7 +4,6 @@
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
- const anatomy = require('@ark-ui/anatomy');
8
7
  const react$1 = require('@zag-js/react');
9
8
  const react = require('react');
10
9
  const factory = require('../factory.cjs');
@@ -14,7 +13,7 @@ const RadioGroupIndicator = react.forwardRef(
14
13
  (props, ref) => {
15
14
  const api = radioGroupContext.useRadioGroupContext();
16
15
  const mergedProps = react$1.mergeProps(api.indicatorProps, props);
17
- return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ...anatomy.radioGroupAnatomy.build().indicator.attrs, ref });
16
+ return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
18
17
  }
19
18
  );
20
19
  RadioGroupIndicator.displayName = "RadioGroupIndicator";
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { radioGroupAnatomy } from '@ark-ui/anatomy';
4
3
  import { mergeProps } from '@zag-js/react';
5
4
  import { forwardRef } from 'react';
6
5
  import { ark } from '../factory.mjs';
@@ -10,7 +9,7 @@ const RadioGroupIndicator = forwardRef(
10
9
  (props, ref) => {
11
10
  const api = useRadioGroupContext();
12
11
  const mergedProps = mergeProps(api.indicatorProps, props);
13
- return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ...radioGroupAnatomy.build().indicator.attrs, ref });
12
+ return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
14
13
  }
15
14
  );
16
15
  RadioGroupIndicator.displayName = "RadioGroupIndicator";
@@ -3,7 +3,7 @@ import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react'
3
3
  import { type HTMLArkProps } from '../factory';
4
4
  import type { Assign } from '../types';
5
5
  export interface RadioGroupItemProps extends Assign<HTMLArkProps<'label'>, {
6
- children?: ReactNode | ((state: ItemState) => ReactNode);
6
+ children?: ((state: ItemState) => ReactNode) | ReactNode;
7
7
  }>, ItemProps {
8
8
  }
9
9
  export declare const RadioGroupItem: ForwardRefExoticComponent<RadioGroupItemProps & RefAttributes<HTMLLabelElement>>;
@@ -12,7 +12,7 @@ const radioGroupContext = require('./radio-group-context.cjs');
12
12
  const useRadioGroup = require('./use-radio-group.cjs');
13
13
 
14
14
  const RadioGroup = react.forwardRef((props, ref) => {
15
- const [useRadioGroupProps, divProps] = createSplitProps.createSplitProps()(props, [
15
+ const [useRadioGroupProps, localProps] = createSplitProps.createSplitProps()(props, [
16
16
  "defaultValue",
17
17
  "dir",
18
18
  "disabled",
@@ -26,7 +26,7 @@ const RadioGroup = react.forwardRef((props, ref) => {
26
26
  "value"
27
27
  ]);
28
28
  const api = useRadioGroup.useRadioGroup(useRadioGroupProps);
29
- const mergedProps = react$1.mergeProps(api.rootProps, divProps);
29
+ const mergedProps = react$1.mergeProps(api.rootProps, localProps);
30
30
  return /* @__PURE__ */ jsxRuntime.jsx(radioGroupContext.RadioGroupProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }) });
31
31
  });
32
32
  RadioGroup.displayName = "RadioGroup";
@@ -8,7 +8,7 @@ import { RadioGroupProvider } from './radio-group-context.mjs';
8
8
  import { useRadioGroup } from './use-radio-group.mjs';
9
9
 
10
10
  const RadioGroup = forwardRef((props, ref) => {
11
- const [useRadioGroupProps, divProps] = createSplitProps()(props, [
11
+ const [useRadioGroupProps, localProps] = createSplitProps()(props, [
12
12
  "defaultValue",
13
13
  "dir",
14
14
  "disabled",
@@ -22,7 +22,7 @@ const RadioGroup = forwardRef((props, ref) => {
22
22
  "value"
23
23
  ]);
24
24
  const api = useRadioGroup(useRadioGroupProps);
25
- const mergedProps = mergeProps(api.rootProps, divProps);
25
+ const mergedProps = mergeProps(api.rootProps, localProps);
26
26
  return /* @__PURE__ */ jsx(RadioGroupProvider, { value: api, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });
27
27
  });
28
28
  RadioGroup.displayName = "RadioGroup";
@@ -12,9 +12,9 @@ const ratingGroupContext = require('./rating-group-context.cjs');
12
12
 
13
13
  const RatingGroupControl = react.forwardRef(
14
14
  (props, ref) => {
15
- const { children, ...divProps } = props;
15
+ const { children, ...localProps } = props;
16
16
  const api = ratingGroupContext.useRatingGroupContext();
17
- const mergedProps = react$1.mergeProps(api.controlProps, divProps);
17
+ const mergedProps = react$1.mergeProps(api.controlProps, localProps);
18
18
  const view = runIfFn.runIfFn(children, api);
19
19
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
20
20
  /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref, children: view }),
@@ -8,9 +8,9 @@ import { useRatingGroupContext } from './rating-group-context.mjs';
8
8
 
9
9
  const RatingGroupControl = forwardRef(
10
10
  (props, ref) => {
11
- const { children, ...divProps } = props;
11
+ const { children, ...localProps } = props;
12
12
  const api = useRatingGroupContext();
13
- const mergedProps = mergeProps(api.controlProps, divProps);
13
+ const mergedProps = mergeProps(api.controlProps, localProps);
14
14
  const view = runIfFn(children, api);
15
15
  return /* @__PURE__ */ jsxs(Fragment, { children: [
16
16
  /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref, children: view }),
@@ -1,6 +1,6 @@
1
1
  import { Provider } from 'react';
2
2
  /// <reference types="react" />
3
- import { type ItemState } from '@zag-js/rating-group';
4
- export interface RatingGroupItemContext extends ItemState {
3
+ import { type ItemProps } from '@zag-js/rating-group';
4
+ export interface RatingGroupItemContext extends ItemProps {
5
5
  }
6
6
  export declare const RatingGroupItemProvider: Provider<RatingGroupItemContext>, useRatingGroupItemContext: () => RatingGroupItemContext;
@@ -6,18 +6,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
7
  const react$1 = require('@zag-js/react');
8
8
  const react = require('react');
9
+ const createSplitProps = require('../create-split-props.cjs');
9
10
  const factory = require('../factory.cjs');
10
11
  const runIfFn = require('../run-if-fn.cjs');
11
12
  const ratingGroupContext = require('./rating-group-context.cjs');
12
13
  const ratingGroupItemContext = require('./rating-group-item-context.cjs');
13
14
 
14
15
  const RatingGroupItem = react.forwardRef((props, ref) => {
15
- const { children, index, ...divProps } = props;
16
+ const [itemProps, { children, ...localProps }] = createSplitProps.createSplitProps()(props, ["index"]);
16
17
  const api = ratingGroupContext.useRatingGroupContext();
17
- const itemState = api.getItemState({ index });
18
- const mergedProps = react$1.mergeProps(api.getItemProps({ index }), divProps);
18
+ const mergedProps = react$1.mergeProps(api.getItemProps(itemProps), localProps);
19
+ const itemState = api.getItemState(itemProps);
19
20
  const view = runIfFn.runIfFn(children, itemState);
20
- return /* @__PURE__ */ jsxRuntime.jsx(ratingGroupItemContext.RatingGroupItemProvider, { value: itemState, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.span, { ...mergedProps, ref, children: view }) });
21
+ return /* @__PURE__ */ jsxRuntime.jsx(ratingGroupItemContext.RatingGroupItemProvider, { value: itemProps, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.span, { ...mergedProps, ref, children: view }) });
21
22
  });
22
23
  RatingGroupItem.displayName = "RatingGroupItem";
23
24
 
@@ -2,18 +2,19 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { mergeProps } from '@zag-js/react';
4
4
  import { forwardRef } from 'react';
5
+ import { createSplitProps } from '../create-split-props.mjs';
5
6
  import { ark } from '../factory.mjs';
6
7
  import { runIfFn } from '../run-if-fn.mjs';
7
8
  import { useRatingGroupContext } from './rating-group-context.mjs';
8
9
  import { RatingGroupItemProvider } from './rating-group-item-context.mjs';
9
10
 
10
11
  const RatingGroupItem = forwardRef((props, ref) => {
11
- const { children, index, ...divProps } = props;
12
+ const [itemProps, { children, ...localProps }] = createSplitProps()(props, ["index"]);
12
13
  const api = useRatingGroupContext();
13
- const itemState = api.getItemState({ index });
14
- const mergedProps = mergeProps(api.getItemProps({ index }), divProps);
14
+ const mergedProps = mergeProps(api.getItemProps(itemProps), localProps);
15
+ const itemState = api.getItemState(itemProps);
15
16
  const view = runIfFn(children, itemState);
16
- return /* @__PURE__ */ jsx(RatingGroupItemProvider, { value: itemState, children: /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref, children: view }) });
17
+ return /* @__PURE__ */ jsx(RatingGroupItemProvider, { value: itemProps, children: /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref, children: view }) });
17
18
  });
18
19
  RatingGroupItem.displayName = "RatingGroupItem";
19
20
 
@@ -12,7 +12,7 @@ const ratingGroupContext = require('./rating-group-context.cjs');
12
12
  const useRatingGroup = require('./use-rating-group.cjs');
13
13
 
14
14
  const RatingGroup = react.forwardRef((props, ref) => {
15
- const [useRatingProps, inputProps] = createSplitProps.createSplitProps()(props, [
15
+ const [useRatingProps, localProps] = createSplitProps.createSplitProps()(props, [
16
16
  "allowHalf",
17
17
  "autoFocus",
18
18
  "count",
@@ -31,7 +31,7 @@ const RatingGroup = react.forwardRef((props, ref) => {
31
31
  "value"
32
32
  ]);
33
33
  const api = useRatingGroup.useRatingGroup(useRatingProps);
34
- const mergedProps = react$1.mergeProps(api.rootProps, inputProps);
34
+ const mergedProps = react$1.mergeProps(api.rootProps, localProps);
35
35
  return /* @__PURE__ */ jsxRuntime.jsx(ratingGroupContext.RatingGroupProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }) });
36
36
  });
37
37
  RatingGroup.displayName = "RatingGroup";
@@ -8,7 +8,7 @@ import { RatingGroupProvider } from './rating-group-context.mjs';
8
8
  import { useRatingGroup } from './use-rating-group.mjs';
9
9
 
10
10
  const RatingGroup = forwardRef((props, ref) => {
11
- const [useRatingProps, inputProps] = createSplitProps()(props, [
11
+ const [useRatingProps, localProps] = createSplitProps()(props, [
12
12
  "allowHalf",
13
13
  "autoFocus",
14
14
  "count",
@@ -27,7 +27,7 @@ const RatingGroup = forwardRef((props, ref) => {
27
27
  "value"
28
28
  ]);
29
29
  const api = useRatingGroup(useRatingProps);
30
- const mergedProps = mergeProps(api.rootProps, inputProps);
30
+ const mergedProps = mergeProps(api.rootProps, localProps);
31
31
  return /* @__PURE__ */ jsx(RatingGroupProvider, { value: api, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });
32
32
  });
33
33
  RatingGroup.displayName = "RatingGroup";
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
- const ratingGroup = require('@zag-js/rating-group');
6
+ const rating = require('@zag-js/rating-group');
7
7
  const react$1 = require('@zag-js/react');
8
8
  const react = require('react');
9
9
  require('../environment/index.cjs');
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
27
27
  return Object.freeze(n);
28
28
  }
29
29
 
30
- const ratingGroup__namespace = /*#__PURE__*/_interopNamespaceDefault(ratingGroup);
30
+ const rating__namespace = /*#__PURE__*/_interopNamespaceDefault(rating);
31
31
 
32
32
  const useRatingGroup = (props) => {
33
33
  const initialContext = {
@@ -42,10 +42,10 @@ const useRatingGroup = (props) => {
42
42
  onValueChange: useEvent.useEvent(props.onValueChange, { sync: true }),
43
43
  onHoverChange: useEvent.useEvent(props.onHoverChange)
44
44
  };
45
- const [state, send] = react$1.useMachine(ratingGroup__namespace.machine(initialContext), {
45
+ const [state, send] = react$1.useMachine(rating__namespace.machine(initialContext), {
46
46
  context
47
47
  });
48
- return ratingGroup__namespace.connect(state, send, react$1.normalizeProps);
48
+ return rating__namespace.connect(state, send, react$1.normalizeProps);
49
49
  };
50
50
 
51
51
  exports.useRatingGroup = useRatingGroup;
@@ -1,12 +1,12 @@
1
- import * as ratingGroup from '@zag-js/rating-group';
1
+ import * as rating from '@zag-js/rating-group';
2
2
  import { type PropTypes } from '@zag-js/react';
3
3
  import { type Optional } from '../types';
4
- export interface UseRatingGroupProps extends Optional<ratingGroup.Context, 'id'> {
4
+ export interface UseRatingGroupProps extends Optional<rating.Context, 'id'> {
5
5
  /**
6
6
  * The initial value of the rating group.
7
7
  */
8
- defaultValue?: ratingGroup.Context['value'];
8
+ defaultValue?: rating.Context['value'];
9
9
  }
10
- export interface UseRatingGroupReturn extends ratingGroup.Api<PropTypes> {
10
+ export interface UseRatingGroupReturn extends rating.Api<PropTypes> {
11
11
  }
12
12
  export declare const useRatingGroup: (props: UseRatingGroupProps) => UseRatingGroupReturn;
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import * as ratingGroup from '@zag-js/rating-group';
2
+ import * as rating from '@zag-js/rating-group';
3
3
  import { useMachine, normalizeProps } from '@zag-js/react';
4
4
  import { useId } from 'react';
5
5
  import '../environment/index.mjs';
@@ -19,10 +19,10 @@ const useRatingGroup = (props) => {
19
19
  onValueChange: useEvent(props.onValueChange, { sync: true }),
20
20
  onHoverChange: useEvent(props.onHoverChange)
21
21
  };
22
- const [state, send] = useMachine(ratingGroup.machine(initialContext), {
22
+ const [state, send] = useMachine(rating.machine(initialContext), {
23
23
  context
24
24
  });
25
- return ratingGroup.connect(state, send, normalizeProps);
25
+ return rating.connect(state, send, normalizeProps);
26
26
  };
27
27
 
28
28
  export { useRatingGroup };
@@ -4,18 +4,18 @@
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
+ const anatomy = require('@ark-ui/anatomy');
7
8
  const react$1 = require('@zag-js/react');
8
9
  const react = require('react');
9
10
  const factory = require('../factory.cjs');
10
11
  const segmentGroupContext = require('./segment-group-context.cjs');
11
- const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
12
12
 
13
13
  const SegmentGroupIndicator = react.forwardRef(
14
14
  (props, ref) => {
15
15
  const api = segmentGroupContext.useSegmentGroupContext();
16
16
  const mergedProps = react$1.mergeProps(
17
17
  api.indicatorProps,
18
- segmentGroup_anatomy.parts.indicator.attrs,
18
+ anatomy.segmentGroupAnatomy.build().indicator.attrs,
19
19
  props
20
20
  );
21
21
  return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
@@ -1,17 +1,17 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
+ import { segmentGroupAnatomy } from '@ark-ui/anatomy';
3
4
  import { mergeProps } from '@zag-js/react';
4
5
  import { forwardRef } from 'react';
5
6
  import { ark } from '../factory.mjs';
6
7
  import { useSegmentGroupContext } from './segment-group-context.mjs';
7
- import { parts } from './segment-group.anatomy.mjs';
8
8
 
9
9
  const SegmentGroupIndicator = forwardRef(
10
10
  (props, ref) => {
11
11
  const api = useSegmentGroupContext();
12
12
  const mergedProps = mergeProps(
13
13
  api.indicatorProps,
14
- parts.indicator.attrs,
14
+ segmentGroupAnatomy.build().indicator.attrs,
15
15
  props
16
16
  );
17
17
  return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
@@ -1,18 +1,6 @@
1
1
  import { Provider } from 'react';
2
2
  /// <reference types="react" />
3
- export interface ItemProps {
4
- value: string;
5
- disabled?: boolean;
6
- invalid?: boolean;
7
- }
8
- export interface ItemState {
9
- isInvalid: boolean;
10
- isDisabled: boolean;
11
- isChecked: boolean;
12
- isFocused: boolean;
13
- isHovered: boolean;
14
- isActive: boolean;
15
- }
3
+ import type { ItemProps } from '@zag-js/radio-group';
16
4
  export interface SegmentGroupItemContext extends ItemProps {
17
5
  }
18
6
  export declare const SegmentGroupItemProvider: Provider<SegmentGroupItemContext>, useSegmentGroupItemContext: () => SegmentGroupItemContext;
@@ -4,12 +4,12 @@
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
+ const anatomy = require('@ark-ui/anatomy');
7
8
  const react$1 = require('@zag-js/react');
8
9
  const react = require('react');
9
10
  const factory = require('../factory.cjs');
10
11
  const segmentGroupContext = require('./segment-group-context.cjs');
11
12
  const segmentGroupItemContext = require('./segment-group-item-context.cjs');
12
- const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
13
13
 
14
14
  const SegmentGroupItemControl = react.forwardRef(
15
15
  (props, ref) => {
@@ -17,7 +17,7 @@ const SegmentGroupItemControl = react.forwardRef(
17
17
  const itemProps = segmentGroupItemContext.useSegmentGroupItemContext();
18
18
  const mergedProps = react$1.mergeProps(
19
19
  api.getItemControlProps(itemProps),
20
- segmentGroup_anatomy.parts.itemControl.attrs,
20
+ anatomy.segmentGroupAnatomy.build().itemControl.attrs,
21
21
  props
22
22
  );
23
23
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+ import { segmentGroupAnatomy } from '@ark-ui/anatomy';
3
4
  import { mergeProps } from '@zag-js/react';
4
5
  import { forwardRef } from 'react';
5
6
  import { ark } from '../factory.mjs';
6
7
  import { useSegmentGroupContext } from './segment-group-context.mjs';
7
8
  import { useSegmentGroupItemContext } from './segment-group-item-context.mjs';
8
- import { parts } from './segment-group.anatomy.mjs';
9
9
 
10
10
  const SegmentGroupItemControl = forwardRef(
11
11
  (props, ref) => {
@@ -13,7 +13,7 @@ const SegmentGroupItemControl = forwardRef(
13
13
  const itemProps = useSegmentGroupItemContext();
14
14
  const mergedProps = mergeProps(
15
15
  api.getItemControlProps(itemProps),
16
- parts.itemControl.attrs,
16
+ segmentGroupAnatomy.build().itemControl.attrs,
17
17
  props
18
18
  );
19
19
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -4,12 +4,12 @@
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
+ const anatomy = require('@ark-ui/anatomy');
7
8
  const react$1 = require('@zag-js/react');
8
9
  const react = require('react');
9
10
  const factory = require('../factory.cjs');
10
11
  const segmentGroupContext = require('./segment-group-context.cjs');
11
12
  const segmentGroupItemContext = require('./segment-group-item-context.cjs');
12
- const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
13
13
 
14
14
  const SegmentGroupItemText = react.forwardRef(
15
15
  (props, ref) => {
@@ -17,7 +17,7 @@ const SegmentGroupItemText = react.forwardRef(
17
17
  const itemProps = segmentGroupItemContext.useSegmentGroupItemContext();
18
18
  const mergedProps = react$1.mergeProps(
19
19
  api.getItemTextProps(itemProps),
20
- segmentGroup_anatomy.parts.itemText.attrs,
20
+ anatomy.segmentGroupAnatomy.build().itemText.attrs,
21
21
  props
22
22
  );
23
23
  return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.span, { ...mergedProps, ref });
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
+ import { segmentGroupAnatomy } from '@ark-ui/anatomy';
3
4
  import { mergeProps } from '@zag-js/react';
4
5
  import { forwardRef } from 'react';
5
6
  import { ark } from '../factory.mjs';
6
7
  import { useSegmentGroupContext } from './segment-group-context.mjs';
7
8
  import { useSegmentGroupItemContext } from './segment-group-item-context.mjs';
8
- import { parts } from './segment-group.anatomy.mjs';
9
9
 
10
10
  const SegmentGroupItemText = forwardRef(
11
11
  (props, ref) => {
@@ -13,7 +13,7 @@ const SegmentGroupItemText = forwardRef(
13
13
  const itemProps = useSegmentGroupItemContext();
14
14
  const mergedProps = mergeProps(
15
15
  api.getItemTextProps(itemProps),
16
- parts.itemText.attrs,
16
+ segmentGroupAnatomy.build().itemText.attrs,
17
17
  props
18
18
  );
19
19
  return /* @__PURE__ */ jsx(ark.span, { ...mergedProps, ref });
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
+ const anatomy = require('@ark-ui/anatomy');
7
8
  const react$1 = require('@zag-js/react');
8
9
  const react = require('react');
9
10
  const createSplitProps = require('../create-split-props.cjs');
@@ -11,7 +12,6 @@ const factory = require('../factory.cjs');
11
12
  const runIfFn = require('../run-if-fn.cjs');
12
13
  const segmentGroupContext = require('./segment-group-context.cjs');
13
14
  const segmentGroupItemContext = require('./segment-group-item-context.cjs');
14
- const segmentGroup_anatomy = require('./segment-group.anatomy.cjs');
15
15
 
16
16
  const SegmentGroupItem = react.forwardRef(
17
17
  (props, ref) => {
@@ -22,12 +22,12 @@ const SegmentGroupItem = react.forwardRef(
22
22
  const api = segmentGroupContext.useSegmentGroupContext();
23
23
  const mergedProps = react$1.mergeProps(
24
24
  api.getItemProps(itemProps),
25
- segmentGroup_anatomy.parts.item.attrs,
25
+ anatomy.segmentGroupAnatomy.build().item.attrs,
26
26
  localProps
27
27
  );
28
28
  const itemState = api.getItemState(itemProps);
29
29
  const view = runIfFn.runIfFn(children, itemState);
30
- return /* @__PURE__ */ jsxRuntime.jsx(segmentGroupItemContext.SegmentGroupItemProvider, { value: props, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.label, { ...mergedProps, ref, children: view }) });
30
+ return /* @__PURE__ */ jsxRuntime.jsx(segmentGroupItemContext.SegmentGroupItemProvider, { value: itemProps, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.label, { ...mergedProps, ref, children: view }) });
31
31
  }
32
32
  );
33
33
  SegmentGroupItem.displayName = "SegmentGroupItem";
@@ -1,9 +1,10 @@
1
+ import type { ItemState } from '@zag-js/radio-group';
1
2
  import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react';
2
3
  import { type HTMLArkProps } from '../factory';
3
4
  import type { Assign } from '../types';
4
- import { type ItemState, type SegmentGroupItemContext } from './segment-group-item-context';
5
+ import { type SegmentGroupItemContext } from './segment-group-item-context';
5
6
  export interface SegmentGroupItemProps extends Assign<HTMLArkProps<'label'>, {
6
- children?: ReactNode | ((state: ItemState) => ReactNode);
7
+ children?: ((state: ItemState) => ReactNode) | ReactNode;
7
8
  }>, SegmentGroupItemContext {
8
9
  }
9
10
  export declare const SegmentGroupItem: ForwardRefExoticComponent<SegmentGroupItemProps & RefAttributes<HTMLLabelElement>>;
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
+ import { segmentGroupAnatomy } from '@ark-ui/anatomy';
3
4
  import { mergeProps } from '@zag-js/react';
4
5
  import { forwardRef } from 'react';
5
6
  import { createSplitProps } from '../create-split-props.mjs';
@@ -7,7 +8,6 @@ import { ark } from '../factory.mjs';
7
8
  import { runIfFn } from '../run-if-fn.mjs';
8
9
  import { useSegmentGroupContext } from './segment-group-context.mjs';
9
10
  import { SegmentGroupItemProvider } from './segment-group-item-context.mjs';
10
- import { parts } from './segment-group.anatomy.mjs';
11
11
 
12
12
  const SegmentGroupItem = forwardRef(
13
13
  (props, ref) => {
@@ -18,12 +18,12 @@ const SegmentGroupItem = forwardRef(
18
18
  const api = useSegmentGroupContext();
19
19
  const mergedProps = mergeProps(
20
20
  api.getItemProps(itemProps),
21
- parts.item.attrs,
21
+ segmentGroupAnatomy.build().item.attrs,
22
22
  localProps
23
23
  );
24
24
  const itemState = api.getItemState(itemProps);
25
25
  const view = runIfFn(children, itemState);
26
- return /* @__PURE__ */ jsx(SegmentGroupItemProvider, { value: props, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref, children: view }) });
26
+ return /* @__PURE__ */ jsx(SegmentGroupItemProvider, { value: itemProps, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref, children: view }) });
27
27
  }
28
28
  );
29
29
  SegmentGroupItem.displayName = "SegmentGroupItem";