kanto-ds 1.2.0 → 1.4.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.
Files changed (116) hide show
  1. package/README.md +24 -6
  2. package/dist/chunks/{defaults-DKzFsNbv.js → defaults-BwgjMcww.js} +27 -26
  3. package/dist/chunks/{defaults-DKzFsNbv.js.map → defaults-BwgjMcww.js.map} +1 -1
  4. package/dist/chunks/index-DSSLJirw.js +79 -0
  5. package/dist/chunks/index-DSSLJirw.js.map +1 -0
  6. package/dist/chunks/kt-element-E-tfJpGQ.js +52 -0
  7. package/dist/chunks/kt-element-E-tfJpGQ.js.map +1 -0
  8. package/dist/components/core/kt-avatar/kt-avatar.js +8 -7
  9. package/dist/components/core/kt-avatar/kt-avatar.js.map +1 -1
  10. package/dist/components/core/kt-badge/kt-badge.js +7 -6
  11. package/dist/components/core/kt-badge/kt-badge.js.map +1 -1
  12. package/dist/components/core/kt-button/kt-button.js +1 -1
  13. package/dist/components/core/kt-card/kt-card.js +1 -1
  14. package/dist/components/core/kt-code/kt-code.js +31 -30
  15. package/dist/components/core/kt-code/kt-code.js.map +1 -1
  16. package/dist/components/core/kt-icon/kt-icon.js +2 -2
  17. package/dist/components/core/kt-kbd/kt-kbd.js +1 -1
  18. package/dist/components/core/kt-split-button/kt-split-button.d.ts +2 -2
  19. package/dist/components/core/kt-split-button/kt-split-button.js +27 -26
  20. package/dist/components/core/kt-split-button/kt-split-button.js.map +1 -1
  21. package/dist/components/data/kt-chart/kt-chart.d.ts +2 -2
  22. package/dist/components/data/kt-chart/kt-chart.js +222 -221
  23. package/dist/components/data/kt-chart/kt-chart.js.map +1 -1
  24. package/dist/components/data/kt-meter/kt-meter.js +1 -1
  25. package/dist/components/data/kt-pagination/kt-pagination.d.ts +1 -1
  26. package/dist/components/data/kt-pagination/kt-pagination.js +29 -28
  27. package/dist/components/data/kt-pagination/kt-pagination.js.map +1 -1
  28. package/dist/components/data/kt-stat/kt-stat.js +1 -1
  29. package/dist/components/data/kt-table/kt-table.d.ts +2 -2
  30. package/dist/components/data/kt-table/kt-table.js +30 -29
  31. package/dist/components/data/kt-table/kt-table.js.map +1 -1
  32. package/dist/components/data/kt-timeline/kt-timeline.js +1 -1
  33. package/dist/components/feedback/kt-alert/kt-alert.js +17 -16
  34. package/dist/components/feedback/kt-alert/kt-alert.js.map +1 -1
  35. package/dist/components/feedback/kt-empty-state/kt-empty-state.js +1 -1
  36. package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +1 -1
  37. package/dist/components/feedback/kt-skeleton/kt-skeleton.js +1 -1
  38. package/dist/components/feedback/kt-toast/kt-toast.js +25 -19
  39. package/dist/components/feedback/kt-toast/kt-toast.js.map +1 -1
  40. package/dist/components/feedback/kt-toast-container/kt-toast-container.js +1 -1
  41. package/dist/components/feedback/kt-tooltip/kt-tooltip.js +1 -1
  42. package/dist/components/forms/kt-checkbox/kt-checkbox.d.ts +66 -0
  43. package/dist/components/forms/kt-checkbox/kt-checkbox.js +198 -0
  44. package/dist/components/forms/kt-checkbox/kt-checkbox.js.map +1 -0
  45. package/dist/components/forms/kt-drag-drop/kt-drag-drop.d.ts +2 -2
  46. package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +60 -57
  47. package/dist/components/forms/kt-drag-drop/kt-drag-drop.js.map +1 -1
  48. package/dist/components/forms/kt-form/kt-form.js +11 -10
  49. package/dist/components/forms/kt-form/kt-form.js.map +1 -1
  50. package/dist/components/forms/kt-input/kt-input.js +56 -55
  51. package/dist/components/forms/kt-input/kt-input.js.map +1 -1
  52. package/dist/components/forms/kt-input-menu/kt-input-menu.d.ts +1 -1
  53. package/dist/components/forms/kt-input-menu/kt-input-menu.js +57 -56
  54. package/dist/components/forms/kt-input-menu/kt-input-menu.js.map +1 -1
  55. package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
  56. package/dist/components/forms/kt-radio-group/kt-radio-group.d.ts +103 -0
  57. package/dist/components/forms/kt-radio-group/kt-radio-group.js +265 -0
  58. package/dist/components/forms/kt-radio-group/kt-radio-group.js.map +1 -0
  59. package/dist/components/forms/kt-select/kt-select.d.ts +2 -2
  60. package/dist/components/forms/kt-select/kt-select.js +62 -61
  61. package/dist/components/forms/kt-select/kt-select.js.map +1 -1
  62. package/dist/components/forms/kt-textarea/kt-textarea.js +9 -8
  63. package/dist/components/forms/kt-textarea/kt-textarea.js.map +1 -1
  64. package/dist/components/forms/kt-toggle/kt-toggle.js +1 -1
  65. package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.d.ts +1 -1
  66. package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +6 -5
  67. package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js.map +1 -1
  68. package/dist/components/navigation/kt-header/kt-header.js +11 -10
  69. package/dist/components/navigation/kt-header/kt-header.js.map +1 -1
  70. package/dist/components/navigation/kt-page-header/kt-page-header.js +1 -1
  71. package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +44 -43
  72. package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js.map +1 -1
  73. package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.d.ts +1 -1
  74. package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +6 -5
  75. package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js.map +1 -1
  76. package/dist/components/navigation/kt-tabs/kt-tabs.js +1 -1
  77. package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +1 -1
  78. package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +12 -6
  79. package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js.map +1 -1
  80. package/dist/components/overlays/kt-collapsible/kt-collapsible.js +1 -1
  81. package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.d.ts +3 -3
  82. package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +30 -27
  83. package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js.map +1 -1
  84. package/dist/components/overlays/kt-dropdown/kt-dropdown.d.ts +1 -1
  85. package/dist/components/overlays/kt-dropdown/kt-dropdown.js +8 -7
  86. package/dist/components/overlays/kt-dropdown/kt-dropdown.js.map +1 -1
  87. package/dist/components/overlays/kt-modal/kt-modal.js +5 -4
  88. package/dist/components/overlays/kt-modal/kt-modal.js.map +1 -1
  89. package/dist/components/overlays/kt-side-panel/kt-side-panel.d.ts +1 -1
  90. package/dist/components/overlays/kt-side-panel/kt-side-panel.js +24 -23
  91. package/dist/components/overlays/kt-side-panel/kt-side-panel.js.map +1 -1
  92. package/dist/custom-elements.json +1870 -1071
  93. package/dist/icons/defaults.d.ts +1 -0
  94. package/dist/icons/index.js +1 -1
  95. package/dist/index.d.ts +5 -0
  96. package/dist/index.js +93 -83
  97. package/dist/index.js.map +1 -1
  98. package/dist/internal/kt-element.d.ts +6 -1
  99. package/dist/internal/strings.d.ts +103 -0
  100. package/dist/react/index.d.ts +13 -0
  101. package/dist/react/index.js +176 -157
  102. package/dist/react/index.js.map +1 -1
  103. package/dist/react/jsx.d.ts +12 -1
  104. package/dist/strings/index.d.ts +11 -0
  105. package/dist/strings/index.js +8 -0
  106. package/dist/strings/index.js.map +1 -0
  107. package/dist/tokens/base.css +56 -0
  108. package/dist/vscode.css-custom-data.json +12 -0
  109. package/dist/vscode.html-custom-data.json +85 -0
  110. package/dist/vue/index.d.ts +6 -0
  111. package/dist/vue/index.js +9 -7
  112. package/dist/vue/index.js.map +1 -1
  113. package/dist/web-types.json +263 -39
  114. package/package.json +19 -3
  115. package/dist/chunks/kt-element-B_jjQDhg.js +0 -38
  116. package/dist/chunks/kt-element-B_jjQDhg.js.map +0 -1
