@f-ewald/components 1.39.0 → 1.40.1

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 (192) hide show
  1. package/README.md +48 -0
  2. package/custom-elements.json +1179 -100
  3. package/dist/address-autocomplete.js +2 -2
  4. package/dist/address-autocomplete.js.map +1 -1
  5. package/dist/app-shell.js +4 -4
  6. package/dist/app-shell.js.map +1 -1
  7. package/dist/app-sidebar.js +2 -2
  8. package/dist/app-sidebar.js.map +1 -1
  9. package/dist/audio-player.js +1 -1
  10. package/dist/audio-player.js.map +1 -1
  11. package/dist/autocomplete-input.js +2 -2
  12. package/dist/autocomplete-input.js.map +1 -1
  13. package/dist/breadcrumb-nav.d.ts +87 -0
  14. package/dist/breadcrumb-nav.d.ts.map +1 -0
  15. package/dist/breadcrumb-nav.js +281 -0
  16. package/dist/breadcrumb-nav.js.map +1 -0
  17. package/dist/button-group.js +2 -2
  18. package/dist/button-group.js.map +1 -1
  19. package/dist/calendar-day.js +3 -3
  20. package/dist/calendar-day.js.map +1 -1
  21. package/dist/calendar-month.d.ts.map +1 -1
  22. package/dist/calendar-month.js +4 -1
  23. package/dist/calendar-month.js.map +1 -1
  24. package/dist/calendar-week.js +4 -4
  25. package/dist/calendar-week.js.map +1 -1
  26. package/dist/chat-message.js +1 -1
  27. package/dist/chat-message.js.map +1 -1
  28. package/dist/comment-composer.js +1 -1
  29. package/dist/comment-composer.js.map +1 -1
  30. package/dist/confirm-dialog.d.ts.map +1 -1
  31. package/dist/confirm-dialog.js +5 -2
  32. package/dist/confirm-dialog.js.map +1 -1
  33. package/dist/content-divider.js +1 -1
  34. package/dist/content-divider.js.map +1 -1
  35. package/dist/cron-schedule.d.ts.map +1 -1
  36. package/dist/cron-schedule.js +6 -5
  37. package/dist/cron-schedule.js.map +1 -1
  38. package/dist/data-table.d.ts.map +1 -1
  39. package/dist/data-table.js +3 -2
  40. package/dist/data-table.js.map +1 -1
  41. package/dist/dropdown-button.d.ts.map +1 -1
  42. package/dist/dropdown-button.js +4 -2
  43. package/dist/dropdown-button.js.map +1 -1
  44. package/dist/editable-text.js +1 -1
  45. package/dist/editable-text.js.map +1 -1
  46. package/dist/empty-state.d.ts +58 -0
  47. package/dist/empty-state.d.ts.map +1 -0
  48. package/dist/empty-state.js +203 -0
  49. package/dist/empty-state.js.map +1 -0
  50. package/dist/form-field.js +1 -1
  51. package/dist/form-field.js.map +1 -1
  52. package/dist/form-select.js +3 -3
  53. package/dist/form-select.js.map +1 -1
  54. package/dist/frame-box.js +1 -1
  55. package/dist/frame-box.js.map +1 -1
  56. package/dist/fullscreen-button.js +1 -1
  57. package/dist/fullscreen-button.js.map +1 -1
  58. package/dist/icons.d.ts +2 -0
  59. package/dist/icons.d.ts.map +1 -1
  60. package/dist/icons.js +2 -0
  61. package/dist/icons.js.map +1 -1
  62. package/dist/index.d.ts +6 -1
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +6 -1
  65. package/dist/index.js.map +1 -1
  66. package/dist/kanban-card.js +1 -1
  67. package/dist/kanban-card.js.map +1 -1
  68. package/dist/kanban-column.js +3 -3
  69. package/dist/kanban-column.js.map +1 -1
  70. package/dist/kbd-hint.d.ts.map +1 -1
  71. package/dist/kbd-hint.js +2 -1
  72. package/dist/kbd-hint.js.map +1 -1
  73. package/dist/link-card.js +1 -1
  74. package/dist/link-card.js.map +1 -1
  75. package/dist/markdown-view.js +3 -3
  76. package/dist/markdown-view.js.map +1 -1
  77. package/dist/modal-dialog.js +1 -1
  78. package/dist/modal-dialog.js.map +1 -1
  79. package/dist/multi-select.js +5 -5
  80. package/dist/multi-select.js.map +1 -1
  81. package/dist/pagination-nav.d.ts.map +1 -1
  82. package/dist/pagination-nav.js +5 -1
  83. package/dist/pagination-nav.js.map +1 -1
  84. package/dist/photo-gallery.js +1 -1
  85. package/dist/photo-gallery.js.map +1 -1
  86. package/dist/popover-panel.d.ts.map +1 -1
  87. package/dist/popover-panel.js +4 -2
  88. package/dist/popover-panel.js.map +1 -1
  89. package/dist/progress-bar.d.ts.map +1 -1
  90. package/dist/progress-bar.js +1 -0
  91. package/dist/progress-bar.js.map +1 -1
  92. package/dist/radio-cards.js +1 -1
  93. package/dist/radio-cards.js.map +1 -1
  94. package/dist/radio-pills.js +1 -1
  95. package/dist/radio-pills.js.map +1 -1
  96. package/dist/reveal-button.js +1 -1
  97. package/dist/reveal-button.js.map +1 -1
  98. package/dist/scroll-to-bottom.js +1 -1
  99. package/dist/scroll-to-bottom.js.map +1 -1
  100. package/dist/scroll-to-top.js +1 -1
  101. package/dist/scroll-to-top.js.map +1 -1
  102. package/dist/skip-link.d.ts +38 -0
  103. package/dist/skip-link.d.ts.map +1 -0
  104. package/dist/skip-link.js +184 -0
  105. package/dist/skip-link.js.map +1 -0
  106. package/dist/slide-panel.js +1 -1
  107. package/dist/slide-panel.js.map +1 -1
  108. package/dist/spec-list.d.ts +58 -0
  109. package/dist/spec-list.d.ts.map +1 -0
  110. package/dist/spec-list.js +226 -0
  111. package/dist/spec-list.js.map +1 -0
  112. package/dist/stat-meter.d.ts.map +1 -1
  113. package/dist/stat-meter.js +1 -0
  114. package/dist/stat-meter.js.map +1 -1
  115. package/dist/tab-bar.js +1 -1
  116. package/dist/tab-bar.js.map +1 -1
  117. package/dist/text-area.js +1 -1
  118. package/dist/text-area.js.map +1 -1
  119. package/dist/tile-grid.js +1 -1
  120. package/dist/tile-grid.js.map +1 -1
  121. package/dist/tokens.css +42 -1
  122. package/dist/tokens.d.ts +50 -0
  123. package/dist/tokens.d.ts.map +1 -1
  124. package/dist/tokens.js +136 -0
  125. package/dist/tokens.js.map +1 -1
  126. package/dist/tree-view.js +2 -2
  127. package/dist/tree-view.js.map +1 -1
  128. package/dist/ui-admonition.js +1 -1
  129. package/dist/ui-admonition.js.map +1 -1
  130. package/dist/ui-button.js +1 -1
  131. package/dist/ui-button.js.map +1 -1
  132. package/dist/video-player.js +1 -1
  133. package/dist/video-player.js.map +1 -1
  134. package/dist/vote-control.d.ts +40 -0
  135. package/dist/vote-control.d.ts.map +1 -0
  136. package/dist/vote-control.js +318 -0
  137. package/dist/vote-control.js.map +1 -0
  138. package/docs/address-autocomplete.md +1 -0
  139. package/docs/app-shell.md +1 -0
  140. package/docs/app-sidebar.md +1 -0
  141. package/docs/audio-player.md +1 -0
  142. package/docs/autocomplete-input.md +1 -0
  143. package/docs/breadcrumb-nav.md +70 -0
  144. package/docs/button-group.md +1 -0
  145. package/docs/calendar-day.md +1 -0
  146. package/docs/calendar-month.md +1 -0
  147. package/docs/calendar-week.md +1 -0
  148. package/docs/chat-message.md +1 -0
  149. package/docs/comment-composer.md +1 -0
  150. package/docs/confirm-dialog.md +1 -0
  151. package/docs/content-divider.md +1 -0
  152. package/docs/cron-schedule.md +2 -0
  153. package/docs/data-table.md +2 -0
  154. package/docs/design-language.md +57 -5
  155. package/docs/dropdown-button.md +1 -0
  156. package/docs/editable-text.md +1 -0
  157. package/docs/empty-state.md +60 -0
  158. package/docs/form-field.md +1 -0
  159. package/docs/form-select.md +1 -0
  160. package/docs/frame-box.md +1 -0
  161. package/docs/fullscreen-button.md +1 -0
  162. package/docs/icons.md +1 -0
  163. package/docs/kanban-card.md +1 -0
  164. package/docs/kanban-column.md +1 -0
  165. package/docs/kbd-hint.md +1 -0
  166. package/docs/link-card.md +1 -0
  167. package/docs/markdown-view.md +1 -0
  168. package/docs/modal-dialog.md +1 -0
  169. package/docs/multi-select.md +1 -0
  170. package/docs/pagination-nav.md +2 -0
  171. package/docs/photo-gallery.md +1 -0
  172. package/docs/popover-panel.md +1 -0
  173. package/docs/progress-bar.md +1 -0
  174. package/docs/radio-cards.md +1 -0
  175. package/docs/radio-pills.md +1 -0
  176. package/docs/reveal-button.md +1 -0
  177. package/docs/scroll-to-bottom.md +1 -0
  178. package/docs/scroll-to-top.md +1 -0
  179. package/docs/skip-link.md +61 -0
  180. package/docs/slide-panel.md +1 -0
  181. package/docs/spec-list.md +79 -0
  182. package/docs/stat-meter.md +1 -0
  183. package/docs/tab-bar.md +1 -0
  184. package/docs/text-area.md +1 -0
  185. package/docs/tile-grid.md +1 -0
  186. package/docs/tree-view.md +1 -0
  187. package/docs/ui-admonition.md +1 -0
  188. package/docs/ui-button.md +1 -0
  189. package/docs/video-player.md +1 -0
  190. package/docs/vote-control.md +73 -0
  191. package/llms.txt +212 -49
  192. package/package.json +1 -1
