@payfit/unity-components 3.15.14 → 3.15.16

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.
Files changed (41) hide show
  1. package/dist/esm/core/components/dropzone/Dropzone.context.d.ts +6 -0
  2. package/dist/esm/core/components/dropzone/Dropzone.context.js +10 -0
  3. package/dist/esm/core/components/dropzone/Dropzone.d.ts +82 -0
  4. package/dist/esm/core/components/dropzone/Dropzone.js +32 -0
  5. package/dist/esm/core/components/dropzone/Dropzone.variants.d.ts +24 -0
  6. package/dist/esm/core/components/dropzone/Dropzone.variants.js +23 -0
  7. package/dist/esm/core/components/dropzone/DropzoneOverlay.d.ts +67 -0
  8. package/dist/esm/core/components/dropzone/DropzoneOverlay.js +53 -0
  9. package/dist/esm/core/components/dropzone/parts/DropzoneActions.d.ts +13 -0
  10. package/dist/esm/core/components/dropzone/parts/DropzoneActions.js +13 -0
  11. package/dist/esm/core/components/dropzone/parts/DropzoneContent.d.ts +13 -0
  12. package/dist/esm/core/components/dropzone/parts/DropzoneContent.js +13 -0
  13. package/dist/esm/core/components/dropzone/parts/DropzoneDescription.d.ts +5 -0
  14. package/dist/esm/core/components/dropzone/parts/DropzoneDescription.js +21 -0
  15. package/dist/esm/core/components/dropzone/parts/DropzoneIcon.d.ts +5 -0
  16. package/dist/esm/core/components/dropzone/parts/DropzoneIcon.js +11 -0
  17. package/dist/esm/core/components/dropzone/parts/DropzoneIllustration.d.ts +5 -0
  18. package/dist/esm/core/components/dropzone/parts/DropzoneIllustration.js +14 -0
  19. package/dist/esm/core/components/dropzone/parts/DropzoneLabel.d.ts +5 -0
  20. package/dist/esm/core/components/dropzone/parts/DropzoneLabel.js +20 -0
  21. package/dist/esm/core/components/file-upload-dropzone/FileUploadDropzone.d.ts +51 -0
  22. package/dist/esm/core/components/file-upload-dropzone/FileUploadDropzone.js +46 -0
  23. package/dist/esm/core/components/file-upload-dropzone/parts/FileUploadDropzoneButton.d.ts +13 -0
  24. package/dist/esm/core/components/file-upload-dropzone/parts/FileUploadDropzoneButton.js +14 -0
  25. package/dist/esm/core/components/file-upload-trigger/FileUploadTrigger.d.ts +52 -0
  26. package/dist/esm/core/components/file-upload-trigger/FileUploadTrigger.js +19 -0
  27. package/dist/esm/core/index.d.ts +11 -0
  28. package/dist/esm/core/index.js +12 -1
  29. package/dist/esm/index.js +25 -14
  30. package/dist/esm/modules/tanstack-form/components/tanstack-file-upload-dropzone/TanstackFileUploadDropzone.d.ts +52 -0
  31. package/dist/esm/modules/tanstack-form/components/tanstack-file-upload-dropzone/TanstackFileUploadDropzone.js +26 -0
  32. package/dist/esm/modules/tanstack-form/components/tanstack-file-upload-dropzone/TanstackFileUploadDropzoneField.d.ts +68 -0
  33. package/dist/esm/modules/tanstack-form/components/tanstack-file-upload-dropzone/TanstackFileUploadDropzoneField.js +22 -0
  34. package/dist/esm/modules/tanstack-form/components/tanstack-file-upload-trigger/TanstackFileUploadTrigger.d.ts +48 -0
  35. package/dist/esm/modules/tanstack-form/components/tanstack-file-upload-trigger/TanstackFileUploadTrigger.js +26 -0
  36. package/dist/esm/modules/tanstack-form/components/tanstack-file-upload-trigger/TanstackFileUploadTriggerField.d.ts +13 -0
  37. package/dist/esm/modules/tanstack-form/components/tanstack-file-upload-trigger/TanstackFileUploadTriggerField.js +28 -0
  38. package/dist/esm/modules/tanstack-form/hooks/use-tanstack-form.d.ts +24 -0
  39. package/dist/esm/modules/tanstack-form/hooks/use-tanstack-form.js +29 -25
  40. package/package.json +7 -7
  41. package/src/agent-references/component-catalog.json +170 -0
