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.
Files changed (251) hide show
  1. package/README.md +26 -14
  2. package/dist/AGENTS.md +157 -0
  3. package/dist/cdn/kanto.min.js +4743 -932
  4. package/dist/chunks/block-Cci-Kff_.js +69 -0
  5. package/dist/chunks/block-Cci-Kff_.js.map +1 -0
  6. package/dist/chunks/defaults-yhaR6U65.js +70 -0
  7. package/dist/chunks/{defaults-Cpeg13O5.js.map → defaults-yhaR6U65.js.map} +1 -1
  8. package/dist/chunks/heading-DsnZsfg-.js +21 -0
  9. package/dist/chunks/heading-DsnZsfg-.js.map +1 -0
  10. package/dist/chunks/{index-TWJzttLX.js → index-1ZFgagWW.js} +37 -12
  11. package/dist/chunks/index-1ZFgagWW.js.map +1 -0
  12. package/dist/chunks/indicator-B_Rs8F92.js +49 -0
  13. package/dist/chunks/indicator-B_Rs8F92.js.map +1 -0
  14. package/dist/chunks/{kt-calendar-CtwOby1R.js → kt-calendar-SK8eapuy.js} +3 -3
  15. package/dist/chunks/{kt-calendar-CtwOby1R.js.map → kt-calendar-SK8eapuy.js.map} +1 -1
  16. package/dist/chunks/kt-color-picker-BoezCAmx.js +365 -0
  17. package/dist/chunks/kt-color-picker-BoezCAmx.js.map +1 -0
  18. package/dist/chunks/{kt-element-T0VbIBNp.js → kt-element-DvWtPQ1Y.js} +2 -2
  19. package/dist/chunks/{kt-element-T0VbIBNp.js.map → kt-element-DvWtPQ1Y.js.map} +1 -1
  20. package/dist/chunks/motion-ChVUUO7O.js +28 -0
  21. package/dist/chunks/motion-ChVUUO7O.js.map +1 -0
  22. package/dist/chunks/numbers-QyecMiSJ.js +9 -0
  23. package/dist/chunks/numbers-QyecMiSJ.js.map +1 -0
  24. package/dist/chunks/{segmented-field-BBXR4XFL.js → segmented-field-T_Zo6lc1.js} +2 -2
  25. package/dist/chunks/{segmented-field-BBXR4XFL.js.map → segmented-field-T_Zo6lc1.js.map} +1 -1
  26. package/dist/chunks/{typed-date-CPAUNHzr.js → typed-date-CaU0kXoY.js} +2 -2
  27. package/dist/chunks/{typed-date-CPAUNHzr.js.map → typed-date-CaU0kXoY.js.map} +1 -1
  28. package/dist/components/blocks/kt-auth-form/kt-auth-form.d.ts +143 -0
  29. package/dist/components/blocks/kt-auth-form/kt-auth-form.js +368 -0
  30. package/dist/components/blocks/kt-auth-form/kt-auth-form.js.map +1 -0
  31. package/dist/components/blocks/kt-blog-post/kt-blog-post.d.ts +75 -0
  32. package/dist/components/blocks/kt-blog-post/kt-blog-post.js +285 -0
  33. package/dist/components/blocks/kt-blog-post/kt-blog-post.js.map +1 -0
  34. package/dist/components/blocks/kt-cta/kt-cta.d.ts +51 -0
  35. package/dist/components/blocks/kt-cta/kt-cta.js +126 -0
  36. package/dist/components/blocks/kt-cta/kt-cta.js.map +1 -0
  37. package/dist/components/blocks/kt-empty-page/kt-empty-page.d.ts +75 -0
  38. package/dist/components/blocks/kt-empty-page/kt-empty-page.js +245 -0
  39. package/dist/components/blocks/kt-empty-page/kt-empty-page.js.map +1 -0
  40. package/dist/components/blocks/kt-error-page/kt-error-page.d.ts +65 -0
  41. package/dist/components/blocks/kt-error-page/kt-error-page.js +177 -0
  42. package/dist/components/blocks/kt-error-page/kt-error-page.js.map +1 -0
  43. package/dist/components/blocks/kt-faq/kt-faq.d.ts +61 -0
  44. package/dist/components/blocks/kt-faq/kt-faq.js +129 -0
  45. package/dist/components/blocks/kt-faq/kt-faq.js.map +1 -0
  46. package/dist/components/blocks/kt-feature-grid/kt-feature-grid.d.ts +59 -0
  47. package/dist/components/blocks/kt-feature-grid/kt-feature-grid.js +166 -0
  48. package/dist/components/blocks/kt-feature-grid/kt-feature-grid.js.map +1 -0
  49. package/dist/components/blocks/kt-hero/kt-hero.d.ts +51 -0
  50. package/dist/components/blocks/kt-hero/kt-hero.js +138 -0
  51. package/dist/components/blocks/kt-hero/kt-hero.js.map +1 -0
  52. package/dist/components/blocks/kt-logo-cloud/kt-logo-cloud.d.ts +46 -0
  53. package/dist/components/blocks/kt-logo-cloud/kt-logo-cloud.js +100 -0
  54. package/dist/components/blocks/kt-logo-cloud/kt-logo-cloud.js.map +1 -0
  55. package/dist/components/blocks/kt-newsletter/kt-newsletter.d.ts +85 -0
  56. package/dist/components/blocks/kt-newsletter/kt-newsletter.js +247 -0
  57. package/dist/components/blocks/kt-newsletter/kt-newsletter.js.map +1 -0
  58. package/dist/components/blocks/kt-post-grid/kt-post-grid.d.ts +73 -0
  59. package/dist/components/blocks/kt-post-grid/kt-post-grid.js +249 -0
  60. package/dist/components/blocks/kt-post-grid/kt-post-grid.js.map +1 -0
  61. package/dist/components/blocks/kt-pricing-table/kt-pricing-table.d.ts +102 -0
  62. package/dist/components/blocks/kt-pricing-table/kt-pricing-table.js +307 -0
  63. package/dist/components/blocks/kt-pricing-table/kt-pricing-table.js.map +1 -0
  64. package/dist/components/blocks/kt-settings-section/kt-settings-section.d.ts +52 -0
  65. package/dist/components/blocks/kt-settings-section/kt-settings-section.js +158 -0
  66. package/dist/components/blocks/kt-settings-section/kt-settings-section.js.map +1 -0
  67. package/dist/components/blocks/kt-testimonials/kt-testimonials.d.ts +56 -0
  68. package/dist/components/blocks/kt-testimonials/kt-testimonials.js +161 -0
  69. package/dist/components/blocks/kt-testimonials/kt-testimonials.js.map +1 -0
  70. package/dist/components/core/kt-avatar/kt-avatar.js +2 -2
  71. package/dist/components/core/kt-avatar-group/kt-avatar-group.d.ts +42 -0
  72. package/dist/components/core/kt-avatar-group/kt-avatar-group.js +97 -0
  73. package/dist/components/core/kt-avatar-group/kt-avatar-group.js.map +1 -0
  74. package/dist/components/core/kt-badge/kt-badge.js +2 -2
  75. package/dist/components/core/kt-button/flights.d.ts +27 -0
  76. package/dist/components/core/kt-button/kt-button.d.ts +52 -1
  77. package/dist/components/core/kt-button/kt-button.js +353 -77
  78. package/dist/components/core/kt-button/kt-button.js.map +1 -1
  79. package/dist/components/core/kt-button/morph.d.ts +27 -0
  80. package/dist/components/core/kt-card/kt-card.js +1 -1
  81. package/dist/components/core/kt-code/kt-code.d.ts +2 -1
  82. package/dist/components/core/kt-code/kt-code.js +52 -37
  83. package/dist/components/core/kt-code/kt-code.js.map +1 -1
  84. package/dist/components/core/kt-copy-button/kt-copy-button.d.ts +47 -0
  85. package/dist/components/core/kt-copy-button/kt-copy-button.js +74 -0
  86. package/dist/components/core/kt-copy-button/kt-copy-button.js.map +1 -0
  87. package/dist/components/core/kt-icon/kt-icon.js +2 -2
  88. package/dist/components/core/kt-kbd/kt-kbd.js +1 -1
  89. package/dist/components/core/kt-split-button/kt-split-button.js +2 -2
  90. package/dist/components/data/kt-chart/kt-chart.js +2 -2
  91. package/dist/components/data/kt-chat-message/kt-chat-message.d.ts +60 -0
  92. package/dist/components/data/kt-chat-message/kt-chat-message.js +204 -0
  93. package/dist/components/data/kt-chat-message/kt-chat-message.js.map +1 -0
  94. package/dist/components/data/kt-description-list/kt-description-list.d.ts +56 -0
  95. package/dist/components/data/kt-description-list/kt-description-list.js +120 -0
  96. package/dist/components/data/kt-description-list/kt-description-list.js.map +1 -0
  97. package/dist/components/data/kt-meter/kt-meter.js +8 -6
  98. package/dist/components/data/kt-meter/kt-meter.js.map +1 -1
  99. package/dist/components/data/kt-pagination/kt-pagination.js +2 -2
  100. package/dist/components/data/kt-stat/kt-stat.d.ts +3 -1
  101. package/dist/components/data/kt-stat/kt-stat.js +31 -16
  102. package/dist/components/data/kt-stat/kt-stat.js.map +1 -1
  103. package/dist/components/data/kt-table/kt-table.js +2 -2
  104. package/dist/components/data/kt-timeline/kt-timeline.js +2 -2
  105. package/dist/components/data/kt-timeline/kt-timeline.js.map +1 -1
  106. package/dist/components/data/kt-tree/kt-tree.d.ts +69 -0
  107. package/dist/components/data/kt-tree/kt-tree.js +208 -0
  108. package/dist/components/data/kt-tree/kt-tree.js.map +1 -0
  109. package/dist/components/feedback/kt-alert/kt-alert.js +2 -2
  110. package/dist/components/feedback/kt-empty-state/kt-empty-state.js +1 -1
  111. package/dist/components/feedback/kt-progress-bar/kt-progress-bar.js +1 -1
  112. package/dist/components/feedback/kt-skeleton/kt-skeleton.js +1 -1
  113. package/dist/components/feedback/kt-toast/kt-toast.js +2 -2
  114. package/dist/components/feedback/kt-toast-container/kt-toast-container.d.ts +8 -1
  115. package/dist/components/feedback/kt-toast-container/kt-toast-container.js +65 -26
  116. package/dist/components/feedback/kt-toast-container/kt-toast-container.js.map +1 -1
  117. package/dist/components/feedback/kt-tooltip/kt-tooltip.js +1 -1
  118. package/dist/components/forms/kt-calendar/kt-calendar.js +3 -3
  119. package/dist/components/forms/kt-checkbox/kt-checkbox.d.ts +2 -0
  120. package/dist/components/forms/kt-checkbox/kt-checkbox.js +19 -8
  121. package/dist/components/forms/kt-checkbox/kt-checkbox.js.map +1 -1
  122. package/dist/components/forms/kt-color-picker/kt-color-picker.d.ts +66 -0
  123. package/dist/components/forms/kt-color-picker/kt-color-picker.js +14 -0
  124. package/dist/components/forms/kt-color-picker/kt-color-picker.js.map +1 -0
  125. package/dist/components/forms/kt-date-input/kt-date-input.js +5 -5
  126. package/dist/components/forms/kt-date-picker/kt-date-picker.js +4 -4
  127. package/dist/components/forms/kt-drag-drop/kt-drag-drop.js +2 -2
  128. package/dist/components/forms/kt-form/kt-form.js +2 -2
  129. package/dist/components/forms/kt-input/kt-input.js +2 -2
  130. package/dist/components/forms/kt-input-menu/kt-input-menu.js +2 -2
  131. package/dist/components/forms/kt-label-input/kt-label-input.js +1 -1
  132. package/dist/components/forms/kt-multi-select/kt-multi-select.js +2 -2
  133. package/dist/components/forms/kt-number-input/kt-number-input.d.ts +92 -0
  134. package/dist/components/forms/kt-number-input/kt-number-input.js +366 -0
  135. package/dist/components/forms/kt-number-input/kt-number-input.js.map +1 -0
  136. package/dist/components/forms/kt-otp-input/kt-otp-input.d.ts +74 -0
  137. package/dist/components/forms/kt-otp-input/kt-otp-input.js +232 -0
  138. package/dist/components/forms/kt-otp-input/kt-otp-input.js.map +1 -0
  139. package/dist/components/forms/kt-prompt-input/kt-prompt-input.d.ts +74 -0
  140. package/dist/components/forms/kt-prompt-input/kt-prompt-input.js +213 -0
  141. package/dist/components/forms/kt-prompt-input/kt-prompt-input.js.map +1 -0
  142. package/dist/components/forms/kt-radio-group/kt-radio-group.js +2 -2
  143. package/dist/components/forms/kt-select/kt-select.js +2 -2
  144. package/dist/components/forms/kt-slider/kt-slider.d.ts +69 -0
  145. package/dist/components/forms/kt-slider/kt-slider.js +252 -0
  146. package/dist/components/forms/kt-slider/kt-slider.js.map +1 -0
  147. package/dist/components/forms/kt-textarea/kt-textarea.js +2 -2
  148. package/dist/components/forms/kt-time-input/kt-time-input.js +3 -3
  149. package/dist/components/forms/kt-toggle/kt-toggle.js +1 -1
  150. package/dist/components/navigation/kt-app-shell/kt-app-shell.d.ts +85 -0
  151. package/dist/components/navigation/kt-app-shell/kt-app-shell.js +220 -0
  152. package/dist/components/navigation/kt-app-shell/kt-app-shell.js.map +1 -0
  153. package/dist/components/navigation/kt-breadcrumb/kt-breadcrumb.js +2 -2
  154. package/dist/components/navigation/kt-footer/kt-footer.d.ts +82 -0
  155. package/dist/components/navigation/kt-footer/kt-footer.js +220 -0
  156. package/dist/components/navigation/kt-footer/kt-footer.js.map +1 -0
  157. package/dist/components/navigation/kt-header/kt-header.js +2 -2
  158. package/dist/components/navigation/kt-page-header/kt-page-header.js +2 -2
  159. package/dist/components/navigation/kt-page-header/kt-page-header.js.map +1 -1
  160. package/dist/components/navigation/kt-segmented-control/kt-segmented-control.d.ts +1 -0
  161. package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js +81 -44
  162. package/dist/components/navigation/kt-segmented-control/kt-segmented-control.js.map +1 -1
  163. package/dist/components/navigation/kt-steps/kt-steps.d.ts +68 -0
  164. package/dist/components/navigation/kt-steps/kt-steps.js +286 -0
  165. package/dist/components/navigation/kt-steps/kt-steps.js.map +1 -0
  166. package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js +3 -3
  167. package/dist/components/navigation/kt-sub-menu-navigation/kt-sub-menu-navigation.js.map +1 -1
  168. package/dist/components/navigation/kt-tabs/kt-tabs.d.ts +1 -0
  169. package/dist/components/navigation/kt-tabs/kt-tabs.js +92 -64
  170. package/dist/components/navigation/kt-tabs/kt-tabs.js.map +1 -1
  171. package/dist/components/navigation/kt-toggle-button/kt-toggle-button.js +1 -1
  172. package/dist/components/navigation/kt-toggle-button-group/kt-toggle-button-group.js +2 -2
  173. package/dist/components/navigation/kt-user-menu/kt-user-menu.d.ts +86 -0
  174. package/dist/components/navigation/kt-user-menu/kt-user-menu.js +298 -0
  175. package/dist/components/navigation/kt-user-menu/kt-user-menu.js.map +1 -0
  176. package/dist/components/overlays/kt-accordion/kt-accordion.d.ts +47 -0
  177. package/dist/components/overlays/kt-accordion/kt-accordion.js +80 -0
  178. package/dist/components/overlays/kt-accordion/kt-accordion.js.map +1 -0
  179. package/dist/components/overlays/kt-collapsible/kt-collapsible.d.ts +17 -1
  180. package/dist/components/overlays/kt-collapsible/kt-collapsible.js +87 -32
  181. package/dist/components/overlays/kt-collapsible/kt-collapsible.js.map +1 -1
  182. package/dist/components/overlays/kt-command-palette/kt-command-palette.d.ts +87 -0
  183. package/dist/components/overlays/kt-command-palette/kt-command-palette.js +370 -0
  184. package/dist/components/overlays/kt-command-palette/kt-command-palette.js.map +1 -0
  185. package/dist/components/overlays/kt-confirm-dialog/kt-confirm-dialog.js +2 -2
  186. package/dist/components/overlays/kt-dropdown/kt-dropdown.js +2 -2
  187. package/dist/components/overlays/kt-modal/kt-modal.js +2 -2
  188. package/dist/components/overlays/kt-side-panel/kt-side-panel.js +2 -2
  189. package/dist/components/overlays/kt-tour/kt-tour.d.ts +77 -0
  190. package/dist/components/overlays/kt-tour/kt-tour.js +200 -0
  191. package/dist/components/overlays/kt-tour/kt-tour.js.map +1 -0
  192. package/dist/custom-elements.json +16427 -8061
  193. package/dist/docs/kt-accordion.md +49 -0
  194. package/dist/docs/kt-app-shell.md +89 -0
  195. package/dist/docs/kt-auth-form.md +111 -0
  196. package/dist/docs/kt-avatar-group.md +49 -0
  197. package/dist/docs/kt-blog-post.md +77 -0
  198. package/dist/docs/kt-button.md +21 -0
  199. package/dist/docs/kt-chat-message.md +68 -0
  200. package/dist/docs/kt-color-picker.md +67 -0
  201. package/dist/docs/kt-command-palette.md +99 -0
  202. package/dist/docs/kt-copy-button.md +50 -0
  203. package/dist/docs/kt-cta.md +45 -0
  204. package/dist/docs/kt-description-list.md +58 -0
  205. package/dist/docs/kt-empty-page.md +92 -0
  206. package/dist/docs/kt-error-page.md +64 -0
  207. package/dist/docs/kt-faq.md +54 -0
  208. package/dist/docs/kt-feature-grid.md +53 -0
  209. package/dist/docs/kt-footer.md +115 -0
  210. package/dist/docs/kt-hero.md +53 -0
  211. package/dist/docs/kt-logo-cloud.md +41 -0
  212. package/dist/docs/kt-newsletter.md +69 -0
  213. package/dist/docs/kt-number-input.md +77 -0
  214. package/dist/docs/kt-otp-input.md +68 -0
  215. package/dist/docs/kt-post-grid.md +66 -0
  216. package/dist/docs/kt-pricing-table.md +101 -0
  217. package/dist/docs/kt-prompt-input.md +86 -0
  218. package/dist/docs/kt-settings-section.md +65 -0
  219. package/dist/docs/kt-slider.md +76 -0
  220. package/dist/docs/kt-steps.md +79 -0
  221. package/dist/docs/kt-testimonials.md +52 -0
  222. package/dist/docs/kt-tour.md +75 -0
  223. package/dist/docs/kt-tree.md +83 -0
  224. package/dist/docs/kt-user-menu.md +77 -0
  225. package/dist/icons/defaults.d.ts +2 -0
  226. package/dist/icons/index.js +1 -1
  227. package/dist/index.d.ts +56 -0
  228. package/dist/index.js +225 -284
  229. package/dist/index.js.map +1 -1
  230. package/dist/internal/block.d.ts +23 -0
  231. package/dist/internal/command-search.d.ts +27 -0
  232. package/dist/internal/heading.d.ts +8 -0
  233. package/dist/internal/indicator.d.ts +34 -0
  234. package/dist/internal/motion.d.ts +25 -0
  235. package/dist/internal/numbers.d.ts +2 -0
  236. package/dist/internal/strings.d.ts +36 -0
  237. package/dist/react/index.d.ts +165 -0
  238. package/dist/react/index.js +420 -171
  239. package/dist/react/index.js.map +1 -1
  240. package/dist/react/jsx.d.ts +128 -1
  241. package/dist/strings/index.js +1 -1
  242. package/dist/tokens/base.css +35 -2
  243. package/dist/vscode.css-custom-data.json +165 -19
  244. package/dist/vscode.html-custom-data.json +1023 -149
  245. package/dist/vue/index.d.ts +62 -0
  246. package/dist/vue/index.js +39 -8
  247. package/dist/vue/index.js.map +1 -1
  248. package/dist/web-types.json +3238 -836
  249. package/package.json +128 -3
  250. package/dist/chunks/defaults-Cpeg13O5.js +0 -68
  251. package/dist/chunks/index-TWJzttLX.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kt-avatar-group.js","sources":["../../../../src/components/core/kt-avatar-group/kt-avatar-group.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { KtElement, defineElement } from '#internal/kt-element';\nimport { strings } from '#internal/strings';\nimport '../kt-avatar/kt-avatar.js';\nimport type { KtAvatarSize } from '../kt-avatar/kt-avatar.js';\n\nexport interface KtAvatarGroupPerson {\n readonly name: string;\n /** A picture; without one the avatar draws the name's initials. */\n readonly src?: string;\n}\n\n/**\n * The people on something — a project's members, a document's editors — as\n * avatars overlapping in a row, the rest summed up as \"+N\".\n *\n * @element kt-avatar-group\n *\n * @csspart list - The `<ul>`.\n * @csspart more - The \"+N\" at the end.\n *\n * @example\n * ```html\n * <kt-avatar-group label=\"Project members\" max=\"3\"></kt-avatar-group>\n * <script>\n * group.people = [{ name: 'Dana Whitfield' }, { name: 'Hank Scorpio', src: '/hank.png' }];\n * </script>\n * ```\n */\nexport class KtAvatarGroup extends KtElement {\n static override styles = [\n KtElement.styles,\n css`\n :host {\n display: inline-block;\n --kt-avatar-size: 32px;\n }\n :host([size='small']) {\n --kt-avatar-size: 24px;\n }\n :host([size='large']) {\n --kt-avatar-size: 48px;\n }\n\n ul {\n display: flex;\n margin: 0;\n padding: 0;\n list-style: none;\n }\n /* Each one over the last by a third, ringed in the page's colour so the\n overlap reads as a stack, not a smudge. */\n li {\n display: flex;\n border-radius: var(--radius-full);\n box-shadow: 0 0 0 2px var(--surface-page);\n }\n li + li {\n margin-inline-start: calc(var(--kt-avatar-size) * -0.3);\n }\n\n .more {\n display: grid;\n place-items: center;\n min-width: var(--kt-avatar-size);\n height: var(--kt-avatar-size);\n padding: 0 4px;\n color: var(--text-body);\n font: 600 calc(var(--kt-avatar-size) * 0.36) / 1 var(--font-family-body);\n background: var(--surface-raised);\n border-radius: var(--radius-full);\n }\n `,\n ];\n\n /** The people. Set as a property: `group.people = [...]`. */\n @property({ attribute: false })\n people: readonly KtAvatarGroupPerson[] = [];\n\n /** How many avatars to show before summing the rest up. */\n @property({ type: Number })\n max = 4;\n\n @property({ type: String, reflect: true })\n size: KtAvatarSize = 'medium';\n\n /** Accessible name for the group: \"Project members\". */\n @property({ type: String })\n label = '';\n\n override render(): TemplateResult {\n const shown = this.people.slice(0, Math.max(0, this.max));\n const rest = this.people.length - shown.length;\n return html`<ul part=\"list\" aria-label=${this.label || nothing}>\n ${shown.map(\n (person) =>\n html`<li>\n <kt-avatar\n name=${person.name}\n src=${person.src || nothing}\n size=${this.size}\n ></kt-avatar>\n </li>`,\n )}\n ${\n rest > 0\n ? html`<li>\n <span part=\"more\" class=\"more\" role=\"img\" aria-label=${strings().moreCount(rest)}\n >+${rest}</span\n >\n </li>`\n : nothing\n }\n </ul>`;\n }\n}\n\ndefineElement('kt-avatar-group', KtAvatarGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kt-avatar-group': KtAvatarGroup;\n }\n}\n"],"names":["KtAvatarGroup","KtElement","css","shown","rest","html","nothing","person","strings","__decorateClass","property","defineElement"],"mappings":";;;;;;;;;;AA8BO,MAAMA,UAAsBC,EAAU;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA,GAgDL,KAAA,SAAyC,CAAA,GAIzC,KAAA,MAAM,GAGN,KAAA,OAAqB,UAIrB,KAAA,QAAQ;AAAA,EAAA;AAAA,EA1DR,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,IAAA;AAAA,EAyCF;AAAA,EAiBS,SAAyB;AAChC,UAAMC,IAAQ,KAAK,OAAO,MAAM,GAAG,KAAK,IAAI,GAAG,KAAK,GAAG,CAAC,GAClDC,IAAO,KAAK,OAAO,SAASD,EAAM;AACxC,WAAOE,+BAAkC,KAAK,SAASC,CAAO;AAAA,QAC1DH,EAAM;AAAA,MACN,CAACI,MACCF;AAAA;AAAA,qBAEWE,EAAO,IAAI;AAAA,oBACZA,EAAO,OAAOD,CAAO;AAAA,qBACpB,KAAK,IAAI;AAAA;AAAA;AAAA,IAAA,CAGvB;AAAA,QAECF,IAAO,IACHC;AAAA,qEACyDG,EAAA,EAAU,UAAUJ,CAAI,CAAC;AAAA,oBAC1EA,CAAI;AAAA;AAAA,qBAGZE,CACN;AAAA;AAAA,EAEJ;AACF;AAtCEG,EAAA;AAAA,EADCC,EAAS,EAAE,WAAW,GAAA,CAAO;AAAA,GA/CnBV,EAgDX,WAAA,QAAA;AAIAS,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAnDfV,EAoDX,WAAA,KAAA;AAGAS,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAtD9BV,EAuDX,WAAA,MAAA;AAIAS,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GA1DfV,EA2DX,WAAA,OAAA;AA6BFW,EAAc,mBAAmBX,CAAa;"}
