@cas-smartdesign/stage 3.0.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/LICENSE +8 -0
- package/dist/docs/2_create-from-source.js +1 -0
- package/dist/docs/doc.css +1 -0
- package/dist/docs/doc.mjs +276 -0
- package/dist/docs/index.html +25 -0
- package/dist/stage-with-externals.js +114 -0
- package/dist/stage-with-externals.js.map +7 -0
- package/dist/stage.d.ts +61 -0
- package/dist/stage.mjs +234 -0
- package/dist/stage.mjs.map +1 -0
- package/npm-third-party-licenses.json +192 -0
- package/package.json +34 -0
- package/readme.md +58 -0
package/dist/stage.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { LitElement, TemplateResult, PropertyValues } from "lit";
|
|
2
|
+
import { ValidationLevel } from "@cas-smartdesign/field-validation-message";
|
|
3
|
+
declare global {
|
|
4
|
+
interface HTMLElementTagNameMap {
|
|
5
|
+
[Stage.ID]: Stage;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export type ISelectionModelId = string | number;
|
|
9
|
+
export interface ISelectionModel {
|
|
10
|
+
id: ISelectionModelId;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
export type SelectionModel = ISelectionModel | ISelectionModelId;
|
|
14
|
+
export interface IValueChangeEvent {
|
|
15
|
+
value: ISelectionModelId;
|
|
16
|
+
}
|
|
17
|
+
export interface CustomEventMap extends HTMLElementEventMap {
|
|
18
|
+
"value-change": CustomEvent<IValueChangeEvent>;
|
|
19
|
+
}
|
|
20
|
+
export interface Stage {
|
|
21
|
+
addEventListener<K extends keyof CustomEventMap>(event: K, listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null, options?: AddEventListenerOptions | boolean): void;
|
|
22
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
|
|
23
|
+
removeEventListener<K extends keyof CustomEventMap>(type: K, listener: (this: this, ev: CustomEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
24
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
25
|
+
dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class Stage extends LitElement {
|
|
28
|
+
static readonly ID = "sd-stage";
|
|
29
|
+
static ensureDefined: () => void;
|
|
30
|
+
private _value;
|
|
31
|
+
private _possibleValues;
|
|
32
|
+
private _renderedItems;
|
|
33
|
+
private _readonly;
|
|
34
|
+
private _resizeObserver;
|
|
35
|
+
private _isSpaceOrEnterKeyDown;
|
|
36
|
+
private _focusIndex;
|
|
37
|
+
private _focusOutSuspended;
|
|
38
|
+
static get styles(): import("lit").CSSResult[];
|
|
39
|
+
validationMessage: string;
|
|
40
|
+
validationIconSrc: string;
|
|
41
|
+
validationLevel: ValidationLevel;
|
|
42
|
+
get value(): ISelectionModelId;
|
|
43
|
+
set value(value: ISelectionModelId);
|
|
44
|
+
get readonly(): boolean;
|
|
45
|
+
set readonly(readonly: boolean);
|
|
46
|
+
get possibleValues(): SelectionModel[];
|
|
47
|
+
set possibleValues(possibleValues: SelectionModel[]);
|
|
48
|
+
static shadowRootOptions: ShadowRootInit;
|
|
49
|
+
connectedCallback(): void;
|
|
50
|
+
private focusSibling;
|
|
51
|
+
private updateFocusIndex;
|
|
52
|
+
private getIndexOfSelection;
|
|
53
|
+
disconnectedCallback(): void;
|
|
54
|
+
firstUpdated(_changedProperties: PropertyValues): void;
|
|
55
|
+
render(): TemplateResult;
|
|
56
|
+
private onKeyDown;
|
|
57
|
+
private onKeyUp;
|
|
58
|
+
private updatePossibleValuesFromOptionElements;
|
|
59
|
+
private isSpaceOrEnter;
|
|
60
|
+
private fireValueChange;
|
|
61
|
+
}
|
package/dist/stage.mjs
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { LitElement as K, css as X, unsafeCSS as J, html as g } from "lit";
|
|
2
|
+
import { property as S } from "lit/decorators/property.js";
|
|
3
|
+
import { repeat as Q } from "lit/directives/repeat.js";
|
|
4
|
+
import { ifDefined as I } from "lit/directives/if-defined.js";
|
|
5
|
+
import { ValidationLevel as Y } from "@cas-smartdesign/field-validation-message";
|
|
6
|
+
const Z = ':host{--component-stage-border-color: var(--color-base-grey-400, #cccccc);--component-stage-border-focus-color: var(--color-base-black, black);--component-stage-border-highlight-color: var(--color-base-white, white);--component-stage-inactive-color: var(--color-base-white, white);--component-stage-active-color: var(--color-base-green-200, #deedbc);--component-stage-selected-color: var(--color-base-green-400, #bedb79);--component-stage-hover-color: var(--color-base-green-300, #cee49c);--component-stage-focus-color: var(--color-base-green-300, #cee49c);--component-stage-font-color: var(--color-base-grey-900, #555555);--component-stage-font-inactive-color: var(--color-base-grey-900, #555555);--component-stage-font-selected-color: var(--color-base-grey-900, #555555);--component-stage-font-hover-color: var(--color-base-grey-900, #555555);--component-stage-font-focus-color: var(--color-base-grey-900, #555555);--component-stage-font-size: var(--size-font-medium, 13px);--component-stage-font-family: var(--font-family-base, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif);--component-stage-transition-time: var(--time-transition-short, 275ms);display:flex;flex-direction:column;width:100%;margin:0;box-sizing:border-box;font-size:var(--component-stage-font-size);font-family:var(--component-stage-font-family);color:var(--component-stage-font-color)}@media (prefers-reduced-motion){:host{--component-stage-transition-time: 1ms}}:host *{box-sizing:border-box}:host *:before,:host *:after{box-sizing:border-box}:host .sections{width:100%;overflow:hidden;display:flex;-webkit-user-select:none;user-select:none}:host .sections .section:first-child{margin-left:0}:host .sections .section:first-child .content{padding-left:0}:host .section{display:flex;flex:1 1 80px;box-sizing:border-box;height:48px;cursor:pointer;overflow:visible;position:relative}:host .section.placeholder{flex:0 0 48px}:host .section.placeholder .index{display:none}:host .section.placeholder .content .label{top:18px;padding:0 16px}:host .section .content{height:100%;flex:1 1 0;overflow:hidden;transition:background-color var(--component-stage-transition-time) ease-in,color var(--component-stage-transition-time) ease-in}:host .section .content .label{position:absolute;top:25px;min-width:28px;width:100%;padding:0 8px 0 16px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .section .content .index{position:absolute;bottom:25px;width:100%;padding:0 8px 0 16px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .section .arrow{flex:0 0 auto;position:absolute;right:0;top:0;z-index:1;box-sizing:border-box;height:48px;width:48px;margin-right:-24px;transform-origin:center center;border:3px solid var(--component-stage-border-highlight-color);border-left:0px;border-bottom:0px;transform:scaleX(.5) scale(.707) rotate(45deg);transition:background-color var(--component-stage-transition-time) ease-in}:host .section:last-of-type .arrow{display:none}:host .section:last-of-type .content{margin-right:0}:host .section.inactive:last-of-type .content{border-right:1px solid var(--component-stage-border-color)}:host .section.inactive:first-child .content{border-left:1px solid var(--component-stage-border-color)}:host .section.inactive .arrow{border-color:var(--component-stage-border-color)}:host .section.inactive .content{color:var(--component-stage-font-inactive-color);background:var(--component-stage-inactive-color);border-top:1px solid var(--component-stage-border-color);border-bottom:1px solid var(--component-stage-border-color)}:host .section.inactive .content,:host .section.inactive .arrow{background:var(--component-stage-inactive-color)}:host .section.active .content,:host .section.active .arrow{color:var(--component-stage-font-color);background:var(--component-stage-active-color)}:host .section.selected .content,:host .section.selected .arrow{color:var(--component-stage-font-selected-color);background:var(--component-stage-selected-color)}:host .hidden{flex:0 1 0px;margin:0;overflow:hidden}:host ::slotted(*){display:none}:host(.readonly) .section{cursor:default}:host(:focus){outline:none}@media (hover: hover){:host(:not(.readonly)) .section:hover .content,:host(:not(.readonly)) .section:hover .arrow{color:var(--component-stage-font-hover-color);background:var(--component-stage-hover-color)}}:host(:not(.readonly)) .section.focused:focus-visible{outline:none}:host(:not(.readonly)) .section.focused:focus-visible .content{border-top:1px solid var(--component-stage-border-focus-color);border-bottom:1px solid var(--component-stage-border-focus-color)}:host(:not(.readonly)) .section.focused:focus-visible .content,:host(:not(.readonly)) .section.focused:focus-visible .arrow{color:var(--component-stage-font-focus-color);background:var(--component-stage-focus-color)}';
|
|
7
|
+
var ee = Object.defineProperty, te = Object.getOwnPropertyDescriptor, O = (l, t, o, i) => {
|
|
8
|
+
for (var r = i > 1 ? void 0 : i ? te(t, o) : t, s = l.length - 1, p; s >= 0; s--)
|
|
9
|
+
(p = l[s]) && (r = (i ? p(t, o, r) : p(r)) || r);
|
|
10
|
+
return i && r && ee(t, o, r), r;
|
|
11
|
+
};
|
|
12
|
+
function T(l) {
|
|
13
|
+
return l.label != null && l.id != null;
|
|
14
|
+
}
|
|
15
|
+
var a;
|
|
16
|
+
const b = (a = class extends K {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments), this._isSpaceOrEnterKeyDown = !1, this._focusIndex = -1, this._focusOutSuspended = !1;
|
|
19
|
+
}
|
|
20
|
+
static get styles() {
|
|
21
|
+
return [
|
|
22
|
+
X`
|
|
23
|
+
${J(Z)}
|
|
24
|
+
`
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
get value() {
|
|
28
|
+
return this._value;
|
|
29
|
+
}
|
|
30
|
+
set value(t) {
|
|
31
|
+
this._value !== t && (this._value = t, this._focusIndex = this.getIndexOfSelection(this.value), this.requestUpdate());
|
|
32
|
+
}
|
|
33
|
+
get readonly() {
|
|
34
|
+
return this._readonly;
|
|
35
|
+
}
|
|
36
|
+
set readonly(t) {
|
|
37
|
+
this._readonly = t, this.classList.remove("readonly"), this._readonly && this.classList.add("readonly"), this.requestUpdate("readonly");
|
|
38
|
+
}
|
|
39
|
+
get possibleValues() {
|
|
40
|
+
return this._possibleValues;
|
|
41
|
+
}
|
|
42
|
+
set possibleValues(t) {
|
|
43
|
+
this._possibleValues = t, this.requestUpdate();
|
|
44
|
+
}
|
|
45
|
+
connectedCallback() {
|
|
46
|
+
super.connectedCallback(), this._resizeObserver = new ResizeObserver(this.requestUpdate.bind(this)), this._resizeObserver.observe(this);
|
|
47
|
+
}
|
|
48
|
+
focusSibling(t) {
|
|
49
|
+
this.updateFocusIndex(this._focusIndex + t);
|
|
50
|
+
}
|
|
51
|
+
updateFocusIndex(t) {
|
|
52
|
+
(this.possibleValues || []).length != 0 && (this._focusIndex = Math.min(Math.max(0, t), this.possibleValues.length - 1), this._focusOutSuspended = !0, this.requestUpdate(), this.updateComplete.then(() => {
|
|
53
|
+
var o;
|
|
54
|
+
this._focusOutSuspended = !1, (o = this.shadowRoot.querySelector(".focused")) == null || o.focus();
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
getIndexOfSelection(t) {
|
|
58
|
+
return (this.possibleValues || []).length == 0 ? -1 : this.possibleValues.map((i) => T(i) ? i.id : i).indexOf(t);
|
|
59
|
+
}
|
|
60
|
+
disconnectedCallback() {
|
|
61
|
+
super.disconnectedCallback(), this._resizeObserver && (this._resizeObserver.disconnect(), this._resizeObserver = null);
|
|
62
|
+
}
|
|
63
|
+
firstUpdated(t) {
|
|
64
|
+
super.firstUpdated(t), this.updatePossibleValuesFromOptionElements(), this.addEventListener("keydown", (o) => {
|
|
65
|
+
o.key == "ArrowLeft" || o.key == "ArrowUp" ? (this.focusSibling(-1), o.preventDefault()) : o.key == "ArrowRight" || o.key == "ArrowDown" ? (this.focusSibling(1), o.preventDefault()) : o.key == "PageUp" ? (this.focusSibling(-this._renderedItems.length), o.preventDefault()) : o.key == "PageDown" && (this.focusSibling(this._renderedItems.length), o.preventDefault());
|
|
66
|
+
}), this.addEventListener("focusout", () => {
|
|
67
|
+
this._focusOutSuspended || (this._focusIndex = this.getIndexOfSelection(this.value), this.requestUpdate());
|
|
68
|
+
}), this._focusIndex = this.getIndexOfSelection(this.value);
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
var P;
|
|
72
|
+
let t = this.offsetWidth;
|
|
73
|
+
const o = g`<slot @slotchange=${this.updatePossibleValuesFromOptionElements}></slot>`, i = g`<sd-field-validation-message
|
|
74
|
+
class="validation-message"
|
|
75
|
+
.message=${this.validationMessage}
|
|
76
|
+
.icon=${this.validationIconSrc}
|
|
77
|
+
.level=${this.validationLevel}
|
|
78
|
+
>
|
|
79
|
+
</sd-field-validation-message>`, r = g`${o}${i}`;
|
|
80
|
+
if ((this._possibleValues || []).length === 0)
|
|
81
|
+
return r;
|
|
82
|
+
const s = this._possibleValues.map((e, d) => T(e) ? {
|
|
83
|
+
...e,
|
|
84
|
+
index: d
|
|
85
|
+
} : {
|
|
86
|
+
id: e,
|
|
87
|
+
label: String(e),
|
|
88
|
+
index: d
|
|
89
|
+
}), p = {
|
|
90
|
+
label: "...",
|
|
91
|
+
id: "placeholder1",
|
|
92
|
+
index: -2,
|
|
93
|
+
firstHiddenIndex: 0
|
|
94
|
+
}, D = {
|
|
95
|
+
label: "...",
|
|
96
|
+
id: "placeholder2",
|
|
97
|
+
index: s.length,
|
|
98
|
+
firstHiddenIndex: s.length
|
|
99
|
+
}, E = 80, C = 48;
|
|
100
|
+
let u = [], m = [];
|
|
101
|
+
if (t / E >= s.length || s.length <= 2)
|
|
102
|
+
m = [...s], u = [...s];
|
|
103
|
+
else {
|
|
104
|
+
const e = () => Math.max(1, Math.floor(t / E)), d = () => {
|
|
105
|
+
t = this.offsetWidth;
|
|
106
|
+
}, n = (k) => {
|
|
107
|
+
const G = Math.max(0, k);
|
|
108
|
+
let V = 0, L, R, v, w, q, H, _;
|
|
109
|
+
do
|
|
110
|
+
q = v, H = w, V = e(), v = Math.max(0, Math.min(Math.ceil(G - V / 2), s.length - V)), w = v + V, _ = !1, v > 0 && !L && (t -= C, L = !0, _ = !0), !_ && w < s.length && !R && (t -= C, R = !0, _ = !0);
|
|
111
|
+
while (_ || q != v || H != w);
|
|
112
|
+
return { start: v, end: w };
|
|
113
|
+
};
|
|
114
|
+
let { start: x, end: h } = n(this._focusIndex);
|
|
115
|
+
if (this._focusIndex > -1 && h - x >= 2 && h <= this._focusIndex + 1 && h < s.length) {
|
|
116
|
+
d();
|
|
117
|
+
const k = n(this._focusIndex + 1);
|
|
118
|
+
x = k.start, h = k.end;
|
|
119
|
+
}
|
|
120
|
+
const y = s.slice(x, h), A = x > 0 ? [p] : [], F = h < s.length ? [D] : [];
|
|
121
|
+
D.firstHiddenIndex = h, m = [...A, ...y, ...F], u = [...A, ...s, ...F];
|
|
122
|
+
}
|
|
123
|
+
const f = this._value ? (P = u.find((e) => e.id === this._value)) == null ? void 0 : P.index : -1, c = (e) => e == p || e == D, U = (e) => e.index == this._focusIndex, M = (e) => !c(e) && f != null && e.index === f, W = (e) => c(e) ? e.firstHiddenIndex <= f : e.index < f, j = (e) => {
|
|
124
|
+
const d = m.indexOf(e) == -1;
|
|
125
|
+
let n = "section";
|
|
126
|
+
return f != null ? M(e) ? n += " selected" : W(e) ? n += " active" : n += " inactive" : n += " inactive", c(e) && (n += " placeholder"), U(e) && (n += " focused"), d && (n += " hidden"), n;
|
|
127
|
+
};
|
|
128
|
+
this._renderedItems = m.filter((e) => !c(e));
|
|
129
|
+
const N = (e) => {
|
|
130
|
+
const d = () => {
|
|
131
|
+
if (c(e)) {
|
|
132
|
+
e.index < 0 ? this.focusSibling(-this._renderedItems.length) : this.focusSibling(this._renderedItems.length);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this._readonly || (this.value = e.id, this.fireValueChange());
|
|
136
|
+
}, n = u.indexOf(e), h = m.indexOf(e) == -1 ? -1 : u.length - n;
|
|
137
|
+
return g`
|
|
138
|
+
<div
|
|
139
|
+
role="option"
|
|
140
|
+
style="z-index: ${h}"
|
|
141
|
+
id="${I(!c(e) && e.index ? "stage-option-" + e.index : void 0)}"
|
|
142
|
+
aria-hidden="${I(c(e) ? !0 : void 0)}"
|
|
143
|
+
aria-selected=${I(
|
|
144
|
+
this._readonly || c(e) ? void 0 : M(e) ? "true" : "false"
|
|
145
|
+
)}
|
|
146
|
+
tabindex="${U(e) ? 0 : -1}"
|
|
147
|
+
@keydown="${(y) => this.onKeyDown(y)}"
|
|
148
|
+
@keyup="${(y) => this.onKeyUp(y, () => d())}"
|
|
149
|
+
@click="${() => d()}"
|
|
150
|
+
class="${j(e)}"
|
|
151
|
+
>
|
|
152
|
+
<div class="content" title="${e.label}">
|
|
153
|
+
<div class="index" aria-hidden="true">${c(e) ? "" : e.index + 1}</div>
|
|
154
|
+
<div class="label">${e.label}</div>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="arrow"></div>
|
|
157
|
+
</div>
|
|
158
|
+
`;
|
|
159
|
+
}, z = u.find((e) => e.index == f), $ = u.find((e) => e.index == this._focusIndex), B = g`<div
|
|
160
|
+
class="sections"
|
|
161
|
+
role="listbox"
|
|
162
|
+
aria-activedescendant="${I($ != null && $.index ? "stage-option-" + $.index : void 0)}"
|
|
163
|
+
aria-orientation="horizontal"
|
|
164
|
+
aria-valuenow=${I(z == null ? void 0 : z.label)}
|
|
165
|
+
?aria-readonly="${this._readonly}"
|
|
166
|
+
>
|
|
167
|
+
${Q(
|
|
168
|
+
u,
|
|
169
|
+
(e) => e.id,
|
|
170
|
+
(e) => N(e)
|
|
171
|
+
)}
|
|
172
|
+
</div>`;
|
|
173
|
+
return g`${B}${r}`;
|
|
174
|
+
}
|
|
175
|
+
onKeyDown(t) {
|
|
176
|
+
this.isSpaceOrEnter(t) && (this._isSpaceOrEnterKeyDown = !0, t.preventDefault());
|
|
177
|
+
}
|
|
178
|
+
onKeyUp(t, o) {
|
|
179
|
+
this.isSpaceOrEnter(t) && this._isSpaceOrEnterKeyDown == !0 && (this._isSpaceOrEnterKeyDown = !1, o());
|
|
180
|
+
}
|
|
181
|
+
updatePossibleValuesFromOptionElements() {
|
|
182
|
+
const t = Array.prototype.map.call(
|
|
183
|
+
this.querySelectorAll("option"),
|
|
184
|
+
(o) => o
|
|
185
|
+
);
|
|
186
|
+
this.possibleValues = t.length > 0 ? t.map((o) => ({ id: o.value, label: o.innerText })) : this.possibleValues;
|
|
187
|
+
}
|
|
188
|
+
isSpaceOrEnter(t) {
|
|
189
|
+
switch (t.key) {
|
|
190
|
+
case " ":
|
|
191
|
+
case "Space":
|
|
192
|
+
case "Enter":
|
|
193
|
+
return !0;
|
|
194
|
+
default:
|
|
195
|
+
return !1;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
fireValueChange() {
|
|
199
|
+
this.dispatchEvent(new CustomEvent("value-change", { detail: { value: this.value } }));
|
|
200
|
+
}
|
|
201
|
+
}, a.ID = "sd-stage", a.ensureDefined = () => {
|
|
202
|
+
customElements.get(a.ID) || customElements.define(a.ID, a);
|
|
203
|
+
}, a.shadowRootOptions = {
|
|
204
|
+
...K.shadowRootOptions,
|
|
205
|
+
delegatesFocus: !0
|
|
206
|
+
}, a);
|
|
207
|
+
O([
|
|
208
|
+
S({ type: String })
|
|
209
|
+
], b.prototype, "validationMessage", 2);
|
|
210
|
+
O([
|
|
211
|
+
S({ type: String })
|
|
212
|
+
], b.prototype, "validationIconSrc", 2);
|
|
213
|
+
O([
|
|
214
|
+
S({ type: Y, reflect: !0 })
|
|
215
|
+
], b.prototype, "validationLevel", 2);
|
|
216
|
+
O([
|
|
217
|
+
S({
|
|
218
|
+
reflect: !0,
|
|
219
|
+
attribute: !0,
|
|
220
|
+
converter: {
|
|
221
|
+
fromAttribute: (l) => l,
|
|
222
|
+
toAttribute: (l) => l
|
|
223
|
+
}
|
|
224
|
+
})
|
|
225
|
+
], b.prototype, "value", 1);
|
|
226
|
+
O([
|
|
227
|
+
S({ type: Boolean, attribute: !0, reflect: !0 })
|
|
228
|
+
], b.prototype, "readonly", 1);
|
|
229
|
+
let oe = b;
|
|
230
|
+
oe.ensureDefined();
|
|
231
|
+
export {
|
|
232
|
+
oe as Stage
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=stage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage.mjs","sources":["../stage.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS, TemplateResult, PropertyValues, css } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\n\nimport { ValidationLevel } from \"@cas-smartdesign/field-validation-message\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Stage.ID]: Stage;\n }\n}\n\nimport style from \"./stage.scss?inline\";\n\nexport type ISelectionModelId = string | number;\n\nexport interface ISelectionModel {\n id: ISelectionModelId;\n label: string;\n}\n\nexport type SelectionModel = ISelectionModel | ISelectionModelId;\n\ninterface InternalSelectionModel extends ISelectionModel {\n index?: number;\n}\n\ninterface PlaceholderModel extends InternalSelectionModel {\n firstHiddenIndex: number;\n}\n\nfunction isSelectionModel(value: SelectionModel): value is ISelectionModel {\n return (value as ISelectionModel).label != null && (value as ISelectionModel).id != null;\n}\n\nexport interface IValueChangeEvent {\n value: ISelectionModelId;\n}\n\nexport interface CustomEventMap extends HTMLElementEventMap {\n \"value-change\": CustomEvent<IValueChangeEvent>;\n}\n\nexport interface Stage {\n addEventListener<K extends keyof CustomEventMap>(\n event: K,\n listener: ((this: this, ev: CustomEventMap[K]) => unknown) | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n addEventListener(\n type: string,\n callback: EventListenerOrEventListenerObject | null,\n options?: AddEventListenerOptions | boolean,\n ): void;\n removeEventListener<K extends keyof CustomEventMap>(\n type: K,\n listener: (this: this, ev: CustomEventMap[K]) => unknown,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n dispatchEvent<EventType extends CustomEventMap[keyof CustomEventMap]>(event: EventType): boolean;\n}\nexport class Stage extends LitElement {\n public static readonly ID = \"sd-stage\";\n\n public static ensureDefined = (): void => {\n if (!customElements.get(Stage.ID)) {\n customElements.define(Stage.ID, Stage);\n }\n };\n\n private _value: ISelectionModelId;\n private _possibleValues: SelectionModel[];\n private _renderedItems: SelectionModel[];\n private _readonly: boolean;\n private _resizeObserver: ResizeObserver;\n private _isSpaceOrEnterKeyDown = false;\n private _focusIndex = -1;\n private _focusOutSuspended = false;\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n @property({ type: String })\n public validationMessage: string;\n @property({ type: String })\n public validationIconSrc: string;\n @property({ type: ValidationLevel, reflect: true })\n public validationLevel: ValidationLevel;\n\n @property({\n reflect: true,\n attribute: true,\n converter: {\n fromAttribute: (value: string | number) => value,\n toAttribute: (value: ISelectionModelId): string | number => value,\n },\n })\n get value(): ISelectionModelId {\n return this._value;\n }\n\n set value(value: ISelectionModelId) {\n if (this._value !== value) {\n this._value = value;\n this._focusIndex = this.getIndexOfSelection(this.value);\n this.requestUpdate();\n }\n }\n\n @property({ type: Boolean, attribute: true, reflect: true })\n get readonly(): boolean {\n return this._readonly;\n }\n\n set readonly(readonly: boolean) {\n this._readonly = readonly;\n this.classList.remove(\"readonly\");\n if (this._readonly) {\n this.classList.add(\"readonly\");\n }\n this.requestUpdate(\"readonly\");\n }\n\n get possibleValues(): SelectionModel[] {\n return this._possibleValues;\n }\n\n set possibleValues(possibleValues: SelectionModel[]) {\n this._possibleValues = possibleValues;\n this.requestUpdate();\n }\n\n static shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n this._resizeObserver = new ResizeObserver(this.requestUpdate.bind(this));\n this._resizeObserver.observe(this);\n }\n\n private focusSibling(offset: number): void {\n this.updateFocusIndex(this._focusIndex + offset);\n }\n\n private updateFocusIndex(index: number) {\n if ((this.possibleValues || []).length == 0) {\n return;\n }\n this._focusIndex = Math.min(Math.max(0, index), this.possibleValues.length - 1);\n this._focusOutSuspended = true;\n this.requestUpdate();\n this.updateComplete.then(() => {\n this._focusOutSuspended = false;\n (this.shadowRoot.querySelector(\".focused\") as HTMLElement)?.focus();\n });\n }\n\n private getIndexOfSelection(item: ISelectionModelId) {\n if ((this.possibleValues || []).length == 0) {\n return -1;\n }\n const index = this.possibleValues.map((p) => (isSelectionModel(p) ? p.id : p)).indexOf(item);\n return index;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n this._resizeObserver = null;\n }\n }\n\n firstUpdated(_changedProperties: PropertyValues): void {\n super.firstUpdated(_changedProperties);\n this.updatePossibleValuesFromOptionElements();\n this.addEventListener(\"keydown\", (e) => {\n if (e.key == \"ArrowLeft\" || e.key == \"ArrowUp\") {\n this.focusSibling(-1);\n e.preventDefault();\n } else if (e.key == \"ArrowRight\" || e.key == \"ArrowDown\") {\n this.focusSibling(1);\n e.preventDefault();\n } else if (e.key == \"PageUp\") {\n this.focusSibling(-this._renderedItems.length);\n e.preventDefault();\n } else if (e.key == \"PageDown\") {\n this.focusSibling(this._renderedItems.length);\n e.preventDefault();\n }\n });\n this.addEventListener(\"focusout\", () => {\n if (this._focusOutSuspended) {\n return;\n }\n this._focusIndex = this.getIndexOfSelection(this.value);\n this.requestUpdate();\n });\n this._focusIndex = this.getIndexOfSelection(this.value);\n }\n\n render(): TemplateResult {\n let availableWidth = this.offsetWidth;\n\n const optionsSlot = html`<slot @slotchange=${this.updatePossibleValuesFromOptionElements}></slot>`;\n const validation = html`<sd-field-validation-message\n class=\"validation-message\"\n .message=${this.validationMessage}\n .icon=${this.validationIconSrc}\n .level=${this.validationLevel}\n >\n </sd-field-validation-message>`;\n\n const baseTemplate = html`${optionsSlot}${validation}`;\n\n if ((this._possibleValues || []).length === 0) {\n return baseTemplate;\n }\n\n const values: InternalSelectionModel[] = this._possibleValues.map((p, i) => {\n if (isSelectionModel(p)) {\n return {\n ...p,\n index: i,\n };\n } else {\n return {\n id: p,\n label: String(p),\n index: i,\n };\n }\n });\n\n const placeholder1: PlaceholderModel = {\n label: \"...\",\n id: \"placeholder1\",\n index: -2,\n firstHiddenIndex: 0,\n };\n const placeholder2: PlaceholderModel = {\n label: \"...\",\n id: \"placeholder2\",\n index: values.length,\n firstHiddenIndex: values.length,\n };\n\n const minItemWidth = 80;\n const placeholderWidth = 48;\n\n let allItems: InternalSelectionModel[] = [];\n let valuesToRender: InternalSelectionModel[] = [];\n const allItemsFit = availableWidth / minItemWidth >= values.length;\n\n if (allItemsFit || values.length <= 2) {\n valuesToRender = [...values];\n allItems = [...values];\n } else {\n const computeMaxVisibleItems = () => Math.max(1, Math.floor(availableWidth / minItemWidth));\n\n const resetComputationVariables = () => {\n availableWidth = this.offsetWidth;\n };\n\n const computeVisibleRange = (focusIndex: number) => {\n const center = Math.max(0, focusIndex);\n let visibleItems = 0;\n let needsHead;\n let needsTail;\n\n let start;\n let end;\n let oldStart;\n let oldEnd;\n let headOrTailChangedInThisRound;\n\n do {\n oldStart = start;\n oldEnd = end;\n\n visibleItems = computeMaxVisibleItems();\n\n // determine indexes for the visible item slice\n start = Math.max(0, Math.min(Math.ceil(center - visibleItems / 2), values.length - visibleItems));\n end = start + visibleItems;\n\n headOrTailChangedInThisRound = false;\n if (start > 0 && !needsHead) {\n availableWidth -= placeholderWidth;\n needsHead = true;\n headOrTailChangedInThisRound = true;\n }\n if (!headOrTailChangedInThisRound && end < values.length && !needsTail) {\n availableWidth -= placeholderWidth;\n needsTail = true;\n headOrTailChangedInThisRound = true;\n }\n } while (headOrTailChangedInThisRound || oldStart != start || oldEnd != end);\n return { start, end };\n };\n\n let { start, end } = computeVisibleRange(this._focusIndex);\n\n // show next item if possible\n if (this._focusIndex > -1 && end - start >= 2 && end <= this._focusIndex + 1 && end < values.length) {\n resetComputationVariables();\n const updatedRange = computeVisibleRange(this._focusIndex + 1);\n start = updatedRange.start;\n end = updatedRange.end;\n }\n\n const centerItems = values.slice(start, end);\n\n const placeholderHead = start > 0 ? [placeholder1] : [];\n const placeholderTail = end < values.length ? [placeholder2] : [];\n placeholder2.firstHiddenIndex = end;\n valuesToRender = [...placeholderHead, ...centerItems, ...placeholderTail];\n allItems = [...placeholderHead, ...values, ...placeholderTail];\n }\n\n const selectedIndex: number = this._value ? allItems.find((p) => p.id === this._value)?.index : -1;\n const isPlaceholder = (item: InternalSelectionModel): item is PlaceholderModel =>\n item == placeholder1 || item == placeholder2;\n const isFocused = (item: InternalSelectionModel) => item.index == this._focusIndex;\n const isSelected = (item: InternalSelectionModel) => {\n return !isPlaceholder(item) && selectedIndex != null && item.index === selectedIndex;\n };\n const isActive = (item: InternalSelectionModel) =>\n isPlaceholder(item) ? item.firstHiddenIndex <= selectedIndex : item.index < selectedIndex;\n const getClassName = (item: InternalSelectionModel) => {\n const hidden = valuesToRender.indexOf(item) == -1;\n let styleName = \"section\";\n\n if (selectedIndex != null) {\n if (isSelected(item)) {\n styleName += \" selected\";\n } else if (isActive(item)) {\n styleName += \" active\";\n } else {\n styleName += \" inactive\";\n }\n } else {\n styleName += \" inactive\";\n }\n\n if (isPlaceholder(item)) {\n styleName += \" placeholder\";\n }\n\n if (isFocused(item)) {\n styleName += \" focused\";\n }\n if (hidden) {\n styleName += \" hidden\";\n }\n return styleName;\n };\n this._renderedItems = valuesToRender.filter((p) => !isPlaceholder(p));\n const section = (p: InternalSelectionModel) => {\n const onClick = () => {\n if (isPlaceholder(p)) {\n if (p.index < 0) {\n this.focusSibling(-this._renderedItems.length);\n } else {\n this.focusSibling(this._renderedItems.length);\n }\n return;\n }\n if (this._readonly) {\n return;\n }\n\n this.value = p.id;\n this.fireValueChange();\n };\n const index = allItems.indexOf(p);\n const visuallyHidden = valuesToRender.indexOf(p) == -1;\n const zIndex = visuallyHidden ? -1 : allItems.length - index;\n\n return html`\n <div\n role=\"option\"\n style=\"z-index: ${zIndex}\"\n id=\"${ifDefined(!isPlaceholder(p) && p.index ? \"stage-option-\" + p.index : undefined)}\"\n aria-hidden=\"${ifDefined(isPlaceholder(p) ? true : undefined)}\"\n aria-selected=${ifDefined(\n this._readonly || isPlaceholder(p) ? undefined : isSelected(p) ? \"true\" : \"false\",\n )}\n tabindex=\"${isFocused(p) ? 0 : -1}\"\n @keydown=\"${(e) => this.onKeyDown(e)}\"\n @keyup=\"${(e) => this.onKeyUp(e, () => onClick())}\"\n @click=\"${() => onClick()}\"\n class=\"${getClassName(p)}\"\n >\n <div class=\"content\" title=\"${p.label}\">\n <div class=\"index\" aria-hidden=\"true\">${isPlaceholder(p) ? \"\" : p.index + 1}</div>\n <div class=\"label\">${p.label}</div>\n </div>\n <div class=\"arrow\"></div>\n </div>\n `;\n };\n const selected = allItems.find((p) => p.index == selectedIndex);\n const focused = allItems.find((p) => p.index == this._focusIndex);\n const sections = html`<div\n class=\"sections\"\n role=\"listbox\"\n aria-activedescendant=\"${ifDefined(focused?.index ? \"stage-option-\" + focused.index : undefined)}\"\n aria-orientation=\"horizontal\"\n aria-valuenow=${ifDefined(selected?.label)}\n ?aria-readonly=\"${this._readonly}\"\n >\n ${repeat(\n allItems,\n (p) => p.id,\n (p) => section(p),\n )}\n </div>`;\n\n return html`${sections}${baseTemplate}`;\n }\n\n private onKeyDown(e: KeyboardEvent): void {\n if (this.isSpaceOrEnter(e)) {\n this._isSpaceOrEnterKeyDown = true;\n e.preventDefault(); // prevent potential scroll-down triggered by space\n }\n }\n\n private onKeyUp(e: KeyboardEvent, onClick: VoidFunction): void {\n if (this.isSpaceOrEnter(e) && this._isSpaceOrEnterKeyDown == true) {\n this._isSpaceOrEnterKeyDown = false;\n onClick();\n }\n }\n\n private updatePossibleValuesFromOptionElements(): void {\n const options: HTMLOptionElement[] = Array.prototype.map.call(\n this.querySelectorAll(\"option\"),\n (p) => p as HTMLOptionElement,\n );\n this.possibleValues =\n options.length > 0 ? options.map((p) => ({ id: p.value, label: p.innerText })) : this.possibleValues;\n }\n\n private isSpaceOrEnter(event: KeyboardEvent): boolean {\n switch (event.key) {\n case \" \":\n case \"Space\":\n case \"Enter\":\n return true;\n default:\n return false;\n }\n }\n\n private fireValueChange(): void {\n this.dispatchEvent(new CustomEvent<IValueChangeEvent>(`value-change`, { detail: { value: this.value } }));\n }\n}\n\nStage.ensureDefined();\n"],"names":["isSelectionModel","value","_Stage","_a","LitElement","css","unsafeCSS","style","readonly","possibleValues","offset","index","item","p","_changedProperties","e","availableWidth","optionsSlot","html","validation","baseTemplate","values","i","placeholder1","placeholder2","minItemWidth","placeholderWidth","allItems","valuesToRender","computeMaxVisibleItems","resetComputationVariables","computeVisibleRange","focusIndex","center","visibleItems","needsHead","needsTail","start","end","oldStart","oldEnd","headOrTailChangedInThisRound","updatedRange","centerItems","placeholderHead","placeholderTail","selectedIndex","isPlaceholder","isFocused","isSelected","isActive","getClassName","hidden","styleName","section","onClick","zIndex","ifDefined","selected","focused","sections","repeat","options","event","__decorateClass","property","ValidationLevel","Stage"],"mappings":";;;;;;;;;;;AAgCA,SAASA,EAAiBC,GAAiD;AACvE,SAAQA,EAA0B,SAAS,QAASA,EAA0B,MAAM;AACxF;;AAiCO,MAAMC,KAANC,IAAA,cAAoBC,EAAW;AAAA,EAA/B,cAAA;AAAA,UAAA,GAAA,SAAA,GAcH,KAAQ,yBAAyB,IACjC,KAAQ,cAAc,IACtB,KAAQ,qBAAqB;AAAA,EAAA;AAAA,EAE7B,WAAW,SAAS;AACT,WAAA;AAAA,MACHC;AAAA,kBACMC,EAAUC,CAAK,CAAC;AAAA;AAAA,IAAA;AAAA,EAG9B;AAAA,EAiBA,IAAI,QAA2B;AAC3B,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,MAAMN,GAA0B;AAC5B,IAAA,KAAK,WAAWA,MAChB,KAAK,SAASA,GACd,KAAK,cAAc,KAAK,oBAAoB,KAAK,KAAK,GACtD,KAAK,cAAc;AAAA,EAE3B;AAAA,EAGA,IAAI,WAAoB;AACpB,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,SAASO,GAAmB;AAC5B,SAAK,YAAYA,GACZ,KAAA,UAAU,OAAO,UAAU,GAC5B,KAAK,aACA,KAAA,UAAU,IAAI,UAAU,GAEjC,KAAK,cAAc,UAAU;AAAA,EACjC;AAAA,EAEA,IAAI,iBAAmC;AACnC,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,eAAeC,GAAkC;AACjD,SA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F,WAAA,qBAAA,CAAA;AAEA8D,EAAA;AAAA,EADNC,EAAS,EAAE,MAAM,QAAQ;AAAA,GA5BjB/D,EA6BF,WAAA,qBAAA,CAAA;AAEA8D,EAAA;AAAA,EADNC,EAAS,EAAE,MAAMC,GAAiB,SAAS,IAAM;AAAA,GA9BzChE,EA+BF,WAAA,mBAAA,CAAA;AAUH8D,EAAA;AAAA,EARHC,EAAS;AAAA,IACN,SAAS;AAAA,IACT,WAAW;AAAA,IACX,WAAW;AAAA,MACP,eAAe,CAAChE,MAA2BA;AAAA,MAC3C,aAAa,CAACA,MAA8CA;AAAA,IAChE;AAAA,EAAA,CACH;AAAA,GAxCQC,EAyCL,WAAA,SAAA,CAAA;AAaA8D,EAAA;AAAA,EADHC,EAAS,EAAE,MAAM,SAAS,WAAW,IAAM,SAAS,IAAM;AAAA,GArDlD/D,EAsDL,WAAA,YAAA,CAAA;AAtDD,IAAMiE,KAANjE;AAwZPiE,GAAM,cAAc;"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@cypress/vite-dev-server@5.0.7": {
|
|
3
|
+
"licenses": "MIT",
|
|
4
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
5
|
+
"licenseUrl": "https://github.com/cypress-io/cypress/tree/develop/npm/vite-dev-server#readme"
|
|
6
|
+
},
|
|
7
|
+
"@rollup/plugin-node-resolve@15.2.3": {
|
|
8
|
+
"licenses": "MIT",
|
|
9
|
+
"repository": "https://github.com/rollup/plugins",
|
|
10
|
+
"licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
|
|
11
|
+
},
|
|
12
|
+
"@types/node@20.10.6": {
|
|
13
|
+
"licenses": "MIT",
|
|
14
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
15
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
16
|
+
},
|
|
17
|
+
"@types/postcss-prefix-selector@1.16.3": {
|
|
18
|
+
"licenses": "MIT",
|
|
19
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
20
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
21
|
+
},
|
|
22
|
+
"@typescript-eslint/eslint-plugin@6.17.0": {
|
|
23
|
+
"licenses": "MIT",
|
|
24
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
25
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
26
|
+
},
|
|
27
|
+
"@typescript-eslint/parser@6.17.0": {
|
|
28
|
+
"licenses": "BSD-2-Clause",
|
|
29
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
30
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
31
|
+
},
|
|
32
|
+
"@vitest/coverage-v8@1.1.1": {
|
|
33
|
+
"licenses": "MIT",
|
|
34
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
35
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
36
|
+
},
|
|
37
|
+
"@vitest/ui@1.1.1": {
|
|
38
|
+
"licenses": "MIT",
|
|
39
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
40
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
41
|
+
},
|
|
42
|
+
"axe-core@4.8.3": {
|
|
43
|
+
"licenses": "MPL-2.0",
|
|
44
|
+
"repository": "https://github.com/dequelabs/axe-core",
|
|
45
|
+
"licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
|
|
46
|
+
},
|
|
47
|
+
"cypress-axe@1.5.0": {
|
|
48
|
+
"licenses": "MIT",
|
|
49
|
+
"repository": "https://github.com/component-driven/cypress-axe",
|
|
50
|
+
"licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
|
|
51
|
+
},
|
|
52
|
+
"cypress-real-events@1.13.0": {
|
|
53
|
+
"licenses": "MIT",
|
|
54
|
+
"repository": "https://github.com/dmtrKovalenko/cypress-real-events",
|
|
55
|
+
"licenseUrl": "https://github.com/dmtrKovalenko/cypress-real-events"
|
|
56
|
+
},
|
|
57
|
+
"cypress@13.6.2": {
|
|
58
|
+
"licenses": "MIT",
|
|
59
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
60
|
+
"licenseUrl": "https://cypress.io"
|
|
61
|
+
},
|
|
62
|
+
"esbuild@0.19.11": {
|
|
63
|
+
"licenses": "MIT",
|
|
64
|
+
"repository": "https://github.com/evanw/esbuild",
|
|
65
|
+
"licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
|
|
66
|
+
},
|
|
67
|
+
"eslint-config-google@0.14.0": {
|
|
68
|
+
"licenses": "Apache-2.0",
|
|
69
|
+
"repository": "https://github.com/google/eslint-config-google",
|
|
70
|
+
"licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
|
|
71
|
+
},
|
|
72
|
+
"eslint-config-prettier@9.1.0": {
|
|
73
|
+
"licenses": "MIT",
|
|
74
|
+
"repository": "https://github.com/prettier/eslint-config-prettier",
|
|
75
|
+
"licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
|
|
76
|
+
},
|
|
77
|
+
"eslint@8.56.0": {
|
|
78
|
+
"licenses": "MIT",
|
|
79
|
+
"repository": "https://github.com/eslint/eslint",
|
|
80
|
+
"licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
|
|
81
|
+
},
|
|
82
|
+
"github-markdown-css@5.5.0": {
|
|
83
|
+
"licenses": "MIT",
|
|
84
|
+
"repository": "https://github.com/sindresorhus/github-markdown-css",
|
|
85
|
+
"licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
|
|
86
|
+
},
|
|
87
|
+
"highlight.js@11.9.0": {
|
|
88
|
+
"licenses": "BSD-3-Clause",
|
|
89
|
+
"repository": "https://github.com/highlightjs/highlight.js",
|
|
90
|
+
"licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
|
|
91
|
+
},
|
|
92
|
+
"junit-report-builder@3.1.0": {
|
|
93
|
+
"licenses": "MIT",
|
|
94
|
+
"repository": "https://github.com/davidparsson/junit-report-builder",
|
|
95
|
+
"licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
|
|
96
|
+
},
|
|
97
|
+
"lint-staged@15.2.0": {
|
|
98
|
+
"licenses": "MIT",
|
|
99
|
+
"repository": "https://github.com/okonet/lint-staged",
|
|
100
|
+
"licenseUrl": "https://github.com/okonet/lint-staged/raw/HEAD/LICENSE"
|
|
101
|
+
},
|
|
102
|
+
"lit@2.8.0": {
|
|
103
|
+
"licenses": "BSD-3-Clause",
|
|
104
|
+
"repository": "https://github.com/lit/lit",
|
|
105
|
+
"licenseUrl": "https://github.com/lit/lit/raw/HEAD/LICENSE"
|
|
106
|
+
},
|
|
107
|
+
"marked@11.1.1": {
|
|
108
|
+
"licenses": "MIT",
|
|
109
|
+
"repository": "https://github.com/markedjs/marked",
|
|
110
|
+
"licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
|
|
111
|
+
},
|
|
112
|
+
"postcss-prefix-selector@1.16.0": {
|
|
113
|
+
"licenses": "MIT",
|
|
114
|
+
"repository": "https://github.com/RadValentin/postcss-prefix-selector",
|
|
115
|
+
"licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
|
|
116
|
+
},
|
|
117
|
+
"postcss@8.4.32": {
|
|
118
|
+
"licenses": "MIT",
|
|
119
|
+
"repository": "https://github.com/postcss/postcss",
|
|
120
|
+
"licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
|
|
121
|
+
},
|
|
122
|
+
"prettier@3.1.1": {
|
|
123
|
+
"licenses": "MIT",
|
|
124
|
+
"repository": "https://github.com/prettier/prettier",
|
|
125
|
+
"licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
|
|
126
|
+
},
|
|
127
|
+
"resolve-pkg@2.0.0": {
|
|
128
|
+
"licenses": "MIT",
|
|
129
|
+
"repository": "https://github.com/sindresorhus/resolve-pkg",
|
|
130
|
+
"licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
|
|
131
|
+
},
|
|
132
|
+
"sass@1.69.6": {
|
|
133
|
+
"licenses": "MIT",
|
|
134
|
+
"repository": "https://github.com/sass/dart-sass",
|
|
135
|
+
"licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
|
|
136
|
+
},
|
|
137
|
+
"stylelint-config-recommended-scss@14.0.0": {
|
|
138
|
+
"licenses": "MIT",
|
|
139
|
+
"repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
|
|
140
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
|
|
141
|
+
},
|
|
142
|
+
"stylelint-config-standard@36.0.0": {
|
|
143
|
+
"licenses": "MIT",
|
|
144
|
+
"repository": "https://github.com/stylelint/stylelint-config-standard",
|
|
145
|
+
"licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
|
|
146
|
+
},
|
|
147
|
+
"stylelint-scss@6.0.0": {
|
|
148
|
+
"licenses": "MIT",
|
|
149
|
+
"repository": "https://github.com/stylelint-scss/stylelint-scss",
|
|
150
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
|
|
151
|
+
},
|
|
152
|
+
"stylelint@16.1.0": {
|
|
153
|
+
"licenses": "MIT",
|
|
154
|
+
"repository": "https://github.com/stylelint/stylelint",
|
|
155
|
+
"licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
|
|
156
|
+
},
|
|
157
|
+
"tsup@8.0.1": {
|
|
158
|
+
"licenses": "MIT",
|
|
159
|
+
"repository": "https://github.com/egoist/tsup",
|
|
160
|
+
"licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
|
|
161
|
+
},
|
|
162
|
+
"turbo@1.11.2": {
|
|
163
|
+
"licenses": "MPL-2.0",
|
|
164
|
+
"repository": "https://github.com/vercel/turbo",
|
|
165
|
+
"licenseUrl": "https://github.com/vercel/turbo/raw/HEAD/LICENSE"
|
|
166
|
+
},
|
|
167
|
+
"typescript@5.3.3": {
|
|
168
|
+
"licenses": "Apache-2.0",
|
|
169
|
+
"repository": "https://github.com/Microsoft/TypeScript",
|
|
170
|
+
"licenseUrl": "https://github.com/Microsoft/TypeScript/raw/HEAD/LICENSE.txt"
|
|
171
|
+
},
|
|
172
|
+
"vite-tsconfig-paths@4.2.3": {
|
|
173
|
+
"licenses": "MIT",
|
|
174
|
+
"repository": "https://github.com/aleclarson/vite-tsconfig-paths",
|
|
175
|
+
"licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
|
|
176
|
+
},
|
|
177
|
+
"vite@5.0.10": {
|
|
178
|
+
"licenses": "MIT",
|
|
179
|
+
"repository": "https://github.com/vitejs/vite",
|
|
180
|
+
"licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
|
|
181
|
+
},
|
|
182
|
+
"vitest@1.1.1": {
|
|
183
|
+
"licenses": "MIT",
|
|
184
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
185
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
|
|
186
|
+
},
|
|
187
|
+
"yargs@17.7.2": {
|
|
188
|
+
"licenses": "MIT",
|
|
189
|
+
"repository": "https://github.com/yargs/yargs",
|
|
190
|
+
"licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
|
|
191
|
+
}
|
|
192
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cas-smartdesign/stage",
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "An element which can be used to represent the progress in a given workflow",
|
|
5
|
+
"main": "dist/stage-with-externals.js",
|
|
6
|
+
"module": "dist/stage.mjs",
|
|
7
|
+
"types": "dist/stage.d.ts",
|
|
8
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"lit": "^2.8.0",
|
|
11
|
+
"@cas-smartdesign/field-validation-message": "^5.0.1"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@cas-smartdesign/element-preview": "^0.2.1",
|
|
15
|
+
"@cas-smartdesign/license-generator": "^1.6.1"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"npm-third-party-licenses.json"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"registry": "https://registry.npmjs.org/",
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"version": "pnpm version",
|
|
27
|
+
"generate-declaration": "tsc -p tsconfig.types.json",
|
|
28
|
+
"build:no-license": "vite build && pnpm generate-declaration && vite build --mode documentation",
|
|
29
|
+
"build": "pnpm generate-license && pnpm build:no-license",
|
|
30
|
+
"watch": "vite build --watch",
|
|
31
|
+
"dev": "vite",
|
|
32
|
+
"generate-license": "sd-license-generator --r ../../"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @cas-smartdesign/stage
|
|
2
|
+
|
|
3
|
+
An element which can be used to represent the progress in a given workflow
|
|
4
|
+
|
|
5
|
+
## Attributes
|
|
6
|
+
|
|
7
|
+
- `value`: **_string|number (default: undefined)_**
|
|
8
|
+
- The current value of the element
|
|
9
|
+
- `readonly`: **_boolean (default: false)_**
|
|
10
|
+
- A flag which determines whether the value can be changed or not
|
|
11
|
+
|
|
12
|
+
## Properties
|
|
13
|
+
|
|
14
|
+
- `value`: **_string|number (default: undefined)_**
|
|
15
|
+
- The current value of the element
|
|
16
|
+
- `readonly`: **_boolean (default: false)_**
|
|
17
|
+
- A flag which determines whether the value can be changed or not
|
|
18
|
+
- `possibleValues`: **_SelectionModel[] (default: undefined)_**
|
|
19
|
+
- A collection of possible values. Examples:
|
|
20
|
+
- `[1,2,3]`
|
|
21
|
+
- `["A","B","C"]`
|
|
22
|
+
- `[{id: "0x12345", label: "A"}, {id: "0x67890", label: "B"}]`
|
|
23
|
+
|
|
24
|
+
## Events
|
|
25
|
+
|
|
26
|
+
- `value-change`
|
|
27
|
+
- Dispatched when the value is changed by user interaction. Contains the current value in the event details.
|
|
28
|
+
|
|
29
|
+
## Validation
|
|
30
|
+
|
|
31
|
+
The element could show validation messages via an `sd-field-validation-message` element which can be configured with the following attributes & properties which are all delegated to that:
|
|
32
|
+
|
|
33
|
+
- `validationMessage`
|
|
34
|
+
- `validationIconSrc`
|
|
35
|
+
- `validationLevel`
|
|
36
|
+
|
|
37
|
+
## Styling
|
|
38
|
+
|
|
39
|
+
The element is configured to use `@cas-smartdesign/design-tokens` package and in addition allows component level customization too via the following css properties:
|
|
40
|
+
|
|
41
|
+
- `--component-stage-border-color`
|
|
42
|
+
- `--component-stage-border-focus-color`
|
|
43
|
+
- `--component-stage-border-highlight-color`
|
|
44
|
+
- `--component-stage-inactive-color`
|
|
45
|
+
- `--component-stage-active-color`
|
|
46
|
+
- `--component-stage-selected-color`
|
|
47
|
+
- `--component-stage-hover-color`
|
|
48
|
+
- `--component-stage-focus-color`
|
|
49
|
+
- `--component-stage-font-color`
|
|
50
|
+
- `--component-stage-font-inactive-color`
|
|
51
|
+
- `--component-stage-font-selected-color`
|
|
52
|
+
- `--component-stage-font-hover-color`
|
|
53
|
+
- `--component-stage-font-focus-color`
|
|
54
|
+
- `--component-stage-font-size`
|
|
55
|
+
- `--component-stage-font-family`
|
|
56
|
+
- `--component-stage-transition-time-short`
|
|
57
|
+
|
|
58
|
+
## Examples
|