@lilydesignsystem/html-picker-bar 0.2.0 → 0.4.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/LICENSE.md +64 -0
- package/dist/index.d.ts +18 -2
- package/dist/index.js +45 -2
- package/index.md +2 -0
- package/package.json +14 -4
package/LICENSE.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!-- Synced from the canonical repository by bin/sync-special-files.
|
|
2
|
+
Do not edit here; edit the root copy and re-run the script.
|
|
3
|
+
Canonical: https://github.com/LilyDesignSystem/lily-design-system/blob/main/LICENSE.md -->
|
|
4
|
+
|
|
5
|
+
# License
|
|
6
|
+
|
|
7
|
+
Lily Design System™ is free open source software.
|
|
8
|
+
|
|
9
|
+
License is any of these, at your option, or contact us for custom license options.
|
|
10
|
+
|
|
11
|
+
* [MIT](https://opensource.org/license/mit) ([SPDX: MIT](https://spdx.org/licenses/MIT.html))
|
|
12
|
+
|
|
13
|
+
* [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) ([SPDX: Apache-2.0](https://spdx.org/licenses/Apache-2.0.html))
|
|
14
|
+
|
|
15
|
+
* [GNU General Public License v2.0](https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html) ([SPDX: GPL-2.0-only](https://spdx.org/licenses/GPL-2.0-only.html))
|
|
16
|
+
|
|
17
|
+
* [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0-standalone.html) ([SPDX: GPL-3.0-only](https://spdx.org/licenses/GPL-3.0-only.html))
|
|
18
|
+
|
|
19
|
+
* [BSD 3-Clause License](https://opensource.org/license/bsd-3-clause) ([SPDX: BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html))
|
|
20
|
+
|
|
21
|
+
## SPDX
|
|
22
|
+
|
|
23
|
+
The machine-readable expression for the choice above is:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
SPDX-License-Identifier: MIT OR Apache-2.0 OR GPL-2.0-only OR GPL-3.0-only OR BSD-3-Clause
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Every package manifest in this repository should carry that expression, or a
|
|
30
|
+
single identifier from the list where the packaging format does not accept a
|
|
31
|
+
disjunction. You do not need permission to pick one: choose whichever member of
|
|
32
|
+
the list suits your project and comply with that one.
|
|
33
|
+
|
|
34
|
+
This applies to the whole repository — the component catalog, the seven headless
|
|
35
|
+
libraries, the seven example applications, the seven helper catalogs, the
|
|
36
|
+
`themes/` stylesheets, the `bin/` tooling, and the documentation.
|
|
37
|
+
|
|
38
|
+
## Scope note
|
|
39
|
+
|
|
40
|
+
This file supersedes an earlier `CC BY-NC-SA` notice. That notice was a content
|
|
41
|
+
license with a non-commercial clause, it was not an open-source license, and it
|
|
42
|
+
contradicted both the specification and the published packages. It should not be
|
|
43
|
+
relied on. If you obtained Lily under it and that raises a question for you,
|
|
44
|
+
contact <joel@joelparkerhenderson.com>.
|
|
45
|
+
|
|
46
|
+
## Trademarks
|
|
47
|
+
|
|
48
|
+
Lily™ and Lily Design System™ are trademarks. The trademarks are distinct from
|
|
49
|
+
the software license: a trademark claim (™) asserts use of the marks and is
|
|
50
|
+
independent of the licenses above. A license to the software is not a license to
|
|
51
|
+
the marks.
|
|
52
|
+
|
|
53
|
+
You may say your project uses Lily, is built with Lily, or is compatible with
|
|
54
|
+
Lily. Please do not use the marks as the name of your fork or product, or in a
|
|
55
|
+
way that suggests affiliation or endorsement. For any use beyond that, contact
|
|
56
|
+
<joel@joelparkerhenderson.com>.
|
|
57
|
+
|
|
58
|
+
## Third-party references
|
|
59
|
+
|
|
60
|
+
Lily's example applications and `themes/` stylesheets take visual reference from
|
|
61
|
+
public-sector design systems including NHS UK, GOV.UK, and USWDS. Lily is not
|
|
62
|
+
affiliated with, endorsed by, or connected to any of those organisations. Their
|
|
63
|
+
names and marks belong to them, and this license grants nothing in respect of
|
|
64
|
+
them.
|
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';
|
|
@@ -21,7 +22,7 @@ export { ShareTarget } from '@lilydesignsystem/html-share-picker';
|
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
|
-
* All
|
|
25
|
+
* All 57 Lily reference theme slugs (see `themes/` at the repo root),
|
|
25
26
|
* sorted alphabetically except the United Kingdom and United States
|
|
26
27
|
* government/public-sector themes, which sort last as one alphabetical
|
|
27
28
|
* group of their own. Mirrors `theme-picker`'s own title-casing of each
|
|
@@ -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
|
|
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
|
+
// 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";
|
|
@@ -8,11 +9,14 @@ var DEFAULT_THEMES = [
|
|
|
8
9
|
"abyss",
|
|
9
10
|
"acid",
|
|
10
11
|
"adobe-spectrum",
|
|
12
|
+
"ant-design",
|
|
11
13
|
"aqua",
|
|
14
|
+
"atlassian",
|
|
12
15
|
"autumn",
|
|
13
16
|
"black",
|
|
14
17
|
"bumblebee",
|
|
15
18
|
"business",
|
|
19
|
+
"cappuccino",
|
|
16
20
|
"caramellatte",
|
|
17
21
|
"cmyk",
|
|
18
22
|
"coffee",
|
|
@@ -23,23 +27,32 @@ var DEFAULT_THEMES = [
|
|
|
23
27
|
"dim",
|
|
24
28
|
"dracula",
|
|
25
29
|
"emerald",
|
|
30
|
+
"excel",
|
|
26
31
|
"fantasy",
|
|
32
|
+
"fluent",
|
|
27
33
|
"forest",
|
|
28
34
|
"garden",
|
|
35
|
+
"github-primer",
|
|
29
36
|
"halloween",
|
|
37
|
+
"ibm-carbon",
|
|
30
38
|
"lemonade",
|
|
31
39
|
"light",
|
|
40
|
+
"linear",
|
|
32
41
|
"lofi",
|
|
33
42
|
"luxury",
|
|
34
43
|
"mozilla-protocol",
|
|
35
44
|
"night",
|
|
36
45
|
"nord",
|
|
46
|
+
"notion",
|
|
37
47
|
"pastel",
|
|
38
48
|
"retro",
|
|
49
|
+
"salesforce",
|
|
50
|
+
"sap-fiori",
|
|
39
51
|
"silk",
|
|
40
52
|
"sunset",
|
|
41
53
|
"synthwave",
|
|
42
54
|
"valentine",
|
|
55
|
+
"vercel",
|
|
43
56
|
"winter",
|
|
44
57
|
"wireframe",
|
|
45
58
|
"united-kingdom-government-digital-service",
|
|
@@ -82,6 +95,8 @@ var PickerBar = class extends HTMLElement {
|
|
|
82
95
|
#locales = [];
|
|
83
96
|
#sizes = DEFAULT_SIZES;
|
|
84
97
|
#shareTargets = [];
|
|
98
|
+
#links = [];
|
|
99
|
+
#linkProps = {};
|
|
85
100
|
#searchProps = {};
|
|
86
101
|
#themeProps = {};
|
|
87
102
|
#localeProps = {};
|
|
@@ -89,6 +104,7 @@ var PickerBar = class extends HTMLElement {
|
|
|
89
104
|
#shareProps = {};
|
|
90
105
|
// Rendered-DOM references. Null until #render() has run.
|
|
91
106
|
#rootEl = null;
|
|
107
|
+
#linkPickerEl = null;
|
|
92
108
|
#searchPickerEl = null;
|
|
93
109
|
#themePickerEl = null;
|
|
94
110
|
#localePickerEl = null;
|
|
@@ -151,6 +167,20 @@ var PickerBar = class extends HTMLElement {
|
|
|
151
167
|
this.#shareTargets = Array.isArray(v) ? v.slice() : [];
|
|
152
168
|
this.#render();
|
|
153
169
|
}
|
|
170
|
+
get links() {
|
|
171
|
+
return [...this.#links];
|
|
172
|
+
}
|
|
173
|
+
set links(v) {
|
|
174
|
+
this.#links = Array.isArray(v) ? v.slice() : [];
|
|
175
|
+
this.#render();
|
|
176
|
+
}
|
|
177
|
+
get linkProps() {
|
|
178
|
+
return this.#linkProps;
|
|
179
|
+
}
|
|
180
|
+
set linkProps(v) {
|
|
181
|
+
this.#linkProps = v ?? {};
|
|
182
|
+
this.#render();
|
|
183
|
+
}
|
|
154
184
|
get searchProps() {
|
|
155
185
|
return this.#searchProps;
|
|
156
186
|
}
|
|
@@ -186,6 +216,10 @@ var PickerBar = class extends HTMLElement {
|
|
|
186
216
|
this.#shareProps = v ?? {};
|
|
187
217
|
this.#render();
|
|
188
218
|
}
|
|
219
|
+
/** The rendered `<link-picker>` instance, once connected (null when no links). */
|
|
220
|
+
get linkPicker() {
|
|
221
|
+
return this.#linkPickerEl;
|
|
222
|
+
}
|
|
189
223
|
/** The rendered `<search-picker>` instance, once connected. */
|
|
190
224
|
get searchPicker() {
|
|
191
225
|
return this.#searchPickerEl;
|
|
@@ -244,6 +278,15 @@ var PickerBar = class extends HTMLElement {
|
|
|
244
278
|
const extraClass = this.getAttribute("class") ?? "";
|
|
245
279
|
const root = document.createElement("div");
|
|
246
280
|
root.className = `picker-bar ${extraClass}`.trim();
|
|
281
|
+
this.#linkPickerEl = null;
|
|
282
|
+
if (this.#links.length > 0 && this.#labels.link) {
|
|
283
|
+
const linkEl = document.createElement("link-picker");
|
|
284
|
+
linkEl.label = this.#labels.link;
|
|
285
|
+
linkEl.links = this.#links;
|
|
286
|
+
Object.assign(linkEl, this.#linkProps);
|
|
287
|
+
root.appendChild(linkEl);
|
|
288
|
+
this.#linkPickerEl = linkEl;
|
|
289
|
+
}
|
|
247
290
|
const searchEl = document.createElement("search-picker");
|
|
248
291
|
searchEl.label = this.#labels.search;
|
|
249
292
|
searchEl.inputLabel = this.#labels.searchInput;
|
|
@@ -287,7 +330,7 @@ function parseCsv(s) {
|
|
|
287
330
|
return s.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
288
331
|
}
|
|
289
332
|
|
|
290
|
-
//
|
|
333
|
+
// index.ts
|
|
291
334
|
if (typeof customElements !== "undefined" && !customElements.get("picker-bar")) {
|
|
292
335
|
customElements.define("picker-bar", PickerBar);
|
|
293
336
|
}
|
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.
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -21,15 +21,25 @@
|
|
|
21
21
|
"README.md"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"
|
|
24
|
+
"build": "node build.js",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"test:watch": "vitest",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
25
28
|
},
|
|
26
29
|
"dependencies": {
|
|
30
|
+
"@lilydesignsystem/html-link-picker": "^0.1.0",
|
|
27
31
|
"@lilydesignsystem/html-search-picker": "^0.1.0",
|
|
28
32
|
"@lilydesignsystem/html-theme-picker": "^0.2.0",
|
|
29
33
|
"@lilydesignsystem/html-locale-picker": "^0.2.0",
|
|
30
34
|
"@lilydesignsystem/html-text-size-picker": "^0.2.0",
|
|
31
35
|
"@lilydesignsystem/html-share-picker": "^0.2.0"
|
|
32
36
|
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"jsdom": "^30.1.1",
|
|
39
|
+
"tsup": "^8.5.1",
|
|
40
|
+
"typescript": "^5.9.3",
|
|
41
|
+
"vitest": "^5.0.3"
|
|
42
|
+
},
|
|
33
43
|
"keywords": [
|
|
34
44
|
"lily",
|
|
35
45
|
"design",
|
|
@@ -47,7 +57,7 @@
|
|
|
47
57
|
"license": "MIT OR Apache-2.0 OR GPL-2.0-only OR GPL-3.0-only OR BSD-3-Clause",
|
|
48
58
|
"repository": {
|
|
49
59
|
"type": "git",
|
|
50
|
-
"url": "git+https://github.com/LilyDesignSystem/lily-design-system
|
|
60
|
+
"url": "git+https://github.com/LilyDesignSystem/lily-design-system.git",
|
|
51
61
|
"directory": "lily-design-system-html-picker-bar"
|
|
52
62
|
},
|
|
53
63
|
"homepage": "https://lilydesignsystem.com/",
|