@lilydesignsystem/nunjucks-picker-bar 0.1.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.
@@ -0,0 +1,142 @@
1
+ import { initThemePicker } from '@lilydesignsystem/nunjucks-theme-picker';
2
+ export { autoInit as autoInitThemePicker } from '@lilydesignsystem/nunjucks-theme-picker';
3
+ import { initLocalePicker } from '@lilydesignsystem/nunjucks-locale-picker';
4
+ export { autoInit as autoInitLocalePicker } from '@lilydesignsystem/nunjucks-locale-picker';
5
+ import { initTextSizePicker } from '@lilydesignsystem/nunjucks-text-size-picker';
6
+ export { autoInit as autoInitTextSizePicker } from '@lilydesignsystem/nunjucks-text-size-picker';
7
+ import { initSharePicker } from '@lilydesignsystem/nunjucks-share-picker';
8
+ export { autoInit as autoInitSharePicker } from '@lilydesignsystem/nunjucks-share-picker';
9
+
10
+ // PickerBar client-side runtime.
11
+ //
12
+ // Pairs with picker-bar.njk. Unlike every other helper in this catalog,
13
+ // this module owns NO lifecycle of its own: theme-picker.client.js,
14
+ // locale-picker.client.js, text-size-picker.client.js, and
15
+ // share-picker.client.js already own theirs, in full, independently of
16
+ // nesting (each scans the document for its own `data-lily-*-picker-root`
17
+ // hook). This module is a convenience wrapper that wires all four at
18
+ // once, scoped to one `picker-bar` root, instead of requiring the
19
+ // consumer to call four separate `init*Picker` functions.
20
+ //
21
+ // See spec/index.md §4.3 (client.js exports), §5 (behaviour).
22
+
23
+
24
+ /**
25
+ * All 45 Lily reference theme slugs, in the same order as
26
+ * `DEFAULT_THEMES` in picker-bar.njk. A Nunjucks macro cannot import a
27
+ * JS constant, so the two copies are held in agreement by a test
28
+ * rather than by delegation — the same pattern this catalog already
29
+ * uses for `themeName`/`sizeName` (macro template syntax vs. client.js
30
+ * function).
31
+ */
32
+ const DEFAULT_THEMES = [
33
+ "abyss",
34
+ "acid",
35
+ "adobe-spectrum",
36
+ "aqua",
37
+ "autumn",
38
+ "black",
39
+ "bumblebee",
40
+ "business",
41
+ "caramellatte",
42
+ "cmyk",
43
+ "coffee",
44
+ "corporate",
45
+ "cupcake",
46
+ "cyberpunk",
47
+ "dark",
48
+ "dim",
49
+ "dracula",
50
+ "emerald",
51
+ "fantasy",
52
+ "forest",
53
+ "garden",
54
+ "halloween",
55
+ "lemonade",
56
+ "light",
57
+ "lofi",
58
+ "luxury",
59
+ "mozilla-protocol",
60
+ "night",
61
+ "nord",
62
+ "pastel",
63
+ "retro",
64
+ "silk",
65
+ "sunset",
66
+ "synthwave",
67
+ "valentine",
68
+ "winter",
69
+ "wireframe",
70
+ "united-kingdom-government-digital-service",
71
+ "united-kingdom-national-health-service-england-for-patients",
72
+ "united-kingdom-national-health-service-england-for-practitioners",
73
+ "united-kingdom-national-health-service-scotland-for-patients",
74
+ "united-kingdom-national-health-service-scotland-for-practitioners",
75
+ "united-kingdom-national-health-service-wales-for-patients",
76
+ "united-kingdom-national-health-service-wales-for-practitioners",
77
+ "united-states-web-design-system",
78
+ ];
79
+
80
+ /** The seven-step text-size scale, largest first. */
81
+ const DEFAULT_SIZES = [
82
+ "largest",
83
+ "larger",
84
+ "large",
85
+ "normal",
86
+ "small",
87
+ "smaller",
88
+ "smallest",
89
+ ];
90
+
91
+ /**
92
+ * Wire the four pickers inside one `[data-lily-picker-bar-root]`
93
+ * element. Each nested picker root is found and handed to its own
94
+ * sibling package's `init*Picker(root, opts)` — no different from
95
+ * calling all four by hand, just in one call.
96
+ *
97
+ * @param {HTMLElement} root
98
+ * @param {{themeProps?: object, localeProps?: object, textSizeProps?: object, shareProps?: object}=} opts
99
+ */
100
+ function initPickerBar(root, opts = {}) {
101
+ if (!root) {
102
+ return { theme: null, locale: null, textSize: null, share: null };
103
+ }
104
+ const {
105
+ themeProps = {},
106
+ localeProps = {},
107
+ textSizeProps = {},
108
+ shareProps = {},
109
+ } = opts;
110
+
111
+ const themeRoot = root.querySelector("[data-lily-theme-picker-root]");
112
+ const localeRoot = root.querySelector("[data-lily-locale-picker-root]");
113
+ const textSizeRoot = root.querySelector(
114
+ "[data-lily-text-size-picker-root]",
115
+ );
116
+ const shareRoot = root.querySelector("[data-lily-share-picker-root]");
117
+
118
+ return {
119
+ theme: themeRoot ? initThemePicker(themeRoot, themeProps) : null,
120
+ locale: localeRoot ? initLocalePicker(localeRoot, localeProps) : null,
121
+ textSize: textSizeRoot
122
+ ? initTextSizePicker(textSizeRoot, textSizeProps)
123
+ : null,
124
+ share: shareRoot ? initSharePicker(shareRoot, shareProps) : null,
125
+ };
126
+ }
127
+
128
+ /**
129
+ * Find every `[data-lily-picker-bar-root]` and wire it.
130
+ *
131
+ * @param {{themeProps?: object, localeProps?: object, textSizeProps?: object, shareProps?: object}=} opts
132
+ * @returns {Array<ReturnType<typeof initPickerBar>>}
133
+ */
134
+ function autoInit(opts = {}) {
135
+ if (typeof document === "undefined") return [];
136
+ const roots = Array.from(
137
+ document.querySelectorAll("[data-lily-picker-bar-root]"),
138
+ );
139
+ return roots.map((root) => initPickerBar(root, opts));
140
+ }
141
+
142
+ export { DEFAULT_SIZES, DEFAULT_THEMES, autoInit, initPickerBar };
package/dist/index.js ADDED
@@ -0,0 +1,113 @@
1
+ // lily-design-system-nunjucks-picker-bar/picker-bar.client.js
2
+ import {
3
+ initThemePicker,
4
+ autoInit as autoInitThemePicker
5
+ } from "@lilydesignsystem/nunjucks-theme-picker";
6
+ import {
7
+ initLocalePicker,
8
+ autoInit as autoInitLocalePicker
9
+ } from "@lilydesignsystem/nunjucks-locale-picker";
10
+ import {
11
+ initTextSizePicker,
12
+ autoInit as autoInitTextSizePicker
13
+ } from "@lilydesignsystem/nunjucks-text-size-picker";
14
+ import {
15
+ initSharePicker,
16
+ autoInit as autoInitSharePicker
17
+ } from "@lilydesignsystem/nunjucks-share-picker";
18
+ var DEFAULT_THEMES = [
19
+ "abyss",
20
+ "acid",
21
+ "adobe-spectrum",
22
+ "aqua",
23
+ "autumn",
24
+ "black",
25
+ "bumblebee",
26
+ "business",
27
+ "caramellatte",
28
+ "cmyk",
29
+ "coffee",
30
+ "corporate",
31
+ "cupcake",
32
+ "cyberpunk",
33
+ "dark",
34
+ "dim",
35
+ "dracula",
36
+ "emerald",
37
+ "fantasy",
38
+ "forest",
39
+ "garden",
40
+ "halloween",
41
+ "lemonade",
42
+ "light",
43
+ "lofi",
44
+ "luxury",
45
+ "mozilla-protocol",
46
+ "night",
47
+ "nord",
48
+ "pastel",
49
+ "retro",
50
+ "silk",
51
+ "sunset",
52
+ "synthwave",
53
+ "valentine",
54
+ "winter",
55
+ "wireframe",
56
+ "united-kingdom-government-digital-service",
57
+ "united-kingdom-national-health-service-england-for-patients",
58
+ "united-kingdom-national-health-service-england-for-practitioners",
59
+ "united-kingdom-national-health-service-scotland-for-patients",
60
+ "united-kingdom-national-health-service-scotland-for-practitioners",
61
+ "united-kingdom-national-health-service-wales-for-patients",
62
+ "united-kingdom-national-health-service-wales-for-practitioners",
63
+ "united-states-web-design-system"
64
+ ];
65
+ var DEFAULT_SIZES = [
66
+ "largest",
67
+ "larger",
68
+ "large",
69
+ "normal",
70
+ "small",
71
+ "smaller",
72
+ "smallest"
73
+ ];
74
+ function initPickerBar(root, opts = {}) {
75
+ if (!root) {
76
+ return { theme: null, locale: null, textSize: null, share: null };
77
+ }
78
+ const {
79
+ themeProps = {},
80
+ localeProps = {},
81
+ textSizeProps = {},
82
+ shareProps = {}
83
+ } = opts;
84
+ const themeRoot = root.querySelector("[data-lily-theme-picker-root]");
85
+ const localeRoot = root.querySelector("[data-lily-locale-picker-root]");
86
+ const textSizeRoot = root.querySelector(
87
+ "[data-lily-text-size-picker-root]"
88
+ );
89
+ const shareRoot = root.querySelector("[data-lily-share-picker-root]");
90
+ return {
91
+ theme: themeRoot ? initThemePicker(themeRoot, themeProps) : null,
92
+ locale: localeRoot ? initLocalePicker(localeRoot, localeProps) : null,
93
+ textSize: textSizeRoot ? initTextSizePicker(textSizeRoot, textSizeProps) : null,
94
+ share: shareRoot ? initSharePicker(shareRoot, shareProps) : null
95
+ };
96
+ }
97
+ function autoInit(opts = {}) {
98
+ if (typeof document === "undefined") return [];
99
+ const roots = Array.from(
100
+ document.querySelectorAll("[data-lily-picker-bar-root]")
101
+ );
102
+ return roots.map((root) => initPickerBar(root, opts));
103
+ }
104
+ export {
105
+ DEFAULT_SIZES,
106
+ DEFAULT_THEMES,
107
+ autoInit,
108
+ autoInitLocalePicker,
109
+ autoInitSharePicker,
110
+ autoInitTextSizePicker,
111
+ autoInitThemePicker,
112
+ initPickerBar
113
+ };
@@ -0,0 +1,185 @@
1
+ {#
2
+ PickerBar macro — composes theme-picker, locale-picker,
3
+ text-size-picker, and share-picker into one page-header row.
4
+
5
+ HTML tag: <div> (root) wrapping the four picker roots, unmodified.
6
+ CSS class: picker-bar
7
+ Companion runtime: picker-bar.client.js (a convenience `autoInit`
8
+ wrapping the four siblings' own `autoInit` — see that file; there is
9
+ no picker-bar-owned lifecycle of its own).
10
+
11
+ This macro owns no preference, action, or form value itself. It is a
12
+ composition: each of the four picker macros below is imported from
13
+ its own sibling PACKAGE (a real npm `dependency` declared in this
14
+ package's package.json — not vendored source), and rendered with its
15
+ own unmodified contract. `motion-picker` and `date-time-picker` are
16
+ deliberately excluded — see spec/index.md §1.
17
+
18
+ The import paths below assume a Nunjucks Environment whose search
19
+ paths include `node_modules` (the standard way to make an installed
20
+ package's templates resolvable) — see index.md "Install" for the
21
+ one-line Environment setup. In this monorepo's own dev/test tree the
22
+ same relative shape already holds: each sibling package sits at
23
+ `../lily-design-system-nunjucks-{name}-picker/dist/{name}-picker.njk`
24
+ relative to the catalog root, exactly where `node_modules` would
25
+ place it after a real install.
26
+ #}
27
+ {% from "lily-design-system-nunjucks-theme-picker/dist/theme-picker.njk" import themePicker %}
28
+ {% from "lily-design-system-nunjucks-locale-picker/dist/locale-picker.njk" import localePicker %}
29
+ {% from "lily-design-system-nunjucks-text-size-picker/dist/text-size-picker.njk" import textSizePicker %}
30
+ {% from "lily-design-system-nunjucks-share-picker/dist/share-picker.njk" import sharePicker %}
31
+ {#
32
+ All 45 Lily reference theme slugs (see `themes/` at the repo root),
33
+ sorted alphabetically except the United Kingdom and United States
34
+ government/public-sector themes, which sort last as one alphabetical
35
+ group of their own. Mirrors `theme-picker`'s own title-casing of each
36
+ slug, so no `themeLabels` override is needed for these to read well.
37
+ Kept in agreement with `DEFAULT_THEMES` in picker-bar.client.js by a
38
+ test — a Nunjucks macro cannot import a JS constant, so, as with
39
+ `themeName`/`sizeName` elsewhere in this catalog, the two copies are
40
+ held in sync by assertion rather than by delegation.
41
+ #}
42
+ {%- set DEFAULT_THEMES = [
43
+ "abyss", "acid", "adobe-spectrum", "aqua", "autumn", "black",
44
+ "bumblebee", "business", "caramellatte", "cmyk", "coffee",
45
+ "corporate", "cupcake", "cyberpunk", "dark", "dim", "dracula",
46
+ "emerald", "fantasy", "forest", "garden", "halloween", "lemonade",
47
+ "light", "lofi", "luxury", "mozilla-protocol", "night", "nord",
48
+ "pastel", "retro", "silk", "sunset", "synthwave", "valentine",
49
+ "winter", "wireframe",
50
+ "united-kingdom-government-digital-service",
51
+ "united-kingdom-national-health-service-england-for-patients",
52
+ "united-kingdom-national-health-service-england-for-practitioners",
53
+ "united-kingdom-national-health-service-scotland-for-patients",
54
+ "united-kingdom-national-health-service-scotland-for-practitioners",
55
+ "united-kingdom-national-health-service-wales-for-patients",
56
+ "united-kingdom-national-health-service-wales-for-practitioners",
57
+ "united-states-web-design-system"
58
+ ] -%}
59
+ {#
60
+ The seven-step text-size scale. Each slug title-cases to exactly the
61
+ requested label via text-size-picker's own default label rule, so no
62
+ `sizeLabels` override is needed.
63
+ #}
64
+ {%- set DEFAULT_SIZES = [
65
+ "largest", "larger", "large", "normal", "small", "smaller", "smallest"
66
+ ] -%}
67
+ {#
68
+ Params (single `opts` object):
69
+ labels — object, required: { theme, locale, textSize, share }.
70
+ The four accessible names. No English default — a
71
+ nav row this catalog invented is exactly what the
72
+ i18n rule exists to prevent hardcoding.
73
+ themesUrl — string, required. Forwarded to theme-picker.
74
+ locales — array<string>, required. Forwarded to locale-picker;
75
+ no catalog default exists.
76
+ themes — array<string>. Defaults to DEFAULT_THEMES (above).
77
+ sizes — array<string>. Defaults to DEFAULT_SIZES (above).
78
+ shareTargets — array<object>. Forwarded to share-picker's `targets`
79
+ (default []). See share-picker.njk for the object
80
+ shape — `href` is an already-resolved string, not a
81
+ function, per that package's documented deviation.
82
+ themeProps — object. Extra theme-picker opts (value, defaultValue,
83
+ storageKey, detectFromSystem, name, extension,
84
+ themeLabels, id, classes, attributes) — anything NOT
85
+ already lifted to the top level above.
86
+ localeProps — object. Extra locale-picker opts (value, defaultValue,
87
+ storageKey, detectFromNavigator, name, applyDir,
88
+ localeLabels, id, classes, attributes).
89
+ textSizeProps — object. Extra text-size-picker opts (value,
90
+ defaultValue, storageKey, name, sizeLabels, id,
91
+ classes, attributes). `defaultValue` defaults to
92
+ "normal" here (text-size-picker's own "medium"
93
+ fallback is not one of DEFAULT_SIZES' seven slugs).
94
+ shareProps — object. Extra share-picker opts (url, title, text,
95
+ copyLabel, copiedLabel, copyFailedLabel, strategy,
96
+ name, id, classes, attributes).
97
+ classes — string. Extra CSS classes on the picker-bar root.
98
+ attributes — object. Extra HTML attributes spread onto the root.
99
+
100
+ Unlike the Svelte canonical's `children` snippet passthrough, a
101
+ Nunjucks macro call accepts at most one `{% call %}` block, so
102
+ picker-bar cannot route a custom glyph to one specific nested picker.
103
+ Compose the four macros directly if you need a custom glyph on just
104
+ one of them — see spec/index.md §4.4.
105
+
106
+ Usage:
107
+ {% from "lily-design-system-nunjucks-picker-bar/dist/picker-bar.njk" import pickerBar %}
108
+ {{ pickerBar({
109
+ labels: { theme: "Theme", locale: "Language", textSize: "Text size", share: "Share" },
110
+ themesUrl: "/assets/themes/",
111
+ locales: ["en", "cy"]
112
+ }) }}
113
+
114
+ Spec: spec/index.md §4 (macro parameters), §5 (defaults).
115
+ #}
116
+ {%- macro pickerBar(opts) -%}
117
+ {%- set themes = opts.themes | default(DEFAULT_THEMES) -%}
118
+ {%- set sizes = opts.sizes | default(DEFAULT_SIZES) -%}
119
+ {%- set themeProps = opts.themeProps | default({}) -%}
120
+ {%- set localeProps = opts.localeProps | default({}) -%}
121
+ {%- set textSizeProps = opts.textSizeProps | default({}) -%}
122
+ {%- set shareProps = opts.shareProps | default({}) -%}
123
+ <div
124
+ class="picker-bar{% if opts.classes %} {{ opts.classes }}{% endif %}"
125
+ data-lily-picker-bar-root
126
+ {%- if opts.attributes %}{% for k, v in opts.attributes %} {{ k }}="{{ v }}"{% endfor %}{% endif %}
127
+ >
128
+ {{ themePicker({
129
+ label: opts.labels.theme,
130
+ themesUrl: opts.themesUrl,
131
+ themes: themes,
132
+ value: themeProps.value,
133
+ defaultValue: themeProps.defaultValue,
134
+ storageKey: themeProps.storageKey,
135
+ detectFromSystem: themeProps.detectFromSystem,
136
+ name: themeProps.name,
137
+ extension: themeProps.extension,
138
+ themeLabels: themeProps.themeLabels,
139
+ id: themeProps.id,
140
+ classes: themeProps.classes,
141
+ attributes: themeProps.attributes
142
+ }) }}
143
+ {{ localePicker({
144
+ label: opts.labels.locale,
145
+ locales: opts.locales,
146
+ value: localeProps.value,
147
+ defaultValue: localeProps.defaultValue,
148
+ storageKey: localeProps.storageKey,
149
+ detectFromNavigator: localeProps.detectFromNavigator,
150
+ name: localeProps.name,
151
+ applyDir: localeProps.applyDir,
152
+ localeLabels: localeProps.localeLabels,
153
+ id: localeProps.id,
154
+ classes: localeProps.classes,
155
+ attributes: localeProps.attributes
156
+ }) }}
157
+ {{ textSizePicker({
158
+ label: opts.labels.textSize,
159
+ sizes: sizes,
160
+ value: textSizeProps.value,
161
+ defaultValue: textSizeProps.defaultValue | default("normal"),
162
+ storageKey: textSizeProps.storageKey,
163
+ name: textSizeProps.name,
164
+ sizeLabels: textSizeProps.sizeLabels,
165
+ id: textSizeProps.id,
166
+ classes: textSizeProps.classes,
167
+ attributes: textSizeProps.attributes
168
+ }) }}
169
+ {{ sharePicker({
170
+ label: opts.labels.share,
171
+ targets: opts.shareTargets | default([]),
172
+ url: shareProps.url,
173
+ title: shareProps.title,
174
+ text: shareProps.text,
175
+ copyLabel: shareProps.copyLabel,
176
+ copiedLabel: shareProps.copiedLabel,
177
+ copyFailedLabel: shareProps.copyFailedLabel,
178
+ strategy: shareProps.strategy,
179
+ name: shareProps.name,
180
+ id: shareProps.id,
181
+ classes: shareProps.classes,
182
+ attributes: shareProps.attributes
183
+ }) }}
184
+ </div>
185
+ {%- endmacro -%}
package/index.md ADDED
@@ -0,0 +1,140 @@
1
+ # Lily Design System™ — Nunjucks PickerBar
2
+
3
+ A single page-header macro that composes four of the Lily
4
+ [`*-picker` helpers](../index.md) in this catalog — theme, locale,
5
+ text size, and share — with two catalog-wide defaults pre-wired, so
6
+ you can call one macro instead of assembling and configuring four.
7
+
8
+ `motion-picker` and `date-time-picker` are not part of the bar: motion
9
+ has no natural spot next to the other three header preferences, and
10
+ `date-time-picker` is a form control, not a header control.
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ npm install @lilydesignsystem/nunjucks-picker-bar
16
+ ```
17
+
18
+ `@lilydesignsystem/nunjucks-theme-picker`, `-locale-picker`,
19
+ `-text-size-picker`, and `-share-picker` install automatically as
20
+ regular dependencies — `pickerBar` is a thin wrapper around them, not
21
+ a reimplementation.
22
+
23
+ Point your Nunjucks `Environment` at `node_modules` so the macro's
24
+ cross-package imports resolve:
25
+
26
+ ```js
27
+ import nunjucks from "nunjucks";
28
+ const env = nunjucks.configure(["views", "node_modules"], { autoescape: true });
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ```njk
34
+ {% from "lily-design-system-nunjucks-picker-bar/dist/picker-bar.njk" import pickerBar %}
35
+
36
+ {{ pickerBar({
37
+ labels: {
38
+ theme: "Theme",
39
+ locale: "Language",
40
+ textSize: "Text size",
41
+ share: "Share"
42
+ },
43
+ themesUrl: "/assets/themes/",
44
+ locales: ["en", "cy", "gd", "ga"],
45
+ shareTargets: [
46
+ { id: "email", label: "Email", href: "mailto:?subject=Check this out&body=https://example.com" }
47
+ ]
48
+ }) }}
49
+ ```
50
+
51
+ Then load `picker-bar.client.js` once and call `autoInit()`:
52
+
53
+ ```html
54
+ <script type="module">
55
+ import { autoInit } from "/path/to/picker-bar.client.js";
56
+ autoInit();
57
+ </script>
58
+ ```
59
+
60
+ That's a complete, working header row: 45 themes, four locales, the
61
+ seven-step text-size scale, and one share destination plus copy-to-URL
62
+ if you add `shareProps: { copyLabel: "Copy link" }`.
63
+
64
+ Note the [`share-picker` deviation](../lily-design-system-nunjucks-share-picker/index.md):
65
+ `href` in `shareTargets` is an already-resolved string, not a
66
+ function — a Nunjucks macro cannot call an arbitrary JS function.
67
+
68
+ ## Defaults
69
+
70
+ - **`themes`** defaults to `DEFAULT_THEMES` — all 45 Lily reference
71
+ theme slugs, alphabetical, with the 8 United Kingdom / United States
72
+ government themes moved to their own alphabetical group at the
73
+ bottom. Pass your own `themes` array to override.
74
+ - **`sizes`** defaults to `DEFAULT_SIZES` — the seven-step scale
75
+ `largest`, `larger`, `large`, `normal`, `small`, `smaller`,
76
+ `smallest` — and the text-size picker starts on `normal`. Pass your
77
+ own `sizes` array (and `textSizeProps: { defaultValue: "…" }` if
78
+ you want a different starting point) to override.
79
+
80
+ Both are exported from the client.js module too:
81
+
82
+ ```js
83
+ import { DEFAULT_THEMES, DEFAULT_SIZES } from "@lilydesignsystem/nunjucks-picker-bar";
84
+ ```
85
+
86
+ ## Passing extra params to one picker
87
+
88
+ Each wrapped picker takes a `*Props` object for anything beyond what
89
+ `pickerBar` lifts to the top level — persistence, initial value,
90
+ detection, a `*Labels` override map, an `id`:
91
+
92
+ ```njk
93
+ {{ pickerBar({
94
+ labels: { theme: "Theme", locale: "Language", textSize: "Text size", share: "Share" },
95
+ themesUrl: "/assets/themes/",
96
+ locales: ["en", "cy"],
97
+ themeProps: { storageKey: "lily-theme", detectFromSystem: true },
98
+ localeProps: { storageKey: "lily-locale", detectFromNavigator: true },
99
+ textSizeProps: { storageKey: "lily-text-size" },
100
+ shareProps: { copyLabel: "Copy link", copiedLabel: "Copied" }
101
+ }) }}
102
+ ```
103
+
104
+ Unlike the Svelte canonical, `pickerBar` cannot route a custom glyph to
105
+ one specific picker (a Nunjucks macro call accepts only one
106
+ `{% call %}` block) — compose the four macros directly if you need
107
+ that.
108
+
109
+ ## Styling
110
+
111
+ `pickerBar` renders no CSS of its own beyond the `picker-bar` root
112
+ wrapper — style each child through its own package's class hooks
113
+ (`theme-picker`, `locale-picker`, `text-size-picker`, `share-picker`;
114
+ see each package's own `index.md`). A typical header layout:
115
+
116
+ ```css
117
+ .picker-bar {
118
+ display: flex;
119
+ gap: var(--theme-space-sm, 0.5rem);
120
+ align-items: center;
121
+ }
122
+ ```
123
+
124
+ ## Accessibility
125
+
126
+ Every accessible name comes from `labels` — there is no English
127
+ default, because a set of names this catalog invented is exactly the
128
+ case the rest of Lily's i18n rule exists for. Each wrapped picker keeps
129
+ its own WAI-ARIA APG contract unchanged; see that picker's own
130
+ `index.md`. As with every helper in this catalog, none of the four is
131
+ operable until its client.js has run — see each package's own
132
+ `docs/ssr.md`.
133
+
134
+ ## Full contract
135
+
136
+ See [`spec/index.md`](./spec/index.md).
137
+
138
+ ---
139
+
140
+ Lily™ and Lily Design System™ are trademarks.
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@lilydesignsystem/nunjucks-picker-bar",
3
+ "version": "0.1.0",
4
+ "engines": {
5
+ "node": "=26"
6
+ },
7
+ "description": "Lily Design System Nunjucks picker bar: composes theme-picker, locale-picker, 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/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ },
17
+ "./template": "./dist/picker-bar.njk"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "index.md",
22
+ "README.md"
23
+ ],
24
+ "scripts": {
25
+ "prepublishOnly": "cd .. && npm run build"
26
+ },
27
+ "dependencies": {
28
+ "@lilydesignsystem/nunjucks-theme-picker": "^0.1.0",
29
+ "@lilydesignsystem/nunjucks-locale-picker": "^0.1.0",
30
+ "@lilydesignsystem/nunjucks-text-size-picker": "^0.1.0",
31
+ "@lilydesignsystem/nunjucks-share-picker": "^0.1.0"
32
+ },
33
+ "keywords": [
34
+ "lily",
35
+ "design",
36
+ "system",
37
+ "nunjucks",
38
+ "picker",
39
+ "picker-bar",
40
+ "theme",
41
+ "locale",
42
+ "text-size",
43
+ "share"
44
+ ],
45
+ "author": "Joel Parker Henderson <joel@joelparkerhenderson.com>",
46
+ "license": "MIT OR Apache-2.0 OR GPL-2.0-only OR GPL-3.0-only OR BSD-3-Clause",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/LilyDesignSystem/lily-design-system-nunjucks-helpers.git",
50
+ "directory": "lily-design-system-nunjucks-picker-bar"
51
+ },
52
+ "homepage": "https://lilydesignsystem.com/",
53
+ "bugs": {
54
+ "url": "https://github.com/LilyDesignSystem/lily-design-system/issues"
55
+ }
56
+ }