@webority/ui-react 0.164.0 → 0.167.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/LICENSE +1 -1
- package/dist/canvas-kit/kit.js +225 -223
- package/dist/canvas-kit/manifest.json +1334 -435
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAsyncBlock.js +1 -1
- package/dist/components/AppAvatar.js +1 -1
- package/dist/components/AppAvatarGroup.js +1 -1
- package/dist/components/AppBanner.js +1 -1
- package/dist/components/AppBreadcrumbs.js +1 -1
- package/dist/components/AppButton.js +1 -1
- package/dist/components/AppCalendar.js +1 -1
- package/dist/components/AppCard.js +1 -1
- package/dist/components/AppCarousel.js +1 -1
- package/dist/components/AppCell.js +1 -1
- package/dist/components/AppChart.js +1 -1
- package/dist/components/AppChartCard.js +1 -1
- package/dist/components/AppCheckbox.js +1 -1
- package/dist/components/AppChip.js +1 -1
- package/dist/components/AppChipGroup.js +1 -1
- package/dist/components/AppChoiceCard.js +1 -1
- package/dist/components/AppChoiceChip.js +1 -1
- package/dist/components/AppColorField.js +1 -1
- package/dist/components/AppColumnMenu.js +1 -1
- package/dist/components/AppCommandPalette.js +1 -1
- package/dist/components/AppCommentThread.js +1 -1
- package/dist/components/AppCompareTable.js +1 -1
- package/dist/components/AppConfirmDialog.js +1 -1
- package/dist/components/AppConfirmProvider.js +1 -1
- package/dist/components/AppContextMenu.js +1 -1
- package/dist/components/AppCopyButton.js +1 -1
- package/dist/components/AppDataTable.js +1 -1
- package/dist/components/AppDatePicker.js +1 -1
- package/dist/components/AppDateRangePicker.js +1 -1
- package/dist/components/AppDescriptions.js +1 -1
- package/dist/components/AppDrawer.js +1 -1
- package/dist/components/AppDropZone.js +1 -1
- package/dist/components/AppDropdown.js +1 -1
- package/dist/components/AppDueDate.js +1 -1
- package/dist/components/AppEntryGrid.js +1 -0
- package/dist/components/AppErrorBoundary.js +1 -1
- package/dist/components/AppErrorSummary.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/AppFloatingDock.js +1 -1
- package/dist/components/AppForm.js +1 -1
- package/dist/components/AppFormulaSteps.js +1 -0
- package/dist/components/AppHoverCard.js +1 -1
- package/dist/components/AppImagePicker.js +1 -1
- package/dist/components/AppInfoTip.js +1 -1
- package/dist/components/AppInlineEdit.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppInputGroup.js +1 -1
- package/dist/components/AppKanban.js +1 -1
- package/dist/components/AppMentionInput.js +1 -1
- package/dist/components/AppMetricStrip.js +1 -1
- package/dist/components/AppModal.js +1 -1
- package/dist/components/AppNavigationMenu.js +1 -1
- package/dist/components/AppNotificationCenter.js +1 -1
- package/dist/components/AppNumberInput.js +1 -1
- package/dist/components/AppOnboardingChecklist.js +1 -1
- package/dist/components/AppOrgTree.js +1 -1
- package/dist/components/AppOtpInput.js +1 -1
- package/dist/components/AppPageHeader.js +1 -1
- package/dist/components/AppPhoneNumberInput.js +1 -1
- package/dist/components/AppPopover.js +1 -1
- package/dist/components/AppPricingCard.js +1 -1
- package/dist/components/AppQrCode.js +1 -1
- package/dist/components/AppRadio.js +1 -1
- package/dist/components/AppRadioGroup.js +1 -1
- package/dist/components/AppRating.js +1 -1
- package/dist/components/AppRecordPager.js +1 -1
- package/dist/components/AppRelativeTime.js +1 -1
- package/dist/components/AppRepeater.js +1 -1
- package/dist/components/AppRichText.js +1 -1
- package/dist/components/AppRouteError.js +1 -1
- package/dist/components/AppRowActions.js +1 -0
- package/dist/components/AppScoreScale.js +1 -1
- package/dist/components/AppSearch.js +1 -1
- package/dist/components/AppSectionFeatures.js +1 -1
- package/dist/components/AppSectionLeadCapture.js +1 -1
- package/dist/components/AppSectionLogos.js +1 -1
- package/dist/components/AppSegmented.js +1 -1
- package/dist/components/AppSelect.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppShortcutLegend.js +1 -1
- package/dist/components/AppShowMore.js +1 -1
- package/dist/components/AppSlider.js +1 -1
- package/dist/components/AppSortableList.js +1 -1
- package/dist/components/AppSparkline.js +1 -1
- package/dist/components/AppSpinner.js +1 -1
- package/dist/components/AppSplash.js +1 -1
- package/dist/components/AppSplitButton.js +1 -1
- package/dist/components/AppSplitView.js +1 -1
- package/dist/components/AppStatusBadge.js +1 -1
- package/dist/components/AppStepper.js +1 -1
- package/dist/components/AppSwitch.js +1 -1
- package/dist/components/AppTablePagination.js +1 -1
- package/dist/components/AppTableToolbar.js +1 -1
- package/dist/components/AppTabs.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppThemeToggle.js +1 -1
- package/dist/components/AppTimePicker.js +1 -1
- package/dist/components/AppTimeline.js +1 -1
- package/dist/components/AppToast.js +1 -1
- package/dist/components/AppUpdateBar.js +1 -1
- package/dist/components/AppWhatsNew.js +1 -1
- package/dist/components/AppWizard.js +1 -1
- package/dist/components/AppWorkspaceSwitcher.js +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/guidance.json +220 -140
- package/dist/hookForm/index.js +1 -0
- package/dist/lib/CheckField.js +1 -1
- package/dist/lib/FileItemRow.js +1 -1
- package/dist/lib/emptyValue.js +1 -1
- package/dist/lib/fieldState.js +1 -1
- package/dist/lib/formFields.js +1 -0
- package/dist/lib/useWuiText.js +1 -0
- package/dist/types/components/AppAsyncBlock.d.ts +3 -3
- package/dist/types/components/AppChart.d.ts +12 -4
- package/dist/types/components/AppColorField.d.ts +3 -3
- package/dist/types/components/AppDataTable.d.ts +29 -2
- package/dist/types/components/AppDatePicker.d.ts +2 -1
- package/dist/types/components/AppDateRangePicker.d.ts +5 -1
- package/dist/types/components/AppDescriptions.d.ts +6 -0
- package/dist/types/components/AppDropdown.d.ts +6 -0
- package/dist/types/components/AppEntryGrid.d.ts +164 -0
- package/dist/types/components/AppFilterBar.d.ts +12 -1
- package/dist/types/components/AppForm.d.ts +18 -0
- package/dist/types/components/AppFormulaSteps.d.ts +64 -0
- package/dist/types/components/AppInput.d.ts +4 -4
- package/dist/types/components/AppInputGroup.d.ts +1 -1
- package/dist/types/components/AppMentionInput.d.ts +2 -2
- package/dist/types/components/AppMetricStrip.d.ts +5 -0
- package/dist/types/components/AppModal.d.ts +5 -0
- package/dist/types/components/AppNumberInput.d.ts +9 -3
- package/dist/types/components/AppPhoneNumberInput.d.ts +1 -1
- package/dist/types/components/AppRowActions.d.ts +46 -0
- package/dist/types/components/AppSearch.d.ts +1 -1
- package/dist/types/components/AppSectionFeatures.d.ts +5 -1
- package/dist/types/components/AppSectionLogos.d.ts +1 -0
- package/dist/types/components/AppSelect.d.ts +3 -2
- package/dist/types/components/AppShell.d.ts +2 -0
- package/dist/types/components/AppSlider.d.ts +5 -0
- package/dist/types/components/AppTextarea.d.ts +2 -2
- package/dist/types/components/AppTimePicker.d.ts +1 -1
- package/dist/types/components/AppToast.d.ts +5 -0
- package/dist/types/hookForm/index.d.ts +14 -0
- package/dist/types/index.d.ts +8 -5
- package/dist/types/lib/emptyValue.d.ts +2 -2
- package/dist/types/lib/fieldState.d.ts +1 -0
- package/dist/types/lib/formFields.d.ts +12 -0
- package/dist/types/lib/useWuiText.d.ts +3 -0
- package/dist/ui-react.js +1 -1
- package/dist/web-core/dist/errors/extractApiError.js +2 -0
- package/dist/web-core/dist/errors/requestPlatform.js +1 -0
- package/package.json +21 -10
- package/dist/components/AppResizable.js +0 -1
- package/dist/components/AppResizableHandle.js +0 -1
- package/dist/components/AppResizablePanel.js +0 -1
- package/dist/components/AppRollingNumber.js +0 -1
- package/dist/components/AppRowSwitch.js +0 -1
- package/dist/types/components/AppResizable.d.ts +0 -37
- package/dist/types/components/AppResizableHandle.d.ts +0 -14
- package/dist/types/components/AppResizablePanel.d.ts +0 -14
- package/dist/types/components/AppRollingNumber.d.ts +0 -30
- package/dist/types/components/AppRowSwitch.d.ts +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./warnUnknownProps.js";import{isElementDefined as i}from"@webority/ui-elements/helpers";import{useId as a,useLayoutEffect as o,useRef as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{SHOW_MORE_TEXT as u}from"@webority/ui-elements/text";var d=()=>import(`@webority/ui-elements/elements/show-more`);function f(f){e(`wui-show-more`,d);let{marker:p,props:m}=n(`AppShowMore`,{...f}),h=t(`showMore`,u),{children:g,lines:_=3,moreLabel:v=h.moreLabel,lessLabel:y=h.lessLabel,defaultExpanded:b=!1,id:x,className:S=``,...C}=m;r(`AppShowMore`,C);let w=a(),T=x||`show-more-${w.replace(/:/g,``)}`,E=`${T}-body`,D=s(null),O=s(b);return o(()=>{if(O.current){if(!D.current)throw Error(`<AppShowMore> element was not mounted before layout`);i(`wui-show-more`)?D.current.toggle(!0):D.current.setAttribute(`expanded`,``)}},[]),/* @__PURE__ */ l(`wui-show-more`,{ref:D,class:[`wui-show-more`,S].filter(Boolean).join(` `),id:T,lines:_===3?void 0:String(_),"more-label":v===h.moreLabel?void 0:v,"less-label":y===h.lessLabel?void 0:y,...p,...C,children:[/* @__PURE__ */ c(`div`,{className:`wui-show-more-body`,id:E,children:g}),/* @__PURE__ */ c(`button`,{type:`button`,className:`btn btn-link btn-sm wui-show-more-toggle`,"aria-expanded":O.current?`true`:`false`,"aria-controls":E,hidden:!0,children:O.current?y:v})]})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import i from"./assertValidValue.js";import a,{readRange as o,writeNumberValue as s}from"./useWuiControl.js";import re from"./warnUnknownProps.js";import{forwardRef as c,useEffect as ie,useId as l,useRef as ae}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{SLIDER_TEXT as oe}from"@webority/ui-elements/text";var se=[`sm`,`md`,`lg`],f=[`none`,`indian`],p=()=>import(`@webority/ui-elements/elements/slider`),ce=(e,t)=>s(e,typeof t==`number`||typeof t==`string`?t:void 0),m=c(function(s,c){let{marker:m,props:h}=r(`AppSlider`,s),g=ee(`slider`,oe),{value:_,start:v,end:y,range:le=!1,onChange:ue,label:b,required:x=!1,optional:de=!1,helperText:S,error:fe,name:C,startName:w,endName:T,min:E=0,max:D=100,step:O=1,disabled:k,readOnly:A=!1,loading:j=!1,defaultValue:M,defaultStart:N,defaultEnd:P,size:F,showValue:I,unit:L,grouping:R=`none`,id:z,ariaLabel:pe,className:B=``,fieldClassName:V=``,help:H,helpLabel:me=g.helpLabel,optionalLabel:he=g.optionalLabel,...U}=h,ge=t(C),_e=t(w),ve=t(T),W=fe??ge??_e??ve;re(`AppSlider`,U),i(`AppSlider`,`size`,F,se),i(`AppSlider`,`grouping`,R,f);let ye=n(`wui-slider`,p),be=l(),G=z||be,K=le,{setRef:q,innerRef:J}=a({ready:ye,ref:e=>{typeof c==`function`?c(e):c&&(c.current=e)},value:K?void 0:_,onChange:K?e=>{s.range&&s.onChange?.(e)}:e=>{s.range||s.onChange?.(e)},readValue:K?o:void 0,writeValue:K?void 0:ce}),Y=ae(!1);ie(()=>{if(!K)return;let e=J.current;if(!e)return;let t=v===void 0?Y.current?void 0:N:v,n=y===void 0?Y.current?void 0:P:y;Y.current=!0,t!==void 0&&t>e.end?(n!==void 0&&e.end!==n&&(e.end=n),t!==void 0&&e.start!==t&&(e.start=t)):(t!==void 0&&e.start!==t&&(e.start=t),n!==void 0&&e.end!==n&&(e.end=n))},[v,y,N,P,K,J]);let X=!b&&!W&&!S,Z=W?`${G}-error`:void 0,Q=S?`${G}-hint`:void 0,$=/* @__PURE__ */ u(`wui-slider`,{ref:q,id:G,name:C||void 0,"start-name":w||void 0,"end-name":T||void 0,min:E,max:D,step:O,size:F||void 0,value:(_??M)!=null&&!K?String(_??M):void 0,"aria-label":pe||(typeof b==`string`?b:void 0),"aria-describedby":Z||Q,"aria-invalid":W?`true`:void 0,disabled:k?``:void 0,readonly:A?``:void 0,loading:j?``:void 0,required:x?``:void 0,range:K?``:void 0,"show-value":I?``:void 0,unit:L||void 0,grouping:R===`indian`?R:void 0,className:B||void 0,...X?m:null,...U});return X?$:/* @__PURE__ */ d(`div`,{...m,className:`field${V?` ${V}`:``}`,children:[b&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:G,children:[b,de&&!x&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${he}`}),x&&/* @__PURE__ */ u(ne,{}),H&&/* @__PURE__ */ u(te,{label:me,children:H})]}),$,/* @__PURE__ */ u(e,{error:W,hint:S,errorId:Z,hintId:Q})]})});export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/
|
|
1
|
+
import e from"../lib/useElementEntry.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./useWuiControl.js";import o from"./warnUnknownProps.js";import{forwardRef as s,useEffect as c,useRef as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{SORTABLE_LIST_TEXT as f,fillText as p}from"@webority/ui-elements/text";var m=[`vertical`,`horizontal`],h=[`always`,`hover`],g=()=>import(`@webority/ui-elements/elements/sortable`),_=e=>`order`in e,v=(e,t)=>{if(!_(e))throw TypeError(`<AppSortableList> wrote its order before <wui-sortable> upgraded.`);e.controlled=!0;let n=e.order;(n.length!==t.length||t.some((e,t)=>e!==n[t]))&&(e.order=t)},y=s(function(s,_){let y=e(`wui-sortable`,g),{marker:b,props:x}=n(`AppSortableList`,s),S=t(`sortableList`,f),{items:C=[],onReorder:w,ariaLabel:T,handle:E=!1,group:D,name:O,disabled:k=!1,orientation:A=`vertical`,handleDisplay:j=`always`,bordered:M=!0,className:N=``,reorderLabel:P=S.reorderLabel,...F}=x;o(`AppSortableList`,F),i(`AppSortableList`,`orientation`,A,m),i(`AppSortableList`,`handleDisplay`,j,h);let I=j===`hover`,L=C.map(e=>e.id),R=l(L);c(()=>{R.current=L});let{setRef:z,innerRef:B}=a({ready:y,ref:_,value:L,writeValue:v,on:{"wui-sortable:change":e=>{if(e.target!==e.currentTarget)return;let t=e.detail;w?.(t.ids,t),requestAnimationFrame(()=>{let e=B.current;e&&v(e,R.current)})}}});return/* @__PURE__ */ u(`wui-sortable`,{ref:z,role:`list`,"aria-label":T,name:O||void 0,group:D||void 0,orientation:A===`horizontal`?`horizontal`:void 0,"handle-display":I?`hover`:void 0,handle:E||I?``:void 0,disabled:k?``:void 0,borderless:M?void 0:``,className:`wui-sortable${N?` ${N}`:``}`,...b,...F,children:C.map(e=>/* @__PURE__ */ d(`div`,{role:`listitem`,className:`wui-sortable-item`,"data-id":e.id,"data-label":e.label,"data-disabled":e.disabled?``:void 0,children:[/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-sortable-handle`,"aria-label":p(P,{name:e.label}),disabled:k||e.disabled?!0:void 0,children:/* @__PURE__ */ u(r,{name:`menu`,size:18})}),/* @__PURE__ */ u(`div`,{className:`wui-sortable-body`,children:e.content??e.label})]},e.id))})});export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./warnUnknownProps.js";import{jsx as i}from"react/jsx-runtime";import{SPARKLINE_TEXT as a,fillText as o}from"@webority/ui-elements/text";var s=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},c=!1;function l(t){!c&&s()&&(c=!0,e(`[@webority/ui-react] <AppSparkline> left out ${t} value(s) in \`data\` that are not finite numbers.`))}var u=e=>typeof e==`number`&&Number.isFinite(e);function d(e,t,n,r){if(e.length<2)return`0,${n/2} ${t},${n/2}`;let i=r===void 0?Math.min(...e):Math.min(r,...e),a=Math.max(...e)-i,o=t/(e.length-1);return e.map((e,t)=>{let r=a===0?n/2:n-(e-i)/a*n;return`${t*o},${r}`}).join(` `)}var f=e=>String(Number(e.toFixed(2)));function p(e,t,n){let r=t?o(n.namedTrendLabel,{label:t}):n.trendLabel;return e.length===1?o(n.oneValueText,{name:r,value:f(e[0]??0)}):o(n.rangeText,{name:r,from:f(e[0]??0),to:f(e[e.length-1]??0),count:e.length})}function m(e){let{marker:o,props:s}=n(`AppSparkline`,e),c=t(`sparkline`,a),{data:f,label:m,width:h=48,height:g=16,className:_=``,trendLabel:v=c.trendLabel,namedTrendLabel:y=c.namedTrendLabel,oneValueText:b=c.oneValueText,rangeText:x=c.rangeText,yMin:S,...C}=s;r(`AppSparkline`,C);let w=Array.isArray(f)?f.filter(u):[];if(Array.isArray(f)&&w.length<f.length&&l(f.length-w.length),w.length===0)return null;let T={trendLabel:v,namedTrendLabel:y,oneValueText:b,rangeText:x};return/* @__PURE__ */ i(`svg`,{className:`wui-sparkline${_?` ${_}`:``}`,width:h,height:g,viewBox:`0 0 ${h} ${g}`,role:`img`,"aria-label":p(w,m,T),...o,...C,children:/* @__PURE__ */ i(`polyline`,{points:d(w,h,g,S),stroke:`currentColor`,fill:`none`})})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{jsx as i}from"react/jsx-runtime";import{SPINNER_TEXT as a}from"@webority/ui-elements/text";var o=[`sm`,`md`];function s(s){let{marker:c,props:l}=t(`AppSpinner`,s),u=e(`spinner`,a),{size:d=`md`,label:f=u.label,className:p=``,...m}=l;r(`AppSpinner`,m),n(`AppSpinner`,`size`,typeof d==`string`&&!Number.isFinite(Number(d))?d:null,o);let{style:h,...g}=m,_=Number(d),v=Number.isFinite(_)&&_>0,y=`spinner-border${!v&&d===`sm`?` spinner-border-sm`:``}${p?` ${p}`:``}`,b=v?{width:`${_}px`,height:`${_}px`,borderWidth:`${Math.max(2,Math.round(_/8))}px`,...h}:h;return/* @__PURE__ */ i(`span`,{className:y,role:`status`,"aria-label":f,style:b,...c,...g})}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./assertValidValue.js";import r from"./warnUnknownProps.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{SPLASH_TEXT as o}from"@webority/ui-elements/text";var s=[`bar`,`ring`,`dots`],c={sm:44,md:56,lg:72};function l(l){let{marker:u,props:d}=t(`AppSplash`,l),f=e(`splash`,o),{logo:p,initials:m,description:h,subtext:g,variant:_=`bar`,size:v=`md`,label:y=f.label,className:b=``,...x}=d;r(`AppSplash`,x),n(`AppSplash`,`variant`,_,s),n(`AppSplash`,`size`,typeof v==`string`?v:null,Object.keys(c));let{style:S,...C}=x,w={"--wui-splash-size":`${typeof v==`number`?v:c[v]??c.md}px`},T=_===`ring`?/* @__PURE__ */ i(`span`,{className:`splash-ring`,"aria-hidden":`true`}):_===`dots`?/* @__PURE__ */ a(`span`,{className:`splash-dots`,"aria-hidden":`true`,children:[/* @__PURE__ */ i(`i`,{}),/* @__PURE__ */ i(`i`,{}),/* @__PURE__ */ i(`i`,{})]}):/* @__PURE__ */ i(`span`,{className:`splash-bar`,"aria-hidden":`true`});return/* @__PURE__ */ i(`div`,{className:`splash${b?` ${b}`:``}`,role:`status`,"aria-live":`polite`,"aria-label":y,style:{...w,...S},...u,...C,children:/* @__PURE__ */ a(`div`,{className:`splash-inner`,children:[p||m&&/* @__PURE__ */ i(`span`,{className:`splash-mark`,children:m}),T,h&&/* @__PURE__ */ i(`span`,{className:`splash-text`,children:h}),g&&/* @__PURE__ */ i(`span`,{className:`splash-subtext`,children:g})]})})}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buttonClass as e}from"../lib/buttonClass.js";import{FILL_VARIANTS as
|
|
1
|
+
import{buttonClass as e}from"../lib/buttonClass.js";import t from"../lib/useWuiText.js";import{FILL_VARIANTS as n,TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppButton.js";import o from"./AppDropdown.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{SPLIT_BUTTON_TEXT as f}from"@webority/ui-elements/text";var p=[`sm`,`md`,`lg`],m=[`button`,`submit`,`reset`],h={sm:14,md:16,lg:20},g={sm:`btn-sm`,md:``,lg:`btn-lg`};function _(_){let{marker:v,props:y}=i(`AppSplitButton`,_),b=t(`splitButton`,f),{label:x,items:S=[],onClick:C,href:w,type:T=`button`,tone:E=`primary`,variant:D=`solid`,size:O=`md`,disabled:k=!1,loading:A=!1,leftIcon:j,shortcut:M,menuLabel:N=b.menuLabel,align:P=`end`,linkComponent:F,className:I=``,...L}=y;l(`AppSplitButton`,L),c(`AppSplitButton`,`size`,O,p),c(`AppSplitButton`,`tone`,E,r),c(`AppSplitButton`,`variant`,D,n),c(`AppSplitButton`,`type`,T,m);let R=[`btn`,e(E,D),g[O]??``,`wui-split-toggle`].filter(Boolean).join(` `),z=/* @__PURE__ */ u(s,{name:`chevron-down`,size:h[O]??h.md}),B=k||A;return/* @__PURE__ */ d(`div`,{role:`group`,"aria-label":x,className:[`wui-split-button`,I].filter(Boolean).join(` `),...v,...L,children:[/* @__PURE__ */ u(a,{tone:E,variant:D,size:O,type:T,href:w,onClick:C,disabled:k,loading:A,leftIcon:j,shortcut:M,children:x}),B?/* @__PURE__ */ u(`div`,{className:`wui-split-menu`,children:/* @__PURE__ */ u(`button`,{type:`button`,className:R,disabled:!0,"aria-label":N,children:z})}):/* @__PURE__ */ u(o,{className:`wui-split-menu`,trigger:z,toggleClassName:R,label:N,ariaLabel:N,align:P,items:S,linkComponent:F})]})}export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppRecordPager.js";import a from"./AppShortcutLegend.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{listKeys as c,selectKey as l,shortcutKey as ee}from"@webority/ui-elements/helpers";import{useEffect as te,useMemo as u,useRef as d}from"react";import{Fragment as ne,jsx as f,jsxs as p}from"react/jsx-runtime";import{KBD_TEXT as m,SPLIT_VIEW_TEXT as re,fillText as h}from"@webority/ui-elements/text";var g={sm:576,md:768,lg:992,xl:1200,xxl:1400},ie=Object.keys(g),_=[3,4,5,6,7,8],ae=Array.from({length:6},(e,t)=>`skeleton-placeholder-${t}`),v=`.wui-split-items > .wui-split-item > .wui-split-link`,y=(e,t)=>e!=null&&String(e)===String(t),oe=e=>{let t=window.matchMedia?.(`(min-width: ${g[e]}px)`);return!t||t.matches},se=(e,t)=>typeof e==`string`||typeof e==`number`?String(e):t;function b(b){let{marker:ce,props:le}=r(`AppSplitView`,b),x=n(`splitView`,re),S=n(`kbd`,m),{items:C=[],currentKey:w,onSelect:T,selectable:E=!1,selectedKeys:D,onToggle:ue,onToggleAll:de,bulkActions:fe,header:O,chips:k,pane:pe,paneHeader:A,pager:me=!0,shortcuts:j,shortcutsEnabled:M=!0,empty:N=x.empty,loading:P=!1,listWidth:F=5,stackBelow:I=`xl`,linkComponent:L,loadingLabel:R=x.loadingLabel,itemsLabel:z=x.itemsLabel,selectItemLabel:he=x.selectItemLabel,selectAllLabel:B=x.selectAllLabel,readingPaneLabel:ge=x.readingPaneLabel,previousItemLabel:_e=x.previousItemLabel,nextItemLabel:ve=x.nextItemLabel,openLabel:ye=x.openLabel,moveLabel:be=x.moveLabel,selectedLabel:xe=x.selectedLabel,untitledItemLabel:Se=x.untitledItemLabel,className:Ce=``,...V}=le,H=u(()=>new Set(D),[D]);s(`AppSplitView`,V),o(`AppSplitView`,`stackBelow`,I,ie),o(`AppSplitView`,`listWidth`,F,_);let U=g[I]?I:`xl`,we=_.includes(F)?F:5,W=d(null),Te=w!=null,G=E?H?.size??0:0,K=G>0,q=E&&C.length>0&&C.every(e=>H?.has(e.key)),Ee=E&&!q&&C.some(e=>H?.has(e.key)),De=e=>{e&&(e.indeterminate=Ee)},J=d(!1);te(()=>{J.current?w!=null&&W.current?.querySelector(`.wui-split-link[aria-current="true"]`)?.scrollIntoView?.({block:`nearest`}):J.current=!0},[w]);let Y=(e,t)=>{t.button>0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||T&&(!e.href||oe(U))&&(t.preventDefault(),T(e.key))},X=e=>{let t=[...W.current?.querySelectorAll(v)??[]];t[t.findIndex(e=>e.getAttribute(`aria-current`)===`true`)+e]?.click()},Oe=[`wui-split-view`,Te?`wui-split-reading`:``,Ce].filter(Boolean).join(` `),ke=E?[...c(),l()]:c(),Ae=/* @__PURE__ */ new Set([`J`,`K`,`Enter`,`?`,...E?[`X`]:[]]),je=[...ke,...(j??[]).filter(e=>!Ae.has(ee(e.key))).map(e=>({key:e.key,label:e.label,onPress:()=>e.onPress?.(w)}))],Z=C.findIndex(e=>y(w,e.key)),Q=me&&!P&&C.length>0?/* @__PURE__ */ f(i,{"data-split-pager":``,index:Z>=0?Z+1:void 0,total:C.length,onPrev:()=>X(-1),onNext:()=>X(1),prevLabel:_e,nextLabel:ve}):null,Me=n=>{let r=y(w,n.key),i=E&&!!H?.has(n.key),a=n.badge!==void 0&&n.badge!==null&&n.badge!==``,o=e(L,{href:n.href}),s=/* @__PURE__ */ p(ne,{children:[/* @__PURE__ */ p(`span`,{className:`wui-split-item-main`,children:[/* @__PURE__ */ f(`span`,{className:`wui-split-item-title`,children:n.title}),n.meta!==void 0&&n.meta!==null&&/* @__PURE__ */ f(`span`,{className:`wui-split-item-meta`,children:n.meta})]}),(n.trailing||a)&&/* @__PURE__ */ p(`span`,{className:`wui-split-item-end`,children:[n.trailing,a&&/* @__PURE__ */ f(`span`,{className:`wui-split-badge`,children:n.badge})]})]});return/* @__PURE__ */ p(`li`,{className:[`wui-split-item`,r?`is-active`:``,i?`is-selected`:``].filter(Boolean).join(` `),"data-key":n.key,children:[E&&/* @__PURE__ */ f(`input`,{type:`checkbox`,className:`wui-check wui-split-check`,checked:i,onChange:()=>ue?.(n.key),"aria-label":h(he,{title:se(n.title,Se)})}),n.href?/* @__PURE__ */ f(t,{link:o,className:`wui-split-link`,"aria-current":r?`true`:void 0,onClick:e=>Y(n,e),children:s}):/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-split-link`,"aria-current":r?`true`:void 0,onClick:e=>Y(n,e),children:s})]},n.key)},$;return $=P?/* @__PURE__ */ p(`div`,{className:`wui-split-items`,"aria-busy":`true`,tabIndex:0,children:[/* @__PURE__ */ f(`span`,{className:`visually-hidden`,children:R}),ae.map(e=>/* @__PURE__ */ p(`div`,{className:`wui-split-skeleton`,"aria-hidden":`true`,children:[/* @__PURE__ */ f(`span`,{className:`skeleton wui-split-skeleton-title`}),/* @__PURE__ */ f(`span`,{className:`skeleton wui-split-skeleton-meta`})]},e))]}):C.length?/* @__PURE__ */ f(`ul`,{className:`wui-split-items`,"aria-label":z,children:C.map(Me)}):/* @__PURE__ */ f(`div`,{className:`wui-split-empty`,children:N}),/* @__PURE__ */ p(`div`,{ref:W,className:Oe,"data-stack-below":U,"data-list-width":we,"data-shortcut-scope":M?``:void 0,...ce,...V,children:[/* @__PURE__ */ p(`div`,{className:`wui-split-list`,children:[(O||E)&&/* @__PURE__ */ p(`div`,{className:`wui-split-head`,children:[E&&/* @__PURE__ */ f(`input`,{ref:De,type:`checkbox`,className:`wui-check wui-split-all`,checked:q,onChange:e=>de?.(e.target.checked),"aria-label":B}),/* @__PURE__ */ f(`div`,{className:`wui-split-head-main`,hidden:K,children:O}),E&&/* @__PURE__ */ p(`div`,{className:`wui-split-head-bulk`,hidden:!K,children:[/* @__PURE__ */ f(`span`,{className:`wui-split-count`,"aria-live":`polite`,children:h(xe,{count:G})}),fe]})]}),k&&/* @__PURE__ */ f(`div`,{className:`wui-split-chips`,children:k}),$,M&&/* @__PURE__ */ p(`div`,{className:`wui-split-legend`,children:[/* @__PURE__ */ p(`span`,{children:[/* @__PURE__ */ f(`kbd`,{className:`wui-kbd`,children:`J`}),` `,/* @__PURE__ */ f(`kbd`,{className:`wui-kbd`,children:`K`}),` ${be}`]}),/* @__PURE__ */ p(`span`,{children:[/* @__PURE__ */ f(`kbd`,{className:`wui-kbd`,children:S.enterLabel}),` ${ye}`]}),/* @__PURE__ */ f(a,{items:v,shortcuts:je})]})]}),/* @__PURE__ */ p(`div`,{className:`wui-split-pane`,children:[(A||Q)&&/* @__PURE__ */ p(`div`,{className:`wui-split-pane-head`,children:[A,Q]}),/* @__PURE__ */ f(`section`,{className:`wui-split-pane-body`,"aria-label":ge,tabIndex:0,children:pe})]})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{emptyPlaceholder as e}from"../lib/emptyValue.js";import{TONES as t}from"../lib/vocabulary.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import a from"./withTooltip.js";import{jsx as o}from"react/jsx-runtime";function s(s){let{marker:c,props:l}=n(`AppStatusBadge`,s),{label:u,tone:d=`neutral`,bordered:f=!1,className:p=``,tooltip:m,tooltipPlacement:h,...g}=l;return i(`AppStatusBadge`,g),r(`AppStatusBadge`,`tone`,d,t),u==null||u===``?e():a(/* @__PURE__ */ o(`span`,{className:`status-label ${d}${f?` wui-bordered`:``}${p?` ${p}`:``}`,...c,...g,children:u}),m,h)}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{deriveStepStatus as c,stepperHeaderItems as l}from"@webority/ui-elements/helpers";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{STEPPER_TEXT as p,fillText as m}from"@webority/ui-elements/text";var h=[`steps`,`journey`],g=[`horizontal`,`vertical`],_=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],v=[`sm`,`md`,`lg`],y=r.filter(e=>e===`primary`||e===`info`),b={sm:12,md:14,lg:18},x=[`done`,`active`,`pending`,`error`];function S(r){let{marker:S,props:C}=i(`AppStepper`,r),w=n(`stepper`,p),{steps:T=[],variant:E=`steps`,orientation:D=`horizontal`,iconVariant:O,size:k=`md`,iconSize:A,active:j,onStepClick:M,label:N=w.label,stepLabel:P=w.stepLabel,tone:F=`primary`,linkComponent:I,className:L=``,...R}=C;s(`AppStepper`,R),o(`AppStepper`,`variant`,E,h),o(`AppStepper`,`orientation`,D,g),o(`AppStepper`,`iconVariant`,O,_),o(`AppStepper`,`size`,k,v),o(`AppStepper`,`tone`,F,y);let z=A!==void 0&&A>0?A:b[k];for(let e of T)o(`AppStepper`,`steps[].status`,e.status,x);let B=E===`journey`,V=[`stepper`,B&&`stepper-journey`,D===`vertical`&&`stepper-vertical`,k!==`md`&&v.includes(k)&&`wui-step-size-${k}`,F!==`primary`&&y.includes(F)&&`wui-step-tone-${F}`,L].filter(Boolean).join(` `),H=l(T,{statusOf:e=>{let t=T[e];if(!t)throw Error(`AppStepper: no step at index ${e}`);return t.status||c(e,j)},journey:B,connectors:!0});return/* @__PURE__ */ d(`nav`,{className:V,"aria-label":N,...S,...R,children:H.map(n=>{let r=n.index,i=T[r];if(!i)throw Error(`AppStepper: no step at index ${r}`);let o=n.className,s=n.glyph.number;n.glyph.icon&&(s=/* @__PURE__ */ d(a,{name:n.glyph.icon,size:z,variant:O}));let c=/* @__PURE__ */ f(u,{children:[/* @__PURE__ */ d(`span`,{className:`step-circle`,children:s}),B?/* @__PURE__ */ f(`span`,{className:`step-text`,children:[/* @__PURE__ */ d(`span`,{className:`step-index`,children:m(P,{number:r+1})}),/* @__PURE__ */ d(`span`,{className:`step-label`,children:i.label}),i.description?/* @__PURE__ */ d(`span`,{className:`step-desc`,children:i.description}):null]}):/* @__PURE__ */ f(u,{children:[/* @__PURE__ */ d(`span`,{className:`step-label`,children:i.label}),i.description?/* @__PURE__ */ d(`span`,{className:`step-desc`,children:i.description}):null]})]}),l=n.current?`step`:void 0,p=i.key??`${i.label}-${r}`,h;if(M)h=/* @__PURE__ */ d(`button`,{type:`button`,className:o,"aria-current":l,onClick:()=>M(i,r),children:c},p);else if(i.href){let n=e(I,{href:i.href});h=/* @__PURE__ */ d(t,{link:n,className:o,"aria-current":l,children:c},p)}else h=/* @__PURE__ */ d(`div`,{className:o,"aria-current":l,children:c},p);return n.line?[h,/* @__PURE__ */ d(`span`,{className:`step-line${n.line.done?` done`:``}`,"aria-hidden":`true`},`${p}-line`)]:h})})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/CheckField.js";import{
|
|
1
|
+
import e from"../lib/CheckField.js";import{BOX_SIZES as t}from"../lib/fieldState.js";import n from"../lib/labelWithHelp.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{forwardRef as s}from"react";import{jsx as c}from"react/jsx-runtime";import{SWITCH_TEXT as l}from"@webority/ui-elements/text";var u=[`round`,`pill`,`circle`];function d(e,t){if(t!=null&&t!==``)throw Error(`<AppSwitch> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}var f=s(function(s,f){let{marker:p,props:m}=i(`AppSwitch`,s),h=r(`switch`,l),{label:g,id:_,name:v,error:y,helperText:b,help:x,helpLabel:S=h.helpLabel,shape:C=`round`,className:w=``,checked:T,defaultChecked:E,onChange:D,readOnly:O=!1,loading:k=!1,size:A=`md`,controlOnly:j=!1,...M}=m;if(o(`AppSwitch`,M),j&&(d(`label`,g),d(`error`,y),d(`helperText`,b),m.size!==void 0&&m.size!==`md`))throw Error(`<AppSwitch> controlOnly draws no field, so it takes no size; draw the label or message on the page.`);a(`AppSwitch`,`shape`,C,u),a(`AppSwitch`,`size`,A,t);let N=`form-check form-switch${C===`circle`?` form-switch-circle`:C===`pill`?` form-switch-pill`:``}`,P={...M};return T!==void 0&&(P.checked=T),E!==void 0&&(P.defaultChecked=E),D!==void 0&&(P.onChange=D),T!==void 0&&D===void 0&&(P.readOnly=!0),/* @__PURE__ */ c(e,{rootProps:p,ref:f,label:n(g,x,S),id:_,name:v,error:y,hint:b,className:w,rest:P,inputType:`checkbox`,wrapperClass:N,readOnly:O,loading:k,size:A,controlOnly:j})});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e
|
|
1
|
+
import{pageWindow as e}from"../lib/pageWindow.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./AppSelect.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{TABLE_PAGINATION_TEXT as l,fillText as u}from"@webority/ui-elements/text";var d=[`numbered`,`prev-next`],f=[`sm`,`md`],p=[`footer`,`standalone`],m=[5,10,25,50];function h(e,t,n,r){let i=Math.min((t-1)*n+1,r),a=Math.min(t*n,r);return u(e,{first:i,last:a,total:r})}function g(g){let{marker:_,props:v}=n(`AppTablePagination`,g),y=t(`tablePagination`,l),{page:b,totalPages:x,total:S,pageSize:C,onPageChange:w,onPageSizeChange:T,pageSizes:E=m,mode:D=`numbered`,showPageSize:O=!0,siblings:k=2,summary:A=!1,size:j=`md`,variant:M=`footer`,ariaLabel:N=y.ariaLabel,rowsPerPageLabel:P=y.rowsPerPageLabel,pageSizeLabel:F=y.pageSizeLabel,previousLabel:I=y.previousLabel,nextLabel:L=y.nextLabel,pageLabel:R=y.pageLabel,rangeText:z=y.rangeText,className:B=``,...V}=v;o(`AppTablePagination`,V),a(`AppTablePagination`,`mode`,D,d),a(`AppTablePagination`,`size`,j,f),a(`AppTablePagination`,`variant`,M,p);let H=Number(C)||0,U=Number(S)||0,W=x===void 0?U<=0:x<=0,G=Math.max(1,x??Math.ceil(U/(H>0?H:10))),K=Math.min(Math.max(1,Number(b)||1),G),q=H>0&&!!T&&O!==!1,J=A===!0&&U>0&&H>0;if(W||G<=1&&!q)return null;let Y=H>0&&!E.includes(H)?[...E,H].sort((e,t)=>e-t):E,X=D===`numbered`,Z=X?e(K,G,{siblingCount:k}):null,Q=[`table-pagination`,M===`standalone`&&`wui-table-pagination-standalone`,j===`sm`&&`wui-table-pagination-sm`,B].filter(Boolean).join(` `);return/* @__PURE__ */ c(`nav`,{className:Q,"aria-label":N,..._,...V,children:[J&&/* @__PURE__ */ s(`span`,{className:`wui-pager-summary`,children:h(y.summaryText,K,H,U)}),q&&/* @__PURE__ */ s(`span`,{className:`tpg-rows`,children:/* @__PURE__ */ s(i,{density:`compact`,size:`sm`,"aria-label":P,value:String(H),onChange:e=>T?.(Number(e)),options:Y.map(e=>({value:String(e),label:u(F,{count:e})}))})}),!X&&/* @__PURE__ */ s(`span`,{className:`tpg-range`,children:u(z,{page:K,pages:G})}),/* @__PURE__ */ c(`div`,{className:`tpg-nav`,children:[/* @__PURE__ */ s(`button`,{type:`button`,className:`tpg-arrow`,onClick:()=>w?.(Math.max(1,K-1)),disabled:K<=1,"aria-label":I,children:/* @__PURE__ */ s(r,{name:`arrow-left`,size:18})}),Z?.map(e=>typeof e==`number`?/* @__PURE__ */ s(`button`,{type:`button`,className:`tpg-page${e===K?` is-active`:``}`,onClick:()=>w?.(e),"aria-current":e===K?`page`:void 0,"aria-label":u(R,{page:e}),children:e},e):/* @__PURE__ */ s(`span`,{className:`tpg-ellipsis`,"aria-hidden":`true`,children:`…`},e)),/* @__PURE__ */ s(`button`,{type:`button`,className:`tpg-arrow`,onClick:()=>w?.(Math.min(G,K+1)),disabled:K>=G,"aria-label":L,children:/* @__PURE__ */ s(r,{name:`arrow-right`,size:18})})]})]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./warnUnknownProps.js";import{formatNumber as i}from"@webority/ui-elements/helpers";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{TABLE_TOOLBAR_TEXT as s,fillText as c}from"@webority/ui-elements/text";function l(l){let{marker:u,props:d}=t(`AppTableToolbar`,l),f=e(`tableToolbar`,s),{filters:p,actions:m,selectedCount:h=0,bulkActions:g,onClearSelection:_,totalCount:v,pageCount:y,onSelectAllMatching:b,allMatchingSelected:x=!1,selectAllMatchingLabel:S=f.selectAllMatchingLabel,selectedLabel:C=f.selectedLabel,allSelectedLabel:w=f.allSelectedLabel,clearLabel:T=f.clearLabel,clearSelectionLabel:E=f.clearSelectionLabel,className:D=``,...O}=d;r(`AppTableToolbar`,O);let k=h>0,A=typeof b==`function`&&typeof v==`number`,j=A&&x,M=e=>i(e,{decimals:0}),N=A&&!j&&k&&h>=(y??1)&&v>(y??h);return/* @__PURE__ */ o(`div`,{className:`wui-table-toolbar${D?` ${D}`:``}`,...u,...O,children:[/* @__PURE__ */ o(`div`,{className:`wui-table-toolbar-main`,hidden:k,children:[/* @__PURE__ */ a(`div`,{className:`wui-table-toolbar-filters`,children:p}),/* @__PURE__ */ a(`div`,{className:`wui-table-toolbar-actions`,children:m})]}),/* @__PURE__ */ o(`div`,{className:`wui-table-toolbar-bulk`,hidden:!k,children:[/* @__PURE__ */ a(`span`,{className:`wui-table-toolbar-count`,"aria-live":`polite`,children:c(j?w:C,{count:M(j?v:h)})}),A&&/* @__PURE__ */ a(`button`,{type:`button`,className:`btn btn-link btn-sm wui-table-toolbar-all`,hidden:!N,onClick:b,children:c(S,{count:M(v)})}),g,_&&/* @__PURE__ */ a(n,{variant:`ghost`,size:`sm`,className:`wui-table-toolbar-clear`,onClick:_,children:j?E:T})]})]})}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import{TONES as
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./AppTooltip.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import u from"./warnUnknownProps.js";import{formatNumber as ee}from"@webority/ui-elements/helpers";import{cloneElement as te,useCallback as d,useEffect as f,useLayoutEffect as p,useRef as m,useState as h}from"react";import{Fragment as ne,jsx as g,jsxs as _}from"react/jsx-runtime";import{TABS_TEXT as re}from"@webority/ui-elements/text";var v=[`underline`,`pills`],y=[`horizontal`,`vertical`],ie=[`sm`,`md`,`lg`],ae=[`automatic`,`manual`],oe=[`scroll`,`menu`],se=i.filter(e=>e!==`primary`&&e!==`neutral`),ce=()=>import(`@webority/ui-elements/elements/overflow`),b=1,le=28,x=.7;function S(i){let{marker:S,props:C}=a(`AppTabs`,i),w=r(`tabs`,re),{tabs:T,value:E,onChange:D,linkComponent:O,variant:k=`underline`,orientation:A=`horizontal`,size:j=`md`,fitted:ue=!1,overflow:M=`scroll`,moreLabel:de=w.moreLabel,maxVisible:fe,activation:N=`automatic`,ariaLabel:P,className:F=``,style:I,...L}=C;n(`wui-overflow`,ce),u(`AppTabs`,L),c(`AppTabs`,`variant`,k,v),c(`AppTabs`,`orientation`,A,y),c(`AppTabs`,`size`,j,ie),c(`AppTabs`,`activation`,N,ae),c(`AppTabs`,`overflow`,M,oe);for(let e of T)c(`AppTabs`,`tabs[].tone`,e.tone,se);let R=m(null),z=m(null),B=A===`vertical`,V=(M===`menu`||fe!=null)&&!B,[H,U]=h(E);f(()=>{U(E)},[E]);let pe=T.find(e=>!e.disabled)?.key,me=T.some(e=>e.key===H&&!e.disabled)?H:void 0,he=T.some(e=>e.key===E&&!e.disabled)?E:void 0,ge=me??he??pe,_e=e=>{R.current?.querySelector(`[data-key="${CSS.escape(String(e))}"]`)?.focus()},W=d(()=>{let e=R.current,t=z.current;if(!e||!t||B||V)return;let n=e.scrollWidth-e.clientWidth;t.classList.toggle(`is-overflow-start`,e.scrollLeft>b),t.classList.toggle(`is-overflow-end`,n>b&&e.scrollLeft<n-b)},[B,V]),G=d(()=>{let e=R.current;if(!e)return;let t=e.querySelector(`.app-tab.active`);t?(B?(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`,!!T.find(e=>e.key===E)?.danger)):e.style.setProperty(B?`--wui-tab-h`:`--wui-tab-w`,`0px`),e.setAttribute(`data-wui-tabs`,``),W()},[B,T,E,W]),K=e=>!V||!R.current?.querySelector(`[data-key="${CSS.escape(String(e))}"][data-wui-overflow-hidden]`),q=d(e=>{let t=R.current;if(!t||B)return;let n=t.querySelector(`.app-tab[data-key="${CSS.escape(e)}"]`);if(!n)return;let r=le,i=n.offsetLeft,a=i+n.offsetWidth;i-r<t.scrollLeft?t.scrollLeft=Math.max(0,i-r):a+r>t.scrollLeft+t.clientWidth&&(t.scrollLeft=a+r-t.clientWidth)},[B]);p(()=>{G()},[G]),p(()=>{q(E)},[E,q]);let J=m(G);f(()=>{J.current=G},[G]),f(()=>{if(!document.fonts)return;let e=!0;return document.fonts.ready.then(()=>{e&&J.current()}),()=>{e=!1}},[]);let Y=m(null),X=d(e=>{if(typeof ResizeObserver>`u`)return;let t=Y.current??{ro:new ResizeObserver(()=>J.current()),count:0};return Y.current=t,t.ro.observe(e),t.count+=1,()=>{t.ro.unobserve(e),--t.count,t.count===0&&(t.ro.disconnect(),Y.current===t&&(Y.current=null))}},[]),ve=d(e=>{R.current=e;let t=e?X(e):void 0;return()=>{R.current=null,t?.()}},[X]),Z=d(e=>{z.current=e;let t=e?X(e):void 0;return()=>{z.current=null,t?.()}},[X]);f(()=>{let e=z.current;if(!V||!e)return;let t=()=>J.current();return e.addEventListener(`wui-overflow-change`,t),()=>e.removeEventListener(`wui-overflow-change`,t)},[V]);function ye(e){let t=e.target instanceof HTMLElement?e.target.dataset.key:void 0;if(t==null)return;let n=T.findIndex(e=>e.key===t);if(n<0)return;let r=T.length,i=(e,t)=>{for(let n=1;n<=r;n++){let i=T[((e+t*n)%r+r)%r];if(i&&!i.disabled&&K(i.key))return i}return null},a=B?`ArrowDown`:`ArrowRight`,o=B?`ArrowUp`:`ArrowLeft`,s=null;if(e.key===a?s=i(n,1):e.key===o?s=i(n,-1):e.key===`Home`?s=T.find(e=>!e.disabled&&K(e.key))??null:e.key===`End`&&(s=[...T].reverse().find(e=>!e.disabled&&K(e.key))??null),!s)return;e.preventDefault(),U(s.key),_e(s.key);let c=s.href!=null||s.to!=null;N===`automatic`&&!c&&D?.(s.key)}let Q=e=>{let t=R.current;t&&t.scrollBy({left:e*t.clientWidth*x})},be=[`app-tabs`,k===`pills`?`app-tabs-pills`:``,B?`app-tabs-vertical`:``,j===`sm`?`app-tabs-sm`:``,j===`lg`?`app-tabs-lg`:``,ue?`app-tabs-fitted`:``,F].filter(Boolean).join(` `),$=/* @__PURE__ */ _(`div`,{ref:ve,role:`tablist`,"aria-orientation":B?`vertical`:void 0,"aria-label":P,className:be,style:I,"data-wui-overflow-list":V?``:void 0,...L,onKeyDown:ye,onScroll:W,children:[T.map(n=>{let r=n.key===E,i=n.href!=null||n.to!=null,a={role:`tab`,"data-key":n.key,"aria-selected":r,tabIndex:n.key===ge?0:-1,className:`app-tab${r?` active`:``}${n.danger?` danger`:``}${i&&n.disabled?` disabled`:``}`},o=/* @__PURE__ */ _(ne,{children:[n.image?/* @__PURE__ */ g(`img`,{className:`app-tab-img`,src:n.image,alt:n.imageAlt??``}):l(n.icon,{size:16,className:`app-tab-icon`}),/* @__PURE__ */ g(`span`,{className:`wui-tab-label`,children:n.label}),(n.countLabel||n.count!=null)&&/* @__PURE__ */ g(`span`,{className:`app-tab-count${n.tone?` ${n.tone}`:``}`,children:n.countLabel||ee(n.count,{decimals:0})})]}),c;if(i){let r=n.disabled||n.to==null||O==null||O===`a`?e(void 0,{href:n.disabled?void 0:n.href??n.to}):e(O,{to:n.to}),i=n.rel??(n.target===`_blank`?`noopener noreferrer`:void 0),s=n.disabled?{"aria-disabled":!0}:{target:n.target,rel:i},l=e=>{n.disabled?e.preventDefault():e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(U(n.key),D?.(n.key))};c=/* @__PURE__ */ g(t,{link:r,...a,...s,onClick:l,children:o},n.key)}else c=/* @__PURE__ */ g(`button`,{type:`button`,...a,disabled:n.disabled,onClick:()=>{n.disabled||(U(n.key),D?.(n.key))},children:o},n.key);return n.tooltip?/* @__PURE__ */ g(s,{content:n.tooltip,children:c},n.key):c}),/* @__PURE__ */ g(`span`,{className:`app-tab-indicator`,"aria-hidden":`true`,"data-wui-overflow-skip":``})]});return B?te($,S):V?/* @__PURE__ */ g(`wui-overflow`,{...S,ref:Z,class:`app-tabs-wrap`,label:de,children:$}):/* @__PURE__ */ _(`div`,{...S,ref:Z,className:`app-tabs-wrap`,children:[/* @__PURE__ */ g(`button`,{type:`button`,className:`app-tabs-scroll-btn prev`,"aria-label":w.scrollTabsBackwardLabel,tabIndex:-1,onClick:()=>Q(-1),children:/* @__PURE__ */ g(o,{name:`chevron-left`,size:16})}),$,/* @__PURE__ */ g(`button`,{type:`button`,className:`app-tabs-scroll-btn next`,"aria-label":w.scrollTabsForwardLabel,tabIndex:-1,onClick:()=>Q(1),children:/* @__PURE__ */ g(o,{name:`chevron-right`,size:16})})]})}export{S 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,FIELD_SIZES as r}from"../lib/fieldState.js";import{
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as n,FIELD_SIZES as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as te}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import ne from"./assertValidValue.js";import re from"./warnUnknownProps.js";import{forwardRef as s,useCallback as ie,useEffect as c,useId as l,useLayoutEffect as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{TEXTAREA_TEXT as h}from"@webority/ui-elements/text";import{Form as g}from"react-bootstrap";var ae=e=>e!=null&&e!==``&&e!==!1,_=s(function(s,_){let{marker:v,props:y}=te(`AppTextarea`,s),b=ee(`textarea`,h),{label:x,required:S=!1,optional:C=!1,optionalLabel:w=b.optionalLabel,error:T,helperText:E,help:D,helpLabel:oe=b.helpLabel,id:se,name:O,rows:ce=4,autoGrow:k=!1,monospace:A=!1,showCount:j=!1,maxLength:M,disabled:N=!1,readOnly:P=!1,loading:F=!1,size:I=`md`,className:L=``,fieldClassName:R=``,controlOnly:z=!1,value:B,...V}=y,H=i(O),U=T??H,{onChange:W,...le}=V;if(z){let e=[[`label`,x],[`error`,U],[`helperText`,E],[`fieldClassName`,R],[`showCount`,j],[`help`,D],[`optional`,C]];for(let[t,n]of e)if(ae(n))throw Error(`<AppTextarea> controlOnly draws no field, so it takes no ${t}; draw the label or message on the page.`)}re(`AppTextarea`,V),ne(`AppTextarea`,`size`,I,r),c(()=>{C&&S&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppTextarea: optional and required together; optional ignored`)},[C,S]);let ue=l(),G=se||ue,de=[`textarea`,k?`autosize`:``,A?`wui-mono`:``,U?`error`:``,I===`sm`?`wui-input-sm`:``,I===`lg`?`wui-input-lg`:``,I===`xl`?`wui-input-xl`:``,F?n:``,L].filter(Boolean).join(` `),K=U&&G?`${G}-error`:void 0,q=E&&G?`${G}-hint`:void 0,fe=K||q,J=d(null),pe=e=>{J.current=e,typeof _==`function`?_(e):_&&(_.current=e)},Y=d(void 0),X=ie(()=>{let e=J.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,Y.current=`${e.value}|${e.clientWidth}`)},[]);u(()=>{let e=J.current;!k||!e?Y.current=void 0:`${String(B??e.value)}|${e.clientWidth}`!==Y.current&&X()});let[Z,Q]=f(()=>String(B??V.defaultValue??``).length);c(()=>{j&&B!==void 0&&Q(String(B??``).length)},[B,j]);let me=e=>{k&&X(),j&&Q(e.currentTarget.value.length),V.onInput?.(e)},$=/* @__PURE__ */ p(g.Control,{as:`textarea`,id:G,name:O,rows:ce,className:de,"aria-invalid":U?`true`:`false`,"aria-describedby":fe,"aria-busy":F||void 0,required:S,maxLength:M,disabled:N,readOnly:P||F,...z?v:null,...B===void 0?null:{value:B},...le,...W?{onChange:W}:null,ref:pe,onInput:me});return z?$:/* @__PURE__ */ m(g.Group,{...v,className:`field${R?` ${R}`:``}`,children:[x&&/* @__PURE__ */ m(g.Label,{className:`label`,htmlFor:G,children:[x,C&&!S&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${w}`}),S&&/* @__PURE__ */ p(o,{}),D&&/* @__PURE__ */ p(a,{label:oe,children:D})]}),$,/* @__PURE__ */ p(t,{error:U,hint:E,errorId:K,hintId:q}),j&&/* @__PURE__ */ m(`div`,{className:`field-count${M&&Z>=M?` at-limit`:``}`,children:[Z,M?` / ${M}`:``]})]})});export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppActionIcon.js";import r from"./AppSegmented.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{DEFAULT_THEME_EFFECT as o,DEFAULT_THEME_STORAGE_KEY as s,THEME_CHANGE_EVENT as c,THEME_EFFECTS as l,THEME_MODES as u,applyTheme as d,nextTheme as f,readStoredTheme as p,resolveTheme as m,storeTheme as h,transitionTheme as g,watchSystemTheme as _}from"@webority/ui-elements/helpers";import{useCallback as v,useEffect as y,useId as b,useRef as ee,useState as te}from"react";import{flushSync as x}from"react-dom";import{jsx as S}from"react/jsx-runtime";import{THEME_TOGGLE_TEXT as C}from"@webority/ui-elements/text";function w(e){return u.some(t=>t===e)}var T={light:`sun`,dark:`moon`,auto:`monitor`},E=[`icon`,`segmented`],D={sm:16,md:20,lg:24,xl:28};function O(u){let{marker:O,props:k}=t(`AppThemeToggle`,u),A=e(`themeToggle`,C),{variant:j=`icon`,effect:M=o,includeAuto:N=!0,storageKey:P=s,duration:F,label:I=A.label,lightLabel:L=A.lightLabel,darkLabel:R=A.darkLabel,autoLabel:z=A.autoLabel,name:B,size:V=`md`,tooltipPlacement:H=`auto`,onChange:U,className:W=``,...G}=k,K={light:A.lightModeLabel,dark:A.darkModeLabel,auto:A.autoModeLabel};a(`AppThemeToggle`,G),i(`AppThemeToggle`,`variant`,j,E),i(`AppThemeToggle`,`effect`,M,l),i(`AppThemeToggle`,`size`,V,Object.keys(D));let q=v(e=>e===`auto`&&!N?m(e):e,[N]),[J,Y]=te(()=>q(typeof window>`u`?`auto`:p(P))),X=b(),Z=B||X,Q=ee({shown:q,storageKey:P});y(()=>{let e=document.documentElement.getAttribute(`data-theme`);w(e)?Y(Q.current.shown(e)):d(p(Q.current.storageKey))},[]),y(()=>{let e=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:theme:change arrived without a CustomEvent`);let t=`detail`in e?e.detail:void 0,n=typeof t==`object`&&t&&`preference`in t?t.preference:void 0;w(n)&&Y(q(n))};return document.addEventListener(c,e),()=>document.removeEventListener(c,e)},[q]),y(()=>_(()=>{document.documentElement.getAttribute(`data-theme`)===`auto`&&d(`auto`)}),[]);let $=v((e,t)=>{let n=t?.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r={x:n.left+n.width/2,y:n.top+n.height/2};g(()=>{d(e),h(e,P),x(()=>Y(e)),U?.(e)},{effect:M,to:m(e),origin:r,...F===void 0?null:{duration:F}})},[P,M,F,U]);if(j===`segmented`){let e=[{value:`light`,label:L,icon:T.light},{value:`dark`,label:R,icon:T.dark}];return N&&e.push({value:`auto`,label:z,icon:T.auto}),/* @__PURE__ */ S(r,{...O,options:e,value:J,name:Z,label:I,size:V===`xl`?`lg`:V,className:[`wui-theme-toggle`,`wui-theme-toggle-segmented`,W].filter(Boolean).join(` `),onChange:e=>{if(!w(e)||e===J)return;let t=document.querySelector(`.segmented-input[name="${CSS.escape(Z)}"][value="${e}"]`);$(e,t?.closest(`.segmented-option`)??t)}})}return/* @__PURE__ */ S(n,{...O,icon:T[J],label:`${I}: ${K[J]}`,size:D[V]??D.md,tooltipPlacement:H,onClick:e=>$(f(J,{includeAuto:N}),e.currentTarget),className:[`wui-theme-toggle`,W].filter(Boolean).join(` `)})}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./assertValidValue.js";import s from"./textOf.js";import te from"./useWuiControl.js";import c from"./warnUnknownProps.js";import{cloneElement as ne,forwardRef as l,useId as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{TIME_PICKER_TEXT as p}from"@webority/ui-elements/text";var m=[`sm`,`md`,`lg`,`xl`],h=[`12`,`24`],g=()=>import(`@webority/ui-elements/elements/timepicker`),_=l(function(l,_){let v=n(`wui-timepicker`,g),{marker:y,props:re}=r(`AppTimePicker`,l),b=ee(`timePicker`,p),{value:x,defaultValue:S,onChange:C,label:w,required:T=!1,optional:E=!1,optionalLabel:D=b.optionalLabel,helperText:O,error:k,help:A,helpLabel:j=b.helpLabel,name:M,min:N,max:P,step:F,format:I=24,placeholder:ie=b.placeholder,disabled:L,readOnly:R=!1,loading:z=!1,size:B,id:V,ariaLabel:H,className:U=``,fieldClassName:W=``,...G}=re,K=t(M),q=k??K;c(`AppTimePicker`,G),o(`AppTimePicker`,`size`,B,m);let J=String(I);o(`AppTimePicker`,`format`,J,h);let Y=u(),X=V||M||Y,{setRef:ae}=te({ready:v,ref:_,value:x??(S===void 0?``:void 0),onChange:C}),oe=!w&&!q&&!O,Z=q?`${X}-error`:void 0,Q=O?`${X}-hint`:void 0,se=Z||Q,$=/* @__PURE__ */ d(`wui-timepicker`,{ref:ae,value:(x??S)||void 0,id:X,name:M,min:N,max:P,step:F==null?void 0:String(F),format:J,placeholder:ie,size:B||void 0,"aria-label":H||s(w)||void 0,"aria-describedby":se,"aria-invalid":q?`true`:void 0,disabled:L?``:void 0,readonly:R?``:void 0,loading:z?``:void 0,required:T?``:void 0,className:U||void 0,...G});return oe?ne($,y):/* @__PURE__ */ f(`div`,{...y,className:`field${W?` ${W}`:``}`,children:[w&&/* @__PURE__ */ f(`label`,{className:`label`,htmlFor:X,children:[w,E&&!T&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` ${D}`}),T&&/* @__PURE__ */ d(a,{}),A&&/* @__PURE__ */ d(i,{label:j,children:A})]}),$,/* @__PURE__ */ d(e,{error:q,hint:O,errorId:Z,hintId:Q})]})});export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./AppMarkdown.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{TIMELINE_TEXT as d,fillText as f}from"@webority/ui-elements/text";var p=[`feed`,`progress`,`steps`],m=[`vertical`,`horizontal`],h=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],g=r.filter(e=>e!==`primary`),_=[`sm`,`md`,`lg`],v={done:`check`,current:`clock`,"on-hold":`lock`,rejected:`x`,cancelled:`minus`,skipped:`arrow-right`,upcoming:null},y=e=>(/^https?:[/][/]/i.test(e)||e.startsWith(`/`)&&e[1]!==`/`&&e[1]!==`\\`)&&![...e].some(e=>e.charCodeAt(0)<=32||e.charCodeAt(0)===127);function b(e){if(e.byHref!=null&&e.byHref!==``){if(!y(e.byHref))throw Error(`<AppTimeline> items[].byHref must be a path starting with one '/', or an http:// or https:// address, with no spaces.`);if(!e.by)throw Error(`<AppTimeline> items[].byHref links the by name, so the item needs by.`)}}var x=(n,r)=>{if(!n.byHref)return n.by;let i=e(r,{href:n.byHref});return/* @__PURE__ */ l(t,{link:i,className:`timeline-by-link`,children:n.by})},S=(e,t)=>{if(typeof e!=`string`)throw TypeError(`<AppTimeline> items[].${t} must be a string when markdown is set, because it is Markdown source.`);return e},C=(e,t)=>t?/* @__PURE__ */ l(o,{value:S(e.description,`description`),headings:`text`}):e.description,w=(e,t)=>t?/* @__PURE__ */ l(`div`,{className:`timeline-note wui-timeline-note--markdown`,children:/* @__PURE__ */ l(o,{value:S(e.note,`note`),headings:`text`})}):/* @__PURE__ */ l(`p`,{className:`timeline-note`,children:e.note});function T(e){let{marker:t,props:r}=i(`AppTimeline`,e),o=n(`timeline`,d),{items:y=[],variant:S=`feed`,orientation:T,iconVariant:E,size:D,linkComponent:O,className:k=``,style:A,stepLabel:j=o.stepLabel,markdown:M=!1,...N}=r;c(`AppTimeline`,N),s(`AppTimeline`,`variant`,S,p),s(`AppTimeline`,`orientation`,T,m),s(`AppTimeline`,`iconVariant`,E,h),s(`AppTimeline`,`size`,typeof D==`string`?D:null,_);for(let e of y){if(M)for(let t of[`description`,`note`]){let n=e[t];if(n!=null&&typeof n!=`string`)throw TypeError(`<AppTimeline> items[].${t} must be a string when markdown is set, because it is Markdown source.`)}s(`AppTimeline`,`items[].tone`,e.tone,g),b(e),S===`progress`&&s(`AppTimeline`,`items[].status`,e.status,Object.keys(v))}let P=S===`progress`,F=S===`steps`,I=T===`horizontal`,L=E??(F?`bulk`:void 0),R=typeof D==`string`&&_.includes(D)?D:`md`,z=typeof D==`number`&&D>0?D:void 0,B=!z&&R!==`md`?` wui-timeline--${R}`:``,V=`${F?`timeline wui-timeline--steps${T===`vertical`?` wui-timeline--steps-vertical`:``}`:`timeline${P?` timeline--progress`:``}${I?` timeline--horizontal`:``}`}${B}${k?` ${k}`:``}`,H=F?z?Math.round(z*.43):{sm:19,md:24,lg:31}[R]:z?Math.round(z*.54):P?{sm:10,md:13,lg:17}[R]:{sm:10,md:12,lg:17}[R],U={"--wui-timeline-dot":`${z}px`},W=z?{...A,...U}:A;return/* @__PURE__ */ l(`ol`,{className:V,style:W,...t,...N,children:y.map((e,t)=>{let n=e.tone&&e.tone!==`neutral`?` ${e.tone}`:``;if(F){let r=e.eyebrow??f(j,{number:t+1});return/* @__PURE__ */ u(`li`,{className:`timeline-item${n}`,children:[/* @__PURE__ */ l(`span`,{className:`timeline-dot`,children:e.icon?/* @__PURE__ */ l(a,{name:e.icon,size:H,variant:L}):null}),/* @__PURE__ */ u(`div`,{className:`timeline-body`,children:[r!==``&&/* @__PURE__ */ l(`div`,{className:`wui-timeline-eyebrow`,children:r}),/* @__PURE__ */ l(`div`,{className:`timeline-title`,children:e.title}),e.description&&/* @__PURE__ */ l(`div`,{className:`timeline-desc`,children:C(e,M)})]})]},e.key??`${typeof e.at==`string`?e.at:``}-${t}`)}let r=P?e.status:void 0,i=r?` is-${r}`:``,o=P?e.icon??(r?v[r]:void 0):e.icon||`circle`;return/* @__PURE__ */ u(`li`,{className:`timeline-item${i}${n}`,children:[/* @__PURE__ */ l(`span`,{className:`timeline-dot`,children:o?/* @__PURE__ */ l(a,{name:o,size:H,variant:L}):null}),/* @__PURE__ */ u(`div`,{className:`timeline-body`,children:[P?/* @__PURE__ */ u(`div`,{className:`timeline-head`,children:[/* @__PURE__ */ l(`div`,{className:`timeline-title`,children:e.title}),(e.at||e.time)&&/* @__PURE__ */ u(`span`,{className:`timeline-when`,children:[e.at&&/* @__PURE__ */ l(`span`,{className:`timeline-at`,title:e.atTitle||void 0,children:e.at}),e.time&&/* @__PURE__ */ l(`span`,{className:`timeline-time`,children:e.time})]})]}):/* @__PURE__ */ l(`div`,{className:`timeline-title`,children:e.title}),e.description&&/* @__PURE__ */ l(`div`,{className:`timeline-desc`,children:C(e,M)}),!P&&(e.at||e.time||e.by)&&/* @__PURE__ */ u(`div`,{className:`timeline-meta`,children:[(e.at||e.time)&&/* @__PURE__ */ u(`span`,{className:`timeline-when`,children:[e.at&&/* @__PURE__ */ l(`span`,{className:`timeline-at`,title:e.atTitle||void 0,children:e.at}),e.time&&/* @__PURE__ */ l(`span`,{className:`timeline-time`,children:e.time})]}),e.by&&/* @__PURE__ */ l(`span`,{className:`timeline-by`,children:x(e,O)})]}),P&&e.by&&/* @__PURE__ */ l(`div`,{className:`timeline-meta`,children:/* @__PURE__ */ l(`span`,{className:`timeline-by`,children:x(e,O)})}),e.note&&w(e,M)]})]},e.key??`${typeof e.at==`string`?e.at:``}-${t}`)})})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{useOverlayRoot as t}from"../lib/useOverlayRoot.js";import{splitMarkerProps as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{useOverlayRoot as t}from"../lib/useOverlayRoot.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./assertValidValue.js";import{TOAST_ANIMATIONS as o,TOAST_SHAPES as s,TOAST_SURFACES as c,adoptToast as l,dismissToast as u,subscribeToasts as d}from"./toastStore.js";import f from"./warnUnknownProps.js";import{raisePopover as p}from"@webority/ui-elements/helpers";import{useEffect as m,useRef as h,useState as g}from"react";import{createPortal as _}from"react-dom";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{TOAST_TEXT as b}from"@webority/ui-elements/text";var x={success:{icon:`check-circle`,assertive:!1},info:{icon:`info`,assertive:!1},warning:{icon:`alert-triangle`,assertive:!0},danger:{icon:`alert-circle`,assertive:!0}},S=e=>Object.keys(x).includes(e),C={"top-start":`top-0 start-0`,"top-center":`top-0 start-50 translate-middle-x`,"top-end":`top-0 end-0`,"middle-center":`top-50 start-50 translate-middle`,"bottom-start":`bottom-0 start-0`,"bottom-center":`bottom-0 start-50 translate-middle-x`,"bottom-end":`bottom-0 end-0`},w=64;function T(i){let{marker:l,props:u}=r(`AppToast`,i),x=n(`toast`,b),{position:S=`bottom-end`,maxVisible:w=4,animation:T=`rise`,shape:D=`rounded`,surface:O=`auto`,offset:k,closeLabel:A=x.closeLabel,className:j=``,...M}=u;f(`AppToast`,M),a(`AppToast`,`position`,S,Object.keys(C)),a(`AppToast`,`animation`,T,o),a(`AppToast`,`shape`,D,s),a(`AppToast`,`surface`,O,c);let[N,P]=g([]);m(()=>d(P),[]);let F=t(),I=h(null);m(()=>{let e=I.current;F&&e&&N.length!==0&&e.isConnected&&p(e)},[N,F]);let L=typeof k==`number`&&Number.isFinite(k)&&k>=0;m(()=>{k==null||L||e(`[@webority/ui-react] <AppToast> received offset="${String(k)}", which must be a number of pixels, 0 or more. The default offset is used instead.`)},[k,L]);let{style:R,...z}=M,B={"--wui-toast-offset":`${k}px`},V=L?{...B,...R}:R,H=Math.max(0,N.length-w),U=H?N.slice(H):N,W=C[S]??C[`bottom-end`];return F?_(/* @__PURE__ */ y(`div`,{...l,...z,ref:I,popover:`manual`,style:V,className:`wui-toast-container toast-container position-fixed ${W} p-3 ${j}`.trim(),children:[H>0&&/* @__PURE__ */ y(`div`,{className:`wui-toast-more`,"aria-hidden":`true`,children:[`+`,H,` `,x.moreText]}),U.map(e=>/* @__PURE__ */ v(E,{toast:e,defaultAnimation:T,defaultShape:D,defaultSurface:O,closeLabel:A},e.id))]}),F):null}function E(e){let t=n(`toast`,b),{toast:r,defaultAnimation:a=`rise`,defaultShape:o=`rounded`,defaultSurface:s=`auto`,closeLabel:c=t.closeLabel}=e;if(!S(r.variant))throw Error(`<AppToast> has no tone for the variant "${r.variant}".`);let d=x[r.variant],f=r.animation??a,p=r.shape??o,_=r.surface??s,C=(f===`rise`?``:` wui-toast--anim-${f}`)+(p===`rounded`?``:` wui-toast--shape-${p}`)+(_===`inverse`?` wui-toast--surface-inverse`:``),T=r.duration===0,[E,D]=g(0),[O,k]=g(!1),A=h(null),j=()=>u(r.id),M=h(null);m(()=>{if(r.duration===0)return;l(r.id);let e=M.current,t=e==null?``:getComputedStyle(e).animationName;if(e!=null&&(typeof e.getAnimations==`function`?e.getAnimations().length>0:t!==``&&t!==`none`))return;let n=setTimeout(()=>u(r.id),r.duration);return()=>clearTimeout(n)},[r.id,r.duration]);let N=e=>{if(e.button===0){if(!(e.target instanceof Element))throw Error(`<AppToast> received a pointer event whose target is not an element.`);e.target.closest(`button`)||(A.current=e.clientX,k(!0),e.currentTarget.setPointerCapture?.(e.pointerId))}},P=e=>{A.current!==null&&D(e.clientX-A.current)},F=()=>{A.current=null,k(!1),D(0)},I=e=>{if(A.current===null)return;let t=e.clientX-A.current;Math.abs(t)>w?j():F()},L=E?{transform:`translateX(${E}px)`,opacity:Math.max(0,1-Math.abs(E)/200)}:void 0,R=r.message;return/* @__PURE__ */ y(`div`,{className:`toast show wui-toast wui-toast--${r.variant}${C}${O?` wui-toast--dragging`:``}`,role:d.assertive?`alert`:`status`,"aria-live":d.assertive?`assertive`:`polite`,"aria-atomic":`true`,style:L,onPointerDown:N,onPointerMove:P,onPointerUp:I,onPointerCancel:F,children:[/* @__PURE__ */ v(`span`,{className:`wui-toast-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ v(i,{name:d.icon,size:20})}),/* @__PURE__ */ y(`div`,{className:`wui-toast-content`,children:[r.title&&/* @__PURE__ */ v(`div`,{className:`wui-toast-title`,children:r.title}),/* @__PURE__ */ v(`div`,{className:`wui-toast-message`,children:R}),typeof r.progress==`number`&&/* @__PURE__ */ y(`div`,{className:`wui-toast-task`,children:[/* @__PURE__ */ v(`div`,{className:`wui-toast-track`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r.progress),children:/* @__PURE__ */ v(`div`,{className:`wui-toast-track-fill`,style:{width:`${r.progress}%`}})}),/* @__PURE__ */ y(`span`,{className:`wui-toast-track-pct`,"aria-hidden":`true`,children:[Math.round(r.progress),`%`]})]}),r.action&&/* @__PURE__ */ v(`button`,{type:`button`,className:`wui-toast-action`,onClick:()=>{r.action?.onClick?.(),j()},children:r.action.label})]}),/* @__PURE__ */ v(`button`,{type:`button`,className:`btn-close wui-toast-close`,"aria-label":c,onClick:j}),!T&&/* @__PURE__ */ v(`div`,{ref:M,className:`wui-toast-progress`,style:{animationDuration:`${r.duration}ms`},onAnimationEnd:j})]})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppBanner.js";import r from"./AppButton.js";import i from"./warnUnknownProps.js";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{UPDATE_BAR_TEXT as s}from"@webority/ui-elements/text";var c=()=>window.location.reload();function l(l){let{marker:u,props:d}=t(`AppUpdateBar`,l),f=e(`updateBar`,s),{onReload:p=c,dismissible:m=!1,onClose:h,className:g=``,description:_=f.description,reloadLabel:v=f.reloadLabel,dismissLabel:y=f.dismissLabel,...b}=d;return i(`AppUpdateBar`,b),/* @__PURE__ */ o(n,{tone:`info`,icon:`refresh-cw`,dismissible:m,onClose:h,dismissLabel:y,className:g,...u,...b,children:[/* @__PURE__ */ a(`span`,{className:`me-3`,children:_}),/* @__PURE__ */ a(r,{size:`sm`,onClick:p,children:v})]})}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{formatDate as c}from"@webority/ui-elements/helpers";import{useEffect as l,useRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{WHATS_NEW_TEXT as p}from"@webority/ui-elements/text";var m=[`dot`,`count`],h=()=>import(`@webority/ui-elements/elements/whats-new`),g=e=>typeof e==`object`&&!!e&&`through`in e&&typeof e.through==`string`;function _(e){n(`wui-whats-new`,h);let{marker:t,props:_}=i(`AppWhatsNew`,e),y=r(`whatsNew`,p),{entries:b=[],storageKey:x,readThrough:S,indicator:C=`dot`,label:w=y.label,unreadLabel:T=y.unreadLabel,emptyText:E=y.emptyText,onRead:D,linkComponent:O,className:k=``,...A}=_;s(`AppWhatsNew`,A),o(`AppWhatsNew`,`indicator`,C,m);let j=u(null),M=u(D);return M.current=D,l(()=>{let e=j.current;if(!e)return;let t=e=>{let t=e instanceof CustomEvent?e.detail:void 0;if(!g(t))throw Error(`wui-whats-new-read carried no read-through date`);M.current?.(t.through)};return e.addEventListener(`wui-whats-new-read`,t),()=>e.removeEventListener(`wui-whats-new-read`,t)},[]),/* @__PURE__ */ f(`wui-whats-new`,{ref:j,class:[`wui-whats-new`,k].filter(Boolean).join(` `),"storage-key":x||void 0,"read-through":S||void 0,indicator:C,...t,...A,children:[/* @__PURE__ */ f(`button`,{type:`button`,className:`u-action wui-whats-new-trigger`,"aria-haspopup":`dialog`,children:[/* @__PURE__ */ d(a,{name:`gift`,size:20}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-name`,children:w}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-unread`,children:` ${T}`}),/* @__PURE__ */ d(`span`,{className:`wui-whats-new-dot`,"aria-hidden":`true`})]}),/* @__PURE__ */ f(`div`,{className:`wui-whats-new-panel`,popover:`auto`,role:`dialog`,"aria-label":w,tabIndex:-1,children:[/* @__PURE__ */ d(`h2`,{className:`wui-whats-new-title`,children:w}),b.length>0?/* @__PURE__ */ d(`ol`,{className:`wui-whats-new-list`,children:b.map((e,t)=>/* @__PURE__ */ f(`li`,{className:`wui-whats-new-entry`,children:[/* @__PURE__ */ d(`time`,{className:`wui-whats-new-date`,dateTime:e.date,children:c(e.date)}),/* @__PURE__ */ d(`h3`,{className:`wui-whats-new-entry-title`,children:e.title}),e.body&&/* @__PURE__ */ d(`p`,{className:`wui-whats-new-body`,children:e.body}),e.imageSrc&&/* @__PURE__ */ d(`img`,{className:`wui-whats-new-image`,src:e.imageSrc,alt:e.imageAlt??``,loading:`lazy`}),e.href&&/* @__PURE__ */ d(v,{entry:e,linkComponent:O})]},e.id??`${e.date}-${t}`))}):/* @__PURE__ */ d(`p`,{className:`wui-whats-new-empty`,children:E})]})]})}function v({entry:n,linkComponent:i}){let a=r(`whatsNew`,p),o=e(i,{href:n.href});return/* @__PURE__ */ d(t,{link:o,className:`wui-whats-new-link`,children:n.linkLabel||a.linkLabel})}export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import{TONES as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{Children as c,forwardRef as l,useEffect as u,useRef as d}from"react";import{jsx as f,jsxs as ee}from"react/jsx-runtime";import{WIZARD_TEXT as p}from"@webority/ui-elements/text";var te=[`steps`,`journey`,`icons`,`tiles`],m=r.filter(e=>e!==`neutral`),h=[`horizontal`,`vertical`],g=[`center`,`start`],_=[`done`,`active`,`pending`,`error`],v=[`key`,`label`,`description`,`optional`,`icon`,`status`],ne=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],re=[`check`,`alert-triangle`,`minus`],y=[`sm`,`md`,`lg`],b={sm:14,md:16,lg:20},x=()=>import(`@webority/ui-elements/elements/wizard`),S=/* @__PURE__ */ new Set,C=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}};function ie(t){if(!Array.isArray(t))throw Error(`AppWizard: steps must be an array of { label, description?, optional?, icon?, status?, key? } objects.`);t.forEach((t,n)=>{if(typeof t!=`object`||!t)throw Error(`AppWizard: steps[${n}] needs a text label.`);let r=`label`in t?t.label:void 0;if(typeof r!=`string`||r.trim()===``)throw Error(`AppWizard: steps[${n}] needs a text label.`);if(C())for(let r of Object.keys(t)){if(v.includes(r))continue;let t=`AppWizard: steps[${n}] has an unknown field ${r}; the fields are ${v.join(`, `)}.`;S.has(t)||(S.add(t),e(t))}})}var w=l(function(e,r){let l=t(`wui-wizard`,x),{marker:v,props:S}=i(`AppWizard`,e),C=n(`wizard`,p),{steps:w=[],children:T,active:E,defaultActive:D=0,onStepChange:O,onFinish:k,onSkip:A,beforeNext:j,onInvalid:M,onClose:N,variant:P=`steps`,tone:F,doneTone:I,orientation:L=`horizontal`,align:R=`center`,iconVariant:z,size:B=`md`,iconSize:V,skippable:H=!1,nonLinear:U=!1,hideStepper:W=!1,hideConnectors:G=!1,disabled:K=!1,label:q=C.label,backLabel:J=C.backLabel,nextLabel:ae=C.nextLabel,skipLabel:oe=C.skipLabel,finishLabel:se=C.finishLabel,topBar:ce=!1,barTitle:le,closeLabel:ue=C.closeLabel,className:de=``,...Y}=S;s(`AppWizard`,Y),o(`AppWizard`,`variant`,P,te),o(`AppWizard`,`tone`,F,m),o(`AppWizard`,`doneTone`,I,m),o(`AppWizard`,`orientation`,L,h),o(`AppWizard`,`align`,R,g),o(`AppWizard`,`iconVariant`,z,ne),o(`AppWizard`,`size`,B,y),ie(w);let X=V!==void 0&&V>0?V:b[B]??b.md;for(let e of w)o(`AppWizard`,`steps[].status`,e.status,_);let Z=d(null),fe=e=>{Z.current=e,typeof r==`function`?r(e):r&&(r.current=e)},pe=c.toArray(T),Q=z&&z!==`linear`?[.../* @__PURE__ */ new Set([...re,...w.map(e=>e.icon).filter(e=>!!e)])]:[],me=[F&&`wui-step-tone-${F}`,I&&`wui-step-done-tone-${I}`,B!==`md`&&y.includes(B)&&`wui-step-size-${B}`,de].filter(Boolean).join(` `),$=d(E===void 0?D:E);return u(()=>{let e=Z.current;e&&l&&$.current&&(e.active=$.current)},[l]),u(()=>{let e=Z.current;e&&l&&E!==void 0&&Number(e.active)!==E&&(e.active=E)},[E,l]),u(()=>{let e=Z.current;e&&l&&(e.beforeNext=j??null)},[j,l]),u(()=>{let e=Z.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:change must be a CustomEvent carrying its detail.`);let t=e.detail;O?.(t.index,t)},n=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:finish must be a CustomEvent carrying its detail.`);let t=e.detail;k?.(t)},r=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:skip must be a CustomEvent carrying its detail.`);let t=e.detail;A?.(t.index)},i=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:invalid must be a CustomEvent carrying its detail.`);let t=e.detail;M?.(t.index)},a=e=>{if(!(e instanceof CustomEvent))throw Error(`AppWizard: wui-wizard:close must be a CustomEvent carrying its detail.`);let t=e.detail;N?.(t)};return e.addEventListener(`wui-wizard:change`,t),e.addEventListener(`wui-wizard:finish`,n),e.addEventListener(`wui-wizard:skip`,r),e.addEventListener(`wui-wizard:invalid`,i),e.addEventListener(`wui-wizard:close`,a),()=>{e.removeEventListener(`wui-wizard:change`,t),e.removeEventListener(`wui-wizard:finish`,n),e.removeEventListener(`wui-wizard:skip`,r),e.removeEventListener(`wui-wizard:invalid`,i),e.removeEventListener(`wui-wizard:close`,a)}},[O,k,A,M,N]),/* @__PURE__ */ ee(`wui-wizard`,{ref:fe,variant:P,orientation:L,align:R===`start`?`start`:void 0,"icon-size":X===16?void 0:X,skippable:H?``:void 0,"non-linear":U?``:void 0,"hide-stepper":W?``:void 0,"hide-connectors":G?``:void 0,disabled:K?``:void 0,label:q,"back-label":J,"next-label":ae,"skip-label":oe,"finish-label":se,"top-bar":ce?``:void 0,"bar-title":le||void 0,"close-label":ue,className:me||void 0,...v,...Y,children:[w.map((e,t)=>/* @__PURE__ */ f(`wui-wizard-step`,{label:e.label,description:e.description||void 0,optional:e.optional?``:void 0,icon:e.icon||void 0,status:e.status||void 0,children:pe[t]},e.key??`${e.label}-${t}`)),Q.length>0&&/* @__PURE__ */ f(`span`,{hidden:!0,"data-wui-glyphs":``,children:Q.map(e=>/* @__PURE__ */ f(a,{name:e,size:X,variant:z},e))})]})});export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initialsOf as e}from"../lib/initials.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
|
|
1
|
+
import{initialsOf as e}from"../lib/initials.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useElementEntry.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{useCallback as l,useEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{WORKSPACE_SWITCHER_TEXT as _,fillText as v}from"@webority/ui-elements/text";var y=[`sm`,`md`,`lg`],b=()=>import(`@webority/ui-elements/elements/dropdown`),x=/* @__PURE__ */ new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]);function S(e){let{marker:t,props:n}=a(`AppWorkspaceSwitcher`,e),m=i(`workspaceSwitcher`,_),{tenants:S=[],currentId:E,onSelect:D,menuLabel:O,footerAction:k,linkComponent:A,searchable:j=!1,onCreate:M,canCreate:N=!1,createLabel:P=m.createLabel,compact:F=!1,size:I=`md`,ariaLabel:L,searchPlaceholder:R=m.searchPlaceholder,searchLabel:z=m.searchPlaceholder,noMatchText:B=m.noMatchText,...V}=n,{onToggle:H,...U}=V;c(`AppWorkspaceSwitcher`,U),s(`AppWorkspaceSwitcher`,`size`,I,y),r(`wui-dropdown`,b);let[W,G]=p(``),[K,q]=p(!1),J=f(null),Y=f(null),X=l((e,t)=>{q(e),H?.(e,t)},[H]),Z=S.find(e=>e.id===E)??S[0],Q=d(()=>{let e=W.trim().toLowerCase();return!j||!e?S:S.filter(t=>String(t.name??``).toLowerCase().includes(e))},[S,W,j]);u(()=>{K&&j&&J.current?.focus()},[K,j]),u(()=>{let e=Y.current;if(!e)return;let t=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-dropdown> toggle arrived without its detail.`);X(t.detail.open,{source:t.detail.source})}};return e.addEventListener(`wui-dropdown-toggle`,t),()=>e.removeEventListener(`wui-dropdown-toggle`,t)},[X]),u(()=>{if(!j)return;let e=J.current;if(!e)return;let t=e=>{x.has(e.key)&&e.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[j]);let $=Z?.name??``,ee=L??v(m.ariaLabel,{currentName:$});return/* @__PURE__ */ g(`wui-dropdown`,{ref:Y,class:`dropdown workspace-switcher${I===`sm`?` workspace-switcher-sm`:``}${I===`lg`?` workspace-switcher-lg`:``}`,...t,...U,children:[/* @__PURE__ */ h(T,{compact:F,tenant:Z,ariaLabel:ee}),/* @__PURE__ */ g(`div`,{"data-wui-dropdown-menu":``,popover:`auto`,className:`dropdown-menu workspace-switcher-menu`,children:[O?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-menu-label`,children:O}):null,j?/* @__PURE__ */ g(`div`,{className:`workspace-switcher-search`,children:[/* @__PURE__ */ h(o,{name:`search`,size:14}),/* @__PURE__ */ h(`input`,{ref:J,type:`search`,className:`workspace-switcher-search-input`,placeholder:R,"aria-label":z,value:W,onChange:e=>G(e.target.value)})]}):null,/* @__PURE__ */ g(`div`,{className:`workspace-switcher-list`,children:[Q.map(e=>/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-option${e.id===Z?.id?` is-active`:``}`,onClick:()=>D?.(e),children:[/* @__PURE__ */ h(C,{tenant:e}),/* @__PURE__ */ h(`span`,{className:`workspace-switcher-option-name`,children:e.name}),e.badge?/* @__PURE__ */ h(`span`,{className:`workspace-switcher-badge`,children:e.badge}):null,e.id===Z?.id?/* @__PURE__ */ h(o,{name:`check`,size:16,className:`workspace-switcher-tick`}):null]},e.id)),Q.length===0?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-empty`,children:B}):null]}),N?/* @__PURE__ */ g(`button`,{type:`button`,className:`dropdown-item workspace-switcher-create`,onClick:()=>M?.(),children:[/* @__PURE__ */ h(o,{name:`plus`,size:16}),P]}):null,k?/* @__PURE__ */ h(`div`,{className:`workspace-switcher-footer`,children:w(k,A)}):null]})]})}function C({tenant:t}){return t?.logoUrl?/* @__PURE__ */ h(`img`,{className:`workspace-switcher-mark`,src:t.logoUrl,alt:``,loading:`lazy`}):/* @__PURE__ */ h(`span`,{className:`workspace-switcher-mark`,children:e(t?.name,1)})}function w(e,r){if(typeof e!=`object`||!e||!(`label`in e))return e;let{label:i,icon:a,href:s}=e,c=/* @__PURE__ */ g(m,{children:[a?/* @__PURE__ */ h(o,{name:a,size:16}):null,i]});return s?/* @__PURE__ */ h(n,{link:t(r,{href:s}),className:`workspace-switcher-footer-action`,children:c}):/* @__PURE__ */ h(`button`,{className:`workspace-switcher-footer-action`,type:`button`,children:c})}function T({compact:e,tenant:t,ariaLabel:n}){return/* @__PURE__ */ g(`button`,{type:`button`,"data-wui-dropdown-trigger":``,className:`workspace-switcher-trigger${e?` is-compact`:``}`,"aria-haspopup":`true`,"aria-expanded":`false`,"aria-label":n,children:[/* @__PURE__ */ h(C,{tenant:t}),e?null:/* @__PURE__ */ g(m,{children:[/* @__PURE__ */ h(`span`,{className:`workspace-switcher-trigger-name`,children:t?.name}),/* @__PURE__ */ h(o,{name:`chevrons-up-down`,size:16,className:`workspace-switcher-chevron`})]})]})}export{S as default};
|