@lilydesignsystem/web-components-theme-picker 0.1.0 → 0.1.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.
package/dist/index.d.ts CHANGED
@@ -7,7 +7,14 @@
7
7
  *
8
8
  * The control is an icon button that opens a dropdown listbox
9
9
  * (WAI-ARIA APG listbox pattern). It is not a native `<select>`.
10
+ *
11
+ * Depends on `@lilydesignsystem/web-components-headless`'s
12
+ * `<lily-icon-button>` for the trigger button, composed in `#render()`
13
+ * rather than hand-rolled. Imported here (not only from `index.ts`) so
14
+ * `lily-icon-button` is registered regardless of which module a
15
+ * consumer (or this package's own tests) imports first.
10
16
  */
17
+
11
18
  /**
12
19
  * Default button icon: a bundled SVG (contrast/half-circle), not a
13
20
  * Unicode character. Reversed 2026-09-16 from the font-dependent-glyph
package/dist/index.js CHANGED
@@ -1,4 +1,8 @@
1
+ // lily-design-system-web-components-theme-picker/index.ts
2
+ import "@lilydesignsystem/web-components-headless";
3
+
1
4
  // lily-design-system-web-components-theme-picker/theme-picker.ts
5
+ import "@lilydesignsystem/web-components-headless";
2
6
  var SVG_NS = "http://www.w3.org/2000/svg";
3
7
  function themeName(theme) {
4
8
  return theme.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
@@ -45,6 +49,8 @@ var ThemePicker = class extends HTMLElement {
45
49
  // Rendered-DOM references. Null until #render() has run.
46
50
  #rootEl = null;
47
51
  #inputEl = null;
52
+ // The real <button>, nested one level inside the composed
53
+ // <lily-icon-button> host (see #render()) — not #rootEl's direct child.
48
54
  #buttonEl = null;
49
55
  #listEl = null;
50
56
  #optionEls = [];
@@ -496,20 +502,19 @@ var ThemePicker = class extends HTMLElement {
496
502
  input.name = this.name;
497
503
  input.value = this.value;
498
504
  root.appendChild(input);
499
- const button = document.createElement("button");
500
- button.type = "button";
501
- button.className = "theme-picker-button";
502
- button.setAttribute("aria-label", this.label);
503
- button.setAttribute("aria-haspopup", "listbox");
504
- button.setAttribute("aria-expanded", "false");
505
- button.setAttribute("aria-controls", this.listId);
506
- button.appendChild(this.renderButtonContent());
507
- button.addEventListener("click", () => {
505
+ const iconButtonHost = document.createElement("lily-icon-button");
506
+ iconButtonHost.setAttribute("base-class", "theme-picker-button");
507
+ iconButtonHost.setAttribute("label", this.label);
508
+ iconButtonHost.setAttribute("aria-haspopup", "listbox");
509
+ iconButtonHost.setAttribute("aria-expanded", "false");
510
+ iconButtonHost.setAttribute("aria-controls", this.listId);
511
+ iconButtonHost.appendChild(this.renderButtonContent());
512
+ iconButtonHost.addEventListener("click", () => {
508
513
  if (this.#open) this.closeList();
509
514
  else this.openList();
510
515
  });
511
- button.addEventListener("keydown", this.#onButtonKeydown);
512
- root.appendChild(button);
516
+ iconButtonHost.addEventListener("keydown", this.#onButtonKeydown);
517
+ root.appendChild(iconButtonHost);
513
518
  const list = document.createElement("ul");
514
519
  list.className = "theme-picker-list";
515
520
  list.id = this.listId;
@@ -533,10 +538,10 @@ var ThemePicker = class extends HTMLElement {
533
538
  root.appendChild(list);
534
539
  this.#rootEl = root;
535
540
  this.#inputEl = input;
536
- this.#buttonEl = button;
537
541
  this.#listEl = list;
538
542
  this.#optionEls = optionEls;
539
543
  this.replaceChildren(root);
544
+ this.#buttonEl = iconButtonHost.querySelector("button");
540
545
  }
541
546
  };
542
547
  function parseCsv(s) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lilydesignsystem/web-components-theme-picker",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "engines": {
5
5
  "node": "=26"
6
6
  },
@@ -23,6 +23,9 @@
23
23
  "scripts": {
24
24
  "prepublishOnly": "cd .. && npm run build"
25
25
  },
26
+ "dependencies": {
27
+ "@lilydesignsystem/web-components-headless": "^0.1.0"
28
+ },
26
29
  "keywords": [
27
30
  "lily",
28
31
  "design",