@@ -0,0 +1,265 @@
1
+ import { css as b, nothing as d, html as p } from "lit";
2
+ import { property as a, queryAssignedElements as y } from "lit/decorators.js";
3
+ import { K as h, d as v } from "../../../chunks/kt-element-E-tfJpGQ.js";
4
+ import { e as g } from "../../../chunks/events-Bjl5Zmmq.js";
5
+ import { a as m, s as k, b as w } from "../../../chunks/form-control-CxjBTt1c.js";
6
+ import { s as f } from "../../../chunks/index-DSSLJirw.js";
7
+ var x = Object.defineProperty, i = (c, e, r, s) => {
8
+ for (var t = void 0, o = c.length - 1, u; o >= 0; o--)
9
+ (u = c[o]) && (t = u(e, r, t) || t);
10
+ return t && x(e, r, t), t;
11
+ };
12
+ class l extends h {
13
+ constructor() {
14
+ super(...arguments), this.value = "", this.disabled = !1, this.checked = !1, this.tabbable = !1, this.invalid = !1, this.groupDisabled = !1;
15
+ }
16
+ static {
17
+ this.styles = [
18
+ h.styles,
19
+ b`
20
+ :host {
21
+ display: block;
22
+ --radio-size: calc(var(--button-height) * 0.45);
23
+ }
24
+
25
+ .radio {
26
+ display: inline-flex;
27
+ align-items: flex-start;
28
+ gap: var(--gap-button);
29
+ color: var(--text-body);
30
+ font: var(--font-normal-regular);
31
+ outline: none;
32
+ cursor: pointer;
33
+ }
34
+
35
+ .circle {
36
+ position: relative;
37
+ flex: none;
38
+ width: var(--radio-size);
39
+ height: var(--radio-size);
40
+ margin-top: calc((1lh - var(--radio-size)) / 2);
41
+ background-color: var(--surface-field);
42
+ border: var(--border-width) solid var(--border-field);
43
+ border-radius: var(--radius-full);
44
+ transition: border-color var(--duration-instant);
45
+ }
46
+
47
+ /* The dot: a fill inset by a third of the circle. */
48
+ .circle::after {
49
+ content: '';
50
+ position: absolute;
51
+ inset: 22%;
52
+ border-radius: var(--radius-full);
53
+ background-color: var(--color-primary-base);
54
+ transform: scale(0);
55
+ transition: transform var(--duration-fast);
56
+ }
57
+
58
+ .radio:hover .circle {
59
+ border-color: var(--text-muted);
60
+ }
61
+
62
+ .radio:focus-visible .circle {
63
+ outline: var(--outline-width) solid var(--color-primary-base);
64
+ outline-offset: 2px;
65
+ }
66
+
67
+ .radio[aria-checked='true'] .circle {
68
+ border-color: var(--color-primary-base);
69
+ }
70
+ .radio[aria-checked='true'] .circle::after {
71
+ transform: scale(1);
72
+ }
73
+
74
+ :host([invalid]) .circle {
75
+ border-color: var(--color-danger-base);
76
+ }
77
+
78
+ :host([disabled]) .radio,
79
+ :host([group-disabled]) .radio {
80
+ color: var(--text-disabled);
81
+ cursor: not-allowed;
82
+ }
83
+ :host([disabled]) .circle,
84
+ :host([group-disabled]) .circle {
85
+ background-color: var(--color-dark-22);
86
+ border-color: var(--color-dark-24);
87
+ }
88
+ :host([disabled]) .circle::after,
89
+ :host([group-disabled]) .circle::after {
90
+ background-color: var(--text-disabled);
91
+ }
92
+ `
93
+ ];
94
+ }
95
+ get inactive() {
96
+ return this.disabled || this.groupDisabled;
97
+ }
98
+ focus(e) {
99
+ this.shadowRoot?.querySelector(".radio")?.focus(e);
100
+ }
101
+ render() {
102
+ return p`<div
103
+ part="base"
104
+ class="radio"
105
+ role="radio"
106
+ aria-checked=${this.checked ? "true" : "false"}
107
+ aria-disabled=${this.inactive ? "true" : d}
108
+ tabindex=${this.tabbable && !this.inactive ? 0 : -1}
109
+ >
110
+ <span part="circle" class="circle"></span>
111
+ <span class="text"><slot></slot></span>
112
+ </div>`;
113
+ }
114
+ }
115
+ i([
116
+ a({ type: String, reflect: !0 })
117
+ ], l.prototype, "value");
118
+ i([
119
+ a({ type: Boolean, reflect: !0 })
120
+ ], l.prototype, "disabled");
121
+ i([
122
+ a({ type: Boolean, reflect: !0 })
123
+ ], l.prototype, "checked");
124
+ i([
125
+ a({ type: Boolean, attribute: !1 })
126
+ ], l.prototype, "tabbable");
127
+ i([
128
+ a({ type: Boolean, reflect: !0 })
129
+ ], l.prototype, "invalid");
130
+ i([
131
+ a({ type: Boolean, reflect: !0, attribute: "group-disabled" })
132
+ ], l.prototype, "groupDisabled");
133
+ class n extends h {
134
+ constructor() {
135
+ super(...arguments), this.internals = null, this.defaultValue = null, this.value = null, this.name = "", this.label = "", this.disabled = !1, this.required = !1, this.orientation = "vertical", this.error = "", this.syncRadios = () => {
136
+ const e = this.enabled(), s = e.find((t) => t.value === this.value) ?? e[0];
137
+ for (const t of this.radios)
138
+ t.checked = t.value === this.value, t.tabbable = t === s, t.invalid = !!this.error, t.groupDisabled = this.disabled;
139
+ }, this.onClick = (e) => {
140
+ const r = e.composedPath().find((s) => s instanceof l);
141
+ !r || !this.enabled().includes(r) || (this.choose(r), r.focus());
142
+ }, this.onKeyDown = (e) => {
143
+ const r = this.enabled();
144
+ if (r.length === 0) return;
145
+ const s = e.composedPath().find((u) => u instanceof l), t = s ? r.indexOf(s) : -1;
146
+ let o;
147
+ if (e.key === "ArrowDown" || e.key === "ArrowRight")
148
+ o = r[(t + 1) % r.length];
149
+ else if (e.key === "ArrowUp" || e.key === "ArrowLeft")
150
+ o = r[(t - 1 + r.length) % r.length];
151
+ else if (e.key === " " && s && t >= 0)
152
+ o = s;
153
+ else
154
+ return;
155
+ e.preventDefault(), o && (this.choose(o), this.updateComplete.then(() => o.focus()));
156
+ };
157
+ }
158
+ static {
159
+ this.formAssociated = !0;
160
+ }
161
+ static {
162
+ this.styles = [
163
+ h.styles,
164
+ b`
165
+ :host {
166
+ display: block;
167
+ }
168
+
169
+ .group {
170
+ display: flex;
171
+ flex-direction: column;
172
+ gap: var(--gap-element);
173
+ }
174
+
175
+ :host([orientation='horizontal']) .group {
176
+ flex-direction: row;
177
+ flex-wrap: wrap;
178
+ column-gap: var(--gap-card);
179
+ }
180
+ `
181
+ ];
182
+ }
183
+ connectedCallback() {
184
+ super.connectedCallback(), this.internals ??= m(this), this.defaultValue = this.value, this.addEventListener("click", this.onClick), this.addEventListener("keydown", this.onKeyDown);
185
+ }
186
+ disconnectedCallback() {
187
+ super.disconnectedCallback(), this.removeEventListener("click", this.onClick), this.removeEventListener("keydown", this.onKeyDown);
188
+ }
189
+ willUpdate(e) {
190
+ if (e.has("value") || e.has("required") || e.has("error") || this.stringsChanged(e)) {
191
+ k(this.internals, this.value);
192
+ const r = this.required && this.value === null;
193
+ w(
194
+ this.internals,
195
+ { valueMissing: r, customError: !!this.error },
196
+ this.error || (r ? f().selectOption : "")
197
+ );
198
+ }
199
+ }
200
+ updated() {
201
+ this.syncRadios();
202
+ }
203
+ formResetCallback() {
204
+ this.value = this.defaultValue;
205
+ }
206
+ formStateRestoreCallback(e) {
207
+ this.value = e;
208
+ }
209
+ focus(e) {
210
+ this.radios.find((r) => r.tabbable)?.focus(e);
211
+ }
212
+ enabled() {
213
+ return this.disabled ? [] : this.radios.filter((e) => !e.disabled);
214
+ }
215
+ choose(e) {
216
+ e.value !== this.value && (this.value = e.value, g(this, "kt-change", { value: this.value }));
217
+ }
218
+ render() {
219
+ return p`${this.error ? p`<span id="error-message" class="visually-hidden">${this.error}</span>` : d}
220
+ <div
221
+ part="base"
222
+ class="group"
223
+ role="radiogroup"
224
+ aria-label=${this.label || f().options}
225
+ aria-orientation=${this.orientation}
226
+ aria-required=${this.required ? "true" : d}
227
+ aria-invalid=${this.error ? "true" : d}
228
+ aria-disabled=${this.disabled ? "true" : d}
229
+ aria-describedby=${this.error ? "error-message" : d}
230
+ >
231
+ <slot @slotchange=${this.syncRadios}></slot>
232
+ </div>`;
233
+ }
234
+ }
235
+ i([
236
+ y({ selector: "kt-radio" })
237
+ ], n.prototype, "radios");
238
+ i([
239
+ a({ type: String, reflect: !0 })
240
+ ], n.prototype, "value");
241
+ i([
242
+ a({ type: String })
243
+ ], n.prototype, "name");
244
+ i([
245
+ a({ type: String })
246
+ ], n.prototype, "label");
247
+ i([
248
+ a({ type: Boolean, reflect: !0 })
249
+ ], n.prototype, "disabled");
250
+ i([
251
+ a({ type: Boolean, reflect: !0 })
252
+ ], n.prototype, "required");
253
+ i([
254
+ a({ type: String, reflect: !0 })
255
+ ], n.prototype, "orientation");
256
+ i([
257
+ a({ type: String, reflect: !0 })
258
+ ], n.prototype, "error");
259
+ v("kt-radio", l);
260
+ v("kt-radio-group", n);
261
+ export {
262
+ l as KtRadio,
263
+ n as KtRadioGroup
264
+ };
265
+ //# sourceMappingURL=kt-radio-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kt-radio-group.js","sources":["../../../../src/components/forms/kt-radio-group/kt-radio-group.ts"],"sourcesContent":["import { css, html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { KtElement, defineElement } from '#internal/kt-element';\nimport { emit } from '#internal/events';\nimport {\n attachFormInternals,\n setFormValue,\n setValidity,\n type UsableInternals,\n} from '#internal/form-control';\nimport { strings } from '#internal/strings';\n\nexport type KtRadioGroupOrientation = 'vertical' | 'horizontal';\n\n/**\n * One option of a `<kt-radio-group>`.\n *\n * It draws itself and carries `role=\"radio\"`; the group owns the selection,\n * the tab stop and the keyboard. A `<kt-radio>` outside a group does nothing\n * useful.\n *\n * @element kt-radio\n *\n * @slot - The label.\n *\n * @csspart base - The `role=\"radio\"` row.\n * @csspart circle - The drawn circle.\n */\nexport class KtRadio extends KtElement {\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n --radio-size: calc(var(--button-height) * 0.45);\n }\n\n .radio {\n display: inline-flex;\n align-items: flex-start;\n gap: var(--gap-button);\n color: var(--text-body);\n font: var(--font-normal-regular);\n outline: none;\n cursor: pointer;\n }\n\n .circle {\n position: relative;\n flex: none;\n width: var(--radio-size);\n height: var(--radio-size);\n margin-top: calc((1lh - var(--radio-size)) / 2);\n background-color: var(--surface-field);\n border: var(--border-width) solid var(--border-field);\n border-radius: var(--radius-full);\n transition: border-color var(--duration-instant);\n }\n\n /* The dot: a fill inset by a third of the circle. */\n .circle::after {\n content: '';\n position: absolute;\n inset: 22%;\n border-radius: var(--radius-full);\n background-color: var(--color-primary-base);\n transform: scale(0);\n transition: transform var(--duration-fast);\n }\n\n .radio:hover .circle {\n border-color: var(--text-muted);\n }\n\n .radio:focus-visible .circle {\n outline: var(--outline-width) solid var(--color-primary-base);\n outline-offset: 2px;\n }\n\n .radio[aria-checked='true'] .circle {\n border-color: var(--color-primary-base);\n }\n .radio[aria-checked='true'] .circle::after {\n transform: scale(1);\n }\n\n :host([invalid]) .circle {\n border-color: var(--color-danger-base);\n }\n\n :host([disabled]) .radio,\n :host([group-disabled]) .radio {\n color: var(--text-disabled);\n cursor: not-allowed;\n }\n :host([disabled]) .circle,\n :host([group-disabled]) .circle {\n background-color: var(--color-dark-22);\n border-color: var(--color-dark-24);\n }\n :host([disabled]) .circle::after,\n :host([group-disabled]) .circle::after {\n background-color: var(--text-disabled);\n }\n `,\n ];\n\n /** Submitted by the group when this option is chosen. */\n @property({ type: String, reflect: true })\n value = '';\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Set by the group. */\n @property({ type: Boolean, reflect: true })\n checked = false;\n\n /** Set by the group: whether this option holds the group's one tab stop. */\n @property({ type: Boolean, attribute: false })\n tabbable = false;\n\n /** Set by the group while it reports an error. */\n @property({ type: Boolean, reflect: true })\n invalid = false;\n\n /** Set by the group while the whole group is disabled. */\n @property({ type: Boolean, reflect: true, attribute: 'group-disabled' })\n groupDisabled = false;\n\n private get inactive(): boolean {\n return this.disabled || this.groupDisabled;\n }\n\n override focus(options?: FocusOptions): void {\n this.shadowRoot?.querySelector<HTMLElement>('.radio')?.focus(options);\n }\n\n override render(): TemplateResult {\n return html`<div\n part=\"base\"\n class=\"radio\"\n role=\"radio\"\n aria-checked=${this.checked ? 'true' : 'false'}\n aria-disabled=${this.inactive ? 'true' : nothing}\n tabindex=${this.tabbable && !this.inactive ? 0 : -1}\n >\n <span part=\"circle\" class=\"circle\"></span>\n <span class=\"text\"><slot></slot></span>\n </div>`;\n }\n}\n\n/**\n * One choice among a few, all visible at once.\n *\n * Reach for it over `<kt-select>` when there are few enough options to show\n * them all — seeing every option is the point — and over\n * `<kt-segmented-control>` when the options need a sentence each, or the\n * choice belongs in a form rather than a toolbar.\n *\n * Native radios cannot form a group across shadow roots, so this is the ARIA\n * radio group pattern: one tab stop for the whole group, arrow keys move and\n * select, disabled options are skipped.\n *\n * @element kt-radio-group\n *\n * @slot - The `<kt-radio>` options.\n *\n * @csspart base - The `role=\"radiogroup\"` container.\n *\n * @fires kt-change - An option was chosen. `detail: { value }`.\n *\n * @example\n * ```html\n * <kt-radio-group label=\"Billing\" name=\"billing\" value=\"monthly\">\n * <kt-radio value=\"monthly\">Monthly</kt-radio>\n * <kt-radio value=\"yearly\">Yearly — two months free</kt-radio>\n * </kt-radio-group>\n * ```\n */\nexport class KtRadioGroup extends KtElement {\n static readonly formAssociated = true;\n\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: block;\n }\n\n .group {\n display: flex;\n flex-direction: column;\n gap: var(--gap-element);\n }\n\n :host([orientation='horizontal']) .group {\n flex-direction: row;\n flex-wrap: wrap;\n column-gap: var(--gap-card);\n }\n `,\n ];\n\n @queryAssignedElements({ selector: 'kt-radio' })\n private radios!: KtRadio[];\n\n private internals: UsableInternals | null = null;\n private defaultValue: string | null = null;\n\n /** The chosen option's value, or `null`. */\n @property({ type: String, reflect: true })\n value: string | null = null;\n\n @property({ type: String })\n name = '';\n\n /** Accessible name of the group. */\n @property({ type: String })\n label = '';\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n required = false;\n\n @property({ type: String, reflect: true })\n orientation: KtRadioGroupOrientation = 'vertical';\n\n /** Error message. A non-empty value puts the group in its error state. */\n @property({ type: String, reflect: true })\n error = '';\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.internals ??= attachFormInternals(this);\n this.defaultValue = this.value;\n // On the host: the radios are slotted light-DOM children.\n this.addEventListener('click', this.onClick);\n this.addEventListener('keydown', this.onKeyDown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('click', this.onClick);\n this.removeEventListener('keydown', this.onKeyDown);\n }\n\n override willUpdate(changed: PropertyValues<this>): void {\n if (\n changed.has('value') ||\n changed.has('required') ||\n changed.has('error') ||\n this.stringsChanged(changed)\n ) {\n setFormValue(this.internals, this.value);\n\n const missing = this.required && this.value === null;\n setValidity(\n this.internals,\n { valueMissing: missing, customError: Boolean(this.error) },\n this.error || (missing ? strings().selectOption : ''),\n );\n }\n }\n\n override updated(): void {\n this.syncRadios();\n }\n\n formResetCallback(): void {\n this.value = this.defaultValue;\n }\n\n formStateRestoreCallback(state: string | null): void {\n this.value = state;\n }\n\n override focus(options?: FocusOptions): void {\n this.radios.find((radio) => radio.tabbable)?.focus(options);\n }\n\n private enabled(): KtRadio[] {\n return this.disabled ? [] : this.radios.filter((radio) => !radio.disabled);\n }\n\n /**\n * Pushes the group's state down; the radios are the display, not the truth.\n * The tab stop sits on the chosen option, or the first enabled one.\n */\n private syncRadios = (): void => {\n const enabled = this.enabled();\n const chosen = enabled.find((radio) => radio.value === this.value);\n const tabStop = chosen ?? enabled[0];\n\n for (const radio of this.radios) {\n radio.checked = radio.value === this.value;\n radio.tabbable = radio === tabStop;\n radio.invalid = Boolean(this.error);\n radio.groupDisabled = this.disabled;\n }\n };\n\n private choose(radio: KtRadio): void {\n if (radio.value === this.value) return;\n this.value = radio.value;\n emit(this, 'kt-change', { value: this.value });\n }\n\n private onClick = (event: Event): void => {\n const radio = event.composedPath().find((node): node is KtRadio => node instanceof KtRadio);\n if (!radio || !this.enabled().includes(radio)) return;\n this.choose(radio);\n radio.focus();\n };\n\n /** Arrows move and select, wrapping; Space selects the focused option. */\n private onKeyDown = (event: KeyboardEvent): void => {\n const enabled = this.enabled();\n if (enabled.length === 0) return;\n\n const focused = event.composedPath().find((node): node is KtRadio => node instanceof KtRadio);\n const from = focused ? enabled.indexOf(focused) : -1;\n\n let target: KtRadio | undefined;\n if (event.key === 'ArrowDown' || event.key === 'ArrowRight') {\n target = enabled[(from + 1) % enabled.length];\n } else if (event.key === 'ArrowUp' || event.key === 'ArrowLeft') {\n target = enabled[(from - 1 + enabled.length) % enabled.length];\n } else if (event.key === ' ' && focused && from >= 0) {\n target = focused;\n } else {\n return;\n }\n\n event.preventDefault();\n if (!target) return;\n this.choose(target);\n void this.updateComplete.then(() => target.focus());\n };\n\n override render(): TemplateResult {\n return html`${\n this.error\n ? html`<span id=\"error-message\" class=\"visually-hidden\">${this.error}</span>`\n : nothing\n }\n <div\n part=\"base\"\n class=\"group\"\n role=\"radiogroup\"\n aria-label=${this.label || strings().options}\n aria-orientation=${this.orientation}\n aria-required=${this.required ? 'true' : nothing}\n aria-invalid=${this.error ? 'true' : nothing}\n aria-disabled=${this.disabled ? 'true' : nothing}\n aria-describedby=${this.error ? 'error-message' : nothing}\n >\n <slot @slotchange=${this.syncRadios}></slot>\n </div>`;\n }\n}\n\ndefineElement('kt-radio', KtRadio);\ndefineElement('kt-radio-group', KtRadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kt-radio': KtRadio;\n 'kt-radio-group': KtRadioGroup;\n }\n}\n"],"names":["KtRadio","KtElement","css","options","html","nothing","__decorateClass","property","KtRadioGroup","enabled","tabStop","radio","event","node","focused","from","target","attachFormInternals","changed","setFormValue","missing","setValidity","strings","state","emit","queryAssignedElements","defineElement"],"mappings":";;;;;;;;;;;AA4BO,MAAMA,UAAgBC,EAAU;AAAA,EAAhC,cAAA;AAAA,UAAA,GAAA,SAAA,GAiFL,KAAA,QAAQ,IAGR,KAAA,WAAW,IAIX,KAAA,UAAU,IAIV,KAAA,WAAW,IAIX,KAAA,UAAU,IAIV,KAAA,gBAAgB;AAAA,EAAA;AAAA,EAnGhB,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;AAA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EA6CX,WAAA,UAAA;AAGAF,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GA/C9BC,EAgDX,WAAA,aAAA;AAIAF,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAnD9BC,EAoDX,WAAA,OAAA;AAoIFkB,EAAc,YAAY1B,CAAO;AACjC0B,EAAc,kBAAkBlB,CAAY;"}
@@ -42,7 +42,7 @@ export declare class KtSelect extends KtElement {
42
42
  options: readonly KtOption[];
43
43
  /** The selected option's id, or `null`. */
44
44
  value: string | number | null;
45
- placeholder: string;
45
+ placeholder: string | undefined;
46
46
  name: string;
47
47
  size: KtSelectSize;
48
48
  disabled: boolean;
@@ -54,7 +54,7 @@ export declare class KtSelect extends KtElement {
54
54
  /** Accessible name, when no `<kt-label-input>` wraps the control. */
55
55
  label: string;
56
56
  /** Shown when `options` is empty. */
57
- emptyText: string;
57
+ emptyText: string | undefined;
58
58
  connectedCallback(): void;
59
59
  disconnectedCallback(): void;
60
60
  willUpdate(changed: PropertyValues<this>): void;
@@ -1,19 +1,20 @@
1
- import { css as m, nothing as n, html as l } from "lit";
2
- import { state as g, property as r } from "lit/decorators.js";
3
- import { classMap as d } from "lit/directives/class-map.js";
4
- import { K as u, d as y } from "../../../chunks/kt-element-B_jjQDhg.js";
5
- import { u as x, e as v } from "../../../chunks/events-Bjl5Zmmq.js";
6
- import { a as w, s as k, b as $ } from "../../../chunks/form-control-CxjBTt1c.js";
7
- import { a as I, f, l as D, n as L, o as b } from "../../../chunks/listbox-Sm3nvsC6.js";
1
+ import { css as y, nothing as n, html as d } from "lit";
2
+ import { state as m, property as o } from "lit/decorators.js";
3
+ import { classMap as h } from "lit/directives/class-map.js";
4
+ import { K as v, d as x } from "../../../chunks/kt-element-E-tfJpGQ.js";
5
+ import { u as w, e as f } from "../../../chunks/events-Bjl5Zmmq.js";
6
+ import { a as k, s as $, b as I } from "../../../chunks/form-control-CxjBTt1c.js";
7
+ import { a as D, f as b, l as L, n as S, o as g } from "../../../chunks/listbox-Sm3nvsC6.js";
8
+ import { s as l } from "../../../chunks/index-DSSLJirw.js";
8
9
  import "../../core/kt-icon/kt-icon.js";
9
- var S = Object.defineProperty, i = (h, e, o, a) => {
10
- for (var s = void 0, c = h.length - 1, p; c >= 0; c--)
11
- (p = h[c]) && (s = p(e, o, s) || s);
12
- return s && S(e, o, s), s;
10
+ var E = Object.defineProperty, i = (c, e, s, a) => {
11
+ for (var r = void 0, p = c.length - 1, u; p >= 0; p--)
12
+ (u = c[p]) && (r = u(e, s, r) || r);
13
+ return r && E(e, s, r), r;
13
14
  };
14
- class t extends u {
15
+ class t extends v {
15
16
  constructor() {
16
- super(...arguments), this.internals = null, this.defaultValue = null, this.listId = x("kt-select-list"), this.open = !1, this.activeIndex = -1, this.options = [], this.value = null, this.placeholder = "Select", this.name = "", this.size = "medium", this.disabled = !1, this.required = !1, this.error = "", this.clearable = !0, this.label = "", this.emptyText = "No options available", this.onDocumentPointerDown = (e) => {
17
+ super(...arguments), this.internals = null, this.defaultValue = null, this.listId = w("kt-select-list"), this.open = !1, this.activeIndex = -1, this.options = [], this.value = null, this.placeholder = void 0, this.name = "", this.size = "medium", this.disabled = !1, this.required = !1, this.error = "", this.clearable = !0, this.label = "", this.emptyText = void 0, this.onDocumentPointerDown = (e) => {
17
18
  e.composedPath().includes(this) || (this.open = !1);
18
19
  };
19
20
  }
@@ -22,9 +23,9 @@ class t extends u {
22
23
  }
23
24
  static {
24
25
  this.styles = [
25
- u.styles,
26
- I,
27
- m`
26
+ v.styles,
27
+ D,
28
+ y`
28
29
  :host {
29
30
  position: relative;
30
31
  display: block;
@@ -137,19 +138,19 @@ class t extends u {
137
138
  ];
138
139
  }
139
140
  connectedCallback() {
140
- super.connectedCallback(), this.internals ??= w(this), this.defaultValue = this.value, document.addEventListener("pointerdown", this.onDocumentPointerDown);
141
+ super.connectedCallback(), this.internals ??= k(this), this.defaultValue = this.value, document.addEventListener("pointerdown", this.onDocumentPointerDown);
141
142
  }
142
143
  disconnectedCallback() {
143
144
  super.disconnectedCallback(), document.removeEventListener("pointerdown", this.onDocumentPointerDown);
144
145
  }
145
146
  willUpdate(e) {
146
- if (e.has("value") || e.has("required") || e.has("error")) {
147
- k(this.internals, this.value === null ? null : String(this.value));
148
- const o = this.required && this.value === null;
149
- $(
147
+ if (e.has("value") || e.has("required") || e.has("error") || this.stringsChanged(e)) {
148
+ $(this.internals, this.value === null ? null : String(this.value));
149
+ const s = this.required && this.value === null;
150
+ I(
150
151
  this.internals,
151
- { valueMissing: o, customError: !!this.error },
152
- this.error || (o ? "Select an option." : "")
152
+ { valueMissing: s, customError: !!this.error },
153
+ this.error || (s ? l().selectOption : "")
153
154
  );
154
155
  }
155
156
  }
@@ -169,8 +170,8 @@ class t extends u {
169
170
  openList() {
170
171
  if (this.disabled) return;
171
172
  this.open = !0;
172
- const e = this.options.findIndex((o) => o.id === this.value);
173
- this.activeIndex = e >= 0 ? e : f(this.options);
173
+ const e = this.options.findIndex((s) => s.id === this.value);
174
+ this.activeIndex = e >= 0 ? e : b(this.options);
174
175
  }
175
176
  closeList() {
176
177
  this.open = !1, this.activeIndex = -1;
@@ -179,17 +180,17 @@ class t extends u {
179
180
  this.open ? this.closeList() : this.openList();
180
181
  }
181
182
  choose(e) {
182
- e.disabled || (this.value = e.id, this.closeList(), this.focus(), v(this, "kt-change", { value: e.id, option: e }));
183
+ e.disabled || (this.value = e.id, this.closeList(), this.focus(), f(this, "kt-change", { value: e.id, option: e }));
183
184
  }
184
185
  clear(e) {
185
- e.stopPropagation(), this.value = null, v(this, "kt-change", { value: null, option: null });
186
+ e.stopPropagation(), this.value = null, f(this, "kt-change", { value: null, option: null });
186
187
  }
187
188
  onKeyDown(e) {
188
189
  switch (e.key) {
189
190
  case "ArrowDown":
190
191
  case "ArrowUp": {
191
192
  if (e.preventDefault(), !this.open) return this.openList();
192
- this.activeIndex = L(
193
+ this.activeIndex = S(
193
194
  this.options,
194
195
  this.activeIndex,
195
196
  e.key === "ArrowDown" ? 1 : -1
@@ -198,17 +199,17 @@ class t extends u {
198
199
  }
199
200
  case "Home":
200
201
  if (!this.open) return;
201
- e.preventDefault(), this.activeIndex = f(this.options);
202
+ e.preventDefault(), this.activeIndex = b(this.options);
202
203
  return;
203
204
  case "End":
204
205
  if (!this.open) return;
205
- e.preventDefault(), this.activeIndex = D(this.options);
206
+ e.preventDefault(), this.activeIndex = L(this.options);
206
207
  return;
207
208
  case "Enter":
208
209
  case " ": {
209
210
  if (e.preventDefault(), !this.open) return this.openList();
210
- const o = this.options[this.activeIndex];
211
- o && this.choose(o);
211
+ const s = this.options[this.activeIndex];
212
+ s && this.choose(s);
212
213
  return;
213
214
  }
214
215
  case "Escape":
@@ -223,9 +224,9 @@ class t extends u {
223
224
  return `${this.listId}-option-${e}`;
224
225
  }
225
226
  render() {
226
- const e = this.selectedOption, o = this.clearable && e !== void 0 && !this.disabled;
227
- return l`<div
228
- class=${d({ open: this.open, error: !!this.error })}
227
+ const e = this.selectedOption, s = this.clearable && e !== void 0 && !this.disabled;
228
+ return d`<div
229
+ class=${h({ open: this.open, error: !!this.error })}
229
230
  @keydown=${this.onKeyDown}
230
231
  >
231
232
  <button
@@ -242,15 +243,15 @@ class t extends u {
242
243
  ?disabled=${this.disabled}
243
244
  @click=${this.toggleList}
244
245
  >
245
- <span class=${d({ value: !0, placeholder: !e })}>
246
- ${e ? b(e) : this.placeholder}
246
+ <span class=${h({ value: !0, placeholder: !e })}>
247
+ ${e ? g(e) : this.placeholder ?? l().select}
247
248
  </span>
248
249
  <span class="icons">
249
- ${o ? l`<span
250
+ ${s ? d`<span
250
251
  class="clear"
251
252
  role="button"
252
253
  tabindex="-1"
253
- aria-label="Clear"
254
+ aria-label=${l().clear}
254
255
  @click=${this.clear}
255
256
  >
256
257
  <kt-icon name="x" size="18"></kt-icon>
@@ -262,18 +263,18 @@ class t extends u {
262
263
  <ul
263
264
  part="popup"
264
265
  id=${this.listId}
265
- class=${d({ popup: !0, open: this.open })}
266
+ class=${h({ popup: !0, open: this.open })}
266
267
  role="listbox"
267
- aria-label=${this.label || this.placeholder}
268
+ aria-label=${this.label || (this.placeholder ?? l().select)}
268
269
  >
269
- ${this.options.length === 0 ? l`<li class="empty">${this.emptyText}</li>` : this.options.map(
270
- (a, s) => l`<li
270
+ ${this.options.length === 0 ? d`<li class="empty">${this.emptyText ?? l().noOptions}</li>` : this.options.map(
271
+ (a, r) => d`<li
271
272
  part="option"
272
- id=${this.optionId(s)}
273
- class=${d({
273
+ id=${this.optionId(r)}
274
+ class=${h({
274
275
  option: !0,
275
276
  selected: a.id === this.value,
276
- active: s === this.activeIndex,
277
+ active: r === this.activeIndex,
277
278
  disabled: !!a.disabled
278
279
  })}
279
280
  role="option"
@@ -281,7 +282,7 @@ class t extends u {
281
282
  aria-disabled=${a.disabled ? "true" : n}
282
283
  @click=${() => this.choose(a)}
283
284
  >
284
- ${b(a)}
285
+ ${g(a)}
285
286
  </li>`
286
287
  )}
287
288
  </ul>
@@ -289,45 +290,45 @@ class t extends u {
289
290
  }
290
291
  }
291
292
  i([
292
- g()
293
+ m()
293
294
  ], t.prototype, "open");
294
295
  i([
295
- g()
296
+ m()
296
297
  ], t.prototype, "activeIndex");
297
298
  i([
298
- r({ attribute: !1 })
299
+ o({ attribute: !1 })
299
300
  ], t.prototype, "options");
300
301
  i([
301
- r({ type: String })
302
+ o({ type: String })
302
303
  ], t.prototype, "value");
303
304
  i([
304
- r({ type: String })
305
+ o({ type: String })
305
306
  ], t.prototype, "placeholder");
306
307
  i([
307
- r({ type: String })
308
+ o({ type: String })
308
309
  ], t.prototype, "name");
309
310
  i([
310
- r({ type: String, reflect: !0 })
311
+ o({ type: String, reflect: !0 })
311
312
  ], t.prototype, "size");
312
313
  i([
313
- r({ type: Boolean, reflect: !0 })
314
+ o({ type: Boolean, reflect: !0 })
314
315
  ], t.prototype, "disabled");
315
316
  i([
316
- r({ type: Boolean, reflect: !0 })
317
+ o({ type: Boolean, reflect: !0 })
317
318
  ], t.prototype, "required");
318
319
  i([
319
- r({ type: String, reflect: !0 })
320
+ o({ type: String, reflect: !0 })
320
321
  ], t.prototype, "error");
321
322
  i([
322
- r({ type: Boolean })
323
+ o({ type: Boolean })
323
324
  ], t.prototype, "clearable");
324
325
  i([
325
- r({ type: String })
326
+ o({ type: String })
326
327
  ], t.prototype, "label");
327
328
  i([
328
- r({ type: String, attribute: "empty-text" })
329
+ o({ type: String, attribute: "empty-text" })
329
330
  ], t.prototype, "emptyText");
330
- y("kt-select", t);
331
+ x("kt-select", t);
331
332
  export {
332
333
  t as KtSelect
333
334
  };