@digitalpromise/design 2.0.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/logo.d.ts +6 -0
- package/dist/components/logo.d.ts.map +1 -0
- package/dist/components/pagination.d.ts +8 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/search.d.ts +13 -0
- package/dist/components/search.d.ts.map +1 -0
- package/dist/components/table.d.ts +16 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +205 -9
- package/dist/main.css +1 -1
- package/dist/shims/next-navigation.d.ts +11 -0
- package/dist/shims/next-navigation.d.ts.map +1 -0
- package/package.json +32 -25
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../src/components/logo.tsx"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAQtD,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,OAAiB,EACjB,SAAS,GACV,EAAE;IACD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,kDAcA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type PaginationProps = {
|
|
2
|
+
count: number;
|
|
3
|
+
limit: number;
|
|
4
|
+
pageParamKey?: string;
|
|
5
|
+
};
|
|
6
|
+
export default function Pagination({ count, limit, pageParamKey, }: PaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type SearchProps = {
|
|
2
|
+
placeholder: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
inputWidth?: number | string;
|
|
5
|
+
value?: string;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
syncToUrl?: boolean;
|
|
8
|
+
id?: string;
|
|
9
|
+
paramKey?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function Search({ placeholder, className, inputWidth, value, onChange, syncToUrl, id, paramKey, }: SearchProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/components/search.tsx"],"names":[],"mappings":"AAKA,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,2CA8Fb"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type TableColumn<TRow> = {
|
|
3
|
+
key: string;
|
|
4
|
+
header: string;
|
|
5
|
+
headerClassName?: string;
|
|
6
|
+
cellClassName?: string;
|
|
7
|
+
render: (row: TRow) => ReactNode;
|
|
8
|
+
};
|
|
9
|
+
type TableProps<TRow> = {
|
|
10
|
+
columns: TableColumn<TRow>[];
|
|
11
|
+
rows: TRow[];
|
|
12
|
+
rowKey: (row: TRow, index: number) => string;
|
|
13
|
+
};
|
|
14
|
+
export default function Table<TRow>({ columns, rows, rowKey }: TableProps<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,WAAW,CAAC,IAAI,IAAI;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC;CAClC,CAAC;AAEF,KAAK,UAAU,CAAC,IAAI,IAAI;IACtB,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;IAC7B,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9C,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,IAAI,CAAC,2CA+B9E"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("next/navigation"),S=require("react");function $({className:l,variant:u="primary",state:n="default",...t}){const p=[u,n].map(a=>"btn-"+a).join(" ");return e.jsx("button",{className:`btn ${p} ${l??""}`.trim(),...t})}const 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:l="color",className:u}){const n=k.get(l);return n===void 0?null:e.jsx("img",{src:n,width:186,height:36,alt:"Badge Engine",className:u})}function R({count:l,limit:u,pageParamKey:n="page"}){const t=m.useSearchParams(),p=m.usePathname(),a=m.useRouter(),v=t.get(n),x=v?Number.parseInt(v,10):Number.NaN,s=Number.isFinite(x)?x:1,r=Math.max(1,Math.ceil(l/u)),w=r<=7?Array.from({length:r},(i,o)=>o+1):s<=4?[1,2,3,4,5,"ellipsis",r]:s>=r-3?[1,"ellipsis",r-4,r-3,r-2,r-1,r]:[1,"ellipsis",s-1,s,s+1,"ellipsis",r],y=s===1,d=s===r,N=i=>{if(y&&i==="prev"||d&&i==="next")return;const o=i==="prev"?s-1:s+1,g=new URLSearchParams(t.toString());g.set(n,String(o)),a.push(`${p}?${g.toString()}`,{scroll:!1})},j=i=>{const o=new URLSearchParams(t.toString());o.set(n,String(i)),a.push(`${p}?${o.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((i,o)=>{const g=i==="ellipsis",h=g?void 0:i,f=h===s,b=g||f,c=g?"Pagination ellipsis":`Go to page ${h}`;return e.jsx("li",{children:e.jsx("button",{type:"button","aria-label":c,"aria-current":f?"page":void 0,disabled:b,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":""} ${b?"cursor-default":"cursor-pointer hover:bg-gray-1"}`.trim(),onClick:!b&&h?()=>j(h):void 0,children:g?"...":h})},`${i}-${o}`)}),e.jsx("li",{className:"ml-2",children:e.jsx("button",{type:"button","aria-label":"Next page",disabled:d,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:l,className:u,inputWidth:n,value:t,onChange:p,syncToUrl:a=!0,id:v="search",paramKey:x="s"}){const s=m.useSearchParams(),r=m.usePathname(),w=m.useRouter(),y=S.useRef(null),d=t!==void 0,[N,j]=S.useState(d?t:s.get(x)?.toString()??""),i=d?t:N,o=Math.max(l.length,1),g=`calc(${o}ch + 60px)`,h=n===void 0?g:typeof n=="number"?`${n}px`:n;S.useEffect(()=>{!a||d||j(s.get(x)?.toString()??"")},[d,x,s,a]);const f=b=>{if(!a)return;const c=new URLSearchParams(s.toString());b?(c.set(x,b),c.delete("page")):(c.delete(x),c.delete("page"));const P=c.toString();w.replace(P?`${r}?${P}`:r)};return e.jsxs("form",{className:u??"",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("span",{"aria-hidden":!0,className:"absolute left-[15px] top-1/2 z-10 -translate-y-1/2 font-icon dpg-icons-magnifier inline-block h-6 w-6 text-[24px] leading-[24px] text-gray-5"}),e.jsx("input",{ref:y,className:"hide-search-clear block w-full max-w-full rounded-[4px] bg-white py-[11px] pl-[15px] pr-[40px] text-base leading-6 indent-[30px] outline outline-1 outline-gray-5 transition focus:outline-2 focus:outline-blue-4",style:{color:"#000000",WebkitTextFillColor:"#000000"},size:o,id:v,type:"search",autoComplete:"off",value:i,placeholder:l,onChange:b=>{const c=b.target.value;d||j(c),p?.(c),f(c)}}),i.length>0&&e.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute right-[4px] 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:()=>{d||j(""),p?.(""),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-[16px] text-gray-5"})})]})]})}function M({columns:l,rows:u,rowKey:n}){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:l.map(t=>e.jsx("td",{className:`px-3 py-4 ${t.headerClassName??""}`.trim(),children:t.header},t.key))})}),e.jsx("tbody",{children:u.map((t,p)=>e.jsx("tr",{className:"border-t border-gray-2",children:l.map(a=>e.jsx("td",{className:`${a.cellClassName??"px-3 py-4"}`.trim(),children:a.render(t)},a.key))},n(t,p)))})]})}exports.Button=$;exports.Logo=C;exports.Pagination=R;exports.Search=L;exports.Table=M;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { default as Button } from "./components/button";
|
|
2
|
-
|
|
2
|
+
import { default as Logo } from "./components/logo";
|
|
3
|
+
import { default as Pagination } from "./components/pagination";
|
|
4
|
+
import { default as Search } from "./components/search";
|
|
5
|
+
import { default as Table } from "./components/table";
|
|
6
|
+
export type { TableColumn } from "./components/table";
|
|
7
|
+
export { Button, Logo, Pagination, Search, Table };
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,209 @@
|
|
|
1
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as e, jsxs as w } from "react/jsx-runtime";
|
|
2
|
+
import { useSearchParams as $, usePathname as k, useRouter as C } from "next/navigation";
|
|
3
|
+
import { useRef as j, useState as L, useEffect as R } from "react";
|
|
4
|
+
function B({
|
|
5
|
+
className: l,
|
|
6
|
+
variant: u = "primary",
|
|
7
|
+
state: n = "default",
|
|
8
|
+
...t
|
|
7
9
|
}) {
|
|
8
|
-
const
|
|
9
|
-
return /* @__PURE__ */ e("button", { className: `btn ${
|
|
10
|
+
const p = [u, n].map((a) => "btn-" + a).join(" ");
|
|
11
|
+
return /* @__PURE__ */ e("button", { className: `btn ${p} ${l ?? ""}`.trim(), ...t });
|
|
12
|
+
}
|
|
13
|
+
const z = /* @__PURE__ */ new Map([
|
|
14
|
+
["black", "/primary-badge-engine-logo-black.svg"],
|
|
15
|
+
["white", "/primary-badge-engine-logo-white.svg"],
|
|
16
|
+
["color", "/primary-badge-engine-logo-color.svg"]
|
|
17
|
+
]);
|
|
18
|
+
function I({
|
|
19
|
+
variant: l = "color",
|
|
20
|
+
className: u
|
|
21
|
+
}) {
|
|
22
|
+
const n = z.get(l);
|
|
23
|
+
return n === void 0 ? null : /* @__PURE__ */ e(
|
|
24
|
+
"img",
|
|
25
|
+
{
|
|
26
|
+
src: n,
|
|
27
|
+
width: 186,
|
|
28
|
+
height: 36,
|
|
29
|
+
alt: "Badge Engine",
|
|
30
|
+
className: u
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function V({
|
|
35
|
+
count: l,
|
|
36
|
+
limit: u,
|
|
37
|
+
pageParamKey: n = "page"
|
|
38
|
+
}) {
|
|
39
|
+
const t = $(), p = k(), a = C(), x = t.get(n), b = x ? Number.parseInt(x, 10) : Number.NaN, r = Number.isFinite(b) ? b : 1, i = Math.max(1, Math.ceil(l / u)), S = i <= 7 ? Array.from({ length: i }, (s, o) => o + 1) : r <= 4 ? [1, 2, 3, 4, 5, "ellipsis", i] : r >= i - 3 ? [1, "ellipsis", i - 4, i - 3, i - 2, i - 1, i] : [
|
|
40
|
+
1,
|
|
41
|
+
"ellipsis",
|
|
42
|
+
r - 1,
|
|
43
|
+
r,
|
|
44
|
+
r + 1,
|
|
45
|
+
"ellipsis",
|
|
46
|
+
i
|
|
47
|
+
], v = r === 1, d = r === i, N = (s) => {
|
|
48
|
+
if (v && s === "prev" || d && s === "next")
|
|
49
|
+
return;
|
|
50
|
+
const o = s === "prev" ? r - 1 : r + 1, g = new URLSearchParams(t.toString());
|
|
51
|
+
g.set(n, String(o)), a.push(`${p}?${g.toString()}`, { scroll: !1 });
|
|
52
|
+
}, y = (s) => {
|
|
53
|
+
const o = new URLSearchParams(t.toString());
|
|
54
|
+
o.set(n, String(s)), a.push(`${p}?${o.toString()}`, { scroll: !1 });
|
|
55
|
+
};
|
|
56
|
+
return /* @__PURE__ */ w("ul", { className: "flex items-center justify-center gap-4 font-medium", children: [
|
|
57
|
+
/* @__PURE__ */ e("li", { className: "mr-2", children: /* @__PURE__ */ e(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
"aria-label": "Previous page",
|
|
62
|
+
disabled: v,
|
|
63
|
+
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",
|
|
64
|
+
onClick: () => N("prev"),
|
|
65
|
+
children: /* @__PURE__ */ e(
|
|
66
|
+
"span",
|
|
67
|
+
{
|
|
68
|
+
"aria-hidden": !0,
|
|
69
|
+
className: "font-icon dpg-icons-arrow-line-left inline-block h-[24px] w-[24px] text-[24px] leading-[24px]"
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
) }),
|
|
74
|
+
S.map((s, o) => {
|
|
75
|
+
const g = s === "ellipsis", h = g ? void 0 : s, m = h === r, f = g || m, c = g ? "Pagination ellipsis" : `Go to page ${h}`;
|
|
76
|
+
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
77
|
+
"button",
|
|
78
|
+
{
|
|
79
|
+
type: "button",
|
|
80
|
+
"aria-label": c,
|
|
81
|
+
"aria-current": m ? "page" : void 0,
|
|
82
|
+
disabled: f,
|
|
83
|
+
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" : ""} ${f ? "cursor-default" : "cursor-pointer hover:bg-gray-1"}`.trim(),
|
|
84
|
+
onClick: !f && h ? () => y(h) : void 0,
|
|
85
|
+
children: g ? "..." : h
|
|
86
|
+
}
|
|
87
|
+
) }, `${s}-${o}`);
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ e("li", { className: "ml-2", children: /* @__PURE__ */ e(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
"aria-label": "Next page",
|
|
94
|
+
disabled: d,
|
|
95
|
+
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",
|
|
96
|
+
onClick: () => N("next"),
|
|
97
|
+
children: /* @__PURE__ */ e(
|
|
98
|
+
"span",
|
|
99
|
+
{
|
|
100
|
+
"aria-hidden": !0,
|
|
101
|
+
className: "font-icon dpg-icons-arrow-line-right inline-block h-[24px] w-[24px] text-[24px] leading-[24px]"
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
) })
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
function q({
|
|
109
|
+
placeholder: l,
|
|
110
|
+
className: u,
|
|
111
|
+
inputWidth: n,
|
|
112
|
+
value: t,
|
|
113
|
+
onChange: p,
|
|
114
|
+
syncToUrl: a = !0,
|
|
115
|
+
id: x = "search",
|
|
116
|
+
paramKey: b = "s"
|
|
117
|
+
}) {
|
|
118
|
+
const r = $(), i = k(), S = C(), v = j(null), d = t !== void 0, [N, y] = L(
|
|
119
|
+
d ? t : r.get(b)?.toString() ?? ""
|
|
120
|
+
), s = d ? t : N, o = Math.max(l.length, 1), g = `calc(${o}ch + 60px)`, h = n === void 0 ? g : typeof n == "number" ? `${n}px` : n;
|
|
121
|
+
R(() => {
|
|
122
|
+
!a || d || y(r.get(b)?.toString() ?? "");
|
|
123
|
+
}, [d, b, r, a]);
|
|
124
|
+
const m = (f) => {
|
|
125
|
+
if (!a) return;
|
|
126
|
+
const c = new URLSearchParams(r.toString());
|
|
127
|
+
f ? (c.set(b, f), c.delete("page")) : (c.delete(b), c.delete("page"));
|
|
128
|
+
const P = c.toString();
|
|
129
|
+
S.replace(P ? `${i}?${P}` : i);
|
|
130
|
+
};
|
|
131
|
+
return /* @__PURE__ */ w("form", { className: u ?? "", noValidate: !0, children: [
|
|
132
|
+
/* @__PURE__ */ e("label", { className: "sr-only", htmlFor: x, children: "Search" }),
|
|
133
|
+
/* @__PURE__ */ w("div", { className: "relative max-w-full", style: { width: h }, children: [
|
|
134
|
+
/* @__PURE__ */ e(
|
|
135
|
+
"span",
|
|
136
|
+
{
|
|
137
|
+
"aria-hidden": !0,
|
|
138
|
+
className: "absolute left-[15px] top-1/2 z-10 -translate-y-1/2 font-icon dpg-icons-magnifier inline-block h-6 w-6 text-[24px] leading-[24px] text-gray-5"
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ e(
|
|
142
|
+
"input",
|
|
143
|
+
{
|
|
144
|
+
ref: v,
|
|
145
|
+
className: "hide-search-clear block w-full max-w-full rounded-[4px] bg-white py-[11px] pl-[15px] pr-[40px] text-base leading-6 indent-[30px] outline outline-1 outline-gray-5 transition focus:outline-2 focus:outline-blue-4",
|
|
146
|
+
style: {
|
|
147
|
+
color: "#000000",
|
|
148
|
+
WebkitTextFillColor: "#000000"
|
|
149
|
+
},
|
|
150
|
+
size: o,
|
|
151
|
+
id: x,
|
|
152
|
+
type: "search",
|
|
153
|
+
autoComplete: "off",
|
|
154
|
+
value: s,
|
|
155
|
+
placeholder: l,
|
|
156
|
+
onChange: (f) => {
|
|
157
|
+
const c = f.target.value;
|
|
158
|
+
d || y(c), p?.(c), m(c);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
s.length > 0 && /* @__PURE__ */ e(
|
|
163
|
+
"button",
|
|
164
|
+
{
|
|
165
|
+
type: "button",
|
|
166
|
+
"aria-label": "Clear search",
|
|
167
|
+
className: "absolute right-[4px] 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",
|
|
168
|
+
onClick: () => {
|
|
169
|
+
d || y(""), p?.(""), m(""), v.current?.focus();
|
|
170
|
+
},
|
|
171
|
+
children: /* @__PURE__ */ e(
|
|
172
|
+
"span",
|
|
173
|
+
{
|
|
174
|
+
"aria-hidden": !0,
|
|
175
|
+
className: "font-icon dpg-icons-close inline-block h-4 w-4 text-[16px] leading-[16px] text-gray-5"
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
] })
|
|
181
|
+
] });
|
|
182
|
+
}
|
|
183
|
+
function A({ columns: l, rows: u, rowKey: n }) {
|
|
184
|
+
return /* @__PURE__ */ w("table", { className: "w-full table-auto border-y border-gray-2 text-gray-5", children: [
|
|
185
|
+
/* @__PURE__ */ e("thead", { className: "font-bold", children: /* @__PURE__ */ e("tr", { children: l.map((t) => /* @__PURE__ */ e(
|
|
186
|
+
"td",
|
|
187
|
+
{
|
|
188
|
+
className: `px-3 py-4 ${t.headerClassName ?? ""}`.trim(),
|
|
189
|
+
children: t.header
|
|
190
|
+
},
|
|
191
|
+
t.key
|
|
192
|
+
)) }) }),
|
|
193
|
+
/* @__PURE__ */ e("tbody", { children: u.map((t, p) => /* @__PURE__ */ e("tr", { className: "border-t border-gray-2", children: l.map((a) => /* @__PURE__ */ e(
|
|
194
|
+
"td",
|
|
195
|
+
{
|
|
196
|
+
className: `${a.cellClassName ?? "px-3 py-4"}`.trim(),
|
|
197
|
+
children: a.render(t)
|
|
198
|
+
},
|
|
199
|
+
a.key
|
|
200
|
+
)) }, n(t, p))) })
|
|
201
|
+
] });
|
|
10
202
|
}
|
|
11
203
|
export {
|
|
12
|
-
|
|
204
|
+
B as Button,
|
|
205
|
+
I as Logo,
|
|
206
|
+
V as Pagination,
|
|
207
|
+
q as Search,
|
|
208
|
+
A as Table
|
|
13
209
|
};
|
package/dist/main.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@theme{--color-*: initial; --text-*: initial; --spacing-*: initial;}@theme{ --color-gray-1: #f4f4f4; --color-gray-2: #e6e6e6; --color-gray-3: #a3a3a3; --color-gray-4: #777777; --color-gray-5: #454545; --color-blue-1: #ebf4fa; --color-blue-2: #cce3f2; --color-blue-3: #348ec7; --color-blue-4: #2a7aac; --color-blue-5: #246289; --color-indigo-1: #eef2f9; --color-indigo-2: #d2d8ec; --color-indigo-3: #5a71b9; --color-indigo-4: #465da5; --color-indigo-5: #3a4d88; --color-purple-1: #f1eef6; --color-purple-2: #ddd5e9; --color-purple-3: #8164af; --color-purple-4: #6d509b; --color-purple-5: #5a4280; --color-violet-1: #f5eef6; --color-violet-2: #e6d5ea; --color-violet-3: #9a55aa; --color-violet-4: #81488e; --color-violet-5: #693a73; --color-magenta-1: #f6eef4; --color-magenta-2: #ead5e3; --color-magenta-3: #aa558e; --color-magenta-4: #8f4777; --color-magenta-5: #743a61; --color-red-1: #fcede8; --color-red-2: #f8d2c7; --color-red-3: #e45a2f; --color-red-4: #d0451b; --color-red-5: #ab3916; --color-orange-1: #fcf2e8; --color-orange-2: #f8dfc6; --color-orange-3: #e3811c; --color-orange-4: #c86400; --color-orange-5: #9e5000; --color-green-1: #f5f9eb; --color-green-2: #e6f1cd; --color-green-3: #82a82f; --color-green-4: #698826; --color-green-5: #50681d; --color-jade-1: #eef7f1; --color-jade-2: #d4eadd; --color-jade-3: #4e9d6d; --color-jade-4: #40815a; --color-jade-5: #336647; --color-teal-1: #eaf8fb; --color-teal-2: #caeef4; --color-teal-3: #259cb2; --color-teal-4: #1e7e90; --color-teal-5: #17616e; --color-neutral-1: #ffffff; --color-neutral-2: rgba(0, 0, 0, .08); --color-neutral-3: rgba(0, 0, 0, .15); --color-neutral-4: rgba(0, 0, 0, .45); --color-neutral-5: #000000; --color-primary: #2a7aac; --color-primary-hover: #ebf4fa; --color-danger: #d0451b; --color-danger-hover: #ab3916; --color-disabled: #a3a3a3; --text-small: .875rem; --text-medium: 1rem; --text-medium-large: 1.25rem; --text-large: 1.5rem; --text-x-large: 2rem; --text-xx-large: 3rem; --text-xxx-large: 4rem; --text-base: 1rem; --spacing-0: 0; --spacing-1: .25rem; --spacing-2: .5rem; --spacing-3: .75rem; --spacing-4: 1rem; --spacing-5: 1.5rem; --spacing-6: 2rem; --spacing-7: 3rem; --spacing-8: 4rem; --spacing-9: 5rem; --spacing-10: 6rem; --spacing-11: 15rem; --spacing-12: 22.5rem; }@layer components{.btn{@apply transition cursor-pointer font-semibold px-[1.375rem] py-[.625rem] rounded-3xl disabled:opacity-50;}.btn-primary{@apply bg-blue-3 border-2 border-blue-3 leading-5 text-neutral-1 hover:border-blue-4 hover:bg-blue-4 disabled:border-blue-3 disabled:bg-blue-3;}.btn-primary.btn-danger{@apply border-red-3 bg-red-3 text-neutral-1 hover:border-red-4 hover:bg-red-4;}.btn-primary.btn-inverse{@apply bg-neutral-1 text-blue-4 hover:bg-blue-1 hover:border-blue-5 hover:text-blue-5;}.btn-primary.btn-decolor{@apply border-gray-5 bg-gray-5 text-neutral-1 hover:border-neutral-5 hover:bg-neutral-5;}.btn-secondary{@apply bg-neutral-1 border-2 border-blue-3 text-blue-4 hover:border-blue-4 hover:bg-blue-1 hover:text-blue-5;}.btn-secondary.btn-danger{@apply border-red-3 text-red-3 hover:border-red-4 hover:text-red-4 hover:bg-red-1;}.btn-secondary.btn-inverse{@apply border-neutral-1 text-neutral-1 bg-indigo-3 hover:bg-indigo-4;}.btn-secondary.btn-decolor{@apply text-gray-5 border-gray-5 hover:text-neutral-5 hover:border-neutral-5 hover:bg-gray-1;}.btn-tertiary{@apply px-0 py-3 text-blue-4 underline hover:text-blue-5;}.btn-tertiary.btn-danger{@apply text-red-4 hover:text-red-5;}.btn-tertiary.btn-inverse{@apply text-neutral-1 hover:text-gray-1;}.btn-tertiary.btn-decolor{@apply text-gray-5 hover:text-neutral-5;}}
|
|
1
|
+
@theme{--color-*: initial; --text-*: initial; --spacing-*: initial;}@theme{ --color-gray-1: #f4f4f4; --color-gray-2: #e6e6e6; --color-gray-3: #a3a3a3; --color-gray-4: #777777; --color-gray-5: #454545; --color-blue-1: #ebf4fa; --color-blue-2: #cce3f2; --color-blue-3: #348ec7; --color-blue-4: #2a7aac; --color-blue-5: #246289; --color-indigo-1: #eef2f9; --color-indigo-2: #d2d8ec; --color-indigo-3: #5a71b9; --color-indigo-4: #465da5; --color-indigo-5: #3a4d88; --color-purple-1: #f1eef6; --color-purple-2: #ddd5e9; --color-purple-3: #8164af; --color-purple-4: #6d509b; --color-purple-5: #5a4280; --color-violet-1: #f5eef6; --color-violet-2: #e6d5ea; --color-violet-3: #9a55aa; --color-violet-4: #81488e; --color-violet-5: #693a73; --color-magenta-1: #f6eef4; --color-magenta-2: #ead5e3; --color-magenta-3: #aa558e; --color-magenta-4: #8f4777; --color-magenta-5: #743a61; --color-red-1: #fcede8; --color-red-2: #f8d2c7; --color-red-3: #e45a2f; --color-red-4: #d0451b; --color-red-5: #ab3916; --color-orange-1: #fcf2e8; --color-orange-2: #f8dfc6; --color-orange-3: #e3811c; --color-orange-4: #c86400; --color-orange-5: #9e5000; --color-green-1: #f5f9eb; --color-green-2: #e6f1cd; --color-green-3: #82a82f; --color-green-4: #698826; --color-green-5: #50681d; --color-jade-1: #eef7f1; --color-jade-2: #d4eadd; --color-jade-3: #4e9d6d; --color-jade-4: #40815a; --color-jade-5: #336647; --color-teal-1: #eaf8fb; --color-teal-2: #caeef4; --color-teal-3: #259cb2; --color-teal-4: #1e7e90; --color-teal-5: #17616e; --color-neutral-1: #ffffff; --color-neutral-2: rgba(0, 0, 0, .08); --color-neutral-3: rgba(0, 0, 0, .15); --color-neutral-4: rgba(0, 0, 0, .45); --color-neutral-5: #000000; --color-primary: #2a7aac; --color-primary-hover: #ebf4fa; --color-danger: #d0451b; --color-danger-hover: #ab3916; --color-disabled: #a3a3a3; --text-small: .875rem; --text-medium: 1rem; --text-medium-large: 1.25rem; --text-large: 1.5rem; --text-x-large: 2rem; --text-xx-large: 3rem; --text-xxx-large: 4rem; --text-base: 1rem; --spacing-0: 0; --spacing-1: .25rem; --spacing-2: .5rem; --spacing-3: .75rem; --spacing-4: 1rem; --spacing-5: 1.5rem; --spacing-6: 2rem; --spacing-7: 3rem; --spacing-8: 4rem; --spacing-9: 5rem; --spacing-10: 6rem; --spacing-11: 15rem; --spacing-12: 22.5rem; }@layer components{.btn{@apply transition cursor-pointer font-semibold px-[1.375rem] py-[.625rem] rounded-3xl disabled:opacity-50;}.btn-primary{@apply bg-blue-3 border-2 border-blue-3 leading-5 text-neutral-1 hover:border-blue-4 hover:bg-blue-4 disabled:border-blue-3 disabled:bg-blue-3;}.btn-primary.btn-danger{@apply border-red-3 bg-red-3 text-neutral-1 hover:border-red-4 hover:bg-red-4;}.btn-primary.btn-inverse{@apply bg-neutral-1 text-blue-4 hover:bg-blue-1 hover:border-blue-5 hover:text-blue-5;}.btn-primary.btn-decolor{@apply border-gray-5 bg-gray-5 text-neutral-1 hover:border-neutral-5 hover:bg-neutral-5;}.btn-secondary{@apply bg-neutral-1 border-2 border-blue-3 text-blue-4 hover:border-blue-4 hover:bg-blue-1 hover:text-blue-5;}.btn-secondary.btn-danger{@apply border-red-3 text-red-3 hover:border-red-4 hover:text-red-4 hover:bg-red-1;}.btn-secondary.btn-inverse{@apply border-neutral-1 text-neutral-1 bg-indigo-3 hover:bg-indigo-4;}.btn-secondary.btn-decolor{@apply text-gray-5 border-gray-5 hover:text-neutral-5 hover:border-neutral-5 hover:bg-gray-1;}.btn-tertiary{@apply px-0 py-3 text-blue-4 underline hover:text-blue-5;}.btn-tertiary.btn-danger{@apply text-red-4 hover:text-red-5;}.btn-tertiary.btn-inverse{@apply text-neutral-1 hover:text-gray-1;}.btn-tertiary.btn-decolor{@apply text-gray-5 hover:text-neutral-5;}}@utility hide-search-clear{&::-webkit-search-cancel-button,&::-webkit-search-decoration {-webkit-appearance: none; appearance: none;} &::-ms-clear {display: none;}}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type NavigateOptions = {
|
|
2
|
+
scroll?: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare function usePathname(): string;
|
|
5
|
+
export declare function useSearchParams(): URLSearchParams;
|
|
6
|
+
export declare function useRouter(): {
|
|
7
|
+
push(href: string, options?: NavigateOptions): void;
|
|
8
|
+
replace(href: string, options?: NavigateOptions): void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=next-navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-navigation.d.ts","sourceRoot":"","sources":["../../src/shims/next-navigation.ts"],"names":[],"mappings":"AAEA,KAAK,eAAe,GAAG;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA4BF,wBAAgB,WAAW,WAE1B;AAED,wBAAgB,eAAe,oBAI9B;AAED,wBAAgB,SAAS;eAEV,MAAM,YAAY,eAAe;kBAS9B,MAAM,YAAY,eAAe;EAUlD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalpromise/design",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -9,39 +9,46 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@chromatic-com/storybook": "^4.1.
|
|
13
|
-
"@
|
|
14
|
-
"@
|
|
15
|
-
"@storybook/addon-
|
|
16
|
-
"@storybook/
|
|
17
|
-
"@
|
|
18
|
-
"@
|
|
19
|
-
"@testing-library/
|
|
12
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
13
|
+
"@digitalpromise/icons": "1.4.0",
|
|
14
|
+
"@eslint/js": "^9.39.3",
|
|
15
|
+
"@storybook/addon-docs": "^9.1.19",
|
|
16
|
+
"@storybook/addon-links": "^9.1.19",
|
|
17
|
+
"@storybook/react-vite": "^9.1.19",
|
|
18
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
19
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
20
|
+
"@testing-library/react": "^16.3.2",
|
|
20
21
|
"@types/jest": "^30.0.0",
|
|
21
|
-
"@types/react": "^19.
|
|
22
|
-
"@types/react-dom": "^19.
|
|
23
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
24
|
-
"@typescript-eslint/parser": "^8.
|
|
25
|
-
"@vitejs/plugin-react-swc": "^4.
|
|
26
|
-
"eslint": "^9.
|
|
22
|
+
"@types/react": "^19.2.14",
|
|
23
|
+
"@types/react-dom": "^19.2.3",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
25
|
+
"@typescript-eslint/parser": "^8.56.1",
|
|
26
|
+
"@vitejs/plugin-react-swc": "^4.2.3",
|
|
27
|
+
"eslint": "^9.39.3",
|
|
27
28
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
28
|
-
"eslint-plugin-storybook": "^9.1.
|
|
29
|
-
"jsdom": "^27.
|
|
30
|
-
"react": "^19.
|
|
31
|
-
"react-dom": "^19.
|
|
32
|
-
"storybook": "^9.1.
|
|
33
|
-
"style-dictionary": "^5.
|
|
34
|
-
"tailwindcss": "^4.1
|
|
35
|
-
"typescript": "^5.9.
|
|
36
|
-
"typescript-eslint": "^8.
|
|
37
|
-
"vite": "^7.1
|
|
29
|
+
"eslint-plugin-storybook": "^9.1.19",
|
|
30
|
+
"jsdom": "^27.4.0",
|
|
31
|
+
"react": "^19.2.4",
|
|
32
|
+
"react-dom": "^19.2.4",
|
|
33
|
+
"storybook": "^9.1.19",
|
|
34
|
+
"style-dictionary": "^5.3.2",
|
|
35
|
+
"tailwindcss": "^4.2.1",
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
|
+
"typescript-eslint": "^8.56.1",
|
|
38
|
+
"vite": "^7.3.1",
|
|
38
39
|
"vitest": "^3.2.4"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
42
|
+
"next": "^16.0.0",
|
|
41
43
|
"react": "^19.1.1",
|
|
42
44
|
"react-dom": "^19.1.1",
|
|
43
45
|
"tailwindcss": "^4.1.13"
|
|
44
46
|
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"next": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
45
52
|
"scripts": {
|
|
46
53
|
"postinstall": "npm run build",
|
|
47
54
|
"style-dictionary": "style-dictionary build",
|