@webority/ui-react 0.165.0 → 0.168.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 +217 -215
- package/dist/canvas-kit/manifest.json +247 -28
- 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 -1
- 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 -1
- 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/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/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 -1
- package/dist/components/AppScoreScale.js +1 -1
- package/dist/components/AppSearch.js +1 -1
- package/dist/components/AppSectionLeadCapture.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 +10 -5
- package/dist/lib/FileItemRow.js +1 -1
- package/dist/lib/emptyValue.js +1 -1
- package/dist/lib/fieldState.js +1 -1
- package/dist/lib/useWuiText.js +1 -0
- package/dist/types/components/AppColorField.d.ts +3 -3
- package/dist/types/components/AppDatePicker.d.ts +2 -1
- package/dist/types/components/AppDateRangePicker.d.ts +1 -1
- package/dist/types/components/AppDropdown.d.ts +6 -0
- package/dist/types/components/AppEntryGrid.d.ts +43 -1
- package/dist/types/components/AppFormulaSteps.d.ts +3 -3
- 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/AppNumberInput.d.ts +9 -3
- package/dist/types/components/AppPhoneNumberInput.d.ts +1 -1
- package/dist/types/components/AppRowActions.d.ts +6 -0
- package/dist/types/components/AppSearch.d.ts +1 -1
- package/dist/types/components/AppSelect.d.ts +3 -2
- package/dist/types/components/AppTextarea.d.ts +2 -2
- package/dist/types/components/AppTimePicker.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/lib/emptyValue.d.ts +2 -2
- package/dist/types/lib/fieldState.d.ts +1 -0
- package/dist/types/lib/useWuiText.d.ts +3 -0
- package/dist/ui-react.js +1 -1
- package/package.json +9 -9
- package/dist/lib/unsavedText.js +0 -1
- package/dist/types/lib/unsavedText.d.ts +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./warnUnknownProps.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{PRICING_CARD_TEXT as o}from"@webority/ui-elements/text";function s(s){let{marker:c,props:l}=t(`AppPricingCard`,s),u=e(`pricingCard`,o),{name:d,price:f,unit:p,tagline:m,features:h=[],cta:g,featured:_=!1,current:v=!1,badge:y=u.badge,className:b=``,...x}=l;r(`AppPricingCard`,x);let S=[`plan-card`,_?`featured`:``,v?`current`:``,b].filter(Boolean).join(` `);return/* @__PURE__ */ a(`div`,{className:S,...c,...x,children:[_&&y&&/* @__PURE__ */ i(`span`,{className:`plan-badge`,children:y}),/* @__PURE__ */ i(`div`,{className:`plan-name`,children:d}),/* @__PURE__ */ a(`div`,{className:`plan-price`,children:[f,p&&/* @__PURE__ */ i(`span`,{className:`plan-price-unit`,children:p})]}),m&&/* @__PURE__ */ i(`div`,{className:`plan-tagline`,children:m}),h.length>0&&/* @__PURE__ */ i(`ul`,{className:`plan-features`,children:h.map((e,t)=>{let r=e.included!==!1;return/* @__PURE__ */ a(`li`,{className:r?void 0:`excluded`,children:[/* @__PURE__ */ i(`span`,{className:`plan-feature-icon`,children:/* @__PURE__ */ i(n,{name:r?`check`:`x`,size:16})}),e.text]},e.text?`feat-${t}-${e.text}`:`feat-${t}`)})}),g&&/* @__PURE__ */ i(`div`,{className:`plan-cta`,children:g})]})}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{encodeQr as e,qrSvgPath as t}from"../lib/qrCode.js";import{splitMarkerProps as
|
|
1
|
+
import{encodeQr as e,qrSvgPath as t}from"../lib/qrCode.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./warnUnknownProps.js";import{useMemo as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{QR_CODE_TEXT as c}from"@webority/ui-elements/text";var l=4;function u(u){let{marker:d,props:f}=r(`AppQrCode`,u),p=n(`qrCode`,c),{value:m,size:h=240,title:g=p.title,className:_,style:v,...y}=f;if(i(`AppQrCode`,y),!Number.isFinite(h)||h<=0)throw RangeError(`<AppQrCode> received size=${String(h)}; size is a positive number of pixels.`);let b=a(()=>{if(!m)return null;let n=e(String(m));return{modules:n.size+8,path:t(n,l)}},[m]);if(!b)return null;let{modules:x,path:S}=b,C=Math.max(1,Math.floor(h/x))*x;return/* @__PURE__ */ s(`svg`,{viewBox:`0 0 ${x} ${x}`,width:C,height:C,role:`img`,"aria-label":g,shapeRendering:`crispEdges`,className:_||void 0,style:v,...d,...y,children:[/* @__PURE__ */ o(`rect`,{width:x,height:x,fill:`#ffffff`}),/* @__PURE__ */ o(`path`,{d:S,fill:`#000000`})]})}export{u 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{RADIO_TEXT as l}from"@webority/ui-elements/text";var u=e=>/* @__PURE__ */ Error(`<AppRadio> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`),d=s(function(s,d){let{marker:f,props:p}=i(`AppRadio`,s),m=r(`radio`,l),{label:h,id:g,name:_,error:v,helperText:y,help:b,helpLabel:x=m.helpLabel,className:S=``,readOnly:C=!1,loading:w=!1,size:T=`md`,controlOnly:E=!1,...D}=p;if(o(`AppRadio`,D),a(`AppRadio`,`size`,T,t),E){if(h!=null&&h!==``)throw u(`label`);if(v!=null&&v!==``)throw u(`error`);if(y!=null&&y!==``)throw u(`helperText`);if(T!==`md`)throw u(`size`)}return/* @__PURE__ */ c(e,{rootProps:f,ref:d,label:n(h,b,x),id:g,name:_,error:v,hint:y,className:S,rest:D,inputType:`radio`,wrapperClass:`form-check`,readOnly:C,loading:w,size:T,controlOnly:E})});export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{BOX_SIZES as t,FIELD_BUSY_CLASS as n,blockWhenReadOnly as r}from"../lib/fieldState.js";import{useFieldError as i}from"../lib/formFields.js";import a from"../lib/useWuiText.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./AppInfoTip.js";import c from"./AppRequiredMark.js";import l from"./assertValidValue.js";import u from"./warnUnknownProps.js";import{useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{RADIO_GROUP_TEXT as m}from"@webority/ui-elements/text";var h=[`default`,`card`];function g(g){let{marker:_,props:v}=o(`AppRadioGroup`,g),y=a(`radioGroup`,m),{label:b,options:x=[],name:S,value:C,defaultValue:w,onChange:T,variant:E=`default`,inline:D=!1,required:O=!1,optional:k=!1,optionalLabel:A=y.optionalLabel,disabled:j=!1,readOnly:M=!1,loading:N=!1,size:P=`md`,error:F,helperText:I,help:L,helpLabel:R=y.helpLabel,id:z,className:B=``,fieldClassName:V=``,style:H,...U}=v,W=i(S),G=F??W;u(`AppRadioGroup`,U),l(`AppRadioGroup`,`variant`,E,h),l(`AppRadioGroup`,`size`,P,t);let K=P===`sm`?` form-check-sm`:P===`lg`?` form-check-lg`:``,q=d(),J=z||q,Y=S||J,X=`${J}-error`,Z=`${J}-hint`,Q=C!==void 0;return/* @__PURE__ */ p(`div`,{..._,className:`field${V?` ${V}`:``}`,children:[b!=null&&/* @__PURE__ */ p(`span`,{className:`label`,id:`${J}-label`,children:[b,k&&!O&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${A}`}),O&&/* @__PURE__ */ f(c,{}),L&&/* @__PURE__ */ f(s,{label:R,children:L})]}),/* @__PURE__ */ f(`div`,{className:[`wui-radio-group`,E===`card`?`wui-radio-group-card`:``,D?`wui-radio-group-inline`:``,B].filter(Boolean).join(` `),style:H,id:J,role:`radiogroup`,"aria-labelledby":b==null?void 0:`${J}-label`,"aria-required":O?`true`:void 0,"aria-readonly":M||void 0,"aria-busy":N||void 0,"aria-invalid":G?`true`:void 0,"aria-describedby":G?X:I?Z:void 0,...U,children:x.map((e,t)=>{let i=`${J}-${t}`,a=e.description==null?void 0:`${i}-desc`;return/* @__PURE__ */ p(`div`,{className:`form-check${K}`,children:[/* @__PURE__ */ f(`input`,{type:`radio`,className:N?`form-check-input ${n}`:`form-check-input`,id:i,name:Y,value:e.value,disabled:j||e.disabled||void 0,required:O||void 0,"aria-describedby":a,"aria-readonly":M||void 0,"aria-busy":N||void 0,onClick:r(M||N),...Q?{checked:C===e.value,onChange:()=>T?.(e.value)}:{defaultChecked:w===e.value,onChange:()=>T?.(e.value)}}),/* @__PURE__ */ f(`label`,{className:`form-check-label`,htmlFor:i,children:e.label}),a&&/* @__PURE__ */ f(`div`,{className:`wui-radio-option-desc`,id:a,children:e.description})]},e.value)})}),/* @__PURE__ */ f(e,{error:G,hint:I,errorId:X,hintId:Z})]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{blockWhenReadOnly as t}from"../lib/fieldState.js";import n
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{blockWhenReadOnly as t}from"../lib/fieldState.js";import{useFieldError as n}from"../lib/formFields.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"./AppInfoTip.js";import ee from"./AppRequiredMark.js";import te from"./assertValidValue.js";import c from"./warnUnknownProps.js";import{useId as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{RATING_TEXT as p,fillText as m}from"@webority/ui-elements/text";var ne=()=>import(`@webority/ui-elements/elements/rating`),h={sm:16,md:20,lg:28},g=e=>String(Math.round(e*100)/100),_=(e,t,n)=>e>=t?`full`:n&&e>=t-.5?`half`:`empty`;function v(o){r(`wui-rating`,ne);let{marker:v,props:b}=a(`AppRating`,o),x=i(`rating`,p),{value:S,defaultValue:C,onChange:w,max:T=5,readOnly:E=!1,half:D=!1,showValue:re=!1,size:O=`md`,label:k,help:A,helpLabel:ie=x.helpLabel,ratingLabel:ae=x.ratingLabel,starLabel:oe=x.starLabel,starsLabel:j=x.starsLabel,valueText:M=x.valueText,name:N,required:P=!1,disabled:F=!1,loading:I=!1,error:L,helperText:R,id:z,className:B=``,fieldClassName:V=``,...H}=b,U=n(N),W=L??U;c(`AppRating`,H),te(`AppRating`,`size`,O,Object.keys(h));let G=l(),[K,se]=u(C),q=h[O]??h.md,J=Array.from({length:T},(e,t)=>t+1),Y=(...e)=>[`wui-rating`,`wui-rating-${O}`,...e,B].filter(Boolean).join(` `);if(E){let e=S===void 0?K:S,t=Number.isFinite(Number(e))?Math.min(Math.max(Number(e),0),T):0,n=D?Math.round(t*2)/2:Math.round(t),r=`${typeof k==`string`&&k?`${k}: `:``}${m(M,{value:g(t),max:T})}`;return/* @__PURE__ */ f(`span`,{className:Y(`wui-rating-display`,I&&`wui-field-busy`),id:z,role:`img`,"aria-label":r,"aria-busy":I||void 0,...v,...H,children:[/* @__PURE__ */ d(`span`,{className:`wui-rating-stars`,"aria-hidden":`true`,children:J.map(e=>/* @__PURE__ */ d(`span`,{className:`wui-rating-star wui-rating-star-${_(n,e,D)}`,children:/* @__PURE__ */ d(y,{px:q})},e))}),re&&/* @__PURE__ */ d(`span`,{className:`wui-rating-value`,"aria-hidden":`true`,children:g(t)})]})}let X=z||G,ce=N||X,Z=`${X}-error`,Q=`${X}-hint`,$=Math.round(Number(S===void 0?K:S))||0,le=e=>{I||(se(e),w?.(e))};return/* @__PURE__ */ f(`div`,{...v,className:`field${V?` ${V}`:``}`,children:[k!=null&&/* @__PURE__ */ f(`span`,{className:`label`,id:`${X}-label`,children:[k,P&&/* @__PURE__ */ d(ee,{}),A&&/* @__PURE__ */ d(s,{label:ie,children:A})]}),/* @__PURE__ */ d(`wui-rating`,{class:Y(`wui-rating-input`,I&&`wui-field-busy`),id:X,role:`radiogroup`,"aria-busy":I?`true`:void 0,"aria-labelledby":k==null?void 0:`${X}-label`,"aria-label":k==null?ae:void 0,"aria-required":P?`true`:void 0,"aria-invalid":W?`true`:void 0,"aria-describedby":W?Z:R?Q:void 0,disabled:F?``:void 0,...H,children:J.map(e=>/* @__PURE__ */ f(`label`,{className:`wui-rating-star wui-rating-star-${$>=e?`full`:`empty`}`,"data-value":e,children:[/* @__PURE__ */ d(`input`,{type:`radio`,className:`visually-hidden`,name:ce,value:e,"aria-label":m(e===1?oe:j,{count:e}),checked:$===e,onChange:()=>le(e),onClick:t(E||I),disabled:F||void 0,required:P||void 0}),/* @__PURE__ */ d(y,{px:q})]},e))}),/* @__PURE__ */ d(e,{error:W,hint:R,errorId:Z,hintId:Q})]})}function y({px:e}){return/* @__PURE__ */ f(`span`,{className:`wui-rating-glyphs`,"aria-hidden":`true`,children:[/* @__PURE__ */ d(o,{name:`star`,size:e}),/* @__PURE__ */ d(`span`,{className:`wui-rating-fill`,children:/* @__PURE__ */ d(o,{name:`star`,variant:`bold`,size:e})})]})}export{v as default};
|
|
@@ -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"./AppActionIcon.js";import i from"./warnUnknownProps.js";import{formatNumber as a}from"@webority/ui-elements/helpers";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{RECORD_PAGER_TEXT as c,fillText as l}from"@webority/ui-elements/text";var u=e=>a(e,{decimals:0}),d=()=>import(`@webority/ui-elements/elements/record-pager`);function f(a){e(`wui-record-pager`,d);let{marker:f,props:p}=n(`AppRecordPager`,a),m=t(`recordPager`,c),{index:h,total:g,prevHref:_,onPrev:v,nextHref:y,onNext:b,prevLabel:x=m.prevLabel,nextLabel:S=m.nextLabel,keys:C=!1,className:w=``,...T}=p;i(`AppRecordPager`,T);let E=Number(h),D=Number(g),O=Number.isInteger(E)&&Number.isInteger(D)&&E>=1&&E<=D,k=O&&E>1&&!!(_||v),A=O&&E<D&&!!(y||b);return/* @__PURE__ */ s(`wui-record-pager`,{class:[`wui-record-pager`,w].filter(Boolean).join(` `),keys:C?``:void 0,...f,...T,children:[/* @__PURE__ */ o(`span`,{className:`wui-record-pager-position`,"aria-live":`polite`,children:O?l(m.positionText,{position:u(E),total:u(D)}):``}),/* @__PURE__ */ o(r,{icon:`chevron-left`,label:x,size:18,className:`wui-record-pager-prev`,href:_||void 0,onClick:v,disabled:!k,shortcut:C?`K`:void 0}),/* @__PURE__ */ o(r,{icon:`chevron-right`,label:S,size:18,className:`wui-record-pager-next`,href:y||void 0,onClick:b,disabled:!A,shortcut:C?`J`:void 0})]})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import r from"./withTooltip.js";import{
|
|
1
|
+
import e from"../lib/useElementEntry.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import r from"./withTooltip.js";import{emptyValueLabel as i,formatDate as a,relativeTimeTitle as o,toInstant as s}from"@webority/ui-elements/helpers";import{jsx as c}from"react/jsx-runtime";var l=()=>import(`@webority/ui-elements/elements/relative-time`);function u(u){e(`wui-relative-time`,l);let{marker:d,props:f}=t(`AppRelativeTime`,u),{value:p,tooltipPlacement:m=`auto`,className:h=``,...g}=f;n(`AppRelativeTime`,g);let _=s(p),v=Number.isFinite(_),y=v?typeof p==`string`?p.trim():new Date(_).toISOString():void 0;return r(/* @__PURE__ */ c(`wui-relative-time`,{class:[`wui-relative-time`,h].filter(Boolean).join(` `),...d,...g,children:/* @__PURE__ */ c(`time`,{dateTime:y,children:v?a(_):i()})}),v?o(_):void 0,m)}export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FILL_VARIANTS as
|
|
1
|
+
import e from"../lib/useWuiText.js";import{FILL_VARIANTS as t}from"../lib/vocabulary.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppActionIcon.js";import i from"./AppButton.js";import a from"./AppLink.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{REPEATER_TEXT as u}from"@webority/ui-elements/text";function d(e,t){return`id`in e&&(typeof e.id==`string`||typeof e.id==`number`)?e.id:t}function f(f){let{marker:p,props:m}=n(`AppRepeater`,f),h=e(`repeater`,u),{rows:g=[],renderRow:_,rowLabel:v,onAdd:y,onRemove:b,addLabel:x=h.addLabel,addVariant:S=`soft`,removeLabel:C=h.removeLabel,emptyText:w,min:T=0,max:E,numbered:D=!0,className:O=``,...k}=m;s(`AppRepeater`,k),o(`AppRepeater`,`addVariant`,S,t);let A=typeof E==`number`&&g.length>=E,j=!!b&&g.length>T;return/* @__PURE__ */ l(`div`,{className:`repeater${O?` ${O}`:``}`,...p,...k,children:[g.length===0&&w&&/* @__PURE__ */ c(`div`,{className:`repeater-empty`,children:w}),g.map((e,t)=>{let n=v?v(e,t):null;return/* @__PURE__ */ l(`div`,{className:`repeater-row`,children:[(!!n||j)&&/* @__PURE__ */ c(`span`,{className:`repeater-row-label`,children:n}),D&&/* @__PURE__ */ c(`span`,{className:`repeater-index`,children:t+1}),/* @__PURE__ */ c(`div`,{className:`repeater-body`,children:_(e,t)}),j&&/* @__PURE__ */ c(r,{icon:`trash-2`,label:`${C} ${t+1}`,tone:`danger`,className:`repeater-remove`,onClick:()=>b?.(t)})]},d(e,t))}),S===`link`?/* @__PURE__ */ c(a,{animation:`static`,size:`sm`,linkComponent:`button`,type:`button`,leftIcon:`plus`,className:`repeater-add`,disabled:A,onClick:y,children:x}):/* @__PURE__ */ c(i,{variant:S,size:`sm`,leftIcon:`plus`,className:`repeater-add`,disabled:A,onClick:y,children:x})]})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import{splitMarkerProps as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./assertValidValue.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{isElementDefined as u,whenElementDefined as d}from"@webority/ui-elements/helpers";import{forwardRef as f,useEffect as p,useId as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{RICH_TEXT_TEXT as v}from"@webority/ui-elements/text";var y=[`html`,`markdown`],b=[`input`,`change`],x=f(function(f,x){let{marker:S,props:C}=i(`AppRichText`,f),w=r(`richText`,v),{value:T,onChange:E,format:D,placeholder:O,name:k,label:A,error:j,helperText:M,required:N=!1,disabled:P=!1,readOnly:F=!1,loading:I=!1,defaultValue:L,id:R,ariaLabel:z,className:B=``,fieldClassName:V=``,help:H,helpLabel:U=w.helpLabel,...W}=C,G=n(k),K=j??G;l(`AppRichText`,W),s(`AppRichText`,`format`,D,y);let q=m(),J=R||q,[Y,X]=h(!1),[Z,Q]=h(()=>u(`wui-rich-text`)),{setRef:$}=c({ready:Z,ref:x,value:T,defaultValue:L,onChange:E,events:b});return p(()=>{if(Z)return;let t=!0;return import(`@webority/ui-elements/rich-text`).then(()=>d(`wui-rich-text`)).then(()=>{t&&Q(!0)},n=>{let r=typeof n==`object`&&n&&`message`in n?n.message:void 0;e(`[AppRichText] the editor failed to load:`,r),t&&X(!0)}),()=>{t=!1}},[Z]),/* @__PURE__ */ _(`div`,{...S,className:`field${V?` ${V}`:``}`,children:[A&&/* @__PURE__ */ _(`label`,{className:`label`,htmlFor:J,children:[A,N&&/* @__PURE__ */ g(o,{}),H&&/* @__PURE__ */ g(a,{label:U,children:H})]}),Y?/* @__PURE__ */ g(`div`,{className:`field-error`,role:`status`,children:w.loadFailedText}):/* @__PURE__ */ g(`wui-rich-text`,{ref:$,id:J,role:`group`,name:k,format:D||void 0,placeholder:O,"aria-label":z||(typeof A==`string`?A:void 0),"aria-describedby":K?`${J}-error`:M?`${J}-hint`:void 0,"aria-invalid":K?`true`:void 0,required:N?``:void 0,disabled:P?``:void 0,readonly:F?``:void 0,loading:I?``:void 0,className:B||void 0,...W},D||`html`),/* @__PURE__ */ g(t,{error:K,hint:M,errorId:`${J}-error`,hintId:`${J}-hint`})]})});export{x 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"./AppButton.js";import r from"./AppResult.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";import{ROUTE_ERROR_TEXT as l}from"@webority/ui-elements/text";var u=[`error`,`stale-build`,`not-found`],d=()=>window.location.reload();function f(f){let{marker:p,props:m}=t(`AppRouteError`,f),h=e(`routeError`,l),{kind:g=`error`,homeHref:_=`/`,onRetry:v=d,brand:y,fullPage:b=!0,homeLabel:x=h.homeLabel,reloadLabel:S=h.reloadLabel,retryLabel:C=h.retryLabel,staleTitle:w=h.staleTitle,staleText:T=h.staleText,notFoundTitle:E=h.notFoundTitle,notFoundText:D=h.notFoundText,errorTitle:O=h.errorTitle,errorText:k=h.errorText,children:A,className:j=``,...M}=m;a(`AppRouteError`,M),i(`AppRouteError`,`kind`,g,u);let N=e=>/* @__PURE__ */ s(n,{variant:e,leftIcon:`home`,href:_,children:x}),P;return P=g===`stale-build`?/* @__PURE__ */ s(r,{status:`info`,icon:`refresh-cw`,title:w,subtitle:T,actions:/* @__PURE__ */ s(n,{leftIcon:`refresh-cw`,onClick:v,children:S}),children:A}):g===`not-found`?/* @__PURE__ */ s(r,{status:`404`,title:E,subtitle:D,actions:N(`solid`),children:A}):/* @__PURE__ */ s(r,{status:`500`,title:O,subtitle:k,actions:/* @__PURE__ */ c(o,{children:[/* @__PURE__ */ s(n,{leftIcon:`refresh-cw`,onClick:v,children:C}),N(`outline`)]}),children:A}),/* @__PURE__ */ c(`div`,{className:[b?`d-flex flex-column align-items-center justify-content-center min-vh-100 px-3`:`d-flex flex-column align-items-center py-5 px-3`,j].filter(Boolean).join(` `),...p,...M,children:[y&&/* @__PURE__ */ s(`div`,{className:`mb-4`,children:y}),/* @__PURE__ */ s(`div`,{className:`col-12 col-md-8 col-lg-6`,children:P})]})}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{splitMarkerProps as
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppActionIcon.js";import i from"./AppButton.js";import a from"./AppDropdown.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{ROW_ACTIONS_TEXT as u}from"@webority/ui-elements/text";var d=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],f=[`danger`],p=[`_blank`,`_self`],m=/^data-[a-z0-9]+(?:-[a-z0-9]+)*$/,h=e=>!!e,g=e=>!e.menuOnly&&(!!e.icon||e.showLabel===!0);function _(e){if(e.label.trim()===``)throw RangeError(`<AppRowActions> an action needs a label.`);if(e.to&&e.href)throw RangeError(`<AppRowActions> action "${e.key}" takes to or href, not both.`);if(!e.disabled&&!e.onClick&&!e.href&&!e.to)throw RangeError(`<AppRowActions> action "${e.key}" needs onClick, href or to unless it is disabled.`);if(e.disabledReason&&!e.disabled)throw RangeError(`<AppRowActions> action "${e.key}" has disabledReason without disabled.`);if(e.menuOnly&&e.showLabel)throw RangeError(`<AppRowActions> action "${e.key}" takes menuOnly or showLabel, not both.`);if((e.target||e.rel)&&!e.href&&!e.to)throw RangeError(`<AppRowActions> action "${e.key}" takes target and rel only with href or to.`);for(let t of Object.keys(e.data??{}))if(!m.test(t))throw RangeError(`<AppRowActions> action "${e.key}" has a data key "${t}" that is not data-<name> in lowercase.`);o(`AppRowActions`,`items[].tone`,e.tone,f),o(`AppRowActions`,`items[].target`,e.target,p),o(`AppRowActions`,`items[].iconVariant`,e.iconVariant,d)}function v(t,n){if(!n.to)return{href:n.href};let r=e(t,{to:n.to});return r.Tag===`a`?{href:r.linkProps.href}:{as:r.Tag,to:r.linkProps.to}}function y(e,t){let n=v(t,e),a={target:e.target,rel:e.rel,...e.data};if(e.showLabel||!e.icon)return/* @__PURE__ */ c(i,{size:`sm`,variant:`outline`,tone:e.tone,leftIcon:e.icon,iconVariant:e.iconVariant,tooltip:e.disabled?e.disabledReason:void 0,className:`wui-row-action-inline`,disabled:e.disabled,onClick:e.onClick,...n,...a,children:e.label},e.key);let o=e.disabled&&e.disabledReason?`${e.label}: ${e.disabledReason}`:e.label;return/* @__PURE__ */ c(r,{icon:e.icon,iconVariant:e.iconVariant,label:o,tone:e.tone,className:`wui-row-action-inline`,disabled:e.disabled,onClick:e.onClick,...n,...a},e.key)}function b(e){let{marker:r,props:i}=n(`AppRowActions`,e),o=t(`rowActions`,u),{items:d,menuLabel:f=o.menuLabel,linkComponent:p,className:m=``,...v}=i;s(`AppRowActions`,v);let b=d.filter(h);for(let e of b)_(e);let x=b.length>0&&b.every(g),S=b.map(e=>({key:e.key,label:e.label,icon:e.icon,to:e.to,href:e.href,target:e.target,rel:e.rel,data:e.data,onClick:e.onClick,tone:e.tone,disabled:e.disabled,disabledReason:e.disabledReason,hiddenFrom:g(e)?`sm`:void 0}));return/* @__PURE__ */ l(`div`,{className:[`u-row-actions`,m].filter(Boolean).join(` `),...r,...v,children:[b.filter(g).map(e=>y(e,p)),b.length>0?/* @__PURE__ */ c(a,{className:[`wui-row-actions-menu`,x?`wui-hidden-from-sm`:``].filter(Boolean).join(` `),icon:`more-horizontal`,label:f,align:`end`,toggleClassName:`u-action`,linkComponent:p,items:S}):null]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import{wuiMarkerAttributes as
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useWuiText.js";import{wuiMarkerAttributes as r}from"../lib/wuiMarker.js";import{useId as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{SCORE_SCALE_TEXT as s}from"@webority/ui-elements/text";function c(c){let l=n(`scoreScale`,s),{value:u=null,onChange:d,min:f=0,max:p=10,label:m,lowLabel:h,highLabel:g,name:_,disabled:v=!1,error:y,helperText:b,id:x,className:S=``,fieldClassName:C=``,scoreLabel:w=l.scoreLabel}=c,T=t(_),E=y??T,D=i(),O=x||D,k=_||O,A=`${O}-error`,j=`${O}-hint`,M=Array.from({length:Math.max(0,p-f+1)},(e,t)=>f+t),N=h!=null||g!=null;return/* @__PURE__ */ o(`div`,{...r(`AppScoreScale`,c),className:`field${C?` ${C}`:``}`,children:[m!=null&&/* @__PURE__ */ a(`span`,{className:`label`,id:`${O}-label`,children:m}),/* @__PURE__ */ o(`div`,{className:`wui-score-scale${S?` ${S}`:``}`,id:O,role:`radiogroup`,"aria-labelledby":m==null?void 0:`${O}-label`,"aria-label":m==null?w:void 0,"aria-invalid":E?`true`:void 0,"aria-describedby":E?A:b?j:void 0,children:[M.map(e=>/* @__PURE__ */ o(`label`,{className:`wui-score-scale__item${u===e?` wui-score-scale__item--selected`:``}`,children:[/* @__PURE__ */ a(`input`,{type:`radio`,className:`visually-hidden`,name:k,value:e,checked:u===e,disabled:v,onChange:()=>d?.(e)}),e]},e)),N&&/* @__PURE__ */ o(`span`,{className:`wui-score-scale__ends`,children:[/* @__PURE__ */ a(`span`,{children:h}),/* @__PURE__ */ a(`span`,{children:g})]})]}),/* @__PURE__ */ a(e,{error:E,hint:b,errorId:A,hintId:j})]})}export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{FIELD_SIZES as e}from"../lib/fieldState.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"./warnUnknownProps.js";import{isTypingTarget as o}from"@webority/ui-elements/helpers";import{useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{flushSync as d}from"react-dom";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{SEARCH_TEXT as m}from"@webority/ui-elements/text";import{Form as h}from"react-bootstrap";function g(g){let{marker:_,props:v}=n(`AppSearch`,g),y=t(`search`,m),{value:b,defaultValue:x,onChange:S,placeholder:C=y.placeholder,ariaLabel:w,clearLabel:T=y.clearLabel,searchLabel:E=y.searchLabel,iconSize:D,size:O,loading:k=!1,collapsible:A=!1,disabled:j=!1,className:M=``,form:N,onKeyDown:P,...F}=v;a(`AppSearch`,F);let{readOnly:I,...L}=F;i(`AppSearch`,`size`,O,e);let R=D??18,[z,B]=u(x??``),V=b===void 0?z:b,[H,U]=u(!!V),W=l(null),G=l(null),K=!A||H||!!V,q=s(()=>{U(!0),requestAnimationFrame(()=>W.current?.focus())},[]),J=()=>{B(``),d(()=>S?.(``)),W.current?.form?.requestSubmit()};c(()=>{if(!A)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||o(e.target instanceof Node?e.target:null)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===G.current&&(e.preventDefault(),q())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A,q]);let Y=[`search-wrap`,V?`has-value`:``,O===`sm`?`wui-search-sm`:O===`lg`?`wui-search-lg`:O===`xl`?`wui-search-xl`:``,k?`is-loading`:``,A?`wui-search-collapsible`:``,A&&!K?`is-collapsed`:``,M].filter(Boolean).join(` `),X=D==null?void 0:{"--wui-search-icon-size":`${D}px`};return/* @__PURE__ */ p(`div`,{..._,className:Y,style:X,ref:G,onBlur:e=>{A&&!e.currentTarget.contains(e.relatedTarget)&&!V&&U(!1)},children:[A&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":w||C||E,"aria-expanded":K?`true`:`false`,onClick:q,children:/* @__PURE__ */ f(r,{name:`search`,size:R})}),k&&/* @__PURE__ */ f(`span`,{className:`search-spinner`,"aria-hidden":`true`}),/* @__PURE__ */ f(r,{name:`search`,size:R,className:`search-icon`}),/* @__PURE__ */ f(h.Control,{ref:W,type:`search`,className:`input search-input`,placeholder:C,value:V,onChange:e=>{B(e.target.value),S?.(e.target.value)},onKeyDown:e=>{P?.(e),A&&e.key===`Escape`&&!V&&U(!1)},"aria-label":w,form:N,disabled:j,...I===void 0?null:{readOnly:I},...L}),!j&&/* @__PURE__ */ f(`button`,{type:`button`,className:`search-clear`,"aria-label":T,onClick:J,hidden:!V,children:/* @__PURE__ */ f(r,{name:`x`,size:16})})]})}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_VARIANTS as r,sectionHeading as i}from"../lib/sectionShell.js";import{splitMarkerProps as
|
|
1
|
+
import e,{SECTION_ALIGNS as t,SECTION_HEADINGS as n,SECTION_VARIANTS as r,sectionHeading as i}from"../lib/sectionShell.js";import a from"../lib/useWuiText.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import o from"./AppAlert.js";import s from"./AppButton.js";import c from"./AppForm.js";import l from"./AppInput.js";import te from"./AppPhoneNumberInput.js";import ne from"./AppTextarea.js";import u from"./assertValidValue.js";import d from"./warnUnknownProps.js";import{useId as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{SECTION_LEAD_CAPTURE_TEXT as g}from"@webority/ui-elements/text";var _=[`name`,`email`,`phone`,`company`,`message`],v={name:`name`,email:`email`,company:`organization`},y=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function re(e,t,n){let r={};for(let{name:i,required:a=!1}of e){let e=(t[i]??``).trim();a&&e===``?r[i]=n.required:i===`email`&&e!==``&&!y.test(e)&&(r[i]=n.invalidEmail)}return r}function b(y){let{marker:b,props:ie}=ee(`AppSectionLeadCapture`,y),x=a(`sectionLeadCapture`,g),{title:ae,description:S,fields:C,onSubmit:w,submitLabel:T=x.submitLabel,nameLabel:E=x.nameLabel,emailLabel:D=x.emailLabel,phoneLabel:O=x.phoneLabel,companyLabel:k=x.companyLabel,messageLabel:A=x.messageLabel,requiredText:j=x.requiredText,invalidEmailText:M=x.invalidEmailText,submitErrorText:N=x.submitErrorText,successTitle:P,successText:F,consent:I,as:L=`h2`,eyebrow:oe,subtitle:R,align:z=`center`,variant:B=`default`,className:V=``,...H}=ie;d(`AppSectionLeadCapture`,H),u(`AppSectionLeadCapture`,`as`,L,n),u(`AppSectionLeadCapture`,`align`,z,t),u(`AppSectionLeadCapture`,`variant`,B,r);for(let e of C)u(`AppSectionLeadCapture`,`fields.name`,e.name,_);let U=f(),[W,G]=p(()=>Object.fromEntries(C.map(e=>[e.name,``]))),[K,q]=p({}),[J,Y]=p(null),[X,Z]=p(!1),[se,ce]=p(!1),Q=(e,t)=>G(n=>({...n,[e]:t})),le={name:E,email:D,phone:O,company:k,message:A},$={required:j,invalidEmail:M};async function ue(){if(X)return!1;let e=re(C,W,$);if(q(e),Y(null),Object.keys(e).length>0)return!1;let t=Object.fromEntries(Object.entries(W).map(([e,t])=>[e,(t??``).trim()]));Z(!0);try{return await w(t),ce(!0),!0}catch(e){let t=typeof e==`object`&&e&&`message`in e?e.message:void 0;return Y(typeof t==`string`&&t!==``?t:N),!1}finally{Z(!1)}}function de({name:e,label:t=le[e],required:n=!1}){let r=`${U}-${e}`,i=K[e];return e===`phone`?/* @__PURE__ */ m(te,{id:r,name:e,label:t,required:n,value:W[e],onChange:t=>Q(e,t),error:i},e):e===`message`?/* @__PURE__ */ m(ne,{id:r,name:e,label:t,required:n,value:W[e],onChange:t=>Q(e,t.target.value),error:i},e):/* @__PURE__ */ m(l,{id:r,name:e,type:e===`email`?`email`:`text`,autoComplete:v[e],label:t,required:n,value:W[e],onChange:t=>Q(e,t.target.value),error:i},e)}return/* @__PURE__ */ h(e,{component:`AppSectionLeadCapture`,kind:`lead-capture`,title:ae,as:i(L,`h2`),eyebrow:oe,subtitle:R,align:z,variant:B,className:V,rest:{...b,...H},children:[S!=null&&S!==``&&/* @__PURE__ */ m(`p`,{className:`wui-section-lead-text`,children:S}),se?/* @__PURE__ */ m(`div`,{className:`wui-section-lead-success`,children:/* @__PURE__ */ m(o,{tone:`success`,title:P,children:F})}):/* @__PURE__ */ h(c,{className:`wui-section-lead-form`,noValidate:!0,onSubmit:ue,children:[/* @__PURE__ */ m(`div`,{className:`wui-section-lead-fields`,children:C.map(de)}),J!=null&&/* @__PURE__ */ m(o,{tone:`danger`,children:J}),/* @__PURE__ */ m(s,{type:`submit`,loading:X,children:T}),I!=null&&I!==``&&/* @__PURE__ */ m(`p`,{className:`wui-section-lead-consent`,children:I})]})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FIELD_BUSY_CLASS as e,blockWhenReadOnly as t}from"../lib/fieldState.js";import{splitMarkerProps as
|
|
1
|
+
import{FIELD_BUSY_CLASS as e,blockWhenReadOnly as t}from"../lib/fieldState.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./AppInfoTip.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{useCallback as c,useEffect as l,useId as u,useLayoutEffect as d,useRef as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{SEGMENTED_TEXT as g}from"@webority/ui-elements/text";var _={sm:`segmented-sm`,md:``,lg:`segmented-lg`};function v(v){let{marker:y,props:b}=r(`AppSegmented`,v),x=n(`segmented`,g),{options:S=[],value:C,defaultValue:w,onChange:T,label:E,name:D,size:O=`md`,fullWidth:k=!1,bordered:A=!0,disabled:j=!1,readOnly:M=!1,loading:N=!1,labelVisible:P=!1,help:F,helpLabel:I=x.helpLabel,className:L=``,...R}=b;s(`AppSegmented`,R),o(`AppSegmented`,`size`,O,Object.keys(_));let z=u(),B=D||z,V=f(null),H=f(null),[U,W]=p(w),G=C===void 0?U:C,K=[`segmented`,_[O]??``,k?`segmented-full`:``,A?``:`wui-segmented-borderless`,j?`is-disabled`:``,N?e:``,L].filter(Boolean).join(` `),q=f(null),J=c(e=>{let t=V.current,n=H.current;if(!t||!n)return;let r=t.querySelector(`.segmented-option:has(.segmented-input:checked)`);if(!r||!t.offsetWidth){n.style.opacity=`0`,q.current=null;return}let i=r.offsetLeft,a=r.offsetWidth,o=q.current;if(o&&o.thumb===n&&o.left===i&&o.width===a)return;let s=e||!o||o.thumb!==n;s&&t.classList.remove(`is-animated`),n.style.width=`${a}px`,n.style.transform=`translateX(${i}px)`,n.style.opacity=`1`,q.current={thumb:n,left:i,width:a},s&&requestAnimationFrame(()=>V.current?.classList.add(`is-animated`))},[]);d(()=>{J(!1)});let Y=c(e=>{if(V.current=e,!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>J(!0));return t.observe(e),()=>{t.disconnect(),V.current=null}},[J]);l(()=>{let e=requestAnimationFrame(()=>V.current?.classList.add(`is-animated`));return()=>cancelAnimationFrame(e)},[]);let X=P&&E,Z=/* @__PURE__ */ h(`div`,{ref:Y,className:K,role:`radiogroup`,"aria-label":E,"aria-disabled":j||void 0,"aria-busy":N||void 0,...X?void 0:y,...R,children:[/* @__PURE__ */ m(`span`,{className:`segmented-thumb`,ref:H,"aria-hidden":`true`}),S.map(e=>/* @__PURE__ */ h(`label`,{className:`segmented-option`,children:[/* @__PURE__ */ m(`input`,{type:`radio`,className:`segmented-input`,name:B,value:e.value,checked:e.value===G,disabled:j||N||e.disabled,"aria-readonly":M||void 0,onClick:t(M||N),onChange:()=>{W(e.value),T?.(e.value)}}),e.icon&&/* @__PURE__ */ m(i,{name:e.icon,size:13}),e.note?/* @__PURE__ */ h(`span`,{className:`segmented-option-text`,children:[/* @__PURE__ */ m(`span`,{className:`segmented-option-label`,children:e.label}),/* @__PURE__ */ m(`span`,{className:`segmented-option-note`,children:e.note})]}):e.label,e.count!=null&&/* @__PURE__ */ m(`span`,{className:`wui-segmented-option-count`,children:e.count})]},e.value))]},`group`);return X?/* @__PURE__ */ h(`div`,{className:`field`,...y,children:[/* @__PURE__ */ m(`span`,{className:`label`,"aria-hidden":`true`,children:E}),F&&/* @__PURE__ */ m(a,{label:I,children:F}),Z]},`field`):Z}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{FIELD_SIZES as n}from"../lib/fieldState.js";import{loadFlagStyles as r}from"../lib/flagStyles.js";import{useFieldError as ee}from"../lib/formFields.js";import te from"../lib/useElementEntry.js";import ne from"../lib/useWuiText.js";import{splitMarkerProps as re}from"../lib/wuiMarker.js";import ie from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./assertValidValue.js";import ae from"./textOf.js";import oe from"./useNodeLabels.js";import se,{optionsEqual as ce}from"./useWuiControl.js";import le from"./warnUnknownProps.js";import{forwardRef as o,useEffect as s,useId as ue,useLayoutEffect as c,useMemo as de,useRef as l}from"react";import{Fragment as fe,jsx as u,jsxs as d}from"react/jsx-runtime";import{SELECT_TEXT as pe,fillText as me}from"@webority/ui-elements/text";var he=[`single`,`multiple`,`search`,`tag`,`country`],ge=[`comfortable`,`compact`],_e=[`off`,`border`,`above`],ve=[],f=[],ye=()=>import(`@webority/ui-elements/elements/select`),be=e=>e===`multiple`||e===`tag`,p=e=>e!=null&&e!==``,m=e=>{throw Error(`<AppSelect> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)},xe=(e,t)=>{let n=t??``;String(e.value??``)!==String(n)&&(e.value=n)},Se=(e,t)=>{let n=Array.isArray(t)?t:f,r=Array.isArray(e.value)?e.value:f;n.length===r.length&&n.every((e,t)=>e===r[t])||(e.value=n)},Ce=(e,t)=>({...e,label:t}),we=e=>Array.isArray(e)?e.join(`,`):e,h=o(function(o,h){let g=te(`wui-select`,ye),{marker:_,props:Te}=re(`AppSelect`,o),v=ne(`select`,pe),{mode:y=`single`,density:b=`comfortable`,size:x,value:Ee,defaultValue:S,onChange:De,options:C=ve,loadOptions:w,remote:T=!1,onSearch:Oe,validate:E,placeholder:ke,searchPlaceholder:Ae,emptyText:je,searchable:D,clearable:Me=!1,openOnHover:Ne=!1,icon:Pe,valuePrefix:O,prefix:k,suffix:A,floatingLabel:j=`off`,disabled:Fe,readOnly:Ie=!1,loading:Le=!1,open:Re,label:M,required:N=!1,optional:P=!1,optionalLabel:F=v.optionalLabel,error:ze,helperText:I,help:L,helpLabel:Be=v.helpLabel,id:Ve,name:R,minChars:z,debounce:B,allowCustom:He=!1,addLabel:Ue,searchingText:We,hintText:Ge,valueLabel:Ke,valueAvatar:qe,valueInitials:Je,maxTags:V,allowDuplicates:Ye=!1,separators:Xe,pattern:Ze,invalidMessage:Qe,createLabel:$e,collapseChips:et=!1,selectedText:tt,clearAllLabel:nt,countries:rt,suggested:it,suggestedLabel:at,allCountriesLabel:ot,recentsKey:st,recentsLimit:H,recentsLabel:ct,className:lt=``,fieldClassName:U=``,controlOnly:ut=!1,"aria-label":dt,"aria-labelledby":ft,"aria-describedby":pt,"aria-invalid":mt,...ht}=Te,gt=ee(R),W=ze??gt;le(`AppSelect`,ht),a(`AppSelect`,`mode`,y,he),a(`AppSelect`,`density`,b,ge),a(`AppSelect`,`size`,x,n);let G=be(y);a(`AppSelect`,`floatingLabel`,j,G?[`off`]:_e);let _t=l(!1);G&&(k!=null||A!=null)&&!_t.current&&(_t.current=!0,e(`AppSelect: prefix and suffix are not drawn in mode="${y}"; they are ignored.`));let vt=ue(),K=l(!1);s(()=>{y===`country`&&r()},[y]);let{setRef:yt,innerRef:q}=se({ready:g,ref:h,value:Ee??(S===void 0?G?f:``:void 0),defaultValue:S,writeValue:G?Se:xe,on:{change:e=>{let t=e.currentTarget.value,n={isCustom:!!e.detail?.isCustom};switch(o.mode){case`multiple`:Array.isArray(t)&&o.onChange?.(t);break;case`tag`:Array.isArray(t)&&o.onChange?.(t,n);break;case`search`:typeof t==`string`&&o.onChange?.(t,n);break;default:typeof t==`string`&&o.onChange?.(t)}},search:e=>{T&&typeof w!=`function`&&Oe?.(e.detail.query,{seq:e.detail.seq})}}}),bt=de(()=>typeof w==`function`?(e,t)=>new Promise(n=>n(w(e,t))).then(e=>(K.current=!0,e),e=>{throw K.current=!0,e}):null,[w]),{portal:xt,toElementOptions:J}=oe(C),Y=l({el:null,options:null,map:null});c(()=>{let e=q.current;if(!e||!g||Y.current.el===e&&Y.current.options===C&&Y.current.map===J||(Y.current={el:e,options:C,map:J},w&&K.current))return;let t=J(C,Ce);ce(t,e.options)||(e.options=t)}),c(()=>{let e=q.current;if(!e||!g)return;e.loadOptions!==bt&&(e.loadOptions=bt);let t=typeof E==`function`?E:null;e.validate!==t&&(e.validate=t)}),c(()=>{q.current?.toggleAttribute(`loading`,!!Le)});let X=Ve||vt,Z=!G&&j!==`off`&&M,St=W&&X?`${X}-error`:void 0,Ct=I&&X?`${X}-hint`:void 0,wt=St||Ct||pt;s(()=>{let e=q.current;e&&(O==null||O===``?e.removeAttribute(`prefix`):e.setAttribute(`prefix`,O))},[O,q]);let Tt=!G&&!Z&&(k!=null||A!=null),Et=y===`multiple`||y===`tag`||y===`country`;if(ut&&(p(M)&&m(`label`),p(W)&&m(`error`),p(I)&&m(`helperText`),p(U)&&m(`fieldClassName`),Et))throw Error(`<AppSelect> controlOnly draws no field, so it takes no mode="${y}"; that mode always draws its field.`);let Q=ut||!Et&&!M&&!W&&!I&&!U,Dt=ae(M).trim(),Ot=Dt&&(y===`single`||y===`multiple`||y===`search`)?me(v.defaultSearchPlaceholder,{labelText:Dt}):void 0,kt=/* @__PURE__ */ u(`wui-select`,{"aria-label":dt||ae(M)||void 0,"aria-labelledby":ft||void 0,"aria-describedby":wt||void 0,"aria-invalid":mt??(W?`true`:void 0),ref:yt,id:X,name:R,mode:y,density:b===`compact`?`compact`:void 0,placeholder:Z?` `:ke||void 0,"search-placeholder":Ae||Ot,"empty-text":je||void 0,searchable:D===void 0?void 0:D?`true`:`false`,clearable:Me?``:void 0,"open-on-hover":Ne?``:void 0,size:x!==`md`&&n.includes(x??``)?x:void 0,icon:Pe||void 0,disabled:Fe?``:void 0,readonly:Ie?``:void 0,open:Re?``:void 0,required:N?``:void 0,"min-chars":z==null?void 0:String(z),debounce:B==null?void 0:String(B),remote:T?``:void 0,"allow-custom":He?``:void 0,"add-label":Ue||void 0,"searching-text":We||void 0,"hint-text":Ge||void 0,"value-label":Ke||void 0,"value-avatar":qe||void 0,"value-initials":Je||void 0,"max-tags":V==null?void 0:String(V),"allow-duplicates":Ye?``:void 0,separators:Xe||void 0,pattern:Ze||void 0,"invalid-message":Qe||void 0,"create-label":$e||void 0,"collapse-chips":et?``:void 0,"selected-text":tt||void 0,"clear-all-label":nt||void 0,countries:we(rt)||void 0,suggested:we(it)||void 0,"suggested-label":at||void 0,"all-countries-label":ot||void 0,"recents-key":st||void 0,"recents-limit":H==null?void 0:String(H),"recents-label":ct||void 0,className:lt||void 0,...Q&&!Tt?_:null,...ht}),$=/* @__PURE__ */ d(fe,{children:[kt,xt]}),At=Tt?/* @__PURE__ */ d(`div`,{...Q?_:null,className:`input-affixed`,children:[k!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-pre`,children:k}),$,A!=null&&/* @__PURE__ */ u(`span`,{className:`affix affix-suf`,children:A})]}):$;if(Q)return At;let jt=[`field`,U].filter(Boolean).join(` `);return/* @__PURE__ */ d(`div`,{..._,className:jt,children:[M&&!Z&&/* @__PURE__ */ d(`label`,{className:`label`,htmlFor:X,children:[M,P&&!N&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ u(i,{}),L&&/* @__PURE__ */ u(ie,{label:Be,children:L})]}),Z?/* @__PURE__ */ d(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:[$,/* @__PURE__ */ d(`label`,{className:`float-label`,htmlFor:X,children:[M,P&&!N&&/* @__PURE__ */ u(`span`,{className:`label-optional`,children:` ${F}`}),N&&/* @__PURE__ */ u(i,{})]})]}):At,/* @__PURE__ */ u(t,{error:W,hint:I,errorId:St,hintId:Ct})]})});export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/fillLabel.js";import{linkTarget as n}from"../lib/linkTarget.js";import{navMatchScore as r}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as i,readNavFolded as a,readShellCollapsed as o,writeNavFolded as s,writeShellCollapsed as c}from"../lib/shellCookie.js";import{TargetLink as l}from"../lib/TargetLink.js";import u from"../lib/useElementEntry.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,isImeSafeEnter as b,revealActiveNavItem as x,setPopoverOpen as S}from"@webority/ui-elements/helpers";import{useEffect as C,useId as w,useMemo as T,useRef as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";var j=()=>import(`@webority/ui-elements/elements/overflow`),M=()=>import(`@webority/ui-elements/elements/dropdown`),N=99,P=4,F=5,I=/^[a-z0-9-]+$/,L=`wui-sidebar-footer`,R=[],z=[`prefix`,`exact`],B=[`comfortable`,`compact`],V=[`neutral`,`primary`],ee=[`default`,`brand`],te=[`side`,`top`],ne=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],re=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),H=e=>e>N?`${N}+`:String(e),U=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),ie=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:U.format(/* @__PURE__ */ new Date)<=e},ae=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},oe=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ k(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ k(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function W(e){let{marker:t,props:n}=f(`AppShell`,e),{groups:r=[],brand:l,logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b,brandHref:w,brandLabel:j,sidebarStart:M,sidebarStartCompact:N,sidebarFooter:P,sidebarFooterItems:F=R,topbarStart:I,topbarEnd:L,footer:z,launcher:re,children:H,collapsed:U,onCollapsedChange:ie,noSidebar:W=!1,nav:G=`side`,density:K=`comfortable`,itemHeight:ce,iconVariant:q=`twotone`,topbarTone:le=`neutral`,tone:J=`default`,navLabel:ve=`Main navigation`,linkComponent:Y,currentPath:be,rememberCollapsed:xe=!1,collapsedCookie:Se=`wui-shell-collapsed`,foldedCookie:Ce=i,tabBarLabel:we=`Quick navigation`,moreLabel:Te=`More`,skipLabel:Ee=`Skip to content`,openNavLabel:De=`Open navigation`,expandNavLabel:Oe=`Expand navigation`,collapseNavLabel:ke=`Collapse navigation`,newLabel:Ae=`New`,togglePagesLabel:je=`Show or hide {name} pages`,accountMenuLabel:Me=`Account menu for {name}`,roleLabel:Ne=`Role:`,rolesLabel:Pe=`Roles:`,unreadLabel:Fe=`Unread`,markAllReadLabel:Ie=`Mark all read`,viewAllLabel:Le=`View all`,loadingNotificationsText:Re=`Loading…`,noUnreadText:ze=`No unread notifications`,unreadNotificationsText:Be=`{count} unread notifications`,unreadBellLabel:Ve=`{label}, {count} unread`,searchResultsLabel:He=`Search results`,noResultsText:Ue=`No results`,noResultsForText:We=`No results for “{value}”`,resultsCountText:Ge=`{count} results`,resultCountText:Ke=`{count} result`,userMenu:qe,notifications:Je,search:Ye,className:Xe=``,style:Ze,...Qe}=n;if(v(`AppShell`,Qe),_(`AppShell`,`density`,K,B),_(`AppShell`,`topbarTone`,le,V),_(`AppShell`,`tone`,J,ee),_(`AppShell`,`nav`,G,te),_(`AppShell`,`iconVariant`,q,ne),j!==void 0&&!w)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(w){if(!j&&!b)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(l||u||d||p||m))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let $e=(ce??0)>0?{...Ze,"--wui-nav-item-height":`${ce}px`}:Ze,[et,tt]=D(()=>xe&&U===void 0&&typeof document<`u`?o(Se)??!1:!1),[X,Z]=D(!1),nt=E(null),[rt,it]=D(!1),[at,ot]=D(!1),st=E(null),Q=U??et,ct=e=>w?/* @__PURE__ */ k(fe,{href:w,label:j||b,linkComponent:Y,onNavigate:()=>Z(!1),children:e}):e,lt=()=>{let e=!Q;U===void 0&&tt(e),xe&&c(e,Se),ie?.(e)},ut=r.some(e=>e.collapsible),[dt,ft]=D(()=>ut&&typeof document<`u`?a(Ce):/* @__PURE__ */ new Set),pt=e=>{let t=new Set(dt);t.has(e)?t.delete(e):t.add(e),ft(t),s(t,Ce)},mt=T(()=>se(r,F,be),[r,F,be]),$=mt.groups,ht=mt.footer,gt=W?null:ue($,ht.some(e=>e.active));C(()=>{let e=()=>it(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),C(()=>{y()},[]),C(()=>{x(st.current)},[]),C(()=>{let e=st.current;if(!e)return;let t=()=>ot($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),C(()=>{let e=nt.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Z(!1))},r=e=>Z(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),C(()=>{let e=nt.current;e?.hasAttribute(`popover`)&&S(e,X)},[X]);let _t=[`app-shell`,Q?`collapsed`:``,W?`no-sidebar`:``,G===`top`?`wui-shell-top`:``,X?`mobile-open`:``,Xe].filter(Boolean).join(` `);return/* @__PURE__ */ A(`div`,{className:_t,"data-density":K===`compact`?`compact`:void 0,"data-shell-tone":J===`brand`?`brand`:void 0,"data-wui-folded-cookie":ut?Ce:void 0,style:$e,...t,...Qe,children:[/* @__PURE__ */ k(`a`,{className:`wui-skip-link`,href:`#main-content`,children:Ee}),/* @__PURE__ */ A(`aside`,{className:`app-sidebar`,ref:nt,children:[(l||u||d||p||m)&&/* @__PURE__ */ k(`div`,{className:ae({logoLight:u,logoDark:d,markLight:p,markDark:m}),children:ct(/* @__PURE__ */ A(O,{children:[oe({logoLight:u,logoDark:d,markLight:p,markDark:m,brandName:b}),l]}))}),M&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start`,children:M}),N&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start-compact`,children:N}),/* @__PURE__ */ k(`nav`,{className:`app-sidebar-scroll`,"aria-label":ve,ref:st,tabIndex:at?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ k(he,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label):/* @__PURE__ */ k(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ A(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!dt.has(e.key??``)||!!me(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ A(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>pt(e.key??``),children:[/* @__PURE__ */ k(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ k(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ A(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(P||ht.length>0)&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-foot`,children:[ht.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-sidebar-foot-links`,children:ht.map(e=>/* @__PURE__ */ k(he,{item:e,linkComponent:Y,onNavigate:()=>Z(!1),iconVariant:q,newLabel:Ae,togglePagesLabel:je},e.key??e.href??e.label))}),P]}),!W&&/* @__PURE__ */ k(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:lt,"aria-label":Q?Oe:ke,"aria-expanded":!Q,children:/* @__PURE__ */ k(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ A(`div`,{className:`app-main`,children:[/* @__PURE__ */ A(`header`,{className:`app-topbar${rt?` wui-scrolled`:``}`,"data-tone":le===`primary`?`primary`:void 0,children:[/* @__PURE__ */ A(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Z(!0),"aria-label":De,"aria-expanded":X,children:/* @__PURE__ */ k(h,{name:`menu`,size:18})}),G===`top`&&l&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-brand`,children:ct(l)}),G===`top`&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ k(g,{items:de($),ariaLabel:ve,linkComponent:Y})}),I,Ye&&/* @__PURE__ */ k(ye,{config:Ye,searchResultsLabel:He,noResultsText:Ue,noResultsForText:We,resultsCountText:Ge,resultCountText:Ke,moreLabel:Te})]}),/* @__PURE__ */ A(`div`,{className:`app-topbar-end`,children:[L,Je&&/* @__PURE__ */ k(_e,{config:Je,unreadLabel:Fe,markAllReadLabel:Ie,viewAllLabel:Le,loadingNotificationsText:Re,noUnreadText:ze,unreadNotificationsText:Be,unreadBellLabel:Ve}),qe&&/* @__PURE__ */ k(ge,{config:qe,linkComponent:Y,accountMenuLabel:Me,roleLabel:Ne,rolesLabel:Pe})]})]}),/* @__PURE__ */ k(`main`,{className:`app-content`,id:`main-content`,children:H}),z&&/* @__PURE__ */ k(`footer`,{className:`app-footer`,children:z})]}),re&&/* @__PURE__ */ k(`div`,{className:`wui-shell-launcher`,children:re}),gt&&/* @__PURE__ */ A(`nav`,{className:`wui-tabbar`,"aria-label":we,children:[gt.tabs.map(e=>/* @__PURE__ */ k(pe,{tab:e,linkComponent:Y,iconVariant:q},e.key??e.href)),gt.hasMore&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-tabbar-item${gt.moreActive?` active`:``}`,onClick:()=>Z(!0),children:[/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ k(h,{name:`more`,size:24})}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:Te})]})]})]})}function se(e,t,n){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&le(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>K(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:L,items:t}].map(e=>({...e,items:ce(a(e.items,!0))})).filter(e=>e.items.some(e=>!K(e))),s=[],c=e=>{for(let t of e)K(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,G(e)),_(`AppShell`,`match`,e.match,z),_(`AppShell`,`iconVariant`,e.iconVariant,ne),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(n!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=r(n,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&r(n,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==L),footer:o.find(e=>e.key===L)?.items??[]}}function G(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!re.has(e)))}var K=e=>e.header!=null;function ce(e){return e.filter((t,n)=>{if(!K(t))return!0;let r=e.findIndex((e,t)=>t>n&&K(e));return e.slice(n+1,r<0?void 0:r).length>0})}var q=/* @__PURE__ */ new Set;function le(t){if(t.key!=null&&I.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||q.has(n)||(q.add(n),e(n))}function ue(e,t){let n=[],r=e=>{for(let t of e)K(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?P:F;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function de(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>K(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(K(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function fe({href:e,label:t,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ k(l,{link:n(r,{to:e}),className:`wui-brand-link`,"aria-label":t,onClick:i,children:a})}function pe({tab:e,linkComponent:t,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ k(l,{link:n(t,{to:e.href}),className:i,"aria-current":o,children:a})}function me(e){for(let t of e){if(t.active)return t;let e=t.children?.length?me(t.children):void 0;if(e)return e}}function he({item:e,linkComponent:r,onNavigate:i,depth:a=0,iconVariant:o,newLabel:s,togglePagesLabel:c}){let u=a>0,d=a>1?` wui-nav-depth-${Math.min(a,6)}`:``,f=Array.isArray(e.children)&&e.children.length>0,p=f?me(e.children??[]):void 0,m=!!p,g=p?p.key??p.href??p.label:null,[_,v]=D(m);C(()=>{g!=null&&v(!0)},[g]);let y=typeof e.label==`string`?e.label:void 0,b=!u&&e.icon&&/* @__PURE__ */ k(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??o}):e.icon}),x=e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),S=ie(e.newUntil)&&/* @__PURE__ */ k(`span`,{className:`wui-nav-new`,children:s}),w=/* @__PURE__ */ A(O,{children:[b,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),S,x,e.trailingIcon&&/* @__PURE__ */ k(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ k(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),T=e.active?`page`:void 0;if(f){let f=/* @__PURE__ */ k(`div`,{className:`app-nav-sub${_?` expanded`:``}`,inert:!_,"aria-hidden":!_||void 0,children:/* @__PURE__ */ k(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ k(he,{item:e,linkComponent:r,onNavigate:i,depth:a+1,iconVariant:o,newLabel:s,togglePagesLabel:c},e.key??e.href))})});if(e.href){let a=/* @__PURE__ */ k(l,{link:n(r,{to:e.href}),className:`wui-nav-split-link`,"aria-current":T,onClick:i,children:w});return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`div`,{className:`app-nav-item has-children wui-nav-split${u?` app-nav-subitem`:``}${m||e.active?` active`:``}${d}`,"data-label":y,children:[a,/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":_,"aria-label":t(c,{name:y??``}),onClick:()=>v(e=>!e),children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),f]})}return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-item${u?` app-nav-subitem`:``} has-children${m?` active`:``}${d}`,"aria-expanded":_,"data-label":y,onClick:()=>v(e=>!e),children:[b,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),S,x,/* @__PURE__ */ k(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),f]})}let E=`app-nav-item${u?` app-nav-subitem`:``}${e.active?` active`:``}${d}`;return/* @__PURE__ */ k(l,{link:n(r,{to:e.href}),className:E,"aria-current":T,"data-label":y,onClick:i,children:w})}function J(e){u(`wui-dropdown`,M);let[t,n]=D(!1),r=E(null);return C(()=>{r.current?.toggleAttribute(`open`,t)},[t]),C(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function ge({config:e,linkComponent:r,accountMenuLabel:i,roleLabel:a,rolesLabel:o}){let s=w(),{open:c,setOpen:u,ref:d}=J(),{name:f,role:g,roles:v=[],noTriggerRole:y=!1,outlined:b=!1,photo:x,profileHref:S,profileLabel:C=`My profile`,onLogout:T,logoutAction:E,logoutLabel:D=`Sign out`,head:j,section:M,logoutVariant:N=`item`,items:P=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,N,[`item`,`button`]),!f)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let F=v.map(e=>(e??``).trim()).filter(Boolean),I=()=>u(!1),L=(e,t,i,a)=>/* @__PURE__ */ k(l,{link:n(r,{to:e}),className:`dropdown-item`,onClick:a,children:t},i),R=/* @__PURE__ */ k(h,{name:`log-out`,size:18}),z=/* @__PURE__ */ A(O,{children:[R,D]});return/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:d,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:s,className:b?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":c,"aria-label":t(i,{name:f}),children:[/* @__PURE__ */ k(p,{name:f,src:x,tone:`auto`}),/* @__PURE__ */ A(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-name`,children:f}),g&&!y&&/* @__PURE__ */ k(`span`,{className:`wui-usermenu-role`,children:g})]}),/* @__PURE__ */ k(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${c?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ k(p,{name:f,src:x,size:`lg`,tone:`auto`}),/* @__PURE__ */ A(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-name`,children:f}),g&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-role`,children:g}),F.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-roles-label`,children:F.length===1?a:o}),` ${F.join(`, `)}`]}),j?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-extra`,children:j}):null]})]}),M?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-section`,children:M}):null,S&&L(S,/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(h,{name:`user`,size:18}),C]}),void 0,I),P.map(e=>{if(e.divider)return/* @__PURE__ */ k(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),I()};return e.href?L(e.href,t,e.key,n):/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),N===`button`?(E||T)&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-foot`,children:E?/* @__PURE__ */ k(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:R,children:D})}):/* @__PURE__ */ k(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:R,onClick:()=>{I(),T?.()},children:D})}):E?/* @__PURE__ */ k(`form`,{method:`post`,action:E,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(`button`,{type:`submit`,className:`dropdown-item danger`,children:z})}):T&&/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{I(),T()},children:z})]})]})}function _e({config:e,unreadLabel:n,markAllReadLabel:r,viewAllLabel:i,loadingNotificationsText:a,noUnreadText:o,unreadNotificationsText:s,unreadBellLabel:c}){let l=w(),{open:u,ref:d}=J(e.onOpen),{unread:f=0,items:p,loading:m=!1,onMarkAllRead:g,viewAllHref:_,label:v=`Notifications`,emptyText:y=`You are all caught up.`}=e,[b,x]=D(``),S=E(f);C(()=>{S.current!==f&&(S.current=f,x(f===0?o:t(s,{count:H(f)})))},[f,o,s]);let T=null;return p?.length?T=/* @__PURE__ */ k(`div`,{className:`wui-bell-items`,children:p.map((e,t)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ A(`span`,{className:`visually-hidden`,children:[n,`: `]}),/* @__PURE__ */ k(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ k(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ k(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??t):/* @__PURE__ */ k(`div`,{className:r,"data-id":e.id,children:i},e.id??t)})}):m?T=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:a}):p&&(T=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:y})),/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:d,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":u,"aria-label":f===0?v:t(c,{label:v,count:H(f)}),children:[/* @__PURE__ */ k(h,{name:`notification`,size:20}),/* @__PURE__ */ k(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:f===0,children:H(f)})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:b}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${u?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ A(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-title`,children:v}),g&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-bell-markall`,onClick:g,children:r})]}),/* @__PURE__ */ k(`div`,{className:`wui-bell-list`,"aria-busy":m||void 0,children:T}),_&&/* @__PURE__ */ k(`a`,{className:`wui-bell-foot`,href:_,children:i})]})]})}var ve=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ye({config:e,searchResultsLabel:n,noResultsText:r,noResultsForText:i,resultsCountText:a,resultCountText:o,moreLabel:s}){u(`wui-overflow`,j);let c=w(),{value:l=``,onChange:d,results:f=null,loading:p=!1,onSelect:m,onSubmit:g,onFocus:_,placeholder:v=`Search`}=e,[y,x]=D(!1),[S,O]=D(!1),[M,N]=D({results:null,index:-1}),P=M.results===f?M.index:-1,F=e=>N({results:f,index:e}),I=E(null),L=E(null),R=E([]),z=T(()=>(f??[]).flatMap(e=>e.hits??[]),[f]),B=f!=null&&!S,V=z.length;C(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ve(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),x(!0),L.current?.focus())},t=e=>{I.current?.contains(e.target instanceof Node?e.target:null)||(O(!0),x(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ee=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!B||V===0)return;e.preventDefault(),F((P+(e.key===`ArrowDown`?1:-1)+V)%V)}else b(e.nativeEvent)?B&&P>=0&&R.current[P]?(e.preventDefault(),R.current[P].click()):g&&l.trim()!==``&&(e.preventDefault(),g(l.trim())):e.key===`Escape`&&(B?(e.preventDefault(),O(!0)):y&&(e.preventDefault(),x(!1)))},te=-1;return R.current=[],/* @__PURE__ */ k(`wui-overflow`,{class:`wui-topsearch-host`,label:s,children:/* @__PURE__ */ k(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ A(`div`,{className:`wui-topsearch${y?` is-open`:``}${p?` is-loading`:``}`,ref:I,"data-overflow-label":v,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":v,"aria-expanded":y,"aria-controls":`${c}-panel`,onClick:()=>{let e=!y;x(e),e&&L.current?.focus()},children:/* @__PURE__ */ k(h,{name:`search`,size:20})}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ A(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ k(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ k(`input`,{ref:L,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:v,"aria-label":v,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":B,"aria-controls":`${c}-list`,"aria-activedescendant":B&&P>=0?`${c}-opt-${P}`:void 0,autoComplete:`off`,value:l,onChange:e=>{O(!1),d?.(e.target.value)},onKeyDown:ee,onFocus:_})]}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":n,hidden:!B,children:B&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[V===0&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:t(i,{value:l})}),f.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{te+=1;let t=te;return/* @__PURE__ */ A(`a`,{className:`wui-topsearch-hit${t===P?` is-active`:``}`,role:`option`,"aria-selected":t===P,id:`${c}-opt-${t}`,href:e.href,ref:e=>{R.current[t]=e},onClick:t=>m?.(e,t),children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:B?V===0?r:t(V===1?o:a,{count:V}):``})]})})})}export{W as default};
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{navMatchScore as n}from"../lib/navMatch.js";import{SHELL_FOLDED_COOKIE as r,readNavFolded as i,readShellCollapsed as a,writeNavFolded as o,writeShellCollapsed as s}from"../lib/shellCookie.js";import{TargetLink as c}from"../lib/TargetLink.js";import l from"../lib/useElementEntry.js";import u from"../lib/useWuiText.js";import{TONES as d}from"../lib/vocabulary.js";import{splitMarkerProps as f}from"../lib/wuiMarker.js";import p from"./AppAvatar.js";import m from"./AppButton.js";import h from"./AppIcon.js";import g from"./AppNavigationMenu.js";import _ from"./assertValidValue.js";import v from"./warnUnknownProps.js";import{initScrollEdges as y,isImeSafeEnter as b,revealActiveNavItem as x,setPopoverOpen as S}from"@webority/ui-elements/helpers";import{useEffect as C,useId as w,useMemo as T,useRef as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";import{SHELL_TEXT as j,fillText as M}from"@webority/ui-elements/text";var N=()=>import(`@webority/ui-elements/elements/overflow`),P=()=>import(`@webority/ui-elements/elements/dropdown`),F=99,I=4,L=5,R=/^[a-z0-9-]+$/,z=`wui-sidebar-footer`,B=[],V=[`prefix`,`exact`],H=[`comfortable`,`compact`],U=[`neutral`,`primary`],W=[`default`,`brand`],ee=[`side`,`top`],G=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],te=/* @__PURE__ */ new Set([`key`,`label`,`icon`,`iconVariant`,`iconSize`,`href`,`badge`,`badgeTone`,`badgeTitle`,`newUntil`,`trailingIcon`,`active`,`match`,`matchAlso`,`tab`,`tabLabel`,`children`]),K=e=>e>F?`${F}+`:String(e),ne=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Kolkata`}),q=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=/* @__PURE__ */ new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())||t.toISOString().slice(0,10)!==e?!1:ne.format(/* @__PURE__ */ new Date)<=e},re=({logoLight:e,logoDark:t,markLight:n,markDark:r})=>{let i=!!(n||r);return[`app-sidebar-brand`,i&&`wui-brand-has-mark`,i&&!e&&!t&&`wui-brand-mark-only`,(t||r)&&`wui-brand-themed`].filter(Boolean).join(` `)},ie=({logoLight:e,logoDark:t,markLight:n,markDark:r,brandName:i})=>{let a=i??``,o=[e&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-light`,src:e,alt:a},`logo-light`),t&&/* @__PURE__ */ k(`img`,{className:`wui-brand-logo wui-brand-dark`,src:t,alt:``,"aria-hidden":`true`},`logo-dark`)],s=[n&&[`mark-light`,`wui-brand-mark wui-brand-light`,n],r&&[`mark-dark`,`wui-brand-mark wui-brand-dark`,r]].filter(e=>!!e).map(([t,n,r],i)=>i===0&&!e?/* @__PURE__ */ k(`img`,{className:n,src:r,alt:a},t):/* @__PURE__ */ k(`img`,{className:n,src:r,alt:``,"aria-hidden":`true`},t));return[...o,...s].filter(Boolean)};function ae(e){let{marker:t,props:n}=f(`AppShell`,e),c=u(`shell`,j),{groups:l=[],brand:d,logoLight:p,logoDark:m,markLight:b,markDark:w,brandName:M,brandHref:N,brandLabel:P,sidebarStart:F,sidebarStartCompact:I,sidebarFooter:L,sidebarFooterItems:R=B,topbarStart:z,topbarEnd:V,footer:te,launcher:K,children:ne,collapsed:q,onCollapsedChange:ae,noSidebar:J=!1,nav:Y=`side`,density:se=`comfortable`,itemHeight:ce,iconVariant:X=`twotone`,topbarTone:he=`neutral`,tone:ve=`default`,navLabel:be=c.navLabel,linkComponent:Z,currentPath:xe,rememberCollapsed:Se=!1,collapsedCookie:Ce=`wui-shell-collapsed`,foldedCookie:we=r,tabBarLabel:Te=c.tabBarLabel,moreLabel:Ee=c.moreLabel,skipLabel:De=c.skipLabel,openNavLabel:Oe=c.openNavLabel,expandNavLabel:ke=c.expandNavLabel,collapseNavLabel:Ae=c.collapseNavLabel,newLabel:je=c.newLabel,togglePagesLabel:Me=c.togglePagesLabel,accountMenuLabel:Ne=c.accountMenuLabel,roleLabel:Pe=c.roleLabel,rolesLabel:Fe=c.rolesLabel,unreadLabel:Ie=c.unreadLabel,markAllReadLabel:Le=c.markAllReadLabel,viewAllLabel:Re=c.viewAllLabel,loadingNotificationsText:ze=c.loadingNotificationsText,noUnreadText:Be=c.noUnreadText,unreadNotificationsText:Ve=c.unreadNotificationsText,unreadBellLabel:He=c.unreadBellLabel,searchResultsLabel:Ue=c.searchResultsLabel,noResultsText:We=c.noResultsText,noResultsForText:Ge=c.noResultsForText,resultsCountText:Ke=c.resultsCountText,resultCountText:qe=c.resultCountText,userMenu:Je,notifications:Ye,search:Xe,className:Ze=``,style:Qe,...$e}=n;if(v(`AppShell`,$e),_(`AppShell`,`density`,se,H),_(`AppShell`,`topbarTone`,he,U),_(`AppShell`,`tone`,ve,W),_(`AppShell`,`nav`,Y,ee),_(`AppShell`,`iconVariant`,X,G),P!==void 0&&!N)throw Error(`<AppShell> brandLabel names the brand link, so it needs brandHref.`);if(N){if(!P&&!M)throw Error(`<AppShell> brandHref needs brandLabel or brandName: the collapsed rail hides the logo, so the link would have no accessible name.`);if(!(d||p||m||b||w))throw Error(`<AppShell> brandHref has no brand, logo or mark to link.`)}let et=(ce??0)>0?{...Qe,"--wui-nav-item-height":`${ce}px`}:Qe,[tt,nt]=D(()=>Se&&q===void 0&&typeof document<`u`?a(Ce)??!1:!1),[rt,Q]=D(!1),it=E(null),[at,ot]=D(!1),[st,ct]=D(!1),lt=E(null),ut=q??tt,dt=e=>N?/* @__PURE__ */ k(de,{href:N,label:P||M,linkComponent:Z,onNavigate:()=>Q(!1),children:e}):e,ft=()=>{let e=!ut;q===void 0&&nt(e),Se&&s(e,Ce),ae?.(e)},pt=l.some(e=>e.collapsible),[mt,ht]=D(()=>pt&&typeof document<`u`?i(we):/* @__PURE__ */ new Set),gt=e=>{let t=new Set(mt);t.has(e)?t.delete(e):t.add(e),ht(t),o(t,we)},_t=T(()=>oe(l,R,xe),[l,R,xe]),$=_t.groups,vt=_t.footer,yt=J?null:le($,vt.some(e=>e.active));C(()=>{let e=()=>ot(window.scrollY>4);return e(),window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)},[]),C(()=>{y()},[]),C(()=>{x(lt.current)},[]),C(()=>{let e=lt.current;if(!e)return;let t=()=>ct($.length>0&&e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[$]),C(()=>{let e=it.current;if(!e)return;let t=window.matchMedia(`(max-width: 991.98px)`),n=()=>{t.matches?e.setAttribute(`popover`,`auto`):(e.removeAttribute(`popover`),Q(!1))},r=e=>Q(`newState`in e&&e.newState===`open`);return n(),t.addEventListener(`change`,n),e.addEventListener(`toggle`,r),()=>{t.removeEventListener(`change`,n),e.removeEventListener(`toggle`,r)}},[]),C(()=>{let e=it.current;e?.hasAttribute(`popover`)&&S(e,rt)},[rt]);let bt=[`app-shell`,ut?`collapsed`:``,J?`no-sidebar`:``,Y===`top`?`wui-shell-top`:``,rt?`mobile-open`:``,Ze].filter(Boolean).join(` `);return/* @__PURE__ */ A(`div`,{className:bt,"data-density":se===`compact`?`compact`:void 0,"data-shell-tone":ve===`brand`?`brand`:void 0,"data-wui-folded-cookie":pt?we:void 0,style:et,...t,...$e,children:[/* @__PURE__ */ k(`a`,{className:`wui-skip-link`,href:`#main-content`,children:De}),/* @__PURE__ */ A(`aside`,{className:`app-sidebar`,ref:it,children:[(d||p||m||b||w)&&/* @__PURE__ */ k(`div`,{className:re({logoLight:p,logoDark:m,markLight:b,markDark:w}),children:dt(/* @__PURE__ */ A(O,{children:[ie({logoLight:p,logoDark:m,markLight:b,markDark:w,brandName:M}),d]}))}),F&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start`,children:F}),I&&/* @__PURE__ */ k(`div`,{className:`app-sidebar-start-compact`,children:I}),/* @__PURE__ */ k(`nav`,{className:`app-sidebar-scroll`,"aria-label":be,ref:lt,tabIndex:st?0:void 0,children:$.map((e,t)=>{let n=e.items.map(e=>e.header==null?/* @__PURE__ */ k(me,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:X,newLabel:je,togglePagesLabel:Me},e.key??e.href??e.label):/* @__PURE__ */ k(`div`,{className:`wui-nav-header`,children:e.header},e.key??e.header));if(!e.collapsible)return/* @__PURE__ */ A(`div`,{className:`app-nav-group`,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`app-nav-group-label`,children:e.label}),n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]},e.key??e.label??`group-${t}`);let r=!mt.has(e.key??``)||!!pe(e.items),i=`wui-nav-group-${e.key}`;return/* @__PURE__ */ A(`div`,{className:`app-nav-group wui-nav-group-collapsible${r?``:` wui-nav-group-folded`}`,"data-wui-nav-group":e.key,children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-group-label wui-nav-group-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>gt(e.key??``),children:[/* @__PURE__ */ k(`span`,{className:`wui-nav-group-text`,children:e.label}),/* @__PURE__ */ k(`span`,{className:`wui-nav-group-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-down`,size:16})})]}),/* @__PURE__ */ A(`div`,{className:`wui-nav-group-body`,id:i,children:[n,e.after&&/* @__PURE__ */ k(`div`,{className:`wui-nav-group-after`,children:e.after})]})]},e.key??`group-${t}`)})}),(L||vt.length>0)&&/* @__PURE__ */ A(`div`,{className:`app-sidebar-foot`,children:[vt.length>0&&/* @__PURE__ */ k(`div`,{className:`wui-sidebar-foot-links`,children:vt.map(e=>/* @__PURE__ */ k(me,{item:e,linkComponent:Z,onNavigate:()=>Q(!1),iconVariant:X,newLabel:je,togglePagesLabel:Me},e.key??e.href??e.label))}),L]}),!J&&/* @__PURE__ */ k(`button`,{type:`button`,className:`app-sidebar-toggle`,onClick:ft,"aria-label":ut?ke:Ae,"aria-expanded":!ut,children:/* @__PURE__ */ k(h,{name:`chevrons-left`,size:20})})]}),/* @__PURE__ */ A(`div`,{className:`app-main`,children:[/* @__PURE__ */ A(`header`,{className:`app-topbar${at?` wui-scrolled`:``}`,"data-tone":he===`primary`?`primary`:void 0,children:[/* @__PURE__ */ A(`div`,{className:`app-topbar-start`,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`app-topbar-menu`,onClick:()=>Q(!0),"aria-label":Oe,"aria-expanded":rt,children:/* @__PURE__ */ k(h,{name:`menu`,size:18})}),Y===`top`&&d&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-brand`,children:dt(d)}),Y===`top`&&/* @__PURE__ */ k(`div`,{className:`wui-shell-top-nav`,children:/* @__PURE__ */ k(g,{items:ue($),ariaLabel:be,linkComponent:Z})}),z,Xe&&/* @__PURE__ */ k(ye,{config:Xe,searchResultsLabel:Ue,noResultsText:We,noResultsForText:Ge,resultsCountText:Ke,resultCountText:qe,moreLabel:Ee})]}),/* @__PURE__ */ A(`div`,{className:`app-topbar-end`,children:[V,Ye&&/* @__PURE__ */ k(_e,{config:Ye,unreadLabel:Ie,markAllReadLabel:Le,viewAllLabel:Re,loadingNotificationsText:ze,noUnreadText:Be,unreadNotificationsText:Ve,unreadBellLabel:He}),Je&&/* @__PURE__ */ k(ge,{config:Je,linkComponent:Z,accountMenuLabel:Ne,roleLabel:Pe,rolesLabel:Fe})]})]}),/* @__PURE__ */ k(`main`,{className:`app-content`,id:`main-content`,children:ne}),te&&/* @__PURE__ */ k(`footer`,{className:`app-footer`,children:te})]}),K&&/* @__PURE__ */ k(`div`,{className:`wui-shell-launcher`,children:K}),yt&&/* @__PURE__ */ A(`nav`,{className:`wui-tabbar`,"aria-label":Te,children:[yt.tabs.map(e=>/* @__PURE__ */ k(fe,{tab:e,linkComponent:Z,iconVariant:X},e.key??e.href)),yt.hasMore&&/* @__PURE__ */ A(`button`,{type:`button`,className:`wui-tabbar-item${yt.moreActive?` active`:``}`,onClick:()=>Q(!0),children:[/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:/* @__PURE__ */ k(h,{name:`more`,size:24})}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:Ee})]})]})]})}function oe(e,t,r){let i=t;for(let e of i){if(e.children?.length)throw Error(`<AppShell> sidebarFooterItems cannot hold children; keep footer links flat.`);if(e.tab)throw Error(`<AppShell> sidebarFooterItems cannot carry tab: true; the phone tab bar is built from groups.`);if(e.header!=null)throw Error(`<AppShell> sidebarFooterItems cannot hold a header row.`)}for(let t of e)t.collapsible&&X(t);let a=(e,t=!1)=>(e??[]).map(e=>Array.isArray(e.children)?{...e,children:a(e.children)}:{...e}).filter(e=>Y(e)?t:(e.children?.length??0)>0||!!e.href),o=[...e,{key:z,items:t}].map(e=>({...e,items:se(a(e.items,!0))})).filter(e=>e.items.some(e=>!Y(e))),s=[],c=e=>{for(let t of e)Y(t)||(s.push(t),t.children&&c(t.children))};for(let e of o)c(e.items);for(let e of s)v(`AppShell items`,J(e)),_(`AppShell`,`match`,e.match,V),_(`AppShell`,`iconVariant`,e.iconVariant,G),_(`AppShell`,`badgeTone`,e.badgeTone,d);let l=null;if(r!=null&&!s.some(e=>e.active===!0)){let e=-1;for(let t of s){if(t.active!=null||t.children?.length&&!t.href)continue;let i=n(r,t.href,{exact:t.match===`exact`,also:t.matchAlso});if(i<0)continue;let a=t.match===`exact`&&n(r,t.href,{exact:!0})>=0?1/0:i;a>e&&(e=a,l=t)}}for(let e of s)e.active=e.active??e===l;return{groups:o.filter(e=>e.key!==z),footer:o.find(e=>e.key===z)?.items??[]}}function J(e){return Object.fromEntries(Object.entries(e).filter(([e])=>!te.has(e)))}var Y=e=>e.header!=null;function se(e){return e.filter((t,n)=>{if(!Y(t))return!0;let r=e.findIndex((e,t)=>t>n&&Y(e));return e.slice(n+1,r<0?void 0:r).length>0})}var ce=/* @__PURE__ */ new Set;function X(t){if(t.key!=null&&R.test(t.key))return;let n=t.key==null?`<AppShell> a collapsible group needs a key so its folded state can be remembered.`:`<AppShell> collapsible group key "${t.key}" must use lower-case letters, digits and hyphens.`;typeof process<`u`&&process.env.NODE_ENV===`production`||ce.has(n)||(ce.add(n),e(n))}function le(e,t){let n=[],r=e=>{for(let t of e)Y(t)||(t.children?.length?r(t.children):n.push(t))};for(let t of e)r(t.items);let i=n.filter(e=>e.tab);if(i.length===0)return null;let a=i.length<n.length,o=a?I:L;if(i.length>o)throw Error(`<AppShell>: ${i.length} items carry tab: true, but the phone tab bar holds ${o} (${a?`4 plus More, because other items exist`:`5 when every item is a tab`}). Flag fewer items.`);return{tabs:i,hasMore:a,moreActive:t||n.some(e=>!e.tab&&e.active)}}function ue(e){let t=e=>{if(e.label===void 0)throw Error(`<AppShell> a navigation row has no label; every row but a header needs one.`);return e.label},n=e=>e.key??e.href??t(e),r=(e,r)=>({key:n(e),label:t(e),to:r,current:!!e.active}),i=e=>e.flatMap(e=>Y(e)?[]:[...e.href?[{...r(e,e.href),icon:e.icon}]:[],...i(e.children??[])]),a=[];for(let o of e.flatMap(e=>e.items)){if(Y(o))continue;let e=i(o.children??[]);if(e.length>0){let i=o.href?[{...r(o,o.href),icon:o.icon}]:[];a.push({key:n(o),label:t(o),links:[...i,...e]})}else o.href&&a.push(r(o,o.href))}return a}function de({href:e,label:n,linkComponent:r,onNavigate:i,children:a}){return/* @__PURE__ */ k(c,{link:t(r,{to:e}),className:`wui-brand-link`,"aria-label":n,onClick:i,children:a})}function fe({tab:e,linkComponent:n,iconVariant:r}){let i=`wui-tabbar-item${e.active?` active`:``}`,a=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:24,variant:e.iconVariant??r}):e.icon}),/* @__PURE__ */ k(`span`,{className:`wui-tabbar-label`,children:e.tabLabel??e.label}),e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`wui-tabbar-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge})]}),o=e.active?`page`:void 0;return/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:i,"aria-current":o,children:a})}function pe(e){for(let t of e){if(t.active)return t;let e=t.children?.length?pe(t.children):void 0;if(e)return e}}function me({item:e,linkComponent:n,onNavigate:r,depth:i=0,iconVariant:a,newLabel:o,togglePagesLabel:s}){let l=i>0,u=i>1?` wui-nav-depth-${Math.min(i,6)}`:``,d=Array.isArray(e.children)&&e.children.length>0,f=d?pe(e.children??[]):void 0,p=!!f,m=f?f.key??f.href??f.label:null,[g,_]=D(p);C(()=>{m!=null&&_(!0)},[m]);let v=typeof e.label==`string`?e.label:void 0,y=!l&&e.icon&&/* @__PURE__ */ k(`span`,{className:`app-nav-icon`,children:typeof e.icon==`string`?/* @__PURE__ */ k(h,{name:e.icon,size:e.iconSize??22,variant:e.iconVariant??a}):e.icon}),b=e.badge!=null&&/* @__PURE__ */ k(`span`,{className:`app-nav-badge${e.badgeTone?` tone-${e.badgeTone}`:``}`,title:e.badgeTitle||void 0,children:e.badge}),x=q(e.newUntil)&&/* @__PURE__ */ k(`span`,{className:`wui-nav-new`,children:o}),S=/* @__PURE__ */ A(O,{children:[y,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),x,b,e.trailingIcon&&/* @__PURE__ */ k(`span`,{className:`app-nav-trailing`,children:typeof e.trailingIcon==`string`?/* @__PURE__ */ k(h,{name:e.trailingIcon,size:16}):e.trailingIcon})]}),w=e.active?`page`:void 0;if(d){let d=/* @__PURE__ */ k(`div`,{className:`app-nav-sub${g?` expanded`:``}`,inert:!g,"aria-hidden":!g||void 0,children:/* @__PURE__ */ k(`div`,{className:`app-nav-sub-inner`,children:(e.children??[]).map(e=>/* @__PURE__ */ k(me,{item:e,linkComponent:n,onNavigate:r,depth:i+1,iconVariant:a,newLabel:o,togglePagesLabel:s},e.key??e.href))})});if(e.href){let i=/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:`wui-nav-split-link`,"aria-current":w,onClick:r,children:S});return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`div`,{className:`app-nav-item has-children wui-nav-split${l?` app-nav-subitem`:``}${p||e.active?` active`:``}${u}`,"data-label":v,children:[i,/* @__PURE__ */ k(`button`,{type:`button`,className:`app-nav-caret wui-nav-split-toggle`,"aria-expanded":g,"aria-label":M(s,{name:v??``}),onClick:()=>_(e=>!e),children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),d]})}return/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ A(`button`,{type:`button`,className:`app-nav-item${l?` app-nav-subitem`:``} has-children${p?` active`:``}${u}`,"aria-expanded":g,"data-label":v,onClick:()=>_(e=>!e),children:[y,/* @__PURE__ */ k(`span`,{className:`app-nav-text`,children:e.label}),x,b,/* @__PURE__ */ k(`span`,{className:`app-nav-caret`,children:/* @__PURE__ */ k(h,{name:`chevron-right`,size:16})})]}),d]})}let T=`app-nav-item${l?` app-nav-subitem`:``}${e.active?` active`:``}${u}`;return/* @__PURE__ */ k(c,{link:t(n,{to:e.href}),className:T,"aria-current":w,"data-label":v,onClick:r,children:S})}function he(e){l(`wui-dropdown`,P);let[t,n]=D(!1),r=E(null);return C(()=>{r.current?.toggleAttribute(`open`,t)},[t]),C(()=>{let t=r.current;if(!t)return;let i=r=>{if(r.target!==t||!(`detail`in r)||!r.detail||typeof r.detail!=`object`)return;let i=`open`in r.detail&&r.detail.open===!0;n(i),i&&e?.()};return t.addEventListener(`wui-dropdown-toggle`,i),()=>t.removeEventListener(`wui-dropdown-toggle`,i)},[e]),{open:t,setOpen:n,ref:r}}function ge({config:e,linkComponent:n,accountMenuLabel:r,roleLabel:i,rolesLabel:a}){let o=u(`shell`,j),s=w(),{open:l,setOpen:d,ref:f}=he(),{name:g,role:v,roles:y=[],noTriggerRole:b=!1,outlined:x=!1,photo:S,profileHref:C,profileLabel:T=o.profileLabel,onLogout:E,logoutAction:D,logoutLabel:N=o.logoutLabel,head:P,section:F,logoutVariant:I=`item`,items:L=[]}=e;if(_(`AppShell`,`userMenu.logoutVariant`,I,[`item`,`button`]),!g)throw Error(`<AppShell> userMenu.name is required; the trigger and the avatar are named from it.`);let R=y.map(e=>(e??``).trim()).filter(Boolean),z=()=>d(!1),B=(e,r,i,a)=>/* @__PURE__ */ k(c,{link:t(n,{to:e}),className:`dropdown-item`,onClick:a,children:r},i),V=/* @__PURE__ */ k(h,{name:`log-out`,size:18}),H=/* @__PURE__ */ A(O,{children:[V,N]});return/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-usermenu`,align:`end`,ref:f,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:s,className:x?`wui-usermenu-trigger wui-usermenu-trigger-outlined`:`wui-usermenu-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":l,"aria-label":M(r,{name:g}),children:[/* @__PURE__ */ k(p,{name:g,src:S,tone:`auto`}),/* @__PURE__ */ A(`span`,{className:`wui-usermenu-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-name`,children:g}),v&&!b&&/* @__PURE__ */ k(`span`,{className:`wui-usermenu-role`,children:v})]}),/* @__PURE__ */ k(h,{name:`chevron-down`,size:14,className:`wui-usermenu-caret`})]}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-usermenu-menu${l?` show`:``}`,"aria-labelledby":s,children:[/* @__PURE__ */ A(`div`,{className:`wui-usermenu-head`,children:[/* @__PURE__ */ k(p,{name:g,src:S,size:`lg`,tone:`auto`}),/* @__PURE__ */ A(`div`,{className:`wui-usermenu-who`,children:[/* @__PURE__ */ k(`div`,{className:`wui-usermenu-name`,children:g}),v&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-role`,children:v}),R.length>0&&/* @__PURE__ */ A(`div`,{className:`wui-usermenu-roles`,children:[/* @__PURE__ */ k(`span`,{className:`wui-usermenu-roles-label`,children:R.length===1?i:a}),` ${R.join(`, `)}`]}),P?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-extra`,children:P}):null]})]}),F?/* @__PURE__ */ k(`div`,{className:`wui-usermenu-section`,children:F}):null,C&&B(C,/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(h,{name:`user`,size:18}),T]}),void 0,z),L.map(e=>{if(e.divider)return/* @__PURE__ */ k(`hr`,{className:`dropdown-divider`},e.key);let t=/* @__PURE__ */ A(O,{children:[e.icon&&/* @__PURE__ */ k(h,{name:e.icon,size:18}),e.label]}),n=()=>{e.onClick?.(),z()};return e.href?B(e.href,t,e.key,n):/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item`,onClick:n,children:t},e.key)}),I===`button`?(D||E)&&/* @__PURE__ */ k(`div`,{className:`wui-usermenu-foot`,children:D?/* @__PURE__ */ k(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(m,{type:`submit`,tone:`danger`,variant:`soft`,block:!0,leftIcon:V,children:N})}):/* @__PURE__ */ k(m,{type:`button`,tone:`danger`,variant:`soft`,block:!0,leftIcon:V,onClick:()=>{z(),E?.()},children:N})}):D?/* @__PURE__ */ k(`form`,{method:`post`,action:D,className:`wui-usermenu-logout`,children:/* @__PURE__ */ k(`button`,{type:`submit`,className:`dropdown-item danger`,children:H})}):E&&/* @__PURE__ */ k(`button`,{type:`button`,className:`dropdown-item danger`,onClick:()=>{z(),E()},children:H})]})]})}function _e({config:e,unreadLabel:t,markAllReadLabel:n,viewAllLabel:r,loadingNotificationsText:i,noUnreadText:a,unreadNotificationsText:o,unreadBellLabel:s}){let c=u(`shell`,j),l=w(),{open:d,ref:f}=he(e.onOpen),{unread:p=0,items:m,loading:g=!1,onMarkAllRead:_,viewAllHref:v,label:y=c.label,emptyText:b=c.emptyText}=e,[x,S]=D(``),T=E(p);C(()=>{T.current!==p&&(T.current=p,S(p===0?a:M(o,{count:K(p)})))},[p,a,o]);let N=null;return m?.length?N=/* @__PURE__ */ k(`div`,{className:`wui-bell-items`,children:m.map((e,n)=>{let r=`wui-bell-item${e.read?` wui-bell-item-read`:``}`,i=/* @__PURE__ */ A(O,{children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-dot`,"aria-hidden":`true`}),e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-bell-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-bell-body`,children:[!e.read&&/* @__PURE__ */ A(`span`,{className:`visually-hidden`,children:[t,`: `]}),/* @__PURE__ */ k(`span`,{className:`wui-bell-item-title`,children:e.title}),e.time&&/* @__PURE__ */ k(`span`,{className:`wui-bell-when`,children:e.time})]})]});return e.href?/* @__PURE__ */ k(`a`,{className:r,href:e.href,"data-id":e.id,children:i},e.id??n):/* @__PURE__ */ k(`div`,{className:r,"data-id":e.id,children:i},e.id??n)})}):g?N=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:i}):m&&(N=/* @__PURE__ */ k(`div`,{className:`wui-bell-state`,children:b})),/* @__PURE__ */ A(`wui-dropdown`,{class:`dropdown wui-bell`,align:`end`,ref:f,children:[/* @__PURE__ */ A(`button`,{type:`button`,id:l,className:`topbar-icon-btn wui-bell-trigger`,"data-wui-dropdown-trigger":!0,"aria-expanded":d,"aria-label":p===0?y:M(s,{label:y,count:K(p)}),children:[/* @__PURE__ */ k(h,{name:`notification`,size:20}),/* @__PURE__ */ k(`span`,{className:`wui-bell-count`,"aria-hidden":`true`,hidden:p===0,children:K(p)})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:x}),/* @__PURE__ */ A(`div`,{"data-wui-dropdown-menu":!0,popover:`auto`,className:`dropdown-menu dropdown-menu-end wui-bell-menu${d?` show`:``}`,"aria-labelledby":l,children:[/* @__PURE__ */ A(`div`,{className:`wui-bell-head`,children:[/* @__PURE__ */ k(`span`,{className:`wui-bell-title`,children:y}),_&&/* @__PURE__ */ k(`button`,{type:`button`,className:`wui-bell-markall`,onClick:_,children:n})]}),/* @__PURE__ */ k(`div`,{className:`wui-bell-list`,"aria-busy":g||void 0,children:N}),v&&/* @__PURE__ */ k(`a`,{className:`wui-bell-foot`,href:v,children:r})]})]})}var ve=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function ye({config:e,searchResultsLabel:t,noResultsText:n,noResultsForText:r,resultsCountText:i,resultCountText:a,moreLabel:o}){l(`wui-overflow`,N);let s=u(`shell`,j),c=w(),{value:d=``,onChange:f,results:p=null,loading:m=!1,onSelect:g,onSubmit:_,onFocus:v,placeholder:y=s.placeholder}=e,[x,S]=D(!1),[O,P]=D(!1),[F,I]=D({results:null,index:-1}),L=F.results===p?F.index:-1,R=e=>I({results:p,index:e}),z=E(null),B=E(null),V=E([]),H=T(()=>(p??[]).flatMap(e=>e.hits??[]),[p]),U=p!=null&&!O,W=H.length;C(()=>{let e=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||ve(e.target instanceof HTMLElement?e.target:null)||(e.preventDefault(),S(!0),B.current?.focus())},t=e=>{z.current?.contains(e.target instanceof Node?e.target:null)||(P(!0),S(!1))};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[]);let ee=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(!U||W===0)return;e.preventDefault(),R((L+(e.key===`ArrowDown`?1:-1)+W)%W)}else b(e.nativeEvent)?U&&L>=0&&V.current[L]?(e.preventDefault(),V.current[L].click()):_&&d.trim()!==``&&(e.preventDefault(),_(d.trim())):e.key===`Escape`&&(U?(e.preventDefault(),P(!0)):x&&(e.preventDefault(),S(!1)))},G=-1;return V.current=[],/* @__PURE__ */ k(`wui-overflow`,{class:`wui-topsearch-host`,label:o,children:/* @__PURE__ */ k(`div`,{"data-wui-overflow-list":!0,className:`wui-topsearch-row`,children:/* @__PURE__ */ A(`div`,{className:`wui-topsearch${x?` is-open`:``}${m?` is-loading`:``}`,ref:z,"data-overflow-label":y,children:[/* @__PURE__ */ k(`button`,{type:`button`,className:`topbar-icon-btn wui-topsearch-open`,"aria-label":y,"aria-expanded":x,"aria-controls":`${c}-panel`,onClick:()=>{let e=!x;S(e),e&&B.current?.focus()},children:/* @__PURE__ */ k(h,{name:`search`,size:20})}),/* @__PURE__ */ A(`div`,{className:`wui-topsearch-panel`,id:`${c}-panel`,children:[/* @__PURE__ */ A(`div`,{className:`search-wrap`,children:[/* @__PURE__ */ k(h,{name:`search`,size:18,className:`search-icon`}),/* @__PURE__ */ k(`input`,{ref:B,type:`search`,className:`form-control input search-input`,id:`${c}-input`,placeholder:y,"aria-label":y,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":U,"aria-controls":`${c}-list`,"aria-activedescendant":U&&L>=0?`${c}-opt-${L}`:void 0,autoComplete:`off`,value:d,onChange:e=>{P(!1),f?.(e.target.value)},onKeyDown:ee,onFocus:v})]}),/* @__PURE__ */ k(`div`,{className:`wui-topsearch-results`,id:`${c}-list`,role:`listbox`,"aria-label":t,hidden:!U,children:U&&/* @__PURE__ */ A(`div`,{className:`wui-topsearch-groups`,role:`presentation`,children:[W===0&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-empty`,role:`option`,"aria-disabled":`true`,"aria-selected":`false`,children:M(r,{value:d})}),p.filter(e=>e.hits?.length).map((e,t)=>/* @__PURE__ */ A(`div`,{className:`wui-topsearch-group`,role:`group`,"aria-label":e.label??``,children:[e.label&&/* @__PURE__ */ k(`div`,{className:`wui-topsearch-group-label`,role:`presentation`,children:e.label}),e.hits.map(e=>{G+=1;let t=G;return/* @__PURE__ */ A(`a`,{className:`wui-topsearch-hit${t===L?` is-active`:``}`,role:`option`,"aria-selected":t===L,id:`${c}-opt-${t}`,href:e.href,ref:e=>{V.current[t]=e},onClick:t=>g?.(e,t),children:[e.icon&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-icon`,children:/* @__PURE__ */ k(h,{name:e.icon,size:18})}),/* @__PURE__ */ A(`span`,{className:`wui-topsearch-hit-text`,children:[/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-title`,children:e.title}),e.subtitle&&/* @__PURE__ */ k(`span`,{className:`wui-topsearch-hit-sub`,children:e.subtitle})]})]},`${e.href}-${t}`)})]},e.label??t))]})})]}),/* @__PURE__ */ k(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:U?W===0?n:M(W===1?a:i,{count:W}):``})]})})})}export{ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shortcutChip as e}from"../lib/shortcutChip.js";import t from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import{shortcutChip as e}from"../lib/shortcutChip.js";import t from"../lib/useElementEntry.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./warnUnknownProps.js";import{SHORTCUT_EVENT as o,shortcutKey as s}from"@webority/ui-elements/helpers";import{useEffect as c,useId as l,useRef as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{SHORTCUT_KEYS_TEXT as p}from"@webority/ui-elements/text";var m=`wui-shortcuts-open-change`,h=()=>import(`@webority/ui-elements/elements/shortcuts`);function g(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=r.group?.trim(),i=e?n.get(e):void 0;e?i?i.rows.push(r):n.set(e,{title:e,rows:[r]}):t.push(r)}return[{title:null,rows:t},...n.values()].filter(e=>e.rows.length>0)}function _(e){return/* @__PURE__ */ d(`dl`,{className:`wui-shortcut-keys`,children:e.map(e=>/* @__PURE__ */ f(`div`,{"data-shortcut":s(e.key),children:[/* @__PURE__ */ d(`dt`,{children:/* @__PURE__ */ d(`kbd`,{className:`wui-kbd`,children:s(e.key)})}),/* @__PURE__ */ d(`dd`,{children:e.label})]},s(e.key)))})}function v(v){t(`wui-shortcuts`,h);let{marker:y,props:b}=r(`AppShortcutLegend`,{...v}),x=n(`shortcutKeys`,p),{shortcuts:S=[],items:C,search:w,open:T,onOpenChange:E,trigger:D=!0,className:O=``,...k}=b;a(`AppShortcutLegend`,k);let A=l(),j=u(null),M=S.filter(e=>s(e.key)!==`?`),N=g(M),P={key:`?`,label:x.helpLabel},F=N.at(-1);F?F.rows.push(P):N.push({title:null,rows:[P]});let I=N.find(e=>!e.title),L=N.filter(e=>e.title),R=u(M);R.current=M,c(()=>{let e=j.current;if(!e)return;let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui:shortcut arrived without a detail`);let t=e.detail,n=R.current.find(e=>s(e.key)===t.key&&typeof e.onPress==`function`);n?.onPress&&(e.preventDefault(),n.onPress(t.itemKey))};return e.addEventListener(o,t),()=>e.removeEventListener(o,t)},[]);let z=u(E);return z.current=E,c(()=>{let e=j.current;if(!e)return;let t=t=>{if(!(t instanceof CustomEvent)||t.target!==e)return;let n=t.detail;z.current?.(n.open)};return e.addEventListener(m,t),()=>e.removeEventListener(m,t)},[]),/* @__PURE__ */ f(`wui-shortcuts`,{ref:j,class:[`wui-shortcut-legend`,O].filter(Boolean).join(` `),items:C||void 0,search:w||void 0,open:T,"no-trigger":D?void 0:``,...y,...k,children:[D&&/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-shortcut-toggle`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-controls":A,"aria-keyshortcuts":`?`,children:[e(`?`),` ${x.sheetTitle}`]}),/* @__PURE__ */ f(`div`,{className:`wui-shortcut-sheet`,id:A,role:`dialog`,"aria-label":x.sheetTitle,hidden:!0,children:[/* @__PURE__ */ f(`div`,{className:`wui-shortcut-sheet-head`,children:[/* @__PURE__ */ d(`span`,{className:`wui-shortcut-sheet-title`,children:x.sheetTitle}),/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-shortcut-close`,"aria-label":x.closeLabel,children:/* @__PURE__ */ d(i,{name:`x`,size:16})})]}),I&&_(I.rows),L.map(e=>/* @__PURE__ */ f(`section`,{className:`wui-shortcut-group`,children:[/* @__PURE__ */ d(`h3`,{className:`wui-shortcut-group-title`,children:e.title}),_(e.rows)]},e.title))]})]})}export{v as default};
|
|
@@ -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{useFieldError as t}from"../lib/formFields.js";import n 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};
|