amotify 0.2.230 → 0.2.232

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.
@@ -2732,9 +2732,9 @@ const UserConfig = () => {
2732
2732
  }
2733
2733
 
2734
2734
  let DesignBook = () => {
2735
- let [ val_tabIndex,set_tabIndex ] = useState( Number( $$.queryParams.get().ti ) || 0 )
2735
+ let [ val_tabIndex,set_tabIndex ] = useState( Number( $$.url.search.get().ti ) || 0 )
2736
2736
  useEffect( () => {
2737
- $$.queryParams.set( { 'ti': String( val_tabIndex ) } )
2737
+ $$.url.search.set( { 'ti': String( val_tabIndex ) } )
2738
2738
  },[ val_tabIndex ] )
2739
2739
 
2740
2740
  // let [ val_refresh,set_refresh ] = useState( UUID() )
@@ -12,7 +12,7 @@
12
12
  "cross-env": "^7.0.3",
13
13
  "dotenv": "^16.4.5",
14
14
  "express": "^4.19.2",
15
- "jmini": "^0.0.98",
15
+ "jmini": "^0.0.101",
16
16
  "next": "^15.3.4",
17
17
  "node-cron": "^4.1.1",
18
18
  "nodemon": "^3.1.4",
@@ -2750,9 +2750,9 @@ const UserConfig = () => {
2750
2750
  }
2751
2751
 
2752
2752
  let DesignBook = () => {
2753
- let [ val_tabIndex,set_tabIndex ] = useState( Number( $$.queryParams.get().ti ) || 0 )
2753
+ let [ val_tabIndex,set_tabIndex ] = useState( Number( $$.url.search.get().ti ) || 0 )
2754
2754
  useEffect( () => {
2755
- $$.queryParams.set( { 'ti': String( val_tabIndex ) } )
2755
+ $$.url.search.set( { 'ti': String( val_tabIndex ) } )
2756
2756
  },[ val_tabIndex ] )
2757
2757
 
2758
2758
  // let [ val_refresh,set_refresh ] = useState( UUID() )
@@ -133,80 +133,32 @@ let Page = () => {
133
133
  val_value { val_value || "null" }
134
134
  </Literal>
135
135
 
136
- <Input.TextField.Money.JPY
137
- override='force'
136
+ <Input.TextField.Number
137
+ form='test_form'
138
+ name='testing'
138
139
  value={ val_value || void 0 }
139
- // options={ [
140
- // { value: select1,label: "option1" },
141
- // { value: select2,label: "option2" },
142
- // { value: select3,label: "option3" }
143
- // ] }
144
- onUserAction={ ( value,event ) => {
145
- console.log( event )
146
- set_data( $$.Stringify( event ) )
147
- set_value( value || '' )
140
+ onValidate={ async ( value,eventType,opt ) => {
141
+ console.log(
142
+ value,eventType,opt
143
+ )
144
+
145
+ return {
146
+ ok: true,
147
+ notice: []
148
+ }
148
149
  } }
149
150
  />
150
151
  <Literal.Description>
151
152
  { $$.Stringify( val_data ) }
152
153
  </Literal.Description>
153
- {/* <Column>
154
- <Input.Checker
155
- override='force'
156
- label='checker1'
157
- name='checker1'
158
- // options={ [
159
- // { label: 'checker1',value: true }
160
- // ] }
161
- value={ !!val_checked1 }
162
- onUpdateValidValue={ value => {
163
- set_checked1( !!value )
164
- } }
165
- />
166
- <Input.Checker
167
- override='force'
168
- label='checker2'
169
- name='checker2'
170
- // options={ [
171
- // { label: 'checker2',value: true }
172
- // ] }
173
- value={ !!val_checked2 }
174
- onUpdateValidValue={ value => {
175
- set_checked2( !!value )
176
- } }
177
- />
178
- </Column> */}
179
154
  </Box>
180
155
 
181
156
  <Button.Prime
182
- // submitOption={ {
183
- // formName: 'form_test',
184
- // callback: form => {
185
- // console.log( form )
186
- // }
187
- // } }
188
- onClick={ event => {
189
- let sheetID = 'sheet1'
190
- Sheet.open( 'topCenter',{
191
- // closeAtAroundClick: true,
192
- sheetID,
193
- padding: 4,
194
- content: () => {
195
- return <Sheet.Body>
196
- <Column padding={ 2 }>
197
- <Button.Sub
198
- onClick={ () => {
199
- Sheet.close( sheetID )
200
- } }
201
- >
202
- <FAI.X />
203
- </Button.Sub>
204
-
205
- { Array.from( { length: 100 } ).map( ( _,i ) => <Literal key={ i }>Item { i + 1 }</Literal> ) }
206
- </Column>
207
- </Sheet.Body>
208
- }
209
- } )
157
+ submitOption={ {
158
+ formName: 'test_form',
159
+ callback: form => {
160
+ console.log( form )
161
+ }
210
162
  } }
211
163
  >
212
164
  Submit
@@ -255,4 +207,5 @@ let Page = () => {
255
207
  }
256
208
 
257
209
  import dynamic from 'next/dynamic'
210
+ import { ok } from 'assert'
258
211
  export default dynamic( () => Promise.resolve( Page ),{ ssr: false } )
@@ -1,3 +1,3 @@
1
- import{b as n,c as r,d as ae,e as ue}from"../../chunk-C5N2D3ZX.js";import{Fragment as de,jsx as s,jsxs as Y}from"react/jsx-runtime";import b,{UUID as C,useStore as ce}from"jmini";import{useState as ie,useEffect as ne}from"react";import{$$fromRoot as De,ExtractStyles as ke}from"../../@utils";import{Box as D,FAI as Ne}from"../../atoms";import{Literal as le}from"../../mols";import{Tips as pe,Button as Ee}from"..";import{faEye as Le}from"@fortawesome/free-solid-svg-icons/faEye";import{OptionalInputWrapper as _e,BoxWrapper as He,CoreEffects as K,DefaultBoxishStyles as Ae}from"./core";import{InputLabel as Be}from"./Label";import{LeftIcon as Me,RightIcon as me}from".";const $e={katakana:{reg:/^[ァ-ヶー  ヲ-゚  ]*$/g,exist:!0,reason:"\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},"hankaku.katakana":{reg:/^[ヲ-゚  ]*$/g,exist:!0,reason:"\u534A\u89D2\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},number:{reg:/^-?[0-9\.]{0,}[0-9]{1,}$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},digitNumber:{reg:/^-?[0-9\,\.]{0,}[0-9]{1,}$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},fileName:{reg:/[¥\/:*\?\"\'\|\.\s\n\r\<\>]/g,exist:!1,reason:"\u7A7A\u767D\u307E\u305F\u306F\u4E00\u90E8\u306E\u7279\u6B8A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093"},creditCard:{reg:/^\d{14,16}$/g,exist:!0,reason:"14~16\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},email:{reg:/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]+\.[A-Za-z0-9]+$/,exist:!0,reason:Y(de,{children:[s(D,{children:"\u25CB\u25CB\u25CB\u25CB@\u25CB\u25CB\u25CB\u25CB.\u25CB\u25CB\u25CB\u306E\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),s(D,{children:"\u6700\u5F8C\u306E\u6587\u5B57\u306B.(\u30C9\u30C3\u30C8)\u3092\u5165\u308C\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"})]})},password:{reg:/^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=[^0-9]*[0-9]).{8,}$/,exist:!0,reason:"8\u6587\u5B57\u4EE5\u4E0A\u3001\u534A\u89D2\u82F1\u6570\u5927\u5C0F\u6587\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},tel:{reg:/.*$/g,exist:!0,reason:Y(de,{children:[s(D,{children:"0\u304B\u3089\u59CB\u307E\u308B\u756A\u53F7\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"}),s(D,{children:"9~12\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),s(D,{children:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"})]})},url:{reg:/^https?:\/\/[^\n\s]+(\.|\:)[^\n\s\.\:]+$/,exist:!0,reason:"URL\u5F62\u5F0F : http(s)://\u25EF\u25EF\u25EF\u25EF"},postal:{reg:/^\d{7}$/g,exist:!0,reason:"7\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},T={setSelection:t=>{let{id:a,restrict:l,val_status:u}=t,i=De("#"+a)[0];if(!i||!u.prevValue||!u.formatValue||!u.isFocusing||!u.isComposing)return;let{formatValue:e,prevValue:f,caretFrom:g,caretTo:o}=u;if(l=="creditCard")e.length>=f.length&&g%5==0&&(g++,o++),i.setSelectionRange(g,o);else if(l=="postal")e.length==5&&f.length==3&&(g++,o++),i.setSelectionRange(g,o);else if(l=="digitNumber"){let p=e.length-f.length;p==2&&(g++,o++),p==-2&&(g--,o--),i.setSelectionRange(g,o)}},Validation:{System:t=>{let{value:a,states:l}=t,{restrict:u="text",defaultValidation:i,maxLength:e,multiline:f,required:g}=l,o=[];if(f||(e=e||255),b.is.exist(e)&&a.length>=Number(e)&&o.push({type:"invalid",label:e+"\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),a){let p=T.Validation.Text(a,u,i);p.ok||o.push({type:"invalid",label:p.body})}else g&&o.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"});return{ok:!o.filter(({type:p})=>p=="invalid").length,notice:o}},Text:(t,a,l)=>{let u={ok:!0,body:""};return(()=>{let i=l||$e[a];if(!i)return;let e=i.reason;if(i){let f=!!(+!!t.match(i.reg)^+!i.exist);u={ok:f,body:f?"":e}}})(),u},DataLeveling:t=>{let{restrict:a,allowDecimals:l,allowZeroStart:u,value:i=""}=t,e=String(i);["tel","number","digitNumber","postal","creditCard"].includes(a)&&(e=e.zen2hanNumber()),a=="katakana",a=="hankaku.katakana",["postal","creditCard"].includes(a)&&(e=e.removeLetters()),b.scope(()=>{if(!["number","digitNumber"].includes(a))return;e=e.replace(/(\.\d+)\..*/g,"$1").replace(/\.+/g,".").replace(/[^0-9.-]/g,"");let g=Number(e)<0||e[0]=="-";e=e.replace(/[^0-9.]/g,""),g&&(e="-"+e);let o=Number(l);l?e=e.replace(/(\.\d{0,})\..*/g,"$1").replace(/\.(\d{0,})/g,(p,x)=>x.length>o?"."+x.slice(0,o):p):e=e.replace(/\.\d?/g,""),b.scope(()=>{a=="number"&&(u||(e=e.replace(/^0(\d+)/g,"$1").replace(/^-0(\d+)/g,"-$1")))}),b.scope(()=>{let p=e.slice(-1);if(!e||p=="."||p=="-")return;let{min:x,max:c}=t;b.is.exist(x)&&b.is.number(x)&&Number(e)<Number(x)&&(e=String(x.toFixed(o))),b.is.exist(c)&&b.is.number(c)&&Number(e)>Number(c)&&(e=String(c.toFixed(o)))}),b.scope(()=>{if(!e||e=="-"||a!="digitNumber")return;let p=e.slice(-1),[x,c]=e.split(".");e=x.replace(/\B(?=(\d{3})+(?!\d))/g,","),c&&(e+="."+c),p=="."&&(e+=".")})});let f=e;return a=="digitNumber"||(a=="postal"?e.length>=4&&(f=e.clip(0,3)+"-"+e.clip(3)):a=="creditCard"&&(f=e.replace(/.{4}(?=.)/g,"$& "))),(a=="digitNumber"||a=="number")&&(e=e.replace(/,/g,"")),{formatValue:f,dataValue:e}}},Shallow:t=>{let{rootStates:a,val_status:l}=t,u=l.dataValue||"";ne(()=>{b.scope(()=>ue(void 0,null,function*(){if(!a.multiline)return;let p=b('[data-input-origin="'+l.componentId+'"]'),x=b('[data-input-shallow="'+l.componentId+'"]'),c=b('[data-input-min-height-value-shallow="'+l.componentId+'"]'),E=b('[data-input-max-height-value-shallow="'+l.componentId+'"]');if(!p[0]||!x[0]||!c[0]||!E[0])return;let L=x.position(),F=c.position(),$=E.position(),k=0;a.autoHeight&&(k=L.height),k=Math.max(k,F.height),k=Math.min(k,$.height),p[0].style.height=k+"px"}))},[u]);let i=u||"";(!!u.match(/\n$/)||!u)&&(i+="T");let f="",g="";if(a.multiline){let p=a.minRows||1,x=a.maxRows||100;f=`
1
+ import{b as n,c as r,d as ae,e as ue}from"../../chunk-C5N2D3ZX.js";import{Fragment as de,jsx as s,jsxs as Y}from"react/jsx-runtime";import b,{UUID as C,useStore as ce}from"jmini";import{useState as ie,useEffect as ne}from"react";import{$$fromRoot as De,ExtractStyles as ke}from"../../@utils";import{Box as D,FAI as Ne}from"../../atoms";import{Literal as le}from"../../mols";import{Tips as pe,Button as Ee}from"..";import{faEye as Le}from"@fortawesome/free-solid-svg-icons/faEye";import{OptionalInputWrapper as _e,BoxWrapper as He,CoreEffects as K,DefaultBoxishStyles as Ae}from"./core";import{InputLabel as Be}from"./Label";import{LeftIcon as Me,RightIcon as me}from".";const $e={katakana:{reg:/^[ァ-ヶー  ヲ-゚  ]*$/g,exist:!0,reason:"\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},"hankaku.katakana":{reg:/^[ヲ-゚  ]*$/g,exist:!0,reason:"\u534A\u89D2\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},number:{reg:/^-?[0-9\.]{0,}[0-9]{1,}$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},digitNumber:{reg:/^-?[0-9\,\.]{0,}[0-9]{1,}$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},fileName:{reg:/[¥\/:*\?\"\'\|\.\s\n\r\<\>]/g,exist:!1,reason:"\u7A7A\u767D\u307E\u305F\u306F\u4E00\u90E8\u306E\u7279\u6B8A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093"},creditCard:{reg:/^\d{14,16}$/g,exist:!0,reason:"14~16\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},email:{reg:/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]+\.[A-Za-z0-9]+$/,exist:!0,reason:Y(de,{children:[s(D,{children:"\u25CB\u25CB\u25CB\u25CB@\u25CB\u25CB\u25CB\u25CB.\u25CB\u25CB\u25CB\u306E\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),s(D,{children:"\u6700\u5F8C\u306E\u6587\u5B57\u306B.(\u30C9\u30C3\u30C8)\u3092\u5165\u308C\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"})]})},password:{reg:/^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=[^0-9]*[0-9]).{8,}$/,exist:!0,reason:"8\u6587\u5B57\u4EE5\u4E0A\u3001\u534A\u89D2\u82F1\u6570\u5927\u5C0F\u6587\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},tel:{reg:/.*$/g,exist:!0,reason:Y(de,{children:[s(D,{children:"0\u304B\u3089\u59CB\u307E\u308B\u756A\u53F7\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"}),s(D,{children:"9~12\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),s(D,{children:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"})]})},url:{reg:/^https?:\/\/[^\n\s]+(\.|\:)[^\n\s\.\:]+$/,exist:!0,reason:"URL\u5F62\u5F0F : http(s)://\u25EF\u25EF\u25EF\u25EF"},postal:{reg:/^\d{7}$/g,exist:!0,reason:"7\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},T={setSelection:t=>{let{id:a,restrict:l,val_status:u}=t,i=De("#"+a)[0];if(!i||!u.prevValue||!u.formatValue||!u.isFocusing||u.isComposing)return;let{formatValue:e,prevValue:f,caretFrom:g,caretTo:o}=u;if(l=="creditCard")e.length>=f.length&&g%5==0&&(g++,o++),i.setSelectionRange(g,o);else if(l=="postal")e.length==5&&f.length==3&&(g++,o++),i.setSelectionRange(g,o);else if(l=="digitNumber"){let p=e.length-f.length;p==2&&(g++,o++),p==-2&&(g--,o--),i.setSelectionRange(g,o)}},Validation:{System:t=>{let{value:a,states:l}=t,{restrict:u="text",defaultValidation:i,maxLength:e,multiline:f,required:g}=l,o=[];if(f||(e=e||255),b.is.exist(e)&&a.length>=Number(e)&&o.push({type:"invalid",label:e+"\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),a){let p=T.Validation.Text(a,u,i);p.ok||o.push({type:"invalid",label:p.body})}else g&&o.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"});return{ok:!o.filter(({type:p})=>p=="invalid").length,notice:o}},Text:(t,a,l)=>{let u={ok:!0,body:""};return(()=>{let i=l||$e[a];if(!i)return;let e=i.reason;if(i){let f=!!(+!!t.match(i.reg)^+!i.exist);u={ok:f,body:f?"":e}}})(),u},DataLeveling:t=>{let{restrict:a,allowDecimals:l,allowZeroStart:u,value:i=""}=t,e=String(i);["tel","number","digitNumber","postal","creditCard"].includes(a)&&(e=e.zen2hanNumber()),a=="katakana",a=="hankaku.katakana",["postal","creditCard"].includes(a)&&(e=e.removeLetters()),b.scope(()=>{if(!["number","digitNumber"].includes(a))return;e=e.replace(/(\.\d+)\..*/g,"$1").replace(/\.+/g,".").replace(/[^0-9.-]/g,"");let g=Number(e)<0||e[0]=="-";e=e.replace(/[^0-9.]/g,""),g&&(e="-"+e);let o=Number(l);l?e=e.replace(/(\.\d{0,})\..*/g,"$1").replace(/\.(\d{0,})/g,(p,x)=>x.length>o?"."+x.slice(0,o):p):e=e.replace(/\.\d?/g,""),b.scope(()=>{a=="number"&&(u||(e=e.replace(/^0(\d+)/g,"$1").replace(/^-0(\d+)/g,"-$1")))}),b.scope(()=>{let p=e.slice(-1);if(!e||p=="."||p=="-")return;let{min:x,max:c}=t;b.is.exist(x)&&b.is.number(x)&&Number(e)<Number(x)&&(e=String(x.toFixed(o))),b.is.exist(c)&&b.is.number(c)&&Number(e)>Number(c)&&(e=String(c.toFixed(o)))}),b.scope(()=>{if(!e||e=="-"||a!="digitNumber")return;let p=e.slice(-1),[x,c]=e.split(".");e=x.replace(/\B(?=(\d{3})+(?!\d))/g,","),c&&(e+="."+c),p=="."&&(e+=".")})});let f=e;return a=="digitNumber"||(a=="postal"?e.length>=4&&(f=e.clip(0,3)+"-"+e.clip(3)):a=="creditCard"&&(f=e.replace(/.{4}(?=.)/g,"$& "))),(a=="digitNumber"||a=="number")&&(e=e.replace(/,/g,"")),{formatValue:f,dataValue:e}}},Shallow:t=>{let{rootStates:a,val_status:l}=t,u=l.dataValue||"";ne(()=>{b.scope(()=>ue(void 0,null,function*(){if(!a.multiline)return;let p=b('[data-input-origin="'+l.componentId+'"]'),x=b('[data-input-shallow="'+l.componentId+'"]'),c=b('[data-input-min-height-value-shallow="'+l.componentId+'"]'),E=b('[data-input-max-height-value-shallow="'+l.componentId+'"]');if(!p[0]||!x[0]||!c[0]||!E[0])return;let L=x.position(),F=c.position(),$=E.position(),k=0;a.autoHeight&&(k=L.height),k=Math.max(k,F.height),k=Math.min(k,$.height),p[0].style.height=k+"px"}))},[u]);let i=u||"";(!!u.match(/\n$/)||!u)&&(i+="T");let f="",g="";if(a.multiline){let p=a.minRows||1,x=a.maxRows||100;f=`
2
2
  T`.repeat(p-1),g=`
3
3
  T`.repeat(x-1)}let o=ke(a);return Y(D,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:[s(le.Description,r(n({className:a.className},o),{position:"absolute",width:1,freeCSS:r(n({},o.freeCSS),{color:"orange"}),"data-input-shallow":l.componentId,children:s(D,{"data-input-value-shallow":l.componentId,children:i})})),s(le.Description,r(n({className:a.className},o),{position:"absolute",left:0,freeCSS:r(n({},o.freeCSS),{backgroundColor:"transparent",color:"blue"}),"data-input-min-height-value-shallow":l.componentId,children:f})),s(le.Description,r(n({className:a.className},o),{position:"absolute",right:0,freeCSS:r(n({},o.freeCSS),{backgroundColor:"transparent",color:"red"}),"data-input-max-height-value-shallow":l.componentId,children:g}))]})},InputBox:t=>{let{rootStates:a,val_validate:l,set_validate:u,val_status:i,set_status:e,val_inputType:f,set_inputType:g}=t;if(a.multiline)return null;let re=a,{componentId:o,tone:p,required:x,restrict:c="text",form:E,autoComplete:L="off",autoCapitalize:F="off",minRows:$,maxRows:k,multiline:fe,autoHeight:ge,enableFormSubmit:G,clearButton:xe=!1,allowDecimals:z,allowZeroStart:A,checkValidationAtFirst:W,onChange:X,onKeyDown:Q,onValidate:be,onValidateDelay:he,onUpdateValue:Ie,onUpdateValidValue:Se,onUserAction:ve,value:Te="",leftIndicator:Ce,rightIndicator:Re,leftIcon:ye,rightIcon:we,maxLength:m,min:O,max:B,label:v,isLabelActive:y,defaultValidation:oe,wrapStyles:Pe}=re,d=ae(re,["componentId","tone","required","restrict","form","autoComplete","autoCapitalize","minRows","maxRows","multiline","autoHeight","enableFormSubmit","clearButton","allowDecimals","allowZeroStart","checkValidationAtFirst","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","maxLength","min","max","label","isLabelActive","defaultValidation","wrapStyles"]);return s(D,r(n({htmlTag:"input",type:f,inputMode:["number","digitNumber","creditCard"].includes(c)?"numeric":c=="email"?"email":"text","data-disabled":a.disabled,"data-show-validation":K.isShowValidation(l,i,!!W),"data-component-id":i.componentId,"data-input-origin":i.componentId,value:i.formatValue,autoComplete:L,autoCapitalize:F,onKeyDown:I=>{let{key:h,target:w}=I,M=w,{selectionStart:P,selectionEnd:j}=M,q=Number(P),Z=Number(j);{let _=i.formatValue[Number(q)],H=i.formatValue[Number(q)-1];h=="Delete"&&(c=="creditCard"&&_==" "||c=="postal"&&_=="-"||c=="digitNumber"&&_==",")&&(M.setSelectionRange(q+1,Z+1),I.preventDefault()),h=="Backspace"&&(c=="creditCard"&&H==" "||c=="postal"&&H=="-"||c=="digitNumber"&&H==",")&&(M.setSelectionRange(q-1,Z-1),I.preventDefault()),h=="Enter"||h=="Tab"}b.scope(()=>{["number","digitNumber","creditCard"].includes(c)&&h=="Clear"&&e(_=>r(n({},_),{dataValue:"",formatValue:"",eventType:"update",eventID:C(),isFocusing:!0}))}),b.scope(()=>{if(!["number","digitNumber"].includes(c)||!["ArrowUp","ArrowDown"].includes(h))return;let _=+(h=="ArrowUp")*2-1,H=i.dataValue.slice(-1),se=i.formatValue[Z-1],N=Z-1,V=String(i.formatValue),ee=i.dataValue.split(".")[1],Ve=(ee==null?void 0:ee.length)||0;b.scope(()=>{if(!H){V="0";return}if(H=="-"){V+="0";return}if(H=="."){V+="0";return}if(Z==0)return;let te=String(V).slice(0,N).match(/\./),Fe=String(V).slice(N),J=String(Fe.toNumber().toFixed(0)).length;se=="."&&(J=1,N=V.split(".")[0].length-1),se==","&&(J+=1,N--),te&&(J=-1*(Ve-J));let U=V[N].toNumber()+_;U<0?U=9:U>=10&&(U=0),V=V.partReplace(N,String(U)),setTimeout(()=>{M.setSelectionRange(N+1,N+1)},1)}),l.ok&&u({ok:!1,notice:[]}),e(te=>r(n(n({},te),T.Validation.DataLeveling({allowDecimals:z,allowZeroStart:A,min:O,max:B,restrict:c,value:V})),{eventType:"update",eventID:C(),isFocusing:!0})),I.preventDefault()}),Q&&Q(I),G&&K.SubmitForm(I,E)},onChange:I=>{let{value:h,selectionStart:w,selectionEnd:M}=I.target,P=T.Validation.DataLeveling({allowDecimals:z,allowZeroStart:A,min:O,max:B,restrict:c,value:h});i.isComposing&&(P.formatValue=h),P.formatValue!=i.formatValue&&(l.ok&&u({ok:!1,notice:[]}),e(j=>r(n(n({},j),P),{prevValue:i.formatValue,eventType:"update",eventID:C(),caretFrom:Number(w),caretTo:Number(M),isFocusing:!0})),X&&X(I))},width:1},d),{onFocus:I=>{d!=null&&d.onFocus&&(d==null||d.onFocus(I)),e(h=>r(n({},h),{eventID:C(),isFocusing:!0}))},onBlur:I=>{d!=null&&d.onBlur&&(d==null||d.onBlur(I)),e(h=>r(n({},h),{eventID:C(),isFocusing:!1}))},onCompositionStart:I=>{d!=null&&d.onCompositionStart&&(d==null||d.onCompositionStart(I)),e(h=>r(n({},h),{eventID:C(),isComposing:!0}))},onCompositionEnd:I=>{if(d!=null&&d.onCompositionEnd&&(d==null||d.onCompositionEnd(I)),c=="text"){b.interval.once(()=>{e(w=>r(n({},w),{isComposing:!1}))},100,"input.textfield.composing.end");return}let h=T.Validation.DataLeveling({allowDecimals:z,allowZeroStart:A,min:O,max:B,restrict:c,value:i.formatValue});e(w=>r(n(n({},w),h),{prevValue:w.formatValue,eventType:"update",eventID:C(),caretFrom:Number(w.formatValue.length+1),caretTo:Number(w.formatValue.length+1),isComposing:!1}))}}))},TextAreaBox:t=>{let{rootStates:a,val_validate:l,set_validate:u,val_status:i,set_status:e,isShallow:f}=t,B=a,{componentId:g,tone:o,required:p,form:x,label:c,isLabelActive:E,minRows:L,maxRows:F,multiline:$,autoHeight:k,allowDecimals:fe,allowZeroStart:ge,enableFormSubmit:G,maxLength:xe,checkValidationAtFirst:z,onChange:A,onKeyDown:W,onValidate:X,onValidateDelay:Q,onUpdateValue:be,onUpdateValidValue:he,onUserAction:Ie,value:Se="",leftIndicator:ve,rightIndicator:Te,leftIcon:Ce,rightIcon:Re,defaultValidation:ye,wrapStyles:we}=B,m=ae(B,["componentId","tone","required","form","label","isLabelActive","minRows","maxRows","multiline","autoHeight","allowDecimals","allowZeroStart","enableFormSubmit","maxLength","checkValidationAtFirst","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","defaultValidation","wrapStyles"]);return!a.multiline?null:s(D,r(n({htmlTag:"textarea","data-show-validation":K.isShowValidation(l,i,!!z),"data-input-origin":i.componentId,"data-component-id":i.componentId,value:i.dataValue,width:1},m),{onFocus:v=>{m!=null&&m.onFocus&&(m==null||m.onFocus(v)),e(y=>r(n({},y),{eventID:C(),isFocusing:!0}))},onBlur:v=>{m!=null&&m.onBlur&&(m==null||m.onBlur(v)),e(y=>r(n({},y),{eventID:C(),isFocusing:!1}))},onCompositionStart:v=>{m!=null&&m.onCompositionStart&&(m==null||m.onCompositionStart(v)),e(y=>r(n({},y),{eventID:C(),isComposing:!0}))},onCompositionEnd:v=>{m!=null&&m.onCompositionEnd&&(m==null||m.onCompositionEnd(v)),b.interval.once(()=>{e(y=>r(n({},y),{eventID:C(),isComposing:!1}))},100,"input.textfield.composing.end")},onKeyDown:v=>{W&&W(v),G&&K.SubmitForm(v,x)},onChange:v=>{let{value:y}=v.target;l.ok&&u({ok:!1,notice:[]}),e(oe=>r(n({},oe),{dataValue:y,eventType:"update",eventID:C(),isFocusing:!0})),A&&A(v)}}))}},ze=t=>{let{componentId:a,restrict:l="text",value:u="",min:i,max:e,allowDecimals:f,allowZeroStart:g}=t,[o,p]=ie(r(n({componentId:a},T.Validation.DataLeveling({allowDecimals:f,allowZeroStart:g,min:i,max:e,restrict:l,value:u})),{prevValue:"",eventType:"init",eventID:C(),caretFrom:null,caretTo:null})),[x,c]=ie({ok:!1,notice:[]}),[E,L]=ie(["password","concealed"].includes(l)&&"password"||"text");ne(()=>{p($=>n(n({},$),T.Validation.DataLeveling({allowDecimals:f,allowZeroStart:g,min:i,max:e,restrict:l,value:u}))),ce.set({[a+":set_inputType"]:L})},[]);let F={rootStates:t,val_inputType:E,set_inputType:L,val_status:o,set_status:p,val_validate:x,set_validate:c};return K.CommonEffects({type:"textfield",states:t,val_status:o,set_status:p,val_validate:x,set_validate:c,SystemValidation:T.Validation.System,ExtraOverrideStates:()=>T.Validation.DataLeveling({allowDecimals:f,allowZeroStart:g,min:i,max:e,restrict:l,value:u})}),ne(()=>{T.setSelection({id:t.id,restrict:l,val_status:o})},[o]),Y(He,{val_status:o,set_status:p,val_validate:x,states:F.rootStates,children:[s(Be,{componentId:t.componentId,fontSize:t.fontSize,required:t.required,label:t.label,isActive:t.isLabelActive||!!o.isFocusing||!!o.dataValue}),s(T.Shallow,n({},F)),s(T.InputBox,n({},F)),s(T.TextAreaBox,n({},F))]})},R=t=>(t=n({autoHeight:!0,restrict:"text",fontSize:"inherit",value:""},t),t.value=T.Validation.DataLeveling({allowDecimals:t.allowDecimals,allowZeroStart:t.allowZeroStart,min:t.min,max:t.max,restrict:t.restrict||"text",value:t.value||""}).dataValue||"",t.multiline?(t.minRows=t.minRows||5,t.maxRows=t.maxRows||20):(t.minRows=1,t.maxRows=1),s(_e,{componentId:t.componentId,children:ze,states:Ae(t)})),S=R;S.Validate=T.Validation.Text,S.Katakana=t=>s(R,r(n({},t),{restrict:"katakana",multiline:!1,autoHeight:!1})),S.HankakuKatakana=t=>s(R,r(n({},t),{restrict:"hankaku.katakana",multiline:!1,autoHeight:!1})),S.CreditCard=t=>s(R,r(n({},t),{restrict:"creditCard",multiline:!1,autoHeight:!1})),S.Tel=t=>s(R,r(n({},t),{restrict:"tel",multiline:!1,autoHeight:!1})),S.Number=t=>s(R,r(n({},t),{restrict:"number",multiline:!1,autoHeight:!1})),S.DigitNumber=t=>s(R,r(n({},t),{restrict:"digitNumber",multiline:!1,autoHeight:!1})),S.Email=t=>s(R,r(n({},t),{restrict:"email",multiline:!1,autoHeight:!1})),S.Url=t=>s(R,r(n({},t),{restrict:"url",multiline:!1,autoHeight:!1})),S.Postal=t=>s(R,r(n({label:"\u90F5\u4FBF\u756A\u53F7"},t),{restrict:"postal",multiline:!1,autoHeight:!1,leftIcon:s(Me,{ssSphere:2,fontColor:"4.thin",children:"\u3012"})})),S.Password=t=>s(R,r(n({label:"\u30D1\u30B9\u30EF\u30FC\u30C9",rightIcon:s(me,{ssSphere:2.5,freeCSS:{pointerEvents:"all"},children:s(Ee.Sub,{ssSphere:2.5,borderRadius:"3.tone.tertiary",fontColor:"theme",flexCenter:!0,height:1,ssEffectsOnActive:["expand"],onMouseOver:a=>{pe.open(a.currentTarget,"\u30C6\u30AD\u30B9\u30C8\u3092\u8868\u793A",24)},onMouseLeave:pe.abort,tabIndex:-1,onClick:a=>{b(a.target).parent().parent().find("input").callback(l=>{let u=l[0];if(!u)return;let i=u.dataset.componentId;if(!i)return;let e=ce.get(i+":set_inputType");e&&e(f=>f==="password"&&"text"||"password")})},children:s(Ne,{icon:Le})})}),restrict:"password"},t),{multiline:!1,autoHeight:!1})),S.Concealed=t=>s(S.Password,r(n({label:"\u79D8\u5BC6\u9375"},t),{restrict:"concealed"})),S.Money={JPY:t=>s(S.DigitNumber,r(n({rightIcon:s(me,{fontColor:"4.thin",children:"\u5186"})},t),{multiline:!1,autoHeight:!1}))};export{S as TextField,ze as TextInput,S as default};
@@ -1 +1 @@
1
- import{b as n,c as d,e as _}from"../../chunk-C5N2D3ZX.js";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{useState as x,useEffect as S}from"react";import p,{UUID as v,useStore as g}from"jmini";import{$$fromRoot as D}from"../../@utils";import{InputClasses as b}from"../../@styles/componentClasses";import{Box as B,Flex as E,FAI as C,Column as F}from"../../atoms";import{Row as k,Literal as N}from"../../mols";import{Button as w}from"../Button";import R from"../Tooltips";const et=t=>{let[i]=x(t.componentId||v());t=n({},t),t.states=d(n({enableFormSubmit:!0,status_id:v(),override:"never",form:"",id:v(),"aria-label":"Input-"+i},t.states),{componentId:i});let{children:a}=t;return m(a,n({},t.states))},at=t=>{let{children:i,val_status:a,val_validate:e,states:s}=t,{leftIcon:r,wrapStyles:o}=s;return s.checkValidationAtFirst||a.eventType=="init"&&(e.notice=[]),h(k.Center,d(n({position:"relative",verticalAlign:"unset",gap:0},o),{className:b("Wrapper"),"data-notice-uid":a.componentId,children:[m(T.Notice,{notice:e.notice,val_status:a}),s.leftIndicator,h(E,{position:"relative",flexSizing:"auto",children:[i,r,m(T.RightIcon,n({},t)),m(T.ClearButton,n({},t))]}),s.rightIndicator]}))},T={ClearButton:t=>!t.states.clearButton||!t.val_status.dataValue?null:m(w.Normal,{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",right:1,top:"50%",freeCSS:{zIndex:3,transform:"translateY(-50%)"},onClick:()=>{t.set_status(i=>d(n({},i),{dataValue:"",formatValue:"",eventType:"update",eventID:v()}))},children:m(C.X,{})}),RightIcon:t=>t.states.clearButton&&t.val_status.dataValue?null:t.states.rightIcon,Notice:t=>{let{notice:i,val_status:a}=t,{componentId:e}=a,s="NoticeTimer-"+e,r="NoticeTimerClose-"+e,o="notice-tips-"+e;return S(()=>{p.interval.once(()=>{if(!i.length){R.close(o);return}R.open({tipsID:o,parent:`[data-notice-uid="${e}"]`,gravityPoint:24,padding:[1,0],closeAtParentBlur:!1,content:h(R.Body,{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative",children:[m(B,{position:"absolute",unitHeight:1,unitWidth:1,right:1,backgroundColor:"dark",freeCSS:{zIndex:1,transform:"rotate(45deg)",top:-6}}),m(F,{backgroundColor:"inherit",gap:"1/3",position:"relative",freeCSS:{zIndex:2},children:i.map((y,I)=>{let{type:l,label:u}=y,f=l=="invalid"?C.Exclamation:l=="warn"?C.Exclamation:C.Check;return h(k.Left,{gap:0,borderRadius:"2.tone.secondary",children:[m(f,{flexCenter:!0,fontSize:"2.normal",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[l]}),m(N.Supplement,{fontSize:"0.xs",fontColor:"white",children:u})]},I+"-"+p.Stringify(y))})})]})})},350,s),p.interval.once(()=>{R.close(o)},6e3,r)},[i]),null}},A={DefaultStatus:(t,i)=>({componentId:t,dataValue:i,eventType:"init",eventID:v()}),CommonEffects:function(t){let{type:i,states:a,val_status:e,set_status:s,val_validate:r,set_validate:o,SystemValidation:y}=t;a=n({},a);let{componentId:I}=e;S(()=>(g.update({[I]:{ResolveRefresh:null,Refresh:()=>new Promise((l,u)=>{g.get(I).ResolveRefresh=l,s(f=>d(n({},f),{isValidating:!0,eventType:"refresh",eventID:v()}))}),GenNotice:l=>{let{ok:u,notice:f}=l;o({ok:u,notice:f})}}}),()=>{g.delete(I)}),[]),p.scope(()=>{let{override:l}=a;if(l=="never"||l=="beforeModified"&&!["init","override"].includes(e.eventType)||e.isComposing)return;let u=g.get(e.componentId);if(!u)return;if(p.is.equal(a.value,e.dataValue)){u.status_id=a.status_id;return}let f=p.SortifyObject(a.value),c=p.SortifyObject(e.dataValue);if(f&&c&&p.is.equal(f,c)){u.status_id=a.status_id;return}a.status_id!=u.status_id&&s(V=>d(n(d(n({},V),{dataValue:a.value}),t.ExtraOverrideStates&&t.ExtraOverrideStates()),{eventType:"override",eventID:v()}))}),S(()=>{A.ValidationCheck({val_status:e,set_status:s,set_validate:o,SystemValidation:y,states:a})},[e.eventID,e.dataValue]);{let{componentId:l,eventType:u,dataValue:f}=e,c=f;i=="autocomplete.single"||i=="list.radio"?c=c[0]:a.isChecker&&(c=!!c[0]),S(()=>(p.scope(()=>{if(a.form=a.form||"testForm",a.name&&a.form&&g.update({[["form-data",a.form].join("-")]:{[a.name]:{componentId:l,type:i,value:c,validation:r.ok}}}),e.isValidating||u!="refresh")return;let V=g.get(l);V&&V.ResolveRefresh&&V.ResolveRefresh(null)}),()=>{g.update({[["form-data",a.form].join("-")]:{[a.name]:null}})}),[e,r]),S(()=>{a.onUserAction&&a.onUserAction(c,{eventType:u,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing})},[e]),S(()=>{u=="update"&&(a.onUpdateValue&&a.onUpdateValue(c,{eventType:u,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing}),a.onUpdateValidValue&&r.ok&&a.onUpdateValidValue(c,{eventType:u,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing}))},[r.ok,e.dataValue])}},ValidationCheck:t=>{let{states:i}=t,a="ValidationTimer-"+t.val_status.componentId;p.interval.abort(a),t.set_status(o=>d(n({},o),{isValidating:!0}));let e=t.SystemValidation({value:t.val_status.dataValue,states:i});if(!e.ok){t.set_validate(e),t.set_status(o=>d(n({},o),{isValidating:!1}));return}let s=e.notice;const r=()=>_(void 0,null,function*(){if(!i.onValidate)return;let o=yield i.onValidate(t.val_status.dataValue,t.val_status.eventType,t);t.set_validate({ok:o.ok,notice:[...s,...o.notice]}),t.set_status(y=>d(n({},y),{isValidating:!1}))});if(i.onValidate){if(t.val_status.eventType=="refresh"){r();return}p.interval.once(r,i.onValidateDelay||500,a);return}t.set_validate({ok:!0,notice:s}),t.set_status(o=>d(n({},o),{isValidating:!1}))},SubmitForm:(t,i)=>{let a=!1;if(!i)return a;let e=D(`[data-form-submit-button="${i}"]`)[0];if(!e)return a;let s=e.dataset.sdfike||"",r=t.key,o=t.ctrlKey||t.metaKey;return p.scope(()=>{s.includes("enter")&&(r!="Enter"||t.nativeEvent.isComposing||(t==null?void 0:t.keyCode)==229)||((r=="Enter"&&(s.includes("enter")||s.includes("auxEnter")&&o)||r==" "&&s.includes("space"))&&(e.click(),t.preventDefault()),a=!0)}),a},isShowValidation:(t,i,a)=>{let e=t.ok;return!a&&i.eventType=="init"?!0:e}},it=function(t){t=n({tone:"border"},t);let i=p.scope(()=>{if(t.tone=="plain")return{};let e={padding:1,transition:"middle",flexSizing:"auto",boxShadow:"0.min"};return t.tone=="border"?e=d(n({},e),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):t.tone=="cloud"?e=d(n({},e),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):t.tone=="bottomBorder"&&(e=d(n({},e),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),e});return d(n(n(n(n(n(n({fontColor:"2.normal"},i),!!t.rightIcon&&{paddingRight:3}),!!t.leftIcon&&{paddingLeft:3}),!!t.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!t.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),t),{freeCSS:n({letterSpacing:"1px",resize:"none"},t.freeCSS),className:[b("Input"),t.className].join(" ")})};export{at as BoxWrapper,A as CoreEffects,it as DefaultBoxishStyles,et as OptionalInputWrapper};
1
+ import{b as n,c as d,e as _}from"../../chunk-C5N2D3ZX.js";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{useState as x,useEffect as S}from"react";import p,{UUID as v,useStore as g}from"jmini";import{$$fromRoot as D}from"../../@utils";import{InputClasses as b}from"../../@styles/componentClasses";import{Box as B,Flex as E,FAI as C,Column as F}from"../../atoms";import{Row as k,Literal as N}from"../../mols";import{Button as w}from"../Button";import R from"../Tooltips";const et=t=>{let[i]=x(t.componentId||v());t=n({},t),t.states=d(n({enableFormSubmit:!0,status_id:v(),override:"never",form:"",id:v(),"aria-label":"Input-"+i},t.states),{componentId:i});let{children:a}=t;return m(a,n({},t.states))},at=t=>{let{children:i,val_status:a,val_validate:e,states:s}=t,{leftIcon:r,wrapStyles:o}=s;return s.checkValidationAtFirst||a.eventType=="init"&&(e.notice=[]),h(k.Center,d(n({position:"relative",verticalAlign:"unset",gap:0},o),{className:b("Wrapper"),"data-notice-uid":a.componentId,children:[m(T.Notice,{notice:e.notice,val_status:a}),s.leftIndicator,h(E,{position:"relative",flexSizing:"auto",children:[i,r,m(T.RightIcon,n({},t)),m(T.ClearButton,n({},t))]}),s.rightIndicator]}))},T={ClearButton:t=>!t.states.clearButton||!t.val_status.dataValue?null:m(w.Normal,{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",right:1,top:"50%",freeCSS:{zIndex:3,transform:"translateY(-50%)"},onClick:()=>{t.set_status(i=>d(n({},i),{dataValue:"",formatValue:"",eventType:"update",eventID:v()}))},children:m(C.X,{})}),RightIcon:t=>t.states.clearButton&&t.val_status.dataValue?null:t.states.rightIcon,Notice:t=>{let{notice:i,val_status:a}=t,{componentId:e}=a,s="NoticeTimer-"+e,r="NoticeTimerClose-"+e,o="notice-tips-"+e;return S(()=>{p.interval.once(()=>{if(!i.length){R.close(o);return}R.open({tipsID:o,parent:`[data-notice-uid="${e}"]`,gravityPoint:24,padding:[1,0],closeAtParentBlur:!1,content:h(R.Body,{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative",children:[m(B,{position:"absolute",unitHeight:1,unitWidth:1,right:1,backgroundColor:"dark",freeCSS:{zIndex:1,transform:"rotate(45deg)",top:-6}}),m(F,{backgroundColor:"inherit",gap:"1/3",position:"relative",freeCSS:{zIndex:2},children:i.map((y,I)=>{let{type:l,label:u}=y,f=l=="invalid"?C.Exclamation:l=="warn"?C.Exclamation:C.Check;return h(k.Left,{gap:0,borderRadius:"2.tone.secondary",children:[m(f,{flexCenter:!0,fontSize:"2.normal",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[l]}),m(N.Supplement,{fontSize:"0.xs",fontColor:"white",children:u})]},I+"-"+p.Stringify(y))})})]})})},350,s),p.interval.once(()=>{R.close(o)},6e3,r)},[i]),null}},A={DefaultStatus:(t,i)=>({componentId:t,dataValue:i,eventType:"init",eventID:v()}),CommonEffects:function(t){let{type:i,states:a,val_status:e,set_status:s,val_validate:r,set_validate:o,SystemValidation:y}=t;a=n({},a);let{componentId:I}=e;S(()=>(g.update({[I]:{ResolveRefresh:null,Refresh:()=>new Promise((l,u)=>{g.get(I).ResolveRefresh=l,s(f=>d(n({},f),{isValidating:!0,eventType:"refresh",eventID:v()}))}),GenNotice:l=>{let{ok:u,notice:f}=l;o({ok:u,notice:f})}}}),()=>{g.delete(I)}),[]),p.scope(()=>{let{override:l}=a;if(l=="never"||l=="beforeModified"&&!["init","override"].includes(e.eventType)||e.isComposing)return;let u=g.get(e.componentId);if(!u)return;if(p.is.equal(a.value,e.dataValue)){u.status_id=a.status_id;return}let f=p.SortifyObject(a.value),c=p.SortifyObject(e.dataValue);if(f&&c&&p.is.equal(f,c)){u.status_id=a.status_id;return}a.status_id!=u.status_id&&s(V=>d(n(d(n({},V),{dataValue:a.value}),t.ExtraOverrideStates&&t.ExtraOverrideStates()),{eventType:"override",eventID:v()}))}),S(()=>{A.ValidationCheck({val_status:e,set_status:s,set_validate:o,SystemValidation:y,states:a})},[e.eventID,e.dataValue]);{let{componentId:l,eventType:u,dataValue:f}=e,c=f;i=="autocomplete.single"||i=="list.radio"?c=c[0]:a.isChecker&&(c=!!c[0]),S(()=>(p.scope(()=>{if(a.form=a.form||"testForm",a.name&&a.form&&g.update({[["form-data",a.form].join("-")]:{[a.name]:{componentId:l,type:i,value:c,validation:r.ok}}}),e.isValidating||u!="refresh")return;let V=g.get(l);V&&V.ResolveRefresh&&V.ResolveRefresh(null)}),()=>{g.update({[["form-data",a.form].join("-")]:{[a.name]:null}})}),[e,r]),S(()=>{a.onUserAction&&a.onUserAction(c,{eventType:u,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing})},[e]),S(()=>{u=="update"&&(a.onUpdateValue&&a.onUpdateValue(c,{eventType:u,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing}),a.onUpdateValidValue&&r.ok&&a.onUpdateValidValue(c,{eventType:u,componentId:l,isValidated:!!r.ok,isComposing:!!e.isComposing,isFocusing:!!e.isFocusing}))},[r.ok,e.dataValue])}},ValidationCheck:t=>{let{states:i}=t,a="ValidationTimer-"+t.val_status.componentId;p.interval.abort(a),t.set_status(o=>d(n({},o),{isValidating:!0}));let e=t.SystemValidation({value:t.val_status.dataValue,states:i});if(!e.ok){t.set_validate(e),t.set_status(o=>d(n({},o),{isValidating:!1}));return}let s=e.notice;const r=()=>_(void 0,null,function*(){if(!i.onValidate)return;let o=yield i.onValidate(t.val_status.dataValue,t.val_status.eventType,t.val_status);t.set_validate({ok:o.ok,notice:[...s,...o.notice]}),t.set_status(y=>d(n({},y),{isValidating:!1}))});if(i.onValidate){if(t.val_status.eventType=="refresh"){r();return}p.interval.once(r,i.onValidateDelay||500,a);return}t.set_validate({ok:!0,notice:s}),t.set_status(o=>d(n({},o),{isValidating:!1}))},SubmitForm:(t,i)=>{let a=!1;if(!i)return a;let e=D(`[data-form-submit-button="${i}"]`)[0];if(!e)return a;let s=e.dataset.sdfike||"",r=t.key,o=t.ctrlKey||t.metaKey;return p.scope(()=>{s.includes("enter")&&(r!="Enter"||t.nativeEvent.isComposing||(t==null?void 0:t.keyCode)==229)||((r=="Enter"&&(s.includes("enter")||s.includes("auxEnter")&&o)||r==" "&&s.includes("space"))&&(e.click(),t.preventDefault()),a=!0)}),a},isShowValidation:(t,i,a)=>{let e=t.ok;return!a&&i.eventType=="init"?!0:e}},it=function(t){t=n({tone:"border"},t);let i=p.scope(()=>{if(t.tone=="plain")return{};let e={padding:1,transition:"middle",flexSizing:"auto",boxShadow:"0.min"};return t.tone=="border"?e=d(n({},e),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):t.tone=="cloud"?e=d(n({},e),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):t.tone=="bottomBorder"&&(e=d(n({},e),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),e});return d(n(n(n(n(n(n({fontColor:"2.normal"},i),!!t.rightIcon&&{paddingRight:3}),!!t.leftIcon&&{paddingLeft:3}),!!t.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!t.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),t),{freeCSS:n({letterSpacing:"1px",resize:"none"},t.freeCSS),className:[b("Input"),t.className].join(" ")})};export{at as BoxWrapper,A as CoreEffects,it as DefaultBoxishStyles,et as OptionalInputWrapper};
@@ -1,4 +1,3 @@
1
- import { KeyValueDict } from 'jmini';
2
1
  import { ReactElement, StyleTags } from '../../@declares';
3
2
  export declare namespace InputTypes {
4
3
  type BoxTone = 'border' | 'cloud' | 'bottomBorder' | 'plain';
@@ -51,7 +50,7 @@ export declare namespace InputTypes {
51
50
  value: any;
52
51
  states: any;
53
52
  }) => Result;
54
- type OnValidate<T = any> = (value: T, eventType: EventType, props: KeyValueDict) => Promise<Result>;
53
+ type OnValidate<T = any> = (value: T, eventType: EventType, opt: Status.Plain) => Promise<Result>;
55
54
  }
56
55
  namespace Status {
57
56
  type Plain<T = any> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amotify",
3
- "version": "0.2.230",
3
+ "version": "0.2.232",
4
4
  "description": "UI Component for React,NextJS,esbuild",
5
5
  "scripts": {
6
6
  "start": "run-p clean build:*",
@@ -90,7 +90,7 @@
90
90
  "@fortawesome/free-solid-svg-icons": "^6.7.2",
91
91
  "@fortawesome/react-fontawesome": "^0.2.2",
92
92
  "dotenv": "^17.0.1",
93
- "jmini": "^0.0.100",
93
+ "jmini": "^0.0.101",
94
94
  "react": "^18.3.1"
95
95
  },
96
96
  "devDependencies": {