@digitalpromise/design 4.3.0 → 4.5.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.
@@ -4,7 +4,7 @@ interface DropzoneProps extends Omit<ComponentPropsWithRef<"input">, "type">, Fo
4
4
  instructions?: string;
5
5
  remover?: ReactElement;
6
6
  }
7
- export declare const Dropzone: ({ children, error, instructions, className, onChange: userOnChange, remover, ...props }: DropzoneProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Dropzone: ({ children, error, instructions, className, ref: userRef, onChange: userOnChange, remover, ...props }: DropzoneProps) => import("react/jsx-runtime").JSX.Element;
8
8
  type SingleImageDropzoneProps = Omit<DropzoneProps, "multiple" | "accept" | "children">;
9
9
  export declare const SingleImageDropzone: (props: SingleImageDropzoneProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone.d.ts","sourceRoot":"","sources":["../../../src/components/forms/dropzone.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,YAAY,EAGZ,KAAK,qBAAqB,EAC3B,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,UAAU,aACR,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAClD,cAAc;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED,eAAO,MAAM,QAAQ,GAAI,yFAQtB,aAAa,4CAiHf,CAAC;AAEF,KAAK,wBAAwB,GAAG,IAAI,CAClC,aAAa,EACb,UAAU,GAAG,QAAQ,GAAG,UAAU,CACnC,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4CAelE,CAAC"}
1
+ {"version":3,"file":"dropzone.d.ts","sourceRoot":"","sources":["../../../src/components/forms/dropzone.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,YAAY,EAGZ,KAAK,qBAAqB,EAC3B,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,UAAU,aACR,SAAQ,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAClD,cAAc;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED,eAAO,MAAM,QAAQ,GAAI,uGAStB,aAAa,4CA2Hf,CAAC;AAEF,KAAK,wBAAwB,GAAG,IAAI,CAClC,aAAa,EACb,UAAU,GAAG,QAAQ,GAAG,UAAU,CACnC,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4CAelE,CAAC"}
@@ -5,5 +5,6 @@ import { FormField } from "./form-field";
5
5
  import { Select } from "./select";
6
6
  import { TextInput } from "./text-input";
7
7
  import { Textarea } from "./textarea";
8
- export { Checkbox, Dropzone, SingleImageDropzone, Form, FormField, Select, Textarea, TextInput, };
8
+ import { Label } from "./label";
9
+ export { Checkbox, Dropzone, SingleImageDropzone, Form, FormField, Label, Select, Textarea, TextInput, };
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,GACV,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,GACV,CAAC"}
package/dist/forms.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),g=require("./icon-DjGt_3uE.cjs"),I=({error:a,className:r,label:t,...l})=>{const n=l.id||l.name;return e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx("input",{type:"checkbox",className:`transition-colors appearance-none cursor-pointer bg-neutral-1 border-2 border-gray-5 rounded-sm w-5 h-5 grid place-content-center hover:bg-gray-1 hover:border-neutral-5 before:hidden before:content-['\\2713'] before:text-neutral-1 before:font-bold checked:bg-blue-3 checked:border-blue-4 checked:hover:bg-blue-4 checked:hover:border-blue-5 checked:before:inline-block ${r??""}`.trim(),...l,id:n}),e.jsx("label",{"data-error":a||null,htmlFor:n,className:"data-error:text-red-4",children:t})]})},p=({children:a,error:r,instructions:t,className:l,onChange:n,remover:d,...i})=>{const s=u.useRef(null),[v,m]=u.useState(!1),[b,j]=u.useState([]),h=b.length>0,w=o=>{o.preventDefault(),m(!1),s.current&&o.dataTransfer.files.length>0&&(s.current.files=o.dataTransfer.files,o.dataTransfer.clearData(),s.current.dispatchEvent(new Event("change",{bubbles:!0})))},y=o=>{n&&n(o);const k=Array.from(o.currentTarget.files??[]).map(c=>{if(c.type.includes("image")){const F=URL.createObjectURL(c);return e.jsx("img",{alt:"",src:F,className:"max-h-full max-w-full object-contain"},c.name)}else return e.jsx("p",{children:c.name},c.name)});j(k)},N=()=>{s.current&&(s.current.value="",s.current.files=null,s.current.dispatchEvent(new Event("change",{bubbles:!0})))},x={onClick:o=>{o.preventDefault(),N()}},D=d?u.cloneElement(d,x):e.jsx(g.Button,{type:"button",variant:"tertiary",state:"decolor",...x,children:"Remove Files"}),f=o=>{o.preventDefault(),m(!0)};return e.jsxs("div",{children:[e.jsxs("label",{"data-showing-preview":h||null,"data-is-dragging":v||null,onDragLeave:()=>m(!1),onDragEnter:f,onDragOver:f,onDrop:w,htmlFor:i.id,"data-error":r||null,className:`flex items-center justify-center rounded-lg border border-dashed border-blue-3 px-7 py-8 font-medium text-blue-3 data-showing-preview:w-max data-showing-preview:border-gray-3 data-showing-preview:text-gray-3 data-is-dragging:border-blue-5 data-is-dragging:bg-blue-1 data-showing-preview:py-5 data-is-dragging:text-blue-4 ${l??""} cursor-default`.trim(),children:[e.jsx("input",{...i,ref:s,onChange:y,className:"sr-only",type:"file"}),h?e.jsxs(e.Fragment,{children:[e.jsx("aside",{className:"grid grid-cols-2 grid-rows-2 w-11 h-11",children:b}),D]}):a??e.jsxs("p",{className:"pointer-events-none select-none",children:[e.jsx(g.Icon,{name:"Upload"})," Click or drop to upload"]})]}),t&&e.jsx("p",{className:"font-light leading-6",children:t})]})},T=a=>{const r=e.jsx(g.Button,{type:"button",variant:"tertiary",state:"decolor",children:"Remove Image"});return e.jsx(p,{...a,multiple:!1,remover:r,accept:"image/png image/svg+xml"})},q=({noValidate:a,className:r,...t})=>e.jsx("form",{className:`container flex flex-col gap-7 max-w-[45rem] ${r??""}`.trim(),...t,noValidate:a??!0}),C=({className:a,label:r,required:t,error:l,...n})=>e.jsx("label",{"data-required":t||null,"data-error":l||null,...n,className:`text-base font-medium leading-5 data-error:text-red-4 data-required:after:content-['*'] data-required:after:text-red-4 data-required:after:ml-1 ${a??""}`.trim(),children:r}),S=({Input:a,inputProps:r,errorMessage:t,label:l,labelClassname:n})=>{const d=!!t,i=r?.id||r?.name;return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(C,{label:l,className:n,htmlFor:i,required:r?.required,error:d}),e.jsx(a,{error:d,...r,id:i}),t&&e.jsx("p",{className:"text-red-4",children:t})]})},E=({options:a,error:r,className:t,...l})=>e.jsx("select",{...l,"data-error":r||null,className:`border border-gray-5 rounded-sm text-base leading-5 px-[0.94rem] py-[0.69rem] focus-within:border-transparent focus-within:outline-blue-4 data-error:border-red-4 data-error:outline-red-4 ${t??""}`.trim(),children:a.map(n=>e.jsx("option",{className:"hover:bg-gray-3",value:n.value,children:n.label},[l.name,n.label].join()))}),R=({error:a,className:r,...t})=>e.jsx("input",{"data-error":a||null,className:`border border-gray-5 rounded-sm text-base leading-5 px-[0.94rem] py-[0.69rem] focus-within:border-transparent focus-within:outline-blue-4 data-error:border-red-4 data-error:outline-red-4 ${r??""}`.trim(),...t,type:"text"}),$=({className:a,error:r,...t})=>e.jsx("textarea",{"data-error":r||null,className:`border border-gray-5 rounded-sm text-base leading-5 px-[0.94rem] py-[0.69rem] focus-within:border-transparent focus-within:outline-blue-4 data-error:border-red-4 data-error:outline-red-4 ${a??""}`.trim(),...t});exports.Checkbox=I;exports.Dropzone=p;exports.Form=q;exports.FormField=S;exports.Select=E;exports.SingleImageDropzone=T;exports.TextInput=R;exports.Textarea=$;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),g=require("./icon-DjGt_3uE.cjs"),q=({error:a,className:r,label:t,...o})=>{const n=o.id||o.name;return e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx("input",{type:"checkbox",className:`transition-colors appearance-none cursor-pointer bg-neutral-1 border-2 border-gray-5 rounded-sm w-5 h-5 grid place-content-center hover:bg-gray-1 hover:border-neutral-5 before:hidden before:content-['\\2713'] before:text-neutral-1 before:font-bold checked:bg-blue-3 checked:border-blue-4 checked:hover:bg-blue-4 checked:hover:border-blue-5 checked:before:inline-block ${r??""}`.trim(),...o,id:n}),e.jsx("label",{"data-error":a||null,htmlFor:n,className:"data-error:text-red-4",children:t})]})},v=({children:a,error:r,instructions:t,className:o,ref:n,onChange:i,remover:d,...b})=>{const s=u.useRef(null),[w,m]=u.useState(!1),[h,y]=u.useState([]),x=h.length>0,N=l=>{l.preventDefault(),m(!1),s.current&&l.dataTransfer.files.length>0&&(s.current.files=l.dataTransfer.files,l.dataTransfer.clearData(),s.current.dispatchEvent(new Event("change",{bubbles:!0})))},D=l=>{i&&i(l);const I=Array.from(l.currentTarget.files??[]).map(c=>{if(c.type.includes("image")){const T=URL.createObjectURL(c);return e.jsx("img",{alt:"",src:T,className:"max-h-full max-w-full object-contain"},c.name)}else return e.jsx("p",{children:c.name},c.name)});y(I)},F=()=>{s.current&&(s.current.value="",s.current.files=null,s.current.dispatchEvent(new Event("change",{bubbles:!0})))},f={onClick:l=>{l.preventDefault(),F()}},k=d?u.cloneElement(d,f):e.jsx(g.Button,{type:"button",variant:"tertiary",state:"decolor",...f,children:"Remove Files"}),p=l=>{l.preventDefault(),m(!0)};return e.jsxs("div",{children:[e.jsxs("label",{"data-showing-preview":x||null,"data-is-dragging":w||null,onDragLeave:()=>m(!1),onDragEnter:p,onDragOver:p,onDrop:N,htmlFor:b.id,"data-error":r||null,className:`flex items-center justify-center rounded-lg border border-dashed border-blue-3 px-7 py-8 font-medium text-blue-3 data-showing-preview:w-max data-showing-preview:border-gray-3 data-showing-preview:text-gray-3 data-is-dragging:border-blue-5 data-is-dragging:bg-blue-1 data-showing-preview:py-5 data-is-dragging:text-blue-4 ${o??""} cursor-default`.trim(),children:[e.jsx("input",{...b,ref:l=>{n&&(n instanceof Function?n(l):n.current=l),s.current=l},onChange:D,className:"sr-only",type:"file"}),x?e.jsxs(e.Fragment,{children:[e.jsx("aside",{className:"grid grid-cols-2 grid-rows-2 w-11 h-11",children:h}),k]}):a??e.jsxs("p",{className:"pointer-events-none select-none",children:[e.jsx(g.Icon,{name:"Upload"})," Click or drop to upload"]})]}),t&&e.jsx("p",{className:"font-light leading-6",children:t})]})},C=a=>{const r=e.jsx(g.Button,{type:"button",variant:"tertiary",state:"decolor",children:"Remove Image"});return e.jsx(v,{...a,multiple:!1,remover:r,accept:"image/png image/svg+xml"})},S=({noValidate:a,className:r,...t})=>e.jsx("form",{className:`container flex flex-col gap-7 max-w-[45rem] ${r??""}`.trim(),...t,noValidate:a??!0}),j=({className:a,label:r,required:t,error:o,...n})=>e.jsx("label",{"data-required":t||null,"data-error":o||null,...n,className:`text-base font-medium leading-5 data-error:text-red-4 data-required:after:content-['*'] data-required:after:text-red-4 data-required:after:ml-1 ${a??""}`.trim(),children:r}),E=({Input:a,inputProps:r,errorMessage:t,label:o,labelClassname:n})=>{const i=!!t,d=r?.id||r?.name;return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(j,{label:o,className:n,htmlFor:d,required:r?.required,error:i}),e.jsx(a,{error:i,...r,id:d}),t&&e.jsx("p",{className:"text-red-4",children:t})]})},$=({options:a,error:r,className:t,...o})=>e.jsx("select",{...o,"data-error":r||null,className:`border border-gray-5 rounded-sm text-base leading-5 px-[0.94rem] py-[0.69rem] focus-within:border-transparent focus-within:outline-blue-4 data-error:border-red-4 data-error:outline-red-4 ${t??""}`.trim(),children:a.map(n=>e.jsx("option",{className:"hover:bg-gray-3",value:n.value,children:n.label},[o.name,n.label].join()))}),L=({error:a,className:r,...t})=>e.jsx("input",{"data-error":a||null,className:`border border-gray-5 rounded-sm text-base leading-5 px-[0.94rem] py-[0.69rem] focus-within:border-transparent focus-within:outline-blue-4 data-error:border-red-4 data-error:outline-red-4 ${r??""}`.trim(),...t,type:"text"}),z=({className:a,error:r,...t})=>e.jsx("textarea",{"data-error":r||null,className:`border border-gray-5 rounded-sm text-base leading-5 px-[0.94rem] py-[0.69rem] focus-within:border-transparent focus-within:outline-blue-4 data-error:border-red-4 data-error:outline-red-4 ${a??""}`.trim(),...t});exports.Checkbox=q;exports.Dropzone=v;exports.Form=S;exports.FormField=E;exports.Label=j;exports.Select=$;exports.SingleImageDropzone=C;exports.TextInput=L;exports.Textarea=z;
package/dist/forms.d.ts CHANGED
@@ -8,7 +8,7 @@ declare type CheckboxProps = InputPropsWithoutType & FormInputProps & {
8
8
  label: string;
9
9
  };
