@webority/ui-react 0.121.0 → 0.124.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.
Files changed (214) hide show
  1. package/dist/canvas-kit/kit.css +2 -0
  2. package/dist/canvas-kit/kit.js +33568 -34365
  3. package/dist/canvas-kit/manifest.json +240 -3
  4. package/dist/canvas-kit/release.json +8 -8
  5. package/dist/components/AppAccordion.js +1 -1
  6. package/dist/components/AppActionIcon.js +1 -1
  7. package/dist/components/AppAlert.js +1 -1
  8. package/dist/components/AppAsyncBlock.js +1 -1
  9. package/dist/components/AppAutocomplete.js +1 -1
  10. package/dist/components/AppAvatar.js +1 -1
  11. package/dist/components/AppAvatarGroup.js +1 -1
  12. package/dist/components/AppBadge.js +1 -1
  13. package/dist/components/AppBanner.js +1 -1
  14. package/dist/components/AppBreadcrumbs.js +1 -1
  15. package/dist/components/AppButton.js +1 -1
  16. package/dist/components/AppButtonGroup.js +1 -1
  17. package/dist/components/AppCalendar.js +1 -1
  18. package/dist/components/AppCard.js +1 -1
  19. package/dist/components/AppCarousel.js +1 -1
  20. package/dist/components/AppChart.js +1 -1
  21. package/dist/components/AppChartCard.js +1 -1
  22. package/dist/components/AppCheckbox.js +1 -1
  23. package/dist/components/AppChip.js +1 -1
  24. package/dist/components/AppChipGroup.js +1 -1
  25. package/dist/components/AppChoiceCard.js +1 -1
  26. package/dist/components/AppChoiceChip.js +1 -1
  27. package/dist/components/AppCodeBlock.js +1 -1
  28. package/dist/components/AppColorField.js +1 -1
  29. package/dist/components/AppColumnMenu.js +1 -1
  30. package/dist/components/AppCommandPalette.js +1 -1
  31. package/dist/components/AppCommentThread.js +1 -1
  32. package/dist/components/AppCompareTable.js +1 -1
  33. package/dist/components/AppConfirmDialog.js +1 -1
  34. package/dist/components/AppConfirmProvider.js +1 -0
  35. package/dist/components/AppConsentBanner.js +1 -1
  36. package/dist/components/AppContextMenu.js +1 -1
  37. package/dist/components/AppCopyButton.js +1 -1
  38. package/dist/components/AppCountryFlag.js +1 -1
  39. package/dist/components/AppCountrySelect.js +1 -1
  40. package/dist/components/AppDashboardCell.js +1 -1
  41. package/dist/components/AppDashboardGrid.js +1 -1
  42. package/dist/components/AppDataTable.js +1 -1
  43. package/dist/components/AppDatePicker.js +1 -1
  44. package/dist/components/AppDateRangePicker.js +1 -1
  45. package/dist/components/AppDescriptions.js +1 -1
  46. package/dist/components/AppDetailPane.js +1 -1
  47. package/dist/components/AppDrawer.js +1 -1
  48. package/dist/components/AppDropZone.js +1 -1
  49. package/dist/components/AppDropdown.js +1 -1
  50. package/dist/components/AppDueDate.js +1 -1
  51. package/dist/components/AppEmptyState.js +1 -1
  52. package/dist/components/AppErrorSummary.js +1 -1
  53. package/dist/components/AppFileAttachment.js +1 -1
  54. package/dist/components/AppFilePicker.js +1 -1
  55. package/dist/components/AppFileTiles.js +1 -1
  56. package/dist/components/AppFileViewer.js +1 -1
  57. package/dist/components/AppFilterBar.js +1 -1
  58. package/dist/components/AppFloatingDock.js +1 -1
  59. package/dist/components/AppFormActions.js +1 -1
  60. package/dist/components/AppFormRow.js +1 -1
  61. package/dist/components/AppFormSection.js +1 -1
  62. package/dist/components/AppHoverCard.js +1 -1
  63. package/dist/components/AppIcon.js +1 -1
  64. package/dist/components/AppImagePicker.js +1 -1
  65. package/dist/components/AppInfoTip.js +1 -1
  66. package/dist/components/AppInlineEdit.js +1 -1
  67. package/dist/components/AppInput.js +1 -1
  68. package/dist/components/AppInputGroup.js +1 -1
  69. package/dist/components/AppKanban.js +1 -1
  70. package/dist/components/AppKbd.js +1 -1
  71. package/dist/components/AppKpiTile.js +1 -1
  72. package/dist/components/AppLightbox.js +1 -1
  73. package/dist/components/AppLink.js +1 -1
  74. package/dist/components/AppMarkdown.js +1 -1
  75. package/dist/components/AppMentionInput.js +1 -1
  76. package/dist/components/AppMeter.js +1 -1
  77. package/dist/components/AppMetricStrip.js +1 -1
  78. package/dist/components/AppModal.js +1 -1
  79. package/dist/components/AppMultiSelect.js +1 -1
  80. package/dist/components/AppNavList.js +1 -1
  81. package/dist/components/AppNavigationMenu.js +1 -1
  82. package/dist/components/AppNotificationCenter.js +1 -1
  83. package/dist/components/AppNumberInput.js +1 -1
  84. package/dist/components/AppOnboardingChecklist.js +1 -1
  85. package/dist/components/AppOtpInput.js +1 -1
  86. package/dist/components/AppPageHeader.js +1 -1
  87. package/dist/components/AppPhoneNumberInput.js +1 -1
  88. package/dist/components/AppPopover.js +1 -1
  89. package/dist/components/AppPricingCard.js +1 -1
  90. package/dist/components/AppProgress.js +1 -1
  91. package/dist/components/AppQrCode.js +1 -1
  92. package/dist/components/AppRadio.js +1 -1
  93. package/dist/components/AppRadioGroup.js +1 -1
  94. package/dist/components/AppRating.js +1 -1
  95. package/dist/components/AppRecordPager.js +1 -1
  96. package/dist/components/AppRelativeTime.js +1 -1
  97. package/dist/components/AppRepeater.js +1 -1
  98. package/dist/components/AppRequiredMark.js +1 -1
  99. package/dist/components/AppResizable.js +1 -1
  100. package/dist/components/AppResizableHandle.js +1 -1
  101. package/dist/components/AppResizablePanel.js +1 -1
  102. package/dist/components/AppResourceCard.js +1 -1
  103. package/dist/components/AppResult.js +1 -1
  104. package/dist/components/AppRichText.js +1 -1
  105. package/dist/components/AppRollingNumber.js +1 -1
  106. package/dist/components/AppRouteError.js +1 -1
  107. package/dist/components/AppRowSwitch.js +1 -0
  108. package/dist/components/AppScoreScale.js +1 -1
  109. package/dist/components/AppScrollbar.js +1 -1
  110. package/dist/components/AppSearch.js +1 -1
  111. package/dist/components/AppSectionCallToAction.js +1 -1
  112. package/dist/components/AppSectionFaq.js +1 -1
  113. package/dist/components/AppSectionFeatures.js +1 -1
  114. package/dist/components/AppSectionHero.js +1 -1
  115. package/dist/components/AppSectionLeadCapture.js +1 -1
  116. package/dist/components/AppSectionLogos.js +1 -1
  117. package/dist/components/AppSectionPricing.js +1 -1
  118. package/dist/components/AppSectionTestimonials.js +1 -1
  119. package/dist/components/AppSegmented.js +1 -1
  120. package/dist/components/AppSelect.js +1 -1
  121. package/dist/components/AppSeoHead.js +1 -1
  122. package/dist/components/AppShell.js +1 -1
  123. package/dist/components/AppShortcutLegend.js +1 -1
  124. package/dist/components/AppShowMore.js +1 -1
  125. package/dist/components/AppSkeleton.js +1 -1
  126. package/dist/components/AppSkeletonLines.js +1 -1
  127. package/dist/components/AppSlider.js +1 -1
  128. package/dist/components/AppSortableList.js +1 -1
  129. package/dist/components/AppSparkline.js +1 -1
  130. package/dist/components/AppSpinner.js +1 -1
  131. package/dist/components/AppSplash.js +1 -1
  132. package/dist/components/AppSplitButton.js +1 -1
  133. package/dist/components/AppSplitView.js +1 -1
  134. package/dist/components/AppStatusBadge.js +1 -1
  135. package/dist/components/AppStepper.js +1 -1
  136. package/dist/components/AppSwitch.js +1 -1
  137. package/dist/components/AppTablePagination.js +1 -1
  138. package/dist/components/AppTableToolbar.js +1 -1
  139. package/dist/components/AppTabs.js +1 -1
  140. package/dist/components/AppTagInput.js +1 -1
  141. package/dist/components/AppTextarea.js +1 -1
  142. package/dist/components/AppThemeToggle.js +1 -1
  143. package/dist/components/AppTimePicker.js +1 -1
  144. package/dist/components/AppTimeline.js +1 -1
  145. package/dist/components/AppToast.js +1 -1
  146. package/dist/components/AppToolbar.js +1 -1
  147. package/dist/components/AppTooltip.js +1 -1
  148. package/dist/components/AppTour.js +1 -1
  149. package/dist/components/AppTreeView.js +1 -1
  150. package/dist/components/AppTruncate.js +1 -1
  151. package/dist/components/AppUpdateBar.js +1 -1
  152. package/dist/components/AppWhatsNew.js +1 -1
  153. package/dist/components/AppWizard.js +1 -1
  154. package/dist/components/AppWorkspaceSwitcher.js +1 -1
  155. package/dist/components/ModalIcons.js +1 -1
  156. package/dist/components/iconCatalogNames.g.js +1 -1
  157. package/dist/components/iconGlyphs.g.js +1 -1
  158. package/dist/components/iconVariants.g.js +1 -1
  159. package/dist/components/toast.js +1 -1
  160. package/dist/components/toastStore.js +1 -1
  161. package/dist/components/useWuiControl.js +1 -1
  162. package/dist/components/warnInvalidValue.js +1 -1
  163. package/dist/components/warnUnknownProps.js +1 -1
  164. package/dist/components/withTooltip.js +1 -1
  165. package/dist/guidance.json +60 -1
  166. package/dist/lib/CheckField.js +1 -1
  167. package/dist/lib/DiscardPrompt.js +1 -1
  168. package/dist/lib/FieldMessage.js +1 -1
  169. package/dist/lib/FileItemRow.js +1 -1
  170. package/dist/lib/FocusPanel.js +1 -1
  171. package/dist/lib/emptyIllustration.js +1 -1
  172. package/dist/lib/fileItem.js +1 -1
  173. package/dist/lib/flagStyles.js +1 -0
  174. package/dist/lib/initials.js +1 -1
  175. package/dist/lib/pageScrollLock.js +1 -0
  176. package/dist/lib/qrCode.js +1 -1
  177. package/dist/lib/sectionShell.js +1 -1
  178. package/dist/lib/shellCookie.js +1 -1
  179. package/dist/lib/shortcutChip.js +1 -1
  180. package/dist/lib/useFileDrop.js +1 -1
  181. package/dist/lib/useFloatingStack.js +1 -1
  182. package/dist/lib/useListQuery.js +1 -1
  183. package/dist/lib/wuiMarker.js +1 -1
  184. package/dist/markdown-core/dist/citations.js +1 -0
  185. package/dist/markdown-core/dist/inline.js +1 -1
  186. package/dist/types/components/AppAutocomplete.d.ts +12 -1
  187. package/dist/types/components/AppChart.d.ts +2 -0
  188. package/dist/types/components/AppColorField.d.ts +6 -0
  189. package/dist/types/components/AppConfirmDialog.d.ts +3 -0
  190. package/dist/types/components/AppConfirmProvider.d.ts +27 -0
  191. package/dist/types/components/AppCountrySelect.d.ts +5 -0
  192. package/dist/types/components/AppDatePicker.d.ts +5 -0
  193. package/dist/types/components/AppDateRangePicker.d.ts +5 -0
  194. package/dist/types/components/AppFilePicker.d.ts +6 -0
  195. package/dist/types/components/AppImagePicker.d.ts +6 -0
  196. package/dist/types/components/AppMarkdown.d.ts +4 -0
  197. package/dist/types/components/AppMultiSelect.d.ts +5 -0
  198. package/dist/types/components/AppNumberInput.d.ts +5 -0
  199. package/dist/types/components/AppOtpInput.d.ts +5 -0
  200. package/dist/types/components/AppPhoneNumberInput.d.ts +5 -0
  201. package/dist/types/components/AppRadioGroup.d.ts +6 -0
  202. package/dist/types/components/AppRepeater.d.ts +2 -2
  203. package/dist/types/components/AppRowSwitch.d.ts +23 -0
  204. package/dist/types/components/AppSelect.d.ts +5 -0
  205. package/dist/types/components/AppSlider.d.ts +5 -0
  206. package/dist/types/components/AppTagInput.d.ts +5 -0
  207. package/dist/types/components/AppTimePicker.d.ts +5 -0
  208. package/dist/types/components/iconGlyphs.g.d.ts +11 -0
  209. package/dist/types/components/iconVariants.g.d.ts +55 -0
  210. package/dist/types/index.d.ts +2 -0
  211. package/dist/types/lib/flagStyles.d.ts +2 -0
  212. package/dist/types/lib/pageScrollLock.d.ts +1 -0
  213. package/dist/ui-react.js +1 -1
  214. package/package.json +6 -6
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{shortcutAria as i,shortcutChip as a}from"../lib/shortcutChip.js";import o from"./withTooltip.js";import s from"./AppIcon.js";import c from"./renderIconProp.js";import{Fragment as l,forwardRef as u,useEffect as d,useRef as f,useState as p}from"react";import{Dropdown as m}from"react-bootstrap";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`sm`,`md`,`lg`,`xl`],v=[`neutral`],y=[`sm`,`md`,`lg`],b=e=>{e.preventDefault(),e.stopPropagation()},x=u(function(e,t){return h(`button`,{...e,ref:t,"aria-disabled":`true`})}),S=!1;function C(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||S||(S=!0,t("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function w(s){let{marker:u,props:S}=e(`AppDropdown`,s),{icon:w,iconSize:E,toggleClassName:D,toggleVariant:O,menuWidth:k,label:A,ariaLabel:j,align:M=`end`,items:N=[],menuClassName:P=``,linkComponent:F,children:I,trigger:L,show:R,onToggle:z,...B}=S;r(`AppDropdown`,B);for(let e of N)n(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,_);!L&&!j&&!A&&C(),n(`AppDropdown`,`toggleVariant`,O,v),n(`AppDropdown`,`menuWidth`,k,y),O&&!L&&t(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let V=(D??(L?`wui-dropdown-trigger`:`topbar-icon-btn`))+(L&&O===`neutral`?` wui-dropdown-trigger-neutral`:``),H=[P,y.includes(k)?`wui-dropdown-menu-${k}`:``].filter(Boolean).join(` `),U=R!==void 0,[W,G]=p(!1),K=U?!!R:W,q=f(null);q.current=(e,t)=>{U||G(e),z?.(e,t)};let J=f(null);return d(()=>{if(!K)return;let e=J.current?.getBoundingClientRect(),t=()=>{let t=J.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&q.current(!1,{source:`scroll`})},n=()=>q.current(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[K]),g(m,{ref:J,align:M,show:K,onToggle:(e,t)=>q.current(e,t),...u,...B,children:[h(m.Toggle,{as:T,icon:w,iconSize:E,btnClassName:V,trigger:L,title:A,"aria-label":j??(L?void 0:A)}),h(m.Menu,{className:H,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:I??N.map(e=>{if(e.header!=null)return h(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return h(m.Divider,{},e.key);if(e.disabled)return h(l,{children:o(g(m.Item,{as:x,type:`button`,className:[e.danger&&`danger`,`wui-dropdown-item-disabled`].filter(Boolean).join(` `),onClick:b,children:[e.image?h(`img`,{src:e.image,alt:``}):c(e.icon,{size:16}),e.label,e.disabledReason&&g(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let t=e.to?F?{as:F,to:e.to}:{as:`a`,href:e.to}:{as:`button`,type:`button`},n=[e.danger&&`danger`,_.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return g(m.Item,{...t,onClick:e.onClick,className:n,"aria-keyshortcuts":i(e.shortcut),children:[e.image?h(`img`,{src:e.image,alt:``}):c(e.icon,{size:16}),e.label,a(e.shortcut)]},e.key)})})]})}var T=u(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":i,className:a,...o},c){return h(`button`,{ref:c,type:`button`,className:n,"aria-label":i,...o,children:r??h(s,{name:e,size:t})})});export{w as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./renderIconProp.js";import o from"./warnInvalidValue.js";import s from"./warnUnknownProps.js";import c from"./withTooltip.js";import{Fragment as l,forwardRef as u,useEffect as d,useRef as f,useState as p}from"react";import{Dropdown as m}from"react-bootstrap";import{jsx as h,jsxs as g}from"react/jsx-runtime";var _=[`sm`,`md`,`lg`,`xl`],v=[`neutral`],y=[`sm`,`md`,`lg`],b=e=>{e.preventDefault(),e.stopPropagation()},x=u(function(e,t){return/* @__PURE__ */ h(`button`,{...e,ref:t,"aria-disabled":`true`})}),S=!1;function C(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!S&&(S=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function w(i){let{marker:u,props:S}=r(`AppDropdown`,i),{icon:w,iconSize:E,toggleClassName:D,toggleVariant:O,menuWidth:k,label:A,ariaLabel:j,align:M=`end`,items:N=[],menuClassName:P=``,linkComponent:F,children:I,trigger:L,show:R,onToggle:z,...B}=S;s(`AppDropdown`,B);for(let e of N)o(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,_);L||j||A||C(),o(`AppDropdown`,`toggleVariant`,O,v),o(`AppDropdown`,`menuWidth`,k,y),O&&!L&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let V=(D??(L?`wui-dropdown-trigger`:`topbar-icon-btn`))+(L&&O===`neutral`?` wui-dropdown-trigger-neutral`:``),H=[P,y.includes(k)?`wui-dropdown-menu-${k}`:``].filter(Boolean).join(` `),U=R!==void 0,[W,G]=p(!1),K=U?!!R:W,q=f(null);q.current=(e,t)=>{U||G(e),z?.(e,t)};let J=f(null);return d(()=>{if(!K)return;let e=J.current?.getBoundingClientRect(),t=()=>{let t=J.current?.getBoundingClientRect();(!e||!t||Math.abs(t.top-e.top)>2||Math.abs(t.left-e.left)>2)&&q.current(!1,{source:`scroll`})},n=()=>q.current(!1,{source:`resize`});return window.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,t,{capture:!0}),window.removeEventListener(`resize`,n)}},[K]),/* @__PURE__ */ g(m,{ref:J,align:M,show:K,onToggle:(e,t)=>q.current(e,t),...u,...B,children:[/* @__PURE__ */ h(m.Toggle,{as:T,icon:w,iconSize:E,btnClassName:V,trigger:L,title:A,"aria-label":j??(L?void 0:A)}),/* @__PURE__ */ h(m.Menu,{className:H,renderOnMount:!0,popperConfig:{strategy:`fixed`},children:I??N.map(e=>{if(e.header!=null)return/* @__PURE__ */ h(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ h(m.Divider,{},e.key);if(e.disabled)return/* @__PURE__ */ h(l,{children:c(/* @__PURE__ */ g(m.Item,{as:x,type:`button`,className:[e.danger&&`danger`,`wui-dropdown-item-disabled`].filter(Boolean).join(` `),onClick:b,children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):a(e.icon,{size:16}),e.label,e.disabledReason&&/* @__PURE__ */ g(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let r=e.to?F?{as:F,to:e.to}:{as:`a`,href:e.to}:{as:`button`,type:`button`},i=[e.danger&&`danger`,_.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0;return/* @__PURE__ */ g(m.Item,{...r,onClick:e.onClick,className:i,"aria-keyshortcuts":t(e.shortcut),children:[e.image?/* @__PURE__ */ h(`img`,{src:e.image,alt:``}):a(e.icon,{size:16}),e.label,n(e.shortcut)]},e.key)})})]})}var T=u(function({icon:e,iconSize:t=20,btnClassName:n=`topbar-icon-btn`,trigger:r,"aria-label":a,className:o,...s},c){return/* @__PURE__ */ h(`button`,{ref:c,type:`button`,className:n,"aria-label":a,...s,children:r??/* @__PURE__ */ h(i,{name:e,size:t})})});export{w as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{formatDate as i,toInstant as a}from"@webority/ui-elements/helpers";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=864e5,l=330*6e4,u=14,d=[`days`,`due`],f=e=>Math.floor((e+l)/c),p=(...e)=>e.filter(Boolean).join(` `),m=(e,t)=>e===`due`?t===0?`Due today`:t===1?`Due tomorrow`:`Due in ${t} days`:t===1?`1 day left`:`${t} days left`;function h(l){let{marker:h,props:g}=e(`AppDueDate`,l),{date:_,soonDays:v,soonWording:y=`days`,icon:b=!1,overdue:x=!1,overdueLabel:S,className:C=``,...w}=g;n(`AppDueDate`,w),t(`AppDueDate`,`soonWording`,y,d);let T=a(_);if(!Number.isFinite(T))return o(`wui-due-date`,{class:p(`wui-due-date`,`wui-due-date-empty`,C),...h,...w,children:o(`time`,{children:`Not set`})});let E=f(T),D=new Date(E*c).toISOString().slice(0,10),O=E-f(Date.now()),k=b?o(r,{name:`calendar`,size:u}):null;if(x){let e=i(T);return s(`wui-due-date`,{class:p(`wui-due-date`,`wui-due-date-danger`,C),title:`Overdue since ${e}`,...h,...w,children:[o(r,{name:`danger`,size:u}),k,o(`time`,{dateTime:D,children:S||e})]})}return Number.isFinite(v)&&O>=0&&O<=v?s(`wui-due-date`,{class:p(`wui-due-date`,`wui-due-date-warning`,C),...h,...w,children:[k,o(`time`,{dateTime:D,children:m(y,O)})]}):s(`wui-due-date`,{class:p(`wui-due-date`,C),...h,...w,children:[k,o(`time`,{dateTime:D,children:i(T)})]})}export{h as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{formatDate as i,toInstant as a}from"@webority/ui-elements/helpers";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=864e5,l=198e5,u=14,d=[`days`,`due`],f=e=>Math.floor((e+l)/c),p=(...e)=>e.filter(Boolean).join(` `),m=(e,t)=>e===`due`?t===0?`Due today`:t===1?`Due tomorrow`:`Due in ${t} days`:t===1?`1 day left`:`${t} days left`;function h(l){let{marker:h,props:g}=e(`AppDueDate`,l),{date:_,soonDays:v,soonWording:y=`days`,icon:b=!1,overdue:x=!1,overdueLabel:S,className:C=``,...w}=g;r(`AppDueDate`,w),n(`AppDueDate`,`soonWording`,y,d);let T=a(_);if(!Number.isFinite(T))return/* @__PURE__ */ o(`wui-due-date`,{class:p(`wui-due-date`,`wui-due-date-empty`,C),...h,...w,children:/* @__PURE__ */ o(`time`,{children:`Not set`})});let E=f(T),D=(/* @__PURE__ */ new Date(E*c)).toISOString().slice(0,10),O=E-f(Date.now()),k=b?/* @__PURE__ */ o(t,{name:`calendar`,size:u}):null;if(x){let e=i(T);return/* @__PURE__ */ s(`wui-due-date`,{class:p(`wui-due-date`,`wui-due-date-danger`,C),title:`Overdue since ${e}`,...h,...w,children:[/* @__PURE__ */ o(t,{name:`danger`,size:u}),k,/* @__PURE__ */ o(`time`,{dateTime:D,children:S||e})]})}return Number.isFinite(v)&&O>=0&&O<=v?/* @__PURE__ */ s(`wui-due-date`,{class:p(`wui-due-date`,`wui-due-date-warning`,C),...h,...w,children:[k,/* @__PURE__ */ o(`time`,{dateTime:D,children:m(y,O)})]}):/* @__PURE__ */ s(`wui-due-date`,{class:p(`wui-due-date`,C),...h,...w,children:[k,/* @__PURE__ */ o(`time`,{dateTime:D,children:i(T)})]})}export{h as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./renderIconProp.js";import a,{ILLUSTRATION_NAMES as o}from"../lib/emptyIllustration.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`md`,`sm`],u=[`card`,`table`],d=!1;function f(f){let{marker:p,props:m}=e(`AppEmptyState`,f),{icon:h,illustration:g,iconSize:_=24,size:v=`md`,variant:y=`card`,title:b,text:x,action:S,className:C=``,style:w,...T}=m;r(`AppEmptyState`,T),n(`AppEmptyState`,`size`,v,l),n(`AppEmptyState`,`variant`,y,u),y===`table`&&v===`sm`&&!d&&(d=!0,t(`[@webority/ui-react] <AppEmptyState> size="sm" has no table look; variant="table" uses the md scale.`)),typeof g==`string`&&n(`AppEmptyState`,`illustration`,g,o);let E=typeof g==`string`&&o.includes(g),D=g!=null&&typeof g!=`string`?g:null;return c(`div`,{className:[`empty-state`,v===`sm`?`empty-state-sm`:``,y===`table`?`wui-empty-state-table`:``,C].filter(Boolean).join(` `),style:w,...p,...T,children:[E?s(a,{name:g,className:`wui-empty-illustration`}):null,D?s(`span`,{className:`wui-empty-illustration wui-empty-illustration-custom`,"aria-hidden":`true`,children:D}):null,h&&!E&&!D?s(`div`,{className:`empty-state-icon`,children:i(h,{size:_})}):null,b!=null&&s(`div`,{className:`empty-state-title`,children:b}),x!=null&&s(`div`,{className:`empty-state-message`,children:x}),S&&s(`div`,{className:`empty-state-action`,children:S})]})}export{f as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t,{ILLUSTRATION_NAMES as n}from"../lib/emptyIllustration.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./renderIconProp.js";import a from"./warnInvalidValue.js";import o from"./warnUnknownProps.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`md`,`sm`],u=[`card`,`table`],d=!1;function f(f){let{marker:p,props:m}=r(`AppEmptyState`,f),{icon:h,illustration:g,iconSize:_=24,size:v=`md`,variant:y=`card`,title:b,text:x,action:S,className:C=``,style:w,...T}=m;o(`AppEmptyState`,T),a(`AppEmptyState`,`size`,v,l),a(`AppEmptyState`,`variant`,y,u),y===`table`&&v===`sm`&&!d&&(d=!0,e(`[@webority/ui-react] <AppEmptyState> size="sm" has no table look; variant="table" uses the md scale.`)),typeof g==`string`&&a(`AppEmptyState`,`illustration`,g,n);let E=typeof g==`string`&&n.includes(g),D=g!=null&&typeof g!=`string`?g:null,O=[`empty-state`,v===`sm`?`empty-state-sm`:``,y===`table`?`wui-empty-state-table`:``,C].filter(Boolean).join(` `);return/* @__PURE__ */ c(`div`,{className:O,style:w,...p,...T,children:[E?/* @__PURE__ */ s(t,{name:g,className:`wui-empty-illustration`}):null,D?/* @__PURE__ */ s(`span`,{className:`wui-empty-illustration wui-empty-illustration-custom`,"aria-hidden":`true`,children:D}):null,h&&!E&&!D?/* @__PURE__ */ s(`div`,{className:`empty-state-icon`,children:i(h,{size:_})}):null,b!=null&&/* @__PURE__ */ s(`div`,{className:`empty-state-title`,children:b}),x!=null&&/* @__PURE__ */ s(`div`,{className:`empty-state-message`,children:x}),S&&/* @__PURE__ */ s(`div`,{className:`empty-state-action`,children:S})]})}export{f as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"../lib/focusField.js";import{useEffect as r,useId as i,useRef as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";function c(c){let{marker:l,props:u}=e(`AppErrorSummary`,c),{errors:d=[],title:f,autoFocus:p=!0,id:m,className:h=``,...g}=u;t(`AppErrorSummary`,g);let _=i(),v=m||_,y=a(null),b=a(0),x=d.length;return r(()=>{p&&x>0&&b.current===0&&y.current?.focus(),b.current=x},[x,p]),x?s(`div`,{ref:y,className:[`alert alert-danger wui-error-summary`,h].filter(Boolean).join(` `),role:`alert`,tabIndex:-1,"aria-labelledby":`${v}-title`,id:v,"data-autofocus":p?``:void 0,...l,...g,children:[o(`h2`,{className:`wui-error-summary-title`,id:`${v}-title`,children:f??`Fix ${x} field${x>1?`s`:``} to continue`}),o(`ul`,{className:`wui-error-summary-list`,children:d.map(e=>o(`li`,{children:o(`a`,{href:`#${e.field}`,onClick:t=>{t.preventDefault(),n(e.field)},children:e.message})},`${e.field}:${e.message}`))})]}):null}export{c as default};
1
+ import e from"../lib/focusField.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{useEffect as r,useId as i,useRef as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";function c(c){let{marker:l,props:u}=t(`AppErrorSummary`,c),{errors:d=[],title:f,autoFocus:p=!0,id:m,className:h=``,...g}=u;n(`AppErrorSummary`,g);let _=i(),v=m||_,y=a(null),b=a(0),x=d.length;return r(()=>{p&&x>0&&b.current===0&&y.current?.focus(),b.current=x},[x,p]),x?/* @__PURE__ */ s(`div`,{ref:y,className:[`alert alert-danger wui-error-summary`,h].filter(Boolean).join(` `),role:`alert`,tabIndex:-1,"aria-labelledby":`${v}-title`,id:v,"data-autofocus":p?``:void 0,...l,...g,children:[/* @__PURE__ */ o(`h2`,{className:`wui-error-summary-title`,id:`${v}-title`,children:f??`Fix ${x} field${x>1?`s`:``} to continue`}),/* @__PURE__ */ o(`ul`,{className:`wui-error-summary-list`,children:d.map(t=>/* @__PURE__ */ o(`li`,{children:/* @__PURE__ */ o(`a`,{href:`#${t.field}`,onClick:n=>{n.preventDefault(),e(t.field)},children:t.message})},`${t.field}:${t.message}`))})]}):null}export{c as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"./AppProgress.js";import i from"../lib/FieldMessage.js";import a from"../lib/useFileDrop.js";import{keyOf as o,linkOf as s,nameOf as c,sizeLabelOf as l,uploadErrorOf as u,uploadProgressOf as d,useItemUrl as f}from"../lib/fileItem.js";import p from"../lib/FileItemRow.js";import{DEFAULT_IMAGE_ACCEPT as m,DEFAULT_MAX_SIZE_MB as h,acceptDroppedFiles as g,acceptLabel as _,isImageFile as v,isImageOnlyAccept as y}from"@webority/ui-elements/helpers";import{useId as b,useState as ee}from"react";import{Fragment as x,jsx as S,jsxs as C}from"react/jsx-runtime";function w(r){let{marker:c,props:l}=e(`AppFileAttachment`,r),{label:u=`Attachment`,value:d,name:f,onChange:_,multiple:w=!1,accept:D=m,maxSizeMb:O=h,optional:k=!1,validate:A=!0,error:j,id:M,...N}=l;t(`AppFileAttachment`,N);let P=b(),F=M||P,[I,L]=ee(``),R=w&&Array.isArray(d)?d:d?[d]:[],z=y(D),B=e=>e instanceof File?v(e):z||v(e),V=!w&&R.length===1&&B(R[0])&&(R[0]instanceof File||s(R[0])!==null),H=T(D,O),U=A?{accept:D,maxSizeMb:O,multiple:w}:{accept:``,maxSizeMb:0,multiple:w};function W(e){if(L(``),w){let t=Array.isArray(d)?d:d?[d]:[],n=new Set(t.map(o)),r=t.concat(e.filter(e=>!n.has(o(e))));_(r)}else _(e[0])}function G(e){if(!e.length)return;let{files:t,rejections:n}=g(e,U);t.length&&W(t),L(n[0]?.message??``)}let{dragOver:K,dropProps:q}=a({...U,disabled:N.disabled,onFiles:W,onReject:e=>L(e.message)});function J(e){let t=Array.from(e.target.files||[]);e.target.value=``,G(t)}function Y(e){L(``),_(w?R.filter((t,n)=>n!==e):null)}let X=j||I,Z=X?`${F}-error`:void 0,Q=w||R.length===0,$=z?`image`:`file`,te=w?`Add ${$}s`:`Add ${z?`an`:`a`} ${$}`;return C(`div`,{...c,className:`field`,children:[C(`label`,{className:`label`,htmlFor:F,children:[u,k&&S(`span`,{className:`label-optional`,children:` (optional)`})]}),Q&&C(x,{children:[C(`label`,{className:`attach-drop${K?` dragging`:``}`,htmlFor:F,...q,children:[S(`span`,{className:`attach-drop-icon`,children:S(n,{name:z?`image`:`file-text`,size:18})}),C(`span`,{className:`attach-drop-copy`,children:[S(`span`,{className:`attach-drop-title`,children:te}),H&&S(`span`,{className:`attach-drop-hint`,children:H})]}),S(`span`,{className:`attach-drop-cta`,children:`Browse`})]}),S(`input`,{id:F,type:`file`,className:`visually-hidden`,name:f,accept:D||void 0,multiple:w||void 0,"aria-describedby":Z,onChange:J,...N})]}),V?S(E,{item:R[0],isImage:!0,onRemove:()=>Y(0)}):R.length>0&&S(`div`,{className:`attach-list`,children:R.map((e,t)=>S(p,{item:e,isImage:B(e),onRemove:()=>Y(t)},o(e)))}),S(i,{error:X,errorId:`${F}-error`})]})}function T(e,t){let n=e?.trim()?_(e):``,r=t>0?`up to ${t} MB`:``;return n&&r?`${n}, ${r}`:r?`Up to ${t} MB`:n}function E({item:e,isImage:t,onRemove:i}){let a=f(e,t),o=c(e),p=l(e),m=d(e),h=u(e),g=s(e);return C(`div`,{className:h?`attach-preview wui-attach-failed`:`attach-preview`,children:[C(`div`,{className:`attach-figure`,children:[S(`img`,{src:a,alt:o}),S(`button`,{type:`button`,className:`attach-remove`,"aria-label":`Remove attachment`,onClick:i,children:S(n,{name:`x`,size:18})})]}),C(`div`,{className:`attach-meta`,children:[S(`div`,{className:`attach-name`,children:g?S(`a`,{href:g,children:o}):o}),p&&S(`div`,{className:`attach-size`,children:p})]}),m!==null&&S(r,{value:m,size:`sm`,label:`Uploading ${o}`,className:`wui-attach-progress`}),h&&S(`div`,{className:`wui-attach-error`,children:h})]})}export{w as default};
1
+ import e from"../lib/FieldMessage.js";import t from"../lib/FileItemRow.js";import{keyOf as n,linkOf as r,nameOf as i,sizeLabelOf as a,uploadErrorOf as o,uploadProgressOf as s,useItemUrl as c}from"../lib/fileItem.js";import l from"../lib/useFileDrop.js";import{splitMarkerProps as u}from"../lib/wuiMarker.js";import d from"./AppIcon.js";import f from"./AppProgress.js";import p from"./warnUnknownProps.js";import{DEFAULT_IMAGE_ACCEPT as m,DEFAULT_MAX_SIZE_MB as h,acceptDroppedFiles as g,acceptLabel as _,isImageFile as v,isImageOnlyAccept as y}from"@webority/ui-elements/helpers";import{useId as b,useState as ee}from"react";import{Fragment as x,jsx as S,jsxs as C}from"react/jsx-runtime";function w(i){let{marker:a,props:o}=u(`AppFileAttachment`,i),{label:s=`Attachment`,value:c,name:f,onChange:_,multiple:w=!1,accept:D=m,maxSizeMb:O=h,optional:k=!1,validate:A=!0,error:j,id:M,...N}=o;p(`AppFileAttachment`,N);let P=b(),F=M||P,[I,L]=ee(``),R=w&&Array.isArray(c)?c:c?[c]:[],z=y(D),B=e=>e instanceof File?v(e):z||v(e),V=!w&&R.length===1&&B(R[0])&&(R[0]instanceof File||r(R[0])!==null),H=T(D,O),U=A?{accept:D,maxSizeMb:O,multiple:w}:{accept:``,maxSizeMb:0,multiple:w};function W(e){if(L(``),w){let t=Array.isArray(c)?c:c?[c]:[],r=new Set(t.map(n)),i=t.concat(e.filter(e=>!r.has(n(e))));_(i)}else _(e[0])}function G(e){if(!e.length)return;let{files:t,rejections:n}=g(e,U);t.length&&W(t),L(n[0]?.message??``)}let{dragOver:K,dropProps:q}=l({...U,disabled:N.disabled,onFiles:W,onReject:e=>L(e.message)});function J(e){let t=Array.from(e.target.files||[]);e.target.value=``,G(t)}function Y(e){L(``),_(w?R.filter((t,n)=>n!==e):null)}let X=j||I,Z=X?`${F}-error`:void 0,Q=w||R.length===0,$=z?`image`:`file`,te=w?`Add ${$}s`:`Add ${z?`an`:`a`} ${$}`;return/* @__PURE__ */ C(`div`,{...a,className:`field`,children:[/* @__PURE__ */ C(`label`,{className:`label`,htmlFor:F,children:[s,k&&/* @__PURE__ */ S(`span`,{className:`label-optional`,children:` (optional)`})]}),Q&&/* @__PURE__ */ C(x,{children:[/* @__PURE__ */ C(`label`,{className:`attach-drop${K?` dragging`:``}`,htmlFor:F,...q,children:[/* @__PURE__ */ S(`span`,{className:`attach-drop-icon`,children:/* @__PURE__ */ S(d,{name:z?`image`:`file-text`,size:18})}),/* @__PURE__ */ C(`span`,{className:`attach-drop-copy`,children:[/* @__PURE__ */ S(`span`,{className:`attach-drop-title`,children:te}),H&&/* @__PURE__ */ S(`span`,{className:`attach-drop-hint`,children:H})]}),/* @__PURE__ */ S(`span`,{className:`attach-drop-cta`,children:`Browse`})]}),/* @__PURE__ */ S(`input`,{id:F,type:`file`,className:`visually-hidden`,name:f,accept:D||void 0,multiple:w||void 0,"aria-describedby":Z,onChange:J,...N})]}),V?/* @__PURE__ */ S(E,{item:R[0],isImage:!0,onRemove:()=>Y(0)}):R.length>0&&/* @__PURE__ */ S(`div`,{className:`attach-list`,children:R.map((e,r)=>/* @__PURE__ */ S(t,{item:e,isImage:B(e),onRemove:()=>Y(r)},n(e)))}),/* @__PURE__ */ S(e,{error:X,errorId:`${F}-error`})]})}function T(e,t){let n=e?.trim()?_(e):``,r=t>0?`up to ${t} MB`:``;return n&&r?`${n}, ${r}`:r?`Up to ${t} MB`:n}function E({item:e,isImage:t,onRemove:n}){let l=c(e,t),u=i(e),p=a(e),m=s(e),h=o(e),g=r(e);return/* @__PURE__ */ C(`div`,{className:h?`attach-preview wui-attach-failed`:`attach-preview`,children:[/* @__PURE__ */ C(`div`,{className:`attach-figure`,children:[/* @__PURE__ */ S(`img`,{src:l,alt:u}),/* @__PURE__ */ S(`button`,{type:`button`,className:`attach-remove`,"aria-label":`Remove attachment`,onClick:n,children:/* @__PURE__ */ S(d,{name:`x`,size:18})})]}),/* @__PURE__ */ C(`div`,{className:`attach-meta`,children:[/* @__PURE__ */ S(`div`,{className:`attach-name`,children:g?/* @__PURE__ */ S(`a`,{href:g,children:u}):u}),p&&/* @__PURE__ */ S(`div`,{className:`attach-size`,children:p})]}),m!==null&&/* @__PURE__ */ S(f,{value:m,size:`sm`,label:`Uploading ${u}`,className:`wui-attach-progress`}),h&&/* @__PURE__ */ S(`div`,{className:`wui-attach-error`,children:h})]})}export{w as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./withTooltip.js";import a from"./AppIcon.js";import ee from"../lib/FieldMessage.js";import te from"./AppRequiredMark.js";import ne from"./AppSpinner.js";import o from"../lib/useFileDrop.js";import{keyOf as s}from"../lib/fileItem.js";import re from"../lib/FileItemRow.js";import{DEFAULT_MAX_SIZE_MB as ie,acceptDroppedFiles as ae,acceptLabel as c,isImageFile as l,isImageOnlyAccept as oe,isPdfFile as se}from"@webority/ui-elements/helpers";import{useEffect as u,useId as ce,useRef as le,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`dropzone`,`button`];function h(h){let{marker:ue,props:de}=e(`AppFilePicker`,h),{label:g,value:_,name:fe,id:pe,onPick:v,multiple:y=!1,variant:b=`dropzone`,buttonLabel:me=`Add file`,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=ie,required:he,error:w,hint:T,loading:E=!1,className:D=``,fieldClassName:O=``,style:k,...A}=de;r(`AppFilePicker`,A),n(`AppFilePicker`,`variant`,b,m);let[ge,j]=d(null),[_e,M]=d(null),[N,P]=d(``),F=le(null),I=ce(),L=pe||I;u(()=>{if(!y&&_ instanceof File&&l(_)){let e=URL.createObjectURL(_);return j(e),()=>URL.revokeObjectURL(e)}j(null)},[_,y]);let R=!y&&_&&!l(_)&&se(_)?_ instanceof File?_:_.url:null;u(()=>{if(!R){M(null);return}let e=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof R==`string`?{url:R}:R)).then(t=>{e&&(n=URL.createObjectURL(t),M(n))}).catch(e=>t(`[AppFilePicker] the PDF preview failed:`,e?.message)),()=>{e=!1,M(null),n&&URL.revokeObjectURL(n)}},[R]);let z=y?Array.isArray(_)?_:_?[_]:[]:[],B=w||N,V=B?`${L}-error`:void 0,H=T&&!B?`${L}-hint`:void 0,ve=V||H,U=oe(S),ye=b===`button`,W=!y&&!!_,G=W&&(_ instanceof File?l(_):U||l(_)),be=_?.name,K=G?_?.url||ge:_e,q=G?`image`:`file`,xe=g?`Change ${g}`:`Change ${q}`,J=g?`Remove ${g}`:`Remove ${q}`,Se=g?`${g} preview`:`Selected ${q} preview`,Y={accept:S,maxSizeMb:C,multiple:y},X=e=>{if(P(``),!y){v(e[0]);return}let t=Array.isArray(_)?_:_?[_]:[],n=new Set(t.map(s)),r=[];for(let t of e)n.has(s(t))||(n.add(s(t)),r.push(t));let i=t.concat(r);x&&i.length>x&&(i=i.slice(0,x),P(`Up to ${x} files.`)),v(i)},Z=e=>P(e.message),{dragOver:Ce,dropProps:we}=o({...Y,disabled:E,onFiles:X,onReject:Z}),Te=e=>{let{files:t,rejections:n}=ae(e,Y);t.length&&X(t),n.length&&Z(n[0])},Ee=e=>Te(e.target.files),De=e=>{P(``),v(z.filter((t,n)=>n!==e))},Oe=()=>F.current?.click(),Q=E?f(`span`,{className:`wui-file-busy`,children:f(ne,{size:`sm`})}):null,$=f(`input`,{id:L,name:fe,ref:F,type:`file`,"aria-describedby":ve,accept:S,multiple:y||void 0,disabled:E||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:Ee,...A});return p(`div`,{...ue,className:`field${O?` ${O}`:``}`,children:[p(`label`,{className:`label`,htmlFor:L,children:[g,he&&f(te,{})]}),ye?p(`div`,{className:`file-input wui-file-input-button-field${B?` error`:``}${D?` ${D}`:``}`,style:k,"aria-busy":E||void 0,children:[p(`label`,{htmlFor:L,className:`btn btn-outline-primary btn-sm`,children:[f(a,{name:`paperclip`,size:16}),me]}),$,Q]}):W?p(`div`,{className:`file-preview${B?` error`:``}${D?` ${D}`:``}`,style:k,"aria-busy":E||void 0,children:[p(`button`,{type:`button`,className:`file-preview-open`,"aria-label":xe,onClick:Oe,disabled:E,children:[K?f(`img`,{src:K,alt:Se,className:`file-preview-img`}):p(`span`,{className:`file-preview-file`,children:[f(a,{name:`file-text`,size:28}),f(`span`,{className:`file-preview-file-name`,children:be})]}),f(`span`,{className:`file-preview-overlay`,children:p(`span`,{className:`file-preview-cta`,children:[f(a,{name:G?`image`:`file-text`,size:16}),` `,G?`Change image`:`Change file`]})})]}),i(f(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":J,onClick:()=>v(null),disabled:E,children:f(a,{name:`x`,size:16})}),J),$,Q]}):p(`div`,{className:`file-input file-input-tall${Ce?` dragging`:``}${B?` error`:``}${y&&z.length>0?` has-files`:``}${D?` ${D}`:``}`,style:k,"aria-busy":E||void 0,...we,children:[p(`label`,{htmlFor:L,className:`file-input-zone-label`,children:[f(`span`,{className:`file-input-icon`,children:f(a,{name:`upload`,size:24})}),p(`span`,{className:`file-input-title`,children:[f(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),f(`span`,{className:`file-input-text`,children:C>0?`${c(S)}, up to ${C} MB`:c(S)})]}),$,Q,y&&z.length>0&&f(`div`,{className:`attach-list`,children:z.map((e,t)=>f(re,{item:e,isImage:e instanceof File?l(e):U||l(e),noun:`file`,onRemove:()=>De(t)},s(e)))})]}),f(ee,{error:B,hint:T,errorId:V,hintId:H})]})}export{h as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import n from"../lib/FileItemRow.js";import{keyOf as r}from"../lib/fileItem.js";import i from"../lib/useFileDrop.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppIcon.js";import ee from"./AppRequiredMark.js";import te from"./AppSpinner.js";import ne from"./warnInvalidValue.js";import s from"./warnUnknownProps.js";import re from"./withTooltip.js";import{DEFAULT_MAX_SIZE_MB as ie,acceptDroppedFiles as ae,acceptLabel as c,isImageFile as l,isImageOnlyAccept as oe,isPdfFile as se}from"@webority/ui-elements/helpers";import{useEffect as u,useId as ce,useRef as le,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`dropzone`,`button`];function h(h){let{marker:ue,props:de}=a(`AppFilePicker`,h),{label:g,value:_,name:fe,id:pe,onPick:v,multiple:y=!1,variant:b=`dropzone`,buttonLabel:me=`Add file`,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=ie,required:w,optional:T=!1,error:he,hint:E,loading:D=!1,className:O=``,fieldClassName:k=``,style:A,...j}=de;s(`AppFilePicker`,j),ne(`AppFilePicker`,`variant`,b,m);let[ge,M]=d(null),[_e,N]=d(null),[P,F]=d(``),I=le(null),ve=ce(),L=pe||ve;u(()=>{if(!y&&_ instanceof File&&l(_)){let e=URL.createObjectURL(_);return M(e),()=>URL.revokeObjectURL(e)}M(null)},[_,y]);let R=!y&&_&&!l(_)&&se(_)?_ instanceof File?_:_.url:null;u(()=>{if(!R){N(null);return}let t=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof R==`string`?{url:R}:R)).then(e=>{t&&(n=URL.createObjectURL(e),N(n))}).catch(t=>e(`[AppFilePicker] the PDF preview failed:`,t?.message)),()=>{t=!1,N(null),n&&URL.revokeObjectURL(n)}},[R]);let z=y?Array.isArray(_)?_:_?[_]:[]:[],B=he||P,V=B?`${L}-error`:void 0,H=E&&!B?`${L}-hint`:void 0,ye=V||H,U=oe(S),be=b===`button`,W=!y&&!!_,G=W&&(_ instanceof File?l(_):U||l(_)),xe=_?.name,K=G?_?.url||ge:_e,q=G?`image`:`file`,Se=g?`Change ${g}`:`Change ${q}`,J=g?`Remove ${g}`:`Remove ${q}`,Ce=g?`${g} preview`:`Selected ${q} preview`,Y={accept:S,maxSizeMb:C,multiple:y},X=e=>{if(F(``),!y){v(e[0]);return}let t=Array.isArray(_)?_:_?[_]:[],n=new Set(t.map(r)),i=[];for(let t of e)n.has(r(t))||(n.add(r(t)),i.push(t));let a=t.concat(i);x&&a.length>x&&(a=a.slice(0,x),F(`Up to ${x} files.`)),v(a)},Z=e=>F(e.message),{dragOver:we,dropProps:Te}=i({...Y,disabled:D,onFiles:X,onReject:Z}),Ee=e=>{let{files:t,rejections:n}=ae(e,Y);t.length&&X(t),n.length&&Z(n[0])},De=e=>Ee(e.target.files),Oe=e=>{F(``),v(z.filter((t,n)=>n!==e))},ke=()=>I.current?.click(),Q=D?/* @__PURE__ */ f(`span`,{className:`wui-file-busy`,children:/* @__PURE__ */ f(te,{size:`sm`})}):null,$=/* @__PURE__ */ f(`input`,{id:L,name:fe,ref:I,type:`file`,"aria-describedby":ye,accept:S,multiple:y||void 0,disabled:D||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:De,...j});return/* @__PURE__ */ p(`div`,{...ue,className:`field${k?` ${k}`:``}`,children:[/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:L,children:[g,T&&!w&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` (optional)`}),w&&/* @__PURE__ */ f(ee,{})]}),be?/* @__PURE__ */ p(`div`,{className:`file-input wui-file-input-button-field${B?` error`:``}${O?` ${O}`:``}`,style:A,"aria-busy":D||void 0,children:[/* @__PURE__ */ p(`label`,{htmlFor:L,className:`btn btn-outline-primary btn-sm`,children:[/* @__PURE__ */ f(o,{name:`paperclip`,size:16}),me]}),$,Q]}):W?/* @__PURE__ */ p(`div`,{className:`file-preview${B?` error`:``}${O?` ${O}`:``}`,style:A,"aria-busy":D||void 0,children:[/* @__PURE__ */ p(`button`,{type:`button`,className:`file-preview-open`,"aria-label":Se,onClick:ke,disabled:D,children:[K?/* @__PURE__ */ f(`img`,{src:K,alt:Ce,className:`file-preview-img`}):/* @__PURE__ */ p(`span`,{className:`file-preview-file`,children:[/* @__PURE__ */ f(o,{name:`file-text`,size:28}),/* @__PURE__ */ f(`span`,{className:`file-preview-file-name`,children:xe})]}),/* @__PURE__ */ f(`span`,{className:`file-preview-overlay`,children:/* @__PURE__ */ p(`span`,{className:`file-preview-cta`,children:[/* @__PURE__ */ f(o,{name:G?`image`:`file-text`,size:16}),` `,G?`Change image`:`Change file`]})})]}),re(/* @__PURE__ */ f(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":J,onClick:()=>v(null),disabled:D,children:/* @__PURE__ */ f(o,{name:`x`,size:16})}),J),$,Q]}):/* @__PURE__ */ p(`div`,{className:`file-input file-input-tall${we?` dragging`:``}${B?` error`:``}${y&&z.length>0?` has-files`:``}${O?` ${O}`:``}`,style:A,"aria-busy":D||void 0,...Te,children:[/* @__PURE__ */ p(`label`,{htmlFor:L,className:`file-input-zone-label`,children:[/* @__PURE__ */ f(`span`,{className:`file-input-icon`,children:/* @__PURE__ */ f(o,{name:`upload`,size:24})}),/* @__PURE__ */ p(`span`,{className:`file-input-title`,children:[/* @__PURE__ */ f(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),/* @__PURE__ */ f(`span`,{className:`file-input-text`,children:C>0?`${c(S)}, up to ${C} MB`:c(S)})]}),$,Q,y&&z.length>0&&/* @__PURE__ */ f(`div`,{className:`attach-list`,children:z.map((e,t)=>/* @__PURE__ */ f(n,{item:e,isImage:e instanceof File?l(e):U||l(e),noun:`file`,onRemove:()=>Oe(t)},r(e)))})]}),/* @__PURE__ */ f(t,{error:B,hint:E,errorId:V,hintId:H})]})}export{h as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{sizeLabelOf as n}from"../lib/fileItem.js";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";function o(e){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):``;return n.length>0?n.slice(0,4).toUpperCase():`FILE`}function s(e){let t=n({sizeBytes:e.sizeBytes});return t&&e.meta?a(r,{children:[t,` · `,e.meta]}):t||e.meta||null}function c(n){let{marker:c,props:l}=e(`AppFileTiles`,n),{label:u,files:d=[],className:f=``,...p}=l;if(t(`AppFileTiles`,p),d.some(e=>!e.name))throw Error(`<AppFileTiles> each file needs a name.`);return i(`ul`,{className:[`wui-file-tiles`,f].filter(Boolean).join(` `),"aria-label":u,...c,...p,children:d.map(e=>{let t=s(e),n=a(r,{children:[i(`span`,{className:`wui-file-tile-ext`,"aria-hidden":`true`,children:o(e.name)}),a(`span`,{className:`wui-file-tile-text`,children:[i(`span`,{className:`wui-file-tile-name`,children:e.name}),t?i(`span`,{className:`wui-file-tile-meta`,children:t}):null]})]});return i(`li`,{children:e.href?i(`a`,{className:`wui-file-tile`,href:e.href,children:n}):i(`div`,{className:`wui-file-tile`,children:n})},e.key)})})}export{c as default};
1
+ import{sizeLabelOf as e}from"../lib/fileItem.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./warnUnknownProps.js";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";function o(e){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):``;return n.length>0?n.slice(0,4).toUpperCase():`FILE`}function s(t){let n=e({sizeBytes:t.sizeBytes});return n&&t.meta?/* @__PURE__ */ a(r,{children:[n,` · `,t.meta]}):n||t.meta||null}function c(e){let{marker:c,props:l}=t(`AppFileTiles`,e),{label:u,files:d=[],className:f=``,...p}=l;if(n(`AppFileTiles`,p),d.some(e=>!e.name))throw Error(`<AppFileTiles> each file needs a name.`);let m=[`wui-file-tiles`,f].filter(Boolean).join(` `);return/* @__PURE__ */ i(`ul`,{className:m,"aria-label":u,...c,...p,children:d.map(e=>{let t=s(e),n=/* @__PURE__ */ a(r,{children:[/* @__PURE__ */ i(`span`,{className:`wui-file-tile-ext`,"aria-hidden":`true`,children:o(e.name)}),/* @__PURE__ */ a(`span`,{className:`wui-file-tile-text`,children:[/* @__PURE__ */ i(`span`,{className:`wui-file-tile-name`,children:e.name}),t?/* @__PURE__ */ i(`span`,{className:`wui-file-tile-meta`,children:t}):null]})]});return/* @__PURE__ */ i(`li`,{children:e.href?/* @__PURE__ */ i(`a`,{className:`wui-file-tile`,href:e.href,children:n}):/* @__PURE__ */ i(`div`,{className:`wui-file-tile`,children:n})},e.key)})})}export{c as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{forwardRef as n,useCallback as r,useEffect as i,useLayoutEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{createPortal as d}from"react-dom";import"@webority/ui-elements/file-viewer";var f=`wui-file-viewer:load`,p=`wui-file-viewer:error`,m=`wui-file-viewer:prefs-change`,h=n(function(n,h){let{marker:g,props:_}=e(`AppFileViewer`,n),{src:v,name:y,type:b,prefs:x,onPrefsChange:S,viewKey:C,download:w=!1,print:T=!0,workerSrc:E,assetBase:D,captions:O,actions:k,onLoad:A,onError:j,className:M=``,style:N,...P}=_;t(`AppFileViewer`,P);let F=o(null),I=o(A),L=o(j),R=o(S),[z,B]=s(null),V=r(e=>{F.current=e,typeof h==`function`?h(e):h&&(h.current=e)},[h]);a(()=>{x!==void 0&&(F.current.prefs=x)},[x]),i(()=>{I.current=A,L.current=j,R.current=S}),i(()=>{let e=F.current,t=e=>I.current?.(e.detail),n=e=>L.current?.(e.detail),r=e=>R.current?.(e.detail);return e.addEventListener(f,t),e.addEventListener(p,n),e.addEventListener(m,r),()=>{e.removeEventListener(f,t),e.removeEventListener(p,n),e.removeEventListener(m,r)}},[]),i(()=>{let e=F.current;e?.isConnected&&B(e.actionsContainer)},[]);let H=N&&N.height!==void 0&&N.minHeight===void 0?{...N,minHeight:0}:N;return u(c,{children:[l(`wui-file-viewer`,{ref:V,src:v,name:y||void 0,type:b||void 0,"view-key":C||void 0,download:w?``:void 0,print:T?void 0:`false`,"worker-src":E||void 0,"asset-base":D||void 0,captions:O||void 0,className:M||void 0,style:H,...g,...P}),z&&k!=null&&d(l(`div`,{slot:`actions`,className:`wui-file-viewer-slot`,children:k}),z)]})});export{h as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{forwardRef as n,useCallback as r,useEffect as i,useLayoutEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{createPortal as d}from"react-dom";import"@webority/ui-elements/file-viewer";var f=`wui-file-viewer:load`,p=`wui-file-viewer:error`,m=`wui-file-viewer:prefs-change`,h=n(function(n,h){let{marker:g,props:_}=e(`AppFileViewer`,n),{src:v,name:y,type:b,prefs:x,onPrefsChange:S,viewKey:C,download:w=!1,print:T=!0,workerSrc:E,assetBase:D,captions:O,actions:k,onLoad:A,onError:j,className:M=``,style:N,...P}=_;t(`AppFileViewer`,P);let F=o(null),I=o(A),L=o(j),R=o(S),[z,B]=s(null),V=r(e=>{F.current=e,typeof h==`function`?h(e):h&&(h.current=e)},[h]);a(()=>{x!==void 0&&(F.current.prefs=x)},[x]),i(()=>{I.current=A,L.current=j,R.current=S}),i(()=>{let e=F.current,t=e=>I.current?.(e.detail),n=e=>L.current?.(e.detail),r=e=>R.current?.(e.detail);return e.addEventListener(f,t),e.addEventListener(p,n),e.addEventListener(m,r),()=>{e.removeEventListener(f,t),e.removeEventListener(p,n),e.removeEventListener(m,r)}},[]),i(()=>{let e=F.current;e?.isConnected&&B(e.actionsContainer)},[]);let H=N&&N.height!==void 0&&N.minHeight===void 0?{...N,minHeight:0}:N;return/* @__PURE__ */ u(c,{children:[/* @__PURE__ */ l(`wui-file-viewer`,{ref:V,src:v,name:y||void 0,type:b||void 0,"view-key":C||void 0,download:w?``:void 0,print:T?void 0:`false`,"worker-src":E||void 0,"asset-base":D||void 0,captions:O||void 0,className:M||void 0,style:H,...g,...P}),z&&k!=null&&d(/* @__PURE__ */ l(`div`,{slot:`actions`,className:`wui-file-viewer-slot`,children:k}),z)]})});export{h as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import a from"./AppButton.js";import o from"./AppSegmented.js";import s from"./AppChip.js";import c from"./AppSelect.js";import l from"./AppDateRangePicker.js";import{emptyFacetValue as u,isFacetActive as d}from"../lib/listQuery.js";import f from"./AppMultiSelect.js";import p from"./AppSearch.js";import ee from"./AppSwitch.js";import{Fragment as m,useEffect as h,useId as te,useRef as g,useState as ne,useSyncExternalStore as re}from"react";import{Fragment as ie,jsx as _,jsxs as v}from"react/jsx-runtime";import"@webority/ui-elements/elements/filter-popover";var y=`(max-width: 575.98px)`,ae=3,b=2,oe=e=>{let t=window.matchMedia?.(y);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},se=()=>window.matchMedia?.(y).matches??!1,ce=[`enum`,`multiEnum`,`dateRange`,`text`],x=4,le=e=>(e.type===`enum`||e.type===`multiEnum`)&&!e.options?.length,S=(e,t)=>e.options?.find(e=>e.value===t)?.label??t,ue=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function C(e,t){if(e.required||!d(e,t))return[];if(e.type===`enum`)return[{id:e.key,text:S(e,t),clear:()=>u(e)}];if(e.type===`multiEnum`)return t.map(n=>({id:`${e.key}:${n}`,text:S(e,n),clear:()=>t.filter(e=>e!==n)}));if(e.type===`dateRange`){let n=t.from&&t.to?`${t.from} to ${t.to}`:t.from?`From ${t.from}`:`Until ${t.to}`;return[{id:e.key,text:n,clear:()=>u(e)}]}return[]}var w=new Set;function T(e){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}!n||w.has(e)||(w.add(e),t(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel, which only an enum facet uses.`))}var E=new Set;function de(e){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}!n||E.has(e)||(E.add(e),t(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets required, which only an enum facet uses.`))}var D=new Set;function fe(e){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}!n||D.has(e)||(D.add(e),t(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets allLabel and required; a required facet has no All segment.`))}var O=new Set;function k(e){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}!n||O.has(e)||(O.add(e),t(`[@webority/ui-react] <AppFilterBar> facet "${e}" sets presets, which only a dateRange facet uses.`))}function A(t){let{marker:o,props:c}=e(`AppFilterBar`,t),{facets:l,value:f,onChange:p,inline:y=ae,floating:x=!1,apply:S=!1,className:w=``,...E}=c;r(`AppFilterBar`,E);let D=re(oe,se,()=>!1),O=g(null),A=te(),[M,N]=ne({}),P=g(f);for(let e of l)n(`AppFilterBar`,`facets[].type`,e.type,ce);for(let e of l)e.allLabel!=null&&e.type!==`enum`&&T(e.key),e.required&&e.type!==`enum`&&de(e.key),e.required&&e.allLabel!=null&&fe(e.key),e.presets!=null&&e.type!==`dateRange`&&k(e.key);let F=l.filter(e=>!le(e)),I=F.flatMap(e=>C(e,f[e.key]).map(t=>({...t,facet:e}))),L=F.filter(e=>!e.required&&d(e,f[e.key])),R=x||D?0:Math.max(0,y),z=F.slice(R),B=z.filter(e=>L.includes(e)).length,V=!x&&z.length>0;h(()=>{if(!V)return;let e=e=>{let t=O.current;t?.open&&(e.type===`keydown`?e.key===`Escape`:!e.composedPath().includes(t))&&(t.open=!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e)}},[V]),h(()=>{let e=P.current;P.current=f,N(t=>{let n=Object.entries(t).filter(([t])=>ue(e[t],f[t]));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})},[f]);let H=e=>S&&!x&&(e.type===`text`||e.type===`dateRange`),U=e=>H(e)&&Object.hasOwn(M,e.key)?M[e.key]:f[e.key],W=e=>t=>H(e)?N(n=>({...n,[e.key]:t})):p(e.key,t),G=()=>{for(let[e,t]of Object.entries(M))p(e,t);N({})},pe=e=>{e.key===`Enter`&&G()},me=e=>{e.preventDefault(),G()},K=(e,t)=>e.type===`text`&&H(e)?_(`span`,{onKeyDownCapture:pe,children:t}):t,he=e=>_(m,{children:K(e,_(j,{facet:e,value:U(e),onChange:W(e)}))},e.key),q=e=>v(`div`,{className:`wui-filter-popover-field`,children:[_(`span`,{className:`label`,"aria-hidden":`true`,children:e.label}),K(e,_(j,{facet:e,value:U(e),onChange:W(e),floating:!0}))]},e.key),J=(e,t)=>t>0&&_(`span`,{className:e,children:` (${t})`}),Y=e=>_(s,{size:`sm`,label:`${e.facet.label}: ${e.text}`,removeLabel:`Remove ${e.facet.label} filter ${e.text}`,onRemove:()=>p(e.facet.key,e.clear()),className:!x&&F.indexOf(e.facet)<R?`wui-filter-chip-inline`:void 0},e.id),X=_(a,{variant:`ghost`,size:`sm`,onClick:()=>{for(let e of L)p(e.key,u(e));N({})},children:`Clear all`});if(x){let e=I.slice(b),t=L.length;return v(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${w?` ${w}`:``}`,...o,...E,children:[v(`wui-filter-popover`,{class:`wui-filter-popover`,children:[v(a,{variant:t>0?`outline`:`ghost`,size:`sm`,leftIcon:`filter`,className:`wui-filter-popover-trigger`,"aria-expanded":`false`,"aria-controls":A,"aria-label":t>0?`Filters, ${t} active`:void 0,children:[`Filters`,t>0&&_(`span`,{className:`badge rounded-pill text-bg-primary ms-1`,children:t})]}),v(`div`,{id:A,className:`wui-filter-popover-panel`,role:`dialog`,"aria-label":`Filters`,hidden:!0,children:[v(`div`,{className:`wui-filter-popover-head`,children:[_(`span`,{className:`wui-filter-popover-title`,children:`Filters`}),_(ee,{label:`Keep open`,id:`${A}-pin`})]}),_(`div`,{className:`wui-filter-popover-grid`,children:F.map(q)}),v(`div`,{className:`wui-filter-popover-foot`,children:[_(`span`,{className:`wui-filter-popover-note`,children:`Changes apply at once.`}),t>0&&X]})]})]}),I.slice(0,b).map(Y),e.length>0&&v(`span`,{className:`chip chip-sm wui-filter-popover-more`,title:e.map(e=>`${e.facet.label}: ${e.text}`).join(`, `),children:[`+`,e.length]})]})}let Z=`wui-filter-bar d-flex flex-wrap align-items-center gap-2${D&&V?` wui-filter-bar--folded`:``}`,Q=e=>`${e}${w?` ${w}`:``}`,$=v(ie,{children:[F.slice(0,R).map(he),V&&v(`details`,{ref:O,className:`wui-filter-more`,children:[v(`summary`,{className:`btn btn-outline-primary btn-sm wui-filter-more-trigger`,children:[_(i,{name:`filter`,size:14,className:`me-2`}),`Filters`,J(`wui-filter-count-desktop`,B),J(`wui-filter-count-phone`,L.length)]}),v(`div`,{className:`wui-filter-more-panel`,children:[_(`div`,{className:`wui-filter-more-head`,children:`Filters`}),z.map(q)]})]}),I.map(Y),L.length>0&&X]});return!S||!F.some(e=>e.type===`text`||e.type===`dateRange`)?_(`div`,{className:Q(Z),...o,...E,children:$}):v(`div`,{className:Q(`wui-filter-form d-flex flex-wrap align-items-center gap-2`),...o,...E,children:[_(`div`,{className:Z,children:$}),_(a,{type:`submit`,size:`sm`,onClick:me,children:`Apply`})]})}function j({facet:e,value:t,onChange:n,floating:r=!1}){if(e.type===`enum`){let i=e.options??[];return(e.required?i.length<=x:i.length<x)?_(o,{label:e.label,name:e.key,size:`sm`,value:t??``,onChange:n,options:e.required?i:[{value:``,label:e.allLabel||`All`},...i]}):_(c,{"aria-label":e.label,name:e.key,placeholder:r?`Any`:e.label,clearable:!e.required,size:`sm`,value:t??``,onChange:n,options:i})}return e.type===`multiEnum`?_(f,{"aria-label":e.label,name:e.key,placeholder:r?`Any`:e.label,size:`sm`,collapseChips:!0,values:t??[],onChange:n,options:e.options??[]}):e.type===`dateRange`?_(l,{ariaLabel:e.label,startName:`${e.key}From`,endName:`${e.key}To`,placeholder:r?`Any`:e.label,size:`sm`,presets:e.presets,start:t?.from??``,end:t?.to??``,onChange:e=>n({from:e.start??``,to:e.end??``})}):_(p,{ariaLabel:e.label,name:e.key,placeholder:e.label,size:`sm`,value:t??``,onChange:n})}export{A as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{emptyFacetValue as t,isFacetActive as n}from"../lib/listQuery.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppButton.js";import a from"./AppChip.js";import o from"./AppDateRangePicker.js";import ee from"./AppIcon.js";import s from"./AppMultiSelect.js";import c from"./AppSearch.js";import l from"./AppSegmented.js";import u from"./AppSelect.js";import te from"./AppSwitch.js";import d from"./warnInvalidValue.js";import f from"./warnUnknownProps.js";import{Fragment as ne,useEffect as p,useId as m,useRef as h,useState as re,useSyncExternalStore as ie}from"react";import{Fragment as ae,jsx as g,jsxs as _}from"react/jsx-runtime";import"@webority/ui-elements/elements/filter-popover";var v=`(max-width: 575.98px)`,y=3,b=2,x=e=>{let t=window.matchMedia?.(v);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},oe=()=>window.matchMedia?.(v).matches??!1,se=[`enum`,`multiEnum`,`dateRange`,`text`],S=4,ce=e=>(e.type===`enum`||e.type===`multiEnum`)&&!e.options?.length,C=(e,t)=>e.options?.find(e=>e.value===t)?.label??t,w=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function T(e,r){if(e.required||!n(e,r))return[];if(e.type===`enum`)return[{id:e.key,text:C(e,r),clear:()=>t(e)}];if(e.type===`multiEnum`)return r.map(t=>({id:`${e.key}:${t}`,text:C(e,t),clear:()=>r.filter(e=>e!==t)}));if(e.type===`dateRange`){let n=r.from&&r.to?`${r.from} to ${r.to}`:r.from?`From ${r.from}`:`Until ${r.to}`;return[{id:e.key,text:n,clear:()=>t(e)}]}return[]}var E=/* @__PURE__ */ new Set;function le(t){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}n&&!E.has(t)&&(E.add(t),e(`[@webority/ui-react] <AppFilterBar> facet "${t}" sets allLabel, which only an enum facet uses.`))}var D=/* @__PURE__ */ new Set;function ue(t){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}n&&!D.has(t)&&(D.add(t),e(`[@webority/ui-react] <AppFilterBar> facet "${t}" sets required, which only an enum facet uses.`))}var O=/* @__PURE__ */ new Set;function de(t){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}n&&!O.has(t)&&(O.add(t),e(`[@webority/ui-react] <AppFilterBar> facet "${t}" sets allLabel and required; a required facet has no All segment.`))}var k=/* @__PURE__ */ new Set;function fe(t){let n=!0;try{n=process.env.NODE_ENV!==`production`}catch{n=!0}n&&!k.has(t)&&(k.add(t),e(`[@webority/ui-react] <AppFilterBar> facet "${t}" sets presets, which only a dateRange facet uses.`))}function A(e){let{marker:o,props:s}=r(`AppFilterBar`,e),{facets:c,value:l,onChange:u,inline:v=y,floating:S=!1,apply:C=!1,className:E=``,...D}=s;f(`AppFilterBar`,D);let O=ie(x,oe,()=>!1),k=h(null),A=m(),[M,N]=re({}),P=h(l);for(let e of c)d(`AppFilterBar`,`facets[].type`,e.type,se);for(let e of c)e.allLabel!=null&&e.type!==`enum`&&le(e.key),e.required&&e.type!==`enum`&&ue(e.key),e.required&&e.allLabel!=null&&de(e.key),e.presets!=null&&e.type!==`dateRange`&&fe(e.key);let F=c.filter(e=>!ce(e)),I=F.flatMap(e=>T(e,l[e.key]).map(t=>({...t,facet:e}))),L=F.filter(e=>!e.required&&n(e,l[e.key])),R=S||O?0:Math.max(0,v),z=F.slice(R),B=z.filter(e=>L.includes(e)).length,V=!S&&z.length>0;p(()=>{if(!V)return;let e=e=>{let t=k.current;t?.open&&(e.type===`keydown`?e.key===`Escape`:!e.composedPath().includes(t))&&(t.open=!1)};return document.addEventListener(`click`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e)}},[V]),p(()=>{let e=P.current;P.current=l,N(t=>{let n=Object.entries(t).filter(([t])=>w(e[t],l[t]));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})},[l]);let H=e=>C&&!S&&(e.type===`text`||e.type===`dateRange`),U=e=>H(e)&&Object.hasOwn(M,e.key)?M[e.key]:l[e.key],W=e=>t=>H(e)?N(n=>({...n,[e.key]:t})):u(e.key,t),G=()=>{for(let[e,t]of Object.entries(M))u(e,t);N({})},pe=e=>{e.key===`Enter`&&G()},me=e=>{e.preventDefault(),G()},K=(e,t)=>e.type===`text`&&H(e)?/* @__PURE__ */ g(`span`,{onKeyDownCapture:pe,children:t}):t,he=e=>/* @__PURE__ */ g(ne,{children:K(e,/* @__PURE__ */ g(j,{facet:e,value:U(e),onChange:W(e)}))},e.key),q=e=>/* @__PURE__ */ _(`div`,{className:`wui-filter-popover-field`,children:[/* @__PURE__ */ g(`span`,{className:`label`,"aria-hidden":`true`,children:e.label}),K(e,/* @__PURE__ */ g(j,{facet:e,value:U(e),onChange:W(e),floating:!0}))]},e.key),J=(e,t)=>t>0&&/* @__PURE__ */ g(`span`,{className:e,children:` (${t})`}),Y=e=>/* @__PURE__ */ g(a,{size:`sm`,label:`${e.facet.label}: ${e.text}`,removeLabel:`Remove ${e.facet.label} filter ${e.text}`,onRemove:()=>u(e.facet.key,e.clear()),className:!S&&F.indexOf(e.facet)<R?`wui-filter-chip-inline`:void 0},e.id),X=/* @__PURE__ */ g(i,{variant:`ghost`,size:`sm`,onClick:()=>{for(let e of L)u(e.key,t(e));N({})},children:`Clear all`});if(S){let e=I.slice(b),t=L.length;return/* @__PURE__ */ _(`div`,{className:`wui-filter-bar d-flex flex-wrap align-items-center gap-2${E?` ${E}`:``}`,...o,...D,children:[/* @__PURE__ */ _(`wui-filter-popover`,{class:`wui-filter-popover`,children:[/* @__PURE__ */ _(i,{variant:t>0?`outline`:`ghost`,size:`sm`,leftIcon:`filter`,className:`wui-filter-popover-trigger`,"aria-expanded":`false`,"aria-controls":A,"aria-label":t>0?`Filters, ${t} active`:void 0,children:[`Filters`,t>0&&/* @__PURE__ */ g(`span`,{className:`badge rounded-pill text-bg-primary ms-1`,children:t})]}),/* @__PURE__ */ _(`div`,{id:A,className:`wui-filter-popover-panel`,role:`dialog`,"aria-label":`Filters`,hidden:!0,children:[/* @__PURE__ */ _(`div`,{className:`wui-filter-popover-head`,children:[/* @__PURE__ */ g(`span`,{className:`wui-filter-popover-title`,children:`Filters`}),/* @__PURE__ */ g(te,{label:`Keep open`,id:`${A}-pin`})]}),/* @__PURE__ */ g(`div`,{className:`wui-filter-popover-grid`,children:F.map(q)}),/* @__PURE__ */ _(`div`,{className:`wui-filter-popover-foot`,children:[/* @__PURE__ */ g(`span`,{className:`wui-filter-popover-note`,children:`Changes apply at once.`}),t>0&&X]})]})]}),I.slice(0,b).map(Y),e.length>0&&/* @__PURE__ */ _(`span`,{className:`chip chip-sm wui-filter-popover-more`,title:e.map(e=>`${e.facet.label}: ${e.text}`).join(`, `),children:[`+`,e.length]})]})}let Z=`wui-filter-bar d-flex flex-wrap align-items-center gap-2${O&&V?` wui-filter-bar--folded`:``}`,Q=e=>`${e}${E?` ${E}`:``}`,$=/* @__PURE__ */ _(ae,{children:[F.slice(0,R).map(he),V&&/* @__PURE__ */ _(`details`,{ref:k,className:`wui-filter-more`,children:[/* @__PURE__ */ _(`summary`,{className:`btn btn-outline-primary btn-sm wui-filter-more-trigger`,children:[/* @__PURE__ */ g(ee,{name:`filter`,size:14,className:`me-2`}),`Filters`,J(`wui-filter-count-desktop`,B),J(`wui-filter-count-phone`,L.length)]}),/* @__PURE__ */ _(`div`,{className:`wui-filter-more-panel`,children:[/* @__PURE__ */ g(`div`,{className:`wui-filter-more-head`,children:`Filters`}),z.map(q)]})]}),I.map(Y),L.length>0&&X]});return!C||!F.some(e=>e.type===`text`||e.type===`dateRange`)?/* @__PURE__ */ g(`div`,{className:Q(Z),...o,...D,children:$}):/* @__PURE__ */ _(`div`,{className:Q(`wui-filter-form d-flex flex-wrap align-items-center gap-2`),...o,...D,children:[/* @__PURE__ */ g(`div`,{className:Z,children:$}),/* @__PURE__ */ g(i,{type:`submit`,size:`sm`,onClick:me,children:`Apply`})]})}function j({facet:e,value:t,onChange:n,floating:r=!1}){if(e.type===`enum`){let i=e.options??[];return(e.required?i.length<=S:i.length<S)?/* @__PURE__ */ g(l,{label:e.label,name:e.key,size:`sm`,value:t??``,onChange:n,options:e.required?i:[{value:``,label:e.allLabel||`All`},...i]}):/* @__PURE__ */ g(u,{"aria-label":e.label,name:e.key,placeholder:r?`Any`:e.label,clearable:!e.required,size:`sm`,value:t??``,onChange:n,options:i})}return e.type===`multiEnum`?/* @__PURE__ */ g(s,{"aria-label":e.label,name:e.key,placeholder:r?`Any`:e.label,size:`sm`,collapseChips:!0,values:t??[],onChange:n,options:e.options??[]}):e.type===`dateRange`?/* @__PURE__ */ g(o,{ariaLabel:e.label,startName:`${e.key}From`,endName:`${e.key}To`,placeholder:r?`Any`:e.label,size:`sm`,presets:e.presets,start:t?.from??``,end:t?.to??``,onChange:e=>n({from:e.start??``,to:e.end??``})}):/* @__PURE__ */ g(c,{ariaLabel:e.label,name:e.key,placeholder:e.label,size:`sm`,value:t??``,onChange:n})}export{A as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"./renderIconProp.js";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";import"@webority/ui-elements/elements/dock";function o(o){let{marker:s,props:c}=e(`AppFloatingDock`,o),{items:l=[],linkComponent:u,ariaLabel:d=`Quick navigation`,magnify:f=!0,maxScale:p,radius:m,className:h=``,...g}=c;return t(`AppFloatingDock`,g),i(`wui-dock`,{role:`navigation`,"aria-label":d,static:f?void 0:``,"max-scale":p??void 0,radius:m??void 0,class:h||void 0,...s,...g,children:l.map((e,t)=>{let o=e.key??`${e.title}-${t}`,s=a(r,{children:[i(`span`,{className:`dock-item-tip`,"aria-hidden":`true`,children:e.title}),i(`span`,{className:`dock-item-icon`,children:n(e.icon,{size:18})})]});if(e.to&&u)return i(u,{className:`dock-item`,to:e.to,"aria-label":e.title,children:s},o);let c=e.href??e.to;return c?i(`a`,{className:`dock-item`,href:c,"aria-label":e.title,children:s},o):i(`button`,{type:`button`,className:`dock-item`,onClick:e.onClick,"aria-label":e.title,children:s},o)})})}export{o as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./renderIconProp.js";import n from"./warnUnknownProps.js";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";import"@webority/ui-elements/elements/dock";function o(o){let{marker:s,props:c}=e(`AppFloatingDock`,o),{items:l=[],linkComponent:u,ariaLabel:d=`Quick navigation`,magnify:f=!0,maxScale:p,radius:m,className:h=``,...g}=c;return n(`AppFloatingDock`,g),/* @__PURE__ */ i(`wui-dock`,{role:`navigation`,"aria-label":d,static:f?void 0:``,"max-scale":p??void 0,radius:m??void 0,class:h||void 0,...s,...g,children:l.map((e,n)=>{let o=e.key??`${e.title}-${n}`,s=/* @__PURE__ */ a(r,{children:[/* @__PURE__ */ i(`span`,{className:`dock-item-tip`,"aria-hidden":`true`,children:e.title}),/* @__PURE__ */ i(`span`,{className:`dock-item-icon`,children:t(e.icon,{size:18})})]});if(e.to&&u)return/* @__PURE__ */ i(u,{className:`dock-item`,to:e.to,"aria-label":e.title,children:s},o);let c=e.href??e.to;return c?/* @__PURE__ */ i(`a`,{className:`dock-item`,href:c,"aria-label":e.title,children:s},o):/* @__PURE__ */ i(`button`,{type:`button`,className:`dock-item`,onClick:e.onClick,"aria-label":e.title,children:s},o)})})}export{o as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[`end`,`start`,`between`];function a(a){let{marker:o,props:s}=e(`AppFormActions`,a),{children:c,sticky:l=!1,align:u=`end`,className:d=``,...f}=s;return n(`AppFormActions`,f),t(`AppFormActions`,`align`,u,i),r(`div`,{className:[`form-actions`,l?`form-actions-sticky`:``,u&&u!==`end`?`form-actions-${u}`:``,d].filter(Boolean).join(` `),...o,...f,children:c})}export{a as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[`end`,`start`,`between`];function a(a){let{marker:o,props:s}=e(`AppFormActions`,a),{children:c,sticky:l=!1,align:u=`end`,className:d=``,...f}=s;n(`AppFormActions`,f),t(`AppFormActions`,`align`,u,i);let p=[`form-actions`,l?`form-actions-sticky`:``,u&&u!==`end`?`form-actions-${u}`:``,d].filter(Boolean).join(` `);return/* @__PURE__ */ r(`div`,{className:p,...o,...f,children:c})}export{a as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[1,2,3,4,5,6,7,8,9,10,11,12];function a(a){let{marker:o,props:s}=e(`AppFormRow`,a),{children:c,columns:l=2,collapse:u=!0,className:d=``,...f}=s;n(`AppFormRow`,f),t(`AppFormRow`,`columns`,l,i);let{style:p,...m}=f;return r(`div`,{className:[`form-row-grid`,`wui-form-cols-${Math.min(12,Math.max(1,Number(l)||2))}`,u===!1&&`wui-form-row-keep`,d].filter(Boolean).join(` `),style:p,...o,...m,children:c})}export{a as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";var i=[1,2,3,4,5,6,7,8,9,10,11,12];function a(a){let{marker:o,props:s}=e(`AppFormRow`,a),{children:c,columns:l=2,collapse:u=!0,className:d=``,...f}=s;n(`AppFormRow`,f),t(`AppFormRow`,`columns`,l,i);let{style:p,...m}=f,h=[`form-row-grid`,`wui-form-cols-${Math.min(12,Math.max(1,Number(l)||2))}`,u===!1&&`wui-form-row-keep`,d].filter(Boolean).join(` `);return/* @__PURE__ */ r(`div`,{className:h,style:p,...o,...m,children:c})}export{a as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`stacked`,`side`],o=[`top`,`start`],s=[`comfortable`,`compact`],c=[2,3,4],l=[`body`,`display`],u=[`line`,`none`];function d(d){let{marker:f,props:p}=e(`AppFormSection`,d),{children:m,title:h,description:g,layout:_=`stacked`,labels:v=`top`,density:y=`comfortable`,headingLevel:b=3,titleFont:x=`body`,titleSize:S,rule:C=`line`,className:w=``,...T}=p;n(`AppFormSection`,T);let{style:E,...D}=T;t(`AppFormSection`,`layout`,_,a),t(`AppFormSection`,`labels`,v,o),t(`AppFormSection`,`density`,y,s),t(`AppFormSection`,`headingLevel`,b,c),t(`AppFormSection`,`titleFont`,x,l),t(`AppFormSection`,`rule`,C,u);let O=c.includes(b)?`h${b}`:`h3`;return i(`section`,{className:[`form-section`,_===`side`?`wui-form-side`:``,v===`start`?`wui-form-labels-start`:``,y===`compact`?`wui-form-compact`:``,x===`display`?`wui-form-title-display`:``,C===`none`?`wui-form-rule-none`:``,w].filter(Boolean).join(` `),style:S==null&&E===void 0?void 0:{"--wui-form-title-size":S==null?void 0:`${S}px`,...E},...f,...D,children:[(h!=null||g!=null)&&i(`div`,{className:`form-section-head`,children:[h!=null&&r(O,{className:`form-section-title`,children:h}),g!=null&&r(`p`,{className:`form-section-desc`,children:g})]}),r(`div`,{className:`form-section-body`,children:m})]})}export{d as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";var a=[`stacked`,`side`],o=[`top`,`start`],s=[`comfortable`,`compact`],c=[2,3,4],l=[`body`,`display`],u=[`line`,`none`];function d(d){let{marker:f,props:p}=e(`AppFormSection`,d),{children:m,title:h,description:g,layout:_=`stacked`,labels:v=`top`,density:y=`comfortable`,headingLevel:b=3,titleFont:x=`body`,titleSize:S,rule:C=`line`,className:w=``,...T}=p;n(`AppFormSection`,T);let{style:E,...D}=T;t(`AppFormSection`,`layout`,_,a),t(`AppFormSection`,`labels`,v,o),t(`AppFormSection`,`density`,y,s),t(`AppFormSection`,`headingLevel`,b,c),t(`AppFormSection`,`titleFont`,x,l),t(`AppFormSection`,`rule`,C,u);let O=c.includes(b)?`h${b}`:`h3`,k=[`form-section`,_===`side`?`wui-form-side`:``,v===`start`?`wui-form-labels-start`:``,y===`compact`?`wui-form-compact`:``,x===`display`?`wui-form-title-display`:``,C===`none`?`wui-form-rule-none`:``,w].filter(Boolean).join(` `),A=S==null&&E===void 0?void 0:{"--wui-form-title-size":S==null?void 0:`${S}px`,...E};return/* @__PURE__ */ i(`section`,{className:k,style:A,...f,...D,children:[(h!=null||g!=null)&&/* @__PURE__ */ i(`div`,{className:`form-section-head`,children:[h!=null&&/* @__PURE__ */ r(O,{className:`form-section-title`,children:h}),g!=null&&/* @__PURE__ */ r(`p`,{className:`form-section-desc`,children:g})]}),/* @__PURE__ */ r(`div`,{className:`form-section-body`,children:m})]})}export{d as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{useEffect as n,useRef as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import"@webority/ui-elements/elements/hover-card";function o(o){let{marker:s,props:c}=e(`AppHoverCard`,o),{trigger:l,children:u,open:d,loading:f=!1,loadingLabel:p=`Loading`,label:m,openDelay:h,closeDelay:g,onOpenChange:_,className:v=``,...y}=c;t(`AppHoverCard`,y);let b=r(null),x=r(_);return x.current=_,n(()=>{let e=b.current;if(!e)return;let t=()=>x.current?.(!0),n=()=>x.current?.(!1);return e.addEventListener(`wui:hover-card:open`,t),e.addEventListener(`wui:hover-card:close`,n),()=>{e.removeEventListener(`wui:hover-card:open`,t),e.removeEventListener(`wui:hover-card:close`,n)}},[]),a(`wui-hover-card`,{ref:b,class:[`wui-hover-card`,v].filter(Boolean).join(` `),open:d?``:void 0,"open-delay":Number.isFinite(h)?h:void 0,"close-delay":Number.isFinite(g)?g:void 0,...s,...y,children:[i(`span`,{className:`wui-hover-card-trigger`,children:l}),i(`span`,{className:`wui-hover-card-panel`,role:`group`,"aria-label":m||void 0,"aria-busy":f?`true`:void 0,children:f?a(`span`,{className:`wui-hover-card-loading`,role:`status`,children:[i(`span`,{className:`wui-spinner wui-spinner-sm`,"aria-hidden":`true`}),i(`span`,{children:p})]}):u})]})}export{o as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{useEffect as n,useRef as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import"@webority/ui-elements/elements/hover-card";function o(o){let{marker:s,props:c}=e(`AppHoverCard`,o),{trigger:l,children:u,open:d,loading:f=!1,loadingLabel:p=`Loading`,label:m,openDelay:h,closeDelay:g,onOpenChange:_,className:v=``,...y}=c;t(`AppHoverCard`,y);let b=r(null),x=r(_);return x.current=_,n(()=>{let e=b.current;if(!e)return;let t=()=>x.current?.(!0),n=()=>x.current?.(!1);return e.addEventListener(`wui:hover-card:open`,t),e.addEventListener(`wui:hover-card:close`,n),()=>{e.removeEventListener(`wui:hover-card:open`,t),e.removeEventListener(`wui:hover-card:close`,n)}},[]),/* @__PURE__ */ a(`wui-hover-card`,{ref:b,class:[`wui-hover-card`,v].filter(Boolean).join(` `),open:d?``:void 0,"open-delay":Number.isFinite(h)?h:void 0,"close-delay":Number.isFinite(g)?g:void 0,...s,...y,children:[/* @__PURE__ */ i(`span`,{className:`wui-hover-card-trigger`,children:l}),/* @__PURE__ */ i(`span`,{className:`wui-hover-card-panel`,role:`group`,"aria-label":m||void 0,"aria-busy":f?`true`:void 0,children:f?/* @__PURE__ */ a(`span`,{className:`wui-hover-card-loading`,role:`status`,children:[/* @__PURE__ */ i(`span`,{className:`wui-spinner wui-spinner-sm`,"aria-hidden":`true`}),/* @__PURE__ */ i(`span`,{children:p})]}):u})]})}export{o as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import{FULL_LINEAR_LOADERS as n,FULL_VARIANT_LOADERS as r,shardKey as i}from"./iconCatalogLoaders.g.js";import{ICON_NAMES as a}from"./iconCatalogNames.g.js";import{GLYPHS as o}from"./iconGlyphs.g.js";import s from"./warnInvalidValue.js";import c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{useEffect as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],h=new Set;function g(e,n){h.has(e)||(h.add(e),t(`[@webority/ui-react] The ${e} failed to load (${n?.message??n}); icons fall back to the linear default until a later render retries it.`))}var _=null,v=null,y=!1,b=new Set;function x(){return v||=import(`./iconVariants.g.js`).then(e=>{_=e.VARIANT_GLYPHS,y=!1;for(let e of b)e();b.clear()}).catch(e=>{v=null,g(`curated icon variants chunk`,e),y?b.clear():(y=!0,setTimeout(()=>{for(let e of[...b])e()},1e3))}),v}var S=new Set(a),C=Object.create(null),w=Object.create(null),T=Object.create(null),E=Object.create(null);function D(e){let t=i(e),r=n[t];return r?(w[t]||=r().then(e=>{Object.assign(C,e.FULL_GLYPHS),E[t]=!1;let n=T[t];if(n){for(let e of n)e();n.clear()}}).catch(e=>{w[t]=null,g(`full icon catalogue '${t}' shard`,e),E[t]?T[t]?.clear():(E[t]=!0,setTimeout(()=>{for(let e of[...T[t]||[]])e()},1e3))}),w[t]):null}var O=Object.create(null),k=Object.create(null),A=Object.create(null),j=Object.create(null);function M(e,t){let n=r[e];if(!n)return null;let a=i(t),o=n[a];if(!o)return null;let s=`${e}:${a}`;return k[s]||=o().then(t=>{O[e]||(O[e]=Object.create(null)),Object.assign(O[e],t.FULL_VARIANT_GLYPHS),j[s]=!1;let n=A[s];if(n){for(let e of n)e();n.clear()}}).catch(t=>{k[s]=null,g(`${e} icon catalogue '${a}' shard`,t),j[s]?A[s]?.clear():(j[s]=!0,setTimeout(()=>{for(let e of[...A[s]||[]])e()},1e3))}),k[s]}var N=a,P=new Map;function F(e){for(let[t,n]of Object.entries(e))P.set(t,n)}function I(t){let{marker:n,props:r}=e(`AppIcon`,t),{name:a,size:h=16,variant:g,tooltip:v,tooltipPlacement:y,className:w,color:E,style:k,...j}=r;c(`AppIcon`,j),s(`AppIcon`,`variant`,g,m);let N=!!g&&g!==`linear`,F=v!=null&&v!==``,I=(e,t=!0)=>F?l(f(`span`,{className:`wui-icon-tip`,role:`img`,"aria-label":v,...t?n:void 0,children:e}),v,y):e,L=o[a]!==void 0,R=!L&&S.has(a),[,z]=d(0);u(()=>{let e=()=>z(e=>e+1);N&&L&&!_&&(b.add(e),x());let t=R?i(a):null;R&&C[a]===void 0&&(T[t]||=new Set,T[t].add(e),D(a));let n=N&&R?`${g}:${i(a)}`:null;return N&&R&&O[g]?.[a]===void 0&&(A[n]||=new Set,A[n].add(e),M(g,a)),()=>{b.delete(e),t&&T[t]?.delete(e),n&&A[n]?.delete(e)}},[a,N,L,R,g]);let B=P.get(a);if(B)return I(B({size:h,color:E,className:w,style:k}),!1);if(a===`hard-hat`)return I(f(`svg`,{width:h,height:h,viewBox:`0 0 24 24`,fill:`none`,className:w?`wui-icon ${w}`:`wui-icon`,"data-icon":a,"aria-hidden":`true`,style:{color:E,...k},...F?void 0:n,...j,children:p(`g`,{fill:`currentColor`,children:[f(`circle`,{cx:`12`,cy:`7.5`,r:`4.2`}),f(`path`,{d:`M3.2 22.5C3.2 17.4 7.5 14.9 11 14.7L12 17.4l1-2.7C16.5 14.9 20.8 17.4 20.8 22.5z`})]})}));let V=N&&(_?.[g]?.[a]||R&&O?.[g]?.[a])||o[a]||C[a];return V?I(f(`svg`,{width:h,height:h,viewBox:`0 0 24 24`,fill:`none`,className:w?`wui-icon ${w}`:`wui-icon`,"data-icon":a,"aria-hidden":`true`,style:{color:E,...k},dangerouslySetInnerHTML:{__html:V},...F?void 0:n,...j})):null}export{I as default,N as iconNames,F as registerIcons};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import{FULL_LINEAR_LOADERS as n,FULL_VARIANT_LOADERS as r,shardKey as i}from"./iconCatalogLoaders.g.js";import{ICON_NAMES as a}from"./iconCatalogNames.g.js";import{GLYPHS as o}from"./iconGlyphs.g.js";import s from"./warnInvalidValue.js";import c from"./warnUnknownProps.js";import l from"./withTooltip.js";import{useEffect as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],h=/* @__PURE__ */ new Set;function g(t,n){h.has(t)||(h.add(t),e(`[@webority/ui-react] The ${t} failed to load (${n?.message??n}); icons fall back to the linear default until a later render retries it.`))}var _=null,v=null,y=!1,b=/* @__PURE__ */ new Set;function x(){return v||=import(`./iconVariants.g.js`).then(e=>{_=e.VARIANT_GLYPHS,y=!1;for(let e of b)e();b.clear()}).catch(e=>{v=null,g(`curated icon variants chunk`,e),y?b.clear():(y=!0,setTimeout(()=>{for(let e of[...b])e()},1e3))}),v}var S=new Set(a),C=Object.create(null),w=Object.create(null),T=Object.create(null),E=Object.create(null);function D(e){let t=i(e),r=n[t];return r?(w[t]||=r().then(e=>{Object.assign(C,e.FULL_GLYPHS),E[t]=!1;let n=T[t];if(n){for(let e of n)e();n.clear()}}).catch(e=>{w[t]=null,g(`full icon catalogue '${t}' shard`,e),E[t]?T[t]?.clear():(E[t]=!0,setTimeout(()=>{for(let e of[...T[t]||[]])e()},1e3))}),w[t]):null}var O=Object.create(null),k=Object.create(null),A=Object.create(null),j=Object.create(null);function M(e,t){let n=r[e];if(!n)return null;let a=i(t),o=n[a];if(!o)return null;let s=`${e}:${a}`;return k[s]||=o().then(t=>{O[e]||(O[e]=Object.create(null)),Object.assign(O[e],t.FULL_VARIANT_GLYPHS),j[s]=!1;let n=A[s];if(n){for(let e of n)e();n.clear()}}).catch(t=>{k[s]=null,g(`${e} icon catalogue '${a}' shard`,t),j[s]?A[s]?.clear():(j[s]=!0,setTimeout(()=>{for(let e of[...A[s]||[]])e()},1e3))}),k[s]}var N=a,P=/* @__PURE__ */ new Map;function F(e){for(let[t,n]of Object.entries(e))P.set(t,n)}function I(e){let{marker:n,props:r}=t(`AppIcon`,e),{name:a,size:h=16,variant:g,tooltip:v,tooltipPlacement:y,className:w,color:E,style:k,...j}=r;c(`AppIcon`,j),s(`AppIcon`,`variant`,g,m);let N=!!g&&g!==`linear`,F=v!=null&&v!==``,I=(e,t=!0)=>F?l(/* @__PURE__ */ f(`span`,{className:`wui-icon-tip`,role:`img`,"aria-label":v,...t?n:void 0,children:e}),v,y):e,L=o[a]!==void 0,R=!L&&S.has(a),[,z]=d(0);u(()=>{let e=()=>z(e=>e+1);N&&L&&!_&&(b.add(e),x());let t=R?i(a):null;R&&C[a]===void 0&&(T[t]||=/* @__PURE__ */ new Set,T[t].add(e),D(a));let n=N&&R?`${g}:${i(a)}`:null;return N&&R&&O[g]?.[a]===void 0&&(A[n]||=/* @__PURE__ */ new Set,A[n].add(e),M(g,a)),()=>{b.delete(e),t&&T[t]?.delete(e),n&&A[n]?.delete(e)}},[a,N,L,R,g]);let B=P.get(a);if(B)return I(B({size:h,color:E,className:w,style:k}),!1);if(a===`hard-hat`)return I(/* @__PURE__ */ f(`svg`,{width:h,height:h,viewBox:`0 0 24 24`,fill:`none`,className:w?`wui-icon ${w}`:`wui-icon`,"data-icon":a,"aria-hidden":`true`,style:{color:E,...k},...F?void 0:n,...j,children:/* @__PURE__ */ p(`g`,{fill:`currentColor`,children:[/* @__PURE__ */ f(`circle`,{cx:`12`,cy:`7.5`,r:`4.2`}),/* @__PURE__ */ f(`path`,{d:`M3.2 22.5C3.2 17.4 7.5 14.9 11 14.7L12 17.4l1-2.7C16.5 14.9 20.8 17.4 20.8 22.5z`})]})}));let V=N&&(_?.[g]?.[a]||R&&O?.[g]?.[a])||o[a]||C[a];return V?I(/* @__PURE__ */ f(`svg`,{width:h,height:h,viewBox:`0 0 24 24`,fill:`none`,className:w?`wui-icon ${w}`:`wui-icon`,"data-icon":a,"aria-hidden":`true`,style:{color:E,...k},dangerouslySetInnerHTML:{__html:V},...F?void 0:n,...j})):null}export{I as default,N as iconNames,F as registerIcons};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import ee from"./withTooltip.js";import r from"./AppIcon.js";import te from"./AppAlert.js";import i from"./AppButton.js";import ne from"../lib/FieldMessage.js";import re from"./AppRequiredMark.js";import ie from"./AppModal.js";import ae from"../lib/useFileDrop.js";import{AVATAR_ACCEPT as oe,AVATAR_MAX_SIZE_MB as a,AVATAR_OUTPUT_SIZE as se,AVATAR_OUTPUT_TYPE as o,AVATAR_PREVIEW_SIZES as ce,AVATAR_TEXT as s,DEFAULT_IMAGE_ACCEPT as c,DEFAULT_MAX_SIZE_MB as l,avatarUnreadableMessage as u,validateFile as le}from"@webority/ui-elements/helpers";import{useCallback as ue,useEffect as de,useId as fe,useRef as d,useState as f}from"react";import{Fragment as pe,jsx as p,jsxs as m}from"react/jsx-runtime";import"@webority/ui-elements/elements/image-crop";var me=[`logo`,`avatar`],he=[`overlay`,`buttons`],ge=[`stacked`,`inline`,`profile`],_e=[`initials`,`avatar`],ve=[`circle`,`rounded`,`square`],ye=[`keep`,`image/webp`],be=ce.join(` `),xe={logo:{controls:`overlay`,accept:c,maxSizeMb:l,crop:void 0,rotatable:!1,previews:!1,camera:!1,outputSize:void 0,outputType:`keep`,variant:`initials`,sizes:{sm:72,md:120,lg:160}},avatar:{controls:`buttons`,accept:oe,maxSizeMb:a,crop:1,rotatable:!0,previews:!0,camera:!0,outputSize:se,outputType:o,variant:`avatar`,sizes:{sm:64,md:96,lg:128}}},Se=`That image could not be cropped. Choose another one.`,Ce=`That image could not be opened. Choose another one.`,we={dialogSize:`lg`,dialogTitle:`Crop photo`,dialogSubtitle:`Drag the frame and zoom to choose what to keep.`,save:`Apply`,cancel:`Cancel`,cropFailed:Se,unreadable:()=>Ce},Te={dialogSize:void 0,dialogTitle:s.dialogTitle,dialogSubtitle:s.dialogSubtitle,save:s.save,cancel:s.cancel,cropFailed:s.cropFailed,unreadable:u};function Ee(oe){let{marker:a,props:se}=e(`AppImagePicker`,oe),{kind:o=`logo`,controls:ce,value:c,fallback:l,variant:u,name:Se,onPick:Ce,onRemove:Ee,removeName:h,loading:g=!1,disabled:De=!1,accept:Oe,maxSizeMb:ke,shape:_=`circle`,size:v=`md`,crop:Ae,rotatable:je,previews:Me,camera:Ne,outputSize:Pe,outputType:Fe,layout:y=`stacked`,title:Ie,subtitle:Le,overlayIcon:Re=`image`,overlayLabel:ze=`Update photo`,removeLabel:b=`Remove photo`,ariaLabel:Be,label:Ve,hint:x,error:He,required:Ue=!1,className:We=``,fieldClassName:S=``,style:C,...w}=se;n(`AppImagePicker`,w),t(`AppImagePicker`,`kind`,o,me),t(`AppImagePicker`,`controls`,ce,he),t(`AppImagePicker`,`variant`,u,_e),t(`AppImagePicker`,`layout`,y,ge),t(`AppImagePicker`,`shape`,_,ve),t(`AppImagePicker`,`outputType`,Fe,ye);let T=xe[o]??xe.logo,E=o===`avatar`?Te:we,D=T.sizes;t(`AppImagePicker`,`size`,typeof v==`string`?v:null,Object.keys(D));let Ge=(ce??T.controls)===`overlay`,Ke=u??T.variant,O=Oe??T.accept,k=ke??T.maxSizeMb,A=Pe??T.outputSize,qe=Fe??T.outputType,Je=je??T.rotatable,Ye=Me??T.previews,Xe=Ne??T.camera,j=Ae??T.crop,M=j===`free`?null:typeof j==`number`&&Number.isFinite(j)&&j>0?j:void 0;j!=null&&M===void 0&&t(`AppImagePicker`,`crop`,String(j),[`free`,`a positive number`]);let Ze=M!==void 0&&A===void 0,N=d(null),Qe=d(null),P=d(null),F=fe(),[I,L]=f(null),[$e,R]=f(!1),[et,z]=f(!1),[tt,B]=f(``),[V,H]=f(null),[U,nt]=f(!1),[W,G]=f(`loading`),[rt,K]=f(``),it=ue(e=>{if(P.current=e,!e)return;let t=()=>{G(`ready`),e.querySelector(`.wui-crop-stage`)?.focus()},n=()=>G(`error`);return e.addEventListener(`load`,t),e.addEventListener(`error`,n),()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),P.current=null}},[]);de(()=>()=>V&&URL.revokeObjectURL(V.url),[V]),de(()=>()=>I&&URL.revokeObjectURL(I),[I]);let[at,ot]=f(c);c!==at&&(ot(c),L(null),R(!1),z(!1));let q=g||De,J=$e?null:I||(c&&!et?c:null),st=!!J,Y=He||tt,X=x&&!Y?`${F}-hint`:void 0,Z=Y?`${F}-error`:void 0,ct=Z||X,lt=!q&&st&&(!!I||!!Ee||!!h),ut=st?s.change:s.choose,dt=typeof v==`number`?v:D[v]??D.md,ft=()=>{q||N.current?.click()},pt=()=>{q||Qe.current?.click()},mt=e=>{if(Se&&N.current&&typeof DataTransfer==`function`){let t=new DataTransfer;t.items.add(e),N.current.files=t.files}R(!1),z(!1),L(URL.createObjectURL(e)),Ce(e)},ht=e=>{let t=M!==void 0&&e.type!==`image/svg+xml`,n=le(e,{accept:O,maxSizeMb:t&&Ze?0:k});if(n){B(n);return}if(B(``),t){G(`loading`),K(``),H({file:e,url:URL.createObjectURL(e)});return}mt(e)},{dragOver:gt,dropProps:_t}=ae({accept:O,maxSizeMb:Ze?0:k,disabled:q,onFiles:e=>ht(e[0]),onReject:({message:e})=>B(e)}),vt=e=>{let t=qe===`keep`?e.type:qe;return A===void 0?{name:e.name,type:t,maxBytes:k>0?k*1024*1024:0}:{name:e.name||`photo`,type:t,size:A}},yt=async()=>{let{file:e}=V;nt(!0),K(``);let t=null;try{t=await P.current?.toFile(vt(e))}catch{t=null}if(nt(!1),!t){K(E.cropFailed);return}if(H(null),Ze){let e=le(t,{accept:O,maxSizeMb:k});e?B(e):mt(t);return}mt(t)},bt=()=>{U||H(null)},xt=e=>{let t=e.target.files?.[0];e.target.value=``,t&&ht(t)},St=()=>{L(null),R(!0),B(``),N.current&&(N.current.value=``),Ee?.()},Q=M!==void 0&&m(ie,{open:!!V,title:E.dialogTitle,subtitle:E.dialogSubtitle,size:E.dialogSize,staticBackdrop:!0,dismissible:!U,onClose:bt,footer:m(pe,{children:[p(i,{type:`button`,variant:`secondary`,disabled:U,onClick:bt,children:E.cancel}),p(i,{type:`button`,variant:`primary`,loading:U,disabled:W!==`ready`,onClick:yt,children:E.save})]}),children:[W===`error`&&V&&p(te,{tone:`danger`,children:E.unreadable(V.file)}),rt&&p(te,{tone:`danger`,children:rt}),V&&W!==`error`&&p(`wui-image-crop`,{ref:it,src:V.url,aspect:M??`free`,round:M===1&&_===`circle`,rotatable:Je,previews:Ye?be:void 0})]}),Ct=h&&p(`input`,{type:`hidden`,name:h,value:`true`,disabled:!$e}),$=Ve&&m(`label`,{className:`label`,htmlFor:F,children:[Ve,Ue&&p(re,{})]}),wt=p(`input`,{id:F,ref:N,type:`file`,name:Se,hidden:!0,accept:O,disabled:q,onChange:xt});if(!Ge){let e=dt,t=Xe&&m(`button`,{type:`button`,className:`btn btn-secondary btn-sm wui-image-picker-buttons-camera`,disabled:q,onClick:pt,children:[p(r,{name:`camera`,size:16}),s.camera]});return m(`div`,{...a,className:`field wui-image-picker-field${S?` ${S}`:``}`,children:[$,m(`div`,{className:`wui-image-picker-buttons${gt?` is-dragging`:``}${We?` ${We}`:``}`,style:{"--wui-avatar-size":`${e}px`,...C},..._t,children:[m(`button`,{type:`button`,className:`wui-image-picker-buttons-face`,tabIndex:-1,"aria-label":Be??ut,"aria-describedby":ct,"aria-busy":g||void 0,disabled:q,onClick:ft,...w,children:[J?p(`img`,{className:`wui-image-picker-buttons-img`,src:J,alt:``,onError:()=>z(!0)}):p(`span`,{className:`wui-image-picker-buttons-placeholder`,"aria-hidden":`true`,children:l||p(r,{name:`user`,size:Math.round(e*.5)})}),p(`span`,{className:`wui-image-picker-buttons-badge`,"aria-hidden":`true`,children:g?p(r,{name:`refresh-cw`,size:14,className:`wui-spin`}):p(r,{name:`camera`,size:14})})]}),m(`div`,{className:`wui-image-picker-buttons-actions`,children:[p(i,{variant:`secondary`,size:`sm`,disabled:q,"aria-describedby":ct,onClick:ft,children:ut}),t,p(i,{variant:`secondary-danger`,size:`sm`,"data-wui-image-picker-remove":!0,hidden:!lt,onClick:St,children:b})]}),wt,Xe&&p(`input`,{ref:Qe,type:`file`,hidden:!0,accept:`image/*`,capture:`user`,disabled:q,onChange:xt}),Ct]}),p(ne,{error:Y,hint:x,errorId:Z,hintId:X}),Q]})}let Tt=dt,Et=Math.max(14,Math.round(Tt*.18)),Dt=Math.round(Tt*.5),Ot=`wui-image-picker${Ke===`avatar`?` wui-image-picker-avatar`:``}${_===`rounded`?` wui-image-picker-rounded`:_===`square`?` wui-image-picker-square`:``}${gt?` is-dragging`:``}`,kt=y===`inline`,At=y===`profile`,jt=[`field`,`wui-image-picker-field`,kt&&`wui-image-picker-field-inline`,At&&`wui-image-picker-field-profile`,We,S].filter(Boolean).join(` `),Mt=m(`div`,{className:`wui-image-picker-shell`,style:{"--wui-logo-size":`${Tt}px`},children:[p(`button`,{type:`button`,className:Ot,onClick:ft,disabled:q,"aria-busy":g||void 0,"aria-label":Be??`Upload photo`,"aria-describedby":Z||X,..._t,...w,children:m(`span`,{className:`wui-image-picker-ring`,"data-overlay-label":ze,children:[J?p(`img`,{className:`wui-image-picker-img`,src:J,alt:``,onError:()=>z(!0)}):p(`span`,{className:`wui-image-picker-logo`,children:l||Ke===`avatar`&&p(r,{name:`user`,size:Dt})}),g?p(`span`,{className:`wui-image-picker-overlay is-loading`,"aria-hidden":`true`,children:p(r,{name:`refresh-cw`,size:Et,className:`wui-spin`})}):!De&&m(`span`,{className:`wui-image-picker-overlay`,children:[p(r,{name:Re,size:Et}),p(`span`,{children:ze})]})]})}),ee(p(`button`,{type:`button`,className:`wui-image-picker-remove`,hidden:!lt,"aria-label":b,"data-wui-image-picker-remove":!0,onClick:St,children:p(r,{name:`x`,size:14})}),lt?b:null),wt,Ct]}),Nt=x&&!Y?p(`div`,{className:`wui-image-picker-hint`,id:X,children:x}):null,Pt=Y?p(ne,{error:Y,errorId:Z}):null,Ft=m(`div`,{className:`wui-image-picker-meta`,children:[Ie&&p(`div`,{className:`wui-image-picker-title`,children:Ie}),Le&&p(`div`,{className:`wui-image-picker-subtitle`,children:Le}),Nt,Pt]});return kt?m(`div`,{...a,className:jt,style:C,children:[$,m(`div`,{className:`wui-image-picker-row`,children:[Mt,Ft]}),Q]}):At?m(`div`,{...a,className:jt,style:C,children:[$,Mt,Ft,Q]}):m(`div`,{...a,className:jt,style:C,children:[$,Mt,Nt,Pt,Q]})}export{Ee as default};
1
+ import e from"../lib/FieldMessage.js";import t from"../lib/useFileDrop.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import ee from"./AppAlert.js";import r from"./AppButton.js";import i from"./AppIcon.js";import te from"./AppModal.js";import ne from"./AppRequiredMark.js";import a from"./warnInvalidValue.js";import re from"./warnUnknownProps.js";import ie from"./withTooltip.js";import{AVATAR_ACCEPT as ae,AVATAR_MAX_SIZE_MB as o,AVATAR_OUTPUT_SIZE as oe,AVATAR_OUTPUT_TYPE as s,AVATAR_PREVIEW_SIZES as se,AVATAR_TEXT as c,DEFAULT_IMAGE_ACCEPT as l,DEFAULT_MAX_SIZE_MB as ce,avatarUnreadableMessage as u,validateFile as le}from"@webority/ui-elements/helpers";import{useCallback as ue,useEffect as de,useId as fe,useRef as pe,useState as d}from"react";import{Fragment as me,jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/image-crop";var he=[`logo`,`avatar`],ge=[`overlay`,`buttons`],_e=[`stacked`,`inline`,`profile`],ve=[`initials`,`avatar`],ye=[`circle`,`rounded`,`square`],be=[`keep`,`image/webp`],xe=se.join(` `),Se={logo:{controls:`overlay`,accept:l,maxSizeMb:ce,crop:void 0,rotatable:!1,previews:!1,camera:!1,outputSize:void 0,outputType:`keep`,variant:`initials`,sizes:{sm:72,md:120,lg:160}},avatar:{controls:`buttons`,accept:ae,maxSizeMb:o,crop:1,rotatable:!0,previews:!0,camera:!0,outputSize:oe,outputType:s,variant:`avatar`,sizes:{sm:64,md:96,lg:128}}},Ce=`That image could not be cropped. Choose another one.`,we=`That image could not be opened. Choose another one.`,Te={dialogSize:`lg`,dialogTitle:`Crop photo`,dialogSubtitle:`Drag the frame and zoom to choose what to keep.`,save:`Apply`,cancel:`Cancel`,cropFailed:Ce,unreadable:()=>we},Ee={dialogSize:void 0,dialogTitle:c.dialogTitle,dialogSubtitle:c.dialogSubtitle,save:c.save,cancel:c.cancel,cropFailed:c.cropFailed,unreadable:u};function m(ae){let{marker:o,props:oe}=n(`AppImagePicker`,ae),{kind:s=`logo`,controls:se,value:l,fallback:ce,variant:u,name:Ce,onPick:we,onRemove:m,removeName:h,loading:g=!1,disabled:De=!1,accept:Oe,maxSizeMb:ke,shape:_=`circle`,size:v=`md`,crop:Ae,rotatable:je,previews:Me,camera:Ne,outputSize:Pe,outputType:Fe,layout:y=`stacked`,title:Ie,subtitle:Le,overlayIcon:Re=`image`,overlayLabel:ze=`Update photo`,removeLabel:b=`Remove photo`,ariaLabel:Be,label:Ve,hint:x,error:He,required:Ue=!1,optional:We=!1,className:Ge=``,fieldClassName:S=``,style:C,...w}=oe;re(`AppImagePicker`,w),a(`AppImagePicker`,`kind`,s,he),a(`AppImagePicker`,`controls`,se,ge),a(`AppImagePicker`,`variant`,u,ve),a(`AppImagePicker`,`layout`,y,_e),a(`AppImagePicker`,`shape`,_,ye),a(`AppImagePicker`,`outputType`,Fe,be);let T=Se[s]??Se.logo,E=s===`avatar`?Ee:Te,D=T.sizes;a(`AppImagePicker`,`size`,typeof v==`string`?v:null,Object.keys(D));let Ke=(se??T.controls)===`overlay`,qe=u??T.variant,O=Oe??T.accept,k=ke??T.maxSizeMb,Je=Pe??T.outputSize,Ye=Fe??T.outputType,Xe=je??T.rotatable,Ze=Me??T.previews,Qe=Ne??T.camera,A=Ae??T.crop,j=A===`free`?null:typeof A==`number`&&Number.isFinite(A)&&A>0?A:void 0;A!=null&&j===void 0&&a(`AppImagePicker`,`crop`,String(A),[`free`,`a positive number`]);let M=j!==void 0&&Je===void 0,N=pe(null),$e=pe(null),P=pe(null),F=fe(),[I,L]=d(null),[et,R]=d(!1),[tt,z]=d(!1),[nt,B]=d(``),[V,H]=d(null),[U,rt]=d(!1),[W,G]=d(`loading`),[it,K]=d(``),at=ue(e=>{if(P.current=e,!e)return;let t=()=>{G(`ready`),e.querySelector(`.wui-crop-stage`)?.focus()},n=()=>G(`error`);return e.addEventListener(`load`,t),e.addEventListener(`error`,n),()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),P.current=null}},[]);de(()=>()=>V&&URL.revokeObjectURL(V.url),[V]),de(()=>()=>I&&URL.revokeObjectURL(I),[I]);let[ot,st]=d(l);l!==ot&&(st(l),L(null),R(!1),z(!1));let q=g||De,J=et?null:I||(l&&!tt?l:null),ct=!!J,Y=He||nt,X=x&&!Y?`${F}-hint`:void 0,Z=Y?`${F}-error`:void 0,lt=Z||X,ut=!q&&ct&&(!!I||!!m||!!h),dt=ct?c.change:c.choose,ft=typeof v==`number`?v:D[v]??D.md,pt=()=>{q||N.current?.click()},mt=()=>{q||$e.current?.click()},ht=e=>{if(Ce&&N.current&&typeof DataTransfer==`function`){let t=new DataTransfer;t.items.add(e),N.current.files=t.files}R(!1),z(!1),L(URL.createObjectURL(e)),we(e)},gt=e=>{let t=j!==void 0&&e.type!==`image/svg+xml`,n=le(e,{accept:O,maxSizeMb:t&&M?0:k});n?B(n):(B(``),t?(G(`loading`),K(``),H({file:e,url:URL.createObjectURL(e)})):ht(e))},{dragOver:_t,dropProps:vt}=t({accept:O,maxSizeMb:M?0:k,disabled:q,onFiles:e=>gt(e[0]),onReject:({message:e})=>B(e)}),yt=e=>{let t=Ye===`keep`?e.type:Ye;return Je===void 0?{name:e.name,type:t,maxBytes:k>0?k*1024*1024:0}:{name:e.name||`photo`,type:t,size:Je}},bt=async()=>{let{file:e}=V;rt(!0),K(``);let t=null;try{t=await P.current?.toFile(yt(e))}catch{t=null}if(rt(!1),!t)K(E.cropFailed);else if(H(null),M){let e=le(t,{accept:O,maxSizeMb:k});e?B(e):ht(t)}else ht(t)},xt=()=>{U||H(null)},St=e=>{let t=e.target.files?.[0];e.target.value=``,t&&gt(t)},Ct=()=>{L(null),R(!0),B(``),N.current&&(N.current.value=``),m?.()},Q=j!==void 0&&/* @__PURE__ */ p(te,{open:!!V,title:E.dialogTitle,subtitle:E.dialogSubtitle,size:E.dialogSize,staticBackdrop:!0,dismissible:!U,onClose:xt,footer:/* @__PURE__ */ p(me,{children:[/* @__PURE__ */ f(r,{type:`button`,variant:`secondary`,disabled:U,onClick:xt,children:E.cancel}),/* @__PURE__ */ f(r,{type:`button`,variant:`primary`,loading:U,disabled:W!==`ready`,onClick:bt,children:E.save})]}),children:[W===`error`&&V&&/* @__PURE__ */ f(ee,{tone:`danger`,children:E.unreadable(V.file)}),it&&/* @__PURE__ */ f(ee,{tone:`danger`,children:it}),V&&W!==`error`&&/* @__PURE__ */ f(`wui-image-crop`,{ref:at,src:V.url,aspect:j??`free`,round:j===1&&_===`circle`,rotatable:Xe,previews:Ze?xe:void 0})]}),wt=h&&/* @__PURE__ */ f(`input`,{type:`hidden`,name:h,value:`true`,disabled:!et}),$=Ve&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:F,children:[Ve,We&&!Ue&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` (optional)`}),Ue&&/* @__PURE__ */ f(ne,{})]}),Tt=/* @__PURE__ */ f(`input`,{id:F,ref:N,type:`file`,name:Ce,hidden:!0,accept:O,disabled:q,onChange:St});if(!Ke){let t=ft,n=Qe&&/* @__PURE__ */ p(`button`,{type:`button`,className:`btn btn-secondary btn-sm wui-image-picker-buttons-camera`,disabled:q,onClick:mt,children:[/* @__PURE__ */ f(i,{name:`camera`,size:16}),c.camera]});return/* @__PURE__ */ p(`div`,{...o,className:`field wui-image-picker-field${S?` ${S}`:``}`,children:[$,/* @__PURE__ */ p(`div`,{className:`wui-image-picker-buttons${_t?` is-dragging`:``}${Ge?` ${Ge}`:``}`,style:{"--wui-avatar-size":`${t}px`,...C},...vt,children:[/* @__PURE__ */ p(`button`,{type:`button`,className:`wui-image-picker-buttons-face`,tabIndex:-1,"aria-label":Be??dt,"aria-describedby":lt,"aria-busy":g||void 0,disabled:q,onClick:pt,...w,children:[J?/* @__PURE__ */ f(`img`,{className:`wui-image-picker-buttons-img`,src:J,alt:``,onError:()=>z(!0)}):/* @__PURE__ */ f(`span`,{className:`wui-image-picker-buttons-placeholder`,"aria-hidden":`true`,children:ce||/* @__PURE__ */ f(i,{name:`user`,size:Math.round(t*.5)})}),/* @__PURE__ */ f(`span`,{className:`wui-image-picker-buttons-badge`,"aria-hidden":`true`,children:g?/* @__PURE__ */ f(i,{name:`refresh-cw`,size:14,className:`wui-spin`}):/* @__PURE__ */ f(i,{name:`camera`,size:14})})]}),/* @__PURE__ */ p(`div`,{className:`wui-image-picker-buttons-actions`,children:[/* @__PURE__ */ f(r,{variant:`secondary`,size:`sm`,disabled:q,"aria-describedby":lt,onClick:pt,children:dt}),n,/* @__PURE__ */ f(r,{variant:`secondary-danger`,size:`sm`,"data-wui-image-picker-remove":!0,hidden:!ut,onClick:Ct,children:b})]}),Tt,Qe&&/* @__PURE__ */ f(`input`,{ref:$e,type:`file`,hidden:!0,accept:`image/*`,capture:`user`,disabled:q,onChange:St}),wt]}),/* @__PURE__ */ f(e,{error:Y,hint:x,errorId:Z,hintId:X}),Q]})}let Et=ft,Dt=Math.max(14,Math.round(Et*.18)),Ot=Math.round(Et*.5),kt=`wui-image-picker${qe===`avatar`?` wui-image-picker-avatar`:``}${_===`rounded`?` wui-image-picker-rounded`:_===`square`?` wui-image-picker-square`:``}${_t?` is-dragging`:``}`,At=y===`inline`,jt=y===`profile`,Mt=[`field`,`wui-image-picker-field`,At&&`wui-image-picker-field-inline`,jt&&`wui-image-picker-field-profile`,Ge,S].filter(Boolean).join(` `),Nt=/* @__PURE__ */ p(`div`,{className:`wui-image-picker-shell`,style:{"--wui-logo-size":`${Et}px`},children:[/* @__PURE__ */ f(`button`,{type:`button`,className:kt,onClick:pt,disabled:q,"aria-busy":g||void 0,"aria-label":Be??`Upload photo`,"aria-describedby":Z||X,...vt,...w,children:/* @__PURE__ */ p(`span`,{className:`wui-image-picker-ring`,"data-overlay-label":ze,children:[J?/* @__PURE__ */ f(`img`,{className:`wui-image-picker-img`,src:J,alt:``,onError:()=>z(!0)}):/* @__PURE__ */ f(`span`,{className:`wui-image-picker-logo`,children:ce||qe===`avatar`&&/* @__PURE__ */ f(i,{name:`user`,size:Ot})}),g?/* @__PURE__ */ f(`span`,{className:`wui-image-picker-overlay is-loading`,"aria-hidden":`true`,children:/* @__PURE__ */ f(i,{name:`refresh-cw`,size:Dt,className:`wui-spin`})}):!De&&/* @__PURE__ */ p(`span`,{className:`wui-image-picker-overlay`,children:[/* @__PURE__ */ f(i,{name:Re,size:Dt}),/* @__PURE__ */ f(`span`,{children:ze})]})]})}),ie(/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-image-picker-remove`,hidden:!ut,"aria-label":b,"data-wui-image-picker-remove":!0,onClick:Ct,children:/* @__PURE__ */ f(i,{name:`x`,size:14})}),ut?b:null),Tt,wt]}),Pt=x&&!Y?/* @__PURE__ */ f(`div`,{className:`wui-image-picker-hint`,id:X,children:x}):null,Ft=Y?/* @__PURE__ */ f(e,{error:Y,errorId:Z}):null,It=/* @__PURE__ */ p(`div`,{className:`wui-image-picker-meta`,children:[Ie&&/* @__PURE__ */ f(`div`,{className:`wui-image-picker-title`,children:Ie}),Le&&/* @__PURE__ */ f(`div`,{className:`wui-image-picker-subtitle`,children:Le}),Pt,Ft]});return At?/* @__PURE__ */ p(`div`,{...o,className:Mt,style:C,children:[$,/* @__PURE__ */ p(`div`,{className:`wui-image-picker-row`,children:[Nt,It]}),Q]}):jt?/* @__PURE__ */ p(`div`,{...o,className:Mt,style:C,children:[$,Nt,It,Q]}):/* @__PURE__ */ p(`div`,{...o,className:Mt,style:C,children:[$,Nt,Pt,Ft,Q]})}export{m as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./AppPopover.js";import{useState as a}from"react";import{jsx as o}from"react/jsx-runtime";var s={sm:` infotip-popover-sm`,md:``,lg:` infotip-popover-lg`,xl:` infotip-popover-xl`};function c(c){let{marker:l,props:u}=e(`AppInfoTip`,c),{label:d,children:f,placement:p=`auto`,width:m=`md`,className:h=``,...g}=u;n(`AppInfoTip`,g),t(`AppInfoTip`,`width`,m,Object.keys(s));let[_,v]=a(!1),y=!!d;return!y&&!f?null:o(`span`,{className:`infotip${h?` ${h}`:``}`,...l,...g,children:o(i,{trigger:o(`button`,{type:`button`,className:`infotip-btn`,"aria-label":d||`More information`,children:o(r,{name:`info`,size:16})}),title:y?d:void 0,placement:p,triggerType:[`hover`,`focus`],className:`infotip-popover${s[m]??``}`,onToggle:v,"aria-expanded":_,children:f})})}export{c as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./AppPopover.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import{useState as a}from"react";import{jsx as o}from"react/jsx-runtime";var s={sm:` infotip-popover-sm`,md:``,lg:` infotip-popover-lg`,xl:` infotip-popover-xl`};function c(c){let{marker:l,props:u}=e(`AppInfoTip`,c),{label:d,children:f,placement:p=`auto`,width:m=`md`,className:h=``,...g}=u;i(`AppInfoTip`,g),r(`AppInfoTip`,`width`,m,Object.keys(s));let[_,v]=a(!1),y=!!d;return!y&&!f?null:/* @__PURE__ */ o(`span`,{className:`infotip${h?` ${h}`:``}`,...l,...g,children:/* @__PURE__ */ o(n,{trigger:/* @__PURE__ */ o(`button`,{type:`button`,className:`infotip-btn`,"aria-label":d||`More information`,children:/* @__PURE__ */ o(t,{name:`info`,size:16})}),title:y?d:void 0,placement:p,triggerType:[`hover`,`focus`],className:`infotip-popover${s[m]??``}`,onToggle:v,"aria-expanded":_,children:f})})}export{c as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./AppSelect.js";import{useEffect as a,useId as o,useRef as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/datepicker";import{INLINE_EDIT_TEXT as d,INLINE_EDIT_TYPES as f,inlineEditText as p}from"@webority/ui-elements/elements/inline-edit";var m=e=>e==null?``:String(e),h=(e,t)=>t===`number`?e===``?null:Number(e):e;function g(g){let{marker:_,props:v}=e(`AppInlineEdit`,g),{value:y,onSave:b,type:x,options:S=[],label:C,placeholder:w,validate:T,renderValue:E,disabled:D=!1,className:O=``,id:k,...A}=v;n(`AppInlineEdit`,A),t(`AppInlineEdit`,`type`,x,f);let j=f.includes(x)?x:`text`,M=o(),N=k||`inline-edit-${M.replace(/[^a-zA-Z0-9_-]/g,``)}`,P=`${N}-error`,F=`${N}-control`,I=s(null),L=m(y),[R,z]=c(L),[B,V]=c(L);R!==L&&(z(L),V(L));let[H,U]=c(null),W=s(null);W.current={onSave:b,validate:T,kind:j},a(()=>{let e=I.current;if(e)return e.save=async e=>{U(e);try{await W.current.onSave?.(h(e,W.current.kind)),V(e)}finally{U(null)}},e.validate=e=>W.current.validate?.(h(e,W.current.kind))||null,()=>{e.save=void 0,e.validate=void 0}},[]);let G=H??B,K=p(G,{type:j,options:S,placeholder:w}),q=E&&!K.empty?E(h(G,j)):K.text,J={id:F,"data-wui-control":``,"aria-label":C},Y;if(j===`select`){let e=S.map(e=>({value:String(e.value),label:m(e.label??e.value)}));Y=l(i,{id:F,"data-wui-control":``,"aria-label":C,size:`sm`,placeholder:w||void 0,options:e})}else Y=j===`date`?l(`wui-datepicker`,{...J,size:`sm`,"aria-describedby":P,placeholder:w||void 0}):j===`textarea`?l(`textarea`,{...J,className:`form-control textarea`,rows:3,"aria-describedby":P,placeholder:w||void 0}):l(`input`,{...J,type:j===`number`?`number`:`text`,inputMode:j===`number`?`decimal`:void 0,className:`form-control input input-sm`,"aria-describedby":P,placeholder:w||void 0});return u(`wui-inline-edit`,{ref:I,id:N,class:O?`wui-inline-edit ${O}`:`wui-inline-edit`,type:j,label:C,value:B,placeholder:w||void 0,disabled:D?``:void 0,controlled:``,..._,...A,children:[u(`button`,{type:`button`,className:`wui-inline-edit-display`,"data-wui-display":``,"aria-describedby":P,disabled:D,children:[l(`span`,{className:`visually-hidden`,children:D?d.readOnly(C):d.edit(C)}),l(`span`,{className:`wui-inline-edit-value`,"data-wui-value":``,"data-wui-empty":K.empty?``:void 0,children:q}),l(`span`,{className:`wui-inline-edit-icon`,"aria-hidden":`true`,children:l(r,{name:`edit`,size:14})})]}),l(`span`,{className:`wui-inline-edit-editor`,"data-wui-editor":``,hidden:!0,children:Y}),u(`span`,{className:`wui-inline-edit-status`,"aria-hidden":`true`,children:[l(`span`,{className:`wui-inline-edit-spinner spinner-border spinner-border-sm`}),l(`span`,{className:`wui-inline-edit-saved`,children:l(r,{name:`tick-circle`,size:16})})]}),l(`span`,{className:`wui-inline-edit-error`,id:P,"data-wui-error":``,hidden:!0}),l(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{g as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./AppSelect.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import{useEffect as a,useId as o,useRef as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/datepicker";import{INLINE_EDIT_TEXT as d,INLINE_EDIT_TYPES as f,inlineEditText as p}from"@webority/ui-elements/elements/inline-edit";var m=e=>e==null?``:String(e),h=(e,t)=>t===`number`?e===``?null:Number(e):e;function g(g){let{marker:_,props:v}=e(`AppInlineEdit`,g),{value:y,onSave:b,type:x,options:S=[],label:C,placeholder:w,validate:T,renderValue:E,disabled:D=!1,className:O=``,id:k,...A}=v;i(`AppInlineEdit`,A),r(`AppInlineEdit`,`type`,x,f);let j=f.includes(x)?x:`text`,M=o(),N=k||`inline-edit-${M.replace(/[^a-zA-Z0-9_-]/g,``)}`,P=`${N}-error`,F=`${N}-control`,I=s(null),L=m(y),[R,z]=c(L),[B,V]=c(L);R!==L&&(z(L),V(L));let[H,U]=c(null),W=s(null);W.current={onSave:b,validate:T,kind:j},a(()=>{let e=I.current;if(e)return e.save=async e=>{U(e);try{await W.current.onSave?.(h(e,W.current.kind)),V(e)}finally{U(null)}},e.validate=e=>W.current.validate?.(h(e,W.current.kind))||null,()=>{e.save=void 0,e.validate=void 0}},[]);let G=H??B,K=p(G,{type:j,options:S,placeholder:w}),q=E&&!K.empty?E(h(G,j)):K.text,J={id:F,"data-wui-control":``,"aria-label":C},Y;if(j===`select`){let e=S.map(e=>({value:String(e.value),label:m(e.label??e.value)}));Y=/* @__PURE__ */ l(n,{id:F,"data-wui-control":``,"aria-label":C,size:`sm`,placeholder:w||void 0,options:e})}else Y=j===`date`?/* @__PURE__ */ l(`wui-datepicker`,{...J,size:`sm`,"aria-describedby":P,placeholder:w||void 0}):j===`textarea`?/* @__PURE__ */ l(`textarea`,{...J,className:`form-control textarea`,rows:3,"aria-describedby":P,placeholder:w||void 0}):/* @__PURE__ */ l(`input`,{...J,type:j===`number`?`number`:`text`,inputMode:j===`number`?`decimal`:void 0,className:`form-control input input-sm`,"aria-describedby":P,placeholder:w||void 0});return/* @__PURE__ */ u(`wui-inline-edit`,{ref:I,id:N,class:O?`wui-inline-edit ${O}`:`wui-inline-edit`,type:j,label:C,value:B,placeholder:w||void 0,disabled:D?``:void 0,controlled:``,..._,...A,children:[/* @__PURE__ */ u(`button`,{type:`button`,className:`wui-inline-edit-display`,"data-wui-display":``,"aria-describedby":P,disabled:D,children:[/* @__PURE__ */ l(`span`,{className:`visually-hidden`,children:D?d.readOnly(C):d.edit(C)}),/* @__PURE__ */ l(`span`,{className:`wui-inline-edit-value`,"data-wui-value":``,"data-wui-empty":K.empty?``:void 0,children:q}),/* @__PURE__ */ l(`span`,{className:`wui-inline-edit-icon`,"aria-hidden":`true`,children:/* @__PURE__ */ l(t,{name:`edit`,size:14})})]}),/* @__PURE__ */ l(`span`,{className:`wui-inline-edit-editor`,"data-wui-editor":``,hidden:!0,children:Y}),/* @__PURE__ */ u(`span`,{className:`wui-inline-edit-status`,"aria-hidden":`true`,children:[/* @__PURE__ */ l(`span`,{className:`wui-inline-edit-spinner spinner-border spinner-border-sm`}),/* @__PURE__ */ l(`span`,{className:`wui-inline-edit-saved`,children:/* @__PURE__ */ l(t,{name:`tick-circle`,size:16})})]}),/* @__PURE__ */ l(`span`,{className:`wui-inline-edit-error`,id:P,"data-wui-error":``,hidden:!0}),/* @__PURE__ */ l(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{g as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import ee from"../lib/FieldMessage.js";import te from"./AppPopover.js";import ne from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import{MASK_INPUT_TYPES as re,MASK_NAMES as ie,attachInputMask as ae,evaluatePassword as oe,formatMasked as o,isMaskPattern as se,postedMasked as ce}from"@webority/ui-elements/helpers";import{forwardRef as le,useEffect as s,useId as ue,useRef as c,useState as l}from"react";import{Form as u}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var de=[`sm`,`md`,`lg`,`xl`],fe=[`bare`],pe=[`off`,`border`,`above`],me=[`off`,`shown`],p=le(function(le,p){let{marker:he,props:ge}=e(`AppInput`,le),{label:m,required:h=!1,optional:g=!1,error:_e,hint:ve,help:ye,helpLabel:be=`More information`,type:_=`text`,size:v=`md`,leftIcon:y,rightIcon:b,onRightIconClick:x,rightIconLabel:xe,unit:S,id:Se,name:Ce,className:we=``,fieldClassName:C=``,disabled:w=!1,readOnly:T=!1,clearable:E=!1,showCount:D=!1,maxLength:O,prefix:k,suffix:A,action:j,floatingLabel:M=`off`,variant:N,passwordRequirements:P=`off`,passwordPolicy:Te,requirementsPlacement:F=`auto`,mask:I,postFormatted:L=!1,onMaskChange:R,...z}=ge;r(`AppInput`,z),n(`AppInput`,`size`,v,de),n(`AppInput`,`variant`,N,fe),n(`AppInput`,`floatingLabel`,M,pe),n(`AppInput`,`passwordRequirements`,P,me),s(()=>{g&&h&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&t(`AppInput: optional and required together; optional ignored`)},[g,h]),I!=null&&!se(I)&&n(`AppInput`,`mask`,I,ie),I!=null&&n(`AppInput`,`type`,_,re);let[B,Ee]=l(!1),[De,Oe]=l(``),V=_e||De,ke=ue(),H=Se||ke,U=_===`password`,Ae=U&&B?`text`:_,W=c(null),je=e=>{W.current=e,typeof p==`function`?p(e):p&&(p.current=e)},G=String(z.value??z.defaultValue??``),[Me,K]=l(()=>!!G),[Ne,Pe]=l(()=>G.length),Fe=E&&!w&&!T,q=E||D,J=U&&P===`shown`,[Ie,Le]=l(G);s(()=>{!J||z.value===void 0||Le(String(z.value??``))},[z.value,J]),s(()=>{if(!q||z.value===void 0)return;let e=String(z.value??``);K(!!e),Pe(e.length)},[z.value,q]);let Re=e=>{K(!!e.target.value),Pe(e.target.value.length),z.onInput?.(e)},ze=e=>{J&&Le(e.target.value),q?Re(e):z.onInput?.(e)},Be=I?{...z.value!==void 0&&{value:o(I,z.value)},...z.defaultValue!==void 0&&{defaultValue:o(I,z.defaultValue)}}:null,Ve=c(R);Ve.current=R,s(()=>{let e=W.current;if(!(!I||!e))return ae(e,{mask:I,postFormatted:L,onChange:(e,t)=>Ve.current?.(e,t),onInvalidChange:Oe})},[I,L]);let Y=e=>I&&!L&&e?t=>{let n=t.target,r=new Proxy(n,{get:(e,t)=>{if(t===`value`)return ce(I,e.value);let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}});e(Object.create(t,{target:{value:r}}))}:e,He=Fe?d(`button`,{type:`button`,className:`input-clear`,onClick:()=>{let e=W.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;t?t.call(e,``):e.value=``,e.dispatchEvent(new Event(`input`,{bubbles:!0})),K(!1),e.focus()},"aria-label":`Clear`,tabIndex:-1,hidden:!Me,children:d(i,{name:`x`,size:16})}):null,Ue=V&&H?`${H}-error`:void 0,We=ve&&H?`${H}-hint`:void 0,X=J&&F===`inline`,Ge=X&&H?`${H}-requirements`:void 0,Ke=Ue||(X?Ge:We),qe=[`input`,v===`sm`?`input-sm`:``,v===`lg`?`input-lg`:``,v===`xl`?`wui-input-xl`:``,V?`error`:``,U?`pw`:``,S?`num-input`:``,!(M!==`off`&&m||k||A||S||U||b)&&E&&Fe?`has-clear`:``,N===`bare`?`input-bare`:``,we].filter(Boolean).join(` `),Z=d(u.Control,{id:H,name:Ce,type:Ae,className:qe,disabled:w,readOnly:T,required:h,"aria-invalid":V?`true`:`false`,"aria-describedby":Ke,maxLength:O,...z,onChange:Y(z.onChange),onBlur:Y(z.onBlur),...Be,placeholder:M===`off`?z.placeholder:` `,ref:je,onInput:q||J?ze:z.onInput}),Q=Te??!0,Je=Q&&typeof Q==`object`&&Q.title||`Password requirements`,Ye=J?oe(Ie,Q):null,Xe=J?d(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:Ge,"aria-label":X?Je:void 0,children:Ye.map(e=>f(`li`,{className:`pw-rule ${e.met?`met`:`unmet`}`,children:[d(`span`,{className:`pw-mark`,"aria-hidden":`true`}),d(`span`,{className:`pw-rule-text`,children:e.label}),d(`span`,{className:`visually-hidden`,children:e.met?`: met`:`: not met`})]},e.key))}):null,$;if(M!==`off`&&m&&!U)$=f(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:[Z,f(`label`,{className:`float-label`,htmlFor:H,children:[m,h&&d(a,{})]})]});else if(j)$=f(`div`,{className:`input-action-row`,children:[f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(i,{name:y,size:16})}),Z]}),d(`div`,{className:`input-action`,children:j})]});else if(k||A)$=f(`div`,{className:`input-affixed`,children:[k!=null&&d(`span`,{className:`affix affix-pre`,children:k}),Z,A!=null&&d(`span`,{className:`affix affix-suf`,children:A})]});else if(S)$=f(`div`,{className:`input-with-unit`,children:[Z,d(`span`,{className:`unit`,children:S})]});else if(U){let e=f(`button`,{type:`button`,className:`pw-toggle${B?` pw-revealed`:``}`,onClick:()=>Ee(e=>!e),"aria-label":B?`Hide password`:`Show password`,tabIndex:-1,children:[d(i,{name:`eye`,size:18,className:`pw-eye`}),d(i,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=M!==`off`&&m?d(`div`,{className:M===`above`?`field-float wui-float-above`:`field-float`,children:f(`div`,{className:`input-wrap`,children:[Z,e,f(`label`,{className:`float-label`,htmlFor:H,children:[m,h&&d(a,{})]})]})}):f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(i,{name:y,size:16})}),Z,e]});$=J&&!X?d(te,{trigger:t,triggerType:`focus`,placement:F,title:Je,className:`pw-popover`,children:Xe}):t}else $=b?f(`div`,{className:`input-wrap`,children:[Z,d(`button`,{type:`button`,className:`pw-toggle`,onClick:x,disabled:!x,tabIndex:-1,"aria-label":xe||b,children:d(i,{name:b,size:18})})]}):E?f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(i,{name:y,size:16})}),Z,He]}):y?f(`div`,{className:`input-icon`,children:[d(`span`,{className:`ic`,children:d(i,{name:y,size:16})}),Z]}):Z;return f(u.Group,{...he,className:`field${C?` ${C}`:``}`,children:[m&&M===`off`&&f(u.Label,{className:`label`,htmlFor:H,children:[m,g&&!h&&d(`span`,{className:`label-optional`,children:` (optional)`}),h&&d(a,{}),ye&&d(ne,{label:be,children:ye})]}),$,X&&d(`div`,{className:`wui-pw-inline`,children:Xe}),d(ee,{error:V,hint:X?null:ve,errorId:Ue,hintId:We}),D&&f(`div`,{className:`field-count${O&&Ne>=O?` at-limit`:``}`,children:[Ne,O?` / ${O}`:``]})]})});export{p as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import ee from"./AppInfoTip.js";import te from"./AppPopover.js";import i from"./AppRequiredMark.js";import a from"./warnInvalidValue.js";import ne from"./warnUnknownProps.js";import{MASK_INPUT_TYPES as re,MASK_NAMES as ie,attachInputMask as ae,evaluatePassword as oe,formatMasked as o,isMaskPattern as se,postedMasked as ce}from"@webority/ui-elements/helpers";import{forwardRef as le,useEffect as s,useId as ue,useRef as c,useState as l}from"react";import{Form as u}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var de=[`sm`,`md`,`lg`,`xl`],fe=[`bare`],pe=[`off`,`border`,`above`],me=[`off`,`shown`],p=le(function(le,p){let{marker:he,props:ge}=n(`AppInput`,le),{label:m,required:h=!1,optional:g=!1,error:_e,hint:ve,help:ye,helpLabel:be=`More information`,type:_=`text`,size:v=`md`,leftIcon:y,rightIcon:b,onRightIconClick:xe,rightIconLabel:Se,unit:x,id:Ce,name:we,className:Te=``,fieldClassName:S=``,disabled:C=!1,readOnly:w=!1,clearable:T=!1,showCount:E=!1,maxLength:D,prefix:O,suffix:k,action:A,floatingLabel:j=`off`,variant:M,passwordRequirements:N=`off`,passwordPolicy:Ee,requirementsPlacement:P=`auto`,mask:F,postFormatted:I=!1,onMaskChange:L,...R}=ge;ne(`AppInput`,R),a(`AppInput`,`size`,v,de),a(`AppInput`,`variant`,M,fe),a(`AppInput`,`floatingLabel`,j,pe),a(`AppInput`,`passwordRequirements`,N,me),s(()=>{g&&h&&typeof process<`u`&&process.env.NODE_ENV!==`production`&&e(`AppInput: optional and required together; optional ignored`)},[g,h]),F!=null&&!se(F)&&a(`AppInput`,`mask`,F,ie),F!=null&&a(`AppInput`,`type`,_,re);let[z,De]=l(!1),[Oe,ke]=l(``),B=_e||Oe,Ae=ue(),V=Ce||Ae,H=_===`password`,je=H&&z?`text`:_,U=c(null),Me=e=>{U.current=e,typeof p==`function`?p(e):p&&(p.current=e)},W=String(R.value??R.defaultValue??``),[Ne,G]=l(()=>!!W),[Pe,Fe]=l(()=>W.length),Ie=T&&!C&&!w,K=T||E,q=H&&N===`shown`,[Le,Re]=l(W);s(()=>{q&&R.value!==void 0&&Re(String(R.value??``))},[R.value,q]),s(()=>{if(!K||R.value===void 0)return;let e=String(R.value??``);G(!!e),Fe(e.length)},[R.value,K]);let ze=e=>{G(!!e.target.value),Fe(e.target.value.length),R.onInput?.(e)},Be=e=>{q&&Re(e.target.value),K?ze(e):R.onInput?.(e)},Ve=F?{...R.value!==void 0&&{value:o(F,R.value)},...R.defaultValue!==void 0&&{defaultValue:o(F,R.defaultValue)}}:null,He=c(L);He.current=L,s(()=>{let e=U.current;if(F&&e)return ae(e,{mask:F,postFormatted:I,onChange:(e,t)=>He.current?.(e,t),onInvalidChange:ke})},[F,I]);let J=e=>F&&!I&&e?t=>{let n=t.target,r=new Proxy(n,{get:(e,t)=>{if(t===`value`)return ce(F,e.value);let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}});e(Object.create(t,{target:{value:r}}))}:e,Ue=Ie?/* @__PURE__ */ d(`button`,{type:`button`,className:`input-clear`,onClick:()=>{let e=U.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;t?t.call(e,``):e.value=``,e.dispatchEvent(new Event(`input`,{bubbles:!0})),G(!1),e.focus()},"aria-label":`Clear`,tabIndex:-1,hidden:!Ne,children:/* @__PURE__ */ d(r,{name:`x`,size:16})}):null,We=B&&V?`${V}-error`:void 0,Ge=ve&&V?`${V}-hint`:void 0,Y=q&&P===`inline`,Ke=Y&&V?`${V}-requirements`:void 0,qe=We||(Y?Ke:Ge),Je=[`input`,v===`sm`?`input-sm`:``,v===`lg`?`input-lg`:``,v===`xl`?`wui-input-xl`:``,B?`error`:``,H?`pw`:``,x?`num-input`:``,!(j!==`off`&&m||O||k||x||H||b)&&T&&Ie?`has-clear`:``,M===`bare`?`input-bare`:``,Te].filter(Boolean).join(` `),X=/* @__PURE__ */ d(u.Control,{id:V,name:we,type:je,className:Je,disabled:C,readOnly:w,required:h,"aria-invalid":B?`true`:`false`,"aria-describedby":qe,maxLength:D,...R,onChange:J(R.onChange),onBlur:J(R.onBlur),...Ve,placeholder:j===`off`?R.placeholder:` `,ref:Me,onInput:K||q?Be:R.onInput}),Z=Ee??!0,Ye=Z&&typeof Z==`object`&&Z.title||`Password requirements`,Xe=q?oe(Le,Z):null,Q=q?/* @__PURE__ */ d(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:Ke,"aria-label":Y?Ye:void 0,children:Xe.map(e=>/* @__PURE__ */ f(`li`,{className:`pw-rule ${e.met?`met`:`unmet`}`,children:[/* @__PURE__ */ d(`span`,{className:`pw-mark`,"aria-hidden":`true`}),/* @__PURE__ */ d(`span`,{className:`pw-rule-text`,children:e.label}),/* @__PURE__ */ d(`span`,{className:`visually-hidden`,children:e.met?`: met`:`: not met`})]},e.key))}):null,$;if(j!==`off`&&m&&!H)$=/* @__PURE__ */ f(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:[X,/* @__PURE__ */ f(`label`,{className:`float-label`,htmlFor:V,children:[m,h&&/* @__PURE__ */ d(i,{})]})]});else if(A)$=/* @__PURE__ */ f(`div`,{className:`input-action-row`,children:[/* @__PURE__ */ f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&/* @__PURE__ */ d(`span`,{className:`ic`,children:/* @__PURE__ */ d(r,{name:y,size:16})}),X]}),/* @__PURE__ */ d(`div`,{className:`input-action`,children:A})]});else if(O||k)$=/* @__PURE__ */ f(`div`,{className:`input-affixed`,children:[O!=null&&/* @__PURE__ */ d(`span`,{className:`affix affix-pre`,children:O}),X,k!=null&&/* @__PURE__ */ d(`span`,{className:`affix affix-suf`,children:k})]});else if(x)$=/* @__PURE__ */ f(`div`,{className:`input-with-unit`,children:[X,/* @__PURE__ */ d(`span`,{className:`unit`,children:x})]});else if(H){let e=/* @__PURE__ */ f(`button`,{type:`button`,className:`pw-toggle${z?` pw-revealed`:``}`,onClick:()=>De(e=>!e),"aria-label":z?`Hide password`:`Show password`,tabIndex:-1,children:[/* @__PURE__ */ d(r,{name:`eye`,size:18,className:`pw-eye`}),/* @__PURE__ */ d(r,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=j!==`off`&&m?/* @__PURE__ */ d(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:/* @__PURE__ */ f(`div`,{className:`input-wrap`,children:[X,e,/* @__PURE__ */ f(`label`,{className:`float-label`,htmlFor:V,children:[m,h&&/* @__PURE__ */ d(i,{})]})]})}):/* @__PURE__ */ f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&/* @__PURE__ */ d(`span`,{className:`ic`,children:/* @__PURE__ */ d(r,{name:y,size:16})}),X,e]});$=q&&!Y?/* @__PURE__ */ d(te,{trigger:t,triggerType:`focus`,placement:P,title:Ye,className:`pw-popover`,children:Q}):t}else $=b?/* @__PURE__ */ f(`div`,{className:`input-wrap`,children:[X,/* @__PURE__ */ d(`button`,{type:`button`,className:`pw-toggle`,onClick:xe,disabled:!xe,tabIndex:-1,"aria-label":Se||b,children:/* @__PURE__ */ d(r,{name:b,size:18})})]}):T?/* @__PURE__ */ f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&/* @__PURE__ */ d(`span`,{className:`ic`,children:/* @__PURE__ */ d(r,{name:y,size:16})}),X,Ue]}):y?/* @__PURE__ */ f(`div`,{className:`input-icon`,children:[/* @__PURE__ */ d(`span`,{className:`ic`,children:/* @__PURE__ */ d(r,{name:y,size:16})}),X]}):X;return/* @__PURE__ */ f(u.Group,{...he,className:`field${S?` ${S}`:``}`,children:[m&&j===`off`&&/* @__PURE__ */ f(u.Label,{className:`label`,htmlFor:V,children:[m,g&&!h&&/* @__PURE__ */ d(`span`,{className:`label-optional`,children:` (optional)`}),h&&/* @__PURE__ */ d(i,{}),ye&&/* @__PURE__ */ d(ee,{label:be,children:ye})]}),$,Y&&/* @__PURE__ */ d(`div`,{className:`wui-pw-inline`,children:Q}),/* @__PURE__ */ d(t,{error:B,hint:Y?null:ve,errorId:We,hintId:Ge}),E&&/* @__PURE__ */ f(`div`,{className:`field-count${D&&Pe>=D?` at-limit`:``}`,children:[Pe,D?` / ${D}`:``]})]})});export{p as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppRequiredMark.js";import{cloneElement as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s={sm:`wui-addon-group-sm`,md:``,lg:`wui-addon-group-lg`},c=e=>typeof e==`string`||typeof e==`number`?a(`span`,{className:`wui-addon`,children:e}):e;function l(l){let{marker:u,props:d}=e(`AppInputGroup`,l),{children:f,leading:p,trailing:m,label:h,htmlFor:g,required:_=!1,size:v=`md`,className:y=``,...b}=d;n(`AppInputGroup`,b),t(`AppInputGroup`,`size`,v,Object.keys(s));let x=o(`div`,{className:[`wui-addon-group`,s[v]??``,h?``:y].filter(Boolean).join(` `),...h?{}:b,children:[c(p),f,c(m)]});return h?o(`div`,{className:[`field`,y].filter(Boolean).join(` `),...u,...b,children:[o(`label`,{className:`label`,htmlFor:g,children:[h,_&&a(r,{})]}),x]}):i(x,u)}export{l as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppRequiredMark.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import{cloneElement as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";var s={sm:`wui-addon-group-sm`,md:``,lg:`wui-addon-group-lg`},c=e=>typeof e==`string`||typeof e==`number`?/* @__PURE__ */ a(`span`,{className:`wui-addon`,children:e}):e;function l(l){let{marker:u,props:d}=e(`AppInputGroup`,l),{children:f,leading:p,trailing:m,label:h,htmlFor:g,required:_=!1,size:v=`md`,className:y=``,...b}=d;r(`AppInputGroup`,b),n(`AppInputGroup`,`size`,v,Object.keys(s));let x=/* @__PURE__ */ o(`div`,{className:[`wui-addon-group`,s[v]??``,h?``:y].filter(Boolean).join(` `),...h?{}:b,children:[c(p),f,c(m)]});return h?/* @__PURE__ */ o(`div`,{className:[`field`,y].filter(Boolean).join(` `),...u,...b,children:[/* @__PURE__ */ o(`label`,{className:`label`,htmlFor:g,children:[h,_&&/* @__PURE__ */ a(t,{})]}),x]}):i(x,u)}export{l as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{errorToast as i}from"./toast.js";import{formatValue as a}from"@webority/ui-elements/helpers";import{useEffect as o,useId as s,useMemo as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{KANBAN_SUMMARY_FORMATS as p,KANBAN_TEXT as m,KANBAN_TONES as h,kanbanOverflow as g,kanbanSummaryFormat as _,kanbanVisibleLimit as v,sumKanbanValues as ee}from"@webority/ui-elements/elements/kanban";var te=e=>e.key??e.id,y=e=>e.column,b=[`rupees`,`paise`],ne=[`inline`,`stacked`];function x(x){let{marker:S,props:C}=e(`AppKanban`,x),{columns:w,cards:T,renderCard:E,renderColumnActions:D,getCardKey:O=te,getCardColumn:k=y,getCardValue:A,cardLabel:j,isCardLocked:re,onLocked:ie,onMove:ae,accept:oe,filter:se,boardId:ce,ariaLabel:le=`Board`,emptyText:ue=m.empty,readOnly:de=!1,swipeHint:M=!1,fill:N=!1,columnWidth:P,fillOffset:F,activeCardKey:I,headLayout:L=`inline`,summaryFormat:R,summaryUnit:z,className:B=``,id:V,...H}=C;if(!Array.isArray(w))throw Error(`<AppKanban> columns is required: pass the board's stage columns.`);if(!Array.isArray(T))throw Error(`<AppKanban> cards is required: pass the cards, an empty array for an empty board.`);n(`AppKanban`,H),t(`AppKanban`,`summaryFormat`,R,p),t(`AppKanban`,`summaryUnit`,z,b),t(`AppKanban`,`headLayout`,L,ne);for(let e of w)t(`AppKanban`,`columns[].tone`,e.tone,h);let fe=s(),U=V||`kanban-${fe.replace(/[^a-zA-Z0-9_-]/g,``)}`,W=l(null),[G,K]=u(()=>new Map),[q,pe]=u(()=>new Set),[me,J]=u(()=>new Set),he=c(()=>new Map(T.map(e=>[String(O(e)),e])),[T,O]),Y=l(null);Y.current={accept:oe,onMove:ae,onLocked:ie,byKey:he,columns:w};let X=R&&p.includes(R)&&(z==null||b.includes(z))?_(R,z):null,Z=c(()=>{let e=new Map(w.map(e=>[e.key,[]])),t=[];for(let n of T){let r=String(O(n)),i=G.get(r);i?t.push([n,i]):e.get(k(n))?.push(n)}for(let[n,r]of t){let t=e.get(r.to);t&&t.splice(Math.min(r.index,t.length),0,n)}return e},[w,T,G,O,k]);o(()=>{let e=W.current;if(!e)return;e.accept=(e,t,n)=>{let r=Y.current.accept;return!r||r(Y.current.byKey.get(e.getAttribute(`data-wui-card`)),t,n)};let t=e=>{let{key:t,from:n,to:r,index:a}=e.detail,o=Y.current.onMove,s=Y.current.byKey.get(t);if(!o||!s)return;let c=Y.current.columns.find(e=>e.key===r)?.visibleLimit!=null;c&&J(e=>new Set(e).add(t)),K(e=>new Map(e).set(t,{to:r,index:a}));let l=()=>K(e=>{let n=new Map(e);return n.delete(t),n}),u;try{u=o({card:s,key:t,from:n,to:r,index:a})}catch(e){u=Promise.reject(e)}Promise.resolve(u).then(l,e=>{l(),c&&J(e=>{let n=new Set(e);return n.delete(t),n}),i(e?.message||m.failed.server)})},n=e=>{let{key:t,reason:n}=e.detail,r=Y.current.byKey.get(t);r&&Y.current.onLocked?.({card:r,key:t,reason:n})};return e.addEventListener(`wui:kanban:move`,t),e.addEventListener(`wui:kanban:locked`,n),()=>{e.removeEventListener(`wui:kanban:move`,t),e.removeEventListener(`wui:kanban:locked`,n),e.accept=void 0}},[]);let Q=e=>se?.(e)!==!1,ge=(e,t)=>{q.has(e)&&J(e=>{let n=new Set(e);for(let e of t)n.delete(String(O(e)));return n}),pe(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},$={};return P!=null&&($[`--wui-kanban-column-width`]=`${P}px`),F!=null&&($[`--wui-kanban-fill-offset`]=`${F}px`),f(`wui-kanban`,{ref:W,id:U,class:B?`wui-kanban ${B}`:`wui-kanban`,role:`region`,"aria-label":le,"board-id":ce||void 0,"summary-format":X?R:void 0,"summary-unit":X&&z?z:void 0,readonly:de?``:void 0,fill:N?``:void 0,"data-head-layout":L===`stacked`?`stacked`:void 0,style:$,controlled:``,...S,...H,children:[d(`nav`,{className:`wui-kanban-switcher`,"aria-label":`Board columns`,children:w.map((e,t)=>f(`button`,{type:`button`,className:`wui-kanban-switch`,"data-wui-switch":e.key,"aria-controls":`${U}-${e.key}`,"aria-current":t===0?`true`:void 0,children:[d(`span`,{className:`wui-kanban-switch-title`,children:e.title}),d(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:(Z.get(e.key)||[]).filter(Q).length})]},e.key))}),M&&f(`p`,{className:`wui-kanban-hint`,"aria-hidden":`true`,children:[d(r,{name:`arrow-swap-horizontal`,size:14}),m.swipeHint]}),d(`div`,{className:`wui-kanban-board`,"data-wui-scroller":``,children:w.map(e=>{let t=`${U}-${e.key}`,n=Z.get(e.key)||[],i=n.filter(Q),o=!!(e.collapsible&&e.collapsed),s=v(e.visibleLimit),c=q.has(e.key),l=g(i.map(e=>String(O(e))),s,c,me),u=typeof e.summary==`function`?e.summary(i):e.summary;X&&(u=a(ee(i.map(e=>A?.(e))),X));let p=D?.(e,i);return f(`section`,{className:`wui-kanban-column`,id:t,"data-wui-column":e.key,"data-tone":e.tone&&h.includes(e.tone)?e.tone:`neutral`,"aria-labelledby":`${t}-title`,"data-accept-from":e.acceptFrom?e.acceptFrom.join(` `):void 0,"data-collapsible":e.collapsible?``:void 0,"data-collapsed":o?``:void 0,children:[f(`header`,{className:`wui-kanban-head`,children:[d(`span`,{className:`wui-kanban-dot`,"aria-hidden":`true`}),d(`h2`,{className:`wui-kanban-title`,id:`${t}-title`,children:e.href?d(`a`,{href:e.href,children:e.title}):e.title}),d(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:i.length}),e.collapsible&&d(`span`,{className:`wui-kanban-lock`,"aria-hidden":`true`,children:d(r,{name:`lock`,size:14})}),p!=null&&p!==!1&&d(`div`,{className:`wui-kanban-actions`,"data-wui-no-drag":``,children:p}),e.collapsible&&d(`button`,{type:`button`,className:`wui-kanban-collapse`,"data-wui-collapse":``,"aria-expanded":o?`false`:`true`,"aria-controls":`${t}-body`,"aria-label":o?m.expand(e.title):m.collapse(e.title),children:d(r,{name:`chevron-left`,size:16})}),u!=null&&d(`div`,{className:`wui-kanban-summary`,"data-wui-summary":``,children:u})]}),d(`p`,{className:`wui-kanban-drop-note`,"data-wui-drop-note":``,hidden:!0}),d(`div`,{className:`wui-kanban-body`,id:`${t}-body`,"data-wui-body":``,children:n.map(e=>{let t=String(O(e)),n=G.has(t);return d(`article`,{className:`wui-kanban-card`,"data-wui-card":t,tabIndex:0,"aria-label":j?j(e):void 0,"data-wui-locked":re?.(e)?``:void 0,"data-wui-value":A?A(e)??void 0:void 0,"aria-current":I!=null&&t===String(I)?`true`:void 0,"aria-busy":n?`true`:void 0,"data-wui-saving":n?``:void 0,"data-wui-overflow":l.has(t)?``:void 0,hidden:!Q(e),children:E?.(e)},t)})}),s!=null&&d(`button`,{type:`button`,className:`wui-kanban-more`,"data-wui-more":``,"aria-controls":`${t}-body`,"aria-expanded":c?`true`:`false`,hidden:c?i.length<=s:l.size===0,onClick:()=>ge(e.key,n),children:c?m.fewer:m.more(l.size)}),d(`p`,{className:`wui-kanban-empty`,"data-wui-empty":``,hidden:i.length>0,children:e.emptyText??ue})]},e.key)})}),d(`p`,{className:`visually-hidden`,id:`${U}-help`,"data-wui-help":``,children:m.help}),d(`div`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{x as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import{errorToast as n}from"./toast.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import{formatValue as a}from"@webority/ui-elements/helpers";import{useEffect as o,useId as s,useMemo as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{KANBAN_SUMMARY_FORMATS as p,KANBAN_TEXT as m,KANBAN_TONES as h,kanbanOverflow as g,kanbanSummaryFormat as _,kanbanVisibleLimit as v,sumKanbanValues as ee}from"@webority/ui-elements/elements/kanban";var te=e=>e.key??e.id,y=e=>e.column,b=[`rupees`,`paise`],ne=[`inline`,`stacked`];function x(x){let{marker:S,props:C}=e(`AppKanban`,x),{columns:w,cards:T,renderCard:E,renderColumnActions:D,getCardKey:O=te,getCardColumn:k=y,getCardValue:A,cardLabel:j,isCardLocked:re,onLocked:ie,onMove:ae,accept:oe,filter:se,boardId:ce,ariaLabel:le=`Board`,emptyText:ue=m.empty,readOnly:de=!1,swipeHint:M=!1,fill:N=!1,columnWidth:P,fillOffset:F,activeCardKey:I,headLayout:L=`inline`,summaryFormat:R,summaryUnit:z,className:B=``,id:V,...H}=C;if(!Array.isArray(w))throw Error(`<AppKanban> columns is required: pass the board's stage columns.`);if(!Array.isArray(T))throw Error(`<AppKanban> cards is required: pass the cards, an empty array for an empty board.`);i(`AppKanban`,H),r(`AppKanban`,`summaryFormat`,R,p),r(`AppKanban`,`summaryUnit`,z,b),r(`AppKanban`,`headLayout`,L,ne);for(let e of w)r(`AppKanban`,`columns[].tone`,e.tone,h);let fe=s(),U=V||`kanban-${fe.replace(/[^a-zA-Z0-9_-]/g,``)}`,W=l(null),[G,K]=u(()=>/* @__PURE__ */ new Map),[q,pe]=u(()=>/* @__PURE__ */ new Set),[me,J]=u(()=>/* @__PURE__ */ new Set),he=c(()=>new Map(T.map(e=>[String(O(e)),e])),[T,O]),Y=l(null);Y.current={accept:oe,onMove:ae,onLocked:ie,byKey:he,columns:w};let X=R&&p.includes(R)&&(z==null||b.includes(z))?_(R,z):null,Z=c(()=>{let e=new Map(w.map(e=>[e.key,[]])),t=[];for(let n of T){let r=String(O(n)),i=G.get(r);i?t.push([n,i]):e.get(k(n))?.push(n)}for(let[n,r]of t){let t=e.get(r.to);t&&t.splice(Math.min(r.index,t.length),0,n)}return e},[w,T,G,O,k]);o(()=>{let e=W.current;if(!e)return;e.accept=(e,t,n)=>{let r=Y.current.accept;return!r||r(Y.current.byKey.get(e.getAttribute(`data-wui-card`)),t,n)};let t=e=>{let{key:t,from:r,to:i,index:a}=e.detail,o=Y.current.onMove,s=Y.current.byKey.get(t);if(!o||!s)return;let c=Y.current.columns.find(e=>e.key===i)?.visibleLimit!=null;c&&J(e=>new Set(e).add(t)),K(e=>new Map(e).set(t,{to:i,index:a}));let l=()=>K(e=>{let n=new Map(e);return n.delete(t),n}),u;try{u=o({card:s,key:t,from:r,to:i,index:a})}catch(e){u=Promise.reject(e)}Promise.resolve(u).then(l,e=>{l(),c&&J(e=>{let n=new Set(e);return n.delete(t),n}),n(e?.message||m.failed.server)})},r=e=>{let{key:t,reason:n}=e.detail,r=Y.current.byKey.get(t);r&&Y.current.onLocked?.({card:r,key:t,reason:n})};return e.addEventListener(`wui:kanban:move`,t),e.addEventListener(`wui:kanban:locked`,r),()=>{e.removeEventListener(`wui:kanban:move`,t),e.removeEventListener(`wui:kanban:locked`,r),e.accept=void 0}},[]);let Q=e=>se?.(e)!==!1,ge=(e,t)=>{q.has(e)&&J(e=>{let n=new Set(e);for(let e of t)n.delete(String(O(e)));return n}),pe(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},$={};return P!=null&&($[`--wui-kanban-column-width`]=`${P}px`),F!=null&&($[`--wui-kanban-fill-offset`]=`${F}px`),/* @__PURE__ */ f(`wui-kanban`,{ref:W,id:U,class:B?`wui-kanban ${B}`:`wui-kanban`,role:`region`,"aria-label":le,"board-id":ce||void 0,"summary-format":X?R:void 0,"summary-unit":X&&z?z:void 0,readonly:de?``:void 0,fill:N?``:void 0,"data-head-layout":L===`stacked`?`stacked`:void 0,style:$,controlled:``,...S,...H,children:[/* @__PURE__ */ d(`nav`,{className:`wui-kanban-switcher`,"aria-label":`Board columns`,children:w.map((e,t)=>/* @__PURE__ */ f(`button`,{type:`button`,className:`wui-kanban-switch`,"data-wui-switch":e.key,"aria-controls":`${U}-${e.key}`,"aria-current":t===0?`true`:void 0,children:[/* @__PURE__ */ d(`span`,{className:`wui-kanban-switch-title`,children:e.title}),/* @__PURE__ */ d(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:(Z.get(e.key)||[]).filter(Q).length})]},e.key))}),M&&/* @__PURE__ */ f(`p`,{className:`wui-kanban-hint`,"aria-hidden":`true`,children:[/* @__PURE__ */ d(t,{name:`arrow-swap-horizontal`,size:14}),m.swipeHint]}),/* @__PURE__ */ d(`div`,{className:`wui-kanban-board`,"data-wui-scroller":``,children:w.map(e=>{let n=`${U}-${e.key}`,r=Z.get(e.key)||[],i=r.filter(Q),o=!!(e.collapsible&&e.collapsed),s=v(e.visibleLimit),c=q.has(e.key),l=g(i.map(e=>String(O(e))),s,c,me),u=typeof e.summary==`function`?e.summary(i):e.summary;X&&(u=a(ee(i.map(e=>A?.(e))),X));let p=D?.(e,i);return/* @__PURE__ */ f(`section`,{className:`wui-kanban-column`,id:n,"data-wui-column":e.key,"data-tone":e.tone&&h.includes(e.tone)?e.tone:`neutral`,"aria-labelledby":`${n}-title`,"data-accept-from":e.acceptFrom?e.acceptFrom.join(` `):void 0,"data-collapsible":e.collapsible?``:void 0,"data-collapsed":o?``:void 0,children:[/* @__PURE__ */ f(`header`,{className:`wui-kanban-head`,children:[/* @__PURE__ */ d(`span`,{className:`wui-kanban-dot`,"aria-hidden":`true`}),/* @__PURE__ */ d(`h2`,{className:`wui-kanban-title`,id:`${n}-title`,children:e.href?/* @__PURE__ */ d(`a`,{href:e.href,children:e.title}):e.title}),/* @__PURE__ */ d(`span`,{className:`wui-kanban-count`,"data-wui-count":``,children:i.length}),e.collapsible&&/* @__PURE__ */ d(`span`,{className:`wui-kanban-lock`,"aria-hidden":`true`,children:/* @__PURE__ */ d(t,{name:`lock`,size:14})}),p!=null&&p!==!1&&/* @__PURE__ */ d(`div`,{className:`wui-kanban-actions`,"data-wui-no-drag":``,children:p}),e.collapsible&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-kanban-collapse`,"data-wui-collapse":``,"aria-expanded":o?`false`:`true`,"aria-controls":`${n}-body`,"aria-label":o?m.expand(e.title):m.collapse(e.title),children:/* @__PURE__ */ d(t,{name:`chevron-left`,size:16})}),u!=null&&/* @__PURE__ */ d(`div`,{className:`wui-kanban-summary`,"data-wui-summary":``,children:u})]}),/* @__PURE__ */ d(`p`,{className:`wui-kanban-drop-note`,"data-wui-drop-note":``,hidden:!0}),/* @__PURE__ */ d(`div`,{className:`wui-kanban-body`,id:`${n}-body`,"data-wui-body":``,children:r.map(e=>{let t=String(O(e)),n=G.has(t);return/* @__PURE__ */ d(`article`,{className:`wui-kanban-card`,"data-wui-card":t,tabIndex:0,"aria-label":j?j(e):void 0,"data-wui-locked":re?.(e)?``:void 0,"data-wui-value":A?A(e)??void 0:void 0,"aria-current":I!=null&&t===String(I)?`true`:void 0,"aria-busy":n?`true`:void 0,"data-wui-saving":n?``:void 0,"data-wui-overflow":l.has(t)?``:void 0,hidden:!Q(e),children:E?.(e)},t)})}),s!=null&&/* @__PURE__ */ d(`button`,{type:`button`,className:`wui-kanban-more`,"data-wui-more":``,"aria-controls":`${n}-body`,"aria-expanded":c?`true`:`false`,hidden:c?i.length<=s:l.size===0,onClick:()=>ge(e.key,r),children:c?m.fewer:m.more(l.size)}),/* @__PURE__ */ d(`p`,{className:`wui-kanban-empty`,"data-wui-empty":``,hidden:i.length>0,children:e.emptyText??ue})]},e.key)})}),/* @__PURE__ */ d(`p`,{className:`visually-hidden`,id:`${U}-help`,"data-wui-help":``,children:m.help}),/* @__PURE__ */ d(`div`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}export{x as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{shortcutKey as n}from"@webority/ui-elements/helpers";import{jsx as r}from"react/jsx-runtime";function i(i){let{marker:a,props:o}=e(`AppKbd`,i),{children:s,className:c=``,...l}=o;t(`AppKbd`,l);let u=typeof s==`string`||typeof s==`number`?n(s):s;return r(`kbd`,{className:[`wui-kbd`,c].filter(Boolean).join(` `),...a,...l,children:u})}export{i as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{shortcutKey as n}from"@webority/ui-elements/helpers";import{jsx as r}from"react/jsx-runtime";function i(i){let{marker:a,props:o}=e(`AppKbd`,i),{children:s,className:c=``,...l}=o;t(`AppKbd`,l);let u=typeof s==`string`||typeof s==`number`?n(s):s;return/* @__PURE__ */ r(`kbd`,{className:[`wui-kbd`,c].filter(Boolean).join(` `),...a,...l,children:u})}export{i as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./renderIconProp.js";import a from"./AppSparkline.js";import{isValidElement as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`plain`,`filled`,`accent`,`spotlight`],u=[`sm`,`md`,`lg`],d=[`primary`,`success`,`warning`,`danger`,`info`,`neutral`],f=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],p=[`up`,`down`,`flat`],m=[`success`,`danger`,`neutral`],h={success:` wui-kpi-delta--success`,danger:` wui-kpi-delta--danger`,neutral:` wui-kpi-delta--neutral`};function g(e){return e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(g).join(``):o(e)?g(e.props?.children):``}function _(e){let t=g(e).trim();return t.startsWith(`+`)?`up`:t.startsWith(`-`)||t.startsWith(`−`)?`down`:`flat`}function v(o){let{marker:g,props:v}=e(`AppKpiTile`,o),{label:y,value:b,caption:x,icon:S,iconTone:C,iconVariant:w,delta:T,deltaDirection:E,deltaTone:D,sparkline:O,variant:k=`plain`,size:A=`md`,valueSize:j,inline:M=!1,attention:N=!1,href:P,linkComponent:F,className:I=``,style:L,iconClassName:R=``,labelClassName:z=``,valueClassName:B=``,captionClassName:V=``,deltaClassName:H=``,sparklineClassName:U=``,...W}=v;n(`AppKpiTile`,W),t(`AppKpiTile`,`variant`,k,l),t(`AppKpiTile`,`size`,A,u),t(`AppKpiTile`,`iconTone`,C,d),t(`AppKpiTile`,`iconVariant`,w,f),t(`AppKpiTile`,`deltaDirection`,E,p),t(`AppKpiTile`,`deltaTone`,D,m);let G=`kpi${M?` kpi-inline`:``}${k===`filled`?` kpi-filled`:k===`accent`?` kpi-accent`:k===`spotlight`?` kpi-spotlight`:``}${A===`lg`?` kpi-lg`:A===`sm`?` kpi-sm`:``}${N?` kpi-attention`:``}${I?` ${I}`:``}`,K=typeof j==`number`&&j>0?{...L,"--wui-kpi-value-size":`${j}px`}:L,q=E??_(T),J=q===`up`?`arrow-up`:q===`down`?`arrow-down`:null,Y=Object.hasOwn(h,D??``)?h[D]:``,X=P==null?`div`:F||`a`,Z=P==null?{}:F?{to:P}:{href:P};return c(X,{className:G,style:K,...g,...W,...Z,children:[S&&s(`span`,{className:`kpi-icon${C?` kpi-icon-${C}`:``}${R?` ${R}`:``}`,children:i(S,{size:20,variant:w})}),s(`div`,{className:`kpi-label${z?` ${z}`:``}`,children:y}),s(`div`,{className:`kpi-value${B?` ${B}`:``}`,children:b}),x&&s(`div`,{className:`kpi-caption${V?` ${V}`:``}`,children:x}),T&&c(`div`,{className:`kpi-delta${q===`flat`?``:` ${q}`}${Y}${H?` ${H}`:``}`,children:[J&&s(r,{name:J,size:13}),T]}),O&&O.length>0&&s(a,{data:O,className:`kpi-sparkline${U?` ${U}`:``}`})]})}export{v as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./AppIcon.js";import n from"./AppSparkline.js";import r from"./renderIconProp.js";import i from"./warnInvalidValue.js";import a from"./warnUnknownProps.js";import{isValidElement as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`plain`,`filled`,`accent`,`spotlight`],u=[`sm`,`md`,`lg`],d=[`primary`,`success`,`warning`,`danger`,`info`,`neutral`],f=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],p=[`up`,`down`,`flat`],m=[`success`,`danger`,`neutral`],h={success:` wui-kpi-delta--success`,danger:` wui-kpi-delta--danger`,neutral:` wui-kpi-delta--neutral`};function g(e){return e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(g).join(``):o(e)?g(e.props?.children):``}function _(e){let t=g(e).trim();return t.startsWith(`+`)?`up`:t.startsWith(`-`)||t.startsWith(`−`)?`down`:`flat`}function v(o){let{marker:g,props:v}=e(`AppKpiTile`,o),{label:y,value:b,caption:x,icon:S,iconTone:C,iconVariant:w,delta:T,deltaDirection:E,deltaTone:D,sparkline:O,variant:k=`plain`,size:A=`md`,valueSize:j,inline:M=!1,attention:N=!1,href:P,linkComponent:F,className:I=``,style:L,iconClassName:R=``,labelClassName:z=``,valueClassName:B=``,captionClassName:V=``,deltaClassName:H=``,sparklineClassName:U=``,...W}=v;a(`AppKpiTile`,W),i(`AppKpiTile`,`variant`,k,l),i(`AppKpiTile`,`size`,A,u),i(`AppKpiTile`,`iconTone`,C,d),i(`AppKpiTile`,`iconVariant`,w,f),i(`AppKpiTile`,`deltaDirection`,E,p),i(`AppKpiTile`,`deltaTone`,D,m);let G=`kpi${M?` kpi-inline`:``}${k===`filled`?` kpi-filled`:k===`accent`?` kpi-accent`:k===`spotlight`?` kpi-spotlight`:``}${A===`lg`?` kpi-lg`:A===`sm`?` kpi-sm`:``}${N?` kpi-attention`:``}${I?` ${I}`:``}`,K=typeof j==`number`&&j>0?{...L,"--wui-kpi-value-size":`${j}px`}:L,q=E??_(T),J=q===`up`?`arrow-up`:q===`down`?`arrow-down`:null,Y=Object.hasOwn(h,D??``)?h[D]:``,X=P==null?`div`:F||`a`,Z=P==null?{}:F?{to:P}:{href:P};return/* @__PURE__ */ c(X,{className:G,style:K,...g,...W,...Z,children:[S&&/* @__PURE__ */ s(`span`,{className:`kpi-icon${C?` kpi-icon-${C}`:``}${R?` ${R}`:``}`,children:r(S,{size:20,variant:w})}),/* @__PURE__ */ s(`div`,{className:`kpi-label${z?` ${z}`:``}`,children:y}),/* @__PURE__ */ s(`div`,{className:`kpi-value${B?` ${B}`:``}`,children:b}),x&&/* @__PURE__ */ s(`div`,{className:`kpi-caption${V?` ${V}`:``}`,children:x}),T&&/* @__PURE__ */ c(`div`,{className:`kpi-delta${q===`flat`?``:` ${q}`}${Y}${H?` ${H}`:``}`,children:[J&&/* @__PURE__ */ s(t,{name:J,size:13}),T]}),O&&O.length>0&&/* @__PURE__ */ s(n,{data:O,className:`kpi-sparkline${U?` ${U}`:``}`})]})}export{v as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{useEffect as n,useRef as r}from"react";import{jsx as i}from"react/jsx-runtime";import"@webority/ui-elements/elements/lightbox";function a(a){let{marker:o,props:s}=e(`AppLightbox`,a),{items:c=[],download:l=!1,label:u,openIndex:d,onChange:f,onClose:p,className:m=``,...h}=s;t(`AppLightbox`,h);let g=r(null),_=r({onChange:f,onClose:p});return n(()=>{_.current={onChange:f,onClose:p}}),n(()=>{let e=g.current,t=e=>_.current.onChange?.(e.detail.index),n=()=>_.current.onClose?.();return e.addEventListener(`wui-lightbox:change`,t),e.addEventListener(`wui-lightbox:close`,n),()=>{e.removeEventListener(`wui-lightbox:change`,t),e.removeEventListener(`wui-lightbox:close`,n)}},[]),i(`wui-lightbox`,{ref:g,class:[`wui-lightbox`,m].filter(Boolean).join(` `),download:l?``:void 0,label:u||void 0,"open-index":Number.isInteger(d)?d:void 0,...o,...h,children:c.map(e=>i(`a`,{className:`wui-lightbox-item`,href:e.src,"data-caption":e.caption||void 0,"data-name":e.name||void 0,children:i(`img`,{src:e.thumb||e.src,alt:e.alt??e.caption??``,loading:`lazy`})},e.key??e.src))})}export{a as default};
1
+ import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{useEffect as n,useRef as r}from"react";import{jsx as i}from"react/jsx-runtime";import"@webority/ui-elements/elements/lightbox";function a(a){let{marker:o,props:s}=e(`AppLightbox`,a),{items:c=[],download:l=!1,label:u,openIndex:d,onChange:f,onClose:p,className:m=``,...h}=s;t(`AppLightbox`,h);let g=r(null),_=r({onChange:f,onClose:p});return n(()=>{_.current={onChange:f,onClose:p}}),n(()=>{let e=g.current,t=e=>_.current.onChange?.(e.detail.index),n=()=>_.current.onClose?.();return e.addEventListener(`wui-lightbox:change`,t),e.addEventListener(`wui-lightbox:close`,n),()=>{e.removeEventListener(`wui-lightbox:change`,t),e.removeEventListener(`wui-lightbox:close`,n)}},[]),/* @__PURE__ */ i(`wui-lightbox`,{ref:g,class:[`wui-lightbox`,m].filter(Boolean).join(` `),download:l?``:void 0,label:u||void 0,"open-index":Number.isInteger(d)?d:void 0,...o,...h,children:c.map(e=>/* @__PURE__ */ i(`a`,{className:`wui-lightbox-item`,href:e.src,"data-caption":e.caption||void 0,"data-name":e.name||void 0,children:/* @__PURE__ */ i(`img`,{src:e.thumb||e.src,alt:e.alt??e.caption??``,loading:`lazy`})},e.key??e.src))})}export{a as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnInvalidValue.js";import r from"./warnUnknownProps.js";import i from"./AppIcon.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";var c={sm:13,md:15,lg:18},l=[`underline`,`underline-center`,`static`,`slide`,`icon`,`highlight`,`bracket`,`fade`,`grow`,`glow`,`shine`,`none`];function u(e,t,n){if(!e)return null;let r=`wui-link__ic wui-link__ic--${t}`;return typeof e==`string`?o(`span`,{className:r,children:o(i,{name:e,size:c[n]??c.md})}):o(`span`,{className:r,children:e})}function d(i){let{marker:d,props:f}=e(`AppLink`,i),{children:p,label:m,href:h,animation:g=`underline`,leftIcon:_=null,rightIcon:v=null,size:y=`md`,surface:b=`default`,external:x=!1,disabled:S=!1,linkComponent:C,className:w=``,...T}=f;r(`AppLink`,T),n(`AppLink`,`animation`,g,l),n(`AppLink`,`size`,y,Object.keys(c)),n(`AppLink`,`surface`,b,[`default`,`dark`]),!h&&T.onClick&&!C&&t(`[@webority/ui-react] AppLink has onClick but no href, so it renders an anchor that keyboards cannot reach. Use AppButton for an action, or pass href.`);let E=l.includes(g)?g:`underline`,D=E===`icon`&&!v&&!_?`arrow-right`:v,O=[`wui-link`,`wui-link--${E}`,y===`md`?``:`wui-link--${y}`,S?`is-disabled`:``,b===`dark`?`wui-link--surface-dark`:``,w].filter(Boolean).join(` `),k=s(a,{children:[u(_,`left`,y),o(`span`,{className:`wui-link__label`,children:p??m}),u(D,`right`,y)]});return S?o(`span`,{className:O,"aria-disabled":`true`,...d,...T,children:k}):C&&!x?o(C,{className:O,to:h,...d,...T,children:k}):o(`a`,{className:O,href:h,target:x?`_blank`:void 0,rel:x?`noopener noreferrer`:void 0,...d,...T,children:k})}export{d as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./warnInvalidValue.js";import i from"./warnUnknownProps.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";var c={sm:13,md:15,lg:18},l=[`underline`,`underline-center`,`static`,`slide`,`icon`,`highlight`,`bracket`,`fade`,`grow`,`glow`,`shine`,`none`];function u(e,t,r){if(!e)return null;let i=`wui-link__ic wui-link__ic--${t}`;return typeof e==`string`?/* @__PURE__ */ o(`span`,{className:i,children:/* @__PURE__ */ o(n,{name:e,size:c[r]??c.md})}):/* @__PURE__ */ o(`span`,{className:i,children:e})}function d(n){let{marker:d,props:f}=t(`AppLink`,n),{children:p,label:m,href:h,animation:g=`underline`,leftIcon:_=null,rightIcon:v=null,size:y=`md`,surface:b=`default`,external:x=!1,disabled:S=!1,linkComponent:C,className:w=``,...T}=f;i(`AppLink`,T),r(`AppLink`,`animation`,g,l),r(`AppLink`,`size`,y,Object.keys(c)),r(`AppLink`,`surface`,b,[`default`,`dark`]),!h&&T.onClick&&!C&&e(`[@webority/ui-react] AppLink has onClick but no href, so it renders an anchor that keyboards cannot reach. Use AppButton for an action, or pass href.`);let E=l.includes(g)?g:`underline`,D=E===`icon`&&!v&&!_?`arrow-right`:v,O=[`wui-link`,`wui-link--${E}`,y===`md`?``:`wui-link--${y}`,S?`is-disabled`:``,b===`dark`?`wui-link--surface-dark`:``,w].filter(Boolean).join(` `),k=/* @__PURE__ */ s(a,{children:[u(_,`left`,y),/* @__PURE__ */ o(`span`,{className:`wui-link__label`,children:p??m}),u(D,`right`,y)]});if(S){let e={...T};return delete e.onClick,delete e.type,/* @__PURE__ */ o(`span`,{className:O,"aria-disabled":`true`,...d,...e,children:k})}return C&&!x?/* @__PURE__ */ o(C,{className:O,to:h,...d,...T,children:k}):/* @__PURE__ */ o(`a`,{className:O,href:h,target:x?`_blank`:void 0,rel:x?`noopener noreferrer`:void 0,...d,...T,children:k})}export{d as default};
@@ -1 +1 @@
1
- import{splitMarkerProps as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppCodeBlock.js";import i from"./AppLink.js";import{parseInline as a}from"../markdown-core/dist/inline.js";import{linkTarget as o,webRoute as s}from"../markdown-core/dist/links.js";import{parseMarkdown as c}from"../markdown-core/dist/parse.js";import{Fragment as l,useMemo as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import"@webority/ui-elements/elements/markdown";var p=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`];function m(r){let{marker:i,props:a}=e(`AppMarkdown`,r),{value:o,className:s=``,linkComponent:l,resolveLink:f,links:p=`web`,headings:m=`outline`,...h}=a;n(`AppMarkdown`,h),t(`AppMarkdown`,`links`,p,[`app`,`web`]),t(`AppMarkdown`,`headings`,m,[`outline`,`text`]);let g=u(()=>c(o),[o]),_={links:p,headings:m,resolveLink:f,linkComponent:l};return d(`wui-markdown`,{class:[`wui-markdown`,s].filter(Boolean).join(` `),...i,...h,children:g.map(e=>d(S,{block:e,options:_},e.key))})}function h({token:e,options:t}){let n=d(g,{tokens:e.children,options:t}),r=o(e.href,t.links,t.resolveLink);if(r?.kind===`app`){let e=s(r.target);return e?d(i,{href:e,linkComponent:t.linkComponent,animation:`static`,children:n}):n}return r?.kind===`web`?d(i,{href:r.href,external:!0,animation:`static`,children:n}):r?.kind===`contact`?d(i,{href:r.href,animation:`static`,children:n}):n}function g({tokens:e,options:t}){return e.map(e=>{switch(e.type){case`code`:return d(`code`,{children:e.text},e.key);case`strong`:return d(`strong`,{children:d(g,{tokens:e.children,options:t})},e.key);case`em`:return d(`em`,{children:d(g,{tokens:e.children,options:t})},e.key);case`strike`:return d(`del`,{children:d(g,{tokens:e.children,options:t})},e.key);case`image`:return f(l,{children:[`[`,d(g,{tokens:e.children,options:t}),`]`]},e.key);case`link`:return d(h,{token:e,options:t},e.key);default:return d(l,{children:e.text},e.key)}})}function _({text:e,options:t}){return d(g,{tokens:a(e),options:t})}function v({lines:e,options:t}){return e.map((e,n)=>f(l,{children:[n>0&&d(`br`,{}),d(_,{text:e,options:t})]},n))}function y({block:e,options:t}){let n=e=>d(_,{text:e,options:t});return d(`div`,{className:`table-responsive`,children:f(`table`,{className:`table`,children:[d(`thead`,{children:d(`tr`,{children:e.header.map((e,t)=>d(`th`,{scope:`col`,children:n(e)},t))})}),d(`tbody`,{children:e.rows.map((t,r)=>d(`tr`,{children:e.header.map((e,r)=>d(`td`,{children:n(t[r]??``)},r))},r))})]})})}function b(e,t,n){let{items:r}=e,{depth:i,ordered:a,number:o}=r[t],s=[],c=t;for(;c<r.length&&r[c].depth>=i;)if(r[c].depth>i){let t=b(e,c,n);s[s.length-1].nested=t.node,c=t.next}else s.push({item:r[c],index:c,nested:null}),c+=1;let l=s.map(({item:t,index:r,nested:i})=>f(`li`,{children:[d(_,{text:t.text,options:n}),i]},`${e.key}-${r}`));return{node:a?d(`ol`,{start:a&&o!==1?o:void 0,children:l},`${e.key}-${t}`):d(`ul`,{children:l},`${e.key}-${t}`),next:c}}function x(e,t){let n=[],r=0;for(;r<e.items.length;){let i=b(e,r,t);n.push(i.node),r=i.next}return n}function S({block:e,options:t}){switch(e.type){case`paragraph`:return d(`p`,{children:d(v,{lines:e.lines,options:t})});case`quote`:return d(`blockquote`,{children:d(v,{lines:e.lines,options:t})});case`heading`:{let n=d(_,{text:e.text,options:t});return t.headings===`text`?d(`p`,{className:`fw-semibold`,children:n}):d(`h2`,{children:n})}case`list`:return x(e,t);case`table`:return d(y,{block:e,options:t});case`code`:return d(r,{code:e.text,language:p.includes(e.language)?e.language:`text`});case`rule`:return d(`hr`,{});default:return null}}export{m as default};
1
+ import{linkTarget as e,webRoute as t}from"../markdown-core/dist/links.js";import{parseInline as n}from"../markdown-core/dist/inline.js";import{parseMarkdown as r}from"../markdown-core/dist/parse.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppChip.js";import o from"./AppCodeBlock.js";import s from"./AppLink.js";import c from"./warnInvalidValue.js";import l from"./warnUnknownProps.js";import{Fragment as u,useMemo as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/markdown";var m=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`];function h(e){let{marker:t,props:n}=i(`AppMarkdown`,e),{value:a,className:o=``,linkComponent:s,resolveLink:u,isCitation:p,onOpenCitation:m,links:h=`web`,headings:g=`outline`,..._}=n;l(`AppMarkdown`,_),c(`AppMarkdown`,`links`,h,[`app`,`web`]),c(`AppMarkdown`,`headings`,g,[`outline`,`text`]);let v=d(()=>r(a),[a]),y={links:h,headings:g,resolveLink:u,linkComponent:s,isCitation:p,onOpenCitation:m};return/* @__PURE__ */ f(`wui-markdown`,{class:[`wui-markdown`,o].filter(Boolean).join(` `),...t,..._,children:v.map(e=>/* @__PURE__ */ f(C,{block:e,options:y},e.key))})}function g({token:n,options:r}){let i=/* @__PURE__ */ f(_,{tokens:n.children,options:r}),a=e(n.href,r.links,r.resolveLink);if(a?.kind===`app`){let e=t(a.target);return e?/* @__PURE__ */ f(s,{href:e,linkComponent:r.linkComponent,animation:`static`,children:i}):i}return a?.kind===`web`?/* @__PURE__ */ f(s,{href:a.href,external:!0,animation:`static`,children:i}):a?.kind===`contact`?/* @__PURE__ */ f(s,{href:a.href,animation:`static`,children:i}):i}function _({tokens:e,options:t}){return e.map(e=>{switch(e.type){case`code`:return/* @__PURE__ */ f(`code`,{children:e.text},e.key);case`strong`:return/* @__PURE__ */ f(`strong`,{children:/* @__PURE__ */ f(_,{tokens:e.children,options:t})},e.key);case`em`:return/* @__PURE__ */ f(`em`,{children:/* @__PURE__ */ f(_,{tokens:e.children,options:t})},e.key);case`strike`:return/* @__PURE__ */ f(`del`,{children:/* @__PURE__ */ f(_,{tokens:e.children,options:t})},e.key);case`image`:return/* @__PURE__ */ p(u,{children:[`[`,/* @__PURE__ */ f(_,{tokens:e.children,options:t}),`]`]},e.key);case`link`:return/* @__PURE__ */ f(g,{token:e,options:t},e.key);case`citation`:return/* @__PURE__ */ f(a,{label:e.text,size:`sm`,tone:`primary`,variant:`outline`,"aria-label":e.text,className:`wui-markdown-citation`,onClick:t.onOpenCitation?()=>t.onOpenCitation(e.text):void 0},e.key);default:return/* @__PURE__ */ f(u,{children:e.text},e.key)}})}function v({text:e,options:t}){return/* @__PURE__ */ f(_,{tokens:n(e,{isCitation:t.isCitation}),options:t})}function y({lines:e,options:t}){return e.map((e,n)=>/* @__PURE__ */ p(u,{children:[n>0&&/* @__PURE__ */ f(`br`,{}),/* @__PURE__ */ f(v,{text:e,options:t})]},n))}function b({block:e,options:t}){let n=e=>/* @__PURE__ */ f(v,{text:e,options:t});return/* @__PURE__ */ f(`div`,{className:`table-responsive`,children:/* @__PURE__ */ p(`table`,{className:`table`,children:[/* @__PURE__ */ f(`thead`,{children:/* @__PURE__ */ f(`tr`,{children:e.header.map((e,t)=>/* @__PURE__ */ f(`th`,{scope:`col`,children:n(e)},t))})}),/* @__PURE__ */ f(`tbody`,{children:e.rows.map((t,r)=>/* @__PURE__ */ f(`tr`,{children:e.header.map((e,r)=>/* @__PURE__ */ f(`td`,{children:n(t[r]??``)},r))},r))})]})})}function x(e,t,n){let{items:r}=e,{depth:i,ordered:a,number:o}=r[t],s=[],c=t;for(;c<r.length&&r[c].depth>=i;)if(r[c].depth>i){let t=x(e,c,n);s[s.length-1].nested=t.node,c=t.next}else s.push({item:r[c],index:c,nested:null}),c+=1;let l=s.map(({item:t,index:r,nested:i})=>/* @__PURE__ */ p(`li`,{children:[/* @__PURE__ */ f(v,{text:t.text,options:n}),i]},`${e.key}-${r}`));return{node:a?/* @__PURE__ */ f(`ol`,{start:a&&o!==1?o:void 0,children:l},`${e.key}-${t}`):/* @__PURE__ */ f(`ul`,{children:l},`${e.key}-${t}`),next:c}}function S(e,t){let n=[],r=0;for(;r<e.items.length;){let i=x(e,r,t);n.push(i.node),r=i.next}return n}function C({block:e,options:t}){switch(e.type){case`paragraph`:return/* @__PURE__ */ f(`p`,{children:/* @__PURE__ */ f(y,{lines:e.lines,options:t})});case`quote`:return/* @__PURE__ */ f(`blockquote`,{children:/* @__PURE__ */ f(y,{lines:e.lines,options:t})});case`heading`:{let n=/* @__PURE__ */ f(v,{text:e.text,options:t});return t.headings===`text`?/* @__PURE__ */ f(`p`,{className:`fw-semibold`,children:n}):/* @__PURE__ */ f(`h2`,{children:n})}case`list`:return S(e,t);case`table`:return/* @__PURE__ */ f(b,{block:e,options:t});case`code`:return/* @__PURE__ */ f(o,{code:e.text,language:m.includes(e.language)?e.language:`text`});case`rule`:return/* @__PURE__ */ f(`hr`,{});default:return null}}export{h as default};