@ark-ui/react 1.0.1 → 1.1.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 +15 -0
- package/README.md +60 -67
- package/accordion/accordion.stories.d.ts +0 -1
- package/color-picker/color-picker-format-select.cjs +21 -0
- package/color-picker/color-picker-format-select.d.ts +6 -0
- package/color-picker/color-picker-format-select.mjs +17 -0
- package/color-picker/color-picker-format-trigger.cjs +19 -0
- package/color-picker/color-picker-format-trigger.d.ts +6 -0
- package/color-picker/color-picker-format-trigger.mjs +15 -0
- package/color-picker/color-picker-swatch-context.cjs +15 -0
- package/color-picker/color-picker-swatch-context.d.ts +6 -0
- package/color-picker/color-picker-swatch-context.mjs +10 -0
- package/color-picker/color-picker-swatch-indicator.cjs +21 -0
- package/color-picker/color-picker-swatch-indicator.d.ts +6 -0
- package/color-picker/color-picker-swatch-indicator.mjs +17 -0
- package/color-picker/color-picker-swatch-trigger.cjs +4 -1
- package/color-picker/color-picker-swatch-trigger.d.ts +1 -5
- package/color-picker/color-picker-swatch-trigger.mjs +4 -1
- package/color-picker/color-picker-swatch.cjs +4 -3
- package/color-picker/color-picker-swatch.mjs +4 -3
- package/color-picker/color-picker-transparency-grid.d.ts +2 -5
- package/color-picker/color-picker.cjs +3 -1
- package/color-picker/color-picker.mjs +3 -1
- package/color-picker/index.cjs +10 -0
- package/color-picker/index.d.ts +10 -3
- package/color-picker/index.mjs +7 -1
- package/color-picker/use-color-picker.cjs +1 -1
- package/color-picker/use-color-picker.d.ts +4 -1
- package/color-picker/use-color-picker.mjs +1 -1
- package/file-upload/file-upload-context.cjs +15 -0
- package/file-upload/file-upload-context.d.ts +6 -0
- package/file-upload/file-upload-context.mjs +10 -0
- package/file-upload/file-upload-dropzone.cjs +24 -0
- package/file-upload/file-upload-dropzone.d.ts +6 -0
- package/file-upload/file-upload-dropzone.mjs +20 -0
- package/file-upload/file-upload-item-context.cjs +15 -0
- package/file-upload/file-upload-item-context.d.ts +6 -0
- package/file-upload/file-upload-item-context.mjs +10 -0
- package/file-upload/file-upload-item-delete-trigger.cjs +21 -0
- package/file-upload/file-upload-item-delete-trigger.d.ts +6 -0
- package/file-upload/file-upload-item-delete-trigger.mjs +17 -0
- package/file-upload/file-upload-item-group.cjs +24 -0
- package/file-upload/file-upload-item-group.d.ts +8 -0
- package/file-upload/file-upload-item-group.mjs +20 -0
- package/file-upload/file-upload-item-name.cjs +24 -0
- package/file-upload/file-upload-item-name.d.ts +6 -0
- package/file-upload/file-upload-item-name.mjs +20 -0
- package/file-upload/file-upload-item-preview.cjs +31 -0
- package/file-upload/file-upload-item-preview.d.ts +6 -0
- package/file-upload/file-upload-item-preview.mjs +27 -0
- package/file-upload/file-upload-item-size-text.cjs +24 -0
- package/file-upload/file-upload-item-size-text.d.ts +6 -0
- package/file-upload/file-upload-item-size-text.mjs +20 -0
- package/file-upload/file-upload-item.cjs +24 -0
- package/file-upload/file-upload-item.d.ts +8 -0
- package/file-upload/file-upload-item.mjs +20 -0
- package/file-upload/file-upload-label.cjs +19 -0
- package/file-upload/file-upload-label.d.ts +6 -0
- package/file-upload/file-upload-label.mjs +15 -0
- package/file-upload/file-upload-trigger.cjs +21 -0
- package/file-upload/file-upload-trigger.d.ts +6 -0
- package/file-upload/file-upload-trigger.mjs +17 -0
- package/file-upload/file-upload.cjs +42 -0
- package/file-upload/file-upload.d.ts +9 -0
- package/file-upload/file-upload.mjs +38 -0
- package/file-upload/file-upload.stories.d.ts +7 -0
- package/file-upload/file-upload.test.d.ts +1 -0
- package/file-upload/index.cjs +41 -0
- package/file-upload/index.d.ts +27 -0
- package/file-upload/index.mjs +27 -0
- package/file-upload/use-file-upload.cjs +47 -0
- package/file-upload/use-file-upload.d.ts +8 -0
- package/file-upload/use-file-upload.mjs +24 -0
- package/index.cjs +68 -38
- package/index.d.ts +1 -0
- package/index.mjs +15 -0
- package/number-input/number-input.cjs +35 -30
- package/number-input/number-input.d.ts +5 -4
- package/number-input/number-input.mjs +35 -30
- package/number-input/number-input.stories.d.ts +1 -0
- package/package.json +53 -45
- package/radio-group/radio-group.stories.d.ts +1 -1
- package/select/select.stories.d.ts +1 -0
- package/slider/slider.stories.d.ts +1 -1
- package/toast/create-toaster.cjs +1 -1
- package/toast/create-toaster.mjs +1 -1
package/color-picker/index.mjs
CHANGED
|
@@ -13,10 +13,13 @@ import { ColorPickerContent } from './color-picker-content.mjs';
|
|
|
13
13
|
export { useColorPickerContext } from './color-picker-context.mjs';
|
|
14
14
|
import { ColorPickerControl } from './color-picker-control.mjs';
|
|
15
15
|
import { ColorPickerEyeDropperTrigger } from './color-picker-eye-dropper-trigger.mjs';
|
|
16
|
+
import { ColorPickerFormatSelect } from './color-picker-format-select.mjs';
|
|
17
|
+
import { ColorPickerFormatTrigger } from './color-picker-format-trigger.mjs';
|
|
16
18
|
import { ColorPickerLabel } from './color-picker-label.mjs';
|
|
17
19
|
import { ColorPickerPositioner } from './color-picker-positioner.mjs';
|
|
18
20
|
import { ColorPickerSwatch } from './color-picker-swatch.mjs';
|
|
19
21
|
import { ColorPickerSwatchGroup } from './color-picker-swatch-group.mjs';
|
|
22
|
+
import { ColorPickerSwatchIndicator } from './color-picker-swatch-indicator.mjs';
|
|
20
23
|
import { ColorPickerSwatchTrigger } from './color-picker-swatch-trigger.mjs';
|
|
21
24
|
import { ColorPickerTransparencyGrid } from './color-picker-transparency-grid.mjs';
|
|
22
25
|
import { ColorPickerTrigger } from './color-picker-trigger.mjs';
|
|
@@ -35,10 +38,13 @@ const ColorPicker = Object.assign(ColorPicker$1, {
|
|
|
35
38
|
Content: ColorPickerContent,
|
|
36
39
|
Control: ColorPickerControl,
|
|
37
40
|
EyeDropperTrigger: ColorPickerEyeDropperTrigger,
|
|
41
|
+
FormatTrigger: ColorPickerFormatTrigger,
|
|
42
|
+
FormatSelect: ColorPickerFormatSelect,
|
|
38
43
|
Label: ColorPickerLabel,
|
|
39
44
|
Positioner: ColorPickerPositioner,
|
|
40
45
|
Swatch: ColorPickerSwatch,
|
|
41
46
|
SwatchGroup: ColorPickerSwatchGroup,
|
|
47
|
+
SwatchIndicator: ColorPickerSwatchIndicator,
|
|
42
48
|
SwatchTrigger: ColorPickerSwatchTrigger,
|
|
43
49
|
TransparencyGrid: ColorPickerTransparencyGrid,
|
|
44
50
|
Trigger: ColorPickerTrigger,
|
|
@@ -46,4 +52,4 @@ const ColorPicker = Object.assign(ColorPicker$1, {
|
|
|
46
52
|
View: ColorPickerView
|
|
47
53
|
});
|
|
48
54
|
|
|
49
|
-
export { ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerLabel, ColorPickerPositioner, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText };
|
|
55
|
+
export { ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerFormatSelect, ColorPickerFormatTrigger, ColorPickerLabel, ColorPickerPositioner, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchIndicator, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText, ColorPickerView };
|
|
@@ -29,7 +29,7 @@ function _interopNamespaceDefault(e) {
|
|
|
29
29
|
|
|
30
30
|
const colorPicker__namespace = /*#__PURE__*/_interopNamespaceDefault(colorPicker);
|
|
31
31
|
|
|
32
|
-
const useColorPicker = (props
|
|
32
|
+
const useColorPicker = (props) => {
|
|
33
33
|
const initialContext = {
|
|
34
34
|
id: react.useId(),
|
|
35
35
|
getRootNode: environmentContext.useEnvironmentContext(),
|
|
@@ -6,8 +6,11 @@ export interface UseColorPickerProps extends Optional<Omit<colorPicker.Context,
|
|
|
6
6
|
* The initial value of the color picker.
|
|
7
7
|
*/
|
|
8
8
|
defaultValue?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The current value of the color picker.
|
|
11
|
+
*/
|
|
9
12
|
value?: string;
|
|
10
13
|
}
|
|
11
14
|
export interface UseColorPickerReturn extends colorPicker.Api<PropTypes> {
|
|
12
15
|
}
|
|
13
|
-
export declare const useColorPicker: (props
|
|
16
|
+
export declare const useColorPicker: (props: UseColorPickerProps) => UseColorPickerReturn;
|
|
@@ -6,7 +6,7 @@ import '../environment/index.mjs';
|
|
|
6
6
|
import { useEvent } from '../use-event.mjs';
|
|
7
7
|
import { useEnvironmentContext } from '../environment/environment-context.mjs';
|
|
8
8
|
|
|
9
|
-
const useColorPicker = (props
|
|
9
|
+
const useColorPicker = (props) => {
|
|
10
10
|
const initialContext = {
|
|
11
11
|
id: useId(),
|
|
12
12
|
getRootNode: useEnvironmentContext(),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const createContext = require('../create-context.cjs');
|
|
7
|
+
|
|
8
|
+
const [FileUploadProvider, useFileUploadContext] = createContext.createContext({
|
|
9
|
+
name: "FileUploadContext",
|
|
10
|
+
hookName: "useFileUploadContext",
|
|
11
|
+
providerName: "<FileUploadProvider />"
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
exports.FileUploadProvider = FileUploadProvider;
|
|
15
|
+
exports.useFileUploadContext = useFileUploadContext;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Provider } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type UseFileUploadReturn } from './use-file-upload';
|
|
4
|
+
export interface FileUploadContext extends UseFileUploadReturn {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadProvider: Provider<FileUploadContext>, useFileUploadContext: () => FileUploadContext;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createContext } from '../create-context.mjs';
|
|
3
|
+
|
|
4
|
+
const [FileUploadProvider, useFileUploadContext] = createContext({
|
|
5
|
+
name: "FileUploadContext",
|
|
6
|
+
hookName: "useFileUploadContext",
|
|
7
|
+
providerName: "<FileUploadProvider />"
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { FileUploadProvider, useFileUploadContext };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
11
|
+
|
|
12
|
+
const FileUploadDropzone = react.forwardRef(
|
|
13
|
+
(props, ref) => {
|
|
14
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
15
|
+
const mergedProps = react$1.mergeProps(api.dropzoneProps, props);
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }),
|
|
18
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { ...api.hiddenInputProps })
|
|
19
|
+
] });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
FileUploadDropzone.displayName = "FileUploadDropzone";
|
|
23
|
+
|
|
24
|
+
exports.FileUploadDropzone = FileUploadDropzone;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface FileUploadDropzoneProps extends HTMLArkProps<'div'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadDropzone: ForwardRefExoticComponent<FileUploadDropzoneProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
7
|
+
|
|
8
|
+
const FileUploadDropzone = forwardRef(
|
|
9
|
+
(props, ref) => {
|
|
10
|
+
const api = useFileUploadContext();
|
|
11
|
+
const mergedProps = mergeProps(api.dropzoneProps, props);
|
|
12
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
|
+
/* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }),
|
|
14
|
+
/* @__PURE__ */ jsx("input", { ...api.hiddenInputProps })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
FileUploadDropzone.displayName = "FileUploadDropzone";
|
|
19
|
+
|
|
20
|
+
export { FileUploadDropzone };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const createContext = require('../create-context.cjs');
|
|
7
|
+
|
|
8
|
+
const [FileUploadItemProvider, useFileUploadItemContext] = createContext.createContext({
|
|
9
|
+
name: "FileUploadItemContext",
|
|
10
|
+
hookName: "useFileUploadItemContext",
|
|
11
|
+
providerName: "<FileUploadItemProvider />"
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
exports.FileUploadItemProvider = FileUploadItemProvider;
|
|
15
|
+
exports.useFileUploadItemContext = useFileUploadItemContext;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Provider } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import type { ItemProps } from '@zag-js/file-upload';
|
|
4
|
+
export interface FileUploadItemContext extends ItemProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadItemProvider: Provider<FileUploadItemContext>, useFileUploadItemContext: () => FileUploadItemContext;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createContext } from '../create-context.mjs';
|
|
3
|
+
|
|
4
|
+
const [FileUploadItemProvider, useFileUploadItemContext] = createContext({
|
|
5
|
+
name: "FileUploadItemContext",
|
|
6
|
+
hookName: "useFileUploadItemContext",
|
|
7
|
+
providerName: "<FileUploadItemProvider />"
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { FileUploadItemProvider, useFileUploadItemContext };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
11
|
+
const fileUploadItemContext = require('./file-upload-item-context.cjs');
|
|
12
|
+
|
|
13
|
+
const FileUploadItemDeleteTrigger = react.forwardRef((props, ref) => {
|
|
14
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
15
|
+
const item = fileUploadItemContext.useFileUploadItemContext();
|
|
16
|
+
const mergedProps = react$1.mergeProps(api.getItemDeleteTriggerProps(item), props);
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ...mergedProps, ref });
|
|
18
|
+
});
|
|
19
|
+
FileUploadItemDeleteTrigger.displayName = "FileUploadItemDeleteTrigger";
|
|
20
|
+
|
|
21
|
+
exports.FileUploadItemDeleteTrigger = FileUploadItemDeleteTrigger;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface FileUploadItemDeleteTriggerProps extends HTMLArkProps<'button'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadItemDeleteTrigger: ForwardRefExoticComponent<FileUploadItemDeleteTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
7
|
+
import { useFileUploadItemContext } from './file-upload-item-context.mjs';
|
|
8
|
+
|
|
9
|
+
const FileUploadItemDeleteTrigger = forwardRef((props, ref) => {
|
|
10
|
+
const api = useFileUploadContext();
|
|
11
|
+
const item = useFileUploadItemContext();
|
|
12
|
+
const mergedProps = mergeProps(api.getItemDeleteTriggerProps(item), props);
|
|
13
|
+
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
14
|
+
});
|
|
15
|
+
FileUploadItemDeleteTrigger.displayName = "FileUploadItemDeleteTrigger";
|
|
16
|
+
|
|
17
|
+
export { FileUploadItemDeleteTrigger };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const runIfFn = require('../run-if-fn.cjs');
|
|
11
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
12
|
+
|
|
13
|
+
const FileUploadItemGroup = react.forwardRef(
|
|
14
|
+
(props, ref) => {
|
|
15
|
+
const { children, ...rest } = props;
|
|
16
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
17
|
+
const mergedProps = react$1.mergeProps(api.itemGroupProps, rest);
|
|
18
|
+
const view = runIfFn.runIfFn(children, api.files);
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.ul, { ...mergedProps, ref, children: view });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
FileUploadItemGroup.displayName = "FileUploadItemGroup";
|
|
23
|
+
|
|
24
|
+
exports.FileUploadItemGroup = FileUploadItemGroup;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type HTMLArkProps } from '../factory';
|
|
3
|
+
import type { Assign } from '../types';
|
|
4
|
+
export interface FileUploadItemGroupProps extends Assign<HTMLArkProps<'ul'>, {
|
|
5
|
+
children?: ReactNode | ((state: File[]) => ReactNode);
|
|
6
|
+
}> {
|
|
7
|
+
}
|
|
8
|
+
export declare const FileUploadItemGroup: ForwardRefExoticComponent<FileUploadItemGroupProps & RefAttributes<HTMLUListElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { runIfFn } from '../run-if-fn.mjs';
|
|
7
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
8
|
+
|
|
9
|
+
const FileUploadItemGroup = forwardRef(
|
|
10
|
+
(props, ref) => {
|
|
11
|
+
const { children, ...rest } = props;
|
|
12
|
+
const api = useFileUploadContext();
|
|
13
|
+
const mergedProps = mergeProps(api.itemGroupProps, rest);
|
|
14
|
+
const view = runIfFn(children, api.files);
|
|
15
|
+
return /* @__PURE__ */ jsx(ark.ul, { ...mergedProps, ref, children: view });
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
FileUploadItemGroup.displayName = "FileUploadItemGroup";
|
|
19
|
+
|
|
20
|
+
export { FileUploadItemGroup };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
11
|
+
const fileUploadItemContext = require('./file-upload-item-context.cjs');
|
|
12
|
+
|
|
13
|
+
const FileUploadItemName = react.forwardRef(
|
|
14
|
+
(props, ref) => {
|
|
15
|
+
const { children, ...rest } = props;
|
|
16
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
17
|
+
const item = fileUploadItemContext.useFileUploadItemContext();
|
|
18
|
+
const mergedProps = react$1.mergeProps(api.getItemNameProps(item), rest);
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref, children: children || item.file.name });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
FileUploadItemName.displayName = "FileUploadItemName";
|
|
23
|
+
|
|
24
|
+
exports.FileUploadItemName = FileUploadItemName;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface FileUploadItemNameProps extends HTMLArkProps<'div'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadItemName: ForwardRefExoticComponent<FileUploadItemNameProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
7
|
+
import { useFileUploadItemContext } from './file-upload-item-context.mjs';
|
|
8
|
+
|
|
9
|
+
const FileUploadItemName = forwardRef(
|
|
10
|
+
(props, ref) => {
|
|
11
|
+
const { children, ...rest } = props;
|
|
12
|
+
const api = useFileUploadContext();
|
|
13
|
+
const item = useFileUploadItemContext();
|
|
14
|
+
const mergedProps = mergeProps(api.getItemNameProps(item), rest);
|
|
15
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref, children: children || item.file.name });
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
FileUploadItemName.displayName = "FileUploadItemName";
|
|
19
|
+
|
|
20
|
+
export { FileUploadItemName };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
11
|
+
const fileUploadItemContext = require('./file-upload-item-context.cjs');
|
|
12
|
+
|
|
13
|
+
const FileUploadItemPreview = react.forwardRef(
|
|
14
|
+
(props, ref) => {
|
|
15
|
+
const [url, setUrl] = react.useState("");
|
|
16
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
17
|
+
const item = fileUploadItemContext.useFileUploadItemContext();
|
|
18
|
+
react.useEffect(() => {
|
|
19
|
+
api.createFileUrl(item.file, (url2) => setUrl(url2));
|
|
20
|
+
}, [item, api]);
|
|
21
|
+
try {
|
|
22
|
+
const mergedProps = react$1.mergeProps(api.getItemPreviewProps({ ...item, url }), props);
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.img, { ...mergedProps, ref });
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
FileUploadItemPreview.displayName = "FileUploadItemPreview";
|
|
30
|
+
|
|
31
|
+
exports.FileUploadItemPreview = FileUploadItemPreview;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface FileUploadItemPreviewProps extends HTMLArkProps<'img'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadItemPreview: ForwardRefExoticComponent<FileUploadItemPreviewProps & RefAttributes<HTMLImageElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef, useState, useEffect } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
7
|
+
import { useFileUploadItemContext } from './file-upload-item-context.mjs';
|
|
8
|
+
|
|
9
|
+
const FileUploadItemPreview = forwardRef(
|
|
10
|
+
(props, ref) => {
|
|
11
|
+
const [url, setUrl] = useState("");
|
|
12
|
+
const api = useFileUploadContext();
|
|
13
|
+
const item = useFileUploadItemContext();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
api.createFileUrl(item.file, (url2) => setUrl(url2));
|
|
16
|
+
}, [item, api]);
|
|
17
|
+
try {
|
|
18
|
+
const mergedProps = mergeProps(api.getItemPreviewProps({ ...item, url }), props);
|
|
19
|
+
return /* @__PURE__ */ jsx(ark.img, { ...mergedProps, ref });
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
FileUploadItemPreview.displayName = "FileUploadItemPreview";
|
|
26
|
+
|
|
27
|
+
export { FileUploadItemPreview };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
11
|
+
const fileUploadItemContext = require('./file-upload-item-context.cjs');
|
|
12
|
+
|
|
13
|
+
const FileUploadItemSizeText = react.forwardRef(
|
|
14
|
+
(props, ref) => {
|
|
15
|
+
const { children, ...rest } = props;
|
|
16
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
17
|
+
const item = fileUploadItemContext.useFileUploadItemContext();
|
|
18
|
+
const mergedProps = react$1.mergeProps(api.getItemSizeTextProps(item), rest);
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref, children: children || api.getFileSize(item.file) });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
FileUploadItemSizeText.displayName = "FileUploadItemSizeText";
|
|
23
|
+
|
|
24
|
+
exports.FileUploadItemSizeText = FileUploadItemSizeText;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface FileUploadItemSizeTextProps extends HTMLArkProps<'div'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadItemSizeText: ForwardRefExoticComponent<FileUploadItemSizeTextProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
7
|
+
import { useFileUploadItemContext } from './file-upload-item-context.mjs';
|
|
8
|
+
|
|
9
|
+
const FileUploadItemSizeText = forwardRef(
|
|
10
|
+
(props, ref) => {
|
|
11
|
+
const { children, ...rest } = props;
|
|
12
|
+
const api = useFileUploadContext();
|
|
13
|
+
const item = useFileUploadItemContext();
|
|
14
|
+
const mergedProps = mergeProps(api.getItemSizeTextProps(item), rest);
|
|
15
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref, children: children || api.getFileSize(item.file) });
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
FileUploadItemSizeText.displayName = "FileUploadItemSizeText";
|
|
19
|
+
|
|
20
|
+
export { FileUploadItemSizeText };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const createSplitProps = require('../create-split-props.cjs');
|
|
10
|
+
const factory = require('../factory.cjs');
|
|
11
|
+
const runIfFn = require('../run-if-fn.cjs');
|
|
12
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
13
|
+
const fileUploadItemContext = require('./file-upload-item-context.cjs');
|
|
14
|
+
|
|
15
|
+
const FileUploadItem = react.forwardRef((props, ref) => {
|
|
16
|
+
const [itemProps, { children, ...localProps }] = createSplitProps.createSplitProps()(props, ["file"]);
|
|
17
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
18
|
+
const mergedProps = react$1.mergeProps(api.getItemProps(itemProps), localProps);
|
|
19
|
+
const view = runIfFn.runIfFn(children, api);
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(fileUploadItemContext.FileUploadItemProvider, { value: itemProps, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.li, { ...mergedProps, ref, children: view }) });
|
|
21
|
+
});
|
|
22
|
+
FileUploadItem.displayName = "FileUploadItem";
|
|
23
|
+
|
|
24
|
+
exports.FileUploadItem = FileUploadItem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import type { ItemProps } from '@zag-js/file-upload';
|
|
4
|
+
import { type HTMLArkProps } from '../factory';
|
|
5
|
+
import type { Assign } from '../types';
|
|
6
|
+
export interface FileUploadItemProps extends Assign<HTMLArkProps<'ul'>, ItemProps> {
|
|
7
|
+
}
|
|
8
|
+
export declare const FileUploadItem: ForwardRefExoticComponent<FileUploadItemProps & RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { createSplitProps } from '../create-split-props.mjs';
|
|
6
|
+
import { ark } from '../factory.mjs';
|
|
7
|
+
import { runIfFn } from '../run-if-fn.mjs';
|
|
8
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
9
|
+
import { FileUploadItemProvider } from './file-upload-item-context.mjs';
|
|
10
|
+
|
|
11
|
+
const FileUploadItem = forwardRef((props, ref) => {
|
|
12
|
+
const [itemProps, { children, ...localProps }] = createSplitProps()(props, ["file"]);
|
|
13
|
+
const api = useFileUploadContext();
|
|
14
|
+
const mergedProps = mergeProps(api.getItemProps(itemProps), localProps);
|
|
15
|
+
const view = runIfFn(children, api);
|
|
16
|
+
return /* @__PURE__ */ jsx(FileUploadItemProvider, { value: itemProps, children: /* @__PURE__ */ jsx(ark.li, { ...mergedProps, ref, children: view }) });
|
|
17
|
+
});
|
|
18
|
+
FileUploadItem.displayName = "FileUploadItem";
|
|
19
|
+
|
|
20
|
+
export { FileUploadItem };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
11
|
+
|
|
12
|
+
const FileUploadLabel = react.forwardRef((props, ref) => {
|
|
13
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
14
|
+
const mergedProps = react$1.mergeProps(api.labelProps, props);
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.label, { ...mergedProps, ref });
|
|
16
|
+
});
|
|
17
|
+
FileUploadLabel.displayName = "FileUploadLabel";
|
|
18
|
+
|
|
19
|
+
exports.FileUploadLabel = FileUploadLabel;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface FileUploadLabelProps extends HTMLArkProps<'label'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadLabel: ForwardRefExoticComponent<FileUploadLabelProps & RefAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
7
|
+
|
|
8
|
+
const FileUploadLabel = forwardRef((props, ref) => {
|
|
9
|
+
const api = useFileUploadContext();
|
|
10
|
+
const mergedProps = mergeProps(api.labelProps, props);
|
|
11
|
+
return /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref });
|
|
12
|
+
});
|
|
13
|
+
FileUploadLabel.displayName = "FileUploadLabel";
|
|
14
|
+
|
|
15
|
+
export { FileUploadLabel };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const fileUploadContext = require('./file-upload-context.cjs');
|
|
11
|
+
|
|
12
|
+
const FileUploadTrigger = react.forwardRef(
|
|
13
|
+
(props, ref) => {
|
|
14
|
+
const api = fileUploadContext.useFileUploadContext();
|
|
15
|
+
const mergedProps = react$1.mergeProps(api.triggerProps, props);
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ...mergedProps, ref });
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
FileUploadTrigger.displayName = "FileUploadTrigger";
|
|
20
|
+
|
|
21
|
+
exports.FileUploadTrigger = FileUploadTrigger;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface FileUploadTriggerProps extends HTMLArkProps<'button'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const FileUploadTrigger: ForwardRefExoticComponent<FileUploadTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useFileUploadContext } from './file-upload-context.mjs';
|
|
7
|
+
|
|
8
|
+
const FileUploadTrigger = forwardRef(
|
|
9
|
+
(props, ref) => {
|
|
10
|
+
const api = useFileUploadContext();
|
|
11
|
+
const mergedProps = mergeProps(api.triggerProps, props);
|
|
12
|
+
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
FileUploadTrigger.displayName = "FileUploadTrigger";
|
|
16
|
+
|
|
17
|
+
export { FileUploadTrigger };
|