@pixstella/components 0.3.0 → 0.3.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.
- package/COPY-PASTE.md +109 -0
- package/README.md +9 -75
- package/dist/app/components/Dashboard/dashboardRegistry.cjs +1 -1
- package/dist/app/components/Dashboard/dashboardRegistry.mjs +202 -201
- package/dist/app/components/Table/DataTable.cjs +1 -1
- package/dist/app/components/Table/DataTable.mjs +46 -49
- package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.cjs +1 -1
- package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.mjs +53 -53
- package/dist/app/components/ai/ProposalCard/ProposalCard.cjs +1 -1
- package/dist/app/components/ai/ProposalCard/ProposalCard.mjs +227 -227
- package/dist/app/components/ai/ReviewTable/ReviewTable.cjs +1 -1
- package/dist/app/components/ai/ReviewTable/ReviewTable.mjs +81 -81
- package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.cjs +1 -1
- package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.mjs +15 -14
- package/dist/app/components/ui/AuthSection/AuthSection.cjs +1 -1
- package/dist/app/components/ui/AuthSection/AuthSection.mjs +19 -18
- package/dist/app/components/ui/Checkbox/Checkbox.cjs +1 -0
- package/dist/app/components/ui/Checkbox/Checkbox.css +1 -0
- package/dist/app/components/ui/Checkbox/Checkbox.mjs +87 -0
- package/dist/app/components/ui/DataGrid/DataGrid.cjs +1 -1
- package/dist/app/components/ui/DataGrid/DataGrid.mjs +196 -199
- package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.cjs +1 -1
- package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.mjs +47 -48
- package/dist/browser/pixstella.esm.js +70 -70
- package/dist/browser/pixstella.standalone.js +72 -72
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.mjs +2886 -2884
- package/dist/registry/files/174512e8f294ad2f +101 -0
- package/dist/registry/files/4c7e419c8caf02c3 +119 -0
- package/dist/registry/files/{f23e788832b45fc0 → 67ac8b4abe3fc564} +2 -1
- package/dist/registry/files/{e84f443f3fc3f261 → 995feaa023211faf} +4 -8
- package/dist/registry/files/{5ba71aa83263995e → a27872a7d58aeb58} +4 -5
- package/dist/registry/files/{162078d04cb26276 → df919b524be27e88} +4 -5
- package/dist/registry/index.json +1 -1
- package/dist/styles.css +3 -0
- package/package.json +3 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),t=require("react"),ie=require("../Dialog/Dialog.cjs"),g=require("../Button/Button.cjs");;/* empty css */const L=require("../Checkbox/Checkbox.cjs"),T={steps:["Change","Check and confirm"],stepOf:(n,o)=>`Step ${n} of ${o}`,cancel:"Cancel",preview:"Preview",previewing:"Preparing the preview…",back:"Back",confirm:"Confirm",confirming:"Saving…",errorTitle:"That didn’t work",retry:"Try again",include:n=>`Include ${n}`,includeAll:"Include all rows",includeColumn:"Include",includedCount:(n,o)=>`${n} of ${o} rows included`,nothingIncluded:"Include at least one row to confirm."},$=n=>n&&typeof n=="object"&&!t.isValidElement(n)&&Array.isArray(n.rows),q=n=>n==null?"":typeof n=="string"?n:n.message||String(n);function ne({open:n,onOpenChange:o,title:V,description:B,children:M,onPreview:O,onConfirm:F,previewDisabled:S=!1,requireIncluded:D=!0,closeOnConfirm:W=!0,labels:z,size:G="lg",fullScreenOnMobile:H=!0,tone:J,className:K=""}){const s={...T,...z},Q=t.useId().replace(/:/g,""),[p,b]=t.useState(1),[c,C]=t.useState(null),[v,y]=t.useState(()=>new Set),[d,u]=t.useState("idle"),[w,m]=t.useState(null),f=t.useRef(!0);t.useEffect(()=>()=>{f.current=!1},[]),t.useEffect(()=>{n&&(b(1),C(null),m(null),u("idle"))},[n]);const a=d!=="idle",I=async()=>{if(!(a||S)){m(null),u("previewing");try{const e=await O?.();if(!f.current)return;C(e??null),$(e)&&y(new Set(e.rows.filter(r=>r.included!==!1).map(r=>r.id))),b(2)}catch(e){f.current&&m({action:"preview",message:q(e)})}finally{f.current&&u("idle")}}},_=$(c),N=_?c.rows.filter(e=>v.has(e.id)).map(e=>e.id):[],x=_&&D&&N.length===0,E=async()=>{if(!(a||x)){m(null),u("confirming");try{if(await F?.({result:c,included:N}),!f.current)return;u("idle"),W&&o?.(!1)}catch(e){f.current&&(m({action:"confirm",message:q(e)}),u("idle"))}}},U=e=>y(r=>{const l=new Set(r);return l.has(e)?l.delete(e):l.add(e),l}),h=_?c.rows.filter(e=>!e.locked):[],k=h.length>0&&h.every(e=>v.has(e.id)),X=h.some(e=>v.has(e.id)),Y=()=>y(e=>{const r=new Set(e);for(const l of h)k?r.delete(l.id):r.add(l.id);return r}),R=`preview-confirm-form-${Q}`,P=s.steps,Z=i.jsx("div",{className:"preview-confirm__footer",children:p===1?i.jsxs(i.Fragment,{children:[i.jsx(g.default,{disabled:a,onClick:()=>o?.(!1),children:s.cancel}),i.jsx(g.default,{type:"submit",form:R,variant:"primary",disabled:a||S,loading:d==="previewing",loadingLabel:s.previewing,children:s.preview})]}):i.jsxs(i.Fragment,{children:[i.jsx(g.default,{icon:"arrow-left",disabled:a,onClick:()=>(m(null),b(1)),children:s.back}),i.jsx(g.default,{variant:J==="danger"?"danger":"primary",icon:d==="confirming"?i.jsx("span",{className:"dialog__spinner","aria-hidden":"true"}):void 0,disabled:a||x,"aria-busy":d==="confirming"||void 0,onClick:E,children:d==="confirming"?s.confirming:s.confirm})]})}),ee=w?i.jsxs("div",{className:"preview-confirm__error",role:"alert",children:[i.jsxs("div",{className:"preview-confirm__error-text",children:[s.errorTitle,w.message?i.jsx("span",{children:w.message}):null]}),i.jsx(g.default,{size:"sm",icon:"refresh",onClick:w.action==="preview"?I:E,disabled:a,children:s.retry})]}):null;return i.jsxs(ie.default,{open:n,onOpenChange:o,title:V,description:B,size:G,fullScreenOnMobile:H,pending:a,pendingLabel:d==="previewing"?s.previewing:s.confirming,footer:Z,className:`preview-confirm ${K}`.trim(),children:[i.jsx("ol",{className:"preview-confirm__steps","aria-label":s.stepOf(p,P.length),children:P.map((e,r)=>i.jsxs("li",{className:"preview-confirm__step","aria-current":p===r+1?"step":void 0,"data-done":p>r+1||void 0,children:[i.jsx("span",{className:"preview-confirm__step-num","aria-hidden":"true",children:r+1}),e]},r))}),ee,p===1?i.jsxs("form",{id:R,className:"preview-confirm__form",noValidate:!0,onSubmit:e=>{e.preventDefault(),I()},children:[i.jsx("fieldset",{disabled:a,className:"preview-confirm__fieldset",children:M}),d==="previewing"?i.jsxs("div",{className:"preview-confirm__loading",role:"status",children:[i.jsx("span",{className:"preview-confirm__spinner","aria-hidden":"true"}),s.previewing]}):null]}):_?i.jsxs("div",{children:[c.summary?i.jsx("div",{className:"preview-confirm__summary",children:c.summary}):null,i.jsx("div",{className:"preview-confirm__table-wrap",children:i.jsxs("table",{className:"preview-confirm__table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",className:"preview-confirm__check-cell",children:i.jsx(L.Checkbox,{className:"preview-confirm__check","aria-label":s.includeAll,checked:k,indeterminate:X&&!k,onChange:Y,disabled:a||!h.length})}),(c.columns??[]).map((e,r)=>{const l=typeof e=="object"&&e&&!t.isValidElement(e)?e:{label:e};return i.jsx("th",{scope:"col","data-align":l.align,children:l.label},r)})]})}),i.jsx("tbody",{children:c.rows.map(e=>{const r=v.has(e.id);return i.jsxs("tr",{"data-included":r,children:[i.jsx("td",{className:"preview-confirm__check-cell",children:i.jsx(L.Checkbox,{className:"preview-confirm__check","aria-label":s.include(e.label??String(e.id)),checked:r,disabled:a||e.locked,onChange:()=>U(e.id)})}),(e.cells??[]).map((l,A)=>{const j=c.columns?.[A];return i.jsx("td",{"data-align":j&&typeof j=="object"&&!t.isValidElement(j)?j.align:void 0,children:l},A)})]},e.id)})})]})}),i.jsx("p",{className:"preview-confirm__count","data-empty":x||void 0,"aria-live":"polite",children:x?s.nothingIncluded:s.includedCount(N.length,c.rows.length)})]}):i.jsx("div",{children:c})]})}exports.PREVIEW_CONFIRM_LABELS=T;exports.default=ne;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsxs as t, jsx as i, Fragment as T } from "react/jsx-runtime";
|
|
2
|
-
import { useId as
|
|
3
|
-
import
|
|
2
|
+
import { useId as le, useState as g, useRef as ce, useEffect as B, isValidElement as x } from "react";
|
|
3
|
+
import te from "../Dialog/Dialog.mjs";
|
|
4
4
|
import v from "../Button/Button.mjs";
|
|
5
5
|
import './PreviewConfirmDialog.css';/* empty css */
|
|
6
|
-
|
|
6
|
+
import { Checkbox as O } from "../Checkbox/Checkbox.mjs";
|
|
7
|
+
const ae = {
|
|
7
8
|
steps: ["Change", "Check and confirm"],
|
|
8
9
|
stepOf: (n, o) => `Step ${n} of ${o}`,
|
|
9
10
|
cancel: "Cancel",
|
|
@@ -19,25 +20,25 @@ const te = {
|
|
|
19
20
|
includeColumn: "Include",
|
|
20
21
|
includedCount: (n, o) => `${n} of ${o} rows included`,
|
|
21
22
|
nothingIncluded: "Include at least one row to confirm."
|
|
22
|
-
},
|
|
23
|
-
function
|
|
23
|
+
}, V = (n) => n && typeof n == "object" && !x(n) && Array.isArray(n.rows), D = (n) => n == null ? "" : typeof n == "string" ? n : n.message || String(n);
|
|
24
|
+
function pe({
|
|
24
25
|
open: n,
|
|
25
26
|
onOpenChange: o,
|
|
26
|
-
title:
|
|
27
|
-
description:
|
|
28
|
-
children:
|
|
29
|
-
onPreview:
|
|
30
|
-
onConfirm:
|
|
27
|
+
title: F,
|
|
28
|
+
description: M,
|
|
29
|
+
children: z,
|
|
30
|
+
onPreview: W,
|
|
31
|
+
onConfirm: q,
|
|
31
32
|
previewDisabled: $ = !1,
|
|
32
|
-
requireIncluded:
|
|
33
|
-
closeOnConfirm:
|
|
34
|
-
labels:
|
|
35
|
-
size:
|
|
36
|
-
fullScreenOnMobile:
|
|
37
|
-
tone:
|
|
38
|
-
className:
|
|
33
|
+
requireIncluded: G = !0,
|
|
34
|
+
closeOnConfirm: H = !0,
|
|
35
|
+
labels: J,
|
|
36
|
+
size: K = "lg",
|
|
37
|
+
fullScreenOnMobile: Q = !0,
|
|
38
|
+
tone: U,
|
|
39
|
+
className: X = ""
|
|
39
40
|
}) {
|
|
40
|
-
const l = { ...
|
|
41
|
+
const l = { ...ae, ...J }, Y = le().replace(/:/g, ""), [p, k] = g(1), [a, A] = g(null), [w, C] = g(() => /* @__PURE__ */ new Set()), [d, m] = g("idle"), [_, f] = g(null), u = ce(!0);
|
|
41
42
|
B(() => () => {
|
|
42
43
|
u.current = !1;
|
|
43
44
|
}, []), B(() => {
|
|
@@ -47,34 +48,34 @@ function fe({
|
|
|
47
48
|
if (!(s || $)) {
|
|
48
49
|
f(null), m("previewing");
|
|
49
50
|
try {
|
|
50
|
-
const e = await
|
|
51
|
+
const e = await W?.();
|
|
51
52
|
if (!u.current) return;
|
|
52
|
-
A(e ?? null),
|
|
53
|
+
A(e ?? null), V(e) && C(new Set(e.rows.filter((r) => r.included !== !1).map((r) => r.id))), k(2);
|
|
53
54
|
} catch (e) {
|
|
54
|
-
u.current && f({ action: "preview", message:
|
|
55
|
+
u.current && f({ action: "preview", message: D(e) });
|
|
55
56
|
} finally {
|
|
56
57
|
u.current && m("idle");
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
}, b =
|
|
60
|
+
}, b = V(a), I = b ? a.rows.filter((e) => w.has(e.id)).map((e) => e.id) : [], y = b && G && I.length === 0, P = async () => {
|
|
60
61
|
if (!(s || y)) {
|
|
61
62
|
f(null), m("confirming");
|
|
62
63
|
try {
|
|
63
|
-
if (await
|
|
64
|
-
m("idle"),
|
|
64
|
+
if (await q?.({ result: a, included: I }), !u.current) return;
|
|
65
|
+
m("idle"), H && o?.(!1);
|
|
65
66
|
} catch (e) {
|
|
66
|
-
u.current && (f({ action: "confirm", message:
|
|
67
|
+
u.current && (f({ action: "confirm", message: D(e) }), m("idle"));
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
},
|
|
70
|
+
}, Z = (e) => C((r) => {
|
|
70
71
|
const c = new Set(r);
|
|
71
72
|
return c.has(e) ? c.delete(e) : c.add(e), c;
|
|
72
|
-
}), h = b ? a.rows.filter((e) => !e.locked) : [], S = h.length > 0 && h.every((e) => w.has(e.id)),
|
|
73
|
+
}), h = b ? a.rows.filter((e) => !e.locked) : [], S = h.length > 0 && h.every((e) => w.has(e.id)), ee = h.some((e) => w.has(e.id)), ie = () => C((e) => {
|
|
73
74
|
const r = new Set(e);
|
|
74
75
|
for (const c of h)
|
|
75
76
|
S ? r.delete(c.id) : r.add(c.id);
|
|
76
77
|
return r;
|
|
77
|
-
}), R = `preview-confirm-form-${
|
|
78
|
+
}), R = `preview-confirm-form-${Y}`, j = l.steps, ne = /* @__PURE__ */ i("div", { className: "preview-confirm__footer", children: p === 1 ? /* @__PURE__ */ t(T, { children: [
|
|
78
79
|
/* @__PURE__ */ i(v, { disabled: s, onClick: () => o?.(!1), children: l.cancel }),
|
|
79
80
|
/* @__PURE__ */ i(v, { type: "submit", form: R, variant: "primary", disabled: s || $, loading: d === "previewing", loadingLabel: l.previewing, children: l.preview })
|
|
80
81
|
] }) : /* @__PURE__ */ t(T, { children: [
|
|
@@ -82,7 +83,7 @@ function fe({
|
|
|
82
83
|
/* @__PURE__ */ i(
|
|
83
84
|
v,
|
|
84
85
|
{
|
|
85
|
-
variant:
|
|
86
|
+
variant: U === "danger" ? "danger" : "primary",
|
|
86
87
|
icon: d === "confirming" ? /* @__PURE__ */ i("span", { className: "dialog__spinner", "aria-hidden": "true" }) : void 0,
|
|
87
88
|
disabled: s || y,
|
|
88
89
|
"aria-busy": d === "confirming" || void 0,
|
|
@@ -90,7 +91,7 @@ function fe({
|
|
|
90
91
|
children: d === "confirming" ? l.confirming : l.confirm
|
|
91
92
|
}
|
|
92
93
|
)
|
|
93
|
-
] }) }),
|
|
94
|
+
] }) }), re = _ ? /* @__PURE__ */ t("div", { className: "preview-confirm__error", role: "alert", children: [
|
|
94
95
|
/* @__PURE__ */ t("div", { className: "preview-confirm__error-text", children: [
|
|
95
96
|
l.errorTitle,
|
|
96
97
|
_.message ? /* @__PURE__ */ i("span", { children: _.message }) : null
|
|
@@ -98,24 +99,24 @@ function fe({
|
|
|
98
99
|
/* @__PURE__ */ i(v, { size: "sm", icon: "refresh", onClick: _.action === "preview" ? E : P, disabled: s, children: l.retry })
|
|
99
100
|
] }) : null;
|
|
100
101
|
return /* @__PURE__ */ t(
|
|
101
|
-
|
|
102
|
+
te,
|
|
102
103
|
{
|
|
103
104
|
open: n,
|
|
104
105
|
onOpenChange: o,
|
|
105
|
-
title:
|
|
106
|
-
description:
|
|
107
|
-
size:
|
|
108
|
-
fullScreenOnMobile:
|
|
106
|
+
title: F,
|
|
107
|
+
description: M,
|
|
108
|
+
size: K,
|
|
109
|
+
fullScreenOnMobile: Q,
|
|
109
110
|
pending: s,
|
|
110
111
|
pendingLabel: d === "previewing" ? l.previewing : l.confirming,
|
|
111
|
-
footer:
|
|
112
|
-
className: `preview-confirm ${
|
|
112
|
+
footer: ne,
|
|
113
|
+
className: `preview-confirm ${X}`.trim(),
|
|
113
114
|
children: [
|
|
114
115
|
/* @__PURE__ */ i("ol", { className: "preview-confirm__steps", "aria-label": l.stepOf(p, j.length), children: j.map((e, r) => /* @__PURE__ */ t("li", { className: "preview-confirm__step", "aria-current": p === r + 1 ? "step" : void 0, "data-done": p > r + 1 || void 0, children: [
|
|
115
116
|
/* @__PURE__ */ i("span", { className: "preview-confirm__step-num", "aria-hidden": "true", children: r + 1 }),
|
|
116
117
|
e
|
|
117
118
|
] }, r)) }),
|
|
118
|
-
|
|
119
|
+
re,
|
|
119
120
|
p === 1 ? /* @__PURE__ */ t(
|
|
120
121
|
"form",
|
|
121
122
|
{
|
|
@@ -126,7 +127,7 @@ function fe({
|
|
|
126
127
|
e.preventDefault(), E();
|
|
127
128
|
},
|
|
128
129
|
children: [
|
|
129
|
-
/* @__PURE__ */ i("fieldset", { disabled: s, className: "preview-confirm__fieldset", children:
|
|
130
|
+
/* @__PURE__ */ i("fieldset", { disabled: s, className: "preview-confirm__fieldset", children: z }),
|
|
130
131
|
d === "previewing" ? /* @__PURE__ */ t("div", { className: "preview-confirm__loading", role: "status", children: [
|
|
131
132
|
/* @__PURE__ */ i("span", { className: "preview-confirm__spinner", "aria-hidden": "true" }),
|
|
132
133
|
l.previewing
|
|
@@ -138,14 +139,13 @@ function fe({
|
|
|
138
139
|
/* @__PURE__ */ i("div", { className: "preview-confirm__table-wrap", children: /* @__PURE__ */ t("table", { className: "preview-confirm__table", children: [
|
|
139
140
|
/* @__PURE__ */ i("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
140
141
|
/* @__PURE__ */ i("th", { scope: "col", className: "preview-confirm__check-cell", children: /* @__PURE__ */ i(
|
|
141
|
-
|
|
142
|
+
O,
|
|
142
143
|
{
|
|
143
|
-
type: "checkbox",
|
|
144
144
|
className: "preview-confirm__check",
|
|
145
145
|
"aria-label": l.includeAll,
|
|
146
146
|
checked: S,
|
|
147
|
-
|
|
148
|
-
onChange:
|
|
147
|
+
indeterminate: ee && !S,
|
|
148
|
+
onChange: ie,
|
|
149
149
|
disabled: s || !h.length
|
|
150
150
|
}
|
|
151
151
|
) }),
|
|
@@ -158,14 +158,13 @@ function fe({
|
|
|
158
158
|
const r = w.has(e.id);
|
|
159
159
|
return /* @__PURE__ */ t("tr", { "data-included": r, children: [
|
|
160
160
|
/* @__PURE__ */ i("td", { className: "preview-confirm__check-cell", children: /* @__PURE__ */ i(
|
|
161
|
-
|
|
161
|
+
O,
|
|
162
162
|
{
|
|
163
|
-
type: "checkbox",
|
|
164
163
|
className: "preview-confirm__check",
|
|
165
164
|
"aria-label": l.include(e.label ?? String(e.id)),
|
|
166
165
|
checked: r,
|
|
167
166
|
disabled: s || e.locked,
|
|
168
|
-
onChange: () =>
|
|
167
|
+
onChange: () => Z(e.id)
|
|
169
168
|
}
|
|
170
169
|
) }),
|
|
171
170
|
(e.cells ?? []).map((c, L) => {
|
|
@@ -182,6 +181,6 @@ function fe({
|
|
|
182
181
|
);
|
|
183
182
|
}
|
|
184
183
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
ae as PREVIEW_CONFIRM_LABELS,
|
|
185
|
+
pe as default
|
|
187
186
|
};
|