@zydon/common 2.3.23 → 2.3.25
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/chunk-7W6YDCBD.js +11 -0
- package/dist/components/IconButton/index.d.ts +12 -0
- package/dist/components/IconButton/index.js +9 -0
- package/dist/components/Incrementer/index.js +1 -1
- package/dist/components/form/Incrementer/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3RQMRHTB.js +0 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { f } from './chunk-ANAHA3L6.js';
|
|
2
|
+
import { a } from './chunk-NRL7VKLK.js';
|
|
3
|
+
import { a as a$1 } from './chunk-ZCG6MY64.js';
|
|
4
|
+
import { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
|
|
5
|
+
import A from '@mui/material/IconButton';
|
|
6
|
+
import T from '@mui/material/InputAdornment';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var R=forwardRef(({name:C,increment:e=1,updadteForMultiple:D,allowNegative:u=!1,value:i,onChange:c,minValue:r,maxValue:o,decimalScale:p,disabled:I,tabIndex:M,labelIncrementer:w,labelDecrementer:B,placeholder:O,...z},E)=>{let[L,N]=useState(`incrementer-input-${Date.now()}`),m=useRef(null),s=Number(i||0),y=()=>{m.current&&(clearTimeout(m.current),m.current=null);},_=useMemo(()=>{let n=s-e;return typeof r=="number"&&n<r?!0:I||!u&&n<0},[I,s,e,r,u]),$=useMemo(()=>{let n=s+e;return typeof o=="number"&&n>o?!0:I},[I,s,e,o]),G=useCallback(()=>{if(y(),!u&&s-e<0)return;let n=s-e,t=r!==void 0&&n<r?r:f(n,p);c(t);},[s,e,r,p,c,u]),H=n=>r!==void 0&&n<r?r:o!==void 0&&n>o?o:f(n,p),K=useCallback(()=>{y();let n=s+e,t=H(n);c(t);},[s,e,o,r,p,c]),U=useCallback(n=>{y();let t=Number(n.target.value||0);(e!==1||D)&&(t=t+e/2,t-=t%e),!u&&t<0&&(t=0),typeof r=="number"&&t<r&&(t=r),typeof o=="number"&&t>o&&(t=o),t=f(t,p),(!t||t===i)&&(m.current=setTimeout(()=>{N(`incrementer-input-${Date.now()}`);},600)),c(t);},[i,e,r,o,p,c,D,u]);return jsx(a,{ref:E,name:C,value:i,minValue:r,maxValue:o,allowNegative:u,decimalScale:p,InputProps:{startAdornment:jsx(T,{position:"start",children:jsx(A,{size:"medium",onClick:G,disabled:_,"aria-label":B||"Decrementa",children:jsx(a$1,{icon:"MINUS_SIGN",width:14,height:14,color:"primary.main"})})}),endAdornment:jsx(T,{position:"end",children:jsx(A,{size:"medium",onClick:K,disabled:$,"aria-label":w||"Incrementa",children:jsx(a$1,{icon:"SIMPLE_ADD",width:14,height:14,color:"primary.main"})})}),inputProps:{style:{textAlign:"center"}}},inputProps:{tabIndex:M},onChange:U,disabled:I,placeholder:O,...z},L)});R.displayName="Incrementer";var F=R;
|
|
10
|
+
|
|
11
|
+
export { F as a };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { IconButtonProps as IconButtonProps$1 } from '@mui/material/IconButton';
|
|
3
|
+
import { Icon } from '../../types/icon.js';
|
|
4
|
+
|
|
5
|
+
interface IconButtonProps extends IconButtonProps$1 {
|
|
6
|
+
icon: keyof typeof Icon;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const IconButton: ({ icon, loading, disabled, ...props }: IconButtonProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { IconButton as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { a } from '../../chunk-ZCG6MY64.js';
|
|
2
|
+
import '../../chunk-WAKLVBQT.js';
|
|
3
|
+
import u from '@mui/material/CircularProgress';
|
|
4
|
+
import s from '@mui/material/IconButton';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var e=({icon:n,loading:r=!1,disabled:i=!1,...c})=>jsx(s,{disabled:r||i,...c,children:r?jsx(u,{size:20,color:"inherit"}):jsx(a,{icon:n})}),I=e;
|
|
8
|
+
|
|
9
|
+
export { I as default };
|
package/package.json
CHANGED
package/dist/chunk-3RQMRHTB.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { f } from './chunk-ANAHA3L6.js';
|
|
2
|
-
import { a } from './chunk-NRL7VKLK.js';
|
|
3
|
-
import { a as a$1 } from './chunk-ZCG6MY64.js';
|
|
4
|
-
import { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
|
|
5
|
-
import A from '@mui/material/IconButton';
|
|
6
|
-
import T from '@mui/material/InputAdornment';
|
|
7
|
-
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var R=forwardRef(({name:C,increment:r=1,updadteForMultiple:D,allowNegative:u=!1,value:m,onChange:c,minValue:n,maxValue:e,decimalScale:p,disabled:i,tabIndex:M,labelIncrementer:w,labelDecrementer:B,placeholder:O,...v},z)=>{let[E,L]=useState(`incrementer-input-${Date.now()}`),I=useRef(null),s=Number(m||0),y=()=>{I.current&&(clearTimeout(I.current),I.current=null);},N=useMemo(()=>{let o=s-r;return typeof n=="number"&&o<n?!0:i||!u&&o<0},[i,s,r,n,u]),_=useMemo(()=>{let o=s+r;return typeof e=="number"&&o>e?!0:i},[i,s,r,e]),$=useCallback(()=>{if(y(),!u&&s-r<0)return;let o=s-r,t=n!==void 0&&o<n?n:f(o,p);c(t);},[s,r,n,p,c,u]),G=useCallback(()=>{y();let o=s+r,t=e!==void 0&&o>e?e:f(o,p);c(t);},[s,r,e,p,c]),H=useCallback(o=>{y();let t=Number(o.target.value||0);(r!==1||D)&&(t=t+r/2,t-=t%r),!u&&t<0&&(t=0),typeof n=="number"&&t<n&&(t=n),typeof e=="number"&&t>e&&(t=e),t=f(t,p),(!t||t===m)&&(I.current=setTimeout(()=>{L(`incrementer-input-${Date.now()}`);},600)),c(t);},[m,r,n,e,p,c,D,u]);return jsx(a,{ref:z,name:C,value:m,minValue:n,maxValue:e,allowNegative:u,decimalScale:p,InputProps:{startAdornment:jsx(T,{position:"start",children:jsx(A,{size:"medium",onClick:$,disabled:N,"aria-label":B||"Decrementa",children:jsx(a$1,{icon:"MINUS_SIGN",width:14,height:14,color:"primary.main"})})}),endAdornment:jsx(T,{position:"end",children:jsx(A,{size:"medium",onClick:G,disabled:_,"aria-label":w||"Incrementa",children:jsx(a$1,{icon:"SIMPLE_ADD",width:14,height:14,color:"primary.main"})})}),inputProps:{style:{textAlign:"center"}}},inputProps:{tabIndex:M},onChange:H,disabled:i,placeholder:O,...v},E)});R.displayName="Incrementer";var j=R;
|
|
10
|
-
|
|
11
|
-
export { j as a };
|