@webority/ui-react 0.164.0 → 0.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/canvas-kit/kit.js +225 -223
- package/dist/canvas-kit/manifest.json +1334 -435
- package/dist/canvas-kit/release.json +6 -6
- package/dist/components/AppAsyncBlock.js +1 -1
- package/dist/components/AppAvatar.js +1 -1
- package/dist/components/AppAvatarGroup.js +1 -1
- package/dist/components/AppBanner.js +1 -1
- package/dist/components/AppBreadcrumbs.js +1 -1
- package/dist/components/AppButton.js +1 -1
- package/dist/components/AppCalendar.js +1 -1
- package/dist/components/AppCard.js +1 -1
- package/dist/components/AppCarousel.js +1 -1
- package/dist/components/AppCell.js +1 -1
- package/dist/components/AppChart.js +1 -1
- package/dist/components/AppChartCard.js +1 -1
- package/dist/components/AppCheckbox.js +1 -1
- package/dist/components/AppChip.js +1 -1
- package/dist/components/AppChipGroup.js +1 -1
- package/dist/components/AppChoiceCard.js +1 -1
- package/dist/components/AppChoiceChip.js +1 -1
- package/dist/components/AppColorField.js +1 -1
- package/dist/components/AppColumnMenu.js +1 -1
- package/dist/components/AppCommandPalette.js +1 -1
- package/dist/components/AppCommentThread.js +1 -1
- package/dist/components/AppCompareTable.js +1 -1
- package/dist/components/AppConfirmDialog.js +1 -1
- package/dist/components/AppConfirmProvider.js +1 -1
- package/dist/components/AppContextMenu.js +1 -1
- package/dist/components/AppCopyButton.js +1 -1
- package/dist/components/AppDataTable.js +1 -1
- package/dist/components/AppDatePicker.js +1 -1
- package/dist/components/AppDateRangePicker.js +1 -1
- package/dist/components/AppDescriptions.js +1 -1
- package/dist/components/AppDrawer.js +1 -1
- package/dist/components/AppDropZone.js +1 -1
- package/dist/components/AppDropdown.js +1 -1
- package/dist/components/AppDueDate.js +1 -1
- package/dist/components/AppEntryGrid.js +1 -0
- package/dist/components/AppErrorBoundary.js +1 -1
- package/dist/components/AppErrorSummary.js +1 -1
- package/dist/components/AppFileAttachment.js +1 -1
- package/dist/components/AppFilePicker.js +1 -1
- package/dist/components/AppFilterBar.js +1 -1
- package/dist/components/AppFloatingDock.js +1 -1
- package/dist/components/AppForm.js +1 -1
- package/dist/components/AppFormulaSteps.js +1 -0
- package/dist/components/AppHoverCard.js +1 -1
- package/dist/components/AppImagePicker.js +1 -1
- package/dist/components/AppInfoTip.js +1 -1
- package/dist/components/AppInlineEdit.js +1 -1
- package/dist/components/AppInput.js +1 -1
- package/dist/components/AppInputGroup.js +1 -1
- package/dist/components/AppKanban.js +1 -1
- package/dist/components/AppMentionInput.js +1 -1
- package/dist/components/AppMetricStrip.js +1 -1
- package/dist/components/AppModal.js +1 -1
- package/dist/components/AppNavigationMenu.js +1 -1
- package/dist/components/AppNotificationCenter.js +1 -1
- package/dist/components/AppNumberInput.js +1 -1
- package/dist/components/AppOnboardingChecklist.js +1 -1
- package/dist/components/AppOrgTree.js +1 -1
- package/dist/components/AppOtpInput.js +1 -1
- package/dist/components/AppPageHeader.js +1 -1
- package/dist/components/AppPhoneNumberInput.js +1 -1
- package/dist/components/AppPopover.js +1 -1
- package/dist/components/AppPricingCard.js +1 -1
- package/dist/components/AppQrCode.js +1 -1
- package/dist/components/AppRadio.js +1 -1
- package/dist/components/AppRadioGroup.js +1 -1
- package/dist/components/AppRating.js +1 -1
- package/dist/components/AppRecordPager.js +1 -1
- package/dist/components/AppRelativeTime.js +1 -1
- package/dist/components/AppRepeater.js +1 -1
- package/dist/components/AppRichText.js +1 -1
- package/dist/components/AppRouteError.js +1 -1
- package/dist/components/AppRowActions.js +1 -0
- package/dist/components/AppScoreScale.js +1 -1
- package/dist/components/AppSearch.js +1 -1
- package/dist/components/AppSectionFeatures.js +1 -1
- package/dist/components/AppSectionLeadCapture.js +1 -1
- package/dist/components/AppSectionLogos.js +1 -1
- package/dist/components/AppSegmented.js +1 -1
- package/dist/components/AppSelect.js +1 -1
- package/dist/components/AppShell.js +1 -1
- package/dist/components/AppShortcutLegend.js +1 -1
- package/dist/components/AppShowMore.js +1 -1
- package/dist/components/AppSlider.js +1 -1
- package/dist/components/AppSortableList.js +1 -1
- package/dist/components/AppSparkline.js +1 -1
- package/dist/components/AppSpinner.js +1 -1
- package/dist/components/AppSplash.js +1 -1
- package/dist/components/AppSplitButton.js +1 -1
- package/dist/components/AppSplitView.js +1 -1
- package/dist/components/AppStatusBadge.js +1 -1
- package/dist/components/AppStepper.js +1 -1
- package/dist/components/AppSwitch.js +1 -1
- package/dist/components/AppTablePagination.js +1 -1
- package/dist/components/AppTableToolbar.js +1 -1
- package/dist/components/AppTabs.js +1 -1
- package/dist/components/AppTextarea.js +1 -1
- package/dist/components/AppThemeToggle.js +1 -1
- package/dist/components/AppTimePicker.js +1 -1
- package/dist/components/AppTimeline.js +1 -1
- package/dist/components/AppToast.js +1 -1
- package/dist/components/AppUpdateBar.js +1 -1
- package/dist/components/AppWhatsNew.js +1 -1
- package/dist/components/AppWizard.js +1 -1
- package/dist/components/AppWorkspaceSwitcher.js +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/guidance.json +220 -140
- package/dist/hookForm/index.js +1 -0
- package/dist/lib/CheckField.js +1 -1
- package/dist/lib/FileItemRow.js +1 -1
- package/dist/lib/emptyValue.js +1 -1
- package/dist/lib/fieldState.js +1 -1
- package/dist/lib/formFields.js +1 -0
- package/dist/lib/useWuiText.js +1 -0
- package/dist/types/components/AppAsyncBlock.d.ts +3 -3
- package/dist/types/components/AppChart.d.ts +12 -4
- package/dist/types/components/AppColorField.d.ts +3 -3
- package/dist/types/components/AppDataTable.d.ts +29 -2
- package/dist/types/components/AppDatePicker.d.ts +2 -1
- package/dist/types/components/AppDateRangePicker.d.ts +5 -1
- package/dist/types/components/AppDescriptions.d.ts +6 -0
- package/dist/types/components/AppDropdown.d.ts +6 -0
- package/dist/types/components/AppEntryGrid.d.ts +164 -0
- package/dist/types/components/AppFilterBar.d.ts +12 -1
- package/dist/types/components/AppForm.d.ts +18 -0
- package/dist/types/components/AppFormulaSteps.d.ts +64 -0
- package/dist/types/components/AppInput.d.ts +4 -4
- package/dist/types/components/AppInputGroup.d.ts +1 -1
- package/dist/types/components/AppMentionInput.d.ts +2 -2
- package/dist/types/components/AppMetricStrip.d.ts +5 -0
- package/dist/types/components/AppModal.d.ts +5 -0
- package/dist/types/components/AppNumberInput.d.ts +9 -3
- package/dist/types/components/AppPhoneNumberInput.d.ts +1 -1
- package/dist/types/components/AppRowActions.d.ts +46 -0
- package/dist/types/components/AppSearch.d.ts +1 -1
- package/dist/types/components/AppSectionFeatures.d.ts +5 -1
- package/dist/types/components/AppSectionLogos.d.ts +1 -0
- package/dist/types/components/AppSelect.d.ts +3 -2
- package/dist/types/components/AppShell.d.ts +2 -0
- package/dist/types/components/AppSlider.d.ts +5 -0
- package/dist/types/components/AppTextarea.d.ts +2 -2
- package/dist/types/components/AppTimePicker.d.ts +1 -1
- package/dist/types/components/AppToast.d.ts +5 -0
- package/dist/types/hookForm/index.d.ts +14 -0
- package/dist/types/index.d.ts +8 -5
- package/dist/types/lib/emptyValue.d.ts +2 -2
- package/dist/types/lib/fieldState.d.ts +1 -0
- package/dist/types/lib/formFields.d.ts +12 -0
- package/dist/types/lib/useWuiText.d.ts +3 -0
- package/dist/ui-react.js +1 -1
- package/dist/web-core/dist/errors/extractApiError.js +2 -0
- package/dist/web-core/dist/errors/requestPlatform.js +1 -0
- package/package.json +21 -10
- package/dist/components/AppResizable.js +0 -1
- package/dist/components/AppResizableHandle.js +0 -1
- package/dist/components/AppResizablePanel.js +0 -1
- package/dist/components/AppRollingNumber.js +0 -1
- package/dist/components/AppRowSwitch.js +0 -1
- package/dist/types/components/AppResizable.d.ts +0 -37
- package/dist/types/components/AppResizableHandle.d.ts +0 -14
- package/dist/types/components/AppResizablePanel.d.ts +0 -14
- package/dist/types/components/AppRollingNumber.d.ts +0 -30
- package/dist/types/components/AppRowSwitch.d.ts +0 -18
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webority-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.167.0",
|
|
4
4
|
"platform": "Web",
|
|
5
5
|
"kitModuleVersion": 2,
|
|
6
6
|
"rendererProtocolVersion": 14,
|
|
7
7
|
"library": {
|
|
8
8
|
"name": "@webority/ui-react",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.167.0"
|
|
10
10
|
},
|
|
11
11
|
"files": {
|
|
12
12
|
"manifest.json": {
|
|
13
|
-
"sha256": "
|
|
14
|
-
"bytes":
|
|
13
|
+
"sha256": "5c5f13fb16c7be7529db28f87652b1abd09284605dc27eeae23dde2d40f0cefd",
|
|
14
|
+
"bytes": 1050487
|
|
15
15
|
},
|
|
16
16
|
"kit.js": {
|
|
17
|
-
"sha256": "
|
|
18
|
-
"bytes":
|
|
17
|
+
"sha256": "1409683a596e8315ad23c0d8b976d984139c9c16cdf80532101768b93d515ae6",
|
|
18
|
+
"bytes": 9909904
|
|
19
19
|
},
|
|
20
20
|
"kit.css": {
|
|
21
21
|
"sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
|
|
@@ -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"./AppEmptyState.js";import i from"./AppProgress.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{jsx as s}from"react/jsx-runtime";import{ASYNC_BLOCK_TEXT as c}from"@webority/ui-elements/text";function l(l){let{marker:u,props:d}=t(`AppAsyncBlock`,l),f=e(`asyncBlock`,c),{state:p,children:m,empty:h,skeleton:g,className:_=``,loadingLabel:v=f.loadingLabel,errorTitle:y=f.errorTitle,retryLabel:b=f.retryLabel,emptyTitle:x=f.emptyTitle,...S}=d;o(`AppAsyncBlock`,S),a(`AppAsyncBlock`,`state.status`,p.status,[`idle`,`loading`,`error`,`empty`,`data`]);let C=`async-block${_?` ${_}`:``}`,w;switch(p.status){case`idle`:return null;case`loading`:w=g??/* @__PURE__ */ s(i,{value:0,indeterminate:!0,size:`sm`,label:v});break;case`error`:w=/* @__PURE__ */ s(r,{icon:`alert-circle`,title:y,description:p.error.message,action:/* @__PURE__ */ s(n,{variant:`soft`,onClick:()=>p.retry(),children:b})});break;case`empty`:w=h??/* @__PURE__ */ s(r,{icon:`inbox`,title:x});break;case`data`:w=m(p.data)}return/* @__PURE__ */ s(`div`,{className:C,"data-state":p.status,...u,...S,children:w})}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initialsOf as e}from"../lib/initials.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import{TONES as
|
|
1
|
+
import{initialsOf as e}from"../lib/initials.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useWuiText.js";import{TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./assertValidValue.js";import s from"./renderIconProp.js";import c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{AVATAR_TEXT as m}from"@webority/ui-elements/text";var ee=[`circle`,`rounded`,`square`],h=[...i,`auto`],g=[`none`,`online`,`offline`,`away`,`busy`],_=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],te=/* @__PURE__ */ new Set([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),v={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function ne(t){return e(t)||`?`}function re(e){let t=e||``,n=0;for(let e=0;e<t.length;e+=1)n=Math.imul(n,31)+t.charCodeAt(e)>>>0;return n%360}function y(e){if(typeof e==`number`)return e;let t=v[e];if(t!=null)return t;let n=Number.parseInt(e,10);return Number.isNaN(n)?32:n}function b(e){let{marker:i,props:v}=a(`AppAvatar`,e),b=r(`avatar`,m),{name:x,src:S,size:C=`md`,shape:w=`circle`,tone:T=`primary`,status:E=`none`,ring:D=!1,label:O,icon:k,iconVariant:A,badge:j,href:M,onClick:N,linkComponent:P,tooltip:F,tooltipPlacement:I,className:L=``,photoLabel:R=b.photoLabel,...z}=v;c(`AppAvatar`,z),o(`AppAvatar`,`shape`,w,ee),o(`AppAvatar`,`tone`,T,h),o(`AppAvatar`,`status`,E,g),o(`AppAvatar`,`iconVariant`,A,_);let{style:B,...V}=z,[H,U]=u(null),W=H!=null&&H===S,G=typeof C==`string`&&te.has(C),K=G?null:typeof C==`number`||/^\d+$/.test(C)?`${C}px`:C,q=M!=null||N!=null,J=S!=null&&S!==``&&!W,Y=[`avatar`,G&&C!==`md`?`avatar-${C}`:``,w===`circle`?``:`avatar-${w}`,T===`primary`?``:`avatar-${T}`,D?`avatar-ring`:``,q?`avatar-clickable`:``,L].filter(Boolean).join(` `),X={};K&&(X[`--avatar-size`]=K),T===`auto`&&(X[`--avatar-hue`]=re(x));let Z=Object.keys(X).length||B?{...X,...B}:void 0,ie=/* @__PURE__ */ f(`span`,{className:`avatar-face`,"aria-hidden":`true`,children:k!=null&&k!==!1&&k!==``?s(k,{size:Math.round(y(C)*.55),variant:A}):ne(x)}),ae=/* @__PURE__ */ p(d,{children:[E!==`none`&&/* @__PURE__ */ f(`span`,{className:`avatar-status avatar-status-${E}`,"aria-hidden":`true`}),j!=null&&/* @__PURE__ */ f(`span`,{className:`avatar-badge`,children:j}),O!=null&&/* @__PURE__ */ f(`span`,{className:`avatar-label`,"aria-hidden":`true`,children:O})]}),Q=/* @__PURE__ */ p(d,{children:[ie,J&&/* @__PURE__ */ f(`img`,{className:`avatar-img`,src:S,alt:q?``:x||R,onError:()=>U(S)}),ae]});if(M!=null){let e=t(P,{href:M});return l(/* @__PURE__ */ f(n,{link:e,className:Y,style:Z,...i,...V,"aria-label":O||x,onClick:N,children:Q}),F,I)}if(N!=null)return l(/* @__PURE__ */ f(`button`,{type:`button`,className:Y,style:Z,...i,...V,"aria-label":O||x,onClick:N,children:Q}),F,I);if(J)return l(/* @__PURE__ */ f(`span`,{className:Y,style:Z,...i,...V,children:Q}),F,I);let $=O?.trim()||x?.trim();return l($?/* @__PURE__ */ f(`span`,{className:Y,style:Z,...i,...V,role:`img`,"aria-label":$,children:Q}):/* @__PURE__ */ f(`span`,{className:Y,style:Z,...i,...V,"aria-hidden":`true`,children:Q}),F,I)}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./assertValidValue.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{fillText as a}from"@webority/ui-elements/text";var o=[`tight`,`normal`,`loose`],s={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function c(e){if(e==null)return null;if(typeof e==`number`)return`${e}px`;let t=s[e];return t==null?/^\d+$/.test(e)?`${e}px`:e:`${t}px`}function l(s){let{marker:l,props:u}=e(`AppAvatarGroup`,s),{children:d,size:f,spacing:p=`normal`,overflow:m,moreLabel:h=`{count} more`,className:g=``,..._}=u;n(`AppAvatarGroup`,_),t(`AppAvatarGroup`,`spacing`,p,o);let{style:v,...y}=_,b=[`avatar-group`,p===`normal`?``:`avatar-group-${p}`,g].filter(Boolean).join(` `),x=c(f),S=x?{...x?{"--avatar-size":x}:{},...v}:v,C=typeof m==`string`?Number.parseInt(m,10):m??0,w=typeof m==`string`&&!/^\d+$/.test(m)?m:`+${C}`;return/* @__PURE__ */ i(`div`,{className:b,style:S,...l,...y,children:[d,C>0&&/* @__PURE__ */ r(`span`,{className:`avatar avatar-more`,role:`img`,"aria-label":a(h,{count:C}),children:w})]})}export{l 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"./AppIcon.js";import r from"./assertValidValue.js";import i from"./renderIconProp.js";import a from"./warnUnknownProps.js";import{useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{BANNER_TEXT as l}from"@webority/ui-elements/text";var u=[`info`,`success`,`warning`,`danger`,`neutral`];function d(d){let{marker:f,props:p}=t(`AppBanner`,d),m=e(`banner`,l),{tone:h=`info`,icon:g,children:_,dismissible:v=!1,onClose:y,action:b,className:x=``,dismissLabel:S=m.dismissLabel,...C}=p;a(`AppBanner`,C),r(`AppBanner`,`tone`,h,u);let[w,T]=o(!0);if(!w)return null;let E=b!=null&&b!==!1,D=()=>{T(!1),y?.()};return/* @__PURE__ */ c(`div`,{className:`wui-banner wui-banner-${h}${E?` wui-banner-has-action`:``}${x?` ${x}`:``}`,role:`status`,...f,...C,children:[g&&/* @__PURE__ */ s(`span`,{className:`wui-banner-icon`,children:i(g,{size:18})}),/* @__PURE__ */ s(`div`,{className:`wui-banner-body`,children:_}),E&&/* @__PURE__ */ s(`div`,{className:`wui-banner-action`,children:b}),v&&/* @__PURE__ */ s(`button`,{type:`button`,className:`wui-banner-dismiss`,"aria-label":S,onClick:D,children:/* @__PURE__ */ s(n,{name:`x`,size:18})})]})}export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import{splitMarkerProps as
|
|
1
|
+
import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppDropdown.js";import a from"./renderIconProp.js";import o from"./warnUnknownProps.js";import{createContext as s,useContext as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{BREADCRUMBS_TEXT as d}from"@webority/ui-elements/text";import{Breadcrumb as f}from"react-bootstrap";var p=s(!1);function m(s){let{marker:m,props:h}=r(`AppBreadcrumbs`,s),g=n(`breadcrumbs`,d),{items:_=[],linkComponent:v,className:y=``,maxItems:b,moreLabel:x=g.moreLabel,wrap:S=!0,...C}=h;o(`AppBreadcrumbs`,C);let w=c(p);if(b!==void 0&&(!Number.isInteger(b)||b<1))throw RangeError(`AppBreadcrumbs: maxItems must be a whole number of 1 or more.`);let T=b!==void 0&&_.length>b?_.length-b:0,E=_.slice(0,T).map((e,t)=>{if(typeof e.label!=`string`)throw RangeError(`AppBreadcrumbs: with maxItems, every hidden crumb's label must be a string.`);let n=e.key??`${e.label}-${t}`;return e.to?{key:n,label:e.label,icon:e.icon,to:e.to}:e.href?{key:n,label:e.label,icon:e.icon,href:e.href}:{key:n,header:e.label}}),D=[T>0?`wui-breadcrumb-collapse`:``,S?``:`wui-breadcrumb-nowrap`].filter(Boolean).join(` `);return/* @__PURE__ */ u(f,{className:y||void 0,...D?{listProps:{className:D}}:{},...m,...C,children:[T>0?/* @__PURE__ */ l(`li`,{className:`breadcrumb-item wui-breadcrumb-more`,children:/* @__PURE__ */ l(i,{icon:`more-horizontal`,iconSize:14,label:x,align:`start`,toggleClassName:`wui-breadcrumb-more-toggle`,linkComponent:v,items:E})}):null,_.map((n,r)=>{let i=!w&&r===_.length-1,o=n.icon?a(n.icon,{size:14}):null,s={};if(!i){let r=n.to||n.href;s=n.to&&v?{linkAs:t,linkProps:{link:e(v,{to:n.to})}}:r?{href:r}:{linkAs:`span`}}return/* @__PURE__ */ u(f.Item,{active:i,className:r<T?`wui-breadcrumb-collapsible`:void 0,...s,children:[o,n.label]},n.key??`${n.label}-${r}`)})]})}export{p as BreadcrumbTrailContext,m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buttonClass as e}from"../lib/buttonClass.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{FILL_VARIANTS as r,TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import{FormSubmitContext as a}from"./AppForm.js";import o from"./AppIcon.js";import s from"./assertValidValue.js";import
|
|
1
|
+
import{buttonClass as e}from"../lib/buttonClass.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{FILL_VARIANTS as r,TONES as i}from"../lib/vocabulary.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import{FormSubmitContext as a}from"./AppForm.js";import o from"./AppIcon.js";import s from"./assertValidValue.js";import c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{useContext as te,useRef as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{Button as ne}from"react-bootstrap";var m={sm:14,md:16,lg:20,xl:20},h=[`sheen`,`fill`,`expand`,`glow`,`roll`,`none`],re=[`rounded`,`pill`,`sharp`],ie=[`button`,`submit`,`reset`],ae=/* @__PURE__ */ new Set([!0,!1,...Array.from({length:100},(e,t)=>t+1)]),g={variant:null},oe=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],_=e=>e===`pill`||e===`sharp`?`wui-btn-shape-${e}`:``;function se(e){return/* @__PURE__ */ p(`span`,{className:`wui-btn-roll`,children:[/* @__PURE__ */ f(`span`,{className:`wui-btn-roll__a`,children:e}),/* @__PURE__ */ f(`span`,{className:`wui-btn-roll__b`,"aria-hidden":`true`,children:e})]})}function ce(e,t,n,r){if(!e)return null;let i=n=>typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[t]??m.md,variant:r,className:n}):/* @__PURE__ */ f(`span`,{className:[`d-inline-flex`,n].filter(Boolean).join(` `),children:e});return/* @__PURE__ */ p(`span`,{className:n?`wui-btn-roll-ico wui-btn-pin-icon`:`wui-btn-roll-ico ms-2`,"aria-hidden":`true`,children:[i(),i(`wui-btn-roll-ico__next`)]})}function v(e,t,n,r){if(!e)return null;let i=t===`left`?`me-2`:`ms-2`;return typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[n]??m.md,variant:r,className:i}):/* @__PURE__ */ f(`span`,{className:`d-inline-flex ${i}`,children:e})}function y(e,t,n){return e?/* @__PURE__ */ f(`span`,{className:`wui-btn-pin-icon`,"aria-hidden":`true`,children:typeof e==`string`?/* @__PURE__ */ f(o,{name:e,size:m[t]??m.md,variant:n}):e}):null}function b(o){let{marker:b,props:le}=ee(`AppButton`,o),{children:x,tone:S=`primary`,variant:C=`solid`,size:w=`md`,type:T=`button`,loading:ue=!1,disabled:E=!1,block:D=!1,leftIcon:O=null,rightIcon:k=null,href:A,static:j=!1,tooltip:M,tooltipPlacement:N,shortcut:P,animation:F,pinRightIcon:I=!1,shape:L=`rounded`,iconVariant:R,className:z=``,onClick:B,onClickCapture:V,vibrate:H,...U}=le,[de,W]=d(!1),G=u(!1),K=te(a),fe=K!==null&&T===`submit`&&K.submitting,q=ue||de||fe;c(`AppButton`,U),s(`AppButton`,`vibrate`,H,ae);let J=H===!0?10:typeof H==`number`&&Number.isInteger(H)&&H>=1&&H<=100?H:0;F!==void 0&&s(`AppButton`,`animation`,F,h);let Y=F===`roll`&&!j,X=I&&k!=null&&k!==``&&!j&&!q;if(s(`AppButton`,`tone`,S,i),s(`AppButton`,`variant`,C,r),s(`AppButton`,`size`,w,Object.keys(m)),s(`AppButton`,`shape`,L,re),s(`AppButton`,`type`,T,ie),R!==void 0&&s(`AppButton`,`iconVariant`,R,oe),j){let t=[`btn`,e(S,C),w===`sm`?`btn-sm`:w===`lg`?`btn-lg`:w===`xl`?`btn-xl`:``,D?`w-100`:``,_(L),`btn-static`,z].filter(Boolean).join(` `);return l(/* @__PURE__ */ p(`span`,{className:t,...b,...U,children:[v(O,`left`,w,R),x,v(k,`right`,w,R)]}),M,N)}let pe=[D?`w-100`:``,q?`is-loading`:``,e(S,C),w===`xl`?`btn-xl`:``,F&&h.includes(F)?`btn-anim-${F}`:``,X?`wui-btn-pin-end`:``,_(L),z].filter(Boolean).join(` `),Z=(U.as===void 0||U.as===`button`)&&A===void 0&&U.to===void 0,me=Z?{}:{role:void 0,tabIndex:E||q?-1:void 0},{as:he,...ge}=U,_e={as:he},Q=M!=null&&M!==``,ve=e=>{if(G.current)return;J&&!E&&!q&&navigator.vibrate?.(J);let t=B?.(e);if(!(t instanceof Promise))return;G.current=!0,W(!0);let n=()=>{G.current=!1,W(!1)};t.then(n,e=>{throw n(),e})},$=/* @__PURE__ */ p(ne,{type:Z?T:void 0,href:A,...g,...w===`sm`||w===`lg`?{size:w}:null,disabled:E||q,"aria-busy":q||void 0,"aria-keyshortcuts":t(P),"data-wui-vibrate":J||void 0,className:pe||void 0,onClick:ve,onClickCapture:E||q?void 0:V,...me,...b,..._e,...ge,children:[q&&/* @__PURE__ */ f(`span`,{className:`spinner-border spinner-border-sm me-2`,"aria-hidden":`true`}),!q&&v(O,`left`,w,R),Y?se(x):x,!q&&(Y?ce(k,w,X,R):X?y(k,w,R):v(k,`right`,w,R)),!Q&&n(P)]});return l(E&&Q?/* @__PURE__ */ f(`span`,{className:`d-inline-block`,tabIndex:0,children:$}):$,M,N,P)}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{createElement as a,forwardRef as o,useCallback as s,useEffect as c,useLayoutEffect as l,useRef as u,useState as d}from"react";import{jsx as f}from"react/jsx-runtime";import{CALENDAR_TEXT as p}from"@webority/ui-elements/text";var m=`wui-calendar:event-click`,h=`wui-calendar:date-click`,g=`wui-calendar:range-change`,_=[`month`,`week`,`day`,`list`],v=o(function(o,v){let{marker:y,props:b}=n(`AppCalendar`,o),x=t(`calendar`,p),{label:S,events:C,eventsUrl:w,view:T,date:E,emptyText:D,errorText:O,firstDay:k,timeZone:A,onEventClick:j,onDateClick:M,onRangeChange:N,className:P=``,style:F,...I}=b;i(`AppCalendar`,I),r(`AppCalendar`,`view`,T,_);let L=u(null),R=u(``),z=u({onEventClick:j,onDateClick:M,onRangeChange:N}),[B,V]=d(!1),H=s(e=>{L.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]);return c(()=>{z.current={onEventClick:j,onDateClick:M,onRangeChange:N}}),l(()=>{let e=L.current;if(!e)return;let t=C==null?``:JSON.stringify(C);t!==R.current&&(R.current=t,e.events=C??null)}),c(()=>{let e=L.current;if(!e)throw Error(`AppCalendar: the <wui-calendar> element is not mounted`);let t=[[m,e=>{if(!(e instanceof CustomEvent))throw Error(`${m} arrived without a detail`);let t=e.detail;z.current.onEventClick?.(t)===!1&&e.preventDefault()}],[h,e=>{if(!(e instanceof CustomEvent))throw Error(`${h} arrived without a detail`);let t=e.detail;z.current.onDateClick?.(t)}],[g,e=>{if(!(e instanceof CustomEvent))throw Error(`${g} arrived without a detail`);let t=e.detail;z.current.onRangeChange?.(t)}]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),c(()=>{let t=!0;return import(`@webority/ui-elements/calendar`).catch(n=>{e(`[AppCalendar] the calendar failed to load:`,n?.message),t&&V(!0)}),()=>{t=!1}},[]),B?/* @__PURE__ */ f(`div`,{...y,className:P||void 0,style:F,role:`status`,children:/* @__PURE__ */ f(`p`,{className:`wui-calendar-status-text`,children:O||x.loadFailedText})}):a(`wui-calendar`,{ref:H,label:S||void 0,"events-url":w||void 0,view:T||void 0,date:E||void 0,"empty-text":D||void 0,"error-text":O||void 0,"first-day":k==null?void 0:String(k),"time-zone":A||void 0,className:P||void 0,style:F,...y,...I})});export{v 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 ee}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{isImeSafeEnter as te}from"@webority/ui-elements/helpers";import{useState as ne}from"react";import{Fragment as re,jsx as a,jsxs as o}from"react/jsx-runtime";import{CARD_TEXT as s}from"@webority/ui-elements/text";import{Card as c}from"react-bootstrap";var l=[`flat`,`elevated`,`outline`,`filled`,`accent`],u={elevated:`card-elevated`,outline:`card-outlined`,filled:`card-muted`,accent:`card-accent`},d=[`primary`,`success`,`warning`,`danger`,`info`],ie=[`none`,`sm`,`md`,`lg`],ae=[`sans`,`serif`],f={xs:320,sm:420,md:560,lg:720};function p(p){let{marker:m,props:oe}=ee(`AppCard`,p),h=t(`card`,s),{title:g,subtitle:_,headerIcon:v,titleClassName:se=``,titleFont:y=`sans`,header:b,headerExtra:x,headerActions:S,footer:C,media:w,children:T,variant:E=`flat`,tone:D=`primary`,padding:O=`md`,maxWidth:k,className:A=``,bodyClassName:j=``,headerClassName:M=``,body:N=!0,lifted:P=!1,flush:F=!1,divided:I=!1,href:L,onClick:R,linkComponent:z,onClose:B,dismissible:V,closeLabel:H=h.closeLabel,...U}=oe,[W,G]=ne(!1);i(`AppCard`,U),r(`AppCard`,`variant`,E,l),r(`AppCard`,`tone`,D,d),r(`AppCard`,`padding`,O,ie),r(`AppCard`,`titleFont`,y,ae);let{style:K,as:q,...ce}=U,le=L!=null||R!=null,ue=[u[E]??``,E===`accent`&&D&&D!==`primary`?`tone-${D}`:``,O&&O!==`md`?`card-pad-${O}`:``,F?`card-flush`:``,I?`card-divided`:``,P?`card-lifted`:``,k==null?``:`card-constrained`,le?`card-clickable`:``,A].filter(Boolean).join(` `)||void 0,J=k==null?void 0:f[String(k)],Y=k==null?void 0:J==null?typeof k==`number`?`${k}px`:k:`${J}px`,de=Y?{"--card-max-width":Y,...K}:K,X={};if(L!=null){let t=e(z,{href:L});X=t.Tag===`a`?{as:`a`,href:t.linkProps.href}:{as:t.Tag,to:t.linkProps.to},R&&(X.onClick=R)}else R!=null&&(X={role:`button`,tabIndex:0,onClick:R,onKeyDown:e=>{(te(e.nativeEvent)||e.key===` `)&&(e.preventDefault(),R(e))}});let Z=V??typeof B==`function`,fe=Z?/* @__PURE__ */ a(`button`,{type:`button`,className:`card-close`,"aria-label":H,onClick:e=>{e.preventDefault(),e.stopPropagation(),G(!0),B?.()},onKeyDown:e=>e.stopPropagation(),children:/* @__PURE__ */ a(n,{name:`x`,size:16})}):null,Q=g!=null||_!=null||v!=null,pe=b!=null||Q||x!=null||S!=null||Z,$=v==null?null:typeof v==`string`?/* @__PURE__ */ a(n,{name:v,size:18}):v;return W?null:/* @__PURE__ */ o(c,{className:ue,style:de,...m,...ce,...q===void 0?null:{as:q},...X,children:[w!=null&&/* @__PURE__ */ a(`div`,{className:`card-media`,children:w}),pe&&/* @__PURE__ */ o(c.Header,{className:M||void 0,children:[b??/* @__PURE__ */ o(re,{children:[Q&&/* @__PURE__ */ o(`div`,{className:`card-header-main`,children:[$!=null&&/* @__PURE__ */ a(`span`,{className:`card-header-icon`,children:$}),/* @__PURE__ */ o(`div`,{className:`card-header-titles`,children:[g!=null&&/* @__PURE__ */ a(`div`,{className:[`card-title`,se].filter(Boolean).join(` `),style:y===`serif`?{fontFamily:`var(--wui-font-display)`}:void 0,children:g}),_!=null&&/* @__PURE__ */ a(`div`,{className:`card-subtitle`,children:_})]})]}),x,S!=null&&/* @__PURE__ */ a(`div`,{className:`card-header-actions`,children:S})]}),fe]}),N?/* @__PURE__ */ a(c.Body,{className:j||void 0,children:T}):T,C!=null&&/* @__PURE__ */ a(`div`,{className:`card-footer`,children:C})]})}export{p 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"./AppIcon.js";import i from"./warnUnknownProps.js";import{Children as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{CAROUSEL_TEXT as c}from"@webority/ui-elements/text";var l=()=>import(`@webority/ui-elements/elements/carousel`);function u(u){let{marker:d,props:f}=n(`AppCarousel`,u),p=t(`carousel`,c),{label:m,autoplay:h,loop:g=!1,perView:_,perViewMd:v,perViewLg:y,arrows:b=!0,dots:x=!0,previousLabel:S=p.previousLabel,nextLabel:C=p.nextLabel,dotLabel:w=p.dotLabel,pauseLabel:T=p.pauseLabel,playLabel:E=p.playLabel,className:D=``,children:O,style:k,...A}=f;i(`AppCarousel`,A),e(`wui-carousel`,l);let j=Number(h)>0?Math.round(Number(h)):0,M={..._!==void 0&&Number(_)>1?{"--wui-carousel-per-view":_}:null,...v!==void 0&&Number(v)>=1?{"--wui-carousel-per-view-md":v}:null,...y!==void 0&&Number(y)>=1?{"--wui-carousel-per-view-lg":y}:null};return/* @__PURE__ */ s(`wui-carousel`,{class:[`wui-carousel`,D].filter(Boolean).join(` `),role:`region`,"aria-roledescription":p.carouselLabel,"aria-label":m,autoplay:j||void 0,loop:g?``:void 0,"dot-label":w===p.dotLabel?void 0:w,"pause-label":T===p.pauseLabel?void 0:T,"play-label":E===p.playLabel?void 0:E,style:Object.keys(M).length||k?{...M,...k}:void 0,...d,...A,children:[j?/* @__PURE__ */ s(`button`,{type:`button`,className:`wui-carousel-pause`,children:[/* @__PURE__ */ o(`span`,{className:`wui-carousel-pause-icon`,"aria-hidden":`true`}),/* @__PURE__ */ o(`span`,{className:`wui-carousel-pause-text`,children:T})]}):null,/* @__PURE__ */ s(`div`,{className:`wui-carousel-stage`,children:[b?/* @__PURE__ */ o(`button`,{type:`button`,className:`wui-carousel-arrow wui-carousel-prev`,"aria-label":S,children:/* @__PURE__ */ o(r,{name:`chevron-left`,size:20})}):null,/* @__PURE__ */ o(`div`,{className:`wui-carousel-track`,tabIndex:0,role:`group`,"aria-label":m,children:a.map(a.toArray(O),e=>/* @__PURE__ */ o(`div`,{className:`wui-carousel-slide`,role:`group`,"aria-roledescription":p.slideLabel,children:e}))}),b?/* @__PURE__ */ o(`button`,{type:`button`,className:`wui-carousel-arrow wui-carousel-next`,"aria-label":C,children:/* @__PURE__ */ o(r,{name:`chevron-right`,size:20})}):null]}),x?/* @__PURE__ */ o(`div`,{className:`wui-carousel-dots`}):null,/* @__PURE__ */ o(`span`,{className:`visually-hidden`,"data-wui-status":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{emptyPlaceholder as e}from"../lib/emptyValue.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=(...e)=>e.filter(Boolean).join(` `),o=e=>e==null||e===``;function s(s){let{marker:c,props:l}=t(`AppCell`,s),{primary:u,secondary:d,href:f,mono:p=!1,numeric:m=!1,className:h=``,...g}=l;n(`AppCell`,g);let _=o(u)?e():u;return/* @__PURE__ */ i(`div`,{className:a(`wui-cell`,m&&`wui-cell-numeric`,p&&`wui-cell-mono`,h),...c,...g,children:[f?/* @__PURE__ */ r(`a`,{className:`wui-cell-primary`,href:f,children:_}):/* @__PURE__ */ r(`span`,{className:`wui-cell-primary`,children:_}),o(d)?null:/* @__PURE__ */ r(`span`,{className:`wui-cell-secondary`,children:d})]})}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{forwardRef as i,useCallback as te,useEffect as a,useLayoutEffect as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";import{CHART_TEXT as ne}from"@webority/ui-elements/text";var u=(e,t)=>{if(!(e instanceof CustomEvent))throw Error(`${t} arrived without a CustomEvent`);return e.detail},d=`wui-chart:select`,f=`wui-chart:legend-change`,p=`wui-chart:ready`,m=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],re=[`none`,`stacked`,`percent`],h=[`ready`,`loading`,`empty`,`error`],ie=[`auto`,`svg`,`canvas`],ae=[`chart`,`table`],g=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},_=!1;function v(){!_&&g()&&(_=!0,e("[@webority/ui-react] <AppChart> has no `title`, which names the chart for assistive tech and its exported files."))}var y=e=>e===``?void 0:e,b=e=>Array.isArray(e)?e.map(b):e==null||Object.getPrototypeOf(e)!==Object.prototype?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``).map(([e,t])=>[e,b(t)])),oe=e=>({type:y(e.type),title:y(e.title),description:y(e.description),data:e.data,x:b(e.x),series:b(e.series),group:b(e.group),to:b(e.to),size:b(e.size),trend:e.trend,zoom:e.zoom,bands:b(e.bands),stack:y(e.stack),y:b(e.y),target:b(e.target),centerLabel:y(e.centerLabel),valueLabels:y(e.valueLabels),height:e.height!==void 0&&e.height>0?e.height:void 0,state:y(e.state),emptyText:y(e.emptyText),errorText:y(e.errorText),loadingText:y(e.loadingText),renderer:y(e.renderer),timeZone:y(e.timeZone)}),se=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),ce=e=>{try{return JSON.stringify(e)}catch{return null}},x=i(function(i,_){let{marker:y,props:b}=n(`AppChart`,i),x=t(`chart`,ne),{type:S,title:C,description:le,data:ue,x:de,series:fe,group:pe,to:w,size:T,trend:E,zoom:D,bands:O,stack:k,y:A,target:j,centerLabel:M,valueLabels:N,height:P,state:F,loading:I,error:L,emptyText:R,errorText:z,loadingText:B,renderer:V,timeZone:me,view:H,onSelect:U,onLegendChange:W,onReady:G,className:K=``,style:q,...J}=b;ee(`AppChart`,J),r(`AppChart`,`type`,S,m),r(`AppChart`,`stack`,k,re),r(`AppChart`,`state`,F,h),r(`AppChart`,`renderer`,V,ie),r(`AppChart`,`view`,H,ae),C||v();let Y=!!L;g()&&I&&Y&&e("[@webority/ui-react] <AppChart> takes `loading` or `error`, not both; `error` is shown.");let X=Y?`error`:I?`loading`:F,he=Y?L:z,Z=s(null),Q=s({props:null,signature:null}),$=s({onSelect:U,onLegendChange:W,onReady:G}),[ge,_e]=c(!1),ve=te(e=>{Z.current=e,typeof _==`function`?_(e):_&&(_.current=e)},[_]);return a(()=>{$.current={onSelect:U,onLegendChange:W,onReady:G}}),o(()=>{let e=Z.current;if(!e)return;let t={type:S,title:C,description:le,data:ue,x:de,series:fe,group:pe,to:w,size:T,trend:E,zoom:D,bands:O,stack:k,y:A,target:j,centerLabel:M,valueLabels:N,height:P,state:X,emptyText:R,errorText:he,loadingText:B,renderer:V,timeZone:me};if(se(t,Q.current.props))return;Q.current.props=t;let n=oe(t),r=ce(n);(r===null||r!==Q.current.signature)&&(Q.current.signature=r,e.spec=n)}),a(()=>{let e=Z.current;if(!e)throw Error(`AppChart: the <wui-chart> element is not mounted`);let t=[[d,e=>$.current.onSelect?.(u(e,d))],[f,e=>$.current.onLegendChange?.(u(e,f))],[p,e=>$.current.onReady?.(u(e,p))]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),a(()=>{let t=!0;return import(`@webority/ui-elements/chart`).catch(n=>{e(`[AppChart] the chart failed to load:`,n?.message),t&&_e(!0)}),()=>{t=!1}},[]),ge?/* @__PURE__ */ l(`div`,{...y,className:K||void 0,style:q,role:`status`,children:/* @__PURE__ */ l(`p`,{className:`wui-chart-state-text`,children:z||x.errorText})}):/* @__PURE__ */ l(`wui-chart`,{ref:ve,view:H||void 0,className:K||void 0,style:q,...y,...J})});export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/
|
|
1
|
+
import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppButton.js";import i from"./AppCard.js";import a from"./AppDropdown.js";import o from"./AppIcon.js";import s from"./AppSegmented.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{useLayoutEffect as u,useMemo as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{CHART_CARD_TEXT as _,fillText as v}from"@webority/ui-elements/text";var y=e=>e instanceof HTMLElement,b=e=>{let t=e.querySelector(`wui-chart`);return t&&y(t)?t:null},x=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},S=!1;function C(){!S&&x()&&(S=!0,e("[@webority/ui-react] <AppChartCard> has no `title`, which is the card's heading and names its menu button."))}var w=e=>e.getAttribute(`view`)===`table`?`table`:`chart`,T=e=>e===`chart`||e===`table`;function E(e){let{marker:y,props:x}=n(`AppChartCard`,e),S=t(`chartCard`,_),{title:E,subtitle:D,toolbar:O=!0,onRetry:k,footer:A,children:j,className:M=``,legendLabel:N=S.legendLabel,legendTitle:P=S.legendTitle,viewLabel:F=S.viewLabel,chartViewLabel:I=S.chartViewLabel,tableViewLabel:L=S.tableViewLabel,moreActionsLabel:R=S.moreActionsLabel,moreActionsForLabel:z=S.moreActionsForLabel,downloadPngLabel:B=S.downloadPngLabel,downloadCsvLabel:V=S.downloadCsvLabel,retryLabel:H=S.retryLabel,...U}=x;l(`AppChartCard`,U),E||C();let W=f(null),G=f(null),[K,q]=p(`chart`),J=f(K);J.current=K;let[Y,X]=p(!0),Z=()=>W.current?b(W.current):null;u(()=>{let e=W.current;if(!e)throw Error(`AppChartCard: the chart body is not mounted`);let t=()=>{let t=b(e);t&&(t===G.current?q(w(t)):(G.current=t,t.hasAttribute(`view`)?q(w(t)):J.current!==`chart`&&t.setAttribute(`view`,J.current)))};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`view`]}),()=>n.disconnect()},[]);let Q=e=>{if(c(`AppChartCard`,`view`,e,[`chart`,`table`]),!T(e))throw TypeError(`[@webority/ui-react] <AppChartCard> received no view`);q(e),Z()?.setAttribute(`view`,e)},$=d(()=>[{value:`chart`,label:I,icon:`chart`},{value:`table`,label:L,icon:`grid`}],[I,L]),ee=/* @__PURE__ */ g(m,{children:[/* @__PURE__ */ h(`button`,{type:`button`,className:`topbar-icon-btn wui-chart-card-tool wui-chart-card-legend-tool`,"aria-pressed":Y,"aria-label":N,title:P,onClick:()=>X(!Y),children:/* @__PURE__ */ h(o,{name:`list`,size:16})}),/* @__PURE__ */ h(s,{size:`sm`,label:F,options:$,value:K,onChange:Q}),/* @__PURE__ */ h(a,{icon:`more-horizontal`,label:E?v(z,{title:E}):R,items:[{key:`png`,label:B,icon:`image`,onClick:()=>Z()?.exportPng?.()},{key:`csv`,label:V,icon:`download`,onClick:()=>Z()?.exportCsv?.()}]})]}),te=[`wui-chart-card`,Y?``:`wui-chart-card-legend-off`,M].filter(Boolean).join(` `);return/* @__PURE__ */ g(i,{title:E,subtitle:D,headerActions:O?ee:void 0,footer:A,className:te,...y,...U,children:[/* @__PURE__ */ h(`div`,{ref:W,children:j}),k&&/* @__PURE__ */ h(`div`,{className:`wui-chart-card-retry`,children:/* @__PURE__ */ h(r,{variant:`outline`,size:`sm`,onClick:k,children:H})})]})}export{E 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{CHECKBOX_TEXT as l}from"@webority/ui-elements/text";var u=[`circle`];function d(e,t){if(t!=null&&t!==``)throw Error(`<AppCheckbox> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}var f=s(function(s,f){let{marker:p,props:m}=i(`AppCheckbox`,s),h=r(`checkbox`,l),{label:g,id:_,name:v,error:y,helperText:b,shape:x,help:S,helpLabel:C=h.helpLabel,readOnly:w=!1,loading:T=!1,size:E=`md`,controlOnly:D=!1,className:O=``,...k}=m;if(o(`AppCheckbox`,k),D&&(d(`label`,g),d(`error`,y),d(`helperText`,b),E!==`md`))throw Error(`<AppCheckbox> controlOnly draws no field, so it takes no size; draw the label or message on the page.`);a(`AppCheckbox`,`shape`,x,u),a(`AppCheckbox`,`size`,E,t);let A=x===`circle`?`form-check form-check-circle`:`form-check`;return/* @__PURE__ */ c(e,{rootProps:p,ref:f,label:n(g,S,C),id:_,name:v,error:y,hint:b,className:O,rest:k,inputType:`checkbox`,wrapperClass:A,readOnly:w,loading:T,size:E,controlOnly:D})});export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TONES as
|
|
1
|
+
import e from"../lib/useWuiText.js";import{TONES as t}from"../lib/vocabulary.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{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";import{CHIP_TEXT as l,fillText as u}from"@webority/ui-elements/text";var d=[`soft`,`outline`,`solid`],f=[`sm`,`md`];function p(p){let{marker:m,props:h}=n(`AppChip`,p),g=e(`chip`,l),{label:_,children:v,tone:y=`neutral`,variant:b=`soft`,size:x=`md`,leadingIcon:S,avatar:C,onRemove:w,onClick:T,selected:E,count:D,disabled:O=!1,removeLabel:k,className:A=``,...j}=h;if(a(`AppChip`,j),i(`AppChip`,`tone`,y,t),i(`AppChip`,`variant`,b,d),i(`AppChip`,`size`,x,f),E!=null&&!T)throw RangeError(`[@webority/ui-react] <AppChip> received selected without onClick. Only a clickable chip can be the chosen filter: pass onClick, or omit selected.`);let M=_??v,N=D==null?null:/* @__PURE__ */ s(`span`,{className:`wui-chip-count`,children:D}),P={},F={};for(let[e,t]of Object.entries(j))T&&(e.startsWith(`aria-`)||e.startsWith(`data-`))?P[e]=t:F[e]=t;let I=[`chip`,y&&y!==`neutral`?y:``,b===`outline`?`chip-outline`:b===`solid`?`chip-solid`:``,x===`sm`?`chip-sm`:``,T?`chip-clickable`:``,w?`chip-removable`:``,O?`is-disabled`:``,A].filter(Boolean).join(` `),L=C?/* @__PURE__ */ s(`span`,{className:`chip-avatar`,children:typeof C==`string`?/* @__PURE__ */ s(`img`,{src:C,alt:``}):C}):S?/* @__PURE__ */ s(`span`,{className:`chip-ic`,children:/* @__PURE__ */ s(r,{name:S,size:x===`sm`?12:14})}):null,R=T?/* @__PURE__ */ c(`button`,{type:`button`,className:`chip-body`,"aria-pressed":E??void 0,...P,onClick:T,disabled:O,children:[L,/* @__PURE__ */ s(`span`,{className:`chip-label`,children:M}),N]}):/* @__PURE__ */ c(o,{children:[L,/* @__PURE__ */ s(`span`,{className:`chip-label`,children:M}),N]});return/* @__PURE__ */ c(`span`,{className:I,...m,...F,children:[R,w&&/* @__PURE__ */ s(`button`,{type:`button`,className:`chip-remove`,onClick:w,disabled:O,"aria-label":k||(typeof M==`string`?u(g.removeText,{content:M}):g.removeLabel),children:/* @__PURE__ */ s(r,{name:`x`,size:x===`sm`?12:14})})]})}export{p 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"./assertValidValue.js";import i from"./warnUnknownProps.js";import{jsx as a}from"react/jsx-runtime";import{CHIP_GROUP_TEXT as o}from"@webority/ui-elements/text";var s=[`wrap`,`menu`],c=()=>import(`@webority/ui-elements/elements/overflow`);function l(l){e(`wui-overflow`,c);let{marker:u,props:d}=n(`AppChipGroup`,l),f=t(`chipGroup`,o),{children:p,overflow:m=`wrap`,moreLabel:h=f.moreLabel,label:g,className:_=``,...v}=d;i(`AppChipGroup`,v),r(`AppChipGroup`,`overflow`,m,s);let y=e=>[e,_].filter(Boolean).join(` `);return m===`menu`?/* @__PURE__ */ a(`wui-overflow`,{...u,class:`wui-chip-group-host`,label:h,children:/* @__PURE__ */ a(`div`,{role:`group`,"aria-label":g,className:y(`wui-chip-group wui-chip-group-nowrap`),"data-wui-overflow-list":``,...v,children:p})}):/* @__PURE__ */ a(`div`,{role:`group`,"aria-label":g,className:y(`wui-chip-group`),...u,...v,children:p})}export{l 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{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{CHOICE_CARD_TEXT as d}from"@webority/ui-elements/text";var f={sm:` wui-struct-card-sm`,md:``,lg:` wui-struct-card-lg`},p={inline:``,stacked:` wui-struct-card-stacked`},m={filled:` wui-struct-card-filled`},h={sm:16,md:18,lg:22};function g(g){let{marker:_,props:v}=r(`AppChoiceCard`,g),y=n(`choiceCard`,d),{name:b,multiple:x=!1,value:S,checked:C,onChange:w,icon:T,iconNode:E,iconSize:D,image:O,imageAlt:k=``,children:A,title:j,description:M,help:N,helpLabel:P=y.helpLabel,checkIcon:F=`check`,checkSize:I=18,hideCheck:L=!1,disabled:R=!1,readOnly:z=!1,loading:B=!1,size:V=`md`,layout:H=`inline`,selectedStyle:U,className:W=``,...G}=v;s(`AppChoiceCard`,G),o(`AppChoiceCard`,`size`,V,Object.keys(f)),o(`AppChoiceCard`,`layout`,H,Object.keys(p)),o(`AppChoiceCard`,`selectedStyle`,U,Object.keys(m));let K=f[V]??``,q=p[H]??``,J=U?m[U]??``:``,Y=D??h[V]??h.md;return/* @__PURE__ */ u(`label`,{className:`struct-card${O?` struct-card-img-card`:``}${K}${q}${J}${L?` wui-struct-card-no-check`:``}${W?` ${W}`:``}${B?` ${e}`:``}`,"aria-disabled":R||void 0,"aria-busy":B||void 0,..._,...G,children:[/* @__PURE__ */ l(`input`,{type:x?`checkbox`:`radio`,name:b,value:S,className:`struct-card-input`,checked:C,onChange:w,onClick:t(z||B),"aria-readonly":z||void 0,disabled:R||B}),O?/* @__PURE__ */ l(`span`,{className:`struct-card-media`,children:/* @__PURE__ */ l(`img`,{className:`struct-card-img`,src:O,alt:k})}):E||T?/* @__PURE__ */ l(`span`,{className:`struct-card-ic`,children:E||T&&/* @__PURE__ */ u(c,{children:[/* @__PURE__ */ l(`span`,{className:`wui-struct-card-glyph`,children:/* @__PURE__ */ l(i,{name:T,size:Y})}),/* @__PURE__ */ l(`span`,{className:`wui-struct-card-glyph-on`,children:/* @__PURE__ */ l(i,{name:T,size:Y,variant:`bold`})})]})}):null,/* @__PURE__ */ u(`span`,{className:`struct-card-body`,children:[A||/* @__PURE__ */ u(c,{children:[j&&/* @__PURE__ */ l(`span`,{className:`struct-card-title`,children:j}),M&&/* @__PURE__ */ l(`span`,{className:`struct-card-desc`,children:M})]}),N&&/* @__PURE__ */ l(a,{label:P,children:N})]}),!L&&/* @__PURE__ */ l(`span`,{className:`struct-card-check`,children:/* @__PURE__ */ l(i,{name:F,size:I})})]})}export{g 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"./AppInfoTip.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{CHOICE_CHIP_TEXT as u}from"@webority/ui-elements/text";var d=[`sm`,`md`,`lg`],f=[`soft`,`solid`];function p(p){let{marker:m,props:h}=r(`AppChoiceChip`,p),g=n(`choiceChip`,u),{multiple:_=!0,label:v,name:y,value:b,checked:x,onChange:S,children:C,count:w,help:T,helpLabel:E=g.helpLabel,size:D=`md`,variant:O=`soft`,disabled:k=!1,readOnly:A=!1,loading:j=!1,className:M=``,ref:N,...P}=h;return o(`AppChoiceChip`,P),a(`AppChoiceChip`,`size`,D,d),a(`AppChoiceChip`,`variant`,O,f),/* @__PURE__ */ l(s,{children:[/* @__PURE__ */ l(`label`,{className:`choice-chip${D===`sm`?` choice-chip-sm`:D===`lg`?` choice-chip-lg`:``}${O===`solid`?` wui-choice-chip-solid`:``}${M?` ${M}`:``}${j?` ${e}`:``}`,"aria-busy":j||void 0,...m,...P,children:[/* @__PURE__ */ c(`input`,{ref:N,type:_?`checkbox`:`radio`,name:y,value:b,checked:x,disabled:k||j,"aria-readonly":A||void 0,onClick:t(A||j),onChange:S}),/* @__PURE__ */ c(`span`,{children:v??C}),w!=null&&/* @__PURE__ */ c(`span`,{className:`count`,children:w})]}),T&&/* @__PURE__ */ c(i,{label:E,children:T})]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t}from"../lib/fieldState.js";import
|
|
1
|
+
import e from"../lib/FieldMessage.js";import{FIELD_BUSY_CLASS as t,FIELD_SIZES as n}from"../lib/fieldState.js";import r from"../lib/fillLabel.js";import{useFieldError as i}from"../lib/formFields.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppInfoTip.js";import s from"./AppRequiredMark.js";import c from"./assertValidValue.js";import l from"./warnUnknownProps.js";import{useId as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";function m(m){let{marker:h,props:g}=a(`AppColorField`,m),{value:_,defaultValue:v,onChange:y,label:b,required:x=!1,optional:S=!1,error:C,helperText:w,help:T,helpLabel:E=`More information`,colourLabel:D=`Colour`,colourPickerLabel:O=`{label}, colour picker`,optionalLabel:k=`(optional)`,name:A,id:j,disabled:M=!1,readOnly:N=!1,loading:P=!1,size:F=`md`,className:I=``,fieldClassName:L=``,...R}=g,z=i(A),B=C??z;l(`AppColorField`,R),c(`AppColorField`,`size`,F,n);let[V,H]=d(v??`#000000`),U=_===void 0?V:_,W=e=>{H(e),y?.(e)},G=u(),K=j||G,q=B?`${K}-error`:w?`${K}-hint`:void 0,J=e=>/^#[0-9a-f]{6}$/i.test(e),Y=F===`sm`?` wui-color-field-sm`:F===`lg`?` wui-color-field-lg`:F===`xl`?` wui-color-field-xl`:``,X=F===`sm`?` wui-input-sm`:F===`lg`?` wui-input-lg`:F===`xl`?` wui-input-xl`:``;return/* @__PURE__ */ p(`div`,{...h,className:`field${L?` ${L}`:``}`,children:[b&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:K,children:[b,S&&!x&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${k}`}),x&&/* @__PURE__ */ f(s,{}),T&&/* @__PURE__ */ f(o,{label:E,children:T})]}),/* @__PURE__ */ p(`div`,{className:`color-field${Y}`,children:[/* @__PURE__ */ f(`input`,{type:`color`,className:`color-field-swatch`,value:J(U)?U:`#000000`,onChange:e=>W(e.target.value),disabled:M||N||P,"aria-label":r(O,{label:typeof b==`string`&&b!==``?b:D}),tabIndex:-1}),/* @__PURE__ */ f(`input`,{type:`text`,className:`input color-field-hex${X}${B?` error`:``}${P?` ${t}`:``}${I?` ${I}`:``}`,id:K,name:A,value:U,onChange:e=>W(e.target.value),placeholder:`#4F46E5`,spellCheck:!1,maxLength:7,required:x,disabled:M,readOnly:N||P,"aria-busy":P||void 0,"aria-invalid":B?`true`:`false`,"aria-describedby":q,...R})]}),/* @__PURE__ */ f(e,{error:B,hint:w,errorId:`${K}-error`,hintId:`${K}-hint`})]})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{splitMarkerProps as
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppDropdown.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{COLUMN_MENU_TEXT as a}from"@webority/ui-elements/text";function o(o){let{marker:s,props:c}=t(`AppColumnMenu`,o),l=e(`columnMenu`,a),{columns:u,hiddenColumns:d=[],onToggle:f,label:p=l.label,className:m=``,...h}=c,g=u.filter(e=>e.hideable);return/* @__PURE__ */ i(n,{icon:`layout-grid`,label:p,menuClassName:`wui-column-menu${m?` ${m}`:``}`,...s,...h,children:[/* @__PURE__ */ r(`div`,{className:`wui-column-menu-title`,children:p}),g.map(e=>/* @__PURE__ */ i(`label`,{className:`wui-column-menu-item`,children:[/* @__PURE__ */ r(`input`,{type:`checkbox`,className:`wui-check`,checked:!d.includes(e.key),onChange:()=>f(e.key)}),e.label]},e.key))]})}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shortcutAria as e,shortcutChip as t}from"../lib/shortcutChip.js";import n from"../lib/useElementEntry.js";import{splitMarkerProps as
|
|
1
|
+
import{shortcutAria as e,shortcutChip as t}from"../lib/shortcutChip.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppIcon.js";import o from"./AppModal.js";import s from"./AppSpinner.js";import c from"./renderIconProp.js";import l from"./warnUnknownProps.js";import{matchSegments as u}from"@webority/ui-elements/helpers";import{Fragment as d,useEffect as f,useId as p,useLayoutEffect as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{COMMAND_PALETTE_TEXT as y,fillText as b}from"@webority/ui-elements/text";var x=`lg`,S=()=>import(`@webority/ui-elements/elements/command-palette`);function C(e){n(`wui-command-palette`,S);let t=r(`commandPalette`,y),{marker:a,props:s}=i(`AppCommandPalette`,e),{open:c,onClose:u,query:d=``,onQueryChange:f,placeholder:m=t.placeholder,groups:h=[],path:g=[],onPathChange:v,rootLabel:b,backLabel:C=t.backLabel,recentsKey:T,recentsLimit:E,recentsLabel:D,loading:O=!1,emptyText:k=t.emptyText,footer:A,ariaLabel:j=t.ariaLabel,resultsLabel:M=t.resultsLabel,highlight:N=!0,groupFilter:P=!1,id:F,className:I=``,...L}=s;l(`AppCommandPalette`,L);let R=p(),z=F||R;return/* @__PURE__ */ _(o,{...a,open:c,onClose:u,staticBackdrop:!1,hideHeader:!0,placement:`top`,size:x,ariaLabel:j,className:`wui-cmd-card${I?` ${I}`:``}`,children:/* @__PURE__ */ _(w,{baseId:z,query:d,onQueryChange:f,placeholder:m,groups:h,path:g,onPathChange:v,rootLabel:b,backLabel:C,recentsKey:T,recentsLimit:E,recentsLabel:D,loading:O,emptyText:k,footer:A,ariaLabel:j,resultsLabel:M,highlight:N,groupFilter:P,onClose:u,rest:L})})}function w({baseId:n,query:i,onQueryChange:o,placeholder:l,groups:u,path:d,onPathChange:p,rootLabel:x,backLabel:S,recentsKey:C,recentsLimit:w,recentsLabel:O,loading:k,emptyText:A,footer:j,ariaLabel:M,resultsLabel:N,highlight:P,groupFilter:F,onClose:I,rest:L}){let R=r(`commandPalette`,y),z=h(null),B=`${n}-list`,V=u.filter(e=>!!e.items?.length),H=!k&&i.trim()!==``&&V.length===0,[U,W]=g({query:i,key:null}),G=U.query===i&&V.some(e=>String(e.key)===U.key)?U.key:null,K=F&&G!=null?V.filter(e=>String(e.key)===G):V,q=F&&V.length>0,J=e=>W({query:i,key:e}),Y=e=>{if(!q||e.key!==`Tab`)return;e.preventDefault();let t=[E,...V.map(e=>String(e.key))],n=t[(Math.max(0,t.indexOf(G??E))+(e.shiftKey?-1:1)+t.length)%t.length]??E;J(n===E?null:n)};return m(()=>{z.current?.refresh?.()}),f(()=>{let e=z.current;if(!e)throw Error(`<wui-command-palette> is not mounted`);let t=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-command-palette:select arrived without a detail`);let t=e.detail,n=u.find(e=>String(e.key)===t.groupKey)?.items?.find(e=>String(e.key)===t.key);n&&(e.preventDefault(),n.page?(o?.(``),p?.([...d,{key:n.page.key,label:n.page.label}])):(n.onSelect?.(),I?.()))},n=e=>{if(!(e instanceof CustomEvent))throw Error(`wui-command-palette:navigate arrived without a detail`);e.preventDefault(),o?.(``);let t=e.detail;p?.(t.path)};return e.addEventListener(`wui-command-palette:select`,t),e.addEventListener(`wui-command-palette:navigate`,n),()=>{e.removeEventListener(`wui-command-palette:select`,t),e.removeEventListener(`wui-command-palette:navigate`,n)}},[u,d,I,o,p]),/* @__PURE__ */ v(`wui-command-palette`,{ref:z,path:JSON.stringify(d),"root-label":x,"recents-key":C,"recents-limit":w,"recents-label":O,...L,children:[/* @__PURE__ */ v(`div`,{className:`wui-cmd-search`,children:[/* @__PURE__ */ _(`span`,{className:`wui-cmd-search-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ _(a,{name:`search`,size:18})}),/* @__PURE__ */ _(`input`,{className:`wui-cmd-input`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":B,"aria-autocomplete":`list`,"aria-label":M,placeholder:l,autoComplete:`off`,spellCheck:!1,"data-autofocus":``,value:i,onChange:e=>o?.(e.target.value),onKeyDown:Y}),k&&/* @__PURE__ */ _(s,{size:`sm`,className:`wui-cmd-spinner`})]}),q&&/* @__PURE__ */ _(`div`,{className:`wui-cmd-tabs app-tabs app-tabs-pills app-tabs-sm`,role:`tablist`,"aria-label":R.resultGroupsLabel,children:[{key:``,label:b(R.allCountText,{count:V.reduce((e,t)=>e+t.items.length,0)})},...V.map(e=>({key:String(e.key),label:`${e.label} (${e.items.length})`}))].map(e=>{let t=(G??``)===e.key;return/* @__PURE__ */ _(`button`,{type:`button`,className:t?`app-tab active`:`app-tab`,role:`tab`,"aria-selected":t?`true`:`false`,tabIndex:-1,"data-group-tab":e.key,onClick:()=>J(e.key===``?null:e.key),children:/* @__PURE__ */ _(`span`,{className:`wui-tab-label`,children:e.label})},e.key||E)})}),/* @__PURE__ */ v(`div`,{className:`wui-cmd-crumbs`,hidden:!0,children:[/* @__PURE__ */ _(`button`,{type:`button`,className:`wui-cmd-back`,"aria-label":S,children:/* @__PURE__ */ _(a,{name:`chevron-left`,size:16})}),/* @__PURE__ */ _(`ol`,{className:`wui-cmd-trail`})]}),/* @__PURE__ */ v(`div`,{className:`wui-cmd-list`,role:`listbox`,id:B,"aria-label":N,"aria-busy":k?`true`:void 0,hidden:V.length===0,children:[/* @__PURE__ */ _(`div`,{className:`wui-cmd-recents`}),K.map(r=>{let o=`${n}-${D(r.key)}`;return/* @__PURE__ */ v(`div`,{className:`wui-cmd-group`,role:`group`,"aria-labelledby":o,children:[/* @__PURE__ */ _(`div`,{className:`wui-cmd-group-label`,role:`presentation`,id:o,children:r.label}),r.items.map(n=>{let s=`${o}-${D(n.key)}`,l=n.description==null?null:`${s}-desc`,u=n.meta==null?null:`${s}-meta`;return/* @__PURE__ */ v(`div`,{className:`wui-cmd-item`,role:`option`,id:s,"data-group-key":String(r.key),"data-key":String(n.key),"data-opens":n.page?String(n.page.key):void 0,"data-keywords":n.keywords?.length?n.keywords.join(` `):void 0,"aria-label":n.ariaLabel||(typeof n.label==`string`?n.label:``)||void 0,"aria-describedby":[l,u].filter(Boolean).join(` `)||void 0,"aria-disabled":n.disabled?`true`:void 0,"aria-keyshortcuts":e(n.shortcut),children:[n.icon!=null&&/* @__PURE__ */ _(`span`,{className:`wui-cmd-item-icon`,"aria-hidden":`true`,children:c(n.icon,{size:18})}),/* @__PURE__ */ v(`span`,{className:`wui-cmd-item-text`,children:[/* @__PURE__ */ _(`span`,{className:`wui-cmd-item-label`,children:P?T(n.label,i):n.label}),l&&/* @__PURE__ */ _(`span`,{className:`wui-cmd-item-desc`,id:l,children:n.description})]}),u&&/* @__PURE__ */ _(`span`,{className:`wui-cmd-item-meta`,id:u,children:n.meta}),t(n.shortcut),n.page&&/* @__PURE__ */ _(`span`,{className:`wui-cmd-item-chevron`,"aria-hidden":`true`,children:/* @__PURE__ */ _(a,{name:`chevron-right`,size:16})})]},n.key)})]},r.key)})]}),/* @__PURE__ */ _(`div`,{className:`wui-cmd-empty`,role:`status`,children:H?A:null}),j!=null&&/* @__PURE__ */ _(`div`,{className:`wui-cmd-footer`,children:j})]})}function T(e,t){if(typeof e!=`string`)return e;let n=u(e,t),[r]=n;if(n.length===1&&r&&!r.match)return e;let i=0;return n.map(e=>{let t=i;return i+=e.text.length,e.match?/* @__PURE__ */ _(`mark`,{className:`wui-cmd-mark`,children:e.text},t):/* @__PURE__ */ _(d,{children:e.text},t)})}var E=`__all__`;function D(e){return String(e).replace(/\s+/g,`_`)}export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/fillLabel.js";import{initialsOf as t}from"../lib/initials.js";import{linkTarget as n}from"../lib/linkTarget.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAvatar.js";import s from"./AppBadge.js";import c from"./AppButton.js";import l from"./AppIcon.js";import u from"./AppMarkdown.js";import d from"./assertValidValue.js";import f from"./warnUnknownProps.js";import{COMMENT_REACTIONS as p,COMMENT_TEXT as m,formatDate as h,formatFileSize as g,formatNumber as _,mentionTextFromValue as v,parseMentionValue as y,toInstant as b}from"@webority/ui-elements/helpers";import{Fragment as x,useEffect as S,useId as C,useRef as w}from"react";import{jsx as T,jsxs as E}from"react/jsx-runtime";var D=[`stacked`,`inline`],O=[`list`,`conversation`],k=()=>import(`@webority/ui-elements/elements/comment-thread`),A=()=>import(`@webority/ui-elements/elements/mention-input`),j=e=>y(e??``).map((e,t)=>({key:`segment-${t}`,seg:e})),M=e=>e.localName===`wui-mention-input`;function N(e){let{marker:t,props:n}=a(`AppCommentThread`,e),{comments:r=[],onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,people:_,loadPeople:v,reactionChoices:y,allowReplies:b=!0,allowReactions:x=!0,composerPlaceholder:j,variant:N=`list`,composer:F=`stacked`,author:I,postLabel:L=m.post,composerRows:R,readOnly:z=!1,markdown:B=!1,linkComponent:V,label:H=m.listName,internalLabel:U=`Internal note`,attachmentsLabel:W=`Attachments`,composerLabel:G=`Add a comment`,noCommentsText:K=`No comments yet.`,reactionsLabel:ee=`Reactions`,repliesToLabel:te=`Replies to {name}`,editedLabel:ne=`Edited`,deletedText:re=`This comment was deleted.`,replyLabel:ie=`Reply`,editLabel:ae=`Edit`,deleteLabel:oe=`Delete`,deleteConfirmText:se=`Delete this comment?`,cancelLabel:ce=`Cancel`,addReactionLabel:le=`Add a reaction`,chooseReactionLabel:ue=`Choose a reaction`,peopleLabel:de=`People`,id:fe,className:pe=``,...q}=n;f(`AppCommentThread`,q),d(`AppCommentThread`,`variant`,N,O),d(`AppCommentThread`,`composer`,F,D);let J=i(`wui-comment-thread`,k);i(`wui-mention-input`,A);let me=C(),Y=fe||`comment-thread-${me.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=w(null),Z=typeof v==`function`,he=y?.length?y:p,Q=F===`inline`,ge=R??(Q?1:3),_e={reactionsLabel:ee,repliesToLabel:te,editedLabel:ne,deletedText:re,replyLabel:ie,editLabel:ae,deleteLabel:oe,deleteConfirmText:se,cancelLabel:ce,addReactionLabel:le},$=w({onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,loadPeople:v});return $.current={onPost:s,onReply:l,onEdit:u,onDelete:h,onReact:g,loadPeople:v},S(()=>{let e=X.current;if(e&&J)return e.submit=async e=>{let t=$.current;e.intent===`post`?await t.onPost?.(e.body):e.intent===`reply`?await t.onReply?.(e.parentId,e.body):e.intent===`edit`?await t.onEdit?.(e.commentId,e.body):e.intent===`delete`?await t.onDelete?.(e.commentId):e.intent===`react`&&await t.onReact?.(e.commentId,e.emoji)},()=>{e.submit=void 0}},[J]),S(()=>{let e=X.current;e&&J&&!Z&&(e.people=_||[])},[_,Z,J]),S(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target;if(!(e instanceof CustomEvent)||!(n instanceof HTMLElement)||!M(n))throw TypeError(`<wui-comment-thread> search came from something other than a mention box.`);let r=e.detail;if(typeof r!=`object`||!r||!(`query`in r)||typeof r.query!=`string`)throw TypeError(`<wui-comment-thread> search carried no query.`);let i=r.query,{loadPeople:a}=$.current;if(typeof a!=`function`)throw Error(`<AppCommentThread> is remote but has no loadPeople.`);let o=(t.get(n)??0)+1;t.set(n,o),n.loading=!0;try{let e=await a(i);t.get(n)===o&&(n.people=e||[])}catch(e){t.get(n)===o&&(n.people=[],n.searchFailed=!0,reportError(e))}finally{t.get(n)===o&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ E(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,N===`conversation`&&`wui-comment-thread--conversation`,pe].filter(Boolean).join(` `),controlled:``,"read-only":z?``:void 0,remote:Z?``:void 0,"reaction-choices":y?.length?y.join(` `):void 0,"no-replies":b?void 0:``,"no-reactions":x?void 0:``,"composer-placeholder":j,...t,...q,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:r.length?/* @__PURE__ */ T(`ol`,{className:`wui-comment-list`,"aria-label":H,children:r.map(e=>/* @__PURE__ */ T(P,{comment:e,topLevel:!0,readOnly:z,allowReplies:b,allowReactions:x,markdown:B,linkComponent:V,internalLabel:U,attachmentsLabel:W,text:_e},e.id))}):/* @__PURE__ */ T(`p`,{className:`wui-comment-empty`,children:K})}),!z&&x&&/* @__PURE__ */ T(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":ue,"data-wui-picker":``,popover:`auto`,children:he.map(e=>/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!z&&/* @__PURE__ */ E(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&I?/* @__PURE__ */ T(o,{name:I,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ T(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:G,"people-label":de,placeholder:j??m.composerPlaceholder,rows:String(ge),remote:Z?``:void 0}),/* @__PURE__ */ T(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ T(c,{variant:Q?`outline`:`solid`,size:`sm`,"data-wui-action":`post`,children:L})}),/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ T(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function P({comment:i,topLevel:a=!1,readOnly:o,allowReplies:d,allowReactions:f,markdown:p,linkComponent:m,internalLabel:y,attachmentsLabel:S,text:C}){let{id:w,author:D,at:O,value:k,edited:A,mine:M,internal:N,attachments:F=[],deleted:I,canEdit:L,canDelete:R,reactions:z=[],replies:B=[]}=i,V=D?.name||``,H=b(O),U=!o&&!I&&L,W=!o&&!I&&R,G=a&&d,K=[`wui-comment`,N&&`wui-comment--internal`,M&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ E(`li`,{className:K,"data-wui-comment":w,"data-value":k??``,"data-wui-deleted":I?``:void 0,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ E(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ T(`span`,{className:`avatar-face`,children:t(V)||`?`}),D?.src&&/* @__PURE__ */ T(`img`,{className:`avatar-img`,src:D.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ E(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-author`,children:V}),/* @__PURE__ */ T(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(H)?new Date(H).toISOString():void 0,children:h(O,{pattern:`datetime`})}),A&&!I&&/* @__PURE__ */ T(`span`,{className:`wui-comment-edited`,children:C.editedLabel}),N&&/* @__PURE__ */ T(s,{className:`wui-comment-internal-badge`,children:y})]}),I?/* @__PURE__ */ T(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:C.deletedText}):/* @__PURE__ */ T(`div`,{className:p?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:p?/* @__PURE__ */ T(u,{value:v(k??``).text,headings:`text`}):j(k).map(({key:e,seg:t})=>`text`in t?/* @__PURE__ */ T(x,{children:t.text},e):/* @__PURE__ */ E(`span`,{className:`wui-mention`,"data-mention-id":t.id,children:[`@`,t.label]},e))}),!I&&F.length>0&&/* @__PURE__ */ T(`ul`,{className:`wui-comment-attachments`,"aria-label":S,children:F.map(e=>{let t=n(m,{to:e.to,href:e.href,routeHref:!1});return/* @__PURE__ */ E(`li`,{children:[/* @__PURE__ */ E(r,{link:t,className:`wui-comment-attachment`,...e.to?{}:{download:!0},children:[/* @__PURE__ */ T(l,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ T(`span`,{className:`wui-comment-attachment-size`,children:g(e.sizeBytes)})]},e.to??e.href)})}),U&&/* @__PURE__ */ T(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),f&&!I&&(z.length>0||!o)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":C.reactionsLabel,children:[z.map(e=>o?/* @__PURE__ */ E(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:_(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ E(`button`,{type:`button`,className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,"data-wui-emoji":e.emoji,"aria-pressed":e.mine?`true`:`false`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:_(e.count,{decimals:0})})]},e.emoji)),!o&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":C.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ T(l,{name:`emoji-smile`,size:16})})]}),!o&&!I&&(G||U||W)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[G&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:C.replyLabel}),U&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:C.editLabel}),W&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:C.deleteLabel})]}),W&&/* @__PURE__ */ E(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-confirm-text`,children:C.deleteConfirmText}),/* @__PURE__ */ T(c,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:C.deleteLabel}),/* @__PURE__ */ T(c,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:C.cancelLabel})]}),!o&&/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),a&&B.length>0&&/* @__PURE__ */ T(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":e(C.repliesToLabel,{name:V}),children:B.map(e=>/* @__PURE__ */ T(P,{comment:e,readOnly:o,allowReactions:f,markdown:p,linkComponent:m,internalLabel:y,attachmentsLabel:S,text:C},e.id))}),G&&!o&&!I&&/* @__PURE__ */ T(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{N as default};
|
|
1
|
+
import{initialsOf as e}from"../lib/initials.js";import{linkTarget as t}from"../lib/linkTarget.js";import{TargetLink as n}from"../lib/TargetLink.js";import r from"../lib/useElementEntry.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAvatar.js";import s from"./AppBadge.js";import c from"./AppButton.js";import l from"./AppIcon.js";import u from"./AppMarkdown.js";import d from"./assertValidValue.js";import f from"./warnUnknownProps.js";import{COMMENT_REACTIONS as p,formatDate as m,formatFileSize as h,formatNumber as g,mentionTextFromValue as _,parseMentionValue as v,toInstant as y}from"@webority/ui-elements/helpers";import{Fragment as b,useEffect as x,useId as S,useRef as C}from"react";import{jsx as w,jsxs as T}from"react/jsx-runtime";import{COMMENT_THREAD_TEXT as E,fillText as D}from"@webority/ui-elements/text";var O=[`stacked`,`inline`],k=[`list`,`conversation`],A=()=>import(`@webority/ui-elements/elements/comment-thread`),j=()=>import(`@webority/ui-elements/elements/mention-input`),M=e=>v(e??``).map((e,t)=>({key:`segment-${t}`,seg:e})),N=e=>e.localName===`wui-mention-input`;function P(e){let{marker:t,props:n}=a(`AppCommentThread`,e),s=i(`commentThread`,E),{comments:l=[],onPost:u,onReply:m,onEdit:h,onDelete:g,onReact:_,people:v,loadPeople:y,reactionChoices:b,allowReplies:D=!0,allowReactions:M=!0,composerPlaceholder:P,variant:I=`list`,composer:L=`stacked`,author:R,postLabel:z=s.postLabel,composerRows:B,readOnly:V=!1,markdown:H=!1,linkComponent:U,label:W=s.label,internalLabel:G=s.internalLabel,attachmentsLabel:K=s.attachmentsLabel,composerLabel:ee=s.composerLabel,noCommentsText:te=s.noCommentsText,reactionsLabel:ne=s.reactionsLabel,repliesToLabel:re=s.repliesToLabel,editedLabel:ie=s.editedLabel,deletedText:ae=s.deletedText,replyLabel:oe=s.replyLabel,editLabel:se=s.editLabel,deleteLabel:ce=s.deleteLabel,deleteConfirmText:le=s.deleteConfirmText,cancelLabel:ue=s.cancelLabel,addReactionLabel:de=s.addReactionLabel,chooseReactionLabel:fe=s.chooseReactionLabel,peopleLabel:pe=s.peopleLabel,id:me,className:he=``,...q}=n;f(`AppCommentThread`,q),d(`AppCommentThread`,`variant`,I,k),d(`AppCommentThread`,`composer`,L,O);let J=r(`wui-comment-thread`,A);r(`wui-mention-input`,j);let ge=S(),Y=me||`comment-thread-${ge.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=C(null),Z=typeof y==`function`,_e=b?.length?b:p,Q=L===`inline`,ve=B??(Q?1:3),ye={reactionsLabel:ne,repliesToLabel:re,editedLabel:ie,deletedText:ae,replyLabel:oe,editLabel:se,deleteLabel:ce,deleteConfirmText:le,cancelLabel:ue,addReactionLabel:de},$=C({onPost:u,onReply:m,onEdit:h,onDelete:g,onReact:_,loadPeople:y});return $.current={onPost:u,onReply:m,onEdit:h,onDelete:g,onReact:_,loadPeople:y},x(()=>{let e=X.current;if(e&&J)return e.submit=async e=>{let t=$.current;e.intent===`post`?await t.onPost?.(e.body):e.intent===`reply`?await t.onReply?.(e.parentId,e.body):e.intent===`edit`?await t.onEdit?.(e.commentId,e.body):e.intent===`delete`?await t.onDelete?.(e.commentId):e.intent===`react`&&await t.onReact?.(e.commentId,e.emoji)},()=>{e.submit=void 0}},[J]),x(()=>{let e=X.current;e&&J&&!Z&&(e.people=v||[])},[v,Z,J]),x(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target;if(!(e instanceof CustomEvent)||!(n instanceof HTMLElement)||!N(n))throw TypeError(`<wui-comment-thread> search came from something other than a mention box.`);let r=e.detail;if(typeof r!=`object`||!r||!(`query`in r)||typeof r.query!=`string`)throw TypeError(`<wui-comment-thread> search carried no query.`);let i=r.query,{loadPeople:a}=$.current;if(typeof a!=`function`)throw Error(`<AppCommentThread> is remote but has no loadPeople.`);let o=(t.get(n)??0)+1;t.set(n,o),n.loading=!0;try{let e=await a(i);t.get(n)===o&&(n.people=e||[])}catch(e){t.get(n)===o&&(n.people=[],n.searchFailed=!0,reportError(e))}finally{t.get(n)===o&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ T(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,I===`conversation`&&`wui-comment-thread--conversation`,he].filter(Boolean).join(` `),controlled:``,"read-only":V?``:void 0,remote:Z?``:void 0,"reaction-choices":b?.length?b.join(` `):void 0,"no-replies":D?void 0:``,"no-reactions":M?void 0:``,"composer-placeholder":P,...t,...q,children:[/* @__PURE__ */ w(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:l.length?/* @__PURE__ */ w(`ol`,{className:`wui-comment-list`,"aria-label":W,children:l.map(e=>/* @__PURE__ */ w(F,{comment:e,topLevel:!0,readOnly:V,allowReplies:D,allowReactions:M,markdown:H,linkComponent:U,internalLabel:G,attachmentsLabel:K,text:ye},e.id))}):/* @__PURE__ */ w(`p`,{className:`wui-comment-empty`,children:te})}),!V&&M&&/* @__PURE__ */ w(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":fe,"data-wui-picker":``,popover:`auto`,children:_e.map(e=>/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!V&&/* @__PURE__ */ T(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&R?/* @__PURE__ */ w(o,{name:R,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ w(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:ee,"people-label":pe,placeholder:P??s.composerPlaceholder,rows:String(ve),remote:Z?``:void 0}),/* @__PURE__ */ w(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ w(c,{variant:Q?`outline`:`solid`,size:`sm`,"data-wui-action":`post`,children:z})}),/* @__PURE__ */ w(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ w(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function F({comment:r,topLevel:i=!1,readOnly:a,allowReplies:o,allowReactions:d,markdown:f,linkComponent:p,internalLabel:v,attachmentsLabel:x,text:S}){let{id:C,author:E,at:O,value:k,edited:A,mine:j,internal:N,attachments:P=[],deleted:I,canEdit:L,canDelete:R,reactions:z=[],replies:B=[]}=r,V=E?.name||``,H=y(O),U=!a&&!I&&L,W=!a&&!I&&R,G=i&&o,K=[`wui-comment`,N&&`wui-comment--internal`,j&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ T(`li`,{className:K,"data-wui-comment":C,"data-value":k??``,"data-wui-deleted":I?``:void 0,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ T(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ w(`span`,{className:`avatar-face`,children:e(V)||`?`}),E?.src&&/* @__PURE__ */ w(`img`,{className:`avatar-img`,src:E.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ T(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ w(`span`,{className:`wui-comment-author`,children:V}),/* @__PURE__ */ w(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(H)?new Date(H).toISOString():void 0,children:m(O,{pattern:`datetime`})}),A&&!I&&/* @__PURE__ */ w(`span`,{className:`wui-comment-edited`,children:S.editedLabel}),N&&/* @__PURE__ */ w(s,{className:`wui-comment-internal-badge`,children:v})]}),I?/* @__PURE__ */ w(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:S.deletedText}):/* @__PURE__ */ w(`div`,{className:f?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:f?/* @__PURE__ */ w(u,{value:_(k??``).text,headings:`text`}):M(k).map(({key:e,seg:t})=>`text`in t?/* @__PURE__ */ w(b,{children:t.text},e):/* @__PURE__ */ T(`span`,{className:`wui-mention`,"data-mention-id":t.id,children:[`@`,t.label]},e))}),!I&&P.length>0&&/* @__PURE__ */ w(`ul`,{className:`wui-comment-attachments`,"aria-label":x,children:P.map(e=>{let r=t(p,{to:e.to,href:e.href,routeHref:!1});return/* @__PURE__ */ T(`li`,{children:[/* @__PURE__ */ T(n,{link:r,className:`wui-comment-attachment`,...e.to?{}:{download:!0},children:[/* @__PURE__ */ w(l,{name:`paperclip`,size:14}),e.name]}),typeof e.sizeBytes==`number`&&/* @__PURE__ */ w(`span`,{className:`wui-comment-attachment-size`,children:h(e.sizeBytes)})]},e.to??e.href)})}),U&&/* @__PURE__ */ w(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),d&&!I&&(z.length>0||!a)&&/* @__PURE__ */ T(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":S.reactionsLabel,children:[z.map(e=>a?/* @__PURE__ */ T(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ w(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ w(`span`,{className:`wui-reaction-count`,children:g(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ T(`button`,{type:`button`,className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,"data-wui-emoji":e.emoji,"aria-pressed":e.mine?`true`:`false`,children:[/* @__PURE__ */ w(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ w(`span`,{className:`wui-reaction-count`,children:g(e.count,{decimals:0})})]},e.emoji)),!a&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":S.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ w(l,{name:`emoji-smile`,size:16})})]}),!a&&!I&&(G||U||W)&&/* @__PURE__ */ T(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[G&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:S.replyLabel}),U&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:S.editLabel}),W&&/* @__PURE__ */ w(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:S.deleteLabel})]}),W&&/* @__PURE__ */ T(`div`,{className:`wui-comment-confirm`,"data-wui-confirm":``,hidden:!0,children:[/* @__PURE__ */ w(`span`,{className:`wui-comment-confirm-text`,children:S.deleteConfirmText}),/* @__PURE__ */ w(c,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:S.deleteLabel}),/* @__PURE__ */ w(c,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:S.cancelLabel})]}),!a&&/* @__PURE__ */ w(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),i&&B.length>0&&/* @__PURE__ */ w(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":D(S.repliesToLabel,{name:V}),children:B.map(e=>/* @__PURE__ */ w(F,{comment:e,readOnly:a,allowReactions:d,markdown:f,linkComponent:p,internalLabel:v,attachmentsLabel:x,text:S},e.id))}),G&&!a&&!I&&/* @__PURE__ */ w(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{emptyPlaceholder as e}from"../lib/emptyValue.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{isValidElement as o,useEffect as s,useRef as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{COMPARE_TABLE_TEXT as f}from"@webority/ui-elements/text";var p=[`stack`,`scroll`],m=[`comfortable`,`relaxed`],h=[`boxed`,`plain`],g=[`start`,`center`],_={yes:{icon:`tick-circle`},no:{icon:`close-circle`},warn:{icon:`danger`},partial:{icon:`minus-circle`}};function v(e){return typeof e==`object`&&!!e&&!o(e)}function y(e){return v(e)&&`state`in e}function b(e){return v(e)&&`code`in e}function x(e){return e.scrollLeft+e.clientWidth<e.scrollWidth-1}function S(...e){return e.filter(Boolean).join(` `)||void 0}function C(e){return S(e.highlight&&`is-highlight`,e.align===`center`&&`wui-compare-center`,e.nowrap&&`wui-compare-nowrap`)}function w(t,n){if(t===!0)return/* @__PURE__ */ d(`span`,{className:`compare-yes`,children:[/* @__PURE__ */ u(r,{name:`check`,size:16}),/* @__PURE__ */ u(`span`,{className:`visually-hidden`,children:n.yesLabel})]});if(t===!1)return/* @__PURE__ */ d(`span`,{className:`compare-no`,children:[/* @__PURE__ */ u(`span`,{"aria-hidden":`true`,children:e()}),/* @__PURE__ */ u(`span`,{className:`visually-hidden`,children:n.noLabel})]});if(y(t)){let e=_[t.state],a={yes:n.yesLabel,no:n.noLabel,warn:n.warningLabel,partial:n.partialLabel};return i(`AppCompareTable`,`state`,t.state,Object.keys(_)),/* @__PURE__ */ d(`span`,{className:`wui-compare-state wui-compare-state-${t.state}`,children:[e&&/* @__PURE__ */ u(r,{name:e.icon,size:16,variant:`bulk`}),e&&/* @__PURE__ */ u(`span`,{className:`visually-hidden`,children:`${a[t.state]}: `}),t.text]})}return b(t)?/* @__PURE__ */ u(`span`,{className:`wui-compare-code`,children:t.code}):t}function T(e,t,n){let r=[],i=null;return t.forEach((t,a)=>{t.group!=null&&t.group!==i&&r.push(/* @__PURE__ */ u(`tr`,{className:`wui-compare-group-row`,children:/* @__PURE__ */ u(`th`,{colSpan:e.length,scope:`rowgroup`,className:`wui-compare-group`,children:t.group})},`group:${t.group}:${t.key??t.label}`)),i=t.group??null,r.push(/* @__PURE__ */ d(`tr`,{children:[/* @__PURE__ */ u(`th`,{scope:`row`,children:t.label}),t.values.map((t,r)=>{let i=e[r+1];return/* @__PURE__ */ u(`td`,{className:C(i??{}),"data-label":i?.label,children:w(t,n)},i?.label??r)})]},t.key??`${t.label}-${a}`))}),r}function E(e){let{marker:r,props:o}=n(`AppCompareTable`,e),_=t(`compareTable`,f),{columns:v,rows:y,caption:b,mobile:w=`stack`,stickyFirstColumn:E=!1,stickyHeader:D=!1,density:O=`comfortable`,variant:k=`boxed`,yesLabel:A=_.yesLabel,noLabel:j=_.noLabel,warningLabel:M=_.warningLabel,partialLabel:N=_.partialLabel,className:P=``,...F}=o,I={yesLabel:A,noLabel:j,warningLabel:M,partialLabel:N},L=c(null),[R,z]=l(!1);if(s(()=>{let e=()=>{let e=L.current;e&&z(x(e))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),!Array.isArray(v))throw Error(`<AppCompareTable> columns is required: pass the feature-name column, then one per option.`);if(!Array.isArray(y))throw Error(`<AppCompareTable> rows is required: pass one row per capability.`);a(`AppCompareTable`,F),i(`AppCompareTable`,`mobile`,w,p),i(`AppCompareTable`,`density`,O,m),i(`AppCompareTable`,`variant`,k,h);for(let e of v)i(`AppCompareTable`,`align`,e.align,g);let B=w===`scroll`,V=/* @__PURE__ */ d(`table`,{className:S(B&&`wui-compare-scroll-table`,B&&E&&`wui-compare-sticky-first`),children:[b&&/* @__PURE__ */ u(`caption`,{className:`visually-hidden`,children:b}),/* @__PURE__ */ u(`thead`,{children:/* @__PURE__ */ u(`tr`,{children:v.map((e,t)=>/* @__PURE__ */ u(`th`,{scope:`col`,className:C(e),children:e.label},e.label?`col-${t}-${e.label}`:`col-${t}`))})}),/* @__PURE__ */ u(`tbody`,{children:T(v,y,I)})]});return/* @__PURE__ */ u(`div`,{className:S(`compare-table`,O===`relaxed`&&`wui-compare-relaxed`,k===`plain`&&`wui-compare-plain`,D&&`wui-compare-sticky-head`,P),"data-mobile":w,...r,...F,children:B?/* @__PURE__ */ u(`div`,{className:`wui-compare-scroll`,ref:L,tabIndex:0,role:b?`region`:void 0,"aria-label":b||void 0,"data-more":R?`end`:void 0,onScroll:e=>z(x(e.currentTarget)),children:V}):V})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../lib/
|
|
1
|
+
import e from"../lib/useWuiText.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppIcon.js";import i from"./AppInput.js";import a from"./AppModal.js";import o from"./assertValidValue.js";import{MODAL_ICONS as ee}from"./ModalIcons.js";import s from"./warnUnknownProps.js";import{useEffect as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{CONFIRM_DIALOG_TEXT as p,fillText as m}from"@webority/ui-elements/text";var h=[`sm`,`md`,`lg`,`xl`],g=[`default`,`plain`],_=[`success`,`danger`,`warning`,`info`,`primary`];function v(v){let{marker:y,props:b}=t(`AppConfirmDialog`,v),x=e(`confirmDialog`,p),{open:S,title:C,variant:w=`default`,description:T,confirmLabel:E=x.confirmLabel,cancelLabel:D=x.cancelLabel,typePhraseLabel:O=x.typePhraseLabel,tone:k,image:A,icon:j,iconSize:M,confirmPhrase:N,onConfirm:P,onClose:F,loading:I=!1,staticBackdrop:L=!0,placement:R=`center`,size:z=`md`,className:B=``,children:V,...H}=b;s(`AppConfirmDialog`,H),o(`AppConfirmDialog`,`tone`,k,_),o(`AppConfirmDialog`,`size`,typeof z==`string`?z:null,h),o(`AppConfirmDialog`,`variant`,w,g);let[U,W]=l(``);if(c(()=>{S||W(``)},[S]),!S)return null;let G=!!N&&U.trim()!==N,[K,...q]=O.split(`{phrase}`),J=q.join(N??`,`),Y=w===`plain`,X=Y?`sm`:`md`,Z=Y||A||j?null:ee[k===`danger`?`delete`:k??`info`],Q=M!==void 0&&M>0?{"--wui-confirm-icon-size":`${M}px`}:void 0,$=()=>{I||F?.()};return/* @__PURE__ */ d(a,{...y,...H,open:S,hideHeader:!0,title:C,onClose:$,staticBackdrop:L,closeOnEscape:!L,placement:R,size:z,className:[`wui-confirm`,Y&&`wui-confirm-plain`,B].filter(Boolean).join(` `),footer:/* @__PURE__ */ f(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ d(n,{tone:`neutral`,...Y?{}:{variant:`soft`},size:X,disabled:I,onClick:$,children:D}),/* @__PURE__ */ d(n,{tone:k===`danger`?`danger`:void 0,size:X,disabled:G,loading:I,onClick:P,children:E})]}),children:/* @__PURE__ */ f(`div`,{className:`wui-confirm-content`,children:[!Y&&A?/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:/* @__PURE__ */ d(`img`,{src:A,alt:``,"aria-hidden":`true`})}):!Y&&j?/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:typeof j==`string`?/* @__PURE__ */ d(r,{name:j,size:80}):j}):Z&&/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:/* @__PURE__ */ d(Z,{size:120})}),/* @__PURE__ */ d(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:C}),T&&/* @__PURE__ */ d(`p`,{className:`wui-confirm-msg`,children:T}),V!=null&&V!==!1&&/* @__PURE__ */ d(`div`,{className:`wui-confirm-body`,children:V}),N&&/* @__PURE__ */ d(i,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ f(u,{children:[K,/* @__PURE__ */ d(`strong`,{children:N}),J]}),value:U,onChange:e=>W(e.target.value),"aria-label":m(O,{phrase:N}),disabled:I})]})})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./AppConfirmDialog.js";import{createContext as
|
|
1
|
+
import e from"../lib/useWuiText.js";import t from"./AppConfirmDialog.js";import{createContext as n,useCallback as r,useContext as i,useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{CONFIRM_PROVIDER_TEXT as u}from"@webority/ui-elements/text";var d=n(null);function f(n){let{children:i}=n,f=e(`confirmProvider`,u),[p,m]=s(null),[h,g]=s(!1),_=o(null),v=r((e={})=>new Promise(t=>{_.current?.(!1),_.current=t,m({...e,title:e.title||f.title})}),[f.title]),y=e=>{_.current?.(e),_.current=null,g(!1),m(null)};return a(()=>()=>_.current?.(!1),[]),/* @__PURE__ */ l(d.Provider,{value:v,children:[i,/* @__PURE__ */ c(t,{open:!!p,title:p?.title,description:p?.description,confirmLabel:p?.confirmLabel,cancelLabel:p?.cancelLabel,tone:p?.tone,icon:p?.icon,confirmPhrase:p?.confirmPhrase,loading:h,onConfirm:async()=>{let e=p?.onRun;if(typeof e!=`function`)y(!0);else{g(!0);try{await e(),y(!0)}catch{g(!1)}}},onClose:()=>y(!1)})]})}function p(){let e=i(d);if(!e)throw Error(`useConfirm needs an <AppConfirmProvider> above it.`);return e}export{f as default,p as useConfirm};
|