@lilydesignsystem/html-picker-bar 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { LinkItem, LinkPickerProps, LinkPicker } from '@lilydesignsystem/html-link-picker';
1
2
  import { SearchPickerProps, SearchPicker } from '@lilydesignsystem/html-search-picker';
2
3
  import { ThemePickerProps, ThemePicker } from '@lilydesignsystem/html-theme-picker';
3
4
  import { LocalePickerProps, LocalePicker } from '@lilydesignsystem/html-locale-picker';
@@ -35,8 +36,13 @@ declare const DEFAULT_THEMES: string[];
35
36
  * either.
36
37
  */
37
38
  declare const DEFAULT_SIZES: string[];
38
- /** Accessible names for the five pickers. Required — no English default. */
39
+ /** Accessible names for the pickers. Required — no English default (`link` only when `links` is given). */
39
40
  type PickerBarLabels = {
41
+ /**
42
+ * Accessible name for the link picker's button and list. Needed only when `links` is
43
+ * supplied; the link picker renders only when both are present.
44
+ */
45
+ link?: string;
40
46
  /** Accessible name for the search picker's button and search landmark. */
41
47
  search: string;
42
48
  /** Accessible name for the search picker's text field. */
@@ -61,6 +67,7 @@ type PickerBarLabels = {
61
67
  * so anything here overrides them. Excludes the props `<picker-bar>`
62
68
  * already lifts to the top level.
63
69
  */
70
+ type LinkPickerExtra = Partial<Omit<LinkPickerProps, "label" | "links">>;
64
71
  type SearchPickerExtra = Partial<Omit<SearchPickerProps, "label" | "inputLabel" | "submitLabel">>;
65
72
  type ThemePickerExtra = Partial<Omit<ThemePickerProps, "label" | "themesUrl" | "themes">>;
66
73
  type LocalePickerExtra = Partial<Omit<LocalePickerProps, "label" | "locales">>;
@@ -69,6 +76,9 @@ type SharePickerExtra = Partial<Omit<SharePickerProps, "label" | "targets">>;
69
76
  /** Mirrors the observed attributes / properties for typing convenience. */
70
77
  type PickerBarProps = {
71
78
  labels: PickerBarLabels;
79
+ /** Page links for the link picker, which renders FIRST (leftmost). Omitted or empty: no link picker. */
80
+ links?: LinkItem[];
81
+ linkProps?: LinkPickerExtra;
72
82
  searchProps?: SearchPickerExtra;
73
83
  themesUrl: string;
74
84
  themes?: string[];
@@ -97,6 +107,10 @@ declare class PickerBar extends HTMLElement {
97
107
  set sizes(v: string[]);
98
108
  get shareTargets(): ShareTarget[];
99
109
  set shareTargets(v: ShareTarget[]);
110
+ get links(): LinkItem[];
111
+ set links(v: LinkItem[]);
112
+ get linkProps(): LinkPickerExtra;
113
+ set linkProps(v: LinkPickerExtra);
100
114
  get searchProps(): SearchPickerExtra;
101
115
  set searchProps(v: SearchPickerExtra);
102
116
  get themeProps(): ThemePickerExtra;
@@ -107,6 +121,8 @@ declare class PickerBar extends HTMLElement {
107
121
  set textSizeProps(v: TextSizePickerExtra);
108
122
  get shareProps(): SharePickerExtra;
109
123
  set shareProps(v: SharePickerExtra);
124
+ /** The rendered `<link-picker>` instance, once connected (null when no links). */
125
+ get linkPicker(): LinkPicker | null;
110
126
  /** The rendered `<search-picker>` instance, once connected. */
111
127
  get searchPicker(): SearchPicker | null;
112
128
  /** The rendered `<theme-picker>` instance, once connected. */
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // lily-design-system-html-picker-bar/picker-bar.ts
2
+ import "@lilydesignsystem/html-link-picker";
2
3
  import "@lilydesignsystem/html-search-picker";
3
4
  import "@lilydesignsystem/html-theme-picker";
4
5
  import "@lilydesignsystem/html-locale-picker";
@@ -82,6 +83,8 @@ var PickerBar = class extends HTMLElement {
82
83
  #locales = [];
83
84
  #sizes = DEFAULT_SIZES;
84
85
  #shareTargets = [];
86
+ #links = [];
87
+ #linkProps = {};
85
88
  #searchProps = {};
86
89
  #themeProps = {};
87
90
  #localeProps = {};
@@ -89,6 +92,7 @@ var PickerBar = class extends HTMLElement {
89
92
  #shareProps = {};
90
93
  // Rendered-DOM references. Null until #render() has run.
91
94
  #rootEl = null;
95
+ #linkPickerEl = null;
92
96
  #searchPickerEl = null;
93
97
  #themePickerEl = null;
94
98
  #localePickerEl = null;
@@ -151,6 +155,20 @@ var PickerBar = class extends HTMLElement {
151
155
  this.#shareTargets = Array.isArray(v) ? v.slice() : [];
152
156
  this.#render();
153
157
  }
158
+ get links() {
159
+ return [...this.#links];
160
+ }
161
+ set links(v) {
162
+ this.#links = Array.isArray(v) ? v.slice() : [];
163
+ this.#render();
164
+ }
165
+ get linkProps() {
166
+ return this.#linkProps;
167
+ }
168
+ set linkProps(v) {
169
+ this.#linkProps = v ?? {};
170
+ this.#render();
171
+ }
154
172
  get searchProps() {
155
173
  return this.#searchProps;
156
174
  }
@@ -186,6 +204,10 @@ var PickerBar = class extends HTMLElement {
186
204
  this.#shareProps = v ?? {};
187
205
  this.#render();
188
206
  }
207
+ /** The rendered `<link-picker>` instance, once connected (null when no links). */
208
+ get linkPicker() {
209
+ return this.#linkPickerEl;
210
+ }
189
211
  /** The rendered `<search-picker>` instance, once connected. */
190
212
  get searchPicker() {
191
213
  return this.#searchPickerEl;
@@ -244,6 +266,15 @@ var PickerBar = class extends HTMLElement {
244
266
  const extraClass = this.getAttribute("class") ?? "";
245
267
  const root = document.createElement("div");
246
268
  root.className = `picker-bar ${extraClass}`.trim();
269
+ this.#linkPickerEl = null;
270
+ if (this.#links.length > 0 && this.#labels.link) {
271
+ const linkEl = document.createElement("link-picker");
272
+ linkEl.label = this.#labels.link;
273
+ linkEl.links = this.#links;
274
+ Object.assign(linkEl, this.#linkProps);
275
+ root.appendChild(linkEl);
276
+ this.#linkPickerEl = linkEl;
277
+ }
247
278
  const searchEl = document.createElement("search-picker");
248
279
  searchEl.label = this.#labels.search;
249
280
  searchEl.inputLabel = this.#labels.searchInput;
package/index.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Lily Design System™ — HTML PickerBar
2
2
 
3
+ > **Link picker (0.3.0).** Pass `links` (and `labels.link`) to add a `link-picker` — a home icon opening the page links your app defines — as the leftmost icon. It renders only when both are given.
4
+
3
5
  A single page-header custom element, `<picker-bar>`, that composes five
4
6
  of the Lily [`*-picker` helpers](../index.md) — search, theme, locale,
5
7
  text size, and share, in that order — with two catalog-wide defaults
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@lilydesignsystem/html-picker-bar",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "engines": {
5
5
  "node": "=26"
6
6
  },
7
- "description": "Lily Design System HTML picker bar: composes search-picker, theme-picker, locale-picker, text-size-picker, and share-picker into one page-header row. Headless, SSR-safe, no CSS.",
7
+ "description": "Lily Design System HTML picker bar: composes link-picker (optional), search-picker, theme-picker, locale-picker, text-size-picker, and share-picker into one page-header row. Headless, SSR-safe, no CSS.",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",
10
10
  "module": "./dist/index.js",
@@ -24,6 +24,7 @@
24
24
  "prepublishOnly": "cd .. && npm run build"
25
25
  },
26
26
  "dependencies": {
27
+ "@lilydesignsystem/html-link-picker": "^0.1.0",
27
28
  "@lilydesignsystem/html-search-picker": "^0.1.0",
28
29
  "@lilydesignsystem/html-theme-picker": "^0.2.0",
29
30
  "@lilydesignsystem/html-locale-picker": "^0.2.0",