@webority/ui-react 0.150.0 → 0.152.0
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/canvas-kit/kit.js +200 -200
- package/dist/canvas-kit/manifest.json +624 -31
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAlert.js +1 -1
- package/dist/components/AppAsyncBlock.js +1 -1
- package/dist/components/AppBreadcrumbs.js +1 -1
- package/dist/components/AppButton.js +1 -1
- package/dist/components/AppCard.js +1 -1
- package/dist/components/AppCarousel.js +1 -1
- package/dist/components/AppCompareTable.js +1 -1
- package/dist/components/AppDashboardCell.js +1 -1
- package/dist/components/AppDropdown.js +1 -1
- package/dist/components/AppFileAttachment.js +1 -1
- package/dist/components/AppFilePicker.js +1 -1
- package/dist/components/AppFilterBar.js +1 -1
- package/dist/components/AppForm.js +1 -0
- package/dist/components/AppInlineEdit.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppKanban.js +1 -1
- package/dist/components/AppLink.js +1 -1
- package/dist/components/AppModal.js +1 -1
- package/dist/components/AppPopover.js +1 -1
- package/dist/components/AppSearch.js +1 -1
- package/dist/components/AppSectionLeadCapture.js +1 -1
- package/dist/components/AppSelect.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppThemeToggle.js +1 -1
- package/dist/components/AppTooltip.js +1 -1
- package/dist/components/AppWizard.js +1 -1
- package/dist/guidance.json +160 -16
- package/dist/lib/useFileDrop.js +1 -1
- package/dist/types/components/AppAsyncBlock.d.ts +2 -2
- package/dist/types/components/AppBreadcrumbs.d.ts +11 -0
- package/dist/types/components/AppButton.d.ts +3 -3
- package/dist/types/components/AppCompareTable.d.ts +7 -0
- package/dist/types/components/AppDashboardCell.d.ts +9 -5
- package/dist/types/components/AppDashboardGrid.d.ts +6 -5
- package/dist/types/components/AppDropdown.d.ts +19 -0
- package/dist/types/components/AppForm.d.ts +23 -0
- package/dist/types/components/AppKanban.d.ts +5 -0
- package/dist/types/components/AppLink.d.ts +2 -2
- package/dist/types/components/AppSearch.d.ts +1 -1
- package/dist/types/components/AppSelect.d.ts +7 -2
- package/dist/types/components/AppShell.d.ts +6 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/ui-react.js +1 -1
- package/dist/web-core/dist/api/idempotencyKey.js +1 -0
- package/package.json +10 -9
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.152.0",
|
|
4
4
|
"platform": "Web",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
6
|
"rendererProtocolVersion": 13,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/ui-react",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.152.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "7b368269f4bffbdd64435cf2f7971b40ee6bf3965a356c8f919330bbd24ed653",
|
|
14
|
+
"bytes": 1013879
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "6598c0373851c494d4d9f20d4d9c2ba5fa4d0236a7ad17a611e71770e0422f74",
|
|
18
|
+
"bytes": 9843866
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Alert as a}from"react-bootstrap";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l={info:`info`,success:`check`,warning:`alert-triangle`,danger:`x`},u=e.filter(e=>e!==`primary`),d=[`sm`,`md`,`lg`],f=[`alert`,`status`,`none`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`];function m(e,t,r,i,a,o){return i?/* @__PURE__ */ s(`span`,{className:`alert-icon alert-icon-image`,style:o!==void 0&&o>0?{width:o,height:o}:void 0,children:/* @__PURE__ */ s(`img`,{src:i,alt:a})}):e?typeof e==`string`?/* @__PURE__ */ s(`span`,{className:`alert-icon`,children:/* @__PURE__ */ s(n,{name:e,size:t,variant:r})}):/* @__PURE__ */ s(`span`,{className:`alert-icon`,children:e}):null}function h(e){let{marker:n,props:h}=t(`AppAlert`,e),{tone:g=`info`,children:_,title:v,icon:y,iconVariant:b,iconSize:x,image:S,imageAlt:C=``,imageSize:w,className:T=``,onClose:E,dismissible:D,bordered:O=!0,accent:k=!1,size:A=`md`,action:j,role:M=`alert`,...N}=h;i(`AppAlert`,N),r(`AppAlert`,`tone`,g,u),r(`AppAlert`,`size`,A,d),r(`AppAlert`,`role`,M,f),r(`AppAlert`,`iconVariant`,b,p);let P=y===void 0?l[g]:y===`none`?null:y,F=!!S||!!P,I=j!=null&&j!==!1,L=v?/* @__PURE__ */ s(`div`,{className:`alert-heading`,children:v}):null,R=F&&!!L&&!!_,z=x!==void 0&&x>0?x:A===`lg`?R?17:15:R?13:11,B=[F?`alert-has-icon`:``,I?`alert-has-action`:``,R?`alert-stack`:``,O?``:`alert-borderless`,k?`alert-accent`:``,A===`sm`?`alert-sm`:``,A===`lg`?`alert-lg`:``,T].filter(Boolean).join(` `);return/* @__PURE__ */ s(a,{className:B||void 0
|
|
1
|
+
import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Alert as a}from"react-bootstrap";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";var l={info:`info`,success:`check`,warning:`alert-triangle`,danger:`x`},u=e.filter(e=>e!==`primary`),d=[`sm`,`md`,`lg`],f=[`alert`,`status`,`none`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`];function m(e,t,r,i,a,o){return i?/* @__PURE__ */ s(`span`,{className:`alert-icon alert-icon-image`,style:o!==void 0&&o>0?{width:o,height:o}:void 0,children:/* @__PURE__ */ s(`img`,{src:i,alt:a})}):e?typeof e==`string`?/* @__PURE__ */ s(`span`,{className:`alert-icon`,children:/* @__PURE__ */ s(n,{name:e,size:t,variant:r})}):/* @__PURE__ */ s(`span`,{className:`alert-icon`,children:e}):null}function h(e){let{marker:n,props:h}=t(`AppAlert`,e),{tone:g=`info`,children:_,title:v,icon:y,iconVariant:b,iconSize:x,image:S,imageAlt:C=``,imageSize:w,className:T=``,onClose:E,dismissible:D,bordered:O=!0,accent:k=!1,size:A=`md`,action:j,role:M=`alert`,...N}=h;i(`AppAlert`,N),r(`AppAlert`,`tone`,g,u),r(`AppAlert`,`size`,A,d),r(`AppAlert`,`role`,M,f),r(`AppAlert`,`iconVariant`,b,p);let P=y===void 0?l[g]:y===`none`?null:y,F=!!S||!!P,I=j!=null&&j!==!1,L=v?/* @__PURE__ */ s(`div`,{className:`alert-heading`,children:v}):null,R=F&&!!L&&!!_,z=x!==void 0&&x>0?x:A===`lg`?R?17:15:R?13:11,B=[F?`alert-has-icon`:``,I?`alert-has-action`:``,R?`alert-stack`:``,O?``:`alert-borderless`,k?`alert-accent`:``,A===`sm`?`alert-sm`:``,A===`lg`?`alert-lg`:``,T].filter(Boolean).join(` `);return/* @__PURE__ */ s(a,{className:B||void 0,...E?{onClose:E}:null,dismissible:D??typeof E==`function`,transition:!1,role:M===`none`?void 0:M,...n,...N,variant:g,children:F||I?/* @__PURE__ */ c(o,{children:[F&&m(P,z,b,S,C,w),/* @__PURE__ */ c(`div`,{className:`alert-content`,children:[L,_]}),I&&/* @__PURE__ */ s(`div`,{className:`alert-action`,children:j})]}):/* @__PURE__ */ c(o,{children:[L,_]})})}export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppButton.js";import n from"./AppEmptyState.js";import r from"./AppProgress.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{jsx as o}from"react/jsx-runtime";function s(s){let{marker:c,props:l}=e(`AppAsyncBlock`,s),{state:u,children:d,empty:f,skeleton:p,className:m=``,loadingLabel:h=`Loading`,errorTitle:g=`Something went wrong`,retryLabel:_=`Retry`,emptyTitle:v=`Nothing to show yet`,...y}=l;a(`AppAsyncBlock`,y),i(`AppAsyncBlock`,`state.status`,u.status,[`loading`,`error`,`empty`,`data`]);let b=`async-block${m?` ${m}`:``}`,x;switch(u.status){case`loading`:x=p??/* @__PURE__ */ o(r,{value:0,indeterminate:!0,size:`sm`,label:h});break;case`error`:x=/* @__PURE__ */ o(n,{icon:`alert-circle`,title:g,description:u.error.message,action:/* @__PURE__ */ o(t,{variant:`soft`,onClick:()=>u.retry(),children:_})});break;case`empty`:x=f??/* @__PURE__ */ o(n,{icon:`inbox`,title:v});break;case`data`:x=d(u.data)}return/* @__PURE__ */ o(`div`,{className:b,"data-state":u.status,...c,...y,children:x})}export{s as default};
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppButton.js";import n from"./AppEmptyState.js";import r from"./AppProgress.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{jsx as o}from"react/jsx-runtime";function s(s){let{marker:c,props:l}=e(`AppAsyncBlock`,s),{state:u,children:d,empty:f,skeleton:p,className:m=``,loadingLabel:h=`Loading`,errorTitle:g=`Something went wrong`,retryLabel:_=`Retry`,emptyTitle:v=`Nothing to show yet`,...y}=l;a(`AppAsyncBlock`,y),i(`AppAsyncBlock`,`state.status`,u.status,[`idle`,`loading`,`error`,`empty`,`data`]);let b=`async-block${m?` ${m}`:``}`,x;switch(u.status){case`idle`:return null;case`loading`:x=p??/* @__PURE__ */ o(r,{value:0,indeterminate:!0,size:`sm`,label:h});break;case`error`:x=/* @__PURE__ */ o(n,{icon:`alert-circle`,title:g,description:u.error.message,action:/* @__PURE__ */ o(t,{variant:`soft`,onClick:()=>u.retry(),children:_})});break;case`empty`:x=f??/* @__PURE__ */ o(n,{icon:`inbox`,title:v});break;case`data`:x=d(u.data)}return/* @__PURE__ */ o(`div`,{className:b,"data-state":u.status,...c,...y,children:x})}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppDropdown.js";import i from"./renderIconProp.js";import a from"./warnUnknownProps.js";import{createContext as o,useContext as s}from"react";import{Breadcrumb as c}from"react-bootstrap";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d=o(!1);function f(o){let{marker:f,props:p}=n(`AppBreadcrumbs`,o),{items:m=[],linkComponent:h,className:g=``,maxItems:_,moreLabel:v=`Show hidden levels`,...y}=p;a(`AppBreadcrumbs`,y);let b=s(d);if(_!==void 0&&(!Number.isInteger(_)||_<1))throw RangeError(`AppBreadcrumbs: maxItems must be a whole number of 1 or more.`);let x=_!==void 0&&m.length>_?m.length-_:0,S=m.slice(0,x).map((e,t)=>{if(typeof e.label!=`string`)throw RangeError(`AppBreadcrumbs: with maxItems, every hidden crumb's label must be a string.`);let n=e.key??`${e.label}-${t}`;return e.to?{key:n,label:e.label,icon:e.icon,to:e.to}:e.href?{key:n,label:e.label,icon:e.icon,href:e.href}:{key:n,header:e.label}});return/* @__PURE__ */ u(c,{className:g||void 0,...x>0?{listProps:{className:`wui-breadcrumb-collapse`}}:{},...f,...y,children:[x>0?/* @__PURE__ */ l(`li`,{className:`breadcrumb-item wui-breadcrumb-more`,children:/* @__PURE__ */ l(r,{icon:`more-horizontal`,iconSize:14,label:v,align:`start`,toggleClassName:`wui-breadcrumb-more-toggle`,linkComponent:h,items:S})}):null,m.map((n,r)=>{let a=!b&&r===m.length-1,o=n.icon?i(n.icon,{size:14}):null,s={};if(!a){let r=n.to||n.href;s=n.to&&h?{linkAs:t,linkProps:{link:e(h,{to:n.to})}}:r?{href:r}:{linkAs:`span`}}return/* @__PURE__ */ u(c.Item,{active:a,className:r<x?`wui-breadcrumb-collapsible`:void 0,...s,children:[o,n.label]},n.key??`${n.label}-${r}`)})]})}export{d as BreadcrumbTrailContext,f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buttonClass as e}from"../lib/buttonClass.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{FILL_VARIANTS as r,TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as
|
|
1
|
+
import{buttonClass as e}from"../lib/buttonClass.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{FILL_VARIANTS as r,TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import{FormSubmitContext as a}from"./AppForm.js";import o from"./AppIcon.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{useContext as u,useRef as d,useState as te}from"react";import{Button as ne}from"react-bootstrap";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m={sm:14,md:16,lg:20,xl:20},h=[`sheen`,`fill`,`expand`,`glow`,`roll`,`none`],re=[`rounded`,`pill`,`sharp`],ie=[`button`,`submit`,`reset`],ae=/* @__PURE__ */ new Set([!0,!1,...Array.from({length:100},(e,t)=>t+1)]),g={variant:null},_=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],v=e=>e===`pill`||e===`sharp`?`wui-btn-shape-${e}`:``;function y(e){return/* @__PURE__ */ p(`span`,{className:`wui-btn-roll`,children:[/* @__PURE__ */ f(`span`,{className:`wui-btn-roll__a`,children:e}),/* @__PURE__ */ f(`span`,{className:`wui-btn-roll__b`,"aria-hidden":`true`,children:e})]})}function oe(e,t,n,r){if(!e)return null;let i=n=>typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[t]??m.md,variant:r,className:n}):/* @__PURE__ */ f(`span`,{className:[`d-inline-flex`,n].filter(Boolean).join(` `),children:e});return/* @__PURE__ */ p(`span`,{className:n?`wui-btn-roll-ico wui-btn-pin-icon`:`wui-btn-roll-ico ms-2`,"aria-hidden":`true`,children:[i(),i(`wui-btn-roll-ico__next`)]})}function b(e,t,n,r){if(!e)return null;let i=t===`left`?`me-2`:`ms-2`;return typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[n]??m.md,variant:r,className:i}):/* @__PURE__ */ f(`span`,{className:`d-inline-flex ${i}`,children:e})}function se(e,t,n){return e?/* @__PURE__ */ f(`span`,{className:`wui-btn-pin-icon`,"aria-hidden":`true`,children:typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[t]??m.md,variant:n}):e}):null}function x(o){let{marker:x,props:ce}=ee(`AppButton`,o),{children:S,tone:C=`primary`,variant:w=`solid`,size:T=`md`,type:E=`button`,loading:D=!1,disabled:O=!1,block:k=!1,leftIcon:A=null,rightIcon:j=null,href:M,static:N=!1,tooltip:P,tooltipPlacement:F,shortcut:I,animation:L,pinRightIcon:R=!1,shape:z=`rounded`,iconVariant:B,className:V=``,onClick:H,onClickCapture:U,vibrate:W,...G}=ce,[le,K]=te(!1),q=d(!1),J=u(a),ue=J!==null&&E===`submit`&&J.submitting,Y=D||le||ue;c(`AppButton`,G),s(`AppButton`,`vibrate`,W,ae);let X=W===!0?10:typeof W==`number`&&Number.isInteger(W)&&W>=1&&W<=100?W:0;L!==void 0&&s(`AppButton`,`animation`,L,h);let Z=L===`roll`&&!N,Q=R&&j!=null&&j!==``&&!N&&!Y;if(s(`AppButton`,`tone`,C,i),s(`AppButton`,`variant`,w,r),s(`AppButton`,`size`,T,Object.keys(m)),s(`AppButton`,`shape`,z,re),s(`AppButton`,`type`,E,ie),B!==void 0&&s(`AppButton`,`iconVariant`,B,_),N){let t=[`btn`,e(C,w),T===`sm`?`btn-sm`:T===`lg`?`btn-lg`:T===`xl`?`btn-xl`:``,k?`w-100`:``,v(z),`btn-static`,V].filter(Boolean).join(` `);return l(/* @__PURE__ */ p(`span`,{className:t,...x,...G,children:[b(A,`left`,T,B),S,b(j,`right`,T,B)]}),P,F)}let de=[k?`w-100`:``,Y?`is-loading`:``,e(C,w),T===`xl`?`btn-xl`:``,L&&h.includes(L)?`btn-anim-${L}`:``,Q?`wui-btn-pin-end`:``,v(z),V].filter(Boolean).join(` `),$=(G.as===void 0||G.as===`button`)&&M===void 0&&G.to===void 0,fe=$?{}:{role:void 0,tabIndex:O||Y?-1:void 0},{as:pe,...me}=G,he={as:pe},ge=P!=null&&P!==``,_e=e=>{if(q.current)return;X&&!O&&!Y&&navigator.vibrate?.(X);let t=H?.(e);if(!(t instanceof Promise))return;q.current=!0,K(!0);let n=()=>{q.current=!1,K(!1)};t.then(n,e=>{throw n(),e})};return l(/* @__PURE__ */ p(ne,{type:$?E:void 0,href:M,...g,...T===`sm`||T===`lg`?{size:T}:null,disabled:O||Y,"aria-busy":Y||void 0,"aria-keyshortcuts":t(I),"data-wui-vibrate":X||void 0,className:de||void 0,onClick:_e,onClickCapture:O||Y?void 0:U,...fe,...x,...he,...me,children:[Y&&/* @__PURE__ */ f(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!Y&&b(A,`left`,T,B),Z?y(S):S,!Y&&(Z?oe(j,T,Q,B):Q?se(j,T,B):b(j,`right`,T,B)),!ge&&n(I)]}),P,F,I)}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{useState as
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{useState as te}from"react";import{Card as i}from"react-bootstrap";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";var ne=[`flat`,`elevated`,`outline`,`filled`,`accent`],c={elevated:`card-elevated`,outline:`card-outlined`,filled:`card-muted`,accent:`card-accent`},l=[`primary`,`success`,`warning`,`danger`,`info`],u=[`none`,`sm`,`md`,`lg`],d=[`sans`,`serif`],f={xs:320,sm:420,md:560,lg:720};function p(p){let{marker:re,props:ie}=t(`AppCard`,p),{title:m,subtitle:h,headerIcon:g,titleClassName:_=``,titleFont:v=`sans`,header:y,headerExtra:b,headerActions:x,footer:S,media:C,children:w,variant:T=`flat`,tone:E=`primary`,padding:D=`md`,maxWidth:O,className:ae=``,bodyClassName:k=``,headerClassName:A=``,body:j=!0,lifted:M=!1,flush:N=!1,divided:P=!1,href:F,onClick:I,linkComponent:L,onClose:R,dismissible:z,closeLabel:B=`Close`,...V}=ie,[H,U]=te(!1);ee(`AppCard`,V),r(`AppCard`,`variant`,T,ne),r(`AppCard`,`tone`,E,l),r(`AppCard`,`padding`,D,u),r(`AppCard`,`titleFont`,v,d);let{style:W,as:G,...K}=V,q=F!=null||I!=null,oe=[c[T]??``,T===`accent`&&E&&E!==`primary`?`tone-${E}`:``,D&&D!==`md`?`card-pad-${D}`:``,N?`card-flush`:``,P?`card-divided`:``,M?`card-lifted`:``,O==null?``:`card-constrained`,q?`card-clickable`:``,ae].filter(Boolean).join(` `)||void 0,J=O==null?void 0:f[String(O)],Y=O==null?void 0:J==null?typeof O==`number`?`${O}px`:O:`${J}px`,se=Y?{"--card-max-width":Y,...W}:W,X={};if(F!=null){let t=e(L,{href:F});X=t.Tag===`a`?{as:`a`,href:t.linkProps.href}:{as:t.Tag,to:t.linkProps.to},I&&(X.onClick=I)}else I!=null&&(X={role:`button`,tabIndex:0,onClick:I,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I(e))}});let Z=z??typeof R==`function`,ce=Z?/* @__PURE__ */ o(`button`,{type:`button`,className:`card-close`,"aria-label":B,onClick:e=>{e.preventDefault(),e.stopPropagation(),U(!0),R?.()},onKeyDown:e=>e.stopPropagation(),children:/* @__PURE__ */ o(n,{name:`x`,size:16})}):null,Q=m!=null||h!=null||g!=null,le=y!=null||Q||b!=null||x!=null||Z,$=g==null?null:typeof g==`string`?/* @__PURE__ */ o(n,{name:g,size:18}):g;return H?null:/* @__PURE__ */ s(i,{className:oe,style:se,...re,...K,...G===void 0?null:{as:G},...X,children:[C!=null&&/* @__PURE__ */ o(`div`,{className:`card-media`,children:C}),le&&/* @__PURE__ */ s(i.Header,{className:A||void 0,children:[y??/* @__PURE__ */ s(a,{children:[Q&&/* @__PURE__ */ s(`div`,{className:`card-header-main`,children:[$!=null&&/* @__PURE__ */ o(`span`,{className:`card-header-icon`,children:$}),/* @__PURE__ */ s(`div`,{className:`card-header-titles`,children:[m!=null&&/* @__PURE__ */ o(`div`,{className:[`card-title`,_].filter(Boolean).join(` `),style:v===`serif`?{fontFamily:`var(--wui-font-display)`}:void 0,children:m}),h!=null&&/* @__PURE__ */ o(`div`,{className:`card-subtitle`,children:h})]})]}),b,x!=null&&/* @__PURE__ */ o(`div`,{className:`card-header-actions`,children:x})]}),ce]}),j?/* @__PURE__ */ o(i.Body,{className:k||void 0,children:w}):w,S!=null&&/* @__PURE__ */ o(`div`,{className:`card-footer`,children:S})]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./warnUnknownProps.js";import{Children as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=()=>import(`@webority/ui-elements/elements/carousel`);function c(c){let{marker:l,props:u}=t(`AppCarousel`,c),{label:d,autoplay:f,loop:p=!1,perView:m,perViewMd:h,perViewLg:g,arrows:_=!0,dots:v=!0,previousLabel:y=`Previous slide`,nextLabel:b=`Next slide`,dotLabel:x=`Go to slide`,pauseLabel:S=`Pause`,playLabel:C=`Play`,className:w=``,children:T,style:E,...D}=u;r(`AppCarousel`,D),e(`wui-carousel`,s);let O=Number(f)>0?Math.round(Number(f)):0,k={...Number(m)>1?{"--wui-carousel-per-view":m}:null,...Number(h)>=1?{"--wui-carousel-per-view-md":h}:null,...Number(g)>=1?{"--wui-carousel-per-view-lg":g}:null};return/* @__PURE__ */ o(`wui-carousel`,{class:[`wui-carousel`,w].filter(Boolean).join(` `),role:`region`,"aria-roledescription":`carousel`,"aria-label":d,autoplay:O||void 0,loop:p?``:void 0,"dot-label":x===`Go to slide`?void 0:x,"pause-label":S===`Pause`?void 0:S,"play-label":C===`Play`?void 0:C,style:Object.keys(k).length||E?{...k,...E}:void 0,...l,...D,children:[O?/* @__PURE__ */ o(`button`,{type:`button`,className:`wui-carousel-pause`,children:[/* @__PURE__ */ a(`span`,{className:`wui-carousel-pause-icon`,"aria-hidden":`true`}),/* @__PURE__ */ a(`span`,{className:`wui-carousel-pause-text`,children:S})]}):null,/* @__PURE__ */ o(`div`,{className:`wui-carousel-stage`,children:[_?/* @__PURE__ */ a(`button`,{type:`button`,className:`wui-carousel-arrow wui-carousel-prev`,"aria-label":y,children:/* @__PURE__ */ a(n,{name:`chevron-left`,size:20})}):null,/* @__PURE__ */ a(`div`,{className:`wui-carousel-track`,tabIndex:0,role:`group`,"aria-label":d,children:i.map(i.toArray(T),e=>/* @__PURE__ */ a(`div`,{className:`wui-carousel-slide`,role:`group`,"aria-roledescription":`slide`,children:e}))}),_?/* @__PURE__ */ a(`button`,{type:`button`,className:`wui-carousel-arrow wui-carousel-next`,"aria-label":b,children:/* @__PURE__ */ a(n,{name:`chevron-right`,size:20})}):null]}),v?/* @__PURE__ */ a(`div`,{className:`wui-carousel-dots`}):null,/* @__PURE__ */ a(`span`,{className:`visually-hidden`,"data-wui-status":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{c as default};
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./warnUnknownProps.js";import{Children as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s=()=>import(`@webority/ui-elements/elements/carousel`);function c(c){let{marker:l,props:u}=t(`AppCarousel`,c),{label:d,autoplay:f,loop:p=!1,perView:m,perViewMd:h,perViewLg:g,arrows:_=!0,dots:v=!0,previousLabel:y=`Previous slide`,nextLabel:b=`Next slide`,dotLabel:x=`Go to slide`,pauseLabel:S=`Pause`,playLabel:C=`Play`,className:w=``,children:T,style:E,...D}=u;r(`AppCarousel`,D),e(`wui-carousel`,s);let O=Number(f)>0?Math.round(Number(f)):0,k={...m!==void 0&&Number(m)>1?{"--wui-carousel-per-view":m}:null,...h!==void 0&&Number(h)>=1?{"--wui-carousel-per-view-md":h}:null,...g!==void 0&&Number(g)>=1?{"--wui-carousel-per-view-lg":g}:null};return/* @__PURE__ */ o(`wui-carousel`,{class:[`wui-carousel`,w].filter(Boolean).join(` `),role:`region`,"aria-roledescription":`carousel`,"aria-label":d,autoplay:O||void 0,loop:p?``:void 0,"dot-label":x===`Go to slide`?void 0:x,"pause-label":S===`Pause`?void 0:S,"play-label":C===`Play`?void 0:C,style:Object.keys(k).length||E?{...k,...E}:void 0,...l,...D,children:[O?/* @__PURE__ */ o(`button`,{type:`button`,className:`wui-carousel-pause`,children:[/* @__PURE__ */ a(`span`,{className:`wui-carousel-pause-icon`,"aria-hidden":`true`}),/* @__PURE__ */ a(`span`,{className:`wui-carousel-pause-text`,children:S})]}):null,/* @__PURE__ */ o(`div`,{className:`wui-carousel-stage`,children:[_?/* @__PURE__ */ a(`button`,{type:`button`,className:`wui-carousel-arrow wui-carousel-prev`,"aria-label":y,children:/* @__PURE__ */ a(n,{name:`chevron-left`,size:20})}):null,/* @__PURE__ */ a(`div`,{className:`wui-carousel-track`,tabIndex:0,role:`group`,"aria-label":d,children:i.map(i.toArray(T),e=>/* @__PURE__ */ a(`div`,{className:`wui-carousel-slide`,role:`group`,"aria-roledescription":`slide`,children:e}))}),_?/* @__PURE__ */ a(`button`,{type:`button`,className:`wui-carousel-arrow wui-carousel-next`,"aria-label":b,children:/* @__PURE__ */ a(n,{name:`chevron-right`,size:20})}):null]}),v?/* @__PURE__ */ a(`div`,{className:`wui-carousel-dots`}):null,/* @__PURE__ */ a(`span`,{className:`visually-hidden`,"data-wui-status":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{isValidElement as i,useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u=[`stack`,`scroll`],d=[`comfortable`,`relaxed`],f=[`start`,`center`],
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{isValidElement as i,useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";var u=[`stack`,`scroll`],d=[`comfortable`,`relaxed`],f=[`boxed`,`plain`],p=[`start`,`center`],m={yes:{icon:`tick-circle`},no:{icon:`close-circle`},warn:{icon:`danger`},partial:{icon:`minus-circle`}};function h(e){return typeof e==`object`&&!!e&&!i(e)}function g(e){return h(e)&&`state`in e}function _(e){return h(e)&&`code`in e}function v(e){return e.scrollLeft+e.clientWidth<e.scrollWidth-1}function y(...e){return e.filter(Boolean).join(` `)||void 0}function b(e){return y(e.highlight&&`is-highlight`,e.align===`center`&&`wui-compare-center`,e.nowrap&&`wui-compare-nowrap`)}function x(e,r){if(e===!0)return/* @__PURE__ */ l(`span`,{className:`compare-yes`,children:[/* @__PURE__ */ c(t,{name:`check`,size:16}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:r.yesLabel})]});if(e===!1)return/* @__PURE__ */ l(`span`,{className:`compare-no`,children:[/* @__PURE__ */ c(`span`,{"aria-hidden":`true`,children:`-`}),/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:r.noLabel})]});if(g(e)){let i=m[e.state],a={yes:r.yesLabel,no:r.noLabel,warn:r.warningLabel,partial:r.partialLabel};return n(`AppCompareTable`,`state`,e.state,Object.keys(m)),/* @__PURE__ */ l(`span`,{className:`wui-compare-state wui-compare-state-${e.state}`,children:[i&&/* @__PURE__ */ c(t,{name:i.icon,size:16,variant:`bulk`}),i&&/* @__PURE__ */ c(`span`,{className:`visually-hidden`,children:`${a[e.state]}: `}),e.text]})}return _(e)?/* @__PURE__ */ c(`span`,{className:`wui-compare-code`,children:e.code}):e}function S(e,t,n){let r=[],i=null;return t.forEach((t,a)=>{t.group!=null&&t.group!==i&&r.push(/* @__PURE__ */ c(`tr`,{className:`wui-compare-group-row`,children:/* @__PURE__ */ c(`th`,{colSpan:e.length,scope:`rowgroup`,className:`wui-compare-group`,children:t.group})},`group:${t.group}:${t.key??t.label}`)),i=t.group??null,r.push(/* @__PURE__ */ l(`tr`,{children:[/* @__PURE__ */ c(`th`,{scope:`row`,children:t.label}),t.values.map((t,r)=>{let i=e[r+1];return/* @__PURE__ */ c(`td`,{className:b(i??{}),"data-label":i?.label,children:x(t,n)},i?.label??r)})]},t.key??`${t.label}-${a}`))}),r}function C(t){let{marker:i,props:m}=e(`AppCompareTable`,t),{columns:h,rows:g,caption:_,mobile:x=`stack`,stickyFirstColumn:C=!1,stickyHeader:w=!1,density:T=`comfortable`,variant:E=`boxed`,yesLabel:D=`Yes`,noLabel:O=`No`,warningLabel:k=`Warning`,partialLabel:A=`Partial`,className:j=``,...M}=m,N={yesLabel:D,noLabel:O,warningLabel:k,partialLabel:A},P=o(null),[F,I]=s(!1);if(a(()=>{let e=()=>{let e=P.current;e&&I(v(e))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),!Array.isArray(h))throw Error(`<AppCompareTable> columns is required: pass the feature-name column, then one per option.`);if(!Array.isArray(g))throw Error(`<AppCompareTable> rows is required: pass one row per capability.`);r(`AppCompareTable`,M),n(`AppCompareTable`,`mobile`,x,u),n(`AppCompareTable`,`density`,T,d),n(`AppCompareTable`,`variant`,E,f);for(let e of h)n(`AppCompareTable`,`align`,e.align,p);let L=x===`scroll`,R=/* @__PURE__ */ l(`table`,{className:y(L&&`wui-compare-scroll-table`,L&&C&&`wui-compare-sticky-first`),children:[_&&/* @__PURE__ */ c(`caption`,{className:`visually-hidden`,children:_}),/* @__PURE__ */ c(`thead`,{children:/* @__PURE__ */ c(`tr`,{children:h.map((e,t)=>/* @__PURE__ */ c(`th`,{scope:`col`,className:b(e),children:e.label},e.label?`col-${t}-${e.label}`:`col-${t}`))})}),/* @__PURE__ */ c(`tbody`,{children:S(h,g,N)})]});return/* @__PURE__ */ c(`div`,{className:y(`compare-table`,T===`relaxed`&&`wui-compare-relaxed`,E===`plain`&&`wui-compare-plain`,w&&`wui-compare-sticky-head`,j),"data-mobile":x,...i,...M,children:L?/* @__PURE__ */ c(`div`,{className:`wui-compare-scroll`,ref:P,tabIndex:0,role:_?`region`:void 0,"aria-label":_||void 0,"data-more":F?`end`:void 0,onScroll:e=>I(v(e.currentTarget)),children:R}):R})}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./assertValidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[3
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./assertValidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[`Quarter`,`Third`,`Half`,`TwoThirds`,`Full`,`Fifth`],a={Quarter:` wui-dashboard-cell-3`,Third:` wui-dashboard-cell-4`,Half:` wui-dashboard-cell-6`,TwoThirds:` wui-dashboard-cell-8`,Fifth:` wui-dashboard-cell-fifth`,Full:``};function o(o){let{marker:s,props:c}=e(`AppDashboardCell`,o),{span:l=`Full`,children:u,className:d=``,...f}=c;n(`AppDashboardCell`,f),t(`AppDashboardCell`,`span`,l,i);let p=a[l];return/* @__PURE__ */ r(`div`,{className:`wui-dashboard-cell${p}${d?` ${d}`:``}`,...s,...f,children:u})}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import{TargetLink as i}from"../lib/TargetLink.js";import{TONES as a}from"../lib/vocabulary.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import{TargetLink as i}from"../lib/TargetLink.js";import{TONES as a}from"../lib/vocabulary.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import ee from"./warnUnknownProps.js";import te from"./withTooltip.js";import{Fragment as ne,forwardRef as u,useEffect as d,useRef as f,useState as p}from"react";import{Dropdown as m}from"react-bootstrap";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`sm`,`md`,`lg`,`xl`],v=[`neutral`],y=[`sm`,`md`,`lg`,`fit`],re=e=>{e.preventDefault(),e.stopPropagation()},ie=u(function(e,t){return/* @__PURE__ */ h(`button`,{...e,ref:t,"aria-disabled":`true`})}),b=e=>e.description?/* @__PURE__ */ g(`span`,{className:`wui-dropdown-item-body`,children:[/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-label`,children:e.label}),/* @__PURE__ */ h(`span`,{className:`wui-dropdown-item-desc`,children:e.description})]}):e.label,x=!1;function S(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!x&&(x=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function C(u){let{marker:x,props:C}=o(`AppDropdown`,u),{icon:ae,iconSize:oe,toggleClassName:T,toggleVariant:E,menuWidth:D,label:O,ariaLabel:k,align:A=`end`,items:j=[],menuClassName:M=``,linkComponent:N,children:P,trigger:F,open:I,onOpenChange:L,searchable:R,searchPlaceholder:z,noMatchText:B,...V}=C;if(ee(`AppDropdown`,V),R&&P!=null)throw Error(`<AppDropdown> searchable filters items, so it takes items and no children.`);if(!R&&(z!==void 0||B!==void 0))throw Error(`<AppDropdown> searchPlaceholder and noMatchText need searchable.`);for(let e of j)c(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,_),c(`AppDropdown`,`items[].tone`,e.tone,a);F||k||O||S(),c(`AppDropdown`,`toggleVariant`,E,v),c(`AppDropdown`,`menuWidth`,D,y),E&&!F&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let H=(T??(F?`wui-dropdown-trigger`:`topbar-icon-btn`))+(F&&E===`neutral`?` wui-dropdown-trigger-neutral`:``),U=[D&&y.includes(D)?`wui-dropdown-menu-${D}`:``,R?`wui-dropdown-menu-searchable`:``,M].filter(Boolean).join(` `),[W,G]=p(``),K=f(null),q=z??`Search`,se=B??`No matches.`,J=W.trim().toLowerCase(),Y=J?j.filter(e=>!e.divider&&e.header==null&&String(e.label??``).toLowerCase().includes(J)):j,ce=ae??(F?void 0:`more-horizontal`),X=I!==void 0,[le,ue]=p(!1),Z=X?!!I:le,Q=f(null);Q.current=(e,t)=>{X||ue(e),L?.(e,t)};let $=f(null);return d(()=>{if(!Z)return;let e=$.current?.getBoundingClientRect(),t=()=>{let t=$.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&Q.current?.(!1,{source:`scroll`})},n=()=>Q.current?.(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[Z]),d(()=>{R&&Z&&K.current?.focus(),Z||G(``)},[Z,R]),d(()=>{let e=K.current;if(!R||!e)return;let t=t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault(),t.stopPropagation();let n=Array.from(e.closest(`.dropdown-menu`)?.querySelectorAll(`.dropdown-item`)??[]);(t.key===`ArrowDown`?n[0]:n[n.length-1])?.focus()}else t.key===`Escape`?(t.preventDefault(),t.stopPropagation(),Q.current?.(!1,{source:`keydown`,originalEvent:t}),$.current?.querySelector(`:scope > button`)?.focus()):t.key!==`Tab`&&t.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[R]),/* @__PURE__ */ g(m,{ref:$,align:A,show:Z,onToggle:(e,t)=>Q.current?.(e,t),...x,...V,children:[/* @__PURE__ */ h(m.Toggle,{as:w,icon:ce,iconSize:oe,btnClassName:H,trigger:F,title:O,"aria-label":k??(F?void 0:O)}),/* @__PURE__ */ g(m.Menu,{className:U,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:[R?/* @__PURE__ */ g(`div`,{className:`wui-dropdown-search`,children:[/* @__PURE__ */ h(s,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:K,type:`search`,className:`wui-dropdown-search-input`,autoComplete:`off`,placeholder:q,"aria-label":q,value:W,onChange:e=>G(e.target.value)})]}):null,P??Y.map(e=>{if(e.to&&e.href)throw RangeError(`AppDropdown: an item takes to or href, not both.`);if(e.header!=null)return/* @__PURE__ */ h(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ h(m.Divider,{},e.key);if(e.disabled)return/* @__PURE__ */ h(ne,{children:te(/* @__PURE__ */ g(m.Item,{as:ie,type:`button`,className:[e.tone===`danger`&&`danger`,`wui-dropdown-item-disabled`].filter(Boolean).join(` `),onClick:re,children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),b(e),e.disabledReason&&/* @__PURE__ */ g(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let a=e.to?{as:i,link:t(N,{to:e.to})}:e.href?{as:i,link:t(N,{href:e.href,external:!0})}:{as:`button`,type:`button`},o=[e.tone===`danger`&&`danger`,e.hiddenFrom&&_.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return/* @__PURE__ */ g(m.Item,{...a,onClick:e.onClick,className:o,"aria-keyshortcuts":n(e.shortcut),children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),b(e),r(e.shortcut)]},e.key)}),R&&J&&Y.length===0?/* @__PURE__ */ h(`div`,{className:`wui-dropdown-empty`,role:`status`,children:se}):null]})]})}var w=u(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:a,...o},c){return/* @__PURE__ */ h(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...o,children:r??(e===void 0?null:/* @__PURE__ */ h(s,{name:e,size:t}))})});export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import t from"../lib/FileItemRow.js";import{keyOf as n,linkOf as r,nameOf as i,sizeLabelOf as a,uploadErrorOf as o,uploadProgressOf as s,useItemUrl as c}from"../lib/fileItem.js";import l from"../lib/fillLabel.js";import{linkTarget as ee}from"../lib/linkTarget.js";import{TargetLink as u}from"../lib/TargetLink.js";import d from"../lib/useFileDrop.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppIcon.js";import m from"./AppProgress.js";import h from"./warnUnknownProps.js";import{DEFAULT_IMAGE_ACCEPT as g,DEFAULT_MAX_SIZE_MB as _,acceptDroppedFiles as v,acceptLabel as y,isImageFile as b,isImageOnlyAccept as x}from"@webority/ui-elements/helpers";import{useId as S,useState as C}from"react";import{
|
|
1
|
+
import e from"../lib/FieldMessage.js";import t from"../lib/FileItemRow.js";import{keyOf as n,linkOf as r,nameOf as i,sizeLabelOf as a,uploadErrorOf as o,uploadProgressOf as s,useItemUrl as c}from"../lib/fileItem.js";import l from"../lib/fillLabel.js";import{linkTarget as ee}from"../lib/linkTarget.js";import{TargetLink as u}from"../lib/TargetLink.js";import d from"../lib/useFileDrop.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppIcon.js";import m from"./AppProgress.js";import h from"./warnUnknownProps.js";import{DEFAULT_IMAGE_ACCEPT as g,DEFAULT_MAX_SIZE_MB as _,acceptDroppedFiles as v,acceptLabel as y,isImageFile as b,isImageOnlyAccept as x}from"@webority/ui-elements/helpers";import{useId as S,useState as C}from"react";import{jsx as w,jsxs as T}from"react/jsx-runtime";function E(i){let{marker:a,props:o}=f(`AppFileAttachment`,i),{label:s=`Attachment`,value:c,name:l,onChange:ee,multiple:u=!1,accept:m=g,maxSizeMb:y=_,optional:E=!1,validate:A=!0,error:j,id:M,linkComponent:N,browseLabel:P=`Browse`,removeLabel:F=`Remove attachment`,uploadingLabel:te=`Uploading {name}`,maxSizeText:ne=`Up to {size} MB`,typesAndMaxSizeText:re=`{types}, up to {size} MB`,removeFileLabel:ie=`Remove {name}`,optionalLabel:ae=`(optional)`,dropTitle:oe,...I}=o;if(h(`AppFileAttachment`,I),!u&&Array.isArray(c))throw TypeError(`[@webority/ui-react] <AppFileAttachment> received a list of files as value without multiple. Pass one file (or null), or set multiple to take a list.`);let L=S(),R=M||L,[z,B]=C(``),V=Array.isArray(c)?c:c?[c]:[],H=x(m),U=e=>e instanceof File?b(e):H||b(O(e)),W=V[0],G=!u&&W!==void 0&&U(W)&&(W instanceof File||r(W)!==null)?W:void 0,K=D(m,y,ne,re),q=A?{accept:m,maxSizeMb:y,multiple:u}:{accept:``,maxSizeMb:0,multiple:u},J=e=>{i.multiple!==!0&&i.onChange(e)},Y=e=>{i.multiple===!0&&i.onChange(e)};function X(e){if(B(``),u){let t=Array.isArray(c)?c:c?[c]:[],r=new Set(t.map(n)),i=t.concat(e.filter(e=>!r.has(n(e))));Y(i)}else J(e[0]??null)}function se(e){if(!e.length)return;let{files:t,rejections:n}=v(e,q);t.length&&X(t),B(n[0]?.message??``)}let{dragOver:ce,dropProps:le}=d({...q,disabled:I.disabled,onFiles:X,onReject:e=>B(e.message)});function ue(e){let t=Array.from(e.target.files||[]);e.target.value=``,se(t)}function Z(e){B(``),u?Y(V.filter((t,n)=>n!==e)):J(null)}let Q=j||z,de=Q?`${R}-error`:void 0,fe=u||V.length===0,$=H?`image`:`file`,pe=oe??(u?`Add ${$}s`:`Add ${H?`an`:`a`} ${$}`);return/* @__PURE__ */ T(`div`,{...a,className:`field`,children:[/* @__PURE__ */ T(`label`,{className:`label`,htmlFor:R,children:[s,E&&/* @__PURE__ */ w(`span`,{className:`label-optional`,children:` ${ae}`})]}),/* @__PURE__ */ T(`label`,{className:`attach-drop${ce?` dragging`:``}`,htmlFor:R,style:fe?void 0:{display:`none`},...le,children:[/* @__PURE__ */ w(`span`,{className:`attach-drop-icon`,children:/* @__PURE__ */ w(p,{name:H?`image`:`file-text`,size:18})}),/* @__PURE__ */ T(`span`,{className:`attach-drop-copy`,children:[/* @__PURE__ */ w(`span`,{className:`attach-drop-title`,children:pe}),K&&/* @__PURE__ */ w(`span`,{className:`attach-drop-hint`,children:K})]}),/* @__PURE__ */ w(`span`,{className:`attach-drop-cta`,children:P})]}),/* @__PURE__ */ w(`input`,{id:R,type:`file`,className:`visually-hidden`,name:l,accept:m||void 0,multiple:u||void 0,"aria-describedby":de,onChange:ue,...I}),G?/* @__PURE__ */ w(k,{item:G,isImage:!0,linkComponent:N,onRemove:()=>Z(0),removeLabel:F,uploadingLabel:te}):V.length>0&&/* @__PURE__ */ w(`div`,{className:`attach-list`,children:V.map((e,r)=>/* @__PURE__ */ w(t,{item:e,isImage:U(e),linkComponent:N,onRemove:()=>Z(r),removeFileLabel:ie},n(e)))}),/* @__PURE__ */ w(e,{error:Q,errorId:`${R}-error`})]})}function D(e,t,n,r){let i=e?.trim()?y(e):``,a=t>0;return i&&a?l(r,{types:i,size:t}):a?l(n,{size:t}):i}function O({name:e,url:t}){return{...e===void 0?null:{name:e},...t===void 0?null:{url:t}}}function k({item:e,isImage:t,linkComponent:n,onRemove:d,removeLabel:f,uploadingLabel:h}){let g=c(e,t),_=i(e),v=a(e),y=s(e),b=o(e),x=r(e),S=e instanceof File?void 0:e.to,C=ee(n,{to:S,href:x??void 0,routeHref:!1});return/* @__PURE__ */ T(`div`,{className:b?`attach-preview wui-attach-failed`:`attach-preview`,children:[/* @__PURE__ */ T(`div`,{className:`attach-figure`,children:[/* @__PURE__ */ w(`img`,{src:g??void 0,alt:_}),/* @__PURE__ */ w(`button`,{type:`button`,className:`attach-remove`,"aria-label":f,onClick:d,children:/* @__PURE__ */ w(p,{name:`x`,size:18})})]}),/* @__PURE__ */ T(`div`,{className:`attach-meta`,children:[/* @__PURE__ */ w(`div`,{className:`attach-name`,children:x||S?/* @__PURE__ */ w(u,{link:C,children:_}):_}),v&&/* @__PURE__ */ w(`div`,{className:`attach-size`,children:v})]}),y!==null&&/* @__PURE__ */ w(m,{value:y,size:`sm`,label:l(h,{name:_}),className:`wui-attach-progress`}),b&&/* @__PURE__ */ w(`div`,{className:`wui-attach-error`,children:b})]})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/FileItemRow.js";import{FIELD_SIZES as r}from"../lib/fieldState.js";import{keyOf as i}from"../lib/fileItem.js";import a from"../lib/fillLabel.js";import o from"../lib/useFileDrop.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import re from"./AppSpinner.js";import c from"./assertValidValue.js";import ie from"./warnUnknownProps.js";import ae from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as oe,acceptDroppedFiles as se,acceptLabel as l,isImageFile as u,isImageOnlyAccept as ce,isPdfFile as le}from"@webority/ui-elements/helpers";import{useEffect as d,useId as ue,useRef as de,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var fe=[`dropzone`,`button`],pe={sm:` input-sm`,md:``,lg:` input-lg`},me={md:``,lg:` btn-lg`};function h(
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/FileItemRow.js";import{FIELD_SIZES as r}from"../lib/fieldState.js";import{keyOf as i}from"../lib/fileItem.js";import a from"../lib/fillLabel.js";import o from"../lib/useFileDrop.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import re from"./AppSpinner.js";import c from"./assertValidValue.js";import ie from"./warnUnknownProps.js";import ae from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as oe,acceptDroppedFiles as se,acceptLabel as l,isImageFile as u,isImageOnlyAccept as ce,isPdfFile as le}from"@webority/ui-elements/helpers";import{useEffect as d,useId as ue,useRef as de,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";var fe=[`dropzone`,`button`],pe={sm:` input-sm`,md:``,lg:` input-lg`},me={md:``,lg:` btn-lg`};function h(e){return e instanceof File?e:{url:e.url,...e.name===void 0?null:{name:e.name}}}function g(g){let{marker:he,props:ge}=ee(`AppFilePicker`,g),{label:_,value:v,name:_e,id:ve,onChange:ye,multiple:y=!1,variant:b=`dropzone`,buttonLabel:be=`Add file`,browseLabel:xe=`Click to upload`,dropLabel:Se=`or drag & drop`,maxSizeText:Ce=`up to {size} MB`,optionalLabel:we=`(optional)`,changeImageLabel:Te=`Change image`,changeFileLabel:Ee=`Change file`,maxFilesText:De=`Up to {count} files.`,removeFileLabel:Oe=`Remove {name}`,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=oe,required:w,optional:ke=!1,error:Ae,helperText:T,help:E,helpLabel:je=`More information`,loading:D=!1,readOnly:O=!1,size:k,disabled:A=!1,className:j=``,fieldClassName:M=``,style:N,...P}=ge;if(ie(`AppFilePicker`,P),c(`AppFilePicker`,`variant`,b,fe),c(`AppFilePicker`,`size`,k,r),!y&&Array.isArray(v))throw TypeError(`[@webority/ui-react] <AppFilePicker> received a list of files as value without multiple. Pass one file (or null), or set multiple to take a list.`);let F=k===void 0?``:pe[k]??``,I=O?{"aria-readonly":`true`,"data-wui-readonly":``}:null,[Me,L]=f(null),[Ne,R]=f(null),[Pe,z]=f(``),B=de(null),Fe=ue(),V=ve||Fe,H=A||D;d(()=>{if(!y&&v instanceof File&&u(v)){let e=URL.createObjectURL(v);return L(e),()=>URL.revokeObjectURL(e)}L(null)},[v,y]);let U=y||Array.isArray(v)?void 0:v,W=U&&!u(h(U))&&le(h(U))?U instanceof File?U:U.url:null;d(()=>{if(!W){R(null);return}let t=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof W==`string`?{url:W}:W)).then(e=>{t&&(n=URL.createObjectURL(e),R(n))}).catch(t=>e(`[AppFilePicker] the PDF preview failed:`,t?.message)),()=>{t=!1,R(null),n&&URL.revokeObjectURL(n)}},[W]);let G=y?Array.isArray(v)?v:v?[v]:[]:[],K=Ae||Pe,q=K?`${V}-error`:void 0,J=T&&!K?`${V}-hint`:void 0,Ie=q||J,Y=ce(S),Le=b===`button`,Re=`btn btn-outline-primary${(k===`md`||k===`lg`?me[k]:void 0)??` btn-sm`}`,ze=!y&&!!v,X=!!U&&(U instanceof File?u(U):Y||u(h(U))),Be=U?.name,Ve=U instanceof File?void 0:U?.url,He=X?Ve||Me:Ne,Z=X?`image`:`file`,Ue=_?`Change ${_}`:`Change ${Z}`,We=_?`Remove ${_}`:`Remove ${Z}`,Ge=_?`${_} preview`:`Selected ${Z} preview`,Ke={accept:S,maxSizeMb:C,multiple:y},qe=e=>{g.multiple!==!0&&g.onChange(e)},Je=e=>{g.multiple===!0&&g.onChange(e)},Ye=e=>{if(z(``),!y){qe(e[0]??null);return}let t=Array.isArray(v)?v:v?[v]:[],n=new Set(t.map(i)),r=[];for(let t of e)n.has(i(t))||(n.add(i(t)),r.push(t));let o=t.concat(r);x&&o.length>x&&(o=o.slice(0,x),z(a(De,{count:x}))),Je(o)},Xe=e=>z(e.message),{dragOver:Ze,dropProps:Qe}=o({...Ke,disabled:H||O,onFiles:Ye,onReject:Xe}),$e=e=>{if(O)return;let{files:t,rejections:n}=se(e,Ke);t.length&&Ye(t);let[r]=n;r&&Xe(r)},et=e=>$e(e.target.files),tt=e=>{O||(z(``),Je(G.filter((t,n)=>n!==e)))},nt=()=>{O||B.current?.click()},Q=D?/* @__PURE__ */ p(`span`,{className:`wui-file-busy`,children:/* @__PURE__ */ p(re,{size:`sm`})}):null,$=/* @__PURE__ */ p(`input`,{id:V,name:_e,ref:B,type:`file`,"aria-describedby":Ie,accept:S,multiple:y||void 0,disabled:H||void 0,className:`visually-hidden`,onClick:e=>{O?e.preventDefault():e.currentTarget.value=``},onChange:et,...P});return/* @__PURE__ */ m(`div`,{...he,className:`field${M?` ${M}`:``}`,children:[_?/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:V,children:[_,ke&&!w&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${we}`}),w&&/* @__PURE__ */ p(ne,{}),E&&/* @__PURE__ */ p(te,{label:je,children:E})]}):null,Le?/* @__PURE__ */ m(`div`,{className:`file-input wui-file-input-button-field${F}${K?` error`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,...I,children:[/* @__PURE__ */ m(`label`,{htmlFor:V,className:Re,children:[/* @__PURE__ */ p(s,{name:`paperclip`,size:16}),be]}),$,Q]}):ze?/* @__PURE__ */ m(`div`,{className:`file-preview${F}${K?` error`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,...I,children:[/* @__PURE__ */ m(`button`,{type:`button`,className:`file-preview-open`,"aria-label":Ue,onClick:nt,disabled:H||O,children:[He?/* @__PURE__ */ p(`img`,{src:He,alt:Ge,className:`file-preview-img`}):/* @__PURE__ */ m(`span`,{className:`file-preview-file`,children:[/* @__PURE__ */ p(s,{name:`file-text`,size:28}),/* @__PURE__ */ p(`span`,{className:`file-preview-file-name`,children:Be})]}),/* @__PURE__ */ p(`span`,{className:`file-preview-overlay`,children:/* @__PURE__ */ m(`span`,{className:`file-preview-cta`,children:[/* @__PURE__ */ p(s,{name:X?`image`:`file-text`,size:16}),` `,X?Te:Ee]})})]}),ae(/* @__PURE__ */ p(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":We,onClick:()=>qe(null),disabled:H||O,children:/* @__PURE__ */ p(s,{name:`x`,size:16})}),We),$,Q]}):/* @__PURE__ */ m(`div`,{className:`file-input file-input-tall${F}${Ze?` dragging`:``}${K?` error`:``}${y&&G.length>0?` has-files`:``}${j?` ${j}`:``}`,style:N,"aria-busy":D||void 0,"aria-disabled":A||void 0,...I,...Qe,children:[/* @__PURE__ */ m(`label`,{htmlFor:V,className:`file-input-zone-label`,children:[/* @__PURE__ */ p(`span`,{className:`file-input-icon`,children:/* @__PURE__ */ p(s,{name:`upload`,size:24})}),/* @__PURE__ */ m(`span`,{className:`file-input-title`,children:[/* @__PURE__ */ p(`span`,{className:`browse`,children:xe}),` ${Se}`]}),/* @__PURE__ */ p(`span`,{className:`file-input-text`,children:C>0?`${l(S)}, ${a(Ce,{size:C})}`:l(S)})]}),$,Q,y&&G.length>0&&/* @__PURE__ */ p(`div`,{className:`attach-list`,children:G.map((e,t)=>/* @__PURE__ */ p(n,{item:e,isImage:e instanceof File?u(e):Y||u(h(e)),noun:`file`,removeFileLabel:Oe,readOnly:O,onRemove:()=>tt(t)},i(e)))})]}),/* @__PURE__ */ p(t,{error:K,hint:T,errorId:q,hintId:J})]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{emptyFacetValue as e,isFacetActive as t}from"../web-core/dist/query/listQuery.js";import{devWarn as n}from"../lib/devWarn.js";import r from"../lib/fillLabel.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppButton.js";import ee from"./AppChip.js";import s from"./AppDateRangePicker.js";import te from"./AppIcon.js";import c from"./AppSearch.js";import l from"./AppSegmented.js";import u from"./AppSelect.js";import ne from"./AppSwitch.js";import d from"./assertValidValue.js";import re from"./warnUnknownProps.js";import{Fragment as ie,useEffect as f,useId as ae,useRef as p,useState as oe,useSyncExternalStore as se}from"react";import{Fragment as ce,jsx as m,jsxs as h}from"react/jsx-runtime";var g=`(max-width: 575.98px)`,le=3,
|
|
1
|
+
import{emptyFacetValue as e,isFacetActive as t}from"../web-core/dist/query/listQuery.js";import{devWarn as n}from"../lib/devWarn.js";import r from"../lib/fillLabel.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppButton.js";import ee from"./AppChip.js";import s from"./AppDateRangePicker.js";import te from"./AppIcon.js";import c from"./AppSearch.js";import l from"./AppSegmented.js";import u from"./AppSelect.js";import ne from"./AppSwitch.js";import d from"./assertValidValue.js";import re from"./warnUnknownProps.js";import{Fragment as ie,useEffect as f,useId as ae,useRef as p,useState as oe,useSyncExternalStore as se}from"react";import{Fragment as ce,jsx as m,jsxs as h}from"react/jsx-runtime";var g=`(max-width: 575.98px)`,le=3,_=2,ue=e=>{let t=window.matchMedia?.(g);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},de=()=>window.matchMedia?.(g).matches??!1,fe=[`enum`,`multiEnum`,`dateRange`,`text`],pe=[`sm`,`md`],me=()=>import(`@webority/ui-elements/elements/filter-popover`),v=4,he=e=>(e.type===`enum`||e.type===`multiEnum`)&&!e.options?.length,y=(e,t)=>e.options?.find(e=>e.value===t)?.label??t,ge=(e,t)=>JSON.stringify(e)===JSON.stringify(t),b=(e,t,n)=>/* @__PURE__ */ RangeError(`[@webority/ui-react] <AppFilterBar> facet "${e.key}" needs ${t}, received ${JSON.stringify(n)}.`),x=(e,t)=>{if(t==null)return``;if(typeof t==`string`)return t;throw b(e,`a string value`,t)},S=(e,t)=>{if(t==null)return[];if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t;throw b(e,`an array of strings`,t)},C=(e,t)=>{if(t==null)return{from:``,to:``};if(typeof t==`object`&&!Array.isArray(t)&&!(t instanceof Date)){let{from:e,to:n}=t;if((e===void 0||typeof e==`string`)&&(n===void 0||typeof n==`string`))return{from:e,to:n}}throw b(e,`a { from, to } date range`,t)};function _e(n,i,a){if(n.required||!t(n,i))return[];if(n.type===`enum`)return[{id:n.key,text:y(n,x(n,i)),clear:()=>e(n)}];if(n.type===`multiEnum`){let e=S(n,i);return e.map(t=>({id:`${n.key}:${t}`,text:y(n,t),clear:()=>e.filter(e=>e!==t)}))}if(n.type===`dateRange`){let t=C(n,i),o=t.from&&t.to?r(a.range,{from:t.from,to:t.to}):t.from?r(a.from,{date:t.from}):r(a.until,{date:t.to});return[{id:n.key,text:o,clear:()=>e(n)}]}return[]}var w=/* @__PURE__ */ new Set;function ve(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!w.has(e)&&(w.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel, which only an enum facet uses.`))}var T=/* @__PURE__ */ new Set;function ye(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!T.has(e)&&(T.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets required, which only an enum facet uses.`))}var E=/* @__PURE__ */ new Set;function be(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!E.has(e)&&(E.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel and required; a required facet has no All segment.`))}var D=/* @__PURE__ */ new Set;function xe(e){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!D.has(e)&&(D.add(e),n(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets presets, which only a dateRange facet uses.`))}function O(n){i(`wui-filter-popover`,me);let{marker:s,props:c}=a(`AppFilterBar`,n),{facets:l,value:u,onChange:g,inline:v=le,floating:y=!1,apply:b=!1,size:x=`sm`,className:S=``,clearAllLabel:C=`Clear all`,filtersLabel:w=`Filters`,filtersActiveLabel:T=`Filters, {count} active`,keepOpenLabel:E=`Keep open`,appliesAtOnceText:D=`Changes apply at once.`,applyLabel:O=`Apply`,anyLabel:A=`Any`,removeChipLabel:Se=`Remove {facet} filter {value}`,dateFromText:Ce=`From {date}`,dateUntilText:we=`Until {date}`,dateRangeText:Te=`{from} to {to}`,...j}=c;re(`AppFilterBar`,j),d(`AppFilterBar`,`size`,x,pe);let M=x===`md`,Ee={range:Te,from:Ce,until:we},N=se(ue,de,()=>!1),P=p(null),F=p(null),De=e=>{let t=P.current,n=F.current;t&&n&&(e.preventDefault(),t.open=!t.open,n.classList.remove(`wui-filter-more-panel-end`),t.open&&n.getBoundingClientRect().right>window.innerWidth-8&&n.classList.add(`wui-filter-more-panel-end`))},I=ae(),[L,R]=oe({}),z=p(u);for(let e of l)d(`AppFilterBar`,`facets[].type`,e.type,fe);for(let e of l)e.allLabel!=null&&e.type!==`enum`&&ve(e.key),e.required&&e.type!==`enum`&&ye(e.key),e.required&&e.allLabel!=null&&be(e.key),e.presets!=null&&e.type!==`dateRange`&&xe(e.key);let B=l.filter(e=>!he(e)),V=B.flatMap(e=>_e(e,u[e.key],Ee).map(t=>({...t,facet:e}))),H=B.filter(e=>!e.required&&t(e,u[e.key])),U=y||N?0:Math.max(0,v),W=B.slice(U),Oe=W.filter(e=>H.includes(e)).length,G=!y&&W.length>0;f(()=>{if(!G)return;let e=e=>{let t=P.current;t?.open&&(e.type===`keydown`?e instanceof KeyboardEvent&&e.key===`Escape`:!e.composedPath().includes(t))&&(t.open=!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e)}},[G]),f(()=>{let e=z.current;z.current=u,R(t=>{let n=Object.entries(t).filter(([t])=>ge(e[t],u[t]));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})},[u]);let K=e=>b&&!y&&(e.type===`text`||e.type===`dateRange`),q=e=>K(e)&&Object.hasOwn(L,e.key)?L[e.key]:u[e.key],J=e=>t=>K(e)?R(n=>({...n,[e.key]:t})):g(e.key,t),Y=()=>{for(let[e,t]of Object.entries(L))g(e,t);R({})},ke=e=>{e.key===`Enter`&&Y()},Ae=e=>{e.preventDefault(),Y()},X=(e,t)=>e.type===`text`&&K(e)?/* @__PURE__ */ m(`span`,{onKeyDownCapture:ke,children:t}):t,je=e=>/* @__PURE__ */ m(ie,{children:X(e,/* @__PURE__ */ m(k,{facet:e,value:q(e),onChange:J(e),medium:M,anyLabel:A}))},e.key),Z=e=>/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-field`,children:[/* @__PURE__ */ m(`span`,{className:`label`,"aria-hidden":`true`,children:e.label}),X(e,/* @__PURE__ */ m(k,{facet:e,value:q(e),onChange:J(e),floating:!0,medium:M,anyLabel:A}))]},e.key),Q=(e,t)=>t>0&&/* @__PURE__ */ m(`span`,{className:e,children:` (${t})`}),Me=e=>/* @__PURE__ */ m(ee,{size:`sm`,label:`${e.facet.label}: ${e.text}`,removeLabel:r(Se,{facet:e.facet.label,value:e.text}),onRemove:()=>g(e.facet.key,e.clear()),className:!y&&B.indexOf(e.facet)<U?`wui-filter-chip-inline`:void 0},e.id),Ne=/* @__PURE__ */ m(o,{variant:`ghost`,size:M?void 0:`sm`,onClick:()=>{for(let t of H)g(t.key,e(t));R({})},children:C});if(y){let e=V.slice(_),t=H.length;return/* @__PURE__ */ h(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${S?` ${S}`:``}`,...s,...j,children:[/* @__PURE__ */ h(`wui-filter-popover`,{class:`wui-filter-popover`,children:[/* @__PURE__ */ h(o,{variant:t>0?`outline`:`ghost`,size:M?void 0:`sm`,leftIcon:`filter`,className:`wui-filter-popover-trigger`,"aria-expanded":`false`,"aria-controls":I,"aria-label":t>0?r(T,{count:t}):void 0,children:[w,t>0&&/* @__PURE__ */ m(`span`,{className:`badge rounded-pill text-bg-primary ms-1`,children:t})]}),/* @__PURE__ */ h(`div`,{id:I,className:`wui-filter-popover-panel`,role:`dialog`,"aria-label":w,hidden:!0,children:[/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-head`,children:[/* @__PURE__ */ m(`span`,{className:`wui-filter-popover-title`,children:w}),/* @__PURE__ */ m(ne,{label:E,id:`${I}-pin`})]}),/* @__PURE__ */ m(`div`,{className:`wui-filter-popover-grid`,children:B.map(Z)}),/* @__PURE__ */ h(`div`,{className:`wui-filter-popover-foot`,children:[/* @__PURE__ */ m(`span`,{className:`wui-filter-popover-note`,children:D}),t>0&&Ne]})]})]}),V.slice(0,_).map(Me),e.length>0&&/* @__PURE__ */ h(`span`,{className:`chip chip-sm wui-filter-popover-more`,title:e.map(e=>`${e.facet.label}: ${e.text}`).join(`, `),children:[`+`,e.length]})]})}let Pe=`wui-filter-bar d-flex flex-wrap align-items-center gap-2${N&&G?` wui-filter-bar--folded`:``}`,Fe=e=>`${e}${S?` ${S}`:``}`,$=/* @__PURE__ */ h(ce,{children:[B.slice(0,U).map(je),G&&/* @__PURE__ */ h(`details`,{ref:P,className:`wui-filter-more`,children:[/* @__PURE__ */ h(`summary`,{className:`btn btn-outline-primary${M?``:` btn-sm`} wui-filter-more-trigger`,onClick:De,children:[/* @__PURE__ */ m(te,{name:`filter`,size:14,className:`me-2`}),w,Q(`wui-filter-count-desktop`,Oe),Q(`wui-filter-count-phone`,H.length)]}),/* @__PURE__ */ h(`div`,{ref:F,className:`wui-filter-more-panel`,children:[/* @__PURE__ */ m(`div`,{className:`wui-filter-more-head`,children:w}),W.map(Z)]})]}),V.map(Me),H.length>0&&Ne]});return!b||!B.some(e=>e.type===`text`||e.type===`dateRange`)?/* @__PURE__ */ m(`div`,{className:Fe(Pe),...s,...j,children:$}):/* @__PURE__ */ h(`div`,{className:Fe(`wui-filter-form d-flex flex-wrap align-items-center gap-2`),...s,...j,children:[/* @__PURE__ */ m(`div`,{className:Pe,children:$}),/* @__PURE__ */ m(o,{type:`submit`,size:M?void 0:`sm`,onClick:Ae,children:O})]})}function k({facet:e,value:t,onChange:n,floating:r=!1,medium:i=!1,anyLabel:a}){if(e.type===`enum`){let o=e.options??[];return(e.required?o.length<=v:o.length<v)?/* @__PURE__ */ m(l,{label:e.label,name:e.key,size:i?`md`:`sm`,value:x(e,t),onChange:n,options:e.required?o:[{value:``,label:e.allLabel||`All`},...o]}):/* @__PURE__ */ m(u,{"aria-label":e.label,name:e.key,placeholder:r?a:e.label,clearable:!e.required,size:i?void 0:`sm`,value:x(e,t),onChange:n,options:o})}return e.type===`multiEnum`?/* @__PURE__ */ m(u,{mode:`multiple`,"aria-label":e.label,name:e.key,placeholder:r?a:e.label,size:i?void 0:`sm`,collapseChips:!0,value:S(e,t),onChange:n,options:e.options??[]}):e.type===`dateRange`?/* @__PURE__ */ m(s,{ariaLabel:e.label,startName:`${e.key}From`,endName:`${e.key}To`,placeholder:r?a:e.label,size:i?void 0:`sm`,presets:e.presets,start:C(e,t).from,end:C(e,t).to,onChange:e=>n({from:e.start??``,to:e.end??``})}):/* @__PURE__ */ m(c,{ariaLabel:e.label,name:e.key,placeholder:e.label,size:i?void 0:`sm`,value:x(e,t),onChange:n})}export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{newIdempotencyKey as e}from"../web-core/dist/api/idempotencyKey.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{createContext as r,useCallback as i,useContext as a,useMemo as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";var u=r(null);function d(){let e=a(u);if(e===null)throw Error(`useFormSubmit must be called inside an AppForm`);return e}function f(r){let{marker:a,props:d}=t(`AppForm`,r),{onSubmit:f,className:p,children:m,noValidate:h,action:g,method:_,encType:v,acceptCharset:y,...b}=d;n(`AppForm`,b);let[x,S]=c(!1),[C,w]=c(e),T=s(!1),E=i(async t=>{if(t.preventDefault(),!T.current){T.current=!0,S(!0);try{await f(t,{idempotencyKey:C})&&w(e())}finally{T.current=!1,S(!1)}}},[f,C]),D=o(()=>({submitting:x,idempotencyKey:C}),[x,C]);return/* @__PURE__ */ l(u.Provider,{value:D,children:/* @__PURE__ */ l(`form`,{...a,...b,noValidate:h,action:g,method:_,encType:v,acceptCharset:y,className:p,onSubmit:E,"aria-busy":x||void 0,children:m})})}export{u as FormSubmitContext,f as default,d as useFormSubmit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./AppSelect.js";import
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./AppSelect.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{INLINE_EDIT_TEXT as o,INLINE_EDIT_TYPES as s,inlineEditText as c}from"@webority/ui-elements/helpers";import{useEffect as l,useId as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{flushSync as h}from"react-dom";var g=()=>import(`@webority/ui-elements/elements/datepicker`),ee=()=>import(`@webority/ui-elements/elements/inline-edit`),_=e=>e==null?``:String(e),v=(e,t)=>t===`number`?e===``?null:Number(e):e;function y(y){let b=e(`wui-inline-edit`,ee);e(`wui-datepicker`,g);let{marker:x,props:S}=t(`AppInlineEdit`,y),{value:C,onSave:w,type:T,options:E=[],label:D,placeholder:O,validate:k,renderValue:A,wrap:j=!0,disabled:M=!1,className:N=``,id:te,...P}=S;a(`AppInlineEdit`,P),i(`AppInlineEdit`,`type`,T,s);let F=T??`text`,I=u(),L=te||`inline-edit-${I.replace(/[^a-zA-Z0-9_-]/g,``)}`,R=`${L}-error`,z=`${L}-control`,B=d(null),V=_(C),[H,U]=f(V),[W,G]=f(V);H!==V&&(U(V),G(V));let[K,q]=f(null),J=d({onSave:w,validate:k,kind:F});J.current={onSave:w,validate:k,kind:F},l(()=>{let e=B.current;if(e&&b)return e.save=async e=>{q(e);let t=!1;try{await J.current.onSave?.(v(e,J.current.kind)),t=!0}finally{h(()=>{t&&G(e),q(null)})}},e.validate=e=>J.current.validate?.(v(e,J.current.kind))||null,()=>{e.save=void 0,e.validate=void 0}},[b]);let Y=K??W,X=c(Y,{type:F,options:E,...O===void 0?null:{placeholder:O}}),Z=A&&!X.empty?A(v(Y,F)):X.text,Q={id:z,"data-wui-control":``,"aria-label":D},$;if(F===`select`){let e=E.map(e=>({value:String(e.value),label:_(e.label??e.value)}));$=/* @__PURE__ */ p(r,{id:z,"data-wui-control":``,"aria-label":D,size:`sm`,placeholder:O||void 0,options:e})}else $=F===`date`?/* @__PURE__ */ p(`wui-datepicker`,{...Q,size:`sm`,"aria-describedby":R,placeholder:O||void 0}):F===`textarea`?/* @__PURE__ */ p(`textarea`,{...Q,className:`form-control textarea`,rows:3,"aria-describedby":R,placeholder:O||void 0}):/* @__PURE__ */ p(`input`,{...Q,type:F===`number`?`number`:`text`,inputMode:F===`number`?`decimal`:void 0,className:`form-control input input-sm`,"aria-describedby":R,placeholder:O||void 0});let ne=[`wui-inline-edit`,j===!1?`wui-inline-edit--nowrap`:``,N].filter(Boolean).join(` `);return/* @__PURE__ */ m(`wui-inline-edit`,{ref:B,id:L,class:ne,type:F,label:D,value:W,placeholder:O||void 0,disabled:M?``:void 0,controlled:``,...x,...P,children:[/* @__PURE__ */ m(`button`,{type:`button`,className:`wui-inline-edit-display`,"data-wui-display":``,"aria-describedby":R,disabled:M,children:[/* @__PURE__ */ p(`span`,{className:`visually-hidden`,children:M?o.readOnly(D):o.edit(D)}),/* @__PURE__ */ p(`span`,{className:`wui-inline-edit-value`,"data-wui-value":``,"data-wui-empty":X.empty?``:void 0,children:Z}),/* @__PURE__ */ p(`span`,{className:`wui-inline-edit-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ p(n,{name:`edit`,size:14})})]}),/* @__PURE__ */ p(`span`,{className:`wui-inline-edit-editor`,"data-wui-editor":``,hidden:!0,children:$}),/* @__PURE__ */ m(`span`,{className:`wui-inline-edit-status`,"aria-hidden":`true`,children:[/* @__PURE__ */ p(`span`,{className:`wui-inline-edit-spinner spinner-border spinner-border-sm`}),/* @__PURE__ */ p(`span`,{className:`wui-inline-edit-saved`,children:/* @__PURE__ */ p(n,{name:`tick-circle`,size:16})})]}),/* @__PURE__ */ p(`span`,{className:`wui-inline-edit-error`,id:R,"data-wui-error":``,hidden:!0}),/* @__PURE__ */ p(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,blockWhenReadOnly as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,blockWhenReadOnly as ee}from"../lib/fieldState.js";import{splitMarkerProps as te}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import ne from"./AppInfoTip.js";import re from"./AppPopover.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import ie from"./warnUnknownProps.js";import{MASK_INPUT_TYPES as ae,MASK_NAMES as oe,attachInputMask as se,evaluatePassword as ce,formatMasked as le,isMaskPattern as ue,postedMasked as de}from"@webority/ui-elements/helpers";import{cloneElement as fe,forwardRef as pe,useEffect as o,useId as me,useRef as he,useState as s}from"react";import{Form as c}from"react-bootstrap";import{jsx as l,jsxs as u}from"react/jsx-runtime";var ge=[`sm`,`md`,`lg`],_e=[`bare`],ve=[`off`,`border`,`above`],ye=[`off`,`shown`];function d(e,t){if(t!=null&&t!==``&&t!==!1)throw Error(`<AppInput> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}function be(e){return e==null||{...`minLength`in e&&{minLength:e.minLength??0},...`uppercase`in e&&{uppercase:e.uppercase??!1},...`lowercase`in e&&{lowercase:e.lowercase??!1},...`digit`in e&&{digit:e.digit??!1},...`special`in e&&{special:e.special??!1},...`uniqueChars`in e&&{uniqueChars:e.uniqueChars??0},...`customRules`in e&&{customRules:e.customRules??[]}}}var f=pe(function(pe,f){let{marker:xe,props:Se}=te(`AppInput`,pe),{label:p,required:m=!1,optional:h=!1,error:Ce,helperText:g,help:_,helpLabel:we=`More information`,type:v=`text`,size:y=`md`,leftIcon:b,rightIcon:x,onRightIconClick:Te,rightIconLabel:Ee,unit:S,id:De,name:Oe,className:ke=``,fieldClassName:C=``,disabled:w=!1,readOnly:T=!1,loading:E=!1,clearable:D=!1,clearLabel:Ae=`Clear`,optionalLabel:je=`(optional)`,requirementsTitle:Me=`Password requirements`,showPasswordLabel:Ne=`Show password`,hidePasswordLabel:Pe=`Hide password`,showCount:O=!1,maxLength:k,monospace:Fe=!1,prefix:A,suffix:j,action:Ie,floatingLabel:M=`off`,variant:Le,passwordRequirements:N=`off`,passwordPolicy:Re,requirementsPlacement:P=`auto`,mask:F,postFormatted:I=!1,onMaskChange:ze,controlOnly:Be=!1,value:L,...R}=Se;ie(`AppInput`,R);let{onChange:Ve,onBlur:He,onClick:Ue,onInput:z,...We}=R;a(`AppInput`,`size`,y,ge),a(`AppInput`,`variant`,Le,_e),a(`AppInput`,`floatingLabel`,M,ve),a(`AppInput`,`passwordRequirements`,N,ye),Be&&(d(`label`,p),d(`error`,Ce),d(`helperText`,g),d(`fieldClassName`,C),d(`showCount`,O),d(`help`,_),d(`optional`,h),d(`floatingLabel`,M===`off`?void 0:M),d(`passwordRequirements`,N===`shown`?N:void 0)),o(()=>{h&&m&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppInput: optional and required together; optional ignored`)},[h,m]),F!=null&&!ue(F)&&a(`AppInput`,`mask`,F,oe),F!=null&&a(`AppInput`,`type`,v,ae);let[B,Ge]=s(!1),[Ke,qe]=s(``),V=Ce||Ke,Je=me(),H=De||Je,U=v===`password`,Ye=U&&B?`text`:v,W=he(null),Xe=e=>{W.current=e,typeof f==`function`?f(e):f&&(f.current=e)},G=String(L??R.defaultValue??``),[Ze,K]=s(()=>!!G),[Qe,$e]=s(()=>G.length),et=D&&!w&&!T&&!E,q=D||O,J=U&&N===`shown`,[tt,nt]=s(G);o(()=>{J&&L!==void 0&&nt(String(L??``))},[L,J]),o(()=>{if(!q||L===void 0)return;let e=String(L??``);K(!!e),$e(e.length)},[L,q]);let rt=e=>{let t=e.currentTarget;K(!!t.value),$e(t.value.length),z?.(e)},it=e=>{J&&nt(e.currentTarget.value),q?rt(e):z?.(e)},at=F?{...L!==void 0&&{value:le(F,L)},...R.defaultValue!==void 0&&{defaultValue:le(F,R.defaultValue)}}:null,ot=he(ze);ot.current=ze,o(()=>{let e=W.current;if(F&&e)return se(e,{mask:F,postFormatted:I,onChange:(e,t)=>ot.current?.(e,t),onInvalidChange:qe})},[F,I]);let st=e=>F&&!I&&e?t=>{let n=t.currentTarget,ee=new Proxy(n,{get:(e,t)=>{if(t===`value`)return de(F,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,ct=et?/* @__PURE__ */ l(`button`,{type:`button`,className:`input-clear`,onClick:()=>{let e=W.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})),K(!1),e.focus()},"aria-label":Ae,tabIndex:-1,hidden:!Ze,children:/* @__PURE__ */ l(r,{name:`x`,size:16})}):null,lt=V&&H?`${H}-error`:void 0,Y=g&&H?`${H}-hint`:void 0,X=J&&P===`inline`,ut=X&&H?`${H}-requirements`:void 0,dt=lt||(X?ut:Y),ft=[`input`,y===`sm`?`input-sm`:``,y===`lg`?`input-lg`:``,V?`error`:``,U?`pw`:``,S?`num-input`:``,!(M!==`off`&&p||A||j||S||U||x)&&D&&et?`has-clear`:``,Le===`bare`?`input-bare`:``,Fe?`wui-mono`:``,E?n:``,ke].filter(Boolean).join(` `),pt=ee(T||E),mt=pt?e=>{pt(e),Ue?.(e)}:Ue,ht=st(Ve),gt=st(He),_t=q||J?it:z,Z=/* @__PURE__ */ l(c.Control,{id:H,name:Oe,type:Ye,className:ft,disabled:w,readOnly:T||E,"aria-busy":E||void 0,required:m,"aria-invalid":V?`true`:`false`,"aria-describedby":dt,maxLength:k,...L===void 0?null:{value:L},...We,...mt?{onClick:mt}:null,...ht?{onChange:ht}:null,...gt?{onBlur:gt}:null,...at,placeholder:M===`off`?R.placeholder:` `,ref:Xe,..._t?{onInput:_t}:null}),Q=Re??!0,vt=Q&&typeof Q==`object`&&Q.title||Me,yt=J?ce(tt,be(Re)):null,bt=J?/* @__PURE__ */ l(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:ut,"aria-label":X?vt:void 0,children:yt?.map(e=>/* @__PURE__ */ u(`li`,{className:`pw-rule ${e.met?`met`:`unmet`}`,children:[/* @__PURE__ */ l(`span`,{className:`pw-mark`,"aria-hidden":`true`}),/* @__PURE__ */ l(`span`,{className:`pw-rule-text`,children:e.label}),/* @__PURE__ */ l(`span`,{className:`visually-hidden`,children:e.met?`: met`:`: not met`})]},e.key))}):null,$;if(M!==`off`&&p&&!U)$=/* @__PURE__ */ u(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:[Z,/* @__PURE__ */ u(`label`,{className:`float-label`,htmlFor:H,children:[p,m&&/* @__PURE__ */ l(i,{})]})]});else if(Ie)$=/* @__PURE__ */ u(`div`,{className:`input-action-row`,children:[/* @__PURE__ */ u(`div`,{className:b?`input-icon`:`input-wrap`,children:[b&&/* @__PURE__ */ l(`span`,{className:`ic`,children:/* @__PURE__ */ l(r,{name:b,size:16})}),Z]}),/* @__PURE__ */ l(`div`,{className:`input-action`,children:Ie})]});else if(A||j)$=/* @__PURE__ */ u(`div`,{className:`input-affixed`,children:[A!=null&&/* @__PURE__ */ l(`span`,{className:`affix affix-pre`,children:A}),Z,j!=null&&/* @__PURE__ */ l(`span`,{className:`affix affix-suf`,children:j})]});else if(S)$=/* @__PURE__ */ u(`div`,{className:`input-with-unit`,children:[Z,/* @__PURE__ */ l(`span`,{className:`unit`,children:S})]});else if(U){let e=/* @__PURE__ */ u(`button`,{type:`button`,className:`pw-toggle${B?` pw-revealed`:``}`,onClick:()=>Ge(e=>!e),"aria-label":B?Pe:Ne,tabIndex:-1,children:[/* @__PURE__ */ l(r,{name:`eye`,size:18,className:`pw-eye`}),/* @__PURE__ */ l(r,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=M!==`off`&&p?/* @__PURE__ */ l(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:/* @__PURE__ */ u(`div`,{className:`input-wrap`,children:[Z,e,/* @__PURE__ */ u(`label`,{className:`float-label`,htmlFor:H,children:[p,m&&/* @__PURE__ */ l(i,{})]})]})}):/* @__PURE__ */ u(`div`,{className:b?`input-icon`:`input-wrap`,children:[b&&/* @__PURE__ */ l(`span`,{className:`ic`,children:/* @__PURE__ */ l(r,{name:b,size:16})}),Z,e]});$=J&&!X&&P!==`inline`?/* @__PURE__ */ l(re,{trigger:t,triggerType:`focus`,placement:P,title:vt,className:`pw-popover`,children:bt}):t}else $=x?/* @__PURE__ */ u(`div`,{className:`input-wrap`,children:[Z,/* @__PURE__ */ l(`button`,{type:`button`,className:`pw-toggle`,onClick:Te,disabled:!Te,tabIndex:-1,"aria-label":Ee||x,children:/* @__PURE__ */ l(r,{name:x,size:18})})]}):D?/* @__PURE__ */ u(`div`,{className:b?`input-icon`:`input-wrap`,children:[b&&/* @__PURE__ */ l(`span`,{className:`ic`,children:/* @__PURE__ */ l(r,{name:b,size:16})}),Z,ct]}):b?/* @__PURE__ */ u(`div`,{className:`input-icon`,children:[/* @__PURE__ */ l(`span`,{className:`ic`,children:/* @__PURE__ */ l(r,{name:b,size:16})}),Z]}):Z;return Be?fe($,xe):/* @__PURE__ */ u(c.Group,{...xe,className:`field${C?` ${C}`:``}`,children:[p&&M===`off`&&/* @__PURE__ */ u(c.Label,{className:`label`,htmlFor:H,children:[p,h&&!m&&/* @__PURE__ */ l(`span`,{className:`label-optional`,children:` ${je}`}),m&&/* @__PURE__ */ l(i,{}),_&&/* @__PURE__ */ l(ne,{label:we,children:_})]}),$,X&&/* @__PURE__ */ l(`div`,{className:`wui-pw-inline`,children:bt}),/* @__PURE__ */ l(t,{error:V,hint:X?null:g,errorId:lt,hintId:Y}),O&&/* @__PURE__ */ u(`div`,{className:`field-count${k&&Qe>=k?` at-limit`:``}`,children:[Qe,k?` / ${k}`:``]})]})});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/fillLabel.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import{errorToast as s}from"./toast.js";import c from"./warnUnknownProps.js";import{KANBAN_SUMMARY_FORMATS as l,KANBAN_TEXT as u,KANBAN_TONES as d,formatValue as ee,kanbanOverflow as
|
|
1
|
+
import e from"../lib/fillLabel.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useElementEntry.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import{errorToast as s}from"./toast.js";import c from"./warnUnknownProps.js";import{KANBAN_SUMMARY_FORMATS as l,KANBAN_TEXT as u,KANBAN_TONES as d,formatValue as ee,kanbanOverflow as te,kanbanSummaryFormat as f,kanbanVisibleLimit as ne,sumKanbanValues as re}from"@webority/ui-elements/helpers";import{useEffect as p,useId as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";var ie=()=>import(`@webority/ui-elements/elements/kanban`),ae=e=>e.key??e.id,oe=e=>e.column,b=[`rupees`,`paise`],se=[`inline`,`stacked`];function ce(e){return typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:void 0}function x(x){let S=r(`wui-kanban`,ie),{marker:le,props:ue}=i(`AppKanban`,x),{columns:C,cards:w,renderCard:de,renderColumnActions:fe,getCardKey:T=ae,getCardColumn:E=oe,getCardValue:D,cardLabel:O,isCardLocked:pe,onLocked:k,onMove:A,accept:j,filter:me,boardId:he,ariaLabel:ge=`Board`,columnsLabel:_e=`Board columns`,expandLabel:ve=`Expand {title}`,collapseLabel:ye=`Collapse {title}`,emptyText:be=u.empty,helpText:xe=u.help,readOnly:Se=!1,swipeHint:Ce=!1,swipeHintText:M=u.swipeHint,fill:we=!1,columnWidth:N,fillOffset:P,activeCardKey:F,headLayout:I=`inline`,truncateHeads:L=!1,summaryFormat:R,summaryUnit:z,className:B=``,id:Te,linkComponent:Ee,...V}=ue;if(!Array.isArray(C))throw Error(`<AppKanban> columns is required: pass the board's stage columns.`);if(!Array.isArray(w))throw Error(`<AppKanban> cards is required: pass the cards, an empty array for an empty board.`);c(`AppKanban`,V),o(`AppKanban`,`summaryFormat`,R,l),o(`AppKanban`,`summaryUnit`,z,b),o(`AppKanban`,`headLayout`,I,se);for(let e of C)o(`AppKanban`,`columns[].tone`,e.tone,d);let De=m(),H=Te||`kanban-${De.replace(/[^a-zA-Z0-9_-]/g,``)}`,U=g(null),[W,G]=_(()=>/* @__PURE__ */ new Map),[K,Oe]=_(()=>/* @__PURE__ */ new Set),[ke,q]=_(()=>/* @__PURE__ */ new Set),J=h(()=>new Map(w.map(e=>[String(T(e)),e])),[w,T]),Y=g({accept:j,onMove:A,onLocked:k,byKey:J,columns:C});Y.current={accept:j,onMove:A,onLocked:k,byKey:J,columns:C};let X=R&&l.includes(R)&&(z==null||b.includes(z))?f(R,z):null,Z=h(()=>{let e=new Map(C.map(e=>[e.key,[]])),t=[];for(let n of w){let r=String(T(n)),i=W.get(r);i?t.push([n,i]):e.get(E(n))?.push(n)}for(let[n,r]of t){let t=e.get(r.to);t&&t.splice(Math.min(r.index,t.length),0,n)}return e},[C,w,W,T,E]);p(()=>{let e=U.current;if(!e||!S)return;e.accept=(e,t,n)=>{let r=Y.current.accept;return!r||r(Y.current.byKey.get(e.getAttribute(`data-wui-card`)??``),t,n)};let t=e=>{if(!(e instanceof CustomEvent))return;let{key:t,from:n,to:r,index:i}=e.detail,a=Y.current.onMove,o=Y.current.byKey.get(t);if(!a||!o)return;let c=Y.current.columns.find(e=>e.key===r)?.visibleLimit!=null;c&&q(e=>new Set(e).add(t)),G(e=>new Map(e).set(t,{to:r,index:i}));let l=()=>G(e=>{let n=new Map(e);return n.delete(t),n}),d;try{d=a({card:o,key:t,from:n,to:r,index:i})}catch(e){d=Promise.reject(e)}Promise.resolve(d).then(l,e=>{l(),c&&q(e=>{let n=new Set(e);return n.delete(t),n}),s(ce(e)||u.failed.server)})},n=e=>{if(!(e instanceof CustomEvent))return;let{key:t,reason:n}=e.detail,r=Y.current.byKey.get(t);r&&Y.current.onLocked?.({card:r,key:t,reason:n})};return e.addEventListener(`wui:kanban:move`,t),e.addEventListener(`wui:kanban:locked`,n),()=>{e.removeEventListener(`wui:kanban:move`,t),e.removeEventListener(`wui:kanban:locked`,n),e.accept=void 0}},[S]);let Q=e=>me?.(e)!==!1,Ae=(e,t)=>{K.has(e)&&q(e=>{let n=new Set(e);for(let e of t)n.delete(String(T(e)));return n}),Oe(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},$={};return N!=null&&($[`--wui-kanban-column-width`]=`${N}px`),P!=null&&($[`--wui-kanban-fill-offset`]=`${P}px`),/* @__PURE__ */ y(`wui-kanban`,{ref:U,id:H,class:B?`wui-kanban ${B}`:`wui-kanban`,role:`region`,"aria-label":ge,"board-id":he||void 0,"summary-format":X?R:void 0,"summary-unit":X&&z?z:void 0,readonly:Se?``:void 0,fill:we?``:void 0,"data-head-layout":I===`stacked`?`stacked`:void 0,"data-head-truncate":L?``:void 0,style:$,controlled:``,...le,...V,children:[/* @__PURE__ */ v(`nav`,{className:`wui-kanban-switcher`,"aria-label":_e,children:C.map((e,t)=>/* @__PURE__ */ y(`button`,{type:`button`,className:`wui-kanban-switch`,"data-wui-switch":e.key,"aria-controls":`${H}-${e.key}`,"aria-current":t===0?`true`:void 0,children:[/* @__PURE__ */ v(`span`,{className:`wui-kanban-switch-title`,children:e.title}),/* @__PURE__ */ v(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:(Z.get(e.key)||[]).filter(Q).length})]},e.key))}),Ce&&/* @__PURE__ */ y(`p`,{className:`wui-kanban-hint`,"aria-hidden":`true`,children:[/* @__PURE__ */ v(a,{name:`arrow-swap-horizontal`,size:14}),M]}),/* @__PURE__ */ v(`div`,{className:`wui-kanban-board`,"data-wui-scroller":``,children:C.map(r=>{let i=t(Ee,{href:r.href}),o=`${H}-${r.key}`,s=Z.get(r.key)||[],c=s.filter(Q),l=!!(r.collapsible&&r.collapsed),f=ne(r.visibleLimit),p=K.has(r.key),m=te(c.map(e=>String(T(e))),f,p,ke),h=typeof r.summary==`function`?r.summary(c):r.summary;X&&(h=ee(re(c.map(e=>D?.(e))),X));let g=fe?.(r,c);return/* @__PURE__ */ y(`section`,{className:`wui-kanban-column`,id:o,"data-wui-column":r.key,"data-tone":r.tone&&d.includes(r.tone)?r.tone:`neutral`,"aria-labelledby":`${o}-title`,"data-accept-from":r.acceptFrom?r.acceptFrom.join(` `):void 0,"data-collapsible":r.collapsible?``:void 0,"data-collapsed":l?``:void 0,children:[/* @__PURE__ */ y(`header`,{className:`wui-kanban-head`,children:[/* @__PURE__ */ v(`span`,{className:`wui-kanban-dot`,"aria-hidden":`true`}),/* @__PURE__ */ v(`h2`,{className:`wui-kanban-title`,id:`${o}-title`,title:L?r.title:void 0,children:r.href?/* @__PURE__ */ v(n,{link:i,children:r.title}):r.title}),/* @__PURE__ */ v(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:c.length}),r.collapsible&&/* @__PURE__ */ v(`span`,{className:`wui-kanban-lock`,"aria-hidden":`true`,children:/* @__PURE__ */ v(a,{name:`lock`,size:14})}),g!=null&&g!==!1&&/* @__PURE__ */ v(`div`,{className:`wui-kanban-actions`,"data-wui-no-drag":``,children:g}),r.collapsible&&/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-kanban-collapse`,"data-wui-collapse":``,"aria-expanded":l?`false`:`true`,"aria-controls":`${o}-body`,"aria-label":e(l?ve:ye,{title:r.title}),children:/* @__PURE__ */ v(a,{name:`chevron-left`,size:16})}),h!=null&&/* @__PURE__ */ v(`div`,{className:`wui-kanban-summary`,"data-wui-summary":``,children:h})]}),/* @__PURE__ */ v(`p`,{className:`wui-kanban-drop-note`,"data-wui-drop-note":``,hidden:!0}),/* @__PURE__ */ v(`div`,{className:`wui-kanban-body`,id:`${o}-body`,"data-wui-body":``,children:s.map(e=>{let t=String(T(e)),n=W.has(t);return/* @__PURE__ */ v(`article`,{className:`wui-kanban-card`,"data-wui-card":t,tabIndex:0,"aria-label":O?O(e):void 0,"data-wui-locked":pe?.(e)?``:void 0,"data-wui-value":D?D(e)??void 0:void 0,"aria-current":F!=null&&t===String(F)?`true`:void 0,"aria-busy":n?`true`:void 0,"data-wui-saving":n?``:void 0,"data-wui-overflow":m.has(t)?``:void 0,hidden:!Q(e),children:de?.(e)},t)})}),f!=null&&/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-kanban-more`,"data-wui-more":``,"aria-controls":`${o}-body`,"aria-expanded":p?`true`:`false`,hidden:p?c.length<=f:m.size===0,onClick:()=>Ae(r.key,s),children:p?u.fewer:u.more(m.size)}),/* @__PURE__ */ v(`p`,{className:`wui-kanban-empty`,"data-wui-empty":``,hidden:c.length>0,children:r.emptyText??be})]},r.key)})}),/* @__PURE__ */ v(`p`,{className:`visually-hidden`,id:`${H}-help`,"data-wui-help":``,children:xe}),/* @__PURE__ */ v(`div`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import*as s from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";var d={sm:13,md:15,lg:18},f=[`underline`,`underline-center`,`static`,`slide`,`icon`,`highlight`,`bracket`,`fade`,`grow`,`glow`,`shine`,`none`];function
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import*as s from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";var d={sm:13,md:15,lg:18},f=[`underline`,`underline-center`,`static`,`slide`,`icon`,`rotate`,`highlight`,`bracket`,`fade`,`grow`,`glow`,`shine`,`none`],p={icon:`arrow-right`,rotate:`arrow-up-right`};function m(e,t,n){if(!e)return null;let r=`wui-link__ic wui-link__ic--${t}`;return typeof e==`string`?/* @__PURE__ */ l(`span`,{className:r,children:/* @__PURE__ */ l(i,{name:e,size:d[n]??d.md})}):/* @__PURE__ */ l(`span`,{className:r,children:e})}function h(i){let{marker:h,props:g}=r(`AppLink`,i),{children:_,label:v,href:y,animation:b=`underline`,leftIcon:x=null,rightIcon:S=null,size:C=`md`,surface:w=`default`,external:T=!1,disabled:E=!1,linkComponent:D,maxLines:O=null,className:k=``,...A}=g;o(`AppLink`,A),a(`AppLink`,`animation`,b,f),a(`AppLink`,`size`,C,Object.keys(d)),a(`AppLink`,`surface`,w,[`default`,`dark`]);let j=typeof O==`number`&&Number.isInteger(O)&&O>=1?O:null;O!=null&&j===null&&e(`[@webority/ui-react] AppLink maxLines must be a whole number of 1 or more; got ${String(O)}. The label is not clamped.`),!y&&A.onClick&&!D&&e(`[@webority/ui-react] AppLink has onClick but no href, so it renders an anchor that keyboards cannot reach. Use AppButton for an action, or pass href.`);let M=f.includes(b)?b:`underline`,N=!S&&!x?p[M]??S:S,P=[`wui-link`,`wui-link--${M}`,C===`md`?``:`wui-link--${C}`,E?`is-disabled`:``,w===`dark`?`wui-link--surface-dark`:``,j===null?``:`wui-link--clamp`,k].filter(Boolean).join(` `),F=j===null?void 0:{"--wui-link-max-lines":j},I=/* @__PURE__ */ u(c,{children:[m(x,`left`,C),/* @__PURE__ */ l(`span`,{className:`wui-link__label`,style:F,children:_??v}),m(N,`right`,C)]});if(E){let e={...A};return delete e.onClick,delete e.onClickCapture,delete e.type,/* @__PURE__ */ l(`span`,{className:P,"aria-disabled":`true`,...h,...e,children:I})}return D===`button`&&!T?s.createElement(`button`,{className:P,to:y,...h,...A},I):/* @__PURE__ */ l(n,{link:t(D===`button`?void 0:D,{href:y,external:T}),className:P,target:T?`_blank`:void 0,rel:T?`noopener noreferrer`:void 0,...h,...A,children:I})}export{h as default};
|