@ya-accelerators/nextjs-framework 0.0.41 → 0.0.43
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/hooks/loading/index.jsx +1 -1
- package/dist/hooks/loading/index.jsx.map +1 -1
- package/dist/hooks/modal/index.d.ts +2 -16
- package/dist/hooks/modal/index.jsx +9 -40
- package/dist/hooks/modal/index.jsx.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/component/index.d.ts +7 -3
- package/dist/ui/component/index.js +2 -0
- package/dist/ui/component/index.js.map +1 -1
- package/dist/ui/component/loading/index.d.ts +1 -3
- package/dist/ui/component/loading/index.jsx +1 -7
- package/dist/ui/component/loading/index.jsx.map +1 -1
- package/dist/ui/component/modal/index.d.ts +7 -0
- package/dist/ui/component/modal/index.jsx +12 -0
- package/dist/ui/component/modal/index.jsx.map +1 -0
- package/dist/ui/composite/index.d.ts +6 -6
- package/dist/ui/functional/index.d.ts +2 -2
- package/dist/ui/functional/signInForm/index.d.ts +2 -2
- package/dist/ui/functional/signInForm/index.jsx +1 -1
- package/dist/ui/functional/signInForm/index.jsx.map +1 -1
- package/dist/ui/layout/index.d.ts +19 -14
- package/dist/ui/layout/index.js +2 -0
- package/dist/ui/layout/index.js.map +1 -1
- package/dist/ui/layout/loading/index.d.ts +3 -0
- package/dist/ui/layout/loading/index.jsx +9 -0
- package/dist/ui/layout/loading/index.jsx.map +1 -0
- package/dist/ui/layout/modal/index.d.ts +20 -7
- package/dist/ui/layout/modal/index.jsx +35 -7
- package/dist/ui/layout/modal/index.jsx.map +1 -1
- package/dist/ui/layout/table/index.jsx +4 -0
- package/dist/ui/layout/table/index.jsx.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { usePathname } from 'next/navigation';
|
|
3
3
|
import { createContext, useContext, useState } from 'react';
|
|
4
|
-
import { LoadingOverlay } from '../../ui/
|
|
4
|
+
import { LoadingOverlay } from '../../ui/layout/loading';
|
|
5
5
|
const LoadingContext = createContext({ showLoading: () => { }, dismissLoading: () => { } });
|
|
6
6
|
export const useLoadingContext = () => useContext(LoadingContext);
|
|
7
7
|
export const LoadingProvider = ({ children }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../../src/hooks/loading/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../../src/hooks/loading/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAMxD,MAAM,cAAc,GAAG,aAAa,CAAkB,EAAE,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAA;AAE1G,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAEjE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IACvE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC7C,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IAC1C,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC9C,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC1D,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC9B,UAAU,CAAC,KAAK,CAAC,CAAA;QACjB,eAAe,CAAC,QAAQ,CAAC,CAAA;IAC3B,CAAC;IACD,OAAO,CACL,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAC9D;MAAA,CAAC,QAAQ,CACT;MAAA,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,AAAD,EAAG,CAChC;IAAA,EAAE,cAAc,CAAC,QAAQ,CAAC,CAC3B,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export interface ModalProps {
|
|
5
|
-
rounded?: Rounded;
|
|
6
|
-
title?: string;
|
|
7
|
-
message?: string;
|
|
8
|
-
content?: ReactNode;
|
|
9
|
-
actions?: {
|
|
10
|
-
default?: boolean;
|
|
11
|
-
label: string;
|
|
12
|
-
color?: ColorTypes;
|
|
13
|
-
onClick?: () => void;
|
|
14
|
-
}[];
|
|
15
|
-
showCloseButton?: boolean;
|
|
16
|
-
dismissOnBarrierClick?: boolean;
|
|
17
|
-
}
|
|
2
|
+
import { ModalOverlay } from '../../ui/layout/modal';
|
|
3
|
+
export type ModalProps = Omit<Parameters<typeof ModalOverlay>[0]['items'][number], 'id'>;
|
|
18
4
|
interface IModalContext {
|
|
19
5
|
showModal: (props: ModalProps) => void;
|
|
20
6
|
dismissModal: (id?: string) => void;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { motion } from 'framer-motion';
|
|
4
2
|
import { usePathname } from 'next/navigation';
|
|
5
3
|
import { createContext, startTransition, useCallback, useContext, useEffect, useState } from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import { Typography } from '../../ui/component/typography';
|
|
8
|
-
import { Modal } from '../../ui/layout/modal';
|
|
9
|
-
import { BackgroundColorTypes, ColorTypes, ControlSize, getBackgroundColorTypeClassName, TextColorTypes, } from '../../ui/theme';
|
|
4
|
+
import { ModalOverlay } from '../../ui/layout/modal';
|
|
10
5
|
import { Util } from '../../util';
|
|
11
6
|
const ModalContext = createContext({
|
|
12
7
|
showModal: () => { },
|
|
@@ -14,51 +9,25 @@ const ModalContext = createContext({
|
|
|
14
9
|
});
|
|
15
10
|
export const useModalContext = () => useContext(ModalContext);
|
|
16
11
|
export const ModalProvider = ({ children }) => {
|
|
17
|
-
const [
|
|
18
|
-
const showModal = (props) =>
|
|
12
|
+
const [items, setItems] = useState([]);
|
|
13
|
+
const showModal = (props) => setItems((e) => [...e, { ...props, id: new Date().getTime().toString() }]);
|
|
19
14
|
const dismissModal = useCallback((id) => {
|
|
20
|
-
if (id === undefined || !Util.isString(id) || !
|
|
21
|
-
|
|
15
|
+
if (id === undefined || !Util.isString(id) || !items.some((x) => x.id !== id)) {
|
|
16
|
+
setItems([]);
|
|
22
17
|
}
|
|
23
18
|
else {
|
|
24
|
-
|
|
19
|
+
setItems((e) => e.filter((x) => x.id !== id));
|
|
25
20
|
}
|
|
26
|
-
}, [
|
|
21
|
+
}, [items]);
|
|
27
22
|
const pathname = usePathname();
|
|
28
23
|
useEffect(() => {
|
|
29
24
|
startTransition(() => {
|
|
30
|
-
|
|
25
|
+
setItems([]);
|
|
31
26
|
});
|
|
32
27
|
}, [pathname]);
|
|
33
28
|
return (<ModalContext.Provider value={{ showModal, dismissModal }}>
|
|
34
29
|
{children}
|
|
35
|
-
|
|
36
|
-
if (e.target === e.currentTarget) {
|
|
37
|
-
const latestModal = props[props.length - 1];
|
|
38
|
-
if (latestModal?.dismissOnBarrierClick !== false) {
|
|
39
|
-
dismissModal();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}}>
|
|
43
|
-
{props.map((x, i) => (<Modal key={x.id} id={x.id} rounded={x.rounded} showCloseButton={x.actions === undefined || x.showCloseButton !== false} onClickClose={dismissModal} className={i !== props.length - 1 ? 'hidden' : undefined}>
|
|
44
|
-
{x.title && (<Typography.H4 container={true} className='font-bold'>
|
|
45
|
-
{x.title}
|
|
46
|
-
</Typography.H4>)}
|
|
47
|
-
{x.message && (<Typography.Pre color={TextColorTypes.sub} container={true}>
|
|
48
|
-
{x.message}
|
|
49
|
-
</Typography.Pre>)}
|
|
50
|
-
{x.content}
|
|
51
|
-
{x.actions && (<form className='mt-control-padding-base gap-control-padding-md flex' onSubmit={(e) => {
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
dismissModal(x.id);
|
|
54
|
-
}}>
|
|
55
|
-
{x.actions?.map((action, i) => (<Colored type={action.default != false ? 'submit' : 'button'} autoFocus={action.default != false} key={i} rounded={x.rounded} size={ControlSize.base} label={action.label} color={action.color ?? ColorTypes.primary} className='w-full' onClick={() => {
|
|
56
|
-
dismissModal(x.id);
|
|
57
|
-
action.onClick?.();
|
|
58
|
-
}}/>))}
|
|
59
|
-
</form>)}
|
|
60
|
-
</Modal>))}
|
|
61
|
-
</motion.div>)}
|
|
30
|
+
<ModalOverlay items={items} onDismiss={dismissModal}/>
|
|
62
31
|
</ModalContext.Provider>);
|
|
63
32
|
};
|
|
64
33
|
//# sourceMappingURL=index.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../../src/hooks/modal/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../../../src/hooks/modal/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,WA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