akanjs 3.0.0-alpha.107 → 3.0.0-alpha.109

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "3.0.0-alpha.107",
3
+ "version": "3.0.0-alpha.109",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -2,14 +2,16 @@ import type { ReactNode } from "react";
2
2
  export interface ModalProps {
3
3
  /** Additional classes for the modal surface. */
4
4
  className?: string;
5
+ /** Optional trigger element to open the modal. */
6
+ trigger?: ReactNode;
5
7
  /** Optional modal title. */
6
8
  title?: string | ReactNode;
7
9
  /** Optional action area, usually footer buttons. */
8
10
  action?: ReactNode;
9
11
  /** Controlled open state. */
10
- open: boolean;
12
+ open?: boolean;
11
13
  /** Called when the modal requests closing. */
12
- onCancel: () => void;
14
+ onCancel?: () => void;
13
15
  /** Additional classes for the content body. */
14
16
  bodyClassName?: string;
15
17
  children?: ReactNode;
@@ -20,7 +22,7 @@ export interface ModalProps {
20
22
  * Default akanjs modal skin. Kept as the fallback implementation; apps replace
21
23
  * it per-route through a `page/**\/_overrides.tsx` manifest.
22
24
  */
23
- export declare const DefaultModal: ({ className, title, action, open, onCancel, bodyClassName, children, confirmClose, }: ModalProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const DefaultModal: ({ className, trigger, title, action, open, onCancel, bodyClassName, children, confirmClose, }: ModalProps) => import("react/jsx-runtime").JSX.Element;
24
26
  /**
25
27
  * Public Modal. Resolves to a route-scoped override when a `_overrides.tsx` in
26
28
  * the route's ancestry declares one, otherwise renders {@link DefaultModal}.
package/ui/Modal.tsx CHANGED
@@ -1,20 +1,21 @@
1
1
  "use client";
2
- import type { ReactNode } from "react";
3
2
 
4
- import { Dialog } from "./Dialog";
5
- import { createOverridable } from "./UiOverride";
3
+ import { createOverridable, Dialog } from "akanjs/ui";
4
+ import type { ReactNode } from "react";
6
5
 
7
6
  export interface ModalProps {
8
7
  /** Additional classes for the modal surface. */
9
8
  className?: string;
9
+ /** Optional trigger element to open the modal. */
10
+ trigger?: ReactNode;
10
11
  /** Optional modal title. */
11
12
  title?: string | ReactNode;
12
13
  /** Optional action area, usually footer buttons. */
13
14
  action?: ReactNode;
14
15
  /** Controlled open state. */
15
- open: boolean;
16
+ open?: boolean;
16
17
  /** Called when the modal requests closing. */
17
- onCancel: () => void;
18
+ onCancel?: () => void;
18
19
  /** Additional classes for the content body. */
19
20
  bodyClassName?: string;
20
21
  children?: ReactNode;
@@ -28,6 +29,7 @@ export interface ModalProps {
28
29
  */
29
30
  export const DefaultModal = ({
30
31
  className,
32
+ trigger,
31
33
  title,
32
34
  action,
33
35
  open,
@@ -38,6 +40,7 @@ export const DefaultModal = ({
38
40
  }: ModalProps) => {
39
41
  return (
40
42
  <Dialog open={open}>
43
+ {trigger ? <Dialog.Trigger>{trigger}</Dialog.Trigger> : null}
41
44
  <Dialog.Modal className={className} onCancel={onCancel} bodyClassName={bodyClassName} confirmClose={confirmClose}>
42
45
  {title ? <Dialog.Title>{title}</Dialog.Title> : null}
43
46
  <Dialog.Content>{children}</Dialog.Content>