@ark-ui/react 0.7.1 → 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 (173) hide show
  1. package/CHANGELOG.md +23 -10
  2. package/README.md +1 -0
  3. package/accordion/accordion-context.d.ts +1 -1
  4. package/accordion/index.cjs +20 -0
  5. package/accordion/index.mjs +5 -0
  6. package/avatar/index.cjs +18 -0
  7. package/avatar/index.mjs +4 -0
  8. package/carousel/carousel.anatomy.d.ts +1 -1
  9. package/carousel/carousel.cjs +1 -0
  10. package/carousel/carousel.mjs +1 -0
  11. package/carousel/index.cjs +23 -0
  12. package/carousel/index.mjs +8 -0
  13. package/checkbox/checkbox.cjs +1 -0
  14. package/checkbox/checkbox.mjs +1 -0
  15. package/checkbox/index.cjs +20 -0
  16. package/checkbox/index.mjs +5 -0
  17. package/color-picker/color-picker-area.d.ts +280 -0
  18. package/color-picker/color-picker-channel-slider-track.d.ts +281 -0
  19. package/color-picker/color-picker-context.d.ts +44 -0
  20. package/color-picker/color-picker-swatch.d.ts +289 -0
  21. package/color-picker/color-picker.anatomy.d.ts +1 -1
  22. package/color-picker/color-picker.cjs +1 -0
  23. package/color-picker/color-picker.mjs +1 -0
  24. package/color-picker/index.cjs +35 -0
  25. package/color-picker/index.mjs +14 -0
  26. package/color-picker/use-color-picker.d.ts +28 -0
  27. package/combobox/combobox-context.d.ts +1 -1
  28. package/combobox/combobox.d.ts +332 -0
  29. package/combobox/index.cjs +28 -0
  30. package/combobox/index.mjs +9 -0
  31. package/combobox/use-combobox.d.ts +2 -3
  32. package/date-picker/date-picker-context.d.ts +256 -0
  33. package/date-picker/date-picker-day-cell.d.ts +281 -0
  34. package/date-picker/date-picker.anatomy.d.ts +1 -1
  35. package/date-picker/date-picker.cjs +1 -0
  36. package/date-picker/date-picker.mjs +1 -0
  37. package/date-picker/index.cjs +53 -0
  38. package/date-picker/index.mjs +23 -0
  39. package/date-picker/use-date-picker.d.ts +132 -0
  40. package/dialog/dialog.cjs +1 -0
  41. package/dialog/dialog.mjs +1 -0
  42. package/dialog/index.cjs +28 -0
  43. package/dialog/index.mjs +9 -0
  44. package/editable/editable-cancel-trigger.cjs +1 -0
  45. package/editable/editable-cancel-trigger.mjs +1 -0
  46. package/editable/editable-edit-trigger.cjs +1 -0
  47. package/editable/editable-edit-trigger.mjs +1 -0
  48. package/editable/editable-submit-trigger.cjs +1 -0
  49. package/editable/editable-submit-trigger.mjs +1 -0
  50. package/editable/editable.cjs +1 -0
  51. package/editable/editable.d.ts +326 -0
  52. package/editable/editable.mjs +1 -0
  53. package/editable/index.cjs +30 -0
  54. package/editable/index.mjs +10 -0
  55. package/environment/environment-context.cjs +1 -0
  56. package/environment/environment-context.mjs +1 -0
  57. package/environment/index.cjs +11 -0
  58. package/environment/index.mjs +2 -0
  59. package/hover-card/hover-card-context.d.ts +25 -0
  60. package/hover-card/hover-card.cjs +1 -0
  61. package/hover-card/hover-card.mjs +1 -0
  62. package/hover-card/index.cjs +24 -0
  63. package/hover-card/index.mjs +7 -0
  64. package/hover-card/use-hover-card.d.ts +16 -0
  65. package/index.cjs +108 -108
  66. package/index.mjs +22 -22
  67. package/menu/index.cjs +38 -0
  68. package/menu/index.mjs +14 -0
  69. package/menu/menu-option-item.cjs +2 -0
  70. package/menu/menu-option-item.mjs +2 -0
  71. package/number-input/index.cjs +26 -0
  72. package/number-input/index.mjs +8 -0
  73. package/number-input/number-input-decrement-trigger.cjs +1 -0
  74. package/number-input/number-input-decrement-trigger.mjs +1 -0
  75. package/number-input/number-input-increment-trigger.cjs +1 -0
  76. package/number-input/number-input-increment-trigger.mjs +1 -0
  77. package/package.json +49 -47
  78. package/pagination/index.cjs +23 -0
  79. package/pagination/index.mjs +8 -0
  80. package/pagination/pagination.anatomy.d.ts +3 -3
  81. package/pagination/pagination.cjs +1 -0
  82. package/pagination/pagination.mjs +1 -0
  83. package/pin-input/index.cjs +20 -0
  84. package/pin-input/index.mjs +5 -0
  85. package/popover/index.cjs +32 -0
  86. package/popover/index.mjs +11 -0
  87. package/popover/popover-context.d.ts +35 -0
  88. package/popover/popover.cjs +1 -0
  89. package/popover/popover.mjs +1 -0
  90. package/popover/use-popover.cjs +1 -1
  91. package/popover/use-popover.d.ts +28 -0
  92. package/popover/use-popover.mjs +1 -1
  93. package/pressable/index.cjs +11 -0
  94. package/pressable/index.mjs +2 -0
  95. package/radio-group/index.cjs +24 -0
  96. package/radio-group/index.mjs +7 -0
  97. package/radio-group/radio-context.cjs +1 -0
  98. package/radio-group/radio-context.mjs +1 -0
  99. package/range-slider/index.cjs +30 -0
  100. package/range-slider/index.mjs +10 -0
  101. package/range-slider/range-slider-output.cjs +1 -0
  102. package/range-slider/range-slider-output.mjs +1 -0
  103. package/range-slider/range-slider.cjs +1 -0
  104. package/range-slider/range-slider.mjs +1 -0
  105. package/rating-group/index.cjs +20 -0
  106. package/rating-group/index.mjs +5 -0
  107. package/rating-group/rating-context.cjs +1 -0
  108. package/rating-group/rating-context.d.ts +1 -2
  109. package/rating-group/rating-context.mjs +1 -0
  110. package/rating-group/rating-group-context.d.ts +1 -1
  111. package/rating-group/rating-group-control.cjs +1 -0
  112. package/rating-group/rating-group-control.mjs +1 -0
  113. package/rating-group/rating.cjs +1 -0
  114. package/rating-group/rating.mjs +1 -0
  115. package/segment-group/index.cjs +23 -0
  116. package/segment-group/index.mjs +8 -0
  117. package/segment-group/segment-context.cjs +1 -0
  118. package/segment-group/segment-context.mjs +1 -0
  119. package/segment-group/segment-group.anatomy.d.ts +1 -1
  120. package/select/index.cjs +28 -0
  121. package/select/index.mjs +9 -0
  122. package/select/select-context.d.ts +2 -1
  123. package/select/select.cjs +1 -0
  124. package/select/select.mjs +1 -0
  125. package/slider/index.cjs +30 -0
  126. package/slider/index.mjs +10 -0
  127. package/slider/slider.cjs +1 -0
  128. package/slider/slider.mjs +1 -0
  129. package/splitter/index.cjs +18 -0
  130. package/splitter/index.mjs +4 -0
  131. package/splitter/splitter-context.d.ts +2 -1
  132. package/splitter/splitter-panel.cjs +1 -0
  133. package/splitter/splitter-panel.mjs +1 -0
  134. package/splitter/splitter-resize-trigger.cjs +1 -0
  135. package/splitter/splitter-resize-trigger.mjs +1 -0
  136. package/switch/index.cjs +22 -0
  137. package/switch/index.mjs +6 -0
  138. package/tabs/index.cjs +22 -0
  139. package/tabs/index.mjs +6 -0
  140. package/tabs/tab-content.cjs +1 -0
  141. package/tabs/tab-content.mjs +1 -0
  142. package/tabs/tabs-context.d.ts +1 -1
  143. package/tabs/use-tabs.d.ts +1 -2
  144. package/tags-input/index.cjs +28 -0
  145. package/tags-input/index.mjs +9 -0
  146. package/tags-input/tags-input.cjs +1 -0
  147. package/tags-input/tags-input.d.ts +359 -0
  148. package/tags-input/tags-input.mjs +1 -0
  149. package/toast/index.cjs +27 -0
  150. package/toast/index.mjs +8 -0
  151. package/toast/toast-group.cjs +2 -0
  152. package/toast/toast-group.mjs +2 -0
  153. package/toast/toast-item-context.d.ts +1 -1
  154. package/toast/toast-placements.cjs +2 -0
  155. package/toast/toast-placements.mjs +2 -0
  156. package/toast/toast.cjs +6 -2
  157. package/toast/toast.d.ts +1 -1
  158. package/toast/toast.mjs +6 -2
  159. package/tooltip/index.cjs +24 -0
  160. package/tooltip/index.mjs +7 -0
  161. package/tooltip/tooltip-context.d.ts +35 -0
  162. package/tooltip/tooltip.cjs +1 -0
  163. package/tooltip/tooltip.mjs +1 -0
  164. package/tooltip/use-tooltip.d.ts +21 -0
  165. package/transition/index.cjs +11 -0
  166. package/transition/index.d.ts +2 -0
  167. package/transition/index.mjs +2 -0
  168. package/transition/transition.cjs +28 -0
  169. package/transition/transition.d.ts +12 -0
  170. package/transition/transition.mjs +24 -0
  171. package/transition/use-transition.cjs +37 -0
  172. package/transition/use-transition.d.ts +10 -0
  173. package/transition/use-transition.mjs +14 -0
@@ -0,0 +1,21 @@
1
+ import type { DetailedHTMLProps, ButtonHTMLAttributes, HTMLAttributes } from 'react';
2
+ import * as tooltip from '@zag-js/tooltip';
3
+ import { type Optional } from '../types';
4
+ export type UseTooltipProps = Optional<tooltip.Context, 'id'>;
5
+ export declare const useTooltip: (props: UseTooltipProps) => {
6
+ isOpen: boolean;
7
+ open(): void;
8
+ close(): void;
9
+ getAnimationState(): {
10
+ enter: boolean;
11
+ exit: boolean;
12
+ };
13
+ setPositioning(options?: Partial<tooltip.PositioningOptions> | undefined): void;
14
+ triggerProps: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
15
+ arrowProps: HTMLAttributes<HTMLElement>;
16
+ arrowTipProps: HTMLAttributes<HTMLElement>;
17
+ positionerProps: HTMLAttributes<HTMLElement>;
18
+ contentProps: HTMLAttributes<HTMLElement>;
19
+ labelProps: HTMLAttributes<HTMLElement>;
20
+ };
21
+ export type UseTooltipReturn = ReturnType<typeof useTooltip>;
@@ -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 };