@ark-ui/react 0.7.2 → 0.7.3

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 (139) hide show
  1. package/CHANGELOG.md +12 -3
  2. package/accordion/index.cjs +20 -0
  3. package/accordion/index.mjs +5 -0
  4. package/avatar/index.cjs +18 -0
  5. package/avatar/index.mjs +4 -0
  6. package/carousel/carousel.cjs +1 -0
  7. package/carousel/carousel.mjs +1 -0
  8. package/carousel/index.cjs +23 -0
  9. package/carousel/index.mjs +8 -0
  10. package/checkbox/checkbox.cjs +1 -0
  11. package/checkbox/checkbox.mjs +1 -0
  12. package/checkbox/index.cjs +20 -0
  13. package/checkbox/index.mjs +5 -0
  14. package/color-picker/color-picker.cjs +1 -0
  15. package/color-picker/color-picker.mjs +1 -0
  16. package/color-picker/index.cjs +35 -0
  17. package/color-picker/index.mjs +14 -0
  18. package/combobox/index.cjs +28 -0
  19. package/combobox/index.mjs +9 -0
  20. package/date-picker/date-picker.cjs +1 -0
  21. package/date-picker/date-picker.mjs +1 -0
  22. package/date-picker/index.cjs +53 -0
  23. package/date-picker/index.mjs +23 -0
  24. package/dialog/dialog.cjs +1 -0
  25. package/dialog/dialog.mjs +1 -0
  26. package/dialog/index.cjs +28 -0
  27. package/dialog/index.mjs +9 -0
  28. package/editable/editable-cancel-trigger.cjs +1 -0
  29. package/editable/editable-cancel-trigger.mjs +1 -0
  30. package/editable/editable-edit-trigger.cjs +1 -0
  31. package/editable/editable-edit-trigger.mjs +1 -0
  32. package/editable/editable-submit-trigger.cjs +1 -0
  33. package/editable/editable-submit-trigger.mjs +1 -0
  34. package/editable/editable.cjs +1 -0
  35. package/editable/editable.mjs +1 -0
  36. package/editable/index.cjs +30 -0
  37. package/editable/index.mjs +10 -0
  38. package/environment/environment-context.cjs +1 -0
  39. package/environment/environment-context.mjs +1 -0
  40. package/environment/index.cjs +11 -0
  41. package/environment/index.mjs +2 -0
  42. package/hover-card/hover-card.cjs +1 -0
  43. package/hover-card/hover-card.mjs +1 -0
  44. package/hover-card/index.cjs +24 -0
  45. package/hover-card/index.mjs +7 -0
  46. package/index.cjs +108 -108
  47. package/index.mjs +22 -22
  48. package/menu/index.cjs +38 -0
  49. package/menu/index.mjs +14 -0
  50. package/menu/menu-option-item.cjs +2 -0
  51. package/menu/menu-option-item.mjs +2 -0
  52. package/number-input/index.cjs +26 -0
  53. package/number-input/index.mjs +8 -0
  54. package/number-input/number-input-decrement-trigger.cjs +1 -0
  55. package/number-input/number-input-decrement-trigger.mjs +1 -0
  56. package/number-input/number-input-increment-trigger.cjs +1 -0
  57. package/number-input/number-input-increment-trigger.mjs +1 -0
  58. package/package.json +48 -47
  59. package/pagination/index.cjs +23 -0
  60. package/pagination/index.mjs +8 -0
  61. package/pagination/pagination.cjs +1 -0
  62. package/pagination/pagination.mjs +1 -0
  63. package/pin-input/index.cjs +20 -0
  64. package/pin-input/index.mjs +5 -0
  65. package/popover/index.cjs +32 -0
  66. package/popover/index.mjs +11 -0
  67. package/popover/popover.cjs +1 -0
  68. package/popover/popover.mjs +1 -0
  69. package/popover/use-popover.cjs +1 -1
  70. package/popover/use-popover.mjs +1 -1
  71. package/pressable/index.cjs +11 -0
  72. package/pressable/index.mjs +2 -0
  73. package/radio-group/index.cjs +24 -0
  74. package/radio-group/index.mjs +7 -0
  75. package/radio-group/radio-context.cjs +1 -0
  76. package/radio-group/radio-context.mjs +1 -0
  77. package/range-slider/index.cjs +30 -0
  78. package/range-slider/index.mjs +10 -0
  79. package/range-slider/range-slider-output.cjs +1 -0
  80. package/range-slider/range-slider-output.mjs +1 -0
  81. package/range-slider/range-slider.cjs +1 -0
  82. package/range-slider/range-slider.mjs +1 -0
  83. package/rating-group/index.cjs +20 -0
  84. package/rating-group/index.mjs +5 -0
  85. package/rating-group/rating-context.cjs +1 -0
  86. package/rating-group/rating-context.mjs +1 -0
  87. package/rating-group/rating-group-control.cjs +1 -0
  88. package/rating-group/rating-group-control.mjs +1 -0
  89. package/rating-group/rating.cjs +1 -0
  90. package/rating-group/rating.mjs +1 -0
  91. package/segment-group/index.cjs +23 -0
  92. package/segment-group/index.mjs +8 -0
  93. package/segment-group/segment-context.cjs +1 -0
  94. package/segment-group/segment-context.mjs +1 -0
  95. package/select/index.cjs +28 -0
  96. package/select/index.mjs +9 -0
  97. package/select/select.cjs +1 -0
  98. package/select/select.mjs +1 -0
  99. package/slider/index.cjs +30 -0
  100. package/slider/index.mjs +10 -0
  101. package/slider/slider.cjs +1 -0
  102. package/slider/slider.mjs +1 -0
  103. package/splitter/index.cjs +18 -0
  104. package/splitter/index.mjs +4 -0
  105. package/splitter/splitter-panel.cjs +1 -0
  106. package/splitter/splitter-panel.mjs +1 -0
  107. package/splitter/splitter-resize-trigger.cjs +1 -0
  108. package/splitter/splitter-resize-trigger.mjs +1 -0
  109. package/switch/index.cjs +22 -0
  110. package/switch/index.mjs +6 -0
  111. package/tabs/index.cjs +22 -0
  112. package/tabs/index.mjs +6 -0
  113. package/tabs/tab-content.cjs +1 -0
  114. package/tabs/tab-content.mjs +1 -0
  115. package/tags-input/index.cjs +28 -0
  116. package/tags-input/index.mjs +9 -0
  117. package/tags-input/tags-input.cjs +1 -0
  118. package/tags-input/tags-input.mjs +1 -0
  119. package/toast/index.cjs +27 -0
  120. package/toast/index.mjs +8 -0
  121. package/toast/toast-group.cjs +2 -0
  122. package/toast/toast-group.mjs +2 -0
  123. package/toast/toast-placements.cjs +2 -0
  124. package/toast/toast-placements.mjs +2 -0
  125. package/toast/toast.cjs +6 -2
  126. package/toast/toast.mjs +6 -2
  127. package/tooltip/index.cjs +24 -0
  128. package/tooltip/index.mjs +7 -0
  129. package/tooltip/tooltip.cjs +1 -0
  130. package/tooltip/tooltip.mjs +1 -0
  131. package/transition/index.cjs +11 -0
  132. package/transition/index.d.ts +2 -0
  133. package/transition/index.mjs +2 -0
  134. package/transition/transition.cjs +28 -0
  135. package/transition/transition.d.ts +12 -0
  136. package/transition/transition.mjs +24 -0
  137. package/transition/use-transition.cjs +37 -0
  138. package/transition/use-transition.d.ts +10 -0
  139. package/transition/use-transition.mjs +14 -0
