reaxify 0.0.69 → 0.0.70

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.
@@ -1 +1 @@
1
- "use client";"use strict";const u=require("../../_virtual/jsx-runtime.cjs.js");require("react");const i=require("../../hooks/useClasses.cjs.js"),o=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js");function a({className:e,children:s,...t}){const n=i(r=>r.skeleton.base);return u.jsxRuntimeExports.jsx("span",{className:o.twMerge("inline-block size-10 rounded bg-gray-200 text-gray-200 animate-pulse",n,e),...t,children:s})}module.exports=a;
1
+ "use client";"use strict";const u=require("../../_virtual/jsx-runtime.cjs.js");require("react");const i=require("../../hooks/useClasses.cjs.js"),o=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js");function a({className:e,children:s,...t}){const n=i(r=>r.skeleton.base);return u.jsxRuntimeExports.jsx("span",{className:o.twMerge("inline-block w-10 h-10 rounded bg-gray-200 text-gray-200 animate-pulse",n,e),...t,children:s})}module.exports=a;
@@ -13,7 +13,7 @@ function c({
13
13
  "span",
14
14
  {
15
15
  className: i(
16
- "inline-block size-10 rounded bg-gray-200 text-gray-200 animate-pulse",
16
+ "inline-block w-10 h-10 rounded bg-gray-200 text-gray-200 animate-pulse",
17
17
  o,
18
18
  e
19
19
  ),
@@ -0,0 +1,6 @@
1
+ import { ComponentPropsWithoutAs } from '../../types';
2
+ type SkeletonProps = ComponentPropsWithoutAs<"span", {
3
+ children?: never;
4
+ }>;
5
+ export default function Spacer({ className, ...props }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("../../_virtual/jsx-runtime.cjs.js"),e=require("react"),v=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),g=require("../../helpers/cn.cjs.js"),m=require("../../hooks/useClasses.cjs.js"),R=require("../Button/index.cjs.js"),d=e.createContext({active:null,onChange:()=>{},buttonGroupClasses:""});function p({active:s=null,onChange:r=()=>{},children:a}){const n=m(c=>c.tabs.buttonGroup.base),i=e.useMemo(()=>g("relative flex items-center",n),[n]);return l.jsxRuntimeExports.jsx(d.Provider,{value:{active:s,onChange:r,buttonGroupClasses:i},children:a})}function q({className:s,...r}){const[a,n]=e.useState(!1),i=m(t=>t.tabs.indicator.base),{active:c}=e.useContext(d),x=e.useRef(null),b=e.useCallback(()=>{const t=x.current,u=t==null?void 0:t.parentElement,o=u==null?void 0:u.querySelector("button[data-active='true']");if(!u||!o||!t)return;const h=(o==null?void 0:o.offsetLeft)??0,j=window.getComputedStyle(o).paddingInline,C=(o==null?void 0:o.getBoundingClientRect().width)??0,w=h,y=C;t.style.setProperty("--left",`${w}px`),t.style.setProperty("--width",`${y}px`),t.style.setProperty("--padding-x",`${j}`)},[]);return e.useEffect(()=>{b(),requestAnimationFrame(()=>n(!0))},[b,c]),l.jsxRuntimeExports.jsx("span",{ref:x,className:v.twMerge("absolute bottom-0 left-(--left,0px) rtl:left-(--left,100%) w-(--width,0px) px-(--padding-x,0px) h-px overflow-hidden",a?"transition-[width,left,padding]":"",i,s),...r,children:l.jsxRuntimeExports.jsx("span",{className:"block size-full rounded-full bg-primary"})})}function E({eventKey:s,className:r,children:a,onClick:n,...i}){const c=m(f=>f.tabs.button.base),{active:x,onChange:b}=e.useContext(d),t=s===x,u=f=>{!t&&b(s),n==null||n(f)};return l.jsxRuntimeExports.jsx(R,{as:"button",type:"button","data-active":t,onClick:u,color:t?"primary":null,variant:"text",className:g("shadow-none border-none",c,r),...i,children:a})}function I({eventKey:s,children:r}){const{active:a}=e.useContext(d);return a!==s?null:l.jsxRuntimeExports.jsx(e.Fragment,{children:r})}p.Indicator=q;p.Button=E;p.Item=I;exports.TabsContext=d;exports.default=p;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("../../_virtual/jsx-runtime.cjs.js"),n=require("react"),w=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),g=require("../../helpers/cn.cjs.js"),p=require("../../hooks/useClasses.cjs.js"),R=require("../Button/index.cjs.js"),b=n.createContext({active:null,onChange:()=>{},buttonGroupClasses:""});function m({active:r=null,onChange:s=()=>{},children:u}){const a=p(l=>l.tabs.buttonGroup.base),c=n.useMemo(()=>g("relative flex items-center",a),[a]);return d.jsxRuntimeExports.jsx(b.Provider,{value:{active:r,onChange:s,buttonGroupClasses:c},children:u})}function q({className:r,...s}){const[u,a]=n.useState(!1),c=p(t=>t.tabs.indicator.base),{active:l}=n.useContext(b),f=n.useRef(null),x=n.useCallback(()=>{const t=f.current,e=t==null?void 0:t.parentElement,o=e==null?void 0:e.querySelector("button[data-active='true']");if(!e||!o||!t)return;const i=(o==null?void 0:o.offsetLeft)??0,C=window.getComputedStyle(o).paddingInline,j=(o==null?void 0:o.getBoundingClientRect().width)??0,v=i,y=j;t.style.setProperty("--left",`${v}px`),t.style.setProperty("--width",`${y}px`),t.style.setProperty("--padding-x",`${C}`)},[]);return n.useEffect(()=>{x(),requestAnimationFrame(()=>a(!0))},[x,l]),d.jsxRuntimeExports.jsx("span",{ref:f,className:w.twMerge("absolute bottom-0 left-(--left,0px) rtl:left-(--left,100%) w-(--width,0px) px-(--padding-x,0px) h-px overflow-hidden",u?"transition-[width,left,padding]":"",c,r),...s,children:d.jsxRuntimeExports.jsx("span",{className:"block size-full rounded-full bg-primary"})})}function E({eventKey:r,className:s,children:u,onClick:a,...c}){const l=p(i=>i.tabs.button.base),f=p(i=>i.tabs.button.active),{active:x,onChange:t}=n.useContext(b),e=r===x,h=n.useMemo(()=>typeof s=="function"?s({isActive:e}):s,[e,s]),o=i=>{!e&&t(r),a==null||a(i)};return d.jsxRuntimeExports.jsx(R,{as:"button",type:"button","data-active":e,onClick:o,color:e?"primary":null,variant:"text",className:g("shadow-none border-none",l,e&&f,h),...c,children:u})}function I({eventKey:r,children:s}){const{active:u}=n.useContext(b);return u!==r?null:d.jsxRuntimeExports.jsx(n.Fragment,{children:s})}m.Indicator=q;m.Button=E;m.Item=I;exports.TabsContext=b;exports.default=m;
@@ -9,6 +9,9 @@ type TabButtonProps = {
9
9
  eventKey: string;
10
10
  type?: never;
11
11
  ref?: never;
12
+ className?: string | ((options?: {
13
+ isActive: boolean;
14
+ }) => string);
12
15
  };
13
16
  type TabItemProps = {
14
17
  eventKey: string;
@@ -1,81 +1,86 @@
1
1
  "use client";
2
2
  import { j as c } from "../../_virtual/jsx-runtime.es.js";
3
- import { createContext as j, useMemo as I, useState as P, useContext as m, useRef as T, useCallback as A, useEffect as R, Fragment as E } from "react";
3
+ import { createContext as I, useMemo as g, useState as P, useContext as m, useRef as T, useCallback as A, useEffect as R, Fragment as E } from "react";
4
4
  import { twMerge as G } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
5
- import h from "../../helpers/cn.es.js";
6
- import b from "../../hooks/useClasses.es.js";
7
- import N from "../Button/index.es.js";
8
- const p = j({
5
+ import C from "../../helpers/cn.es.js";
6
+ import p from "../../hooks/useClasses.es.js";
7
+ import S from "../Button/index.es.js";
8
+ const b = I({
9
9
  active: null,
10
10
  onChange: () => {
11
11
  },
12
12
  buttonGroupClasses: ""
13
13
  });
14
- function x({ active: e = null, onChange: o = () => {
15
- }, children: r }) {
16
- const n = b((i) => i.tabs.buttonGroup.base), l = I(() => h("relative flex items-center", n), [n]);
17
- return /* @__PURE__ */ c.jsx(p.Provider, { value: { active: e, onChange: o, buttonGroupClasses: l }, children: r });
14
+ function x({ active: o = null, onChange: n = () => {
15
+ }, children: a }) {
16
+ const r = p((u) => u.tabs.buttonGroup.base), l = g(() => C("relative flex items-center", r), [r]);
17
+ return /* @__PURE__ */ c.jsx(b.Provider, { value: { active: o, onChange: n, buttonGroupClasses: l }, children: a });
18
18
  }
19
- function S({
20
- className: e,
21
- ...o
19
+ function $({
20
+ className: o,
21
+ ...n
22
22
  }) {
23
- const [r, n] = P(!1), l = b((t) => t.tabs.indicator.base), { active: i } = m(p), u = T(null), d = A(() => {
24
- const t = u.current, a = t == null ? void 0 : t.parentElement, s = a == null ? void 0 : a.querySelector("button[data-active='true']");
25
- if (!a || !s || !t) return;
26
- const g = (s == null ? void 0 : s.offsetLeft) ?? 0, w = window.getComputedStyle(s).paddingInline, y = (s == null ? void 0 : s.getBoundingClientRect().width) ?? 0, C = g, v = y;
27
- t.style.setProperty("--left", `${C}px`), t.style.setProperty("--width", `${v}px`), t.style.setProperty("--padding-x", `${w}`);
23
+ const [a, r] = P(!1), l = p((t) => t.tabs.indicator.base), { active: u } = m(b), d = T(null), f = A(() => {
24
+ const t = d.current, e = t == null ? void 0 : t.parentElement, s = e == null ? void 0 : e.querySelector("button[data-active='true']");
25
+ if (!e || !s || !t) return;
26
+ const i = (s == null ? void 0 : s.offsetLeft) ?? 0, w = window.getComputedStyle(s).paddingInline, y = (s == null ? void 0 : s.getBoundingClientRect().width) ?? 0, v = i, j = y;
27
+ t.style.setProperty("--left", `${v}px`), t.style.setProperty("--width", `${j}px`), t.style.setProperty("--padding-x", `${w}`);
28
28
  }, []);
29
29
  return R(() => {
30
- d(), requestAnimationFrame(() => n(!0));
31
- }, [d, i]), /* @__PURE__ */ c.jsx(
30
+ f(), requestAnimationFrame(() => r(!0));
31
+ }, [f, u]), /* @__PURE__ */ c.jsx(
32
32
  "span",
33
33
  {
34
- ref: u,
34
+ ref: d,
35
35
  className: G(
36
36
  "absolute bottom-0 left-(--left,0px) rtl:left-(--left,100%) w-(--width,0px) px-(--padding-x,0px) h-px overflow-hidden",
37
- r ? "transition-[width,left,padding]" : "",
37
+ a ? "transition-[width,left,padding]" : "",
38
38
  l,
39
- e
39
+ o
40
40
  ),
41
- ...o,
41
+ ...n,
42
42
  children: /* @__PURE__ */ c.jsx("span", { className: "block size-full rounded-full bg-primary" })
43
43
  }
44
44
  );
45
45
  }
46
- function $({
47
- eventKey: e,
48
- className: o,
49
- children: r,
50
- onClick: n,
46
+ function q({
47
+ eventKey: o,
48
+ className: n,
49
+ children: a,
50
+ onClick: r,
51
51
  ...l
52
52
  }) {
53
- const i = b((f) => f.tabs.button.base), { active: u, onChange: d } = m(p), t = e === u, a = (f) => {
54
- !t && d(e), n == null || n(f);
53
+ const u = p((i) => i.tabs.button.base), d = p((i) => i.tabs.button.active), { active: f, onChange: t } = m(b), e = o === f, h = g(() => typeof n == "function" ? n({ isActive: e }) : n, [e, n]), s = (i) => {
54
+ !e && t(o), r == null || r(i);
55
55
  };
56
56
  return /* @__PURE__ */ c.jsx(
57
- N,
57
+ S,
58
58
  {
59
59
  as: "button",
60
60
  type: "button",
61
- "data-active": t,
62
- onClick: a,
63
- color: t ? "primary" : null,
61
+ "data-active": e,
62
+ onClick: s,
63
+ color: e ? "primary" : null,
64
64
  variant: "text",
65
- className: h("shadow-none border-none", i, o),
65
+ className: C(
66
+ "shadow-none border-none",
67
+ u,
68
+ e && d,
69
+ h
70
+ ),
66
71
  ...l,
67
- children: r
72
+ children: a
68
73
  }
69
74
  );
70
75
  }
71
- function q({ eventKey: e, children: o }) {
72
- const { active: r } = m(p);
73
- return r !== e ? null : /* @__PURE__ */ c.jsx(E, { children: o });
76
+ function F({ eventKey: o, children: n }) {
77
+ const { active: a } = m(b);
78
+ return a !== o ? null : /* @__PURE__ */ c.jsx(E, { children: n });
74
79
  }
75
- x.Indicator = S;
76
- x.Button = $;
77
- x.Item = q;
80
+ x.Indicator = $;
81
+ x.Button = q;
82
+ x.Item = F;
78
83
  export {
79
- p as TabsContext,
84
+ b as TabsContext,
80
85
  x as default
81
86
  };
@@ -1 +1 @@
1
- "use client";"use strict";const c=require("react");function a(l){const o=c.useRef(null);c.useEffect(()=>{var t,s;o.current=new AbortController;const e=o.current;return(s=(t=navigator==null?void 0:navigator.credentials)==null?void 0:t.get)==null||s.call(t,{otp:{transport:["sms"]},signal:e.signal}).then(n=>{const r=n;l((r==null?void 0:r.code)||null)}).catch(n=>{console.error(n)}),()=>{e==null||e.abort("signal has been aborted.")}},[])}module.exports=a;
1
+ "use client";"use strict";const a=require("react");function f(s,e){const l=a.useRef(null);a.useEffect(()=>{var t,u;if(e!=null&&e.skip)return;l.current=new AbortController;const r=l.current;return(u=(t=navigator==null?void 0:navigator.credentials)==null?void 0:t.get)==null||u.call(t,{otp:{transport:["sms"]},signal:r.signal}).then(c=>{const n=c;s((n==null?void 0:n.code)||null)}).catch(c=>{console.error(c)}),()=>{r==null||r.abort("signal has been aborted.")}},[e==null?void 0:e.skip])}module.exports=f;
@@ -1,2 +1,4 @@
1
1
  import { Dispatch } from 'react';
2
- export default function useAutoFill(callback: Dispatch<string | null>): void;
2
+ export default function useAutoFill(callback: Dispatch<string | null>, options?: {
3
+ skip?: boolean;
4
+ }): void;
@@ -1,26 +1,27 @@
1
1
  "use client";
2
- import { useRef as a, useEffect as c } from "react";
3
- function i(l) {
4
- const r = a(null);
5
- c(() => {
6
- var t, s;
7
- r.current = new AbortController();
8
- const e = r.current;
9
- return (s = (t = navigator == null ? void 0 : navigator.credentials) == null ? void 0 : t.get) == null || s.call(t, {
2
+ import { useRef as s, useEffect as f } from "react";
3
+ function b(u, e) {
4
+ const a = s(null);
5
+ f(() => {
6
+ var t, c;
7
+ if (e != null && e.skip) return;
8
+ a.current = new AbortController();
9
+ const r = a.current;
10
+ return (c = (t = navigator == null ? void 0 : navigator.credentials) == null ? void 0 : t.get) == null || c.call(t, {
10
11
  // eslint-disable-next-line
11
12
  // @ts-ignore
12
13
  otp: { transport: ["sms"] },
13
- signal: e.signal
14
- }).then((n) => {
15
- const o = n;
16
- l((o == null ? void 0 : o.code) || null);
17
- }).catch((n) => {
18
- console.error(n);
14
+ signal: r.signal
15
+ }).then((l) => {
16
+ const n = l;
17
+ u((n == null ? void 0 : n.code) || null);
18
+ }).catch((l) => {
19
+ console.error(l);
19
20
  }), () => {
20
- e == null || e.abort("signal has been aborted.");
21
+ r == null || r.abort("signal has been aborted.");
21
22
  };
22
- }, []);
23
+ }, [e == null ? void 0 : e.skip]);
23
24
  }
24
25
  export {
25
- i as default
26
+ b as default
26
27
  };
@@ -131,6 +131,9 @@ export type ThemeProviderContextType = {
131
131
  skeleton: {
132
132
  base: string;
133
133
  };
134
+ spacer: {
135
+ base: string;
136
+ };
134
137
  stack: {
135
138
  base: string;
136
139
  variants: {
@@ -172,6 +175,7 @@ export type ThemeProviderContextType = {
172
175
  };
173
176
  button: {
174
177
  base: string;
178
+ active: string;
175
179
  };
176
180
  };
177
181
  typography: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reaxify",
3
3
  "private": false,
4
- "version": "0.0.69",
4
+ "version": "0.0.70",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "files": [