@geomak/ui 1.7.0 → 1.7.1

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.cts CHANGED
@@ -1,80 +1,8 @@
1
1
  export { C as COLORS, S as SemanticColorKey, a as SemanticSharedKey, V as VarColorKey, b as VarDensityKey, c as VarMotionKey, d as VarRadiusKey, e as VarShadowKey, f as VarTypoKey, g as VarZIndexKey, P as palette, s as semanticTokens, v as vars } from './index-CvyV3YPI.cjs';
2
- import React$1 from 'react';
3
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React$1 from 'react';
4
4
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
5
5
 
6
- interface PortalProps {
7
- /** Content to render at the target node. */
8
- children: React$1.ReactNode;
9
- /**
10
- * Where to mount the portal.
11
- * - omitted / undefined → `document.body` (the safe default for viewport-anchored UI)
12
- * - HTMLElement → that exact node
13
- * - () => HTMLElement → resolved at mount time (lets you query the DOM after layout)
14
- * - null → portal is disabled and renders nothing
15
- */
16
- target?: HTMLElement | (() => HTMLElement | null) | null;
17
- }
18
- /**
19
- * SSR-safe portal helper. Renders `children` at a detached DOM node — by
20
- * default `document.body` — so that any `position: fixed` descendant resolves
21
- * against the real viewport, never against a transformed, filtered, or
22
- * contained ancestor.
23
- *
24
- * ## Why this exists
25
- *
26
- * Per CSS spec, **any ancestor with `transform`, `filter`, `perspective`,
27
- * `will-change`, or `contain: layout|paint|strict` creates a new containing
28
- * block for `position: fixed` descendants**. The fixed element then resolves
29
- * its coordinates against that ancestor, not the viewport — silently breaking
30
- * full-screen overlays, toast viewports, mobile drawers, and loading screens
31
- * whenever the consumer wraps the component in:
32
- * - a page-transition library (Framer Motion, view transitions)
33
- * - a modal/drawer (Storybook's centered-layout wrapper hits this too)
34
- * - a card with `contain: layout` or `will-change: transform`
35
- * - a CSS filter (backdrop-blur, drop-shadow on a card)
36
- *
37
- * Portaling to `document.body` makes the component **immune** to any
38
- * styling its consumer applies to ancestor elements. This is the same
39
- * pattern Radix UI uses internally for every overlay primitive
40
- * (`Dialog.Portal`, `Tooltip.Portal`, `Popover.Portal`, etc.).
41
- *
42
- * ## When to use it
43
- *
44
- * Wrap any element that uses `position: fixed` to anchor itself to the
45
- * viewport — full-screen overlays, toast viewports, drawers, loading
46
- * screens, command palettes. If you're using a Radix primitive, prefer
47
- * its built-in `*.Portal` component (they're equivalent but match the
48
- * primitive's lifecycle).
49
- *
50
- * ## SSR / hydration
51
- *
52
- * `document.body` isn't available during SSR or the very first client
53
- * render. The component renders `null` until `useEffect` resolves the
54
- * target post-mount, then re-renders with the portal in place. Content
55
- * that needs to appear immediately on mount will paint one frame later
56
- * — acceptable for overlays (the trigger interaction is what kicks them
57
- * off anyway).
58
- *
59
- * @example Full-screen loading overlay
60
- * <Portal>
61
- * <div className="fixed inset-0 bg-black/40 z-overlay">
62
- * <Spinner />
63
- * </div>
64
- * </Portal>
65
- *
66
- * @example Mount to a specific element
67
- * <Portal target={() => document.getElementById('app-root')}>
68
- * <Drawer />
69
- * </Portal>
70
- *
71
- * @example Conditionally disable (e.g. SSR-only render)
72
- * <Portal target={shouldPortal ? undefined : null}>
73
- * <Banner />
74
- * </Portal>
75
- */
76
- declare function Portal({ children, target }: PortalProps): React$1.ReactPortal;
77
-
78
6
  declare const Icon: {
79
7
  (): react_jsx_runtime.JSX.Element;
80
8
  Moon: ({ color }: {
@@ -322,18 +250,107 @@ declare const Icon: {
322
250
  }) => react_jsx_runtime.JSX.Element;
323
251
  };
324
252
 
253
+ interface PortalProps {
254
+ /** Content to render at the target node. */
255
+ children: React$1.ReactNode;
256
+ /**
257
+ * Where to mount the portal.
258
+ * - omitted / `undefined` → `document.body` (the safe default for viewport-anchored UI)
259
+ * - `HTMLElement` → that exact node
260
+ * - `() => HTMLElement | null` → resolved at mount time (lets you query the DOM after layout)
261
+ * - `null` → portal is disabled; nothing renders
262
+ */
263
+ target?: HTMLElement | (() => HTMLElement | null) | null;
264
+ }
265
+ /**
266
+ * SSR-safe DOM relocator. Renders `children` at a detached DOM node — by
267
+ * default `document.body` — so that any `position: fixed` descendant resolves
268
+ * against the real viewport, never against a transformed, filtered, or
269
+ * contained ancestor.
270
+ *
271
+ * ## Why this exists
272
+ *
273
+ * Per the CSS spec, **any ancestor with `transform`, `filter`, `perspective`,
274
+ * `will-change`, or `contain: layout|paint|strict` creates a new containing
275
+ * block for `position: fixed` descendants**. The fixed element then resolves
276
+ * its coordinates against that ancestor, not the viewport — silently breaking
277
+ * full-screen overlays, toast viewports, mobile drawers, and loading screens
278
+ * whenever a consumer wraps the component in:
279
+ *
280
+ * - a page-transition library (Framer Motion, view transitions)
281
+ * - a modal or drawer (Storybook's centered-layout wrapper hits this too)
282
+ * - a card with `contain: layout` or `will-change: transform`
283
+ * - a CSS filter (`backdrop-blur`, `drop-shadow`)
284
+ *
285
+ * Portaling to `document.body` makes the element **immune** to any styling
286
+ * its consumer applies to ancestor nodes. This is the same pattern Radix UI
287
+ * uses internally for every overlay primitive (`Dialog.Portal`,
288
+ * `Tooltip.Portal`, `Popover.Portal`, etc.).
289
+ *
290
+ * ## When to use it
291
+ *
292
+ * Wrap any element that uses `position: fixed` to anchor itself to the
293
+ * viewport — full-screen overlays, toast viewports, drawers, loading screens,
294
+ * command palettes, lightboxes.
295
+ *
296
+ * If you're already using a Radix primitive, prefer its built-in `*.Portal`
297
+ * component (they're equivalent but lifecycle-aware for that primitive).
298
+ *
299
+ * ## When NOT to use it
300
+ *
301
+ * - For inline elements that already flow naturally with the document — Portal
302
+ * is for **fixed/absolute escape**, not general layout.
303
+ * - For SSR-critical content that must appear before hydration — Portal renders
304
+ * `null` on the server and the first client render.
305
+ * - For accessibility-critical content that depends on DOM proximity (form
306
+ * labels, ARIA `aria-controls` targets) — escaping the tree can break focus
307
+ * order and assistive-tech navigation.
308
+ *
309
+ * ## SSR / hydration
310
+ *
311
+ * `document.body` isn't available during SSR or the first client render.
312
+ * `Portal` renders `null` until `useEffect` resolves the target post-mount,
313
+ * then re-renders with the portal in place. Content that needs to appear
314
+ * immediately on mount paints one frame later — acceptable for overlays
315
+ * (the trigger interaction is what kicks them off anyway).
316
+ *
317
+ * @example Full-screen loading overlay
318
+ * ```tsx
319
+ * <Portal>
320
+ * <div className="fixed inset-0 bg-black/40 z-overlay flex items-center justify-center">
321
+ * <Spinner />
322
+ * </div>
323
+ * </Portal>
324
+ * ```
325
+ *
326
+ * @example Mount to a specific element
327
+ * ```tsx
328
+ * <Portal target={() => document.getElementById('app-root')}>
329
+ * <Drawer />
330
+ * </Portal>
331
+ * ```
332
+ *
333
+ * @example Conditionally disable (render inline)
334
+ * ```tsx
335
+ * <Portal target={shouldPortal ? undefined : null}>
336
+ * <Banner />
337
+ * </Portal>
338
+ * ```
339
+ */
340
+ declare function Portal({ children, target }: PortalProps): React$1.ReactPortal;
341
+
342
+ type IconButtonVariant = 'primary' | 'bordered';
325
343
  interface IconButtonProps {
326
344
  icon?: React.ReactNode;
327
345
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
328
- /** 'primary' | 'bordered' */
329
- type?: string;
346
+ /** Visual style. Defaults to `'primary'`. */
347
+ type?: IconButtonVariant;
330
348
  buttonType?: 'button' | 'submit' | 'reset';
331
349
  disabled?: boolean;
332
350
  size?: 'sm' | 'lg';
333
351
  loading?: boolean;
334
352
  loadingIcon?: React.ReactNode;
335
353
  title?: string;
336
- [key: string]: any;
337
354
  }
338
355
  /**
339
356
  * Square icon-only button.
@@ -348,8 +365,13 @@ interface ModalProps {
348
365
  /**
349
366
  * Max width of the modal panel in pixels (default 600).
350
367
  * On narrow viewports the panel fills the screen minus 1 rem on each side.
351
- * Height is always content-driven `size[1]` is accepted for backwards
352
- * compatibility but is no longer used; remove it when convenient.
368
+ * Height is always content-driven (max 90 dvh).
369
+ */
370
+ width?: number;
371
+ /**
372
+ * @deprecated Use `width` instead. The second tuple value (height) was
373
+ * never honoured and is silently ignored. Kept for backwards
374
+ * compatibility — will be removed in a future major version.
353
375
  */
354
376
  size?: [number, number] | [number];
355
377
  isOpen?: boolean;
@@ -374,7 +396,7 @@ interface ModalProps {
374
396
  * Are you sure you want to delete this item?
375
397
  * </Modal>
376
398
  */
377
- declare function Modal({ size, isOpen, onClose, onOk, onCancel, okText, cancelText, hasFooter, title, children, }: ModalProps): react_jsx_runtime.JSX.Element;
399
+ declare function Modal({ width, size, isOpen, onClose, onOk, onCancel, okText, cancelText, hasFooter, title, children, }: ModalProps): react_jsx_runtime.JSX.Element;
378
400
 
379
401
  interface DrawerProps {
380
402
  isOpen?: boolean;
package/dist/index.d.ts CHANGED
@@ -1,80 +1,8 @@
1
1
  export { C as COLORS, S as SemanticColorKey, a as SemanticSharedKey, V as VarColorKey, b as VarDensityKey, c as VarMotionKey, d as VarRadiusKey, e as VarShadowKey, f as VarTypoKey, g as VarZIndexKey, P as palette, s as semanticTokens, v as vars } from './index-CvyV3YPI.js';
2
- import React$1 from 'react';
3
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React$1 from 'react';
4
4
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
5
5
 
6
- interface PortalProps {
7
- /** Content to render at the target node. */
8
- children: React$1.ReactNode;
9
- /**
10
- * Where to mount the portal.
11
- * - omitted / undefined → `document.body` (the safe default for viewport-anchored UI)
12
- * - HTMLElement → that exact node
13
- * - () => HTMLElement → resolved at mount time (lets you query the DOM after layout)
14
- * - null → portal is disabled and renders nothing
15
- */
16
- target?: HTMLElement | (() => HTMLElement | null) | null;
17
- }
18
- /**
19
- * SSR-safe portal helper. Renders `children` at a detached DOM node — by
20
- * default `document.body` — so that any `position: fixed` descendant resolves
21
- * against the real viewport, never against a transformed, filtered, or
22
- * contained ancestor.
23
- *
24
- * ## Why this exists
25
- *
26
- * Per CSS spec, **any ancestor with `transform`, `filter`, `perspective`,
27
- * `will-change`, or `contain: layout|paint|strict` creates a new containing
28
- * block for `position: fixed` descendants**. The fixed element then resolves
29
- * its coordinates against that ancestor, not the viewport — silently breaking
30
- * full-screen overlays, toast viewports, mobile drawers, and loading screens
31
- * whenever the consumer wraps the component in:
32
- * - a page-transition library (Framer Motion, view transitions)
33
- * - a modal/drawer (Storybook's centered-layout wrapper hits this too)
34
- * - a card with `contain: layout` or `will-change: transform`
35
- * - a CSS filter (backdrop-blur, drop-shadow on a card)
36
- *
37
- * Portaling to `document.body` makes the component **immune** to any
38
- * styling its consumer applies to ancestor elements. This is the same
39
- * pattern Radix UI uses internally for every overlay primitive
40
- * (`Dialog.Portal`, `Tooltip.Portal`, `Popover.Portal`, etc.).
41
- *
42
- * ## When to use it
43
- *
44
- * Wrap any element that uses `position: fixed` to anchor itself to the
45
- * viewport — full-screen overlays, toast viewports, drawers, loading
46
- * screens, command palettes. If you're using a Radix primitive, prefer
47
- * its built-in `*.Portal` component (they're equivalent but match the
48
- * primitive's lifecycle).
49
- *
50
- * ## SSR / hydration
51
- *
52
- * `document.body` isn't available during SSR or the very first client
53
- * render. The component renders `null` until `useEffect` resolves the
54
- * target post-mount, then re-renders with the portal in place. Content
55
- * that needs to appear immediately on mount will paint one frame later
56
- * — acceptable for overlays (the trigger interaction is what kicks them
57
- * off anyway).
58
- *
59
- * @example Full-screen loading overlay
60
- * <Portal>
61
- * <div className="fixed inset-0 bg-black/40 z-overlay">
62
- * <Spinner />
63
- * </div>
64
- * </Portal>
65
- *
66
- * @example Mount to a specific element
67
- * <Portal target={() => document.getElementById('app-root')}>
68
- * <Drawer />
69
- * </Portal>
70
- *
71
- * @example Conditionally disable (e.g. SSR-only render)
72
- * <Portal target={shouldPortal ? undefined : null}>
73
- * <Banner />
74
- * </Portal>
75
- */
76
- declare function Portal({ children, target }: PortalProps): React$1.ReactPortal;
77
-
78
6
  declare const Icon: {
79
7
  (): react_jsx_runtime.JSX.Element;
80
8
  Moon: ({ color }: {
@@ -322,18 +250,107 @@ declare const Icon: {
322
250
  }) => react_jsx_runtime.JSX.Element;
323
251
  };
324
252
 
253
+ interface PortalProps {
254
+ /** Content to render at the target node. */
255
+ children: React$1.ReactNode;
256
+ /**
257
+ * Where to mount the portal.
258
+ * - omitted / `undefined` → `document.body` (the safe default for viewport-anchored UI)
259
+ * - `HTMLElement` → that exact node
260
+ * - `() => HTMLElement | null` → resolved at mount time (lets you query the DOM after layout)
261
+ * - `null` → portal is disabled; nothing renders
262
+ */
263
+ target?: HTMLElement | (() => HTMLElement | null) | null;
264
+ }
265
+ /**
266
+ * SSR-safe DOM relocator. Renders `children` at a detached DOM node — by
267
+ * default `document.body` — so that any `position: fixed` descendant resolves
268
+ * against the real viewport, never against a transformed, filtered, or
269
+ * contained ancestor.
270
+ *
271
+ * ## Why this exists
272
+ *
273
+ * Per the CSS spec, **any ancestor with `transform`, `filter`, `perspective`,
274
+ * `will-change`, or `contain: layout|paint|strict` creates a new containing
275
+ * block for `position: fixed` descendants**. The fixed element then resolves
276
+ * its coordinates against that ancestor, not the viewport — silently breaking
277
+ * full-screen overlays, toast viewports, mobile drawers, and loading screens
278
+ * whenever a consumer wraps the component in:
279
+ *
280
+ * - a page-transition library (Framer Motion, view transitions)
281
+ * - a modal or drawer (Storybook's centered-layout wrapper hits this too)
282
+ * - a card with `contain: layout` or `will-change: transform`
283
+ * - a CSS filter (`backdrop-blur`, `drop-shadow`)
284
+ *
285
+ * Portaling to `document.body` makes the element **immune** to any styling
286
+ * its consumer applies to ancestor nodes. This is the same pattern Radix UI
287
+ * uses internally for every overlay primitive (`Dialog.Portal`,
288
+ * `Tooltip.Portal`, `Popover.Portal`, etc.).
289
+ *
290
+ * ## When to use it
291
+ *
292
+ * Wrap any element that uses `position: fixed` to anchor itself to the
293
+ * viewport — full-screen overlays, toast viewports, drawers, loading screens,
294
+ * command palettes, lightboxes.
295
+ *
296
+ * If you're already using a Radix primitive, prefer its built-in `*.Portal`
297
+ * component (they're equivalent but lifecycle-aware for that primitive).
298
+ *
299
+ * ## When NOT to use it
300
+ *
301
+ * - For inline elements that already flow naturally with the document — Portal
302
+ * is for **fixed/absolute escape**, not general layout.
303
+ * - For SSR-critical content that must appear before hydration — Portal renders
304
+ * `null` on the server and the first client render.
305
+ * - For accessibility-critical content that depends on DOM proximity (form
306
+ * labels, ARIA `aria-controls` targets) — escaping the tree can break focus
307
+ * order and assistive-tech navigation.
308
+ *
309
+ * ## SSR / hydration
310
+ *
311
+ * `document.body` isn't available during SSR or the first client render.
312
+ * `Portal` renders `null` until `useEffect` resolves the target post-mount,
313
+ * then re-renders with the portal in place. Content that needs to appear
314
+ * immediately on mount paints one frame later — acceptable for overlays
315
+ * (the trigger interaction is what kicks them off anyway).
316
+ *
317
+ * @example Full-screen loading overlay
318
+ * ```tsx
319
+ * <Portal>
320
+ * <div className="fixed inset-0 bg-black/40 z-overlay flex items-center justify-center">
321
+ * <Spinner />
322
+ * </div>
323
+ * </Portal>
324
+ * ```
325
+ *
326
+ * @example Mount to a specific element
327
+ * ```tsx
328
+ * <Portal target={() => document.getElementById('app-root')}>
329
+ * <Drawer />
330
+ * </Portal>
331
+ * ```
332
+ *
333
+ * @example Conditionally disable (render inline)
334
+ * ```tsx
335
+ * <Portal target={shouldPortal ? undefined : null}>
336
+ * <Banner />
337
+ * </Portal>
338
+ * ```
339
+ */
340
+ declare function Portal({ children, target }: PortalProps): React$1.ReactPortal;
341
+
342
+ type IconButtonVariant = 'primary' | 'bordered';
325
343
  interface IconButtonProps {
326
344
  icon?: React.ReactNode;
327
345
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
328
- /** 'primary' | 'bordered' */
329
- type?: string;
346
+ /** Visual style. Defaults to `'primary'`. */
347
+ type?: IconButtonVariant;
330
348
  buttonType?: 'button' | 'submit' | 'reset';
331
349
  disabled?: boolean;
332
350
  size?: 'sm' | 'lg';
333
351
  loading?: boolean;
334
352
  loadingIcon?: React.ReactNode;
335
353
  title?: string;
336
- [key: string]: any;
337
354
  }
338
355
  /**
339
356
  * Square icon-only button.
@@ -348,8 +365,13 @@ interface ModalProps {
348
365
  /**
349
366
  * Max width of the modal panel in pixels (default 600).
350
367
  * On narrow viewports the panel fills the screen minus 1 rem on each side.
351
- * Height is always content-driven `size[1]` is accepted for backwards
352
- * compatibility but is no longer used; remove it when convenient.
368
+ * Height is always content-driven (max 90 dvh).
369
+ */
370
+ width?: number;
371
+ /**
372
+ * @deprecated Use `width` instead. The second tuple value (height) was
373
+ * never honoured and is silently ignored. Kept for backwards
374
+ * compatibility — will be removed in a future major version.
353
375
  */
354
376
  size?: [number, number] | [number];
355
377
  isOpen?: boolean;
@@ -374,7 +396,7 @@ interface ModalProps {
374
396
  * Are you sure you want to delete this item?
375
397
  * </Modal>
376
398
  */
377
- declare function Modal({ size, isOpen, onClose, onOk, onCancel, okText, cancelText, hasFooter, title, children, }: ModalProps): react_jsx_runtime.JSX.Element;
399
+ declare function Modal({ width, size, isOpen, onClose, onOk, onCancel, okText, cancelText, hasFooter, title, children, }: ModalProps): react_jsx_runtime.JSX.Element;
378
400
 
379
401
  interface DrawerProps {
380
402
  isOpen?: boolean;