kanto-ds 1.7.0 → 1.9.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 +26 -14
- package/dist/AGENTS.md +157 -0
- package/dist/cdn/kanto.min.js +4743 -932
- package/dist/chunks/block-Cci-Kff_.js +69 -0
- package/dist/chunks/block-Cci-Kff_.js.map +1 -0
- package/dist/chunks/defaults-yhaR6U65.js +70 -0
- package/dist/chunks/{defaults-Cpeg13O5.js.map → defaults-yhaR6U65.js.map} +1 -1
- package/dist/chunks/heading-DsnZsfg-.js +21 -0
- package/dist/chunks/heading-DsnZsfg-.js.map +1 -0
- package/dist/chunks/{index-TWJzttLX.js → index-1ZFgagWW.js} +37 -12
- package/dist/chunks/index-1ZFgagWW.js.map +1 -0
- package/dist/chunks/indicator-B_Rs8F92.js +49 -0
- package/dist/chunks/indicator-B_Rs8F92.js.map +1 -0
- package/dist/chunks/{kt-calendar-CtwOby1R.js → kt-calendar-SK8eapuy.js} +3 -3
- package/dist/chunks/{kt-calendar-CtwOby1R.js.map → kt-calendar-SK8eapuy.js.map} +1 -1
- package/dist/chunks/kt-color-picker-BoezCAmx.js +365 -0
- package/dist/chunks/kt-color-picker-BoezCAmx.js.map +1 -0
- package/dist/chunks/{kt-element-T0VbIBNp.js → kt-element-DvWtPQ1Y.js} +2 -2
- package/dist/chunks/{kt-element-T0VbIBNp.js.map → kt-element-DvWtPQ1Y.js.map} +1 -1
- package/dist/chunks/motion-ChVUUO7O.js +28 -0
- package/dist/chunks/motion-ChVUUO7O.js.map +1 -0
- 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-T_Zo6lc1.js} +2 -2
- package/dist/chunks/{segmented-field-BBXR4XFL.js.map → segmented-field-T_Zo6lc1.js.map} +1 -1
- package/dist/chunks/{typed-date-CPAUNHzr.js → typed-date-CaU0kXoY.js} +2 -2
- package/dist/chunks/{typed-date-CPAUNHzr.js.map → typed-date-CaU0kXoY.js.map} +1 -1
- package/dist/components/blocks/kt-auth-form/kt-auth-form.d.ts +143 -0
- package/dist/components/blocks/kt-auth-form/kt-auth-form.js +368 -0
- package/dist/components/blocks/kt-auth-form/kt-auth-form.js.map +1 -0
- package/dist/components/blocks/kt-blog-post/kt-blog-post.d.ts +75 -0
- package/dist/components/blocks/kt-blog-post/kt-blog-post.js +285 -0
- package/dist/components/blocks/kt-blog-post/kt-blog-post.js.map +1 -0
- package/dist/components/blocks/kt-cta/kt-cta.d.ts +51 -0
- package/dist/components/blocks/kt-cta/kt-cta.js +126 -0
- package/dist/components/blocks/kt-cta/kt-cta.js.map +1 -0
- package/dist/components/blocks/kt-empty-page/kt-empty-page.d.ts +75 -0
- package/dist/components/blocks/kt-empty-page/kt-empty-page.js +245 -0
- package/dist/components/blocks/kt-empty-page/kt-empty-page.js.map +1 -0
- package/dist/components/blocks/kt-error-page/kt-error-page.d.ts +65 -0
- package/dist/components/blocks/kt-error-page/kt-error-page.js +177 -0
- package/dist/components/blocks/kt-error-page/kt-error-page.js.map +1 -0
- package/dist/components/blocks/kt-faq/kt-faq.d.ts +61 -0
- package/dist/components/blocks/kt-faq/kt-faq.js +129 -0
- package/dist/components/blocks/kt-faq/kt-faq.js.map +1 -0
- package/dist/components/blocks/kt-feature-grid/kt-feature-grid.d.ts +59 -0
- package/dist/components/blocks/kt-feature-grid/kt-feature-grid.js +166 -0
- package/dist/components/blocks/kt-feature-grid/kt-feature-grid.js.map +1 -0
- package/dist/components/blocks/kt-hero/kt-hero.d.ts +51 -0
- package/dist/components/blocks/kt-hero/kt-hero.js +138 -0
- package/dist/components/blocks/kt-hero/kt-hero.js.map +1 -0
- package/dist/components/blocks/kt-logo-cloud/kt-logo-cloud.d.ts +46 -0
- package/dist/components/blocks/kt-logo-cloud/kt-logo-cloud.js +100 -0
- package/dist/components/blocks/kt-logo-cloud/kt-logo-cloud.js.map +1 -0
- package/dist/components/blocks/kt-newsletter/kt-newsletter.d.ts +85 -0
- package/dist/components/blocks/kt-newsletter/kt-newsletter.js +247 -0
- package/dist/components/blocks/kt-newsletter/kt-newsletter.js.map +1 -0
- package/dist/components/blocks/kt-post-grid/kt-post-grid.d.ts +73 -0
- package/dist/components/blocks/kt-post-grid/kt-post-grid.js +249 -0
- package/dist/components/blocks/kt-post-grid/kt-post-grid.js.map +1 -0
- package/dist/components/blocks/kt-pricing-table/kt-pricing-table.d.ts +102 -0
- package/dist/components/blocks/kt-pricing-table/kt-pricing-table.js +307 -0
- package/dist/components/blocks/kt-pricing-table/kt-pricing-table.js.map +1 -0
- package/dist/components/blocks/kt-settings-section/kt-settings-section.d.ts +52 -0
- package/dist/components/blocks/kt-settings-section/kt-settings-section.js +158 -0
- package/dist/components/blocks/kt-settings-section/kt-settings-section.js.map +1 -0
- package/dist/components/blocks/kt-testimonials/kt-testimonials.d.ts +56 -0
- package/dist/components/blocks/kt-testimonials/kt-testimonials.js +161 -0
- package/dist/components/blocks/kt-testimonials/kt-testimonials.js.map +1 -0
- package/dist/components/core/kt-avatar/kt-avatar.js +2 -2
- package/dist/components/core/kt-avatar-group/kt-avatar-group.d.ts +42 -0
- package/dist/components/core/kt-avatar-group/kt-avatar-group.js +97 -0
- package/dist/components/core/kt-avatar-group/kt-avatar-group.js.map +1 -0
- package/dist/components/core/kt-badge/kt-badge.js +2 -2
- package/dist/components/core/kt-button/flights.d.ts +27 -0
- package/dist/components/core/kt-button/kt-button.d.ts +52 -1
- package/dist/components/core/kt-button/kt-button.js +353 -77
- package/dist/components/core/kt-button/kt-button.js.map +1 -1
- package/dist/components/core/kt-button/morph.d.ts +27 -0
- package/dist/components/core/kt-card/kt-card.js +1 -1
- package/dist/components/core/kt-code/kt-code.d.ts +2 -1
- package/dist/components/core/kt-code/kt-code.js +52 -37
- package/dist/components/core/kt-code/kt-code.js.map +1 -1
- package/dist/components/core/kt-copy-button/kt-copy-button.d.ts +47 -0
- package/dist/components/core/kt-copy-button/kt-copy-button.js +74 -0
- package/dist/components/core/kt-copy-button/kt-copy-button.js.map +1 -0
- package/dist/components/core/kt-icon/kt-icon.js +2 -2
- 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-chat-message/kt-chat-message.d.ts +60 -0
- package/dist/components/data/kt-chat-message/kt-chat-message.js +204 -0
- package/dist/components/data/kt-chat-message/kt-chat-message.js.map +1 -0
- package/dist/components/data/kt-description-list/kt-description-list.d.ts +56 -0
- package/dist/components/data/kt-description-list/kt-description-list.js +120 -0
- package/dist/components/data/kt-description-list/kt-description-list.js.map +1 -0
- package/dist/components/data/kt-meter/kt-meter.js +8 -6
- package/dist/components/data/kt-meter/kt-meter.js.map +1 -1
- package/dist/components/data/kt-pagination/kt-pagination.js +2 -2
- package/dist/components/data/kt-stat/kt-stat.d.ts +3 -1
- package/dist/components/data/kt-stat/kt-stat.js +31 -16
- package/dist/components/data/kt-stat/kt-stat.js.map +1 -1
- package/dist/components/data/kt-table/kt-table.js +2 -2
- package/dist/components/data/kt-timeline/kt-timeline.js +2 -2
- package/dist/components/data/kt-timeline/kt-timeline.js.map +1 -1
- package/dist/components/data/kt-tree/kt-tree.d.ts +69 -0
- package/dist/components/data/kt-tree/kt-tree.js +208 -0
- package/dist/components/data/kt-tree/kt-tree.js.map +1 -0
- 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.d.ts +8 -1
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js +65 -26
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js.map +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.d.ts +2 -0
- package/dist/components/forms/kt-checkbox/kt-checkbox.js +19 -8
- package/dist/components/forms/kt-checkbox/kt-checkbox.js.map +1 -1
- package/dist/components/forms/kt-color-picker/kt-color-picker.d.ts +66 -0
- package/dist/components/forms/kt-color-picker/kt-color-picker.js +14 -0
- package/dist/components/forms/kt-color-picker/kt-color-picker.js.map +1 -0
- 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 +92 -0
- package/dist/components/forms/kt-number-input/kt-number-input.js +366 -0
- package/dist/components/forms/kt-number-input/kt-number-input.js.map +1 -0
- package/dist/components/forms/kt-otp-input/kt-otp-input.d.ts +74 -0
- package/dist/components/forms/kt-otp-input/kt-otp-input.js +232 -0
- package/dist/components/forms/kt-otp-input/kt-otp-input.js.map +1 -0
- package/dist/components/forms/kt-prompt-input/kt-prompt-input.d.ts +74 -0
- package/dist/components/forms/kt-prompt-input/kt-prompt-input.js +213 -0
- package/dist/components/forms/kt-prompt-input/kt-prompt-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-app-shell/kt-app-shell.d.ts +85 -0
- package/dist/components/navigation/kt-app-shell/kt-app-shell.js +220 -0
- package/dist/components/navigation/kt-app-shell/kt-app-shell.js.map +1 -0
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +2 -2
- package/dist/components/navigation/kt-footer/kt-footer.d.ts +82 -0
- package/dist/components/navigation/kt-footer/kt-footer.js +220 -0
- package/dist/components/navigation/kt-footer/kt-footer.js.map +1 -0
- package/dist/components/navigation/kt-header/kt-header.js +2 -2
- package/dist/components/navigation/kt-page-header/kt-page-header.js +2 -2
- package/dist/components/navigation/kt-page-header/kt-page-header.js.map +1 -1
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.d.ts +1 -0
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +81 -44
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js.map +1 -1
- package/dist/components/navigation/kt-steps/kt-steps.d.ts +68 -0
- package/dist/components/navigation/kt-steps/kt-steps.js +286 -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 +3 -3
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js.map +1 -1
- package/dist/components/navigation/kt-tabs/kt-tabs.d.ts +1 -0
- package/dist/components/navigation/kt-tabs/kt-tabs.js +92 -64
- package/dist/components/navigation/kt-tabs/kt-tabs.js.map +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/navigation/kt-user-menu/kt-user-menu.d.ts +86 -0
- package/dist/components/navigation/kt-user-menu/kt-user-menu.js +298 -0
- package/dist/components/navigation/kt-user-menu/kt-user-menu.js.map +1 -0
- package/dist/components/overlays/kt-accordion/kt-accordion.d.ts +47 -0
- package/dist/components/overlays/kt-accordion/kt-accordion.js +80 -0
- package/dist/components/overlays/kt-accordion/kt-accordion.js.map +1 -0
- package/dist/components/overlays/kt-collapsible/kt-collapsible.d.ts +17 -1
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js +87 -32
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js.map +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/components/overlays/kt-tour/kt-tour.d.ts +77 -0
- package/dist/components/overlays/kt-tour/kt-tour.js +200 -0
- package/dist/components/overlays/kt-tour/kt-tour.js.map +1 -0
- package/dist/custom-elements.json +16427 -8061
- package/dist/docs/kt-accordion.md +49 -0
- package/dist/docs/kt-app-shell.md +89 -0
- package/dist/docs/kt-auth-form.md +111 -0
- package/dist/docs/kt-avatar-group.md +49 -0
- package/dist/docs/kt-blog-post.md +77 -0
- package/dist/docs/kt-button.md +21 -0
- package/dist/docs/kt-chat-message.md +68 -0
- package/dist/docs/kt-color-picker.md +67 -0
- package/dist/docs/kt-command-palette.md +99 -0
- package/dist/docs/kt-copy-button.md +50 -0
- package/dist/docs/kt-cta.md +45 -0
- package/dist/docs/kt-description-list.md +58 -0
- package/dist/docs/kt-empty-page.md +92 -0
- package/dist/docs/kt-error-page.md +64 -0
- package/dist/docs/kt-faq.md +54 -0
- package/dist/docs/kt-feature-grid.md +53 -0
- package/dist/docs/kt-footer.md +115 -0
- package/dist/docs/kt-hero.md +53 -0
- package/dist/docs/kt-logo-cloud.md +41 -0
- package/dist/docs/kt-newsletter.md +69 -0
- package/dist/docs/kt-number-input.md +77 -0
- package/dist/docs/kt-otp-input.md +68 -0
- package/dist/docs/kt-post-grid.md +66 -0
- package/dist/docs/kt-pricing-table.md +101 -0
- package/dist/docs/kt-prompt-input.md +86 -0
- package/dist/docs/kt-settings-section.md +65 -0
- package/dist/docs/kt-slider.md +76 -0
- package/dist/docs/kt-steps.md +79 -0
- package/dist/docs/kt-testimonials.md +52 -0
- package/dist/docs/kt-tour.md +75 -0
- package/dist/docs/kt-tree.md +83 -0
- package/dist/docs/kt-user-menu.md +77 -0
- package/dist/icons/defaults.d.ts +2 -0
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +56 -0
- package/dist/index.js +225 -284
- package/dist/index.js.map +1 -1
- package/dist/internal/block.d.ts +23 -0
- package/dist/internal/command-search.d.ts +27 -0
- package/dist/internal/heading.d.ts +8 -0
- package/dist/internal/indicator.d.ts +34 -0
- package/dist/internal/motion.d.ts +25 -0
- package/dist/internal/numbers.d.ts +2 -0
- package/dist/internal/strings.d.ts +36 -0
- package/dist/react/index.d.ts +165 -0
- package/dist/react/index.js +420 -171
- package/dist/react/index.js.map +1 -1
- package/dist/react/jsx.d.ts +128 -1
- package/dist/strings/index.js +1 -1
- package/dist/tokens/base.css +35 -2
- package/dist/vscode.css-custom-data.json +165 -19
- package/dist/vscode.html-custom-data.json +1023 -149
- package/dist/vue/index.d.ts +62 -0
- package/dist/vue/index.js +39 -8
- package/dist/vue/index.js.map +1 -1
- package/dist/web-types.json +3238 -836
- package/package.json +128 -3
- package/dist/chunks/defaults-Cpeg13O5.js +0 -68
- package/dist/chunks/index-TWJzttLX.js.map +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { KtElement } from '#internal/kt-element';
|
|
3
|
+
/**
|
|
4
|
+
* A value picked by sliding along a range: a volume, a threshold, or with
|
|
5
|
+
* `range`, a price between two ends.
|
|
6
|
+
*
|
|
7
|
+
* Each thumb is a native `<input type="range">`, so the keyboard — arrows,
|
|
8
|
+
* Page Up and Down, Home and End — and what a screen reader announces come
|
|
9
|
+
* from the platform. The value is text, like a form field's: `"40"`, or
|
|
10
|
+
* `"20/80"` with `range`, low then high. It is kept within `min` and `max`
|
|
11
|
+
* and on `step`, and two thumbs never cross.
|
|
12
|
+
*
|
|
13
|
+
* @element kt-slider
|
|
14
|
+
*
|
|
15
|
+
* @csspart track - The rail.
|
|
16
|
+
* @csspart fill - The selected stretch of it.
|
|
17
|
+
* @csspart value - The shown value, with `show-value`.
|
|
18
|
+
*
|
|
19
|
+
* @fires kt-input - While sliding. `detail: { value }`.
|
|
20
|
+
* @fires kt-change - Once let go. `detail: { value }`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <kt-slider label="Volume" value="40" show-value></kt-slider>
|
|
25
|
+
* <kt-slider label="Price" range min="0" max="500" step="10" value="50/300"></kt-slider>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class KtSlider extends KtElement {
|
|
29
|
+
static readonly formAssociated = true;
|
|
30
|
+
static styles: import("lit").CSSResultGroup[];
|
|
31
|
+
/** `"40"`, or `"20/80"` with `range`. Kept within bounds and on the step. */
|
|
32
|
+
value: string;
|
|
33
|
+
min: number;
|
|
34
|
+
max: number;
|
|
35
|
+
step: number;
|
|
36
|
+
/** Two thumbs: a low and a high end. */
|
|
37
|
+
range: boolean;
|
|
38
|
+
/** Accessible name; shown above the slider with `show-value`. */
|
|
39
|
+
label: string;
|
|
40
|
+
name: string;
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
/** Shows the label and the current value above the slider. */
|
|
43
|
+
showValue: boolean;
|
|
44
|
+
/** How a number is shown and announced: `(n) => \`$${n}\``. */
|
|
45
|
+
format: (value: number) => string;
|
|
46
|
+
private formDisabled;
|
|
47
|
+
private internals;
|
|
48
|
+
private defaultValue;
|
|
49
|
+
connectedCallback(): void;
|
|
50
|
+
firstUpdated(): void;
|
|
51
|
+
willUpdate(changed: PropertyValues<this>): void;
|
|
52
|
+
formResetCallback(): void;
|
|
53
|
+
formDisabledCallback(disabled: boolean): void;
|
|
54
|
+
formStateRestoreCallback(state: string | null): void;
|
|
55
|
+
/** The thumbs' numbers: one, or low and high. */
|
|
56
|
+
private get numbers();
|
|
57
|
+
/** `n` within bounds and on the step. */
|
|
58
|
+
private snap;
|
|
59
|
+
private normalised;
|
|
60
|
+
/** A thumb moved: the low one cannot pass the high one, nor the other way. */
|
|
61
|
+
private onSlide;
|
|
62
|
+
private percent;
|
|
63
|
+
render(): TemplateResult;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
'kt-slider': KtSlider;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -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-DvWtPQ1Y.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-1ZFgagWW.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;AAA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X,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-DvWtPQ1Y.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-1ZFgagWW.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-DvWtPQ1Y.js";
|
|
4
|
+
import { K as O } from "../../../chunks/segmented-field-T_Zo6lc1.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-1ZFgagWW.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-DvWtPQ1Y.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) => {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { KtElement } from '#internal/kt-element';
|
|
3
|
+
import '../../core/kt-button/kt-button.js';
|
|
4
|
+
/**
|
|
5
|
+
* The frame of an application: a header along the top, a sidebar down the
|
|
6
|
+
* side, and the content, which scrolls on its own.
|
|
7
|
+
*
|
|
8
|
+
* Wide, the sidebar sits beside the content, and its toggle narrows it to a
|
|
9
|
+
* rail (`collapsed`). Narrower than `breakpoint` — measured on the shell
|
|
10
|
+
* itself, not the viewport — the sidebar leaves the layout: the toggle opens
|
|
11
|
+
* it as a drawer over the content, behind a backdrop, closed by Escape or a
|
|
12
|
+
* click outside. A closed drawer is inert, so Tab never wanders into it.
|
|
13
|
+
*
|
|
14
|
+
* The shell fills its container's height; give the container one —
|
|
15
|
+
* `height: 100dvh` on a page, a fixed height in a preview.
|
|
16
|
+
*
|
|
17
|
+
* @element kt-app-shell
|
|
18
|
+
*
|
|
19
|
+
* @slot header - The top bar: a wordmark, a search, an account menu.
|
|
20
|
+
* @slot sidebar - Down the side: the application's navigation.
|
|
21
|
+
* @slot - The content.
|
|
22
|
+
*
|
|
23
|
+
* @csspart header - The top bar.
|
|
24
|
+
* @csspart sidebar - The `<aside>`.
|
|
25
|
+
* @csspart main - The `<main>`.
|
|
26
|
+
* @csspart toggle - The sidebar's toggle.
|
|
27
|
+
*
|
|
28
|
+
* @cssproperty --kt-app-shell-sidebar-width - The sidebar's width. 240px.
|
|
29
|
+
* @cssproperty --kt-app-shell-rail-width - Its width when collapsed. 64px.
|
|
30
|
+
* @cssproperty --kt-app-shell-header-height - The top bar's height. 56px.
|
|
31
|
+
*
|
|
32
|
+
* @fires kt-sidebar-toggle - The sidebar opened or closed — collapsed or
|
|
33
|
+
* expanded when wide, the drawer when narrow. `detail: { open }`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```html
|
|
37
|
+
* <kt-app-shell style="height: 100dvh">
|
|
38
|
+
* <a slot="header" href="/">Northwind</a>
|
|
39
|
+
* <kt-sub-menu-navigation slot="sidebar"></kt-sub-menu-navigation>
|
|
40
|
+
* <h1>Overview</h1>
|
|
41
|
+
* </kt-app-shell>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare class KtAppShell extends KtElement {
|
|
45
|
+
static styles: import("lit").CSSResultGroup[];
|
|
46
|
+
/** Wide: the sidebar narrowed to a rail. */
|
|
47
|
+
collapsed: boolean;
|
|
48
|
+
/** Narrow: the sidebar open as a drawer. */
|
|
49
|
+
sidebarOpen: boolean;
|
|
50
|
+
/** Below this width, in pixels of the shell itself, the sidebar becomes a drawer. */
|
|
51
|
+
breakpoint: number;
|
|
52
|
+
/** Leaves the toggle out, for a header that brings its own. */
|
|
53
|
+
noToggle: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Draws the sidebar and the content as plain boxes rather than an \`<aside>\`
|
|
56
|
+
* and a \`<main>\` — for a shell shown inside a page that has its own, a
|
|
57
|
+
* preview or a demo, where a second main landmark would be wrong.
|
|
58
|
+
*/
|
|
59
|
+
noLandmarks: boolean;
|
|
60
|
+
/** Accessible name for the sidebar. Defaults to the translated "Sidebar". */
|
|
61
|
+
label: string;
|
|
62
|
+
/** Narrower than `breakpoint`: reflected as the `narrow` attribute, for styling. */
|
|
63
|
+
private narrow;
|
|
64
|
+
private aside;
|
|
65
|
+
private toggle?;
|
|
66
|
+
private readonly sidebarId;
|
|
67
|
+
private observer;
|
|
68
|
+
connectedCallback(): void;
|
|
69
|
+
disconnectedCallback(): void;
|
|
70
|
+
private measure;
|
|
71
|
+
/** Whether the sidebar shows: expanded when wide, open when narrow. */
|
|
72
|
+
private get open();
|
|
73
|
+
/** Opens or closes the sidebar, as its toggle does. */
|
|
74
|
+
toggleSidebar(): void;
|
|
75
|
+
private closeDrawer;
|
|
76
|
+
private onKeyDown;
|
|
77
|
+
willUpdate(changed: PropertyValues<this>): void;
|
|
78
|
+
updated(changed: PropertyValues): void;
|
|
79
|
+
render(): TemplateResult;
|
|
80
|
+
}
|
|
81
|
+
declare global {
|
|
82
|
+
interface HTMLElementTagNameMap {
|
|
83
|
+
'kt-app-shell': KtAppShell;
|
|
84
|
+
}
|
|
85
|
+
}
|