@@ -2,9 +2,9 @@ import { css as h, nothing as n, html as l } from "lit";
2
2
  import { property as e } from "lit/decorators.js";
3
3
  import { classMap as b } from "lit/directives/class-map.js";
4
4
  import { styleMap as m } from "lit/directives/style-map.js";
5
- import { K as p, d as v } from "../../../chunks/kt-element-T0VbIBNp.js";
5
+ import { K as p, d as v } from "../../../chunks/kt-element-DvWtPQ1Y.js";
6
6
  import { e as u } from "../../../chunks/events-r51msXNf.js";
7
- import { s as g } from "../../../chunks/index-TWJzttLX.js";
7
+ import { s as g } from "../../../chunks/index-1ZFgagWW.js";
8
8
  import "../kt-icon/kt-icon.js";
9
9
  var f = Object.defineProperty, t = (s, r, i, y) => {
10
10
  for (var a = void 0, c = s.length - 1, d; c >= 0; c--)
@@ -0,0 +1,27 @@
1
+ /**
2
+ * How an icon leaves a button when its action is done, and comes back.
3
+ *
4
+ * Most icons have no story to tell and fade; a few do. A paper plane takes a
5
+ * breath back, then flies off to the top right. Keyed by the Lucide name.
6
+ */
7
+ export interface Flight {
8
+ /**
9
+ * While the action runs, the icon's own outline becomes the spinner — and
10
+ * becomes the icon again when it is done — instead of being swapped for one.
11
+ */
12
+ readonly morphs?: boolean;
13
+ /**
14
+ * On success, before the tick. Each keyframe carries the easing of the
15
+ * leg after it; the whole runs on a linear clock.
16
+ */
17
+ readonly leave: Keyframe[];
18
+ /** How many times the slow duration the leaving takes. */
19
+ readonly leaveScale?: number;
20
+ /** Back to rest, a moment later. */
21
+ readonly back: Keyframe[];
22
+ }
23
+ export declare function flightOf(icon: string): Flight;
24
+ /** The tick or the alert coming in: a small overshoot, then rest. */
25
+ export declare const ARRIVE: Keyframe[];
26
+ /** A no: side to side, settling. */
27
+ export declare const SHAKE: Keyframe[];
@@ -1,4 +1,4 @@
1
- import { type TemplateResult } from 'lit';
1
+ import { type PropertyValues, type TemplateResult } from 'lit';
2
2
  import { KtElement } from '#internal/kt-element';
3
3
  import '../kt-icon/kt-icon.js';
4
4
  export type KtButtonVariant = 'primary' | 'secondary' | 'secondary-no-bg' | 'dark' | 'danger' | 'delete' | 'warning' | 'info' | 'success' | 'text';
@@ -15,6 +15,11 @@ export type KtButtonType = 'button' | 'submit' | 'reset';
15
15
  * Setting `icon` with no slotted text produces a square icon-only button,
16
16
  * which then requires a `label`.
17
17
  *
18
+ * `run(action)` runs an async action and shows how it went: busy while it
19
+ * runs, then a tick — and `done-label`, if given — or, if it throws, a shake,
20
+ * an alert and `failed-label`; back to rest two seconds later. Some icons
21
+ * leave in their own way: a `send` plane flies off to the top right.
22
+ *
18
23
  * @element kt-button
19
24
  *
20
25
  * @slot - The button label.
@@ -27,6 +32,10 @@ export type KtButtonType = 'button' | 'submit' | 'reset';
27
32
  * <kt-button icon="plus">New entity</kt-button>
28
33
  * <kt-button variant="secondary" icon="refresh-cw">Refresh</kt-button>
29
34
  * <kt-button variant="danger">Delete</kt-button>
35
+ * <kt-button icon="send" done-label="Sent">Send</kt-button>
36
+ * <script>
37
+ * send.addEventListener('click', () => send.run(() => api.send(message)));
38
+ * </script>
30
39
  * ```
31
40
  */
32
41
  export declare class KtButton extends KtElement {
@@ -57,6 +66,46 @@ export declare class KtButton extends KtElement {
57
66
  name: string;
58
67
  /** @see name */
59
68
  value: string;
69
+ /** Shown in place of the label once `run()` succeeds. Empty keeps the label. */
70
+ doneLabel: string;
71
+ /** Shown in place of the label when `run()` fails. Empty keeps the label. */
72
+ failedLabel: string;
73
+ /** How long the done or failed state stays before the button rests again. */
74
+ static DONE_MS: number;
75
+ private phase;
76
+ private running;
77
+ private restTimer;
78
+ /** The button's width before a label change, to move from. */
79
+ private widthBefore;
80
+ /** Whether this run turns its icon into the spinner and back. */
81
+ private morphing;
82
+ /**
83
+ * The morph, driven frame by frame: `m` from icon (0) to ring (1), moving
84
+ * towards `target`; `offset` walks the arc round the ring. One state, so a
85
+ * change of mind half-way goes back from where it is, never from an end.
86
+ */
87
+ private shape;
88
+ /**
89
+ * Runs `action` and shows how it went. A second call while it runs gets the
90
+ * same promise rather than a second run. Resolves with what the action
91
+ * resolved with; rejects with what it threw, after showing it failed.
92
+ */
93
+ run<T>(action: () => Promise<T>): Promise<T>;
94
+ private finish;
95
+ disconnectedCallback(): void;
96
+ /** Moves the morph towards the ring (1) or the icon (0); resolves on arrival at the icon. */
97
+ private morphTo;
98
+ private step;
99
+ /** Draws the morph where it stands: the outline, its opening, the fold. */
100
+ private drawShape;
101
+ updated(changed: PropertyValues): void;
102
+ /**
103
+ * A label that changed length: the width follows instead of jumping. A new
104
+ * icon draws in its own update, after this one, so it is waited for — the
105
+ * button measured before it would be an icon short, and shrink to that
106
+ * before snapping back. The wait ends before the frame is painted.
107
+ */
108
+ private followWidth;
60
109
  /** Moves focus to the button. */
61
110
  focus(options?: FocusOptions): void;
62
111
  blur(): void;
@@ -69,6 +118,8 @@ export declare class KtButton extends KtElement {
69
118
  */
70
119
  private submitEnclosingForm;
71
120
  private onClick;
121
+ /** The icon for where `run()` is, and how it moves while busy. */
122
+ private get shownIcon();
72
123
  render(): TemplateResult;
73
124
  }
74
125
  declare global {
@@ -1,22 +1,133 @@
1
- import { css as h, html as d, nothing as i } from "lit";
2
- import { property as e } from "lit/decorators.js";
3
- import { classMap as p } from "lit/directives/class-map.js";
4
- import { K as u, d as v } from "../../../chunks/kt-element-T0VbIBNp.js";
1
+ import { css as P, html as g, nothing as c } from "lit";
2
+ import { property as l, state as T } from "lit/decorators.js";
3
+ import { classMap as N } from "lit/directives/class-map.js";
4
+ import { K as y, d as I } from "../../../chunks/kt-element-DvWtPQ1Y.js";
5
+ import { d as $, p as f } from "../../../chunks/motion-ChVUUO7O.js";
5
6
  import "../kt-icon/kt-icon.js";
6
- var g = Object.defineProperty, a = (l, t, o, y) => {
7
- for (var n = void 0, c = l.length - 1, s; c >= 0; c--)
8
- (s = l[c]) && (n = s(t, o, n) || n);
9
- return n && g(t, o, n), n;
7
+ const R = {
8
+ leave: [
9
+ { opacity: 1, scale: 1, easing: "ease-in" },
10
+ { opacity: 0, scale: 0.6 }
11
+ ],
12
+ back: [
13
+ { opacity: 0, scale: 0.6 },
14
+ { opacity: 1, scale: 1 }
15
+ ]
16
+ }, A = {
17
+ morphs: !0,
18
+ leaveScale: 1.5,
19
+ leave: [
20
+ { translate: "0 0", rotate: "0deg", opacity: 1, easing: "cubic-bezier(0.2, 0, 0.4, 1)" },
21
+ // A breath back, slowing into it, before it goes.
22
+ {
23
+ translate: "-0.15em 0.15em",
24
+ rotate: "-6deg",
25
+ opacity: 1,
26
+ offset: 0.3,
27
+ easing: "cubic-bezier(0.55, 0, 0.8, 0.4)"
28
+ },
29
+ // Then off, speeding up, fading only at the end.
30
+ { translate: "1.1em -1.1em", rotate: "6deg", opacity: 1, offset: 0.75 },
31
+ { translate: "1.8em -1.8em", rotate: "10deg", opacity: 0 }
32
+ ],
33
+ back: [
34
+ { translate: "-0.8em 0.8em", opacity: 0 },
35
+ { translate: "0 0", opacity: 1 }
36
+ ]
37
+ }, C = {
38
+ send: A,
39
+ "send-horizontal": A
10
40
  };
11
- const b = { small: 16, medium: 20, large: 24 };
12
- class r extends u {
41
+ function m(a) {
42
+ return C[a] ?? R;
43
+ }
44
+ const M = [
45
+ { opacity: 0, scale: 0.3 },
46
+ { opacity: 1, scale: 1.15, offset: 0.6 },
47
+ { opacity: 1, scale: 1 }
48
+ ], O = [
49
+ { translate: "0" },
50
+ { translate: "-4px" },
51
+ { translate: "4px" },
52
+ { translate: "-3px" },
53
+ { translate: "2px" },
54
+ { translate: "0" }
55
+ ], b = [
56
+ [14.536, 21.686],
57
+ [15.473, 21.662],
58
+ [21.973, 2.662],
59
+ [21.338, 2.027],
60
+ [2.338, 8.527],
61
+ [2.314, 9.464],
62
+ [10.244, 12.644],
63
+ [11.356, 13.754]
64
+ ], _ = "M21.854 2.147L10.914 13.086", L = 64, v = [12, 12], E = 9;
65
+ function z(a) {
66
+ let e = 0;
67
+ return a.forEach(([t, o], r) => {
68
+ const [i, d] = a[(r + 1) % a.length];
69
+ e += t * d - i * o;
70
+ }), Math.sign(e);
71
+ }
72
+ const q = Math.atan2(b[0][1] - v[1], b[0][0] - v[0]);
73
+ function F(a, e) {
74
+ const t = a.map((h, p) => {
75
+ const u = a[(p + 1) % a.length];
76
+ return { from: h, to: u, length: Math.hypot(u[0] - h[0], u[1] - h[1]) };
77
+ }), o = t.reduce((h, p) => h + p.length, 0), r = [];
78
+ let i = 0, d = 0;
79
+ for (let h = 0; h < e; h += 1) {
80
+ const p = o * h / e;
81
+ for (; d + t[i].length < p; ) d += t[i++].length;
82
+ const { from: u, to: k, length: x } = t[i], S = x ? (p - d) / x : 0;
83
+ r.push([u[0] + (k[0] - u[0]) * S, u[1] + (k[1] - u[1]) * S]);
84
+ }
85
+ return r;
86
+ }
87
+ function D(a, e) {
88
+ const t = z(b) || 1;
89
+ return Array.from({ length: a }, (o, r) => {
90
+ const i = e + t * 2 * Math.PI * r / a;
91
+ return [v[0] + E * Math.cos(i), v[1] + E * Math.sin(i)];
92
+ });
93
+ }
94
+ function K(a, e, t) {
95
+ return a.map(([o, r], i) => [o + (e[i][0] - o) * t, r + (e[i][1] - r) * t]);
96
+ }
97
+ function j(a) {
98
+ const e = ([t, o]) => `${Number(t.toFixed(3))} ${Number(o.toFixed(3))}`;
99
+ return `M${a.map(e).join("L")}Z`;
100
+ }
101
+ var W = Object.defineProperty, s = (a, e, t, o) => {
102
+ for (var r = void 0, i = a.length - 1, d; i >= 0; i--)
103
+ (d = a[i]) && (r = d(e, t, r) || r);
104
+ return r && W(e, t, r), r;
105
+ };
106
+ const w = { small: 16, medium: 20, large: 24 }, G = F(b, L), Z = D(L, q), H = 0.28, U = 1e3, V = (a) => a < 0.5 ? 4 * a ** 3 : 1 - (-2 * a + 2) ** 3 / 2, n = class B extends y {
13
107
  constructor() {
14
- super(...arguments), this.variant = "primary", this.size = "medium", this.disabled = !1, this.type = "button", this.icon = "", this.iconPosition = "left", this.label = "", this.popup = void 0, this.expanded = void 0, this.fullWidth = !1, this.name = "", this.value = "";
108
+ super(...arguments), this.variant = "primary", this.size = "medium", this.disabled = !1, this.type = "button", this.icon = "", this.iconPosition = "left", this.label = "", this.popup = void 0, this.expanded = void 0, this.fullWidth = !1, this.name = "", this.value = "", this.doneLabel = "", this.failedLabel = "", this.phase = "idle", this.running = null, this.widthBefore = 0, this.morphing = !1, this.shape = {
109
+ m: 0,
110
+ target: 0,
111
+ offset: 0,
112
+ frame: 0,
113
+ last: 0,
114
+ span: 1,
115
+ settled: null
116
+ }, this.step = (e) => {
117
+ const t = this.shape, o = t.last ? e - t.last : 0;
118
+ t.last = e;
119
+ const r = o / t.span;
120
+ if (t.m = t.target > t.m ? Math.min(t.target, t.m + r) : Math.max(t.target, t.m - r), t.offset = (t.offset - o / U) % 1, this.drawShape(), t.target === 0 && t.m === 0) {
121
+ t.frame = 0, t.settled?.(), t.settled = null;
122
+ return;
123
+ }
124
+ t.frame = requestAnimationFrame(this.step);
125
+ };
15
126
  }
16
127
  static {
17
128
  this.styles = [
18
- u.styles,
19
- h`
129
+ y.styles,
130
+ P`
20
131
  :host {
21
132
  display: inline-flex;
22
133
  vertical-align: middle;
@@ -38,6 +149,9 @@ class r extends u {
38
149
  border: none;
39
150
  border-radius: var(--border-radius);
40
151
  font: var(--font-normal-regular);
152
+ /* One line, always: the height is fixed, and a label that wrapped —
153
+ while run() moves the width to a new one — stood on end. */
154
+ white-space: nowrap;
41
155
  cursor: pointer;
42
156
  transition:
43
157
  background-color var(--duration-instant),
@@ -182,12 +296,126 @@ class r extends u {
182
296
  outline: var(--outline-width) solid var(--color-primary-base);
183
297
  outline-offset: 2px;
184
298
  }
299
+
300
+ /* === RUN ===
301
+ Busy is shown, not disabled: the button keeps its colour and the
302
+ focus, and ignores clicks. */
303
+ button[aria-busy='true'] {
304
+ cursor: progress;
305
+ }
306
+ .spin {
307
+ animation: kt-button-spin calc(var(--duration-slow) * 2) linear infinite;
308
+ }
309
+ @keyframes kt-button-spin {
310
+ to {
311
+ rotate: 1turn;
312
+ }
313
+ }
314
+ .visually-hidden {
315
+ position: absolute;
316
+ width: 1px;
317
+ height: 1px;
318
+ overflow: hidden;
319
+ clip-path: inset(50%);
320
+ white-space: nowrap;
321
+ }
185
322
  `
186
323
  ];
