@inntechcorp/it-design 2.1.8 → 2.1.10
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/index.cjs.js +37 -37
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +3 -3
- package/dist/types/CheckboxProps.d.ts +1 -0
- package/dist/types/RadioProps.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -933,6 +933,7 @@ type ButtonContentPosition = "left" | "right";
|
|
|
933
933
|
type RadioType = "default" | "primary";
|
|
934
934
|
type Direction = "column" | "row";
|
|
935
935
|
type RadioGroupProps = {
|
|
936
|
+
id?: string;
|
|
936
937
|
name?: string;
|
|
937
938
|
message?: string;
|
|
938
939
|
type?: RadioType;
|
|
@@ -1035,6 +1036,7 @@ type CheckboxProps = {
|
|
|
1035
1036
|
onUpdate?: ((value: any, update: any, validation: boolean) => void);
|
|
1036
1037
|
};
|
|
1037
1038
|
type CheckboxGroupProps = {
|
|
1039
|
+
id?: string;
|
|
1038
1040
|
value?: (string | number | boolean)[];
|
|
1039
1041
|
defaultValue?: (string | number | boolean)[];
|
|
1040
1042
|
options?: GroupCheckboxOptionType[];
|
package/dist/index.esm.js
CHANGED
|
@@ -1727,7 +1727,7 @@ function(t,o){e.exports?e.exports=o(Il()):o(t.moment)}(Vl,(function(e){void 0===
|
|
|
1727
1727
|
justify-content: flex-start;
|
|
1728
1728
|
gap: 10px;
|
|
1729
1729
|
|
|
1730
|
-
`;const xu=u((({
|
|
1730
|
+
`;const xu=u((({id:t="itd-checkbox-group-"+Ha(),className:o="",disabled:p,value:b,defaultValue:n,options:M,children:c,onChange:i,onUpdate:a},O)=>{const[s,A]=r([]),[l,u]=r([]),[W,g]=r("");z((()=>{A(R)}),[c]),z((()=>{n&&u(n)}),[n]),z((()=>{Bu(l,b)}),[b]),z((()=>{}),[n,M]),z((()=>{let e=[];l.forEach((t=>{e.push(t)})),i&&i(e),L(e)}),[l]);const m=()=>{if(c)return v(c)};let R=[];const v=e=>f.map(e,(e=>{if(!function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}(e))return e;let t;if(e.type===_u){let o={ref:h(),onChange:e=>{(e=>{let t=l;if(e.value){if(e.checked)t=[...l,e.value];else{const o=l.indexOf(e.value);if(o>-1){let e=[...l];e.splice(o,1),t=e}}u(t)}})(e)},children:v(e.props.children)};l.indexOf(e.props.value)>-1&&!e.props.disabled&&(o.checked=!0),void 0!==p&&(o.disabled=p),t=d(e,o),R.push(e.props.value)}else t=d(e,{children:v(e.props.children)});return t}));q(O,(()=>({reset(e=!0,t=!0){this.selectAll(!1),u([]),g(""),L([],e,t)},setValue(e=[],t=!0,o=!0){u(e),L(e,t,o)},getValue:()=>l,setError(e=""){g(e)},clear(){u([]),this.selectAll(!1)},selectAll(e){u(e?s:[]),L(e?s:[]),i&&i(e?s:[])}})));const L=(e,t=!0,o=!0)=>{a&&a(e,t,o)};return e(wu,{id:t,className:(()=>{let e="itd-checkbox-group";return""!==W&&(e+=" itd-checkbox-group-error"),p&&(e+=" itd-checkbox-group-disabled"),""!==o&&(e+=" "+o),e})(),children:m()})}));xu.displayName="ITD-CheckboxGroup";const Xu=ha.label`
|
|
1731
1731
|
|
|
1732
1732
|
display: flex;
|
|
1733
1733
|
align-items: center;
|
|
@@ -4515,7 +4515,7 @@ function Of(e,t){if(yf(e))for(let o=0;o<e.length&&!1!==t(e[o],o,e);o++);else e&&
|
|
|
4515
4515
|
background-color: #f8285a;
|
|
4516
4516
|
}
|
|
4517
4517
|
|
|
4518
|
-
`;const nR=u((({id:t="",placeholder:p="",value:b="",defaultValue:n="",className:M="",size:i="default",variant:a="default",rows:O=3,maxLength:s=-1,disabled:A=!1,showCount:d=!1,onChange:l,onUpdate:u,children:f},h)=>{const W=c(null),[g,m]=r(""),[R,v]=r(!1),[L,y]=r(!1),[N,B]=r("")
|
|
4518
|
+
`;const nR=u((({id:t="itd-textarea-"+Ha(),placeholder:p="",value:b="",defaultValue:n="",className:M="",size:i="default",variant:a="default",rows:O=3,maxLength:s=-1,disabled:A=!1,showCount:d=!1,onChange:l,onUpdate:u,children:f},h)=>{const W=c(null),[g,m]=r(""),[R,v]=r(!1),[L,y]=r(!1),[N,B]=r("");z((()=>(n&&w(n),document.addEventListener("pointerdown",T,!1),document.addEventListener("mousedown",(()=>{v(!0)})),document.addEventListener("mouseup",(()=>{v(!1)})),()=>{document.removeEventListener("pointerdown",T,!1),document.removeEventListener("mousedown",(()=>{v(!0)})),document.removeEventListener("mouseup",(()=>{v(!1)}))})),[]),z((()=>{w(String(b),!0,""!==b)}),[b]);const w=(e,t=!0,o=!0)=>{m(e),u&&u(e,t,o)};q(h,(()=>({setFocus(){W.current&&W.current.focus()},reset(e=!0,t=!0){m(n||""),B(""),w("",e,t)},setValue(e,t=!0,o=!0){m(e),w(e,t,o)},getValue:()=>g,setError(e){B(e)},forceUpdate(){w(g)},clear(){m("")}})));const x=e=>{m(e.target.value),w(e.target.value,!0,!0),l&&l({value:e.target.value,className:"itd-textarea",disabled:A,target:W,stopPropagation:()=>{e.stopPropagation()},preventDefault:()=>{e.preventDefault()}})},X=e=>{y(!0),R||e.target.classList.add("keyboard-focus")},k=e=>{y(!1),e.target.classList.remove("keyboard-focus")},S=e=>{"Tab"===e.key&&y(!1)},T=e=>{W?.current&&(W.current.contains(e.target)||y(!1))},E=()=>{if(""!==N&&!A)return e(pR,{className:"itd-error-border"})},_=()=>{let e="itd-textarea";return e+=" itd-textarea-"+Da(i),e+=" itd-textarea-"+a,A&&(e+=" itd-textarea-disabled"),L&&(e+=" itd-textarea-focus"),d&&(e+=" itd-textarea-show-count"),""!==M&&(e+=" "+M),e};return(()=>{if(f)throw new Error("ITD TextArea Error: Remove the children!");return o(oR,{className:_(),children:[e("textarea",{id:t,placeholder:p,value:g,className:"itd-textarea-default-input",disabled:A,autoComplete:"off",rows:O,maxLength:s,onChange:x,onFocus:X,onBlur:k,onKeyDown:S,ref:W}),E()]})})()}));nR.displayName="ITD-TextArea";const MR=ha.span`
|
|
4519
4519
|
|
|
4520
4520
|
content: '';
|
|
4521
4521
|
position: absolute;
|
|
@@ -5088,7 +5088,7 @@ function Of(e,t){if(yf(e))for(let o=0;o<e.length&&!1!==t(e[o],o,e);o++);else e&&
|
|
|
5088
5088
|
grid-template-columns : ${e=>"row"===e.$direction||e.$onlyFlow?"auto":`repeat(${e.$length}, 1fr)`};
|
|
5089
5089
|
grid-template-rows : ${e=>"column"===e.$direction||e.$onlyFlow?"auto":`repeat(${e.$length}, 1fr)`};
|
|
5090
5090
|
grid-gap : ${e=>e.$gap};
|
|
5091
|
-
`,VR=u((({
|
|
5091
|
+
`,VR=u((({id:t="itd-radio-group-"+Ha(),name:o="",message:p="",type:n="default",defaultValue:M="",value:c="",buttonProps:i={},className:a="",direction:O="column",gap:s="10px",length:A=3,onlyFlow:l=!1,onChange:u=null,onUpdate:h=null,children:W=null},g)=>{const[m,R]=r(p),[v,L]=r("");z((()=>{M&&(L(M),y(M))}),[]),z((()=>{L(c),y(c)}),[c]);const y=(e,t=!0,o=!0)=>{h&&h(e,t,o)};q(g,(()=>({reset(e=!0,t=!0){L(M),R(""),y(M,e,t)},setValue(e,t=!0,o=!0){L(e),y(e,t,o)},getValue:()=>v,setError(e){R(e)},clear(){}})));const N=e=>{v!==e&&(L(e),y(e,!0,!1),R(""),u&&u(e))};return e(UR,{id:t,className:(()=>{let e="itd-radio-group";return e+=" itd-radio-group-"+n,e+=" itd-radio-group-"+O,m&&(e+=" itd-radio-group-error"),""!==a&&(e+=" "+a),e})(),role:"radiogroup",$direction:O,$length:A,$gap:s,$onlyFlow:l,children:(()=>{const e=t=>{if(!b.isValidElement(t))return null;if(t.type===$R)return d(t,{...t.props,checked:v===t.props.value,onChange:N,hasError:""!==m,name:o,type:n,buttonProps:i});if(t.props.children){const o=f.map(t.props.children,e);return d(t,{...t.props,children:o})}return t};return f.map(W,e)})()})}));var HR=W(VR);const YR=()=>null;YR.Group=HR,YR.Button=$R;var GR="itd__label__9437953e",KR="itd__checkmark__9437953e",QR="itd__check__9437953e",JR="itd__container__9437953e";Jm(".itd__container__9437953e{align-items:center;cursor:pointer;display:flex;-webkit-user-select:none;user-select:none}.itd__label__9437953e{align-items:center;display:flex;position:relative}.itd__label__9437953e span{color:#fff9;font-size:12px;font-weight:400;line-height:1.2;margin-left:10px}.itd__checkmark__9437953e{align-items:center;background-color:#1d2649;border-radius:6px;display:flex;height:20px;justify-content:center;transition:background-color .25sn ease-out;width:20px}.itd__checkmark__9437953e svg{fill:#fff;visibility:hidden}.itd__check__9437953e{background-color:#3396fb}.itd__check__9437953e svg{animation:itd__bounce__9437953e .5s;visibility:visible}@keyframes itd__bounce__9437953e{0%{transform:scale(.2) rotate(4deg)}50%{transform:scale(1.2) rotate(-2deg)}75%{transform:scale(.9) rotate(1deg)}to{transform:scale(1) rotate(0deg)}}",{});const ZR=({checked:e=!1,className:t="",children:o=null})=>b.createElement("label",{className:"itd-inline-select-checkbox-label "+t+" "+JR},b.createElement("div",{className:"itd-inline-select-checkbox-wrapper "+GR},(()=>{let t="itd-inline-select-checkbox "+KR;return e&&(t+=" "+QR),b.createElement("div",{className:t},b.createElement(qu,{className:"itd-svg",width:12,height:12}))})(),b.createElement("span",null,o)));var ev="itd__option__733c7593",tv="itd__selected__733c7593",ov="itd__single__733c7593";Jm(".itd__option__733c7593{align-items:center;cursor:pointer;display:flex;min-width:max-content;padding:10px 30px 10px 15px}.itd__option__733c7593:not(:last-child){margin-bottom:1px}.itd__option__733c7593:hover{background-color:rgba(29,38,73,.502)}.itd__selected__733c7593 .itd__option__733c7593 span,.itd__selected__733c7593 .itd__single__733c7593{color:#fff}.itd__option__733c7593 span,.itd__single__733c7593{color:hsla(0,0%,100%,.667);font-size:12px;font-weight:400;line-height:12px;white-space:nowrap}",{});const pv=({value:e="",checked:t=!1,single:o=!1,onChange:p=null,children:n=null})=>{const[M,c]=r(!1);return b.createElement("li",{onMouseEnter:e=>{c(!0),e.stopPropagation()},onMouseLeave:e=>{c(!1),e.stopPropagation()},className:(()=>{let e="itd-inline-select-item itd-inline-select-item-option";return e+=" "+ev,t&&(e+=" "+tv),t&&(e+=" itd-inline-select-item-option-selected"),M&&!t&&(e+=" itd-inline-select-item-option-active"),e})(),onClick:o=>{p(e,!t,n),o.stopPropagation()}},o?b.createElement("div",{className:"itd-item-single "+ov},b.createElement("span",null,n)):b.createElement(ZR,{className:"itd-item-multi",checked:t},n))};var bv=W(pv),nv={menu:"itd__menu__211ba801",bodyWrapper:"itd__bodyWrapper__211ba801",bodyWrapperLong:"itd__bodyWrapperLong__211ba801",menuEnter:"itd__menuEnter__211ba801",menuEnterActive:"itd__menuEnterActive__211ba801",menuExit:"itd__menuExit__211ba801",menuExitActive:"itd__menuExitActive__211ba801",menuEnterActiveLong:"itd__menuEnterActiveLong__211ba801",menuExitActiveLong:"itd__menuExitActiveLong__211ba801",bottom:"itd__bottom__211ba801",left:"itd__left__211ba801"};function Mv(e){const t=c(null),{value:o=[],children:p=null,onChange:n=null,isOpen:M=!1,single:i=!1,minWidth:a=0}=e,[O,s]=r([]);z((()=>{s(o)}),[o]);const A=(e,t,o)=>{if(i){const p=[t?e:""];s(p),n(p,o)}else{let p=[];t?p=[...O,e]:(O.splice(O.indexOf(e),1),p=[...O]),s(p),n(p,o)}};return b.createElement(v,{in:M,timeout:500,classNames:{enter:nv.menuEnter,enterActive:p.length>5?nv.menuEnterActiveLong:nv.menuEnterActive,exit:nv.menuExit,exitActive:p.length>5?nv.menuExitActiveLong:nv.menuExitActive},nodeRef:t,unmountOnExit:!0},b.createElement("div",{className:"itd-inline-select-dropdown "+nv.menu+" "+nv.bottom+" "+nv.left,style:{width:0===a?"max-content":a+"px"},ref:t},b.createElement("div",{className:nv.spacer}),b.createElement(FW,{className:"itd-inline-select-dropdown-body "+p.length>5?nv.bodyWrapperLong:nv.bodyWrapper},b.createElement("ul",null,f.map(p,(e=>d(e,{onChange:A,checked:O.indexOf(e.props.value)>-1,key:e.props.value})))))))}Jm(".itd__menu__211ba801{background-color:#050a20;border-radius:0 5px 5px 5px;box-shadow:0 20px 20px #00000040;overflow:hidden;position:absolute;transform-box:fill-box;transform-origin:50% 1%;transition-timing-function:cubic-bezier(.75,-.5,0,1.25);z-index:2}.itd__menu__211ba801 ul{min-width:max-content}.itd__bodyWrapperLong__211ba801,.itd__bodyWrapper__211ba801{height:300px}.itd__bottom__211ba801{top:100%}.itd__left__211ba801{left:0}.itd__menuEnter__211ba801{height:50px;opacity:0}.itd__menuEnterActive__211ba801{height:300px;opacity:1;transition:height .15s ease-out}.itd__menuExit__211ba801{opacity:1}.itd__menuExitActive__211ba801{height:300px;opacity:0;transition:height .15s ease-out}.itd__menuEnterActiveLong__211ba801{height:300px;opacity:1;transition:height .15s ease-out}.itd__menuExitActiveLong__211ba801{height:300px;opacity:0;transition:height .15s ease-out}",{});const rv=ha.div`
|
|
5092
5092
|
width: max-content;
|
|
5093
5093
|
`,cv=ha.span`
|
|
5094
5094
|
|
|
@@ -13,6 +13,7 @@ export type CheckboxProps = {
|
|
|
13
13
|
onUpdate?: ((value: any, update: any, validation: boolean) => void);
|
|
14
14
|
};
|
|
15
15
|
export type CheckboxGroupProps = {
|
|
16
|
+
id?: string;
|
|
16
17
|
value?: (string | number | boolean)[];
|
|
17
18
|
defaultValue?: (string | number | boolean)[];
|
|
18
19
|
options?: GroupCheckboxOptionType[];
|