@@ -3,6 +3,8 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
+ require('@zag-js/toast');
7
+ require('react');
6
8
  const runIfFn = require('../run-if-fn.cjs');
7
9
  const toastProvider = require('./toast-provider.cjs');
8
10
 
@@ -1,4 +1,6 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import '@zag-js/toast';
3
+ import 'react';
2
4
  import { runIfFn } from '../run-if-fn.mjs';
3
5
  import { useToast } from './toast-provider.mjs';
4
6
 
package/toast/toast.cjs CHANGED
@@ -11,10 +11,14 @@ const toastItemContext = require('./toast-item-context.cjs');
11
11
  const useToastItem = require('./use-toast-item.cjs');
12
12
 
13
13
  const Toast = forwardRef.forwardRef((props, ref) => {
14
- const [useToastItemProps, divProps] = createSplitProps.createSplitProps()(props, ["toast"]);
14
+ const [useToastItemProps, { children, ...divProps }] = createSplitProps.createSplitProps()(
15
+ props,
16
+ ["toast"]
17
+ );
15
18
  const api = useToastItem.useToastItem(useToastItemProps);
16
19
  const mergedProps = react.mergeProps(api.rootProps, divProps);
17
- return /* @__PURE__ */ jsxRuntime.jsx(toastItemContext.ToastItemProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }) });
20
+ const customToast = api.render();
21
+ return /* @__PURE__ */ jsxRuntime.jsx(toastItemContext.ToastItemProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref, children: customToast || children }) });
18
22
  });