187
324
  }
325
+ static {
326
+ this.DONE_MS = 2e3;
327
+ }
328
+ /**
329
+ * Runs `action` and shows how it went. A second call while it runs gets the
330
+ * same promise rather than a second run. Resolves with what the action
331
+ * resolved with; rejects with what it threw, after showing it failed.
332
+ */
333
+ run(e) {
334
+ if (this.running) return this.running;
335
+ clearTimeout(this.restTimer), this.morphing = !!m(this.icon).morphs && $(this, "--duration-slow") > 0, this.phase = "busy";
336
+ const t = (async () => {
337
+ try {
338
+ const o = await e();
339
+ return await this.finish("done"), o;
340
+ } catch (o) {
341
+ throw await this.finish("failed"), o;
342
+ } finally {
343
+ this.running = null;
344
+ }
345
+ })();
346
+ return this.running = t, t;
347
+ }
348
+ async finish(e) {
349
+ if (this.morphing && await this.morphTo(0), e === "done") {
350
+ const t = this.renderRoot.querySelector('[part="icon"]');
351
+ this.phase = "leaving", await this.updateComplete;
352
+ const o = m(this.icon);
353
+ await (t ? f(t, o.leave, "--duration-slow", "kt-button-leave", {
354
+ easing: "linear",
355
+ scale: o.leaveScale ?? 1
356
+ }) : null)?.finished.catch(() => {
357
+ });
358
+ }
359
+ this.widthBefore = this.getBoundingClientRect().width, this.morphing = !1, this.phase = e, this.restTimer = setTimeout(() => {
360
+ this.widthBefore = this.getBoundingClientRect().width, this.phase = "idle";
361
+ }, B.DONE_MS);
362
+ }
363
+ disconnectedCallback() {
364
+ super.disconnectedCallback(), clearTimeout(this.restTimer), cancelAnimationFrame(this.shape.frame), this.shape.frame = 0, this.shape.settled?.(), this.running || (this.phase = "idle");
365
+ }
366
+ /** Moves the morph towards the ring (1) or the icon (0); resolves on arrival at the icon. */
367
+ morphTo(e) {
368
+ const t = this.shape;
369
+ t.target = e, t.span = $(this, "--duration-slow");
370
+ const o = new Promise((r) => {
371
+ e === 0 && t.m === 0 && !t.frame ? r() : e === 0 ? t.settled = r : r();
372
+ });
373
+ return t.frame || (t.last = 0, t.frame = requestAnimationFrame(this.step)), o;
374
+ }
375
+ /** Draws the morph where it stands: the outline, its opening, the fold. */
376
+ drawShape() {
377
+ const e = this.renderRoot.querySelector("svg.morph");
378
+ if (!e) return;
379
+ const t = V(this.shape.m), o = e.querySelector(".outline");
380
+ o.setAttribute("d", j(K(G, Z, t)));
381
+ const r = H * t;
382
+ o.setAttribute("stroke-dasharray", `${1 - r} ${r}`), o.setAttribute("stroke-dashoffset", String(this.shape.offset)), e.querySelector(".fold").style.opacity = String(Math.max(0, 1 - t * 2.5));
383
+ }
384
+ // `phase` is private, so the map is read untyped.
385
+ updated(e) {
386
+ super.updated(e);
387
+ const t = e.get("phase");
388
+ if (t === void 0 || !e.has("phase")) return;
389
+ this.phase === "busy" && this.morphing && (this.drawShape(), this.morphTo(1));
390
+ const o = this.renderRoot.querySelector('[part="icon"]'), r = this.renderRoot.querySelector("button");
391
+ (this.phase === "done" || this.phase === "failed") && (o && f(o, M, "--duration-normal", "kt-button-arrive"), this.phase === "failed" && f(r, O, "--duration-slow", "kt-button-shake")), this.phase === "idle" && (t === "done" || t === "failed") && o && f(o, m(this.icon).back, "--duration-normal", "kt-button-back");
392
+ const i = this.widthBefore;
393
+ this.widthBefore = 0, i && this.followWidth(i, o);
394
+ }
395
+ /**
396
+ * A label that changed length: the width follows instead of jumping. A new
397
+ * icon draws in its own update, after this one, so it is waited for — the
398
+ * button measured before it would be an icon short, and shrink to that
399
+ * before snapping back. The wait ends before the frame is painted.
400
+ */
401
+ async followWidth(e, t) {
402
+ t instanceof y && await t.updateComplete;
403
+ const o = this.getBoundingClientRect().width;
404
+ Math.abs(o - e) <= 0.5 || f(
405
+ this,
406
+ [
407
+ // Clipped while it moves: a label wider than the button so far is
408
+ // cut at its edge, not spilled past it.
409
+ { width: `${e}px`, overflow: "clip" },
410
+ { width: `${o}px`, overflow: "clip" }
411
+ ],
412
+ "--duration-normal",
413
+ "kt-button-resize"
414
+ );
415
+ }
188
416
  /** Moves focus to the button. */
