@lilydesignsystem/web-components-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/web-components-link-picker';
1
2
  import { SearchPickerProps } from '@lilydesignsystem/web-components-search-picker';
2
3
  import { ThemePickerProps } from '@lilydesignsystem/web-components-theme-picker';
3
4
  import { LocalePickerProps } from '@lilydesignsystem/web-components-locale-picker';
@@ -37,6 +38,11 @@ declare const DEFAULT_THEMES: string[];
37
38
  declare const DEFAULT_SIZES: string[];
38
39
  /** Accessible names for the four pickers. Required — no English default. */
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. */
@@ -58,6 +64,10 @@ type PickerBarProps = {
58
64
  labels: PickerBarLabels;
59
65
  /** Property-only extra `<lily-search-picker>` config (`action`, `navigate`, `placeholder`, `onSearch`, …), applied after the bar's own. */
60
66
  searchProps?: Partial<Omit<SearchPickerProps, "label" | "inputLabel" | "submitLabel">>;
67
+ /** Page links for the link picker, which renders FIRST (leftmost). Omitted or empty: no link picker. */
68
+ links?: LinkItem[];
69
+ /** Property-only extra `<lily-link-picker>` config (`onNavigate`, …), applied after this bar's own. */
70
+ linkProps?: Partial<Omit<LinkPickerProps, "label" | "links">>;
61
71
  themesUrl: string;
62
72
  themes?: string[];
63
73
  /** Property-only extra `<lily-theme-picker>` config, applied after the bar's own. */
@@ -92,6 +102,13 @@ declare class PickerBar extends HTMLElement {
92
102
  /** Property-only — `ShareTarget.href` is a function. */
93
103
  get shareTargets(): ShareTarget[];
94
104
  set shareTargets(v: ShareTarget[]);
105
+ /** Page links for the link picker (leftmost). Property-only. */
106
+ get links(): LinkItem[];
107
+ set links(v: LinkItem[]);
108
+ get linkProps(): Partial<LinkPickerProps>;
109
+ set linkProps(v: Partial<LinkPickerProps>);
110
+ /** The rendered `<lily-link-picker>` instance (null when no links). */
111
+ get linkPicker(): LinkPicker | null;
95
112
  get searchProps(): Partial<SearchPickerProps>;
96
113
  set searchProps(v: Partial<SearchPickerProps>);
97
114
  get themeProps(): Partial<ThemePickerProps>;
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // lily-design-system-web-components-picker-bar/picker-bar.ts
2
+ import "@lilydesignsystem/web-components-link-picker";
2
3
  import "@lilydesignsystem/web-components-search-picker";
3
4
  import "@lilydesignsystem/web-components-theme-picker";
4
5
  import "@lilydesignsystem/web-components-locale-picker";
@@ -81,6 +82,8 @@ var PickerBar = class extends HTMLElement {
81
82
  #sizes = [...DEFAULT_SIZES];
82
83
  #labels = { ...DEFAULT_LABELS };
83
84
  #shareTargets = [];
85
+ #links = [];
86
+ #linkProps = {};
84
87
  #searchProps = {};
85
88
  #themeProps = {};
86
89
  #localeProps = {};
@@ -88,6 +91,7 @@ var PickerBar = class extends HTMLElement {
88
91
  #shareProps = {};
89
92
  #built = false;
90
93
  #rootEl = null;
94
+ #linkEl = null;
91
95
  #searchEl = null;
92
96
  #themeEl = null;
93
97
  #localeEl = null;
@@ -142,6 +146,7 @@ var PickerBar = class extends HTMLElement {
142
146
  }
143
147
  set labels(v) {
144
148
  this.#labels = v ?? { ...DEFAULT_LABELS };
149
+ this.#syncLink();
145
150
  if (this.#searchEl) {
146
151
  this.#searchEl.label = this.#labels.search;
147
152
  this.#searchEl.inputLabel = this.#labels.searchInput;
@@ -160,6 +165,46 @@ var PickerBar = class extends HTMLElement {
160
165
  this.#shareTargets = Array.isArray(v) ? v.slice() : [];
161
166
  if (this.#shareEl) this.#shareEl.targets = this.#shareTargets;
162
167
  }
168
+ /** Page links for the link picker (leftmost). Property-only. */
169
+ get links() {
170
+ return [...this.#links];
171
+ }
172
+ set links(v) {
173
+ this.#links = Array.isArray(v) ? v.slice() : [];
174
+ this.#syncLink();
175
+ }
176
+ get linkProps() {
177
+ return { ...this.#linkProps };
178
+ }
179
+ set linkProps(v) {
180
+ this.#linkProps = v ?? {};
181
+ if (this.#linkEl) Object.assign(this.#linkEl, this.#linkProps);
182
+ }
183
+ /** The rendered `<lily-link-picker>` instance (null when no links). */
184
+ get linkPicker() {
185
+ return this.#linkEl;
186
+ }
187
+ /**
188
+ * Create, update or remove the link picker so it is the root's first child exactly when
189
+ * `links` is non-empty and `labels.link` is set. The picker is optional, so unlike the
190
+ * other five it can appear and disappear after the bar is rendered.
191
+ */
192
+ #syncLink() {
193
+ if (!this.#rootEl) return;
194
+ const wanted = this.#links.length > 0 && !!this.#labels.link;
195
+ if (!wanted) {
196
+ this.#linkEl?.remove();
197
+ this.#linkEl = null;
198
+ return;
199
+ }
200
+ if (!this.#linkEl) {
201
+ this.#linkEl = document.createElement("lily-link-picker");
202
+ this.#rootEl.insertBefore(this.#linkEl, this.#rootEl.firstChild);
203
+ }
204
+ this.#linkEl.label = this.#labels.link;
205
+ this.#linkEl.links = this.#links;
206
+ Object.assign(this.#linkEl, this.#linkProps);
207
+ }
163
208
  get searchProps() {
164
209
  return { ...this.#searchProps };
165
210
  }
@@ -275,6 +320,8 @@ var PickerBar = class extends HTMLElement {
275
320
  this.#localeEl = localeEl;
276
321
  this.#textSizeEl = textSizeEl;
277
322
  this.#shareEl = shareEl;
323
+ this.#linkEl = null;
324
+ this.#syncLink();
278
325
  }
279
326
  };
280
327
 
package/index.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Lily Design System™ — `<lily-picker-bar>`
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 row that composes five of the Lily
4
6
  [`*-picker` helpers](../index.md) — search, theme, locale, text size,
5
7
  and share, in that order — with two catalog-wide defaults pre-wired,
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@lilydesignsystem/web-components-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 custom element picker bar: composes lily-search-picker, lily-theme-picker, lily-locale-picker, lily-text-size-picker, and lily-share-picker into one page-header row.",
7
+ "description": "Lily Design System Web Components picker bar: composes lily-link-picker (optional), lily-search-picker, lily-theme-picker, lily-locale-picker, lily-text-size-picker, and lily-share-picker into one page-header row.",
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/web-components-link-picker": "^0.1.0",
27
28
  "@lilydesignsystem/web-components-search-picker": "^0.1.0",
28
29
  "@lilydesignsystem/web-components-theme-picker": "^0.2.0",
29
30
  "@lilydesignsystem/web-components-locale-picker": "^0.2.0",