@panneau/fields 5.0.0-alpha.6 → 5.0.0-alpha.7

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 (67) hide show
  1. package/dist/boolean/BooleanField.js +78 -17
  2. package/dist/boolean/BooleanField.js.map +1 -1
  3. package/dist/color/ColorField.js.map +1 -1
  4. package/dist/date/DateField.js.map +1 -1
  5. package/dist/datetime/DateTimeField.js +107 -20
  6. package/dist/datetime/DateTimeField.js.map +1 -1
  7. package/dist/duration/DurationField.js +126 -41
  8. package/dist/duration/DurationField.js.map +1 -1
  9. package/dist/email/EmailField.js.map +1 -1
  10. package/dist/embed/EmbedField.js +185 -69
  11. package/dist/embed/EmbedField.js.map +1 -1
  12. package/dist/file/FileField.d.ts.map +1 -1
  13. package/dist/file/FileField.js +167 -77
  14. package/dist/file/FileField.js.map +1 -1
  15. package/dist/group/GroupField.js.map +1 -1
  16. package/dist/json/JsonField.js +104 -22
  17. package/dist/json/JsonField.js.map +1 -1
  18. package/dist/locales/index.js.map +1 -1
  19. package/dist/localized/LocalizedField.js.map +1 -1
  20. package/dist/location/LocationField.d.ts.map +1 -1
  21. package/dist/location/LocationField.js +351 -138
  22. package/dist/location/LocationField.js.map +1 -1
  23. package/dist/location/LocationMap.d.ts.map +1 -1
  24. package/dist/location/LocationMap.js +155 -65
  25. package/dist/location/LocationMap.js.map +1 -1
  26. package/dist/location/leafletCss.js.map +1 -1
  27. package/dist/location/nominatim.js.map +1 -1
  28. package/dist/missing/MissingField.d.ts +3 -2
  29. package/dist/missing/MissingField.d.ts.map +1 -1
  30. package/dist/missing/MissingField.js +3 -2
  31. package/dist/missing/MissingField.js.map +1 -1
  32. package/dist/number/NumberField.js.map +1 -1
  33. package/dist/range/RangeField.js +82 -11
  34. package/dist/range/RangeField.js.map +1 -1
  35. package/dist/relation/RelationField.js +485 -145
  36. package/dist/relation/RelationField.js.map +1 -1
  37. package/dist/repeater/RepeaterField.js +118 -34
  38. package/dist/repeater/RepeaterField.js.map +1 -1
  39. package/dist/select/SelectField.js.map +1 -1
  40. package/dist/shared/DefinitionField.js.map +1 -1
  41. package/dist/shared/builtIn.js.map +1 -1
  42. package/dist/shared/check.js.map +1 -1
  43. package/dist/shared/context.js.map +1 -1
  44. package/dist/shared/cx.js.map +1 -1
  45. package/dist/shared/dates.js.map +1 -1
  46. package/dist/shared/embed.js.map +1 -1
  47. package/dist/shared/entry.js.map +1 -1
  48. package/dist/shared/relation.js.map +1 -1
  49. package/dist/slug/SlugField.d.ts.map +1 -1
  50. package/dist/slug/SlugField.js +184 -36
  51. package/dist/slug/SlugField.js.map +1 -1
  52. package/dist/tags/TagsField.js.map +1 -1
  53. package/dist/tel/TelField.js.map +1 -1
  54. package/dist/text/TextField.js.map +1 -1
  55. package/dist/textarea/TextAreaField.js.map +1 -1
  56. package/dist/time/TimeField.js +64 -10
  57. package/dist/time/TimeField.js.map +1 -1
  58. package/dist/upload/FilePicker.js +107 -24
  59. package/dist/upload/FilePicker.js.map +1 -1
  60. package/dist/upload/UploadList.js.map +1 -1
  61. package/dist/upload/files.js.map +1 -1
  62. package/dist/upload/useRejectionMessage.js.map +1 -1
  63. package/dist/upload/useUploads.js.map +1 -1
  64. package/dist/uppy/uploader.js.map +1 -1
  65. package/dist/url/UrlField.js +69 -14
  66. package/dist/url/UrlField.js.map +1 -1
  67. package/package.json +4 -4
@@ -1,9 +1,15 @@
1
1
  import LocationField_module_default from "./LocationField.module.js";
2
2
  import { LEAFLET_CSS } from "./leafletCss.js";
3
- import { useEffect, useRef } from "react";
3
+ import { c } from "react/compiler-runtime";
4
+ import { useEffect, useEffectEvent, useRef } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  //#region src/location/LocationMap.tsx
6
7
  var STYLE_ID = "panneau-leaflet-css";
8
+ /** Loads Leaflet, outside the component: the React Compiler doesn't handle `import()`. */
9
+ async function loadLeaflet() {
10
+ const module = await import("leaflet");
11
+ return module.default ?? module;
12
+ }
7
13
  /** Adds Leaflet's stylesheet to the document of the map, once. */
