@unofficialbox/box-open-elements 0.10.0 → 0.11.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/feedback/alert.js +1 -16
- package/dist/components/feedback/path.d.ts +84 -0
- package/dist/components/feedback/path.js +455 -0
- package/dist/components/feedback/skeleton.d.ts +70 -0
- package/dist/components/feedback/skeleton.js +231 -1
- package/dist/components/feedback/toast.d.ts +38 -0
- package/dist/components/feedback/toast.js +189 -13
- package/dist/components/feedback/tone.d.ts +16 -0
- package/dist/components/feedback/tone.js +31 -0
- package/dist/components/layout/grid.d.ts +41 -0
- package/dist/components/layout/grid.js +152 -0
- package/dist/element-maps.d.ts +5 -3
- package/dist/entries/grid.d.ts +1 -0
- package/dist/entries/grid.js +1 -0
- package/dist/entries/path.d.ts +1 -0
- package/dist/entries/path.js +1 -0
- package/dist/foundations/layout/grid.d.ts +70 -0
- package/dist/foundations/layout/grid.js +84 -0
- package/dist/foundations/layout/index.d.ts +1 -0
- package/dist/foundations/layout/index.js +3 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -1
- package/dist/patterns/audit/audit-log.js +0 -1
- package/dist/patterns/lineage/lineage-graph.d.ts +7 -0
- package/dist/patterns/lineage/lineage-graph.js +67 -6
- package/dist/patterns/lineage/provenance-strip.js +106 -15
- package/dist/patterns/notifications/notification-inbox.js +2 -18
- package/dist/patterns/timeline/timeline.js +44 -12
- package/dist/patterns/versions/graph-arrows.d.ts +22 -0
- package/dist/patterns/versions/graph-arrows.js +13 -0
- package/dist/patterns/versions/index.d.ts +1 -0
- package/dist/patterns/versions/index.js +1 -0
- package/dist/patterns/versions/version-graph.d.ts +7 -0
- package/dist/patterns/versions/version-graph.js +54 -6
- package/package.json +1 -1
- package/dist/components/feedback/stage-path.d.ts +0 -44
- package/dist/components/feedback/stage-path.js +0 -235
- package/dist/entries/stage-path.d.ts +0 -1
- package/dist/entries/stage-path.js +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { BaseElement } from "../../core/index.js";
|
|
2
|
-
/** One point in a record's lifecycle. */
|
|
3
|
-
export interface StagePathStage {
|
|
4
|
-
id: string;
|
|
5
|
-
label: string;
|
|
6
|
-
/** Optional detail shown under the label on the current stage. */
|
|
7
|
-
description?: string;
|
|
8
|
-
}
|
|
9
|
-
export type StageState = "complete" | "current" | "upcoming";
|
|
10
|
-
/** Attribute payloads are author input — validate every record. */
|
|
11
|
-
export declare const isStagePathStageRecord: (value: unknown) => value is StagePathStage;
|
|
12
|
-
/** State of each stage relative to the current one. */
|
|
13
|
-
export declare const resolveStageStates: (stages: readonly StagePathStage[], currentId: string) => StageState[];
|
|
14
|
-
/**
|
|
15
|
-
* Horizontal chevron lifecycle tracker for record headers — Draft → In
|
|
16
|
-
* Review → Approved → Executed.
|
|
17
|
-
*
|
|
18
|
-
* Distinct from `box-progress-steps`, which is a vertical setup rail for a
|
|
19
|
-
* task the reader is working through: this states where a *record* sits in
|
|
20
|
-
* its lifecycle, is read-only, and belongs in a header rather than a form.
|
|
21
|
-
*
|
|
22
|
-
* Rendered as an ordered list with the current stage marked `aria-current`,
|
|
23
|
-
* so the sequence and the position are both available without relying on the
|
|
24
|
-
* chevron geometry — which is decoration, and collapses on narrow viewports.
|
|
25
|
-
*/
|
|
26
|
-
export declare class StagePath extends BaseElement {
|
|
27
|
-
static readonly tagName: string;
|
|
28
|
-
static get observedAttributes(): string[];
|
|
29
|
-
private pathEl;
|
|
30
|
-
private stagesRaw;
|
|
31
|
-
private stagesCache;
|
|
32
|
-
get label(): string;
|
|
33
|
-
set label(value: string);
|
|
34
|
-
/** Id of the stage the record is at. An unknown id leaves every stage upcoming. */
|
|
35
|
-
get current(): string;
|
|
36
|
-
set current(value: string);
|
|
37
|
-
get stages(): StagePathStage[];
|
|
38
|
-
set stages(value: StagePathStage[]);
|
|
39
|
-
/** State of each stage, in order. */
|
|
40
|
-
get states(): StageState[];
|
|
41
|
-
protected renderTemplate(): void;
|
|
42
|
-
protected setupListeners(): void;
|
|
43
|
-
protected update(): void;
|
|
44
|
-
}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { BaseElement } from "../../core/index.js";
|
|
2
|
-
import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
|
|
3
|
-
const DEFAULT_TAG_NAME = "box-stage-path";
|
|
4
|
-
const escapeHtml = (value) => value
|
|
5
|
-
.replaceAll("&", "&")
|
|
6
|
-
.replaceAll("<", "<")
|
|
7
|
-
.replaceAll(">", ">")
|
|
8
|
-
.replaceAll('"', """)
|
|
9
|
-
.replaceAll("'", "'");
|
|
10
|
-
/** Attribute payloads are author input — validate every record. */
|
|
11
|
-
export const isStagePathStageRecord = (value) => {
|
|
12
|
-
if (typeof value !== "object" || value === null) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
const stage = value;
|
|
16
|
-
return (typeof stage.id === "string" &&
|
|
17
|
-
stage.id.length > 0 &&
|
|
18
|
-
typeof stage.label === "string" &&
|
|
19
|
-
stage.label.length > 0);
|
|
20
|
-
};
|
|
21
|
-
/** State of each stage relative to the current one. */
|
|
22
|
-
export const resolveStageStates = (stages, currentId) => {
|
|
23
|
-
const index = stages.findIndex(stage => stage.id === currentId);
|
|
24
|
-
// An unknown current id means nothing is complete — better than silently
|
|
25
|
-
// marking the whole path done because the host sent a stale value.
|
|
26
|
-
return stages.map((_, position) => index === -1
|
|
27
|
-
? "upcoming"
|
|
28
|
-
: position < index
|
|
29
|
-
? "complete"
|
|
30
|
-
: position === index
|
|
31
|
-
? "current"
|
|
32
|
-
: "upcoming");
|
|
33
|
-
};
|
|
34
|
-
const elementStyles = `
|
|
35
|
-
:host {
|
|
36
|
-
display: block;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
[part="path"] {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-wrap: wrap;
|
|
42
|
-
margin: 0;
|
|
43
|
-
padding: 0;
|
|
44
|
-
list-style: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
[part="stage"] {
|
|
48
|
-
position: relative;
|
|
49
|
-
flex: 1 1 0;
|
|
50
|
-
min-inline-size: 6rem;
|
|
51
|
-
padding: 0.45rem 0.7rem 0.45rem 1.35rem;
|
|
52
|
-
background: var(--boe-token-surface-surface-hover, #f4f4f4);
|
|
53
|
-
color: var(--boe-token-text-text-secondary, #6f6f6f);
|
|
54
|
-
font-size: 0.82rem;
|
|
55
|
-
transition: background ${boeMotionDuration.interactive} ${boeMotionEasing.standard};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
[part="stage"]:first-child {
|
|
59
|
-
padding-inline-start: 0.8rem;
|
|
60
|
-
border-start-start-radius: 999px;
|
|
61
|
-
border-end-start-radius: 999px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
[part="stage"]:last-child {
|
|
65
|
-
border-start-end-radius: 999px;
|
|
66
|
-
border-end-end-radius: 999px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* The chevron: a notch cut from the following stage plus an arrow on
|
|
70
|
-
this one, so the path reads as a directed sequence rather than a row
|
|
71
|
-
of pills. Drawn with clip-path so no extra elements are needed. */
|
|
72
|
-
[part="stage"]:not(:last-child) {
|
|
73
|
-
clip-path: polygon(0 0, calc(100% - 0.7rem) 0, 100% 50%, calc(100% - 0.7rem) 100%, 0 100%, 0.7rem 50%);
|
|
74
|
-
margin-inline-end: -0.55rem;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
[part="stage"]:first-child:not(:last-child) {
|
|
78
|
-
clip-path: polygon(0 0, calc(100% - 0.7rem) 0, 100% 50%, calc(100% - 0.7rem) 100%, 0 100%);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
[part="stage"]:last-child:not(:first-child) {
|
|
82
|
-
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0.7rem 50%);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
[part="stage"][data-state="complete"] {
|
|
86
|
-
background: color-mix(in srgb, var(--boe-token-surface-status-surface-success, #26a27b) 18%, transparent);
|
|
87
|
-
color: color-mix(in srgb, var(--boe-token-surface-status-surface-success, #26a27b) 72%, black 28%);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
[part="stage"][data-state="current"] {
|
|
91
|
-
background: var(--boe-token-surface-surface-brand, #0061d5);
|
|
92
|
-
color: var(--boe-token-text-text-on-brand, #ffffff);
|
|
93
|
-
font-weight: 700;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
[part="stage-label"] {
|
|
97
|
-
display: block;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
[part="stage-description"] {
|
|
101
|
-
display: block;
|
|
102
|
-
margin-block-start: 0.1rem;
|
|
103
|
-
font-size: 0.72rem;
|
|
104
|
-
font-weight: 400;
|
|
105
|
-
opacity: 0.85;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
[part="stage-marker"] {
|
|
109
|
-
margin-inline-end: 0.3rem;
|
|
110
|
-
font-weight: 700;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
@media (prefers-reduced-motion: reduce) {
|
|
114
|
-
[part="stage"] {
|
|
115
|
-
transition: none;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@media (max-width: 34rem) {
|
|
120
|
-
/* Chevrons collapse below the width where they stop being legible;
|
|
121
|
-
the states still read from tone and the completed marker. */
|
|
122
|
-
[part="stage"],
|
|
123
|
-
[part="stage"]:first-child:not(:last-child),
|
|
124
|
-
[part="stage"]:last-child:not(:first-child) {
|
|
125
|
-
clip-path: none;
|
|
126
|
-
margin-inline-end: 0;
|
|
127
|
-
padding-inline-start: 0.8rem;
|
|
128
|
-
border-radius: 0;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
`;
|
|
132
|
-
/**
|
|
133
|
-
* Horizontal chevron lifecycle tracker for record headers — Draft → In
|
|
134
|
-
* Review → Approved → Executed.
|
|
135
|
-
*
|
|
136
|
-
* Distinct from `box-progress-steps`, which is a vertical setup rail for a
|
|
137
|
-
* task the reader is working through: this states where a *record* sits in
|
|
138
|
-
* its lifecycle, is read-only, and belongs in a header rather than a form.
|
|
139
|
-
*
|
|
140
|
-
* Rendered as an ordered list with the current stage marked `aria-current`,
|
|
141
|
-
* so the sequence and the position are both available without relying on the
|
|
142
|
-
* chevron geometry — which is decoration, and collapses on narrow viewports.
|
|
143
|
-
*/
|
|
144
|
-
export class StagePath extends BaseElement {
|
|
145
|
-
static tagName = DEFAULT_TAG_NAME;
|
|
146
|
-
static get observedAttributes() {
|
|
147
|
-
return ["current", "label", "stages"];
|
|
148
|
-
}
|
|
149
|
-
pathEl;
|
|
150
|
-
stagesRaw = null;
|
|
151
|
-
stagesCache = [];
|
|
152
|
-
get label() {
|
|
153
|
-
return this.getAttribute("label") ?? "Lifecycle";
|
|
154
|
-
}
|
|
155
|
-
set label(value) {
|
|
156
|
-
this.setAttribute("label", value);
|
|
157
|
-
}
|
|
158
|
-
/** Id of the stage the record is at. An unknown id leaves every stage upcoming. */
|
|
159
|
-
get current() {
|
|
160
|
-
return this.getAttribute("current") ?? "";
|
|
161
|
-
}
|
|
162
|
-
set current(value) {
|
|
163
|
-
this.setAttribute("current", value);
|
|
164
|
-
}
|
|
165
|
-
get stages() {
|
|
166
|
-
const raw = this.getAttribute("stages");
|
|
167
|
-
if (!raw) {
|
|
168
|
-
return [];
|
|
169
|
-
}
|
|
170
|
-
if (raw !== this.stagesRaw) {
|
|
171
|
-
this.stagesRaw = raw;
|
|
172
|
-
try {
|
|
173
|
-
const parsed = JSON.parse(raw);
|
|
174
|
-
this.stagesCache =
|
|
175
|
-
Array.isArray(parsed) && parsed.every(isStagePathStageRecord)
|
|
176
|
-
? parsed
|
|
177
|
-
: [];
|
|
178
|
-
}
|
|
179
|
-
catch {
|
|
180
|
-
this.stagesCache = [];
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return [...this.stagesCache];
|
|
184
|
-
}
|
|
185
|
-
set stages(value) {
|
|
186
|
-
if (value.length) {
|
|
187
|
-
this.setAttribute("stages", JSON.stringify(value));
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
this.removeAttribute("stages");
|
|
191
|
-
}
|
|
192
|
-
/** State of each stage, in order. */
|
|
193
|
-
get states() {
|
|
194
|
-
return resolveStageStates(this.stages, this.current);
|
|
195
|
-
}
|
|
196
|
-
renderTemplate() {
|
|
197
|
-
if (!this.shadowRoot) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
this.shadowRoot.innerHTML = `<style>${elementStyles}</style><ol part="path"></ol>`;
|
|
201
|
-
this.pathEl = this.shadowRoot.querySelector('[part="path"]');
|
|
202
|
-
}
|
|
203
|
-
setupListeners() {
|
|
204
|
-
// Read-only: a record's lifecycle position is not something a header edits.
|
|
205
|
-
}
|
|
206
|
-
update() {
|
|
207
|
-
if (!this.pathEl) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const stages = this.stages;
|
|
211
|
-
const states = resolveStageStates(stages, this.current);
|
|
212
|
-
this.pathEl.setAttribute("aria-label", this.label);
|
|
213
|
-
this.pathEl.innerHTML = stages
|
|
214
|
-
.map((stage, index) => {
|
|
215
|
-
const state = states[index];
|
|
216
|
-
// The completed marker is a second, non-colour signal for "done".
|
|
217
|
-
const marker = state === "complete" ? `<span part="stage-marker" aria-hidden="true">✓</span>` : "";
|
|
218
|
-
return `
|
|
219
|
-
<li
|
|
220
|
-
part="stage"
|
|
221
|
-
data-stage-id="${escapeHtml(stage.id)}"
|
|
222
|
-
data-state="${state}"
|
|
223
|
-
${state === "current" ? 'aria-current="step"' : ""}
|
|
224
|
-
>
|
|
225
|
-
<span part="stage-label">${marker}${escapeHtml(stage.label)}</span>
|
|
226
|
-
${state === "current" && stage.description
|
|
227
|
-
? `<span part="stage-description">${escapeHtml(stage.description)}</span>`
|
|
228
|
-
: ""}
|
|
229
|
-
</li>
|
|
230
|
-
`;
|
|
231
|
-
})
|
|
232
|
-
.join("");
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
StagePath.register();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../components/feedback/stage-path.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../components/feedback/stage-path.js";
|