|
@@ -1,61 +1,12 @@
|
|
|
-import {
|
|
|
|
|
- type ReactNode
|
|
|
|
|
-} from "react";
|
|
|
|
|
-import type {
|
|
|
|
|
- NCoreUIKitConfig,
|
|
|
|
|
- LocalizeType,
|
|
|
|
|
- ThemesType
|
|
|
|
|
-} from "./types";
|
|
|
|
|
-import CoreContext from "./context";
|
|
|
|
|
-import {
|
|
|
|
|
- default as NCoreUIKitLocalizeClass
|
|
|
|
|
-} from "./context/localize";
|
|
|
|
|
-import {
|
|
|
|
|
- default as NCoreUIKitModalClass
|
|
|
|
|
-} from "./context/modal";
|
|
|
|
|
-import {
|
|
|
|
|
- default as NCoreUIKitThemeClass
|
|
|
|
|
-} from "./context/theme";
|
|
|
|
|
-
|
|
|
|
|
-class NCoreUIKitBase<T extends NCoreUIKitConfig> {
|
|
|
|
|
- NCoreUIKitContext: CoreContext<T>;
|
|
|
|
|
-
|
|
|
|
|
- constructor(initialState: T) {
|
|
|
|
|
- this.NCoreUIKitContext = new CoreContext(initialState);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Provider = ({
|
|
|
|
|
- children
|
|
|
|
|
- }: {
|
|
|
|
|
- children: ReactNode;
|
|
|
|
|
- }) => {
|
|
|
|
|
- const NCoreUIKitContext = this.NCoreUIKitContext;
|
|
|
|
|
-
|
|
|
|
|
- return <NCoreUIKitContext.Provider>
|
|
|
|
|
- {children}
|
|
|
|
|
- </NCoreUIKitContext.Provider>;
|
|
|
|
|
- };
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-let NCoreUIKit!: NCoreUIKitBase<NCoreUIKitConfig>;
|
|
|
|
|
-
|
|
|
|
|
-export let NCoreUIKitLocalize: NCoreUIKitLocalizeClass<LocalizeType>;
|
|
|
|
|
-export let NCoreUIKitTheme: NCoreUIKitThemeClass<ThemesType>;
|
|
|
|
|
-export let NCoreUIKitModal: NCoreUIKitModalClass;
|
|
|
|
|
-
|
|
|
|
|
-export const setupNCoreUIKit = (initialState: NCoreUIKitConfig, isCustom: boolean = false) => {
|
|
|
|
|
- if(isCustom) {
|
|
|
|
|
- return new NCoreUIKitBase(initialState);
|
|
|
|
|
- } else {
|
|
|
|
|
- NCoreUIKit = new NCoreUIKitBase(initialState);
|
|
|
|
|
-
|
|
|
|
|
- NCoreUIKitLocalize = NCoreUIKit.NCoreUIKitContext.NCoreUIKitLocalize;
|
|
|
|
|
- NCoreUIKitModal = NCoreUIKit.NCoreUIKitContext.NCoreUIKitModal;
|
|
|
|
|
- NCoreUIKitTheme = NCoreUIKit.NCoreUIKitContext.NCoreUIKitTheme;
|
|
|
|
|
|
|
+export {
|
|
|
|
|
+ setupNCoreUIKit
|
|
|
|
|
+} from "./core";
|
|
|
|
|
|
|
|
- return NCoreUIKit;
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
|
|
+export {
|
|
|
|
|
+ NCoreUIKitLocalize,
|
|
|
|
|
+ NCoreUIKitModal,
|
|
|
|
|
+ NCoreUIKitTheme
|
|
|
|
|
+} from "./core/hooks";
|
|
|
|
|
|
|
|
export {
|
|
export {
|
|
|
// TextInput,
|
|
// TextInput,
|