@kolking/react-ui 1.9.2 → 1.9.3

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.
@@ -10,9 +10,6 @@ export type WithDialogProps<T extends object, R> = T & {
10
10
  };
11
11
  export declare function withDialog<T extends object, R>(Component: React.ComponentType<WithDialogProps<T, R>>, withProps?: PartialDialogProps): {
12
12
  ({ children, defaultOpen, onShow, onConfirm, onCancel, ...props }: ComponentProps<T, R>): import("react/jsx-runtime").JSX.Element;
13
- useTrigger(): {
14
- props: Record<string, unknown>;
15
- show(_values: T, _showOptions?: DialogShowOptions<R>): void;
16
- };
13
+ useDialogShow(): (_values: T, _showOptions?: DialogShowOptions<R>) => void;
17
14
  };
18
15
  export {};
@@ -1,33 +1,27 @@
1
- import { jsxs as h, Fragment as w, jsx as r } from "react/jsx-runtime";
2
- import i, { useMemo as x } from "react";
1
+ import { jsxs as g, Fragment as x, jsx as r } from "react/jsx-runtime";
2
+ import i from "react";
3
3
  import { Dialog as d } from "./Dialog.js";
4
- import { useDialog as D } from "./useDialog.js";
5
- function j(a, p) {
6
- const e = i.createContext({
7
- props: {},
8
- show(t, n) {
9
- throw new Error("Dialog context is not available");
10
- }
4
+ import { useDialog as h } from "./useDialog.js";
5
+ function C(s, l) {
6
+ const e = i.createContext((t, n) => {
7
+ throw new Error("Dialog context is not available");
11
8
  });
12
- function s({
9
+ function a({
13
10
  children: t,
14
11
  defaultOpen: n,
15
- onShow: u,
16
- onConfirm: g,
12
+ onShow: p,
13
+ onConfirm: u,
17
14
  onCancel: c,
18
- ...l
15
+ ...f
19
16
  }) {
20
- const o = D({ defaultOpen: n, onShow: u, onConfirm: g, onCancel: c }), m = { ...p, ...l, ...o.props }, f = x(() => ({
21
- props: o.triggerProps,
22
- show: o.show
23
- }), [o.show, o.triggerProps]);
24
- return /* @__PURE__ */ h(w, { children: [
25
- /* @__PURE__ */ r(e, { value: f, children: typeof t == "function" ? t(o) : t }),
26
- /* @__PURE__ */ r(d, { ...m, children: o.data && /* @__PURE__ */ r(a, { ...o.data, dialog: o }) })
17
+ const o = h({ defaultOpen: n, onShow: p, onConfirm: u, onCancel: c }), m = { ...l, ...f, ...o.props };
18
+ return /* @__PURE__ */ g(x, { children: [
19
+ /* @__PURE__ */ r(e, { value: o.show, children: typeof t == "function" ? t(o) : t }),
20
+ /* @__PURE__ */ r(d, { ...m, children: o.data && /* @__PURE__ */ r(s, { ...o.data, dialog: o }) })
27
21
  ] });
28
22
  }
29
- return s.useTrigger = () => i.useContext(e), s;
23
+ return a.useDialogShow = () => i.useContext(e), a;
30
24
  }
31
25
  export {
32
- j as withDialog
26
+ C as withDialog
33
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolking/react-ui",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "React component library for building user interfaces",
5
5
  "author": "Nick Seryakov (https://github.com/kolking)",
6
6
  "license": "MIT",