kanto-ds 1.0.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/LICENSE +26 -0
- package/README.md +155 -0
- package/dist/assets/fonts/README.md +19 -0
- package/dist/assets/fonts/manrope/OFL.txt +93 -0
- package/dist/assets/fonts/manrope/manrope-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/assets/fonts/manrope/manrope-cyrillic-wght-normal.woff2 +0 -0
- package/dist/assets/fonts/manrope/manrope-latin-ext-wght-normal.woff2 +0 -0
- package/dist/assets/fonts/manrope/manrope-latin-wght-normal.woff2 +0 -0
- package/dist/assets/fonts/mulish/OFL.txt +93 -0
- package/dist/assets/fonts/mulish/mulish-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/assets/fonts/mulish/mulish-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/assets/fonts/mulish/mulish-cyrillic-wght-italic.woff2 +0 -0
- package/dist/assets/fonts/mulish/mulish-cyrillic-wght-normal.woff2 +0 -0
- package/dist/assets/fonts/mulish/mulish-latin-ext-wght-italic.woff2 +0 -0
- package/dist/assets/fonts/mulish/mulish-latin-ext-wght-normal.woff2 +0 -0
- package/dist/assets/fonts/mulish/mulish-latin-wght-italic.woff2 +0 -0
- package/dist/assets/fonts/mulish/mulish-latin-wght-normal.woff2 +0 -0
- package/dist/assets/fonts/source_code_pro/OFL.txt +93 -0
- package/dist/assets/fonts/source_code_pro/SourceCodePro-Regular.woff2 +0 -0
- package/dist/chunks/dialog-CPIfFIlF.js +29 -0
- package/dist/chunks/dialog-CPIfFIlF.js.map +1 -0
- package/dist/chunks/events-Bjl5Zmmq.js +18 -0
- package/dist/chunks/events-Bjl5Zmmq.js.map +1 -0
- package/dist/chunks/form-control-CxjBTt1c.js +17 -0
- package/dist/chunks/form-control-CxjBTt1c.js.map +1 -0
- package/dist/chunks/kt-element-CcMLO5e8.js +28 -0
- package/dist/chunks/kt-element-CcMLO5e8.js.map +1 -0
- package/dist/chunks/listbox-CUXYn_3S.js +101 -0
- package/dist/chunks/listbox-CUXYn_3S.js.map +1 -0
- package/dist/chunks/registry-X4LS9J5K.js +30 -0
- package/dist/chunks/registry-X4LS9J5K.js.map +1 -0
- package/dist/chunks/slots-BPbIdxAJ.js +7 -0
- package/dist/chunks/slots-BPbIdxAJ.js.map +1 -0
- package/dist/chunks/toaster-PmdKSV5x.js +40 -0
- package/dist/chunks/toaster-PmdKSV5x.js.map +1 -0
- package/dist/components/core/kt-avatar/kt-avatar.d.ts +49 -0
- package/dist/components/core/kt-avatar/kt-avatar.js +156 -0
- package/dist/components/core/kt-avatar/kt-avatar.js.map +1 -0
- package/dist/components/core/kt-badge/kt-badge.d.ts +77 -0
- package/dist/components/core/kt-badge/kt-badge.js +254 -0
- package/dist/components/core/kt-badge/kt-badge.js.map +1 -0
- package/dist/components/core/kt-button/kt-button.d.ts +71 -0
- package/dist/components/core/kt-button/kt-button.js +271 -0
- package/dist/components/core/kt-button/kt-button.js.map +1 -0
- package/dist/components/core/kt-card/kt-card.d.ts +62 -0
- package/dist/components/core/kt-card/kt-card.js +230 -0
- package/dist/components/core/kt-card/kt-card.js.map +1 -0
- package/dist/components/core/kt-code/kt-code.d.ts +55 -0
- package/dist/components/core/kt-code/kt-code.js +155 -0
- package/dist/components/core/kt-code/kt-code.js.map +1 -0
- package/dist/components/core/kt-icon/kt-icon.d.ts +44 -0
- package/dist/components/core/kt-icon/kt-icon.js +85 -0
- package/dist/components/core/kt-icon/kt-icon.js.map +1 -0
- package/dist/components/core/kt-kbd/kt-kbd.d.ts +38 -0
- package/dist/components/core/kt-kbd/kt-kbd.js +89 -0
- package/dist/components/core/kt-kbd/kt-kbd.js.map +1 -0
- package/dist/components/data/kt-chart/kt-chart.d.ts +99 -0
- package/dist/components/data/kt-chart/kt-chart.js +406 -0
- package/dist/components/data/kt-chart/kt-chart.js.map +1 -0
- package/dist/components/data/kt-meter/kt-meter.d.ts +63 -0
- package/dist/components/data/kt-meter/kt-meter.js +177 -0
- package/dist/components/data/kt-meter/kt-meter.js.map +1 -0
- package/dist/components/data/kt-pagination/kt-pagination.d.ts +35 -0
- package/dist/components/data/kt-pagination/kt-pagination.js +88 -0
- package/dist/components/data/kt-pagination/kt-pagination.js.map +1 -0
- package/dist/components/data/kt-stat/kt-stat.d.ts +60 -0
- package/dist/components/data/kt-stat/kt-stat.js +137 -0
- package/dist/components/data/kt-stat/kt-stat.js.map +1 -0
- package/dist/components/data/kt-table/kt-table.d.ts +99 -0
- package/dist/components/data/kt-table/kt-table.js +340 -0
- package/dist/components/data/kt-table/kt-table.js.map +1 -0
- package/dist/components/data/kt-timeline/kt-timeline.d.ts +78 -0
- package/dist/components/data/kt-timeline/kt-timeline.js +252 -0
- package/dist/components/data/kt-timeline/kt-timeline.js.map +1 -0
- package/dist/components/feedback/kt-alert/kt-alert.d.ts +46 -0
- package/dist/components/feedback/kt-alert/kt-alert.js +180 -0
- package/dist/components/feedback/kt-alert/kt-alert.js.map +1 -0
- package/dist/components/feedback/kt-empty-state/kt-empty-state.d.ts +40 -0
- package/dist/components/feedback/kt-empty-state/kt-empty-state.js +100 -0
- package/dist/components/feedback/kt-empty-state/kt-empty-state.js.map +1 -0
- package/dist/components/feedback/kt-progress-bar/kt-progress-bar.d.ts +53 -0
- package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +212 -0
- package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js.map +1 -0
- package/dist/components/feedback/kt-skeleton/kt-skeleton.d.ts +43 -0
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js +117 -0
- package/dist/components/feedback/kt-skeleton/kt-skeleton.js.map +1 -0
- package/dist/components/feedback/kt-toast/kt-toast.d.ts +57 -0
- package/dist/components/feedback/kt-toast/kt-toast.js +231 -0
- package/dist/components/feedback/kt-toast/kt-toast.js.map +1 -0
- package/dist/components/feedback/kt-toast-container/kt-toast-container.d.ts +60 -0
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js +100 -0
- package/dist/components/feedback/kt-toast-container/kt-toast-container.js.map +1 -0
- package/dist/components/feedback/kt-toast-container/toaster.d.ts +37 -0
- package/dist/components/feedback/kt-tooltip/kt-tooltip.d.ts +57 -0
- package/dist/components/feedback/kt-tooltip/kt-tooltip.js +138 -0
- package/dist/components/feedback/kt-tooltip/kt-tooltip.js.map +1 -0
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.d.ts +68 -0
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +287 -0
- package/dist/components/forms/kt-drag-drop/kt-drag-drop.js.map +1 -0
- package/dist/components/forms/kt-form/kt-form.d.ts +75 -0
- package/dist/components/forms/kt-form/kt-form.js +187 -0
- package/dist/components/forms/kt-form/kt-form.js.map +1 -0
- package/dist/components/forms/kt-input/kt-input.d.ts +112 -0
- package/dist/components/forms/kt-input/kt-input.js +556 -0
- package/dist/components/forms/kt-input/kt-input.js.map +1 -0
- package/dist/components/forms/kt-input-menu/kt-input-menu.d.ts +60 -0
- package/dist/components/forms/kt-input-menu/kt-input-menu.js +313 -0
- package/dist/components/forms/kt-input-menu/kt-input-menu.js.map +1 -0
- package/dist/components/forms/kt-label-input/kt-label-input.d.ts +42 -0
- package/dist/components/forms/kt-label-input/kt-label-input.js +69 -0
- package/dist/components/forms/kt-label-input/kt-label-input.js.map +1 -0
- package/dist/components/forms/kt-select/kt-select.d.ts +80 -0
- package/dist/components/forms/kt-select/kt-select.js +334 -0
- package/dist/components/forms/kt-select/kt-select.js.map +1 -0
- package/dist/components/forms/kt-textarea/kt-textarea.d.ts +62 -0
- package/dist/components/forms/kt-textarea/kt-textarea.js +239 -0
- package/dist/components/forms/kt-textarea/kt-textarea.js.map +1 -0
- package/dist/components/forms/kt-toggle/kt-toggle.d.ts +53 -0
- package/dist/components/forms/kt-toggle/kt-toggle.js +170 -0
- package/dist/components/forms/kt-toggle/kt-toggle.js.map +1 -0
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.d.ts +45 -0
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +93 -0
- package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js.map +1 -0
- package/dist/components/navigation/kt-header/kt-header.d.ts +67 -0
- package/dist/components/navigation/kt-header/kt-header.js +195 -0
- package/dist/components/navigation/kt-header/kt-header.js.map +1 -0
- package/dist/components/navigation/kt-page-header/kt-page-header.d.ts +48 -0
- package/dist/components/navigation/kt-page-header/kt-page-header.js +111 -0
- package/dist/components/navigation/kt-page-header/kt-page-header.js.map +1 -0
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.d.ts +63 -0
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +228 -0
- package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js.map +1 -0
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.d.ts +94 -0
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +265 -0
- package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js.map +1 -0
- package/dist/components/navigation/kt-tabs/kt-tabs.d.ts +64 -0
- package/dist/components/navigation/kt-tabs/kt-tabs.js +175 -0
- package/dist/components/navigation/kt-tabs/kt-tabs.js.map +1 -0
- package/dist/components/navigation/kt-toggle-button/kt-toggle-button.d.ts +50 -0
- package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +191 -0
- package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js.map +1 -0
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.d.ts +55 -0
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +128 -0
- package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js.map +1 -0
- package/dist/components/overlays/kt-collapsible/kt-collapsible.d.ts +42 -0
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js +107 -0
- package/dist/components/overlays/kt-collapsible/kt-collapsible.js.map +1 -0
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.d.ts +56 -0
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +155 -0
- package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js.map +1 -0
- package/dist/components/overlays/kt-dropdown/kt-dropdown.d.ts +64 -0
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js +212 -0
- package/dist/components/overlays/kt-dropdown/kt-dropdown.js.map +1 -0
- package/dist/components/overlays/kt-modal/kt-modal.d.ts +61 -0
- package/dist/components/overlays/kt-modal/kt-modal.js +207 -0
- package/dist/components/overlays/kt-modal/kt-modal.js.map +1 -0
- package/dist/components/overlays/kt-side-panel/kt-side-panel.d.ts +52 -0
- package/dist/components/overlays/kt-side-panel/kt-side-panel.js +178 -0
- package/dist/components/overlays/kt-side-panel/kt-side-panel.js.map +1 -0
- package/dist/icons/defaults.d.ts +25 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/icons/index.js +37 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/icons/registry.d.ts +38 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/countries.d.ts +37 -0
- package/dist/internal/dialog.d.ts +22 -0
- package/dist/internal/events.d.ts +14 -0
- package/dist/internal/form-control.d.ts +27 -0
- package/dist/internal/format.d.ts +8 -0
- package/dist/internal/kt-element.d.ts +22 -0
- package/dist/internal/listbox.d.ts +36 -0
- package/dist/internal/slots.d.ts +10 -0
- package/dist/react/index.d.ts +208 -0
- package/dist/react/index.js +314 -0
- package/dist/react/index.js.map +1 -0
- package/dist/styles.css +13 -0
- package/dist/tokens/README.md +63 -0
- package/dist/tokens/base.css +79 -0
- package/dist/tokens/colors.css +125 -0
- package/dist/tokens/fonts.css +136 -0
- package/dist/tokens/index.css +12 -0
- package/dist/tokens/responsive.css +108 -0
- package/dist/tokens/spacing.css +66 -0
- package/dist/tokens/theme-light.css +144 -0
- package/dist/tokens/typography.css +41 -0
- package/dist/vue/index.d.ts +143 -0
- package/dist/vue/index.js +56 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +296 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { KtElement } from '#internal/kt-element';
|
|
3
|
+
import '../../core/kt-button/kt-button.js';
|
|
4
|
+
/**
|
|
5
|
+
* The application header: a banner landmark holding the brand, the primary
|
|
6
|
+
* navigation and a row of actions.
|
|
7
|
+
*
|
|
8
|
+
* Below `--kt-header-breakpoint` (900px by default) the navigation collapses
|
|
9
|
+
* behind a menu button and reappears as a panel under the bar. That threshold
|
|
10
|
+
* is a token rather than a hard-coded media query, because how much navigation
|
|
11
|
+
* fits depends on how much navigation you put in.
|
|
12
|
+
*
|
|
13
|
+
* @element kt-header
|
|
14
|
+
*
|
|
15
|
+
* @slot brand - Logo or wordmark, at the start.
|
|
16
|
+
* @slot - Primary navigation, in the middle.
|
|
17
|
+
* @slot actions - Buttons and links, at the end. Stays visible on mobile.
|
|
18
|
+
* @slot menu - What the menu button reveals below the breakpoint. Separate
|
|
19
|
+
* from the default slot because a node can only be assigned to one slot; put
|
|
20
|
+
* a compact copy of the navigation here.
|
|
21
|
+
* @slot bottom - A second row under the bar — sub-navigation, a breadcrumb.
|
|
22
|
+
*
|
|
23
|
+
* @csspart base - The `<header>`.
|
|
24
|
+
* @csspart bar - The main row.
|
|
25
|
+
* @csspart bottom - The second row.
|
|
26
|
+
*
|
|
27
|
+
* The bar is a three-column grid whose outer columns are equal, so the
|
|
28
|
+
* navigation is centred in the bar rather than in whatever the brand and the
|
|
29
|
+
* actions left over. Set `nav-align="start"` to butt it against the brand
|
|
30
|
+
* instead.
|
|
31
|
+
*
|
|
32
|
+
* @cssproperty --kt-header-breakpoint - Where the navigation collapses. 900px.
|
|
33
|
+
* @cssproperty --kt-header-height - Height of the main row. 64px.
|
|
34
|
+
*
|
|
35
|
+
* @fires kt-menu-toggle - The mobile menu opened or closed. `detail: { open }`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```html
|
|
39
|
+
* <kt-header sticky>
|
|
40
|
+
* <a slot="brand" href="/">KANTO</a>
|
|
41
|
+
* <nav><a href="/docs">Docs</a><a href="/components">Components</a></nav>
|
|
42
|
+
* <kt-button slot="actions" size="small" icon="github" label="GitHub"></kt-button>
|
|
43
|
+
* </kt-header>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare class KtHeader extends KtElement {
|
|
47
|
+
static styles: import("lit").CSSResultGroup[];
|
|
48
|
+
private menuOpen;
|
|
49
|
+
/** Pins the header to the top of the viewport. */
|
|
50
|
+
sticky: boolean;
|
|
51
|
+
/** Where the navigation sits: centred in the bar, or against the brand. */
|
|
52
|
+
navAlign: 'center' | 'start';
|
|
53
|
+
bordered: boolean;
|
|
54
|
+
/** Accessible name for the banner, when a page has more than one. */
|
|
55
|
+
label: string;
|
|
56
|
+
/** Whether the collapsed navigation panel is showing. */
|
|
57
|
+
get isMenuOpen(): boolean;
|
|
58
|
+
/** Closes the collapsed navigation — call it after routing. */
|
|
59
|
+
closeMenu(): void;
|
|
60
|
+
private toggleMenu;
|
|
61
|
+
render(): TemplateResult;
|
|
62
|
+
}
|
|
63
|
+
declare global {
|
|
64
|
+
interface HTMLElementTagNameMap {
|
|
65
|
+
'kt-header': KtHeader;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { css as h, nothing as c, html as u } from "lit";
|
|
2
|
+
import { state as m, property as n } from "lit/decorators.js";
|
|
3
|
+
import { K as d, d as b } from "../../../chunks/kt-element-CcMLO5e8.js";
|
|
4
|
+
import { e as p } from "../../../chunks/events-Bjl5Zmmq.js";
|
|
5
|
+
import "../../core/kt-button/kt-button.js";
|
|
6
|
+
var f = Object.defineProperty, a = (r, o, s, g) => {
|
|
7
|
+
for (var e = void 0, i = r.length - 1, l; i >= 0; i--)
|
|
8
|
+
(l = r[i]) && (e = l(o, s, e) || e);
|
|
9
|
+
return e && f(o, s, e), e;
|
|
10
|
+
};
|
|
11
|
+
class t extends d {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.menuOpen = !1, this.sticky = !1, this.navAlign = "center", this.bordered = !0, this.label = "";
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.styles = [
|
|
17
|
+
d.styles,
|
|
18
|
+
h`
|
|
19
|
+
:host {
|
|
20
|
+
display: block;
|
|
21
|
+
--kt-header-height: 64px;
|
|
22
|
+
--kt-header-breakpoint: 900px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([sticky]) {
|
|
26
|
+
position: sticky;
|
|
27
|
+
top: 0;
|
|
28
|
+
z-index: var(--z-dropdown);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
header {
|
|
32
|
+
background-color: var(--surface-page);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Translucent only where the browser can actually blur; an unblurred
|
|
36
|
+
semi-transparent bar is just hard to read. */
|
|
37
|
+
@supports (backdrop-filter: blur(1px)) {
|
|
38
|
+
:host([sticky]) header {
|
|
39
|
+
background-color: color-mix(in srgb, var(--surface-page) 80%, transparent);
|
|
40
|
+
backdrop-filter: blur(12px);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([bordered]) header {
|
|
45
|
+
border-bottom: var(--border-width) solid var(--border-subtle);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Three columns rather than a flex row, and the outer two share what is
|
|
49
|
+
left equally: with flex:1 on the middle, the navigation is centred in
|
|
50
|
+
the leftover space, so it sits off-centre by half the difference
|
|
51
|
+
between the brand and the actions — which is exactly how far off it
|
|
52
|
+
looked. Equal outer columns centre it in the bar itself. */
|
|
53
|
+
.bar {
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: var(--gap-card);
|
|
58
|
+
min-height: var(--kt-header-height);
|
|
59
|
+
padding: 0 var(--padding-card);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host([nav-align='start']) .bar {
|
|
63
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.brand {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: var(--gap-button);
|
|
70
|
+
color: var(--text-body);
|
|
71
|
+
font: var(--font-title-h6);
|
|
72
|
+
line-height: 1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* A wordmark is capitals, and capitals use none of a font's descent — so
|
|
76
|
+
centring the *line box* parks the letters half a descent high, which is
|
|
77
|
+
about 1.5px at 18px in Manrope and reads as a misalignment rather than
|
|
78
|
+
as a font. Trimming the box to the cap height and the baseline centres
|
|
79
|
+
what the eye actually sees. */
|
|
80
|
+
@supports (text-box: trim-both cap alphabetic) {
|
|
81
|
+
.brand ::slotted(*) {
|
|
82
|
+
text-box: trim-both cap alphabetic;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.nav {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
min-width: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:host([nav-align='start']) .nav {
|
|
94
|
+
justify-content: flex-start;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.actions {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: flex-end;
|
|
101
|
+
gap: var(--gap-button);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.bottom {
|
|
105
|
+
padding: 0 var(--padding-card);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Hidden above the breakpoint; the container query cannot help here
|
|
109
|
+
because the header spans the viewport by definition. */
|
|
110
|
+
.menu-button {
|
|
111
|
+
display: none;
|
|
112
|
+
flex: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.panel {
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@media (max-width: 899px) {
|
|
120
|
+
.menu-button {
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nav {
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.panel.open {
|
|
129
|
+
display: block;
|
|
130
|
+
padding: 0 var(--padding-card) var(--padding-form);
|
|
131
|
+
border-top: var(--border-width) solid var(--border-subtle);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
/** Whether the collapsed navigation panel is showing. */
|
|
138
|
+
get isMenuOpen() {
|
|
139
|
+
return this.menuOpen;
|
|
140
|
+
}
|
|
141
|
+
/** Closes the collapsed navigation — call it after routing. */
|
|
142
|
+
closeMenu() {
|
|
143
|
+
this.menuOpen && (this.menuOpen = !1, p(this, "kt-menu-toggle", { open: !1 }));
|
|
144
|
+
}
|
|
145
|
+
toggleMenu() {
|
|
146
|
+
this.menuOpen = !this.menuOpen, p(this, "kt-menu-toggle", { open: this.menuOpen });
|
|
147
|
+
}
|
|
148
|
+
render() {
|
|
149
|
+
return u`<header part="base" role="banner" aria-label=${this.label || c}>
|
|
150
|
+
<div part="bar" class="bar">
|
|
151
|
+
<div class="brand"><slot name="brand"></slot></div>
|
|
152
|
+
|
|
153
|
+
<div class="nav"><slot></slot></div>
|
|
154
|
+
|
|
155
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
156
|
+
|
|
157
|
+
<kt-button
|
|
158
|
+
class="menu-button"
|
|
159
|
+
variant="secondary-no-bg"
|
|
160
|
+
size="small"
|
|
161
|
+
icon=${this.menuOpen ? "x" : "menu"}
|
|
162
|
+
label=${this.menuOpen ? "Close menu" : "Open menu"}
|
|
163
|
+
aria-expanded=${this.menuOpen ? "true" : "false"}
|
|
164
|
+
@click=${this.toggleMenu}
|
|
165
|
+
></kt-button>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<div class="panel ${this.menuOpen ? "open" : ""}">
|
|
169
|
+
<slot name="menu"></slot>
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<div part="bottom" class="bottom"><slot name="bottom"></slot></div>
|
|
173
|
+
</header>`;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
a([
|
|
177
|
+
m()
|
|
178
|
+
], t.prototype, "menuOpen");
|
|
179
|
+
a([
|
|
180
|
+
n({ type: Boolean, reflect: !0 })
|
|
181
|
+
], t.prototype, "sticky");
|
|
182
|
+
a([
|
|
183
|
+
n({ type: String, reflect: !0, attribute: "nav-align" })
|
|
184
|
+
], t.prototype, "navAlign");
|
|
185
|
+
a([
|
|
186
|
+
n({ type: Boolean, reflect: !0 })
|
|
187
|
+
], t.prototype, "bordered");
|
|
188
|
+
a([
|
|
189
|
+
n({ type: String })
|
|
190
|
+
], t.prototype, "label");
|
|
191
|
+
b("kt-header", t);
|
|
192
|
+
export {
|
|
193
|
+
t as KtHeader
|
|
194
|
+
};
|
|
195
|
+
//# sourceMappingURL=kt-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kt-header.js","sources":["../../../../src/components/navigation/kt-header/kt-header.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { KtElement, defineElement } from '#internal/kt-element';\nimport { emit } from '#internal/events';\nimport '../../core/kt-button/kt-button.js';\n\n/**\n * The application header: a banner landmark holding the brand, the primary\n * navigation and a row of actions.\n *\n * Below `--kt-header-breakpoint` (900px by default) the navigation collapses\n * behind a menu button and reappears as a panel under the bar. That threshold\n * is a token rather than a hard-coded media query, because how much navigation\n * fits depends on how much navigation you put in.\n *\n * @element kt-header\n *\n * @slot brand - Logo or wordmark, at the start.\n * @slot - Primary navigation, in the middle.\n * @slot actions - Buttons and links, at the end. Stays visible on mobile.\n * @slot menu - What the menu button reveals below the breakpoint. Separate\n * from the default slot because a node can only be assigned to one slot; put\n * a compact copy of the navigation here.\n * @slot bottom - A second row under the bar — sub-navigation, a breadcrumb.\n *\n * @csspart base - The `<header>`.\n * @csspart bar - The main row.\n * @csspart bottom - The second row.\n *\n * The bar is a three-column grid whose outer columns are equal, so the\n * navigation is centred in the bar rather than in whatever the brand and the\n * actions left over. Set `nav-align=\"start\"` to butt it against the brand\n * instead.\n *\n * @cssproperty --kt-header-breakpoint - Where the navigation collapses. 900px.\n * @cssproperty --kt-header-height - Height of the main row. 64px.\n *\n * @fires kt-menu-toggle - The mobile menu opened or closed. `detail: { open }`.\n *\n * @example\n * ```html\n * <kt-header sticky>\n * <a slot=\"brand\" href=\"/\">KANTO</a>\n * <nav><a href=\"/docs\">Docs</a><a href=\"/components\">Components</a></nav>\n * <kt-button slot=\"actions\" size=\"small\" icon=\"github\" label=\"GitHub\"></kt-button>\n * </kt-header>\n * ```\n */\nexport class KtHeader extends KtElement {\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n --kt-header-height: 64px;\n --kt-header-breakpoint: 900px;\n }\n\n :host([sticky]) {\n position: sticky;\n top: 0;\n z-index: var(--z-dropdown);\n }\n\n header {\n background-color: var(--surface-page);\n }\n\n /* Translucent only where the browser can actually blur; an unblurred\n semi-transparent bar is just hard to read. */\n @supports (backdrop-filter: blur(1px)) {\n :host([sticky]) header {\n background-color: color-mix(in srgb, var(--surface-page) 80%, transparent);\n backdrop-filter: blur(12px);\n }\n }\n\n :host([bordered]) header {\n border-bottom: var(--border-width) solid var(--border-subtle);\n }\n\n /* Three columns rather than a flex row, and the outer two share what is\n left equally: with flex:1 on the middle, the navigation is centred in\n the leftover space, so it sits off-centre by half the difference\n between the brand and the actions — which is exactly how far off it\n looked. Equal outer columns centre it in the bar itself. */\n .bar {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);\n align-items: center;\n gap: var(--gap-card);\n min-height: var(--kt-header-height);\n padding: 0 var(--padding-card);\n }\n\n :host([nav-align='start']) .bar {\n grid-template-columns: auto minmax(0, 1fr) auto;\n }\n\n .brand {\n display: flex;\n align-items: center;\n gap: var(--gap-button);\n color: var(--text-body);\n font: var(--font-title-h6);\n line-height: 1;\n }\n\n /* A wordmark is capitals, and capitals use none of a font's descent — so\n centring the *line box* parks the letters half a descent high, which is\n about 1.5px at 18px in Manrope and reads as a misalignment rather than\n as a font. Trimming the box to the cap height and the baseline centres\n what the eye actually sees. */\n @supports (text-box: trim-both cap alphabetic) {\n .brand ::slotted(*) {\n text-box: trim-both cap alphabetic;\n }\n }\n\n .nav {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 0;\n }\n\n :host([nav-align='start']) .nav {\n justify-content: flex-start;\n }\n\n .actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--gap-button);\n }\n\n .bottom {\n padding: 0 var(--padding-card);\n }\n\n /* Hidden above the breakpoint; the container query cannot help here\n because the header spans the viewport by definition. */\n .menu-button {\n display: none;\n flex: none;\n }\n\n .panel {\n display: none;\n }\n\n @media (max-width: 899px) {\n .menu-button {\n display: inline-flex;\n }\n\n .nav {\n display: none;\n }\n\n .panel.open {\n display: block;\n padding: 0 var(--padding-card) var(--padding-form);\n border-top: var(--border-width) solid var(--border-subtle);\n }\n }\n `,\n ];\n\n @state()\n private menuOpen = false;\n\n /** Pins the header to the top of the viewport. */\n @property({ type: Boolean, reflect: true })\n sticky = false;\n\n /** Where the navigation sits: centred in the bar, or against the brand. */\n @property({ type: String, reflect: true, attribute: 'nav-align' })\n navAlign: 'center' | 'start' = 'center';\n\n @property({ type: Boolean, reflect: true })\n bordered = true;\n\n /** Accessible name for the banner, when a page has more than one. */\n @property({ type: String })\n label = '';\n\n /** Whether the collapsed navigation panel is showing. */\n get isMenuOpen(): boolean {\n return this.menuOpen;\n }\n\n /** Closes the collapsed navigation — call it after routing. */\n closeMenu(): void {\n if (!this.menuOpen) return;\n this.menuOpen = false;\n emit(this, 'kt-menu-toggle', { open: false });\n }\n\n private toggleMenu(): void {\n this.menuOpen = !this.menuOpen;\n emit(this, 'kt-menu-toggle', { open: this.menuOpen });\n }\n\n override render(): TemplateResult {\n return html`<header part=\"base\" role=\"banner\" aria-label=${this.label || nothing}>\n <div part=\"bar\" class=\"bar\">\n <div class=\"brand\"><slot name=\"brand\"></slot></div>\n\n <div class=\"nav\"><slot></slot></div>\n\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n\n <kt-button\n class=\"menu-button\"\n variant=\"secondary-no-bg\"\n size=\"small\"\n icon=${this.menuOpen ? 'x' : 'menu'}\n label=${this.menuOpen ? 'Close menu' : 'Open menu'}\n aria-expanded=${this.menuOpen ? 'true' : 'false'}\n @click=${this.toggleMenu}\n ></kt-button>\n </div>\n\n <div class=\"panel ${this.menuOpen ? 'open' : ''}\">\n <slot name=\"menu\"></slot>\n </div>\n\n <div part=\"bottom\" class=\"bottom\"><slot name=\"bottom\"></slot></div>\n </header>`;\n }\n}\n\ndefineElement('kt-header', KtHeader);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kt-header': KtHeader;\n }\n}\n"],"names":["KtHeader","KtElement","css","emit","html","nothing","__decorateClass","state","property","defineElement"],"mappings":";;;;;;;;;;AAgDO,MAAMA,UAAiBC,EAAU;AAAA,EAAjC,cAAA;AAAA,UAAA,GAAA,SAAA,GA2HL,KAAQ,WAAW,IAInB,KAAA,SAAS,IAIT,KAAA,WAA+B,UAG/B,KAAA,WAAW,IAIX,KAAA,QAAQ;AAAA,EAAA;AAAA,EAzIR,OAAA;AAAA,SAAgB,SAAS;AAAA,MACvBA,EAAU;AAAA,MACVC;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA;AAAA,EAqHF;AAAA;AAAA,EAqBA,IAAI,aAAsB;AACxB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,YAAkB;AAChB,IAAK,KAAK,aACV,KAAK,WAAW,IAChBC,EAAK,MAAM,kBAAkB,EAAE,MAAM,IAAO;AAAA,EAC9C;AAAA,EAEQ,aAAmB;AACzB,SAAK,WAAW,CAAC,KAAK,UACtBA,EAAK,MAAM,kBAAkB,EAAE,MAAM,KAAK,UAAU;AAAA,EACtD;AAAA,EAES,SAAyB;AAChC,WAAOC,iDAAoD,KAAK,SAASC,CAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAYnE,KAAK,WAAW,MAAM,MAAM;AAAA,kBAC3B,KAAK,WAAW,eAAe,WAAW;AAAA,0BAClC,KAAK,WAAW,SAAS,OAAO;AAAA,mBACvC,KAAK,UAAU;AAAA;AAAA;AAAA;AAAA,0BAIR,KAAK,WAAW,SAAS,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnD;AACF;AA7DUC,EAAA;AAAA,EADPC,EAAA;AAAM,GA1HIP,EA2HH,WAAA,UAAA;AAIRM,EAAA;AAAA,EADCE,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GA9H/BR,EA+HX,WAAA,QAAA;AAIAM,EAAA;AAAA,EADCE,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM,WAAW,aAAa;AAAA,GAlItDR,EAmIX,WAAA,UAAA;AAGAM,EAAA;AAAA,EADCE,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GArI/BR,EAsIX,WAAA,UAAA;AAIAM,EAAA;AAAA,EADCE,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAzIfR,EA0IX,WAAA,OAAA;AAgDFS,EAAc,aAAaT,CAAQ;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { KtElement } from '#internal/kt-element';
|
|
3
|
+
/**
|
|
4
|
+
* The block every screen opens with: an overline, a title, a sentence, and the
|
|
5
|
+
* actions that belong to the page rather than to anything on it.
|
|
6
|
+
*
|
|
7
|
+
* It exists because it was being rebuilt on every screen, and the copies drifted
|
|
8
|
+
* — different heading levels, different gaps, actions sometimes above and
|
|
9
|
+
* sometimes beside. Those are not decisions worth making twice.
|
|
10
|
+
*
|
|
11
|
+
* At `level="section"` the same block introduces a region inside a page: a
|
|
12
|
+
* smaller heading, and the action is usually a link onward rather than a button.
|
|
13
|
+
*
|
|
14
|
+
* @element kt-page-header
|
|
15
|
+
*
|
|
16
|
+
* @slot - Extra content under the description.
|
|
17
|
+
* @slot actions - Buttons or a link, trailing on wide screens.
|
|
18
|
+
*
|
|
19
|
+
* @csspart base - The container.
|
|
20
|
+
* @csspart heading - The heading element.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <kt-page-header eyebrow="Dashboard" heading="Good evening"
|
|
25
|
+
* description="Recent files, integrations and activity.">
|
|
26
|
+
* <kt-button slot="actions" icon="plus">New document</kt-button>
|
|
27
|
+
* </kt-page-header>
|
|
28
|
+
*
|
|
29
|
+
* <kt-page-header level="section" heading="Recently opened">
|
|
30
|
+
* <a slot="actions" href="#/files">See all files</a>
|
|
31
|
+
* </kt-page-header>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class KtPageHeader extends KtElement {
|
|
35
|
+
static styles: import("lit").CSSResultGroup[];
|
|
36
|
+
/** Small uppercase label above the heading — "Dashboard", "Settings". */
|
|
37
|
+
eyebrow: string;
|
|
38
|
+
heading: string;
|
|
39
|
+
description: string;
|
|
40
|
+
/** `page` renders an `<h1>`; `section` an `<h2>` at body scale. */
|
|
41
|
+
level: 'page' | 'section';
|
|
42
|
+
render(): TemplateResult;
|
|
43
|
+
}
|
|
44
|
+
declare global {
|
|
45
|
+
interface HTMLElementTagNameMap {
|
|
46
|
+
'kt-page-header': KtPageHeader;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { css as d, html as t, nothing as l } from "lit";
|
|
2
|
+
import { property as o } from "lit/decorators.js";
|
|
3
|
+
import { K as c, d as g } from "../../../chunks/kt-element-CcMLO5e8.js";
|
|
4
|
+
var f = Object.defineProperty, s = (a, r, p, v) => {
|
|
5
|
+
for (var e = void 0, n = a.length - 1, h; n >= 0; n--)
|
|
6
|
+
(h = a[n]) && (e = h(r, p, e) || e);
|
|
7
|
+
return e && f(r, p, e), e;
|
|
8
|
+
};
|
|
9
|
+
class i extends c {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this.eyebrow = "", this.heading = "", this.description = "", this.level = "page";
|
|
12
|
+
}
|
|
13
|
+
static {
|
|
14
|
+
this.styles = [
|
|
15
|
+
c.styles,
|
|
16
|
+
d`
|
|
17
|
+
:host {
|
|
18
|
+
display: block;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.header {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-wrap: wrap;
|
|
24
|
+
align-items: flex-end;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
gap: 16px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.copy {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex: 1 1 320px;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: 4px;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.eyebrow {
|
|
38
|
+
color: var(--color-text-500);
|
|
39
|
+
font: var(--font-title-overline);
|
|
40
|
+
letter-spacing: var(--letter-spacing-overline);
|
|
41
|
+
text-transform: uppercase;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
h1 {
|
|
45
|
+
margin: 0;
|
|
46
|
+
color: var(--text-body);
|
|
47
|
+
font: var(--font-title-h1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
h2 {
|
|
51
|
+
margin: 0;
|
|
52
|
+
color: var(--text-body);
|
|
53
|
+
font: var(--font-title-h5);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.description {
|
|
57
|
+
max-width: 72ch;
|
|
58
|
+
margin: 0;
|
|
59
|
+
color: var(--text-muted);
|
|
60
|
+
font: var(--font-normal-regular);
|
|
61
|
+
line-height: 1.6;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.actions {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex: none;
|
|
67
|
+
flex-wrap: wrap;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: var(--gap-button);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* A section header sits tight against what it introduces. */
|
|
73
|
+
:host([level='section']) .header {
|
|
74
|
+
align-items: center;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
:host([level='section']) .description {
|
|
78
|
+
font: var(--font-normal-small);
|
|
79
|
+
}
|
|
80
|
+
`
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
const r = this.heading ? this.level === "section" ? t`<h2 part="heading">${this.heading}</h2>` : t`<h1 part="heading">${this.heading}</h1>` : l;
|
|
85
|
+
return t`<div part="base" class="header">
|
|
86
|
+
<div class="copy">
|
|
87
|
+
${this.eyebrow ? t`<span class="eyebrow">${this.eyebrow}</span>` : l} ${r}
|
|
88
|
+
${this.description ? t`<p class="description">${this.description}</p>` : l}
|
|
89
|
+
<slot></slot>
|
|
90
|
+
</div>
|
|
91
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
92
|
+
</div>`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
s([
|
|
96
|
+
o({ type: String })
|
|
97
|
+
], i.prototype, "eyebrow");
|
|
98
|
+
s([
|
|
99
|
+
o({ type: String })
|
|
100
|
+
], i.prototype, "heading");
|
|
101
|
+
s([
|
|
102
|
+
o({ type: String })
|
|
103
|
+
], i.prototype, "description");
|
|
104
|
+
s([
|
|
105
|
+
o({ type: String, reflect: !0 })
|
|
106
|
+
], i.prototype, "level");
|
|
107
|
+
g("kt-page-header", i);
|
|
108
|
+
export {
|
|
109
|
+
i as KtPageHeader
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=kt-page-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kt-page-header.js","sources":["../../../../src/components/navigation/kt-page-header/kt-page-header.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { KtElement, defineElement } from '#internal/kt-element';\n\n/**\n * The block every screen opens with: an overline, a title, a sentence, and the\n * actions that belong to the page rather than to anything on it.\n *\n * It exists because it was being rebuilt on every screen, and the copies drifted\n * — different heading levels, different gaps, actions sometimes above and\n * sometimes beside. Those are not decisions worth making twice.\n *\n * At `level=\"section\"` the same block introduces a region inside a page: a\n * smaller heading, and the action is usually a link onward rather than a button.\n *\n * @element kt-page-header\n *\n * @slot - Extra content under the description.\n * @slot actions - Buttons or a link, trailing on wide screens.\n *\n * @csspart base - The container.\n * @csspart heading - The heading element.\n *\n * @example\n * ```html\n * <kt-page-header eyebrow=\"Dashboard\" heading=\"Good evening\"\n * description=\"Recent files, integrations and activity.\">\n * <kt-button slot=\"actions\" icon=\"plus\">New document</kt-button>\n * </kt-page-header>\n *\n * <kt-page-header level=\"section\" heading=\"Recently opened\">\n * <a slot=\"actions\" href=\"#/files\">See all files</a>\n * </kt-page-header>\n * ```\n */\nexport class KtPageHeader extends KtElement {\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n }\n\n .header {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-end;\n justify-content: space-between;\n gap: 16px;\n }\n\n .copy {\n display: flex;\n flex: 1 1 320px;\n flex-direction: column;\n gap: 4px;\n min-width: 0;\n }\n\n .eyebrow {\n color: var(--color-text-500);\n font: var(--font-title-overline);\n letter-spacing: var(--letter-spacing-overline);\n text-transform: uppercase;\n }\n\n h1 {\n margin: 0;\n color: var(--text-body);\n font: var(--font-title-h1);\n }\n\n h2 {\n margin: 0;\n color: var(--text-body);\n font: var(--font-title-h5);\n }\n\n .description {\n max-width: 72ch;\n margin: 0;\n color: var(--text-muted);\n font: var(--font-normal-regular);\n line-height: 1.6;\n }\n\n .actions {\n display: flex;\n flex: none;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--gap-button);\n }\n\n /* A section header sits tight against what it introduces. */\n :host([level='section']) .header {\n align-items: center;\n }\n\n :host([level='section']) .description {\n font: var(--font-normal-small);\n }\n `,\n ];\n\n /** Small uppercase label above the heading — \"Dashboard\", \"Settings\". */\n @property({ type: String })\n eyebrow = '';\n\n @property({ type: String })\n heading = '';\n\n @property({ type: String })\n description = '';\n\n /** `page` renders an `<h1>`; `section` an `<h2>` at body scale. */\n @property({ type: String, reflect: true })\n level: 'page' | 'section' = 'page';\n\n override render(): TemplateResult {\n const title = this.heading\n ? this.level === 'section'\n ? html`<h2 part=\"heading\">${this.heading}</h2>`\n : html`<h1 part=\"heading\">${this.heading}</h1>`\n : nothing;\n\n return html`<div part=\"base\" class=\"header\">\n <div class=\"copy\">\n ${this.eyebrow ? html`<span class=\"eyebrow\">${this.eyebrow}</span>` : nothing} ${title}\n ${this.description ? html`<p class=\"description\">${this.description}</p>` : nothing}\n <slot></slot>\n </div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>`;\n }\n}\n\ndefineElement('kt-page-header', KtPageHeader);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kt-page-header': KtPageHeader;\n }\n}\n"],"names":["KtPageHeader","KtElement","css","title","html","nothing","__decorateClass","property","defineElement"],"mappings":";;;;;;;;AAmCO,MAAMA,UAAqBC,EAAU;AAAA,EAArC,cAAA;AAAA,UAAA,GAAA,SAAA,GAwEL,KAAA,UAAU,IAGV,KAAA,UAAU,IAGV,KAAA,cAAc,IAId,KAAA,QAA4B;AAAA,EAAA;AAAA,EAjF5B,OAAA;AAAA,SAAgB,SAAS;AAAA,MACvBA,EAAU;AAAA,MACVC;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,IAAA;AAAA,EAiEF;AAAA,EAgBS,SAAyB;AAChC,UAAMC,IAAQ,KAAK,UACf,KAAK,UAAU,YACbC,uBAA0B,KAAK,OAAO,UACtCA,uBAA0B,KAAK,OAAO,UACxCC;AAEJ,WAAOD;AAAA;AAAA,UAED,KAAK,UAAUA,0BAA6B,KAAK,OAAO,YAAYC,CAAO,IAAIF,CAAK;AAAA,UACpF,KAAK,cAAcC,2BAA8B,KAAK,WAAW,SAASC,CAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzF;AACF;AA5BEC,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAvEfP,EAwEX,WAAA,SAAA;AAGAM,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GA1EfP,EA2EX,WAAA,SAAA;AAGAM,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GA7EfP,EA8EX,WAAA,aAAA;AAIAM,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAjF9BP,EAkFX,WAAA,OAAA;AAoBFQ,EAAc,kBAAkBR,CAAY;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { KtElement } from '#internal/kt-element';
|
|
3
|
+
import '../../core/kt-icon/kt-icon.js';
|
|
4
|
+
export type KtSegmentedSize = 'small' | 'medium' | 'large';
|
|
5
|
+
export interface KtSegmentedOption {
|
|
6
|
+
readonly value: string | number;
|
|
7
|
+
readonly label?: string;
|
|
8
|
+
readonly icon?: string;
|
|
9
|
+
readonly disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A small set of mutually exclusive choices, shown as one inset track with the
|
|
13
|
+
* selected segment raised out of it.
|
|
14
|
+
*
|
|
15
|
+
* Use it for two to five options that all fit on screen — a view switch, a date
|
|
16
|
+
* range. Past that, `<kt-select>`.
|
|
17
|
+
*
|
|
18
|
+
* Implemented as a radio group: one tab stop for the whole control, arrows to
|
|
19
|
+
* move between segments. That is what a keyboard user expects here, and it
|
|
20
|
+
* keeps a five-option control from adding five tab stops to the page.
|
|
21
|
+
*
|
|
22
|
+
* @element kt-segmented-control
|
|
23
|
+
*
|
|
24
|
+
* @csspart base - The track.
|
|
25
|
+
* @csspart option - A segment.
|
|
26
|
+
*
|
|
27
|
+
* @fires kt-change - A segment was chosen. `detail: { value, option }`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```js
|
|
31
|
+
* control.options = [
|
|
32
|
+
* { value: 'day', label: 'Day' },
|
|
33
|
+
* { value: 'week', label: 'Week' },
|
|
34
|
+
* { value: 'month', label: 'Month' },
|
|
35
|
+
* ];
|
|
36
|
+
* control.value = 'week';
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class KtSegmentedControl extends KtElement {
|
|
40
|
+
static styles: import("lit").CSSResultGroup[];
|
|
41
|
+
private segments;
|
|
42
|
+
options: readonly KtSegmentedOption[];
|
|
43
|
+
value: string | number | null;
|
|
44
|
+
size: KtSegmentedSize;
|
|
45
|
+
orientation: 'horizontal' | 'vertical';
|
|
46
|
+
disabled: boolean;
|
|
47
|
+
/** Accessible name for the group. */
|
|
48
|
+
label: string;
|
|
49
|
+
private get selectedIndex();
|
|
50
|
+
private choose;
|
|
51
|
+
/**
|
|
52
|
+
* Radio-group semantics: the arrows move *and* select, wrapping at the ends
|
|
53
|
+
* and skipping disabled segments.
|
|
54
|
+
*/
|
|
55
|
+
private onKeyDown;
|
|
56
|
+
private step;
|
|
57
|
+
render(): TemplateResult;
|
|
58
|
+
}
|
|
59
|
+
declare global {
|
|
60
|
+
interface HTMLElementTagNameMap {
|
|
61
|
+
'kt-segmented-control': KtSegmentedControl;
|
|
62
|
+
}
|
|
63
|
+
}
|