@seed-design/react 0.0.0-alpha-20260324091316 → 0.0.0-alpha-20260416134952
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/lib/components/AttachmentInput/AttachmentInput.cjs +66 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts +23 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.js +37 -0
- package/lib/components/AttachmentInput/AttachmentInput.namespace.cjs +31 -0
- package/lib/components/AttachmentInput/AttachmentInput.namespace.d.ts +6 -0
- package/lib/components/AttachmentInput/AttachmentInput.namespace.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.namespace.js +4 -0
- package/lib/components/AttachmentInput/AttachmentInput.test.d.ts +2 -0
- package/lib/components/AttachmentInput/AttachmentInput.test.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInputDropzone.cjs +17 -0
- package/lib/components/AttachmentInput/AttachmentInputDropzone.d.ts +9 -0
- package/lib/components/AttachmentInput/AttachmentInputDropzone.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInputDropzone.js +12 -0
- package/lib/components/AttachmentInput/AttachmentInputItem.cjs +100 -0
- package/lib/components/AttachmentInput/AttachmentInputItem.d.ts +36 -0
- package/lib/components/AttachmentInput/AttachmentInputItem.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInputItem.js +68 -0
- package/lib/components/AttachmentInput/AttachmentInputTrigger.cjs +75 -0
- package/lib/components/AttachmentInput/AttachmentInputTrigger.d.ts +21 -0
- package/lib/components/AttachmentInput/AttachmentInputTrigger.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInputTrigger.js +50 -0
- package/lib/components/AttachmentInput/index.cjs +32 -0
- package/lib/components/AttachmentInput/index.d.ts +7 -0
- package/lib/components/AttachmentInput/index.d.ts.map +1 -0
- package/lib/components/AttachmentInput/index.js +6 -0
- package/lib/components/BottomSheet/BottomSheet.cjs +3 -1
- package/lib/components/BottomSheet/BottomSheet.d.ts +1 -2
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.js +3 -1
- package/lib/components/Checkbox/Checkbox.cjs +1 -13
- package/lib/components/Checkbox/Checkbox.d.ts +1 -7
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -13
- package/lib/components/ChipTabs/ChipTabs.cjs +0 -5
- package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -1
- package/lib/components/ChipTabs/ChipTabs.js +0 -5
- package/lib/components/Footer/Footer.namespace.cjs +9 -0
- package/lib/components/Footer/Footer.namespace.d.ts +2 -0
- package/lib/components/Footer/Footer.namespace.d.ts.map +1 -0
- package/lib/components/Footer/Footer.namespace.js +1 -0
- package/lib/components/Footer/FooterLinkText.cjs +40 -0
- package/lib/components/Footer/FooterLinkText.d.ts +7 -0
- package/lib/components/Footer/FooterLinkText.d.ts.map +1 -0
- package/lib/components/Footer/FooterLinkText.js +17 -0
- package/lib/components/Footer/index.cjs +11 -0
- package/lib/components/Footer/index.d.ts +3 -0
- package/lib/components/Footer/index.d.ts.map +1 -0
- package/lib/components/Footer/index.js +3 -0
- package/lib/components/ImageFrame/ImageFrame.cjs +31 -20
- package/lib/components/ImageFrame/ImageFrame.d.ts +0 -6
- package/lib/components/ImageFrame/ImageFrame.d.ts.map +1 -1
- package/lib/components/ImageFrame/ImageFrame.js +31 -20
- package/lib/components/Layout/Layout.cjs +18 -0
- package/lib/components/Layout/Layout.d.ts +10 -0
- package/lib/components/Layout/Layout.d.ts.map +1 -0
- package/lib/components/Layout/Layout.js +13 -0
- package/lib/components/Layout/Layout.namespace.cjs +10 -0
- package/lib/components/Layout/Layout.namespace.d.ts +2 -0
- package/lib/components/Layout/Layout.namespace.d.ts.map +1 -0
- package/lib/components/Layout/Layout.namespace.js +1 -0
- package/lib/components/Layout/index.cjs +12 -0
- package/lib/components/Layout/index.d.ts +3 -0
- package/lib/components/Layout/index.d.ts.map +1 -0
- package/lib/components/Layout/index.js +3 -0
- package/lib/components/Menu/Menu.cjs +118 -0
- package/lib/components/Menu/Menu.d.ts +42 -0
- package/lib/components/Menu/Menu.d.ts.map +1 -0
- package/lib/components/Menu/Menu.js +84 -0
- package/lib/components/Menu/Menu.namespace.cjs +20 -0
- package/lib/components/Menu/Menu.namespace.d.ts +2 -0
- package/lib/components/Menu/Menu.namespace.d.ts.map +1 -0
- package/lib/components/Menu/Menu.namespace.js +1 -0
- package/lib/components/Menu/index.cjs +22 -0
- package/lib/components/Menu/index.d.ts +3 -0
- package/lib/components/Menu/index.d.ts.map +1 -0
- package/lib/components/Menu/index.js +3 -0
- package/lib/components/SideNavigation/SideNavigation.cjs +178 -0
- package/lib/components/SideNavigation/SideNavigation.d.ts +59 -0
- package/lib/components/SideNavigation/SideNavigation.d.ts.map +1 -0
- package/lib/components/SideNavigation/SideNavigation.js +159 -0
- package/lib/components/SideNavigation/SideNavigation.namespace.cjs +24 -0
- package/lib/components/SideNavigation/SideNavigation.namespace.d.ts +3 -0
- package/lib/components/SideNavigation/SideNavigation.namespace.d.ts.map +1 -0
- package/lib/components/SideNavigation/SideNavigation.namespace.js +1 -0
- package/lib/components/SideNavigation/index.cjs +26 -0
- package/lib/components/SideNavigation/index.d.ts +4 -0
- package/lib/components/SideNavigation/index.d.ts.map +1 -0
- package/lib/components/SideNavigation/index.js +3 -0
- package/lib/components/Switch/Switch.cjs +1 -13
- package/lib/components/Switch/Switch.d.ts +1 -7
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +1 -13
- package/lib/components/index.cjs +68 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +18 -0
- package/lib/index.cjs +68 -0
- package/lib/index.js +18 -0
- package/lib/primitive.cjs +21 -0
- package/lib/primitive.d.ts +3 -0
- package/lib/primitive.d.ts.map +1 -1
- package/lib/primitive.js +3 -0
- package/lib/utils/styled.cjs +6 -95
- package/lib/utils/styled.d.ts +6 -6
- package/lib/utils/styled.d.ts.map +1 -1
- package/lib/utils/styled.js +6 -95
- package/package.json +25 -22
- package/src/components/AttachmentInput/AttachmentInput.namespace.ts +54 -0
- package/src/components/AttachmentInput/AttachmentInput.test.tsx +143 -0
- package/src/components/AttachmentInput/AttachmentInput.tsx +72 -0
- package/src/components/AttachmentInput/AttachmentInputDropzone.tsx +25 -0
- package/src/components/AttachmentInput/AttachmentInputItem.tsx +177 -0
- package/src/components/AttachmentInput/AttachmentInputTrigger.tsx +85 -0
- package/src/components/AttachmentInput/index.ts +54 -0
- package/src/components/BottomSheet/BottomSheet.tsx +2 -0
- package/src/components/Checkbox/Checkbox.tsx +3 -31
- package/src/components/ChipTabs/ChipTabs.tsx +0 -6
- package/src/components/Footer/Footer.namespace.ts +4 -0
- package/src/components/Footer/FooterLinkText.tsx +23 -0
- package/src/components/Footer/index.ts +3 -0
- package/src/components/ImageFrame/ImageFrame.tsx +8 -7
- package/src/components/Layout/Layout.namespace.ts +6 -0
- package/src/components/Layout/Layout.tsx +21 -0
- package/src/components/Layout/index.ts +8 -0
- package/src/components/Menu/Menu.namespace.ts +26 -0
- package/src/components/Menu/Menu.tsx +157 -0
- package/src/components/Menu/index.ts +28 -0
- package/src/components/SideNavigation/SideNavigation.namespace.ts +37 -0
- package/src/components/SideNavigation/SideNavigation.tsx +338 -0
- package/src/components/SideNavigation/index.ts +39 -0
- package/src/components/Switch/Switch.tsx +3 -26
- package/src/components/index.ts +5 -0
- package/src/primitive.ts +3 -0
- package/src/utils/styled.tsx +14 -155
|
@@ -0,0 +1,66 @@
|
|
|
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 = require('react');
|
|
8
|
+
const attachmentInput = require('@seed-design/css/recipes/attachment-input');
|
|
9
|
+
const reactFileUpload = require('@seed-design/react-file-upload');
|
|
10
|
+
const reactField = require('@seed-design/react-field');
|
|
11
|
+
const reactPrimitive = require('@seed-design/react-primitive');
|
|
12
|
+
const domUtils = require('@seed-design/dom-utils');
|
|
13
|
+
const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
|
|
14
|
+
const createWithStateProps = require('../../utils/createWithStateProps.cjs');
|
|
15
|
+
|
|
16
|
+
function _interopNamespaceDefault(e) {
|
|
17
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
18
|
+
if (e) {
|
|
19
|
+
for (const k in e) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: () => e[k]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
34
|
+
|
|
35
|
+
const { withProvider, withContext } = createSlotRecipeContext.createSlotRecipeContext(attachmentInput.attachmentInput);
|
|
36
|
+
const withStateProps = createWithStateProps.createWithStateProps([reactFileUpload.useFileUploadContext]);
|
|
37
|
+
const AttachmentInputRoot = withProvider(
|
|
38
|
+
reactFileUpload.FileUpload.Root,
|
|
39
|
+
"root"
|
|
40
|
+
);
|
|
41
|
+
const AttachmentInputContainer = withContext(
|
|
42
|
+
withStateProps(reactPrimitive.Primitive.div),
|
|
43
|
+
"container"
|
|
44
|
+
);
|
|
45
|
+
const AttachmentInputHiddenInput = React__namespace.forwardRef((props, ref) => {
|
|
46
|
+
const fileUploadContext = reactFileUpload.useFileUploadContext();
|
|
47
|
+
const fieldContext = reactField.useFieldContext({ strict: false });
|
|
48
|
+
const mergedProps = domUtils.mergeProps(
|
|
49
|
+
fieldContext ? fieldContext.inputAriaAttributes : {},
|
|
50
|
+
fileUploadContext.hiddenInputProps,
|
|
51
|
+
fieldContext ? fieldContext.inputProps : {},
|
|
52
|
+
props
|
|
53
|
+
);
|
|
54
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactFileUpload.FileUpload.HiddenInput, { ref, ...mergedProps });
|
|
55
|
+
});
|
|
56
|
+
AttachmentInputHiddenInput.displayName = "AttachmentInputHiddenInput";
|
|
57
|
+
const AttachmentInputItemGroup = withContext(withStateProps(reactPrimitive.Primitive.ul), "itemGroup");
|
|
58
|
+
const AttachmentInputContext = reactFileUpload.FileUpload.Context;
|
|
59
|
+
|
|
60
|
+
exports.AttachmentInputContainer = AttachmentInputContainer;
|
|
61
|
+
exports.AttachmentInputContext = AttachmentInputContext;
|
|
62
|
+
exports.AttachmentInputHiddenInput = AttachmentInputHiddenInput;
|
|
63
|
+
exports.AttachmentInputItemGroup = AttachmentInputItemGroup;
|
|
64
|
+
exports.AttachmentInputRoot = AttachmentInputRoot;
|
|
65
|
+
exports.withContext = withContext;
|
|
66
|
+
exports.withProvider = withProvider;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AttachmentInputVariantProps, AttachmentInputSlotName } from '@seed-design/css/recipes/attachment-input';
|
|
2
|
+
import { FileUpload as FileUploadPrimitive } from '@seed-design/react-file-upload';
|
|
3
|
+
import { PrimitiveProps } from '@seed-design/react-primitive';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export declare const withProvider: <T, P>(Component: React.ElementType<any>, slot: AttachmentInputSlotName, options?: {
|
|
6
|
+
defaultProps?: Partial<P> | undefined;
|
|
7
|
+
} | undefined) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>, withContext: <T, P>(Component: React.ElementType<any>, slot?: AttachmentInputSlotName | undefined) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
|
|
8
|
+
export interface AttachmentInputRootProps extends AttachmentInputVariantProps, FileUploadPrimitive.RootProps {
|
|
9
|
+
}
|
|
10
|
+
export declare const AttachmentInputRoot: React.ForwardRefExoticComponent<AttachmentInputRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export interface AttachmentInputContainerProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
}
|
|
13
|
+
export declare const AttachmentInputContainer: React.ForwardRefExoticComponent<AttachmentInputContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export interface AttachmentInputHiddenInputProps extends FileUploadPrimitive.HiddenInputProps {
|
|
15
|
+
}
|
|
16
|
+
export declare const AttachmentInputHiddenInput: React.ForwardRefExoticComponent<AttachmentInputHiddenInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
17
|
+
export interface AttachmentInputItemGroupProps extends PrimitiveProps, React.HTMLAttributes<HTMLUListElement> {
|
|
18
|
+
}
|
|
19
|
+
export declare const AttachmentInputItemGroup: React.ForwardRefExoticComponent<AttachmentInputItemGroupProps & React.RefAttributes<HTMLUListElement>>;
|
|
20
|
+
export interface AttachmentInputContextProps extends FileUploadPrimitive.ContextProps {
|
|
21
|
+
}
|
|
22
|
+
export declare const AttachmentInputContext: (props: FileUploadPrimitive.ContextProps) => React.ReactNode;
|
|
23
|
+
//# sourceMappingURL=AttachmentInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentInput.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentInput/AttachmentInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,UAAU,IAAI,mBAAmB,EAElC,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAK9E,eAAO,MAAQ,YAAY;;sGAAE,WAAW,iOAA6C,CAAC;AAItF,MAAM,WAAW,wBACf,SAAQ,2BAA2B,EACjC,mBAAmB,CAAC,SAAS;CAAG;AAEpC,eAAO,MAAM,mBAAmB,iGAG/B,CAAC;AAEF,MAAM,WAAW,6BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,wBAAwB,sGAGpC,CAAC;AAEF,MAAM,WAAW,+BAAgC,SAAQ,mBAAmB,CAAC,gBAAgB;CAAG;AAEhG,eAAO,MAAM,0BAA0B,0GAerC,CAAC;AAGH,MAAM,WAAW,6BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;CAAG;AAE7C,eAAO,MAAM,wBAAwB,wGAGO,CAAC;AAE7C,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB,CAAC,YAAY;CAAG;AAExF,eAAO,MAAM,sBAAsB,8DAA8B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { attachmentInput } from '@seed-design/css/recipes/attachment-input';
|
|
5
|
+
import { FileUpload, useFileUploadContext } from '@seed-design/react-file-upload';
|
|
6
|
+
import { useFieldContext } from '@seed-design/react-field';
|
|
7
|
+
import { Primitive } from '@seed-design/react-primitive';
|
|
8
|
+
import { mergeProps } from '@seed-design/dom-utils';
|
|
9
|
+
import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
|
|
10
|
+
import { createWithStateProps } from '../../utils/createWithStateProps.js';
|
|
11
|
+
|
|
12
|
+
const { withProvider, withContext } = createSlotRecipeContext(attachmentInput);
|
|
13
|
+
const withStateProps = createWithStateProps([useFileUploadContext]);
|
|
14
|
+
const AttachmentInputRoot = withProvider(
|
|
15
|
+
FileUpload.Root,
|
|
16
|
+
"root"
|
|
17
|
+
);
|
|
18
|
+
const AttachmentInputContainer = withContext(
|
|
19
|
+
withStateProps(Primitive.div),
|
|
20
|
+
"container"
|
|
21
|
+
);
|
|
22
|
+
const AttachmentInputHiddenInput = React.forwardRef((props, ref) => {
|
|
23
|
+
const fileUploadContext = useFileUploadContext();
|
|
24
|
+
const fieldContext = useFieldContext({ strict: false });
|
|
25
|
+
const mergedProps = mergeProps(
|
|
26
|
+
fieldContext ? fieldContext.inputAriaAttributes : {},
|
|
27
|
+
fileUploadContext.hiddenInputProps,
|
|
28
|
+
fieldContext ? fieldContext.inputProps : {},
|
|
29
|
+
props
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ jsx(FileUpload.HiddenInput, { ref, ...mergedProps });
|
|
32
|
+
});
|
|
33
|
+
AttachmentInputHiddenInput.displayName = "AttachmentInputHiddenInput";
|
|
34
|
+
const AttachmentInputItemGroup = withContext(withStateProps(Primitive.ul), "itemGroup");
|
|
35
|
+
const AttachmentInputContext = FileUpload.Context;
|
|
36
|
+
|
|
37
|
+
export { AttachmentInputContainer, AttachmentInputContext, AttachmentInputHiddenInput, AttachmentInputItemGroup, AttachmentInputRoot, withContext, withProvider };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const AttachmentInput = require('./AttachmentInput.cjs');
|
|
6
|
+
const AttachmentInputDropzone = require('./AttachmentInputDropzone.cjs');
|
|
7
|
+
const AttachmentInputItem = require('./AttachmentInputItem.cjs');
|
|
8
|
+
const AttachmentInputTrigger = require('./AttachmentInputTrigger.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.Container = AttachmentInput.AttachmentInputContainer;
|
|
13
|
+
exports.Context = AttachmentInput.AttachmentInputContext;
|
|
14
|
+
exports.HiddenInput = AttachmentInput.AttachmentInputHiddenInput;
|
|
15
|
+
exports.ItemGroup = AttachmentInput.AttachmentInputItemGroup;
|
|
16
|
+
exports.Root = AttachmentInput.AttachmentInputRoot;
|
|
17
|
+
exports.Dropzone = AttachmentInputDropzone.AttachmentInputDropzone;
|
|
18
|
+
exports.DropzoneLabel = AttachmentInputDropzone.AttachmentInputDropzoneLabel;
|
|
19
|
+
exports.Item = AttachmentInputItem.AttachmentInputItem;
|
|
20
|
+
exports.ItemActionButton = AttachmentInputItem.AttachmentInputItemActionButton;
|
|
21
|
+
exports.ItemBackdrop = AttachmentInputItem.AttachmentInputItemBackdrop;
|
|
22
|
+
exports.ItemBadge = AttachmentInputItem.AttachmentInputItemBadge;
|
|
23
|
+
exports.ItemImage = AttachmentInputItem.AttachmentInputItemImage;
|
|
24
|
+
exports.ItemMetadata = AttachmentInputItem.AttachmentInputItemMetadata;
|
|
25
|
+
exports.ItemName = AttachmentInputItem.AttachmentInputItemName;
|
|
26
|
+
exports.ItemRemoveButton = AttachmentInputItem.AttachmentInputItemRemoveButton;
|
|
27
|
+
exports.ItemSizeText = AttachmentInputItem.AttachmentInputItemSize;
|
|
28
|
+
exports.ItemThumbnail = AttachmentInputItem.AttachmentInputItemThumbnail;
|
|
29
|
+
exports.Trigger = AttachmentInputTrigger.AttachmentInputTrigger;
|
|
30
|
+
exports.TriggerIcon = AttachmentInputTrigger.AttachmentInputTriggerIcon;
|
|
31
|
+
exports.TriggerItemCount = AttachmentInputTrigger.AttachmentInputTriggerItemCount;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { AttachmentInputContainer as Container, AttachmentInputHiddenInput as HiddenInput, AttachmentInputItemGroup as ItemGroup, AttachmentInputRoot as Root, type AttachmentInputContainerProps as ContainerProps, type AttachmentInputHiddenInputProps as HiddenInputProps, type AttachmentInputItemGroupProps as ItemGroupProps, type AttachmentInputRootProps as RootProps, } from './AttachmentInput';
|
|
2
|
+
export { AttachmentInputContext as Context, type AttachmentInputContextProps as ContextProps, } from './AttachmentInput';
|
|
3
|
+
export { AttachmentInputDropzone as Dropzone, AttachmentInputDropzoneLabel as DropzoneLabel, type AttachmentInputDropzoneLabelProps as DropzoneLabelProps, type AttachmentInputDropzoneProps as DropzoneProps, } from './AttachmentInputDropzone';
|
|
4
|
+
export { AttachmentInputItem as Item, AttachmentInputItemActionButton as ItemActionButton, AttachmentInputItemBackdrop as ItemBackdrop, AttachmentInputItemBadge as ItemBadge, AttachmentInputItemImage as ItemImage, AttachmentInputItemMetadata as ItemMetadata, AttachmentInputItemName as ItemName, AttachmentInputItemRemoveButton as ItemRemoveButton, AttachmentInputItemSize as ItemSizeText, AttachmentInputItemThumbnail as ItemThumbnail, type AttachmentInputItemActionButtonProps as ItemActionButtonProps, type AttachmentInputItemBackdropProps as ItemBackdropProps, type AttachmentInputItemBadgeProps as ItemBadgeProps, type AttachmentInputItemImageProps as ItemImageProps, type AttachmentInputItemMetadataProps as ItemMetadataProps, type AttachmentInputItemNameProps as ItemNameProps, type AttachmentInputItemProps as ItemProps, type AttachmentInputItemRemoveButtonProps as ItemRemoveButtonProps, type AttachmentInputItemSizeProps as ItemSizeTextProps, type AttachmentInputItemThumbnailProps as ItemThumbnailProps, } from './AttachmentInputItem';
|
|
5
|
+
export { AttachmentInputTrigger as Trigger, AttachmentInputTriggerIcon as TriggerIcon, AttachmentInputTriggerItemCount as TriggerItemCount, type AttachmentInputTriggerIconProps as TriggerIconProps, type AttachmentInputTriggerItemCountProps as TriggerItemCountProps, type AttachmentInputTriggerProps as TriggerProps, } from './AttachmentInputTrigger';
|
|
6
|
+
//# sourceMappingURL=AttachmentInput.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentInput.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentInput/AttachmentInput.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,IAAI,SAAS,EACrC,0BAA0B,IAAI,WAAW,EACzC,wBAAwB,IAAI,SAAS,EACrC,mBAAmB,IAAI,IAAI,EAC3B,KAAK,6BAA6B,IAAI,cAAc,EACpD,KAAK,+BAA+B,IAAI,gBAAgB,EACxD,KAAK,6BAA6B,IAAI,cAAc,EACpD,KAAK,wBAAwB,IAAI,SAAS,GAC3C,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,sBAAsB,IAAI,OAAO,EACjC,KAAK,2BAA2B,IAAI,YAAY,GACjD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,uBAAuB,IAAI,QAAQ,EACnC,4BAA4B,IAAI,aAAa,EAC7C,KAAK,iCAAiC,IAAI,kBAAkB,EAC5D,KAAK,4BAA4B,IAAI,aAAa,GACnD,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,mBAAmB,IAAI,IAAI,EAC3B,+BAA+B,IAAI,gBAAgB,EACnD,2BAA2B,IAAI,YAAY,EAC3C,wBAAwB,IAAI,SAAS,EACrC,wBAAwB,IAAI,SAAS,EACrC,2BAA2B,IAAI,YAAY,EAC3C,uBAAuB,IAAI,QAAQ,EACnC,+BAA+B,IAAI,gBAAgB,EACnD,uBAAuB,IAAI,YAAY,EACvC,4BAA4B,IAAI,aAAa,EAC7C,KAAK,oCAAoC,IAAI,qBAAqB,EAClE,KAAK,gCAAgC,IAAI,iBAAiB,EAC1D,KAAK,6BAA6B,IAAI,cAAc,EACpD,KAAK,6BAA6B,IAAI,cAAc,EACpD,KAAK,gCAAgC,IAAI,iBAAiB,EAC1D,KAAK,4BAA4B,IAAI,aAAa,EAClD,KAAK,wBAAwB,IAAI,SAAS,EAC1C,KAAK,oCAAoC,IAAI,qBAAqB,EAClE,KAAK,4BAA4B,IAAI,iBAAiB,EACtD,KAAK,iCAAiC,IAAI,kBAAkB,GAC7D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,sBAAsB,IAAI,OAAO,EACjC,0BAA0B,IAAI,WAAW,EACzC,+BAA+B,IAAI,gBAAgB,EACnD,KAAK,+BAA+B,IAAI,gBAAgB,EACxD,KAAK,oCAAoC,IAAI,qBAAqB,EAClE,KAAK,2BAA2B,IAAI,YAAY,GACjD,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AttachmentInputContainer as Container, AttachmentInputContext as Context, AttachmentInputHiddenInput as HiddenInput, AttachmentInputItemGroup as ItemGroup, AttachmentInputRoot as Root } from './AttachmentInput.js';
|
|
2
|
+
export { AttachmentInputDropzone as Dropzone, AttachmentInputDropzoneLabel as DropzoneLabel } from './AttachmentInputDropzone.js';
|
|
3
|
+
export { AttachmentInputItem as Item, AttachmentInputItemActionButton as ItemActionButton, AttachmentInputItemBackdrop as ItemBackdrop, AttachmentInputItemBadge as ItemBadge, AttachmentInputItemImage as ItemImage, AttachmentInputItemMetadata as ItemMetadata, AttachmentInputItemName as ItemName, AttachmentInputItemRemoveButton as ItemRemoveButton, AttachmentInputItemSize as ItemSizeText, AttachmentInputItemThumbnail as ItemThumbnail } from './AttachmentInputItem.js';
|
|
4
|
+
export { AttachmentInputTrigger as Trigger, AttachmentInputTriggerIcon as TriggerIcon, AttachmentInputTriggerItemCount as TriggerItemCount } from './AttachmentInputTrigger.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentInput.test.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentInput/AttachmentInput.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const reactFileUpload = require('@seed-design/react-file-upload');
|
|
7
|
+
const reactPrimitive = require('@seed-design/react-primitive');
|
|
8
|
+
const AttachmentInput = require('./AttachmentInput.cjs');
|
|
9
|
+
|
|
10
|
+
const AttachmentInputDropzone = AttachmentInput.withContext(
|
|
11
|
+
reactFileUpload.FileUpload.Dropzone,
|
|
12
|
+
"dropzone"
|
|
13
|
+
);
|
|
14
|
+
const AttachmentInputDropzoneLabel = AttachmentInput.withContext(reactPrimitive.Primitive.div, "dropzoneLabel");
|
|
15
|
+
|
|
16
|
+
exports.AttachmentInputDropzone = AttachmentInputDropzone;
|
|
17
|
+
exports.AttachmentInputDropzoneLabel = AttachmentInputDropzoneLabel;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PrimitiveProps } from '@seed-design/react-primitive';
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
export interface AttachmentInputDropzoneProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
}
|
|
5
|
+
export declare const AttachmentInputDropzone: React.ForwardRefExoticComponent<AttachmentInputDropzoneProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export interface AttachmentInputDropzoneLabelProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
}
|
|
8
|
+
export declare const AttachmentInputDropzoneLabel: React.ForwardRefExoticComponent<AttachmentInputDropzoneLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//# sourceMappingURL=AttachmentInputDropzone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentInputDropzone.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentInput/AttachmentInputDropzone.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAGpC,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9E,MAAM,WAAW,4BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,uBAAuB,qGAGnC,CAAC;AAEF,MAAM,WAAW,iCACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,4BAA4B,0GAGR,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { FileUpload } from '@seed-design/react-file-upload';
|
|
3
|
+
import { Primitive } from '@seed-design/react-primitive';
|
|
4
|
+
import { withContext } from './AttachmentInput.js';
|
|
5
|
+
|
|
6
|
+
const AttachmentInputDropzone = withContext(
|
|
7
|
+
FileUpload.Dropzone,
|
|
8
|
+
"dropzone"
|
|
9
|
+
);
|
|
10
|
+
const AttachmentInputDropzoneLabel = withContext(Primitive.div, "dropzoneLabel");
|
|
11
|
+
|
|
12
|
+
export { AttachmentInputDropzone, AttachmentInputDropzoneLabel };
|
|
@@ -0,0 +1,100 @@
|
|
|
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 = require('react');
|
|
8
|
+
const attachmentInputItem = require('@seed-design/css/recipes/attachment-input-item');
|
|
9
|
+
const reactFileUpload = require('@seed-design/react-file-upload');
|
|
10
|
+
const reactMiddleTruncate = require('@seed-design/react-middle-truncate');
|
|
11
|
+
const reactPrimitive = require('@seed-design/react-primitive');
|
|
12
|
+
const clsx = require('clsx');
|
|
13
|
+
const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
|
|
14
|
+
|
|
15
|
+
function _interopNamespaceDefault(e) {
|
|
16
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
17
|
+
if (e) {
|
|
18
|
+
for (const k in e) {
|
|
19
|
+
if (k !== 'default') {
|
|
20
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
21
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: () => e[k]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
n.default = e;
|
|
29
|
+
return Object.freeze(n);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
33
|
+
|
|
34
|
+
const { useClassNames, ClassNamesProvider, withContext } = createSlotRecipeContext.createSlotRecipeContext(attachmentInputItem.attachmentInputItem);
|
|
35
|
+
const AttachmentInputItem = React__namespace.forwardRef(
|
|
36
|
+
({ className, fileEntry, ...props }, ref) => {
|
|
37
|
+
const { acceptType } = reactFileUpload.useFileUploadContext();
|
|
38
|
+
const api = reactFileUpload.useFileUploadItem(fileEntry);
|
|
39
|
+
const [variantProps, otherProps] = attachmentInputItem.attachmentInputItem.splitVariantProps({
|
|
40
|
+
type: acceptType,
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
const classNames = attachmentInputItem.attachmentInputItem(variantProps);
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsxRuntime.jsx(reactFileUpload.FileUploadItemProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(reactPrimitive.Primitive.li, { ref, className: clsx(classNames.root, className), ...otherProps }) }) });
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
AttachmentInputItem.displayName = "AttachmentInputItem";
|
|
48
|
+
const AttachmentInputItemName = React__namespace.forwardRef(({ className, children, ...props }, ref) => {
|
|
49
|
+
const classNames = useClassNames();
|
|
50
|
+
const { file } = reactFileUpload.useFileUploadItemContext();
|
|
51
|
+
const { extension } = reactFileUpload.splitFileName(file.name);
|
|
52
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactFileUpload.FileUpload.ItemName, { ref, className: clsx(classNames.name, className), ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsx(reactMiddleTruncate.MiddleTruncate, { maxLines: 2, ...{ end: extension.length }, children: file.name }) });
|
|
53
|
+
});
|
|
54
|
+
AttachmentInputItemName.displayName = "AttachmentInputItemName";
|
|
55
|
+
const AttachmentInputItemSize = React__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
56
|
+
const classNames = useClassNames();
|
|
57
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
+
reactFileUpload.FileUpload.ItemSize,
|
|
59
|
+
{
|
|
60
|
+
ref,
|
|
61
|
+
className: clsx(classNames.size, className),
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
AttachmentInputItemSize.displayName = "AttachmentInputItemSize";
|
|
67
|
+
const AttachmentInputItemRemoveButton = withContext(reactFileUpload.FileUpload.ItemRemoveButton, "removeButton");
|
|
68
|
+
const AttachmentInputItemImage = withContext(reactFileUpload.FileUpload.ItemImage, "image");
|
|
69
|
+
const AttachmentInputItemThumbnail = withContext(reactFileUpload.FileUpload.ItemThumbnail, "thumbnail");
|
|
70
|
+
const AttachmentInputItemBadge = withContext(
|
|
71
|
+
reactPrimitive.Primitive.div,
|
|
72
|
+
"badge"
|
|
73
|
+
);
|
|
74
|
+
AttachmentInputItemBadge.displayName = "AttachmentInputItemBadge";
|
|
75
|
+
const AttachmentInputItemActionButton = React__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
76
|
+
const classNames = useClassNames();
|
|
77
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
reactPrimitive.Primitive.button,
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
ref,
|
|
82
|
+
className: clsx(classNames.actionButton, className),
|
|
83
|
+
...props
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
AttachmentInputItemActionButton.displayName = "AttachmentInputItemActionButton";
|
|
88
|
+
const AttachmentInputItemBackdrop = withContext(reactFileUpload.FileUpload.ItemBackdrop, "backdrop");
|
|
89
|
+
const AttachmentInputItemMetadata = withContext(reactFileUpload.FileUpload.ItemMetadata, "metadata");
|
|
90
|
+
|
|
91
|
+
exports.AttachmentInputItem = AttachmentInputItem;
|
|
92
|
+
exports.AttachmentInputItemActionButton = AttachmentInputItemActionButton;
|
|
93
|
+
exports.AttachmentInputItemBackdrop = AttachmentInputItemBackdrop;
|
|
94
|
+
exports.AttachmentInputItemBadge = AttachmentInputItemBadge;
|
|
95
|
+
exports.AttachmentInputItemImage = AttachmentInputItemImage;
|
|
96
|
+
exports.AttachmentInputItemMetadata = AttachmentInputItemMetadata;
|
|
97
|
+
exports.AttachmentInputItemName = AttachmentInputItemName;
|
|
98
|
+
exports.AttachmentInputItemRemoveButton = AttachmentInputItemRemoveButton;
|
|
99
|
+
exports.AttachmentInputItemSize = AttachmentInputItemSize;
|
|
100
|
+
exports.AttachmentInputItemThumbnail = AttachmentInputItemThumbnail;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AttachmentInputItemVariantProps } from '@seed-design/css/recipes/attachment-input-item';
|
|
2
|
+
import { FileUpload as FileUploadPrimitive, FileEntry } from '@seed-design/react-file-upload';
|
|
3
|
+
import { PrimitiveProps } from '@seed-design/react-primitive';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export interface AttachmentInputItemProps extends AttachmentInputItemVariantProps, PrimitiveProps, React.LiHTMLAttributes<HTMLLIElement> {
|
|
6
|
+
fileEntry: FileEntry;
|
|
7
|
+
}
|
|
8
|
+
export declare const AttachmentInputItem: React.ForwardRefExoticComponent<AttachmentInputItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
9
|
+
export interface AttachmentInputItemNameProps extends PrimitiveProps, FileUploadPrimitive.ItemNameProps {
|
|
10
|
+
}
|
|
11
|
+
export declare const AttachmentInputItemName: React.ForwardRefExoticComponent<AttachmentInputItemNameProps & React.RefAttributes<HTMLSpanElement>>;
|
|
12
|
+
export interface AttachmentInputItemSizeProps extends FileUploadPrimitive.ItemSizeProps {
|
|
13
|
+
}
|
|
14
|
+
export declare const AttachmentInputItemSize: React.ForwardRefExoticComponent<AttachmentInputItemSizeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
15
|
+
export interface AttachmentInputItemRemoveButtonProps extends FileUploadPrimitive.ItemRemoveButtonProps {
|
|
16
|
+
}
|
|
17
|
+
export declare const AttachmentInputItemRemoveButton: React.ForwardRefExoticComponent<AttachmentInputItemRemoveButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export interface AttachmentInputItemImageProps extends FileUploadPrimitive.ItemImageProps {
|
|
19
|
+
}
|
|
20
|
+
export declare const AttachmentInputItemImage: React.ForwardRefExoticComponent<AttachmentInputItemImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
21
|
+
export interface AttachmentInputItemThumbnailProps extends FileUploadPrimitive.ItemThumbnailProps {
|
|
22
|
+
}
|
|
23
|
+
export declare const AttachmentInputItemThumbnail: React.ForwardRefExoticComponent<AttachmentInputItemThumbnailProps & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export interface AttachmentInputItemBadgeProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
|
|
25
|
+
}
|
|
26
|
+
export declare const AttachmentInputItemBadge: React.ForwardRefExoticComponent<AttachmentInputItemBadgeProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export interface AttachmentInputItemActionButtonProps extends PrimitiveProps, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
28
|
+
}
|
|
29
|
+
export declare const AttachmentInputItemActionButton: React.ForwardRefExoticComponent<AttachmentInputItemActionButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
export interface AttachmentInputItemBackdropProps extends FileUploadPrimitive.ItemBackdropProps {
|
|
31
|
+
}
|
|
32
|
+
export declare const AttachmentInputItemBackdrop: React.ForwardRefExoticComponent<AttachmentInputItemBackdropProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export interface AttachmentInputItemMetadataProps extends FileUploadPrimitive.ItemMetadataProps {
|
|
34
|
+
}
|
|
35
|
+
export declare const AttachmentInputItemMetadata: React.ForwardRefExoticComponent<AttachmentInputItemMetadataProps & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
//# sourceMappingURL=AttachmentInputItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentInputItem.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentInput/AttachmentInputItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,UAAU,IAAI,mBAAmB,EAKjC,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAO9E,MAAM,WAAW,wBACf,SAAQ,+BAA+B,EACrC,cAAc,EACd,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC;IACvC,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,gGAoB/B,CAAC;AAKF,MAAM,WAAW,4BACf,SAAQ,cAAc,EACpB,mBAAmB,CAAC,aAAa;CAAG;AAExC,eAAO,MAAM,uBAAuB,sGAiBlC,CAAC;AAKH,MAAM,WAAW,4BAA6B,SAAQ,mBAAmB,CAAC,aAAa;CAAG;AAE1F,eAAO,MAAM,uBAAuB,sGAalC,CAAC;AAKH,MAAM,WAAW,oCACf,SAAQ,mBAAmB,CAAC,qBAAqB;CAAG;AAEtD,eAAO,MAAM,+BAA+B,gHAGW,CAAC;AAExD,MAAM,WAAW,6BAA8B,SAAQ,mBAAmB,CAAC,cAAc;CAAG;AAE5F,eAAO,MAAM,wBAAwB,wGAGI,CAAC;AAE1C,MAAM,WAAW,iCAAkC,SAAQ,mBAAmB,CAAC,kBAAkB;CAAG;AAGpG,eAAO,MAAM,4BAA4B,0GAGQ,CAAC;AAIlD,MAAM,WAAW,6BACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,wBAAwB,sGAGpC,CAAC;AAKF,MAAM,WAAW,oCACf,SAAQ,cAAc,EACpB,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAEpD,eAAO,MAAM,+BAA+B,gHAc1C,CAAC;AAKH,MAAM,WAAW,gCAAiC,SAAQ,mBAAmB,CAAC,iBAAiB;CAAG;AAElG,eAAO,MAAM,2BAA2B,yGAGO,CAAC;AAIhD,MAAM,WAAW,gCAAiC,SAAQ,mBAAmB,CAAC,iBAAiB;CAAG;AAElG,eAAO,MAAM,2BAA2B,yGAGO,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { attachmentInputItem } from '@seed-design/css/recipes/attachment-input-item';
|
|
5
|
+
import { useFileUploadContext, useFileUploadItem, FileUploadItemProvider, FileUpload, useFileUploadItemContext, splitFileName } from '@seed-design/react-file-upload';
|
|
6
|
+
import { MiddleTruncate } from '@seed-design/react-middle-truncate';
|
|
7
|
+
import { Primitive } from '@seed-design/react-primitive';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
|
|
10
|
+
|
|
11
|
+
const { useClassNames, ClassNamesProvider, withContext } = createSlotRecipeContext(attachmentInputItem);
|
|
12
|
+
const AttachmentInputItem = React.forwardRef(
|
|
13
|
+
({ className, fileEntry, ...props }, ref) => {
|
|
14
|
+
const { acceptType } = useFileUploadContext();
|
|
15
|
+
const api = useFileUploadItem(fileEntry);
|
|
16
|
+
const [variantProps, otherProps] = attachmentInputItem.splitVariantProps({
|
|
17
|
+
type: acceptType,
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
const classNames = attachmentInputItem(variantProps);
|
|
21
|
+
return /* @__PURE__ */ jsx(ClassNamesProvider, { value: classNames, children: /* @__PURE__ */ jsx(FileUploadItemProvider, { value: api, children: /* @__PURE__ */ jsx(Primitive.li, { ref, className: clsx(classNames.root, className), ...otherProps }) }) });
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
AttachmentInputItem.displayName = "AttachmentInputItem";
|
|
25
|
+
const AttachmentInputItemName = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
26
|
+
const classNames = useClassNames();
|
|
27
|
+
const { file } = useFileUploadItemContext();
|
|
28
|
+
const { extension } = splitFileName(file.name);
|
|
29
|
+
return /* @__PURE__ */ jsx(FileUpload.ItemName, { ref, className: clsx(classNames.name, className), ...props, children: children ?? /* @__PURE__ */ jsx(MiddleTruncate, { maxLines: 2, ...{ end: extension.length }, children: file.name }) });
|
|
30
|
+
});
|
|
31
|
+
AttachmentInputItemName.displayName = "AttachmentInputItemName";
|
|
32
|
+
const AttachmentInputItemSize = React.forwardRef(({ className, ...props }, ref) => {
|
|
33
|
+
const classNames = useClassNames();
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
FileUpload.ItemSize,
|
|
36
|
+
{
|
|
37
|
+
ref,
|
|
38
|
+
className: clsx(classNames.size, className),
|
|
39
|
+
...props
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
AttachmentInputItemSize.displayName = "AttachmentInputItemSize";
|
|
44
|
+
const AttachmentInputItemRemoveButton = withContext(FileUpload.ItemRemoveButton, "removeButton");
|
|
45
|
+
const AttachmentInputItemImage = withContext(FileUpload.ItemImage, "image");
|
|
46
|
+
const AttachmentInputItemThumbnail = withContext(FileUpload.ItemThumbnail, "thumbnail");
|
|
47
|
+
const AttachmentInputItemBadge = withContext(
|
|
48
|
+
Primitive.div,
|
|
49
|
+
"badge"
|
|
50
|
+
);
|
|
51
|
+
AttachmentInputItemBadge.displayName = "AttachmentInputItemBadge";
|
|
52
|
+
const AttachmentInputItemActionButton = React.forwardRef(({ className, ...props }, ref) => {
|
|
53
|
+
const classNames = useClassNames();
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
Primitive.button,
|
|
56
|
+
{
|
|
57
|
+
type: "button",
|
|
58
|
+
ref,
|
|
59
|
+
className: clsx(classNames.actionButton, className),
|
|
60
|
+
...props
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
AttachmentInputItemActionButton.displayName = "AttachmentInputItemActionButton";
|
|
65
|
+
const AttachmentInputItemBackdrop = withContext(FileUpload.ItemBackdrop, "backdrop");
|
|
66
|
+
const AttachmentInputItemMetadata = withContext(FileUpload.ItemMetadata, "metadata");
|
|
67
|
+
|
|
68
|
+
export { AttachmentInputItem, AttachmentInputItemActionButton, AttachmentInputItemBackdrop, AttachmentInputItemBadge, AttachmentInputItemImage, AttachmentInputItemMetadata, AttachmentInputItemName, AttachmentInputItemRemoveButton, AttachmentInputItemSize, AttachmentInputItemThumbnail };
|
|
@@ -0,0 +1,75 @@
|
|
|
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 = require('react');
|
|
8
|
+
const attachmentInputTrigger = require('@seed-design/css/recipes/attachment-input-trigger');
|
|
9
|
+
const reactFileUpload = require('@seed-design/react-file-upload');
|
|
10
|
+
const reactPrimitive = require('@seed-design/react-primitive');
|
|
11
|
+
const domUtils = require('@seed-design/dom-utils');
|
|
12
|
+
const clsx = require('clsx');
|
|
13
|
+
const Icon = require('../private/Icon.cjs');
|
|
14
|
+
const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
|
|
15
|
+
|
|
16
|
+
function _interopNamespaceDefault(e) {
|
|
17
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
18
|
+
if (e) {
|
|
19
|
+
for (const k in e) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: () => e[k]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
34
|
+
|
|
35
|
+
const { withProvider, useClassNames } = createSlotRecipeContext.createSlotRecipeContext(attachmentInputTrigger.attachmentInputTrigger);
|
|
36
|
+
const AttachmentInputTrigger = withProvider(
|
|
37
|
+
reactFileUpload.FileUpload.Trigger,
|
|
38
|
+
"root"
|
|
39
|
+
);
|
|
40
|
+
const AttachmentInputTriggerIcon = React__namespace.forwardRef(({ image, general, ...props }, ref) => {
|
|
41
|
+
const { acceptType, stateProps } = reactFileUpload.useFileUploadContext();
|
|
42
|
+
const classNames = useClassNames();
|
|
43
|
+
const mergedProps = domUtils.mergeProps(
|
|
44
|
+
stateProps,
|
|
45
|
+
{ className: classNames.icon },
|
|
46
|
+
props
|
|
47
|
+
);
|
|
48
|
+
if (acceptType === "image" && image) {
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.InternalIcon, { svg: image, ref, ...mergedProps });
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon.InternalIcon, { svg: general, ref, ...mergedProps });
|
|
52
|
+
});
|
|
53
|
+
const AttachmentInputTriggerItemCount = React__namespace.forwardRef(({ className, ...otherProps }, ref) => {
|
|
54
|
+
const classNames = useClassNames();
|
|
55
|
+
const { currentFileEntryCount, maxFiles, stateProps } = reactFileUpload.useFileUploadContext();
|
|
56
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactPrimitive.Primitive.div, { className: clsx(classNames.itemCountArea, className), ref, ...otherProps, children: [
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
...currentFileEntryCount === 0 && { "data-empty": true },
|
|
61
|
+
className: classNames.itemCount,
|
|
62
|
+
...stateProps,
|
|
63
|
+
children: currentFileEntryCount
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: classNames.maxItemCount, ...stateProps, children: [
|
|
67
|
+
"/",
|
|
68
|
+
maxFiles
|
|
69
|
+
] })
|
|
70
|
+
] });
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
exports.AttachmentInputTrigger = AttachmentInputTrigger;
|
|
74
|
+
exports.AttachmentInputTriggerIcon = AttachmentInputTriggerIcon;
|
|
75
|
+
exports.AttachmentInputTriggerItemCount = AttachmentInputTriggerItemCount;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AttachmentInputTriggerVariantProps } from '@seed-design/css/recipes/attachment-input-trigger';
|
|
2
|
+
import { FileAcceptType } from '@seed-design/react-file-upload';
|
|
3
|
+
import { PrimitiveProps } from '@seed-design/react-primitive';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
export interface AttachmentInputTriggerProps extends AttachmentInputTriggerVariantProps, PrimitiveProps, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
}
|
|
7
|
+
export declare const AttachmentInputTrigger: React.ForwardRefExoticComponent<AttachmentInputTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export type AttachmentInputTriggerIconProps = React.SVGAttributes<SVGElement> & {
|
|
9
|
+
[K in NonNullable<FileAcceptType>]?: React.ReactNode;
|
|
10
|
+
} & {
|
|
11
|
+
general: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare const AttachmentInputTriggerIcon: React.ForwardRefExoticComponent<React.SVGAttributes<SVGElement> & {
|
|
14
|
+
image?: React.ReactNode;
|
|
15
|
+
} & {
|
|
16
|
+
general: React.ReactNode;
|
|
17
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
|
18
|
+
export interface AttachmentInputTriggerItemCountProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {
|
|
19
|
+
}
|
|
20
|
+
export declare const AttachmentInputTriggerItemCount: React.ForwardRefExoticComponent<AttachmentInputTriggerItemCountProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
//# sourceMappingURL=AttachmentInputTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentInputTrigger.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentInput/AttachmentInputTrigger.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQ9E,MAAM,WAAW,2BACf,SAAQ,kCAAkC,EACxC,cAAc,EACd,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAEpD,eAAO,MAAM,sBAAsB,uGAGlC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG;KAC7E,CAAC,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS;CACrD,GAAG;IACF,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;aAH5B,KAAK,CAAC,SAAS;uCAuBxB,CAAC;AAEH,MAAM,WAAW,oCACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3C,eAAO,MAAM,+BAA+B,6GAqB1C,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { attachmentInputTrigger } from '@seed-design/css/recipes/attachment-input-trigger';
|
|
5
|
+
import { FileUpload, useFileUploadContext } from '@seed-design/react-file-upload';
|
|
6
|
+
import { Primitive } from '@seed-design/react-primitive';
|
|
7
|
+
import { mergeProps } from '@seed-design/dom-utils';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import { InternalIcon } from '../private/Icon.js';
|
|
10
|
+
import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
|
|
11
|
+
|
|
12
|
+
const { withProvider, useClassNames } = createSlotRecipeContext(attachmentInputTrigger);
|
|
13
|
+
const AttachmentInputTrigger = withProvider(
|
|
14
|
+
FileUpload.Trigger,
|
|
15
|
+
"root"
|
|
16
|
+
);
|
|
17
|
+
const AttachmentInputTriggerIcon = React.forwardRef(({ image, general, ...props }, ref) => {
|
|
18
|
+
const { acceptType, stateProps } = useFileUploadContext();
|
|
19
|
+
const classNames = useClassNames();
|
|
20
|
+
const mergedProps = mergeProps(
|
|
21
|
+
stateProps,
|
|
22
|
+
{ className: classNames.icon },
|
|
23
|
+
props
|
|
24
|
+
);
|
|
25
|
+
if (acceptType === "image" && image) {
|
|
26
|
+
return /* @__PURE__ */ jsx(InternalIcon, { svg: image, ref, ...mergedProps });
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(InternalIcon, { svg: general, ref, ...mergedProps });
|
|
29
|
+
});
|
|
30
|
+
const AttachmentInputTriggerItemCount = React.forwardRef(({ className, ...otherProps }, ref) => {
|
|
31
|
+
const classNames = useClassNames();
|
|
32
|
+
const { currentFileEntryCount, maxFiles, stateProps } = useFileUploadContext();
|
|
33
|
+
return /* @__PURE__ */ jsxs(Primitive.div, { className: clsx(classNames.itemCountArea, className), ref, ...otherProps, children: [
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
...currentFileEntryCount === 0 && { "data-empty": true },
|
|
38
|
+
className: classNames.itemCount,
|
|
39
|
+
...stateProps,
|
|
40
|
+
children: currentFileEntryCount
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsxs("span", { className: classNames.maxItemCount, ...stateProps, children: [
|
|
44
|
+
"/",
|
|
45
|
+
maxFiles
|
|
46
|
+
] })
|
|
47
|
+
] });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export { AttachmentInputTrigger, AttachmentInputTriggerIcon, AttachmentInputTriggerItemCount };
|