8
14
  function injectStyles(document) {
9
15
  if (document.getElementById(STYLE_ID) === null) {
@@ -17,29 +23,78 @@ function injectStyles(document) {
17
23
  * A Leaflet map with a marker on the point. Clicking the map or dragging the marker moves the
18
24
  * point. Leaflet and its stylesheet load when the map first shows.
19
25
  */
20
- function LocationMap({ point, onChange, tiles, center, zoom, readOnly = false, label, className }) {
26
+ function LocationMap(t0) {
27
+ const $ = c(34);
28
+ const { point, onChange, tiles, center, zoom, readOnly: t1, label, className } = t0;
29
+ const readOnly = t1 === void 0 ? false : t1;
21
30
  const container = useRef(null);
22
31
  const map = useRef(null);
23
- const latest = useRef({
24
- onChange,
25
- readOnly
26
- });
27
- useEffect(() => {
28
- latest.current = {
32
+ let t2;
33
+ if ($[0] !== onChange || $[1] !== readOnly) {
34
+ t2 = {
29
35
  onChange,
30
36
  readOnly
31
37
  };
32
- });
33
- useEffect(() => {
34
- const element = container.current;
35
- if (element === null) return;
36
- let cancelled = false;
37
- import("leaflet").then((module) => {
38
- if (cancelled) return;
39
- const leaflet = module.default ?? module;
38
+ $[0] = onChange;
39
+ $[1] = readOnly;
40
+ $[2] = t2;
41
+ } else t2 = $[2];
42
+ const latest = useRef(t2);
43
+ let t3;
44
+ if ($[3] !== onChange || $[4] !== readOnly) {
45
+ t3 = () => {
46
+ latest.current = {
47
+ onChange,
48
+ readOnly
49
+ };
50
+ };
51
+ $[3] = onChange;
52
+ $[4] = readOnly;
53
+ $[5] = t3;
54
+ } else t3 = $[5];
55
+ useEffect(t3);
56
+ let t4;
57
+ if ($[6] !== zoom) {
58
+ t4 = function sync(next, pan) {
59
+ const current = map.current;
60
+ if (current === null) return;
61
+ if (next === null) {
62
+ current.marker?.remove();
63
+ current.marker = null;
64
+ return;
65
+ }
66
+ if (current.marker === null) {
67
+ const marker = current.leaflet.marker(next, {
68
+ draggable: !latest.current.readOnly,
69
+ keyboard: false,
70
+ icon: current.leaflet.divIcon({
71
+ className: LocationField_module_default.marker,
72
+ html: `<span class="${LocationField_module_default.pin}"></span>`,
73
+ iconSize: [24, 24],
74
+ iconAnchor: [12, 29]
75
+ })
76
+ }).addTo(current.map);
77
+ marker.on("dragend", () => {
78
+ const position = marker.getLatLng();
79
+ latest.current.onChange?.({
80
+ lat: position.lat,
81
+ lng: position.lng
82
+ });
83
+ });
84
+ current.marker = marker;
85
+ } else current.marker.setLatLng(next);
86
+ if (pan && !current.map.getBounds().contains(next)) current.map.setView(next, Math.max(current.map.getZoom(), zoom));
87
+ };
88
+ $[6] = zoom;
89
+ $[7] = t4;
90
+ } else t4 = $[7];
91
+ const sync = t4;
92
+ let t5;
93
+ if ($[8] !== center || $[9] !== point || $[10] !== sync || $[11] !== tiles.attribution || $[12] !== tiles.maxZoom || $[13] !== zoom) {
94
+ t5 = (leaflet, element, url) => {
40
95
  injectStyles(element.ownerDocument);
41
96
  const instance = leaflet.map(element, { attributionControl: true });
42
- leaflet.tileLayer(tiles.url, {
97
+ leaflet.tileLayer(url, {
43
98
  attribution: tiles.attribution,
44
99
  maxZoom: tiles.maxZoom ?? 19
45
100
  }).addTo(instance);
@@ -56,58 +111,93 @@ function LocationMap({ point, onChange, tiles, center, zoom, readOnly = false, l
56
111
  };
57
112
  instance.setView(point ?? center, point !== null ? zoom : 2);
58
113
  sync(point, false);
59
- });
60
- return () => {
61
- cancelled = true;
62
- map.current?.map.remove();
63
- map.current = null;
64
114
  };
65
- }, [tiles.url]);
66
- /** Puts the marker on the point, and the point in view. */
67
- function sync(next, pan) {
68
- const current = map.current;
69
- if (current === null) return;
70
- if (next === null) {
71
- current.marker?.remove();
72
- current.marker = null;
73
- return;
74
- }
75
- if (current.marker === null) {
76
- const marker = current.leaflet.marker(next, {
77
- draggable: !latest.current.readOnly,
78
- keyboard: false,
79
- icon: current.leaflet.divIcon({
80
- className: LocationField_module_default.marker,
81
- html: `<span class="${LocationField_module_default.pin}"></span>`,
82
- iconSize: [24, 24],
83
- iconAnchor: [12, 29]
84
- })
85
- }).addTo(current.map);
86
- marker.on("dragend", () => {
87
- const position = marker.getLatLng();
88
- latest.current.onChange?.({
89
- lat: position.lat,
90
- lng: position.lng
91
- });
115
+ $[8] = center;
116
+ $[9] = point;
117
+ $[10] = sync;
118
+ $[11] = tiles.attribution;
119
+ $[12] = tiles.maxZoom;
120
+ $[13] = zoom;
121
+ $[14] = t5;
122
+ } else t5 = $[14];
123
+ const create = useEffectEvent(t5);
124
+ const url_0 = tiles.url;
125
+ let t6;
126
+ if ($[15] !== create || $[16] !== url_0) {
127
+ t6 = () => {
128
+ const element_0 = container.current;
129
+ if (element_0 === null) return;
130
+ let cancelled = false;
131
+ loadLeaflet().then((leaflet_0) => {
132
+ if (!cancelled) create(leaflet_0, element_0, url_0);
92
133
  });
93
- current.marker = marker;
94
- } else current.marker.setLatLng(next);
95
- if (pan && !current.map.getBounds().contains(next)) current.map.setView(next, Math.max(current.map.getZoom(), zoom));
96
- }
134
+ return () => {
135
+ cancelled = true;
136
+ map.current?.map.remove();
137
+ map.current = null;
138
+ };
139
+ };
140
+ $[15] = create;
141
+ $[16] = url_0;
142
+ $[17] = t6;
143
+ } else t6 = $[17];
144
+ let t7;
145
+ if ($[18] !== url_0) {
146
+ t7 = [url_0];
147
+ $[18] = url_0;
148
+ $[19] = t7;
149
+ } else t7 = $[19];
150
+ useEffect(t6, t7);
97
151
  const lat = point?.lat;
98
152
  const lng = point?.lng;
99
- useEffect(() => {
100
- sync(lat !== void 0 && lng !== void 0 ? {
101
- lat,
102
- lng
103
- } : null, true);
104
- }, [lat, lng]);
105
- return /* @__PURE__ */ jsx("div", {
106
- ref: container,
107
- className: [LocationField_module_default.map, className].filter(Boolean).join(" "),
108
- role: "application",
109
- "aria-label": label
110
- });
153
+ let t8;
154
+ if ($[20] !== sync) {
155
+ t8 = (next_0) => sync(next_0, true);
156
+ $[20] = sync;
157
+ $[21] = t8;
158
+ } else t8 = $[21];
159
+ const show = useEffectEvent(t8);
160
+ let t9;
161
+ if ($[22] !== lat || $[23] !== lng || $[24] !== show) {
162
+ t9 = () => {
163
+ show(lat !== void 0 && lng !== void 0 ? {
164
+ lat,
165
+ lng
166
+ } : null);
167
+ };
168
+ $[22] = lat;
169
+ $[23] = lng;
170
+ $[24] = show;
171
+ $[25] = t9;
172
+ } else t9 = $[25];
173
+ let t10;
174
+ if ($[26] !== lat || $[27] !== lng) {
175
+ t10 = [lat, lng];
176
+ $[26] = lat;
177
+ $[27] = lng;
178
+ $[28] = t10;
179
+ } else t10 = $[28];
180
+ useEffect(t9, t10);
181
+ let t11;
182
+ if ($[29] !== className) {
183
+ t11 = [LocationField_module_default.map, className].filter(Boolean);
184
+ $[29] = className;
185
+ $[30] = t11;
186
+ } else t11 = $[30];
187
+ const t12 = t11.join(" ");
188
+ let t13;
189
+ if ($[31] !== label || $[32] !== t12) {
190
+ t13 = /* @__PURE__ */ jsx("div", {
191
+ ref: container,
192
+ className: t12,
193
+ role: "application",
194
+ "aria-label": label
195
+ });
196
+ $[31] = label;
197
+ $[32] = t12;
198
+ $[33] = t13;
199
+ } else t13 = $[33];
200
+ return t13;
111
201
  }
112
202
  //#endregion
113
203
  export { LocationMap };
@@ -1 +1 @@
1
- {"version":3,"file":"LocationMap.js","names":["styles"],"sources":["../../src/location/LocationMap.tsx"],"sourcesContent":["import type * as LeafletModule from 'leaflet';\nimport { useEffect, useRef } from 'react';\n\nimport styles from './LocationField.module.css';\nimport { LEAFLET_CSS } from './leafletCss';\nimport type { MapTiles } from './types';\n\ntype Leaflet = typeof LeafletModule;\ntype LeafletMap = LeafletModule.Map;\ntype LeafletMarker = LeafletModule.Marker;\n\nconst STYLE_ID = 'panneau-leaflet-css';\n\n/** Adds Leaflet's stylesheet to the document of the map, once. */\nfunction injectStyles(document: Document) {\n if (document.getElementById(STYLE_ID) === null) {\n const style = document.createElement('style');\n style.id = STYLE_ID;\n style.textContent = LEAFLET_CSS;\n document.head.append(style);\n }\n}\n\nexport interface Point {\n lat: number;\n lng: number;\n}\n\nexport interface LocationMapProps {\n point: Point | null;\n /** Called with the point clicked, or where the marker was dropped. */\n onChange?: (point: Point) => void;\n tiles: MapTiles;\n /** Where the map opens without a point. */\n center: Point;\n /** Zoom of the map on a point; the map opens wider without one. */\n zoom: number;\n readOnly?: boolean;\n /** Accessible name of the map. */\n label: string;\n className?: string;\n}\n\n/**\n * A Leaflet map with a marker on the point. Clicking the map or dragging the marker moves the\n * point. Leaflet and its stylesheet load when the map first shows.\n */\nexport function LocationMap({\n point,\n onChange,\n tiles,\n center,\n zoom,\n readOnly = false,\n label,\n className,\n}: LocationMapProps) {\n const container = useRef<HTMLDivElement>(null);\n const map = useRef<{ leaflet: Leaflet; map: LeafletMap; marker: LeafletMarker | null } | null>(\n null,\n );\n // The latest values, for the handlers of the map\n const latest = useRef({ onChange, readOnly });\n useEffect(() => {\n latest.current = { onChange, readOnly };\n });\n\n // Creates the map once Leaflet is loaded\n useEffect(() => {\n const element = container.current;\n if (element === null) {\n return undefined;\n }\n let cancelled = false;\n void import('leaflet').then((module) => {\n if (cancelled) {\n return;\n }\n const leaflet = ((module as { default?: Leaflet }).default ?? module) as Leaflet;\n injectStyles(element.ownerDocument);\n const instance = leaflet.map(element, { attributionControl: true });\n leaflet\n .tileLayer(tiles.url, {\n attribution: tiles.attribution,\n maxZoom: tiles.maxZoom ?? 19,\n })\n .addTo(instance);\n instance.on('click', (event) => {\n if (!latest.current.readOnly) {\n latest.current.onChange?.({ lat: event.latlng.lat, lng: event.latlng.lng });\n }\n });\n map.current = { leaflet, map: instance, marker: null };\n instance.setView(point ?? center, point !== null ? zoom : 2);\n sync(point, false);\n });\n return () => {\n cancelled = true;\n map.current?.map.remove();\n map.current = null;\n };\n // The map is made once; later changes go through the effect below\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [tiles.url]);\n\n /** Puts the marker on the point, and the point in view. */\n function sync(next: Point | null, pan: boolean) {\n const current = map.current;\n if (current === null) {\n return;\n }\n if (next === null) {\n current.marker?.remove();\n current.marker = null;\n return;\n }\n if (current.marker === null) {\n const marker = current.leaflet\n .marker(next, {\n draggable: !latest.current.readOnly,\n keyboard: false,\n icon: current.leaflet.divIcon({\n className: styles.marker,\n // Leaflet places the icon with `transform`: the pin turns inside it\n html: `<span class=\"${styles.pin}\"></span>`,\n iconSize: [24, 24],\n iconAnchor: [12, 29],\n }),\n })\n .addTo(current.map);\n marker.on('dragend', () => {\n const position = marker.getLatLng();\n latest.current.onChange?.({ lat: position.lat, lng: position.lng });\n });\n current.marker = marker;\n } else {\n current.marker.setLatLng(next);\n }\n if (pan && !current.map.getBounds().contains(next)) {\n current.map.setView(next, Math.max(current.map.getZoom(), zoom));\n }\n }\n\n const lat = point?.lat;\n const lng = point?.lng;\n useEffect(() => {\n sync(lat !== undefined && lng !== undefined ? { lat, lng } : null, true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [lat, lng]);\n\n return (\n <div\n ref={container}\n className={[styles.map, className].filter(Boolean).join(' ')}\n role=\"application\"\n aria-label={label}\n />\n );\n}\n"],"mappings":";;;;;AAWA,IAAM,WAAW;;AAGjB,SAAS,aAAa,UAAoB;CACtC,IAAI,SAAS,eAAe,QAAQ,MAAM,MAAM;EAC5C,MAAM,QAAQ,SAAS,cAAc,OAAO;EAC5C,MAAM,KAAK;EACX,MAAM,cAAc;EACpB,SAAS,KAAK,OAAO,KAAK;CAC9B;AACJ;;;;;AA0BA,SAAgB,YAAY,EACxB,OACA,UACA,OACA,QACA,MACA,WAAW,OACX,OACA,aACiB;CACjB,MAAM,YAAY,OAAuB,IAAI;CAC7C,MAAM,MAAM,OACR,IACJ;CAEA,MAAM,SAAS,OAAO;EAAE;EAAU;CAAS,CAAC;CAC5C,gBAAgB;EACZ,OAAO,UAAU;GAAE;GAAU;EAAS;CAC1C,CAAC;CAGD,gBAAgB;EACZ,MAAM,UAAU,UAAU;EAC1B,IAAI,YAAY,MACZ;EAEJ,IAAI,YAAY;EAChB,OAAY,UAAU,CAAC,MAAM,WAAW;GACpC,IAA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AK,SAAS;KAAK,KAAK,SAAS;IAAI,CAAC;GACtE,CAAC;GACD,QAAQ,SAAS;EACrB,OACI,QAAQ,OAAO,UAAU,IAAI;EAEjC,IAAI,OAAO,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC,SAAS,IAAI,GAC7C,QAAQ,IAAI,QAAQ,MAAM,KAAK,IAAI,QAAQ,IAAI,QAAQ,GAAG,IAAI,CAAC;CAEvE;CAEA,MAAM,MAAM,OAAO;CACnB,MAAM,MAAM,OAAO;CACnB,gBAAgB;EACZ,KAAK,QAAQ,KAAA,KAAa,QAAQ,KAAA,IAAY;GAAE;GAAK;EAAI,IAAI,MAAM,IAAI;CAE3E,GAAG,CAAC,KAAK,GAAG,CAAC;CAEb,OACI,oBAAC,OAAD;EACI,KAAK;EACL,WAAW,CAACA,6BAAO,KAAK,SAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC3D,MAAK;EACL,cAAY;CAAM,CAAA;AAG9B"}
1
+ {"version":3,"file":"LocationMap.js","names":["LeafletModule","useEffect","useEffectEvent","useRef","styles","LEAFLET_CSS","MapTiles","Leaflet","LeafletMap","Map","LeafletMarker","Marker","STYLE_ID","loadLeaflet","Promise","module","default","injectStyles","document","Document","getElementById","style","createElement","id","textContent","head","append","Point","lat","lng","LocationMapProps","point","onChange","tiles","center","zoom","readOnly","label","className","LocationMap","t0","$","_c","t1","undefined","container","map","t2","latest","t3","current","t4","sync","next","pan","marker","remove","leaflet","draggable","keyboard","icon","divIcon","html","pin","iconSize","iconAnchor","addTo","on","position","getLatLng","setLatLng","getBounds","contains","setView","Math","max","getZoom","t5","attribution","maxZoom","element","url","ownerDocument","instance","attributionControl","tileLayer","event","latlng","create","url_0","t6","element_0","cancelled","then","leaflet_0","t7","t8","next_0","show","t9","t10","t11","filter","Boolean","t12","join","t13","_c","styles"],"sources":["../../src/location/LocationMap.tsx"],"sourcesContent":["import type * as LeafletModule from 'leaflet';\nimport { useEffect, useEffectEvent, useRef } from 'react';\n\nimport styles from './LocationField.module.css';\nimport { LEAFLET_CSS } from './leafletCss';\nimport type { MapTiles } from './types';\n\ntype Leaflet = typeof LeafletModule;\ntype LeafletMap = LeafletModule.Map;\ntype LeafletMarker = LeafletModule.Marker;\n\nconst STYLE_ID = 'panneau-leaflet-css';\n\n/** Loads Leaflet, outside the component: the React Compiler doesn't handle `import()`. */\nasync function loadLeaflet(): Promise<Leaflet> {\n const module = await import('leaflet');\n return ((module as { default?: Leaflet }).default ?? module) as Leaflet;\n}\n\n/** Adds Leaflet's stylesheet to the document of the map, once. */\nfunction injectStyles(document: Document) {\n if (document.getElementById(STYLE_ID) === null) {\n const style = document.createElement('style');\n style.id = STYLE_ID;\n style.textContent = LEAFLET_CSS;\n document.head.append(style);\n }\n}\n\nexport interface Point {\n lat: number;\n lng: number;\n}\n\nexport interface LocationMapProps {\n point: Point | null;\n /** Called with the point clicked, or where the marker was dropped. */\n onChange?: (point: Point) => void;\n tiles: MapTiles;\n /** Where the map opens without a point. */\n center: Point;\n /** Zoom of the map on a point; the map opens wider without one. */\n zoom: number;\n readOnly?: boolean;\n /** Accessible name of the map. */\n label: string;\n className?: string;\n}\n\n/**\n * A Leaflet map with a marker on the point. Clicking the map or dragging the marker moves the\n * point. Leaflet and its stylesheet load when the map first shows.\n */\nexport function LocationMap({\n point,\n onChange,\n tiles,\n center,\n zoom,\n readOnly = false,\n label,\n className,\n}: LocationMapProps) {\n const container = useRef<HTMLDivElement>(null);\n const map = useRef<{ leaflet: Leaflet; map: LeafletMap; marker: LeafletMarker | null } | null>(\n null,\n );\n // The latest values, for the handlers of the map\n const latest = useRef({ onChange, readOnly });\n useEffect(() => {\n latest.current = { onChange, readOnly };\n });\n\n /** Puts the marker on the point, and the point in view. */\n function sync(next: Point | null, pan: boolean) {\n const current = map.current;\n if (current === null) {\n return;\n }\n if (next === null) {\n current.marker?.remove();\n current.marker = null;\n return;\n }\n if (current.marker === null) {\n const marker = current.leaflet\n .marker(next, {\n draggable: !latest.current.readOnly,\n keyboard: false,\n icon: current.leaflet.divIcon({\n className: styles.marker,\n // Leaflet places the icon with `transform`: the pin turns inside it\n html: `<span class=\"${styles.pin}\"></span>`,\n iconSize: [24, 24],\n iconAnchor: [12, 29],\n }),\n })\n .addTo(current.map);\n marker.on('dragend', () => {\n const position = marker.getLatLng();\n latest.current.onChange?.({ lat: position.lat, lng: position.lng });\n });\n current.marker = marker;\n } else {\n current.marker.setLatLng(next);\n }\n if (pan && !current.map.getBounds().contains(next)) {\n current.map.setView(next, Math.max(current.map.getZoom(), zoom));\n }\n }\n\n // Creates the map once Leaflet is loaded, with the latest props. It is made again for other\n // tiles only: later points go through the effect below.\n const create = useEffectEvent((leaflet: Leaflet, element: HTMLDivElement, url: string) => {\n injectStyles(element.ownerDocument);\n const instance = leaflet.map(element, { attributionControl: true });\n leaflet\n .tileLayer(url, {\n attribution: tiles.attribution,\n maxZoom: tiles.maxZoom ?? 19,\n })\n .addTo(instance);\n instance.on('click', (event) => {\n if (!latest.current.readOnly) {\n latest.current.onChange?.({ lat: event.latlng.lat, lng: event.latlng.lng });\n }\n });\n map.current = { leaflet, map: instance, marker: null };\n instance.setView(point ?? center, point !== null ? zoom : 2);\n sync(point, false);\n });\n const url = tiles.url;\n useEffect(() => {\n const element = container.current;\n if (element === null) {\n return undefined;\n }\n let cancelled = false;\n void loadLeaflet().then((leaflet) => {\n if (!cancelled) {\n create(leaflet, element, url);\n }\n });\n return () => {\n cancelled = true;\n map.current?.map.remove();\n map.current = null;\n };\n }, [url]);\n\n const lat = point?.lat;\n const lng = point?.lng;\n const show = useEffectEvent((next: Point | null) => sync(next, true));\n useEffect(() => {\n show(lat !== undefined && lng !== undefined ? { lat, lng } : null);\n }, [lat, lng]);\n\n return (\n <div\n ref={container}\n className={[styles.map, className].filter(Boolean).join(' ')}\n role=\"application\"\n aria-label={label}\n />\n );\n}\n"],"mappings":";;;;;;AAWA,IAAMY,WAAW;;AAGjB,eAAeC,cAAgC;CAC3C,M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AAK,CAAA;EACnBI,EAAA,MAAAJ;EAAAI,EAAA,MAAA+D;EAAA/D,EAAA,MAAAiE;CAAA,OAAAA,MAAAjE,EAAA;CAAA,OALFiE;AAKE"}
@@ -1 +1 @@
1
- {"version":3,"file":"leafletCss.js","names":[],"sources":["../../src/location/leafletCss.ts"],"sourcesContent":["// The stylesheet of Leaflet 1.9.4 (BSD-2-Clause, (c) Volodymyr Agafonkin and CloudMade), without\n// its comments: Leaflet's own classes, injected once when a map first shows. Regenerate it from\n// leaflet/dist/leaflet.css when Leaflet is updated.\nexport const LEAFLET_CSS =\n '.leaflet-pane,\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-tile-container,\\r\\n.leaflet-pane > svg,\\r\\n.leaflet-pane > canvas,\\r\\n.leaflet-zoom-box,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-layer {\\r\\n\\tposition: absolute;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\toverflow: hidden;\\r\\n\\t}\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\t-webkit-user-select: none;\\r\\n\\t -moz-user-select: none;\\r\\n\\t user-select: none;\\r\\n\\t -webkit-user-drag: none;\\r\\n\\t}\\r\\n.leaflet-tile::selection {\\r\\n\\tbackground: transparent;\\r\\n}\\r\\n.leaflet-safari .leaflet-tile {\\r\\n\\timage-rendering: -webkit-optimize-contrast;\\r\\n\\t}\\r\\n.leaflet-safari .leaflet-tile-container {\\r\\n\\twidth: 1600px;\\r\\n\\theight: 1600px;\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t}\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-container .leaflet-overlay-pane svg {\\r\\n\\tmax-width: none !important;\\r\\n\\tmax-height: none !important;\\r\\n\\t}\\r\\n.leaflet-container .leaflet-marker-pane img,\\r\\n.leaflet-container .leaflet-shadow-pane img,\\r\\n.leaflet-container .leaflet-tile-pane img,\\r\\n.leaflet-container img.leaflet-image-layer,\\r\\n.leaflet-container .leaflet-tile {\\r\\n\\tmax-width: none !important;\\r\\n\\tmax-height: none !important;\\r\\n\\twidth: auto;\\r\\n\\tpadding: 0;\\r\\n\\t}\\r\\n.leaflet-container img.leaflet-tile {\\r\\n\\tmix-blend-mode: plus-lighter;\\r\\n}\\r\\n.leaflet-container.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: pan-x pan-y;\\r\\n\\ttouch-action: pan-x pan-y;\\r\\n\\t}\\r\\n.leaflet-container.leaflet-touch-drag {\\r\\n\\t-ms-touch-action: pinch-zoom;\\r\\n\\ttouch-action: none;\\r\\n\\ttouch-action: pinch-zoom;\\r\\n}\\r\\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: none;\\r\\n\\ttouch-action: none;\\r\\n}\\r\\n.leaflet-container {\\r\\n\\t-webkit-tap-highlight-color: transparent;\\r\\n}\\r\\n.leaflet-container a {\\r\\n\\t-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);\\r\\n}\\r\\n.leaflet-tile {\\r\\n\\tfilter: inherit;\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n.leaflet-tile-loaded {\\r\\n\\tvisibility: inherit;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\twidth: 0;\\r\\n\\theight: 0;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\tz-index: 800;\\r\\n\\t}\\r\\n.leaflet-overlay-pane svg {\\r\\n\\t-moz-user-select: none;\\r\\n\\t}\\r\\n.leaflet-pane { z-index: 400; }\\r\\n.leaflet-tile-pane { z-index: 200; }\\r\\n.leaflet-overlay-pane { z-index: 400; }\\r\\n.leaflet-shadow-pane { z-index: 500; }\\r\\n.leaflet-marker-pane { z-index: 600; }\\r\\n.leaflet-tooltip-pane { z-index: 650; }\\r\\n.leaflet-popup-pane { z-index: 700; }\\r\\n.leaflet-map-pane canvas { z-index: 100; }\\r\\n.leaflet-map-pane svg { z-index: 200; }\\r\\n.leaflet-vml-shape {\\r\\n\\twidth: 1px;\\r\\n\\theight: 1px;\\r\\n\\t}\\r\\n.lvml {\\r\\n\\tbehavior: url(#default#VML);\\r\\n\\tdisplay: inline-block;\\r\\n\\tposition: absolute;\\r\\n\\t}\\r\\n.leaflet-control {\\r\\n\\tposition: relative;\\r\\n\\tz-index: 800;\\r\\n\\tpointer-events: visiblePainted; \\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-top,\\r\\n.leaflet-bottom {\\r\\n\\tposition: absolute;\\r\\n\\tz-index: 1000;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-top {\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-right {\\r\\n\\tright: 0;\\r\\n\\t}\\r\\n.leaflet-bottom {\\r\\n\\tbottom: 0;\\r\\n\\t}\\r\\n.leaflet-left {\\r\\n\\tleft: 0;\\r\\n\\t}\\r\\n.leaflet-control {\\r\\n\\tfloat: left;\\r\\n\\tclear: both;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tfloat: right;\\r\\n\\t}\\r\\n.leaflet-top .leaflet-control {\\r\\n\\tmargin-top: 10px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control {\\r\\n\\tmargin-bottom: 10px;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control {\\r\\n\\tmargin-left: 10px;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tmargin-right: 10px;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-popup {\\r\\n\\topacity: 0;\\r\\n\\t-webkit-transition: opacity 0.2s linear;\\r\\n\\t -moz-transition: opacity 0.2s linear;\\r\\n\\t transition: opacity 0.2s linear;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\\r\\n\\topacity: 1;\\r\\n\\t}\\r\\n.leaflet-zoom-animated {\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t -ms-transform-origin: 0 0;\\r\\n\\t transform-origin: 0 0;\\r\\n\\t}\\r\\nsvg.leaflet-zoom-animated {\\r\\n\\twill-change: transform;\\r\\n}\\r\\n.leaflet-zoom-anim .leaflet-zoom-animated {\\r\\n\\t-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t transition: transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-tile,\\r\\n.leaflet-pan-anim .leaflet-tile {\\r\\n\\t-webkit-transition: none;\\r\\n\\t -moz-transition: none;\\r\\n\\t transition: none;\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-zoom-hide {\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n.leaflet-interactive {\\r\\n\\tcursor: pointer;\\r\\n\\t}\\r\\n.leaflet-grab {\\r\\n\\tcursor: -webkit-grab;\\r\\n\\tcursor: -moz-grab;\\r\\n\\tcursor: grab;\\r\\n\\t}\\r\\n.leaflet-crosshair,\\r\\n.leaflet-crosshair .leaflet-interactive {\\r\\n\\tcursor: crosshair;\\r\\n\\t}\\r\\n.leaflet-popup-pane,\\r\\n.leaflet-control {\\r\\n\\tcursor: auto;\\r\\n\\t}\\r\\n.leaflet-dragging .leaflet-grab,\\r\\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\\r\\n.leaflet-dragging .leaflet-marker-draggable {\\r\\n\\tcursor: move;\\r\\n\\tcursor: -webkit-grabbing;\\r\\n\\tcursor: -moz-grabbing;\\r\\n\\tcursor: grabbing;\\r\\n\\t}\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-pane > svg path,\\r\\n.leaflet-tile-container {\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-marker-icon.leaflet-interactive,\\r\\n.leaflet-image-layer.leaflet-interactive,\\r\\n.leaflet-pane > svg path.leaflet-interactive,\\r\\nsvg.leaflet-image-layer.leaflet-interactive path {\\r\\n\\tpointer-events: visiblePainted; \\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\tbackground: #ddd;\\r\\n\\toutline-offset: 1px;\\r\\n\\t}\\r\\n.leaflet-container a {\\r\\n\\tcolor: #0078A8;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\tborder: 2px dotted #38f;\\r\\n\\tbackground: rgba(255,255,255,0.5);\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\tfont-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\\r\\n\\tfont-size: 12px;\\r\\n\\tfont-size: 0.75rem;\\r\\n\\tline-height: 1.5;\\r\\n\\t}\\r\\n.leaflet-bar {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.65);\\r\\n\\tborder-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a {\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder-bottom: 1px solid #ccc;\\r\\n\\twidth: 26px;\\r\\n\\theight: 26px;\\r\\n\\tline-height: 26px;\\r\\n\\tdisplay: block;\\r\\n\\ttext-align: center;\\r\\n\\ttext-decoration: none;\\r\\n\\tcolor: black;\\r\\n\\t}\\r\\n.leaflet-bar a,\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-position: 50% 50%;\\r\\n\\tbackground-repeat: no-repeat;\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-bar a:hover,\\r\\n.leaflet-bar a:focus {\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\t}\\r\\n.leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 4px;\\r\\n\\tborder-top-right-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 4px;\\r\\n\\tborder-bottom-right-radius: 4px;\\r\\n\\tborder-bottom: none;\\r\\n\\t}\\r\\n.leaflet-bar a.leaflet-disabled {\\r\\n\\tcursor: default;\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\tcolor: #bbb;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a {\\r\\n\\twidth: 30px;\\r\\n\\theight: 30px;\\r\\n\\tline-height: 30px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 2px;\\r\\n\\tborder-top-right-radius: 2px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 2px;\\r\\n\\tborder-bottom-right-radius: 2px;\\r\\n\\t}\\r\\n.leaflet-control-zoom-in,\\r\\n.leaflet-control-zoom-out {\\r\\n\\tfont: bold 18px \\'Lucida Console\\', Monaco, monospace;\\r\\n\\ttext-indent: 1px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {\\r\\n\\tfont-size: 22px;\\r\\n\\t}\\r\\n.leaflet-control-layers {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.4);\\r\\n\\tbackground: #fff;\\r\\n\\tborder-radius: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(images/layers.png);\\r\\n\\twidth: 36px;\\r\\n\\theight: 36px;\\r\\n\\t}\\r\\n.leaflet-retina .leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(images/layers-2x.png);\\r\\n\\tbackground-size: 26px 26px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers-toggle {\\r\\n\\twidth: 44px;\\r\\n\\theight: 44px;\\r\\n\\t}\\r\\n.leaflet-control-layers .leaflet-control-layers-list,\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\\r\\n\\tdisplay: none;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\\r\\n\\tdisplay: block;\\r\\n\\tposition: relative;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded {\\r\\n\\tpadding: 6px 10px 6px 6px;\\r\\n\\tcolor: #333;\\r\\n\\tbackground: #fff;\\r\\n\\t}\\r\\n.leaflet-control-layers-scrollbar {\\r\\n\\toverflow-y: scroll;\\r\\n\\toverflow-x: hidden;\\r\\n\\tpadding-right: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-selector {\\r\\n\\tmargin-top: 2px;\\r\\n\\tposition: relative;\\r\\n\\ttop: 1px;\\r\\n\\t}\\r\\n.leaflet-control-layers label {\\r\\n\\tdisplay: block;\\r\\n\\tfont-size: 13px;\\r\\n\\tfont-size: 1.08333em;\\r\\n\\t}\\r\\n.leaflet-control-layers-separator {\\r\\n\\theight: 0;\\r\\n\\tborder-top: 1px solid #ddd;\\r\\n\\tmargin: 5px -10px 5px -6px;\\r\\n\\t}\\r\\n.leaflet-default-icon-path { \\r\\n\\tbackground-image: url(images/marker-icon.png);\\r\\n\\t}\\r\\n.leaflet-container .leaflet-control-attribution {\\r\\n\\tbackground: #fff;\\r\\n\\tbackground: rgba(255, 255, 255, 0.8);\\r\\n\\tmargin: 0;\\r\\n\\t}\\r\\n.leaflet-control-attribution,\\r\\n.leaflet-control-scale-line {\\r\\n\\tpadding: 0 5px;\\r\\n\\tcolor: #333;\\r\\n\\tline-height: 1.4;\\r\\n\\t}\\r\\n.leaflet-control-attribution a {\\r\\n\\ttext-decoration: none;\\r\\n\\t}\\r\\n.leaflet-control-attribution a:hover,\\r\\n.leaflet-control-attribution a:focus {\\r\\n\\ttext-decoration: underline;\\r\\n\\t}\\r\\n.leaflet-attribution-flag {\\r\\n\\tdisplay: inline !important;\\r\\n\\tvertical-align: baseline !important;\\r\\n\\twidth: 1em;\\r\\n\\theight: 0.6669em;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control-scale {\\r\\n\\tmargin-left: 5px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control-scale {\\r\\n\\tmargin-bottom: 5px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line {\\r\\n\\tborder: 2px solid #777;\\r\\n\\tborder-top: none;\\r\\n\\tline-height: 1.1;\\r\\n\\tpadding: 2px 5px 1px;\\r\\n\\twhite-space: nowrap;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\tbackground: rgba(255, 255, 255, 0.8);\\r\\n\\ttext-shadow: 1px 1px #fff;\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child) {\\r\\n\\tborder-top: 2px solid #777;\\r\\n\\tborder-bottom: none;\\r\\n\\tmargin-top: -2px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\\r\\n\\tborder-bottom: 2px solid #777;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-attribution,\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tbox-shadow: none;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tborder: 2px solid rgba(0,0,0,0.2);\\r\\n\\tbackground-clip: padding-box;\\r\\n\\t}\\r\\n.leaflet-popup {\\r\\n\\tposition: absolute;\\r\\n\\ttext-align: center;\\r\\n\\tmargin-bottom: 20px;\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper {\\r\\n\\tpadding: 1px;\\r\\n\\ttext-align: left;\\r\\n\\tborder-radius: 12px;\\r\\n\\t}\\r\\n.leaflet-popup-content {\\r\\n\\tmargin: 13px 24px 13px 20px;\\r\\n\\tline-height: 1.3;\\r\\n\\tfont-size: 13px;\\r\\n\\tfont-size: 1.08333em;\\r\\n\\tmin-height: 1px;\\r\\n\\t}\\r\\n.leaflet-popup-content p {\\r\\n\\tmargin: 17px 0;\\r\\n\\tmargin: 1.3em 0;\\r\\n\\t}\\r\\n.leaflet-popup-tip-container {\\r\\n\\twidth: 40px;\\r\\n\\theight: 20px;\\r\\n\\tposition: absolute;\\r\\n\\tleft: 50%;\\r\\n\\tmargin-top: -1px;\\r\\n\\tmargin-left: -20px;\\r\\n\\toverflow: hidden;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-popup-tip {\\r\\n\\twidth: 17px;\\r\\n\\theight: 17px;\\r\\n\\tpadding: 1px;\\r\\n\\tmargin: -10px auto 0;\\r\\n\\tpointer-events: auto;\\r\\n\\t-webkit-transform: rotate(45deg);\\r\\n\\t -moz-transform: rotate(45deg);\\r\\n\\t -ms-transform: rotate(45deg);\\r\\n\\t transform: rotate(45deg);\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper,\\r\\n.leaflet-popup-tip {\\r\\n\\tbackground: white;\\r\\n\\tcolor: #333;\\r\\n\\tbox-shadow: 0 3px 14px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button {\\r\\n\\tposition: absolute;\\r\\n\\ttop: 0;\\r\\n\\tright: 0;\\r\\n\\tborder: none;\\r\\n\\ttext-align: center;\\r\\n\\twidth: 24px;\\r\\n\\theight: 24px;\\r\\n\\tfont: 16px/24px Tahoma, Verdana, sans-serif;\\r\\n\\tcolor: #757575;\\r\\n\\ttext-decoration: none;\\r\\n\\tbackground: transparent;\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button:hover,\\r\\n.leaflet-container a.leaflet-popup-close-button:focus {\\r\\n\\tcolor: #585858;\\r\\n\\t}\\r\\n.leaflet-popup-scrolled {\\r\\n\\toverflow: auto;\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper {\\r\\n\\t-ms-zoom: 1;\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\twidth: 24px;\\r\\n\\tmargin: 0 auto;\\r\\n\\t-ms-filter: \"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)\";\\r\\n\\tfilter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-control-zoom,\\r\\n.leaflet-oldie .leaflet-control-layers,\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper,\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\tborder: 1px solid #999;\\r\\n\\t}\\r\\n.leaflet-div-icon {\\r\\n\\tbackground: #fff;\\r\\n\\tborder: 1px solid #666;\\r\\n\\t}\\r\\n.leaflet-tooltip {\\r\\n\\tposition: absolute;\\r\\n\\tpadding: 6px;\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder: 1px solid #fff;\\r\\n\\tborder-radius: 3px;\\r\\n\\tcolor: #222;\\r\\n\\twhite-space: nowrap;\\r\\n\\t-webkit-user-select: none;\\r\\n\\t-moz-user-select: none;\\r\\n\\t-ms-user-select: none;\\r\\n\\tuser-select: none;\\r\\n\\tpointer-events: none;\\r\\n\\tbox-shadow: 0 1px 3px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-tooltip.leaflet-interactive {\\r\\n\\tcursor: pointer;\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before,\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tposition: absolute;\\r\\n\\tpointer-events: none;\\r\\n\\tborder: 6px solid transparent;\\r\\n\\tbackground: transparent;\\r\\n\\tcontent: \"\";\\r\\n\\t}\\r\\n.leaflet-tooltip-bottom {\\r\\n\\tmargin-top: 6px;\\r\\n}\\r\\n.leaflet-tooltip-top {\\r\\n\\tmargin-top: -6px;\\r\\n}\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tleft: 50%;\\r\\n\\tmargin-left: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tbottom: 0;\\r\\n\\tmargin-bottom: -12px;\\r\\n\\tborder-top-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-bottom:before {\\r\\n\\ttop: 0;\\r\\n\\tmargin-top: -12px;\\r\\n\\tmargin-left: -6px;\\r\\n\\tborder-bottom-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-left {\\r\\n\\tmargin-left: -6px;\\r\\n}\\r\\n.leaflet-tooltip-right {\\r\\n\\tmargin-left: 6px;\\r\\n}\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\ttop: 50%;\\r\\n\\tmargin-top: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-left:before {\\r\\n\\tright: 0;\\r\\n\\tmargin-right: -12px;\\r\\n\\tborder-left-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tleft: 0;\\r\\n\\tmargin-left: -12px;\\r\\n\\tborder-right-color: #fff;\\r\\n\\t}\\r\\n@media print {\\r\\n\\t.leaflet-control {\\r\\n\\t\\t-webkit-print-color-adjust: exact;\\r\\n\\t\\tprint-color-adjust: exact;\\r\\n\\t\\t}\\r\\n\\t}';\n"],"mappings":";AAGA,IAAa,cACT"}
1
+ {"version":3,"file":"leafletCss.js","names":["LEAFLET_CSS"],"sources":["../../src/location/leafletCss.ts"],"sourcesContent":["// The stylesheet of Leaflet 1.9.4 (BSD-2-Clause, (c) Volodymyr Agafonkin and CloudMade), without\n// its comments: Leaflet's own classes, injected once when a map first shows. Regenerate it from\n// leaflet/dist/leaflet.css when Leaflet is updated.\nexport const LEAFLET_CSS =\n '.leaflet-pane,\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-tile-container,\\r\\n.leaflet-pane > svg,\\r\\n.leaflet-pane > canvas,\\r\\n.leaflet-zoom-box,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-layer {\\r\\n\\tposition: absolute;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\toverflow: hidden;\\r\\n\\t}\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\t-webkit-user-select: none;\\r\\n\\t -moz-user-select: none;\\r\\n\\t user-select: none;\\r\\n\\t -webkit-user-drag: none;\\r\\n\\t}\\r\\n.leaflet-tile::selection {\\r\\n\\tbackground: transparent;\\r\\n}\\r\\n.leaflet-safari .leaflet-tile {\\r\\n\\timage-rendering: -webkit-optimize-contrast;\\r\\n\\t}\\r\\n.leaflet-safari .leaflet-tile-container {\\r\\n\\twidth: 1600px;\\r\\n\\theight: 1600px;\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t}\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-container .leaflet-overlay-pane svg {\\r\\n\\tmax-width: none !important;\\r\\n\\tmax-height: none !important;\\r\\n\\t}\\r\\n.leaflet-container .leaflet-marker-pane img,\\r\\n.leaflet-container .leaflet-shadow-pane img,\\r\\n.leaflet-container .leaflet-tile-pane img,\\r\\n.leaflet-container img.leaflet-image-layer,\\r\\n.leaflet-container .leaflet-tile {\\r\\n\\tmax-width: none !important;\\r\\n\\tmax-height: none !important;\\r\\n\\twidth: auto;\\r\\n\\tpadding: 0;\\r\\n\\t}\\r\\n.leaflet-container img.leaflet-tile {\\r\\n\\tmix-blend-mode: plus-lighter;\\r\\n}\\r\\n.leaflet-container.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: pan-x pan-y;\\r\\n\\ttouch-action: pan-x pan-y;\\r\\n\\t}\\r\\n.leaflet-container.leaflet-touch-drag {\\r\\n\\t-ms-touch-action: pinch-zoom;\\r\\n\\ttouch-action: none;\\r\\n\\ttouch-action: pinch-zoom;\\r\\n}\\r\\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: none;\\r\\n\\ttouch-action: none;\\r\\n}\\r\\n.leaflet-container {\\r\\n\\t-webkit-tap-highlight-color: transparent;\\r\\n}\\r\\n.leaflet-container a {\\r\\n\\t-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);\\r\\n}\\r\\n.leaflet-tile {\\r\\n\\tfilter: inherit;\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n.leaflet-tile-loaded {\\r\\n\\tvisibility: inherit;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\twidth: 0;\\r\\n\\theight: 0;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\tz-index: 800;\\r\\n\\t}\\r\\n.leaflet-overlay-pane svg {\\r\\n\\t-moz-user-select: none;\\r\\n\\t}\\r\\n.leaflet-pane { z-index: 400; }\\r\\n.leaflet-tile-pane { z-index: 200; }\\r\\n.leaflet-overlay-pane { z-index: 400; }\\r\\n.leaflet-shadow-pane { z-index: 500; }\\r\\n.leaflet-marker-pane { z-index: 600; }\\r\\n.leaflet-tooltip-pane { z-index: 650; }\\r\\n.leaflet-popup-pane { z-index: 700; }\\r\\n.leaflet-map-pane canvas { z-index: 100; }\\r\\n.leaflet-map-pane svg { z-index: 200; }\\r\\n.leaflet-vml-shape {\\r\\n\\twidth: 1px;\\r\\n\\theight: 1px;\\r\\n\\t}\\r\\n.lvml {\\r\\n\\tbehavior: url(#default#VML);\\r\\n\\tdisplay: inline-block;\\r\\n\\tposition: absolute;\\r\\n\\t}\\r\\n.leaflet-control {\\r\\n\\tposition: relative;\\r\\n\\tz-index: 800;\\r\\n\\tpointer-events: visiblePainted; \\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-top,\\r\\n.leaflet-bottom {\\r\\n\\tposition: absolute;\\r\\n\\tz-index: 1000;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-top {\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-right {\\r\\n\\tright: 0;\\r\\n\\t}\\r\\n.leaflet-bottom {\\r\\n\\tbottom: 0;\\r\\n\\t}\\r\\n.leaflet-left {\\r\\n\\tleft: 0;\\r\\n\\t}\\r\\n.leaflet-control {\\r\\n\\tfloat: left;\\r\\n\\tclear: both;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tfloat: right;\\r\\n\\t}\\r\\n.leaflet-top .leaflet-control {\\r\\n\\tmargin-top: 10px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control {\\r\\n\\tmargin-bottom: 10px;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control {\\r\\n\\tmargin-left: 10px;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tmargin-right: 10px;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-popup {\\r\\n\\topacity: 0;\\r\\n\\t-webkit-transition: opacity 0.2s linear;\\r\\n\\t -moz-transition: opacity 0.2s linear;\\r\\n\\t transition: opacity 0.2s linear;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\\r\\n\\topacity: 1;\\r\\n\\t}\\r\\n.leaflet-zoom-animated {\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t -ms-transform-origin: 0 0;\\r\\n\\t transform-origin: 0 0;\\r\\n\\t}\\r\\nsvg.leaflet-zoom-animated {\\r\\n\\twill-change: transform;\\r\\n}\\r\\n.leaflet-zoom-anim .leaflet-zoom-animated {\\r\\n\\t-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t transition: transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-tile,\\r\\n.leaflet-pan-anim .leaflet-tile {\\r\\n\\t-webkit-transition: none;\\r\\n\\t -moz-transition: none;\\r\\n\\t transition: none;\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-zoom-hide {\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n.leaflet-interactive {\\r\\n\\tcursor: pointer;\\r\\n\\t}\\r\\n.leaflet-grab {\\r\\n\\tcursor: -webkit-grab;\\r\\n\\tcursor: -moz-grab;\\r\\n\\tcursor: grab;\\r\\n\\t}\\r\\n.leaflet-crosshair,\\r\\n.leaflet-crosshair .leaflet-interactive {\\r\\n\\tcursor: crosshair;\\r\\n\\t}\\r\\n.leaflet-popup-pane,\\r\\n.leaflet-control {\\r\\n\\tcursor: auto;\\r\\n\\t}\\r\\n.leaflet-dragging .leaflet-grab,\\r\\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\\r\\n.leaflet-dragging .leaflet-marker-draggable {\\r\\n\\tcursor: move;\\r\\n\\tcursor: -webkit-grabbing;\\r\\n\\tcursor: -moz-grabbing;\\r\\n\\tcursor: grabbing;\\r\\n\\t}\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-pane > svg path,\\r\\n.leaflet-tile-container {\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-marker-icon.leaflet-interactive,\\r\\n.leaflet-image-layer.leaflet-interactive,\\r\\n.leaflet-pane > svg path.leaflet-interactive,\\r\\nsvg.leaflet-image-layer.leaflet-interactive path {\\r\\n\\tpointer-events: visiblePainted; \\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\tbackground: #ddd;\\r\\n\\toutline-offset: 1px;\\r\\n\\t}\\r\\n.leaflet-container a {\\r\\n\\tcolor: #0078A8;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\tborder: 2px dotted #38f;\\r\\n\\tbackground: rgba(255,255,255,0.5);\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\tfont-family: \"Helvetica Neue\", Arial, Helvetica, sans-serif;\\r\\n\\tfont-size: 12px;\\r\\n\\tfont-size: 0.75rem;\\r\\n\\tline-height: 1.5;\\r\\n\\t}\\r\\n.leaflet-bar {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.65);\\r\\n\\tborder-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a {\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder-bottom: 1px solid #ccc;\\r\\n\\twidth: 26px;\\r\\n\\theight: 26px;\\r\\n\\tline-height: 26px;\\r\\n\\tdisplay: block;\\r\\n\\ttext-align: center;\\r\\n\\ttext-decoration: none;\\r\\n\\tcolor: black;\\r\\n\\t}\\r\\n.leaflet-bar a,\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-position: 50% 50%;\\r\\n\\tbackground-repeat: no-repeat;\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-bar a:hover,\\r\\n.leaflet-bar a:focus {\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\t}\\r\\n.leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 4px;\\r\\n\\tborder-top-right-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 4px;\\r\\n\\tborder-bottom-right-radius: 4px;\\r\\n\\tborder-bottom: none;\\r\\n\\t}\\r\\n.leaflet-bar a.leaflet-disabled {\\r\\n\\tcursor: default;\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\tcolor: #bbb;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a {\\r\\n\\twidth: 30px;\\r\\n\\theight: 30px;\\r\\n\\tline-height: 30px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 2px;\\r\\n\\tborder-top-right-radius: 2px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 2px;\\r\\n\\tborder-bottom-right-radius: 2px;\\r\\n\\t}\\r\\n.leaflet-control-zoom-in,\\r\\n.leaflet-control-zoom-out {\\r\\n\\tfont: bold 18px \\'Lucida Console\\', Monaco, monospace;\\r\\n\\ttext-indent: 1px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {\\r\\n\\tfont-size: 22px;\\r\\n\\t}\\r\\n.leaflet-control-layers {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.4);\\r\\n\\tbackground: #fff;\\r\\n\\tborder-radius: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(images/layers.png);\\r\\n\\twidth: 36px;\\r\\n\\theight: 36px;\\r\\n\\t}\\r\\n.leaflet-retina .leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(images/layers-2x.png);\\r\\n\\tbackground-size: 26px 26px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers-toggle {\\r\\n\\twidth: 44px;\\r\\n\\theight: 44px;\\r\\n\\t}\\r\\n.leaflet-control-layers .leaflet-control-layers-list,\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\\r\\n\\tdisplay: none;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\\r\\n\\tdisplay: block;\\r\\n\\tposition: relative;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded {\\r\\n\\tpadding: 6px 10px 6px 6px;\\r\\n\\tcolor: #333;\\r\\n\\tbackground: #fff;\\r\\n\\t}\\r\\n.leaflet-control-layers-scrollbar {\\r\\n\\toverflow-y: scroll;\\r\\n\\toverflow-x: hidden;\\r\\n\\tpadding-right: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-selector {\\r\\n\\tmargin-top: 2px;\\r\\n\\tposition: relative;\\r\\n\\ttop: 1px;\\r\\n\\t}\\r\\n.leaflet-control-layers label {\\r\\n\\tdisplay: block;\\r\\n\\tfont-size: 13px;\\r\\n\\tfont-size: 1.08333em;\\r\\n\\t}\\r\\n.leaflet-control-layers-separator {\\r\\n\\theight: 0;\\r\\n\\tborder-top: 1px solid #ddd;\\r\\n\\tmargin: 5px -10px 5px -6px;\\r\\n\\t}\\r\\n.leaflet-default-icon-path { \\r\\n\\tbackground-image: url(images/marker-icon.png);\\r\\n\\t}\\r\\n.leaflet-container .leaflet-control-attribution {\\r\\n\\tbackground: #fff;\\r\\n\\tbackground: rgba(255, 255, 255, 0.8);\\r\\n\\tmargin: 0;\\r\\n\\t}\\r\\n.leaflet-control-attribution,\\r\\n.leaflet-control-scale-line {\\r\\n\\tpadding: 0 5px;\\r\\n\\tcolor: #333;\\r\\n\\tline-height: 1.4;\\r\\n\\t}\\r\\n.leaflet-control-attribution a {\\r\\n\\ttext-decoration: none;\\r\\n\\t}\\r\\n.leaflet-control-attribution a:hover,\\r\\n.leaflet-control-attribution a:focus {\\r\\n\\ttext-decoration: underline;\\r\\n\\t}\\r\\n.leaflet-attribution-flag {\\r\\n\\tdisplay: inline !important;\\r\\n\\tvertical-align: baseline !important;\\r\\n\\twidth: 1em;\\r\\n\\theight: 0.6669em;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control-scale {\\r\\n\\tmargin-left: 5px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control-scale {\\r\\n\\tmargin-bottom: 5px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line {\\r\\n\\tborder: 2px solid #777;\\r\\n\\tborder-top: none;\\r\\n\\tline-height: 1.1;\\r\\n\\tpadding: 2px 5px 1px;\\r\\n\\twhite-space: nowrap;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\tbackground: rgba(255, 255, 255, 0.8);\\r\\n\\ttext-shadow: 1px 1px #fff;\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child) {\\r\\n\\tborder-top: 2px solid #777;\\r\\n\\tborder-bottom: none;\\r\\n\\tmargin-top: -2px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\\r\\n\\tborder-bottom: 2px solid #777;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-attribution,\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tbox-shadow: none;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tborder: 2px solid rgba(0,0,0,0.2);\\r\\n\\tbackground-clip: padding-box;\\r\\n\\t}\\r\\n.leaflet-popup {\\r\\n\\tposition: absolute;\\r\\n\\ttext-align: center;\\r\\n\\tmargin-bottom: 20px;\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper {\\r\\n\\tpadding: 1px;\\r\\n\\ttext-align: left;\\r\\n\\tborder-radius: 12px;\\r\\n\\t}\\r\\n.leaflet-popup-content {\\r\\n\\tmargin: 13px 24px 13px 20px;\\r\\n\\tline-height: 1.3;\\r\\n\\tfont-size: 13px;\\r\\n\\tfont-size: 1.08333em;\\r\\n\\tmin-height: 1px;\\r\\n\\t}\\r\\n.leaflet-popup-content p {\\r\\n\\tmargin: 17px 0;\\r\\n\\tmargin: 1.3em 0;\\r\\n\\t}\\r\\n.leaflet-popup-tip-container {\\r\\n\\twidth: 40px;\\r\\n\\theight: 20px;\\r\\n\\tposition: absolute;\\r\\n\\tleft: 50%;\\r\\n\\tmargin-top: -1px;\\r\\n\\tmargin-left: -20px;\\r\\n\\toverflow: hidden;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-popup-tip {\\r\\n\\twidth: 17px;\\r\\n\\theight: 17px;\\r\\n\\tpadding: 1px;\\r\\n\\tmargin: -10px auto 0;\\r\\n\\tpointer-events: auto;\\r\\n\\t-webkit-transform: rotate(45deg);\\r\\n\\t -moz-transform: rotate(45deg);\\r\\n\\t -ms-transform: rotate(45deg);\\r\\n\\t transform: rotate(45deg);\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper,\\r\\n.leaflet-popup-tip {\\r\\n\\tbackground: white;\\r\\n\\tcolor: #333;\\r\\n\\tbox-shadow: 0 3px 14px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button {\\r\\n\\tposition: absolute;\\r\\n\\ttop: 0;\\r\\n\\tright: 0;\\r\\n\\tborder: none;\\r\\n\\ttext-align: center;\\r\\n\\twidth: 24px;\\r\\n\\theight: 24px;\\r\\n\\tfont: 16px/24px Tahoma, Verdana, sans-serif;\\r\\n\\tcolor: #757575;\\r\\n\\ttext-decoration: none;\\r\\n\\tbackground: transparent;\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button:hover,\\r\\n.leaflet-container a.leaflet-popup-close-button:focus {\\r\\n\\tcolor: #585858;\\r\\n\\t}\\r\\n.leaflet-popup-scrolled {\\r\\n\\toverflow: auto;\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper {\\r\\n\\t-ms-zoom: 1;\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\twidth: 24px;\\r\\n\\tmargin: 0 auto;\\r\\n\\t-ms-filter: \"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)\";\\r\\n\\tfilter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-control-zoom,\\r\\n.leaflet-oldie .leaflet-control-layers,\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper,\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\tborder: 1px solid #999;\\r\\n\\t}\\r\\n.leaflet-div-icon {\\r\\n\\tbackground: #fff;\\r\\n\\tborder: 1px solid #666;\\r\\n\\t}\\r\\n.leaflet-tooltip {\\r\\n\\tposition: absolute;\\r\\n\\tpadding: 6px;\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder: 1px solid #fff;\\r\\n\\tborder-radius: 3px;\\r\\n\\tcolor: #222;\\r\\n\\twhite-space: nowrap;\\r\\n\\t-webkit-user-select: none;\\r\\n\\t-moz-user-select: none;\\r\\n\\t-ms-user-select: none;\\r\\n\\tuser-select: none;\\r\\n\\tpointer-events: none;\\r\\n\\tbox-shadow: 0 1px 3px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-tooltip.leaflet-interactive {\\r\\n\\tcursor: pointer;\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before,\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tposition: absolute;\\r\\n\\tpointer-events: none;\\r\\n\\tborder: 6px solid transparent;\\r\\n\\tbackground: transparent;\\r\\n\\tcontent: \"\";\\r\\n\\t}\\r\\n.leaflet-tooltip-bottom {\\r\\n\\tmargin-top: 6px;\\r\\n}\\r\\n.leaflet-tooltip-top {\\r\\n\\tmargin-top: -6px;\\r\\n}\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tleft: 50%;\\r\\n\\tmargin-left: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tbottom: 0;\\r\\n\\tmargin-bottom: -12px;\\r\\n\\tborder-top-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-bottom:before {\\r\\n\\ttop: 0;\\r\\n\\tmargin-top: -12px;\\r\\n\\tmargin-left: -6px;\\r\\n\\tborder-bottom-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-left {\\r\\n\\tmargin-left: -6px;\\r\\n}\\r\\n.leaflet-tooltip-right {\\r\\n\\tmargin-left: 6px;\\r\\n}\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\ttop: 50%;\\r\\n\\tmargin-top: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-left:before {\\r\\n\\tright: 0;\\r\\n\\tmargin-right: -12px;\\r\\n\\tborder-left-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tleft: 0;\\r\\n\\tmargin-left: -12px;\\r\\n\\tborder-right-color: #fff;\\r\\n\\t}\\r\\n@media print {\\r\\n\\t.leaflet-control {\\r\\n\\t\\t-webkit-print-color-adjust: exact;\\r\\n\\t\\tprint-color-adjust: exact;\\r\\n\\t\\t}\\r\\n\\t}';\n"],"mappings":";AAGA,IAAaA,cACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"nominatim.js","names":[],"sources":["../../src/location/nominatim.ts"],"sourcesContent":["import type { GeocodingResult, GeocodingSource } from './types';\n\nexport interface NominatimSourceOptions {\n /** The Nominatim server. Defaults to OpenStreetMap's, whose policy allows one request a second. */\n endpoint?: string;\n /** An email, which OpenStreetMap's server asks of apps that send many requests. */\n email?: string;\n /** Limits the search to these countries (`['ca']`). */\n countryCodes?: readonly string[];\n /** Most results of a search. Defaults to 5. */\n limit?: number;\n}\n\ninterface NominatimPlace {\n display_name?: unknown;\n lat?: unknown;\n lon?: unknown;\n}\n\nfunction toResult(place: NominatimPlace): GeocodingResult | null {\n const lat = Number(place.lat);\n const lng = Number(place.lon);\n if (typeof place.display_name !== 'string' || Number.isNaN(lat) || Number.isNaN(lng)) {\n return null;\n }\n return { label: place.display_name, lat, lng };\n}\n\n/**\n * An address search on Nominatim, OpenStreetMap's geocoder. Fine for an admin panel: its public\n * server allows one request a second and no heavy use. For more, run a server or use a service.\n */\nexport function createNominatimSource({\n endpoint = 'https://nominatim.openstreetmap.org',\n email,\n countryCodes,\n limit = 5,\n}: NominatimSourceOptions = {}): GeocodingSource {\n const base = endpoint.replace(/\\/$/, '');\n const request = async (\n path: string,\n params: Record<string, string>,\n { signal, locale }: { signal: AbortSignal; locale?: string },\n ): Promise<unknown> => {\n const query = new URLSearchParams({ format: 'jsonv2', ...params });\n if (email !== undefined) {\n query.set('email', email);\n }\n if (locale !== undefined) {\n query.set('accept-language', locale);\n }\n const response = await fetch(`${base}${path}?${query}`, { signal });\n if (!response.ok) {\n throw new Error(`Nominatim answered ${response.status}.`);\n }\n return response.json();\n };\n return {\n async search(text, options) {\n const places = await request(\n '/search',\n {\n q: text,\n limit: String(limit),\n ...(countryCodes !== undefined && countryCodes.length > 0\n ? { countrycodes: countryCodes.join(',') }\n : {}),\n },\n options,\n );\n return Array.isArray(places)\n ? places.flatMap((place: NominatimPlace) => toResult(place) ?? [])\n : [];\n },\n async reverse({ lat, lng }, options) {\n const place = await request(\n '/reverse',\n { lat: String(lat), lon: String(lng) },\n options,\n );\n return place !== null && typeof place === 'object'\n ? toResult(place as NominatimPlace)\n : null;\n },\n };\n}\n"],"mappings":";AAmBA,SAAS,SAAS,OAA+C;CAC7D,MAAM,MAAM,OAAO,MAAM,GAAG;CAC5B,MAAM,MAAM,OAAO,MAAM,GAAG;CAC5B,IAAI,OAAO,MAAM,iBAAiB,YAAY,OAAO,MAAM,GAAG,KAAK,OAAO,MAAM,GAAG,GAC/E,OAAO;CAEX,OAAO;EAAE,OAAO,MAAM;EAAc;EAAK;CAAI;AACjD;;;;;AAMA,SAAgB,sBAAsB,EAClC,WAAW,uCACX,OACA,cACA,QAAQ,MACgB,CAAC,GAAoB;CAC7C,MAAM,OAAO,SAAS,QAAQ,OAAO,EAAE;CACvC,MAAM,UAAU,OACZ,MACA,QACA,EAAE,QAAQ,aACS;EACnB,MAAM,QAAQ,IAAI,gBAAgB;GAAE,QAAQ;GAAU,GAAG;EAAO,CAAC;EACjE,IAAI,UAAU,KAAA,GACV,MAAM,IAAI,SAAS,KAAK;EAE5B,IAAI,WAAW,KAAA,GACX,MAAM,IAAI,mBAAmB,MAAM;EAEvC,MAAM,WAAW,MAAM,MAAM,GAAG,OAAO,KAAI,GAAI,SAAS,EAAE,OAAO,CAAC;EAClE,IAAI,CAAC,SAAS,IACV,MAAM,IAAI,MAAM,sBAAsB,SAAS,OAAM,EAAG;EAE5D,OAAO,SAAS,KAAK;CACzB;CACA,OAAO;EACH,MAAM,OAAO,MAAM,SAAS;GACxB,MAAM,SAAS,MAAM,QACjB,WACA;IACI,GAAG;IACH,OAAO,OAAO,KAAK;IACnB,GAAI,iBAAiB,KAAA,KAAa,aAAa,SAAS,IAClD,EAAE,cAAc,aAAa,KAAK,GAAG,EAAE,IACvC,CAAC;GACX,GACA,OACJ;GACA,OAAO,MAAM,QAAQ,MAAM,IACrB,OAAO,SAAS,UAA0B,SAAS,KAAK,KAAK,CAAA,CAAE,IAC/D,CAAA;EACV;EACA,MAAM,QAAQ,EAAE,KAAK,OAAO,SAAS;GACjC,MAAM,QAAQ,MAAM,QAChB,YACA;IAAE,KAAK,OAAO,GAAG;IAAG,KAAK,OAAO,GAAG;GAAE,GACrC,OACJ;GACA,OAAO,UAAU,QAAQ,OAAO,UAAU,WACpC,SAAS,KAAuB,IAChC;EACV;CACJ;AACJ"}
1
+ {"version":3,"file":"nominatim.js","names":["GeocodingResult","GeocodingSource","NominatimSourceOptions","endpoint","email","countryCodes","limit","NominatimPlace","display_name","lat","lon","toResult","place","Number","lng","isNaN","label","createNominatimSource","base","replace","request","path","params","Record","signal","locale","AbortSignal","Promise","query","URLSearchParams","format","undefined","set","response","fetch","ok","Error","status","json","search","text","options","places","q","String","length","countrycodes","join","Array","isArray","flatMap","reverse"],"sources":["../../src/location/nominatim.ts"],"sourcesContent":["import type { GeocodingResult, GeocodingSource } from './types';\n\nexport interface NominatimSourceOptions {\n /** The Nominatim server. Defaults to OpenStreetMap's, whose policy allows one request a second. */\n endpoint?: string;\n /** An email, which OpenStreetMap's server asks of apps that send many requests. */\n email?: string;\n /** Limits the search to these countries (`['ca']`). */\n countryCodes?: readonly string[];\n /** Most results of a search. Defaults to 5. */\n limit?: number;\n}\n\ninterface NominatimPlace {\n display_name?: unknown;\n lat?: unknown;\n lon?: unknown;\n}\n\nfunction toResult(place: NominatimPlace): GeocodingResult | null {\n const lat = Number(place.lat);\n const lng = Number(place.lon);\n if (typeof place.display_name !== 'string' || Number.isNaN(lat) || Number.isNaN(lng)) {\n return null;\n }\n return { label: place.display_name, lat, lng };\n}\n\n/**\n * An address search on Nominatim, OpenStreetMap's geocoder. Fine for an admin panel: its public\n * server allows one request a second and no heavy use. For more, run a server or use a service.\n */\nexport function createNominatimSource({\n endpoint = 'https://nominatim.openstreetmap.org',\n email,\n countryCodes,\n limit = 5,\n}: NominatimSourceOptions = {}): GeocodingSource {\n const base = endpoint.replace(/\\/$/, '');\n const request = async (\n path: string,\n params: Record<string, string>,\n { signal, locale }: { signal: AbortSignal; locale?: string },\n ): Promise<unknown> => {\n const query = new URLSearchParams({ format: 'jsonv2', ...params });\n if (email !== undefined) {\n query.set('email', email);\n }\n if (locale !== undefined) {\n query.set('accept-language', locale);\n }\n const response = await fetch(`${base}${path}?${query}`, { signal });\n if (!response.ok) {\n throw new Error(`Nominatim answered ${response.status}.`);\n }\n return response.json();\n };\n return {\n async search(text, options) {\n const places = await request(\n '/search',\n {\n q: text,\n limit: String(limit),\n ...(countryCodes !== undefined && countryCodes.length > 0\n ? { countrycodes: countryCodes.join(',') }\n : {}),\n },\n options,\n );\n return Array.isArray(places)\n ? places.flatMap((place: NominatimPlace) => toResult(place) ?? [])\n : [];\n },\n async reverse({ lat, lng }, options) {\n const place = await request(\n '/reverse',\n { lat: String(lat), lon: String(lng) },\n options,\n );\n return place !== null && typeof place === 'object'\n ? toResult(place as NominatimPlace)\n : null;\n },\n };\n}\n"],"mappings":";AAmBA,SAASW,SAASC,OAA+C;CAC7D,MAAMH,MAAMI,OAAOD,MAAMH,GAAG;CAC5B,MAAMK,MAAMD,OAAOD,MAAMF,GAAG;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mC,OAAOnC,GAAG;IAAGC,KAAKkC,OAAO9B,GAAG;GAAE,GACrC2B,OACJ;GACA,OAAO7B,UAAU,QAAQ,OAAOA,UAAU,WACpCD,SAASC,KAAuB,IAChC;EACV;CACJ;AACJ"}
@@ -1,7 +1,8 @@
1
1
  import type { FieldEntryProps } from '../shared/types';
2
2
  /**
3
- * The slot of a field type that no plugin provides, such as `richtext` and `media` until Phase 2:
4
- * it keeps the field's place in the form and names the missing type. The value is left as is.
3
+ * The slot of a field type that no plugin provides, such as `richtext` and `media` without
4
+ * `@panneau/editor` and `@panneau/media`: it keeps the field's place in the form and names the
5
+ * missing type. The value is left as is.
5
6
  */
6
7
  export declare function MissingFieldEntry({ field, className }: FieldEntryProps): import("react").JSX.Element;
7
8
  //# sourceMappingURL=MissingField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MissingField.d.ts","sourceRoot":"","sources":["../../src/missing/MissingField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,eAAe,+BAUtE"}
1
+ {"version":3,"file":"MissingField.d.ts","sourceRoot":"","sources":["../../src/missing/MissingField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,eAAe,+BAUtE"}
@@ -6,8 +6,9 @@ import { usePanneauIntl } from "@panneau/ui";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/missing/MissingField.tsx
8
8
  /**
9
- * The slot of a field type that no plugin provides, such as `richtext` and `media` until Phase 2:
10
- * it keeps the field's place in the form and names the missing type. The value is left as is.
9
+ * The slot of a field type that no plugin provides, such as `richtext` and `media` without
10
+ * `@panneau/editor` and `@panneau/media`: it keeps the field's place in the form and names the
11
+ * missing type. The value is left as is.
11
12
  */
12
13
  function MissingFieldEntry(t0) {
13
14
  const $ = c(14);
@@ -1 +1 @@
1
- {"version":3,"file":"MissingField.js","names":["_c","styles"],"sources":["../../src/missing/MissingField.tsx"],"sourcesContent":["import { usePanneauIntl } from '@panneau/ui';\n\nimport { cx } from '../shared/cx';\nimport { messages } from '../shared/messages';\nimport type { FieldEntryProps } from '../shared/types';\nimport styles from './MissingField.module.css';\n\n/**\n * The slot of a field type that no plugin provides, such as `richtext` and `media` until Phase 2:\n * it keeps the field's place in the form and names the missing type. The value is left as is.\n */\nexport function MissingFieldEntry({ field, className }: FieldEntryProps) {\n const intl = usePanneauIntl();\n return (\n <div className={cx(styles.missing, className)} data-field-type={field.type}>\n <span className={styles.label}>{field.label ?? field.name}</span>\n <p className={styles.notice} role=\"note\">\n {intl.formatMessage(messages.missingPlugin, { type: field.type })}\n </p>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAO,kBAAA,IAAA;CAAA,MAAA,IAAAA,EAAA,EAAA;CAA2B,MAAA,EAAA,OAAA,cAAA;CAC9B,MAAA,OAAa,eAAe;CAAE,IAAA;CAAA,IAAA,EAAA,OAAA,WAAA;EAEV,KAAA,GAAGC,4BAAM,SAAU,SAAS;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAmB,MAAA,KAAA,MAAK;CACjC,MAAA,KAAA,MAAK,SAAU,MAAK;CAAK,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAzD,KAAA,oBAAA,QAAA;GAAiB,WAAAA,4BAAM;GAAS,UAAA;EAAiC,CAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,MAAA,QAAA,EAAA,OAAA,MAAA;EAE5D,KAAA,KAAI,cAAe,SAAQ,eAAgB,EAAA,MAAQ,MAAK,KAAM,CAAC;EAAC,EAAA,KAAA,MAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EADrE,KAAA,oBAAA,KAAA;GAAc,WAAAA,4BAAM;GAAc,MAAA;GAC7B,UAAA;EACD,CAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,MAAA,QAAA,EAAA,QAAA,MAAA,EAAA,QAAA,MAAA,EAAA,QAAA,IAAA;EAJR,KAAA,qBAAA,OAAA;GAAgB,WAAA;GAAgD,mBAAA;GAAhE,UAAA,CACI,IACA,EAGE;;EAAA,EAAA,KAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OALN;AAKM"}
1
+ {"version":3,"file":"MissingField.js","names":["usePanneauIntl","cx","messages","FieldEntryProps","styles","MissingFieldEntry","t0","$","_c","field","className","intl","t1","missing","t2","type","t3","label","name","t4","t5","formatMessage","missingPlugin","t6","notice","t7","_c","styles"],"sources":["../../src/missing/MissingField.tsx"],"sourcesContent":["import { usePanneauIntl } from '@panneau/ui';\n\nimport { cx } from '../shared/cx';\nimport { messages } from '../shared/messages';\nimport type { FieldEntryProps } from '../shared/types';\nimport styles from './MissingField.module.css';\n\n/**\n * The slot of a field type that no plugin provides, such as `richtext` and `media` without\n * `@panneau/editor` and `@panneau/media`: it keeps the field's place in the form and names the\n * missing type. The value is left as is.\n */\nexport function MissingFieldEntry({ field, className }: FieldEntryProps) {\n const intl = usePanneauIntl();\n return (\n <div className={cx(styles.missing, className)} data-field-type={field.type}>\n <span className={styles.label}>{field.label ?? field.name}</span>\n <p className={styles.notice} role=\"note\">\n {intl.formatMessage(messages.missingPlugin, { type: field.type })}\n </p>\n </div>\n );\n}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;EAAAhB,EAAA,KAAAE,MAAAM;EAAAR,EAAA,MAAAK;EAAAL,EAAA,MAAAY;EAAAZ,EAAA,MAAAgB;EAAAhB,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAAA,OALNkB;AAKM"}
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField.js","names":["min","max","disabled","readOnly","required","_c"],"sources":["../../src/number/NumberField.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { NumberInput } from '@panneau/ui';\n\nimport { getFieldProps, getRuleNumber, getSetting, isNumber, isString } from '../shared/entry';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\n\nexport interface NumberFieldProps extends FieldProps<number> {\n placeholder?: string;\n min?: number;\n max?: number;\n /** Step of the steppers and arrow keys. Defaults to 1. */\n step?: number;\n /** Format of the number, for the locale: decimals, percent, currency. */\n formatOptions?: Intl.NumberFormatOptions;\n /** Content after the number: a unit. */\n suffix?: ReactNode;\n controlClassName?: string;\n inputClassName?: string;\n}\n\n/** A number, formatted for the locale. An empty field is `null`. */\nexport function NumberField({\n value,\n onChange,\n min,\n max,\n disabled,\n readOnly,\n required,\n ...props\n}: NumberFieldProps) {\n return (\n <NumberInput\n {...props}\n value={value ?? null}\n onChange={(next) => onChange?.(next)}\n minValue={min}\n maxValue={max}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n />\n );\n}\n\n/**\n * The `number` type: `min` and `max` from its rules, and settings `step`, `decimals` (the most\n * digits after the decimal point) and `suffix`.\n */\nexport function NumberFieldEntry(props: FieldEntryProps) {\n const { field } = props;\n const min = getRuleNumber(field, 'min');\n const max = getRuleNumber(field, 'max');\n const step = getSetting(field, 'step', isNumber);\n const decimals = getSetting(field, 'decimals', isNumber);\n const suffix = getSetting(field, 'suffix', isString);\n return (\n <NumberField\n {...getFieldProps(props)}\n value={isNumber(props.value) ? props.value : null}\n onChange={props.onChange}\n {...(min !== undefined ? { min } : {})}\n {...(max !== undefined ? { max } : {})}\n {...(step !== undefined ? { step } : {})}\n {...(decimals !== undefined\n ? { formatOptions: { maximumFractionDigits: decimals } }\n : {})}\n {...(suffix !== undefined ? { suffix } : {})}\n />\n );\n}\n"],"mappings":";;;;;;AAsBA,SAAO,YAAA,IAAA;CAAA,MAAA,IAAAK,EAAA,EAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAqB,CAAA,CAAA,OAAA,UAAA,KAAA,KAAA,UAAA,UAAA,UAAA,GAAA,SAAA;EAST,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA;EAAA,WAAA,EAAA;EAAA,MAAA,EAAA;EAAA,MAAA,EAAA;EAAA,WAAA,EAAA;EAAA,QAAA,EAAA;EAAA,WAAA,EAAA;EAAA,WAAA,EAAA;EAAA,QAAA,EAAA;CAAA;CAIA,MAAA,KAAA,SAAA;CAAa,IAAA;CAAA,IAAA,EAAA,OAAA,UAAA;EACV,MAAA,SAAU,WAAW,IAAI;EAAC,EAAA,KAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,QAAA,YAAA,EAAA,QAAA,OAAA,EAAA,QAAA,OAAA,EAAA,QAAA,SAAA,EAAA,QAAA,YAAA,EAAA,QAAA,YAAA,EAAA,QAAA,MAAA,EAAA,QAAA,IAAA;EAHxC,KAAA,oBAAC,aAAD;GAAY,GACJ;GACG,OAAA;GACG,UAAA;GACAL,UAAA;GACAC,UAAA;GACEC,YAAA;GACAC,YAAA;GACAC,YAAA;EAAQ,CAAA;EACtB,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA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AA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,MAAA,EAAA;CAAA,OAXF;AAWE"}
1
+ {"version":3,"file":"NumberField.js","names":["ReactNode","NumberInput","getFieldProps","getRuleNumber","getSetting","isNumber","isString","FieldEntryProps","FieldProps","NumberFieldProps","placeholder","min","max","step","formatOptions","Intl","NumberFormatOptions","suffix","controlClassName","inputClassName","NumberField","t0","$","_c","disabled","onChange","props","readOnly","required","value","t1","t2","next","t3","NumberFieldEntry","field","decimals","t4","t5","t6","t7","undefined","t8","t9","t10","maximumFractionDigits","t11","t12","_c"],"sources":["../../src/number/NumberField.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { NumberInput } from '@panneau/ui';\n\nimport { getFieldProps, getRuleNumber, getSetting, isNumber, isString } from '../shared/entry';\nimport type { FieldEntryProps, FieldProps } from '../shared/types';\n\nexport interface NumberFieldProps extends FieldProps<number> {\n placeholder?: string;\n min?: number;\n max?: number;\n /** Step of the steppers and arrow keys. Defaults to 1. */\n step?: number;\n /** Format of the number, for the locale: decimals, percent, currency. */\n formatOptions?: Intl.NumberFormatOptions;\n /** Content after the number: a unit. */\n suffix?: ReactNode;\n controlClassName?: string;\n inputClassName?: string;\n}\n\n/** A number, formatted for the locale. An empty field is `null`. */\nexport function NumberField({\n value,\n onChange,\n min,\n max,\n disabled,\n readOnly,\n required,\n ...props\n}: NumberFieldProps) {\n return (\n <NumberInput\n {...props}\n value={value ?? null}\n onChange={(next) => onChange?.(next)}\n minValue={min}\n maxValue={max}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n />\n );\n}\n\n/**\n * The `number` type: `min` and `max` from its rules, and settings `step`, `decimals` (the most\n * digits after the decimal point) and `suffix`.\n */\nexport function NumberFieldEntry(props: FieldEntryProps) {\n const { field } = props;\n const min = getRuleNumber(field, 'min');\n const max = getRuleNumber(field, 'max');\n const step = getSetting(field, 'step', isNumber);\n const decimals = getSetting(field, 'decimals', isNumber);\n const suffix = getSetting(field, 'suffix', isString);\n return (\n <NumberField\n {...getFieldProps(props)}\n value={isNumber(props.value) ? props.value : null}\n onChange={props.onChange}\n {...(min !== undefined ? { min } : {})}\n {...(max !== undefined ? { max } : {})}\n {...(step !== undefined ? { step } : {})}\n {...(decimals !== undefined\n ? { formatOptions: { maximumFractionDigits: decimals } }\n : {})}\n {...(suffix !== undefined ? { suffix } : {})}\n />\n );\n}\n"],"mappings":";;;;;;AAsBA,SAAOoB,YAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAZ;CAAA,IAAAD;CAAA,IAAAc;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAP,EAAA,OAAAD,IAAA;EAAqB,CAAA,CAAAQ,OAAAJ,UAAAd,KAAAC,KAAAY,UAAAG,UAAAC,UAAA,GAAAF,SAAAL;EASTC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAV;EAAAU,EAAA,KAAAX;EAAAW,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAA;EAAAL,WAAAF,EAAA;EAAAV,MAAAU,EAAA;EAAAX,MAAAW,EAAA;EAAAG,WAAAH,EAAA;EAAAI,QAAAJ,EAAA;EAAAK,WAAAL,EAAA;EAAAM,WAAAN,EAAA;EAAAO,QAAAP,EAAA;CAAA;CAIA,MAAAQ,KAAAD,SAAA;CAAa,IAAAE;CAAA,IAAAT,EAAA,OAAAG,UAAA;EACVM,MAAAC,SAAUP,WAAWO,IAAI;EAACV,EAAA,KAAAG;EAAAH,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,QAAAE,YAAAF,EAAA,QAAAV,OAAAU,EAAA,QAAAX,OAAAW,EAAA,QAAAI,SAAAJ,EAAA,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EACH6B,MAAA7B,WAAWwB,KAAAA,IAAX,EAAAxB,OAAqC,IAArC,CAAqC;EAACK,EAAA,MAAAL;EAAAK,EAAA,MAAAwB;CAAA,OAAAA,MAAAxB,EAAA;CAAA,IAAAyB;CAAA,IAAAzB,EAAA,QAAAI,MAAAD,YAAAH,EAAA,QAAAsB,OAAAtB,EAAA,QAAAwB,OAAAxB,EAAA,QAAAgB,MAAAhB,EAAA,QAAAiB,MAAAjB,EAAA,QAAAkB,MAAAlB,EAAA,QAAAoB,MAAApB,EAAA,QAAAqB,IAAA;EAV/CI,MAAA,oBAAC,aAAD;GAAY,GACJT;GACG,OAAAC;GACG,UAAAb,MAAKD;GAAS,GACnBe;GAAgC,GAChCE;GAAgC,GAChCC;GAAkC,GAClCC;GAEG,GACHE;EAAsC,CAAA;EAC7CxB,EAAA,MAAAI,MAAAD;EAAAH,EAAA,MAAAsB;EAAAtB,EAAA,MAAAwB;EAAAxB,EAAA,MAAAgB;EAAAhB,EAAA,MAAAiB;EAAAjB,EAAA,MAAAkB;EAAAlB,EAAA,MAAAoB;EAAApB,EAAA,MAAAqB;EAAArB,EAAA,MAAAyB;CAAA,OAAAA,MAAAzB,EAAA;CAAA,OAXFyB;AAWE"}
@@ -4,17 +4,88 @@ import { Slider } from "@panneau/ui";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/range/RangeField.tsx
6
6
  /** A number on a slider. It is `null` until the slider is moved. */
7
- function RangeField({ value, onChange, onBlur, min = 0, max = 100, disabled, readOnly, required, autoFocus: _autoFocus, id: _id, ...props }) {
8
- return /* @__PURE__ */ jsx(Slider, {
9
- ...props,
10
- value: value ?? null,
11
- onChange: (next) => onChange?.(next),
12
- onChangeEnd: () => onBlur?.(),
13
- minValue: min,
14
- maxValue: max,
15
- isDisabled: disabled === true || readOnly === true,
16
- isRequired: required
17
- });
7
+ function RangeField(t0) {
8
+ const $ = c(23);
9
+ let disabled;
10
+ let onBlur;
11
+ let onChange;
12
+ let props;
13
+ let readOnly;
14
+ let required;
15
+ let t1;
16
+ let t2;
17
+ let value;
18
+ if ($[0] !== t0) {
19
+ const { value: t3, onChange: t4, onBlur: t5, min: t6, max: t7, disabled: t8, readOnly: t9, required: t10, autoFocus: _autoFocus, id: _id, ...t11 } = t0;
20
+ value = t3;
21
+ onChange = t4;
22
+ onBlur = t5;
23
+ t1 = t6;
24
+ t2 = t7;
25
+ disabled = t8;
26
+ readOnly = t9;
27
+ required = t10;
28
+ props = t11;
29
+ $[0] = t0;
30
+ $[1] = disabled;
31
+ $[2] = onBlur;
32
+ $[3] = onChange;
33
+ $[4] = props;
34
+ $[5] = readOnly;
35
+ $[6] = required;
36
+ $[7] = t1;
37
+ $[8] = t2;
38
+ $[9] = value;
39
+ } else {
40
+ disabled = $[1];
41
+ onBlur = $[2];
42
+ onChange = $[3];
43
+ props = $[4];
44
+ readOnly = $[5];
45
+ required = $[6];
46
+ t1 = $[7];
47
+ t2 = $[8];
48
+ value = $[9];
49
+ }
50
+ const min = t1 === void 0 ? 0 : t1;
51
+ const max = t2 === void 0 ? 100 : t2;
52
+ const t3 = value ?? null;
53
+ let t4;
54
+ if ($[10] !== onChange) {
55
+ t4 = (next) => onChange?.(next);
56
+ $[10] = onChange;
57
+ $[11] = t4;
58
+ } else t4 = $[11];
59
+ let t5;
60
+ if ($[12] !== onBlur) {
61
+ t5 = () => onBlur?.();
62
+ $[12] = onBlur;
63
+ $[13] = t5;
64
+ } else t5 = $[13];
65
+ const t6 = disabled === true || readOnly === true;
66
+ let t7;
67
+ if ($[14] !== max || $[15] !== min || $[16] !== props || $[17] !== required || $[18] !== t3 || $[19] !== t4 || $[20] !== t5 || $[21] !== t6) {
68
+ t7 = /* @__PURE__ */ jsx(Slider, {
69
+ ...props,
70
+ value: t3,
71
+ onChange: t4,
72
+ onChangeEnd: t5,
73
+ minValue: min,
74
+ maxValue: max,
75
+ isDisabled: t6,
76
+ isRequired: required
77
+ });
78
+ $[14] = max;
79
+ $[15] = min;
80
+ $[16] = props;
81
+ $[17] = required;
82
+ $[18] = t3;
83
+ $[19] = t4;
84
+ $[20] = t5;
85
+ $[21] = t6;
86
+ $[22] = t7;
87
+ } else t7 = $[22];
88
+ return t7;
18
89
  }
19
90
  /**
20
91
  * The `range` type: its ends from the `min` and `max` rules (0 and 100 without them), and