alouette 20.2.0 → 20.3.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/definitions/index.d.ts +4 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/ui/containers/AlertDialog.d.ts +78 -0
- package/dist/definitions/ui/containers/AlertDialog.d.ts.map +1 -0
- package/dist/definitions/ui/containers/AlertDialog.stories.d.ts +33 -0
- package/dist/definitions/ui/containers/AlertDialog.stories.d.ts.map +1 -0
- package/dist/definitions/ui/containers/Modal.d.ts +66 -0
- package/dist/definitions/ui/containers/Modal.d.ts.map +1 -0
- package/dist/definitions/ui/containers/Modal.stories.d.ts +31 -0
- package/dist/definitions/ui/containers/Modal.stories.d.ts.map +1 -0
- package/dist/index-browser.es.js +237 -17
- package/dist/index-browser.es.js.map +1 -1
- package/dist/index-node22.cjs +242 -16
- package/dist/index-node22.cjs.map +1 -1
- package/dist/index-node22.mjs +240 -20
- package/dist/index-node22.mjs.map +1 -1
- package/dist/index-react-native.cjs.js +242 -16
- package/dist/index-react-native.cjs.js.map +1 -1
- package/dist/index-react-native.es.js +240 -20
- package/dist/index-react-native.es.js.map +1 -1
- package/package.json +1 -1
- package/src/config/defaultColorScales.ts +1 -1
- package/src/index.ts +13 -0
- package/src/ui/containers/AlertDialog.stories.tsx +425 -0
- package/src/ui/containers/AlertDialog.tsx +211 -0
- package/src/ui/containers/Modal.stories.tsx +231 -0
- package/src/ui/containers/Modal.tsx +197 -0
|
@@ -40,6 +40,10 @@ export { PresenceList, PresenceOne } from "./ui/containers/Presence";
|
|
|
40
40
|
export { animationDurationsMs } from "./animationDurationsMs";
|
|
41
41
|
export type { SurfaceProps } from "./ui/containers/Surface";
|
|
42
42
|
export { Surface } from "./ui/containers/Surface";
|
|
43
|
+
export type { ModalProps } from "./ui/containers/Modal";
|
|
44
|
+
export { Modal } from "./ui/containers/Modal";
|
|
45
|
+
export type { AlertDialogProps, AlertDialogUsageProps, } from "./ui/containers/AlertDialog";
|
|
46
|
+
export { AlertDialog, InfoAlertDialog, QuestionAlertDialog, SuccessAlertDialog, WarningAlertDialog, } from "./ui/containers/AlertDialog";
|
|
43
47
|
export type { IconProps, SVGIconElement } from "./ui/primitives/Icon";
|
|
44
48
|
export { Icon } from "./ui/primitives/Icon";
|
|
45
49
|
export type { PressableBoxProps } from "./ui/data/PressableBox";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,YA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C;AAC1D,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,OAAO,EACP,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACvE,YAAY,EACV,iBAAiB,EACjB,kCAAkC,EAClC,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { Accent } from "../../core/AlouetteConfig";
|
|
3
|
+
import type { SVGIconElement } from "../primitives/Icon";
|
|
4
|
+
import { type ModalProps } from "./Modal";
|
|
5
|
+
interface AlertDialogBaseProps extends Pick<ModalProps, "size" | "testID"> {
|
|
6
|
+
/** Whether the dialog is shown. */
|
|
7
|
+
visible: boolean;
|
|
8
|
+
/** Heading; also labels the dialog for assistive tech. */
|
|
9
|
+
title: string;
|
|
10
|
+
/** Body copy describing the situation or the consequence of confirming. */
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
/** Themes the icon and the primary button. Defaults to "danger". */
|
|
13
|
+
accent?: Accent;
|
|
14
|
+
/**
|
|
15
|
+
* Icon shown in the header, signalling the nature of the dialog. Prefer a
|
|
16
|
+
* usage component ({@link QuestionAlertDialog}, {@link WarningAlertDialog},
|
|
17
|
+
* {@link InfoAlertDialog}, {@link SuccessAlertDialog}) which supplies it.
|
|
18
|
+
*/
|
|
19
|
+
icon: SVGIconElement;
|
|
20
|
+
}
|
|
21
|
+
interface ConfirmAlertDialogProps extends AlertDialogBaseProps {
|
|
22
|
+
/**
|
|
23
|
+
* "confirm" (default) offers a cancel and a confirm action — for decisions,
|
|
24
|
+
* typically destructive ones.
|
|
25
|
+
*/
|
|
26
|
+
variant?: "confirm";
|
|
27
|
+
/** Called when the user confirms the action. */
|
|
28
|
+
onConfirm: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Called when the user rejects the action — cancel button, backdrop, Escape,
|
|
31
|
+
* or the Android back button.
|
|
32
|
+
*/
|
|
33
|
+
onCancel: () => void;
|
|
34
|
+
/** Confirm button label. Defaults to "Confirm". */
|
|
35
|
+
confirmText?: ReactNode;
|
|
36
|
+
/** Cancel button label. Defaults to "Cancel". */
|
|
37
|
+
cancelText?: ReactNode;
|
|
38
|
+
/** Disables the confirm button (e.g. while an async action is pending). */
|
|
39
|
+
confirmDisabled?: boolean;
|
|
40
|
+
}
|
|
41
|
+
interface AcknowledgeAlertDialogProps extends AlertDialogBaseProps {
|
|
42
|
+
/**
|
|
43
|
+
* "alert" offers a single acknowledge action — for interruptions that only
|
|
44
|
+
* need to be read and dismissed.
|
|
45
|
+
*/
|
|
46
|
+
variant: "alert";
|
|
47
|
+
/**
|
|
48
|
+
* Called when the user dismisses the dialog — acknowledge button, backdrop,
|
|
49
|
+
* Escape, or the Android back button.
|
|
50
|
+
*/
|
|
51
|
+
onClose: () => void;
|
|
52
|
+
/** Acknowledge button label. Defaults to "OK". */
|
|
53
|
+
closeText?: ReactNode;
|
|
54
|
+
}
|
|
55
|
+
interface RequiredAlertDialogProps extends AlertDialogBaseProps {
|
|
56
|
+
/**
|
|
57
|
+
* "required" offers a single action and cannot be dismissed by the backdrop,
|
|
58
|
+
* Escape, or the Android back button — the user must respond (e.g. accept
|
|
59
|
+
* updated terms, a forced sign-out).
|
|
60
|
+
*/
|
|
61
|
+
variant: "required";
|
|
62
|
+
/** Called when the user takes the required action. */
|
|
63
|
+
onConfirm: () => void;
|
|
64
|
+
/** Action button label. Defaults to "OK". */
|
|
65
|
+
confirmText?: ReactNode;
|
|
66
|
+
/** Disables the action button (e.g. while an async action is pending). */
|
|
67
|
+
confirmDisabled?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export type AlertDialogProps = AcknowledgeAlertDialogProps | ConfirmAlertDialogProps | RequiredAlertDialogProps;
|
|
70
|
+
export declare function AlertDialog(props: AlertDialogProps): ReactNode;
|
|
71
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
72
|
+
export type AlertDialogUsageProps = DistributiveOmit<AlertDialogProps, "icon">;
|
|
73
|
+
export declare function QuestionAlertDialog(props: AlertDialogUsageProps): ReactNode;
|
|
74
|
+
export declare function WarningAlertDialog(props: AlertDialogUsageProps): ReactNode;
|
|
75
|
+
export declare function InfoAlertDialog(props: AlertDialogUsageProps): ReactNode;
|
|
76
|
+
export declare function SuccessAlertDialog(props: AlertDialogUsageProps): ReactNode;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=AlertDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/containers/AlertDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,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BAAwB,CAAC;AAsE7B,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAkC9D;AAGD,KAAK,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,OAAO,GAC/D,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACV,KAAK,CAAC;AAGV,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAE/E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAE3E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAE1E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAEvE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAE1E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import type { Accent } from "../../core/AlouetteConfig";
|
|
3
|
+
import { AlertDialog } from "./AlertDialog";
|
|
4
|
+
type ThisStory = StoryObj<typeof AlertDialog>;
|
|
5
|
+
declare const _default: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: typeof AlertDialog;
|
|
8
|
+
parameters: {
|
|
9
|
+
componentSubtitle: string;
|
|
10
|
+
};
|
|
11
|
+
argTypes: {
|
|
12
|
+
title: {
|
|
13
|
+
control: "text";
|
|
14
|
+
};
|
|
15
|
+
variant: {
|
|
16
|
+
control: "inline-radio";
|
|
17
|
+
options: string[];
|
|
18
|
+
};
|
|
19
|
+
size: {
|
|
20
|
+
control: "select";
|
|
21
|
+
options: string[];
|
|
22
|
+
};
|
|
23
|
+
accent: {
|
|
24
|
+
control: "select";
|
|
25
|
+
options: Accent[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
30
|
+
export declare const PreviewAlertDialogStory: ThisStory;
|
|
31
|
+
export declare const Variants: ThisStory;
|
|
32
|
+
export declare const Tests: StoryObj<typeof AlertDialog>;
|
|
33
|
+
//# sourceMappingURL=AlertDialog.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.stories.d.ts","sourceRoot":"","sources":["../../../../src/ui/containers/AlertDialog.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,EACL,WAAW,EAOZ,MAAM,eAAe,CAAC;AAEvB,KAAK,SAAS,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAoH9C,wBAgBqC;AAErC,eAAO,MAAM,uBAAuB,EAAE,SAiBrC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAmKtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,OAAO,WAAW,CAuF9C,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type VariantProps } from "tailwind-variants";
|
|
3
|
+
import type { Accent } from "../../core/AlouetteConfig";
|
|
4
|
+
import { type SVGIconElement } from "../primitives/Icon";
|
|
5
|
+
declare const panelVariants: import("tailwind-variants").TVReturnType<{
|
|
6
|
+
size: {
|
|
7
|
+
sm: string;
|
|
8
|
+
md: string;
|
|
9
|
+
lg: string;
|
|
10
|
+
};
|
|
11
|
+
}, undefined, "w-full", {
|
|
12
|
+
size: {
|
|
13
|
+
sm: string;
|
|
14
|
+
md: string;
|
|
15
|
+
lg: string;
|
|
16
|
+
};
|
|
17
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
18
|
+
size: {
|
|
19
|
+
sm: string;
|
|
20
|
+
md: string;
|
|
21
|
+
lg: string;
|
|
22
|
+
};
|
|
23
|
+
}, undefined, "w-full", unknown, unknown, undefined>>;
|
|
24
|
+
type PanelVariantProps = VariantProps<typeof panelVariants>;
|
|
25
|
+
interface ModalBaseProps {
|
|
26
|
+
/** Whether the modal is shown. */
|
|
27
|
+
visible: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Called when the user dismisses the modal — backdrop press, close button, the
|
|
30
|
+
* Android back button, or the Escape key (web).
|
|
31
|
+
*/
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
/** Accent-tinted icon rendered before the title in the header. */
|
|
35
|
+
icon?: SVGIconElement;
|
|
36
|
+
/** Actions row rendered below the body (e.g. Cancel/Confirm buttons). */
|
|
37
|
+
footer?: ReactNode;
|
|
38
|
+
accent?: Accent;
|
|
39
|
+
size?: PanelVariantProps["size"];
|
|
40
|
+
/** Hide the header close button (the modal stays dismissible otherwise). */
|
|
41
|
+
hideCloseButton?: boolean;
|
|
42
|
+
/** Accessible label for the close button. */
|
|
43
|
+
closeButtonAriaLabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* `alertdialog` for interruptions that require an explicit response
|
|
46
|
+
* (destructive confirmation, errors). Defaults to `dialog`.
|
|
47
|
+
*/
|
|
48
|
+
role?: "alertdialog" | "dialog";
|
|
49
|
+
/** ID of the element describing the dialog (announced by assistive tech). */
|
|
50
|
+
"aria-describedby"?: string;
|
|
51
|
+
testID?: string;
|
|
52
|
+
}
|
|
53
|
+
interface ModalWithTitleProps extends ModalBaseProps {
|
|
54
|
+
/** Heading rendered in the header; also labels the dialog for assistive tech. */
|
|
55
|
+
title: string;
|
|
56
|
+
"aria-label"?: string;
|
|
57
|
+
}
|
|
58
|
+
interface ModalWithoutTitleProps extends ModalBaseProps {
|
|
59
|
+
title?: undefined;
|
|
60
|
+
/** Required when there is no `title`, so the dialog is still labelled. */
|
|
61
|
+
"aria-label": string;
|
|
62
|
+
}
|
|
63
|
+
export type ModalProps = ModalWithoutTitleProps | ModalWithTitleProps;
|
|
64
|
+
export declare function Modal({ visible, onClose, children, icon, footer, accent, size, title, hideCloseButton, closeButtonAriaLabel, role, "aria-describedby": ariaDescribedby, testID, "aria-label": ariaLabel, }: ModalProps): ReactNode;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/ui/containers/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,KAAK,YAAY,EAAM,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAQ/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;qDAelB,CAAC;AAEF,KAAK,iBAAiB,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAqB5D,UAAU,cAAc;IACtB,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,kEAAkE;IAClE,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,yEAAyE;IACzE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjC,4EAA4E;IAC5E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,6CAA6C;IAC7C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,QAAQ,CAAC;IAChC,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,mBAAoB,SAAQ,cAAc;IAClD,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,sBAAuB,SAAQ,cAAc;IACrD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GAAG,sBAAsB,GAAG,mBAAmB,CAAC;AAEtE,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAW,EACX,KAAK,EACL,eAAuB,EACvB,oBAA8B,EAC9B,IAAe,EACf,kBAAkB,EAAE,eAAe,EACnC,MAAM,EACN,YAAY,EAAE,SAAS,GACxB,EAAE,UAAU,GAAG,SAAS,CAsFxB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Modal } from "./Modal";
|
|
3
|
+
type ThisStory = StoryObj<typeof Modal>;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: typeof Modal;
|
|
7
|
+
parameters: {
|
|
8
|
+
componentSubtitle: string;
|
|
9
|
+
};
|
|
10
|
+
argTypes: {
|
|
11
|
+
title: {
|
|
12
|
+
control: "text";
|
|
13
|
+
};
|
|
14
|
+
size: {
|
|
15
|
+
control: "select";
|
|
16
|
+
options: string[];
|
|
17
|
+
};
|
|
18
|
+
accent: {
|
|
19
|
+
control: "select";
|
|
20
|
+
options: import("../..").Accent[];
|
|
21
|
+
};
|
|
22
|
+
hideCloseButton: {
|
|
23
|
+
control: "boolean";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
28
|
+
export declare const PreviewModalStory: ThisStory;
|
|
29
|
+
export declare const Variants: ThisStory;
|
|
30
|
+
export declare const Tests: StoryObj<typeof Modal>;
|
|
31
|
+
//# sourceMappingURL=Modal.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.stories.d.ts","sourceRoot":"","sources":["../../../../src/ui/containers/Modal.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,EAAE,KAAK,EAAmB,MAAM,SAAS,CAAC;AAEjD,KAAK,SAAS,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAsCxC,wBAa+B;AAE/B,eAAO,MAAM,iBAAiB,EAAE,SAqB/B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,SAwGtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,OAAO,KAAK,CAuCxC,CAAC"}
|
package/dist/index-browser.es.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
2
|
import { VariableContextProvider, styled as styled$1 } from 'nativewind';
|
|
3
|
-
import { createContext, useContext, forwardRef, Children, cloneElement, Fragment, useRef, useState, useEffect, isValidElement, useCallback } from 'react';
|
|
4
|
-
import { useColorScheme, View as View$1, Text as Text$1, ScrollView as ScrollView$1, FlatList as FlatList$1, SectionList as SectionList$1, Pressable, Platform,
|
|
3
|
+
import { createContext, useContext, forwardRef, Children, cloneElement, Fragment, useRef, useState, useEffect, isValidElement, useId, useCallback } from 'react';
|
|
4
|
+
import { useColorScheme, View as View$1, Text as Text$1, ScrollView as ScrollView$1, FlatList as FlatList$1, SectionList as SectionList$1, Pressable, Platform, useWindowDimensions, Modal as Modal$1, TextInput } from 'react-native-web';
|
|
5
5
|
import { extendTailwindMerge, twMerge as twMerge$1 } from 'tailwind-merge';
|
|
6
6
|
import { tv } from 'tailwind-variants';
|
|
7
|
-
import {
|
|
7
|
+
import { XRegularIcon } from 'alouette-icons/phosphor-icons/XRegularIcon';
|
|
8
8
|
import { CheckRegularIcon } from 'alouette-icons/phosphor-icons/CheckRegularIcon';
|
|
9
9
|
import { InfoRegularIcon } from 'alouette-icons/phosphor-icons/InfoRegularIcon';
|
|
10
|
+
import { QuestionRegularIcon } from 'alouette-icons/phosphor-icons/QuestionRegularIcon';
|
|
10
11
|
import { WarningRegularIcon } from 'alouette-icons/phosphor-icons/WarningRegularIcon';
|
|
11
|
-
import {
|
|
12
|
+
import { CaretDownRegularIcon } from 'alouette-icons/phosphor-icons/CaretDownRegularIcon';
|
|
12
13
|
import { CaretRightRegularIcon } from 'alouette-icons/phosphor-icons/CaretRightRegularIcon';
|
|
13
14
|
|
|
14
15
|
const ThemeContext = createContext("light");
|
|
@@ -1253,18 +1254,6 @@ const animationDurationsMs = {
|
|
|
1253
1254
|
"collapse": 800
|
|
1254
1255
|
};
|
|
1255
1256
|
|
|
1256
|
-
function Icon({
|
|
1257
|
-
icon,
|
|
1258
|
-
size = 20,
|
|
1259
|
-
className = "text-sharp"
|
|
1260
|
-
}) {
|
|
1261
|
-
return cloneElement(icon, {
|
|
1262
|
-
className,
|
|
1263
|
-
width: size,
|
|
1264
|
-
height: size
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
1257
|
const pressableBoxVariants = tv(
|
|
1269
1258
|
{
|
|
1270
1259
|
extend: interactiveBoxVariants,
|
|
@@ -1396,6 +1385,18 @@ const PressableBox = forwardRef(
|
|
|
1396
1385
|
}
|
|
1397
1386
|
);
|
|
1398
1387
|
|
|
1388
|
+
function Icon({
|
|
1389
|
+
icon,
|
|
1390
|
+
size = 20,
|
|
1391
|
+
className = "text-sharp"
|
|
1392
|
+
}) {
|
|
1393
|
+
return cloneElement(icon, {
|
|
1394
|
+
className,
|
|
1395
|
+
width: size,
|
|
1396
|
+
height: size
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1399
1400
|
const buttonHeight = {
|
|
1400
1401
|
sm: 38,
|
|
1401
1402
|
md: 44
|
|
@@ -1607,6 +1608,225 @@ function IconButton({
|
|
|
1607
1608
|
);
|
|
1608
1609
|
}
|
|
1609
1610
|
|
|
1611
|
+
const panelVariants = tv(
|
|
1612
|
+
{
|
|
1613
|
+
// w-full so the panel shrinks on small screens (the backdrop padding keeps a
|
|
1614
|
+
// margin); max-w caps it on wide viewports.
|
|
1615
|
+
base: "w-full",
|
|
1616
|
+
variants: {
|
|
1617
|
+
size: {
|
|
1618
|
+
sm: "max-w-[360px]",
|
|
1619
|
+
md: "max-w-[520px]",
|
|
1620
|
+
lg: "max-w-[720px]"
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
defaultVariants: { size: "md" }
|
|
1624
|
+
},
|
|
1625
|
+
{ twMerge: false }
|
|
1626
|
+
);
|
|
1627
|
+
const titleReserveVariants = tv(
|
|
1628
|
+
{
|
|
1629
|
+
variants: {
|
|
1630
|
+
size: {
|
|
1631
|
+
sm: "pr-xxl",
|
|
1632
|
+
md: "pr-xl",
|
|
1633
|
+
lg: "pr-xl"
|
|
1634
|
+
}
|
|
1635
|
+
},
|
|
1636
|
+
defaultVariants: { size: "md" }
|
|
1637
|
+
},
|
|
1638
|
+
{ twMerge: false }
|
|
1639
|
+
);
|
|
1640
|
+
function Modal({
|
|
1641
|
+
visible,
|
|
1642
|
+
onClose,
|
|
1643
|
+
children,
|
|
1644
|
+
icon,
|
|
1645
|
+
footer,
|
|
1646
|
+
accent,
|
|
1647
|
+
size = "md",
|
|
1648
|
+
title,
|
|
1649
|
+
hideCloseButton = false,
|
|
1650
|
+
closeButtonAriaLabel = "Close",
|
|
1651
|
+
role = "dialog",
|
|
1652
|
+
"aria-describedby": ariaDescribedby,
|
|
1653
|
+
testID,
|
|
1654
|
+
"aria-label": ariaLabel
|
|
1655
|
+
}) {
|
|
1656
|
+
const { height: windowHeight } = useWindowDimensions();
|
|
1657
|
+
const titleId = useId();
|
|
1658
|
+
return /* @__PURE__ */ jsx(AccentScope, { accent, children: /* @__PURE__ */ jsx(
|
|
1659
|
+
Modal$1,
|
|
1660
|
+
{
|
|
1661
|
+
transparent: true,
|
|
1662
|
+
visible,
|
|
1663
|
+
animationType: "fade",
|
|
1664
|
+
onRequestClose: onClose,
|
|
1665
|
+
children: /* @__PURE__ */ jsxs(View, { className: "flex-1 flex-center p-l", children: [
|
|
1666
|
+
/* @__PURE__ */ jsx(
|
|
1667
|
+
Pressable,
|
|
1668
|
+
{
|
|
1669
|
+
"aria-hidden": true,
|
|
1670
|
+
focusable: false,
|
|
1671
|
+
className: "absolute inset-0 bg-translucent",
|
|
1672
|
+
onPress: onClose
|
|
1673
|
+
}
|
|
1674
|
+
),
|
|
1675
|
+
/* @__PURE__ */ jsx(
|
|
1676
|
+
View,
|
|
1677
|
+
{
|
|
1678
|
+
"aria-modal": true,
|
|
1679
|
+
role,
|
|
1680
|
+
"aria-label": title === void 0 ? ariaLabel : void 0,
|
|
1681
|
+
"aria-labelledby": title === void 0 ? void 0 : titleId,
|
|
1682
|
+
"aria-describedby": ariaDescribedby,
|
|
1683
|
+
testID,
|
|
1684
|
+
className: `relative ${panelVariants({ size })}`,
|
|
1685
|
+
children: /* @__PURE__ */ jsxs(
|
|
1686
|
+
Surface,
|
|
1687
|
+
{
|
|
1688
|
+
variant: "highlight",
|
|
1689
|
+
size,
|
|
1690
|
+
shadow: "l",
|
|
1691
|
+
className: "relative gap-m",
|
|
1692
|
+
children: [
|
|
1693
|
+
title === void 0 && icon === void 0 ? null : /* @__PURE__ */ jsxs(
|
|
1694
|
+
HStack,
|
|
1695
|
+
{
|
|
1696
|
+
className: `items-center gap-xs ${hideCloseButton ? "" : titleReserveVariants({ size })}`,
|
|
1697
|
+
children: [
|
|
1698
|
+
icon === void 0 ? null : /* @__PURE__ */ jsx(Icon, { icon, size: 24, className: "text-accent" }),
|
|
1699
|
+
title === void 0 ? null : /* @__PURE__ */ jsx(
|
|
1700
|
+
Text,
|
|
1701
|
+
{
|
|
1702
|
+
nativeID: titleId,
|
|
1703
|
+
className: "shrink font-heading-bold text-xl leading-tight text-sharp",
|
|
1704
|
+
children: title
|
|
1705
|
+
}
|
|
1706
|
+
)
|
|
1707
|
+
]
|
|
1708
|
+
}
|
|
1709
|
+
),
|
|
1710
|
+
hideCloseButton ? null : /* @__PURE__ */ jsx(
|
|
1711
|
+
IconButton,
|
|
1712
|
+
{
|
|
1713
|
+
icon: /* @__PURE__ */ jsx(XRegularIcon, {}),
|
|
1714
|
+
variant: "ghost",
|
|
1715
|
+
size: size === "lg" ? "md" : size,
|
|
1716
|
+
"aria-label": closeButtonAriaLabel,
|
|
1717
|
+
className: "absolute right-sm top-sm",
|
|
1718
|
+
onPress: onClose
|
|
1719
|
+
}
|
|
1720
|
+
),
|
|
1721
|
+
/* @__PURE__ */ jsx(ScrollView, { style: { maxHeight: windowHeight * 0.7 }, children: /* @__PURE__ */ jsx(VStack, { className: "gap-m", children }) }),
|
|
1722
|
+
footer === void 0 ? null : /* @__PURE__ */ jsx(HStack, { className: "items-center justify-end gap-m", children: footer })
|
|
1723
|
+
]
|
|
1724
|
+
}
|
|
1725
|
+
)
|
|
1726
|
+
}
|
|
1727
|
+
)
|
|
1728
|
+
] })
|
|
1729
|
+
}
|
|
1730
|
+
) });
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
function resolveVariant(props, accent) {
|
|
1734
|
+
switch (props.variant) {
|
|
1735
|
+
case "alert": {
|
|
1736
|
+
const { onClose, closeText } = props;
|
|
1737
|
+
return {
|
|
1738
|
+
onDismiss: onClose,
|
|
1739
|
+
footer: /* @__PURE__ */ jsx(Button, { accent, text: closeText ?? "OK", onPress: onClose })
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
case "required": {
|
|
1743
|
+
const { onConfirm, confirmText, confirmDisabled } = props;
|
|
1744
|
+
return {
|
|
1745
|
+
// Non-dismissible: only the explicit action closes it.
|
|
1746
|
+
onDismiss: () => void 0,
|
|
1747
|
+
footer: /* @__PURE__ */ jsx(
|
|
1748
|
+
Button,
|
|
1749
|
+
{
|
|
1750
|
+
accent,
|
|
1751
|
+
text: confirmText ?? "OK",
|
|
1752
|
+
disabled: confirmDisabled,
|
|
1753
|
+
onPress: onConfirm
|
|
1754
|
+
}
|
|
1755
|
+
)
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
case "confirm":
|
|
1759
|
+
case void 0:
|
|
1760
|
+
default: {
|
|
1761
|
+
const { onConfirm, onCancel, confirmText, cancelText, confirmDisabled } = props;
|
|
1762
|
+
return {
|
|
1763
|
+
onDismiss: onCancel,
|
|
1764
|
+
footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1765
|
+
/* @__PURE__ */ jsx(
|
|
1766
|
+
Button,
|
|
1767
|
+
{
|
|
1768
|
+
variant: "outlined",
|
|
1769
|
+
text: cancelText ?? "Cancel",
|
|
1770
|
+
onPress: onCancel
|
|
1771
|
+
}
|
|
1772
|
+
),
|
|
1773
|
+
/* @__PURE__ */ jsx(
|
|
1774
|
+
Button,
|
|
1775
|
+
{
|
|
1776
|
+
accent,
|
|
1777
|
+
text: confirmText ?? "Confirm",
|
|
1778
|
+
disabled: confirmDisabled,
|
|
1779
|
+
onPress: onConfirm
|
|
1780
|
+
}
|
|
1781
|
+
)
|
|
1782
|
+
] })
|
|
1783
|
+
};
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
function AlertDialog(props) {
|
|
1788
|
+
const {
|
|
1789
|
+
visible,
|
|
1790
|
+
title,
|
|
1791
|
+
children,
|
|
1792
|
+
accent = "danger",
|
|
1793
|
+
icon,
|
|
1794
|
+
size = "md",
|
|
1795
|
+
testID
|
|
1796
|
+
} = props;
|
|
1797
|
+
const descriptionId = useId();
|
|
1798
|
+
const { footer, onDismiss } = resolveVariant(props, accent);
|
|
1799
|
+
return /* @__PURE__ */ jsx(
|
|
1800
|
+
Modal,
|
|
1801
|
+
{
|
|
1802
|
+
hideCloseButton: true,
|
|
1803
|
+
visible,
|
|
1804
|
+
role: "alertdialog",
|
|
1805
|
+
accent,
|
|
1806
|
+
size,
|
|
1807
|
+
title,
|
|
1808
|
+
icon,
|
|
1809
|
+
"aria-describedby": children === void 0 ? void 0 : descriptionId,
|
|
1810
|
+
testID,
|
|
1811
|
+
footer,
|
|
1812
|
+
onClose: onDismiss,
|
|
1813
|
+
children: children === void 0 ? null : /* @__PURE__ */ jsx(Text, { nativeID: descriptionId, className: "text-base text-muted", children })
|
|
1814
|
+
}
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
function QuestionAlertDialog(props) {
|
|
1818
|
+
return /* @__PURE__ */ jsx(AlertDialog, { ...props, icon: /* @__PURE__ */ jsx(QuestionRegularIcon, {}) });
|
|
1819
|
+
}
|
|
1820
|
+
function WarningAlertDialog(props) {
|
|
1821
|
+
return /* @__PURE__ */ jsx(AlertDialog, { ...props, icon: /* @__PURE__ */ jsx(WarningRegularIcon, {}) });
|
|
1822
|
+
}
|
|
1823
|
+
function InfoAlertDialog(props) {
|
|
1824
|
+
return /* @__PURE__ */ jsx(AlertDialog, { ...props, icon: /* @__PURE__ */ jsx(InfoRegularIcon, {}) });
|
|
1825
|
+
}
|
|
1826
|
+
function SuccessAlertDialog(props) {
|
|
1827
|
+
return /* @__PURE__ */ jsx(AlertDialog, { ...props, icon: /* @__PURE__ */ jsx(CheckRegularIcon, {}) });
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1610
1830
|
const inputVariants = tv(
|
|
1611
1831
|
{
|
|
1612
1832
|
base: [
|
|
@@ -2311,5 +2531,5 @@ function ExternalLink({
|
|
|
2311
2531
|
);
|
|
2312
2532
|
}
|
|
2313
2533
|
|
|
2314
|
-
export { AccentScope, AlouetteDecorator, AlouetteProvider, Badge, Box, BreakpointNameEnum, Breakpoints, Button, ConfirmationMessage, ConnectionState, ExternalLink, ExternalLinkButton, FlatList, GradientBackground, GradientScrollView, HStack, Icon, IconButton, InfoMessage, InputText, InteractiveBox, InternalLinkButton, Message, Paragraph, PresenceList, PresenceOne, PressableBox, PressableListItem, SafeAreaBox, SafeAreaProvider, ScopedTheme, ScrollView, SectionList, Select, Separator, Stack, Story, StoryContainer, StoryDecorator, StoryGrid, StoryTitle, Surface, Switch, SwitchBreakpointsUsingDisplayNone, SwitchBreakpointsUsingNull, Text, TextArea, VStack, View, WarningMessage, animationDurationsMs, styled, themeVariables, useCurrentBreakpointName, useCurrentBreakpointNameFiltered, useCurrentMode, useCurrentTheme, useSafeAreaInsets, useThemeToken };
|
|
2534
|
+
export { AccentScope, AlertDialog, AlouetteDecorator, AlouetteProvider, Badge, Box, BreakpointNameEnum, Breakpoints, Button, ConfirmationMessage, ConnectionState, ExternalLink, ExternalLinkButton, FlatList, GradientBackground, GradientScrollView, HStack, Icon, IconButton, InfoAlertDialog, InfoMessage, InputText, InteractiveBox, InternalLinkButton, Message, Modal, Paragraph, PresenceList, PresenceOne, PressableBox, PressableListItem, QuestionAlertDialog, SafeAreaBox, SafeAreaProvider, ScopedTheme, ScrollView, SectionList, Select, Separator, Stack, Story, StoryContainer, StoryDecorator, StoryGrid, StoryTitle, SuccessAlertDialog, Surface, Switch, SwitchBreakpointsUsingDisplayNone, SwitchBreakpointsUsingNull, Text, TextArea, VStack, View, WarningAlertDialog, WarningMessage, animationDurationsMs, styled, themeVariables, useCurrentBreakpointName, useCurrentBreakpointNameFiltered, useCurrentMode, useCurrentTheme, useSafeAreaInsets, useThemeToken };
|
|
2315
2535
|
//# sourceMappingURL=index-browser.es.js.map
|