@aceshooting/lyra-ui 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -10
- package/custom-elements.json +15118 -8342
- package/dist/components/chart/chart.d.ts +57 -1
- package/dist/components/chart/chart.js +202 -12
- package/dist/components/chart/chart.stories.d.ts +32 -0
- package/dist/components/chart/chart.stories.js +141 -0
- package/dist/components/chart/chart.styles.js +16 -0
- package/dist/components/chart/histogram.d.ts +2 -0
- package/dist/components/chart/histogram.js +18 -2
- package/dist/components/chart/line-chart.stories.d.ts +17 -0
- package/dist/components/chart/line-chart.stories.js +75 -0
- package/dist/components/chart/lite-chart.d.ts +83 -0
- package/dist/components/chart/lite-chart.js +424 -0
- package/dist/components/chart/lite-chart.stories.d.ts +14 -0
- package/dist/components/chart/lite-chart.stories.js +114 -0
- package/dist/components/chart/lite-chart.styles.d.ts +1 -0
- package/dist/components/chart/lite-chart.styles.js +83 -0
- package/dist/components/combobox/combobox.d.ts +9 -0
- package/dist/components/combobox/combobox.js +76 -13
- package/dist/components/combobox/combobox.stories.d.ts +18 -0
- package/dist/components/combobox/combobox.stories.js +75 -0
- package/dist/components/date-picker/calendar-core.js +13 -2
- package/dist/components/date-picker/date-input.d.ts +9 -1
- package/dist/components/date-picker/date-input.js +55 -7
- package/dist/components/date-picker/date-input.stories.d.ts +5 -0
- package/dist/components/date-picker/date-input.stories.js +36 -0
- package/dist/components/date-picker/date-picker.d.ts +11 -3
- package/dist/components/date-picker/date-picker.js +87 -37
- package/dist/components/date-picker/date-picker.stories.d.ts +4 -0
- package/dist/components/date-picker/date-picker.stories.js +12 -0
- package/dist/components/date-picker/date-picker.styles.js +1 -1
- package/dist/components/empty/empty.d.ts +12 -1
- package/dist/components/empty/empty.js +20 -3
- package/dist/components/empty/empty.stories.d.ts +2 -0
- package/dist/components/empty/empty.stories.js +20 -0
- package/dist/components/empty/empty.styles.js +11 -0
- package/dist/components/export-button/csv.js +6 -2
- package/dist/components/export-button/export-button.d.ts +15 -1
- package/dist/components/export-button/export-button.js +89 -12
- package/dist/components/export-button/export-button.stories.d.ts +1 -0
- package/dist/components/export-button/export-button.stories.js +5 -0
- package/dist/components/export-button/export-button.styles.js +11 -3
- package/dist/components/file-input/accept.d.ts +8 -2
- package/dist/components/file-input/accept.js +9 -3
- package/dist/components/file-input/file-input.d.ts +5 -2
- package/dist/components/file-input/file-input.js +23 -8
- package/dist/components/file-input/file-input.stories.d.ts +2 -0
- package/dist/components/file-input/file-input.stories.js +9 -0
- package/dist/components/flag/flag.d.ts +69 -3
- package/dist/components/flag/flag.js +107 -30
- package/dist/components/flag/flag.stories.d.ts +1 -0
- package/dist/components/flag/flag.stories.js +14 -0
- package/dist/components/flag/flag.styles.js +1 -1
- package/dist/components/flag/language-map.d.ts +11 -0
- package/dist/components/flag/language-map.js +12 -1
- package/dist/components/gauge/gauge.d.ts +2 -0
- package/dist/components/gauge/gauge.js +19 -5
- package/dist/components/gauge/gauge.stories.d.ts +2 -0
- package/dist/components/gauge/gauge.stories.js +6 -0
- package/dist/components/graph/graph-loader.d.ts +28 -0
- package/dist/components/graph/graph-loader.js +44 -0
- package/dist/components/graph/graph.d.ts +41 -15
- package/dist/components/graph/graph.js +146 -71
- package/dist/components/graph/graph.stories.d.ts +3 -0
- package/dist/components/graph/graph.stories.js +38 -0
- package/dist/components/graph/graph.styles.js +6 -1
- package/dist/components/heatmap/calendar-grid.d.ts +7 -0
- package/dist/components/heatmap/calendar-grid.js +27 -10
- package/dist/components/heatmap/heatmap.d.ts +149 -12
- package/dist/components/heatmap/heatmap.js +445 -28
- package/dist/components/heatmap/heatmap.stories.d.ts +22 -0
- package/dist/components/heatmap/heatmap.stories.js +155 -0
- package/dist/components/heatmap/heatmap.styles.js +60 -2
- package/dist/components/map/map.d.ts +17 -1
- package/dist/components/map/map.js +68 -21
- package/dist/components/map/map.stories.d.ts +10 -0
- package/dist/components/map/map.stories.js +107 -12
- package/dist/components/map/map.styles.js +2 -2
- package/dist/components/playback/playback.d.ts +6 -2
- package/dist/components/playback/playback.js +36 -12
- package/dist/components/playback/playback.stories.d.ts +2 -0
- package/dist/components/playback/playback.stories.js +6 -0
- package/dist/components/playback/playback.styles.js +10 -2
- package/dist/components/select/select.d.ts +125 -0
- package/dist/components/select/select.js +480 -0
- package/dist/components/select/select.stories.d.ts +21 -0
- package/dist/components/select/select.stories.js +91 -0
- package/dist/components/select/select.styles.d.ts +1 -0
- package/dist/components/select/select.styles.js +212 -0
- package/dist/components/skeleton/skeleton.js +4 -7
- package/dist/components/sparkline/sparkline.d.ts +1 -1
- package/dist/components/sparkline/sparkline.js +40 -13
- package/dist/components/sparkline/sparkline.stories.d.ts +4 -0
- package/dist/components/sparkline/sparkline.stories.js +22 -0
- package/dist/components/split/split.d.ts +24 -3
- package/dist/components/split/split.js +155 -31
- package/dist/components/split/split.stories.d.ts +2 -0
- package/dist/components/split/split.stories.js +20 -0
- package/dist/components/stat/stat.d.ts +43 -1
- package/dist/components/stat/stat.js +97 -4
- package/dist/components/stat/stat.stories.d.ts +4 -0
- package/dist/components/stat/stat.stories.js +66 -1
- package/dist/components/stat/stat.styles.js +64 -0
- package/dist/components/table/table.d.ts +64 -2
- package/dist/components/table/table.js +213 -17
- package/dist/components/table/table.stories.d.ts +6 -0
- package/dist/components/table/table.stories.js +45 -0
- package/dist/components/table/table.styles.js +51 -4
- package/dist/components/time-range/time-range.d.ts +34 -5
- package/dist/components/time-range/time-range.js +217 -36
- package/dist/components/time-range/time-range.stories.d.ts +2 -0
- package/dist/components/time-range/time-range.stories.js +13 -0
- package/dist/components/time-range/time-range.styles.js +44 -2
- package/dist/components/toast/toast-item.d.ts +14 -2
- package/dist/components/toast/toast-item.js +134 -17
- package/dist/components/toast/toast-item.styles.js +28 -2
- package/dist/components/toast/toast.stories.d.ts +3 -0
- package/dist/components/toast/toast.stories.js +41 -1
- package/dist/components/toast/toast.styles.js +11 -11
- package/dist/components/toast/toaster.d.ts +1 -1
- package/dist/components/toast/toaster.js +13 -6
- package/dist/components/tree/tree-node.d.ts +13 -7
- package/dist/components/tree/tree-node.js +24 -10
- package/dist/components/tree/tree.d.ts +64 -15
- package/dist/components/tree/tree.js +113 -22
- package/dist/components/tree/tree.stories.d.ts +4 -0
- package/dist/components/tree/tree.stories.js +31 -1
- package/dist/components/tree/update-cascade.d.ts +13 -0
- package/dist/components/tree/update-cascade.js +13 -0
- package/dist/components/widget/widget.d.ts +25 -1
- package/dist/components/widget/widget.js +164 -6
- package/dist/components/widget/widget.stories.d.ts +3 -0
- package/dist/components/widget/widget.stories.js +43 -0
- package/dist/components/widget/widget.styles.js +20 -3
- package/dist/components/word-cloud/word-cloud-layout.d.ts +63 -0
- package/dist/components/word-cloud/word-cloud-layout.js +145 -0
- package/dist/components/word-cloud/word-cloud.d.ts +65 -0
- package/dist/components/word-cloud/word-cloud.js +255 -0
- package/dist/components/word-cloud/word-cloud.stories.d.ts +10 -0
- package/dist/components/word-cloud/word-cloud.stories.js +55 -0
- package/dist/components/word-cloud/word-cloud.styles.d.ts +1 -0
- package/dist/components/word-cloud/word-cloud.styles.js +55 -0
- package/dist/internal/a11y.js +2 -1
- package/dist/internal/rtl.d.ts +7 -0
- package/dist/internal/rtl.js +9 -0
- package/dist/lyra.d.ts +9 -1
- package/dist/lyra.js +6 -0
- package/llms-full.txt +962 -276
- package/llms.txt +12 -9
- package/package.json +6 -4
|
@@ -16,8 +16,8 @@ import { styles } from './playback.styles.js';
|
|
|
16
16
|
* play-timers in time-series dashboards.
|
|
17
17
|
*
|
|
18
18
|
* @customElement lyra-playback
|
|
19
|
-
* @event lyra-play
|
|
20
|
-
* @event lyra-pause
|
|
19
|
+
* @event lyra-play - Fired when playback starts.
|
|
20
|
+
* @event lyra-pause - Fired when playback stops (including auto-pause).
|
|
21
21
|
* @event lyra-step - `detail: { index }`, fired on every tick and manual step.
|
|
22
22
|
* @csspart base, play-button, slider
|
|
23
23
|
*/
|
|
@@ -39,6 +39,10 @@ export class LyraPlayback extends LyraElement {
|
|
|
39
39
|
this.hidden = false;
|
|
40
40
|
}
|
|
41
41
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
42
|
+
/** Largest index reachable at the current `length` (never negative). */
|
|
43
|
+
get maxIndex() {
|
|
44
|
+
return Math.max(0, this.length - 1);
|
|
45
|
+
}
|
|
42
46
|
disconnectedCallback() {
|
|
43
47
|
super.disconnectedCallback();
|
|
44
48
|
this.pause();
|
|
@@ -46,12 +50,18 @@ export class LyraPlayback extends LyraElement {
|
|
|
46
50
|
willUpdate(changed) {
|
|
47
51
|
if (changed.has('hidden') && this.hidden)
|
|
48
52
|
this.pause();
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.
|
|
53
|
+
if (changed.has('length')) {
|
|
54
|
+
// If length is externally reduced to <= 1 while playing, the timer
|
|
55
|
+
// would otherwise keep firing forever — and the play button (the only
|
|
56
|
+
// control that could stop it) becomes ?disabled at that point, leaving
|
|
57
|
+
// no way to stop it from the rendered UI.
|
|
58
|
+
if (this.length <= 1)
|
|
59
|
+
this.pause();
|
|
60
|
+
// Re-clamp `index` into the new `[0, length)` range on any shrink, not
|
|
61
|
+
// just the <= 1 case above, so it never lingers out of bounds.
|
|
62
|
+
if (this.index > this.maxIndex)
|
|
63
|
+
this.index = this.maxIndex;
|
|
64
|
+
}
|
|
55
65
|
}
|
|
56
66
|
/** Start playback; no-op if there's nothing to advance through. */
|
|
57
67
|
play() {
|
|
@@ -59,20 +69,33 @@ export class LyraPlayback extends LyraElement {
|
|
|
59
69
|
return;
|
|
60
70
|
this.playing = true;
|
|
61
71
|
this.emit('lyra-play');
|
|
62
|
-
this.
|
|
72
|
+
this.scheduleTick();
|
|
63
73
|
}
|
|
64
74
|
/** Stop playback. */
|
|
65
75
|
pause() {
|
|
66
76
|
if (!this.playing)
|
|
67
77
|
return;
|
|
68
|
-
window.
|
|
78
|
+
window.clearTimeout(this.timer);
|
|
69
79
|
this.timer = undefined;
|
|
70
80
|
this.playing = false;
|
|
71
81
|
this.emit('lyra-pause');
|
|
72
82
|
}
|
|
83
|
+
/** Toggle between playing and paused. */
|
|
73
84
|
toggle() {
|
|
74
85
|
this.playing ? this.pause() : this.play();
|
|
75
86
|
}
|
|
87
|
+
// A self-rescheduling `setTimeout` (rather than one long-lived
|
|
88
|
+
// `setInterval`) so `intervalMs` is re-read fresh before every tick, the
|
|
89
|
+
// same way `tick()` already re-reads `this.loop` on every fire — changing
|
|
90
|
+
// `interval-ms` live takes effect on the very next step instead of only
|
|
91
|
+
// after a pause/play cycle.
|
|
92
|
+
scheduleTick() {
|
|
93
|
+
this.timer = window.setTimeout(() => {
|
|
94
|
+
this.tick();
|
|
95
|
+
if (this.playing)
|
|
96
|
+
this.scheduleTick();
|
|
97
|
+
}, this.intervalMs);
|
|
98
|
+
}
|
|
76
99
|
tick() {
|
|
77
100
|
const next = this.index + 1;
|
|
78
101
|
if (next >= this.length) {
|
|
@@ -104,7 +127,7 @@ export class LyraPlayback extends LyraElement {
|
|
|
104
127
|
/** Jump to an explicit index, pausing playback. */
|
|
105
128
|
goTo(index) {
|
|
106
129
|
this.pause();
|
|
107
|
-
this.setIndex(Math.min(this.
|
|
130
|
+
this.setIndex(Math.min(this.maxIndex, Math.max(0, index)));
|
|
108
131
|
}
|
|
109
132
|
render() {
|
|
110
133
|
return html `
|
|
@@ -122,9 +145,10 @@ export class LyraPlayback extends LyraElement {
|
|
|
122
145
|
part="slider"
|
|
123
146
|
type="range"
|
|
124
147
|
min="0"
|
|
125
|
-
max=${
|
|
148
|
+
max=${this.maxIndex}
|
|
126
149
|
.value=${String(this.index)}
|
|
127
150
|
aria-label="Playback position"
|
|
151
|
+
?disabled=${this.length <= 1}
|
|
128
152
|
@input=${(e) => this.goTo(Number(e.target.value))}
|
|
129
153
|
/>
|
|
130
154
|
</div>
|
|
@@ -8,3 +8,9 @@ export default meta;
|
|
|
8
8
|
export const Default = {
|
|
9
9
|
render: () => html `<lyra-playback length="10" interval-ms="500" loop></lyra-playback>`,
|
|
10
10
|
};
|
|
11
|
+
export const NoLoop = {
|
|
12
|
+
render: () => html `<lyra-playback length="10" interval-ms="500" .loop=${false}></lyra-playback>`,
|
|
13
|
+
};
|
|
14
|
+
export const SingleFrame = {
|
|
15
|
+
render: () => html `<lyra-playback length="1"></lyra-playback>`,
|
|
16
|
+
};
|
|
@@ -11,8 +11,8 @@ export const styles = css `
|
|
|
11
11
|
gap: var(--lyra-space-s);
|
|
12
12
|
}
|
|
13
13
|
[part='play-button'] {
|
|
14
|
-
inline-size:
|
|
15
|
-
block-size:
|
|
14
|
+
inline-size: var(--lyra-icon-button-size);
|
|
15
|
+
block-size: var(--lyra-icon-button-size);
|
|
16
16
|
border-radius: 50%;
|
|
17
17
|
border: 1px solid var(--lyra-color-border);
|
|
18
18
|
background: var(--lyra-color-surface);
|
|
@@ -37,4 +37,12 @@ export const styles = css `
|
|
|
37
37
|
[part='slider'] {
|
|
38
38
|
accent-color: var(--lyra-color-brand);
|
|
39
39
|
}
|
|
40
|
+
[part='slider']:disabled {
|
|
41
|
+
opacity: var(--lyra-opacity-disabled);
|
|
42
|
+
cursor: not-allowed;
|
|
43
|
+
}
|
|
44
|
+
[part='slider']:focus-visible {
|
|
45
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
46
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
47
|
+
}
|
|
40
48
|
`;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
import '../combobox/option.js';
|
|
4
|
+
/**
|
|
5
|
+
* `<lyra-select>` — a plain closed-list dropdown: a direct `<lyra-*>`
|
|
6
|
+
* counterpart to `<wa-select>`/`<wa-option>`. Trigger is a button (not a text
|
|
7
|
+
* input) -- click/Enter/Space/ArrowDown opens it, there's no typing-to-filter.
|
|
8
|
+
* A printable keypress instead jumps (or, while closed, directly selects) the
|
|
9
|
+
* next option whose label starts with what's been typed, like a native
|
|
10
|
+
* `<select>`'s type-ahead.
|
|
11
|
+
*
|
|
12
|
+
* Options are `<lyra-option value>` children, the same element `<lyra-combobox>`
|
|
13
|
+
* uses. Unlike `lyra-combobox` this is single-select only, with no filter/
|
|
14
|
+
* source/with-clear/max-options-visible/empty-text/max-render/multiple surface
|
|
15
|
+
* -- see `<lyra-combobox>` for the filterable/multi-select case.
|
|
16
|
+
*
|
|
17
|
+
* Reuses `lyra-combobox`'s popup positioning (`internal/positioner.js`) and
|
|
18
|
+
* click-outside/Escape/Home/End/Arrow-key listbox navigation patterns,
|
|
19
|
+
* adapted to a trigger button that keeps DOM focus throughout (the listbox's
|
|
20
|
+
* "active" row is conveyed via `aria-activedescendant`, never actual focus),
|
|
21
|
+
* matching the WAI-ARIA "select-only combobox" pattern.
|
|
22
|
+
*
|
|
23
|
+
* @customElement lyra-select
|
|
24
|
+
* @slot - `<lyra-option>` elements.
|
|
25
|
+
* @slot label - Custom label content.
|
|
26
|
+
* @slot hint - Custom hint content.
|
|
27
|
+
* @slot error - Custom error content.
|
|
28
|
+
* @event change - The selection changed.
|
|
29
|
+
* @event input - Fired alongside `change` on every selection change (native
|
|
30
|
+
* `<select>` doesn't meaningfully distinguish the two either).
|
|
31
|
+
* @event lyra-show - The listbox opened.
|
|
32
|
+
* @event lyra-hide - The listbox closed.
|
|
33
|
+
* @csspart form-control - The outer wrapper around label, trigger, listbox, error and hint.
|
|
34
|
+
* @csspart form-control-label - The `<label>` element.
|
|
35
|
+
* @csspart trigger - The trigger button (positioning anchor).
|
|
36
|
+
* @csspart listbox - The options popover.
|
|
37
|
+
* @csspart option - An option row.
|
|
38
|
+
* @csspart option-dot - An option row's leading status dot (when `dot-color` is set).
|
|
39
|
+
* @csspart option-label - An option row's label/sub wrapper.
|
|
40
|
+
* @csspart option-sub - An option row's secondary line (when `sub` is set).
|
|
41
|
+
* @csspart expand-icon - The dropdown indicator.
|
|
42
|
+
* @csspart error - The error message.
|
|
43
|
+
* @csspart hint - The hint message.
|
|
44
|
+
*/
|
|
45
|
+
export type LyraSelectSize = 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
46
|
+
export declare class LyraSelect extends LyraElement {
|
|
47
|
+
static formAssociated: boolean;
|
|
48
|
+
static styles: import("lit").CSSResultGroup[];
|
|
49
|
+
static properties: {
|
|
50
|
+
value: {
|
|
51
|
+
noAccessor: boolean;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
placeholder: string;
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
required: boolean;
|
|
57
|
+
name: string;
|
|
58
|
+
label: string;
|
|
59
|
+
hint: string;
|
|
60
|
+
errorText: string;
|
|
61
|
+
open: boolean;
|
|
62
|
+
/** Visual size — same `xs`–`xl` scale as `lyra-toast-item`'s `size`. */
|
|
63
|
+
size: LyraSelectSize;
|
|
64
|
+
private activeIndex;
|
|
65
|
+
private options;
|
|
66
|
+
private touched;
|
|
67
|
+
private hasHintSlot;
|
|
68
|
+
private hasErrorSlot;
|
|
69
|
+
private hasLabelSlot;
|
|
70
|
+
private internals;
|
|
71
|
+
private listId;
|
|
72
|
+
private triggerId;
|
|
73
|
+
private cleanup?;
|
|
74
|
+
private _isFirstUpdate;
|
|
75
|
+
private _selected;
|
|
76
|
+
private _defaultSelected;
|
|
77
|
+
private _defaultCaptured;
|
|
78
|
+
private typeAheadBuffer;
|
|
79
|
+
private typeAheadTimer?;
|
|
80
|
+
constructor();
|
|
81
|
+
connectedCallback(): void;
|
|
82
|
+
protected willUpdate(): void;
|
|
83
|
+
/** The selected value: a single string (empty when nothing is selected). */
|
|
84
|
+
get value(): string;
|
|
85
|
+
set value(next: string);
|
|
86
|
+
private updateValidity;
|
|
87
|
+
private syncFormValue;
|
|
88
|
+
formResetCallback(): void;
|
|
89
|
+
formDisabledCallback(disabled: boolean): void;
|
|
90
|
+
checkValidity(): boolean;
|
|
91
|
+
reportValidity(): boolean;
|
|
92
|
+
disconnectedCallback(): void;
|
|
93
|
+
private collectOptions;
|
|
94
|
+
private reflectSelected;
|
|
95
|
+
private show;
|
|
96
|
+
private hide;
|
|
97
|
+
private onDocPointer;
|
|
98
|
+
protected updated(changed: PropertyValues): void;
|
|
99
|
+
private selectOption;
|
|
100
|
+
private onTriggerClick;
|
|
101
|
+
private onTriggerBlur;
|
|
102
|
+
private onHintSlotChange;
|
|
103
|
+
private onErrorSlotChange;
|
|
104
|
+
private onLabelSlotChange;
|
|
105
|
+
/**
|
|
106
|
+
* Standard listbox type-ahead: moves to the next non-disabled option whose
|
|
107
|
+
* label starts with the accumulated buffer, cycling from just after the
|
|
108
|
+
* "current" option (the active row while open, the selected value while
|
|
109
|
+
* closed). While open this only moves `activeIndex` (a highlight, matching
|
|
110
|
+
* Arrow-key nav -- Enter/click still commits it); while closed there's no
|
|
111
|
+
* highlight to show, so it commits immediately, matching a native
|
|
112
|
+
* `<select>`'s closed-state type-ahead.
|
|
113
|
+
*/
|
|
114
|
+
private typeAhead;
|
|
115
|
+
private onKeyDown;
|
|
116
|
+
private onListboxMouseDown;
|
|
117
|
+
private onListboxClick;
|
|
118
|
+
private renderRows;
|
|
119
|
+
render(): TemplateResult;
|
|
120
|
+
}
|
|
121
|
+
declare global {
|
|
122
|
+
interface HTMLElementTagNameMap {
|
|
123
|
+
'lyra-select': LyraSelect;
|
|
124
|
+
}
|
|
125
|
+
}
|