@lilydesignsystem/web-components-picker-bar 0.1.0 → 0.2.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 { SearchPickerProps } from '@lilydesignsystem/web-components-search-picker';
1
2
  import { ThemePickerProps } from '@lilydesignsystem/web-components-theme-picker';
2
3
  import { LocalePickerProps } from '@lilydesignsystem/web-components-locale-picker';
3
4
  import { TextSizePickerProps } from '@lilydesignsystem/web-components-text-size-picker';
@@ -10,9 +11,10 @@ import { ShareTarget, SharePickerProps } from '@lilydesignsystem/web-components-
10
11
  * the custom-element class but does NOT register it. The `index.ts`
11
12
  * barrel registers it on import.
12
13
  *
13
- * A thin composition wrapper: it renders `<lily-theme-picker>`,
14
- * `<lily-locale-picker>`, `<lily-text-size-picker>`, and
15
- * `<lily-share-picker>` — each depended on as a real npm package, not
14
+ * A thin composition wrapper: it renders `<lily-search-picker>`,
15
+ * `<lily-theme-picker>`, `<lily-locale-picker>`,
16
+ * `<lily-text-size-picker>`, and `<lily-share-picker>` — search first,
17
+ * each depended on as a real npm package, not
16
18
  * vendored — in that fixed order, with two catalog-specific defaults
17
19
  * pre-wired (§5.1, §5.2 of the spec). It owns no interaction of its
18
20
  * own: no listbox, no keyboard handling, no applied/persisted state.
@@ -35,6 +37,12 @@ declare const DEFAULT_THEMES: string[];
35
37
  declare const DEFAULT_SIZES: string[];
36
38
  /** Accessible names for the four pickers. Required — no English default. */
