@bison-lab/admin-ui 3.20.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/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # `@bison-lab/admin-ui`
2
+
3
+ Payload-free kit primitives for CMS field editors: type cards, confirm
4
+ dialogs, and the glyphs a rail uses. Field adapters in
5
+ `@bison-lab/payload-blocks/admin` (and later `@bison-lab/payload-core/admin`)
6
+ compose them and own `useField` / `useForm`.
7
+
8
+ The `.` entry does not import `payload` or `@payloadcms/ui`.
@@ -0,0 +1,53 @@
1
+
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import { ReactNode } from "react";
4
+
5
+ //#region src/confirm-dialog.d.ts
6
+ declare function ConfirmDialog({
7
+ open,
8
+ title,
9
+ children,
10
+ cancelLabel,
11
+ confirmLabel,
12
+ onCancel,
13
+ onConfirm
14
+ }: {
15
+ open: boolean;
16
+ title: string;
17
+ children: ReactNode;
18
+ cancelLabel: string;
19
+ confirmLabel: string;
20
+ onCancel: () => void;
21
+ onConfirm: () => void;
22
+ }): react_jsx_runtime0.JSX.Element | null;
23
+ //#endregion
24
+ //#region src/glyphs.d.ts
25
+ declare function LinkGlyph(): react_jsx_runtime0.JSX.Element;
26
+ declare function MegaGlyph(): react_jsx_runtime0.JSX.Element;
27
+ //#endregion
28
+ //#region src/type-cards.d.ts
29
+ declare function TypeCards({
30
+ compact,
31
+ children
32
+ }: {
33
+ compact?: boolean;
34
+ children: ReactNode;
35
+ }): react_jsx_runtime0.JSX.Element;
36
+ declare function TypeCard({
37
+ icon,
38
+ label,
39
+ description,
40
+ onClick,
41
+ active,
42
+ disabled
43
+ }: {
44
+ icon?: ReactNode;
45
+ label: string;
46
+ description?: string;
47
+ onClick: () => void;
48
+ active?: boolean;
49
+ disabled?: boolean;
50
+ }): react_jsx_runtime0.JSX.Element;
51
+ //#endregion
52
+ export { ConfirmDialog, LinkGlyph, MegaGlyph, TypeCard, TypeCards };
53
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/confirm-dialog.tsx","../src/glyphs.tsx","../src/type-cards.tsx"],"mappings":";;;;;iBAIgB,aAAA,CAAA;EACd,IAAA;EACA,KAAA;EACA,QAAA;EACA,WAAA;EACA,YAAA;EACA,QAAA;EACA;AAAA;EAEA,IAAA;EACA,KAAA;EACA,QAAA,EAAU,SAAA;EACV,WAAA;EACA,YAAA;EACA,QAAA;EACA,SAAA;AAAA,IACD,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCpBe,SAAA,CAAA,GAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAST,SAAA,CAAA,GAAS,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCLT,SAAA,CAAA;EACd,OAAA;EACA;AAAA;EAEA,OAAA;EACA,QAAA,EAAU,SAAA;AAAA,IACX,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBASe,QAAA,CAAA;EACd,IAAA;EACA,KAAA;EACA,WAAA;EACA,OAAA;EACA,MAAA;EACA;AAAA;EAEA,IAAA,GAAO,SAAA;EACP,KAAA;EACA,WAAA;EACA,OAAA;EACA,MAAA;EACA,QAAA;AAAA,IACD,kBAAA,CAAA,GAAA,CAAA,OAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ //#region src/styles.tsx
4
+ const CSS = `
5
+ .bl-nav-kit__types{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}
6
+ .bl-nav-kit__types--compact{margin:.5rem 0}
7
+ .bl-nav-kit__type{border:1px solid var(--theme-elevation-150);background:var(--theme-elevation-50);border-radius:8px;padding:.75rem;text-align:left;color:inherit;cursor:pointer;font:inherit}
8
+ .bl-nav-kit__type small{display:block;margin-top:.3rem;color:var(--theme-elevation-500);font-weight:400}
9
+ .bl-nav-kit__type-icon{display:grid;place-items:center;width:2rem;height:2rem;border-radius:7px;background:var(--theme-elevation-100);margin-bottom:.5rem}
10
+ .bl-nav-kit__type.is-active{border-color:var(--brand-primary,var(--theme-success-500));background:color-mix(in srgb,var(--brand-primary,var(--theme-success-500)) 12%,transparent)}
11
+ .bl-nav-kit__modal{position:fixed;inset:0;z-index:30;display:grid;place-items:center;background:var(--theme-overlay)}
12
+ .bl-nav-kit__modal-card{width:min(36rem,calc(100vw - 2rem));background:var(--theme-elevation-0);border:1px solid var(--theme-elevation-150);border-radius:12px;padding:1.25rem}
13
+ .bl-nav-kit__modal-card h2{margin:0 0 .75rem}
14
+ .bl-nav-kit__modal-card p{margin:0}
15
+ .bl-nav-kit__modal-actions{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1rem}
16
+ .bl-nav-kit__danger{color:var(--theme-error-500)}
17
+ `;
18
+ function KitStyles() {
19
+ return /* @__PURE__ */ jsx("style", {
20
+ href: "bl-admin-ui",
21
+ precedence: "default",
22
+ children: CSS
23
+ });
24
+ }
25
+ //#endregion
26
+ //#region src/confirm-dialog.tsx
27
+ function ConfirmDialog({ open, title, children, cancelLabel, confirmLabel, onCancel, onConfirm }) {
28
+ if (!open) return null;
29
+ return /* @__PURE__ */ jsxs("div", {
30
+ className: "bl-nav-kit__modal",
31
+ role: "dialog",
32
+ "aria-labelledby": "bl-admin-confirm-title",
33
+ children: [/* @__PURE__ */ jsx(KitStyles, {}), /* @__PURE__ */ jsxs("div", {
34
+ className: "bl-nav-kit__modal-card",
35
+ children: [
36
+ /* @__PURE__ */ jsx("h2", {
37
+ id: "bl-admin-confirm-title",
38
+ children: title
39
+ }),
40
+ /* @__PURE__ */ jsx("p", { children }),
41
+ /* @__PURE__ */ jsxs("div", {
42
+ className: "bl-nav-kit__modal-actions",
43
+ children: [/* @__PURE__ */ jsx("button", {
44
+ type: "button",
45
+ onClick: onCancel,
46
+ children: cancelLabel
47
+ }), /* @__PURE__ */ jsx("button", {
48
+ type: "button",
49
+ className: "bl-nav-kit__danger",
50
+ onClick: onConfirm,
51
+ children: confirmLabel
52
+ })]
53
+ })
54
+ ]
55
+ })]
56
+ });
57
+ }
58
+ //#endregion
59
+ //#region src/glyphs.tsx
60
+ function LinkGlyph() {
61
+ return /* @__PURE__ */ jsxs("svg", {
62
+ xmlns: "http://www.w3.org/2000/svg",
63
+ width: "16",
64
+ height: "16",
65
+ viewBox: "0 0 24 24",
66
+ fill: "none",
67
+ stroke: "currentColor",
68
+ strokeWidth: "2",
69
+ strokeLinecap: "round",
70
+ strokeLinejoin: "round",
71
+ children: [/* @__PURE__ */ jsx("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ jsx("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })]
72
+ });
73
+ }
74
+ function MegaGlyph() {
75
+ return /* @__PURE__ */ jsxs("svg", {
76
+ xmlns: "http://www.w3.org/2000/svg",
77
+ width: "16",
78
+ height: "16",
79
+ viewBox: "0 0 24 24",
80
+ fill: "none",
81
+ stroke: "currentColor",
82
+ strokeWidth: "2",
83
+ strokeLinecap: "round",
84
+ strokeLinejoin: "round",
85
+ children: [
86
+ /* @__PURE__ */ jsx("rect", {
87
+ width: "18",
88
+ height: "18",
89
+ x: "3",
90
+ y: "3",
91
+ rx: "2"
92
+ }),
93
+ /* @__PURE__ */ jsx("path", { d: "M9 3v18" }),
94
+ /* @__PURE__ */ jsx("path", { d: "M15 3v18" })
95
+ ]
96
+ });
97
+ }
98
+ //#endregion
99
+ //#region src/type-cards.tsx
100
+ function TypeCards({ compact, children }) {
101
+ return /* @__PURE__ */ jsxs("div", {
102
+ className: compact ? "bl-nav-kit__types bl-nav-kit__types--compact" : "bl-nav-kit__types",
103
+ children: [/* @__PURE__ */ jsx(KitStyles, {}), children]
104
+ });
105
+ }
106
+ function TypeCard({ icon, label, description, onClick, active, disabled }) {
107
+ return /* @__PURE__ */ jsxs("button", {
108
+ type: "button",
109
+ className: active ? "bl-nav-kit__type is-active" : "bl-nav-kit__type",
110
+ disabled,
111
+ onClick,
112
+ children: [
113
+ icon ? /* @__PURE__ */ jsx("span", {
114
+ className: "bl-nav-kit__type-icon",
115
+ "aria-hidden": true,
116
+ children: icon
117
+ }) : null,
118
+ label,
119
+ description ? /* @__PURE__ */ jsx("small", { children: description }) : null
120
+ ]
121
+ });
122
+ }
123
+ //#endregion
124
+ export { ConfirmDialog, LinkGlyph, MegaGlyph, TypeCard, TypeCards };
125
+
126
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/styles.tsx","../src/confirm-dialog.tsx","../src/glyphs.tsx","../src/type-cards.tsx"],"sourcesContent":["const CSS = `\n.bl-nav-kit__types{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}\n.bl-nav-kit__types--compact{margin:.5rem 0}\n.bl-nav-kit__type{border:1px solid var(--theme-elevation-150);background:var(--theme-elevation-50);border-radius:8px;padding:.75rem;text-align:left;color:inherit;cursor:pointer;font:inherit}\n.bl-nav-kit__type small{display:block;margin-top:.3rem;color:var(--theme-elevation-500);font-weight:400}\n.bl-nav-kit__type-icon{display:grid;place-items:center;width:2rem;height:2rem;border-radius:7px;background:var(--theme-elevation-100);margin-bottom:.5rem}\n.bl-nav-kit__type.is-active{border-color:var(--brand-primary,var(--theme-success-500));background:color-mix(in srgb,var(--brand-primary,var(--theme-success-500)) 12%,transparent)}\n.bl-nav-kit__modal{position:fixed;inset:0;z-index:30;display:grid;place-items:center;background:var(--theme-overlay)}\n.bl-nav-kit__modal-card{width:min(36rem,calc(100vw - 2rem));background:var(--theme-elevation-0);border:1px solid var(--theme-elevation-150);border-radius:12px;padding:1.25rem}\n.bl-nav-kit__modal-card h2{margin:0 0 .75rem}\n.bl-nav-kit__modal-card p{margin:0}\n.bl-nav-kit__modal-actions{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1rem}\n.bl-nav-kit__danger{color:var(--theme-error-500)}\n`;\n\nexport function KitStyles() {\n return (\n <style href=\"bl-admin-ui\" precedence=\"default\">\n {CSS}\n </style>\n );\n}\n","import type { ReactNode } from \"react\";\n\nimport { KitStyles } from \"./styles\";\n\nexport function ConfirmDialog({\n open,\n title,\n children,\n cancelLabel,\n confirmLabel,\n onCancel,\n onConfirm,\n}: {\n open: boolean;\n title: string;\n children: ReactNode;\n cancelLabel: string;\n confirmLabel: string;\n onCancel: () => void;\n onConfirm: () => void;\n}) {\n if (!open) return null;\n return (\n <div className=\"bl-nav-kit__modal\" role=\"dialog\" aria-labelledby=\"bl-admin-confirm-title\">\n <KitStyles />\n <div className=\"bl-nav-kit__modal-card\">\n <h2 id=\"bl-admin-confirm-title\">{title}</h2>\n <p>{children}</p>\n <div className=\"bl-nav-kit__modal-actions\">\n <button type=\"button\" onClick={onCancel}>\n {cancelLabel}\n </button>\n <button type=\"button\" className=\"bl-nav-kit__danger\" onClick={onConfirm}>\n {confirmLabel}\n </button>\n </div>\n </div>\n </div>\n );\n}\n","export function LinkGlyph() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\" />\n <path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\" />\n </svg>\n );\n}\n\nexport function MegaGlyph() {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" />\n <path d=\"M9 3v18\" />\n <path d=\"M15 3v18\" />\n </svg>\n );\n}\n","import type { ReactNode } from \"react\";\n\nimport { KitStyles } from \"./styles\";\n\nexport function TypeCards({\n compact,\n children,\n}: {\n compact?: boolean;\n children: ReactNode;\n}) {\n return (\n <div className={compact ? \"bl-nav-kit__types bl-nav-kit__types--compact\" : \"bl-nav-kit__types\"}>\n <KitStyles />\n {children}\n </div>\n );\n}\n\nexport function TypeCard({\n icon,\n label,\n description,\n onClick,\n active,\n disabled,\n}: {\n icon?: ReactNode;\n label: string;\n description?: string;\n onClick: () => void;\n active?: boolean;\n disabled?: boolean;\n}) {\n return (\n <button\n type=\"button\"\n className={active ? \"bl-nav-kit__type is-active\" : \"bl-nav-kit__type\"}\n disabled={disabled}\n onClick={onClick}\n >\n {icon ? (\n <span className=\"bl-nav-kit__type-icon\" aria-hidden>\n {icon}\n </span>\n ) : null}\n {label}\n {description ? <small>{description}</small> : null}\n </button>\n );\n}\n"],"mappings":";;;AAAA,MAAM,MAAM;;;;;;;;;;;;;;AAeZ,SAAgB,YAAY;AAC1B,QACE,oBAAC,SAAD;EAAO,MAAK;EAAc,YAAW;YAClC;EACK,CAAA;;;;ACfZ,SAAgB,cAAc,EAC5B,MACA,OACA,UACA,aACA,cACA,UACA,aASC;AACD,KAAI,CAAC,KAAM,QAAO;AAClB,QACE,qBAAC,OAAD;EAAK,WAAU;EAAoB,MAAK;EAAS,mBAAgB;YAAjE,CACE,oBAAC,WAAD,EAAa,CAAA,EACb,qBAAC,OAAD;GAAK,WAAU;aAAf;IACE,oBAAC,MAAD;KAAI,IAAG;eAA0B;KAAW,CAAA;IAC5C,oBAAC,KAAD,EAAI,UAAa,CAAA;IACjB,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,UAAD;MAAQ,MAAK;MAAS,SAAS;gBAC5B;MACM,CAAA,EACT,oBAAC,UAAD;MAAQ,MAAK;MAAS,WAAU;MAAqB,SAAS;gBAC3D;MACM,CAAA,CACL;;IACF;KACF;;;;;ACrCV,SAAgB,YAAY;AAC1B,QACE,qBAAC,OAAD;EAAK,OAAM;EAA6B,OAAM;EAAK,QAAO;EAAK,SAAQ;EAAY,MAAK;EAAO,QAAO;EAAe,aAAY;EAAI,eAAc;EAAQ,gBAAe;YAA1K,CACE,oBAAC,QAAD,EAAM,GAAE,+DAAgE,CAAA,EACxE,oBAAC,QAAD,EAAM,GAAE,gEAAiE,CAAA,CACrE;;;AAIV,SAAgB,YAAY;AAC1B,QACE,qBAAC,OAAD;EAAK,OAAM;EAA6B,OAAM;EAAK,QAAO;EAAK,SAAQ;EAAY,MAAK;EAAO,QAAO;EAAe,aAAY;EAAI,eAAc;EAAQ,gBAAe;YAA1K;GACE,oBAAC,QAAD;IAAM,OAAM;IAAK,QAAO;IAAK,GAAE;IAAI,GAAE;IAAI,IAAG;IAAM,CAAA;GAClD,oBAAC,QAAD,EAAM,GAAE,WAAY,CAAA;GACpB,oBAAC,QAAD,EAAM,GAAE,YAAa,CAAA;GACjB;;;;;ACXV,SAAgB,UAAU,EACxB,SACA,YAIC;AACD,QACE,qBAAC,OAAD;EAAK,WAAW,UAAU,iDAAiD;YAA3E,CACE,oBAAC,WAAD,EAAa,CAAA,EACZ,SACG;;;AAIV,SAAgB,SAAS,EACvB,MACA,OACA,aACA,SACA,QACA,YAQC;AACD,QACE,qBAAC,UAAD;EACE,MAAK;EACL,WAAW,SAAS,+BAA+B;EACzC;EACD;YAJX;GAMG,OACC,oBAAC,QAAD;IAAM,WAAU;IAAwB,eAAA;cACrC;IACI,CAAA,GACL;GACH;GACA,cAAc,oBAAC,SAAD,EAAA,UAAQ,aAAoB,CAAA,GAAG;GACvC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@bison-lab/admin-ui",
3
+ "version": "3.20.0",
4
+ "description": "Payload-free admin kit primitives for Bison Lab CMS fields",
5
+ "homepage": "https://components.bisonlab.ai",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Bison-Lab-LLC/bisonlab-component-library.git",
9
+ "directory": "packages/admin-ui"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/Bison-Lab-LLC/bisonlab-component-library/issues"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.mjs",
16
+ "types": "./dist/index.d.mts",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/index.mjs",
20
+ "types": "./dist/index.d.mts"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "peerDependencies": {
27
+ "react": "^18.0.0 || ^19.0.0",
28
+ "react-dom": "^18.0.0 || ^19.0.0"
29
+ },
30
+ "devDependencies": {
31
+ "@testing-library/react": "^16.3.2",
32
+ "@types/react": "^19.2.14",
33
+ "@types/react-dom": "^19.2.3",
34
+ "jsdom": "^29.0.1",
35
+ "react": "^19.2.4",
36
+ "react-dom": "^19.2.4",
37
+ "tsdown": "^0.21.0",
38
+ "typescript": "^5.9.3",
39
+ "vitest": "^4.1.2"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "scripts": {
45
+ "build": "tsdown",
46
+ "dev": "tsdown --watch",
47
+ "clean": "rm -rf dist",
48
+ "typecheck": "tsc --noEmit",
49
+ "test": "vitest run",
50
+ "test:watch": "vitest"
51
+ }
52
+ }