@krizaka/ui 3.76.1 → 3.77.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.
Files changed (46) hide show
  1. package/dist/blocks.css +14 -0
  2. package/dist/chunk-NM2DEHFZ.js +25 -0
  3. package/dist/chunk-NM2DEHFZ.js.map +1 -0
  4. package/dist/document-viewer.d.ts +23 -6
  5. package/dist/document-viewer.js +21 -5
  6. package/dist/document-viewer.js.map +1 -1
  7. package/dist/filter-bar.d.ts +3 -3
  8. package/dist/map/cards.d.ts +145 -0
  9. package/dist/map/cards.js +74 -0
  10. package/dist/map/cards.js.map +1 -0
  11. package/dist/map/pin.d.ts +57 -0
  12. package/dist/map/pin.js +53 -0
  13. package/dist/map/pin.js.map +1 -0
  14. package/dist/map/sheet.d.ts +80 -0
  15. package/dist/map/sheet.js +61 -0
  16. package/dist/map/sheet.js.map +1 -0
  17. package/dist/map.d.ts +41 -14
  18. package/dist/map.js +85 -112
  19. package/dist/map.js.map +1 -1
  20. package/dist/native/map.d.ts +29 -10
  21. package/dist/native/map.js +81 -107
  22. package/dist/native/map.js.map +1 -1
  23. package/dist/wall.d.ts +10 -5
  24. package/dist/wall.js +10 -4
  25. package/dist/wall.js.map +1 -1
  26. package/package.json +51 -6
  27. package/registry/app-frame.json +1 -1
  28. package/registry/document-viewer.json +9 -8
  29. package/registry/examples/document-viewer/highlights.js +2 -1
  30. package/registry/examples/document-viewer/highlights.tsx +3 -0
  31. package/registry/examples/map/pins.d.ts +4 -0
  32. package/registry/examples/map/pins.js +20 -0
  33. package/registry/examples/map/pins.tsx +27 -0
  34. package/registry/examples/map/place-sheet.d.ts +4 -0
  35. package/registry/examples/map/place-sheet.js +34 -0
  36. package/registry/examples/map/place-sheet.tsx +35 -0
  37. package/registry/examples/wall/tidy.d.ts +4 -0
  38. package/registry/examples/wall/tidy.js +27 -0
  39. package/registry/examples/wall/tidy.tsx +19 -0
  40. package/registry/index.json +9 -9
  41. package/registry/map.json +81 -13
  42. package/registry/nav-bar.json +1 -1
  43. package/registry/rail-nav.json +1 -1
  44. package/registry/shop.json +1 -1
  45. package/registry/site-footer.json +1 -1
  46. package/registry/wall.json +24 -2
