reaxify 0.0.13 → 0.0.15

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.
@@ -0,0 +1,11 @@
1
+ import { Color, ComponentPropsWithoutAs } from '../../types';
2
+ import { ReactElement } from 'react';
3
+ type Placement = "top" | "end" | "bottom" | "start";
4
+ type Props = {
5
+ title: string;
6
+ color?: Color;
7
+ placement?: Placement;
8
+ children?: ReactElement;
9
+ };
10
+ export default function Tooltip({ title, color, placement, className, children, ...props }: ComponentPropsWithoutAs<"span", Props>): ReactElement<any, string | import('react').JSXElementConstructor<any>> | null;
11
+ export {};
@@ -1 +1 @@
1
- "use strict";const v=require("../components/Form/index.cjs.js"),o=require("../helpers/randomID.cjs.js"),s=require("react");function x({rules:c}){const{setFormControl:e,removeFormControl:u}=s.useContext(v.FormContext),[b,i]=s.useState(!1),[g,a]=s.useState(null),f=s.useCallback(t=>{const r=t.id,n=t.value;if(!c.length){e==null||e(r,()=>!0),a(null),i(!1);return}for(const p of c){const l=p(n);if(typeof l=="string"){e==null||e(r,()=>(i(!0),!1)),a(l),i(!0);return}}e==null||e(r,()=>!0),a(null),i(!1)},[c,e]);return{ref:s.useCallback(t=>{if(!t)return;t.id||(t.id=o());const r=t.id;f(t);const n=new MutationObserver(()=>f(t));return n.observe(t,{attributes:!0,childList:!0,subtree:!0}),()=>{n.disconnect(),u==null||u(r)}},[f,u]),error:b,errorMessage:g}}module.exports=x;
1
+ "use strict";const v=require("../components/Form/index.cjs.js"),o=require("../helpers/randomID.cjs.js"),s=require("react");function x({rules:n}){const{setFormControl:e,removeFormControl:u}=s.useContext(v.FormContext),[b,c]=s.useState(!1),[g,a]=s.useState(null),f=s.useCallback(t=>{const r=t.id,i=t.value;if(!n.length){e==null||e(r,()=>!0),a(null),c(!1);return}for(const p of n){const l=p(i);if(typeof l=="string"){e==null||e(r,()=>(c(!0),!1)),a(l);return}}e==null||e(r,()=>!0),a(null),c(!1)},[n,e]);return{ref:s.useCallback(t=>{if(!t)return;t.id||(t.id=o());const r=t.id;f(t);const i=new MutationObserver(()=>f(t));return i.observe(t,{attributes:!0,childList:!0,subtree:!0}),()=>{i.disconnect(),u==null||u(r)}},[f,u]),error:b,errorMessage:g}}module.exports=x;
@@ -1,24 +1,24 @@
1
1
  import { FormContext as v } from "../components/Form/index.es.js";
2
2
  import x from "../helpers/randomID.es.js";
3
3
  import { useContext as M, useState as l, useCallback as p } from "react";
4
- function d({ rules: n }) {
5
- const { setFormControl: r, removeFormControl: s } = M(v), [o, u] = l(!1), [b, a] = l(null), f = p(
4
+ function d({ rules: i }) {
5
+ const { setFormControl: r, removeFormControl: s } = M(v), [o, n] = l(!1), [b, a] = l(null), f = p(
6
6
  (t) => {
7
- const e = t.id, i = t.value;
8
- if (!n.length) {
9
- r == null || r(e, () => !0), a(null), u(!1);
7
+ const e = t.id, u = t.value;
8
+ if (!i.length) {
9
+ r == null || r(e, () => !0), a(null), n(!1);
10
10
  return;
11
11
  }
12
- for (const g of n) {
13
- const c = g(i);
12
+ for (const g of i) {
13
+ const c = g(u);
14
14
  if (typeof c == "string") {
15
- r == null || r(e, () => (u(!0), !1)), a(c), u(!0);
15
+ r == null || r(e, () => (n(!0), !1)), a(c);
16
16
  return;
17
17
  }
18
18
  }
19
- r == null || r(e, () => !0), a(null), u(!1);
19
+ r == null || r(e, () => !0), a(null), n(!1);
20
20
  },
21
- [n, r]
21
+ [i, r]
22
22
  );
23
23
  return { ref: p(
24
24
  (t) => {
@@ -26,13 +26,13 @@ function d({ rules: n }) {
26
26
  t.id || (t.id = x());
27
27
  const e = t.id;
28
28
  f(t);
29
- const i = new MutationObserver(() => f(t));
30
- return i.observe(t, {
29
+ const u = new MutationObserver(() => f(t));
30
+ return u.observe(t, {
31
31
  attributes: !0,
32
32
  childList: !0,
33
33
  subtree: !0
34
34
  }), () => {
35
- i.disconnect(), s == null || s(e);
35
+ u.disconnect(), s == null || s(e);
36
36
  };
37
37
  },
38
38
  [f, s]
@@ -292,6 +292,25 @@ export type ThemeProviderContextType = {
292
292
  body2: string;
293
293
  };
294
294
  };
295
+ tooltip: {
296
+ base: string;
297
+ color: {
298
+ primary: string;
299
+ secondary: string;
300
+ success: string;
301
+ info: string;
302
+ warning: string;
303
+ danger: string;
304
+ dark: string;
305
+ light: string;
306
+ };
307
+ placement: {
308
+ top: string;
309
+ end: string;
310
+ bottom: string;
311
+ start: string;
312
+ };
313
+ };
295
314
  };
296
315
  };
297
316
  type Props = ChildrenProps & DeepPartial<ThemeProviderContextType>;
@@ -1,5 +1,6 @@
1
1
  import { ComponentProps, ElementType, ReactNode } from 'react';
2
2
  import { TransitionStatus } from 'react-transition-group';
3
+ export type ComponentPropsWithoutAs<E extends ElementType, P extends Record<string, unknown> = {}> = P & Omit<ComponentProps<E>, keyof P>;
3
4
  export type ComponentPropsWithAs<E extends ElementType, P extends Record<string, unknown> = {}> = P & {
4
5
  as?: E;
5
6
  } & Omit<ComponentProps<E>, "as" | keyof P>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reaxify",
3
3
  "private": false,
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "files": [