19
23
 
20
24
  exports.Toast = Toast;
package/toast/toast.mjs CHANGED
@@ -7,10 +7,14 @@ import { ToastItemProvider } from './toast-item-context.mjs';
7
7
  import { useToastItem } from './use-toast-item.mjs';
8
8
 
9
9
  const Toast = forwardRef((props, ref) => {
10
- const [useToastItemProps, divProps] = createSplitProps()(props, ["toast"]);
10
+ const [useToastItemProps, { children, ...divProps }] = createSplitProps()(
11
+ props,
12
+ ["toast"]
13
+ );
11
14
  const api = useToastItem(useToastItemProps);
12
15
  const mergedProps = mergeProps(api.rootProps, divProps);
13
- return /* @__PURE__ */ jsx(ToastItemProvider, { value: api, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });
16
+ const customToast = api.render();
17
+ return /* @__PURE__ */ jsx(ToastItemProvider, { value: api, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref, children: customToast || children }) });
14
18
  });
15
19
 
16
20
  export { Toast };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const tooltip = require('./tooltip.cjs');
6
+ const tooltipArrow = require('./tooltip-arrow.cjs');
7
+ const tooltipArrowTip = require('./tooltip-arrow-tip.cjs');
8
+ const tooltipContent = require('./tooltip-content.cjs');
9
+ const tooltipPositioner = require('./tooltip-positioner.cjs');
10
+ const tooltipTrigger = require('./tooltip-trigger.cjs');
11
+ const tooltip$1 = require('@zag-js/tooltip');
12
+
13
+
14
+
15
+ exports.Tooltip = tooltip.Tooltip;
16
+ exports.TooltipArrow = tooltipArrow.TooltipArrow;
17
+ exports.TooltipArrowTip = tooltipArrowTip.TooltipArrowTip;
18
+ exports.TooltipContent = tooltipContent.TooltipContent;
19
+ exports.TooltipPositioner = tooltipPositioner.TooltipPositioner;
20
+ exports.TooltipTrigger = tooltipTrigger.TooltipTrigger;
21
+ Object.defineProperty(exports, 'tooltipAnatomy', {
22
+ enumerable: true,
23
+ get: () => tooltip$1.anatomy
24
+ });
@@ -0,0 +1,7 @@
1
+ export { Tooltip } from './tooltip.mjs';
2
+ export { TooltipArrow } from './tooltip-arrow.mjs';
3
+ export { TooltipArrowTip } from './tooltip-arrow-tip.mjs';
4
+ export { TooltipContent } from './tooltip-content.mjs';
5
+ export { TooltipPositioner } from './tooltip-positioner.mjs';
6
+ export { TooltipTrigger } from './tooltip-trigger.mjs';
7
+ export { anatomy as tooltipAnatomy } from '@zag-js/tooltip';
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
5
  const jsxRuntime = require('react/jsx-runtime');
6
+ require('react');
6
7
  const runIfFn = require('../run-if-fn.cjs');
7
8
  const tooltipContext = require('./tooltip-context.cjs');
8
9
  const useTooltip = require('./use-tooltip.cjs');
@@ -1,4 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import 'react';
2
3
  import { runIfFn } from '../run-if-fn.mjs';
3
4
  import { TooltipProvider } from './tooltip-context.mjs';
4
5
  import { useTooltip } from './use-tooltip.mjs';
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const transition = require('./transition.cjs');
6
+ const useTransition = require('./use-transition.cjs');
7
+
8
+
9
+
10
+ exports.Transition = transition.Transition;
11
+ exports.useTransition = useTransition.useTransition;
@@ -0,0 +1,2 @@
1
+ export { Transition, type TransitionProps } from './transition';
2
+ export { useTransition, type UseTransitionProps } from './use-transition';
@@ -0,0 +1,2 @@
1
+ export { Transition } from './transition.mjs';
2
+ export { useTransition } from './use-transition.mjs';
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const React = require('react');
6
+ const useTransition = require('./use-transition.cjs');
7
+
8
+ const Transition = (props) => {
9
+ const { unmountOnExit, children, ...useTransitionProps } = props;
10
+ const { style, hidden } = useTransition.useTransition(useTransitionProps);
11
+ const child = React.Children.only(children);
12
+ if (unmountOnExit && hidden) {
13
+ return null;
14
+ }
15
+ if (typeof child === "function") {
16
+ return child({ style, hidden });
17
+ }
18
+ const jsxChild = child;
19
+ return React.cloneElement(jsxChild, {
20
+ style: {
21
+ ...jsxChild.props.style,
22
+ ...style
23
+ },
24
+ hidden
25
+ });
26
+ };
27
+
28
+ exports.Transition = Transition;
@@ -0,0 +1,12 @@
1
+ import { type UseTransitionProps } from './use-transition';
2
+ type RenderProps = {
3
+ hidden: boolean;
4
+ style: React.CSSProperties;
5
+ };
6
+ type TransitionChild = React.ReactNode | ((props: RenderProps) => JSX.Element);
7
+ export type TransitionProps = UseTransitionProps & {
8
+ unmountOnExit?: boolean;
9
+ children?: TransitionChild;
10
+ };
11
+ export declare const Transition: (props: TransitionProps) => JSX.Element | null;
12
+ export {};
@@ -0,0 +1,24 @@
1
+ import { Children, cloneElement } from 'react';
2
+ import { useTransition } from './use-transition.mjs';
3
+
4
+ const Transition = (props) => {
5
+ const { unmountOnExit, children, ...useTransitionProps } = props;
6
+ const { style, hidden } = useTransition(useTransitionProps);
7
+ const child = Children.only(children);
8
+ if (unmountOnExit && hidden) {
9
+ return null;
10
+ }
11
+ if (typeof child === "function") {
12
+ return child({ style, hidden });
13
+ }
14
+ const jsxChild = child;
15
+ return cloneElement(jsxChild, {
16
+ style: {
17
+ ...jsxChild.props.style,
18
+ ...style
19
+ },
20
+ hidden
21
+ });
22
+ };
23
+
24
+ export { Transition };
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const react = require('@zag-js/react');
6
+ const transition = require('@zag-js/transition');
7
+
8
+ function _interopNamespaceDefault(e) {
9
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
10
+ if (e) {
11
+ for (const k in e) {
12
+ if (k !== 'default') {
13
+ const d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: () => e[k]
17
+ });
18
+ }
19
+ }
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ const transition__namespace = /*#__PURE__*/_interopNamespaceDefault(transition);
26
+
27
+ const useTransition = (props) => {
28
+ const { enter, exit, ...machineContext } = props;
29
+ const [state, send] = react.useMachine(transition__namespace.machine(machineContext), { context: machineContext });
30
+ const api = transition__namespace.connect(state, send, react.normalizeProps);
31
+ const style = api.transition({
32
+ variants: { enter, exit }
33
+ });
34
+ return { hidden: api.unmount, style };
35
+ };
36
+
37
+ exports.useTransition = useTransition;
@@ -0,0 +1,10 @@
1
+ import type { ClassAttributes, StyleHTMLAttributes, CSSProperties } from 'react';
2
+ import * as transition from '@zag-js/transition';
3
+ export type UseTransitionProps = transition.Context & {
4
+ enter: React.CSSProperties;
5
+ exit: React.CSSProperties;
6
+ };
7
+ export declare const useTransition: (props: UseTransitionProps) => {
8
+ hidden: boolean;
9
+ style: ClassAttributes<HTMLStyleElement> & StyleHTMLAttributes<HTMLStyleElement> & CSSProperties;
10
+ };
@@ -0,0 +1,14 @@
1
+ import { useMachine, normalizeProps } from '@zag-js/react';
2
+ import * as transition from '@zag-js/transition';
3
+
4
+ const useTransition = (props) => {
5
+ const { enter, exit, ...machineContext } = props;
6
+ const [state, send] = useMachine(transition.machine(machineContext), { context: machineContext });
7
+ const api = transition.connect(state, send, normalizeProps);
8
+ const style = api.transition({
9
+ variants: { enter, exit }
10
+ });
11
+ return { hidden: api.unmount, style };
12
+ };
13
+
14
+ export { useTransition };