@a4ui/core 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const A4UI_VERSION = "0.36.0";
1
+ export declare const A4UI_VERSION = "0.37.0";
2
2
  export { cn } from './lib/cn';
3
3
  export { useTheme, toggleTheme, setTheme, storedTheme, applyTheme, toggled, type Theme } from './lib/theme';
4
4
  export { useEffects, isCalm, setEffects } from './lib/effects';
package/dist/index.js CHANGED
@@ -10945,10 +10945,15 @@ function Dw(e) {
10945
10945
  label: c
10946
10946
  });
10947
10947
  }, o = () => {
10948
- typeof navigator > "u" || !navigator.geolocation || navigator.geolocation.getCurrentPosition((c) => s({
10949
- lat: c.coords.latitude,
10950
- lng: c.coords.longitude
10951
- }), (c) => console.error("LocationPicker: geolocation failed", c));
10948
+ typeof navigator > "u" || !navigator.geolocation || navigator.geolocation.getCurrentPosition((c) => {
10949
+ var f;
10950
+ const d = {
10951
+ ...r(),
10952
+ lat: c.coords.latitude,
10953
+ lng: c.coords.longitude
10954
+ };
10955
+ l(d), (f = e.onGeolocate) == null || f.call(e, d);
10956
+ }, (c) => console.error("LocationPicker: geolocation failed", c));
10952
10957
  }, g = () => {
10953
10958
  const {
10954
10959
  lat: c,
@@ -10982,7 +10987,9 @@ function Dw(e) {
10982
10987
  lng: r().lng
10983
10988
  };
10984
10989
  },
10985
- zoom: Kh,
10990
+ get zoom() {
10991
+ return e.zoom ?? Kh;
10992
+ },
10986
10993
  height: Gh,
10987
10994
  get markers() {
10988
10995
  return g();
@@ -14861,7 +14868,7 @@ function j1() {
14861
14868
  }
14862
14869
  Tx(e && jl(e) || br);
14863
14870
  }
14864
- const D1 = "0.36.0";
14871
+ const D1 = "0.37.0";
14865
14872
  export {
14866
14873
  D1 as A4UI_VERSION,
14867
14874
  g$ as Accordion,
@@ -18,6 +18,26 @@ export interface LocationPickerProps {
18
18
  labelPlaceholder?: string;
19
19
  /** Accessible name for the "use my location" button. @default 'Use my location' */
20
20
  geolocateLabel?: string;
21
+ /**
22
+ * Map zoom. Also acts as a zoom trigger the same way `center` does on
23
+ * `InteractiveMap` — passing a new value zooms there.
24
+ *
25
+ * Exposed because 12 (a whole city) is the wrong scale for confirming a
26
+ * pin: a consumer that wants to zoom in after a successful geolocation had
27
+ * no way to do it. @default 12
28
+ */
29
+ zoom?: number;
30
+ /**
31
+ * Fires ONLY when the "use my location" button succeeds, in addition to
32
+ * `onChange`.
33
+ *
34
+ * `onChange` alone cannot tell a map click from a geolocation, so a
35
+ * consumer had no way to react to one and not the other. Recentring on a
36
+ * user already looking at their own city moves the map barely at all and
37
+ * leaves the pin dead centre, which reads as nothing having happened —
38
+ * this is the hook for saying otherwise.
39
+ */
40
+ onGeolocate?: (v: LocationValue) => void;
21
41
  class?: string;
22
42
  }
23
43
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a4ui/core",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "description": "A4ui — Spatial Glass design system & component library for SolidJS (Kobalte behavior + Tailwind glass tokens + motion).",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  // import '@a4ui/core/styles.css'
9
9
  // import { Button, Card, Modal } from '@a4ui/core'
10
10
 
11
- export const A4UI_VERSION = '0.36.0'
11
+ export const A4UI_VERSION = '0.37.0'
12
12
 
13
13
  // Helpers (src/lib) — generic, framework-level utilities.
14
14
  export { cn } from './lib/cn'
@@ -29,10 +29,30 @@ export interface LocationPickerProps {
29
29
  labelPlaceholder?: string
30
30
  /** Accessible name for the "use my location" button. @default 'Use my location' */
31
31
  geolocateLabel?: string
32
+ /**
33
+ * Map zoom. Also acts as a zoom trigger the same way `center` does on
34
+ * `InteractiveMap` — passing a new value zooms there.
35
+ *
36
+ * Exposed because 12 (a whole city) is the wrong scale for confirming a
37
+ * pin: a consumer that wants to zoom in after a successful geolocation had
38
+ * no way to do it. @default 12
39
+ */
40
+ zoom?: number
41
+ /**
42
+ * Fires ONLY when the "use my location" button succeeds, in addition to
43
+ * `onChange`.
44
+ *
45
+ * `onChange` alone cannot tell a map click from a geolocation, so a
46
+ * consumer had no way to react to one and not the other. Recentring on a
47
+ * user already looking at their own city moves the map barely at all and
48
+ * leaves the pin dead centre, which reads as nothing having happened —
49
+ * this is the hook for saying otherwise.
50
+ */
51
+ onGeolocate?: (v: LocationValue) => void
32
52
  class?: string
33
53
  }
34
54
 
35
- const MAP_ZOOM = 12
55
+ const DEFAULT_MAP_ZOOM = 12
36
56
  const MAP_HEIGHT = 240
37
57
 
38
58
  /**
@@ -69,7 +89,15 @@ export function LocationPicker(props: LocationPickerProps): JSX.Element {
69
89
  const useMyLocation = (): void => {
70
90
  if (typeof navigator === 'undefined' || !navigator.geolocation) return
71
91
  navigator.geolocation.getCurrentPosition(
72
- (position) => setCoord({ lat: position.coords.latitude, lng: position.coords.longitude }),
92
+ (position) => {
93
+ const next: LocationValue = {
94
+ ...current(),
95
+ lat: position.coords.latitude,
96
+ lng: position.coords.longitude,
97
+ }
98
+ emit(next)
99
+ props.onGeolocate?.(next)
100
+ },
73
101
  (error) => console.error('LocationPicker: geolocation failed', error),
74
102
  )
75
103
  }
@@ -99,7 +127,7 @@ export function LocationPicker(props: LocationPickerProps): JSX.Element {
99
127
  </div>
100
128
  <InteractiveMap
101
129
  center={{ lat: current().lat, lng: current().lng }}
102
- zoom={MAP_ZOOM}
130
+ zoom={props.zoom ?? DEFAULT_MAP_ZOOM}
103
131
  height={MAP_HEIGHT}
104
132
  markers={pin()}
105
133
  onClick={setCoord}