@ark-ui/solid 1.0.1 → 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.
- package/CHANGELOG.md +65 -0
- package/README.md +67 -61
- package/cjs/index.js +331 -99
- package/cjs/index.js.map +1 -1
- package/esm/index.js +315 -100
- package/esm/index.js.map +1 -1
- package/package.json +55 -50
- package/source/color-picker/color-picker-format-select.jsx +13 -0
- package/source/color-picker/color-picker-format-trigger.jsx +8 -0
- package/source/color-picker/color-picker-swatch-context.js +5 -0
- package/source/color-picker/color-picker-swatch-indicator.jsx +10 -0
- package/source/color-picker/color-picker-swatch-trigger.jsx +4 -1
- package/source/color-picker/color-picker-swatch.jsx +6 -3
- package/source/color-picker/color-picker.jsx +3 -1
- package/source/color-picker/index.js +7 -1
- package/source/date-picker/date-picker.jsx +1 -1
- package/source/dialog/dialog-close-trigger.jsx +1 -1
- package/source/editable/editable-area.jsx +2 -2
- package/source/editable/editable-cancel-trigger.jsx +2 -2
- package/source/editable/editable-control.jsx +2 -2
- package/source/editable/editable-edit-trigger.jsx +2 -2
- package/source/editable/editable-input.jsx +2 -2
- package/source/editable/editable-label.jsx +2 -2
- package/source/editable/editable-preview.jsx +2 -2
- package/source/editable/editable-submit-trigger.jsx +2 -2
- package/source/editable/editable.jsx +5 -7
- package/source/file-upload/file-upload-context.js +5 -0
- package/source/file-upload/file-upload-dropzone.jsx +11 -0
- package/source/file-upload/file-upload-item-context.js +5 -0
- package/source/file-upload/file-upload-item-delete-trigger.jsx +10 -0
- package/source/file-upload/file-upload-item-group.jsx +10 -0
- package/source/file-upload/file-upload-item-name.jsx +12 -0
- package/source/file-upload/file-upload-item-preview-image.jsx +13 -0
- package/source/file-upload/file-upload-item-preview.jsx +12 -0
- package/source/file-upload/file-upload-item-size-text.jsx +12 -0
- package/source/file-upload/file-upload-item.jsx +15 -0
- package/source/file-upload/file-upload-label.jsx +8 -0
- package/source/file-upload/file-upload-trigger.jsx +8 -0
- package/source/file-upload/file-upload.jsx +34 -0
- package/source/file-upload/index.js +26 -0
- package/source/file-upload/use-file-upload.js +10 -0
- package/source/index.jsx +1 -0
- package/source/number-input/index.js +1 -1
- package/source/number-input/number-input.jsx +4 -2
- package/source/pagination/pagination-ellipsis.jsx +2 -2
- package/source/pagination/pagination.jsx +2 -4
- package/source/pin-input/index.js +1 -1
- package/source/pin-input/pin-input.jsx +2 -2
- package/source/radio-group/radio-group-item-context.js +2 -2
- package/source/radio-group/radio-group-item.jsx +9 -6
- package/source/rating-group/rating-group-control.jsx +1 -1
- package/source/rating-group/rating-group-item.jsx +2 -2
- package/source/rating-group/rating-group.jsx +2 -2
- package/source/segment-group/segment-group-item-context.js +2 -2
- package/source/segment-group/segment-group-item.jsx +9 -6
- package/source/select/select-indicator.jsx +1 -1
- package/source/select/select-item-group.jsx +2 -2
- package/source/select/select.jsx +2 -2
- package/source/switch/switch-label.jsx +2 -2
- package/source/switch/switch-thumb.jsx +2 -2
- package/source/switch/switch.jsx +2 -2
- package/source/toast/create-toaster.jsx +9 -10
- package/source/toast/index.js +5 -3
- package/source/toast/toast-group.jsx +4 -0
- package/types/color-picker/color-picker-format-select.d.ts +4 -0
- package/types/color-picker/color-picker-format-trigger.d.ts +4 -0
- package/types/color-picker/color-picker-swatch-context.d.ts +4 -0
- package/types/color-picker/color-picker-swatch-indicator.d.ts +4 -0
- package/types/color-picker/color-picker-swatch-trigger.d.ts +1 -5
- package/types/color-picker/color-picker-transparency-grid.d.ts +2 -5
- package/types/color-picker/index.d.ts +10 -3
- package/types/color-picker/use-color-picker.d.ts +3 -0
- package/types/file-upload/file-upload-context.d.ts +4 -0
- package/types/file-upload/file-upload-dropzone.d.ts +4 -0
- package/types/file-upload/file-upload-item-context.d.ts +4 -0
- package/types/file-upload/file-upload-item-delete-trigger.d.ts +4 -0
- package/types/file-upload/file-upload-item-group.d.ts +8 -0
- package/types/file-upload/file-upload-item-name.d.ts +4 -0
- package/types/file-upload/file-upload-item-preview-image.d.ts +4 -0
- package/types/file-upload/file-upload-item-preview.d.ts +9 -0
- package/types/file-upload/file-upload-item-size-text.d.ts +4 -0
- package/types/file-upload/file-upload-item.d.ts +6 -0
- package/types/file-upload/file-upload-label.d.ts +4 -0
- package/types/file-upload/file-upload-trigger.d.ts +4 -0
- package/types/file-upload/file-upload.d.ts +9 -0
- package/types/file-upload/index.d.ts +27 -0
- package/types/file-upload/use-file-upload.d.ts +9 -0
- package/types/index.d.ts +1 -0
- package/types/number-input/index.d.ts +1 -1
- package/types/number-input/number-input.d.ts +6 -3
- package/types/pin-input/index.d.ts +1 -1
- package/types/radio-group/radio-group-item-context.d.ts +1 -1
- package/types/radio-group/radio-group-item.d.ts +6 -3
- package/types/rating-group/rating-group-item-context.d.ts +2 -3
- package/types/segment-group/segment-group-item-context.d.ts +3 -14
- package/types/segment-group/segment-group-item.d.ts +6 -2
- package/types/toast/create-toaster.d.ts +3 -2
- package/types/toast/index.d.ts +6 -4
- package/types/toast/toast-context.d.ts +7 -2
- package/types/toast/toast-group.d.ts +4 -0
- /package/source/number-input/{number-input-field.jsx → number-input-input.jsx} +0 -0
- /package/source/pin-input/{pin-input-field.jsx → pin-input-input.jsx} +0 -0
- /package/types/number-input/{number-input-field.d.ts → number-input-input.d.ts} +0 -0
- /package/types/pin-input/{pin-input-field.d.ts → pin-input-input.d.ts} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as fileUpload from '@zag-js/file-upload';
|
|
2
|
+
import { mergeProps, normalizeProps, useMachine } from '@zag-js/solid';
|
|
3
|
+
import { createMemo, createUniqueId } from 'solid-js';
|
|
4
|
+
import { useEnvironmentContext } from '../environment';
|
|
5
|
+
export const useFileUpload = (props) => {
|
|
6
|
+
const getRootNode = useEnvironmentContext();
|
|
7
|
+
const context = mergeProps({ id: createUniqueId(), getRootNode }, props);
|
|
8
|
+
const [state, send] = useMachine(fileUpload.machine(context), { context });
|
|
9
|
+
return createMemo(() => fileUpload.connect(state, send, normalizeProps));
|
|
10
|
+
};
|
package/source/index.jsx
CHANGED
|
@@ -2,8 +2,8 @@ import { NumberInput as NumberInputRoot } from './number-input';
|
|
|
2
2
|
import { useNumberInputContext } from './number-input-context';
|
|
3
3
|
import { NumberInputControl } from './number-input-control';
|
|
4
4
|
import { NumberInputDecrementTrigger, } from './number-input-decrement-trigger';
|
|
5
|
-
import { NumberInputInput } from './number-input-field';
|
|
6
5
|
import { NumberInputIncrementTrigger, } from './number-input-increment-trigger';
|
|
6
|
+
import { NumberInputInput } from './number-input-input';
|
|
7
7
|
import { NumberInputLabel } from './number-input-label';
|
|
8
8
|
import { NumberInputScrubber } from './number-input-scrubber';
|
|
9
9
|
const NumberInput = Object.assign(NumberInputRoot, {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
2
|
import { createSplitProps } from '../create-split-props';
|
|
3
3
|
import { ark } from '../factory';
|
|
4
|
+
import { runIfFn } from '../run-if-fn';
|
|
4
5
|
import { NumberInputProvider } from './number-input-context';
|
|
5
|
-
import { useNumberInput } from './use-number-input';
|
|
6
|
+
import { useNumberInput, } from './use-number-input';
|
|
6
7
|
export const NumberInput = (props) => {
|
|
7
8
|
const [useNumberInputProps, localProps] = createSplitProps()(props, [
|
|
8
9
|
'allowMouseWheel',
|
|
@@ -34,7 +35,8 @@ export const NumberInput = (props) => {
|
|
|
34
35
|
]);
|
|
35
36
|
const api = useNumberInput(useNumberInputProps);
|
|
36
37
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
38
|
+
const getChildren = () => runIfFn(localProps.children, api);
|
|
37
39
|
return (<NumberInputProvider value={api}>
|
|
38
|
-
<ark.div {...mergedProps}
|
|
40
|
+
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
39
41
|
</NumberInputProvider>);
|
|
40
42
|
};
|
|
@@ -3,8 +3,8 @@ import { createSplitProps } from '../create-split-props';
|
|
|
3
3
|
import { ark } from '../factory';
|
|
4
4
|
import { usePaginationContext } from './pagination-context';
|
|
5
5
|
export const PaginationEllipsis = (props) => {
|
|
6
|
-
const [ellipsisProps,
|
|
6
|
+
const [ellipsisProps, localProps] = createSplitProps()(props, ['index']);
|
|
7
7
|
const api = usePaginationContext();
|
|
8
|
-
const mergedProps = mergeProps(() => api().getEllipsisProps(ellipsisProps),
|
|
8
|
+
const mergedProps = mergeProps(() => api().getEllipsisProps(ellipsisProps), localProps);
|
|
9
9
|
return <ark.div {...mergedProps}/>;
|
|
10
10
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
|
-
import { splitProps } from 'solid-js';
|
|
3
2
|
import { createSplitProps } from '../create-split-props';
|
|
4
3
|
import { ark } from '../factory';
|
|
5
4
|
import { runIfFn } from '../run-if-fn';
|
|
6
5
|
import { PaginationProvider } from './pagination-context';
|
|
7
6
|
import { usePagination } from './use-pagination';
|
|
8
7
|
export const Pagination = (props) => {
|
|
9
|
-
const [paginationParams,
|
|
8
|
+
const [paginationParams, localProps] = createSplitProps()(props, [
|
|
10
9
|
'count',
|
|
11
10
|
'dir',
|
|
12
11
|
'getRootNode',
|
|
@@ -19,10 +18,9 @@ export const Pagination = (props) => {
|
|
|
19
18
|
'translations',
|
|
20
19
|
'type',
|
|
21
20
|
]);
|
|
22
|
-
const [childrenProps, localProps] = splitProps(restProps, ['children']);
|
|
23
21
|
const api = usePagination(paginationParams);
|
|
24
|
-
const getChildren = () => runIfFn(childrenProps.children, api);
|
|
25
22
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
23
|
+
const getChildren = () => runIfFn(localProps.children, api);
|
|
26
24
|
return (<PaginationProvider value={api}>
|
|
27
25
|
<ark.nav {...mergedProps}>{getChildren()}</ark.nav>
|
|
28
26
|
</PaginationProvider>);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PinInput as PinInputRoot } from './pin-input';
|
|
2
2
|
import { usePinInputContext } from './pin-input-context';
|
|
3
3
|
import { PinInputControl } from './pin-input-control';
|
|
4
|
-
import { PinInputInput } from './pin-input-
|
|
4
|
+
import { PinInputInput } from './pin-input-input';
|
|
5
5
|
import { PinInputLabel } from './pin-input-label';
|
|
6
6
|
const PinInput = Object.assign(PinInputRoot, {
|
|
7
7
|
Root: PinInputRoot,
|
|
@@ -4,7 +4,7 @@ import { ark } from '../factory';
|
|
|
4
4
|
import { PinInputProvider } from './pin-input-context';
|
|
5
5
|
import { usePinInput } from './use-pin-input';
|
|
6
6
|
export const PinInput = (props) => {
|
|
7
|
-
const [
|
|
7
|
+
const [usePinInputProps, localProps] = createSplitProps()(props, [
|
|
8
8
|
'autoFocus',
|
|
9
9
|
'blurOnComplete',
|
|
10
10
|
'dir',
|
|
@@ -27,7 +27,7 @@ export const PinInput = (props) => {
|
|
|
27
27
|
'type',
|
|
28
28
|
'value',
|
|
29
29
|
]);
|
|
30
|
-
const api = usePinInput(
|
|
30
|
+
const api = usePinInput(usePinInputProps);
|
|
31
31
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
32
32
|
return (<PinInputProvider value={api}>
|
|
33
33
|
<ark.div {...mergedProps}/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from '../create-context';
|
|
2
|
-
export const [
|
|
2
|
+
export const [RadioGroupItemProvider, useRadioGroupItemContext] = createContext({
|
|
3
3
|
hookName: 'useRadioGroupItemContext',
|
|
4
|
-
providerName: '<
|
|
4
|
+
providerName: '<RadioGroupItemProvider />',
|
|
5
5
|
});
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
2
|
import { createSplitProps } from '../create-split-props';
|
|
3
3
|
import { ark } from '../factory';
|
|
4
|
+
import { runIfFn } from '../run-if-fn';
|
|
4
5
|
import { useRadioGroupContext } from './radio-group-context';
|
|
5
|
-
import {
|
|
6
|
+
import { RadioGroupItemProvider } from './radio-group-item-context';
|
|
6
7
|
export const RadioGroupItem = (props) => {
|
|
7
|
-
const [itemProps,
|
|
8
|
+
const [itemProps, localProps] = createSplitProps()(props, [
|
|
8
9
|
'value',
|
|
9
10
|
'disabled',
|
|
10
11
|
'invalid',
|
|
11
12
|
]);
|
|
12
13
|
const api = useRadioGroupContext();
|
|
13
|
-
const mergedProps = mergeProps(() => api().getItemProps(itemProps),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const mergedProps = mergeProps(() => api().getItemProps(itemProps), localProps);
|
|
15
|
+
const itemState = api().getItemState(itemProps);
|
|
16
|
+
const getChildren = () => runIfFn(localProps.children, itemState);
|
|
17
|
+
return (<RadioGroupItemProvider value={itemProps}>
|
|
18
|
+
<ark.label {...mergedProps}>{getChildren()}</ark.label>
|
|
19
|
+
</RadioGroupItemProvider>);
|
|
17
20
|
};
|
|
@@ -4,8 +4,8 @@ import { runIfFn } from '../run-if-fn';
|
|
|
4
4
|
import { useRatingGroupContext } from './rating-group-context';
|
|
5
5
|
export const RatingGroupControl = (props) => {
|
|
6
6
|
const api = useRatingGroupContext();
|
|
7
|
-
const getChildren = () => runIfFn(props.children, api);
|
|
8
7
|
const mergedProps = mergeProps(() => api().controlProps, props);
|
|
8
|
+
const getChildren = () => runIfFn(props.children, api);
|
|
9
9
|
return (<>
|
|
10
10
|
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
11
11
|
<input {...api().hiddenInputProps}/>
|
|
@@ -8,10 +8,10 @@ import { RatingGroupItemProvider } from './rating-group-item-context';
|
|
|
8
8
|
export const RatingGroupItem = (props) => {
|
|
9
9
|
const [itemProps, localProps] = createSplitProps()(props, ['index']);
|
|
10
10
|
const api = useRatingGroupContext();
|
|
11
|
+
const mergedProps = mergeProps(() => api().getItemProps(itemProps), localProps);
|
|
11
12
|
const itemState = createMemo(() => api().getItemState(itemProps));
|
|
12
13
|
const getChildren = () => runIfFn(localProps.children, itemState);
|
|
13
|
-
|
|
14
|
-
return (<RatingGroupItemProvider value={itemState}>
|
|
14
|
+
return (<RatingGroupItemProvider value={itemProps}>
|
|
15
15
|
<ark.span {...mergedProps}>{getChildren()}</ark.span>
|
|
16
16
|
</RatingGroupItemProvider>);
|
|
17
17
|
};
|
|
@@ -4,7 +4,7 @@ import { ark } from '../factory';
|
|
|
4
4
|
import { RatingGroupProvider } from './rating-group-context';
|
|
5
5
|
import { useRatingGroup } from './use-rating-group';
|
|
6
6
|
export const RatingGroup = (props) => {
|
|
7
|
-
const [
|
|
7
|
+
const [useRatingProps, localProps] = createSplitProps()(props, [
|
|
8
8
|
'allowHalf',
|
|
9
9
|
'autoFocus',
|
|
10
10
|
'count',
|
|
@@ -21,7 +21,7 @@ export const RatingGroup = (props) => {
|
|
|
21
21
|
'translations',
|
|
22
22
|
'value',
|
|
23
23
|
]);
|
|
24
|
-
const api = useRatingGroup(
|
|
24
|
+
const api = useRatingGroup(useRatingProps);
|
|
25
25
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
26
26
|
return (<RatingGroupProvider value={api}>
|
|
27
27
|
<ark.div {...mergedProps}/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from '../create-context';
|
|
2
|
-
export const [
|
|
2
|
+
export const [SegmentGroupItemProvider, useSegmentGroupItemContext] = createContext({
|
|
3
3
|
hookName: 'useSegmentGroupItemContext',
|
|
4
|
-
providerName: '<
|
|
4
|
+
providerName: '<SegmentGroupItemProvider />',
|
|
5
5
|
});
|
|
@@ -2,17 +2,20 @@ import { segmentGroupAnatomy } from '@ark-ui/anatomy';
|
|
|
2
2
|
import { mergeProps } from '@zag-js/solid';
|
|
3
3
|
import { createSplitProps } from '../create-split-props';
|
|
4
4
|
import { ark } from '../factory';
|
|
5
|
+
import { runIfFn } from '../run-if-fn';
|
|
5
6
|
import { useSegmentGroupContext } from './segment-group-context';
|
|
6
|
-
import {
|
|
7
|
+
import { SegmentGroupItemProvider, } from './segment-group-item-context';
|
|
7
8
|
export const SegmentGroupItem = (props) => {
|
|
8
|
-
const [itemProps,
|
|
9
|
+
const [itemProps, localProps] = createSplitProps()(props, [
|
|
9
10
|
'value',
|
|
10
11
|
'disabled',
|
|
11
12
|
'invalid',
|
|
12
13
|
]);
|
|
13
14
|
const api = useSegmentGroupContext();
|
|
14
|
-
const mergedProps = mergeProps(() => api().getItemProps(itemProps), segmentGroupAnatomy.build().item.attrs,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const mergedProps = mergeProps(() => api().getItemProps(itemProps), segmentGroupAnatomy.build().item.attrs, localProps);
|
|
16
|
+
const itemState = api().getItemState(itemProps);
|
|
17
|
+
const getChildren = () => runIfFn(localProps.children, itemState);
|
|
18
|
+
return (<SegmentGroupItemProvider value={itemProps}>
|
|
19
|
+
<ark.label {...mergedProps}>{getChildren()}</ark.label>
|
|
20
|
+
</SegmentGroupItemProvider>);
|
|
18
21
|
};
|
|
@@ -3,6 +3,6 @@ import { ark } from '../factory';
|
|
|
3
3
|
import { useSelectContext } from './select-context';
|
|
4
4
|
export const SelectIndicator = (props) => {
|
|
5
5
|
const api = useSelectContext();
|
|
6
|
-
const mergedProps = mergeProps(() => api().
|
|
6
|
+
const mergedProps = mergeProps(() => api().indicatorProps, props);
|
|
7
7
|
return <ark.div {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -3,8 +3,8 @@ import { createSplitProps } from '../create-split-props';
|
|
|
3
3
|
import { ark } from '../factory';
|
|
4
4
|
import { useSelectContext } from './select-context';
|
|
5
5
|
export const SelectItemGroup = (props) => {
|
|
6
|
-
const [
|
|
6
|
+
const [itemGroupProps, localProps] = createSplitProps()(props, ['id']);
|
|
7
7
|
const api = useSelectContext();
|
|
8
|
-
const mergedProps = mergeProps(() => api().getItemGroupProps(
|
|
8
|
+
const mergedProps = mergeProps(() => api().getItemGroupProps(itemGroupProps), localProps);
|
|
9
9
|
return <ark.div {...mergedProps}/>;
|
|
10
10
|
};
|
package/source/select/select.jsx
CHANGED
|
@@ -37,11 +37,11 @@ export const Select = (props) => {
|
|
|
37
37
|
'value',
|
|
38
38
|
]);
|
|
39
39
|
const api = useSelect(useSelectProps);
|
|
40
|
-
const
|
|
40
|
+
const presenceApi = usePresence(mergeProps(() => ({ present: api().isOpen }), presenceProps));
|
|
41
41
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
42
42
|
const getChildren = () => runIfFn(localProps.children, api);
|
|
43
43
|
return (<SelectProvider value={api}>
|
|
44
|
-
<PresenceProvider value={
|
|
44
|
+
<PresenceProvider value={presenceApi}>
|
|
45
45
|
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
46
46
|
</PresenceProvider>
|
|
47
47
|
</SelectProvider>);
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useSwitchContext } from './switch-context';
|
|
4
4
|
export const SwitchLabel = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useSwitchContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().labelProps, props);
|
|
7
7
|
return <ark.span {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useSwitchContext } from './switch-context';
|
|
4
4
|
export const SwitchThumb = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useSwitchContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().thumbProps, props);
|
|
7
7
|
return <ark.span {...mergedProps}/>;
|
|
8
8
|
};
|
package/source/switch/switch.jsx
CHANGED
|
@@ -5,7 +5,7 @@ import { runIfFn } from '../run-if-fn';
|
|
|
5
5
|
import { SwitchProvider } from './switch-context';
|
|
6
6
|
import { useSwitch } from './use-switch';
|
|
7
7
|
export const Switch = (props) => {
|
|
8
|
-
const [switchProps,
|
|
8
|
+
const [switchProps, localProps] = createSplitProps()(props, [
|
|
9
9
|
'checked',
|
|
10
10
|
'dir',
|
|
11
11
|
'disabled',
|
|
@@ -21,7 +21,7 @@ export const Switch = (props) => {
|
|
|
21
21
|
'value',
|
|
22
22
|
]);
|
|
23
23
|
const api = useSwitch(switchProps);
|
|
24
|
-
const mergedProps = mergeProps(() => api().rootProps,
|
|
24
|
+
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
25
25
|
const getChildren = () => runIfFn(props.children, api);
|
|
26
26
|
return (<SwitchProvider value={api}>
|
|
27
27
|
<ark.label {...mergedProps}>{getChildren()}</ark.label>
|
|
@@ -2,30 +2,29 @@ import { mergeProps, normalizeProps, useActor } from '@zag-js/solid';
|
|
|
2
2
|
import * as toast from '@zag-js/toast';
|
|
3
3
|
import { Index, createEffect, createMemo, onCleanup } from 'solid-js';
|
|
4
4
|
import { useEnvironmentContext } from '../environment';
|
|
5
|
-
import { ark } from '../factory';
|
|
6
5
|
import { ToastProvider } from './toast-context';
|
|
6
|
+
import { ToastGroup } from './toast-group';
|
|
7
7
|
export const createToaster = (props) => {
|
|
8
|
-
const {
|
|
9
|
-
const service = toast.group.machine({ id: '1', placement, ...rest }).start();
|
|
8
|
+
const service = toast.group.machine({ id: '1', ...props }).start();
|
|
10
9
|
const [state, send] = useActor(service);
|
|
11
10
|
const api = createMemo(() => toast.group.connect(state, send, normalizeProps));
|
|
12
|
-
const Toaster = (
|
|
11
|
+
const Toaster = (toasterProps) => {
|
|
13
12
|
const getRootNode = useEnvironmentContext();
|
|
14
13
|
createEffect(() => {
|
|
15
14
|
service.setContext({ getRootNode });
|
|
16
15
|
onCleanup(() => service.stop());
|
|
17
16
|
});
|
|
18
|
-
const mergedProps = mergeProps(() => api().getGroupProps({ placement }),
|
|
19
|
-
return (<
|
|
20
|
-
<Index each={api().toastsByPlacement[placement]}>
|
|
17
|
+
const mergedProps = mergeProps(() => api().getGroupProps({ placement: props.placement }), toasterProps);
|
|
18
|
+
return (<ToastGroup {...mergedProps}>
|
|
19
|
+
<Index each={api().toastsByPlacement[props.placement]}>
|
|
21
20
|
{(toast) => <ToastProviderFactory service={toast()}/>}
|
|
22
21
|
</Index>
|
|
23
|
-
</
|
|
22
|
+
</ToastGroup>);
|
|
24
23
|
};
|
|
25
24
|
return [Toaster, api];
|
|
26
25
|
};
|
|
27
26
|
const ToastProviderFactory = (props) => {
|
|
28
27
|
const [state, send] = useActor(props.service);
|
|
29
|
-
const api = toast.connect(state, send, normalizeProps);
|
|
30
|
-
return <ToastProvider value={
|
|
28
|
+
const api = createMemo(() => toast.connect(state, send, normalizeProps));
|
|
29
|
+
return <ToastProvider value={api}>{state.context.render?.(api)}</ToastProvider>;
|
|
31
30
|
};
|
package/source/toast/index.js
CHANGED
|
@@ -2,11 +2,13 @@ import { createToaster } from './create-toaster';
|
|
|
2
2
|
import { Toast as ToastRoot } from './toast';
|
|
3
3
|
import { ToastCloseTrigger } from './toast-close-trigger';
|
|
4
4
|
import { ToastDescription } from './toast-description';
|
|
5
|
+
import { ToastGroup } from './toast-group';
|
|
5
6
|
import { ToastTitle } from './toast-title';
|
|
6
7
|
const Toast = Object.assign(ToastRoot, {
|
|
7
8
|
Root: ToastRoot,
|
|
8
|
-
Title: ToastTitle,
|
|
9
|
-
Description: ToastDescription,
|
|
10
9
|
CloseTrigger: ToastCloseTrigger,
|
|
10
|
+
Description: ToastDescription,
|
|
11
|
+
Group: ToastGroup,
|
|
12
|
+
Title: ToastTitle,
|
|
11
13
|
});
|
|
12
|
-
export { createToaster, Toast, ToastCloseTrigger, ToastDescription, ToastTitle };
|
|
14
|
+
export { createToaster, Toast, ToastCloseTrigger, ToastDescription, ToastGroup, ToastTitle };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SwatchProps } from '@zag-js/color-picker';
|
|
2
|
+
export interface ColorPickerSwatchContext extends SwatchProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const ColorPickerSwatchProvider: import("solid-js").ContextProviderComponent<ColorPickerSwatchContext>, useColorPickerSwatchContext: () => ColorPickerSwatchContext;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SwatchTriggerProps } from '@zag-js/color-picker';
|
|
2
2
|
import { type HTMLArkProps } from '../factory';
|
|
3
3
|
import type { Assign } from '../types';
|
|
4
|
-
interface SwatchTriggerProps {
|
|
5
|
-
value: string | Color;
|
|
6
|
-
}
|
|
7
4
|
export interface ColorPickerSwatchTriggerProps extends Assign<HTMLArkProps<'button'>, SwatchTriggerProps> {
|
|
8
5
|
}
|
|
9
6
|
export declare const ColorPickerSwatchTrigger: (props: ColorPickerSwatchTriggerProps) => import("solid-js").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
+
import type { TransparencyGridProps } from '@zag-js/color-picker';
|
|
1
2
|
import { type HTMLArkProps } from '../factory';
|
|
2
3
|
import type { Assign } from '../types';
|
|
3
|
-
interface
|
|
4
|
-
size: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ColorPickerTransparencyGridProps extends Assign<HTMLArkProps<'div'>, TransparancyGridProps> {
|
|
4
|
+
export interface ColorPickerTransparencyGridProps extends Assign<HTMLArkProps<'div'>, TransparencyGridProps> {
|
|
7
5
|
}
|
|
8
6
|
export declare const ColorPickerTransparencyGrid: (props: ColorPickerTransparencyGridProps) => import("solid-js").JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ColorFormat } from '@zag-js/color-picker';
|
|
1
2
|
import { type ColorPickerProps } from './color-picker';
|
|
2
3
|
import { ColorPickerArea, type ColorPickerAreaProps } from './color-picker-area';
|
|
3
4
|
import { ColorPickerAreaBackground, type ColorPickerAreaBackgroundProps } from './color-picker-area-background';
|
|
@@ -12,15 +13,18 @@ import { ColorPickerContent, type ColorPickerContentProps } from './color-picker
|
|
|
12
13
|
import { useColorPickerContext, type ColorPickerContext } from './color-picker-context';
|
|
13
14
|
import { ColorPickerControl, type ColorPickerControlProps } from './color-picker-control';
|
|
14
15
|
import { ColorPickerEyeDropperTrigger, type ColorPickerEyeDropperTriggerProps } from './color-picker-eye-dropper-trigger';
|
|
16
|
+
import { ColorPickerFormatSelect, type ColorPickerFormatSelectProps } from './color-picker-format-select';
|
|
17
|
+
import { ColorPickerFormatTrigger, type ColorPickerFormatTriggerProps } from './color-picker-format-trigger';
|
|
15
18
|
import { ColorPickerLabel, type ColorPickerLabelProps } from './color-picker-label';
|
|
16
19
|
import { ColorPickerPositioner, type ColorPickerPositionerProps } from './color-picker-positioner';
|
|
17
20
|
import { ColorPickerSwatch, type ColorPickerSwatchProps } from './color-picker-swatch';
|
|
18
21
|
import { ColorPickerSwatchGroup, type ColorPickerSwatchGroupProps } from './color-picker-swatch-group';
|
|
22
|
+
import { ColorPickerSwatchIndicator, type ColorPickerSwatchIndicatorProps } from './color-picker-swatch-indicator';
|
|
19
23
|
import { ColorPickerSwatchTrigger, type ColorPickerSwatchTriggerProps } from './color-picker-swatch-trigger';
|
|
20
24
|
import { ColorPickerTransparencyGrid, type ColorPickerTransparencyGridProps } from './color-picker-transparency-grid';
|
|
21
25
|
import { ColorPickerTrigger, type ColorPickerTriggerProps } from './color-picker-trigger';
|
|
22
26
|
import { ColorPickerValueText, type ColorPickerValueTextProps } from './color-picker-value-text';
|
|
23
|
-
import { type ColorPickerViewProps } from './color-picker-view';
|
|
27
|
+
import { ColorPickerView, type ColorPickerViewProps } from './color-picker-view';
|
|
24
28
|
declare const ColorPicker: ((props: ColorPickerProps) => import("solid-js").JSX.Element) & {
|
|
25
29
|
Root: (props: ColorPickerProps) => import("solid-js").JSX.Element;
|
|
26
30
|
Area: (props: ColorPickerAreaProps) => import("solid-js").JSX.Element;
|
|
@@ -33,15 +37,18 @@ declare const ColorPicker: ((props: ColorPickerProps) => import("solid-js").JSX.
|
|
|
33
37
|
Content: (props: ColorPickerContentProps) => import("solid-js").JSX.Element;
|
|
34
38
|
Control: (props: ColorPickerControlProps) => import("solid-js").JSX.Element;
|
|
35
39
|
EyeDropperTrigger: (props: ColorPickerEyeDropperTriggerProps) => import("solid-js").JSX.Element;
|
|
40
|
+
FormatTrigger: (props: ColorPickerFormatTriggerProps) => import("solid-js").JSX.Element;
|
|
41
|
+
FormatSelect: (props: ColorPickerFormatSelectProps) => import("solid-js").JSX.Element;
|
|
36
42
|
Label: (props: ColorPickerLabelProps) => import("solid-js").JSX.Element;
|
|
37
43
|
Positioner: (props: ColorPickerPositionerProps) => import("solid-js").JSX.Element;
|
|
38
44
|
Swatch: (props: ColorPickerSwatchProps) => import("solid-js").JSX.Element;
|
|
39
45
|
SwatchGroup: (props: ColorPickerSwatchGroupProps) => import("solid-js").JSX.Element;
|
|
46
|
+
SwatchIndicator: (props: ColorPickerSwatchIndicatorProps) => import("solid-js").JSX.Element;
|
|
40
47
|
SwatchTrigger: (props: ColorPickerSwatchTriggerProps) => import("solid-js").JSX.Element;
|
|
41
48
|
TransparencyGrid: (props: ColorPickerTransparencyGridProps) => import("solid-js").JSX.Element;
|
|
42
49
|
Trigger: (props: ColorPickerTriggerProps) => import("solid-js").JSX.Element;
|
|
43
50
|
ValueText: (props: ColorPickerValueTextProps) => import("solid-js").JSX.Element;
|
|
44
51
|
View: (props: ColorPickerViewProps) => import("solid-js").JSX.Element;
|
|
45
52
|
};
|
|
46
|
-
export { ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerLabel, ColorPickerPositioner, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText, useColorPickerAreaContext, useColorPickerChannelSliderContext, useColorPickerContext, };
|
|
47
|
-
export type { ColorPickerAreaBackgroundProps, ColorPickerAreaContext, ColorPickerAreaProps, ColorPickerAreaThumbProps, ColorPickerChannelInputProps, ColorPickerChannelSliderContext, ColorPickerChannelSliderProps, ColorPickerChannelSliderThumbProps, ColorPickerChannelSliderTrackProps, ColorPickerContentProps, ColorPickerContext, ColorPickerControlProps, ColorPickerEyeDropperTriggerProps, ColorPickerLabelProps, ColorPickerPositionerProps, ColorPickerProps, ColorPickerSwatchGroupProps, ColorPickerSwatchProps, ColorPickerSwatchTriggerProps, ColorPickerTransparencyGridProps, ColorPickerTriggerProps, ColorPickerValueTextProps, ColorPickerViewProps, };
|
|
53
|
+
export { ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerFormatSelect, ColorPickerFormatTrigger, ColorPickerLabel, ColorPickerPositioner, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchIndicator, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText, ColorPickerView, useColorPickerAreaContext, useColorPickerChannelSliderContext, useColorPickerContext, };
|
|
54
|
+
export type { ColorFormat, ColorPickerAreaBackgroundProps, ColorPickerAreaContext, ColorPickerAreaProps, ColorPickerAreaThumbProps, ColorPickerChannelInputProps, ColorPickerChannelSliderContext, ColorPickerChannelSliderProps, ColorPickerChannelSliderThumbProps, ColorPickerChannelSliderTrackProps, ColorPickerContentProps, ColorPickerContext, ColorPickerControlProps, ColorPickerEyeDropperTriggerProps, ColorPickerFormatSelectProps, ColorPickerFormatTriggerProps, ColorPickerLabelProps, ColorPickerPositionerProps, ColorPickerProps, ColorPickerSwatchGroupProps, ColorPickerSwatchIndicatorProps, ColorPickerSwatchProps, ColorPickerSwatchTriggerProps, ColorPickerTransparencyGridProps, ColorPickerTriggerProps, ColorPickerValueTextProps, ColorPickerViewProps, };
|
|
@@ -3,6 +3,9 @@ import { type PropTypes } from '@zag-js/solid';
|
|
|
3
3
|
import { type Accessor } from 'solid-js';
|
|
4
4
|
import { type Optional } from '../types';
|
|
5
5
|
export interface UseColorPickerProps extends Optional<Omit<colorPicker.Context, 'value'>, 'id'> {
|
|
6
|
+
/**
|
|
7
|
+
* The current value of the color picker.
|
|
8
|
+
*/
|
|
6
9
|
value?: string;
|
|
7
10
|
}
|
|
8
11
|
export interface UseColorPickerReturn extends Accessor<colorPicker.Api<PropTypes>> {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type UseFileUploadReturn } from './use-file-upload';
|
|
2
|
+
export interface FileUploadContext extends UseFileUploadReturn {
|
|
3
|
+
}
|
|
4
|
+
export declare const FileUploadProvider: import("solid-js").ContextProviderComponent<FileUploadContext>, useFileUploadContext: () => FileUploadContext;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ItemProps } from '@zag-js/file-upload';
|
|
2
|
+
export interface FileUploadItemContext extends ItemProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const FileUploadItemProvider: import("solid-js").ContextProviderComponent<FileUploadItemContext>, useFileUploadItemContext: () => FileUploadItemContext;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Accessor, type JSX } from 'solid-js';
|
|
2
|
+
import { type HTMLArkProps } from '../factory';
|
|
3
|
+
import type { Assign } from '../types';
|
|
4
|
+
export interface FileUploadItemGroupProps extends Assign<HTMLArkProps<'ul'>, {
|
|
5
|
+
children?: JSX.Element | ((state: Accessor<File[]>) => JSX.Element);
|
|
6
|
+
}> {
|
|
7
|
+
}
|
|
8
|
+
export declare const FileUploadItemGroup: (props: FileUploadItemGroupProps) => JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type HTMLArkProps } from '../factory';
|
|
2
|
+
export interface FileUploadItemPreviewProps extends HTMLArkProps<'div'> {
|
|
3
|
+
/**
|
|
4
|
+
* The file type to match against. Matches all file types by default.
|
|
5
|
+
* @default '.*'
|
|
6
|
+
*/
|
|
7
|
+
type?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const FileUploadItemPreview: (props: FileUploadItemPreviewProps) => import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ItemProps } from '@zag-js/file-upload';
|
|
2
|
+
import { type HTMLArkProps } from '../factory';
|
|
3
|
+
import type { Assign } from '../types';
|
|
4
|
+
export interface FileUploadItemProps extends Assign<HTMLArkProps<'li'>, ItemProps> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadItem: (props: FileUploadItemProps) => import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js/jsx-runtime';
|
|
2
|
+
import { type HTMLArkProps } from '../factory';
|
|
3
|
+
import type { Assign } from '../types';
|
|
4
|
+
import { type UseFileUploadProps, type UseFileUploadReturn } from './use-file-upload';
|
|
5
|
+
export interface FileUploadProps extends Assign<HTMLArkProps<'div'>, UseFileUploadProps & {
|
|
6
|
+
children?: ((api: UseFileUploadReturn) => JSX.Element) | JSX.Element;
|
|
7
|
+
}> {
|
|
8
|
+
}
|
|
9
|
+
export declare const FileUpload: (props: FileUploadProps) => JSX.Element;
|