37
39
  type PickerBarLabels = {
40
+ /** Accessible name for the search picker's button and search landmark. */
41
+ search: string;
42
+ /** Accessible name for the search picker's text field. */
43
+ searchInput: string;
44
+ /** Accessible name for the search picker's ⏎ submit button. */
45
+ searchSubmit: string;
38
46
  /** Accessible name for the theme picker's button and listbox. */
39
47
  theme: string;
40
48
  /** Accessible name for the locale picker's button and listbox. */
@@ -48,6 +56,8 @@ type PickerBarLabels = {
48
56
  type PickerBarProps = {
49
57
  /** Property-only — see `spec/index.md` §4.3. Required, no default. */
50
58
  labels: PickerBarLabels;
59
+ /** Property-only extra `<lily-search-picker>` config (`action`, `navigate`, `placeholder`, `onSearch`, …), applied after the bar's own. */
60
+ searchProps?: Partial<Omit<SearchPickerProps, "label" | "inputLabel" | "submitLabel">>;
51
61
  themesUrl: string;
52
62
  themes?: string[];
53
63
  /** Property-only extra `<lily-theme-picker>` config, applied after the bar's own. */
@@ -82,6 +92,8 @@ declare class PickerBar extends HTMLElement {
82
92
  /** Property-only — `ShareTarget.href` is a function. */
83
93
  get shareTargets(): ShareTarget[];
84
94
  set shareTargets(v: ShareTarget[]);
95
+ get searchProps(): Partial<SearchPickerProps>;
96
+ set searchProps(v: Partial<SearchPickerProps>);
85
97
  get themeProps(): Partial<ThemePickerProps>;
86
98
  set themeProps(v: Partial<ThemePickerProps>);
87
99
  get localeProps(): Partial<LocalePickerProps>;
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-search-picker";
2
3
  import "@lilydesignsystem/web-components-theme-picker";
3
4
  import "@lilydesignsystem/web-components-locale-picker";
4
5
  import "@lilydesignsystem/web-components-text-size-picker";
@@ -60,6 +61,9 @@ var DEFAULT_SIZES = [
60
61
  "smallest"
61
62
  ];
62
63
  var DEFAULT_LABELS = {
64
+ search: "",
65
+ searchInput: "",
66
+ searchSubmit: "",
63
67
  theme: "",
64
68
  locale: "",
65
69
  textSize: "",
@@ -77,12 +81,14 @@ var PickerBar = class extends HTMLElement {
77
81
  #sizes = [...DEFAULT_SIZES];
78
82
  #labels = { ...DEFAULT_LABELS };
79
83
  #shareTargets = [];
84
+ #searchProps = {};
80
85
  #themeProps = {};
81
86
  #localeProps = {};
82
87
  #textSizeProps = {};
83
88
  #shareProps = {};
84
89
  #built = false;
85
90
  #rootEl = null;
91
+ #searchEl = null;
86
92
  #themeEl = null;
87
93
  #localeEl = null;
88
94
  #textSizeEl = null;
@@ -136,6 +142,11 @@ var PickerBar = class extends HTMLElement {
136
142
  }
137
143
  set labels(v) {
138
144
  this.#labels = v ?? { ...DEFAULT_LABELS };
145
+ if (this.#searchEl) {
146
+ this.#searchEl.label = this.#labels.search;
147
+ this.#searchEl.inputLabel = this.#labels.searchInput;
148
+ this.#searchEl.submitLabel = this.#labels.searchSubmit;
149
+ }
139
150
  if (this.#themeEl) this.#themeEl.label = this.#labels.theme;
140
151
  if (this.#localeEl) this.#localeEl.label = this.#labels.locale;
141
152
  if (this.#textSizeEl) this.#textSizeEl.label = this.#labels.textSize;
@@ -149,6 +160,13 @@ var PickerBar = class extends HTMLElement {
149
160
  this.#shareTargets = Array.isArray(v) ? v.slice() : [];
150
161
  if (this.#shareEl) this.#shareEl.targets = this.#shareTargets;
151
162
  }
163
+ get searchProps() {
164
+ return { ...this.#searchProps };
165
+ }
166
+ set searchProps(v) {
167
+ this.#searchProps = v ?? {};
168
+ if (this.#searchEl) Object.assign(this.#searchEl, this.#searchProps);
169
+ }
152
170
  get themeProps() {
153
171
  return { ...this.#themeProps };
154
172
  }
@@ -221,6 +239,12 @@ var PickerBar = class extends HTMLElement {
221
239
  const root = document.createElement("div");
222
240
  root.className = `picker-bar ${extraClass}`.trim();
223
241
  this.replaceChildren(root);
242
+ const searchEl = document.createElement("lily-search-picker");
243
+ searchEl.label = this.#labels.search;
244
+ searchEl.inputLabel = this.#labels.searchInput;
245
+ searchEl.submitLabel = this.#labels.searchSubmit;
246
+ Object.assign(searchEl, this.#searchProps);
247
+ root.appendChild(searchEl);
224
248
  const themeEl = document.createElement("lily-theme-picker");
225
249
  themeEl.label = this.#labels.theme;
226
250
  themeEl.themesUrl = this.themesUrl;
@@ -246,6 +270,7 @@ var PickerBar = class extends HTMLElement {
246
270
  Object.assign(shareEl, this.#shareProps);
247
271
  root.appendChild(shareEl);
248
272
  this.#rootEl = root;
273
+ this.#searchEl = searchEl;
249
274
  this.#themeEl = themeEl;
250
275
  this.#localeEl = localeEl;
251
276
  this.#textSizeEl = textSizeEl;
package/index.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Lily Design System™ — `<lily-picker-bar>`
2
2
 
3
- A single page-header row that composes four of the Lily
4
- [`*-picker` helpers](../index.md) — theme, locale, text size, and
5
- share — with two catalog-wide defaults pre-wired, so you can drop one
6
- custom element into a header instead of assembling and configuring
7
- four.
3
+ A single page-header row that composes five of the Lily
4
+ [`*-picker` helpers](../index.md) — search, theme, locale, text size,
5
+ and share, in that order — with two catalog-wide defaults pre-wired,
6
+ so you can drop one custom element into a header instead of
7
+ assembling and configuring five.
8
8
 
9
9
  `<lily-motion-picker>` and `<lily-date-time-picker>` are not part of
10
10
  the bar: motion has no natural spot next to the other three header
@@ -17,8 +17,8 @@ header control.
17
17
  npm install @lilydesignsystem/web-components-picker-bar
18
18
  ```
19
19
 
20
- `@lilydesignsystem/web-components-theme-picker`, `-locale-picker`,
21
- `-text-size-picker`, and `-share-picker` install automatically as
20
+ `@lilydesignsystem/web-components-search-picker`, `-theme-picker`,
21
+ `-locale-picker`, `-text-size-picker`, and `-share-picker` install automatically as
22
22
  regular dependencies — `<lily-picker-bar>` is a thin wrapper around
23
23
  them, not a reimplementation.
24
24
 
@@ -34,6 +34,9 @@ them, not a reimplementation.
34
34
  <script type="module">
35
35
  const bar = document.getElementById("header-picker-bar");
36
36
  bar.labels = {
37
+ search: "Search this site",
38
+ searchInput: "Search terms",
39
+ searchSubmit: "Search",
37
40
  theme: "Theme",
38
41
  locale: "Language",
39
42
  textSize: "Text size",
@@ -56,7 +59,8 @@ spec) — objects and functions cannot be expressed as HTML attributes
56
59
  `themes-url` (required) and `class` are plain attributes and can be
57
60
  written directly in HTML, as shown above.
58
61
 
59
- That's a complete, working header row: 45 themes, four locales, the
62
+ That's a complete, working header row: site search (a search for
63
+ `foo` goes to `/?foo`), 45 themes, four locales, the
60
64
  seven-step text-size scale, and one share destination plus
61
65
  copy-to-URL if you add `bar.shareProps = { copyLabel: "Copy link" }`.
62
66
 
@@ -86,6 +90,7 @@ Each wrapped picker takes a `*Props` bag for anything beyond what
86
90
  value, detection, a `*Labels` override map, a custom glyph:
87
91
 
88
92
  ```js
93
+ bar.searchProps = { action: "/search", placeholder: "Search…", navigate: (href) => router.push(href) };
89
94
  bar.themeProps = { storageKey: "lily-theme", detectFromSystem: true };
90
95
  bar.localeProps = { storageKey: "lily-locale", detectFromNavigator: true };
91
96
  bar.textSizeProps = { storageKey: "lily-text-size" };
@@ -99,7 +104,7 @@ for that picker.
99
104
 
100
105
  `<lily-picker-bar>` renders no CSS of its own class beyond the
101
106
  `picker-bar` root wrapper — style each child through its own
102
- package's class hooks (`theme-picker`, `locale-picker`,
107
+ package's class hooks (`search-picker`, `theme-picker`, `locale-picker`,
103
108
  `text-size-picker`, `share-picker`; see each package's own `index.md`).
104
109
  A typical header layout:
105
110
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@lilydesignsystem/web-components-picker-bar",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "engines": {
5
5
  "node": "=26"
6
6
  },
7
- "description": "Lily Design System - HTML custom element picker bar: composes lily-theme-picker, lily-locale-picker, lily-text-size-picker, and lily-share-picker into one page-header row.",
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.",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",
10
10
  "module": "./dist/index.js",
@@ -24,10 +24,11 @@
24
24
  "prepublishOnly": "cd .. && npm run build"
25
25
  },
26
26
  "dependencies": {
27
- "@lilydesignsystem/web-components-theme-picker": "^0.1.0",
28
- "@lilydesignsystem/web-components-locale-picker": "^0.1.0",
29
- "@lilydesignsystem/web-components-text-size-picker": "^0.1.0",
30
- "@lilydesignsystem/web-components-share-picker": "^0.1.0"
27
+ "@lilydesignsystem/web-components-search-picker": "^0.1.0",
28
+ "@lilydesignsystem/web-components-theme-picker": "^0.2.0",
29
+ "@lilydesignsystem/web-components-locale-picker": "^0.2.0",
30
+ "@lilydesignsystem/web-components-text-size-picker": "^0.2.0",
31
+ "@lilydesignsystem/web-components-share-picker": "^0.2.0"
31
32
  },
32
33
  "keywords": [
33
34
  "lily",
@@ -36,6 +37,7 @@
36
37
  "html",
37
38
  "picker",
38
39
  "picker-bar",
40
+ "search",
39
41
  "theme",
40
42
  "locale",
41
43
  "text-size",