moverlay 0.0.0 → 0.0.2

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.
@@ -1,5 +1,5 @@
1
1
  import { ModalProps } from "./normal";
2
- import type { FormBuilderProps } from "@bouko/form";
2
+ import type { FormBuilderProps } from "formeact";
3
3
  import type { JsonMap } from "@bouko/ts";
4
4
  type Props<T> = Omit<ModalProps, "children"> & Omit<FormBuilderProps<T>, "cancel" | "sound" | "oops">;
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Modal } from "./normal";
3
- import { FormBuilder } from "@bouko/form";
3
+ import { FormBuilder } from "formeact";
4
4
  /**
5
5
  * Form Modal component.
6
6
  *
package/package.json CHANGED
@@ -1,86 +1,48 @@
1
1
  {
2
2
 
3
3
  "name": "moverlay",
4
-
5
- "version": "0.0.0",
6
-
4
+ "version": "0.0.2",
7
5
  "main": "./dist/index.js",
8
-
9
6
  "types": "./dist/index.d.ts",
10
-
11
7
  "license": "MIT",
12
-
13
8
  "files": [
14
-
15
9
  "dist"
16
-
17
10
  ],
18
-
19
11
  "publishConfig": {
20
-
21
12
  "access": "public"
22
-
23
13
  },
24
-
25
14
  "author": "",
26
-
27
15
  "description": "",
28
-
29
16
  "peerDependencies": {
30
-
31
17
  "next": ">=15.4.5",
32
-
33
18
  "react": ">=18.3.1"
34
-
35
19
  },
36
-
37
20
  "engines": {},
38
21
 
39
22
  "scripts": {
40
-
41
23
  "build": "tsc"
42
-
43
24
  },
44
25
 
45
26
  "dependencies": {
46
-
47
- "@bouko/form": "^0.6.1",
48
-
49
27
  "@bouko/react": "^2.4.8",
50
-
51
28
  "@bouko/style": "^0.1.6",
52
-
53
29
  "@bouko/ts": "^0.2.0",
54
-
55
30
  "clsx": "^2.1.1",
56
-
31
+ "formeact": "^0.0.2",
57
32
  "framer-motion": "^12.16.0",
58
-
59
33
  "superstruct": "^2.0.2",
60
-
61
34
  "tailwind-merge": "^3.3.0",
62
-
63
35
  "tailwind-variants": "^1.0.0",
64
-
65
36
  "zod": "^4.0.17"
66
-
67
37
  },
68
38
 
69
39
  "devDependencies": {
70
-
71
40
  "@types/react": "^19.1.10",
72
-
73
41
  "dependency-cruiser": "^17.0.1",
74
-
75
42
  "next": "^15.4.5",
76
-
77
43
  "nupabase": "^0.2.0",
78
-
79
44
  "react": "^19.1.1",
80
-
81
45
  "typescript": "^5.9.2"
82
-
83
46
  }
84
47
 
85
- }
86
-
48
+ }
@@ -1,17 +0,0 @@
1
- [
2
-
3
- [{
4
- "id": "email",
5
- "element": "input",
6
- "label": "Email Address",
7
- "placeholder": "Your email"
8
- }],
9
-
10
- [{
11
- "id": "password",
12
- "element": "input",
13
- "label": "Password",
14
- "placeholder": "Enter password"
15
- }]
16
-
17
- ]
@@ -1,6 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" width="1em" height="1em">
2
- <path
3
- d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
4
- fill="currentColor"
5
- />
6
- </svg>
@@ -1,31 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { type Props as BaseProps } from "./normal";
3
- import { type Option, type FormSection, SetState } from "@bouko/form";
4
- import { JsonMap } from "@bouko/ts";
5
- import { ZodTypeAny } from "zod";
6
- type Field<T, K = string> = {
7
- id: string;
8
- label?: string;
9
- style?: string;
10
- value?: K;
11
- update: SetState<T>;
12
- required?: boolean;
13
- disabled?: boolean;
14
- note?: ReactNode;
15
- };
16
- type FormBuilderField<T> = (Omit<Field<T>, "value" | "update"> & {
17
- element: string;
18
- rows?: number;
19
- placeholder?: string;
20
- options?: Option[];
21
- })[][];
22
- type Props<T> = BaseProps & FormSection<T> & {
23
- fields: FormBuilderField<T>;
24
- validator: ZodTypeAny;
25
- styles?: {
26
- submit?: string;
27
- };
28
- submit: (data: T, clear?: (() => void) | undefined) => Promise<void>;
29
- };
30
- export declare function FormModal<T extends JsonMap>({ fields, data, validator, update, submit, styles, clear, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
31
- export default FormModal;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import Modal from "./normal";
3
- import { FormBuilder } from "@bouko/form";
4
- export function FormModal({ fields, data, validator, update, submit, styles, clear, ...props }) {
5
- return (_jsx(Modal, { ...props, children: _jsx(FormBuilder, { styles: styles, fields: fields, validator: validator.safeParse, submit: submit }) }));
6
- }
7
- export default FormModal;
@@ -1,12 +0,0 @@
1
- import type { ReactNode } from "react";
2
- export type Props = {
3
- style?: string;
4
- title: string;
5
- subtitle?: ReactNode;
6
- redirect?: {
7
- label: string;
8
- to: string;
9
- };
10
- children?: ReactNode;
11
- };
12
- export default function ModalLayout({ style, title, subtitle, redirect, children }: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from "@bouko/style";
3
- import useModal from "../state/context";
4
- import X from "../assets/icons/x.svg";
5
- export default function ModalLayout({ style, title, subtitle, redirect, children }) {
6
- const { openModal, closeModal } = useModal();
7
- return (_jsxs("div", { className: cn(styles.container, style), role: "dialog", "aria-modal": "true", children: [_jsxs("div", { className: styles.header, children: [_jsxs("div", { className: styles.heading, children: [_jsx("span", { className: styles.title, children: title }), _jsxs("span", { className: styles.subtitle, children: [subtitle, redirect && (_jsx("button", { className: "p-0 bg-transparent border-none outline-none text-sm text-accent duration-200 hover:text-accent-light cursor-pointer font-semibold", onClick: () => openModal(redirect.to), children: redirect.label }))] })] }), _jsx(X, { className: styles.close, onClick: closeModal })] }), children] }));
8
- }
9
- const styles = {
10
- container: "relative flex flex-col gap-4 w-lg p-7 pt-6 select-none overflow-hidden",
11
- header: "relative flex flex-col gap-px mb-1 w-full",
12
- heading: "flex flex-col gap-px",
13
- title: "leading-none text-xl font-semibold",
14
- subtitle: "flex items-center gap-2 text-sm text-slate-400",
15
- close: "absolute -right-2 -top-1 text-error hover:text-error text-lg duration-200 cursor-pointer"
16
- };
@@ -1 +0,0 @@
1
- export default function RootModal(): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import useModal from "../state/context";
4
- import { AnimatePresence, motion } from "framer-motion";
5
- export default function RootModal() {
6
- const { isOpen, templateId, templates } = useModal();
7
- return (_jsx(AnimatePresence, { mode: "wait", children: isOpen && templateId && (_jsxs(motion.div, { className: styles.container, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, layout: true, children: [_jsx("div", { className: styles.backdrop }), _jsx("div", { className: styles.content, children: _jsx("div", { className: styles.subcontainer, children: templates[templateId] }) })] }, templateId)) }));
8
- }
9
- const styles = {
10
- container: "fixed inset-0 flex justify-center items-center z-[99]",
11
- backdrop: "absolute inset-0 bg-background-dark/60",
12
- content: "absolute top-0 left-0 w-[100dvw] h-[100dvh] flex justify-center items-center 2xl:scale-125 select-none",
13
- subcontainer: "relative flex max-w-[80%] max-h-[85%] bg-background border border-border rounded-lg shadow-soft overflow-hidden"
14
- };
@@ -1,5 +0,0 @@
1
- import { type ReactElement, type ReactNode } from "react";
2
- export default function ModalManager({ config, children }: {
3
- config: Record<string, ReactElement>;
4
- children: ReactNode;
5
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,30 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { Context } from "./context";
5
- import { parseData } from "@bouko/react";
6
- export default function ModalManager({ config, children }) {
7
- const [isOpen, setOpen] = useState(false);
8
- const [templateId, setTemplate] = useState();
9
- const [params, setParams] = useState({});
10
- const openModal = async (template, params) => {
11
- setTemplate(template);
12
- setParams(params ?? {});
13
- setOpen(true);
14
- };
15
- const getParams = () => parseData(params ?? {});
16
- const closeModal = () => {
17
- setOpen(false);
18
- setTemplate(undefined);
19
- setParams({});
20
- };
21
- return (_jsx(Context.Provider, { value: {
22
- templates: config,
23
- templateId,
24
- isOpen,
25
- params,
26
- getParams,
27
- openModal,
28
- closeModal
29
- }, children: children }));
30
- }