@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.
- package/CHANGELOG.md +23 -10
- package/README.md +1 -0
- package/accordion/accordion-context.d.ts +1 -1
- package/accordion/index.cjs +20 -0
- package/accordion/index.mjs +5 -0
- package/avatar/index.cjs +18 -0
- package/avatar/index.mjs +4 -0
- package/carousel/carousel.anatomy.d.ts +1 -1
- package/carousel/carousel.cjs +1 -0
- package/carousel/carousel.mjs +1 -0
- package/carousel/index.cjs +23 -0
- package/carousel/index.mjs +8 -0
- package/checkbox/checkbox.cjs +1 -0
- package/checkbox/checkbox.mjs +1 -0
- package/checkbox/index.cjs +20 -0
- package/checkbox/index.mjs +5 -0
- package/color-picker/color-picker-area.d.ts +280 -0
- package/color-picker/color-picker-channel-slider-track.d.ts +281 -0
- package/color-picker/color-picker-context.d.ts +44 -0
- package/color-picker/color-picker-swatch.d.ts +289 -0
- package/color-picker/color-picker.anatomy.d.ts +1 -1
- package/color-picker/color-picker.cjs +1 -0
- package/color-picker/color-picker.mjs +1 -0
- package/color-picker/index.cjs +35 -0
- package/color-picker/index.mjs +14 -0
- package/color-picker/use-color-picker.d.ts +28 -0
- package/combobox/combobox-context.d.ts +1 -1
- package/combobox/combobox.d.ts +332 -0
- package/combobox/index.cjs +28 -0
- package/combobox/index.mjs +9 -0
- package/combobox/use-combobox.d.ts +2 -3
- package/date-picker/date-picker-context.d.ts +256 -0
- package/date-picker/date-picker-day-cell.d.ts +281 -0
- package/date-picker/date-picker.anatomy.d.ts +1 -1
- package/date-picker/date-picker.cjs +1 -0
- package/date-picker/date-picker.mjs +1 -0
- package/date-picker/index.cjs +53 -0
- package/date-picker/index.mjs +23 -0
- package/date-picker/use-date-picker.d.ts +132 -0
- package/dialog/dialog.cjs +1 -0
- package/dialog/dialog.mjs +1 -0
- package/dialog/index.cjs +28 -0
- package/dialog/index.mjs +9 -0
- package/editable/editable-cancel-trigger.cjs +1 -0
- package/editable/editable-cancel-trigger.mjs +1 -0
- package/editable/editable-edit-trigger.cjs +1 -0
- package/editable/editable-edit-trigger.mjs +1 -0
- package/editable/editable-submit-trigger.cjs +1 -0
- package/editable/editable-submit-trigger.mjs +1 -0
- package/editable/editable.cjs +1 -0
- package/editable/editable.d.ts +326 -0
- package/editable/editable.mjs +1 -0
- package/editable/index.cjs +30 -0
- package/editable/index.mjs +10 -0
- package/environment/environment-context.cjs +1 -0
- package/environment/environment-context.mjs +1 -0
- package/environment/index.cjs +11 -0
- package/environment/index.mjs +2 -0
- package/hover-card/hover-card-context.d.ts +25 -0
- package/hover-card/hover-card.cjs +1 -0
- package/hover-card/hover-card.mjs +1 -0
- package/hover-card/index.cjs +24 -0
- package/hover-card/index.mjs +7 -0
- package/hover-card/use-hover-card.d.ts +16 -0
- package/index.cjs +108 -108
- package/index.mjs +22 -22
- package/menu/index.cjs +38 -0
- package/menu/index.mjs +14 -0
- package/menu/menu-option-item.cjs +2 -0
- package/menu/menu-option-item.mjs +2 -0
- package/number-input/index.cjs +26 -0
- package/number-input/index.mjs +8 -0
- package/number-input/number-input-decrement-trigger.cjs +1 -0
- package/number-input/number-input-decrement-trigger.mjs +1 -0
- package/number-input/number-input-increment-trigger.cjs +1 -0
- package/number-input/number-input-increment-trigger.mjs +1 -0
- package/package.json +49 -47
- package/pagination/index.cjs +23 -0
- package/pagination/index.mjs +8 -0
- package/pagination/pagination.anatomy.d.ts +3 -3
- package/pagination/pagination.cjs +1 -0
- package/pagination/pagination.mjs +1 -0
- package/pin-input/index.cjs +20 -0
- package/pin-input/index.mjs +5 -0
- package/popover/index.cjs +32 -0
- package/popover/index.mjs +11 -0
- package/popover/popover-context.d.ts +35 -0
- package/popover/popover.cjs +1 -0
- package/popover/popover.mjs +1 -0
- package/popover/use-popover.cjs +1 -1
- package/popover/use-popover.d.ts +28 -0
- package/popover/use-popover.mjs +1 -1
- package/pressable/index.cjs +11 -0
- package/pressable/index.mjs +2 -0
- package/radio-group/index.cjs +24 -0
- package/radio-group/index.mjs +7 -0
- package/radio-group/radio-context.cjs +1 -0
- package/radio-group/radio-context.mjs +1 -0
- package/range-slider/index.cjs +30 -0
- package/range-slider/index.mjs +10 -0
- package/range-slider/range-slider-output.cjs +1 -0
- package/range-slider/range-slider-output.mjs +1 -0
- package/range-slider/range-slider.cjs +1 -0
- package/range-slider/range-slider.mjs +1 -0
- package/rating-group/index.cjs +20 -0
- package/rating-group/index.mjs +5 -0
- package/rating-group/rating-context.cjs +1 -0
- package/rating-group/rating-context.d.ts +1 -2
- package/rating-group/rating-context.mjs +1 -0
- package/rating-group/rating-group-context.d.ts +1 -1
- package/rating-group/rating-group-control.cjs +1 -0
- package/rating-group/rating-group-control.mjs +1 -0
- package/rating-group/rating.cjs +1 -0
- package/rating-group/rating.mjs +1 -0
- package/segment-group/index.cjs +23 -0
- package/segment-group/index.mjs +8 -0
- package/segment-group/segment-context.cjs +1 -0
- package/segment-group/segment-context.mjs +1 -0
- package/segment-group/segment-group.anatomy.d.ts +1 -1
- package/select/index.cjs +28 -0
- package/select/index.mjs +9 -0
- package/select/select-context.d.ts +2 -1
- package/select/select.cjs +1 -0
- package/select/select.mjs +1 -0
- package/slider/index.cjs +30 -0
- package/slider/index.mjs +10 -0
- package/slider/slider.cjs +1 -0
- package/slider/slider.mjs +1 -0
- package/splitter/index.cjs +18 -0
- package/splitter/index.mjs +4 -0
- package/splitter/splitter-context.d.ts +2 -1
- package/splitter/splitter-panel.cjs +1 -0
- package/splitter/splitter-panel.mjs +1 -0
- package/splitter/splitter-resize-trigger.cjs +1 -0
- package/splitter/splitter-resize-trigger.mjs +1 -0
- package/switch/index.cjs +22 -0
- package/switch/index.mjs +6 -0
- package/tabs/index.cjs +22 -0
- package/tabs/index.mjs +6 -0
- package/tabs/tab-content.cjs +1 -0
- package/tabs/tab-content.mjs +1 -0
- package/tabs/tabs-context.d.ts +1 -1
- package/tabs/use-tabs.d.ts +1 -2
- package/tags-input/index.cjs +28 -0
- package/tags-input/index.mjs +9 -0
- package/tags-input/tags-input.cjs +1 -0
- package/tags-input/tags-input.d.ts +359 -0
- package/tags-input/tags-input.mjs +1 -0
- package/toast/index.cjs +27 -0
- package/toast/index.mjs +8 -0
- package/toast/toast-group.cjs +2 -0
- package/toast/toast-group.mjs +2 -0
- package/toast/toast-item-context.d.ts +1 -1
- package/toast/toast-placements.cjs +2 -0
- package/toast/toast-placements.mjs +2 -0
- package/toast/toast.cjs +6 -2
- package/toast/toast.d.ts +1 -1
- package/toast/toast.mjs +6 -2
- package/tooltip/index.cjs +24 -0
- package/tooltip/index.mjs +7 -0
- package/tooltip/tooltip-context.d.ts +35 -0
- package/tooltip/tooltip.cjs +1 -0
- package/tooltip/tooltip.mjs +1 -0
- package/tooltip/use-tooltip.d.ts +21 -0
- package/transition/index.cjs +11 -0
- package/transition/index.d.ts +2 -0
- package/transition/index.mjs +2 -0
- package/transition/transition.cjs +28 -0
- package/transition/transition.d.ts +12 -0
- package/transition/transition.mjs +24 -0
- package/transition/use-transition.cjs +37 -0
- package/transition/use-transition.d.ts +10 -0
- 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,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 };
|