10
10
 
11
- export declare const Dropzone: ({ children, error, instructions, className, onChange: userOnChange, remover, ...props }: DropzoneProps) => JSX.Element;
11
+ export declare const Dropzone: ({ children, error, instructions, className, ref: userRef, onChange: userOnChange, remover, ...props }: DropzoneProps) => JSX.Element;
12
12
 
13
13
  declare interface DropzoneProps extends Omit<ComponentPropsWithRef<"input">, "type">, FormInputProps {
14
14
  instructions?: string;
@@ -38,6 +38,14 @@ declare type FormProps = ComponentPropsWithRef<"form">;
38
38
 
39
39
  declare type InputPropsWithoutType = Omit<ComponentPropsWithRef<"input">, "type">;
40
40
 
41
+ export declare const Label: ({ className, label, required, error, ...props }: LabelProps) => JSX.Element;
42
+
43
+ declare interface LabelProps extends ComponentPropsWithRef<"label"> {
44
+ label: string;
45
+ error?: boolean;
46
+ required?: boolean;
47
+ }
48
+
41
49
  export declare const Select: ({ options, error, className, ...props }: SelectProps) => JSX.Element;
42
50
 
43
51
  declare interface SelectProps extends ComponentPropsWithRef<"select">, FormInputProps {
package/dist/forms.js CHANGED
@@ -1,20 +1,20 @@
1
- import { jsxs as i, jsx as e, Fragment as C } from "react/jsx-runtime";
2
- import { useRef as E, useState as p, cloneElement as T } from "react";
3
- import { B as v, I as $ } from "./icon-BR2zaZo5.js";
4
- const S = ({
1
+ import { jsxs as i, jsx as e, Fragment as E } from "react/jsx-runtime";
2
+ import { useRef as T, useState as v, cloneElement as $ } from "react";
3
+ import { B as x, I as j } from "./icon-BR2zaZo5.js";
4
+ const U = ({
5
5
  error: a,
6
6
  className: r,
7
7
  label: t,
8
- ...l
8
+ ...o
9
9
  }) => {
10
- const n = l.id || l.name;
10
+ const n = o.id || o.name;
11
11
  return /* @__PURE__ */ i("div", { className: "flex gap-3 items-center", children: [
12
12
  /* @__PURE__ */ e(
13
13
  "input",
14
14
  {
15
15
  type: "checkbox",
16
16
  className: `transition-colors appearance-none cursor-pointer bg-neutral-1 border-2 border-gray-5 rounded-sm w-5 h-5 grid place-content-center hover:bg-gray-1 hover:border-neutral-5 before:hidden before:content-['\\2713'] before:text-neutral-1 before:font-bold checked:bg-blue-3 checked:border-blue-4 checked:hover:bg-blue-4 checked:hover:border-blue-5 checked:before:inline-block ${r ?? ""}`.trim(),
17
- ...l,
17
+ ...o,
18
18
  id: n
19
19
  }
20
20
  ),
@@ -28,29 +28,30 @@ const S = ({
28
28
  }
29
29
  )
30
30
  ] });
31
- }, j = ({
31
+ }, q = ({
32
32
  children: a,
33
33
  error: r,
34
34
  instructions: t,
35
- className: l,
36
- onChange: n,
35
+ className: o,
36
+ ref: n,
37
+ onChange: c,
37
38
  remover: s,
38
- ...c
39
+ ...g
39
40
  }) => {
40
- const d = E(null), [x, m] = p(!1), [g, w] = p([]), b = g.length > 0, y = (o) => {
41
- o.preventDefault(), m(!1), d.current && o.dataTransfer.files.length > 0 && (d.current.files = o.dataTransfer.files, o.dataTransfer.clearData(), d.current.dispatchEvent(
41
+ const d = T(null), [w, m] = v(!1), [b, y] = v([]), h = b.length > 0, N = (l) => {
42
+ l.preventDefault(), m(!1), d.current && l.dataTransfer.files.length > 0 && (d.current.files = l.dataTransfer.files, l.dataTransfer.clearData(), d.current.dispatchEvent(
42
43
  new Event("change", { bubbles: !0 })
43
44
  ));
44
- }, N = (o) => {
45
- n && n(o);
46
- const k = Array.from(o.currentTarget.files ?? []).map((u) => {
45
+ }, D = (l) => {
46
+ c && c(l);
47
+ const F = Array.from(l.currentTarget.files ?? []).map((u) => {
47
48
  if (u.type.includes("image")) {
48
- const F = URL.createObjectURL(u);
49
+ const C = URL.createObjectURL(u);
49
50
  return /* @__PURE__ */ e(
50
51
  "img",
51
52
  {
52
53
  alt: "",
53
- src: F,
54
+ src: C,
54
55
  className: "max-h-full max-w-full object-contain"
55
56
  },
56
57
  u.name
@@ -58,47 +59,49 @@ const S = ({
58
59
  } else
59
60
  return /* @__PURE__ */ e("p", { children: u.name }, u.name);
60
61
  });
61
- w(k);
62
- }, D = () => {
62
+ y(F);
63
+ }, I = () => {
63
64
  d.current && (d.current.value = "", d.current.files = null, d.current.dispatchEvent(
64
65
  new Event("change", { bubbles: !0 })
65
66
  ));
66
- }, h = {
67
- onClick: (o) => {
68
- o.preventDefault(), D();
67
+ }, f = {
68
+ onClick: (l) => {
69
+ l.preventDefault(), I();
69
70
  }
70
- }, I = s ? T(s, h) : /* @__PURE__ */ e(v, { type: "button", variant: "tertiary", state: "decolor", ...h, children: "Remove Files" }), f = (o) => {
71
- o.preventDefault(), m(!0);
71
+ }, k = s ? $(s, f) : /* @__PURE__ */ e(x, { type: "button", variant: "tertiary", state: "decolor", ...f, children: "Remove Files" }), p = (l) => {
72
+ l.preventDefault(), m(!0);
72
73
  };
73
74
  return /* @__PURE__ */ i("div", { children: [
74
75
  /* @__PURE__ */ i(
75
76
  "label",
76
77
  {
77
- "data-showing-preview": b || null,
78
- "data-is-dragging": x || null,
78
+ "data-showing-preview": h || null,
79
+ "data-is-dragging": w || null,
79
80
  onDragLeave: () => m(!1),
80
- onDragEnter: f,
81
- onDragOver: f,
82
- onDrop: y,
83
- htmlFor: c.id,
81
+ onDragEnter: p,
82
+ onDragOver: p,
83
+ onDrop: N,
84
+ htmlFor: g.id,
84
85
  "data-error": r || null,
85
- className: `flex items-center justify-center rounded-lg border border-dashed border-blue-3 px-7 py-8 font-medium text-blue-3 data-showing-preview:w-max data-showing-preview:border-gray-3 data-showing-preview:text-gray-3 data-is-dragging:border-blue-5 data-is-dragging:bg-blue-1 data-showing-preview:py-5 data-is-dragging:text-blue-4 ${l ?? ""} cursor-default`.trim(),
86
+ className: `flex items-center justify-center rounded-lg border border-dashed border-blue-3 px-7 py-8 font-medium text-blue-3 data-showing-preview:w-max data-showing-preview:border-gray-3 data-showing-preview:text-gray-3 data-is-dragging:border-blue-5 data-is-dragging:bg-blue-1 data-showing-preview:py-5 data-is-dragging:text-blue-4 ${o ?? ""} cursor-default`.trim(),
86
87
  children: [
87
88
  /* @__PURE__ */ e(
88
89
  "input",
89
90
  {
90
- ...c,
91
- ref: d,
92
- onChange: N,
91
+ ...g,
92
+ ref: (l) => {
93
+ n && (n instanceof Function ? n(l) : n.current = l), d.current = l;
94
+ },
95
+ onChange: D,
93
96
  className: "sr-only",
94
97
  type: "file"
95
98
  }
96
99
  ),
97
- b ? /* @__PURE__ */ i(C, { children: [
98
- /* @__PURE__ */ e("aside", { className: "grid grid-cols-2 grid-rows-2 w-11 h-11", children: g }),
99
- I
100
+ h ? /* @__PURE__ */ i(E, { children: [
101
+ /* @__PURE__ */ e("aside", { className: "grid grid-cols-2 grid-rows-2 w-11 h-11", children: b }),
102
+ k
100
103
  ] }) : a ?? /* @__PURE__ */ i("p", { className: "pointer-events-none select-none", children: [
101
- /* @__PURE__ */ e($, { name: "Upload" }),
104
+ /* @__PURE__ */ e(j, { name: "Upload" }),
102
105
  " Click or drop to upload"
103
106
  ] })
104
107
  ]
@@ -106,72 +109,72 @@ const S = ({
106
109
  ),
107
110
  t && /* @__PURE__ */ e("p", { className: "font-light leading-6", children: t })
108
111
  ] });
109
- }, U = (a) => /* @__PURE__ */ e(
110
- j,
112
+ }, z = (a) => /* @__PURE__ */ e(
113
+ q,
111
114
  {
112
115
  ...a,
113
116
  multiple: !1,
114
- remover: /* @__PURE__ */ e(v, { type: "button", variant: "tertiary", state: "decolor", children: "Remove Image" }),
117
+ remover: /* @__PURE__ */ e(x, { type: "button", variant: "tertiary", state: "decolor", children: "Remove Image" }),
115
118
  accept: "image/png image/svg+xml"
116
119
  }
117
- ), z = ({ noValidate: a, className: r, ...t }) => /* @__PURE__ */ e(
120
+ ), P = ({ noValidate: a, className: r, ...t }) => /* @__PURE__ */ e(
118
121
  "form",
119
122
  {
120
123
  className: `container flex flex-col gap-7 max-w-[45rem] ${r ?? ""}`.trim(),
121
124
  ...t,
122
125
  noValidate: a ?? !0
123
126
  }
124
- ), q = ({
127
+ ), L = ({
125
128
  className: a,
126
129
  label: r,
127
130
  required: t,
128
- error: l,
131
+ error: o,
129
132
  ...n
130
133
  }) => /* @__PURE__ */ e(
131
134
  "label",
132
135
  {
133
136
  "data-required": t || null,
134
- "data-error": l || null,
137
+ "data-error": o || null,
135
138
  ...n,
136
139
  className: `text-base font-medium leading-5 data-error:text-red-4 data-required:after:content-['*'] data-required:after:text-red-4 data-required:after:ml-1 ${a ?? ""}`.trim(),
137
140
  children: r
138
141
  }
139
- ), P = ({
142
+ ), A = ({
140
143
  Input: a,
141
144
  inputProps: r,
142
145
  errorMessage: t,
143
- label: l,
146
+ label: o,
144
147
  labelClassname: n
145
148
  }) => {
146
- const s = !!t, c = r?.id || r?.name;
149
+ const c = !!t, s = r?.id || r?.name;
147
150
  return /* @__PURE__ */ i("div", { className: "flex flex-col gap-3", children: [
148
151
  /* @__PURE__ */ e(
149
- q,
152
+ L,
150
153
  {
151
- label: l,
154
+ label: o,
152
155
  className: n,
153
- htmlFor: c,
156
+ htmlFor: s,
154
157
  required: r?.required,
155
- error: s
158
+ error: c
156
159
  }
157
160
  ),
158
- /* @__PURE__ */ e(a, { error: s, ...r, id: c }),
161
+ /* @__PURE__ */ e(a, { error: c, ...r, id: s }),
159
162
  t && /* @__PURE__ */ e("p", { className: "text-red-4", children: t })
160
163
  ] });
161
- }, A = ({
164
+ }, O = ({
162
165
  options: a,
163
166
  error: r,
164
167
  className: t,
165
- ...l
168
+ ...o
166
169
  }) => /* @__PURE__ */ e(
167
170
  "select",
168
171
  {
169
- ...l,
172
+ ...o,
170
173
  "data-error": r || null,
171
174
  className: `border border-gray-5 rounded-sm text-base leading-5 px-[0.94rem] py-[0.69rem] focus-within:border-transparent focus-within:outline-blue-4 data-error:border-red-4 data-error:outline-red-4 ${t ?? ""}`.trim(),
172
- children: a.map((n) => /* @__PURE__ */ e("option", { className: "hover:bg-gray-3", value: n.value, children: n.label }, [l.name, n.label].join()))
175
+ children: a.map((n) => /* @__PURE__ */ e("option", { className: "hover:bg-gray-3", value: n.value, children: n.label }, [o.name, n.label].join()))
173
176
  }
174
- ), O = ({ error: a, className: r, ...t }) => /* @__PURE__ */ e(
177
+ ), V = ({ error: a, className: r, ...t }) => /* @__PURE__ */ e(
175
178
  "input",
176
179
  {
177
180
  "data-error": a || null,
@@ -179,7 +182,7 @@ const S = ({
179
182
  ...t,
180
183
  type: "text"
181
184
  }
182
- ), V = ({ className: a, error: r, ...t }) => /* @__PURE__ */ e(
185
+ ), G = ({ className: a, error: r, ...t }) => /* @__PURE__ */ e(
183
186
  "textarea",
184
187
  {
185
188
  "data-error": r || null,
@@ -188,12 +191,13 @@ const S = ({
188
191
  }
189
192
  );
190
193
  export {
191
- S as Checkbox,
192
- j as Dropzone,
193
- z as Form,
194
- P as FormField,
195
- A as Select,
196
- U as SingleImageDropzone,
197
- O as TextInput,
198
- V as Textarea
194
+ U as Checkbox,
195
+ q as Dropzone,
196
+ P as Form,
197
+ A as FormField,
198
+ L as Label,
199
+ O as Select,
200
+ z as SingleImageDropzone,
201
+ V as TextInput,
202
+ G as Textarea
199
203
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digitalpromise/design",
3
3
  "private": false,
4
- "version": "4.3.0",
4
+ "version": "4.5.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "exports": {
@@ -30,7 +30,7 @@
30
30
  "@typescript-eslint/eslint-plugin": "^8.56.1",
31
31
  "@typescript-eslint/parser": "^8.56.1",
32
32
  "@vitejs/plugin-react-swc": "^4.2.3",
33
- "eslint": "^10.0.2",
33
+ "eslint": "^9.39.3",
34
34
  "eslint-plugin-react-hooks": "^7.0.1",
35
35
  "eslint-plugin-storybook": "^10.2.13",
36
36
  "jsdom": "^28.1.0",