@krizaka/ui 3.83.0 → 3.84.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.
@@ -83,11 +83,11 @@ declare const filterBar: tailwind_variants.TVReturnType<{
83
83
  [key: string]: {
84
84
  [key: string]: tailwind_variants.ClassValue | {
85
85
  root?: tailwind_variants.ClassValue;
86
- count?: tailwind_variants.ClassValue;
87
86
  controls?: tailwind_variants.ClassValue;
88
87
  active?: tailwind_variants.ClassValue;
89
88
  clear?: tailwind_variants.ClassValue;
90
89
  results?: tailwind_variants.ClassValue;
90
+ count?: tailwind_variants.ClassValue;
91
91
  optionCount?: tailwind_variants.ClassValue;
92
92
  trigger?: tailwind_variants.ClassValue;
93
93
  };
@@ -96,11 +96,11 @@ declare const filterBar: tailwind_variants.TVReturnType<{
96
96
  [x: string]: {
97
97
  [x: string]: tailwind_variants.ClassValue | {
98
98
  root?: tailwind_variants.ClassValue;
99
- count?: tailwind_variants.ClassValue;
100
99
  controls?: tailwind_variants.ClassValue;
101
100
  active?: tailwind_variants.ClassValue;
102
101
  clear?: tailwind_variants.ClassValue;
103
102
  results?: tailwind_variants.ClassValue;
103
+ count?: tailwind_variants.ClassValue;
104
104
  optionCount?: tailwind_variants.ClassValue;
105
105
  trigger?: tailwind_variants.ClassValue;
106
106
  };
@@ -118,11 +118,11 @@ declare const filterBar: tailwind_variants.TVReturnType<{
118
118
  [key: string]: {
119
119
  [key: string]: tailwind_variants.ClassValue | {
120
120
  root?: tailwind_variants.ClassValue;
121
- count?: tailwind_variants.ClassValue;
122
121
  controls?: tailwind_variants.ClassValue;
123
122
  active?: tailwind_variants.ClassValue;
124
123
  clear?: tailwind_variants.ClassValue;
125
124
  results?: tailwind_variants.ClassValue;
125
+ count?: tailwind_variants.ClassValue;
126
126
  optionCount?: tailwind_variants.ClassValue;
127
127
  trigger?: tailwind_variants.ClassValue;
128
128
  };
package/dist/map.d.ts CHANGED
@@ -138,10 +138,10 @@ declare const map: tailwind_variants.TVReturnType<{
138
138
  [key: string]: {
139
139
  [key: string]: tailwind_variants.ClassValue | {
140
140
  root?: tailwind_variants.ClassValue;
141
+ attribution?: tailwind_variants.ClassValue;
141
142
  canvas?: tailwind_variants.ClassValue;
142
143
  fallback?: tailwind_variants.ClassValue;
143
144
  controls?: tailwind_variants.ClassValue;
144
- attribution?: tailwind_variants.ClassValue;
145
145
  places?: tailwind_variants.ClassValue;
146
146
  markerLabel?: tailwind_variants.ClassValue;
147
147
  control?: tailwind_variants.ClassValue;
@@ -152,10 +152,10 @@ declare const map: tailwind_variants.TVReturnType<{
152
152
  [x: string]: {
153
153
  [x: string]: tailwind_variants.ClassValue | {
154
154
  root?: tailwind_variants.ClassValue;
155
+ attribution?: tailwind_variants.ClassValue;
155
156
  canvas?: tailwind_variants.ClassValue;
156
157
  fallback?: tailwind_variants.ClassValue;
157
158
  controls?: tailwind_variants.ClassValue;
158
- attribution?: tailwind_variants.ClassValue;
159
159
  places?: tailwind_variants.ClassValue;
160
160
  markerLabel?: tailwind_variants.ClassValue;
161
161
  control?: tailwind_variants.ClassValue;
@@ -176,10 +176,10 @@ declare const map: tailwind_variants.TVReturnType<{
176
176
  [key: string]: {
177
177
  [key: string]: tailwind_variants.ClassValue | {
178
178
  root?: tailwind_variants.ClassValue;
179
+ attribution?: tailwind_variants.ClassValue;
179
180
  canvas?: tailwind_variants.ClassValue;
180
181
  fallback?: tailwind_variants.ClassValue;
181
182
  controls?: tailwind_variants.ClassValue;
182
- attribution?: tailwind_variants.ClassValue;
183
183
  places?: tailwind_variants.ClassValue;
184
184
  markerLabel?: tailwind_variants.ClassValue;
185
185
  control?: tailwind_variants.ClassValue;
@@ -244,8 +244,16 @@ type MapLabels = {
244
244
  zoomOut: string;
245
245
  /** Before the list of places read in place of the map ("Places on the map"). */
246
246
  places: string;
247
+ /**
248
+ * The words of the engine's overlay when the wheel turns over a map in a page (the page scrolls; the map zooms with Ctrl or ⌘,
249
+ * or two fingers): MapLibre's `locale` keys `CooperativeGesturesHandler.WindowsHelpText`, `.MacHelpText` and `.MobileHelpText`.
250
+ * Missing: the engine's English.
251
+ */
252
+ gestureHelp?: Partial<Record<`CooperativeGesturesHandler.${"Windows" | "Mac" | "Mobile"}HelpText`, string>>;
247
253
  };
248
254
  declare const mapLabels: MapLabels;
255
+ /** Who owns the gestures: `page` (default) lets the wheel and one finger scroll the page; `map` is for a map that is the screen. */
256
+ type MapGestures = "page" | "map";
249
257
  type MapProps = {
250
258
  /** The map's accessible name ("Pick-up points near you"), passed translated. */
251
259
  label: string;
@@ -267,6 +275,12 @@ type MapProps = {
267
275
  region?: MapRegion | null;
268
276
  /** The world's low zooms (PMTiles). Default: our world extract (to zoom 6). */
269
277
  world?: MapRegion | null;
278
+ /**
279
+ * Who owns the wheel and the fingers. `page` (default): the wheel and one finger scroll the page past the map; the map zooms
280
+ * with Ctrl/⌘ + wheel, two fingers and the buttons, and a short hint says so. `map`: the map is the screen (full height) and
281
+ * takes every gesture.
282
+ */
283
+ gestures?: MapGestures;
270
284
  /** The zoom buttons (default) — the keyboard also zooms with + and − on the focused map. */
271
285
  controls?: boolean;
272
286
  /** Moves with the hand (default); `false` makes a still picture of a place. */
@@ -288,7 +302,7 @@ type MapProps = {
288
302
  className?: string;
289
303
  };
290
304
  /** A map: MapLibre over our Protomaps tiles, styled from the tokens, with its places as a list for screen readers. */
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;
305
+ declare function MapRoot({ label, center, zoom, controlled, scheme: schemeProp, variant, brand, lang, region, world, gestures, controls, interactive, fallback, onMoveEnd, onPress, children, labels: given, className, }: MapProps): React.JSX.Element;
292
306
  type MarkerProps = {
293
307
  /** Where it stands. */
294
308
  position: LngLat;
@@ -482,16 +496,16 @@ declare const staticMap: tailwind_variants.TVReturnType<{
482
496
  [key: string]: {
483
497
  [key: string]: tailwind_variants.ClassValue | {
484
498
  root?: tailwind_variants.ClassValue;
485
- attribution?: tailwind_variants.ClassValue;
486
499
  svg?: tailwind_variants.ClassValue;
500
+ attribution?: tailwind_variants.ClassValue;
487
501
  };
488
502
  };
489
503
  } | {
490
504
  [x: string]: {
491
505
  [x: string]: tailwind_variants.ClassValue | {
492
506
  root?: tailwind_variants.ClassValue;
493
- attribution?: tailwind_variants.ClassValue;
494
507
  svg?: tailwind_variants.ClassValue;
508
+ attribution?: tailwind_variants.ClassValue;
495
509
  };
496
510
  };
497
511
  } | {}, {
@@ -502,8 +516,8 @@ declare const staticMap: tailwind_variants.TVReturnType<{
502
516
  [key: string]: {
503
517
  [key: string]: tailwind_variants.ClassValue | {
504
518
  root?: tailwind_variants.ClassValue;
505
- attribution?: tailwind_variants.ClassValue;
506
519
  svg?: tailwind_variants.ClassValue;
520
+ attribution?: tailwind_variants.ClassValue;
507
521
  };
508
522
  };
509
523
  } | {}, {
@@ -537,4 +551,4 @@ type StaticMapProps = {
537
551
  declare function StaticMap({ label, center, zoom, places, image, className }: StaticMapProps): React.JSX.Element;
538
552
 
539
553
  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 };
540
- export type { ClusterPoint, ClusterProps, LngLat, LocationPickerLabels, LocationPickerProps, MapBrand, MapLabels, MapProps, MapRegion, MapScheme, MapStyleOptions, MapVariant, MarkerProps, PulseProps, RadiusCircleProps, RouteProps, StaticMapPlace, StaticMapProps, UserPositionProps };
554
+ export type { ClusterPoint, ClusterProps, LngLat, LocationPickerLabels, LocationPickerProps, MapBrand, MapGestures, MapLabels, MapProps, MapRegion, MapScheme, MapStyleOptions, MapVariant, MarkerProps, PulseProps, RadiusCircleProps, RouteProps, StaticMapPlace, StaticMapProps, UserPositionProps };
package/dist/map.js CHANGED
@@ -566,7 +566,11 @@ var hasWebGL = () => {
566
566
  return false;
567
567
  }
568
568
  };
569
- var mapLabels = { zoomIn: "Zoom in", zoomOut: "Zoom out", places: "Places on the map" };
569
+ var mapLabels = {
570
+ zoomIn: "Zoom in",
571
+ zoomOut: "Zoom out",
572
+ places: "Places on the map"
573
+ };
570
574
  function MapRoot({
571
575
  label,
572
576
  center,
@@ -578,6 +582,7 @@ function MapRoot({
578
582
  lang,
579
583
  region,
580
584
  world,
585
+ gestures = "page",
581
586
  controls = true,
582
587
  interactive = true,
583
588
  fallback,
@@ -633,7 +638,10 @@ function MapRoot({
633
638
  interactive,
634
639
  attributionControl: false,
635
640
  fadeDuration: reduce ? 0 : 300,
636
- cooperativeGestures: false
641
+ cooperativeGestures: gestures === "page",
642
+ // The engine's own overlay (styled in motion.css) says it in the words given; its English is the default.
643
+ locale: labels.gestureHelp
644
+ // The engine's own overlay (styled in motion.css) says it in the words given; its English is the default.
637
645
  });
638
646
  created.getCanvas().setAttribute("aria-hidden", "true");
639
647
  created.getCanvas().setAttribute("tabindex", "-1");
@@ -712,6 +720,12 @@ function MapRoot({
712
720
  }
713
721
  ) });
714
722
  }
723
+ function usePlace(id, label, places) {
724
+ React2.useEffect(() => {
725
+ places.add(id, label);
726
+ return () => places.remove(id);
727
+ }, [id, label, places]);
728
+ }
715
729
  var noSubscription = () => () => void 0;
716
730
  function Marker({ position, label, onPress, selected, size = 18, children, drop }) {
717
731
  const { map: m, lib, places } = useMap();
@@ -723,10 +737,7 @@ function Marker({ position, label, onPress, selected, size = 18, children, drop
723
737
  () => host.current ??= document.createElement("div"),
724
738
  () => null
725
739
  );
726
- React2.useEffect(() => {
727
- places.add(id, label);
728
- return () => places.remove(id);
729
- }, [id, label, places]);
740
+ usePlace(id, label, places);
730
741
  React2.useEffect(() => {
731
742
  if (!m || !lib || !el) return;
732
743
  el.setAttribute("data-kz-marker", "");
@@ -760,10 +771,7 @@ function Marker({ position, label, onPress, selected, size = 18, children, drop
760
771
  function UserPosition({ position, label, accuracy }) {
761
772
  const { map: m, lib, places } = useMap();
762
773
  const id = React2.useId();
763
- React2.useEffect(() => {
764
- places.add(id, label);
765
- return () => places.remove(id);
766
- }, [id, label, places]);
774
+ usePlace(id, label, places);
767
775
  React2.useEffect(() => {
768
776
  if (!m || !lib) return;
769
777
  const el = document.createElement("div");
@@ -777,10 +785,7 @@ function UserPosition({ position, label, accuracy }) {
777
785
  function Pulse({ position, label, size = 56, tone = "accent" }) {
778
786
  const { map: m, lib, places } = useMap();
779
787
  const id = React2.useId();
780
- React2.useEffect(() => {
781
- places.add(id, label);
782
- return () => places.remove(id);
783
- }, [id, label, places]);
788
+ usePlace(id, label, places);
784
789
  React2.useEffect(() => {
785
790
  if (!m || !lib) return;
786
791
  const el = document.createElement("div");
@@ -807,10 +812,7 @@ function Route({ path, label, draw = true, duration = 1400, courier, tripDuratio
807
812
  const drawn = !animated || doneFor === token;
808
813
  const whole = React2.useMemo(() => sliceLine(path, 1), [path]);
809
814
  const start = React2.useMemo(() => sliceLine(path, 0), [path]);
810
- React2.useEffect(() => {
811
- places.add(id, label);
812
- return () => places.remove(id);
813
- }, [id, label, places]);
815
+ usePlace(id, label, places);
814
816
  useGeoLayer(id, drawn ? whole : start, (c) => [
815
817
  { id: `${id}-casing`, type: "line", source: id, layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": c.accent, "line-width": 9, "line-opacity": tone === "soft" ? 0.08 : 0.16, "line-blur": 3 } },
816
818
  { id: `${id}-line`, type: "line", source: id, layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": c.accent, "line-width": tone === "soft" ? 2 : 3.5, "line-opacity": tone === "soft" ? 0.6 : 1 } }