@ark-ui/react 0.5.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.
- package/README.md +1 -0
- package/dist/avatar/avatar-context.cjs +14 -0
- package/dist/avatar/avatar-context.d.ts +22 -0
- package/dist/avatar/avatar-context.mjs +9 -0
- package/dist/avatar/avatar-fallback.cjs +17 -0
- package/dist/avatar/avatar-fallback.d.ts +271 -0
- package/dist/avatar/avatar-fallback.mjs +13 -0
- package/dist/avatar/avatar-image.cjs +17 -0
- package/dist/avatar/avatar-image.d.ts +282 -0
- package/dist/avatar/avatar-image.mjs +13 -0
- package/dist/avatar/avatar.anatomy.cjs +9 -0
- package/dist/avatar/avatar.anatomy.d.ts +2 -0
- package/dist/avatar/avatar.anatomy.mjs +5 -0
- package/dist/avatar/avatar.cjs +25 -0
- package/dist/avatar/avatar.d.ts +274 -0
- package/dist/avatar/avatar.mjs +21 -0
- package/dist/avatar/index.d.ts +4 -0
- package/dist/avatar/use-avatar.cjs +40 -0
- package/dist/avatar/use-avatar.d.ts +15 -0
- package/dist/avatar/use-avatar.mjs +17 -0
- package/dist/checkbox/checkbox-input.d.ts +3 -3
- package/dist/color-picker/color-picker-channel-input.d.ts +3 -3
- package/dist/combobox/combobox-input.d.ts +3 -3
- package/dist/date-picker/date-picker-input.d.ts +3 -3
- package/dist/date-picker/date-picker-view-trigger.cjs +1 -1
- package/dist/date-picker/date-picker-view-trigger.mjs +1 -1
- package/dist/date-picker/date-picker-year-cell.d.ts +3 -1
- package/dist/editable/editable-input.d.ts +3 -3
- package/dist/index.cjs +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +4 -0
- package/dist/number-input/number-input-field.d.ts +3 -3
- package/dist/pagination/pagination.cjs +1 -0
- package/dist/pagination/pagination.d.ts +1 -0
- package/dist/pagination/pagination.mjs +1 -0
- package/dist/pagination/use-pagination.cjs +8 -3
- package/dist/pagination/use-pagination.d.ts +3 -1
- package/dist/pagination/use-pagination.mjs +8 -3
- package/dist/pin-input/pin-input-field.d.ts +3 -3
- package/dist/pressable/pressable.cjs +1 -0
- package/dist/pressable/pressable.d.ts +1 -0
- package/dist/pressable/pressable.mjs +1 -0
- package/dist/radio-group/radio-input.d.ts +3 -3
- package/dist/rating-group/rating-group.d.ts +3 -3
- package/dist/slider/slider.d.ts +1 -1
- package/dist/splitter/splitter-context.d.ts +4 -6
- package/dist/splitter/splitter.cjs +18 -12
- package/dist/splitter/splitter.d.ts +12 -4
- package/dist/splitter/splitter.mjs +18 -12
- package/dist/splitter/use-splitter.cjs +28 -4
- package/dist/splitter/use-splitter.d.ts +10 -9
- package/dist/splitter/use-splitter.mjs +10 -5
- package/dist/switch/switch-input.d.ts +3 -3
- package/dist/tags-input/tag-input.d.ts +3 -3
- package/package.json +64 -57
- package/LICENSE +0 -21
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const avatar = require('@zag-js/avatar');
|
|
6
|
+
const react = require('@zag-js/react');
|
|
7
|
+
const React = require('react');
|
|
8
|
+
const environmentContext = require('../environment/environment-context.cjs');
|
|
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 avatar__namespace = /*#__PURE__*/_interopNamespaceDefault(avatar);
|
|
28
|
+
|
|
29
|
+
const useAvatar = (props) => {
|
|
30
|
+
const getRootNode = environmentContext.useEnvironmentContext();
|
|
31
|
+
const context = {
|
|
32
|
+
id: React.useId(),
|
|
33
|
+
getRootNode,
|
|
34
|
+
...props
|
|
35
|
+
};
|
|
36
|
+
const [state, send] = react.useMachine(avatar__namespace.machine(context), { context });
|
|
37
|
+
return avatar__namespace.connect(state, send, react.normalizeProps);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.useAvatar = useAvatar;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTMLAttributes, DetailedHTMLProps, ImgHTMLAttributes } from 'react';
|
|
2
|
+
import * as avatar from '@zag-js/avatar';
|
|
3
|
+
import { type Optional } from '../types';
|
|
4
|
+
export type UseAvatarProps = Optional<avatar.Context, 'id'>;
|
|
5
|
+
export type UseAvatarReturn = ReturnType<typeof useAvatar>;
|
|
6
|
+
export declare const useAvatar: (props: UseAvatarProps) => {
|
|
7
|
+
isLoaded: boolean;
|
|
8
|
+
showFallback: boolean;
|
|
9
|
+
setSrc(src: string): void;
|
|
10
|
+
setLoaded(): void;
|
|
11
|
+
setError(): void;
|
|
12
|
+
rootProps: HTMLAttributes<HTMLElement>;
|
|
13
|
+
imageProps: DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
|
|
14
|
+
fallbackProps: HTMLAttributes<HTMLElement>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as avatar from '@zag-js/avatar';
|
|
2
|
+
import { useMachine, normalizeProps } from '@zag-js/react';
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
import { useEnvironmentContext } from '../environment/environment-context.mjs';
|
|
5
|
+
|
|
6
|
+
const useAvatar = (props) => {
|
|
7
|
+
const getRootNode = useEnvironmentContext();
|
|
8
|
+
const context = {
|
|
9
|
+
id: useId(),
|
|
10
|
+
getRootNode,
|
|
11
|
+
...props
|
|
12
|
+
};
|
|
13
|
+
const [state, send] = useMachine(avatar.machine(context), { context });
|
|
14
|
+
return avatar.connect(state, send, normalizeProps);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { useAvatar };
|
|
@@ -290,13 +290,13 @@ export declare const CheckboxInput: 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
|
}>;
|
|
@@ -293,15 +293,15 @@ export declare const ColorPickerChannelInput: 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
|
channel: ExtendedColorChannel;
|
|
306
306
|
orientation?: Orientation | undefined;
|
|
307
307
|
}>;
|
|
@@ -290,13 +290,13 @@ export declare const ComboboxInput: 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,13 +290,13 @@ export declare const DatePickerInput: 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
|
}>;
|
|
@@ -12,7 +12,7 @@ const datePickerContext = require('./date-picker-context.cjs');
|
|
|
12
12
|
const DatePickerViewTrigger = forwardRef.forwardRef((props, ref) => {
|
|
13
13
|
const [viewProps, localProps] = createSplitProps.createSplitProps()(props, ["view"]);
|
|
14
14
|
const { getViewTriggerProps, view } = datePickerContext.useDatePickerContext();
|
|
15
|
-
const mergedProps = react.mergeProps(getViewTriggerProps({ view }), localProps);
|
|
15
|
+
const mergedProps = react.mergeProps(getViewTriggerProps({ view: viewProps.view ?? view }), localProps);
|
|
16
16
|
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ...mergedProps, ref });
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -8,7 +8,7 @@ import { useDatePickerContext } from './date-picker-context.mjs';
|
|
|
8
8
|
const DatePickerViewTrigger = forwardRef((props, ref) => {
|
|
9
9
|
const [viewProps, localProps] = createSplitProps()(props, ["view"]);
|
|
10
10
|
const { getViewTriggerProps, view } = useDatePickerContext();
|
|
11
|
-
const mergedProps = mergeProps(getViewTriggerProps({ view }), localProps);
|
|
11
|
+
const mergedProps = mergeProps(getViewTriggerProps({ view: viewProps.view ?? view }), localProps);
|
|
12
12
|
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
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 { CellProps } from '@zag-js/date-picker';
|
|
2
3
|
import { type HTMLArkProps } from '../factory';
|
|
3
|
-
|
|
4
|
+
import type { Assign } from '../types';
|
|
5
|
+
export type DatePickerYearCellProps = Assign<HTMLArkProps<'div'>, CellProps>;
|
|
4
6
|
export declare const DatePickerYearCell: ForwardRefExoticComponent<{
|
|
5
7
|
children?: ReactNode;
|
|
6
8
|
slot?: string | undefined;
|
|
@@ -290,13 +290,13 @@ export declare const EditableInput: 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
|
}>;
|
package/dist/index.cjs
CHANGED
|
@@ -9,6 +9,10 @@ const accordionContent = require('./accordion/accordion-content.cjs');
|
|
|
9
9
|
const accordionItem = require('./accordion/accordion-item.cjs');
|
|
10
10
|
const accordionTrigger = require('./accordion/accordion-trigger.cjs');
|
|
11
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');
|
|
12
16
|
const carousel = require('./carousel/carousel.cjs');
|
|
13
17
|
const carouselControl = require('./carousel/carousel-control.cjs');
|
|
14
18
|
const carouselNextSlideTrigger = require('./carousel/carousel-next-slide-trigger.cjs');
|
|
@@ -244,6 +248,10 @@ Object.defineProperty(exports, 'accordionAnatomy', {
|
|
|
244
248
|
enumerable: true,
|
|
245
249
|
get: () => accordion$1.anatomy
|
|
246
250
|
});
|
|
251
|
+
exports.Avatar = avatar.Avatar;
|
|
252
|
+
exports.AvatarFallback = avatarFallback.AvatarFallback;
|
|
253
|
+
exports.AvatarImage = avatarImage.AvatarImage;
|
|
254
|
+
exports.avatarAnatomy = avatar_anatomy.avatarAnatomy;
|
|
247
255
|
exports.Carousel = carousel.Carousel;
|
|
248
256
|
exports.CarouselControl = carouselControl.CarouselControl;
|
|
249
257
|
exports.CarouselNextSlideTrigger = carouselNextSlideTrigger.CarouselNextSlideTrigger;
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,10 @@ export { AccordionContent } from './accordion/accordion-content.mjs';
|
|
|
5
5
|
export { AccordionItem } from './accordion/accordion-item.mjs';
|
|
6
6
|
export { AccordionTrigger } from './accordion/accordion-trigger.mjs';
|
|
7
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';
|
|
8
12
|
export { Carousel } from './carousel/carousel.mjs';
|
|
9
13
|
export { CarouselControl } from './carousel/carousel-control.mjs';
|
|
10
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
|
}>;
|
|
@@ -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
|
}>;
|
|
@@ -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
|
|
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(
|
|
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
|
|
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(
|
|
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
|
}>;
|
|
@@ -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;
|
package/dist/slider/slider.d.ts
CHANGED
|
@@ -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
|
-
|
|
13
|
-
|
|
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
|
-
|
|
35
|
-
|
|
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()(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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,
|
|
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()(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
18
|
-
return
|
|
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;
|