Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cicara/better-modal

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cicara/better-modal - npm Package Compare versions

Comparing version 0.0.1-0 to 0.0.1-1

4

dist/context.d.ts
/// <reference types="react" />
export type ModalContextValue<R = unknown> = {
export type ModalContextValue<R> = {
visible: boolean;

@@ -8,2 +8,2 @@ reject: (reason: unknown) => void;

};
export declare const ModalContext: import("react").Context<ModalContextValue<unknown> | undefined>;
export declare const ModalContext: import("react").Context<ModalContextValue<any> | undefined>;

@@ -1,6 +0,6 @@

import { type ComponentType } from "react";
import { ComponentType } from "react";
export type ShowFunc<P, R = unknown> = (props: P) => Promise<R>;
export declare function useModal<P = object>(ModalComponent: ComponentType<P>): {
show: ShowFunc<P, unknown>;
export declare function useModal<P>(ModalComponent: ComponentType<P>): {
show: <R>(props: P) => Promise<R>;
placeholder: import("react/jsx-runtime").JSX.Element | null;
};

@@ -9,8 +9,5 @@ import { jsx as _jsx } from "react/jsx-runtime";

const placeholder = useMemo(() => {
if (!promiseRef.current) {
if (!(modalProps && promiseRef.current)) {
return null;
}
if (!modalProps) {
return null;
}
return (_jsx(ModalContext.Provider, { value: {

@@ -26,3 +23,3 @@ visible,

}, [ModalComponent, modalProps, visible]);
const show = useCallback(async (props) => {
const show = useCallback(async function (props) {
try {

@@ -29,0 +26,0 @@ setModalProps(props);

{
"name": "@cicara/better-modal",
"version": "0.0.1-0",
"version": "0.0.1-1",
"description": "a tool to help simplify antd modal state management",

@@ -5,0 +5,0 @@ "type": "module",

@@ -69,3 +69,3 @@ # Better Modal

export function App() {
const myModal = useModal<string>(MyModal);
const myModal = useModal(MyModal);

@@ -85,7 +85,7 @@ return <div>{myModal.placeholder}</div>;

export function App() {
const myModal = useModal<string>(MyModal);
const myModal = useModal(MyModal);
const handleOpenModal = useCallback(async () => {
try {
const result = await myModal.show({ value: "hungtcs" });
const result = await myModal.show<string>({ value: "hungtcs" });
alert(result);

@@ -92,0 +92,0 @@ } catch (err) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc