kanto-ds 1.7.0 → 1.8.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 +15 -10
- package/dist/cdn/kanto.min.js +887 -234
- package/dist/chunks/{index-TWJzttLX.js → index-BEWmAE0T.js} +21 -7
- package/dist/chunks/index-BEWmAE0T.js.map +1 -0
- package/dist/chunks/{kt-calendar-CtwOby1R.js → kt-calendar-D72xa8qr.js} +3 -3
- package/dist/chunks/{kt-calendar-CtwOby1R.js.map → kt-calendar-D72xa8qr.js.map} +1 -1
- package/dist/chunks/{kt-element-T0VbIBNp.js → kt-element-COgh6Yr1.js} +2 -2
- package/dist/chunks/{kt-element-T0VbIBNp.js.map → kt-element-COgh6Yr1.js.map} +1 -1
- package/dist/chunks/numbers-QyecMiSJ.js +9 -0
- package/dist/chunks/numbers-QyecMiSJ.js.map +1 -0
- package/dist/chunks/{segmented-field-BBXR4XFL.js → segmented-field-BCjCGF4I.js} +2 -2
- package/dist/chunks/{segmented-field-BBXR4XFL.js.map → segmented-field-BCjCGF4I.js.map} +1 -1
- package/dist/chunks/{typed-date-CPAUNHzr.js → typed-date-Z3vcUJbb.js} +2 -2
- package/dist/chunks/{typed-date-CPAUNHzr.js.map → typed-date-Z3vcUJbb.js.map} +1 -1
- package/dist/components/core/kt-avatar/kt-avatar.js +2 -2
- package/dist/components/core/kt-badge/kt-badge.js +2 -2
- package/dist/components/core/kt-button/kt-button.js +1 -1
- package/dist/components/core/kt-card/kt-card.js +1 -1
- package/dist/components/core/kt-code/kt-code.js +2 -2
- package/dist/components/core/kt-icon/kt-icon.js +1 -1
- package/dist/components/core/kt-kbd/kt-kbd.js +1 -1
- package/dist/components/core/kt-split-button/kt-split-button.js +2 -2
- package/dist/components/data/kt-chart/kt-chart.js +2 -2
- package/dist/components/data/kt-meter/kt-meter.js +1 -1
- package/dist/components/data/kt-pagination/kt-pagination.js +2 -2
- package/dist/components/data/kt-stat/kt-stat.js +1 -1
- package/dist/components/data/kt-table/kt-table.js +2 -2
- package/dist/components/data/kt-timeline/kt-timeline.js +1 -1
- package/dist/components/feedback/kt-alert/kt-alert.js +2 -2
- package/dist/components/feedback/kt-empty-state/kt-empty-state.js +1 -1
- package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +1 -1
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js +1 -1
- package/dist/components/feedback/kt-toast/kt-toast.js +2 -2
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js +1 -1
- package/dist/components/feedback/kt-tooltip/kt-tooltip.js +1 -1
- package/dist/components/forms/kt-calendar/kt-calendar.js +3 -3
- package/dist/components/forms/kt-checkbox/kt-checkbox.js +2 -2
- package/dist/components/forms/kt-date-input/kt-date-input.js +5 -5
- package/dist/components/forms/kt-date-picker/kt-date-picker.js +4 -4
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +2 -2
- package/dist/components/forms/kt-form/kt-form.js +2 -2
- package/dist/components/forms/kt-input/kt-input.js +2 -2
- package/dist/components/forms/kt-input-menu/kt-input-menu.js +2 -2
- package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
- package/dist/components/forms/kt-multi-select/kt-multi-select.js +2 -2
- package/dist/components/forms/kt-number-input/kt-number-input.d.ts +89 -0
- package/dist/components/forms/kt-number-input/kt-number-input.js +350 -0
- package/dist/components/forms/kt-number-input/kt-number-input.js.map +1 -0
- package/dist/components/forms/kt-radio-group/kt-radio-group.js +2 -2
- package/dist/components/forms/kt-select/kt-select.js +2 -2
- package/dist/components/forms/kt-slider/kt-slider.d.ts +69 -0
- package/dist/components/forms/kt-slider/kt-slider.js +252 -0
- package/dist/components/forms/kt-slider/kt-slider.js.map +1 -0
- package/dist/components/forms/kt-textarea/kt-textarea.js +2 -2
- package/dist/components/forms/kt-time-input/kt-time-input.js +3 -3
- package/dist/components/forms/kt-toggle/kt-toggle.js +1 -1
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +2 -2
- package/dist/components/navigation/kt-header/kt-header.js +2 -2
- package/dist/components/navigation/kt-page-header/kt-page-header.js +1 -1
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +2 -2
- package/dist/components/navigation/kt-steps/kt-steps.d.ts +65 -0
- package/dist/components/navigation/kt-steps/kt-steps.js +244 -0
- package/dist/components/navigation/kt-steps/kt-steps.js.map +1 -0
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +2 -2
- package/dist/components/navigation/kt-tabs/kt-tabs.js +1 -1
- package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +1 -1
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +2 -2
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js +1 -1
- package/dist/components/overlays/kt-command-palette/kt-command-palette.d.ts +87 -0
- package/dist/components/overlays/kt-command-palette/kt-command-palette.js +370 -0
- package/dist/components/overlays/kt-command-palette/kt-command-palette.js.map +1 -0
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +2 -2
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js +2 -2
- package/dist/components/overlays/kt-modal/kt-modal.js +2 -2
- package/dist/components/overlays/kt-side-panel/kt-side-panel.js +2 -2
- package/dist/custom-elements.json +3279 -1754
- package/dist/docs/kt-command-palette.md +99 -0
- package/dist/docs/kt-number-input.md +77 -0
- package/dist/docs/kt-slider.md +76 -0
- package/dist/docs/kt-steps.md +79 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +105 -97
- package/dist/index.js.map +1 -1
- package/dist/internal/command-search.d.ts +27 -0
- package/dist/internal/numbers.d.ts +2 -0
- package/dist/internal/strings.d.ts +14 -0
- package/dist/react/index.d.ts +31 -0
- package/dist/react/index.js +199 -164
- package/dist/react/index.js.map +1 -1
- package/dist/react/jsx.d.ts +27 -1
- package/dist/strings/index.js +1 -1
- package/dist/tokens/base.css +4 -0
- package/dist/vscode.css-custom-data.json +26 -2
- package/dist/vscode.html-custom-data.json +120 -12
- package/dist/vue/index.d.ts +8 -0
- package/dist/vue/index.js +12 -8
- package/dist/vue/index.js.map +1 -1
- package/dist/web-types.json +347 -39
- package/package.json +20 -3
- package/dist/chunks/index-TWJzttLX.js.map +0 -1
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { css as k, nothing as b, html as d } from "lit";
|
|
2
|
+
import { property as o, state as y } from "lit/decorators.js";
|
|
3
|
+
import { K as v, d as $ } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
|
+
import { e as w } from "../../../chunks/events-r51msXNf.js";
|
|
5
|
+
import { a as S, s as M } from "../../../chunks/form-control-B74_EHtG.js";
|
|
6
|
+
import { s as N } from "../../../chunks/index-BEWmAE0T.js";
|
|
7
|
+
import { d as f } from "../../../chunks/numbers-QyecMiSJ.js";
|
|
8
|
+
var C = Object.defineProperty, r = (u, t, e, n) => {
|
|
9
|
+
for (var a = void 0, i = u.length - 1, l; i >= 0; i--)
|
|
10
|
+
(l = u[i]) && (a = l(t, e, a) || a);
|
|
11
|
+
return a && C(t, e, a), a;
|
|
12
|
+
};
|
|
13
|
+
class s extends v {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.value = "", this.min = 0, this.max = 100, this.step = 1, this.range = !1, this.label = "", this.name = "", this.disabled = !1, this.showValue = !1, this.format = (t) => String(t), this.formDisabled = !1, this.internals = null, this.defaultValue = "";
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.formAssociated = !0;
|
|
19
|
+
}
|
|
20
|
+
static {
|
|
21
|
+
this.styles = [
|
|
22
|
+
v.styles,
|
|
23
|
+
k`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
--kt-slider-thumb: calc(18px * var(--density-scale, 1));
|
|
27
|
+
--kt-slider-track: 6px;
|
|
28
|
+
}
|
|
29
|
+
:host([disabled]) {
|
|
30
|
+
opacity: 0.5;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.head {
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
gap: var(--gap-button);
|
|
37
|
+
margin-bottom: 8px;
|
|
38
|
+
color: var(--text-body);
|
|
39
|
+
font: var(--font-normal-regular);
|
|
40
|
+
}
|
|
41
|
+
.value {
|
|
42
|
+
color: var(--text-muted);
|
|
43
|
+
font-variant-numeric: tabular-nums;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.control {
|
|
47
|
+
position: relative;
|
|
48
|
+
height: var(--kt-slider-thumb);
|
|
49
|
+
}
|
|
50
|
+
.track,
|
|
51
|
+
.fill {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 50%;
|
|
54
|
+
height: var(--kt-slider-track);
|
|
55
|
+
border-radius: var(--radius-full);
|
|
56
|
+
transform: translateY(-50%);
|
|
57
|
+
}
|
|
58
|
+
.track {
|
|
59
|
+
right: 0;
|
|
60
|
+
left: 0;
|
|
61
|
+
background: var(--color-dark-22);
|
|
62
|
+
}
|
|
63
|
+
.fill {
|
|
64
|
+
background: var(--color-primary-base);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* The native inputs lie over the track, invisible but for their thumbs:
|
|
68
|
+
two can share it, and each thumb still catches its own pointer. */
|
|
69
|
+
input {
|
|
70
|
+
position: absolute;
|
|
71
|
+
inset: 0;
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
margin: 0;
|
|
75
|
+
background: none;
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
appearance: none;
|
|
78
|
+
}
|
|
79
|
+
input:focus {
|
|
80
|
+
outline: none;
|
|
81
|
+
}
|
|
82
|
+
input.front {
|
|
83
|
+
z-index: 1;
|
|
84
|
+
}
|
|
85
|
+
input::-webkit-slider-runnable-track {
|
|
86
|
+
height: 100%;
|
|
87
|
+
background: none;
|
|
88
|
+
}
|
|
89
|
+
input::-moz-range-track {
|
|
90
|
+
background: none;
|
|
91
|
+
}
|
|
92
|
+
input::-webkit-slider-thumb {
|
|
93
|
+
width: var(--kt-slider-thumb);
|
|
94
|
+
height: var(--kt-slider-thumb);
|
|
95
|
+
background: var(--color-white);
|
|
96
|
+
border: 2px solid var(--color-primary-base);
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
box-shadow: 0 1px 3px color-mix(in srgb, var(--color-backdrop) 70%, transparent);
|
|
99
|
+
cursor: grab;
|
|
100
|
+
pointer-events: auto;
|
|
101
|
+
appearance: none;
|
|
102
|
+
transition: box-shadow var(--duration-instant);
|
|
103
|
+
}
|
|
104
|
+
input::-moz-range-thumb {
|
|
105
|
+
box-sizing: border-box;
|
|
106
|
+
width: var(--kt-slider-thumb);
|
|
107
|
+
height: var(--kt-slider-thumb);
|
|
108
|
+
background: var(--color-white);
|
|
109
|
+
border: 2px solid var(--color-primary-base);
|
|
110
|
+
border-radius: 50%;
|
|
111
|
+
box-shadow: 0 1px 3px color-mix(in srgb, var(--color-backdrop) 70%, transparent);
|
|
112
|
+
cursor: grab;
|
|
113
|
+
pointer-events: auto;
|
|
114
|
+
}
|
|
115
|
+
input:focus-visible::-webkit-slider-thumb {
|
|
116
|
+
box-shadow:
|
|
117
|
+
0 0 0 4px var(--color-primary-soft),
|
|
118
|
+
0 0 0 2px var(--color-primary-base);
|
|
119
|
+
}
|
|
120
|
+
input:focus-visible::-moz-range-thumb {
|
|
121
|
+
box-shadow:
|
|
122
|
+
0 0 0 4px var(--color-primary-soft),
|
|
123
|
+
0 0 0 2px var(--color-primary-base);
|
|
124
|
+
}
|
|
125
|
+
input:disabled::-webkit-slider-thumb {
|
|
126
|
+
cursor: not-allowed;
|
|
127
|
+
}
|
|
128
|
+
`
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
connectedCallback() {
|
|
132
|
+
super.connectedCallback(), this.internals ??= S(this);
|
|
133
|
+
}
|
|
134
|
+
// Bounded on the first update, not on connect: a script may set `max`
|
|
135
|
+
// after appending the element, and the value must wait for it.
|
|
136
|
+
firstUpdated() {
|
|
137
|
+
this.defaultValue = this.value;
|
|
138
|
+
}
|
|
139
|
+
willUpdate(t) {
|
|
140
|
+
if (t.has("value") || t.has("min") || t.has("max") || t.has("step") || t.has("range")) {
|
|
141
|
+
const e = this.normalised(this.value);
|
|
142
|
+
e !== this.value && (this.value = e), M(this.internals, this.value);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
formResetCallback() {
|
|
146
|
+
this.value = this.defaultValue;
|
|
147
|
+
}
|
|
148
|
+
formDisabledCallback(t) {
|
|
149
|
+
this.formDisabled = t;
|
|
150
|
+
}
|
|
151
|
+
formStateRestoreCallback(t) {
|
|
152
|
+
t !== null && (this.value = t);
|
|
153
|
+
}
|
|
154
|
+
/** The thumbs' numbers: one, or low and high. */
|
|
155
|
+
get numbers() {
|
|
156
|
+
return this.value.split("/").map(Number);
|
|
157
|
+
}
|
|
158
|
+
/** `n` within bounds and on the step. */
|
|
159
|
+
snap(t) {
|
|
160
|
+
if (!Number.isFinite(t)) return this.min;
|
|
161
|
+
const e = this.step > 0 ? this.step : 1, n = this.min + Math.round((t - this.min) / e) * e, a = Math.max(f(e), f(this.min));
|
|
162
|
+
return Number(Math.min(this.max, Math.max(this.min, n)).toFixed(a));
|
|
163
|
+
}
|
|
164
|
+
normalised(t) {
|
|
165
|
+
const e = t === "" ? [] : t.split("/").map(Number);
|
|
166
|
+
if (!this.range) return String(this.snap(e[0] ?? this.min));
|
|
167
|
+
const n = this.snap(e[0] ?? this.min), a = this.snap(e[1] ?? this.max);
|
|
168
|
+
return `${Math.min(n, a)}/${Math.max(n, a)}`;
|
|
169
|
+
}
|
|
170
|
+
/** A thumb moved: the low one cannot pass the high one, nor the other way. */
|
|
171
|
+
onSlide(t, e, n) {
|
|
172
|
+
const a = t.target;
|
|
173
|
+
let i = this.snap(Number(a.value));
|
|
174
|
+
if (this.range) {
|
|
175
|
+
const [l, h] = this.numbers;
|
|
176
|
+
e === 0 ? i = Math.min(i, h) : i = Math.max(i, l), a.value = String(i), this.value = e === 0 ? `${i}/${h}` : `${l}/${i}`;
|
|
177
|
+
} else
|
|
178
|
+
this.value = String(i);
|
|
179
|
+
w(this, n ? "kt-change" : "kt-input", { value: this.value });
|
|
180
|
+
}
|
|
181
|
+
percent(t) {
|
|
182
|
+
return this.max > this.min ? (t - this.min) / (this.max - this.min) * 100 : 0;
|
|
183
|
+
}
|
|
184
|
+
render() {
|
|
185
|
+
const t = N(), e = this.numbers, [n, a] = this.range ? [e[0], e[1]] : [this.min, e[0]], i = this.disabled || this.formDisabled, l = this.range ? `${this.format(e[0])} – ${this.format(e[1])}` : this.format(e[0]), h = (p) => p.charAt(0).toUpperCase() + p.slice(1), g = this.range ? this.label ? [`${this.label}, ${t.sliderMinimum}`, `${this.label}, ${t.sliderMaximum}`] : [h(t.sliderMinimum), h(t.sliderMaximum)] : [this.label], x = this.range && e[0] === e[1] && e[0] > this.min;
|
|
186
|
+
return d`${this.showValue ? d`<div class="head">
|
|
187
|
+
<span>${this.label}</span>
|
|
188
|
+
<span part="value" class="value">${l}</span>
|
|
189
|
+
</div>` : b}
|
|
190
|
+
<div class="control">
|
|
191
|
+
<div part="track" class="track"></div>
|
|
192
|
+
<div
|
|
193
|
+
part="fill"
|
|
194
|
+
class="fill"
|
|
195
|
+
style=${`left: ${this.percent(n)}%; right: ${100 - this.percent(a)}%`}
|
|
196
|
+
></div>
|
|
197
|
+
${e.map(
|
|
198
|
+
(p, m) => d`<input
|
|
199
|
+
class=${m === 0 && x ? "front" : ""}
|
|
200
|
+
type="range"
|
|
201
|
+
min=${this.min}
|
|
202
|
+
max=${this.max}
|
|
203
|
+
step=${this.step}
|
|
204
|
+
.value=${String(p)}
|
|
205
|
+
?disabled=${i}
|
|
206
|
+
aria-label=${g[m] || b}
|
|
207
|
+
aria-valuetext=${this.format(p)}
|
|
208
|
+
@input=${(c) => this.onSlide(c, m, !1)}
|
|
209
|
+
@change=${(c) => this.onSlide(c, m, !0)}
|
|
210
|
+
/>`
|
|
211
|
+
)}
|
|
212
|
+
</div>`;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
r([
|
|
216
|
+
o({ type: String, reflect: !0 })
|
|
217
|
+
], s.prototype, "value");
|
|
218
|
+
r([
|
|
219
|
+
o({ type: Number })
|
|
220
|
+
], s.prototype, "min");
|
|
221
|
+
r([
|
|
222
|
+
o({ type: Number })
|
|
223
|
+
], s.prototype, "max");
|
|
224
|
+
r([
|
|
225
|
+
o({ type: Number })
|
|
226
|
+
], s.prototype, "step");
|
|
227
|
+
r([
|
|
228
|
+
o({ type: Boolean, reflect: !0 })
|
|
229
|
+
], s.prototype, "range");
|
|
230
|
+
r([
|
|
231
|
+
o({ type: String })
|
|
232
|
+
], s.prototype, "label");
|
|
233
|
+
r([
|
|
234
|
+
o({ type: String })
|
|
235
|
+
], s.prototype, "name");
|
|
236
|
+
r([
|
|
237
|
+
o({ type: Boolean, reflect: !0 })
|
|
238
|
+
], s.prototype, "disabled");
|
|
239
|
+
r([
|
|
240
|
+
o({ type: Boolean, attribute: "show-value" })
|
|
241
|
+
], s.prototype, "showValue");
|
|
242
|
+
r([
|
|
243
|
+
o({ attribute: !1 })
|
|
244
|
+
], s.prototype, "format");
|
|
245
|
+
r([
|
|
246
|
+
y()
|
|
247
|
+
], s.prototype, "formDisabled");
|
|
248
|
+
$("kt-slider", s);
|
|
249
|
+
export {
|
|
250
|
+
s as KtSlider
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=kt-slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kt-slider.js","sources":["../../../../src/components/forms/kt-slider/kt-slider.ts"],"sourcesContent":["import { css, html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { KtElement, defineElement } from '#internal/kt-element';\nimport { emit } from '#internal/events';\nimport { attachFormInternals, setFormValue, type UsableInternals } from '#internal/form-control';\nimport { strings } from '#internal/strings';\nimport { decimalsOf } from '#internal/numbers';\n\n/**\n * A value picked by sliding along a range: a volume, a threshold, or with\n * `range`, a price between two ends.\n *\n * Each thumb is a native `<input type=\"range\">`, so the keyboard — arrows,\n * Page Up and Down, Home and End — and what a screen reader announces come\n * from the platform. The value is text, like a form field's: `\"40\"`, or\n * `\"20/80\"` with `range`, low then high. It is kept within `min` and `max`\n * and on `step`, and two thumbs never cross.\n *\n * @element kt-slider\n *\n * @csspart track - The rail.\n * @csspart fill - The selected stretch of it.\n * @csspart value - The shown value, with `show-value`.\n *\n * @fires kt-input - While sliding. `detail: { value }`.\n * @fires kt-change - Once let go. `detail: { value }`.\n *\n * @example\n * ```html\n * <kt-slider label=\"Volume\" value=\"40\" show-value></kt-slider>\n * <kt-slider label=\"Price\" range min=\"0\" max=\"500\" step=\"10\" value=\"50/300\"></kt-slider>\n * ```\n */\nexport class KtSlider extends KtElement {\n static readonly formAssociated = true;\n\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n --kt-slider-thumb: calc(18px * var(--density-scale, 1));\n --kt-slider-track: 6px;\n }\n :host([disabled]) {\n opacity: 0.5;\n }\n\n .head {\n display: flex;\n justify-content: space-between;\n gap: var(--gap-button);\n margin-bottom: 8px;\n color: var(--text-body);\n font: var(--font-normal-regular);\n }\n .value {\n color: var(--text-muted);\n font-variant-numeric: tabular-nums;\n }\n\n .control {\n position: relative;\n height: var(--kt-slider-thumb);\n }\n .track,\n .fill {\n position: absolute;\n top: 50%;\n height: var(--kt-slider-track);\n border-radius: var(--radius-full);\n transform: translateY(-50%);\n }\n .track {\n right: 0;\n left: 0;\n background: var(--color-dark-22);\n }\n .fill {\n background: var(--color-primary-base);\n }\n\n /* The native inputs lie over the track, invisible but for their thumbs:\n two can share it, and each thumb still catches its own pointer. */\n input {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n background: none;\n pointer-events: none;\n appearance: none;\n }\n input:focus {\n outline: none;\n }\n input.front {\n z-index: 1;\n }\n input::-webkit-slider-runnable-track {\n height: 100%;\n background: none;\n }\n input::-moz-range-track {\n background: none;\n }\n input::-webkit-slider-thumb {\n width: var(--kt-slider-thumb);\n height: var(--kt-slider-thumb);\n background: var(--color-white);\n border: 2px solid var(--color-primary-base);\n border-radius: 50%;\n box-shadow: 0 1px 3px color-mix(in srgb, var(--color-backdrop) 70%, transparent);\n cursor: grab;\n pointer-events: auto;\n appearance: none;\n transition: box-shadow var(--duration-instant);\n }\n input::-moz-range-thumb {\n box-sizing: border-box;\n width: var(--kt-slider-thumb);\n height: var(--kt-slider-thumb);\n background: var(--color-white);\n border: 2px solid var(--color-primary-base);\n border-radius: 50%;\n box-shadow: 0 1px 3px color-mix(in srgb, var(--color-backdrop) 70%, transparent);\n cursor: grab;\n pointer-events: auto;\n }\n input:focus-visible::-webkit-slider-thumb {\n box-shadow:\n 0 0 0 4px var(--color-primary-soft),\n 0 0 0 2px var(--color-primary-base);\n }\n input:focus-visible::-moz-range-thumb {\n box-shadow:\n 0 0 0 4px var(--color-primary-soft),\n 0 0 0 2px var(--color-primary-base);\n }\n input:disabled::-webkit-slider-thumb {\n cursor: not-allowed;\n }\n `,\n ];\n\n /** `\"40\"`, or `\"20/80\"` with `range`. Kept within bounds and on the step. */\n @property({ type: String, reflect: true })\n value = '';\n\n @property({ type: Number })\n min = 0;\n\n @property({ type: Number })\n max = 100;\n\n @property({ type: Number })\n step = 1;\n\n /** Two thumbs: a low and a high end. */\n @property({ type: Boolean, reflect: true })\n range = false;\n\n /** Accessible name; shown above the slider with `show-value`. */\n @property({ type: String })\n label = '';\n\n @property({ type: String })\n name = '';\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Shows the label and the current value above the slider. */\n @property({ type: Boolean, attribute: 'show-value' })\n showValue = false;\n\n /** How a number is shown and announced: `(n) => \\`$${n}\\``. */\n @property({ attribute: false })\n format: (value: number) => string = (value) => String(value);\n\n @state() private formDisabled = false;\n\n private internals: UsableInternals | null = null;\n private defaultValue = '';\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals ??= attachFormInternals(this);\n }\n\n // Bounded on the first update, not on connect: a script may set `max`\n // after appending the element, and the value must wait for it.\n override firstUpdated(): void {\n this.defaultValue = this.value;\n }\n\n override willUpdate(changed: PropertyValues<this>): void {\n if (\n changed.has('value') ||\n changed.has('min') ||\n changed.has('max') ||\n changed.has('step') ||\n changed.has('range')\n ) {\n const normalised = this.normalised(this.value);\n if (normalised !== this.value) this.value = normalised;\n setFormValue(this.internals, this.value);\n }\n }\n\n formResetCallback(): void {\n this.value = this.defaultValue;\n }\n\n formDisabledCallback(disabled: boolean): void {\n this.formDisabled = disabled;\n }\n\n formStateRestoreCallback(state: string | null): void {\n if (state !== null) this.value = state;\n }\n\n /** The thumbs' numbers: one, or low and high. */\n private get numbers(): number[] {\n return this.value.split('/').map(Number);\n }\n\n /** `n` within bounds and on the step. */\n private snap(n: number): number {\n if (!Number.isFinite(n)) return this.min;\n const step = this.step > 0 ? this.step : 1;\n const snapped = this.min + Math.round((n - this.min) / step) * step;\n // Rounding to the step's decimals keeps 0.1 + 0.2 from showing as 0.30000000000000004.\n const decimals = Math.max(decimalsOf(step), decimalsOf(this.min));\n return Number(Math.min(this.max, Math.max(this.min, snapped)).toFixed(decimals));\n }\n\n private normalised(value: string): string {\n const parts = value === '' ? [] : value.split('/').map(Number);\n if (!this.range) return String(this.snap(parts[0] ?? this.min));\n const low = this.snap(parts[0] ?? this.min);\n const high = this.snap(parts[1] ?? this.max);\n return `${Math.min(low, high)}/${Math.max(low, high)}`;\n }\n\n /** A thumb moved: the low one cannot pass the high one, nor the other way. */\n private onSlide(event: Event, index: number, commit: boolean): void {\n const input = event.target as HTMLInputElement;\n let next = this.snap(Number(input.value));\n if (this.range) {\n const [low, high] = this.numbers as [number, number];\n if (index === 0) next = Math.min(next, high);\n else next = Math.max(next, low);\n input.value = String(next);\n this.value = index === 0 ? `${next}/${high}` : `${low}/${next}`;\n } else {\n this.value = String(next);\n }\n emit(this, commit ? 'kt-change' : 'kt-input', { value: this.value });\n }\n\n private percent(n: number): number {\n return this.max > this.min ? ((n - this.min) / (this.max - this.min)) * 100 : 0;\n }\n\n override render(): TemplateResult {\n const s = strings();\n const numbers = this.numbers;\n const [start, end] = this.range ? [numbers[0]!, numbers[1]!] : [this.min, numbers[0]!];\n const inactive = this.disabled || this.formDisabled;\n const shown = this.range\n ? `${this.format(numbers[0]!)} – ${this.format(numbers[1]!)}`\n : this.format(numbers[0]!);\n const capital = (word: string) => word.charAt(0).toUpperCase() + word.slice(1);\n const names = !this.range\n ? [this.label]\n : this.label\n ? [`${this.label}, ${s.sliderMinimum}`, `${this.label}, ${s.sliderMaximum}`]\n : [capital(s.sliderMinimum), capital(s.sliderMaximum)];\n // Met at one point, the thumbs are drawn one over the other and the later\n // input catches the pointer. Above the bottom, the low one goes on top, so\n // a pointer can pull the range open downwards; at the bottom the high one\n // stays on top to pull it open upwards.\n const lowOnTop = this.range && numbers[0] === numbers[1] && numbers[0]! > this.min;\n\n return html`${\n this.showValue\n ? html`<div class=\"head\">\n <span>${this.label}</span>\n <span part=\"value\" class=\"value\">${shown}</span>\n </div>`\n : nothing\n }\n <div class=\"control\">\n <div part=\"track\" class=\"track\"></div>\n <div\n part=\"fill\"\n class=\"fill\"\n style=${`left: ${this.percent(start)}%; right: ${100 - this.percent(end)}%`}\n ></div>\n ${numbers.map(\n (n, index) =>\n html`<input\n class=${index === 0 && lowOnTop ? 'front' : ''}\n type=\"range\"\n min=${this.min}\n max=${this.max}\n step=${this.step}\n .value=${String(n)}\n ?disabled=${inactive}\n aria-label=${names[index] || nothing}\n aria-valuetext=${this.format(n)}\n @input=${(event: Event) => this.onSlide(event, index, false)}\n @change=${(event: Event) => this.onSlide(event, index, true)}\n />`,\n )}\n </div>`;\n }\n}\n\ndefineElement('kt-slider', KtSlider);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kt-slider': KtSlider;\n }\n}\n"],"names":["KtSlider","KtElement","value","css","attachFormInternals","changed","normalised","setFormValue","disabled","state","n","step","snapped","decimals","decimalsOf","parts","low","high","event","index","commit","input","next","emit","s","strings","numbers","start","end","inactive","shown","capital","word","names","lowOnTop","html","nothing","__decorateClass","property","defineElement"],"mappings":";;;;;;;;;;;;AAiCO,MAAMA,UAAiBC,EAAU;AAAA,EAAjC,cAAA;AAAA,UAAA,GAAA,SAAA,GAmHL,KAAA,QAAQ,IAGR,KAAA,MAAM,GAGN,KAAA,MAAM,KAGN,KAAA,OAAO,GAIP,KAAA,QAAQ,IAIR,KAAA,QAAQ,IAGR,KAAA,OAAO,IAGP,KAAA,WAAW,IAIX,KAAA,YAAY,IAIZ,KAAA,SAAoC,CAACC,MAAU,OAAOA,CAAK,GAElD,KAAQ,eAAe,IAEhC,KAAQ,YAAoC,MAC5C,KAAQ,eAAe;AAAA,EAAA;AAAA,EAtJvB,OAAA;AAAA,SAAgB,iBAAiB;AAAA,EAAA;AAAA,EAEjC,OAAA;AAAA,SAAgB,SAAS;AAAA,MACvBD,EAAU;AAAA,MACVE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAA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AOC,GAAO,EAAI,CAAC;AAAA;AAAA,IAAA,CAEjE;AAAA;AAAA,EAEP;AACF;AA3KEkB,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAlH9BtC,EAmHX,WAAA,OAAA;AAGAqC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GArHftC,EAsHX,WAAA,KAAA;AAGAqC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAxHftC,EAyHX,WAAA,KAAA;AAGAqC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GA3HftC,EA4HX,WAAA,MAAA;AAIAqC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GA/H/BtC,EAgIX,WAAA,OAAA;AAIAqC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAnIftC,EAoIX,WAAA,OAAA;AAGAqC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAtIftC,EAuIX,WAAA,MAAA;AAGAqC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAzI/BtC,EA0IX,WAAA,UAAA;AAIAqC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,SAAS,WAAW,cAAc;AAAA,GA7IzCtC,EA8IX,WAAA,WAAA;AAIAqC,EAAA;AAAA,EADCC,EAAS,EAAE,WAAW,GAAA,CAAO;AAAA,GAjJnBtC,EAkJX,WAAA,QAAA;AAEiBqC,EAAA;AAAA,EAAhB5B,EAAA;AAAM,GApJIT,EAoJM,WAAA,cAAA;AA4InBuC,EAAc,aAAavC,CAAQ;"}
|
|
@@ -2,10 +2,10 @@ import { css as m, nothing as i, html as l } from "lit";
|
|
|
2
2
|
import { query as f, property as a, state as b } from "lit/decorators.js";
|
|
3
3
|
import { classMap as u } from "lit/directives/class-map.js";
|
|
4
4
|
import { live as g } from "lit/directives/live.js";
|
|
5
|
-
import { K as c, d as y } from "../../../chunks/kt-element-
|
|
5
|
+
import { K as c, d as y } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
6
6
|
import { e as p } from "../../../chunks/events-r51msXNf.js";
|
|
7
7
|
import { a as x, s as v, b as w } from "../../../chunks/form-control-B74_EHtG.js";
|
|
8
|
-
import { s as $ } from "../../../chunks/index-
|
|
8
|
+
import { s as $ } from "../../../chunks/index-BEWmAE0T.js";
|
|
9
9
|
import "../../core/kt-icon/kt-icon.js";
|
|
10
10
|
var k = Object.defineProperty, r = (n, e, o, C) => {
|
|
11
11
|
for (var s = void 0, h = n.length - 1, d; h >= 0; h--)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "lit";
|
|
2
2
|
import { property as v } from "lit/decorators.js";
|
|
3
|
-
import { d as x } from "../../../chunks/kt-element-
|
|
4
|
-
import { K as O } from "../../../chunks/segmented-field-
|
|
3
|
+
import { d as x } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
|
+
import { K as O } from "../../../chunks/segmented-field-BCjCGF4I.js";
|
|
5
5
|
import { d as w } from "../../../chunks/locale-C5xLkGx5.js";
|
|
6
|
-
import { s as y } from "../../../chunks/index-
|
|
6
|
+
import { s as y } from "../../../chunks/index-BEWmAE0T.js";
|
|
7
7
|
var P = Object.defineProperty, g = (u, e, t, r) => {
|
|
8
8
|
for (var o = void 0, n = u.length - 1, s; n >= 0; n--)
|
|
9
9
|
(s = u[n]) && (o = s(e, t, o) || o);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as d, nothing as h, html as u } from "lit";
|
|
2
2
|
import { property as i, state as b } from "lit/decorators.js";
|
|
3
|
-
import { K as n, d as p } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as n, d as p } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { e as m } from "../../../chunks/events-r51msXNf.js";
|
|
5
5
|
import { a as f, s as v } from "../../../chunks/form-control-B74_EHtG.js";
|
|
6
6
|
var g = Object.defineProperty, a = (s, t, l, k) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as d, nothing as f, html as s } from "lit";
|
|
2
2
|
import { property as c } from "lit/decorators.js";
|
|
3
|
-
import { K as p, d as u } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as p, d as u } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { e as h } from "../../../chunks/events-r51msXNf.js";
|
|
5
|
-
import { s as v } from "../../../chunks/index-
|
|
5
|
+
import { s as v } from "../../../chunks/index-BEWmAE0T.js";
|
|
6
6
|
import "../../core/kt-icon/kt-icon.js";
|
|
7
7
|
var b = Object.defineProperty, m = (o, t, e, a) => {
|
|
8
8
|
for (var r = void 0, i = o.length - 1, l; i >= 0; i--)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css as c, nothing as u, html as m } from "lit";
|
|
2
2
|
import { state as b, property as n } from "lit/decorators.js";
|
|
3
|
-
import { K as d, d as f } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as d, d as f } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
import { e as p } from "../../../chunks/events-r51msXNf.js";
|
|
5
|
-
import { s as h } from "../../../chunks/index-
|
|
5
|
+
import { s as h } from "../../../chunks/index-BEWmAE0T.js";
|
|
6
6
|
import "../../core/kt-button/kt-button.js";
|
|
7
7
|
var g = Object.defineProperty, a = (r, o, s, v) => {
|
|
8
8
|
for (var e = void 0, i = r.length - 1, l; i >= 0; i--)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css as c, html as t, nothing as l } from "lit";
|
|
2
2
|
import { property as s } from "lit/decorators.js";
|
|
3
|
-
import { K as h, d as g } from "../../../chunks/kt-element-
|
|
3
|
+
import { K as h, d as g } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
4
4
|
var f = Object.defineProperty, o = (a, r, p, v) => {
|
|
5
5
|
for (var e = void 0, n = a.length - 1, d; n >= 0; n--)
|
|
6
6
|
(d = a[n]) && (e = d(r, p, e) || e);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { css as b, nothing as c, html as p } from "lit";
|
|
2
2
|
import { queryAll as v, property as n, state as m } from "lit/decorators.js";
|
|
3
3
|
import { classMap as u } from "lit/directives/class-map.js";
|
|
4
|
-
import { K as f, d as g } from "../../../chunks/kt-element-
|
|
4
|
+
import { K as f, d as g } from "../../../chunks/kt-element-COgh6Yr1.js";
|
|
5
5
|
import { e as x } from "../../../chunks/events-r51msXNf.js";
|
|
6
6
|
import { a as y, s as k, b as w } from "../../../chunks/form-control-B74_EHtG.js";
|
|
7
|
-
import { s as $ } from "../../../chunks/index-
|
|
7
|
+
import { s as $ } from "../../../chunks/index-BEWmAE0T.js";
|
|
8
8
|
import "../../core/kt-icon/kt-icon.js";
|
|
9
9
|
var I = Object.defineProperty, s = (h, t, i, o) => {
|
|
10
10
|
for (var e = void 0, r = h.length - 1, l; r >= 0; r--)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { KtElement } from '#internal/kt-element';
|
|
3
|
+
import '../../core/kt-icon/kt-icon.js';
|
|
4
|
+
export interface KtStep {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
/** A line under the label. */
|
|
8
|
+
readonly description?: string;
|
|
9
|
+
/** Something on this step needs fixing — a field it holds failed. */
|
|
10
|
+
readonly error?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type KtStepsOrientation = 'horizontal' | 'vertical';
|
|
13
|
+
/**
|
|
14
|
+
* The steps of a flow — sign-up, checkout, onboarding — and where the reader
|
|
15
|
+
* is in it.
|
|
16
|
+
*
|
|
17
|
+
* Steps before `current` are complete, `current` is current, the rest are to
|
|
18
|
+
* come — all of them, while `current` names no step; a step with `error` shows as needing attention wherever it is. With
|
|
19
|
+
* `navigable`, a completed step is a button that goes back to it; going
|
|
20
|
+
* forward is the flow's job, not the stepper's.
|
|
21
|
+
*
|
|
22
|
+
* An ordered list: the number is the step's place, `aria-current="step"`
|
|
23
|
+
* marks the current one, and each state is said in words, not only shown.
|
|
24
|
+
*
|
|
25
|
+
* @element kt-steps
|
|
26
|
+
*
|
|
27
|
+
* @csspart list - The `<ol>`.
|
|
28
|
+
* @csspart step - A step.
|
|
29
|
+
* @csspart marker - A step's number, tick or alert.
|
|
30
|
+
* @csspart connector - The line from a step to the next.
|
|
31
|
+
*
|
|
32
|
+
* @fires kt-change - A completed step was picked, with `navigable`. `detail: { id }`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```html
|
|
36
|
+
* <kt-steps label="Sign-up" current="billing"></kt-steps>
|
|
37
|
+
* <script>
|
|
38
|
+
* steps.steps = [
|
|
39
|
+
* { id: 'account', label: 'Account' },
|
|
40
|
+
* { id: 'billing', label: 'Billing', description: 'Card or invoice' },
|
|
41
|
+
* { id: 'team', label: 'Team' },
|
|
42
|
+
* ];
|
|
43
|
+
* </script>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare class KtSteps extends KtElement {
|
|
47
|
+
static styles: import("lit").CSSResultGroup[];
|
|
48
|
+
/** The steps, in order. Set as a property. */
|
|
49
|
+
steps: readonly KtStep[];
|
|
50
|
+
/** The id of the step the reader is on. */
|
|
51
|
+
current: string;
|
|
52
|
+
/** Accessible name of the list: what the flow is. */
|
|
53
|
+
label: string;
|
|
54
|
+
orientation: KtStepsOrientation;
|
|
55
|
+
/** Completed steps become buttons that go back to them. */
|
|
56
|
+
navigable: boolean;
|
|
57
|
+
private stateOf;
|
|
58
|
+
private goTo;
|
|
59
|
+
render(): TemplateResult;
|
|
60
|
+
}
|
|
61
|
+
declare global {
|
|
62
|
+
interface HTMLElementTagNameMap {
|
|
63
|
+
'kt-steps': KtSteps;
|
|
64
|
+
}
|
|
65
|
+
}
|