@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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
.px-checkbox {
|
|
2
|
+
--px-checkbox-accent: var(--px-accent, var(--chart-series-1, var(--px-accent, #1a56db)));
|
|
3
|
+
--px-checkbox-size: 18px;
|
|
4
|
+
--px-checkbox-on: var(--color-surface-solid, var(--color-surface));
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-grid;
|
|
7
|
+
flex: none;
|
|
8
|
+
width: var(--px-checkbox-size);
|
|
9
|
+
height: var(--px-checkbox-size);
|
|
10
|
+
vertical-align: middle;
|
|
11
|
+
}
|
|
12
|
+
.px-checkbox--sm {
|
|
13
|
+
--px-checkbox-size: 15px;
|
|
14
|
+
}
|
|
15
|
+
.px-checkbox--lg {
|
|
16
|
+
--px-checkbox-size: 22px;
|
|
17
|
+
}
|
|
18
|
+
.px-checkbox__input {
|
|
19
|
+
position: absolute;
|
|
20
|
+
inset: 0;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
margin: 0;
|
|
24
|
+
opacity: 0;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
z-index: 1;
|
|
27
|
+
}
|
|
28
|
+
.px-checkbox__box {
|
|
29
|
+
display: grid;
|
|
30
|
+
place-items: center;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
border: 1.5px solid color-mix(in srgb, var(--color-text-faint, #9ca3af) 70%, var(--color-border, #d1d5db));
|
|
35
|
+
border-radius: calc(var(--px-checkbox-size) * 0.28);
|
|
36
|
+
background: var(--color-surface, #fff);
|
|
37
|
+
color: transparent;
|
|
38
|
+
transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
|
|
39
|
+
}
|
|
40
|
+
.px-checkbox__box svg {
|
|
41
|
+
width: 70%;
|
|
42
|
+
height: 70%;
|
|
43
|
+
transform: scale(0.6);
|
|
44
|
+
opacity: 0;
|
|
45
|
+
transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.1s ease;
|
|
46
|
+
}
|
|
47
|
+
.px-checkbox:hover:not(.px-checkbox--disabled):not(.px-checkbox--on) .px-checkbox__box {
|
|
48
|
+
border-color: var(--color-text-muted, #6b7280);
|
|
49
|
+
}
|
|
50
|
+
.px-checkbox--on .px-checkbox__box {
|
|
51
|
+
border-color: var(--px-checkbox-accent);
|
|
52
|
+
background: var(--px-checkbox-accent);
|
|
53
|
+
color: var(--px-checkbox-on);
|
|
54
|
+
}
|
|
55
|
+
.px-checkbox--on .px-checkbox__box svg {
|
|
56
|
+
transform: none;
|
|
57
|
+
opacity: 1;
|
|
58
|
+
}
|
|
59
|
+
.px-checkbox__input:focus-visible + .px-checkbox__box {
|
|
60
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--px-checkbox-accent) 30%, transparent);
|
|
61
|
+
}
|
|
62
|
+
.px-checkbox--invalid .px-checkbox__box {
|
|
63
|
+
border-color: var(--color-danger, #e11d48);
|
|
64
|
+
}
|
|
65
|
+
.px-checkbox--disabled {
|
|
66
|
+
opacity: 0.5;
|
|
67
|
+
}
|
|
68
|
+
.px-checkbox--disabled .px-checkbox__input {
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
}
|
|
71
|
+
@media (prefers-reduced-motion: reduce) {
|
|
72
|
+
.px-checkbox__box, .px-checkbox__box svg {
|
|
73
|
+
transition: none;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.px-checkbox-field {
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: flex-start;
|
|
80
|
+
gap: 10px;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
color: var(--color-text-primary);
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
line-height: 1.4;
|
|
85
|
+
}
|
|
86
|
+
.px-checkbox-field .px-checkbox {
|
|
87
|
+
margin-top: 1px;
|
|
88
|
+
}
|
|
89
|
+
.px-checkbox-field__text {
|
|
90
|
+
display: grid;
|
|
91
|
+
gap: 2px;
|
|
92
|
+
min-width: 0;
|
|
93
|
+
}
|
|
94
|
+
.px-checkbox-field__description {
|
|
95
|
+
color: var(--color-text-secondary);
|
|
96
|
+
font-size: 13px;
|
|
97
|
+
}
|
|
98
|
+
.px-checkbox-field--disabled {
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
color: var(--color-text-muted);
|
|
101
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { forwardRef, useCallback, useEffect, useId, useRef, useState } from "react";
|
|
2
|
+
import PxCheck from "./Check.jsx";
|
|
3
|
+
import PxMinus from "./Minus.jsx";
|
|
4
|
+
import "./Checkbox.css";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A checkbox drawn with Pixstella tokens over a real <input type="checkbox">,
|
|
8
|
+
* so Space, form posting, `name`/`value`, labels and screen readers work as
|
|
9
|
+
* usual. Drop-in for a native checkbox: every other prop (aria-label, name,
|
|
10
|
+
* value, onBlur…) goes to the input, and `ref` is the input.
|
|
11
|
+
*
|
|
12
|
+
* With `label` (and optional `description`) it renders its own <label>; without
|
|
13
|
+
* one it renders just the box, for use inside your own <label> or a table cell.
|
|
14
|
+
*/
|
|
15
|
+
const Checkbox = forwardRef(function Checkbox(
|
|
16
|
+
{
|
|
17
|
+
checked,
|
|
18
|
+
defaultChecked,
|
|
19
|
+
onChange,
|
|
20
|
+
onCheckedChange,
|
|
21
|
+
indeterminate,
|
|
22
|
+
disabled = false,
|
|
23
|
+
invalid = false,
|
|
24
|
+
label,
|
|
25
|
+
description,
|
|
26
|
+
size = "md",
|
|
27
|
+
tone,
|
|
28
|
+
id,
|
|
29
|
+
className = "",
|
|
30
|
+
style,
|
|
31
|
+
...inputProps
|
|
32
|
+
},
|
|
33
|
+
ref
|
|
34
|
+
) {
|
|
35
|
+
const autoId = useId();
|
|
36
|
+
const inputId = id ?? (label ? `px-checkbox-${autoId}` : undefined);
|
|
37
|
+
const descId = description ? `${inputId ?? autoId}-desc` : undefined;
|
|
38
|
+
const inner = useRef(null);
|
|
39
|
+
const setRef = useCallback(
|
|
40
|
+
(el) => {
|
|
41
|
+
inner.current = el;
|
|
42
|
+
if (typeof ref === "function") ref(el);
|
|
43
|
+
else if (ref) ref.current = el;
|
|
44
|
+
},
|
|
45
|
+
[ref]
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const controlled = checked !== undefined;
|
|
49
|
+
const [own, setOwn] = useState(Boolean(defaultChecked));
|
|
50
|
+
const isOn = controlled ? Boolean(checked) : own;
|
|
51
|
+
|
|
52
|
+
// Only when the prop is given, so code that sets `el.indeterminate` through
|
|
53
|
+
// the ref (as with a native checkbox) keeps working.
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (inner.current && indeterminate !== undefined) inner.current.indeterminate = Boolean(indeterminate);
|
|
56
|
+
}, [indeterminate]);
|
|
57
|
+
|
|
58
|
+
const handleChange = (e) => {
|
|
59
|
+
if (!controlled) setOwn(e.target.checked);
|
|
60
|
+
onChange?.(e);
|
|
61
|
+
onCheckedChange?.(e.target.checked, e);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const box = (
|
|
65
|
+
<span
|
|
66
|
+
className={[
|
|
67
|
+
"px-checkbox",
|
|
68
|
+
`px-checkbox--${size === "sm" ? "sm" : size === "lg" ? "lg" : "md"}`,
|
|
69
|
+
(isOn || indeterminate) && "px-checkbox--on",
|
|
70
|
+
disabled && "px-checkbox--disabled",
|
|
71
|
+
invalid && "px-checkbox--invalid",
|
|
72
|
+
!label && className,
|
|
73
|
+
]
|
|
74
|
+
.filter(Boolean)
|
|
75
|
+
.join(" ")}
|
|
76
|
+
style={{ ...(tone ? { "--px-checkbox-accent": tone } : null), ...(!label ? style : null) }}
|
|
77
|
+
>
|
|
78
|
+
<input
|
|
79
|
+
ref={setRef}
|
|
80
|
+
type="checkbox"
|
|
81
|
+
id={inputId}
|
|
82
|
+
className="px-checkbox__input"
|
|
83
|
+
checked={controlled ? Boolean(checked) : undefined}
|
|
84
|
+
defaultChecked={controlled ? undefined : defaultChecked}
|
|
85
|
+
onChange={handleChange}
|
|
86
|
+
disabled={disabled}
|
|
87
|
+
aria-invalid={invalid || undefined}
|
|
88
|
+
aria-describedby={descId}
|
|
89
|
+
aria-checked={indeterminate ? "mixed" : undefined}
|
|
90
|
+
{...inputProps}
|
|
91
|
+
/>
|
|
92
|
+
<span className="px-checkbox__box" aria-hidden="true">
|
|
93
|
+
{indeterminate ? <PxMinus trim size={12} strokeWidth={3} /> : <PxCheck trim size={12} strokeWidth={3} />}
|
|
94
|
+
</span>
|
|
95
|
+
</span>
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
if (!label) return box;
|
|
99
|
+
return (
|
|
100
|
+
<label
|
|
101
|
+
htmlFor={inputId}
|
|
102
|
+
className={["px-checkbox-field", disabled && "px-checkbox-field--disabled", className].filter(Boolean).join(" ")}
|
|
103
|
+
style={style}
|
|
104
|
+
>
|
|
105
|
+
{box}
|
|
106
|
+
<span className="px-checkbox-field__text">
|
|
107
|
+
<span className="px-checkbox-field__label">{label}</span>
|
|
108
|
+
{description ? (
|
|
109
|
+
<span id={descId} className="px-checkbox-field__description">
|
|
110
|
+
{description}
|
|
111
|
+
</span>
|
|
112
|
+
) : null}
|
|
113
|
+
</span>
|
|
114
|
+
</label>
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export default Checkbox;
|
|
119
|
+
export { Checkbox };
|
|
@@ -8,6 +8,7 @@ import "./AuthSection.css";
|
|
|
8
8
|
import PxStar from "./Star.jsx";
|
|
9
9
|
import PxEye from "./Eye.jsx";
|
|
10
10
|
import PxEyeOff from "./EyeOff.jsx";
|
|
11
|
+
import Checkbox from "./Checkbox.jsx";
|
|
11
12
|
|
|
12
13
|
export const AUTH_VARIANTS = ["split", "centered", "minimal"];
|
|
13
14
|
export const AUTH_MODES = ["signin", "signup"];
|
|
@@ -248,7 +249,7 @@ export default function AuthSection({
|
|
|
248
249
|
{!up && rememberLabel ? (
|
|
249
250
|
<div className="auth-section__row">
|
|
250
251
|
<label className="auth-section__check">
|
|
251
|
-
<
|
|
252
|
+
<Checkbox name="remember" defaultChecked />
|
|
252
253
|
<span data-edit="rememberLabel">{rememberLabel}</span>
|
|
253
254
|
</label>
|
|
254
255
|
</div>
|
|
@@ -13,6 +13,7 @@ import PxArrowUp from "./ArrowUp.jsx";
|
|
|
13
13
|
import PxArrowUpRight from "./ArrowUpRight.jsx";
|
|
14
14
|
import PxChevronDown from "./ChevronDown.jsx";
|
|
15
15
|
import PxClose from "./Close.jsx";
|
|
16
|
+
import PxCheckbox from "./Checkbox.jsx";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* DataGrid: a fully declarative table. Every prop is JSON-serialisable, so it
|
|
@@ -346,17 +347,12 @@ function Cell({ col, row, index }) {
|
|
|
346
347
|
}
|
|
347
348
|
|
|
348
349
|
function Checkbox({ checked, indeterminate, onChange, label }) {
|
|
349
|
-
const ref = useRef(null);
|
|
350
|
-
useEffect(() => {
|
|
351
|
-
if (ref.current) ref.current.indeterminate = !!indeterminate;
|
|
352
|
-
}, [indeterminate]);
|
|
353
350
|
return (
|
|
354
|
-
<
|
|
355
|
-
|
|
356
|
-
type="checkbox"
|
|
351
|
+
<PxCheckbox
|
|
352
|
+
size="sm"
|
|
357
353
|
className="data-grid__check"
|
|
358
354
|
checked={!!checked}
|
|
359
|
-
|
|
355
|
+
indeterminate={!!indeterminate}
|
|
360
356
|
aria-label={label}
|
|
361
357
|
onChange={onChange}
|
|
362
358
|
onClick={(e) => e.stopPropagation()}
|
|
@@ -2,6 +2,7 @@ import { isValidElement, useEffect, useId, useRef, useState } from "react";
|
|
|
2
2
|
import Dialog from "./Dialog.jsx";
|
|
3
3
|
import Button from "./Button.jsx";
|
|
4
4
|
import "./PreviewConfirmDialog.css";
|
|
5
|
+
import Checkbox from "./Checkbox.jsx";
|
|
5
6
|
|
|
6
7
|
export const PREVIEW_CONFIRM_LABELS = {
|
|
7
8
|
steps: ["Change", "Check and confirm"],
|
|
@@ -228,12 +229,11 @@ export default function PreviewConfirmDialog({
|
|
|
228
229
|
<thead>
|
|
229
230
|
<tr>
|
|
230
231
|
<th scope="col" className="preview-confirm__check-cell">
|
|
231
|
-
<
|
|
232
|
-
type="checkbox"
|
|
232
|
+
<Checkbox
|
|
233
233
|
className="preview-confirm__check"
|
|
234
234
|
aria-label={L.includeAll}
|
|
235
235
|
checked={allOn}
|
|
236
|
-
|
|
236
|
+
indeterminate={someOn && !allOn}
|
|
237
237
|
onChange={toggleAll}
|
|
238
238
|
disabled={pending || !toggleable.length}
|
|
239
239
|
/>
|
|
@@ -254,8 +254,7 @@ export default function PreviewConfirmDialog({
|
|
|
254
254
|
return (
|
|
255
255
|
<tr key={row.id} data-included={on}>
|
|
256
256
|
<td className="preview-confirm__check-cell">
|
|
257
|
-
<
|
|
258
|
-
type="checkbox"
|
|
257
|
+
<Checkbox
|
|
259
258
|
className="preview-confirm__check"
|
|
260
259
|
aria-label={L.include(row.label ?? String(row.id))}
|
|
261
260
|
checked={on}
|
|
@@ -5,6 +5,7 @@ import IconButton from "./IconButton.jsx";
|
|
|
5
5
|
import './DataTable.css'
|
|
6
6
|
import PxChevronLeft from "./ChevronLeft.jsx";
|
|
7
7
|
import PxChevronRight from "./ChevronRight.jsx";
|
|
8
|
+
import Checkbox from "./Checkbox.jsx";
|
|
8
9
|
|
|
9
10
|
function renderHeader(column) {
|
|
10
11
|
if (typeof column.header === 'function') return column.header()
|
|
@@ -41,19 +42,17 @@ export function DataTable({
|
|
|
41
42
|
id: '__select',
|
|
42
43
|
width: '3rem',
|
|
43
44
|
header: () => (
|
|
44
|
-
<
|
|
45
|
-
type="checkbox"
|
|
45
|
+
<Checkbox
|
|
46
46
|
className="dt-checkbox"
|
|
47
47
|
checked={selection.isAllSelected}
|
|
48
|
-
|
|
48
|
+
indeterminate={selection.isIndeterminate}
|
|
49
49
|
onChange={selection.toggleAll}
|
|
50
50
|
aria-label="Select all"
|
|
51
51
|
/>
|
|
52
52
|
),
|
|
53
53
|
cell: (row) => (
|
|
54
54
|
<div onClick={(e) => e.stopPropagation()}>
|
|
55
|
-
<
|
|
56
|
-
type="checkbox"
|
|
55
|
+
<Checkbox
|
|
57
56
|
className="dt-checkbox"
|
|
58
57
|
checked={selection.isSelected(getRowId(row))}
|
|
59
58
|
onChange={() => selection.toggleRow(getRowId(row))}
|