@@ -0,0 +1,57 @@
1
+ import * as tailwind_variants from 'tailwind-variants';
2
+ import * as React from 'react';
3
+
4
+ declare const mapPin: tailwind_variants.TVReturnType<{
5
+ selected: {
6
+ true: {
7
+ root: string;
8
+ };
9
+ };
10
+ }, {
11
+ root: string;
12
+ shape: string;
13
+ glyph: string;
14
+ }, undefined, {
15
+ selected: {
16
+ true: {
17
+ root: string;
18
+ };
19
+ };
20
+ }, {
21
+ root: string;
22
+ shape: string;
23
+ glyph: string;
24
+ }, tailwind_variants.TVReturnTypeLike<{
25
+ selected: {
26
+ true: {
27
+ root: string;
28
+ };
29
+ };
30
+ }, {
31
+ root: string;
32
+ shape: string;
33
+ glyph: string;
34
+ }>>;
35
+ type MapPinShape = "drop" | "disc" | "tag";
36
+ type MapPinState = "default" | "selected" | "visited" | "closed";
37
+ type MapPinProps = {
38
+ /** `drop` (a pin, its tip on the place), `disc` (a dot with a ring) or `tag` (the Cahier's manila tag with its eyelet). Default `drop`. */
39
+ shape?: MapPinShape;
40
+ /** `default`; `selected` (larger, the ring doubled); `visited` (hollow: seen already); `closed` (greyed: not available now). */
41
+ state?: MapPinState;
42
+ /** `accent` (the product's colour) or `margin` (the notebook's red). Default `accent`. */
43
+ tone?: "accent" | "margin";
44
+ /** Its size in pixels (the width). Default 28. */
45
+ size?: number;
46
+ /** A short mark or an icon in the head of the pin ("3", an icon). */
47
+ children?: React.ReactNode;
48
+ className?: string;
49
+ };
50
+ /**
51
+ * A pin for a `Marker`'s children: three shapes, four states, drawn from the tokens (both themes). Decorative by itself —
52
+ * the `Marker` carries the label — and the state is also said by shape (hollow, struck), never by colour alone.
53
+ */
54
+ declare function MapPin({ shape, state, tone, size, children, className }: Readonly<MapPinProps>): React.JSX.Element;
55
+
56
+ export { MapPin, mapPin };
57
+ export type { MapPinProps, MapPinShape, MapPinState };
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import {
3
+ tv
4
+ } from "../chunk-NM2DEHFZ.js";
5
+
6
+ // src/map/pin/map-pin.tsx
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var mapPin = tv({
9
+ slots: {
10
+ root: "relative inline-flex items-center justify-center text-on-accent transition-transform motion-reduce:transition-none",
11
+ shape: "block h-full w-full overflow-visible drop-shadow-md",
12
+ glyph: "absolute inset-0 flex items-center justify-center text-[0.55em] font-semibold leading-none [&>svg]:h-[55%] [&>svg]:w-[55%]"
13
+ },
14
+ variants: {
15
+ selected: {
16
+ true: { root: "scale-125" }
17
+ }
18
+ }
19
+ });
20
+ var PATHS = {
21
+ drop: { d: "M12 1C6.2 1 1.5 5.6 1.5 11.3 1.5 18.6 12 31 12 31s10.5-12.4 10.5-19.7C22.5 5.6 17.8 1 12 1Z", viewBox: "0 0 24 32", height: 32 / 24, head: [12, 11.5] },
22
+ disc: { d: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Z", viewBox: "0 0 24 24", height: 1, head: [12, 12] },
23
+ tag: { d: "M5 2h14a2 2 0 0 1 2 2v12l-9 7.5L3 16V4a2 2 0 0 1 2-2Z", viewBox: "0 0 24 26", height: 26 / 24, head: [12, 10] }
24
+ };
25
+ function pinColours(shape, state, tone) {
26
+ const tag = shape === "tag";
27
+ const base = tag ? "var(--kz-paper-tag)" : `var(--kz-${tone === "margin" ? "paper-rule-margin" : "accent"})`;
28
+ const edge = tag ? "var(--kz-paper-tag-edge)" : "var(--kz-on-accent)";
29
+ const muted = "var(--kz-text-muted)";
30
+ if (state === "closed") return { edge, fill: "var(--kz-surface-3)", stroke: muted, glyph: muted, headFill: "none" };
31
+ if (state === "visited") return { edge, fill: "var(--kz-surface-1)", stroke: base, glyph: base, headFill: base };
32
+ return { edge, fill: base, stroke: edge, glyph: tag ? "var(--kz-paper-tag-ink)" : edge, headFill: "var(--kz-surface-0)" };
33
+ }
34
+ var GLYPH_TOP = { drop: "-8%", tag: "6%", disc: 0 };
35
+ function MapPin({ shape = "drop", state = "default", tone = "accent", size = 28, children, className }) {
36
+ const s = mapPin({ selected: state === "selected" });
37
+ const p = PATHS[shape];
38
+ const c = pinColours(shape, state, tone);
39
+ const closed = state === "closed";
40
+ return /* @__PURE__ */ jsxs("span", { className: s.root({ className }), style: { width: size, height: size * p.height }, "data-shape": shape, "data-state": state, "aria-hidden": "true", children: [
41
+ /* @__PURE__ */ jsxs("svg", { className: s.shape(), viewBox: p.viewBox, focusable: "false", children: [
42
+ /* @__PURE__ */ jsx("path", { d: p.d, fill: c.fill, stroke: c.stroke, strokeWidth: state === "selected" ? 2.5 : 1.75, strokeDasharray: closed ? "3 2" : void 0 }),
43
+ shape === "tag" ? /* @__PURE__ */ jsx("circle", { cx: 12, cy: 5.5, r: 1.6, fill: "var(--kz-surface-0)", stroke: c.edge, strokeWidth: 1 }) : null,
44
+ children ? null : /* @__PURE__ */ jsx("circle", { cx: p.head[0], cy: p.head[1], r: shape === "disc" ? 3 : 3.2, fill: c.headFill, opacity: closed ? 0 : 1 })
45
+ ] }),
46
+ children ? /* @__PURE__ */ jsx("span", { className: s.glyph(), style: { color: c.glyph, top: GLYPH_TOP[shape] }, children }) : null
47
+ ] });
48
+ }
49
+ export {
50
+ MapPin,
51
+ mapPin
52
+ };
53
+ //# sourceMappingURL=pin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/map/pin/map-pin.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { tv } from \"../../tv\";\n\nexport const mapPin = tv({\n slots: {\n root: \"relative inline-flex items-center justify-center text-on-accent transition-transform motion-reduce:transition-none\",\n shape: \"block h-full w-full overflow-visible drop-shadow-md\",\n glyph: \"absolute inset-0 flex items-center justify-center text-[0.55em] font-semibold leading-none [&>svg]:h-[55%] [&>svg]:w-[55%]\",\n },\n variants: {\n selected: {\n true: { root: \"scale-125\" },\n },\n },\n});\n\nexport type MapPinShape = \"drop\" | \"disc\" | \"tag\";\nexport type MapPinState = \"default\" | \"selected\" | \"visited\" | \"closed\";\n\nexport type MapPinProps = {\n /** `drop` (a pin, its tip on the place), `disc` (a dot with a ring) or `tag` (the Cahier's manila tag with its eyelet). Default `drop`. */\n shape?: MapPinShape;\n /** `default`; `selected` (larger, the ring doubled); `visited` (hollow: seen already); `closed` (greyed: not available now). */\n state?: MapPinState;\n /** `accent` (the product's colour) or `margin` (the notebook's red). Default `accent`. */\n tone?: \"accent\" | \"margin\";\n /** Its size in pixels (the width). Default 28. */\n size?: number;\n /** A short mark or an icon in the head of the pin (\"3\", an icon). */\n children?: React.ReactNode;\n className?: string;\n};\n\nconst PATHS: Record<MapPinShape, { d: string; viewBox: string; height: number; head: [number, number] }> = {\n drop: { d: \"M12 1C6.2 1 1.5 5.6 1.5 11.3 1.5 18.6 12 31 12 31s10.5-12.4 10.5-19.7C22.5 5.6 17.8 1 12 1Z\", viewBox: \"0 0 24 32\", height: 32 / 24, head: [12, 11.5] },\n disc: { d: \"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Z\", viewBox: \"0 0 24 24\", height: 1, head: [12, 12] },\n tag: { d: \"M5 2h14a2 2 0 0 1 2 2v12l-9 7.5L3 16V4a2 2 0 0 1 2-2Z\", viewBox: \"0 0 24 26\", height: 26 / 24, head: [12, 10] },\n};\n\ntype PinColours = { edge: string; fill: string; stroke: string; glyph: string; headFill: string };\n\n/** The colours a pin wears for its shape, state and tone: the state is also said by shape (hollow, struck), never by colour alone. */\nfunction pinColours(shape: MapPinShape, state: MapPinState, tone: \"accent\" | \"margin\"): PinColours {\n const tag = shape === \"tag\";\n const base = tag ? \"var(--kz-paper-tag)\" : `var(--kz-${tone === \"margin\" ? \"paper-rule-margin\" : \"accent\"})`;\n const edge = tag ? \"var(--kz-paper-tag-edge)\" : \"var(--kz-on-accent)\";\n const muted = \"var(--kz-text-muted)\";\n if (state === \"closed\") return { edge, fill: \"var(--kz-surface-3)\", stroke: muted, glyph: muted, headFill: \"none\" };\n if (state === \"visited\") return { edge, fill: \"var(--kz-surface-1)\", stroke: base, glyph: base, headFill: base };\n return { edge, fill: base, stroke: edge, glyph: tag ? \"var(--kz-paper-tag-ink)\" : edge, headFill: \"var(--kz-surface-0)\" };\n}\n\nconst GLYPH_TOP: Record<MapPinShape, string | number> = { drop: \"-8%\", tag: \"6%\", disc: 0 };\n\n/**\n * A pin for a `Marker`'s children: three shapes, four states, drawn from the tokens (both themes). Decorative by itself —\n * the `Marker` carries the label — and the state is also said by shape (hollow, struck), never by colour alone.\n */\nexport function MapPin({ shape = \"drop\", state = \"default\", tone = \"accent\", size = 28, children, className }: Readonly<MapPinProps>) {\n const s = mapPin({ selected: state === \"selected\" });\n const p = PATHS[shape];\n const c = pinColours(shape, state, tone);\n const closed = state === \"closed\";\n return (\n <span className={s.root({ className })} style={{ width: size, height: size * p.height }} data-shape={shape} data-state={state} aria-hidden=\"true\">\n <svg className={s.shape()} viewBox={p.viewBox} focusable=\"false\">\n <path d={p.d} fill={c.fill} stroke={c.stroke} strokeWidth={state === \"selected\" ? 2.5 : 1.75} strokeDasharray={closed ? \"3 2\" : undefined} />\n {shape === \"tag\" ? <circle cx={12} cy={5.5} r={1.6} fill=\"var(--kz-surface-0)\" stroke={c.edge} strokeWidth={1} /> : null}\n {children ? null : <circle cx={p.head[0]} cy={p.head[1]} r={shape === \"disc\" ? 3 : 3.2} fill={c.headFill} opacity={closed ? 0 : 1} />}\n </svg>\n {children ? (\n <span className={s.glyph()} style={{ color: c.glyph, top: GLYPH_TOP[shape] }}>\n {children}\n </span>\n ) : null}\n </span>\n );\n}\n"],"mappings":";;;;;;AAoEM,SACE,KADF;AA9DC,IAAM,SAAS,GAAG;AAAA,EACvB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,UAAU;AAAA,MACR,MAAM,EAAE,MA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AAQ,OAAO,EAAE,OAAO,GAAG,cAAY,OAAO,cAAY,OAAO,eAAY,QACzI;AAAA,yBAAC,SAAI,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,WAAU,SACvD;AAAA,0BAAC,UAAK,GAAG,EAAE,GAAG,MAAM,EAAE,MAAM,QAAQ,EAAE,QAAQ,aAAa,UAAU,aAAa,MAAM,MAAM,iBAAiB,SAAS,QAAQ,QAAW;AAAA,MAC1I,UAAU,QAAQ,oBAAC,YAAO,IAAI,IAAI,IAAI,KAAK,GAAG,KAAK,MAAK,uBAAsB,QAAQ,EAAE,MAAM,aAAa,GAAG,IAAK;AAAA,MACnH,WAAW,OAAO,oBAAC,YAAO,IAAI,EAAE,KAAK,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,UAAU,SAAS,IAAI,KAAK,MAAM,EAAE,UAAU,SAAS,SAAS,IAAI,GAAG;AAAA,OACrI;AAAA,IACC,WACC,oBAAC,UAAK,WAAW,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,UAAU,KAAK,EAAE,GACxE,UACH,IACE;AAAA,KACN;AAEJ;","names":[]}
@@ -0,0 +1,80 @@
1
+ import * as tailwind_variants from 'tailwind-variants';
2
+ import * as React from 'react';
3
+
4
+ declare const mapSheet: tailwind_variants.TVReturnType<{
5
+ snap: {
6
+ peek: {
7
+ root: string;
8
+ };
9
+ half: {
10
+ root: string;
11
+ };
12
+ full: {
13
+ root: string;
14
+ };
15
+ };
16
+ }, {
17
+ root: string;
18
+ handle: string;
19
+ grip: string;
20
+ body: string;
21
+ }, undefined, {
22
+ snap: {
23
+ peek: {
24
+ root: string;
25
+ };
26
+ half: {
27
+ root: string;
28
+ };
29
+ full: {
30
+ root: string;
31
+ };
32
+ };
33
+ }, {
34
+ root: string;
35
+ handle: string;
36
+ grip: string;
37
+ body: string;
38
+ }, tailwind_variants.TVReturnTypeLike<{
39
+ snap: {
40
+ peek: {
41
+ root: string;
42
+ };
43
+ half: {
44
+ root: string;
45
+ };
46
+ full: {
47
+ root: string;
48
+ };
49
+ };
50
+ }, {
51
+ root: string;
52
+ handle: string;
53
+ grip: string;
54
+ body: string;
55
+ }>>;
56
+ type MapSheetSnap = "peek" | "half" | "full";
57
+ declare const MAP_SHEET_SNAPS: readonly MapSheetSnap[];
58
+ type MapSheetProps = Omit<React.ComponentProps<"section">, "children"> & {
59
+ /** What the sheet is, passed translated: its accessible name ("Place details"). */
60
+ label: string;
61
+ /** The content: an info card, a route card, a list. */
62
+ children: React.ReactNode;
63
+ /** The snap point, when controlled. */
64
+ snap?: MapSheetSnap;
65
+ /** The snap point at the start, when not controlled. Default "peek". */
66
+ defaultSnap?: MapSheetSnap;
67
+ /** Called with the new snap point (the handle: a press cycles, ArrowUp / ArrowDown step, Home / End jump). */
68
+ onSnapChange?: (snap: MapSheetSnap) => void;
69
+ /** The handle's name, translated ("Resize the panel"). */
70
+ handleLabel: string;
71
+ };
72
+ /**
73
+ * A NON-modal sheet over a map: the map stays alive and reachable behind it (no scrim, no focus trap, nothing made
74
+ * inert). On a phone it rises from the bottom with three snap points; from the `md` breakpoint it is a card at the
75
+ * side and the handle disappears. Place it in the map's positioned container.
76
+ */
77
+ declare function MapSheet({ label, children, snap, defaultSnap, onSnapChange, handleLabel, className, ...props }: MapSheetProps): React.JSX.Element;
78
+
79
+ export { MAP_SHEET_SNAPS, MapSheet, mapSheet };
80
+ export type { MapSheetProps, MapSheetSnap };
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import {
3
+ tv
4
+ } from "../chunk-NM2DEHFZ.js";
5
+
6
+ // src/map/sheet/map-sheet.tsx
7
+ import * as React from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ var mapSheet = tv({
10
+ slots: {
11
+ root: "absolute inset-x-0 bottom-0 z-10 flex max-h-full flex-col rounded-t-2xl border border-border-subtle bg-surface-1 text-fg shadow-lg transition-[height] duration-200 motion-reduce:transition-none md:inset-y-3 md:left-3 md:right-auto md:max-h-none md:w-[22rem] md:rounded-2xl",
12
+ handle: "flex h-6 w-full shrink-0 items-center justify-center md:hidden focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-border-focus",
13
+ grip: "h-1 w-10 rounded-full bg-border-default",
14
+ body: "min-h-0 flex-1 overflow-y-auto px-4 pb-4 md:pt-4"
15
+ },
16
+ variants: {
17
+ snap: {
18
+ peek: { root: "h-24 md:h-auto" },
19
+ half: { root: "h-1/2 md:h-auto" },
20
+ full: { root: "h-[92%] md:h-auto" }
21
+ }
22
+ },
23
+ defaultVariants: { snap: "peek" }
24
+ });
25
+ var MAP_SHEET_SNAPS = ["peek", "half", "full"];
26
+ function MapSheet({ label, children, snap, defaultSnap = "peek", onSnapChange, handleLabel, className, ...props }) {
27
+ const [inner, setInner] = React.useState(defaultSnap);
28
+ const current = snap ?? inner;
29
+ const set = (next) => {
30
+ if (snap === void 0) setInner(next);
31
+ onSnapChange?.(next);
32
+ };
33
+ const step = (by) => set(MAP_SHEET_SNAPS[Math.min(MAP_SHEET_SNAPS.length - 1, Math.max(0, MAP_SHEET_SNAPS.indexOf(current) + by))]);
34
+ const s = mapSheet({ snap: current });
35
+ return /* @__PURE__ */ jsxs("section", { ...props, "aria-label": label, "data-snap": current, className: s.root({ className }), children: [
36
+ /* @__PURE__ */ jsx(
37
+ "button",
38
+ {
39
+ type: "button",
40
+ className: s.handle(),
41
+ "aria-label": handleLabel,
42
+ "aria-expanded": current !== "peek",
43
+ onClick: () => set(MAP_SHEET_SNAPS[(MAP_SHEET_SNAPS.indexOf(current) + 1) % MAP_SHEET_SNAPS.length]),
44
+ onKeyDown: (e) => {
45
+ const move = { ArrowUp: () => step(1), ArrowDown: () => step(-1), Home: () => set("peek"), End: () => set("full") }[e.key];
46
+ if (!move) return;
47
+ e.preventDefault();
48
+ move();
49
+ },
50
+ children: /* @__PURE__ */ jsx("span", { className: s.grip(), "aria-hidden": true })
51
+ }
52
+ ),
53
+ /* @__PURE__ */ jsx("div", { className: s.body(), children })
54
+ ] });
55
+ }
56
+ export {
57
+ MAP_SHEET_SNAPS,
58
+ MapSheet,
59
+ mapSheet
60
+ };
61
+ //# sourceMappingURL=sheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/map/sheet/map-sheet.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { tv } from \"../../tv\";\n\nexport const mapSheet = tv({\n slots: {\n root: \"absolute inset-x-0 bottom-0 z-10 flex max-h-full flex-col rounded-t-2xl border border-border-subtle bg-surface-1 text-fg shadow-lg transition-[height] duration-200 motion-reduce:transition-none md:inset-y-3 md:left-3 md:right-auto md:max-h-none md:w-[22rem] md:rounded-2xl\",\n handle: \"flex h-6 w-full shrink-0 items-center justify-center md:hidden focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-border-focus\",\n grip: \"h-1 w-10 rounded-full bg-border-default\",\n body: \"min-h-0 flex-1 overflow-y-auto px-4 pb-4 md:pt-4\",\n },\n variants: {\n snap: {\n peek: { root: \"h-24 md:h-auto\" },\n half: { root: \"h-1/2 md:h-auto\" },\n full: { root: \"h-[92%] md:h-auto\" },\n },\n },\n defaultVariants: { snap: \"peek\" },\n});\n\nexport type MapSheetSnap = \"peek\" | \"half\" | \"full\";\nexport const MAP_SHEET_SNAPS: readonly MapSheetSnap[] = [\"peek\", \"half\", \"full\"];\n\nexport type MapSheetProps = Omit<React.ComponentProps<\"section\">, \"children\"> & {\n /** What the sheet is, passed translated: its accessible name (\"Place details\"). */\n label: string;\n /** The content: an info card, a route card, a list. */\n children: React.ReactNode;\n /** The snap point, when controlled. */\n snap?: MapSheetSnap;\n /** The snap point at the start, when not controlled. Default \"peek\". */\n defaultSnap?: MapSheetSnap;\n /** Called with the new snap point (the handle: a press cycles, ArrowUp / ArrowDown step, Home / End jump). */\n onSnapChange?: (snap: MapSheetSnap) => void;\n /** The handle's name, translated (\"Resize the panel\"). */\n handleLabel: string;\n};\n\n/**\n * A NON-modal sheet over a map: the map stays alive and reachable behind it (no scrim, no focus trap, nothing made\n * inert). On a phone it rises from the bottom with three snap points; from the `md` breakpoint it is a card at the\n * side and the handle disappears. Place it in the map's positioned container.\n */\nexport function MapSheet({ label, children, snap, defaultSnap = \"peek\", onSnapChange, handleLabel, className, ...props }: MapSheetProps) {\n const [inner, setInner] = React.useState<MapSheetSnap>(defaultSnap);\n const current = snap ?? inner;\n const set = (next: MapSheetSnap) => {\n if (snap === undefined) setInner(next);\n onSnapChange?.(next);\n };\n const step = (by: number) => set(MAP_SHEET_SNAPS[Math.min(MAP_SHEET_SNAPS.length - 1, Math.max(0, MAP_SHEET_SNAPS.indexOf(current) + by))]!);\n const s = mapSheet({ snap: current });\n return (\n <section {...props} aria-label={label} data-snap={current} className={s.root({ className })}>\n <button\n type=\"button\"\n className={s.handle()}\n aria-label={handleLabel}\n aria-expanded={current !== \"peek\"}\n onClick={() => set(MAP_SHEET_SNAPS[(MAP_SHEET_SNAPS.indexOf(current) + 1) % MAP_SHEET_SNAPS.length]!)}\n onKeyDown={(e) => {\n const move = { ArrowUp: () => step(1), ArrowDown: () => step(-1), Home: () => set(\"peek\"), End: () => set(\"full\") }[e.key];\n if (!move) return;\n e.preventDefault();\n move();\n }}\n >\n <span className={s.grip()} aria-hidden />\n </button>\n <div className={s.body()}>{children}</div>\n </section>\n );\n}\n"],"mappings":";;;;;;AAEA,YAAY,WAAW;AAsDnB,SAcI,KAdJ;AAlDG,IAAM,WAAW,GAAG;AAAA,EACzB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM,EAAE,MAAM,iBAAiB;AAAA,MAC/B,MAAM,EAAE,MAAM,kBAAkB;AAAA,MAChC,MAAM,EAAE,MAAM,oBAAoB;AAAA,IACpC;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,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AAA,KACtC;AAEJ;","names":[]}
package/dist/map.d.ts CHANGED
@@ -56,8 +56,15 @@ declare function sliceLine(path: readonly LngLat[], fraction: number): GeoJSON.F
56
56
  type MapBrand = keyof typeof brands;
57
57
  /** A colour mixed into another (`#rrggbb` only): `t` = 0 gives `a`, 1 gives `b`. */
58
58
  declare function mix(a: string, b: string, t: number): string;
59
- /** The colours of the map in a scheme (and a brand): what the style, the markers and the static map share. */
60
- declare function mapPalette(scheme: "dark" | "light", brand?: MapBrand): {
59
+ /**
60
+ * The look of the map: `plain` (the product register) or `notebook` (the Cahier: ink lines on the paper in light, chalk on
61
+ * the slate in dark, the margin's red for the main roads).
62
+ */
63
+ type MapVariant = "plain" | "notebook";
64
+ /** The scheme a map is asked for: `auto` follows the page (web) or the app (native). */
65
+ type MapScheme = "dark" | "light" | "auto";
66
+ /** The colours of the map in a scheme (and a brand, a variant): what the style, the markers, the clusters and the static map share. */
67
+ declare function mapPalette(scheme: "dark" | "light", brand?: MapBrand, variant?: MapVariant): {
61
68
  land: string;
62
69
  background: string;
63
70
  water: string;
@@ -72,9 +79,18 @@ declare function mapPalette(scheme: "dark" | "light", brand?: MapBrand): {
72
79
  halo: string;
73
80
  accent: string;
74
81
  onAccent: string;
82
+ cluster: {
83
+ fill: string;
84
+ stroke: string;
85
+ text: string;
86
+ };
87
+ point: {
88
+ fill: string;
89
+ stroke: string;
90
+ };
75
91
  };
76
92
  /** The basemap flavour of a palette: every role of Protomaps' layers filled from the tokens. */
77
- declare function mapFlavor(scheme: "dark" | "light", brand?: MapBrand): Flavor;
93
+ declare function mapFlavor(scheme: "dark" | "light", brand?: MapBrand, variant?: MapVariant): Flavor;
78
94
  /** A region of the basemap: its PMTiles file and the zoom up to which it has tiles. */
79
95
  type MapRegion = {
80
96
  url: string;
@@ -85,6 +101,8 @@ type MapStyleOptions = {
85
101
  scheme: "dark" | "light";
86
102
  /** The product whose accent the map carries (its markers, its water's tint). Default `krizaka`. */
87
103
  brand?: MapBrand;
104
+ /** The look: `plain` (default), or `notebook` (the Cahier's paper and ink). */
105
+ variant?: MapVariant;
88
106
  /** The language of the labels (`fr`, `en`): the place names in it where OpenStreetMap has them. Default `en`. */
89
107
  lang?: string;
90
108
  /** The low zooms of the whole world. Default: our world extract (zoom 0–6). */
@@ -96,21 +114,22 @@ type MapStyleOptions = {
96
114
  };
97
115
  /** The zoom where the detailed region takes over from the world. */
98
116
  declare const REGION_FROM_ZOOM = 6.5;
117
+ type StyleLayer = {
118
+ id: string;
119
+ minzoom?: number;
120
+ maxzoom?: number;
121
+ [k: string]: unknown;
122
+ };
99
123
  /**
100
124
  * The MapLibre style of a Krizaka map (a `StyleSpecification`): the world's low zooms, then the detailed region,
101
125
  * painted from the tokens. The `pmtiles://` sources need the PMTiles protocol (the web `Map` registers it; MapLibre
102
126
  * Native reads it as it is).
103
127
  */
104
- declare function mapStyle({ scheme, brand, lang, world, region, glyphs }: MapStyleOptions): {
128
+ declare function mapStyle({ scheme, brand, variant, lang, world, region, glyphs }: MapStyleOptions): {
105
129
  version: 8;
106
130
  glyphs: string;
107
131
  sources: Record<string, unknown>;
108
- layers: {
109
- [k: string]: unknown;
110
- id: string;
111
- minzoom?: number;
112
- maxzoom?: number;
113
- }[];
132
+ layers: StyleLayer[];
114
133
  };
115
134
 
116
135
  type MapLibre = typeof maplibre_gl;
@@ -192,12 +211,18 @@ type Registry = {
192
211
  add: (id: string, text: string) => void;
193
212
  remove: (id: string) => void;
194
213
  };
214
+ type Look = {
215
+ scheme: "dark" | "light";
216
+ brand?: MapBrand;
217
+ variant?: MapVariant;
218
+ };
195
219
  type Ctx = {
196
220
  map: MapInstance | null;
197
221
  lib: MapLibre | null;
198
222
  ready: boolean;
199
223
  reduce: boolean;
200
224
  places: Registry;
225
+ look: Look;
201
226
  };
202
227
  /** The map a child is drawn on (`Marker`, `RadiusCircle`, `Cluster`…): the MapLibre instance once it is ready. */
203
228
  declare function useMap(): Ctx;
@@ -230,8 +255,10 @@ type MapProps = {
230
255
  zoom?: number;
231
256
  /** The camera follows `center` and `zoom` when they change (flies, or jumps under reduced motion). */
232
257
  controlled?: boolean;
233
- /** The scheme. Default: the page's (`html.light`), followed. */
234
- scheme?: "dark" | "light";
258
+ /** The scheme: `auto` (default) follows the page (`html.light`) as it changes; `dark` or `light` pins it. */
259
+ scheme?: MapScheme;
260
+ /** The look: `plain` (default), `notebook` (the Cahier: paper and ink, manila tags for clusters). */
261
+ variant?: MapVariant;
235
262
  /** The product whose accent the map carries. Default `krizaka`. */
236
263
  brand?: MapBrand;
237
264
  /** The language of the labels (`fr`, `en`). Default `en`. */
@@ -261,7 +288,7 @@ type MapProps = {
261
288
  className?: string;
262
289
  };
263
290
  /** A map: MapLibre over our Protomaps tiles, styled from the tokens, with its places as a list for screen readers. */
264
- declare function MapRoot({ label, center, zoom, controlled, scheme: schemeProp, brand, lang, region, world, controls, interactive, fallback, onMoveEnd, onPress, children, labels: given, className, }: MapProps): React.JSX.Element;
291
+ declare function MapRoot({ label, center, zoom, controlled, scheme: schemeProp, variant, brand, lang, region, world, controls, interactive, fallback, onMoveEnd, onPress, children, labels: given, className, }: MapProps): React.JSX.Element;
265
292
  type MarkerProps = {
266
293
  /** Where it stands. */
267
294
  position: LngLat;
@@ -510,4 +537,4 @@ type StaticMapProps = {
510
537
  declare function StaticMap({ label, center, zoom, places, image, className }: StaticMapProps): React.JSX.Element;
511
538
 
512
539
  export { Cluster, LocationPicker, MAP_ATTRIBUTION, MAP_GLYPHS, MAP_TILES, MapRoot as Map, Marker, Pulse, REGION_FROM_ZOOM, RadiusCircle, Route, StaticMap, UserPosition, circlePolygon, configureMaps, distanceMeters, formatDistance, locationPicker, locationPickerLabels, map, mapAssets, mapFlavor, mapLabels, mapPalette, mapStyle, mix, pathLength, pointAlong, project, setMapAssetsBase, sliceLine, staticMap, useMap };
513
- export type { ClusterPoint, ClusterProps, LngLat, LocationPickerLabels, LocationPickerProps, MapBrand, MapLabels, MapProps, MapRegion, MapStyleOptions, MarkerProps, PulseProps, RadiusCircleProps, RouteProps, StaticMapPlace, StaticMapProps, UserPositionProps };
540
+ export type { ClusterPoint, ClusterProps, LngLat, LocationPickerLabels, LocationPickerProps, MapBrand, MapLabels, MapProps, MapRegion, MapScheme, MapStyleOptions, MapVariant, MarkerProps, PulseProps, RadiusCircleProps, RouteProps, StaticMapPlace, StaticMapProps, UserPositionProps };