189
- focus(t) {
190
- this.shadowRoot?.querySelector("button")?.focus(t);
417
+ focus(e) {
418
+ this.shadowRoot?.querySelector("button")?.focus(e);
191
419
  }
192
420
  blur() {
193
421
  this.shadowRoot?.querySelector("button")?.blur();
@@ -202,78 +430,126 @@ class r extends u {
202
430
  * `name`/`value` into the submission the way an author expects.
203
431
  */
204
432
  submitEnclosingForm() {
205
- const t = this.closest("form");
206
- if (!t) return;
207
- const o = document.createElement("button");
208
- o.type = this.type, o.hidden = !0, this.name && (o.name = this.name), this.value && (o.value = this.value), t.append(o), o.click(), o.remove();
433
+ const e = this.closest("form");
434
+ if (!e) return;
435
+ const t = document.createElement("button");
436
+ t.type = this.type, t.hidden = !0, this.name && (t.name = this.name), this.value && (t.value = this.value), e.append(t), t.click(), t.remove();
209
437
  }
210
- onClick(t) {
211
- if (this.disabled) {
212
- t.preventDefault(), t.stopPropagation();
438
+ onClick(e) {
439
+ if (this.disabled || this.phase !== "idle") {
440
+ e.preventDefault(), e.stopPropagation();
213
441
  return;
214
442
  }
215
443
  this.type !== "button" && this.submitEnclosingForm();
216
444
  }
445
+ /** The icon for where `run()` is, and how it moves while busy. */
446
+ get shownIcon() {
447
+ const e = m(this.icon);
448
+ switch (this.phase) {
449
+ case "busy":
450
+ return this.icon && e.morphs ? { name: this.icon, motion: "" } : { name: "loader-circle", motion: "spin" };
451
+ case "done":
452
+ return { name: "check", motion: "" };
453
+ case "failed":
454
+ return { name: "circle-alert", motion: "" };
455
+ default:
456
+ return this.icon ? { name: this.icon, motion: "" } : null;
457
+ }
458
+ }
217
459
  render() {
218
- const t = !!this.icon && !this.hasLabelText, o = this.icon ? d`<kt-icon part="icon" name=${this.icon} size=${b[this.size]}></kt-icon>` : i;
219
- return d`<button
220
- part="button"
221
- class=${p({
460
+ const e = !!this.icon && !this.hasLabelText, t = this.shownIcon, o = this.phase === "busy" || this.phase === "leaving", r = o && this.morphing ? g`<svg
461
+ part="icon"
462
+ class="morph"
463
+ viewBox="0 0 24 24"
464
+ width=${w[this.size]}
465
+ height=${w[this.size]}
466
+ fill="none"
467
+ stroke="currentColor"
468
+ stroke-width="2"
469
+ stroke-linecap="round"
470
+ stroke-linejoin="round"
471
+ aria-hidden="true"
472
+ >
473
+ <path class="outline" pathLength="1"></path>
474
+ <path class="fold" d=${_}></path>
475
+ </svg>` : t ? g`<kt-icon
476
+ part="icon"
477
+ class=${t.motion || c}
478
+ name=${t.name}
479
+ size=${w[this.size]}
480
+ ></kt-icon>` : c, i = this.phase === "done" ? this.doneLabel : this.phase === "failed" ? this.failedLabel : "";
481
+ return g`<button
482
+ part="button"
483
+ class=${N({
222
484
  [this.variant]: !0,
223
485
  [this.size]: !0,
224
- "icon-only": t
486
+ "icon-only": e
225
487
  })}
226
- type=${this.type}
227
- ?disabled=${this.disabled}
228
- aria-label=${this.label || i}
229
- aria-haspopup=${this.popup ?? i}
230
- aria-expanded=${this.expanded === void 0 ? i : String(this.expanded)}
231
- @click=${this.onClick}
232
- >
233
- ${this.iconPosition === "left" ? o : i}
234
- <slot></slot>
235
- ${this.iconPosition === "right" ? o : i}
236
- </button>`;
488
+ type=${this.type}
489
+ ?disabled=${this.disabled}
490
+ aria-label=${this.label || c}
491
+ aria-haspopup=${this.popup ?? c}
492
+ aria-expanded=${this.expanded === void 0 ? c : String(this.expanded)}
493
+ aria-busy=${o ? "true" : c}
494
+ aria-disabled=${this.phase === "idle" ? c : "true"}
495
+ @click=${this.onClick}
496
+ >
497
+ ${this.iconPosition === "left" ? r : c}
498
+ ${i && !e ? g`<span>${i}</span>` : c}
499
+ <slot ?hidden=${!!i && !e}></slot>
500
+ ${this.iconPosition === "right" ? r : c}
501
+ </button>
502
+ <span class="visually-hidden" role="status">${i}</span>`;
237
503
  }
238
- }
239
- a([
240
- e({ type: String, reflect: !0 })
241
- ], r.prototype, "variant");
242
- a([
243
- e({ type: String, reflect: !0 })
244
- ], r.prototype, "size");
245
- a([
246
- e({ type: Boolean, reflect: !0 })
247
- ], r.prototype, "disabled");
248
- a([
249
- e({ type: String })
250
- ], r.prototype, "type");
251
- a([
252
- e({ type: String })
253
- ], r.prototype, "icon");
254
- a([
255
- e({ type: String, attribute: "icon-position" })
256
- ], r.prototype, "iconPosition");
257
- a([
258
- e({ type: String })
259
- ], r.prototype, "label");
260
- a([
261
- e({ attribute: !1 })
262
- ], r.prototype, "popup");
263
- a([
264
- e({ attribute: !1 })
265
- ], r.prototype, "expanded");
266
- a([
267
- e({ type: Boolean, reflect: !0, attribute: "full-width" })
268
- ], r.prototype, "fullWidth");
269
- a([
270
- e({ type: String })
271
- ], r.prototype, "name");
272
- a([
273
- e({ type: String })
274
- ], r.prototype, "value");
275
- v("kt-button", r);
504
+ };
505
+ s([
506
+ l({ type: String, reflect: !0 })
507
+ ], n.prototype, "variant");
508
+ s([
509
+ l({ type: String, reflect: !0 })
510
+ ], n.prototype, "size");
511
+ s([
512
+ l({ type: Boolean, reflect: !0 })
513
+ ], n.prototype, "disabled");
514
+ s([
515
+ l({ type: String })
516
+ ], n.prototype, "type");
517
+ s([
518
+ l({ type: String })
519
+ ], n.prototype, "icon");
520
+ s([
521
+ l({ type: String, attribute: "icon-position" })
522
+ ], n.prototype, "iconPosition");
523
+ s([
524
+ l({ type: String })
525
+ ], n.prototype, "label");
526
+ s([
527
+ l({ attribute: !1 })
528
+ ], n.prototype, "popup");
529
+ s([
530
+ l({ attribute: !1 })
531
+ ], n.prototype, "expanded");
532
+ s([
533
+ l({ type: Boolean, reflect: !0, attribute: "full-width" })
534
+ ], n.prototype, "fullWidth");
535
+ s([
536
+ l({ type: String })
537
+ ], n.prototype, "name");
538
+ s([
539
+ l({ type: String })
540
+ ], n.prototype, "value");
541
+ s([
542
+ l({ type: String, attribute: "done-label" })
543
+ ], n.prototype, "doneLabel");
544
+ s([
545
+ l({ type: String, attribute: "failed-label" })
546
+ ], n.prototype, "failedLabel");
547
+ s([
548
+ T()
549
+ ], n.prototype, "phase");
550
+ let Y = n;
551
+ I("kt-button", Y);
276
552
  export {
277
- r as KtButton
553
+ Y as KtButton
278
554
  };
279
555
  //# sourceMappingURL=kt-button.js.map