@lilydesignsystem/solid-picker-bar 0.0.0-stage → 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/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ This subproject is a directory of the canonical Lily Design System™ monorepo,
4
+ and does not keep a separate change history.
5
+
6
+ **The canonical changelog is
7
+ [CHANGELOG.md](https://github.com/LilyDesignSystem/lily-design-system/blob/main/CHANGELOG.md).** It records every change to
8
+ this subproject, with reasoning, alongside the rest of the system.
9
+
10
+ Release highlights and project news: [NEWS.md](NEWS.md).
11
+
12
+ ---
13
+
14
+ Lily™ and Lily Design System™ are trademarks.
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 headless
35
+ libraries, the example applications, the helper packages, the `themes/`
36
+ 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/README.md CHANGED
@@ -1,3 +1,143 @@
1
- # Temporary Holding Version
1
+ # Lily Design System™ — Solid PickerBar
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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
+
5
+ > **Time zone picker (0.5.0).** Pass `labels.timeZone` and `timeZoneProps={{ locale: "fr" }}` (plus any `TimeZonePicker` prop, e.g. `names={zoneNamesFrom(pack)}`) to add a `time-zone-picker` — time zones by UTC offset with their full names — right after the locale picker. It renders only when both the label and the locale are given. To name the text sizes in the reader's language pass `sizeLabels` through the text-size props (`textSizeLabels(pack)` / `LocaleTranslations.TextSizeLabels(locale)` from the locale-translations package).
6
+
7
+ A single page-header row that composes five of the Lily
8
+ [`*-picker` helpers](../index.md) — search, theme, locale, text size,
9
+ and share, in that order — with two catalog-wide defaults pre-wired, so
10
+ you can drop one component into a header instead of assembling and
11
+ configuring five.
12
+
13
+ `motion-picker` and `date-time-picker` are not part of the bar: motion
14
+ has no natural spot next to the other three header preferences, and
15
+ `date-time-picker` is a form control, not a header control.
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pnpm add @lilydesignsystem/solid-picker-bar
21
+ ```
22
+
23
+ `solid-js` and `@solidjs/web` 2.0 are peer dependencies. A Solid app resolves the package's `solid` export condition and compiles the source itself; other bundlers get `dist/index.js`.
24
+
25
+ ## Usage
26
+
27
+ ```tsx
28
+ import PickerBar from "@lilydesignsystem/solid-picker-bar";
29
+
30
+ function Header() {
31
+ return (
32
+ <PickerBar
33
+ labels={{
34
+ search: "Search this site",
35
+ searchInput: "Search terms",
36
+ searchSubmit: "Search",
37
+ theme: "Theme",
38
+ locale: "Language",
39
+ textSize: "Text size",
40
+ share: "Share",
41
+ }}
42
+ themesUrl="/assets/themes/"
43
+ locales={["en", "cy", "gd", "ga"]}
44
+ shareTargets={[
45
+ {
46
+ id: "email",
47
+ label: "Email",
48
+ href: (url, title) => `mailto:?subject=${title}&body=${url}`,
49
+ },
50
+ ]}
51
+ />
52
+ );
53
+ }
54
+ ```
55
+
56
+ That's a complete, working header row: site search (a search for
57
+ `foo` goes to `/?foo`), 63 themes, four locales, the
58
+ seven-step text-size scale, and one share destination plus copy-to-URL
59
+ if you add `shareProps={{ copyLabel: "Copy link" }}`.
60
+
61
+ ## Defaults
62
+
63
+ - **`themes`** defaults to `DEFAULT_THEMES` — all 63 Lily reference
64
+ theme slugs: the 36 generic themes alphabetically, then the 27 company
65
+ and public-sector themes alphabetically by label.
66
+ `DEFAULT_THEME_LABELS` gives the names title-casing gets wrong ("IBM
67
+ Carbon", "GitHub Primer", "NHS England (patients)"); your own
68
+ `themeProps.themeLabels` win. Pass your own `themes` array to
69
+ override.
70
+ - **`sizes`** defaults to `DEFAULT_SIZES` — the seven-step scale
71
+ `largest`, `larger`, `large`, `normal`, `small`, `smaller`,
72
+ `smallest` — and the text-size picker starts on `normal`. Pass your
73
+ own `sizes` array (and `textSizeProps={{ defaultValue: "…" }}` if
74
+ you want a different starting point) to override.
75
+
76
+ Both are exported as named constants:
77
+
78
+ ```ts
79
+ import { DEFAULT_THEMES, DEFAULT_SIZES } from "@lilydesignsystem/solid-picker-bar";
80
+ ```
81
+
82
+ ## Passing extra props to one picker
83
+
84
+ Each wrapped picker takes a `*Props` bag for anything beyond what
85
+ `PickerBar` lifts to the top level — persistence, initial value,
86
+ detection, a `*Labels` override map, a custom glyph render prop:
87
+
88
+ ```tsx
89
+ <PickerBar
90
+ labels={{
91
+ search: "Search this site",
92
+ searchInput: "Search terms",
93
+ searchSubmit: "Search",
94
+ theme: "Theme",
95
+ locale: "Language",
96
+ textSize: "Text size",
97
+ share: "Share",
98
+ }}
99
+ searchProps={{ action: "/search", placeholder: "Search…" }}
100
+ themesUrl="/assets/themes/"
101
+ locales={["en", "cy"]}
102
+ themeProps={{ storageKey: "lily-theme", detectFromSystem: true }}
103
+ localeProps={{ storageKey: "lily-locale", detectFromNavigator: true }}
104
+ textSizeProps={{ storageKey: "lily-text-size" }}
105
+ shareProps={{ copyLabel: "Copy link", copiedLabel: "Copied" }}
106
+ />
107
+ ```
108
+
109
+ Anything in a `*Props` bag wins over `PickerBar`'s own default for
110
+ that picker — including overriding `themes`, `locales`, or `sizes`
111
+ per-picker if you ever needed to (you'd normally just use the
112
+ top-level prop instead).
113
+
114
+ ## Styling
115
+
116
+ `PickerBar` renders no CSS of its own class beyond the `picker-bar`
117
+ root wrapper — style each child through its own package's class hooks
118
+ (`search-picker`, `theme-picker`, `locale-picker`, `text-size-picker`,
119
+ `share-picker`;
120
+ see each package's own `index.md`). A typical header layout:
121
+
122
+ ```css
123
+ .picker-bar {
124
+ display: flex;
125
+ gap: var(--theme-space-sm, 0.5rem);
126
+ align-items: center;
127
+ }
128
+ ```
129
+
130
+ ## Accessibility
131
+
132
+ Every accessible name comes from `labels` — there is no English
133
+ default, because a set of names this catalog invented is exactly the
134
+ case the rest of Lily's i18n rule exists for. Each wrapped picker keeps
135
+ its own WAI-ARIA APG contract unchanged; see that picker's own `index.md`.
136
+
137
+ ## Full contract
138
+
139
+ See [`spec/index.md`](./spec/index.md).
140
+
141
+ ---
142
+
143
+ Lily™ and Lily Design System™ are trademarks.
package/dist/index.js ADDED
@@ -0,0 +1,262 @@
1
+ import { createComponent, insert, memo, mergeProps, spread, template } from "@solidjs/web";
2
+ import { merge, omit } from "solid-js";
3
+ import ThemePicker from "@lilydesignsystem/solid-theme-picker";
4
+ import LocalePicker from "@lilydesignsystem/solid-locale-picker";
5
+ import TextSizePicker from "@lilydesignsystem/solid-text-size-picker";
6
+ import TimeZonePicker from "@lilydesignsystem/solid-time-zone-picker";
7
+ import SharePicker from "@lilydesignsystem/solid-share-picker";
8
+ import LinkPicker from "@lilydesignsystem/solid-link-picker";
9
+ import SearchPicker from "@lilydesignsystem/solid-search-picker";
10
+ // defaults.ts
11
+ function withDefaults(defaults, props) {
12
+ const view = {};
13
+ for (const key of Object.keys(defaults)) Object.defineProperty(view, key, {
14
+ enumerable: true,
15
+ get() {
16
+ const value = props[key];
17
+ return value === void 0 ? defaults[key] : value;
18
+ }
19
+ });
20
+ return merge(props, view);
21
+ }
22
+ // PickerBar.tsx
23
+ var _tmpl$ = /* @__PURE__ */ template(`<div><!><!><!><!><!><!><!>`);
24
+ /**
25
+ * All 63 Lily reference theme slugs (see `themes/` at the repo root): the 36
26
+ * generic themes alphabetically, then the 27 themes that follow a company's
27
+ * or a public body's design system, alphabetically by their label
28
+ * (`DEFAULT_THEME_LABELS`, else the title-cased slug), so "NHS England
29
+ * (patients)" sorts under N.
30
+ */
31
+ var DEFAULT_THEMES = [
32
+ "abyss",
33
+ "acid",
34
+ "aqua",
35
+ "autumn",
36
+ "black",
37
+ "bumblebee",
38
+ "business",
39
+ "cappuccino",
40
+ "caramellatte",
41
+ "cmyk",
42
+ "coffee",
43
+ "corporate",
44
+ "cupcake",
45
+ "cyberpunk",
46
+ "dark",
47
+ "dim",
48
+ "dracula",
49
+ "emerald",
50
+ "fantasy",
51
+ "forest",
52
+ "garden",
53
+ "halloween",
54
+ "lemonade",
55
+ "light",
56
+ "lofi",
57
+ "luxury",
58
+ "night",
59
+ "nord",
60
+ "pastel",
61
+ "retro",
62
+ "silk",
63
+ "sunset",
64
+ "synthwave",
65
+ "valentine",
66
+ "winter",
67
+ "wireframe",
68
+ "adobe-spectrum",
69
+ "ant-design",
70
+ "atlassian",
71
+ "australia-agriculture-design-system",
72
+ "brazil-padrao-digital-de-governo",
73
+ "canada-government-of-canada-design-system",
74
+ "european-union-europa-component-library",
75
+ "excel",
76
+ "fluent",
77
+ "github-primer",
78
+ "united-kingdom-government-digital-service",
79
+ "ibm-carbon",
80
+ "japan-digital-agency-design-system",
81
+ "linear",
82
+ "mozilla-protocol",
83
+ "united-kingdom-national-health-service-england-for-patients",
84
+ "united-kingdom-national-health-service-england-for-practitioners",
85
+ "united-kingdom-national-health-service-scotland-for-patients",
86
+ "united-kingdom-national-health-service-scotland-for-practitioners",
87
+ "united-kingdom-national-health-service-wales-for-patients",
88
+ "united-kingdom-national-health-service-wales-for-practitioners",
89
+ "notion",
90
+ "salesforce",
91
+ "sap-fiori",
92
+ "singapore-government-design-system",
93
+ "united-states-web-design-system",
94
+ "vercel"
95
+ ];
96
+ /**
97
+ * Labels for the default themes whose title-cased slug reads wrongly: an
98
+ * abbreviation ("IBM Carbon", not "Ibm Carbon"), an accent or a small word,
99
+ * or a public body's own short name ("NHS England (patients)"). They are
100
+ * proper names, not prose to translate. A consumer's own theme labels win
101
+ * over each one.
102
+ */
103
+ var DEFAULT_THEME_LABELS = {
104
+ cmyk: "CMYK",
105
+ "brazil-padrao-digital-de-governo": "Brazil Padrão Digital de Governo",
106
+ "canada-government-of-canada-design-system": "Canada Government of Canada Design System",
107
+ "github-primer": "GitHub Primer",
108
+ "ibm-carbon": "IBM Carbon",
109
+ "sap-fiori": "SAP Fiori",
110
+ "united-kingdom-government-digital-service": "GOV.UK Design System",
111
+ "united-kingdom-national-health-service-england-for-patients": "NHS England (patients)",
112
+ "united-kingdom-national-health-service-england-for-practitioners": "NHS England (practitioners)",
113
+ "united-kingdom-national-health-service-scotland-for-patients": "NHS Scotland (patients)",
114
+ "united-kingdom-national-health-service-scotland-for-practitioners": "NHS Scotland (practitioners)",
115
+ "united-kingdom-national-health-service-wales-for-patients": "NHS Wales (patients)",
116
+ "united-kingdom-national-health-service-wales-for-practitioners": "NHS Wales (practitioners)",
117
+ "united-states-web-design-system": "U.S. Web Design System"
118
+ };
119
+ /**
120
+ * The seven-step text-size scale. Each slug title-cases to exactly the
121
+ * requested label ("largest" → "Largest", …) via `text-size-picker`'s
122
+ * own default `labelFor`, so no `sizeLabels` override is needed either.
123
+ */
124
+ var DEFAULT_SIZES = [
125
+ "largest",
126
+ "larger",
127
+ "large",
128
+ "normal",
129
+ "small",
130
+ "smaller",
131
+ "smallest"
132
+ ];
133
+ function PickerBar(props) {
134
+ const p = withDefaults({
135
+ links: [],
136
+ linkProps: {},
137
+ searchProps: {},
138
+ themes: DEFAULT_THEMES,
139
+ themeProps: {},
140
+ localeProps: {},
141
+ timeZoneProps: {},
142
+ sizes: DEFAULT_SIZES,
143
+ textSizeProps: {},
144
+ shareTargets: [],
145
+ shareProps: {},
146
+ class: ""
147
+ }, props);
148
+ const restProps = omit(p, "labels", "links", "linkProps", "searchProps", "themesUrl", "themes", "themeProps", "locales", "localeProps", "timeZoneProps", "sizes", "textSizeProps", "shareTargets", "shareProps", "class");
149
+ var _el$ = _tmpl$();
150
+ var _el$2 = _el$.firstChild;
151
+ var _el$3 = _el$2.nextSibling;
152
+ var _el$4 = _el$3.nextSibling;
153
+ var _el$5 = _el$4.nextSibling;
154
+ var _el$6 = _el$5.nextSibling;
155
+ var _el$7 = _el$6.nextSibling;
156
+ var _el$8 = _el$7.nextSibling;
157
+ spread(_el$, [{ get "class"() {
158
+ return `picker-bar ${p.class}`.trim();
159
+ } }, restProps], true);
160
+ insert(_el$, (() => {
161
+ var _c$ = memo(() => {
162
+ return !!(p.links.length > 0 && p.labels.link);
163
+ });
164
+ return () => {
165
+ return _c$() ? createComponent(LinkPicker, mergeProps({
166
+ get label() {
167
+ return p.labels.link;
168
+ },
169
+ get links() {
170
+ return p.links;
171
+ }
172
+ }, () => {
173
+ return p.linkProps;
174
+ })) : null;
175
+ };
176
+ })(), _el$2);
177
+ insert(_el$, (() => {
178
+ var _c$2 = memo(() => {
179
+ return !!p.labels.search;
180
+ });
181
+ return () => {
182
+ return _c$2() ? createComponent(SearchPicker, mergeProps({
183
+ get label() {
184
+ return p.labels.search;
185
+ },
186
+ get inputLabel() {
187
+ return p.labels.searchInput ?? "";
188
+ },
189
+ get submitLabel() {
190
+ return p.labels.searchSubmit ?? "";
191
+ }
192
+ }, () => {
193
+ return p.searchProps;
194
+ })) : null;
195
+ };
196
+ })(), _el$3);
197
+ insert(_el$, createComponent(ThemePicker, mergeProps({
198
+ get label() {
199
+ return p.labels.theme;
200
+ },
201
+ get themesUrl() {
202
+ return p.themesUrl;
203
+ },
204
+ get themes() {
205
+ return p.themes;
206
+ }
207
+ }, () => {
208
+ return p.themeProps;
209
+ }, { get themeLabels() {
210
+ return {
211
+ ...DEFAULT_THEME_LABELS,
212
+ ...p.themeProps?.themeLabels ?? {}
213
+ };
214
+ } })), _el$4);
215
+ insert(_el$, createComponent(LocalePicker, mergeProps({
216
+ get label() {
217
+ return p.labels.locale;
218
+ },
219
+ get locales() {
220
+ return p.locales;
221
+ }
222
+ }, () => {
223
+ return p.localeProps;
224
+ })), _el$5);
225
+ insert(_el$, (() => {
226
+ var _c$3 = memo(() => {
227
+ return !!(p.labels.timeZone && p.timeZoneProps.locale);
228
+ });
229
+ return () => {
230
+ return _c$3() ? createComponent(TimeZonePicker, mergeProps(() => {
231
+ return p.timeZoneProps;
232
+ }, { get label() {
233
+ return p.labels.timeZone;
234
+ } })) : null;
235
+ };
236
+ })(), _el$6);
237
+ insert(_el$, createComponent(TextSizePicker, mergeProps({
238
+ get label() {
239
+ return p.labels.textSize;
240
+ },
241
+ get sizes() {
242
+ return p.sizes;
243
+ },
244
+ defaultValue: "normal"
245
+ }, () => {
246
+ return p.textSizeProps;
247
+ })), _el$7);
248
+ insert(_el$, createComponent(SharePicker, mergeProps({
249
+ get label() {
250
+ return p.labels.share;
251
+ },
252
+ get targets() {
253
+ return p.shareTargets;
254
+ }
255
+ }, () => {
256
+ return p.shareProps;
257
+ })), _el$8);
258
+ return _el$;
259
+ }
260
+ export { DEFAULT_SIZES, DEFAULT_THEMES, PickerBar, PickerBar as default };
261
+
262
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["<LinkPicker\n label={p.labels.link}\n links={p.links}\n {...p.linkProps}\n />","<div\n class={`picker-bar ${p.class}`.trim()}\n {...restProps}\n >\n {p.links.length > 0 && p.labels.link ? (\n <LinkPicker\n label={p.labels.link}\n links={p.links}\n {...p.linkProps}\n />\n ) : null}\n {p.labels.search ? (\n <SearchPicker\n label={p.labels.search}\n inputLabel={p.labels.searchInput ?? \"\"}\n submitLabel={p.labels.searchSubmit ?? \"\"}\n {...p.searchProps}\n />\n ) : null}\n <ThemePicker\n label={p.labels.theme}\n themesUrl={p.themesUrl}\n themes={p.themes}\n {...p.themeProps}\n themeLabels={{ ...DEFAULT_THEME_LABELS, ...(p.themeProps?.themeLabels ?? {}) }}\n />\n <LocalePicker\n label={p.labels.locale}\n locales={p.locales}\n {...p.localeProps}\n />\n {p.labels.timeZone && p.timeZoneProps.locale ? (\n <TimeZonePicker\n {...(p.timeZoneProps as TimeZonePickerProps)}\n label={p.labels.timeZone}\n />\n ) : null}\n <TextSizePicker\n label={p.labels.textSize}\n sizes={p.sizes}\n defaultValue=\"normal\"\n {...p.textSizeProps}\n />\n <SharePicker\n label={p.labels.share}\n targets={p.shareTargets}\n {...p.shareProps}\n />\n </div>","<SearchPicker\n label={p.labels.search}\n inputLabel={p.labels.searchInput ?? \"\"}\n submitLabel={p.labels.searchSubmit ?? \"\"}\n {...p.searchProps}\n />","<ThemePicker\n label={p.labels.theme}\n themesUrl={p.themesUrl}\n themes={p.themes}\n {...p.themeProps}\n themeLabels={{ ...DEFAULT_THEME_LABELS, ...(p.themeProps?.themeLabels ?? {}) }}\n />","<LocalePicker\n label={p.labels.locale}\n locales={p.locales}\n {...p.localeProps}\n />","<TimeZonePicker\n {...(p.timeZoneProps as TimeZonePickerProps)}\n label={p.labels.timeZone}\n />","<TextSizePicker\n label={p.labels.textSize}\n sizes={p.sizes}\n defaultValue=\"normal\"\n {...p.textSizeProps}\n />","defaultValue=\"normal\"","<SharePicker\n label={p.labels.share}\n targets={p.shareTargets}\n {...p.shareProps}\n />"],"sources":["../defaults.ts","../PickerBar.tsx"],"sourcesContent":["// withDefaults — Solid's merge(), with the default applying when a prop is undefined, as in the other catalogs.\n//\n// Solid 2's merge(defaults, props) lets an explicit `undefined` win: <Button type={maybeType} /> with maybeType\n// undefined would render no type at all, and a button with no type in a form submits it. React's destructuring\n// defaults, Svelte's and Vue's default props all treat undefined as \"not given\", and so does this. Each default key\n// becomes a getter that reads the prop and falls back to the default; every other prop reads through unchanged, so\n// the result stays reactive and works with omit().\nimport { merge, type Merge } from \"solid-js\";\n\nexport function withDefaults<D extends object, P extends object>(\n defaults: D,\n props: P,\n): Merge<[D, P]> {\n const view = {};\n for (const key of Object.keys(defaults)) {\n Object.defineProperty(view, key, {\n enumerable: true,\n get() {\n const value = (props as Record<string, unknown>)[key];\n return value === undefined ? (defaults as Record<string, unknown>)[key] : value;\n },\n });\n }\n return merge(props, view) as unknown as Merge<[D, P]>;\n}\n","import type { JSX } from \"@solidjs/web\";\nimport { omit } from \"solid-js\";\nimport { withDefaults } from \"./defaults\";\nimport ThemePicker, { type Props as ThemePickerProps } from \"@lilydesignsystem/solid-theme-picker\";\nimport LocalePicker, {\n type Props as LocalePickerProps,\n} from \"@lilydesignsystem/solid-locale-picker\";\nimport TextSizePicker, {\n type Props as TextSizePickerProps,\n} from \"@lilydesignsystem/solid-text-size-picker\";\nimport TimeZonePicker, {\n type Props as TimeZonePickerProps,\n} from \"@lilydesignsystem/solid-time-zone-picker\";\nimport SharePicker, {\n type Props as SharePickerProps,\n type ShareTarget,\n} from \"@lilydesignsystem/solid-share-picker\";\nimport LinkPicker, {\n type Props as LinkPickerProps,\n type LinkItem,\n} from \"@lilydesignsystem/solid-link-picker\";\nimport SearchPicker, {\n type Props as SearchPickerProps,\n} from \"@lilydesignsystem/solid-search-picker\";\n\n/**\n * All 63 Lily reference theme slugs (see `themes/` at the repo root): the 36\n * generic themes alphabetically, then the 27 themes that follow a company's\n * or a public body's design system, alphabetically by their label\n * (`DEFAULT_THEME_LABELS`, else the title-cased slug), so \"NHS England\n * (patients)\" sorts under N.\n */\nexport const DEFAULT_THEMES: string[] = [\n \"abyss\",\n \"acid\",\n \"aqua\",\n \"autumn\",\n \"black\",\n \"bumblebee\",\n \"business\",\n \"cappuccino\",\n \"caramellatte\",\n \"cmyk\",\n \"coffee\",\n \"corporate\",\n \"cupcake\",\n \"cyberpunk\",\n \"dark\",\n \"dim\",\n \"dracula\",\n \"emerald\",\n \"fantasy\",\n \"forest\",\n \"garden\",\n \"halloween\",\n \"lemonade\",\n \"light\",\n \"lofi\",\n \"luxury\",\n \"night\",\n \"nord\",\n \"pastel\",\n \"retro\",\n \"silk\",\n \"sunset\",\n \"synthwave\",\n \"valentine\",\n \"winter\",\n \"wireframe\",\n \"adobe-spectrum\",\n \"ant-design\",\n \"atlassian\",\n \"australia-agriculture-design-system\",\n \"brazil-padrao-digital-de-governo\",\n \"canada-government-of-canada-design-system\",\n \"european-union-europa-component-library\",\n \"excel\",\n \"fluent\",\n \"github-primer\",\n \"united-kingdom-government-digital-service\",\n \"ibm-carbon\",\n \"japan-digital-agency-design-system\",\n \"linear\",\n \"mozilla-protocol\",\n \"united-kingdom-national-health-service-england-for-patients\",\n \"united-kingdom-national-health-service-england-for-practitioners\",\n \"united-kingdom-national-health-service-scotland-for-patients\",\n \"united-kingdom-national-health-service-scotland-for-practitioners\",\n \"united-kingdom-national-health-service-wales-for-patients\",\n \"united-kingdom-national-health-service-wales-for-practitioners\",\n \"notion\",\n \"salesforce\",\n \"sap-fiori\",\n \"singapore-government-design-system\",\n \"united-states-web-design-system\",\n \"vercel\",\n];\n\n/**\n * Labels for the default themes whose title-cased slug reads wrongly: an\n * abbreviation (\"IBM Carbon\", not \"Ibm Carbon\"), an accent or a small word,\n * or a public body's own short name (\"NHS England (patients)\"). They are\n * proper names, not prose to translate. A consumer's own theme labels win\n * over each one.\n */\nexport const DEFAULT_THEME_LABELS: Record<string, string> = {\n cmyk: \"CMYK\",\n \"brazil-padrao-digital-de-governo\": \"Brazil Padrão Digital de Governo\",\n \"canada-government-of-canada-design-system\": \"Canada Government of Canada Design System\",\n \"github-primer\": \"GitHub Primer\",\n \"ibm-carbon\": \"IBM Carbon\",\n \"sap-fiori\": \"SAP Fiori\",\n \"united-kingdom-government-digital-service\": \"GOV.UK Design System\",\n \"united-kingdom-national-health-service-england-for-patients\": \"NHS England (patients)\",\n \"united-kingdom-national-health-service-england-for-practitioners\":\n \"NHS England (practitioners)\",\n \"united-kingdom-national-health-service-scotland-for-patients\": \"NHS Scotland (patients)\",\n \"united-kingdom-national-health-service-scotland-for-practitioners\":\n \"NHS Scotland (practitioners)\",\n \"united-kingdom-national-health-service-wales-for-patients\": \"NHS Wales (patients)\",\n \"united-kingdom-national-health-service-wales-for-practitioners\": \"NHS Wales (practitioners)\",\n \"united-states-web-design-system\": \"U.S. Web Design System\",\n};\n\n/**\n * The seven-step text-size scale. Each slug title-cases to exactly the\n * requested label (\"largest\" → \"Largest\", …) via `text-size-picker`'s\n * own default `labelFor`, so no `sizeLabels` override is needed either.\n */\nexport const DEFAULT_SIZES: string[] = [\n \"largest\",\n \"larger\",\n \"large\",\n \"normal\",\n \"small\",\n \"smaller\",\n \"smallest\",\n];\n\n/** Accessible names for the five pickers. Required — no English default. */\nexport type PickerBarLabels = {\n /**\n * Accessible name for the link picker's button and list. Needed only when `links` is\n * supplied; the link picker renders only when both are present.\n */\n link?: string;\n /**\n * Accessible name for the search picker's button and search landmark. Optional: omitted or empty, the bar has no search\n * picker (a client-side app whose search would navigate away from its state can leave it out). When given, `searchInput`\n * and `searchSubmit` are needed too.\n */\n search?: string;\n /** Accessible name for the search picker's text field. */\n searchInput?: string;\n /** Accessible name for the search picker's ⏎ submit button. */\n searchSubmit?: string;\n /** Accessible name for the theme picker's button and listbox. */\n theme: string;\n /** Accessible name for the locale picker's button and listbox. */\n locale: string;\n /** Accessible name for the text-size picker's button and listbox. */\n textSize: string;\n /**\n * Accessible name for the time-zone picker's button and listbox. Needed only when\n * `timeZoneProps.locale` is supplied; the time-zone picker renders only when both are present.\n */\n timeZone?: string;\n /** Accessible name for the share picker's button and list. */\n share: string;\n};\n\n/** Public props for PickerBar. See `spec/index.md` §4 for the contract. */\nexport type Props = Omit<JSX.HTMLAttributes<HTMLDivElement>, \"children\"> & {\n /** Accessible names for each picker. */\n labels: PickerBarLabels;\n\n /** Page links for the link picker (a home icon), which renders FIRST — leftmost. Omitted or empty: no link picker. */\n links?: LinkItem[];\n /** Extra LinkPicker props (e.g. `navigate`, `onNavigate`), spread after this bar's own. */\n linkProps?: Partial<Omit<LinkPickerProps, \"label\" | \"links\">>;\n\n /** Extra SearchPicker props (e.g. `action`, `navigate`, `placeholder`), spread after this bar's own. */\n searchProps?: Partial<Omit<SearchPickerProps, \"label\" | \"inputLabel\" | \"submitLabel\">>;\n\n /** Base URL of the themes directory, forwarded to ThemePicker. */\n themesUrl: string;\n /** Available theme slugs. Defaults to {@link DEFAULT_THEMES}. */\n themes?: string[];\n /** Extra ThemePicker props, spread after this bar's own. */\n themeProps?: Partial<Omit<ThemePickerProps, \"themesUrl\" | \"themes\">>;\n\n /** Available locale codes. No catalog default exists — supply the set you support. */\n locales: string[];\n /** Extra LocalePicker props, spread after this bar's own. */\n localeProps?: Partial<Omit<LocalePickerProps, \"locales\">>;\n\n /**\n * Extra TimeZonePicker props, spread after this bar's own. `locale` (the language that names and sorts\n * the zones) is required for the time-zone picker to render, which sits after the locale picker.\n */\n timeZoneProps?: Partial<Omit<TimeZonePickerProps, \"label\">>;\n\n /** Available size slugs. Defaults to {@link DEFAULT_SIZES}. */\n sizes?: string[];\n /** Extra TextSizePicker props, spread after this bar's own. */\n textSizeProps?: Partial<Omit<TextSizePickerProps, \"sizes\">>;\n\n /** Destinations offered by the share picker. Empty is valid if `shareProps.copyLabel` is set. */\n shareTargets?: ShareTarget[];\n /** Extra SharePicker props, spread after this bar's own. */\n shareProps?: Partial<Omit<SharePickerProps, \"targets\">>;\n\n /** Extra CSS class on the root. */\n class?: string;\n};\n\nexport function PickerBar(props: Props): JSX.Element {\n const p = withDefaults(\n {\n links: [] as NonNullable<Props[\"links\"]>,\n linkProps: {} as NonNullable<Props[\"linkProps\"]>,\n searchProps: {} as NonNullable<Props[\"searchProps\"]>,\n themes: DEFAULT_THEMES,\n themeProps: {} as NonNullable<Props[\"themeProps\"]>,\n localeProps: {} as NonNullable<Props[\"localeProps\"]>,\n timeZoneProps: {} as NonNullable<Props[\"timeZoneProps\"]>,\n sizes: DEFAULT_SIZES,\n textSizeProps: {} as NonNullable<Props[\"textSizeProps\"]>,\n shareTargets: [] as NonNullable<Props[\"shareTargets\"]>,\n shareProps: {} as NonNullable<Props[\"shareProps\"]>,\n class: \"\" as const,\n },\n props,\n );\n const restProps = omit(\n p,\n \"labels\",\n \"links\",\n \"linkProps\",\n \"searchProps\",\n \"themesUrl\",\n \"themes\",\n \"themeProps\",\n \"locales\",\n \"localeProps\",\n \"timeZoneProps\",\n \"sizes\",\n \"textSizeProps\",\n \"shareTargets\",\n \"shareProps\",\n \"class\",\n );\n return (\n <div\n class={`picker-bar ${p.class}`.trim()}\n {...restProps}\n >\n {p.links.length > 0 && p.labels.link ? (\n <LinkPicker\n label={p.labels.link}\n links={p.links}\n {...p.linkProps}\n />\n ) : null}\n {p.labels.search ? (\n <SearchPicker\n label={p.labels.search}\n inputLabel={p.labels.searchInput ?? \"\"}\n submitLabel={p.labels.searchSubmit ?? \"\"}\n {...p.searchProps}\n />\n ) : null}\n <ThemePicker\n label={p.labels.theme}\n themesUrl={p.themesUrl}\n themes={p.themes}\n {...p.themeProps}\n themeLabels={{ ...DEFAULT_THEME_LABELS, ...(p.themeProps?.themeLabels ?? {}) }}\n />\n <LocalePicker\n label={p.labels.locale}\n locales={p.locales}\n {...p.localeProps}\n />\n {p.labels.timeZone && p.timeZoneProps.locale ? (\n <TimeZonePicker\n {...(p.timeZoneProps as TimeZonePickerProps)}\n label={p.labels.timeZone}\n />\n ) : null}\n <TextSizePicker\n label={p.labels.textSize}\n sizes={p.sizes}\n defaultValue=\"normal\"\n {...p.textSizeProps}\n />\n <SharePicker\n label={p.labels.share}\n targets={p.shareTargets}\n {...p.shareProps}\n />\n </div>\n );\n}\n\nexport default PickerBar;\n"],"mappings":";;;;;;;;;;AASA,SAAgB,aACZ,UACA,OACa;CACb,MAAM,OAAO,CAAC;CACd,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GAClC,OAAO,eAAe,MAAM,KAAK;EAC7B,YAAY;EACZ,MAAM;GACF,MAAM,QAAS,MAAkC;GACjD,OAAO,UAAU,KAAA,IAAa,SAAqC,OAAO;EAC9E;CACJ,CAAC;CAEL,OAAO,MAAM,OAAO,IAAI;AAC5B;;;;;;;;;;ACQA,IAAa,iBAA2B;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;;;;;;AASA,IAAa,uBAA+C;CACxD,MAAM;CACN,oCAAoC;CACpC,6CAA6C;CAC7C,iBAAiB;CACjB,cAAc;CACd,aAAa;CACb,6CAA6C;CAC7C,+DAA+D;CAC/D,oEACI;CACJ,gEAAgE;CAChE,qEACI;CACJ,6DAA6D;CAC7D,kEAAkE;CAClE,mCAAmC;AACvC;;;;;;AAOA,IAAa,gBAA0B;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AA+EA,SAAgB,UAAU,OAA2B;CACjD,MAAM,IAAI,aACN;EACI,OAAO,CAAC;EACR,WAAW,CAAC;EACZ,aAAa,CAAC;EACd,QAAQ;EACR,YAAY,CAAC;EACb,aAAa,CAAC;EACd,eAAe,CAAC;EAChB,OAAO;EACP,eAAe,CAAC;EAChB,cAAc,CAAC;EACf,YAAY,CAAC;EACb,OAAO;CACX,GACA,KACJ;CACA,MAAM,YAAY,KACd,GACA,UACA,SACA,aACA,eACA,aACA,UACA,cACA,WACA,eACA,iBACA,SACA,iBACA,gBACA,cACA,OACJ;CAEI,IAAA,OAAA,OAgDK;CAhDL,IAAA,QAAA,KAAA;;;;;;;CAEI,OAAA,MAAA,CAAA,EADA,IAAA,UAAA;EAAO,OAAA,cAAc,EAAE,QAAQ,KAAK;CAAC,EACxB,GAAT,SAAA,GAAA,IAAA;CAFR,OAAA,aAII;;GAAC,OAAA,CAAA,EAAA,EAAE,MAAM,SAAS,KAAK,EAAE,OAAO;EAMxB,CAAA;EANR,aAAA;GAMQ,OAAA,IAAA,IALJA,gBAAAA,YAAAA,WAAAA;IACI,IAAA,QAAA;KAAO,OAAA,EAAE,OAAO;IAAI;IACpB,IAAA,QAAA;KAAO,OAAA,EAAE;IAAK;GAEjB,SADG;IAAI,OAAA,EAAE;GAAS,CAClB,CAAA,IACD;EAAI;CAAC,EAAA,CAAD,GAVZC,KAgDK;CAhDL,OAAA,aAWI;;GAAC,OAAA,CAAA,CAAA,EAAE,OAAO;EAOF,CAAA;EAPR,aAAA;GAOQ,OAAA,KAAA,IANJC,gBAAAA,cAAAA,WAAAA;IACI,IAAA,QAAA;KAAO,OAAA,EAAE,OAAO;IAAM;IACtB,IAAA,aAAA;KAAY,OAAA,EAAE,OAAO,eAAe;IAAE;IACtC,IAAA,cAAA;KAAa,OAAA,EAAE,OAAO,gBAAgB;IAAE;GAE3C,SADG;IAAI,OAAA,EAAE;GAAW,CACpB,CAAA,IACD;EAAI;CAAC,EAAA,CAAD,GAlBZD,KAgDK;CAhDL,OAAA,MAmBIE,gBAAAA,aAAAA,WAAAA;EACI,IAAA,QAAA;GAAO,OAAA,EAAE,OAAO;EAAK;EACrB,IAAA,YAAA;GAAW,OAAA,EAAE;EAAS;EACtB,IAAA,SAAA;GAAQ,OAAA,EAAE;EAAM;CAGnB,SAFG;EAAI,OAAA,EAAE;CAAU,GAJpB,EAKI,IAAA,cAAA;EAAa,OAAA;GAAE,GAAG;GAAsB,GAAI,EAAE,YAAY,eAAe,CAAC;EAAG;CAAC,EACjF,CAAA,CAAA,GAzBLF,KAgDK;CAhDL,OAAA,MA0BIG,gBAAAA,cAAAA,WAAAA;EACI,IAAA,QAAA;GAAO,OAAA,EAAE,OAAO;EAAM;EACtB,IAAA,UAAA;GAAS,OAAA,EAAE;EAAO;CAErB,SADG;EAAI,OAAA,EAAE;CAAW,CACpB,CAAA,GA9BLH,KAgDK;CAhDL,OAAA,aA+BI;;GAAC,OAAA,CAAA,EAAA,EAAE,OAAO,YAAY,EAAE,cAAc;EAK9B,CAAA;EALR,aAAA;GAKQ,OAAA,KAAA,IAJJI,gBAAAA,gBAAAA,iBACI;IAAK,OAAA,EAAE;GAAqC,GADhD,EAEI,IAAA,QAAA;IAAO,OAAA,EAAE,OAAO;GAAQ,EAC3B,CAAA,CAAA,IACD;EAAI;CAAC,EAAA,CAAD,GApCZJ,KAgDK;CAhDL,OAAA,MAqCIK,gBAAAA,gBAAAA,WAAAA;EACI,IAAA,QAAA;GAAO,OAAA,EAAE,OAAO;EAAQ;EACxB,IAAA,QAAA;GAAO,OAAA,EAAE;EAAK;EACdC,cAAa;CAEhB,SADG;EAAI,OAAA,EAAE;CAAa,CACtB,CAAA,GA1CLN,KAgDK;CAhDL,OAAA,MA2CIO,gBAAAA,aAAAA,WAAAA;EACI,IAAA,QAAA;GAAO,OAAA,EAAE,OAAO;EAAK;EACrB,IAAA,UAAA;GAAS,OAAA,EAAE;EAAY;CAE1B,SADG;EAAI,OAAA,EAAE;CAAU,CACnB,CAAA,GA/CLP,KAgDK;CAjDT,OACIA;AAkDR"}
@@ -0,0 +1,99 @@
1
+ import type { JSX } from "@solidjs/web";
2
+ import { type Props as ThemePickerProps } from "@lilydesignsystem/solid-theme-picker";
3
+ import { type Props as LocalePickerProps } from "@lilydesignsystem/solid-locale-picker";
4
+ import { type Props as TextSizePickerProps } from "@lilydesignsystem/solid-text-size-picker";
5
+ import { type Props as TimeZonePickerProps } from "@lilydesignsystem/solid-time-zone-picker";
6
+ import { type Props as SharePickerProps, type ShareTarget } from "@lilydesignsystem/solid-share-picker";
7
+ import { type Props as LinkPickerProps, type LinkItem } from "@lilydesignsystem/solid-link-picker";
8
+ import { type Props as SearchPickerProps } from "@lilydesignsystem/solid-search-picker";
9
+ /**
10
+ * All 63 Lily reference theme slugs (see `themes/` at the repo root): the 36
11
+ * generic themes alphabetically, then the 27 themes that follow a company's
12
+ * or a public body's design system, alphabetically by their label
13
+ * (`DEFAULT_THEME_LABELS`, else the title-cased slug), so "NHS England
14
+ * (patients)" sorts under N.
15
+ */
16
+ export declare const DEFAULT_THEMES: string[];
17
+ /**
18
+ * Labels for the default themes whose title-cased slug reads wrongly: an
19
+ * abbreviation ("IBM Carbon", not "Ibm Carbon"), an accent or a small word,
20
+ * or a public body's own short name ("NHS England (patients)"). They are
21
+ * proper names, not prose to translate. A consumer's own theme labels win
22
+ * over each one.
23
+ */
24
+ export declare const DEFAULT_THEME_LABELS: Record<string, string>;
25
+ /**
26
+ * The seven-step text-size scale. Each slug title-cases to exactly the
27
+ * requested label ("largest" → "Largest", …) via `text-size-picker`'s
28
+ * own default `labelFor`, so no `sizeLabels` override is needed either.
29
+ */
30
+ export declare const DEFAULT_SIZES: string[];
31
+ /** Accessible names for the five pickers. Required — no English default. */
32
+ export type PickerBarLabels = {
33
+ /**
34
+ * Accessible name for the link picker's button and list. Needed only when `links` is
35
+ * supplied; the link picker renders only when both are present.
36
+ */
37
+ link?: string;
38
+ /**
39
+ * Accessible name for the search picker's button and search landmark. Optional: omitted or empty, the bar has no search
40
+ * picker (a client-side app whose search would navigate away from its state can leave it out). When given, `searchInput`
41
+ * and `searchSubmit` are needed too.
42
+ */
43
+ search?: string;
44
+ /** Accessible name for the search picker's text field. */
45
+ searchInput?: string;
46
+ /** Accessible name for the search picker's ⏎ submit button. */
47
+ searchSubmit?: string;
48
+ /** Accessible name for the theme picker's button and listbox. */
49
+ theme: string;
50
+ /** Accessible name for the locale picker's button and listbox. */
51
+ locale: string;
52
+ /** Accessible name for the text-size picker's button and listbox. */
53
+ textSize: string;
54
+ /**
55
+ * Accessible name for the time-zone picker's button and listbox. Needed only when
56
+ * `timeZoneProps.locale` is supplied; the time-zone picker renders only when both are present.
57
+ */
58
+ timeZone?: string;
59
+ /** Accessible name for the share picker's button and list. */
60
+ share: string;
61
+ };
62
+ /** Public props for PickerBar. See `spec/index.md` §4 for the contract. */
63
+ export type Props = Omit<JSX.HTMLAttributes<HTMLDivElement>, "children"> & {
64
+ /** Accessible names for each picker. */
65
+ labels: PickerBarLabels;
66
+ /** Page links for the link picker (a home icon), which renders FIRST — leftmost. Omitted or empty: no link picker. */
67
+ links?: LinkItem[];
68
+ /** Extra LinkPicker props (e.g. `navigate`, `onNavigate`), spread after this bar's own. */
69
+ linkProps?: Partial<Omit<LinkPickerProps, "label" | "links">>;
70
+ /** Extra SearchPicker props (e.g. `action`, `navigate`, `placeholder`), spread after this bar's own. */
71
+ searchProps?: Partial<Omit<SearchPickerProps, "label" | "inputLabel" | "submitLabel">>;
72
+ /** Base URL of the themes directory, forwarded to ThemePicker. */
73
+ themesUrl: string;
74
+ /** Available theme slugs. Defaults to {@link DEFAULT_THEMES}. */
75
+ themes?: string[];
76
+ /** Extra ThemePicker props, spread after this bar's own. */
77
+ themeProps?: Partial<Omit<ThemePickerProps, "themesUrl" | "themes">>;
78
+ /** Available locale codes. No catalog default exists — supply the set you support. */
79
+ locales: string[];
80
+ /** Extra LocalePicker props, spread after this bar's own. */
81
+ localeProps?: Partial<Omit<LocalePickerProps, "locales">>;
82
+ /**
83
+ * Extra TimeZonePicker props, spread after this bar's own. `locale` (the language that names and sorts
84
+ * the zones) is required for the time-zone picker to render, which sits after the locale picker.
85
+ */
86
+ timeZoneProps?: Partial<Omit<TimeZonePickerProps, "label">>;
87
+ /** Available size slugs. Defaults to {@link DEFAULT_SIZES}. */
88
+ sizes?: string[];
89
+ /** Extra TextSizePicker props, spread after this bar's own. */
90
+ textSizeProps?: Partial<Omit<TextSizePickerProps, "sizes">>;
91
+ /** Destinations offered by the share picker. Empty is valid if `shareProps.copyLabel` is set. */
92
+ shareTargets?: ShareTarget[];
93
+ /** Extra SharePicker props, spread after this bar's own. */
94
+ shareProps?: Partial<Omit<SharePickerProps, "targets">>;
95
+ /** Extra CSS class on the root. */
96
+ class?: string;
97
+ };
98
+ export declare function PickerBar(props: Props): JSX.Element;
99
+ export default PickerBar;
@@ -0,0 +1,145 @@
1
+ import { omit } from "solid-js";
2
+ import { withDefaults } from "./defaults";
3
+ import ThemePicker from "@lilydesignsystem/solid-theme-picker";
4
+ import LocalePicker from "@lilydesignsystem/solid-locale-picker";
5
+ import TextSizePicker from "@lilydesignsystem/solid-text-size-picker";
6
+ import TimeZonePicker from "@lilydesignsystem/solid-time-zone-picker";
7
+ import SharePicker from "@lilydesignsystem/solid-share-picker";
8
+ import LinkPicker from "@lilydesignsystem/solid-link-picker";
9
+ import SearchPicker from "@lilydesignsystem/solid-search-picker";
10
+ /**
11
+ * All 63 Lily reference theme slugs (see `themes/` at the repo root): the 36
12
+ * generic themes alphabetically, then the 27 themes that follow a company's
13
+ * or a public body's design system, alphabetically by their label
14
+ * (`DEFAULT_THEME_LABELS`, else the title-cased slug), so "NHS England
15
+ * (patients)" sorts under N.
16
+ */
17
+ export const DEFAULT_THEMES = [
18
+ "abyss",
19
+ "acid",
20
+ "aqua",
21
+ "autumn",
22
+ "black",
23
+ "bumblebee",
24
+ "business",
25
+ "cappuccino",
26
+ "caramellatte",
27
+ "cmyk",
28
+ "coffee",
29
+ "corporate",
30
+ "cupcake",
31
+ "cyberpunk",
32
+ "dark",
33
+ "dim",
34
+ "dracula",
35
+ "emerald",
36
+ "fantasy",
37
+ "forest",
38
+ "garden",
39
+ "halloween",
40
+ "lemonade",
41
+ "light",
42
+ "lofi",
43
+ "luxury",
44
+ "night",
45
+ "nord",
46
+ "pastel",
47
+ "retro",
48
+ "silk",
49
+ "sunset",
50
+ "synthwave",
51
+ "valentine",
52
+ "winter",
53
+ "wireframe",
54
+ "adobe-spectrum",
55
+ "ant-design",
56
+ "atlassian",
57
+ "australia-agriculture-design-system",
58
+ "brazil-padrao-digital-de-governo",
59
+ "canada-government-of-canada-design-system",
60
+ "european-union-europa-component-library",
61
+ "excel",
62
+ "fluent",
63
+ "github-primer",
64
+ "united-kingdom-government-digital-service",
65
+ "ibm-carbon",
66
+ "japan-digital-agency-design-system",
67
+ "linear",
68
+ "mozilla-protocol",
69
+ "united-kingdom-national-health-service-england-for-patients",
70
+ "united-kingdom-national-health-service-england-for-practitioners",
71
+ "united-kingdom-national-health-service-scotland-for-patients",
72
+ "united-kingdom-national-health-service-scotland-for-practitioners",
73
+ "united-kingdom-national-health-service-wales-for-patients",
74
+ "united-kingdom-national-health-service-wales-for-practitioners",
75
+ "notion",
76
+ "salesforce",
77
+ "sap-fiori",
78
+ "singapore-government-design-system",
79
+ "united-states-web-design-system",
80
+ "vercel",
81
+ ];
82
+ /**
83
+ * Labels for the default themes whose title-cased slug reads wrongly: an
84
+ * abbreviation ("IBM Carbon", not "Ibm Carbon"), an accent or a small word,
85
+ * or a public body's own short name ("NHS England (patients)"). They are
86
+ * proper names, not prose to translate. A consumer's own theme labels win
87
+ * over each one.
88
+ */
89
+ export const DEFAULT_THEME_LABELS = {
90
+ cmyk: "CMYK",
91
+ "brazil-padrao-digital-de-governo": "Brazil Padrão Digital de Governo",
92
+ "canada-government-of-canada-design-system": "Canada Government of Canada Design System",
93
+ "github-primer": "GitHub Primer",
94
+ "ibm-carbon": "IBM Carbon",
95
+ "sap-fiori": "SAP Fiori",
96
+ "united-kingdom-government-digital-service": "GOV.UK Design System",
97
+ "united-kingdom-national-health-service-england-for-patients": "NHS England (patients)",
98
+ "united-kingdom-national-health-service-england-for-practitioners": "NHS England (practitioners)",
99
+ "united-kingdom-national-health-service-scotland-for-patients": "NHS Scotland (patients)",
100
+ "united-kingdom-national-health-service-scotland-for-practitioners": "NHS Scotland (practitioners)",
101
+ "united-kingdom-national-health-service-wales-for-patients": "NHS Wales (patients)",
102
+ "united-kingdom-national-health-service-wales-for-practitioners": "NHS Wales (practitioners)",
103
+ "united-states-web-design-system": "U.S. Web Design System",
104
+ };
105
+ /**
106
+ * The seven-step text-size scale. Each slug title-cases to exactly the
107
+ * requested label ("largest" → "Largest", …) via `text-size-picker`'s
108
+ * own default `labelFor`, so no `sizeLabels` override is needed either.
109
+ */
110
+ export const DEFAULT_SIZES = [
111
+ "largest",
112
+ "larger",
113
+ "large",
114
+ "normal",
115
+ "small",
116
+ "smaller",
117
+ "smallest",
118
+ ];
119
+ export function PickerBar(props) {
120
+ const p = withDefaults({
121
+ links: [],
122
+ linkProps: {},
123
+ searchProps: {},
124
+ themes: DEFAULT_THEMES,
125
+ themeProps: {},
126
+ localeProps: {},
127
+ timeZoneProps: {},
128
+ sizes: DEFAULT_SIZES,
129
+ textSizeProps: {},
130
+ shareTargets: [],
131
+ shareProps: {},
132
+ class: "",
133
+ }, props);
134
+ const restProps = omit(p, "labels", "links", "linkProps", "searchProps", "themesUrl", "themes", "themeProps", "locales", "localeProps", "timeZoneProps", "sizes", "textSizeProps", "shareTargets", "shareProps", "class");
135
+ return (<div class={`picker-bar ${p.class}`.trim()} {...restProps}>
136
+ {p.links.length > 0 && p.labels.link ? (<LinkPicker label={p.labels.link} links={p.links} {...p.linkProps}/>) : null}
137
+ {p.labels.search ? (<SearchPicker label={p.labels.search} inputLabel={p.labels.searchInput ?? ""} submitLabel={p.labels.searchSubmit ?? ""} {...p.searchProps}/>) : null}
138
+ <ThemePicker label={p.labels.theme} themesUrl={p.themesUrl} themes={p.themes} {...p.themeProps} themeLabels={{ ...DEFAULT_THEME_LABELS, ...(p.themeProps?.themeLabels ?? {}) }}/>
139
+ <LocalePicker label={p.labels.locale} locales={p.locales} {...p.localeProps}/>
140
+ {p.labels.timeZone && p.timeZoneProps.locale ? (<TimeZonePicker {...p.timeZoneProps} label={p.labels.timeZone}/>) : null}
141
+ <TextSizePicker label={p.labels.textSize} sizes={p.sizes} defaultValue="normal" {...p.textSizeProps}/>
142
+ <SharePicker label={p.labels.share} targets={p.shareTargets} {...p.shareProps}/>
143
+ </div>);
144
+ }
145
+ export default PickerBar;
@@ -0,0 +1,2 @@
1
+ import { type Merge } from "solid-js";
2
+ export declare function withDefaults<D extends object, P extends object>(defaults: D, props: P): Merge<[D, P]>;
@@ -0,0 +1,21 @@
1
+ // withDefaults — Solid's merge(), with the default applying when a prop is undefined, as in the other catalogs.
2
+ //
3
+ // Solid 2's merge(defaults, props) lets an explicit `undefined` win: <Button type={maybeType} /> with maybeType
4
+ // undefined would render no type at all, and a button with no type in a form submits it. React's destructuring
5
+ // defaults, Svelte's and Vue's default props all treat undefined as "not given", and so does this. Each default key
6
+ // becomes a getter that reads the prop and falls back to the default; every other prop reads through unchanged, so
7
+ // the result stays reactive and works with omit().
8
+ import { merge } from "solid-js";
9
+ export function withDefaults(defaults, props) {
10
+ const view = {};
11
+ for (const key of Object.keys(defaults)) {
12
+ Object.defineProperty(view, key, {
13
+ enumerable: true,
14
+ get() {
15
+ const value = props[key];
16
+ return value === undefined ? defaults[key] : value;
17
+ },
18
+ });
19
+ }
20
+ return merge(props, view);
21
+ }
@@ -0,0 +1,2 @@
1
+ export { default, PickerBar, DEFAULT_THEMES, DEFAULT_SIZES } from "./PickerBar";
2
+ export type { Props, PickerBarLabels } from "./PickerBar";
@@ -0,0 +1 @@
1
+ export { default, PickerBar, DEFAULT_THEMES, DEFAULT_SIZES } from "./PickerBar";
@@ -0,0 +1 @@
1
+ export declare function act<T>(step: () => T): T;
@@ -0,0 +1,17 @@
1
+ // act — run a test step, then flush Solid's pending updates.
2
+ //
3
+ // The React tests wrap state changes in act(); Solid has no act, but its updates are batched until flush(). This keeps
4
+ // the ported tests' act(() => …) calls meaning the same thing: the step has run and the DOM is up to date afterwards.
5
+ // A step that returns a promise is awaited before the flush.
6
+ import { flush } from "solid-js";
7
+ export function act(step) {
8
+ const result = step();
9
+ if (result instanceof Promise) {
10
+ return result.then((value) => {
11
+ flush();
12
+ return value;
13
+ });
14
+ }
15
+ flush();
16
+ return result;
17
+ }
@@ -0,0 +1,4 @@
1
+ import { fireEvent as baseFireEvent } from "@solidjs/testing-library";
2
+ export * from "@solidjs/testing-library";
3
+ type FireEvent = typeof baseFireEvent;
4
+ export declare const fireEvent: FireEvent;
@@ -0,0 +1,19 @@
1
+ // test-utils — @solidjs/testing-library with a fireEvent that flushes.
2
+ //
3
+ // Solid 2 batches updates until flush() (or the next microtask). React's fireEvent runs inside act(), so a ported test
4
+ // that asserts straight after fireEvent expects the DOM already updated. This fireEvent dispatches, then flushes, so
5
+ // the ported assertions keep their meaning. userEvent is async and needs no help.
6
+ import { fireEvent as baseFireEvent } from "@solidjs/testing-library";
7
+ import { flush } from "solid-js";
8
+ export * from "@solidjs/testing-library";
9
+ function flushed(fn) {
10
+ return ((...args) => {
11
+ const result = fn(...args);
12
+ flush();
13
+ return result;
14
+ });
15
+ }
16
+ export const fireEvent = Object.assign(flushed(baseFireEvent), Object.fromEntries(Object.entries(baseFireEvent).map(([name, fn]) => [
17
+ name,
18
+ flushed(fn),
19
+ ])));
package/index.md ADDED
@@ -0,0 +1,143 @@
1
+ # Lily Design System™ — Solid PickerBar
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
+
5
+ > **Time zone picker (0.5.0).** Pass `labels.timeZone` and `timeZoneProps={{ locale: "fr" }}` (plus any `TimeZonePicker` prop, e.g. `names={zoneNamesFrom(pack)}`) to add a `time-zone-picker` — time zones by UTC offset with their full names — right after the locale picker. It renders only when both the label and the locale are given. To name the text sizes in the reader's language pass `sizeLabels` through the text-size props (`textSizeLabels(pack)` / `LocaleTranslations.TextSizeLabels(locale)` from the locale-translations package).
6
+
7
+ A single page-header row that composes five of the Lily
8
+ [`*-picker` helpers](../index.md) — search, theme, locale, text size,
9
+ and share, in that order — with two catalog-wide defaults pre-wired, so
10
+ you can drop one component into a header instead of assembling and
11
+ configuring five.
12
+
13
+ `motion-picker` and `date-time-picker` are not part of the bar: motion
14
+ has no natural spot next to the other three header preferences, and
15
+ `date-time-picker` is a form control, not a header control.
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pnpm add @lilydesignsystem/solid-picker-bar
21
+ ```
22
+
23
+ `solid-js` and `@solidjs/web` 2.0 are peer dependencies. A Solid app resolves the package's `solid` export condition and compiles the source itself; other bundlers get `dist/index.js`.
24
+
25
+ ## Usage
26
+
27
+ ```tsx
28
+ import PickerBar from "@lilydesignsystem/solid-picker-bar";
29
+
30
+ function Header() {
31
+ return (
32
+ <PickerBar
33
+ labels={{
34
+ search: "Search this site",
35
+ searchInput: "Search terms",
36
+ searchSubmit: "Search",
37
+ theme: "Theme",
38
+ locale: "Language",
39
+ textSize: "Text size",
40
+ share: "Share",
41
+ }}
42
+ themesUrl="/assets/themes/"
43
+ locales={["en", "cy", "gd", "ga"]}
44
+ shareTargets={[
45
+ {
46
+ id: "email",
47
+ label: "Email",
48
+ href: (url, title) => `mailto:?subject=${title}&body=${url}`,
49
+ },
50
+ ]}
51
+ />
52
+ );
53
+ }
54
+ ```
55
+
56
+ That's a complete, working header row: site search (a search for
57
+ `foo` goes to `/?foo`), 63 themes, four locales, the
58
+ seven-step text-size scale, and one share destination plus copy-to-URL
59
+ if you add `shareProps={{ copyLabel: "Copy link" }}`.
60
+
61
+ ## Defaults
62
+
63
+ - **`themes`** defaults to `DEFAULT_THEMES` — all 63 Lily reference
64
+ theme slugs: the 36 generic themes alphabetically, then the 27 company
65
+ and public-sector themes alphabetically by label.
66
+ `DEFAULT_THEME_LABELS` gives the names title-casing gets wrong ("IBM
67
+ Carbon", "GitHub Primer", "NHS England (patients)"); your own
68
+ `themeProps.themeLabels` win. Pass your own `themes` array to
69
+ override.
70
+ - **`sizes`** defaults to `DEFAULT_SIZES` — the seven-step scale
71
+ `largest`, `larger`, `large`, `normal`, `small`, `smaller`,
72
+ `smallest` — and the text-size picker starts on `normal`. Pass your
73
+ own `sizes` array (and `textSizeProps={{ defaultValue: "…" }}` if
74
+ you want a different starting point) to override.
75
+
76
+ Both are exported as named constants:
77
+
78
+ ```ts
79
+ import { DEFAULT_THEMES, DEFAULT_SIZES } from "@lilydesignsystem/solid-picker-bar";
80
+ ```
81
+
82
+ ## Passing extra props to one picker
83
+
84
+ Each wrapped picker takes a `*Props` bag for anything beyond what
85
+ `PickerBar` lifts to the top level — persistence, initial value,
86
+ detection, a `*Labels` override map, a custom glyph render prop:
87
+
88
+ ```tsx
89
+ <PickerBar
90
+ labels={{
91
+ search: "Search this site",
92
+ searchInput: "Search terms",
93
+ searchSubmit: "Search",
94
+ theme: "Theme",
95
+ locale: "Language",
96
+ textSize: "Text size",
97
+ share: "Share",
98
+ }}
99
+ searchProps={{ action: "/search", placeholder: "Search…" }}
100
+ themesUrl="/assets/themes/"
101
+ locales={["en", "cy"]}
102
+ themeProps={{ storageKey: "lily-theme", detectFromSystem: true }}
103
+ localeProps={{ storageKey: "lily-locale", detectFromNavigator: true }}
104
+ textSizeProps={{ storageKey: "lily-text-size" }}
105
+ shareProps={{ copyLabel: "Copy link", copiedLabel: "Copied" }}
106
+ />
107
+ ```
108
+
109
+ Anything in a `*Props` bag wins over `PickerBar`'s own default for
110
+ that picker — including overriding `themes`, `locales`, or `sizes`
111
+ per-picker if you ever needed to (you'd normally just use the
112
+ top-level prop instead).
113
+
114
+ ## Styling
115
+
116
+ `PickerBar` renders no CSS of its own class beyond the `picker-bar`
117
+ root wrapper — style each child through its own package's class hooks
118
+ (`search-picker`, `theme-picker`, `locale-picker`, `text-size-picker`,
119
+ `share-picker`;
120
+ see each package's own `index.md`). A typical header layout:
121
+
122
+ ```css
123
+ .picker-bar {
124
+ display: flex;
125
+ gap: var(--theme-space-sm, 0.5rem);
126
+ align-items: center;
127
+ }
128
+ ```
129
+
130
+ ## Accessibility
131
+
132
+ Every accessible name comes from `labels` — there is no English
133
+ default, because a set of names this catalog invented is exactly the
134
+ case the rest of Lily's i18n rule exists for. Each wrapped picker keeps
135
+ its own WAI-ARIA APG contract unchanged; see that picker's own `index.md`.
136
+
137
+ ## Full contract
138
+
139
+ See [`spec/index.md`](./spec/index.md).
140
+
141
+ ---
142
+
143
+ Lily™ and Lily Design System™ are trademarks.
package/package.json CHANGED
@@ -1,6 +1,86 @@
1
1
  {
2
2
  "name": "@lilydesignsystem/solid-picker-bar",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "engines": {
5
+ "node": ">=26"
6
+ },
7
+ "description": "Lily Design System Solid picker bar: composes link-picker (optional), search-picker, theme-picker, locale-picker, time-zone-picker (optional), text-size-picker, and share-picker into one page-header row. Headless, SSR-safe, no CSS.",
8
+ "type": "module",
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/source/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/source/index.d.ts",
15
+ "solid": "./dist/source/index.js",
16
+ "import": "./dist/index.js",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "index.md",
23
+ "README.md",
24
+ "CHANGELOG.md"
25
+ ],
26
+ "sideEffects": false,
27
+ "scripts": {
28
+ "build": "node build.mjs",
29
+ "prepublishOnly": "node build.mjs",
30
+ "test": "vitest run",
31
+ "check": "tsc --noEmit",
32
+ "test:watch": "vitest"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/LilyDesignSystem/lily-design-system.git",
37
+ "directory": "lily-design-system-solid-picker-bar"
38
+ },
39
+ "keywords": [
40
+ "design",
41
+ "lily",
42
+ "locale",
43
+ "picker",
44
+ "picker-bar",
45
+ "search",
46
+ "share",
47
+ "solid",
48
+ "solidjs",
49
+ "system",
50
+ "text-size",
51
+ "theme"
52
+ ],
53
+ "author": "Joel Parker Henderson <joel@joelparkerhenderson.com>",
54
+ "license": "MIT OR Apache-2.0 OR GPL-2.0-only OR GPL-3.0-only OR BSD-3-Clause",
55
+ "bugs": {
56
+ "url": "https://github.com/LilyDesignSystem/lily-design-system/issues"
57
+ },
58
+ "homepage": "https://lilydesignsystem.com/",
59
+ "dependencies": {
60
+ "@lilydesignsystem/solid-link-picker": "^0.1.0",
61
+ "@lilydesignsystem/solid-locale-picker": "^0.1.0",
62
+ "@lilydesignsystem/solid-search-picker": "^0.1.0",
63
+ "@lilydesignsystem/solid-share-picker": "^0.1.0",
64
+ "@lilydesignsystem/solid-text-size-picker": "^0.1.0",
65
+ "@lilydesignsystem/solid-theme-picker": "^0.1.0",
66
+ "@lilydesignsystem/solid-time-zone-picker": "^0.1.0"
67
+ },
68
+ "peerDependencies": {
69
+ "@solidjs/web": "^2.0.0",
70
+ "solid-js": "^2.0.0"
71
+ },
72
+ "devDependencies": {
73
+ "@babel/core": "^8.1.2",
74
+ "@solidjs/babel-plugin": "^2.0.0",
75
+ "@solidjs/testing-library": "1.0.0-rc.2",
76
+ "@solidjs/vite-plugin": "^3.0.0",
77
+ "@solidjs/web": "^2.0.0",
78
+ "@testing-library/user-event": "^14.6.11",
79
+ "@types/node": "^26.6.6",
80
+ "jsdom": "^31.0.1",
81
+ "solid-js": "^2.0.0",
82
+ "typescript": "^5.9.3",
83
+ "vite": "^8.3.8",
84
+ "vitest": "^5.1.0"
85
+ }
86
+ }