@@ -93,8 +93,10 @@ let DropdownButton = class DropdownButton extends LitElement {
93
93
  font-size: var(--ui-font-size-sm, 0.75rem);
94
94
  font-weight: var(--ui-font-weight-medium, 500);
95
95
  line-height: var(--ui-line-height-tight, 1.25);
96
- border: 1px solid transparent;
96
+ border: var(--ui-border-width, 1px) solid transparent;
97
97
  border-radius: var(--ui-radius-sm, 0.25rem);
98
+ /* The border is themeable, so it has to stay inside the 2rem target. */
99
+ box-sizing: border-box;
98
100
  cursor: pointer;
99
101
  }
100
102
  button.trigger:disabled {
@@ -178,7 +180,7 @@ let DropdownButton = class DropdownButton extends LitElement {
178
180
  list-style: none;
179
181
  white-space: nowrap;
180
182
  background: var(--ui-surface, #ffffff);
181
- border: 1px solid var(--ui-border, #e2e8f0);
183
+ border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
182
184
  border-radius: var(--ui-radius-sm, 0.25rem);
183
185
  box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));
184
186
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-button.js","sourceRoot":"","sources":["../src/dropdown-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE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AE;6CAAuB;AACd;IAAhB,KAAK,EAAE;oDAA2B;AApMxB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAiU1B","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues, type TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/** A single menu action. */\nexport interface DropdownOption {\n value: string;\n label: string;\n /** Optional leading icon rendered ahead of the label in the menu item. */\n icon?: TemplateResult | null;\n /** Renders the item in the danger color, for a destructive action (e.g. Delete). */\n danger?: boolean;\n}\n\n/** How the trigger presents itself: label only, icon only, or icon + label. */\nexport type DropdownButtonVariant = \"text\" | \"icon\" | \"text-icon\";\n\n/**\n * A button that opens an anchored menu of actions — essentially `form-select`\n * minus \"current value\" semantics: a menu, not a select. Use for a set of\n * mutually exclusive next-step actions (e.g. a failed task's Retry / Close /\n * Backlog, or a table row's overflow actions).\n *\n * Three trigger presentations share one base: `text` (the default — a\n * primary-filled button with a label and a rotating chevron), `text-icon`\n * (the same, with `icon` ahead of the label), and `icon` (a borderless,\n * square, low-emphasis icon target in the style of `icon-button` — the\n * classic \"three-dot\"/overflow menu, where `label` becomes the accessible\n * name rather than visible text). Set `size=\"sm\"` for a compact trigger one\n * step below the default, matching `ui-button`'s `sm` size. Set `circular`\n * on the `icon` variant when the trigger wraps an inherently circular\n * element (e.g. an avatar) so the hover/focus highlight matches its shape\n * instead of the default rounded-square icon-button footprint.\n *\n * @element dropdown-button\n * @fires select - Fired with `{ value: string }` when a menu item is picked.\n */\n@customElement(\"dropdown-button\")\nexport class DropdownButton extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n position: relative;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n /* Shared trigger base — layout, type, shape, and interaction states every\n variant has in common. Variant blocks below only add fill/padding. */\n button.trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n height: 2rem;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n border: 1px solid transparent;\n border-radius: var(--ui-radius-sm, 0.25rem);\n cursor: pointer;\n }\n button.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button.trigger:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n /* text + text-icon: the primary-filled trigger. Written as :not([variant=\"icon\"])\n rather than two positive selectors so the default presentation is correct\n even before the reflected attribute lands. */\n :host(:not([variant=\"icon\"])) button.trigger {\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border-color: var(--ui-button-border, transparent);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n padding: 0.5rem 1rem;\n }\n :host(:not([variant=\"icon\"])) button.trigger:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n :host(:not([variant=\"icon\"])) button.trigger:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n :host(:not([variant=\"icon\"])) button.trigger:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n /* icon: borderless low-emphasis square target, matching icon-button. */\n :host([variant=\"icon\"]) button.trigger {\n width: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n background: none;\n }\n :host([variant=\"icon\"]) button.trigger:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-text, #0f172a);\n }\n /* circular: for an icon-variant trigger wrapping a round element (e.g.\n an avatar) — overrides the default rounded-square footprint so the\n hover/focus highlight matches the wrapped element's own shape. */\n :host([variant=\"icon\"][circular]) button.trigger {\n border-radius: var(--ui-radius-circle, 50%);\n }\n :host([size=\"sm\"]) button.trigger {\n height: 1.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n :host(:not([variant=\"icon\"])[size=\"sm\"]) button.trigger {\n padding: 0.25rem 0.5rem;\n }\n :host([variant=\"icon\"][size=\"sm\"]) button.trigger {\n width: 1.5rem;\n }\n .icon {\n display: flex;\n line-height: 0;\n }\n .chevron {\n display: flex;\n transform: rotate(90deg);\n transition: transform 150ms ease;\n }\n :host([open]) .chevron {\n transform: rotate(-90deg);\n }\n ul.options {\n position: absolute;\n top: 100%;\n right: 0;\n z-index: 10;\n min-width: 100%;\n max-height: 40vh;\n overflow-y: auto;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n white-space: nowrap;\n background: var(--ui-surface, #ffffff);\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n li {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n color: var(--ui-text, #0f172a);\n }\n li .icon {\n color: var(--ui-text-muted, #64748b);\n }\n li.danger .icon {\n color: var(--ui-danger, #dc2626);\n }\n li.danger {\n color: var(--ui-danger, #dc2626);\n }\n li.active,\n li:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n li.danger.active,\n li.danger:hover {\n color: var(--ui-danger-hover, #b91c1c);\n }\n @media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n button.trigger:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button.trigger:disabled {\n color: GrayText;\n opacity: 1;\n }\n li.active,\n li:hover,\n li.danger.active,\n li.danger:hover {\n color: HighlightText;\n background: Highlight;\n }\n }\n `,\n ];\n\n /** The trigger button's label. In the `icon` variant it is the accessible name instead of visible text. */\n @property() label = \"\";\n /** The menu's actions. */\n @property({ attribute: false }) options: DropdownOption[] = [];\n /** Disables the trigger, preventing the menu from opening. */\n @property({ type: Boolean }) disabled = false;\n /** Trigger presentation: label only, icon only, or icon + label. */\n @property({ reflect: true }) variant: DropdownButtonVariant = \"text\";\n /** Icon template rendered by the `icon` and `text-icon` variants. */\n @property({ attribute: false }) icon: TemplateResult | null = null;\n /** Size — `sm` reduces the trigger's height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n /** `icon` variant only: renders the trigger's highlight as a circle instead of a rounded square, to match a wrapped circular element (e.g. an avatar). */\n @property({ type: Boolean, reflect: true }) circular = false;\n\n @state() private _open = false;\n @state() private _activeIndex = -1;\n readonly #menuId = `dropdown-button-menu-${++instanceCount}`;\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n this._open = false;\n this._activeIndex = -1;\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"disabled\") && this.disabled) {\n this._open = false;\n this._activeIndex = -1;\n }\n if (!changed.has(\"_open\")) return;\n this.toggleAttribute(\"open\", this._open);\n if (this._open) {\n window.addEventListener(\"mousedown\", this.#onWindowMousedown, true);\n } else {\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n }\n }\n\n #onWindowMousedown = (e: MouseEvent): void => {\n if (!e.composedPath().includes(this)) this._open = false;\n };\n\n #toggle(): void {\n if (this.disabled) return;\n this._open = !this._open;\n if (this._open) this._activeIndex = 0;\n }\n\n #select(option: DropdownOption): void {\n if (this.disabled) return;\n this._open = false;\n this.dispatchEvent(new CustomEvent(\"select\", { detail: { value: option.value } }));\n }\n\n #onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!this._open) {\n this.#toggle();\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1);\n else this.#confirmActive();\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this._open = false;\n }\n }\n\n #moveActive(delta: number): void {\n if (this.options.length === 0) return;\n const n = this.options.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #confirmActive(): void {\n const option = this.options[this._activeIndex];\n if (option) this.#select(option);\n }\n\n private renderMenu() {\n if (!this._open) return nothing;\n return html`\n <ul id=${this.#menuId} class=\"options\" role=\"menu\" aria-label=${this.label}>\n ${this.options.map(\n (o, i) => html`\n <li\n id=${`${this.#menuId}-item-${i}`}\n role=\"menuitem\"\n class=${[i === this._activeIndex ? \"active\" : \"\", o.danger ? \"danger\" : \"\"]\n .filter(Boolean)\n .join(\" \")}\n @mousedown=${(e: MouseEvent) => {\n if (e.button !== 0) return;\n e.preventDefault();\n this.#select(o);\n }}\n >\n ${o.icon ? html`<span class=\"icon\" aria-hidden=\"true\">${o.icon}</span>` : nothing}\n ${o.label}\n </li>\n `,\n )}\n </ul>\n `;\n }\n\n override render() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#menuId}-item-${this._activeIndex}`\n : nothing;\n const iconOnly = this.variant === \"icon\";\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n aria-haspopup=\"menu\"\n aria-expanded=${this._open}\n aria-controls=${this.#menuId}\n aria-activedescendant=${activeDescendant}\n aria-label=${iconOnly && this.label ? this.label : nothing}\n title=${iconOnly && this.label ? this.label : nothing}\n ?disabled=${this.disabled}\n @click=${() => this.#toggle()}\n @keydown=${(e: KeyboardEvent) => this.#onTriggerKeydown(e)}\n >\n ${this.variant !== \"text\" && this.icon\n ? html`<span class=\"icon\" aria-hidden=\"true\">${this.icon}</span>`\n : nothing}\n ${iconOnly ? nothing : html`<span>${this.label}</span>`}\n ${iconOnly\n ? nothing\n : html`<span class=\"chevron\" aria-hidden=\"true\">${iconChevronRight(14)}</span>`}\n </button>\n ${this.renderMenu()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dropdown-button\": DropdownButton;\n }\n}\n"]}
1
+ {"version":3,"file":"dropdown-button.js","sourceRoot":"","sources":["../src/dropdown-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,IAAI,aAAa,GAAG,CAAC,CAAC;AAetB;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QAsLL,2GAA2G;QAC/F,UAAK,GAAG,EAAE,CAAC;QACvB,0BAA0B;QACM,YAAO,GAAqB,EAAE,CAAC;QAC/D,8DAA8D;QACjC,aAAQ,GAAG,KAAK,CAAC;QAC9C,oEAAoE;QACvC,YAAO,GAA0B,MAAM,CAAC;QACrE,qEAAqE;QACrC,SAAI,GAA0B,IAAI,CAAC;QACnE,6FAA6F;QAChE,SAAI,GAAgB,IAAI,CAAC;QACtD,0JAA0J;QAC9G,aAAQ,GAAG,KAAK,CAAC;QAE5C,UAAK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C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA,SAAS,IAAI,CAAC,KAAK,SAAS;UACrD,QAAQ;YACR,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,IAAI,CAAA,4CAA4C,gBAAgB,CAAC,EAAE,CAAC,SAAS;;QAEjF,IAAI,CAAC,UAAU,EAAE;KACpB,CAAC;IACJ,CAAC;CACF,CAAA;AA5Ia;IAAX,QAAQ,EAAE;6CAAY;AAES;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAAgC;AAElC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAyC;AAErC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAoC;AAEtC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAA0B;AAEV;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAkB;AAE5C;IAAhB,KAAK,EAAE;6CAAuB;AACd;IAAhB,KAAK,EAAE;oDAA2B;AAtMxB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAmU1B","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues, type TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/** A single menu action. */\nexport interface DropdownOption {\n value: string;\n label: string;\n /** Optional leading icon rendered ahead of the label in the menu item. */\n icon?: TemplateResult | null;\n /** Renders the item in the danger color, for a destructive action (e.g. Delete). */\n danger?: boolean;\n}\n\n/** How the trigger presents itself: label only, icon only, or icon + label. */\nexport type DropdownButtonVariant = \"text\" | \"icon\" | \"text-icon\";\n\n/**\n * A button that opens an anchored menu of actions — essentially `form-select`\n * minus \"current value\" semantics: a menu, not a select. Use for a set of\n * mutually exclusive next-step actions (e.g. a failed task's Retry / Close /\n * Backlog, or a table row's overflow actions).\n *\n * Three trigger presentations share one base: `text` (the default — a\n * primary-filled button with a label and a rotating chevron), `text-icon`\n * (the same, with `icon` ahead of the label), and `icon` (a borderless,\n * square, low-emphasis icon target in the style of `icon-button` — the\n * classic \"three-dot\"/overflow menu, where `label` becomes the accessible\n * name rather than visible text). Set `size=\"sm\"` for a compact trigger one\n * step below the default, matching `ui-button`'s `sm` size. Set `circular`\n * on the `icon` variant when the trigger wraps an inherently circular\n * element (e.g. an avatar) so the hover/focus highlight matches its shape\n * instead of the default rounded-square icon-button footprint.\n *\n * @element dropdown-button\n * @fires select - Fired with `{ value: string }` when a menu item is picked.\n */\n@customElement(\"dropdown-button\")\nexport class DropdownButton extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n position: relative;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n /* Shared trigger base — layout, type, shape, and interaction states every\n variant has in common. Variant blocks below only add fill/padding. */\n button.trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n height: 2rem;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n border: var(--ui-border-width, 1px) solid transparent;\n border-radius: var(--ui-radius-sm, 0.25rem);\n /* The border is themeable, so it has to stay inside the 2rem target. */\n box-sizing: border-box;\n cursor: pointer;\n }\n button.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button.trigger:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n /* text + text-icon: the primary-filled trigger. Written as :not([variant=\"icon\"])\n rather than two positive selectors so the default presentation is correct\n even before the reflected attribute lands. */\n :host(:not([variant=\"icon\"])) button.trigger {\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border-color: var(--ui-button-border, transparent);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n padding: 0.5rem 1rem;\n }\n :host(:not([variant=\"icon\"])) button.trigger:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n :host(:not([variant=\"icon\"])) button.trigger:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n :host(:not([variant=\"icon\"])) button.trigger:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n /* icon: borderless low-emphasis square target, matching icon-button. */\n :host([variant=\"icon\"]) button.trigger {\n width: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n background: none;\n }\n :host([variant=\"icon\"]) button.trigger:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-text, #0f172a);\n }\n /* circular: for an icon-variant trigger wrapping a round element (e.g.\n an avatar) — overrides the default rounded-square footprint so the\n hover/focus highlight matches the wrapped element's own shape. */\n :host([variant=\"icon\"][circular]) button.trigger {\n border-radius: var(--ui-radius-circle, 50%);\n }\n :host([size=\"sm\"]) button.trigger {\n height: 1.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n :host(:not([variant=\"icon\"])[size=\"sm\"]) button.trigger {\n padding: 0.25rem 0.5rem;\n }\n :host([variant=\"icon\"][size=\"sm\"]) button.trigger {\n width: 1.5rem;\n }\n .icon {\n display: flex;\n line-height: 0;\n }\n .chevron {\n display: flex;\n transform: rotate(90deg);\n transition: transform 150ms ease;\n }\n :host([open]) .chevron {\n transform: rotate(-90deg);\n }\n ul.options {\n position: absolute;\n top: 100%;\n right: 0;\n z-index: 10;\n min-width: 100%;\n max-height: 40vh;\n overflow-y: auto;\n margin: 0.25rem 0 0;\n padding: 0.25rem 0;\n list-style: none;\n white-space: nowrap;\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n li {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n color: var(--ui-text, #0f172a);\n }\n li .icon {\n color: var(--ui-text-muted, #64748b);\n }\n li.danger .icon {\n color: var(--ui-danger, #dc2626);\n }\n li.danger {\n color: var(--ui-danger, #dc2626);\n }\n li.active,\n li:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n li.danger.active,\n li.danger:hover {\n color: var(--ui-danger-hover, #b91c1c);\n }\n @media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n button.trigger:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button.trigger:disabled {\n color: GrayText;\n opacity: 1;\n }\n li.active,\n li:hover,\n li.danger.active,\n li.danger:hover {\n color: HighlightText;\n background: Highlight;\n }\n }\n `,\n ];\n\n /** The trigger button's label. In the `icon` variant it is the accessible name instead of visible text. */\n @property() label = \"\";\n /** The menu's actions. */\n @property({ attribute: false }) options: DropdownOption[] = [];\n /** Disables the trigger, preventing the menu from opening. */\n @property({ type: Boolean }) disabled = false;\n /** Trigger presentation: label only, icon only, or icon + label. */\n @property({ reflect: true }) variant: DropdownButtonVariant = \"text\";\n /** Icon template rendered by the `icon` and `text-icon` variants. */\n @property({ attribute: false }) icon: TemplateResult | null = null;\n /** Size — `sm` reduces the trigger's height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n /** `icon` variant only: renders the trigger's highlight as a circle instead of a rounded square, to match a wrapped circular element (e.g. an avatar). */\n @property({ type: Boolean, reflect: true }) circular = false;\n\n @state() private _open = false;\n @state() private _activeIndex = -1;\n readonly #menuId = `dropdown-button-menu-${++instanceCount}`;\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n this._open = false;\n this._activeIndex = -1;\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"disabled\") && this.disabled) {\n this._open = false;\n this._activeIndex = -1;\n }\n if (!changed.has(\"_open\")) return;\n this.toggleAttribute(\"open\", this._open);\n if (this._open) {\n window.addEventListener(\"mousedown\", this.#onWindowMousedown, true);\n } else {\n window.removeEventListener(\"mousedown\", this.#onWindowMousedown, true);\n }\n }\n\n #onWindowMousedown = (e: MouseEvent): void => {\n if (!e.composedPath().includes(this)) this._open = false;\n };\n\n #toggle(): void {\n if (this.disabled) return;\n this._open = !this._open;\n if (this._open) this._activeIndex = 0;\n }\n\n #select(option: DropdownOption): void {\n if (this.disabled) return;\n this._open = false;\n this.dispatchEvent(new CustomEvent(\"select\", { detail: { value: option.value } }));\n }\n\n #onTriggerKeydown(e: KeyboardEvent): void {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!this._open) {\n this.#toggle();\n return;\n }\n if (e.key === \"ArrowDown\") this.#moveActive(1);\n else if (e.key === \"ArrowUp\") this.#moveActive(-1);\n else this.#confirmActive();\n } else if (e.key === \"Escape\" && this._open) {\n e.preventDefault();\n this._open = false;\n }\n }\n\n #moveActive(delta: number): void {\n if (this.options.length === 0) return;\n const n = this.options.length;\n this._activeIndex = (this._activeIndex + delta + n) % n;\n }\n\n #confirmActive(): void {\n const option = this.options[this._activeIndex];\n if (option) this.#select(option);\n }\n\n private renderMenu() {\n if (!this._open) return nothing;\n return html`\n <ul id=${this.#menuId} class=\"options\" role=\"menu\" aria-label=${this.label}>\n ${this.options.map(\n (o, i) => html`\n <li\n id=${`${this.#menuId}-item-${i}`}\n role=\"menuitem\"\n class=${[i === this._activeIndex ? \"active\" : \"\", o.danger ? \"danger\" : \"\"]\n .filter(Boolean)\n .join(\" \")}\n @mousedown=${(e: MouseEvent) => {\n if (e.button !== 0) return;\n e.preventDefault();\n this.#select(o);\n }}\n >\n ${o.icon ? html`<span class=\"icon\" aria-hidden=\"true\">${o.icon}</span>` : nothing}\n ${o.label}\n </li>\n `,\n )}\n </ul>\n `;\n }\n\n override render() {\n const activeDescendant =\n this._open && this._activeIndex >= 0\n ? `${this.#menuId}-item-${this._activeIndex}`\n : nothing;\n const iconOnly = this.variant === \"icon\";\n return html`\n <button\n type=\"button\"\n class=\"trigger\"\n aria-haspopup=\"menu\"\n aria-expanded=${this._open}\n aria-controls=${this.#menuId}\n aria-activedescendant=${activeDescendant}\n aria-label=${iconOnly && this.label ? this.label : nothing}\n title=${iconOnly && this.label ? this.label : nothing}\n ?disabled=${this.disabled}\n @click=${() => this.#toggle()}\n @keydown=${(e: KeyboardEvent) => this.#onTriggerKeydown(e)}\n >\n ${this.variant !== \"text\" && this.icon\n ? html`<span class=\"icon\" aria-hidden=\"true\">${this.icon}</span>`\n : nothing}\n ${iconOnly ? nothing : html`<span>${this.label}</span>`}\n ${iconOnly\n ? nothing\n : html`<span class=\"chevron\" aria-hidden=\"true\">${iconChevronRight(14)}</span>`}\n </button>\n ${this.renderMenu()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dropdown-button\": DropdownButton;\n }\n}\n"]}
@@ -88,7 +88,7 @@ let EditableText = class EditableText extends LitElement {
88
88
  font: inherit;
89
89
  color: inherit;
90
90
  background: var(--ui-surface, #ffffff);
91
- border: 1px solid var(--ui-border, #e2e8f0);
91
+ border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
92
92
  border-radius: var(--ui-radius-sm, 0.25rem);
93
93
  padding: 0.25rem;
94
94
  margin: -0.25rem;
@@ -1 +1 @@
1
- {"version":3,"file":"editable-text.js","sourceRoot":"","sources":["../src/editable-text.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;GAQG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QAwFL,oBAAoB;QACR,UAAK,GAAG,EAAE,CAAC;QACvB,yEAAyE;QAC5C,cAAS,GAAG,KAAK,CAAC;QAC/C,0FAA0F;QAC9E,gBAAW,GAAG,EAAE,CAAC;QAC7B,mCAAmC;QACN,aAAQ,GAAG,KAAK,CAAC;QAC9C,kDAAkD;QACtC,UAAK,GAAG,EAAE,CAAC;QAEN,aAAQ,GAAG,KAAK,CAAC;QACjB,WAAM,GAAG,EAAE,CAAC;IA8G/B,CAAC;aAjNiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkFF;KACF,AArFqB,CAqFpB;IAkBF,kEAAkE;IAC1D,UAAU;QAChB,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,M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CAkNxB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Jira/GitHub-style click-to-edit text: a display span that turns into an\n * `<input>` (or auto-growing `<textarea>` when `multiline`) on click. The\n * input/textarea inherits the host's font, so a title wrapped in an `<h1>`\n * edits at title size.\n *\n * @element editable-text\n * @fires change - Fired with `{ value: string }` when the committed value differs from the previous one.\n */\n@customElement(\"editable-text\")\nexport class EditableText extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n line-height: inherit;\n }\n .display {\n display: block;\n width: 100%;\n box-sizing: border-box;\n border: 0;\n color: inherit;\n background: transparent;\n font: inherit;\n line-height: inherit;\n text-align: inherit;\n cursor: text;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem;\n margin: -0.25rem;\n }\n .display.multiline {\n /* Inactive multiline text is flush; the active textarea keeps its editor inset. */\n white-space: pre-wrap;\n padding: 0;\n margin: 0;\n }\n .display:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .display.empty {\n color: var(--ui-text-muted, #64748b);\n }\n .display:disabled {\n cursor: inherit;\n opacity: 0.6;\n }\n .display:disabled:hover {\n background: none;\n }\n .display:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n input,\n textarea {\n display: block;\n width: 100%;\n box-sizing: border-box;\n font: inherit;\n color: inherit;\n background: var(--ui-surface, #ffffff);\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem;\n margin: -0.25rem;\n outline: none;\n }\n input:focus-visible,\n textarea:focus-visible {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n textarea {\n resize: none;\n overflow: hidden;\n }\n @media (forced-colors: active) {\n .display:focus-visible,\n input:focus-visible,\n textarea:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .display:disabled {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Current text. */\n @property() value = \"\";\n /** `false` renders an `<input>`, `true` an auto-growing `<textarea>`. */\n @property({ type: Boolean }) multiline = false;\n /** Muted placeholder text shown when `value` is empty, and as the input's placeholder. */\n @property() placeholder = \"\";\n /** Disables entering edit mode. */\n @property({ type: Boolean }) readonly = false;\n /** `aria-label` applied to the input/textarea. */\n @property() label = \"\";\n\n @state() private _editing = false;\n @state() private _draft = \"\";\n\n @query(\"input, textarea\") private _field?: HTMLInputElement | HTMLTextAreaElement;\n\n /** Enters edit mode, seeding the draft from the current value. */\n private _startEdit() {\n if (this.readonly) return;\n this._draft = this.value;\n this._editing = true;\n }\n\n /** Commits the draft (reverting an empty single-line commit) and exits edit mode.\n *\n * Guarded on `_editing`: removing the focused input/textarea from the DOM\n * (which happens as soon as `_editing` flips to false) makes the browser\n * fire a native `blur` on it, re-invoking this handler a second time after\n * a cancel already ran — the guard makes that second call a no-op instead\n * of re-committing the stale draft.\n */\n private _commit() {\n if (!this._editing) return;\n const next = this._draft;\n this._editing = false;\n if (!this.multiline && next.trim() === \"\") return;\n if (next === this.value) return;\n this.value = next;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value: next } }));\n }\n\n /** Discards the draft and exits edit mode without committing. */\n private _cancel() {\n this._editing = false;\n }\n\n private _onInput(e: Event) {\n this._draft = (e.target as HTMLInputElement | HTMLTextAreaElement).value;\n if (this.multiline) this._resize();\n }\n\n private _onSingleLineKeydown(e: KeyboardEvent) {\n if (e.key === \"Enter\") {\n e.preventDefault();\n this._commit();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n this._cancel();\n }\n }\n\n private _onMultilineKeydown(e: KeyboardEvent) {\n if (e.key === \"Escape\") {\n e.preventDefault();\n this._cancel();\n } else if (e.key === \"Enter\" && (e.metaKey || e.ctrlKey)) {\n e.preventDefault();\n this._commit();\n }\n }\n\n /** Grows the textarea's height to fit its content. */\n private _resize() {\n const field = this._field;\n if (!field) return;\n field.style.height = \"auto\";\n field.style.height = `${field.scrollHeight}px`;\n }\n\n protected override updated(changed: Map<string, unknown>) {\n if (changed.has(\"_editing\") && this._editing) {\n const field = this._field;\n if (!field) return;\n field.focus();\n const end = field.value.length;\n field.setSelectionRange(end, end);\n if (this.multiline) this._resize();\n }\n }\n\n override render() {\n if (this._editing) {\n return this.multiline\n ? html`<textarea\n rows=\"3\"\n .value=${this._draft}\n placeholder=${this.placeholder}\n aria-label=${this.label || nothing}\n @input=${this._onInput}\n @keydown=${this._onMultilineKeydown}\n @blur=${this._commit}\n ></textarea>`\n : html`<input\n type=\"text\"\n .value=${this._draft}\n placeholder=${this.placeholder}\n aria-label=${this.label || nothing}\n @input=${this._onInput}\n @keydown=${this._onSingleLineKeydown}\n @blur=${this._commit}\n />`;\n }\n\n const isEmpty = this.value.trim() === \"\";\n const classes = `display ${this.multiline ? \"multiline\" : \"\"} ${isEmpty ? \"empty\" : \"\"} ${this.readonly ? \"readonly\" : \"\"}`;\n return html`<button\n type=\"button\"\n class=${classes}\n ?disabled=${this.readonly}\n @click=${this._startEdit}\n >${isEmpty ? this.placeholder : this.value}</button>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"editable-text\": EditableText;\n }\n}\n"]}
1
+ {"version":3,"file":"editable-text.js","sourceRoot":"","sources":["../src/editable-text.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;GAQG;AAEI,I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C;QAC5H,OAAO,IAAI,CAAA;;cAED,OAAO;kBACH,IAAI,CAAC,QAAQ;eAChB,IAAI,CAAC,UAAU;OACvB,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC;IACxD,CAAC;CACF,CAAA;AAzHa;IAAX,QAAQ,EAAE;2CAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAmB;AAEnC;IAAX,QAAQ,EAAE;iDAAkB;AAEA;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAAkB;AAElC;IAAX,QAAQ,EAAE;2CAAY;AAEN;IAAhB,KAAK,EAAE;8CAA0B;AACjB;IAAhB,KAAK,EAAE;4CAAqB;AAEK;IAAjC,KAAK,CAAC,iBAAiB,CAAC;4CAAyD;AAtGvE,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAkNxB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Jira/GitHub-style click-to-edit text: a display span that turns into an\n * `<input>` (or auto-growing `<textarea>` when `multiline`) on click. The\n * input/textarea inherits the host's font, so a title wrapped in an `<h1>`\n * edits at title size.\n *\n * @element editable-text\n * @fires change - Fired with `{ value: string }` when the committed value differs from the previous one.\n */\n@customElement(\"editable-text\")\nexport class EditableText extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n line-height: inherit;\n }\n .display {\n display: block;\n width: 100%;\n box-sizing: border-box;\n border: 0;\n color: inherit;\n background: transparent;\n font: inherit;\n line-height: inherit;\n text-align: inherit;\n cursor: text;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem;\n margin: -0.25rem;\n }\n .display.multiline {\n /* Inactive multiline text is flush; the active textarea keeps its editor inset. */\n white-space: pre-wrap;\n padding: 0;\n margin: 0;\n }\n .display:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .display.empty {\n color: var(--ui-text-muted, #64748b);\n }\n .display:disabled {\n cursor: inherit;\n opacity: 0.6;\n }\n .display:disabled:hover {\n background: none;\n }\n .display:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n input,\n textarea {\n display: block;\n width: 100%;\n box-sizing: border-box;\n font: inherit;\n color: inherit;\n background: var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem;\n margin: -0.25rem;\n outline: none;\n }\n input:focus-visible,\n textarea:focus-visible {\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n textarea {\n resize: none;\n overflow: hidden;\n }\n @media (forced-colors: active) {\n .display:focus-visible,\n input:focus-visible,\n textarea:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .display:disabled {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Current text. */\n @property() value = \"\";\n /** `false` renders an `<input>`, `true` an auto-growing `<textarea>`. */\n @property({ type: Boolean }) multiline = false;\n /** Muted placeholder text shown when `value` is empty, and as the input's placeholder. */\n @property() placeholder = \"\";\n /** Disables entering edit mode. */\n @property({ type: Boolean }) readonly = false;\n /** `aria-label` applied to the input/textarea. */\n @property() label = \"\";\n\n @state() private _editing = false;\n @state() private _draft = \"\";\n\n @query(\"input, textarea\") private _field?: HTMLInputElement | HTMLTextAreaElement;\n\n /** Enters edit mode, seeding the draft from the current value. */\n private _startEdit() {\n if (this.readonly) return;\n this._draft = this.value;\n this._editing = true;\n }\n\n /** Commits the draft (reverting an empty single-line commit) and exits edit mode.\n *\n * Guarded on `_editing`: removing the focused input/textarea from the DOM\n * (which happens as soon as `_editing` flips to false) makes the browser\n * fire a native `blur` on it, re-invoking this handler a second time after\n * a cancel already ran — the guard makes that second call a no-op instead\n * of re-committing the stale draft.\n */\n private _commit() {\n if (!this._editing) return;\n const next = this._draft;\n this._editing = false;\n if (!this.multiline && next.trim() === \"\") return;\n if (next === this.value) return;\n this.value = next;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value: next } }));\n }\n\n /** Discards the draft and exits edit mode without committing. */\n private _cancel() {\n this._editing = false;\n }\n\n private _onInput(e: Event) {\n this._draft = (e.target as HTMLInputElement | HTMLTextAreaElement).value;\n if (this.multiline) this._resize();\n }\n\n private _onSingleLineKeydown(e: KeyboardEvent) {\n if (e.key === \"Enter\") {\n e.preventDefault();\n this._commit();\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n this._cancel();\n }\n }\n\n private _onMultilineKeydown(e: KeyboardEvent) {\n if (e.key === \"Escape\") {\n e.preventDefault();\n this._cancel();\n } else if (e.key === \"Enter\" && (e.metaKey || e.ctrlKey)) {\n e.preventDefault();\n this._commit();\n }\n }\n\n /** Grows the textarea's height to fit its content. */\n private _resize() {\n const field = this._field;\n if (!field) return;\n field.style.height = \"auto\";\n field.style.height = `${field.scrollHeight}px`;\n }\n\n protected override updated(changed: Map<string, unknown>) {\n if (changed.has(\"_editing\") && this._editing) {\n const field = this._field;\n if (!field) return;\n field.focus();\n const end = field.value.length;\n field.setSelectionRange(end, end);\n if (this.multiline) this._resize();\n }\n }\n\n override render() {\n if (this._editing) {\n return this.multiline\n ? html`<textarea\n rows=\"3\"\n .value=${this._draft}\n placeholder=${this.placeholder}\n aria-label=${this.label || nothing}\n @input=${this._onInput}\n @keydown=${this._onMultilineKeydown}\n @blur=${this._commit}\n ></textarea>`\n : html`<input\n type=\"text\"\n .value=${this._draft}\n placeholder=${this.placeholder}\n aria-label=${this.label || nothing}\n @input=${this._onInput}\n @keydown=${this._onSingleLineKeydown}\n @blur=${this._commit}\n />`;\n }\n\n const isEmpty = this.value.trim() === \"\";\n const classes = `display ${this.multiline ? \"multiline\" : \"\"} ${isEmpty ? \"empty\" : \"\"} ${this.readonly ? \"readonly\" : \"\"}`;\n return html`<button\n type=\"button\"\n class=${classes}\n ?disabled=${this.readonly}\n @click=${this._startEdit}\n >${isEmpty ? this.placeholder : this.value}</button>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"editable-text\": EditableText;\n }\n}\n"]}
@@ -0,0 +1,58 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * A centered placeholder for an empty list, an empty panel, or a zero-result
4
+ * search: an optional leading glyph, a heading, a supporting line (or richer
5
+ * slotted body), and an optional call-to-action row. Purely presentational —
6
+ * it carries no interactive state of its own and no ARIA `role`; it is a
7
+ * region of content, not a live status. Every optional part collapses
8
+ * completely when absent, reserving no layout space.
9
+ *
10
+ * @element empty-state
11
+ * @slot icon - Optional leading glyph. The consumer supplies it (e.g. an inline SVG icon).
12
+ * @slot - Optional rich body content, an alternative to `description`.
13
+ * @slot actions - Optional call to action, e.g. a `ui-button`.
14
+ */
15
+ export declare class EmptyState extends LitElement {
16
+ #private;
17
+ /** The primary line. */
18
+ heading: string;
19
+ /** The supporting line under the heading. Omitted entirely when empty. */
20
+ description: string;
21
+ /** `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. */
22
+ size: "sm" | "md";
23
+ /**
24
+ * Heading rank the `heading` is exposed as, 1-6. An `empty-state` fills a
25
+ * page, a panel, or a sidebar, so no single rank is right everywhere; set
26
+ * this to whatever the surrounding outline needs. Applied via `aria-level`
27
+ * on the rendered `h2`, which overrides the element's native rank for
28
+ * assistive technology.
29
+ */
30
+ headingLevel: number;
31
+ /** Whether the icon slot currently has assigned content. */
32
+ private _hasIcon;
33
+ /** Whether the default (body) slot currently has assigned content. */
34
+ private _hasBody;
35
+ /** Whether the actions slot currently has assigned content. */
36
+ private _hasActions;
37
+ static styles: import("lit").CSSResult[];
38
+ /**
39
+ * Whether a slot holds real content. Whitespace-only text nodes don't count:
40
+ * ordinary indented markup puts a newline between every child, which would
41
+ * otherwise mark every slot as filled and reserve space for rows that are
42
+ * visually empty.
43
+ */
44
+ private static _slotHasContent;
45
+ /** Tracks whether the icon slot has content so its row can collapse when empty. */
46
+ private _onIconSlotChange;
47
+ /** Tracks whether the default body slot has content so its row can collapse when empty. */
48
+ private _onBodySlotChange;
49
+ /** Tracks whether the actions slot has content so its row can collapse when empty. */
50
+ private _onActionsSlotChange;
51
+ render(): import("lit-html").TemplateResult<1>;
52
+ }
53
+ declare global {
54
+ interface HTMLElementTagNameMap {
55
+ "empty-state": EmptyState;
56
+ }
57
+ }
58
+ //# sourceMappingURL=empty-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../src/empty-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD;;;;;;;;;;;;GAYG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,wBAAwB;IACZ,OAAO,SAAM;IAEzB,0EAA0E;IAC9D,WAAW,SAAM;IAE7B,uHAAuH;IAC1F,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEtD;;;;;;OAMG;IACqD,YAAY,SAAK;IAEzE,4DAA4D;IACnD,OAAO,CAAC,QAAQ,CAAS;IAElC,sEAAsE;IAC7D,OAAO,CAAC,QAAQ,CAAS;IAElC,+DAA+D;IACtD,OAAO,CAAC,WAAW,CAAS;IAErC,OAAgB,MAAM,4BA6EpB;IAEF;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAO9B,mFAAmF;IACnF,OAAO,CAAC,iBAAiB;IAIzB,2FAA2F;IAC3F,OAAO,CAAC,iBAAiB;IAIzB,sFAAsF;IACtF,OAAO,CAAC,oBAAoB;IAWnB,MAAM,yCAkBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -0,0 +1,203 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var EmptyState_1;
8
+ import { LitElement, css, html, nothing } from "lit";
9
+ import { customElement, property, state } from "lit/decorators.js";
10
+ import { tokens } from "./tokens.js";
11
+ /**
12
+ * A centered placeholder for an empty list, an empty panel, or a zero-result
13
+ * search: an optional leading glyph, a heading, a supporting line (or richer
14
+ * slotted body), and an optional call-to-action row. Purely presentational —
15
+ * it carries no interactive state of its own and no ARIA `role`; it is a
16
+ * region of content, not a live status. Every optional part collapses
17
+ * completely when absent, reserving no layout space.
18
+ *
19
+ * @element empty-state
20
+ * @slot icon - Optional leading glyph. The consumer supplies it (e.g. an inline SVG icon).
21
+ * @slot - Optional rich body content, an alternative to `description`.
22
+ * @slot actions - Optional call to action, e.g. a `ui-button`.
23
+ */
24
+ let EmptyState = class EmptyState extends LitElement {
25
+ constructor() {
26
+ super(...arguments);
27
+ /** The primary line. */
28
+ this.heading = "";
29
+ /** The supporting line under the heading. Omitted entirely when empty. */
30
+ this.description = "";
31
+ /** `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. */
32
+ this.size = "md";
33
+ /**
34
+ * Heading rank the `heading` is exposed as, 1-6. An `empty-state` fills a
35
+ * page, a panel, or a sidebar, so no single rank is right everywhere; set
36
+ * this to whatever the surrounding outline needs. Applied via `aria-level`
37
+ * on the rendered `h2`, which overrides the element's native rank for
38
+ * assistive technology.
39
+ */
40
+ this.headingLevel = 2;
41
+ /** Whether the icon slot currently has assigned content. */
42
+ this._hasIcon = false;
43
+ /** Whether the default (body) slot currently has assigned content. */
44
+ this._hasBody = false;
45
+ /** Whether the actions slot currently has assigned content. */
46
+ this._hasActions = false;
47
+ }
48
+ static { EmptyState_1 = this; }
49
+ static { this.styles = [
50
+ tokens,
51
+ css `
52
+ :host {
53
+ display: block;
54
+ font-family: var(
55
+ --ui-font,
56
+ ui-sans-serif,
57
+ system-ui,
58
+ sans-serif,
59
+ "Apple Color Emoji",
60
+ "Segoe UI Emoji",
61
+ "Segoe UI Symbol",
62
+ "Noto Color Emoji"
63
+ );
64
+ }
65
+ .state {
66
+ display: flex;
67
+ flex-direction: column;
68
+ align-items: center;
69
+ text-align: center;
70
+ padding: 2rem 1rem;
71
+ }
72
+ :host([size="sm"]) .state {
73
+ padding: 1rem 0.75rem;
74
+ }
75
+ .icon {
76
+ display: inline-flex;
77
+ margin-bottom: 0.75rem;
78
+ color: var(--ui-text-muted, #64748b);
79
+ }
80
+ :host([size="sm"]) .icon {
81
+ margin-bottom: 0.5rem;
82
+ }
83
+ .heading {
84
+ margin: 0;
85
+ font-size: var(--ui-font-size-lg, 1rem);
86
+ font-weight: var(--ui-font-weight-semibold, 600);
87
+ line-height: var(--ui-line-height-tight, 1.25);
88
+ color: var(--ui-text, #0f172a);
89
+ }
90
+ :host([size="sm"]) .heading {
91
+ font-size: var(--ui-font-size, 0.875rem);
92
+ }
93
+ .description {
94
+ margin: 0.5rem 0 0;
95
+ max-width: 32rem;
96
+ font-size: var(--ui-font-size, 0.875rem);
97
+ font-weight: var(--ui-font-weight-regular, 400);
98
+ line-height: var(--ui-line-height-normal, 1.5);
99
+ color: var(--ui-text-muted, #64748b);
100
+ }
101
+ :host([size="sm"]) .description {
102
+ font-size: var(--ui-font-size-sm, 0.75rem);
103
+ }
104
+ .body {
105
+ margin-top: 0.5rem;
106
+ color: var(--ui-text-muted, #64748b);
107
+ }
108
+ .body.empty {
109
+ display: none;
110
+ }
111
+ .actions {
112
+ display: flex;
113
+ flex-wrap: wrap;
114
+ align-items: center;
115
+ justify-content: center;
116
+ gap: 0.5rem;
117
+ margin-top: 1rem;
118
+ }
119
+ .actions.empty {
120
+ display: none;
121
+ }
122
+ .icon.empty {
123
+ display: none;
124
+ }
125
+ `,
126
+ ]; }
127
+ /**
128
+ * Whether a slot holds real content. Whitespace-only text nodes don't count:
129
+ * ordinary indented markup puts a newline between every child, which would
130
+ * otherwise mark every slot as filled and reserve space for rows that are
131
+ * visually empty.
132
+ */
133
+ static _slotHasContent(event) {
134
+ const slot = event.target;
135
+ return slot
136
+ .assignedNodes({ flatten: true })
137
+ .some((node) => node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? "").trim().length > 0);
138
+ }
139
+ /** Tracks whether the icon slot has content so its row can collapse when empty. */
140
+ _onIconSlotChange(event) {
141
+ this._hasIcon = EmptyState_1._slotHasContent(event);
142
+ }
143
+ /** Tracks whether the default body slot has content so its row can collapse when empty. */
144
+ _onBodySlotChange(event) {
145
+ this._hasBody = EmptyState_1._slotHasContent(event);
146
+ }
147
+ /** Tracks whether the actions slot has content so its row can collapse when empty. */
148
+ _onActionsSlotChange(event) {
149
+ this._hasActions = EmptyState_1._slotHasContent(event);
150
+ }
151
+ /** Clamps `headingLevel` into the valid 1-6 heading range, falling back to 2 for a non-numeric value. */
152
+ #level() {
153
+ const level = Math.trunc(Number(this.headingLevel));
154
+ if (!Number.isFinite(level))
155
+ return 2;
156
+ return Math.min(6, Math.max(1, level));
157
+ }
158
+ render() {
159
+ return html `
160
+ <div class="state">
161
+ <span class="icon ${this._hasIcon ? "" : "empty"}">
162
+ <slot name="icon" @slotchange=${this._onIconSlotChange}></slot>
163
+ </span>
164
+ ${this.heading
165
+ ? html `<h2 class="heading" aria-level=${this.#level()}>${this.heading}</h2>`
166
+ : nothing}
167
+ ${this.description ? html `<p class="description">${this.description}</p>` : nothing}
168
+ <div class="body ${this._hasBody ? "" : "empty"}">
169
+ <slot @slotchange=${this._onBodySlotChange}></slot>
170
+ </div>
171
+ <div class="actions ${this._hasActions ? "" : "empty"}">
172
+ <slot name="actions" @slotchange=${this._onActionsSlotChange}></slot>
173
+ </div>
174
+ </div>
175
+ `;
176
+ }
177
+ };
178
+ __decorate([
179
+ property()
180
+ ], EmptyState.prototype, "heading", void 0);
181
+ __decorate([
182
+ property()
183
+ ], EmptyState.prototype, "description", void 0);
184
+ __decorate([
185
+ property({ reflect: true })
186
+ ], EmptyState.prototype, "size", void 0);
187
+ __decorate([
188
+ property({ type: Number, attribute: "heading-level" })
189
+ ], EmptyState.prototype, "headingLevel", void 0);
190
+ __decorate([
191
+ state()
192
+ ], EmptyState.prototype, "_hasIcon", void 0);
193
+ __decorate([
194
+ state()
195
+ ], EmptyState.prototype, "_hasBody", void 0);
196
+ __decorate([
197
+ state()
198
+ ], EmptyState.prototype, "_hasActions", void 0);
199
+ EmptyState = EmptyState_1 = __decorate([
200
+ customElement("empty-state")
201
+ ], EmptyState);
202
+ export { EmptyState };
203
+ //# sourceMappingURL=empty-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-state.js","sourceRoot":"","sources":["../src/empty-state.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;GAYG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,wBAAwB;QACZ,YAAO,GAAG,EAAE,CAAC;QAEzB,0EAA0E;QAC9D,gBAAW,GAAG,EAAE,CAAC;QAE7B,uHAAuH;QAC1F,SAAI,GAAgB,IAAI,C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U,CAiKtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A centered placeholder for an empty list, an empty panel, or a zero-result\n * search: an optional leading glyph, a heading, a supporting line (or richer\n * slotted body), and an optional call-to-action row. Purely presentational —\n * it carries no interactive state of its own and no ARIA `role`; it is a\n * region of content, not a live status. Every optional part collapses\n * completely when absent, reserving no layout space.\n *\n * @element empty-state\n * @slot icon - Optional leading glyph. The consumer supplies it (e.g. an inline SVG icon).\n * @slot - Optional rich body content, an alternative to `description`.\n * @slot actions - Optional call to action, e.g. a `ui-button`.\n */\n@customElement(\"empty-state\")\nexport class EmptyState extends LitElement {\n /** The primary line. */\n @property() heading = \"\";\n\n /** The supporting line under the heading. Omitted entirely when empty. */\n @property() description = \"\";\n\n /** `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n /**\n * Heading rank the `heading` is exposed as, 1-6. An `empty-state` fills a\n * page, a panel, or a sidebar, so no single rank is right everywhere; set\n * this to whatever the surrounding outline needs. Applied via `aria-level`\n * on the rendered `h2`, which overrides the element's native rank for\n * assistive technology.\n */\n @property({ type: Number, attribute: \"heading-level\" }) headingLevel = 2;\n\n /** Whether the icon slot currently has assigned content. */\n @state() private _hasIcon = false;\n\n /** Whether the default (body) slot currently has assigned content. */\n @state() private _hasBody = false;\n\n /** Whether the actions slot currently has assigned content. */\n @state() private _hasActions = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .state {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: 2rem 1rem;\n }\n :host([size=\"sm\"]) .state {\n padding: 1rem 0.75rem;\n }\n .icon {\n display: inline-flex;\n margin-bottom: 0.75rem;\n color: var(--ui-text-muted, #64748b);\n }\n :host([size=\"sm\"]) .icon {\n margin-bottom: 0.5rem;\n }\n .heading {\n margin: 0;\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n :host([size=\"sm\"]) .heading {\n font-size: var(--ui-font-size, 0.875rem);\n }\n .description {\n margin: 0.5rem 0 0;\n max-width: 32rem;\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n :host([size=\"sm\"]) .description {\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .body {\n margin-top: 0.5rem;\n color: var(--ui-text-muted, #64748b);\n }\n .body.empty {\n display: none;\n }\n .actions {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n margin-top: 1rem;\n }\n .actions.empty {\n display: none;\n }\n .icon.empty {\n display: none;\n }\n `,\n ];\n\n /**\n * Whether a slot holds real content. Whitespace-only text nodes don't count:\n * ordinary indented markup puts a newline between every child, which would\n * otherwise mark every slot as filled and reserve space for rows that are\n * visually empty.\n */\n private static _slotHasContent(event: Event): boolean {\n const slot = event.target as HTMLSlotElement;\n return slot\n .assignedNodes({ flatten: true })\n .some((node) => node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? \"\").trim().length > 0);\n }\n\n /** Tracks whether the icon slot has content so its row can collapse when empty. */\n private _onIconSlotChange(event: Event): void {\n this._hasIcon = EmptyState._slotHasContent(event);\n }\n\n /** Tracks whether the default body slot has content so its row can collapse when empty. */\n private _onBodySlotChange(event: Event): void {\n this._hasBody = EmptyState._slotHasContent(event);\n }\n\n /** Tracks whether the actions slot has content so its row can collapse when empty. */\n private _onActionsSlotChange(event: Event): void {\n this._hasActions = EmptyState._slotHasContent(event);\n }\n\n /** Clamps `headingLevel` into the valid 1-6 heading range, falling back to 2 for a non-numeric value. */\n #level(): number {\n const level = Math.trunc(Number(this.headingLevel));\n if (!Number.isFinite(level)) return 2;\n return Math.min(6, Math.max(1, level));\n }\n\n override render() {\n return html`\n <div class=\"state\">\n <span class=\"icon ${this._hasIcon ? \"\" : \"empty\"}\">\n <slot name=\"icon\" @slotchange=${this._onIconSlotChange}></slot>\n </span>\n ${this.heading\n ? html`<h2 class=\"heading\" aria-level=${this.#level()}>${this.heading}</h2>`\n : nothing}\n ${this.description ? html`<p class=\"description\">${this.description}</p>` : nothing}\n <div class=\"body ${this._hasBody ? \"\" : \"empty\"}\">\n <slot @slotchange=${this._onBodySlotChange}></slot>\n </div>\n <div class=\"actions ${this._hasActions ? \"\" : \"empty\"}\">\n <slot name=\"actions\" @slotchange=${this._onActionsSlotChange}></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"empty-state\": EmptyState;\n }\n}\n"]}
@@ -227,7 +227,7 @@ let FormField = class FormField extends LitElement {
227
227
  margin: 0;
228
228
  /* See the !important note on the floating-native rule above. */
229
229
  padding: 0.5rem 0.75rem !important;
230
- border: 1px solid var(--ui-border, #e2e8f0) !important;
230
+ border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0) !important;
231
231
  border-radius: var(--ui-radius-sm, 0.25rem) !important;
232
232
  color: var(--ui-text, #0f172a) !important;
233
233
  background: var(--ui-surface, #ffffff) !important;