@@ -0,0 +1,6 @@
1
+ export interface DropzoneContextValue {
2
+ descriptionId: string;
3
+ labelId: string;
4
+ }
5
+ export declare const DropzoneContextProvider: import('react').Provider<DropzoneContextValue | null>;
6
+ export declare function useDropzoneContext(): DropzoneContextValue;
@@ -0,0 +1,10 @@
1
+ import { createContext as e, useContext as t } from "react";
2
+ //#region src/core/components/dropzone/Dropzone.context.tsx
3
+ var n = e(null), r = n.Provider;
4
+ function i() {
5
+ let e = t(n);
6
+ if (!e) throw Error("Dropzone parts must be used within a Dropzone");
7
+ return e;
8
+ }
9
+ //#endregion
10
+ export { r as DropzoneContextProvider, i as useDropzoneContext };
@@ -0,0 +1,82 @@
1
+ import { DropZoneProps as AriaDropZoneProps } from 'react-aria-components';
2
+ export type DropzoneState = 'default' | 'disabled' | 'invalid' | 'valid';
3
+ export interface DropzoneProps extends Omit<AriaDropZoneProps, 'className' | 'isDisabled' | 'style'> {
4
+ /**
5
+ * Sets durable workflow feedback without replacing drag-and-drop interaction
6
+ * feedback.
7
+ * @default 'default'
8
+ * @remarks
9
+ * - `default` presents the normal target.
10
+ * - `disabled` prevents drops and communicates that the workflow is unavailable.
11
+ * - `invalid` communicates a form or validation problem.
12
+ * - `valid` communicates successful validation.
13
+ */
14
+ state?: DropzoneState;
15
+ /** Additional classes applied to the drop target. */
16
+ className?: string;
17
+ }
18
+ /**
19
+ * Gives people an accessible destination for content they move into a workflow.
20
+ *
21
+ * Dropzone accepts files, directories, text, and custom dragged data without
22
+ * prescribing transport or validation. Compose it with `DropzoneLabel` and
23
+ * `DropzoneDescription` so assistive technology can identify the target. Use
24
+ * `FileUploadDropzone` when the workflow also needs a native file picker.
25
+ * @param props - Drop behavior, Unity workflow state, and target content.
26
+ * @param props.children - The visual content or render function for the target.
27
+ * @param props.getDropOperation - Chooses the advertised `copy`, `move`, or `link` operation.
28
+ * @param props.onDrop - Receives the accepted drop event.
29
+ * @param props.state - Sets durable workflow feedback such as `invalid` or `valid`.
30
+ * @see {@link DropzoneProps} for all drop behavior.
31
+ * @see {@link DropzoneOverlay} for a target that appears over independent content.
32
+ * @example
33
+ * ```tsx
34
+ * import {
35
+ * Dropzone,
36
+ * DropzoneContent,
37
+ * DropzoneDescription,
38
+ * DropzoneIcon,
39
+ * DropzoneLabel,
40
+ * } from '@payfit/unity-components'
41
+ *
42
+ * export function TextDropzone() {
43
+ * return (
44
+ * <Dropzone
45
+ * getDropOperation={() => 'copy'}
46
+ * onDrop={async event => {
47
+ * const text = await event.items
48
+ * .filter(item => item.kind === 'text')
49
+ * .at(0)
50
+ * ?.getText('text/plain')
51
+ *
52
+ * if (text) {
53
+ * console.log(text)
54
+ * }
55
+ * }}
56
+ * >
57
+ * <DropzoneContent>
58
+ * <DropzoneIcon
59
+ * src="CloudArrowUpOutlined"
60
+ * size={24}
61
+ * role="presentation"
62
+ * />
63
+ * <DropzoneLabel>Drop a planning note</DropzoneLabel>
64
+ * <DropzoneDescription>
65
+ * The note is copied into the project plan.
66
+ * </DropzoneDescription>
67
+ * </DropzoneContent>
68
+ * </Dropzone>
69
+ * )
70
+ * }
71
+ * ```
72
+ * @remarks
73
+ * Dropzone reacts to hover, focus-visible, and drop-target interactions.
74
+ * Group its visual cue, label, and description in `DropzoneContent`; add a
75
+ * sibling `DropzoneActions` for picker buttons. Always give the target a
76
+ * `DropzoneLabel`; add `DropzoneDescription` when people need acceptance
77
+ * guidance. Pair a file workflow with
78
+ * `FileUploadTrigger` or `FileUploadDropzone` so keyboard users can select a
79
+ * file without dragging.
80
+ */
81
+ declare const Dropzone: import('react').ForwardRefExoticComponent<DropzoneProps & import('react').RefAttributes<HTMLDivElement>>;
82
+ export { Dropzone };
@@ -0,0 +1,32 @@
1
+ import { DropzoneContextProvider as e } from "./Dropzone.context.js";
2
+ import { dropzone as t } from "./Dropzone.variants.js";
3
+ import { forwardRef as n, useId as r } from "react";
4
+ import { jsx as i } from "react/jsx-runtime";
5
+ import { DropZone as a } from "react-aria-components";
6
+ //#region src/core/components/dropzone/Dropzone.tsx
7
+ var o = n(({ state: n = "default", className: o, "aria-describedby": s, "aria-labelledby": c, ...l }, u) => {
8
+ let d = r(), f = `unity-dropzone-${d}__label`, p = `unity-dropzone-${d}__description`, m = n === "disabled";
9
+ return /* @__PURE__ */ i(e, {
10
+ value: {
11
+ descriptionId: p,
12
+ labelId: f
13
+ },
14
+ children: /* @__PURE__ */ i(a, {
15
+ ...l,
16
+ ref: u,
17
+ isDisabled: m,
18
+ "aria-invalid": n === "invalid" || void 0,
19
+ "aria-describedby": [s, p].filter(Boolean).join(" ") || void 0,
20
+ "aria-labelledby": [c, f].filter(Boolean).join(" ") || void 0,
21
+ className: t({
22
+ state: n,
23
+ className: o
24
+ }),
25
+ "data-unity-slot": "dropzone",
26
+ "data-dropzone-state": n
27
+ })
28
+ });
29
+ });
30
+ o.displayName = "Dropzone";
31
+ //#endregion
32
+ export { o as Dropzone };
@@ -0,0 +1,24 @@
1
+ import { VariantProps } from '@payfit/unity-themes';
2
+ export declare const dropzone: import('tailwind-variants').TVReturnType<{
3
+ state: {
4
+ default: "uy:border-border-neutral-enabled uy:bg-surface-neutral-enabled";
5
+ disabled: "uy:border-border-neutral-disabled uy:bg-surface-neutral uy:text-content-neutral-disabled";
6
+ invalid: "uy:border-border-danger uy:bg-surface-danger-lowest-enabled";
7
+ valid: "uy:border-border-success uy:bg-surface-success-lowest";
8
+ };
9
+ }, undefined, string[], {
10
+ state: {
11
+ default: "uy:border-border-neutral-enabled uy:bg-surface-neutral-enabled";
12
+ disabled: "uy:border-border-neutral-disabled uy:bg-surface-neutral uy:text-content-neutral-disabled";
13
+ invalid: "uy:border-border-danger uy:bg-surface-danger-lowest-enabled";
14
+ valid: "uy:border-border-success uy:bg-surface-success-lowest";
15
+ };
16
+ }, undefined, import('tailwind-variants').TVReturnTypeLike<{
17
+ state: {
18
+ default: "uy:border-border-neutral-enabled uy:bg-surface-neutral-enabled";
19
+ disabled: "uy:border-border-neutral-disabled uy:bg-surface-neutral uy:text-content-neutral-disabled";
20
+ invalid: "uy:border-border-danger uy:bg-surface-danger-lowest-enabled";
21
+ valid: "uy:border-border-success uy:bg-surface-success-lowest";
22
+ };
23
+ }, undefined>>;
24
+ export type DropzoneVariants = VariantProps<typeof dropzone>;
@@ -0,0 +1,23 @@
1
+ import { uyTv as e } from "@payfit/unity-themes";
2
+ //#region src/core/components/dropzone/Dropzone.variants.ts
3
+ var t = e({
4
+ base: [
5
+ "uy:group uy:flex uy:flex-col uy:items-center uy:justify-center uy:gap-250",
6
+ "uy:rounded-300 uy:border uy:border-solid uy:p-400",
7
+ "uy:bg-surface-neutral-enabled uy:text-center uy:text-content-neutral",
8
+ "uy:transition-colors",
9
+ "uy:data-[hovered=\"true\"]:border-border-neutral-hover uy:data-[hovered=\"true\"]:bg-surface-neutral-hover",
10
+ "uy:data-[focus-visible=\"true\"]:outline-2 uy:data-[focus-visible=\"true\"]:outline-offset-2 uy:data-[focus-visible=\"true\"]:outline-utility-focus-ring",
11
+ "uy:data-[drop-target=\"true\"]:border-border-primary uy:data-[drop-target=\"true\"]:border-dashed uy:data-[drop-target=\"true\"]:bg-surface-primary-lowest-enabled",
12
+ "uy:data-[disabled=\"true\"]:cursor-not-allowed"
13
+ ],
14
+ variants: { state: {
15
+ default: "uy:border-border-neutral-enabled uy:bg-surface-neutral-enabled",
16
+ disabled: "uy:border-border-neutral-disabled uy:bg-surface-neutral uy:text-content-neutral-disabled",
17
+ invalid: "uy:border-border-danger uy:bg-surface-danger-lowest-enabled",
18
+ valid: "uy:border-border-success uy:bg-surface-success-lowest"
19
+ } },
20
+ defaultVariants: { state: "default" }
21
+ });
22
+ //#endregion
23
+ export { t as dropzone };
@@ -0,0 +1,67 @@
1
+ import { ReactNode } from 'react';
2
+ import { DropZoneProps as AriaDropZoneProps } from 'react-aria-components/DropZone';
3
+ export declare const dropzoneOverlay: import('tailwind-variants').TVReturnType<{
4
+ isDropTarget: {
5
+ true: {
6
+ content: string;
7
+ };
8
+ false: {
9
+ content: string;
10
+ };
11
+ };
12
+ }, {
13
+ base: string;
14
+ target: string;
15
+ content: string[];
16
+ }, undefined, {
17
+ isDropTarget: {
18
+ true: {
19
+ content: string;
20
+ };
21
+ false: {
22
+ content: string;
23
+ };
24
+ };
25
+ }, {
26
+ base: string;
27
+ target: string;
28
+ content: string[];
29
+ }, import('tailwind-variants').TVReturnTypeLike<{
30
+ isDropTarget: {
31
+ true: {
32
+ content: string;
33
+ };
34
+ false: {
35
+ content: string;
36
+ };
37
+ };
38
+ }, {
39
+ base: string;
40
+ target: string;
41
+ content: string[];
42
+ }>>;
43
+ export interface DropzoneOverlayProps extends Omit<AriaDropZoneProps, 'children' | 'style'> {
44
+ /** Content that remains visible beneath the full-surface drop target. */
45
+ children: ReactNode;
46
+ /** Dropzone parts rendered across the content while it is a drop target. */
47
+ overlay: ReactNode;
48
+ /** override class names */
49
+ className?: string;
50
+ }
51
+ /**
52
+ * Reveals a full-surface drop target over an established workspace or surface.
53
+ *
54
+ * Use DropzoneOverlay when a page needs to retain its normal content until a
55
+ * person drags compatible data over it. It places independently-rendered
56
+ * `children` below a Dropzone that becomes visible only during a drop target
57
+ * state.
58
+ * @param props - Dropzone behavior, underlying content, and overlay presentation.
59
+ * @param props.children - The content that remains visible before and after a drag.
60
+ * @see {@link DropzoneProps} for the forwarded drop props.
61
+ * @remarks
62
+ * DropzoneOverlay keeps `overlay` mounted so `DropzoneLabel` and
63
+ * `DropzoneDescription` continue to name and describe the target for
64
+ * assistive technology when the visual layer is transparent.
65
+ */
66
+ declare const DropzoneOverlay: import('react').ForwardRefExoticComponent<DropzoneOverlayProps & import('react').RefAttributes<HTMLDivElement>>;
67
+ export { DropzoneOverlay };
@@ -0,0 +1,53 @@
1
+ import { DropzoneContextProvider as e } from "./Dropzone.context.js";
2
+ import { DropzoneContent as t } from "./parts/DropzoneContent.js";
3
+ import { forwardRef as n } from "react";
4
+ import { uyTv as r } from "@payfit/unity-themes";
5
+ import { useId as i } from "react-aria";
6
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ import { DropZone as c } from "react-aria-components/DropZone";
8
+ //#region src/core/components/dropzone/DropzoneOverlay.tsx
9
+ var l = r({
10
+ slots: {
11
+ base: "uy:relative",
12
+ target: "uy:relative uy:block uy:rounded-none uy:border-0 uy:bg-transparent uy:p-0 uy:text-left",
13
+ content: [
14
+ "uy:pointer-events-none uy:absolute uy:inset-0 uy:flex uy:flex-col uy:items-center uy:justify-center",
15
+ "uy:rounded-300 uy:border uy:border-dashed uy:border-border-primary uy:bg-surface-primary-lowest-enabled uy:p-400",
16
+ "uy:text-center uy:transition-opacity uy:duration-150"
17
+ ]
18
+ },
19
+ variants: { isDropTarget: {
20
+ true: { content: "uy:opacity-100" },
21
+ false: { content: "uy:pointer-events-none uy:opacity-0" }
22
+ } },
23
+ defaultVariants: { isDropTarget: !1 }
24
+ }), u = n(({ children: n, overlay: r, "aria-describedby": u, "aria-labelledby": d, className: f, ...p }, m) => {
25
+ let h = i(), { base: g, target: _, content: v } = l(), y = `unity-dropzone-overlay-${h}__label`, b = `unity-dropzone-overlay-${h}__description`;
26
+ return /* @__PURE__ */ o("div", {
27
+ className: g(),
28
+ "data-unity-component": "DropzoneOverlay",
29
+ children: /* @__PURE__ */ o(e, {
30
+ value: {
31
+ descriptionId: b,
32
+ labelId: y
33
+ },
34
+ children: /* @__PURE__ */ o(c, {
35
+ ...p,
36
+ ref: m,
37
+ "aria-describedby": [u, b].filter(Boolean).join(" ") || void 0,
38
+ "aria-labelledby": [d, y].filter(Boolean).join(" ") || void 0,
39
+ className: _(),
40
+ children: ({ isDropTarget: e }) => /* @__PURE__ */ s(a, { children: [n, /* @__PURE__ */ o("div", {
41
+ className: v({
42
+ isDropTarget: e,
43
+ className: f
44
+ }),
45
+ children: /* @__PURE__ */ o(t, { children: r })
46
+ })] })
47
+ })
48
+ })
49
+ });
50
+ });
51
+ u.displayName = "DropzoneOverlay";
52
+ //#endregion
53
+ export { u as DropzoneOverlay, l as dropzoneOverlay };
@@ -0,0 +1,13 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ export type DropzoneActionsProps = ComponentPropsWithoutRef<'div'>;
3
+ /**
4
+ * Groups actions that complement a Dropzone's drag-and-drop interaction.
5
+ *
6
+ * Use DropzoneActions as a sibling of DropzoneContent for file-picker buttons
7
+ * or another way to add content. Dropzone supplies the 20px gap between the
8
+ * visual content and this action region.
9
+ * @param props - Action controls and native div attributes.
10
+ * @see {@link DropzoneContent} for the visual cue and descriptive text block.
11
+ */
12
+ declare const DropzoneActions: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
13
+ export { DropzoneActions };
@@ -0,0 +1,13 @@
1
+ import { forwardRef as e } from "react";
2
+ import { uyMerge as t } from "@payfit/unity-themes";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/core/components/dropzone/parts/DropzoneActions.tsx
5
+ var r = e(({ className: e, ...r }, i) => /* @__PURE__ */ n("div", {
6
+ ...r,
7
+ ref: i,
8
+ className: t("uy:flex uy:flex-wrap uy:items-center uy:justify-center uy:gap-100", e),
9
+ "data-unity-slot": "dropzone.actions"
10
+ }));
11
+ r.displayName = "DropzoneActions";
12
+ //#endregion
13
+ export { r as DropzoneActions };
@@ -0,0 +1,13 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ export type DropzoneContentProps = ComponentPropsWithoutRef<'div'>;
3
+ /**
4
+ * Groups a Dropzone's visual cue, label, and description.
5
+ *
6
+ * Use DropzoneContent as the first child of Dropzone. Its zero internal gap
7
+ * keeps the visual cue and supporting text as one cohesive content block;
8
+ * Dropzone adds the 20px separation before a sibling DropzoneActions section.
9
+ * @param props - Content and native div attributes for the visual block.
10
+ * @see {@link DropzoneActions} for file pickers and other secondary actions.
11
+ */
12
+ declare const DropzoneContent: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
13
+ export { DropzoneContent };
@@ -0,0 +1,13 @@
1
+ import { forwardRef as e } from "react";
2
+ import { uyMerge as t } from "@payfit/unity-themes";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/core/components/dropzone/parts/DropzoneContent.tsx
5
+ var r = e(({ className: e, ...r }, i) => /* @__PURE__ */ n("div", {
6
+ ...r,
7
+ ref: i,
8
+ className: t("uy:flex uy:flex-col uy:items-center uy:gap-0", e),
9
+ "data-unity-slot": "dropzone.content"
10
+ }));
11
+ r.displayName = "DropzoneContent";
12
+ //#endregion
13
+ export { r as DropzoneContent };
@@ -0,0 +1,5 @@
1
+ import { TextProps } from '../../text/Text.js';
2
+ export type DropzoneDescriptionProps = Pick<TextProps, 'asElement' | 'children' | 'variant'>;
3
+ /** Supplementary text for a Dropzone. */
4
+ declare const DropzoneDescription: import('react').ForwardRefExoticComponent<DropzoneDescriptionProps & import('react').RefAttributes<HTMLElement>>;
5
+ export { DropzoneDescription };
@@ -0,0 +1,21 @@
1
+ import { Text as e } from "../../text/Text.js";
2
+ import { useDropzoneContext as t } from "../Dropzone.context.js";
3
+ import { forwardRef as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region src/core/components/dropzone/parts/DropzoneDescription.tsx
6
+ var i = n(({ children: n, variant: i = "body", ...a }, o) => {
7
+ let { descriptionId: s } = t();
8
+ return /* @__PURE__ */ r(e, {
9
+ ...a,
10
+ ref: o,
11
+ id: s,
12
+ variant: i,
13
+ color: "content.neutral.low",
14
+ className: "uy:group-data-[disabled=true]:text-content-neutral-disabled",
15
+ "data-unity-slot": "dropzone.description",
16
+ children: n
17
+ });
18
+ });
19
+ i.displayName = "DropzoneDescription";
20
+ //#endregion
21
+ export { i as DropzoneDescription };
@@ -0,0 +1,5 @@
1
+ import { IconProps } from '@payfit/unity-icons';
2
+ export type DropzoneIconProps = IconProps;
3
+ /** Visual icon region for a Dropzone. */
4
+ declare const DropzoneIcon: ({ className, ...props }: DropzoneIconProps) => import('react/jsx-runtime').JSX.Element;
5
+ export { DropzoneIcon };
@@ -0,0 +1,11 @@
1
+ import { uyMerge as e } from "@payfit/unity-themes";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import { Icon as n } from "@payfit/unity-icons";
4
+ //#region src/core/components/dropzone/parts/DropzoneIcon.tsx
5
+ var r = ({ className: r, ...i }) => /* @__PURE__ */ t(n, {
6
+ ...i,
7
+ className: e("uy:flex uy:items-center uy:p-100 uy:text-content-neutral uy:group-data-[disabled=true]:text-content-neutral-disabled uy:group-data-[dropzone-state=valid]:text-content-success uy:group-data-[dropzone-state=invalid]:text-content-danger", r),
8
+ "data-unity-slot": "dropzone.icon"
9
+ });
10
+ //#endregion
11
+ export { r as DropzoneIcon };
@@ -0,0 +1,5 @@
1
+ import { LazyIllustrationProps } from '@payfit/unity-illustrations';
2
+ export type DropzoneIllustrationProps = LazyIllustrationProps;
3
+ /** Visual illustration region for a Dropzone. */
4
+ declare const DropzoneIllustration: import('react').ForwardRefExoticComponent<LazyIllustrationProps & import('react').RefAttributes<HTMLImageElement>>;
5
+ export { DropzoneIllustration };
@@ -0,0 +1,14 @@
1
+ import { forwardRef as e } from "react";
2
+ import { uyMerge as t } from "@payfit/unity-themes";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import { LazyIllustration as r } from "@payfit/unity-illustrations";
5
+ //#region src/core/components/dropzone/parts/DropzoneIllustration.tsx
6
+ var i = e(({ className: e, ...i }, a) => /* @__PURE__ */ n(r, {
7
+ ...i,
8
+ ref: a,
9
+ className: t("uy:h-auto uy:w-[clamp(100px,50%,160px)]", e),
10
+ "data-unity-slot": "dropzone.illustration"
11
+ }));
12
+ i.displayName = "DropzoneIllustration";
13
+ //#endregion
14
+ export { i as DropzoneIllustration };
@@ -0,0 +1,5 @@
1
+ import { TextProps } from '../../text/Text.js';
2
+ export type DropzoneLabelProps = Pick<TextProps, 'asElement' | 'children' | 'variant'>;
3
+ /** Primary, accessible text label for a Dropzone. */
4
+ declare const DropzoneLabel: import('react').ForwardRefExoticComponent<DropzoneLabelProps & import('react').RefAttributes<HTMLElement>>;
5
+ export { DropzoneLabel };
@@ -0,0 +1,20 @@
1
+ import { Text as e } from "../../text/Text.js";
2
+ import { useDropzoneContext as t } from "../Dropzone.context.js";
3
+ import { forwardRef as n } from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region src/core/components/dropzone/parts/DropzoneLabel.tsx
6
+ var i = n(({ children: n, variant: i = "bodyStrong", ...a }, o) => {
7
+ let { labelId: s } = t();
8
+ return /* @__PURE__ */ r(e, {
9
+ ...a,
10
+ ref: o,
11
+ id: s,
12
+ variant: i,
13
+ className: "uy:group-data-[disabled=true]:text-content-neutral-disabled",
14
+ "data-unity-slot": "dropzone.label",
15
+ children: n
16
+ });
17
+ });
18
+ i.displayName = "DropzoneLabel";
19
+ //#endregion
20
+ export { i as DropzoneLabel };
@@ -0,0 +1,51 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { DropZoneProps as AriaDropZoneProps, FileTriggerProps as AriaFileTriggerProps } from 'react-aria-components';
3
+ import { DropzoneProps } from '../dropzone/Dropzone.js';
4
+ export interface FileUploadDropzoneProps extends Omit<DropzoneProps, 'children' | 'onDrop'>, Pick<AriaFileTriggerProps, 'acceptDirectory' | 'acceptedFileTypes' | 'allowsMultiple' | 'defaultCamera' | 'onSelect'> {
5
+ /** Names the native picker input for browser form semantics. */
6
+ name?: string;
7
+ /** The visual dropzone content. */
8
+ children: ReactNode;
9
+ /** Receives the accepted file drop event. */
10
+ onDrop?: AriaDropZoneProps['onDrop'];
11
+ /**
12
+ * Replaces the default `FileUploadDropzoneButton` picker action.
13
+ *
14
+ * The supplied element must accept `isDisabled` so FileUploadDropzone can
15
+ * keep its picker unavailable while `state="disabled"`.
16
+ */
17
+ picker?: ReactElement<{
18
+ isDisabled?: boolean;
19
+ }>;
20
+ /** Whether the whole dropzone or only `picker` opens the file selector. */
21
+ pickerMode?: 'surface' | 'button';
22
+ }
23
+ /**
24
+ * Gives file workflows one destination for dropping files and choosing them.
25
+ *
26
+ * FileUploadDropzone combines Dropzone with FileUploadTrigger without owning
27
+ * selected files, validation, or upload transport. Use `pickerMode="surface"`
28
+ * when the whole target should open the picker; use the default `button` mode
29
+ * when people should choose files through a separate action.
30
+ * @param props - Dropzone content, file-selection options, and picker mode.
31
+ * @param props.children - The visual cue, label, and description for the target.
32
+ * @param props.acceptDirectory - Lets the native picker select a directory.
33
+ * @param props.acceptedFileTypes - Restricts files shown by the native picker.
34
+ * @param props.allowsMultiple - Lets the native picker select several files.
35
+ * @param props.defaultCamera - Selects the preferred device camera on supported devices.
36
+ * @param props.name - Names the native picker input for form submission.
37
+ * @param props.picker - Replaces the compact primary FileUploadDropzoneButton.
38
+ * @param props.pickerMode - Makes the full surface or only `picker` pressable.
39
+ * @param props.onSelect - Receives files selected through the native picker.
40
+ * @param props.onDrop - Receives files dropped on the target.
41
+ * @see {@link FileUploadDropzoneProps} for all supported file and drop options.
42
+ * @remarks
43
+ * The default picker receives the disabled state automatically. Custom
44
+ * `picker` elements also receive `isDisabled`; provide an alternative
45
+ * file-selection action whenever dragging is not available.
46
+ */
47
+ declare const FileUploadDropzone: {
48
+ ({ pickerMode, picker, children, acceptDirectory, acceptedFileTypes, allowsMultiple, defaultCamera, name, onSelect, ...dropzoneProps }: FileUploadDropzoneProps): import('react/jsx-runtime').JSX.Element;
49
+ displayName: string;
50
+ };
51
+ export { FileUploadDropzone };
@@ -0,0 +1,46 @@
1
+ import { Actionable as e } from "../actionable/Actionable.js";
2
+ import { Dropzone as t } from "../dropzone/Dropzone.js";
3
+ import { DropzoneContent as n } from "../dropzone/parts/DropzoneContent.js";
4
+ import { DropzoneActions as r } from "../dropzone/parts/DropzoneActions.js";
5
+ import { FileUploadTrigger as i } from "../file-upload-trigger/FileUploadTrigger.js";
6
+ import { FileUploadDropzoneButton as a } from "./parts/FileUploadDropzoneButton.js";
7
+ import { cloneElement as o } from "react";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
+ //#region src/core/components/file-upload-dropzone/FileUploadDropzone.tsx
10
+ var l = ({ pickerMode: l = "button", picker: u, children: d, acceptDirectory: f, acceptedFileTypes: p, allowsMultiple: m, defaultCamera: h, name: g, onSelect: _, ...v }) => {
11
+ let y = v.state === "disabled", b = {
12
+ acceptDirectory: f,
13
+ acceptedFileTypes: p,
14
+ allowsMultiple: m,
15
+ defaultCamera: h,
16
+ name: g,
17
+ onSelect: _
18
+ };
19
+ if (l === "surface") return /* @__PURE__ */ s(i, {
20
+ ...b,
21
+ children: /* @__PURE__ */ s(e, {
22
+ "aria-label": v["aria-label"],
23
+ "aria-labelledby": v["aria-labelledby"],
24
+ "aria-describedby": v["aria-describedby"],
25
+ "aria-invalid": v.state === "invalid" || void 0,
26
+ className: "uy:block uy:w-full",
27
+ "data-unity-slot": "file-upload-dropzone-surface-picker",
28
+ isDisabled: y,
29
+ children: /* @__PURE__ */ s(t, {
30
+ ...v,
31
+ children: /* @__PURE__ */ s(n, { children: d })
32
+ })
33
+ })
34
+ });
35
+ let x = u ? o(u, { isDisabled: y || u.props.isDisabled }) : /* @__PURE__ */ s(a, { isDisabled: y });
36
+ return /* @__PURE__ */ c(t, {
37
+ ...v,
38
+ children: [/* @__PURE__ */ s(n, { children: d }), /* @__PURE__ */ s(r, { children: /* @__PURE__ */ s(i, {
39
+ ...b,
40
+ children: x
41
+ }) })]
42
+ });
43
+ };
44
+ l.displayName = "FileUploadDropzone";
45
+ //#endregion
46
+ export { l as FileUploadDropzone };
@@ -0,0 +1,13 @@
1
+ import { ButtonProps } from '../../button/Button.js';
2
+ export type FileUploadDropzoneButtonProps = Omit<ButtonProps, 'mode' | 'variant'>;
3
+ /**
4
+ * Provides the default file-picker action for FileUploadDropzone.
5
+ *
6
+ * It uses a compact primary Button so file selection remains discoverable
7
+ * without competing with the dropzone's content. Pass a custom `picker` to
8
+ * FileUploadDropzone when the surrounding workflow needs another action.
9
+ * @param props - Button content and interaction props.
10
+ * @see {@link FileUploadDropzoneProps} for the composed dropzone API.
11
+ */
12
+ declare const FileUploadDropzoneButton: import('react').ForwardRefExoticComponent<FileUploadDropzoneButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
13
+ export { FileUploadDropzoneButton };
@@ -0,0 +1,14 @@
1
+ import { Button as e } from "../../button/Button.js";
2
+ import { forwardRef as t } from "react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/core/components/file-upload-dropzone/parts/FileUploadDropzoneButton.tsx
5
+ var r = t(({ children: t = "Choose files", ...r }, i) => /* @__PURE__ */ n(e, {
6
+ ...r,
7
+ ref: i,
8
+ mode: "compact",
9
+ variant: "primary",
10
+ children: t
11
+ }));
12
+ r.displayName = "FileUploadDropzoneButton";
13
+ //#endregion
14
+ export { r as FileUploadDropzoneButton };
@@ -0,0 +1,52 @@
1
+ import { FileTriggerProps as AriaFileTriggerProps } from 'react-aria-components';
2
+ export interface FileUploadTriggerProps extends Pick<AriaFileTriggerProps, 'acceptDirectory' | 'acceptedFileTypes' | 'allowsMultiple' | 'defaultCamera' | 'onSelect'> {
3
+ /** Identifies the native file input. */
4
+ id?: string;
5
+ /** Names the native file input for browser form semantics. */
6
+ name?: string;
7
+ /** The pressable or actionable element that opens the native file picker. */
8
+ children: AriaFileTriggerProps['children'];
9
+ }
10
+ /**
11
+ * Gives a familiar control access to the device file picker.
12
+ * FileUploadTrigger turns its pressable child into the native picker trigger
13
+ * and returns selected files through `onSelect`. It only acquires files;
14
+ * validation, display, and upload remain consumer-owned.
15
+ * @param props - The native picker configuration and pressable child.
16
+ * @param props.children - The focusable control that opens the native picker.
17
+ * @param props.acceptDirectory - Lets people choose a directory when supported.
18
+ * @param props.acceptedFileTypes - Filters visible file types in the native picker.
19
+ * @param props.allowsMultiple - Lets people select several files at once.
20
+ * @param props.defaultCamera - Selects a preferred device camera when supported.
21
+ * @param props.id - Identifies the native file input.
22
+ * @param props.name - Names the native file input for form submission.
23
+ * @param props.onSelect - Receives the files chosen through the native picker.
24
+ * @see {@link FileUploadTriggerProps} for native picker configuration.
25
+ * @example
26
+ * ```tsx
27
+ * import { Button, FileUploadTrigger } from '@payfit/unity-components'
28
+ *
29
+ * export function AvatarPicker() {
30
+ * return (
31
+ * <FileUploadTrigger
32
+ * acceptedFileTypes={['image/jpeg', 'image/png']}
33
+ * onSelect={files => {
34
+ * const avatar = files?.item(0)
35
+ * if (avatar) {
36
+ * console.log(avatar.name)
37
+ * }
38
+ * }}
39
+ * >
40
+ * <Button variant="primary">Choose profile picture</Button>
41
+ * </FileUploadTrigger>
42
+ * )
43
+ * }
44
+ * ```
45
+ * @remarks
46
+ * - Use a focusable Button or Actionable child with a specific visible label or `aria-label`.
47
+ * - Reflect disabled, pending, error, and success states on the child.
48
+ * - Announce asynchronous results in a nearby live region.
49
+ * - Pair `acceptedFileTypes` with visible acceptance guidance and validate the selection after it is returned.
50
+ */
51
+ declare const FileUploadTrigger: import('react').ForwardRefExoticComponent<FileUploadTriggerProps & import('react').RefAttributes<HTMLInputElement>>;
52
+ export { FileUploadTrigger };