@korsolutions/ui 0.0.25 → 0.0.26
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/components/index.d.mts +3 -2
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/{index-DLFYQx-P.d.mts → index-j_OCsdsx.d.mts} +22 -8
- package/dist/index.d.mts +4 -12
- package/dist/index.mjs +2 -2
- package/dist/portal.constants-ClRV24_C.d.mts +16 -0
- package/dist/primitives/index.d.mts +3 -2
- package/dist/primitives/index.mjs +2 -2
- package/dist/{primitives-1609Y7eP.mjs → primitives-CB1VBoeH.mjs} +30 -6
- package/dist/{toast-manager-BCt2uAJl.mjs → toast-manager-Bn8NB8Ie.mjs} +9 -6
- package/package.json +1 -1
- package/src/components/toast/toast-manager.tsx +8 -5
- package/src/primitives/index.ts +1 -0
- package/src/primitives/portal/index.ts +1 -0
- package/src/primitives/portal/portal.tsx +32 -26
- package/src/primitives/portal/portal.web.tsx +0 -21
- /package/dist/{use-numeric-mask-B9WZG25o.d.mts → use-numeric-mask-D4zqPOnE.d.mts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as EmptyStyles, C as PopoverTriggerRef, Ct as ButtonStyles, D as DropdownMenuStyles, Et as InputPrimitiveBaseProps, I as TextareaStyles, J as AvatarStyles, Ot as InputStyles, P as TextareaPrimitiveBaseProps, U as ToastStyles, a as CalendarStyles, at as CardStyles, ft as SelectRootBaseProps, jt as FieldStyles, mt as SelectStyles, r as CalendarRootProps, xt as ButtonPrimitiveRootProps, y as PopoverStyles, z as BadgeStyles } from "../index-j_OCsdsx.mjs";
|
|
2
2
|
import "../use-relative-position-DBzhrBU7.mjs";
|
|
3
|
-
import
|
|
3
|
+
import "../portal.constants-ClRV24_C.mjs";
|
|
4
|
+
import { t as NumericMaskFormat } from "../use-numeric-mask-D4zqPOnE.mjs";
|
|
4
5
|
import React from "react";
|
|
5
6
|
import { ImageSource, PressableProps, TextProps, TextStyle } from "react-native";
|
|
6
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as useThemedStyles, r as ToastComponent, t as ToastAPI } from "../toast-manager-
|
|
2
|
-
import { a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-
|
|
1
|
+
import { i as useThemedStyles, r as ToastComponent, t as ToastAPI } from "../toast-manager-Bn8NB8Ie.mjs";
|
|
2
|
+
import { a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-CB1VBoeH.mjs";
|
|
3
3
|
import "../use-relative-position-BTKEyT1F.mjs";
|
|
4
4
|
import { t as useNumericMask } from "../use-numeric-mask-BQlz1Pus.mjs";
|
|
5
5
|
import React, { forwardRef, useEffect, useState } from "react";
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as useRelativePosition, n as DEFAULT_POSITION, r as LayoutPosition, t as DEFAULT_LAYOUT } from "../use-relative-position-DBzhrBU7.mjs";
|
|
2
|
-
import { i as useNumericMask, n as UseNumericMaskOptions, r as UseNumericMaskReturn, t as NumericMaskFormat } from "../use-numeric-mask-
|
|
2
|
+
import { i as useNumericMask, n as UseNumericMaskOptions, r as UseNumericMaskReturn, t as NumericMaskFormat } from "../use-numeric-mask-D4zqPOnE.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/hooks/use-screen-size.d.ts
|
|
5
5
|
type ScreenSize = "mobile" | "tablet" | "desktop";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { r as LayoutPosition } from "./use-relative-position-DBzhrBU7.mjs";
|
|
2
|
-
import
|
|
2
|
+
import { n as PortalHostProps, r as PortalProps } from "./portal.constants-ClRV24_C.mjs";
|
|
3
|
+
import * as react9 from "react";
|
|
3
4
|
import React$1, { Dispatch, RefAttributes } from "react";
|
|
4
5
|
import { ImageSource, ImageStyle, LayoutRectangle, PressableProps, StyleProp, TextInput, TextInputProps, TextProps, TextStyle, View, ViewProps, ViewStyle } from "react-native";
|
|
5
6
|
|
|
@@ -67,7 +68,7 @@ interface InputPrimitiveProps extends InputPrimitiveBaseProps {
|
|
|
67
68
|
render?: (props: InputPrimitiveProps) => React.ReactNode;
|
|
68
69
|
styles?: InputStyles;
|
|
69
70
|
}
|
|
70
|
-
declare const InputPrimitive:
|
|
71
|
+
declare const InputPrimitive: react9.ForwardRefExoticComponent<Omit<InputPrimitiveProps, "ref"> & react9.RefAttributes<TextInput>>;
|
|
71
72
|
//#endregion
|
|
72
73
|
//#region src/primitives/button/button-label.d.ts
|
|
73
74
|
interface ButtonPrimitiveLabelProps {
|
|
@@ -153,7 +154,7 @@ interface SelectOptionProps {
|
|
|
153
154
|
render?: (props: SelectOptionProps) => React.ReactElement;
|
|
154
155
|
style?: StyleProp<TextStyle>;
|
|
155
156
|
}
|
|
156
|
-
declare function SelectOption(props: SelectOptionProps):
|
|
157
|
+
declare function SelectOption(props: SelectOptionProps): react9.JSX.Element;
|
|
157
158
|
//#endregion
|
|
158
159
|
//#region src/primitives/select/types.d.ts
|
|
159
160
|
type SelectState = "default" | "disabled";
|
|
@@ -434,7 +435,7 @@ interface TextareaPrimitiveProps extends TextareaPrimitiveBaseProps {
|
|
|
434
435
|
render?: (props: TextareaPrimitiveProps) => React.ReactNode;
|
|
435
436
|
styles?: TextareaStyles;
|
|
436
437
|
}
|
|
437
|
-
declare function TextareaPrimitive(props: TextareaPrimitiveProps):
|
|
438
|
+
declare function TextareaPrimitive(props: TextareaPrimitiveProps): react9.JSX.Element;
|
|
438
439
|
//#endregion
|
|
439
440
|
//#region src/primitives/dropdown-menu/dropdown-menu-trigger.d.ts
|
|
440
441
|
interface DropdownMenuTriggerProps extends PressableProps {
|
|
@@ -505,7 +506,7 @@ declare function DropdownMenuPortal(props: DropdownMenuPortalProps): React$1.JSX
|
|
|
505
506
|
//#region src/primitives/dropdown-menu/index.d.ts
|
|
506
507
|
declare const DropdownMenuPrimitive: {
|
|
507
508
|
Root: typeof DropdownMenuRoot;
|
|
508
|
-
Trigger:
|
|
509
|
+
Trigger: react9.ForwardRefExoticComponent<DropdownMenuTriggerProps & react9.RefAttributes<DropdownMenuTriggerRef>>;
|
|
509
510
|
Portal: typeof DropdownMenuPortal;
|
|
510
511
|
Overlay: typeof DropdownMenuOverlay;
|
|
511
512
|
Content: typeof DropdownMenuContent;
|
|
@@ -579,19 +580,32 @@ interface PopoverContext {
|
|
|
579
580
|
setTriggerPosition: Dispatch<React.SetStateAction<LayoutPosition>>;
|
|
580
581
|
styles?: PopoverStyles;
|
|
581
582
|
}
|
|
582
|
-
declare const PopoverContext:
|
|
583
|
+
declare const PopoverContext: react9.Context<PopoverContext | undefined>;
|
|
583
584
|
declare const usePopover: () => PopoverContext;
|
|
584
585
|
//#endregion
|
|
585
586
|
//#region src/primitives/popover/index.d.ts
|
|
586
587
|
declare const PopoverPrimitive: {
|
|
587
588
|
Root: typeof PopoverRoot;
|
|
588
|
-
Trigger:
|
|
589
|
+
Trigger: react9.ForwardRefExoticComponent<PopoverTriggerProps & react9.RefAttributes<PopoverTriggerRef>>;
|
|
589
590
|
Portal: typeof PopoverPortal;
|
|
590
591
|
Overlay: typeof PopoverOverlay;
|
|
591
592
|
Content: typeof PopoverContent;
|
|
592
593
|
Close: typeof PopoverClose;
|
|
593
594
|
};
|
|
594
595
|
//#endregion
|
|
596
|
+
//#region src/primitives/portal/portal.d.ts
|
|
597
|
+
declare function NativePortalHost({
|
|
598
|
+
name,
|
|
599
|
+
container
|
|
600
|
+
}: PortalHostProps): react9.JSX.Element | null;
|
|
601
|
+
declare const PortalHost: typeof NativePortalHost;
|
|
602
|
+
declare function NativePortal({
|
|
603
|
+
name,
|
|
604
|
+
hostName,
|
|
605
|
+
children
|
|
606
|
+
}: PortalProps): react9.JSX.Element;
|
|
607
|
+
declare const Portal: typeof NativePortal;
|
|
608
|
+
//#endregion
|
|
595
609
|
//#region src/primitives/calendar/calendar-weeks.d.ts
|
|
596
610
|
interface CalendarWeekProps extends ViewProps {
|
|
597
611
|
index: number;
|
|
@@ -687,4 +701,4 @@ declare const CalendarPrimitive: {
|
|
|
687
701
|
Day: typeof CalendarDay;
|
|
688
702
|
};
|
|
689
703
|
//#endregion
|
|
690
|
-
export {
|
|
704
|
+
export { EmptyStyles as $, DropdownMenuButtonProps as A, FieldPrimitiveRootProps as At, BadgeLabelProps as B, PopoverTriggerRef as C, ButtonStyles as Ct, DropdownMenuStyles as D, InputPrimitiveProps as Dt, DropdownMenuRootProps as E, InputPrimitiveBaseProps as Et, TextareaPrimitiveProps as F, ToastTitleProps as G, ToastRootProps as H, TextareaStyles as I, AvatarStyles as J, AvatarPrimitive as K, BadgePrimitive as L, DropdownMenuTriggerProps as M, FieldErrorProps as Mt, TextareaPrimitive as N, FieldDescriptionProps as Nt, DropdownMenuOverlayProps as O, InputStyles as Ot, TextareaPrimitiveBaseProps as P, FieldLabelProps as Pt, EmptyRootProps as Q, BadgeRootProps as R, PopoverTriggerProps as S, ButtonState as St, DropdownMenuPortalProps as T, InputPrimitive as Tt, ToastStyles as U, ToastPrimitive as V, ToastDescriptionProps as W, AvatarFallbackProps as X, AvatarImageProps as Y, EmptyPrimitive as Z, PopoverPortalProps as _, SelectOverlayProps as _t, CalendarStyles as a, CardStyles as at, PopoverOverlayProps as b, ButtonPrimitive as bt, CalendarDayProps as c, CardTitleProps as ct, Portal as d, SelectPortalProps as dt, EmptyTitleProps as et, PortalHost as f, SelectRootBaseProps as ft, PopoverCloseProps as g, SelectContentProps as gt, usePopover as h, SelectOptionProps as ht, CalendarDayState as i, CardRootProps as it, DropdownMenuContentProps as j, FieldStyles as jt, DropdownMenuDividerProps as k, FieldPrimitive as kt, CalendarWeekLabelsProps as l, CardHeaderProps as lt, PopoverContext as m, SelectStyles as mt, CalendarNavButtonProps as n, EmptyDescriptionProps as nt, CalendarTitleProps as o, CardFooterProps as ot, PopoverPrimitive as p, SelectRootProps as pt, AvatarRootProps as q, CalendarRootProps as r, CardPrimitive as rt, CalendarHeaderProps as s, CardBodyProps as st, CalendarPrimitive as t, EmptyMediaProps as tt, CalendarWeeksProps as u, SelectPrimitive as ut, PopoverRootProps as v, SelectValueProps as vt, DropdownMenuPrimitive as w, ButtonPrimitiveLabelProps as wt, PopoverContentProps as x, ButtonPrimitiveRootProps as xt, PopoverStyles as y, SelectTriggerProps as yt, BadgeStyles as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { n as PortalHostProps } from "./portal.constants-ClRV24_C.mjs";
|
|
2
|
+
import * as react4 from "react";
|
|
2
3
|
|
|
3
|
-
//#region src/primitives/portal/portal.constants.d.ts
|
|
4
|
-
interface PortalHostProps {
|
|
5
|
-
name?: string;
|
|
6
|
-
container?: {
|
|
7
|
-
ios?: React.ComponentType<React.PropsWithChildren>;
|
|
8
|
-
android?: React.ComponentType<React.PropsWithChildren>;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
4
|
//#region src/themes/types.d.ts
|
|
13
5
|
type ThemeName = "default";
|
|
14
6
|
type ColorScheme = "light" | "dark";
|
|
@@ -46,7 +38,7 @@ interface ThemeContext {
|
|
|
46
38
|
setTheme: (themeName: ThemeName) => void;
|
|
47
39
|
themeName: ThemeName;
|
|
48
40
|
}
|
|
49
|
-
declare const ThemeContext:
|
|
41
|
+
declare const ThemeContext: react4.Context<ThemeContext | null>;
|
|
50
42
|
declare const useTheme: () => ThemeContext;
|
|
51
43
|
//#endregion
|
|
52
44
|
//#region src/index.d.ts
|
|
@@ -57,6 +49,6 @@ interface ProviderProps {
|
|
|
57
49
|
declare const UniversalUIProvider: ({
|
|
58
50
|
children,
|
|
59
51
|
portalContainer
|
|
60
|
-
}: ProviderProps) =>
|
|
52
|
+
}: ProviderProps) => react4.JSX.Element;
|
|
61
53
|
//#endregion
|
|
62
54
|
export { ProviderProps, UniversalUIProvider, useTheme };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ThemeProvider, n as ToastContainer, o as useTheme } from "./toast-manager-
|
|
2
|
-
import { g as PortalHost } from "./primitives-
|
|
1
|
+
import { a as ThemeProvider, n as ToastContainer, o as useTheme } from "./toast-manager-Bn8NB8Ie.mjs";
|
|
2
|
+
import { g as PortalHost } from "./primitives-CB1VBoeH.mjs";
|
|
3
3
|
import "./use-relative-position-BTKEyT1F.mjs";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/primitives/portal/portal.constants.d.ts
|
|
2
|
+
declare const DEFAULT_PORTAL_HOST = "__KOR_PORTAL_HOST__";
|
|
3
|
+
interface PortalHostProps {
|
|
4
|
+
name?: string;
|
|
5
|
+
container?: {
|
|
6
|
+
ios?: React.ComponentType<React.PropsWithChildren>;
|
|
7
|
+
android?: React.ComponentType<React.PropsWithChildren>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface PortalProps {
|
|
11
|
+
name: string;
|
|
12
|
+
hostName?: string;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { PortalHostProps as n, PortalProps as r, DEFAULT_PORTAL_HOST as t };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as EmptyStyles, A as DropdownMenuButtonProps, At as FieldPrimitiveRootProps, B as BadgeLabelProps, C as PopoverTriggerRef, Ct as ButtonStyles, D as DropdownMenuStyles, Dt as InputPrimitiveProps, E as DropdownMenuRootProps, Et as InputPrimitiveBaseProps, F as TextareaPrimitiveProps, G as ToastTitleProps, H as ToastRootProps, I as TextareaStyles, J as AvatarStyles, K as AvatarPrimitive, L as BadgePrimitive, M as DropdownMenuTriggerProps, Mt as FieldErrorProps, N as TextareaPrimitive, Nt as FieldDescriptionProps, O as DropdownMenuOverlayProps, Ot as InputStyles, P as TextareaPrimitiveBaseProps, Pt as FieldLabelProps, Q as EmptyRootProps, R as BadgeRootProps, S as PopoverTriggerProps, St as ButtonState, T as DropdownMenuPortalProps, Tt as InputPrimitive, U as ToastStyles, V as ToastPrimitive, W as ToastDescriptionProps, X as AvatarFallbackProps, Y as AvatarImageProps, Z as EmptyPrimitive, _ as PopoverPortalProps, _t as SelectOverlayProps, a as CalendarStyles, at as CardStyles, b as PopoverOverlayProps, bt as ButtonPrimitive, c as CalendarDayProps, ct as CardTitleProps, d as Portal, dt as SelectPortalProps, et as EmptyTitleProps, f as PortalHost, ft as SelectRootBaseProps, g as PopoverCloseProps, gt as SelectContentProps, h as usePopover, ht as SelectOptionProps, i as CalendarDayState, it as CardRootProps, j as DropdownMenuContentProps, jt as FieldStyles, k as DropdownMenuDividerProps, kt as FieldPrimitive, l as CalendarWeekLabelsProps, lt as CardHeaderProps, m as PopoverContext, mt as SelectStyles, n as CalendarNavButtonProps, nt as EmptyDescriptionProps, o as CalendarTitleProps, ot as CardFooterProps, p as PopoverPrimitive, pt as SelectRootProps, q as AvatarRootProps, r as CalendarRootProps, rt as CardPrimitive, s as CalendarHeaderProps, st as CardBodyProps, t as CalendarPrimitive, tt as EmptyMediaProps, u as CalendarWeeksProps, ut as SelectPrimitive, v as PopoverRootProps, vt as SelectValueProps, w as DropdownMenuPrimitive, wt as ButtonPrimitiveLabelProps, x as PopoverContentProps, xt as ButtonPrimitiveRootProps, yt as SelectTriggerProps, z as BadgeStyles } from "../index-j_OCsdsx.mjs";
|
|
2
2
|
import "../use-relative-position-DBzhrBU7.mjs";
|
|
3
|
-
|
|
3
|
+
import { n as PortalHostProps, r as PortalProps, t as DEFAULT_PORTAL_HOST } from "../portal.constants-ClRV24_C.mjs";
|
|
4
|
+
export { AvatarFallbackProps, AvatarImageProps, AvatarPrimitive, AvatarRootProps, AvatarStyles, BadgeLabelProps, BadgePrimitive, BadgeRootProps, BadgeStyles, ButtonPrimitive, ButtonPrimitiveLabelProps, ButtonPrimitiveRootProps, ButtonState, ButtonStyles, CalendarDayProps, CalendarDayState, CalendarHeaderProps, CalendarNavButtonProps, CalendarPrimitive, CalendarRootProps, CalendarStyles, CalendarTitleProps, CalendarWeekLabelsProps, CalendarWeeksProps, CardBodyProps, CardFooterProps, CardHeaderProps, CardPrimitive, CardRootProps, CardStyles, CardTitleProps, DEFAULT_PORTAL_HOST, DropdownMenuButtonProps, DropdownMenuContentProps, DropdownMenuDividerProps, DropdownMenuOverlayProps, DropdownMenuPortalProps, DropdownMenuPrimitive, DropdownMenuRootProps, DropdownMenuStyles, DropdownMenuTriggerProps, EmptyDescriptionProps, EmptyMediaProps, EmptyPrimitive, EmptyRootProps, EmptyStyles, EmptyTitleProps, FieldDescriptionProps, FieldErrorProps, FieldLabelProps, FieldPrimitive, FieldPrimitiveRootProps, FieldStyles, InputPrimitive, InputPrimitiveBaseProps, InputPrimitiveProps, InputStyles, PopoverCloseProps, PopoverContentProps, PopoverContext, PopoverOverlayProps, PopoverPortalProps, PopoverPrimitive, PopoverRootProps, PopoverTriggerProps, PopoverTriggerRef, Portal, PortalHost, PortalHostProps, PortalProps, SelectContentProps, SelectOptionProps, SelectOverlayProps, SelectPortalProps, SelectPrimitive, SelectRootBaseProps, SelectRootProps, SelectStyles, SelectTriggerProps, SelectValueProps, TextareaPrimitive, TextareaPrimitiveBaseProps, TextareaPrimitiveProps, TextareaStyles, ToastDescriptionProps, ToastPrimitive, ToastRootProps, ToastStyles, ToastTitleProps, usePopover };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, s as ToastPrimitive, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-
|
|
1
|
+
import { _ as DEFAULT_PORTAL_HOST, a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, g as PortalHost, h as Portal, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, s as ToastPrimitive, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-CB1VBoeH.mjs";
|
|
2
2
|
import "../use-relative-position-BTKEyT1F.mjs";
|
|
3
3
|
|
|
4
|
-
export { AvatarPrimitive, BadgePrimitive, ButtonPrimitive, CalendarPrimitive, CardPrimitive, DropdownMenuPrimitive, EmptyPrimitive, FieldPrimitive, InputPrimitive, PopoverPrimitive, SelectPrimitive, TextareaPrimitive, ToastPrimitive, usePopover };
|
|
4
|
+
export { AvatarPrimitive, BadgePrimitive, ButtonPrimitive, CalendarPrimitive, CardPrimitive, DEFAULT_PORTAL_HOST, DropdownMenuPrimitive, EmptyPrimitive, FieldPrimitive, InputPrimitive, PopoverPrimitive, Portal, PortalHost, SelectPrimitive, TextareaPrimitive, ToastPrimitive, usePopover };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { n as DEFAULT_POSITION, r as useRelativePosition, t as DEFAULT_LAYOUT } from "./use-relative-position-BTKEyT1F.mjs";
|
|
2
|
-
import React, { createContext, forwardRef,
|
|
2
|
+
import React, { createContext, forwardRef, useContext, useEffect, useId, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { ActivityIndicator, Image, Platform, Pressable, StyleSheet, Text, TextInput, View } from "react-native";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
5
6
|
|
|
6
7
|
//#region src/primitives/portal/portal.constants.tsx
|
|
7
8
|
const DEFAULT_PORTAL_HOST = "__KOR_PORTAL_HOST__";
|
|
@@ -40,7 +41,7 @@ function removePortal(hostName, name) {
|
|
|
40
41
|
store.map = next;
|
|
41
42
|
emit();
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function NativePortalHost({ name = DEFAULT_PORTAL_HOST, container }) {
|
|
44
45
|
const portalMap = useSyncExternalStore(subscribe, getSnapshot, getSnapshot).get(name) ?? /* @__PURE__ */ new Map();
|
|
45
46
|
if (portalMap.size === 0) return null;
|
|
46
47
|
return /* @__PURE__ */ jsx(Platform.select({
|
|
@@ -61,7 +62,14 @@ function PortalHost({ name = DEFAULT_PORTAL_HOST, container }) {
|
|
|
61
62
|
android: container?.android
|
|
62
63
|
}), { children: Array.from(portalMap.values()) });
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function WebPortalHost() {
|
|
66
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
67
|
+
}
|
|
68
|
+
const PortalHost = Platform.select({
|
|
69
|
+
default: NativePortalHost,
|
|
70
|
+
web: WebPortalHost
|
|
71
|
+
});
|
|
72
|
+
function NativePortal({ name, hostName = DEFAULT_PORTAL_HOST, children }) {
|
|
65
73
|
useEffect(() => {
|
|
66
74
|
updatePortal(hostName, name, children);
|
|
67
75
|
}, [
|
|
@@ -74,8 +82,24 @@ function Portal({ name, hostName = DEFAULT_PORTAL_HOST, children }) {
|
|
|
74
82
|
removePortal(hostName, name);
|
|
75
83
|
};
|
|
76
84
|
}, [hostName, name]);
|
|
77
|
-
return
|
|
85
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
78
86
|
}
|
|
87
|
+
function WebPortal({ name, hostName = DEFAULT_PORTAL_HOST, children }) {
|
|
88
|
+
const [container] = useState(() => {
|
|
89
|
+
let container$1 = document.getElementById(hostName);
|
|
90
|
+
if (!container$1) {
|
|
91
|
+
container$1 = document.createElement("div");
|
|
92
|
+
container$1.id = hostName;
|
|
93
|
+
document.body.appendChild(container$1);
|
|
94
|
+
}
|
|
95
|
+
return container$1;
|
|
96
|
+
});
|
|
97
|
+
return /* @__PURE__ */ jsx(Fragment, { children: createPortal(children, container, name) });
|
|
98
|
+
}
|
|
99
|
+
const Portal = Platform.select({
|
|
100
|
+
default: NativePortal,
|
|
101
|
+
web: WebPortal
|
|
102
|
+
});
|
|
79
103
|
|
|
80
104
|
//#endregion
|
|
81
105
|
//#region src/primitives/field/context.ts
|
|
@@ -1410,4 +1434,4 @@ const CalendarPrimitive = {
|
|
|
1410
1434
|
};
|
|
1411
1435
|
|
|
1412
1436
|
//#endregion
|
|
1413
|
-
export { TextareaPrimitive as a, AvatarPrimitive as c, SelectPrimitive as d, ButtonPrimitive as f, PortalHost as g, Portal as h, DropdownMenuPrimitive as i, EmptyPrimitive as l, FieldPrimitive as m, PopoverPrimitive as n, BadgePrimitive as o, InputPrimitive as p, usePopover as r, ToastPrimitive as s, CalendarPrimitive as t, CardPrimitive as u };
|
|
1437
|
+
export { DEFAULT_PORTAL_HOST as _, TextareaPrimitive as a, AvatarPrimitive as c, SelectPrimitive as d, ButtonPrimitive as f, PortalHost as g, Portal as h, DropdownMenuPrimitive as i, EmptyPrimitive as l, FieldPrimitive as m, PopoverPrimitive as n, BadgePrimitive as o, InputPrimitive as p, usePopover as r, ToastPrimitive as s, CalendarPrimitive as t, CardPrimitive as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as Portal, s as ToastPrimitive } from "./primitives-
|
|
1
|
+
import { h as Portal, s as ToastPrimitive } from "./primitives-CB1VBoeH.mjs";
|
|
2
2
|
import React, { createContext, useContext, useEffect, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { StyleSheet, View, useColorScheme } from "react-native";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -251,19 +251,22 @@ function ToastContainer() {
|
|
|
251
251
|
if (!toasts.length) return null;
|
|
252
252
|
return /* @__PURE__ */ jsx(Portal, {
|
|
253
253
|
name: TOAST_PORTAL_NAME,
|
|
254
|
-
children:
|
|
254
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
255
255
|
style: s.wrapper,
|
|
256
|
-
children: /* @__PURE__ */ jsx(ToastComponent, {
|
|
256
|
+
children: toasts.map((toast) => /* @__PURE__ */ jsx(ToastComponent, {
|
|
257
257
|
title: toast.title,
|
|
258
258
|
description: toast.description,
|
|
259
259
|
variant: toast.variant
|
|
260
|
-
})
|
|
261
|
-
}
|
|
260
|
+
}, toast.id))
|
|
261
|
+
})
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
264
|
const s = StyleSheet.create({ wrapper: {
|
|
265
265
|
width: "100%",
|
|
266
|
-
alignItems: "center"
|
|
266
|
+
alignItems: "center",
|
|
267
|
+
position: "absolute",
|
|
268
|
+
top: 24,
|
|
269
|
+
gap: 8
|
|
267
270
|
} });
|
|
268
271
|
|
|
269
272
|
//#endregion
|
package/package.json
CHANGED
|
@@ -81,11 +81,11 @@ export function ToastContainer() {
|
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
83
|
<Portal name={TOAST_PORTAL_NAME}>
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
<ToastComponent title={toast.title} description={toast.description} variant={toast.variant} />
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
<View style={s.wrapper}>
|
|
85
|
+
{toasts.map((toast) => (
|
|
86
|
+
<ToastComponent key={toast.id} title={toast.title} description={toast.description} variant={toast.variant} />
|
|
87
|
+
))}
|
|
88
|
+
</View>
|
|
89
89
|
</Portal>
|
|
90
90
|
);
|
|
91
91
|
}
|
|
@@ -94,5 +94,8 @@ const s = StyleSheet.create({
|
|
|
94
94
|
wrapper: {
|
|
95
95
|
width: "100%",
|
|
96
96
|
alignItems: "center",
|
|
97
|
+
position: "absolute",
|
|
98
|
+
top: 24,
|
|
99
|
+
gap: 8,
|
|
97
100
|
},
|
|
98
101
|
});
|
package/src/primitives/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { Platform, View, type ViewStyle } from "react-native";
|
|
1
|
+
import { useEffect, useSyncExternalStore, useState } from "react";
|
|
2
|
+
import { Platform, View } from "react-native";
|
|
4
3
|
import { DEFAULT_PORTAL_HOST, PortalHostProps, PortalProps } from "./portal.constants";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
5
|
|
|
6
6
|
type PortalMap = Map<string, React.ReactNode>;
|
|
7
7
|
type PortalHostMap = Map<string, PortalMap>;
|
|
@@ -49,7 +49,7 @@ function removePortal(hostName: string, name: string) {
|
|
|
49
49
|
emit();
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
function NativePortalHost({ name = DEFAULT_PORTAL_HOST, container }: PortalHostProps) {
|
|
53
53
|
const map = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
54
54
|
const portalMap = map.get(name) ?? new Map<string, React.ReactNode>();
|
|
55
55
|
if (portalMap.size === 0) return null;
|
|
@@ -77,7 +77,16 @@ export function PortalHost({ name = DEFAULT_PORTAL_HOST, container }: PortalHost
|
|
|
77
77
|
return <Container>{Array.from(portalMap.values())}</Container>;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
function WebPortalHost() {
|
|
81
|
+
return <></>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const PortalHost = Platform.select({
|
|
85
|
+
default: NativePortalHost,
|
|
86
|
+
web: WebPortalHost,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
function NativePortal({ name, hostName = DEFAULT_PORTAL_HOST, children }: PortalProps) {
|
|
81
90
|
useEffect(() => {
|
|
82
91
|
updatePortal(hostName, name, children);
|
|
83
92
|
}, [hostName, name, children]);
|
|
@@ -88,28 +97,25 @@ export function Portal({ name, hostName = DEFAULT_PORTAL_HOST, children }: Porta
|
|
|
88
97
|
};
|
|
89
98
|
}, [hostName, name]);
|
|
90
99
|
|
|
91
|
-
return
|
|
100
|
+
return <></>;
|
|
92
101
|
}
|
|
93
102
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
function WebPortal({ name, hostName = DEFAULT_PORTAL_HOST, children }: PortalProps) {
|
|
104
|
+
const [container] = useState(() => {
|
|
105
|
+
let container = document.getElementById(hostName);
|
|
97
106
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}, []);
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
ref,
|
|
111
|
-
offset,
|
|
112
|
-
onLayout,
|
|
113
|
-
style: ROOT,
|
|
114
|
-
};
|
|
107
|
+
if (!container) {
|
|
108
|
+
container = document.createElement("div");
|
|
109
|
+
container.id = hostName;
|
|
110
|
+
document.body.appendChild(container);
|
|
111
|
+
}
|
|
112
|
+
return container;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return <>{createPortal(children, container, name)}</>;
|
|
115
116
|
}
|
|
117
|
+
|
|
118
|
+
export const Portal = Platform.select({
|
|
119
|
+
default: NativePortal,
|
|
120
|
+
web: WebPortal,
|
|
121
|
+
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createPortal } from "react-dom";
|
|
2
|
-
import { DEFAULT_PORTAL_HOST, PortalHostProps, PortalProps } from "./portal.constants";
|
|
3
|
-
|
|
4
|
-
function getPortalContainer(containerId: string) {
|
|
5
|
-
let container = document.getElementById(containerId);
|
|
6
|
-
if (!container) {
|
|
7
|
-
container = document.createElement("div");
|
|
8
|
-
container.id = containerId;
|
|
9
|
-
document.body.appendChild(container);
|
|
10
|
-
}
|
|
11
|
-
return container;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function PortalHost({ name = DEFAULT_PORTAL_HOST }: PortalHostProps) {
|
|
15
|
-
return <div id={name} />;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function Portal({ name, hostName = DEFAULT_PORTAL_HOST, children }: PortalProps) {
|
|
19
|
-
const container = getPortalContainer(hostName);
|
|
20
|
-
return <>{createPortal(children, container, name)}</>;
|
|
21
|
-
}
|
|
File without changes
|