@digitalpromise/design 4.3.0 → 4.5.1

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"}
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAIA,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,KAAK,EACL,YAAqB,GACtB,EAAE,eAAe,2CAoHjB"}
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAKA,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,KAAK,EACL,YAAqB,GACtB,EAAE,eAAe,2CA+GjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/components/search.tsx"],"names":[],"mappings":"AAMA,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,QAAQ,EACR,SAAgB,EAChB,EAAa,EACb,QAAc,GACf,EAAE,WAAW,2CA+Fb"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/components/search.tsx"],"names":[],"mappings":"AAMA,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,QAAQ,EACR,SAAgB,EAChB,EAAa,EACb,QAAc,GACf,EAAE,WAAW,2CA4Fb"}
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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("./icon-DjGt_3uE.cjs"),e=require("react/jsx-runtime"),m=require("next/navigation"),S=require("react"),k=new Map([["black","/primary-badge-engine-logo-black.svg"],["white","/primary-badge-engine-logo-white.svg"],["color","/primary-badge-engine-logo-color.svg"]]);function C({variant:c="color",className:b}){const r=k.get(c);return r===void 0?null:e.jsx("img",{src:r,width:186,height:36,alt:"Badge Engine",className:b})}function R({count:c,limit:b,pageParamKey:r="page"}){const s=m.useSearchParams(),x=m.usePathname(),o=m.useRouter(),v=s.get(r),d=v?Number.parseInt(v,10):Number.NaN,t=Number.isFinite(d)?d:1,n=Math.max(1,Math.ceil(c/b)),w=n<=7?Array.from({length:n},(a,i)=>i+1):t<=4?[1,2,3,4,5,"ellipsis",n]:t>=n-3?[1,"ellipsis",n-4,n-3,n-2,n-1,n]:[1,"ellipsis",t-1,t,t+1,"ellipsis",n],y=t===1,u=t===n,N=a=>{if(y&&a==="prev"||u&&a==="next")return;const i=a==="prev"?t-1:t+1,g=new URLSearchParams(s.toString());g.set(r,String(i)),o.push(`${x}?${g.toString()}`,{scroll:!1})},j=a=>{const i=new URLSearchParams(s.toString());i.set(r,String(a)),o.push(`${x}?${i.toString()}`,{scroll:!1})};return e.jsxs("ul",{className:"flex items-center justify-center gap-4 font-medium",children:[e.jsx("li",{className:"mr-2",children:e.jsx("button",{type:"button","aria-label":"Previous page",disabled:y,className:"inline-flex h-[42px] w-[42px] items-center justify-center rounded-[4px] bg-transparent p-[9px] text-gray-5 transition hover:bg-transparent hover:text-neutral-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>N("prev"),children:e.jsx("span",{"aria-hidden":!0,className:"font-icon dpg-icons-arrow-line-left inline-block h-[24px] w-[24px] text-[24px] leading-[24px]"})})}),w.map((a,i)=>{const g=a==="ellipsis",h=g?void 0:a,f=h===t,p=g||f,l=g?"Pagination ellipsis":`Go to page ${h}`;return e.jsx("li",{children:e.jsx("button",{type:"button","aria-label":l,"aria-current":f?"page":void 0,disabled:p,className:`flex h-[36px] w-[36px] items-center justify-center rounded-[4px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 ${f?"bg-blue-1 text-blue-4":""} ${p?"cursor-default":"cursor-pointer hover:bg-gray-1"}`.trim(),onClick:!p&&h?()=>j(h):void 0,children:g?"...":h})},`${a}-${i}`)}),e.jsx("li",{className:"ml-2",children:e.jsx("button",{type:"button","aria-label":"Next page",disabled:u,className:"inline-flex h-[42px] w-[42px] items-center justify-center rounded-[4px] bg-transparent p-[9px] text-gray-5 transition hover:bg-transparent hover:text-neutral-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>N("next"),children:e.jsx("span",{"aria-hidden":!0,className:"font-icon dpg-icons-arrow-line-right inline-block h-[24px] w-[24px] text-[24px] leading-[24px]"})})})]})}function L({placeholder:c,className:b,inputWidth:r,value:s,onChange:x,syncToUrl:o=!0,id:v="search",paramKey:d="s"}){const t=m.useSearchParams(),n=m.usePathname(),w=m.useRouter(),y=S.useRef(null),u=s!==void 0,[N,j]=S.useState(u?s:t.get(d)?.toString()??""),a=u?s:N,i=Math.max(c.length,1),g=`calc(${i}ch + 60px)`,h=r===void 0?g:typeof r=="number"?`${r}px`:r;S.useEffect(()=>{!o||u||j(t.get(d)?.toString()??"")},[u,d,t,o]);const f=p=>{if(!o)return;const l=new URLSearchParams(t.toString());p?(l.set(d,p),l.delete("page")):(l.delete(d),l.delete("page"));const P=l.toString();w.replace(P?`${n}?${P}`:n)};return e.jsxs("form",{className:b??"",noValidate:!0,children:[e.jsx("label",{className:"sr-only",htmlFor:v,children:"Search"}),e.jsxs("div",{className:"relative max-w-full",style:{width:h},children:[e.jsx($.Icon,{name:"Magnifier","aria-hidden":!0,className:"absolute left-[15px] top-1/2 z-10 -translate-y-1/2 text-large leading-5 text-gray-5"}),e.jsx("input",{ref:y,className:"hide-search-clear block w-full max-w-full rounded-sm bg-white py-[11px] pl-[15px] pr-[40px] text-base leading-6 indent-[30px] outline-1 outline-gray-5 transition focus:outline-2 focus:outline-blue-4",style:{color:"#000000",WebkitTextFillColor:"#000000"},size:i,id:v,type:"search",autoComplete:"off",value:a,placeholder:c,onChange:p=>{const l=p.target.value;u||j(l),x?.(l),f(l)}}),a.length>0&&e.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute right-1 top-1/2 z-10 inline-flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-lg p-2 text-gray-5 hover:text-neutral-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-4",onClick:()=>{u||j(""),x?.(""),f(""),y.current?.focus()},children:e.jsx("span",{"aria-hidden":!0,className:"font-icon dpg-icons-close inline-block h-4 w-4 text-[16px] leading-4 text-gray-5"})})]})]})}function M({columns:c,rows:b,rowKey:r}){return e.jsxs("table",{className:"w-full table-auto border-y border-gray-2 text-gray-5",children:[e.jsx("thead",{className:"font-bold",children:e.jsx("tr",{children:c.map(s=>e.jsx("td",{className:`px-3 py-4 ${s.headerClassName??""}`.trim(),children:s.header},s.key))})}),e.jsx("tbody",{children:b.map((s,x)=>e.jsx("tr",{className:"border-t border-gray-2",children:c.map(o=>e.jsx("td",{className:`${o.cellClassName??"px-3 py-4"}`.trim(),children:o.render(s)},o.key))},r(s,x)))})]})}exports.Button=$.Button;exports.Logo=C;exports.Pagination=R;exports.Search=L;exports.Table=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./icon-DjGt_3uE.cjs"),e=require("react/jsx-runtime"),m=require("next/navigation"),w=require("react"),C=new Map([["black","/primary-badge-engine-logo-black.svg"],["white","/primary-badge-engine-logo-white.svg"],["color","/primary-badge-engine-logo-color.svg"]]);function k({variant:c="color",className:b}){const r=C.get(c);return r===void 0?null:e.jsx("img",{src:r,width:186,height:36,alt:"Badge Engine",className:b})}function L({count:c,limit:b,pageParamKey:r="page"}){const s=m.useSearchParams(),h=m.usePathname(),o=m.useRouter(),v=s.get(r),d=v?Number.parseInt(v,10):Number.NaN,t=Number.isFinite(d)?d:1,n=Math.max(1,Math.ceil(c/b)),P=n<=7?Array.from({length:n},(a,i)=>i+1):t<=4?[1,2,3,4,5,"ellipsis",n]:t>=n-3?[1,"ellipsis",n-4,n-3,n-2,n-1,n]:[1,"ellipsis",t-1,t,t+1,"ellipsis",n],y=t===1,u=t===n,S=a=>{if(y&&a==="prev"||u&&a==="next")return;const i=a==="prev"?t-1:t+1,g=new URLSearchParams(s.toString());g.set(r,String(i)),o.push(`${h}?${g.toString()}`,{scroll:!1})},j=a=>{const i=new URLSearchParams(s.toString());i.set(r,String(a)),o.push(`${h}?${i.toString()}`,{scroll:!1})};return e.jsxs("ul",{className:"flex items-center justify-center gap-4 font-medium",children:[e.jsx("li",{className:"mr-2",children:e.jsx("button",{type:"button","aria-label":"Previous page",disabled:y,className:"inline-flex h-[42px] w-[42px] items-center justify-center rounded-[4px] bg-transparent p-[9px] text-gray-5 transition hover:bg-transparent hover:text-neutral-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>S("prev"),children:e.jsx(N.Icon,{name:"ArrowLineLeft"})})}),P.map((a,i)=>{const g=a==="ellipsis",x=g?void 0:a,f=x===t,p=g||f,l=g?"Pagination ellipsis":`Go to page ${x}`;return e.jsx("li",{children:e.jsx("button",{type:"button","aria-label":l,"aria-current":f?"page":void 0,disabled:p,className:`flex h-[36px] w-[36px] items-center justify-center rounded-[4px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 ${f?"bg-blue-1 text-blue-4":""} ${p?"cursor-default":"cursor-pointer hover:bg-gray-1"}`.trim(),onClick:!p&&x?()=>j(x):void 0,children:g?"...":x})},`${a}-${i}`)}),e.jsx("li",{className:"ml-2",children:e.jsx("button",{type:"button","aria-label":"Next page",disabled:u,className:"inline-flex h-[42px] w-[42px] items-center justify-center rounded-[4px] bg-transparent p-[9px] text-gray-5 transition hover:bg-transparent hover:text-neutral-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>S("next"),children:e.jsx(N.Icon,{name:"ArrowLineRight"})})})]})}function R({placeholder:c,className:b,inputWidth:r,value:s,onChange:h,syncToUrl:o=!0,id:v="search",paramKey:d="s"}){const t=m.useSearchParams(),n=m.usePathname(),P=m.useRouter(),y=w.useRef(null),u=s!==void 0,[S,j]=w.useState(u?s:t.get(d)?.toString()??""),a=u?s:S,i=Math.max(c.length,1),g=`calc(${i}ch + 60px)`,x=r===void 0?g:typeof r=="number"?`${r}px`:r;w.useEffect(()=>{!o||u||j(t.get(d)?.toString()??"")},[u,d,t,o]);const f=p=>{if(!o)return;const l=new URLSearchParams(t.toString());p?(l.set(d,p),l.delete("page")):(l.delete(d),l.delete("page"));const $=l.toString();P.replace($?`${n}?${$}`:n)};return e.jsxs("form",{className:b??"",noValidate:!0,children:[e.jsx("label",{className:"sr-only",htmlFor:v,children:"Search"}),e.jsxs("div",{className:"relative max-w-full",style:{width:x},children:[e.jsx(N.Icon,{name:"Magnifier","aria-hidden":!0,className:"absolute left-[15px] top-1/2 z-10 -translate-y-1/2 text-large leading-5 text-gray-5"}),e.jsx("input",{ref:y,className:"hide-search-clear block w-full max-w-full rounded-sm bg-white py-[11px] pl-[15px] pr-[40px] text-base leading-6 indent-[30px] outline-1 outline-gray-5 transition focus:outline-2 focus:outline-blue-4",style:{color:"#000000",WebkitTextFillColor:"#000000"},size:i,id:v,type:"search",autoComplete:"off",value:a,placeholder:c,onChange:p=>{const l=p.target.value;u||j(l),h?.(l),f(l)}}),a.length>0&&e.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute right-1 top-1/2 z-10 inline-flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-lg p-2 text-gray-5 hover:text-neutral-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-4",onClick:()=>{u||j(""),h?.(""),f(""),y.current?.focus()},children:e.jsx(N.Icon,{name:"Close"})})]})]})}function I({columns:c,rows:b,rowKey:r}){return e.jsxs("table",{className:"w-full table-auto border-y border-gray-2 text-gray-5",children:[e.jsx("thead",{className:"font-bold",children:e.jsx("tr",{children:c.map(s=>e.jsx("td",{className:`px-3 py-4 ${s.headerClassName??""}`.trim(),children:s.header},s.key))})}),e.jsx("tbody",{children:b.map((s,h)=>e.jsx("tr",{className:"border-t border-gray-2",children:c.map(o=>e.jsx("td",{className:`${o.cellClassName??"px-3 py-4"}`.trim(),children:o.render(s)},o.key))},r(s,h)))})]})}exports.Button=N.Button;exports.Logo=k;exports.Pagination=L;exports.Search=R;exports.Table=I;
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import { I as j } from "./icon-BR2zaZo5.js";
1
+ import { I as w } from "./icon-BR2zaZo5.js";
2
2
  import { B as T } from "./icon-BR2zaZo5.js";
3
- import { jsx as e, jsxs as w } from "react/jsx-runtime";
4
- import { useSearchParams as $, usePathname as k, useRouter as C } from "next/navigation";
5
- import { useRef as L, useState as R, useEffect as M } from "react";
3
+ import { jsx as e, jsxs as S } from "react/jsx-runtime";
4
+ import { useSearchParams as C, usePathname as k, useRouter as L } from "next/navigation";
5
+ import { useRef as j, useState as R, useEffect as M } from "react";
6
6
  const z = /* @__PURE__ */ new Map([
7
7
  ["black", "/primary-badge-engine-logo-black.svg"],
8
8
  ["white", "/primary-badge-engine-logo-white.svg"],
9
9
  ["color", "/primary-badge-engine-logo-color.svg"]
10
10
  ]);
11
- function V({
11
+ function E({
12
12
  variant: c = "color",
13
13
  className: b
14
14
  }) {
15
- const i = z.get(c);
16
- return i === void 0 ? null : /* @__PURE__ */ e(
15
+ const s = z.get(c);
16
+ return s === void 0 ? null : /* @__PURE__ */ e(
17
17
  "img",
18
18
  {
19
- src: i,
19
+ src: s,
20
20
  width: 186,
21
21
  height: 36,
22
22
  alt: "Badge Engine",
@@ -24,29 +24,29 @@ function V({
24
24
  }
25
25
  );
26
26
  }
27
- function q({
27
+ function V({
28
28
  count: c,
29
29
  limit: b,
30
- pageParamKey: i = "page"
30
+ pageParamKey: s = "page"
31
31
  }) {
32
- const n = $(), f = k(), o = C(), x = n.get(i), d = x ? Number.parseInt(x, 10) : Number.NaN, t = Number.isFinite(d) ? d : 1, r = Math.max(1, Math.ceil(c / b)), S = r <= 7 ? Array.from({ length: r }, (a, s) => s + 1) : t <= 4 ? [1, 2, 3, 4, 5, "ellipsis", r] : t >= r - 3 ? [1, "ellipsis", r - 4, r - 3, r - 2, r - 1, r] : [
32
+ const r = C(), f = k(), o = L(), x = r.get(s), d = x ? Number.parseInt(x, 10) : Number.NaN, t = Number.isFinite(d) ? d : 1, n = Math.max(1, Math.ceil(c / b)), P = n <= 7 ? Array.from({ length: n }, (a, i) => i + 1) : t <= 4 ? [1, 2, 3, 4, 5, "ellipsis", n] : t >= n - 3 ? [1, "ellipsis", n - 4, n - 3, n - 2, n - 1, n] : [
33
33
  1,
34
34
  "ellipsis",
35
35
  t - 1,
36
36
  t,
37
37
  t + 1,
38
38
  "ellipsis",
39
- r
40
- ], v = t === 1, u = t === r, N = (a) => {
39
+ n
40
+ ], v = t === 1, u = t === n, N = (a) => {
41
41
  if (v && a === "prev" || u && a === "next")
42
42
  return;
43
- const s = a === "prev" ? t - 1 : t + 1, p = new URLSearchParams(n.toString());
44
- p.set(i, String(s)), o.push(`${f}?${p.toString()}`, { scroll: !1 });
43
+ const i = a === "prev" ? t - 1 : t + 1, g = new URLSearchParams(r.toString());
44
+ g.set(s, String(i)), o.push(`${f}?${g.toString()}`, { scroll: !1 });
45
45
  }, y = (a) => {
46
- const s = new URLSearchParams(n.toString());
47
- s.set(i, String(a)), o.push(`${f}?${s.toString()}`, { scroll: !1 });
46
+ const i = new URLSearchParams(r.toString());
47
+ i.set(s, String(a)), o.push(`${f}?${i.toString()}`, { scroll: !1 });
48
48
  };
49
- return /* @__PURE__ */ w("ul", { className: "flex items-center justify-center gap-4 font-medium", children: [
49
+ return /* @__PURE__ */ S("ul", { className: "flex items-center justify-center gap-4 font-medium", children: [
50
50
  /* @__PURE__ */ e("li", { className: "mr-2", children: /* @__PURE__ */ e(
51
51
  "button",
52
52
  {
@@ -55,29 +55,23 @@ function q({
55
55
  disabled: v,
56
56
  className: "inline-flex h-[42px] w-[42px] items-center justify-center rounded-[4px] bg-transparent p-[9px] text-gray-5 transition hover:bg-transparent hover:text-neutral-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
57
57
  onClick: () => N("prev"),
58
- children: /* @__PURE__ */ e(
59
- "span",
60
- {
61
- "aria-hidden": !0,
62
- className: "font-icon dpg-icons-arrow-line-left inline-block h-[24px] w-[24px] text-[24px] leading-[24px]"
63
- }
64
- )
58
+ children: /* @__PURE__ */ e(w, { name: "ArrowLineLeft" })
65
59
  }
66
60
  ) }),
67
- S.map((a, s) => {
68
- const p = a === "ellipsis", h = p ? void 0 : a, m = h === t, g = p || m, l = p ? "Pagination ellipsis" : `Go to page ${h}`;
61
+ P.map((a, i) => {
62
+ const g = a === "ellipsis", h = g ? void 0 : a, m = h === t, p = g || m, l = g ? "Pagination ellipsis" : `Go to page ${h}`;
69
63
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
70
64
  "button",
71
65
  {
72
66
  type: "button",
73
67
  "aria-label": l,
74
68
  "aria-current": m ? "page" : void 0,
75
- disabled: g,
76
- className: `flex h-[36px] w-[36px] items-center justify-center rounded-[4px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 ${m ? "bg-blue-1 text-blue-4" : ""} ${g ? "cursor-default" : "cursor-pointer hover:bg-gray-1"}`.trim(),
77
- onClick: !g && h ? () => y(h) : void 0,
78
- children: p ? "..." : h
69
+ disabled: p,
70
+ className: `flex h-[36px] w-[36px] items-center justify-center rounded-[4px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 ${m ? "bg-blue-1 text-blue-4" : ""} ${p ? "cursor-default" : "cursor-pointer hover:bg-gray-1"}`.trim(),
71
+ onClick: !p && h ? () => y(h) : void 0,
72
+ children: g ? "..." : h
79
73
  }
80
- ) }, `${a}-${s}`);
74
+ ) }, `${a}-${i}`);
81
75
  }),
82
76
  /* @__PURE__ */ e("li", { className: "ml-2", children: /* @__PURE__ */ e(
83
77
  "button",
@@ -87,45 +81,39 @@ function q({
87
81
  disabled: u,
88
82
  className: "inline-flex h-[42px] w-[42px] items-center justify-center rounded-[4px] bg-transparent p-[9px] text-gray-5 transition hover:bg-transparent hover:text-neutral-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-4 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
89
83
  onClick: () => N("next"),
90
- children: /* @__PURE__ */ e(
91
- "span",
92
- {
93
- "aria-hidden": !0,
94
- className: "font-icon dpg-icons-arrow-line-right inline-block h-[24px] w-[24px] text-[24px] leading-[24px]"
95
- }
96
- )
84
+ children: /* @__PURE__ */ e(w, { name: "ArrowLineRight" })
97
85
  }
98
86
  ) })
99
87
  ] });
100
88
  }
101
- function A({
89
+ function q({
102
90
  placeholder: c,
103
91
  className: b,
104
- inputWidth: i,
105
- value: n,
92
+ inputWidth: s,
93
+ value: r,
106
94
  onChange: f,
107
95
  syncToUrl: o = !0,
108
96
  id: x = "search",
109
97
  paramKey: d = "s"
110
98
  }) {
111
- const t = $(), r = k(), S = C(), v = L(null), u = n !== void 0, [N, y] = R(
112
- u ? n : t.get(d)?.toString() ?? ""
113
- ), a = u ? n : N, s = Math.max(c.length, 1), p = `calc(${s}ch + 60px)`, h = i === void 0 ? p : typeof i == "number" ? `${i}px` : i;
99
+ const t = C(), n = k(), P = L(), v = j(null), u = r !== void 0, [N, y] = R(
100
+ u ? r : t.get(d)?.toString() ?? ""
101
+ ), a = u ? r : N, i = Math.max(c.length, 1), g = `calc(${i}ch + 60px)`, h = s === void 0 ? g : typeof s == "number" ? `${s}px` : s;
114
102
  M(() => {
115
103
  !o || u || y(t.get(d)?.toString() ?? "");
116
104
  }, [u, d, t, o]);
117
- const m = (g) => {
105
+ const m = (p) => {
118
106
  if (!o) return;
119
107
  const l = new URLSearchParams(t.toString());
120
- g ? (l.set(d, g), l.delete("page")) : (l.delete(d), l.delete("page"));
121
- const P = l.toString();
122
- S.replace(P ? `${r}?${P}` : r);
108
+ p ? (l.set(d, p), l.delete("page")) : (l.delete(d), l.delete("page"));
109
+ const $ = l.toString();
110
+ P.replace($ ? `${n}?${$}` : n);
123
111
  };
124
- return /* @__PURE__ */ w("form", { className: b ?? "", noValidate: !0, children: [
112
+ return /* @__PURE__ */ S("form", { className: b ?? "", noValidate: !0, children: [
125
113
  /* @__PURE__ */ e("label", { className: "sr-only", htmlFor: x, children: "Search" }),
126
- /* @__PURE__ */ w("div", { className: "relative max-w-full", style: { width: h }, children: [
114
+ /* @__PURE__ */ S("div", { className: "relative max-w-full", style: { width: h }, children: [
127
115
  /* @__PURE__ */ e(
128
- j,
116
+ w,
129
117
  {
130
118
  name: "Magnifier",
131
119
  "aria-hidden": !0,
@@ -141,14 +129,14 @@ function A({
141
129
  color: "#000000",
142
130
  WebkitTextFillColor: "#000000"
143
131
  },
144
- size: s,
132
+ size: i,
145
133
  id: x,
146
134
  type: "search",
147
135
  autoComplete: "off",
148
136
  value: a,
149
137
  placeholder: c,
150
- onChange: (g) => {
151
- const l = g.target.value;
138
+ onChange: (p) => {
139
+ const l = p.target.value;
152
140
  u || y(l), f?.(l), m(l);
153
141
  }
154
142
  }
@@ -162,42 +150,36 @@ function A({
162
150
  onClick: () => {
163
151
  u || y(""), f?.(""), m(""), v.current?.focus();
164
152
  },
165
- children: /* @__PURE__ */ e(
166
- "span",
167
- {
168
- "aria-hidden": !0,
169
- className: "font-icon dpg-icons-close inline-block h-4 w-4 text-[16px] leading-4 text-gray-5"
170
- }
171
- )
153
+ children: /* @__PURE__ */ e(w, { name: "Close" })
172
154
  }
173
155
  )
174
156
  ] })
175
157
  ] });
176
158
  }
177
- function D({ columns: c, rows: b, rowKey: i }) {
178
- return /* @__PURE__ */ w("table", { className: "w-full table-auto border-y border-gray-2 text-gray-5", children: [
179
- /* @__PURE__ */ e("thead", { className: "font-bold", children: /* @__PURE__ */ e("tr", { children: c.map((n) => /* @__PURE__ */ e(
159
+ function D({ columns: c, rows: b, rowKey: s }) {
160
+ return /* @__PURE__ */ S("table", { className: "w-full table-auto border-y border-gray-2 text-gray-5", children: [
161
+ /* @__PURE__ */ e("thead", { className: "font-bold", children: /* @__PURE__ */ e("tr", { children: c.map((r) => /* @__PURE__ */ e(
180
162
  "td",
181
163
  {
182
- className: `px-3 py-4 ${n.headerClassName ?? ""}`.trim(),
183
- children: n.header
164
+ className: `px-3 py-4 ${r.headerClassName ?? ""}`.trim(),
165
+ children: r.header
184
166
  },
185
- n.key
167
+ r.key
186
168
  )) }) }),
187
- /* @__PURE__ */ e("tbody", { children: b.map((n, f) => /* @__PURE__ */ e("tr", { className: "border-t border-gray-2", children: c.map((o) => /* @__PURE__ */ e(
169
+ /* @__PURE__ */ e("tbody", { children: b.map((r, f) => /* @__PURE__ */ e("tr", { className: "border-t border-gray-2", children: c.map((o) => /* @__PURE__ */ e(
188
170
  "td",
189
171
  {
190
172
  className: `${o.cellClassName ?? "px-3 py-4"}`.trim(),
191
- children: o.render(n)
173
+ children: o.render(r)
192
174
  },
193
175
  o.key
194
- )) }, i(n, f))) })
176
+ )) }, s(r, f))) })
195
177
  ] });
196
178
  }
197
179
  export {
198
180
  T as Button,
199
- V as Logo,
200
- q as Pagination,
201
- A as Search,
181
+ E as Logo,
182
+ V as Pagination,
183
+ q as Search,
202
184
  D as Table
203
185
  };
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.1",
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",