@webority/ui-react 0.74.0 → 0.75.1
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/components/AppAutocomplete.js +1 -1
- package/dist/components/AppAvatarPicker.js +1 -1
- package/dist/components/AppColorField.js +1 -1
- package/dist/components/AppCountrySelect.js +1 -1
- package/dist/components/AppDatePicker.js +1 -1
- package/dist/components/AppDateRangePicker.js +1 -1
- package/dist/components/AppDropZone.js +1 -1
- package/dist/components/AppFileAttachment.js +1 -1
- package/dist/components/AppFilePicker.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppLogoPicker.js +1 -1
- package/dist/components/AppMentionInput.js +1 -1
- package/dist/components/AppMultiSelect.js +1 -1
- package/dist/components/AppNumberInput.js +1 -1
- package/dist/components/AppOtpInput.js +1 -1
- package/dist/components/AppPhoneNumberInput.js +1 -1
- package/dist/components/AppPopover.js +1 -1
- package/dist/components/AppRadioGroup.js +1 -1
- package/dist/components/AppRating.js +1 -1
- package/dist/components/AppRichText.js +1 -1
- package/dist/components/AppScoreScale.js +1 -1
- package/dist/components/AppSelect.js +1 -1
- package/dist/components/AppSlider.js +1 -1
- package/dist/components/AppTabs.js +1 -1
- package/dist/components/AppTagInput.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppTimePicker.js +1 -1
- package/dist/lib/CheckField.js +1 -1
- package/dist/lib/FieldMessage.js +1 -0
- package/dist/types/components/AppPopover.d.ts +1 -1
- package/dist/types/lib/FieldMessage.d.ts +19 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useNodeLabels.js";import o,{optionsEqual as s}from"./useWuiControl.js";import{forwardRef as c,useEffect as l,useId as u,useRef as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/autocomplete";var m=[`sm`,`lg`],h=[],g=(e,t)=>({...e,label:t}),_=c(function({value:c,onChange:_,options:v,loadOptions:y,placeholder:b=`Search…`,minChars:x,debounce:S,disabled:C=!1,size:w,allowCustom:T=!1,name:E,id:D,label:O,error:k,hint:A,required:j=!1,help:M,helpLabel:N=`More information`,fieldClassName:P=``,...F},I){t(`AppAutocomplete`,F),e(`AppAutocomplete`,`size`,w,m);let L=typeof y==`function`,R=u(),z=D||R,{setRef:B,innerRef:V}=o({ref:I,value:c??``,on:{change:e=>_?.(e.currentTarget.value,{isCustom:!!e.detail?.isCustom})}}),H=v||h,{portal:U,toElementOptions:W}=a(H),G=d(!1);return l(()=>{let e=V.current;if(!e||L&&G.current)return;let t=W(H,g);s(t,e.options)||(e.options=t)},[H,L,V,W]),l(()=>{let e=V.current;if(!e||!L)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await y(r.detail.query,{signal:n?.signal});i===t&&(G.current=!0,e.options=a||[])}catch{i===t&&(G.current=!0,e.options=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[L,y,V]),p(`div`,{className:`field${P?` ${P}`:``}`,children:[O&&p(`label`,{className:`label`,htmlFor:z,children:[O,j&&f(i,{}),M&&f(r,{label:N,children:M})]}),f(`wui-autocomplete`,{"aria-label":typeof O==`string`?O:void 0,"aria-describedby":k?`${z}-error`:A?`${z}-hint`:void 0,"aria-invalid":k?`true`:void 0,id:z,ref:B,name:E,placeholder:b,remote:L?``:void 0,"min-chars":x==null?void 0:String(x),debounce:S==null?void 0:String(S),size:w||void 0,"allow-custom":T?``:void 0,disabled:C?``:void 0,required:j?``:void 0,...F}),U,f(n,{error:k,hint:A,errorId:`${z}-error`,hintId:`${z}-hint`})]})});export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppAlert.js";import i from"./AppButton.js";import ee from"./AppRequiredMark.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppAlert.js";import i from"./AppButton.js";import ee from"../lib/FieldMessage.js";import te from"./AppRequiredMark.js";import ne from"./AppModal.js";import{AVATAR_ACCEPT as re,AVATAR_MAX_SIZE_MB as ie,AVATAR_OUTPUT_SIZE as ae,AVATAR_PREVIEW_SIZES as a,AVATAR_TEXT as o,avatarCropOptions as oe,avatarUnreadableMessage as se,validateFile as ce}from"@webority/ui-elements/helpers";import{useCallback as le,useEffect as s,useId as ue,useRef as c,useState as l}from"react";import{Fragment as de,jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/image-crop";var f={sm:64,md:96,lg:128},fe=a.join(` `);function p({value:a,initials:p,onPick:pe,onRemove:m,name:h,removeName:g,accept:_=re,maxSizeMb:me=ie,outputSize:he=ae,size:v=`md`,label:y,hint:b,error:ge,required:_e=!1,loading:x=!1,disabled:ve=!1,ariaLabel:ye,className:S=``,fieldClassName:C=``,style:be,...w}){t(`AppAvatarPicker`,w),e(`AppAvatarPicker`,`size`,typeof v==`string`?v:null,Object.keys(f));let T=ue(),E=c(null),D=c(null),O=c(null),[k,A]=l(null),[j,M]=l(!1),[xe,N]=l(!1),[Se,P]=l(``),[F,I]=l(!1),[L,R]=l(null),[z,B]=l(`loading`),[V,H]=l(``),[U,W]=l(!1),Ce=le(e=>{if(O.current=e,!e)return;let t=()=>{B(`ready`),e.querySelector(`.wui-crop-stage`)?.focus()},n=()=>B(`error`);return e.addEventListener(`load`,t),e.addEventListener(`error`,n),()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),O.current=null}},[]);s(()=>()=>L&&URL.revokeObjectURL(L.url),[L]),s(()=>()=>k&&URL.revokeObjectURL(k),[k]),s(()=>{A(null),M(!1),N(!1)},[a]);let G=x||ve,K=j?null:k||(a&&!xe?a:null),q=!!K,we=!G&&q&&!!(m||g),J=ge||Se,Y=b&&!J?`${T}-hint`:void 0,X=J?`${T}-error`:void 0,Z=X||Y,Q=q?o.change:o.choose,$=typeof v==`number`?v:f[v]??f.md,Te=()=>{G||E.current?.click()},Ee=()=>{G||D.current?.click()},De=e=>{let t=ce(e,{accept:_,maxSizeMb:me});if(t){P(t);return}P(``),B(`loading`),H(``),R({file:e,url:URL.createObjectURL(e)})},Oe=e=>{let t=e.target.files?.[0];e.target.value=``,t&&De(t)},ke=e=>{if(e.preventDefault(),I(!1),G)return;let t=e.dataTransfer?.files?.[0];t&&De(t)},Ae=e=>{if(h&&E.current&&typeof DataTransfer==`function`){let t=new DataTransfer;t.items.add(e),E.current.files=t.files}M(!1),N(!1),A(URL.createObjectURL(e)),pe(e)},je=async()=>{let{file:e}=L;W(!0),H(``);let t=null;try{t=await O.current?.toFile(oe(e,he))}catch{t=null}if(W(!1),!t){H(o.cropFailed);return}R(null),Ae(t)},Me=()=>{U||R(null)},Ne=()=>{A(null),M(!0),P(``),E.current&&(E.current.value=``),m?.()};return d(`div`,{className:`field wui-avatar-picker-field${C?` ${C}`:``}`,children:[y&&d(`label`,{className:`label`,htmlFor:T,children:[y,_e&&u(te,{})]}),d(`div`,{className:`wui-avatar-picker${F?` is-dragging`:``}${S?` ${S}`:``}`,style:{"--wui-avatar-size":`${$}px`,...be},onDragOver:e=>{e.preventDefault(),!G&&!F&&I(!0)},onDragLeave:()=>I(!1),onDrop:ke,children:[d(`button`,{type:`button`,className:`wui-avatar-picker-face`,tabIndex:-1,"aria-label":ye||Q,"aria-describedby":Z,"aria-busy":x||void 0,disabled:G,onClick:Te,...w,children:[K?u(`img`,{className:`wui-avatar-picker-img`,src:K,alt:``,onError:()=>N(!0)}):u(`span`,{className:`wui-avatar-picker-placeholder`,"aria-hidden":`true`,children:p||u(n,{name:`user`,size:Math.round($*.5)})}),u(`span`,{className:`wui-avatar-picker-badge`,"aria-hidden":`true`,children:x?u(n,{name:`refresh-cw`,size:14,className:`wui-spin`}):u(n,{name:`camera`,size:14})})]}),d(`div`,{className:`wui-avatar-picker-actions`,children:[u(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,disabled:G,"aria-describedby":Z,onClick:Te,children:Q}),d(`button`,{type:`button`,className:`btn btn-secondary btn-sm wui-avatar-picker-camera`,disabled:G,onClick:Ee,children:[u(n,{name:`camera`,size:16}),o.camera]}),u(`button`,{type:`button`,className:`btn btn-secondary-danger btn-sm`,hidden:!we,onClick:Ne,children:o.remove})]}),u(`input`,{id:T,ref:E,type:`file`,name:h,hidden:!0,accept:_,disabled:G,onChange:Oe}),u(`input`,{ref:D,type:`file`,hidden:!0,accept:`image/*`,capture:`user`,disabled:G,onChange:Oe}),g&&u(`input`,{type:`hidden`,name:g,value:`true`,disabled:!j})]}),u(ee,{error:J,hint:b,errorId:X,hintId:Y}),d(ne,{open:!!L,title:o.dialogTitle,subtitle:o.dialogSubtitle,dismissible:!U,staticBackdrop:U,onClose:Me,footer:d(de,{children:[u(i,{type:`button`,variant:`secondary`,disabled:U,onClick:Me,children:o.cancel}),u(i,{type:`button`,variant:`primary`,loading:U,disabled:z!==`ready`,onClick:je,children:o.save})]}),children:[z===`error`&&L&&u(r,{variant:`danger`,children:se(L.file)}),V&&u(r,{variant:`danger`,children:V}),L&&z!==`error`&&u(`wui-image-crop`,{ref:Ce,src:L.url,aspect:`1`,round:!0,rotatable:!0,previews:fe})]})]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppRequiredMark.js";import{useId as
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppRequiredMark.js";import{useId as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=[`sm`,`md`,`lg`];function c({value:c=`#000000`,onChange:l,label:u,required:d=!1,error:f,hint:p,name:m,id:h,disabled:g=!1,size:_=`md`,className:v=``,fieldClassName:y=``,...b}){t(`AppColorField`,b),e(`AppColorField`,`size`,_,s);let x=i(),S=h||x,C=f?`${S}-error`:p?`${S}-hint`:void 0,w=e=>/^#[0-9a-f]{6}$/i.test(e),T=_===`sm`?` color-field-sm`:_===`lg`?` color-field-lg`:``,E=_===`sm`?` input-sm`:_===`lg`?` input-lg`:``;return o(`div`,{className:`field${y?` ${y}`:``}`,children:[u&&o(`label`,{className:`label`,htmlFor:S,children:[u,d&&a(r,{})]}),o(`div`,{className:`color-field${T}`,children:[a(`input`,{type:`color`,className:`color-field-swatch`,value:w(c)?c:`#000000`,onChange:e=>l?.(e.target.value),disabled:g,"aria-label":`${u||`Colour`}, colour picker`,tabIndex:-1}),a(`input`,{type:`text`,className:`input color-field-hex${E}${f?` error`:``}${v?` ${v}`:``}`,id:S,name:m,value:c,onChange:e=>l?.(e.target.value),placeholder:`#4F46E5`,spellCheck:!1,maxLength:7,required:d,disabled:g,"aria-invalid":f?`true`:`false`,"aria-describedby":C,...b})]}),a(n,{error:f,hint:p,errorId:`${S}-error`,hintId:`${S}-hint`})]})}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{forwardRef as o,useId as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/country-select";var u=[`sm`,`md`,`lg`],d=o(function({value:o,onChange:d,countries:f,placeholder:p=`Select country`,searchPlaceholder:m=`Search countries...`,searchable:h=!0,clearable:g=!1,size:_=`md`,floatingLabel:v=!1,disabled:y,label:b,required:x=!1,error:S,hint:C,help:w,helpLabel:T=`More information`,id:E,name:D,className:O=``,fieldClassName:k=``,"aria-label":A,"aria-labelledby":j,"aria-describedby":M,...N},P){t(`AppCountrySelect`,N),e(`AppCountrySelect`,`size`,_,u);let F=s(),{setRef:I}=a({ref:P,value:o??``,onChange:d}),L=E||F,R=v&&b,z=S&&L?`${L}-error`:void 0,B=C&&L?`${L}-hint`:void 0,V=c(`wui-country-select`,{"aria-label":A||(typeof b==`string`?b:void 0),"aria-labelledby":j||void 0,"aria-describedby":z||B||M||void 0,"aria-invalid":S?`true`:void 0,ref:I,id:L,name:D,countries:Array.isArray(f)?f.join(`,`):void 0,placeholder:R?` `:p,"search-placeholder":m,searchable:h?``:void 0,clearable:g?``:void 0,size:_===`sm`||_===`lg`?_:void 0,disabled:y?``:void 0,required:x?``:void 0,className:O||void 0,...N});return!b&&!S&&!C?V:l(`div`,{className:[`field`,k].filter(Boolean).join(` `),children:[b&&!R&&l(`label`,{className:`label`,htmlFor:L,children:[b,x&&c(i,{}),w&&c(r,{label:T,children:w})]}),R?l(`div`,{className:`field-float`,children:[V,l(`label`,{className:`float-label`,htmlFor:L,children:[b,x&&c(i,{})]})]}):V,c(n,{error:S,hint:C,errorId:z,hintId:B})]})});export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppRequiredMark.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppRequiredMark.js";import i from"./useWuiControl.js";import{forwardRef as a,useId as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/datepicker";var l=[`sm`,`md`,`lg`],u=a(function({value:a,onChange:u,label:d,required:f=!1,hint:p,error:m,name:h,min:g,max:_,placeholder:v=`Choose a date`,disabled:y,size:b,firstDay:x,displayFormat:S,id:C,ariaLabel:w,className:T=``,fieldClassName:E=``,...D},O){t(`AppDatePicker`,D),e(`AppDatePicker`,`size`,b,l);let k=o(),A=C||k,{setRef:j}=i({ref:O,value:a??``,onChange:u}),M=!d&&!m&&!p,N=m?`${A}-error`:void 0,P=p?`${A}-hint`:void 0,F=s(`wui-datepicker`,{ref:j,id:A,name:h,min:g,max:_,placeholder:v,size:b||void 0,"first-day":x==null?void 0:String(x),"display-format":S||void 0,"aria-label":w||(typeof d==`string`?d:void 0),"aria-describedby":N||P,"aria-invalid":m?`true`:void 0,disabled:y?``:void 0,required:f?``:void 0,className:T||void 0,...D});return M?F:c(`div`,{className:`field${E?` ${E}`:``}`,children:[d&&c(`label`,{className:`label`,htmlFor:A,children:[d,f&&s(r,{})]}),F,s(n,{error:m,hint:p,errorId:N,hintId:P})]})});export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppRequiredMark.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppRequiredMark.js";import i from"./useWuiControl.js";import{forwardRef as a,useEffect as o,useId as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/date-range";var u=[`sm`,`md`,`lg`],d=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)},f=a(function({start:a,end:f,onChange:p,label:m,required:h=!1,hint:g,error:_,startName:v,endName:y,min:b,max:x,placeholder:S=`Start to End`,disabled:C,size:w,firstDay:T,presets:E,id:D,ariaLabel:O,className:k=``,fieldClassName:A=``,...j},M){t(`AppDateRangePicker`,j),e(`AppDateRangePicker`,`size`,w,u);let N=s(),P=D||N,{setRef:F,innerRef:I}=i({ref:M,onChange:p});o(()=>{let e=I.current;if(!e)return;let t=a===void 0?e.value.start:a,n=f===void 0?e.value.end:f;(e.value.start!==t||e.value.end!==n)&&(e.value={start:t,end:n})},[a,f,I]);let L=!m&&!_&&!g,R=_?`${P}-error`:void 0,z=g?`${P}-hint`:void 0,B=R||z,V=c(`wui-date-range`,{ref:F,id:P,"start-name":v,"end-name":y,min:b,max:x,placeholder:S,size:w||void 0,"first-day":T==null?void 0:String(T),presets:d(E),"aria-label":O||(typeof m==`string`?m:void 0),"aria-describedby":B,"aria-invalid":_?`true`:void 0,disabled:C?``:void 0,required:h?``:void 0,className:k||void 0,...j});return L?V:l(`div`,{className:`field${A?` ${A}`:``}`,children:[m&&l(`label`,{className:`label`,htmlFor:P,children:[m,h&&c(r,{})]}),V,c(n,{error:_,hint:g,errorId:R,hintId:z})]})});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnUnknownProps.js";import t from"./AppIcon.js";import{DEFAULT_MAX_SIZE_MB as
|
|
1
|
+
import e from"./warnUnknownProps.js";import t from"./AppIcon.js";import n from"../lib/FieldMessage.js";import{DEFAULT_MAX_SIZE_MB as r,acceptLabel as i,validateFile as a}from"@webority/ui-elements/helpers";import{useId as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";function u({label:u,id:d,onChange:f,multiple:p=!1,accept:m=``,maxSizeMb:h=r,error:g,hint:_,disabled:v=!1,className:y=``,fieldClassName:b=``,style:x,...S}){e(`AppDropZone`,S);let[C,w]=s(!1),[T,E]=s(``),D=o(),O=d||D,k=g||T,A=k?`${O}-error`:void 0,j=_&&!k?`${O}-hint`:void 0,M=A||j,N=m?i(m):`Any file type`,P=e=>{let t=Array.from(e||[]);if(!t.length)return;if(!p){let e=a(t[0],{accept:m,maxSizeMb:h});E(e||``),e||f(t[0]);return}let n=``,r=[];for(let e of t){let t=a(e,{accept:m,maxSizeMb:h});if(t){n||=t;continue}r.push(e)}E(n),r.length&&f(r)};return l(`div`,{className:`field${b?` ${b}`:``}`,children:[u?c(`label`,{className:`label`,htmlFor:O,children:u}):null,l(`div`,{className:`file-input file-input-tall${C?` dragging`:``}${k?` error`:``}${y?` ${y}`:``}`,style:x,"aria-disabled":v||void 0,onDragOver:e=>{e.preventDefault(),!v&&!C&&w(!0)},onDragLeave:e=>{e.preventDefault(),w(!1)},onDrop:e=>{e.preventDefault(),w(!1),v||P(e.dataTransfer.files)},children:[l(`label`,{htmlFor:O,className:`file-input-zone-label`,children:[c(`span`,{className:`file-input-icon`,children:c(t,{name:`upload`,size:24})}),l(`span`,{className:`file-input-title`,children:[c(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),c(`span`,{className:`file-input-text`,children:h>0?`${N}, up to ${h} MB`:N})]}),c(`input`,{id:O,type:`file`,"aria-describedby":M,accept:m,multiple:p||void 0,disabled:v||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:e=>P(e.target.files),...S})]}),c(n,{error:k,hint:_,errorId:A,hintId:j})]})}export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnUnknownProps.js";import t from"./AppIcon.js";import{keyOf as
|
|
1
|
+
import e from"./warnUnknownProps.js";import t from"./AppIcon.js";import n from"../lib/FieldMessage.js";import{keyOf as r,nameOf as i,sizeLabelOf as a,useItemUrl as o}from"../lib/fileItem.js";import s from"../lib/FileItemRow.js";import{DEFAULT_IMAGE_ACCEPT as c,DEFAULT_MAX_SIZE_MB as l,acceptLabel as u,isImageFile as d,isImageOnlyAccept as f,validateFile as p}from"@webority/ui-elements/helpers";import{useId as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";function y({label:i=`Attachment`,value:a,name:o,onChange:u,multiple:y=!1,accept:S=c,maxSizeMb:C=l,optional:w=!1,validate:T=!0,error:E,id:D,...O}){e(`AppFileAttachment`,O);let k=m(),A=D||k,[j,M]=h(``),N=y&&Array.isArray(a)?a:a?[a]:[],P=f(S),F=e=>e instanceof File?d(e):P||d(e),I=!y&&N.length===1&&F(N[0]),L=b(S,C);function R(e){let t=Array.from(e.target.files||[]);if(e.target.value=``,!t.length)return;let n=[],i=``;for(let e of t){let t=T?p(e,{accept:S,maxSizeMb:C}):null;if(t){i||=t;continue}n.push(e)}if(M(i),n.length)if(y){let e=Array.isArray(a)?a:a?[a]:[],t=new Set(e.map(r));u(e.concat(n.filter(e=>!t.has(r(e)))))}else u(n[0])}function z(e){M(``),u(y?N.filter((t,n)=>n!==e):null)}let B=E||j,V=B?`${A}-error`:void 0,H=y||N.length===0,U=P?`image`:`file`,W=y?`Add ${U}s`:`Add ${P?`an`:`a`} ${U}`;return v(`div`,{className:`field`,children:[v(`label`,{className:`label`,htmlFor:A,children:[i,w&&_(`span`,{className:`label-optional`,children:` (optional)`})]}),H&&v(g,{children:[v(`label`,{className:`attach-drop`,htmlFor:A,children:[_(`span`,{className:`attach-drop-icon`,children:_(t,{name:P?`image`:`file-text`,size:18})}),v(`span`,{className:`attach-drop-copy`,children:[_(`span`,{className:`attach-drop-title`,children:W}),L&&_(`span`,{className:`attach-drop-hint`,children:L})]}),_(`span`,{className:`attach-drop-cta`,children:`Browse`})]}),_(`input`,{id:A,type:`file`,className:`visually-hidden`,name:o,accept:S||void 0,multiple:y||void 0,"aria-describedby":V,onChange:R,...O})]}),I?_(x,{item:N[0],isImage:!0,onRemove:()=>z(0)}):N.length>0&&_(`div`,{className:`attach-list`,children:N.map((e,t)=>_(s,{item:e,isImage:F(e),onRemove:()=>z(t)},r(e)))}),_(n,{error:B,errorId:`${A}-error`})]})}function b(e,t){let n=e?.trim()?u(e):``,r=t>0?`up to ${t} MB`:``;return n&&r?`${n}, ${r}`:r?`Up to ${t} MB`:n}function x({item:e,isImage:n,onRemove:r}){let s=o(e,n),c=i(e),l=a(e);return v(`div`,{className:`attach-preview`,children:[v(`div`,{className:`attach-figure`,children:[_(`img`,{src:s,alt:c}),_(`button`,{type:`button`,className:`attach-remove`,"aria-label":`Remove attachment`,onClick:r,children:_(t,{name:`x`,size:18})})]}),v(`div`,{className:`attach-meta`,children:[_(`div`,{className:`attach-name`,children:c}),l&&_(`div`,{className:`attach-size`,children:l})]})]})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnUnknownProps.js";import t from"./withTooltip.js";import n from"./AppIcon.js";import r from"./AppRequiredMark.js";import{keyOf as
|
|
1
|
+
import e from"./warnUnknownProps.js";import t from"./withTooltip.js";import n from"./AppIcon.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import{keyOf as a}from"../lib/fileItem.js";import o from"../lib/FileItemRow.js";import{DEFAULT_MAX_SIZE_MB as s,acceptLabel as c,isImageFile as l,isImageOnlyAccept as ee,isPdfFile as te,validateFile as u}from"@webority/ui-elements/helpers";import{useEffect as d,useId as ne,useRef as re,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";function h({label:h,value:g,name:_,id:ie,onPick:v,multiple:y=!1,maxFiles:b,accept:x=`.jpg,.jpeg,.png`,maxSizeMb:S=s,required:ae,error:oe,hint:C,loading:w=!1,className:T=``,fieldClassName:E=``,style:D,...O}){e(`AppFilePicker`,O);let[k,A]=f(null),[se,j]=f(null),[M,N]=f(!1),[P,F]=f(``),I=re(null),ce=ne(),L=ie||ce;d(()=>{if(!y&&g instanceof File&&l(g)){let e=URL.createObjectURL(g);return A(e),()=>URL.revokeObjectURL(e)}A(null)},[g,y]);let R=!y&&g&&!l(g)&&te(g)?g instanceof File?g:g.url:null;d(()=>{if(!R){j(null);return}let e=!0,t=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof R==`string`?{url:R}:R)).then(n=>{e&&(t=URL.createObjectURL(n),j(t))}).catch(e=>console.warn(`[AppFilePicker] the PDF preview failed:`,e?.message)),()=>{e=!1,j(null),t&&URL.revokeObjectURL(t)}},[R]);let z=y?Array.isArray(g)?g:g?[g]:[]:[],B=oe||P,V=B?`${L}-error`:void 0,H=C&&!B?`${L}-hint`:void 0,U=V||H,W=ee(x),G=!y&&!!g,K=G&&(g instanceof File?l(g):W||l(g)),le=g?.name,q=K?g?.url||k:se,J=K?`image`:`file`,ue=h?`Change ${h}`:`Change ${J}`,Y=h?`Remove ${h}`:`Remove ${J}`,de=h?`${h} preview`:`Selected ${J} preview`,X=e=>{let t=u(e,{accept:x,maxSizeMb:S});return t?(F(t),!1):(F(``),v(e),!0)},Z=e=>{let t=Array.from(e||[]);if(!t.length)return;let n=Array.isArray(g)?g:g?[g]:[],r=new Set(n.map(a)),i=``,o=[];for(let e of t){let t=u(e,{accept:x,maxSizeMb:S});if(t){i||=t;continue}r.has(a(e))||(r.add(a(e)),o.push(e))}let s=n.concat(o);b&&s.length>b&&(s=s.slice(0,b),i||=`Up to ${b} files.`),F(i),v(s)},fe=e=>{if(y){Z(e.target.files);return}let t=e.target.files?.[0]||null;t&&(X(t)||(e.target.value=``))},pe=e=>{if(e.preventDefault(),N(!1),w)return;if(y){Z(e.dataTransfer.files);return}let t=e.dataTransfer.files?.[0];t&&X(t)},me=e=>{F(``),v(z.filter((t,n)=>n!==e))},he=()=>I.current?.click(),Q=w?p(`span`,{className:`wui-file-busy`,children:p(`span`,{className:`spinner-border spinner-border-sm`,role:`status`,"aria-label":`Loading`})}):null,$=p(`input`,{id:L,name:_,ref:I,type:`file`,"aria-describedby":U,accept:x,multiple:y||void 0,disabled:w||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:fe,...O});return m(`div`,{className:`field${E?` ${E}`:``}`,children:[m(`label`,{className:`label`,htmlFor:L,children:[h,ae&&p(i,{})]}),G?m(`div`,{className:`file-preview${B?` error`:``}${T?` ${T}`:``}`,style:D,"aria-busy":w||void 0,children:[m(`button`,{type:`button`,className:`file-preview-open`,"aria-label":ue,onClick:he,disabled:w,children:[q?p(`img`,{src:q,alt:de,className:`file-preview-img`}):m(`span`,{className:`file-preview-file`,children:[p(n,{name:`file-text`,size:28}),p(`span`,{className:`file-preview-file-name`,children:le})]}),p(`span`,{className:`file-preview-overlay`,children:m(`span`,{className:`file-preview-cta`,children:[p(n,{name:K?`image`:`file-text`,size:16}),` `,K?`Change image`:`Change file`]})})]}),t(p(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":Y,onClick:()=>v(null),disabled:w,children:p(n,{name:`x`,size:16})}),Y),$,Q]}):m(`div`,{className:`file-input file-input-tall${M?` dragging`:``}${B?` error`:``}${y&&z.length>0?` has-files`:``}${T?` ${T}`:``}`,style:D,"aria-busy":w||void 0,onDragOver:e=>{e.preventDefault(),!w&&!M&&N(!0)},onDragLeave:e=>{e.preventDefault(),N(!1)},onDrop:pe,children:[m(`label`,{htmlFor:L,className:`file-input-zone-label`,children:[p(`span`,{className:`file-input-icon`,children:p(n,{name:`upload`,size:24})}),m(`span`,{className:`file-input-title`,children:[p(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),p(`span`,{className:`file-input-text`,children:S>0?`${c(x)}, up to ${S} MB`:c(x)})]}),$,Q,y&&z.length>0&&p(`div`,{className:`attach-list`,children:z.map((e,t)=>p(o,{item:e,isImage:e instanceof File?l(e):W||l(e),noun:`file`,onRemove:()=>me(t)},a(e)))})]}),p(r,{error:B,hint:C,errorId:V,hintId:H})]})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import ee from"../lib/FieldMessage.js";import te from"./AppPopover.js";import ne from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import{MASK_INPUT_TYPES as re,MASK_NAMES as ie,attachInputMask as ae,evaluatePassword as oe,formatMasked as i,isMaskPattern as se,postedMasked as ce}from"@webority/ui-elements/helpers";import{forwardRef as a,useEffect as o,useId as le,useRef as s,useState as c}from"react";import{Form as l}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";var ue=[`sm`,`md`,`lg`],de=[`bare`],f=a(function({label:a,required:f=!1,error:fe,hint:p,help:m,helpLabel:pe=`More information`,type:h=`text`,size:g=`md`,leftIcon:_,rightIcon:v,onRightIconClick:y,rightIconLabel:me,unit:b,id:he,name:ge,className:_e=``,fieldClassName:ve=``,disabled:x=!1,clearable:S=!1,showCount:C=!1,maxLength:w,prefix:T,suffix:E,action:D,floatingLabel:O=!1,variant:k,passwordRequirements:A=!1,requirementsPlacement:j=`auto`,mask:M,postFormatted:N=!1,onMaskChange:P,...F},I){t(`AppInput`,F),e(`AppInput`,`size`,g,ue),e(`AppInput`,`variant`,k,de),M!=null&&!se(M)&&e(`AppInput`,`mask`,M,ie),M!=null&&e(`AppInput`,`type`,h,re);let[L,ye]=c(!1),[be,xe]=c(``),R=fe||be,Se=le(),z=he||Se,B=h===`password`,Ce=B&&L?`text`:h,V=s(null),we=e=>{V.current=e,typeof I==`function`?I(e):I&&(I.current=e)},H=String(F.value??F.defaultValue??``),[Te,U]=c(()=>!!H),[W,G]=c(()=>H.length),K=S&&!x,q=S||C,J=B&&!!A,[Ee,De]=c(H);o(()=>{!J||F.value===void 0||De(String(F.value??``))},[F.value,J]),o(()=>{if(!q||F.value===void 0)return;let e=String(F.value??``);U(!!e),G(e.length)},[F.value,q]);let Oe=e=>{U(!!e.target.value),G(e.target.value.length),F.onInput?.(e)},ke=e=>{J&&De(e.target.value),q?Oe(e):F.onInput?.(e)},Ae=M?{...F.value!==void 0&&{value:i(M,F.value)},...F.defaultValue!==void 0&&{defaultValue:i(M,F.defaultValue)}}:null,je=s(P);je.current=P,o(()=>{let e=V.current;if(!(!M||!e))return ae(e,{mask:M,postFormatted:N,onChange:(e,t)=>je.current?.(e,t),onInvalidChange:xe})},[M,N]);let Y=e=>M&&!N&&e?t=>{let n=t.target,ee=new Proxy(n,{get:(e,t)=>{if(t===`value`)return ce(M,e.value);let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}});e(Object.create(t,{target:{value:ee}}))}:e,Me=K?u(`button`,{type:`button`,className:`input-clear`,onClick:()=>{let e=V.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;t?t.call(e,``):e.value=``,e.dispatchEvent(new Event(`input`,{bubbles:!0})),U(!1),e.focus()},"aria-label":`Clear`,tabIndex:-1,hidden:!Te,children:u(n,{name:`x`,size:16})}):null,Ne=R&&z?`${z}-error`:void 0,Pe=p&&z?`${z}-hint`:void 0,X=J&&j===`inline`,Fe=X&&z?`${z}-requirements`:void 0,Ie=Ne||(X?Fe:Pe),Le=[`input`,g===`sm`?`input-sm`:``,g===`lg`?`input-lg`:``,R?`error`:``,B?`pw`:``,b?`num-input`:``,!(O&&a||T||E||b||B||v)&&S&&K?`has-clear`:``,k===`bare`?`input-bare`:``,_e].filter(Boolean).join(` `),Z=u(l.Control,{id:z,name:ge,type:Ce,className:Le,disabled:x,required:f,"aria-invalid":R?`true`:`false`,"aria-describedby":Ie,maxLength:w,...F,onChange:Y(F.onChange),onBlur:Y(F.onBlur),...Ae,placeholder:O?` `:F.placeholder,ref:we,onInput:q||J?ke:F.onInput}),Q=A===!0||A,Re=Q&&typeof Q==`object`&&Q.title||`Password requirements`,ze=J?oe(Ee,Q):null,Be=J?u(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:Fe,"aria-label":X?Re:void 0,children:ze.map(e=>d(`li`,{className:`pw-rule ${e.met?`met`:`unmet`}`,children:[u(`span`,{className:`pw-mark`,"aria-hidden":`true`}),u(`span`,{className:`pw-rule-text`,children:e.label}),u(`span`,{className:`visually-hidden`,children:e.met?`: met`:`: not met`})]},e.key))}):null,$;if(O&&a)$=d(`div`,{className:`field-float`,children:[Z,d(`label`,{className:`float-label`,htmlFor:z,children:[a,f&&u(r,{})]})]});else if(D)$=d(`div`,{className:`input-action-row`,children:[d(`div`,{className:_?`input-icon`:`input-wrap`,children:[_&&u(`span`,{className:`ic`,children:u(n,{name:_,size:16})}),Z]}),u(`div`,{className:`input-action`,children:D})]});else if(T||E)$=d(`div`,{className:`input-affixed`,children:[T!=null&&u(`span`,{className:`affix affix-pre`,children:T}),Z,E!=null&&u(`span`,{className:`affix affix-suf`,children:E})]});else if(b)$=d(`div`,{className:`input-with-unit`,children:[Z,u(`span`,{className:`unit`,children:b})]});else if(B){let e=d(`div`,{className:_?`input-icon`:`input-wrap`,children:[_&&u(`span`,{className:`ic`,children:u(n,{name:_,size:16})}),Z,d(`button`,{type:`button`,className:`pw-toggle${L?` pw-revealed`:``}`,onClick:()=>ye(e=>!e),"aria-label":L?`Hide password`:`Show password`,tabIndex:-1,children:[u(n,{name:`eye`,size:18,className:`pw-eye`}),u(n,{name:`eye-off`,size:18,className:`pw-eye-off`})]})]});$=J&&!X?u(te,{trigger:e,triggerType:`focus`,placement:j,title:Re,className:`pw-popover`,children:Be}):e}else $=v?d(`div`,{className:`input-wrap`,children:[Z,u(`button`,{type:`button`,className:`pw-toggle`,onClick:y,disabled:!y,tabIndex:-1,"aria-label":me||v,children:u(n,{name:v,size:18})})]}):S?d(`div`,{className:_?`input-icon`:`input-wrap`,children:[_&&u(`span`,{className:`ic`,children:u(n,{name:_,size:16})}),Z,Me]}):_?d(`div`,{className:`input-icon`,children:[u(`span`,{className:`ic`,children:u(n,{name:_,size:16})}),Z]}):Z;return d(l.Group,{className:`field${ve?` ${ve}`:``}`,children:[a&&!O&&d(l.Label,{className:`label`,htmlFor:z,children:[a,f&&u(r,{}),m&&u(ne,{label:pe,children:m})]}),$,X&&u(`div`,{className:`wui-pw-inline`,children:Be}),u(ee,{error:R,hint:X?null:p,errorId:Ne,hintId:Pe}),C&&d(`div`,{className:`field-count${w&&W>=w?` at-limit`:``}`,children:[W,w?` / ${w}`:``]})]})});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./withTooltip.js";import r from"./AppIcon.js";import i from"./AppAlert.js";import a from"./AppButton.js";import ee from"./AppRequiredMark.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./withTooltip.js";import r from"./AppIcon.js";import i from"./AppAlert.js";import a from"./AppButton.js";import ee from"../lib/FieldMessage.js";import te from"./AppRequiredMark.js";import ne from"./AppModal.js";import{DEFAULT_MAX_SIZE_MB as re,validateFile as o}from"@webority/ui-elements/helpers";import{useCallback as ie,useEffect as s,useId as ae,useRef as c,useState as l}from"react";import{Fragment as oe,jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/image-crop";var se=[`stacked`,`inline`,`profile`],ce=[`initials`,`avatar`],le=[`circle`,`rounded`,`square`],f={sm:72,md:120,lg:160},ue=`That image could not be cropped. Choose another one.`,de=`That image could not be opened. Choose another one.`;function p({value:p,fallback:fe,name:pe,onPick:me,onRemove:m,loading:h=!1,disabled:g=!1,accept:_=`image/png,image/jpeg,image/webp`,maxSizeMb:v=re,crop:y,overlayIcon:he=`image`,overlayLabel:b=`Update photo`,ariaLabel:ge=`Upload photo`,removeLabel:_e=`Remove photo`,label:ve,hint:x,error:ye,layout:S=`stacked`,title:C,subtitle:w,required:be=!1,variant:T=`initials`,size:E=`md`,shape:D=`circle`,className:O=``,...k}){t(`AppLogoPicker`,k),e(`AppLogoPicker`,`layout`,S,se),e(`AppLogoPicker`,`variant`,T,ce),e(`AppLogoPicker`,`shape`,D,le),e(`AppLogoPicker`,`size`,typeof E==`string`?E:null,Object.keys(f));let A=y===`free`?null:typeof y==`number`&&Number.isFinite(y)&&y>0?y:void 0;y!=null&&A===void 0&&e(`AppLogoPicker`,`crop`,String(y),[`free`,`a positive number`]);let j=c(null),M=c(null),N=ae(),[P,F]=l(null),[xe,I]=l(``),[Se,L]=l(!1),[R,z]=l(!1),[B,V]=l(null),[H,U]=l(!1),[W,G]=l(`loading`),[K,q]=l(``),Ce=ie(e=>{if(M.current=e,!e)return;let t=()=>G(`ready`),n=()=>G(`error`);return e.addEventListener(`load`,t),e.addEventListener(`error`,n),()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),M.current=null}},[]);s(()=>()=>B&&URL.revokeObjectURL(B.url),[B]),s(()=>()=>P&&URL.revokeObjectURL(P),[P]),s(()=>{F(null),L(!1)},[p]);let J=h||g,Y=P||(p&&!Se?p:null),X=ye||xe,we=x&&!X?`${N}-hint`:void 0,Te=X?`${N}-error`:void 0,Ee=!J&&(!!P||!!Y&&!!m),De=()=>{J||j.current?.click()},Oe=e=>{I(``),L(!1),F(URL.createObjectURL(e)),me(e)},ke=e=>{let t=A!==void 0&&e.type!==`image/svg+xml`,n=o(e,{accept:_,maxSizeMb:t?0:v});if(n){I(n);return}if(t){I(``),G(`loading`),q(``),V({file:e,url:URL.createObjectURL(e)});return}Oe(e)},Ae=async()=>{let{file:e}=B;U(!0),q(``);let t=null;try{t=await M.current?.toFile({name:e.name,type:e.type,maxBytes:v>0?v*1024*1024:0})}catch{t=null}if(U(!1),!t){q(ue);return}V(null);let n=o(t,{accept:_,maxSizeMb:v});n?I(n):Oe(t)},je=()=>{H||V(null)},Me=e=>{let t=e.target.files?.[0];e.target.value=``,t&&ke(t)},Ne=e=>{if(e.preventDefault(),z(!1),J)return;let t=e.dataTransfer.files?.[0];t&&ke(t)},Pe=()=>{F(null),I(``),L(!1),j.current&&(j.current.value=``),m?.()},Z=typeof E==`number`?E:f[E]??f.md,Fe=Math.max(14,Math.round(Z*.18)),Ie=Math.round(Z*.5),Le=[`set-uploader`,T===`avatar`?`set-uploader--avatar`:``,D===`rounded`?`set-uploader--rounded`:D===`square`?`set-uploader--square`:``,R&&`is-dragging`].filter(Boolean).join(` `),Re=S===`inline`,ze=S===`profile`,Q=d(`div`,{className:`set-uploader-shell`,style:{"--wui-logo-size":`${Z}px`},children:[u(`button`,{type:`button`,className:Le,onClick:De,disabled:J,"aria-busy":h||void 0,"aria-label":ge,"aria-describedby":Te||we,onDragOver:e=>{e.preventDefault(),!J&&!R&&z(!0)},onDragLeave:e=>{e.preventDefault(),z(!1)},onDrop:Ne,...k,children:d(`span`,{className:`set-uploader-ring`,"data-overlay-label":b,children:[Y?u(`img`,{className:`set-uploader-img`,src:Y,alt:``,onError:()=>L(!0)}):u(`span`,{className:`set-uploader-logo`,children:fe||T===`avatar`&&u(r,{name:`user`,size:Ie})}),h?u(`span`,{className:`set-uploader-overlay is-loading`,"aria-hidden":`true`,children:u(r,{name:`refresh-cw`,size:Fe,className:`wui-spin`})}):!g&&d(`span`,{className:`set-uploader-overlay`,children:[u(r,{name:he,size:Fe}),u(`span`,{children:b})]})]})}),n(u(`button`,{type:`button`,className:`set-uploader-remove`,hidden:!Ee,"aria-label":_e,onClick:Pe,children:u(r,{name:`x`,size:14})}),Ee?_e:null),u(`input`,{id:N,ref:j,type:`file`,name:pe,hidden:!0,accept:_,onChange:Me,disabled:J}),A!==void 0&&d(ne,{open:!!B,title:`Crop photo`,subtitle:`Drag the frame and zoom to choose what to keep.`,size:`lg`,staticBackdrop:!0,dismissible:!H,onClose:je,footer:d(oe,{children:[u(a,{type:`button`,variant:`secondary`,disabled:H,onClick:je,children:`Cancel`}),u(a,{type:`button`,variant:`primary`,loading:H,disabled:W!==`ready`,onClick:Ae,children:`Apply`})]}),children:[W===`error`&&u(i,{variant:`danger`,children:de}),K&&u(i,{variant:`danger`,children:K}),B&&W!==`error`&&u(`wui-image-crop`,{ref:Ce,src:B.url,aspect:A??`free`,round:A===1&&D===`circle`})]})]}),Be=x&&!X?u(`div`,{className:`set-uploader-hint`,id:we,children:x}):null,Ve=X?u(ee,{error:X,errorId:Te}):null,$=ve&&d(`label`,{className:`label`,htmlFor:N,children:[ve,be&&u(te,{})]}),He=d(`div`,{className:`set-uploader-meta`,children:[C&&u(`div`,{className:`set-uploader-title`,children:C}),w&&u(`div`,{className:`set-uploader-subtitle`,children:w}),Be,Ve]});return Re?d(`div`,{className:`field set-uploader-field set-uploader-field--inline${O?` ${O}`:``}`,children:[$,d(`div`,{className:`set-uploader-row`,children:[Q,He]})]}):ze?d(`div`,{className:`field set-uploader-field set-uploader-field--profile${O?` ${O}`:``}`,children:[$,Q,He]}):d(`div`,{className:`field set-uploader-field${O?` ${O}`:``}`,children:[$,Q,Be,Ve]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnUnknownProps.js";import t from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnUnknownProps.js";import t from"../lib/FieldMessage.js";import n from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import i from"./useWuiControl.js";import{forwardRef as a,useEffect as o,useId as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/mention-input";var u=a(function({value:a,onChange:u,people:d,loadPeople:f,minChars:p,debounce:m,onSubmit:h,rows:g=3,placeholder:_,disabled:v=!1,name:y,id:b,label:x,error:S,hint:C,required:w=!1,help:T,helpLabel:E=`More information`,className:D=``,fieldClassName:O=``,...k},A){e(`AppMentionInput`,k);let j=typeof f==`function`,M=s(),N=b||`mention-${M.replace(/[^a-zA-Z0-9_-]/g,``)}`,P=S?`${N}-error`:C?`${N}-hint`:void 0,{setRef:F,innerRef:I}=i({ref:A,value:a??``,on:{change:e=>{e.target===e.currentTarget&&u?.(e.currentTarget.value,{mentions:e.currentTarget.mentions})},"wui:mention-input:submit":()=>h?.()}});return o(()=>{let e=I.current;!e||j||(e.people=d||[])},[d,j,I]),o(()=>{let e=I.current;if(!e||!j)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await f(r.detail.query,{signal:n?.signal});i===t&&(e.people=a||[])}catch{i===t&&(e.people=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[j,f,I]),l(`div`,{className:`field${O?` ${O}`:``}`,children:[x&&l(`label`,{className:`label`,htmlFor:`${N}-text`,children:[x,w&&c(r,{}),T&&c(n,{label:E,children:T})]}),c(`wui-mention-input`,{ref:F,id:N,class:D?`wui-mention-input ${D}`:`wui-mention-input`,label:typeof x==`string`?x:void 0,placeholder:_||void 0,rows:String(g),name:y||void 0,remote:j?``:void 0,"min-chars":p==null?void 0:String(p),debounce:m==null?void 0:String(m),disabled:v?``:void 0,"aria-describedby":P,"aria-invalid":S?`true`:void 0,...k}),c(t,{error:S,hint:C,errorId:`${N}-error`,hintId:`${N}-hint`})]})});export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useNodeLabels.js";import o,{optionsEqual as s,readValues as c,writeValues as l}from"./useWuiControl.js";import{forwardRef as u,useEffect as d,useId as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import"@webority/ui-elements/elements/multiselect";var h=[`sm`,`lg`],g=[],_=(e,t)=>({...e,label:t}),v=u(function({values:u,onChange:v,options:y,placeholder:b=`Select…`,searchPlaceholder:x=`Search…`,searchable:S=!0,disabled:C=!1,icon:w,size:T,collapseChips:E=!1,allowCustom:D=!1,validateCustom:O,customPattern:k,customInvalidMessage:A,name:j,id:M,label:N,error:P,hint:F,required:I=!1,help:L,helpLabel:R=`More information`,fieldClassName:z=``,...B},V){t(`AppMultiSelect`,B),e(`AppMultiSelect`,`size`,T,h);let H=f(),U=M||H,{setRef:W,innerRef:G}=o({ref:V,value:u,onChange:v,readValue:c,writeValue:l}),K=y||g,{portal:q,toElementOptions:J}=a(K);return d(()=>{let e=G.current;if(!e)return;let t=J(K,_);s(t,e.options)||(e.options=t)},[K,G,J]),d(()=>{let e=G.current;e&&(e.validateCustom=O??null)},[O,G]),m(`div`,{className:`field${z?` ${z}`:``}`,children:[N&&m(`label`,{className:`label`,htmlFor:U,children:[N,I&&p(i,{}),L&&p(r,{label:R,children:L})]}),p(`wui-multiselect`,{"aria-label":typeof N==`string`?N:void 0,"aria-describedby":P?`${U}-error`:F?`${U}-hint`:void 0,"aria-invalid":P?`true`:void 0,id:U,ref:W,name:j,placeholder:b,"search-placeholder":x,icon:w||void 0,size:T||void 0,"collapse-chips":E?``:void 0,"allow-custom":D?``:void 0,"custom-pattern":k||void 0,"custom-invalid-message":A||void 0,searchable:S?``:void 0,disabled:C?``:void 0,required:I?``:void 0,...B}),q,p(n,{error:P,hint:F,errorId:`${U}-error`,hintId:`${U}-hint`})]})});export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import{forwardRef as o,useEffect as s,useId as c,useState as l}from"react";import{Form as u}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`sm`,`md`,`lg`],m=o(function({label:o,required:m=!1,error:h,hint:g,help:_,helpLabel:v=`More information`,value:y,onChange:b,min:x,max:S,step:C=1,precision:w=0,unit:T,size:E=`md`,id:D,name:O,className:k=``,fieldClassName:A=``,disabled:j=!1,...M},N){t(`AppNumberInput`,M),e(`AppNumberInput`,`size`,E,p);let P=c(),F=D||P,I=e=>{if(w===0)return Math.round(e);let t=10**w;return Math.round(e*t)/t},L=e=>{let t=e;return typeof x==`number`&&(t=Math.max(t,x)),typeof S==`number`&&(t=Math.min(t,S)),t},R=e=>{if(e===``||e===null)return null;let t=parseFloat(e);return Number.isNaN(t)?null:t},[z,B]=l(y??``);s(()=>{B(y??``)},[y]);let V=e=>{let t=(R(z)??L(0))+e*C,n=L(I(t));B(String(n)),b?.(n)},H=R(z),U=j||H!==null&&typeof x==`number`&&H<=x,W=j||H!==null&&typeof S==`number`&&H>=S,G=h&&F?`${F}-error`:void 0,K=g&&F?`${F}-hint`:void 0,q=G||K,J=[`input`,E===`sm`?`input-sm`:``,E===`lg`?`input-lg`:``,h?`error`:``,`num-input`,k].filter(Boolean).join(` `),Y=RegExp(`^${typeof x==`number`&&x>=0?``:`-?`}\\d*${w>0?`(\\.\\d*)?`:``}$`),X=e=>{let t=e.target.value;if(!Y.test(t))return;B(t);let n=R(t);n!==null&&b?.(n)},Z=e=>{let t=R(e.target.value);if(t===null)B(``),b?.(``);else{let e=L(I(t));B(String(e)),b?.(e)}M.onBlur?.(e)},Q=e=>{e.key===`ArrowUp`?(e.preventDefault(),V(1)):e.key===`ArrowDown`&&(e.preventDefault(),V(-1)),M.onKeyDown?.(e)},$=d(u.Control,{...M,id:F,name:O,type:`text`,inputMode:w>0?`decimal`:`numeric`,className:J,disabled:j,required:m,"aria-invalid":h?`true`:`false`,"aria-describedby":q,value:z,ref:N,onChange:X,onBlur:Z,onKeyDown:Q}),ee=f(`div`,{className:[`num-wrap`,E===`sm`?`num-wrap-sm`:``,E===`lg`?`num-wrap-lg`:``].filter(Boolean).join(` `),children:[d(`button`,{type:`button`,className:`num-btn`,"aria-label":`Decrease`,tabIndex:-1,disabled:U,onClick:()=>V(-1),children:d(n,{name:`minus`,size:16})}),$,T&&d(`span`,{className:`affix`,children:T}),d(`button`,{type:`button`,className:`num-btn`,"aria-label":`Increase`,tabIndex:-1,disabled:W,onClick:()=>V(1),children:d(n,{name:`plus`,size:16})})]});return f(u.Group,{className:`field${A?` ${A}`:``}`,children:[o&&f(u.Label,{className:`label`,htmlFor:F,children:[o,m&&d(a,{}),_&&d(i,{label:v,children:_})]}),ee,d(r,{error:h,hint:g,errorId:G,hintId:K})]})});export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppRequiredMark.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppRequiredMark.js";import i from"./useWuiControl.js";import{forwardRef as a,useId as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/otp";var l=[`numeric`,`alphanumeric`],u=a(function({value:a,onChange:u,onComplete:d,length:f=6,mode:p=`numeric`,label:m,required:h=!1,hint:g,error:_,disabled:v=!1,name:y,id:b,className:x=``,fieldClassName:S=``,...C},w){t(`AppOtpInput`,C),e(`AppOtpInput`,`mode`,p,l);let T=o(),E=b||T,D=_?`${E}-error`:void 0,O=g?`${E}-hint`:void 0,k=D||O,{setRef:A}=i({ref:w,value:a??``,onChange:u,on:{complete:e=>d?.(e.detail)}}),j=s(`wui-otp`,{"aria-label":typeof m==`string`?m:void 0,ref:A,id:E,name:y,length:String(f),mode:p,"aria-describedby":k,"aria-invalid":_?`true`:void 0,disabled:v?``:void 0,required:h?``:void 0,className:x||void 0,...C});return!m&&!_&&!g?j:c(`div`,{className:`field${S?` ${S}`:``}`,children:[m&&c(`label`,{className:`label`,htmlFor:E,children:[m,h&&s(r,{})]}),j,s(n,{error:_,hint:g,errorId:D,hintId:O})]})});export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppRequiredMark.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppRequiredMark.js";import i from"./useWuiControl.js";import{forwardRef as a,useId as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/phone";var l=[`sm`,`md`,`lg`],u=a(function({value:a,onChange:u,country:d,disabled:f=!1,name:p,id:m,label:h=`Phone number`,placeholder:g,required:_=!1,hint:v,error:y,showFlag:b=!0,showDialCode:x=!0,size:S=`md`,fieldClassName:C=``,...w},T){t(`AppPhoneNumberInput`,w),e(`AppPhoneNumberInput`,`size`,S,l);let E=o(),D=m||E,O=y&&D?`${D}-error`:void 0,k=!y&&v&&D?`${D}-hint`:void 0,{setRef:A}=i({ref:T,value:a??``,onChange:u,events:[`input`,`change`]});return c(`div`,{className:`field app-phone-number-input${S===`sm`?` phone-sm`:``}${S===`lg`?` phone-lg`:``}${C?` ${C}`:``}`,children:[h&&c(`label`,{className:`label`,htmlFor:D,children:[h,_&&s(r,{})]}),s(`wui-phone`,{ref:A,id:D,name:p,"aria-label":typeof h==`string`?h:void 0,"aria-describedby":O||k,"aria-invalid":y?`true`:void 0,country:d,placeholder:g,required:_?``:void 0,disabled:f?``:void 0,"hide-flag":b?void 0:``,"hide-dial":x?void 0:``,...w}),s(n,{error:y,hint:v,errorId:O,hintId:k})]})});export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FocusPanel.js";import{cloneElement as r,useId as i,useRef as a,useState as o}from"react";import{OverlayTrigger as s,Popover as c}from"react-bootstrap";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d={start:`left`,end:`right`,top:`top`,bottom:`bottom`,auto:`auto`},f={modifiers:[{name:`computeStyles`,options:{gpuAcceleration:!1}}]},p=[`dialog`];function m({trigger:m,children:h,title:g,placement:_=`bottom`,triggerType:v=`click`,onToggle:y,className:b=``,show:x,role:S,labelledBy:C,autoFocus:w=!1,...T}){t(`AppPopover`,T),e(`AppPopover`,`role`,S,p);let E=i(),D=`${E}-title`,O=a(null),[k,A]=o(!1),j=x!==void 0,M=j?x:k,N=S===`dialog`,P=e=>{j||A(e),y?.(e)},F=u(c,{id:E,className:b||void 0,...N?{role:`dialog`,"aria-modal":`false`,"aria-labelledby":C??(g?D:void 0)}:{},children:[w&&l(n,{triggerRef:O}),g&&l(c.Header,{as:`
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FocusPanel.js";import{cloneElement as r,useId as i,useRef as a,useState as o}from"react";import{OverlayTrigger as s,Popover as c}from"react-bootstrap";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d={start:`left`,end:`right`,top:`top`,bottom:`bottom`,auto:`auto`},f={modifiers:[{name:`computeStyles`,options:{gpuAcceleration:!1}}]},p=[`dialog`];function m({trigger:m,children:h,title:g,placement:_=`bottom`,triggerType:v=`click`,onToggle:y,className:b=``,show:x,role:S,labelledBy:C,autoFocus:w=!1,...T}){t(`AppPopover`,T),e(`AppPopover`,`role`,S,p);let E=i(),D=`${E}-title`,O=a(null),[k,A]=o(!1),j=x!==void 0,M=j?x:k,N=S===`dialog`,P=e=>{j||A(e),y?.(e)},F=u(c,{id:E,className:b||void 0,...N?{role:`dialog`,"aria-modal":`false`,"aria-labelledby":C??(g?D:void 0)}:{},children:[w&&l(n,{triggerRef:O}),g&&l(c.Header,{as:`div`,id:D,children:g}),h==null?null:l(c.Body,{children:h})]}),{onClick:I,"aria-expanded":L,...R}=T,z=m.props[`aria-expanded`],B,V=v===`click`||Array.isArray(v)&&v.includes(`click`);L===void 0?z===void 0?V&&(B=M):B=z:B=L;let H=r(m,{...R,...B===void 0?{}:{"aria-expanded":B},onClick:e=>{O.current=e.currentTarget,I?.(e),typeof m.props.onClick==`function`&&m.props.onClick(e)}}),U=v===`click`,W=v===`hover`||Array.isArray(v)&&v.includes(`hover`);return l(s,{trigger:v,placement:d[_]||_,popperConfig:f,overlay:F,rootClose:U||N,delay:W?{show:80,hide:220}:void 0,onToggle:P,...j?{show:x}:{},children:H})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnUnknownProps.js";import t from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnUnknownProps.js";import t from"../lib/FieldMessage.js";import n from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import{useId as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s({label:s,options:c=[],name:l,value:u,defaultValue:d,onChange:f,inline:p=!1,required:m=!1,disabled:h=!1,error:g,hint:_,help:v,helpLabel:y=`More information`,id:b,className:x=``,fieldClassName:S=``,style:C,...w}){e(`AppRadioGroup`,w);let T=i(),E=b||T,D=l||E,O=`${E}-error`,k=`${E}-hint`,A=u!==void 0;return o(`div`,{className:`field${S?` ${S}`:``}`,children:[s!=null&&o(`span`,{className:`label`,id:`${E}-label`,children:[s,m&&a(r,{}),v&&a(n,{label:y,children:v})]}),a(`div`,{className:[`wui-radio-group`,p?`wui-radio-group-inline`:``,x].filter(Boolean).join(` `),style:C,id:E,role:`radiogroup`,"aria-labelledby":s==null?void 0:`${E}-label`,"aria-required":m?`true`:void 0,"aria-invalid":g?`true`:void 0,"aria-describedby":g?O:_?k:void 0,...w,children:c.map((e,t)=>{let n=`${E}-${t}`;return o(`div`,{className:`form-check`,children:[a(`input`,{type:`radio`,className:`form-check-input`,id:n,name:D,value:e.value,disabled:h||e.disabled||void 0,required:m||void 0,...A?{checked:u===e.value,onChange:()=>f?.(e.value)}:{defaultChecked:d===e.value,onChange:()=>f?.(e.value)}}),a(`label`,{className:`form-check-label`,htmlFor:n,children:e.label})]},e.value)})}),a(t,{error:g,hint:_,errorId:O,hintId:k})]})}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppRequiredMark.js";import{useId as
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import{useId as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import"@webority/ui-elements/elements/rating";var l={sm:16,md:20,lg:28},u=e=>String(Math.round(e*100)/100),d=(e,t,n)=>e>=t?`full`:n&&e>=t-.5?`half`:`empty`;function f({value:n,defaultValue:f,onChange:m,max:h=5,readOnly:g=!1,half:_=!1,showValue:v=!1,size:y=`md`,label:b,name:x,required:S=!1,disabled:C=!1,error:w,hint:T,id:E,className:D=``,fieldClassName:O=``,...k}){t(`AppRating`,k),e(`AppRating`,`size`,y,Object.keys(l));let A=a(),[j,M]=o(f),N=l[y]??l.md,P=Array.from({length:h},(e,t)=>t+1),F=(...e)=>[`wui-rating`,`wui-rating-${y}`,...e,D].filter(Boolean).join(` `);if(g){let e=Number.isFinite(Number(n))?Math.min(Math.max(Number(n),0),h):0,t=_?Math.round(e*2)/2:Math.round(e),r=`${typeof b==`string`&&b?`${b}: `:``}${u(e)} out of ${h}`;return c(`span`,{className:F(`wui-rating-display`),id:E,role:`img`,"aria-label":r,...k,children:[s(`span`,{className:`wui-rating-stars`,"aria-hidden":`true`,children:P.map(e=>s(`span`,{className:`wui-rating-star wui-rating-star-${d(t,e,_)}`,children:s(p,{px:N})},e))}),v&&s(`span`,{className:`wui-rating-value`,"aria-hidden":`true`,children:u(e)})]})}let I=E||A,L=x||I,R=`${I}-error`,z=`${I}-hint`,B=Math.round(Number(n===void 0?j:n))||0,V=e=>{M(e),m?.(e)};return c(`div`,{className:`field${O?` ${O}`:``}`,children:[b!=null&&c(`span`,{className:`label`,id:`${I}-label`,children:[b,S&&s(i,{})]}),s(`wui-rating`,{class:F(`wui-rating-input`),id:I,role:`radiogroup`,"aria-labelledby":b==null?void 0:`${I}-label`,"aria-label":b==null?`Rating`:void 0,"aria-required":S?`true`:void 0,"aria-invalid":w?`true`:void 0,"aria-describedby":w?R:T?z:void 0,disabled:C?``:void 0,...k,children:P.map(e=>c(`label`,{className:`wui-rating-star wui-rating-star-${B>=e?`full`:`empty`}`,"data-value":e,children:[s(`input`,{type:`radio`,className:`visually-hidden`,name:L,value:e,"aria-label":`${e} ${e===1?`star`:`stars`}`,checked:B===e,onChange:()=>V(e),disabled:C||void 0,required:S||void 0}),s(p,{px:N})]},e))}),s(r,{error:w,hint:T,errorId:R,hintId:z})]})}function p({px:e}){return c(`span`,{className:`wui-rating-glyphs`,"aria-hidden":`true`,children:[s(n,{name:`star`,size:e}),s(`span`,{className:`wui-rating-fill`,children:s(n,{name:`star`,variant:`bold`,size:e})})]})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{forwardRef as o,useEffect as s,useId as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`html`,`markdown`],p=[`input`,`change`],m=`The editor couldn't load. Reload the page and try again.`,h=o(function({value:o,onChange:h,format:g,placeholder:_,name:v,label:y,error:b,hint:x,required:S=!1,disabled:C=!1,readOnly:w=!1,id:T,ariaLabel:E,className:D=``,fieldClassName:O=``,help:k,helpLabel:A=`More information`,...j},M){t(`AppRichText`,j),e(`AppRichText`,`format`,g,f);let N=c(),P=T||N,[F,I]=l(!1),{setRef:L}=a({ref:M,value:o,onChange:h,events:p});return s(()=>{let e=!0;return import(`@webority/ui-elements/rich-text`).catch(t=>{console.warn(`[AppRichText] the editor failed to load:`,t?.message),e&&I(!0)}),()=>{e=!1}},[]),d(`div`,{className:`field${O?` ${O}`:``}`,children:[y&&d(`label`,{className:`label`,htmlFor:P,children:[y,S&&u(i,{}),k&&u(r,{label:A,children:k})]}),F?u(`div`,{className:`field-error`,role:`status`,children:m}):u(`wui-rich-text`,{ref:L,id:P,role:`group`,name:v,format:g||void 0,placeholder:_,"aria-label":E||(typeof y==`string`?y:void 0),"aria-describedby":b?`${P}-error`:x?`${P}-hint`:void 0,"aria-invalid":b?`true`:void 0,required:S?``:void 0,disabled:C?``:void 0,readonly:w?``:void 0,className:D||void 0,...j},g||`html`),u(n,{error:b,hint:x,errorId:`${P}-error`,hintId:`${P}-hint`})]})});export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useId as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useId as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";function i({value:i=null,onChange:a,min:o=0,max:s=10,label:c,lowLabel:l,highLabel:u,name:d,disabled:f=!1,error:p,hint:m,id:h,className:g=``,fieldClassName:_=``}){let v=t(),y=h||v,b=d||y,x=`${y}-error`,S=`${y}-hint`,C=Array.from({length:Math.max(0,s-o+1)},(e,t)=>o+t),w=l!=null||u!=null;return r(`div`,{className:`field${_?` ${_}`:``}`,children:[c!=null&&n(`span`,{className:`label`,id:`${y}-label`,children:c}),r(`div`,{className:`wui-score-scale${g?` ${g}`:``}`,id:y,role:`radiogroup`,"aria-labelledby":c==null?void 0:`${y}-label`,"aria-label":c==null?`Score`:void 0,"aria-invalid":p?`true`:void 0,"aria-describedby":p?x:m?S:void 0,children:[C.map(e=>r(`label`,{className:`wui-score-scale__item${i===e?` wui-score-scale__item--selected`:``}`,children:[n(`input`,{type:`radio`,className:`visually-hidden`,name:b,value:e,checked:i===e,disabled:f,onChange:()=>a?.(e)}),e]},e)),w&&r(`span`,{className:`wui-score-scale__ends`,children:[n(`span`,{children:l}),n(`span`,{children:u})]})]}),n(e,{error:p,hint:m,errorId:x,hintId:S})]})}export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import ee from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import ee from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import i from"./useNodeLabels.js";import a,{optionsEqual as o}from"./useWuiControl.js";import{forwardRef as s,useEffect as c,useId as l,useRef as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var te=[`sm`,`lg`],m=(e,t)=>({value:e.value,label:t,icon:e.icon}),h=s(function({value:s,onChange:h,options:g=[],placeholder:_=`Select...`,searchPlaceholder:v=`Search...`,searchable:y=!1,clearable:b=!1,size:x,icon:S,prefix:C,suffix:w,floatingLabel:T=!1,disabled:E,label:D,required:O=!1,error:k,hint:A,help:j,helpLabel:M=`More information`,id:N,name:P,className:F=``,fieldClassName:I=``,"aria-label":L,"aria-labelledby":R,"aria-describedby":z,...B},V){t(`AppSelect`,B),e(`AppSelect`,`size`,x,te);let H=l(),{setRef:U,innerRef:W}=a({ref:V,value:s??``,onChange:h}),{portal:G,toElementOptions:K}=i(g),q=u({el:null,options:null});c(()=>{let e=W.current;if(!e||q.current.el===e&&q.current.options===g)return;q.current={el:e,options:g};let t=K(g,m);o(t,e.options)||(e.options=t)});let J=N||H,Y=T&&D,X=k&&J?`${J}-error`:void 0,Z=A&&J?`${J}-hint`:void 0,Q=p(d,{children:[f(`wui-select`,{"aria-label":L||(typeof D==`string`?D:void 0),"aria-labelledby":R||void 0,"aria-describedby":X||Z||z||void 0,"aria-invalid":k?`true`:void 0,ref:U,id:J,name:P,placeholder:T&&D?` `:_,"search-placeholder":v,searchable:y?``:void 0,clearable:b?``:void 0,size:x||void 0,icon:S||void 0,disabled:E?``:void 0,required:O?``:void 0,className:F||void 0,...B}),G]}),$=!Y&&(C!=null||w!=null)?p(`div`,{className:`input-affixed`,children:[C!=null&&f(`span`,{className:`affix affix-pre`,children:C}),Q,w!=null&&f(`span`,{className:`affix affix-suf`,children:w})]}):Q;return!D&&!k&&!A?$:p(`div`,{className:[`field`,I].filter(Boolean).join(` `),children:[D&&!Y&&p(`label`,{className:`label`,htmlFor:J,children:[D,O&&f(r,{}),j&&f(ee,{label:M,children:j})]}),Y?p(`div`,{className:`field-float`,children:[Q,p(`label`,{className:`float-label`,htmlFor:J,children:[D,O&&f(r,{})]})]}):$,f(n,{error:k,hint:A,errorId:X,hintId:Z})]})});export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppRequiredMark.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppRequiredMark.js";import i,{readRange as a,writeNumberValue as o}from"./useWuiControl.js";import{forwardRef as s,useEffect as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/slider";var f=[`sm`,`md`,`lg`],p=s(function({value:s,start:p,end:m,range:h=!1,onChange:g,label:_,required:v=!1,hint:y,error:b,name:x,startName:S,endName:C,min:w=0,max:T=100,step:E=1,disabled:D,size:O,showValue:k,unit:A,id:j,ariaLabel:M,className:N=``,fieldClassName:P=``,...F},I){t(`AppSlider`,F),e(`AppSlider`,`size`,O,f);let L=l(),R=j||L,z=h,{setRef:B,innerRef:V}=i({ref:I,value:z?void 0:s,onChange:g,readValue:z?a:void 0,writeValue:z?void 0:o});c(()=>{if(!z)return;let e=V.current;e&&(p!==void 0&&p>e.end?(m!==void 0&&e.end!==m&&(e.end=m),p!==void 0&&e.start!==p&&(e.start=p)):(p!==void 0&&e.start!==p&&(e.start=p),m!==void 0&&e.end!==m&&(e.end=m)))},[p,m,z,V]);let H=!_&&!b&&!y,U=b?`${R}-error`:void 0,W=y?`${R}-hint`:void 0,G=u(`wui-slider`,{ref:B,id:R,name:x||void 0,"start-name":S||void 0,"end-name":C||void 0,min:w,max:T,step:E,size:O||void 0,"aria-label":M||(typeof _==`string`?_:void 0),"aria-describedby":U||W,"aria-invalid":b?`true`:void 0,disabled:D?``:void 0,required:v?``:void 0,range:z?``:void 0,"show-value":k?``:void 0,unit:A||void 0,className:N||void 0,...F});return H?G:d(`div`,{className:`field${P?` ${P}`:``}`,children:[_&&d(`label`,{className:`label`,htmlFor:R,children:[_,v&&u(r,{})]}),G,u(n,{error:b,hint:y,errorId:U,hintId:W})]})});export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppTooltip.js";import r from"./AppIcon.js";import i from"./renderIconProp.js";import{formatNumber as a}from"@webority/ui-elements/helpers";import{useCallback as o,useEffect as s,useLayoutEffect as c,useRef as l,useState as ee}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import"@webority/ui-elements/elements/overflow";var te=[`underline`,`pills`],p=[`horizontal`,`vertical`],m=[`sm`,`md`,`lg`],h=[`automatic`,`manual`],g=[`scroll`,`menu`],_=[`success`,`warning`,`danger`,`info`],v=1,y=28,ne=.7;function b({tabs:b,value:x,onChange:S,linkComponent:C,variant:w=`underline`,orientation:T=`horizontal`,size:E=`md`,fitted:D=!1,overflow:O=`scroll`,moreLabel:k=`More`,maxVisible:A,activation:j=`automatic`,ariaLabel:M,className:N=``,style:P,...F}){t(`AppTabs`,F),e(`AppTabs`,`variant`,w,te),e(`AppTabs`,`orientation`,T,p),e(`AppTabs`,`size`,E,m),e(`AppTabs`,`activation`,j,h),e(`AppTabs`,`overflow`,O,g);for(let t of b)e(`AppTabs`,`tabs[].tone`,t.tone,_);let I=l(null),L=l(null),R=T===`vertical`,z=(O===`menu`||A!=null)&&!R,[B,V]=ee(x);s(()=>{V(x)},[x]);let H=b.find(e=>!e.disabled)?.key,U=b.some(e=>e.key===B&&!e.disabled)?B:void 0,W=b.some(e=>e.key===x&&!e.disabled)?x:void 0,G=U??W??H,K=e=>{I.current?.querySelector(`[data-key="${CSS.escape(String(e))}"]`)?.focus()},q=o(()=>{let e=I.current,t=L.current;if(!e||!t||R||z)return;let n=e.scrollWidth-e.clientWidth;t.classList.toggle(`is-overflow-start`,e.scrollLeft>v),t.classList.toggle(`is-overflow-end`,n>v&&e.scrollLeft<n-v)},[R,z]),J=o(()=>{let e=I.current;if(!e)return;let t=e.querySelector(`.app-tab.active`);t?(R?(e.style.setProperty(`--wui-tab-y`,`${t.offsetTop}px`),e.style.setProperty(`--wui-tab-h`,`${t.offsetHeight}px`)):(e.style.setProperty(`--wui-tab-x`,`${t.offsetLeft}px`),e.style.setProperty(`--wui-tab-w`,`${t.offsetWidth}px`)),e.toggleAttribute(`data-active-danger`,!!b.find(e=>e.key===x)?.danger)):e.style.setProperty(R?`--wui-tab-h`:`--wui-tab-w`,`0px`),e.setAttribute(`data-wui-tabs`,``),q()},[R,b,x,q]),Y=e=>!z||!I.current?.querySelector(`[data-key="${CSS.escape(String(e))}"][data-wui-overflow-hidden]`),X=o(()=>{let e=I.current;if(!e||R)return;let t=e.querySelector(`.app-tab.active`);if(!t)return;let n=y,r=t.offsetLeft,i=r+t.offsetWidth;r-n<e.scrollLeft?e.scrollLeft=Math.max(0,r-n):i+n>e.scrollLeft+e.clientWidth&&(e.scrollLeft=i+n-e.clientWidth)},[R]);c(()=>{J()},[J]),c(()=>{X()},[x,X]);let Z=l(J);s(()=>{Z.current=J},[J]),s(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>Z.current());return I.current&&e.observe(I.current),L.current&&e.observe(L.current),()=>e.disconnect()},[R,z]),s(()=>{let e=L.current;if(!z||!e)return;let t=()=>Z.current();return e.addEventListener(`wui-overflow-change`,t),()=>e.removeEventListener(`wui-overflow-change`,t)},[z]);function re(e){let t=e.target?.dataset?.key;if(t==null)return;let n=b.findIndex(e=>e.key===t);if(n<0)return;let r=b.length,i=(e,t)=>{for(let n=1;n<=r;n++){let i=b[((e+t*n)%r+r)%r];if(!i.disabled&&Y(i.key))return i}return null},a=R?`ArrowDown`:`ArrowRight`,o=R?`ArrowUp`:`ArrowLeft`,s=null;if(e.key===a?s=i(n,1):e.key===o?s=i(n,-1):e.key===`Home`?s=b.find(e=>!e.disabled&&Y(e.key))??null:e.key===`End`&&(s=[...b].reverse().find(e=>!e.disabled&&Y(e.key))??null),!s)return;e.preventDefault(),V(s.key),K(s.key);let c=s.href!=null||s.to!=null;j===`automatic`&&!c&&S?.(s.key)}let Q=e=>{let t=I.current;t&&t.scrollBy({left:e*t.clientWidth*ne})},ie=[`app-tabs`,w===`pills`?`app-tabs-pills`:``,R?`app-tabs-vertical`:``,E===`sm`?`app-tabs-sm`:``,E===`lg`?`app-tabs-lg`:``,D?`app-tabs-fitted`:``,N].filter(Boolean).join(` `),$=f(`div`,{ref:I,role:`tablist`,"aria-orientation":R?`vertical`:void 0,"aria-label":M,className:ie,style:P,"data-wui-overflow-list":z?``:void 0,...F,onKeyDown:re,onScroll:q,children:[b.map(e=>{let t=e.key===x,r=e.href!=null||e.to!=null,o={role:`tab`,"data-key":e.key,"aria-selected":t,tabIndex:e.key===G?0:-1,className:`app-tab${t?` active`:``}${e.danger?` danger`:``}${r&&e.disabled?` disabled`:``}`},s=f(u,{children:[e.image?d(`img`,{className:`app-tab-img`,src:e.image,alt:e.imageAlt??``}):i(e.icon,{size:16,className:`app-tab-icon`}),e.label,(e.countLabel||e.count!=null)&&d(`span`,{className:`app-tab-count${e.tone?` ${e.tone}`:``}`,children:e.countLabel||a(e.count,{decimals:0})})]}),c;if(r){let t=e.to!=null&&C?C:`a`,n=e.rel??(e.target===`_blank`?`noopener noreferrer`:void 0),r=e.disabled?{"aria-disabled":!0}:t===`a`?{href:e.href??e.to,target:e.target,rel:n}:{to:e.to,target:e.target,rel:n},i=t=>{if(e.disabled){t.preventDefault();return}t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(V(e.key),S?.(e.key))};c=d(t,{...o,...r,onClick:i,children:s},e.key)}else c=d(`button`,{type:`button`,...o,disabled:e.disabled,onClick:()=>{e.disabled||(V(e.key),S?.(e.key))},children:s},e.key);return e.tooltip?d(n,{content:e.tooltip,children:c},e.key):c}),d(`span`,{className:`app-tab-indicator`,"aria-hidden":`true`,"data-wui-overflow-skip":``})]});return R?$:z?d(`wui-overflow`,{ref:L,class:`app-tabs-wrap`,label:k,children:$}):f(`div`,{ref:L,className:`app-tabs-wrap`,children:[d(`button`,{type:`button`,className:`app-tabs-scroll-btn prev`,"aria-label":`Scroll tabs backward`,tabIndex:-1,onClick:()=>Q(-1),children:d(r,{name:`chevron-left`,size:16})}),$,d(`button`,{type:`button`,className:`app-tabs-scroll-btn next`,"aria-label":`Scroll tabs forward`,tabIndex:-1,onClick:()=>Q(1),children:d(r,{name:`chevron-right`,size:16})})]})}export{b as default};
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppTooltip.js";import r from"./AppIcon.js";import i from"./renderIconProp.js";import{formatNumber as a}from"@webority/ui-elements/helpers";import{useCallback as o,useEffect as s,useLayoutEffect as c,useRef as l,useState as ee}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import"@webority/ui-elements/elements/overflow";var te=[`underline`,`pills`],p=[`horizontal`,`vertical`],m=[`sm`,`md`,`lg`],h=[`automatic`,`manual`],g=[`scroll`,`menu`],_=[`success`,`warning`,`danger`,`info`],v=1,y=28,ne=.7;function b({tabs:b,value:x,onChange:S,linkComponent:C,variant:w=`underline`,orientation:T=`horizontal`,size:E=`md`,fitted:D=!1,overflow:O=`scroll`,moreLabel:k=`More`,maxVisible:A,activation:j=`automatic`,ariaLabel:M,className:N=``,style:P,...F}){t(`AppTabs`,F),e(`AppTabs`,`variant`,w,te),e(`AppTabs`,`orientation`,T,p),e(`AppTabs`,`size`,E,m),e(`AppTabs`,`activation`,j,h),e(`AppTabs`,`overflow`,O,g);for(let t of b)e(`AppTabs`,`tabs[].tone`,t.tone,_);let I=l(null),L=l(null),R=T===`vertical`,z=(O===`menu`||A!=null)&&!R,[B,V]=ee(x);s(()=>{V(x)},[x]);let H=b.find(e=>!e.disabled)?.key,U=b.some(e=>e.key===B&&!e.disabled)?B:void 0,W=b.some(e=>e.key===x&&!e.disabled)?x:void 0,G=U??W??H,K=e=>{I.current?.querySelector(`[data-key="${CSS.escape(String(e))}"]`)?.focus()},q=o(()=>{let e=I.current,t=L.current;if(!e||!t||R||z)return;let n=e.scrollWidth-e.clientWidth;t.classList.toggle(`is-overflow-start`,e.scrollLeft>v),t.classList.toggle(`is-overflow-end`,n>v&&e.scrollLeft<n-v)},[R,z]),J=o(()=>{let e=I.current;if(!e)return;let t=e.querySelector(`.app-tab.active`);t?(R?(e.style.setProperty(`--wui-tab-y`,`${t.offsetTop}px`),e.style.setProperty(`--wui-tab-h`,`${t.offsetHeight}px`)):(e.style.setProperty(`--wui-tab-x`,`${t.offsetLeft}px`),e.style.setProperty(`--wui-tab-w`,`${t.offsetWidth}px`)),e.toggleAttribute(`data-active-danger`,!!b.find(e=>e.key===x)?.danger)):e.style.setProperty(R?`--wui-tab-h`:`--wui-tab-w`,`0px`),e.setAttribute(`data-wui-tabs`,``),q()},[R,b,x,q]),Y=e=>!z||!I.current?.querySelector(`[data-key="${CSS.escape(String(e))}"][data-wui-overflow-hidden]`),X=o(()=>{let e=I.current;if(!e||R)return;let t=e.querySelector(`.app-tab.active`);if(!t)return;let n=y,r=t.offsetLeft,i=r+t.offsetWidth;r-n<e.scrollLeft?e.scrollLeft=Math.max(0,r-n):i+n>e.scrollLeft+e.clientWidth&&(e.scrollLeft=i+n-e.clientWidth)},[R]);c(()=>{J()},[J]),c(()=>{X()},[x,X]);let Z=l(J);s(()=>{Z.current=J},[J]),s(()=>{if(!document.fonts)return;let e=!0;return document.fonts.ready.then(()=>{e&&Z.current()}),()=>{e=!1}},[]),s(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>Z.current());return I.current&&e.observe(I.current),L.current&&e.observe(L.current),()=>e.disconnect()},[R,z]),s(()=>{let e=L.current;if(!z||!e)return;let t=()=>Z.current();return e.addEventListener(`wui-overflow-change`,t),()=>e.removeEventListener(`wui-overflow-change`,t)},[z]);function re(e){let t=e.target?.dataset?.key;if(t==null)return;let n=b.findIndex(e=>e.key===t);if(n<0)return;let r=b.length,i=(e,t)=>{for(let n=1;n<=r;n++){let i=b[((e+t*n)%r+r)%r];if(!i.disabled&&Y(i.key))return i}return null},a=R?`ArrowDown`:`ArrowRight`,o=R?`ArrowUp`:`ArrowLeft`,s=null;if(e.key===a?s=i(n,1):e.key===o?s=i(n,-1):e.key===`Home`?s=b.find(e=>!e.disabled&&Y(e.key))??null:e.key===`End`&&(s=[...b].reverse().find(e=>!e.disabled&&Y(e.key))??null),!s)return;e.preventDefault(),V(s.key),K(s.key);let c=s.href!=null||s.to!=null;j===`automatic`&&!c&&S?.(s.key)}let Q=e=>{let t=I.current;t&&t.scrollBy({left:e*t.clientWidth*ne})},ie=[`app-tabs`,w===`pills`?`app-tabs-pills`:``,R?`app-tabs-vertical`:``,E===`sm`?`app-tabs-sm`:``,E===`lg`?`app-tabs-lg`:``,D?`app-tabs-fitted`:``,N].filter(Boolean).join(` `),$=f(`div`,{ref:I,role:`tablist`,"aria-orientation":R?`vertical`:void 0,"aria-label":M,className:ie,style:P,"data-wui-overflow-list":z?``:void 0,...F,onKeyDown:re,onScroll:q,children:[b.map(e=>{let t=e.key===x,r=e.href!=null||e.to!=null,o={role:`tab`,"data-key":e.key,"aria-selected":t,tabIndex:e.key===G?0:-1,className:`app-tab${t?` active`:``}${e.danger?` danger`:``}${r&&e.disabled?` disabled`:``}`},s=f(u,{children:[e.image?d(`img`,{className:`app-tab-img`,src:e.image,alt:e.imageAlt??``}):i(e.icon,{size:16,className:`app-tab-icon`}),e.label,(e.countLabel||e.count!=null)&&d(`span`,{className:`app-tab-count${e.tone?` ${e.tone}`:``}`,children:e.countLabel||a(e.count,{decimals:0})})]}),c;if(r){let t=e.to!=null&&C?C:`a`,n=e.rel??(e.target===`_blank`?`noopener noreferrer`:void 0),r=e.disabled?{"aria-disabled":!0}:t===`a`?{href:e.href??e.to,target:e.target,rel:n}:{to:e.to,target:e.target,rel:n},i=t=>{if(e.disabled){t.preventDefault();return}t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(V(e.key),S?.(e.key))};c=d(t,{...o,...r,onClick:i,children:s},e.key)}else c=d(`button`,{type:`button`,...o,disabled:e.disabled,onClick:()=>{e.disabled||(V(e.key),S?.(e.key))},children:s},e.key);return e.tooltip?d(n,{content:e.tooltip,children:c},e.key):c}),d(`span`,{className:`app-tab-indicator`,"aria-hidden":`true`,"data-wui-overflow-skip":``})]});return R?$:z?d(`wui-overflow`,{ref:L,class:`app-tabs-wrap`,label:k,children:$}):f(`div`,{ref:L,className:`app-tabs-wrap`,children:[d(`button`,{type:`button`,className:`app-tabs-scroll-btn prev`,"aria-label":`Scroll tabs backward`,tabIndex:-1,onClick:()=>Q(-1),children:d(r,{name:`chevron-left`,size:16})}),$,d(`button`,{type:`button`,className:`app-tabs-scroll-btn next`,"aria-label":`Scroll tabs forward`,tabIndex:-1,onClick:()=>Q(1),children:d(r,{name:`chevron-right`,size:16})})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a,{readValues as o,writeValues as s}from"./useWuiControl.js";import{forwardRef as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/taginput";var f=[`sm`,`lg`],p=c(function({values:c,onChange:p,placeholder:m=`Add…`,name:h,label:g,error:_,hint:v,required:y=!1,size:b,maxTags:x,allowDuplicates:S=!1,disabled:C=!1,id:w,ariaLabel:T,className:E=``,fieldClassName:D=``,help:O,helpLabel:k=`More information`,...A},j){t(`AppTagInput`,A),e(`AppTagInput`,`size`,b,f);let M=l(),N=w||M,{setRef:P}=a({ref:j,value:c,onChange:p,readValue:o,writeValue:s});return d(`div`,{className:`field${D?` ${D}`:``}`,children:[g&&d(`label`,{className:`label`,htmlFor:N,children:[g,y&&u(i,{}),O&&u(r,{label:k,children:O})]}),u(`wui-taginput`,{"aria-label":T||(typeof g==`string`?g:void 0),"aria-describedby":_?`${N}-error`:v?`${N}-hint`:void 0,"aria-invalid":_?`true`:void 0,id:N,ref:P,name:h,placeholder:m,size:b||void 0,"max-tags":x===void 0?void 0:String(x),"allow-duplicates":S?``:void 0,disabled:C?``:void 0,required:y?``:void 0,className:E||void 0,...A}),u(n,{error:_,hint:v,errorId:`${N}-error`,hintId:`${N}-hint`})]})});export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnUnknownProps.js";import t from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnUnknownProps.js";import t from"../lib/FieldMessage.js";import n from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import{forwardRef as i,useCallback as a,useEffect as o,useId as s,useLayoutEffect as c,useRef as l,useState as u}from"react";import{Form as d}from"react-bootstrap";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=i(function({label:i,required:m=!1,error:h,hint:g,help:_,helpLabel:v=`More information`,id:y,name:b,rows:x=4,autoGrow:S=!1,showCount:C=!1,maxLength:w,className:T=``,fieldClassName:E=``,...D},O){e(`AppTextarea`,D);let k=s(),A=y||k,j=[`textarea`,S?`autosize`:``,h?`error`:``,T].filter(Boolean).join(` `),M=h&&A?`${A}-error`:void 0,N=g&&A?`${A}-hint`:void 0,P=M||N,F=l(null),I=e=>{F.current=e,typeof O==`function`?O(e):O&&(O.current=e)},L=a(()=>{let e=F.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[]);c(()=>{S&&L()},[S,L,D.value]);let[R,z]=u(()=>String(D.value??D.defaultValue??``).length);o(()=>{!C||D.value===void 0||z(String(D.value??``).length)},[D.value,C]);let B=e=>{S&&L(),C&&z(e.target.value.length),D.onInput?.(e)};return p(d.Group,{className:`field${E?` ${E}`:``}`,children:[i&&p(d.Label,{className:`label`,htmlFor:A,children:[i,m&&f(r,{}),_&&f(n,{label:v,children:_})]}),f(d.Control,{as:`textarea`,id:A,name:b,rows:x,className:j,"aria-invalid":h?`true`:`false`,"aria-describedby":P,required:m,maxLength:w,...D,ref:I,onInput:B}),f(t,{error:h,hint:g,errorId:M,hintId:N}),C&&p(`div`,{className:`field-count${w&&R>=w?` at-limit`:``}`,children:[R,w?` / ${w}`:``]})]})});export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppInfoTip.js";import
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{forwardRef as o,useId as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/timepicker";var u=[`sm`,`md`,`lg`],d=[`12`,`24`],f=o(function({value:o,onChange:f,label:p,required:m=!1,hint:h,error:g,help:_,helpLabel:v=`More information`,name:y,min:b,max:x,step:S,format:C=`24`,placeholder:w=`Select time`,disabled:T,size:E,id:D,ariaLabel:O,className:k=``,fieldClassName:A=``,...j},M){t(`AppTimePicker`,j),e(`AppTimePicker`,`size`,E,u),e(`AppTimePicker`,`format`,C,d);let N=s(),P=D||y||N,{setRef:F}=a({ref:M,value:o??``,onChange:f}),I=!p&&!g&&!h,L=g?`${P}-error`:void 0,R=h?`${P}-hint`:void 0,z=c(`wui-timepicker`,{ref:F,id:P,name:y,min:b,max:x,step:S==null?void 0:String(S),format:C,placeholder:w,size:E||void 0,"aria-label":O||(typeof p==`string`?p:void 0),"aria-describedby":L||R,"aria-invalid":g?`true`:void 0,disabled:T?``:void 0,required:m?``:void 0,className:k||void 0,...j});return I?z:l(`div`,{className:`field${A?` ${A}`:``}`,children:[p&&l(`label`,{className:`label`,htmlFor:P,children:[p,m&&c(i,{}),_&&c(r,{label:v,children:_})]}),z,c(n,{error:g,hint:h,errorId:L,hintId:R})]})});export{f as default};
|
package/dist/lib/CheckField.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{forwardRef as
|
|
1
|
+
import e from"./FieldMessage.js";import{forwardRef as t,useId as n}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=t(function({label:t,id:a,name:o,error:s,hint:c,className:l=``,rest:u={},inputType:d,wrapperClass:f},p){let m=n(),h=a||m,g=s?`${h}-error`:void 0,_=c?`${h}-hint`:void 0;return i(`div`,{className:`${f}${l?` ${l}`:``}`,children:[r(`input`,{type:d,className:`form-check-input`,id:h,name:o,ref:p,"aria-invalid":s?`true`:`false`,"aria-describedby":g||_,...u}),t!=null&&r(`label`,{className:`form-check-label`,htmlFor:h,children:t}),r(e,{error:s,hint:c,errorId:g,hintId:_})]})});export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as e,useState as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";var i=150;function a({error:a,hint:o,errorId:s,hintId:c}){let[l,u]=t(a||null),[d,f]=t(!1);e(()=>{if(a){u(a),f(!1);return}if(!l)return;f(!0);let e=setTimeout(()=>{u(null),f(!1)},i);return()=>clearTimeout(e)},[a,l]);let p=a||l;return r(`div`,{className:`wui-field-message`,children:[o?n(`div`,{className:`field-hint`,id:c,children:o}):null,p?n(`div`,{className:`field-error${a?``:d?` wui-leaving`:``}`,id:a?s:void 0,children:p}):null]})}export{a as default};
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* App* like AppButton/AppActionIcon). It renders as written; clicking (or hovering/focusing) it
|
|
12
12
|
* toggles the panel.
|
|
13
13
|
* @param {import('react').ReactNode} props.children The panel body.
|
|
14
|
-
* @param {string} [props.title] Optional panel heading.
|
|
14
|
+
* @param {string} [props.title] Optional panel title (plain text, not a heading, so it never breaks the page's heading order).
|
|
15
15
|
* @param {'top'|'bottom'|'start'|'end'|'auto'} [props.placement='bottom'] Where it opens; `auto`
|
|
16
16
|
* flips to stay in view.
|
|
17
17
|
* @param {'click'|'hover'|'focus'|('click'|'hover'|'focus')[]} [props.triggerType='click'] What
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The message line under a field: its hint and its error in one place, the theme hiding the hint
|
|
3
|
+
* while the error shows. The line is kept
|
|
4
|
+
* whether or not anything shows (inside a form), so an error never moves the form. A cleared
|
|
5
|
+
* error keeps its text until its fade-out ends, so there is something to fade.
|
|
6
|
+
* @internal — not exported from the package barrel
|
|
7
|
+
*
|
|
8
|
+
* @param {object} props
|
|
9
|
+
* @param {import('react').ReactNode} [props.error]
|
|
10
|
+
* @param {import('react').ReactNode} [props.hint]
|
|
11
|
+
* @param {string} [props.errorId]
|
|
12
|
+
* @param {string} [props.hintId]
|
|
13
|
+
*/
|
|
14
|
+
export default function FieldMessage({ error, hint, errorId, hintId }: {
|
|
15
|
+
error?: import('react').ReactNode;
|
|
16
|
+
hint?: import('react').ReactNode;
|
|
17
|
+
errorId?: string;
|
|
18
|
+
hintId?: string;
|
|
19
|
+
}): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.1",
|
|
4
4
|
"description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@webority/theme": "0.
|
|
31
|
-
"@webority/ui-elements": "0.
|
|
30
|
+
"@webority/theme": "0.75.1",
|
|
31
|
+
"@webority/ui-elements": "0.75.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@webority/analytics": "^0.23.0",
|