@webority/ui-react 0.88.0 → 0.89.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 (190) hide show
  1. package/dist/canvas-kit/kit.css +0 -0
  2. package/dist/canvas-kit/kit.js +155261 -0
  3. package/dist/canvas-kit/manifest.json +26177 -0
  4. package/dist/canvas-kit/release.json +25 -0
  5. package/dist/components/AppAutocomplete.js +1 -1
  6. package/dist/components/AppAvatarPicker.js +1 -1
  7. package/dist/components/AppChipGroup.js +1 -1
  8. package/dist/components/AppColorField.js +1 -1
  9. package/dist/components/AppCommandPalette.js +1 -1
  10. package/dist/components/AppCountrySelect.js +1 -1
  11. package/dist/components/AppDatePicker.js +1 -1
  12. package/dist/components/AppDateRangePicker.js +1 -1
  13. package/dist/components/AppDropZone.js +1 -1
  14. package/dist/components/AppFileAttachment.js +1 -1
  15. package/dist/components/AppFilePicker.js +1 -1
  16. package/dist/components/AppIcon.js +1 -1
  17. package/dist/components/AppInput.js +1 -1
  18. package/dist/components/AppLogoPicker.js +1 -1
  19. package/dist/components/AppMentionInput.js +1 -1
  20. package/dist/components/AppMeter.js +1 -1
  21. package/dist/components/AppModal.js +1 -1
  22. package/dist/components/AppMultiSelect.js +1 -1
  23. package/dist/components/AppNumberInput.js +1 -1
  24. package/dist/components/AppOtpInput.js +1 -1
  25. package/dist/components/AppPhoneNumberInput.js +1 -1
  26. package/dist/components/AppProgress.js +1 -1
  27. package/dist/components/AppRadioGroup.js +1 -1
  28. package/dist/components/AppRating.js +1 -1
  29. package/dist/components/AppRichText.js +1 -1
  30. package/dist/components/AppSearch.js +1 -1
  31. package/dist/components/AppSegmented.js +1 -1
  32. package/dist/components/AppSelect.js +1 -1
  33. package/dist/components/AppSidebarMenu.js +1 -1
  34. package/dist/components/AppSlider.js +1 -1
  35. package/dist/components/AppSplitView.js +1 -1
  36. package/dist/components/AppTabs.js +1 -1
  37. package/dist/components/AppTagInput.js +1 -1
  38. package/dist/components/AppTextarea.js +1 -1
  39. package/dist/components/AppTimePicker.js +1 -1
  40. package/dist/guidance.json +9623 -0
  41. package/dist/lib/wuiMarker.js +1 -1
  42. package/dist/types/components/AppAccordion.d.ts +14 -4
  43. package/dist/types/components/AppActionIcon.d.ts +40 -15
  44. package/dist/types/components/AppAlert.d.ts +50 -17
  45. package/dist/types/components/AppAsyncBlock.d.ts +19 -9
  46. package/dist/types/components/AppAutocomplete.d.ts +36 -0
  47. package/dist/types/components/AppAvatar.d.ts +48 -12
  48. package/dist/types/components/AppAvatarGroup.d.ts +14 -4
  49. package/dist/types/components/AppAvatarPicker.d.ts +50 -19
  50. package/dist/types/components/AppBadge.d.ts +14 -3
  51. package/dist/types/components/AppBanner.d.ts +13 -3
  52. package/dist/types/components/AppBreadcrumbs.d.ts +3 -3
  53. package/dist/types/components/AppButton.d.ts +72 -20
  54. package/dist/types/components/AppButtonGroup.d.ts +18 -4
  55. package/dist/types/components/AppCalendar.d.ts +13 -0
  56. package/dist/types/components/AppCard.d.ts +60 -21
  57. package/dist/types/components/AppCarousel.d.ts +56 -14
  58. package/dist/types/components/AppChart.d.ts +38 -0
  59. package/dist/types/components/AppChartCard.d.ts +13 -5
  60. package/dist/types/components/AppCheckbox.d.ts +9 -0
  61. package/dist/types/components/AppChip.d.ts +29 -10
  62. package/dist/types/components/AppChipGroup.d.ts +16 -3
  63. package/dist/types/components/AppChoiceCard.d.ts +55 -14
  64. package/dist/types/components/AppChoiceChip.d.ts +26 -6
  65. package/dist/types/components/AppCodeBlock.d.ts +27 -7
  66. package/dist/types/components/AppColorField.d.ts +36 -8
  67. package/dist/types/components/AppColumnMenu.d.ts +17 -4
  68. package/dist/types/components/AppCommandPalette.d.ts +72 -29
  69. package/dist/types/components/AppCommentThread.d.ts +25 -7
  70. package/dist/types/components/AppCompareTable.d.ts +9 -4
  71. package/dist/types/components/AppConfirmDialog.d.ts +54 -15
  72. package/dist/types/components/AppConsentBanner.d.ts +45 -12
  73. package/dist/types/components/AppContextMenu.d.ts +23 -10
  74. package/dist/types/components/AppCopyButton.d.ts +39 -9
  75. package/dist/types/components/AppCountrySelect.d.ts +50 -1
  76. package/dist/types/components/AppDashboardCell.d.ts +10 -2
  77. package/dist/types/components/AppDashboardGrid.d.ts +5 -1
  78. package/dist/types/components/AppDataTable.d.ts +103 -50
  79. package/dist/types/components/AppDatePicker.d.ts +32 -0
  80. package/dist/types/components/AppDateRangePicker.d.ts +31 -0
  81. package/dist/types/components/AppDescriptions.d.ts +28 -8
  82. package/dist/types/components/AppDrawer.d.ts +54 -13
  83. package/dist/types/components/AppDropZone.d.ts +34 -11
  84. package/dist/types/components/AppDropdown.d.ts +27 -20
  85. package/dist/types/components/AppDueDate.d.ts +16 -5
  86. package/dist/types/components/AppEmptyState.d.ts +22 -6
  87. package/dist/types/components/AppErrorSummary.d.ts +17 -4
  88. package/dist/types/components/AppFileAttachment.d.ts +30 -14
  89. package/dist/types/components/AppFilePicker.d.ts +39 -13
  90. package/dist/types/components/AppFileViewer.d.ts +21 -0
  91. package/dist/types/components/AppFilterBar.d.ts +23 -8
  92. package/dist/types/components/AppFloatingDock.d.ts +20 -6
  93. package/dist/types/components/AppFormActions.d.ts +11 -2
  94. package/dist/types/components/AppFormRow.d.ts +11 -2
  95. package/dist/types/components/AppFormSection.d.ts +25 -9
  96. package/dist/types/components/AppHoverCard.d.ts +25 -8
  97. package/dist/types/components/AppIcon.d.ts +18 -8
  98. package/dist/types/components/AppInfoList.d.ts +2 -0
  99. package/dist/types/components/AppInfoTip.d.ts +17 -4
  100. package/dist/types/components/AppInlineEdit.d.ts +22 -11
  101. package/dist/types/components/AppInput.d.ts +81 -2
  102. package/dist/types/components/AppInputGroup.d.ts +19 -6
  103. package/dist/types/components/AppKanban.d.ts +51 -23
  104. package/dist/types/components/AppKbd.d.ts +1 -0
  105. package/dist/types/components/AppKpiTile.d.ts +61 -31
  106. package/dist/types/components/AppLightbox.d.ts +12 -6
  107. package/dist/types/components/AppLink.d.ts +38 -17
  108. package/dist/types/components/AppLogoPicker.d.ts +88 -23
  109. package/dist/types/components/AppMarkdown.d.ts +3 -1
  110. package/dist/types/components/AppMentionInput.d.ts +35 -0
  111. package/dist/types/components/AppMenubar.d.ts +9 -7
  112. package/dist/types/components/AppMeter.d.ts +39 -10
  113. package/dist/types/components/AppMetricStrip.d.ts +11 -2
  114. package/dist/types/components/AppModal.d.ts +48 -19
  115. package/dist/types/components/AppMultiSelect.d.ts +44 -0
  116. package/dist/types/components/AppNavigationMenu.d.ts +6 -3
  117. package/dist/types/components/AppNotificationCenter.d.ts +23 -8
  118. package/dist/types/components/AppNumberInput.d.ts +38 -1
  119. package/dist/types/components/AppOnboardingChecklist.d.ts +27 -8
  120. package/dist/types/components/AppOtpInput.d.ts +24 -0
  121. package/dist/types/components/AppPageHeader.d.ts +60 -19
  122. package/dist/types/components/AppPagination.d.ts +21 -7
  123. package/dist/types/components/AppPhoneNumberInput.d.ts +37 -0
  124. package/dist/types/components/AppPopover.d.ts +23 -16
  125. package/dist/types/components/AppPricingCard.d.ts +27 -8
  126. package/dist/types/components/AppProgress.d.ts +44 -10
  127. package/dist/types/components/AppQrCode.d.ts +13 -5
  128. package/dist/types/components/AppRadio.d.ts +10 -0
  129. package/dist/types/components/AppRadioGroup.d.ts +47 -17
  130. package/dist/types/components/AppRating.d.ts +52 -15
  131. package/dist/types/components/AppRecordPager.d.ts +24 -8
  132. package/dist/types/components/AppRelativeTime.d.ts +9 -5
  133. package/dist/types/components/AppRepeater.d.ts +34 -8
  134. package/dist/types/components/AppResizable.d.ts +11 -3
  135. package/dist/types/components/AppResizableHandle.d.ts +9 -1
  136. package/dist/types/components/AppResizablePanel.d.ts +10 -3
  137. package/dist/types/components/AppResourceCard.d.ts +14 -2
  138. package/dist/types/components/AppResult.d.ts +23 -7
  139. package/dist/types/components/AppRichText.d.ts +34 -0
  140. package/dist/types/components/AppRollingNumber.d.ts +17 -7
  141. package/dist/types/components/AppRouteError.d.ts +22 -5
  142. package/dist/types/components/AppScoreScale.d.ts +40 -12
  143. package/dist/types/components/AppScrollbar.d.ts +7 -3
  144. package/dist/types/components/AppSearch.d.ts +32 -7
  145. package/dist/types/components/AppSectionCallToAction.d.ts +27 -7
  146. package/dist/types/components/AppSectionFaq.d.ts +27 -7
  147. package/dist/types/components/AppSectionFeatures.d.ts +34 -8
  148. package/dist/types/components/AppSectionHero.d.ts +29 -8
  149. package/dist/types/components/AppSectionLogos.d.ts +29 -7
  150. package/dist/types/components/AppSectionPricing.d.ts +25 -6
  151. package/dist/types/components/AppSectionTestimonials.d.ts +29 -7
  152. package/dist/types/components/AppSegmented.d.ts +41 -13
  153. package/dist/types/components/AppSelect.d.ts +53 -1
  154. package/dist/types/components/AppSelectMini.d.ts +28 -11
  155. package/dist/types/components/AppShell.d.ts +81 -35
  156. package/dist/types/components/AppShortcutLegend.d.ts +12 -4
  157. package/dist/types/components/AppShowMore.d.ts +26 -5
  158. package/dist/types/components/AppSidebarMenu.d.ts +59 -18
  159. package/dist/types/components/AppSkeleton.d.ts +33 -4
  160. package/dist/types/components/AppSlider.d.ts +43 -0
  161. package/dist/types/components/AppSortableList.d.ts +20 -0
  162. package/dist/types/components/AppSparkline.d.ts +19 -5
  163. package/dist/types/components/AppSpinner.d.ts +14 -3
  164. package/dist/types/components/AppSplash.d.ts +24 -7
  165. package/dist/types/components/AppSplitButton.d.ts +47 -14
  166. package/dist/types/components/AppSplitView.d.ts +53 -27
  167. package/dist/types/components/AppStatusBadge.d.ts +11 -3
  168. package/dist/types/components/AppStepper.d.ts +36 -11
  169. package/dist/types/components/AppSwitch.d.ts +16 -0
  170. package/dist/types/components/AppTableEmptyState.d.ts +7 -3
  171. package/dist/types/components/AppTablePagination.d.ts +23 -9
  172. package/dist/types/components/AppTableToolbar.d.ts +24 -10
  173. package/dist/types/components/AppTabs.d.ts +47 -18
  174. package/dist/types/components/AppTagInput.d.ts +38 -0
  175. package/dist/types/components/AppTextarea.d.ts +46 -0
  176. package/dist/types/components/AppThemeToggle.d.ts +58 -12
  177. package/dist/types/components/AppTimePicker.d.ts +38 -1
  178. package/dist/types/components/AppTimeline.d.ts +22 -20
  179. package/dist/types/components/AppToast.d.ts +30 -12
  180. package/dist/types/components/AppToolbar.d.ts +24 -9
  181. package/dist/types/components/AppTooltip.d.ts +24 -14
  182. package/dist/types/components/AppTour.d.ts +10 -0
  183. package/dist/types/components/AppTreeView.d.ts +23 -0
  184. package/dist/types/components/AppTruncate.d.ts +11 -2
  185. package/dist/types/components/AppUpdateBar.d.ts +10 -2
  186. package/dist/types/components/AppWhatsNew.d.ts +26 -7
  187. package/dist/types/components/AppWizard.d.ts +79 -0
  188. package/dist/types/components/AppWorkspaceSwitcher.d.ts +36 -17
  189. package/dist/types/lib/wuiMarker.d.ts +4 -0
  190. package/package.json +11 -7
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "webority-web",
3
+ "version": "0.89.0",
4
+ "platform": "Web",
5
+ "kitModuleVersion": 2,
6
+ "rendererProtocolVersion": 7,
7
+ "library": {
8
+ "name": "@webority/ui-react",
9
+ "version": "0.89.0"
10
+ },
11
+ "files": {
12
+ "manifest.json": {
13
+ "sha256": "8541ce50a6736db5525c7eaf776fb53d3fb880b89b840d60b8f44eec9c82082f",
14
+ "bytes": 833504
15
+ },
16
+ "kit.js": {
17
+ "sha256": "fcdeb8001fe0cbc89823acaef1c62b871689348a0805a79bef658884bb82c7eb",
18
+ "bytes": 10836871
19
+ },
20
+ "kit.css": {
21
+ "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
22
+ "bytes": 0
23
+ }
24
+ }
25
+ }
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useNodeLabels.js";import s,{optionsEqual as c}from"./useWuiControl.js";import{forwardRef as l,useEffect as u,useId as d,useRef as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import"@webority/ui-elements/elements/autocomplete";var h=[`sm`,`lg`],g=[],_=(e,t)=>({...e,label:t}),v=(e,t,n)=>{if(n==null||t==null||t===``)return e;let r=String(t);return e.some(e=>String(e.value)===r)?e:[...e,{value:r,label:n}]},y=l(function(l,y){let{value:b,onChange:x,options:S,valueLabel:C,loadOptions:w,placeholder:T=`Search…`,minChars:E,debounce:D,disabled:O=!1,size:k,allowCustom:A=!1,name:j,id:M,label:N,error:P,hint:F,required:I=!1,help:L,helpLabel:R=`More information`,fieldClassName:z=``,...B}=l;n(`AppAutocomplete`,B),t(`AppAutocomplete`,`size`,k,h);let V=typeof w==`function`,H=d(),U=M||H,{setRef:W,innerRef:G}=s({ref:y,value:b??``,on:{change:e=>x?.(e.currentTarget.value,{isCustom:!!e.detail?.isCustom})}}),K=S||g,{portal:q,toElementOptions:J}=o(K),Y=f(!1);return u(()=>{let e=G.current;if(!e||V&&Y.current)return;let t=J(v(K,b,C),_);c(t,e.options)||(e.options=t)},[K,V,G,J,b,C]),u(()=>{let e=G.current;if(!e||!V||!Y.current)return;let t=e.options,n=v(t,b,C);n!==t&&(e.options=n)},[b,C,V,G]),u(()=>{let e=G.current;if(!e||!V)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await w(r.detail.query,{signal:n?.signal});i===t&&(Y.current=!0,e.options=a||[])}catch{i===t&&(Y.current=!0,e.options=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[V,w,G]),m(`div`,{...e(`AppAutocomplete`,l),className:`field${z?` ${z}`:``}`,children:[N&&m(`label`,{className:`label`,htmlFor:U,children:[N,I&&p(a,{}),L&&p(i,{label:R,children:L})]}),p(`wui-autocomplete`,{"aria-label":typeof N==`string`?N:void 0,"aria-describedby":P?`${U}-error`:F?`${U}-hint`:void 0,"aria-invalid":P?`true`:void 0,id:U,ref:W,name:j,placeholder:T,remote:V?``:void 0,"min-chars":E==null?void 0:String(E),debounce:D==null?void 0:String(D),size:k||void 0,"allow-custom":A?``:void 0,disabled:O?``:void 0,required:I?``:void 0,...B}),q,p(r,{error:P,hint:F,errorId:`${U}-error`,hintId:`${U}-hint`})]})});export{y as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useNodeLabels.js";import s,{optionsEqual as c}from"./useWuiControl.js";import{forwardRef as l,useEffect as u,useId as d,useRef as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import"@webority/ui-elements/elements/autocomplete";var h=[`sm`,`lg`],g=[],_=(e,t)=>({...e,label:t}),v=(e,t,n)=>{if(n==null||t==null||t===``)return e;let r=String(t);return e.some(e=>String(e.value)===r)?e:[...e,{value:r,label:n}]},y=l(function(l,y){let{value:b,onChange:x,options:S,valueLabel:C,loadOptions:w,placeholder:T=`Search…`,minChars:E,debounce:D,disabled:O=!1,size:k,allowCustom:A=!1,name:j,id:M,label:N,error:P,hint:F,required:I=!1,help:L,helpLabel:R=`More information`,fieldClassName:z=``,"data-canvas":B,...V}=l;n(`AppAutocomplete`,V),t(`AppAutocomplete`,`size`,k,h);let H=typeof w==`function`,U=d(),W=M||U,{setRef:G,innerRef:K}=s({ref:y,value:b??``,on:{change:e=>x?.(e.currentTarget.value,{isCustom:!!e.detail?.isCustom})}}),q=S||g,{portal:J,toElementOptions:Y}=o(q),X=f(!1);return u(()=>{let e=K.current;if(!e||H&&X.current)return;let t=Y(v(q,b,C),_);c(t,e.options)||(e.options=t)},[q,H,K,Y,b,C]),u(()=>{let e=K.current;if(!e||!H||!X.current)return;let t=e.options,n=v(t,b,C);n!==t&&(e.options=n)},[b,C,H,K]),u(()=>{let e=K.current;if(!e||!H)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await w(r.detail.query,{signal:n?.signal});i===t&&(X.current=!0,e.options=a||[])}catch{i===t&&(X.current=!0,e.options=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[H,w,K]),m(`div`,{...e(`AppAutocomplete`,l),className:`field${z?` ${z}`:``}`,children:[N&&m(`label`,{className:`label`,htmlFor:W,children:[N,I&&p(a,{}),L&&p(i,{label:R,children:L})]}),p(`wui-autocomplete`,{"aria-label":typeof N==`string`?N:void 0,"aria-describedby":P?`${W}-error`:F?`${W}-hint`:void 0,"aria-invalid":P?`true`:void 0,id:W,ref:G,name:j,placeholder:T,remote:H?``:void 0,"min-chars":E==null?void 0:String(E),debounce:D==null?void 0:String(D),size:k||void 0,"allow-custom":A?``:void 0,disabled:O?``:void 0,required:I?``:void 0,...V}),J,p(r,{error:P,hint:F,errorId:`${W}-error`,hintId:`${W}-hint`})]})});export{y as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./AppAlert.js";import a from"./AppButton.js";import ee from"../lib/FieldMessage.js";import te from"./AppRequiredMark.js";import ne from"./AppModal.js";import{AVATAR_ACCEPT as re,AVATAR_MAX_SIZE_MB as ie,AVATAR_OUTPUT_SIZE as ae,AVATAR_PREVIEW_SIZES as o,AVATAR_TEXT as s,avatarCropOptions as oe,avatarUnreadableMessage as se,validateFile as ce}from"@webority/ui-elements/helpers";import{useCallback as le,useEffect as c,useId as ue,useRef as l,useState as u}from"react";import{Fragment as de,jsx as d,jsxs as f}from"react/jsx-runtime";import"@webority/ui-elements/elements/image-crop";var p={sm:64,md:96,lg:128},fe=o.join(` `);function m(o){let{value:m,initials:pe,onPick:me,onRemove:h,name:g,removeName:_,accept:v=re,maxSizeMb:he=ie,outputSize:ge=ae,size:y=`md`,label:b,hint:x,error:_e,required:ve=!1,loading:S=!1,disabled:ye=!1,ariaLabel:be,className:C=``,fieldClassName:w=``,style:xe,...T}=o;n(`AppAvatarPicker`,T),t(`AppAvatarPicker`,`size`,typeof y==`string`?y:null,Object.keys(p));let E=ue(),D=l(null),O=l(null),k=l(null),[A,j]=u(null),[M,N]=u(!1),[Se,P]=u(!1),[Ce,F]=u(``),[I,L]=u(!1),[R,z]=u(null),[B,V]=u(`loading`),[H,U]=u(``),[W,G]=u(!1),we=le(e=>{if(k.current=e,!e)return;let t=()=>{V(`ready`),e.querySelector(`.wui-crop-stage`)?.focus()},n=()=>V(`error`);return e.addEventListener(`load`,t),e.addEventListener(`error`,n),()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),k.current=null}},[]);c(()=>()=>R&&URL.revokeObjectURL(R.url),[R]),c(()=>()=>A&&URL.revokeObjectURL(A),[A]),c(()=>{j(null),N(!1),P(!1)},[m]);let K=S||ye,q=M?null:A||(m&&!Se?m:null),J=!!q,Te=!K&&J&&!!(h||_),Y=_e||Ce,X=x&&!Y?`${E}-hint`:void 0,Z=Y?`${E}-error`:void 0,Ee=Z||X,De=J?s.change:s.choose,Oe=typeof y==`number`?y:p[y]??p.md,Q=()=>{K||D.current?.click()},ke=()=>{K||O.current?.click()},Ae=e=>{let t=ce(e,{accept:v,maxSizeMb:he});if(t){F(t);return}F(``),V(`loading`),U(``),z({file:e,url:URL.createObjectURL(e)})},je=e=>{let t=e.target.files?.[0];e.target.value=``,t&&Ae(t)},Me=e=>{if(e.preventDefault(),L(!1),K)return;let t=e.dataTransfer?.files?.[0];t&&Ae(t)},Ne=e=>{if(g&&D.current&&typeof DataTransfer==`function`){let t=new DataTransfer;t.items.add(e),D.current.files=t.files}N(!1),P(!1),j(URL.createObjectURL(e)),me(e)},Pe=async()=>{let{file:e}=R;G(!0),U(``);let t=null;try{t=await k.current?.toFile(oe(e,ge))}catch{t=null}if(G(!1),!t){U(s.cropFailed);return}z(null),Ne(t)},$=()=>{W||z(null)},Fe=()=>{j(null),N(!0),F(``),D.current&&(D.current.value=``),h?.()};return f(`div`,{...e(`AppAvatarPicker`,o),className:`field wui-avatar-picker-field${w?` ${w}`:``}`,children:[b&&f(`label`,{className:`label`,htmlFor:E,children:[b,ve&&d(te,{})]}),f(`div`,{className:`wui-avatar-picker${I?` is-dragging`:``}${C?` ${C}`:``}`,style:{"--wui-avatar-size":`${Oe}px`,...xe},onDragOver:e=>{e.preventDefault(),!K&&!I&&L(!0)},onDragLeave:()=>L(!1),onDrop:Me,children:[f(`button`,{type:`button`,className:`wui-avatar-picker-face`,tabIndex:-1,"aria-label":be||De,"aria-describedby":Ee,"aria-busy":S||void 0,disabled:K,onClick:Q,...T,children:[q?d(`img`,{className:`wui-avatar-picker-img`,src:q,alt:``,onError:()=>P(!0)}):d(`span`,{className:`wui-avatar-picker-placeholder`,"aria-hidden":`true`,children:pe||d(r,{name:`user`,size:Math.round(Oe*.5)})}),d(`span`,{className:`wui-avatar-picker-badge`,"aria-hidden":`true`,children:S?d(r,{name:`refresh-cw`,size:14,className:`wui-spin`}):d(r,{name:`camera`,size:14})})]}),f(`div`,{className:`wui-avatar-picker-actions`,children:[d(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,disabled:K,"aria-describedby":Ee,onClick:Q,children:De}),f(`button`,{type:`button`,className:`btn btn-secondary btn-sm wui-avatar-picker-camera`,disabled:K,onClick:ke,children:[d(r,{name:`camera`,size:16}),s.camera]}),d(`button`,{type:`button`,className:`btn btn-secondary-danger btn-sm`,hidden:!Te,onClick:Fe,children:s.remove})]}),d(`input`,{id:E,ref:D,type:`file`,name:g,hidden:!0,accept:v,disabled:K,onChange:je}),d(`input`,{ref:O,type:`file`,hidden:!0,accept:`image/*`,capture:`user`,disabled:K,onChange:je}),_&&d(`input`,{type:`hidden`,name:_,value:`true`,disabled:!M})]}),d(ee,{error:Y,hint:x,errorId:Z,hintId:X}),f(ne,{open:!!R,title:s.dialogTitle,subtitle:s.dialogSubtitle,dismissible:!W,staticBackdrop:W,onClose:$,footer:f(de,{children:[d(a,{type:`button`,variant:`secondary`,disabled:W,onClick:$,children:s.cancel}),d(a,{type:`button`,variant:`primary`,loading:W,disabled:B!==`ready`,onClick:Pe,children:s.save})]}),children:[B===`error`&&R&&d(i,{variant:`danger`,children:se(R.file)}),H&&d(i,{variant:`danger`,children:H}),R&&B!==`error`&&d(`wui-image-crop`,{ref:we,src:R.url,aspect:`1`,round:!0,rotatable:!0,previews:fe})]})]})}export{m as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./AppAlert.js";import a from"./AppButton.js";import ee from"../lib/FieldMessage.js";import te from"./AppRequiredMark.js";import ne from"./AppModal.js";import{AVATAR_ACCEPT as re,AVATAR_MAX_SIZE_MB as ie,AVATAR_OUTPUT_SIZE as ae,AVATAR_PREVIEW_SIZES as o,AVATAR_TEXT as s,avatarCropOptions as oe,avatarUnreadableMessage as se,validateFile as ce}from"@webority/ui-elements/helpers";import{useCallback as le,useEffect as c,useId as ue,useRef as l,useState as u}from"react";import{Fragment as de,jsx as d,jsxs as f}from"react/jsx-runtime";import"@webority/ui-elements/elements/image-crop";var p={sm:64,md:96,lg:128},fe=o.join(` `);function m(o){let{value:m,initials:pe,onPick:me,onRemove:h,name:g,removeName:_,accept:v=re,maxSizeMb:he=ie,outputSize:ge=ae,size:y=`md`,label:b,hint:x,error:_e,required:ve=!1,loading:S=!1,disabled:ye=!1,ariaLabel:be,className:C=``,fieldClassName:w=``,style:xe,"data-canvas":Se,...T}=o;n(`AppAvatarPicker`,T),t(`AppAvatarPicker`,`size`,typeof y==`string`?y:null,Object.keys(p));let E=ue(),D=l(null),O=l(null),k=l(null),[A,j]=u(null),[M,N]=u(!1),[Ce,P]=u(!1),[we,F]=u(``),[I,L]=u(!1),[R,z]=u(null),[B,V]=u(`loading`),[H,U]=u(``),[W,G]=u(!1),Te=le(e=>{if(k.current=e,!e)return;let t=()=>{V(`ready`),e.querySelector(`.wui-crop-stage`)?.focus()},n=()=>V(`error`);return e.addEventListener(`load`,t),e.addEventListener(`error`,n),()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),k.current=null}},[]);c(()=>()=>R&&URL.revokeObjectURL(R.url),[R]),c(()=>()=>A&&URL.revokeObjectURL(A),[A]),c(()=>{j(null),N(!1),P(!1)},[m]);let K=S||ye,q=M?null:A||(m&&!Ce?m:null),J=!!q,Ee=!K&&J&&!!(h||_),Y=_e||we,X=x&&!Y?`${E}-hint`:void 0,Z=Y?`${E}-error`:void 0,Q=Z||X,De=J?s.change:s.choose,Oe=typeof y==`number`?y:p[y]??p.md,ke=()=>{K||D.current?.click()},Ae=()=>{K||O.current?.click()},je=e=>{let t=ce(e,{accept:v,maxSizeMb:he});if(t){F(t);return}F(``),V(`loading`),U(``),z({file:e,url:URL.createObjectURL(e)})},Me=e=>{let t=e.target.files?.[0];e.target.value=``,t&&je(t)},Ne=e=>{if(e.preventDefault(),L(!1),K)return;let t=e.dataTransfer?.files?.[0];t&&je(t)},Pe=e=>{if(g&&D.current&&typeof DataTransfer==`function`){let t=new DataTransfer;t.items.add(e),D.current.files=t.files}N(!1),P(!1),j(URL.createObjectURL(e)),me(e)},Fe=async()=>{let{file:e}=R;G(!0),U(``);let t=null;try{t=await k.current?.toFile(oe(e,ge))}catch{t=null}if(G(!1),!t){U(s.cropFailed);return}z(null),Pe(t)},$=()=>{W||z(null)},Ie=()=>{j(null),N(!0),F(``),D.current&&(D.current.value=``),h?.()};return f(`div`,{...e(`AppAvatarPicker`,o),className:`field wui-avatar-picker-field${w?` ${w}`:``}`,children:[b&&f(`label`,{className:`label`,htmlFor:E,children:[b,ve&&d(te,{})]}),f(`div`,{className:`wui-avatar-picker${I?` is-dragging`:``}${C?` ${C}`:``}`,style:{"--wui-avatar-size":`${Oe}px`,...xe},onDragOver:e=>{e.preventDefault(),!K&&!I&&L(!0)},onDragLeave:()=>L(!1),onDrop:Ne,children:[f(`button`,{type:`button`,className:`wui-avatar-picker-face`,tabIndex:-1,"aria-label":be||De,"aria-describedby":Q,"aria-busy":S||void 0,disabled:K,onClick:ke,...T,children:[q?d(`img`,{className:`wui-avatar-picker-img`,src:q,alt:``,onError:()=>P(!0)}):d(`span`,{className:`wui-avatar-picker-placeholder`,"aria-hidden":`true`,children:pe||d(r,{name:`user`,size:Math.round(Oe*.5)})}),d(`span`,{className:`wui-avatar-picker-badge`,"aria-hidden":`true`,children:S?d(r,{name:`refresh-cw`,size:14,className:`wui-spin`}):d(r,{name:`camera`,size:14})})]}),f(`div`,{className:`wui-avatar-picker-actions`,children:[d(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,disabled:K,"aria-describedby":Q,onClick:ke,children:De}),f(`button`,{type:`button`,className:`btn btn-secondary btn-sm wui-avatar-picker-camera`,disabled:K,onClick:Ae,children:[d(r,{name:`camera`,size:16}),s.camera]}),d(`button`,{type:`button`,className:`btn btn-secondary-danger btn-sm`,hidden:!Ee,onClick:Ie,children:s.remove})]}),d(`input`,{id:E,ref:D,type:`file`,name:g,hidden:!0,accept:v,disabled:K,onChange:Me}),d(`input`,{ref:O,type:`file`,hidden:!0,accept:`image/*`,capture:`user`,disabled:K,onChange:Me}),_&&d(`input`,{type:`hidden`,name:_,value:`true`,disabled:!M})]}),d(ee,{error:Y,hint:x,errorId:Z,hintId:X}),f(ne,{open:!!R,title:s.dialogTitle,subtitle:s.dialogSubtitle,dismissible:!W,staticBackdrop:W,onClose:$,footer:f(de,{children:[d(a,{type:`button`,variant:`secondary`,disabled:W,onClick:$,children:s.cancel}),d(a,{type:`button`,variant:`primary`,loading:W,disabled:B!==`ready`,onClick:Fe,children:s.save})]}),children:[B===`error`&&R&&d(i,{variant:`danger`,children:se(R.file)}),H&&d(i,{variant:`danger`,children:H}),R&&B!==`error`&&d(`wui-image-crop`,{ref:Te,src:R.url,aspect:`1`,round:!0,rotatable:!0,previews:fe})]})]})}export{m as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";import"@webority/ui-elements/elements/overflow";var i=[`wrap`,`menu`];function a(a){let{children:o,overflow:s=`wrap`,moreLabel:c=`More`,label:l,className:u=``,...d}=a;n(`AppChipGroup`,d),t(`AppChipGroup`,`overflow`,s,i);let f=e=>[e,u].filter(Boolean).join(` `);return s===`menu`?r(`wui-overflow`,{...e(`AppChipGroup`,a),class:`wui-chip-group-host`,label:c,children:r(`div`,{role:`group`,"aria-label":l,className:f(`wui-chip-group wui-chip-group-nowrap`),"data-wui-overflow-list":``,...d,children:o})}):r(`div`,{role:`group`,"aria-label":l,className:f(`wui-chip-group`),...e(`AppChipGroup`,a),...d,children:o})}export{a as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{jsx as r}from"react/jsx-runtime";import"@webority/ui-elements/elements/overflow";var i=[`wrap`,`menu`];function a(a){let{children:o,overflow:s=`wrap`,moreLabel:c=`More`,label:l,className:u=``,"data-canvas":d,...f}=a;n(`AppChipGroup`,f),t(`AppChipGroup`,`overflow`,s,i);let p=e=>[e,u].filter(Boolean).join(` `);return s===`menu`?r(`wui-overflow`,{...e(`AppChipGroup`,a),class:`wui-chip-group-host`,label:c,children:r(`div`,{role:`group`,"aria-label":l,className:p(`wui-chip-group wui-chip-group-nowrap`),"data-wui-overflow-list":``,...f,children:o})}):r(`div`,{role:`group`,"aria-label":l,className:p(`wui-chip-group`),...e(`AppChipGroup`,a),...f,children:o})}export{a as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import{useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`sm`,`md`,`lg`];function l(l){let{value:u=`#000000`,onChange:d,label:f,required:p=!1,error:m,hint:h,name:g,id:_,disabled:v=!1,size:y=`md`,className:b=``,fieldClassName:x=``,...S}=l;n(`AppColorField`,S),t(`AppColorField`,`size`,y,c);let C=a(),w=_||C,T=m?`${w}-error`:h?`${w}-hint`:void 0,E=e=>/^#[0-9a-f]{6}$/i.test(e),D=y===`sm`?` color-field-sm`:y===`lg`?` color-field-lg`:``,O=y===`sm`?` input-sm`:y===`lg`?` input-lg`:``;return s(`div`,{...e(`AppColorField`,l),className:`field${x?` ${x}`:``}`,children:[f&&s(`label`,{className:`label`,htmlFor:w,children:[f,p&&o(i,{})]}),s(`div`,{className:`color-field${D}`,children:[o(`input`,{type:`color`,className:`color-field-swatch`,value:E(u)?u:`#000000`,onChange:e=>d?.(e.target.value),disabled:v,"aria-label":`${f||`Colour`}, colour picker`,tabIndex:-1}),o(`input`,{type:`text`,className:`input color-field-hex${O}${m?` error`:``}${b?` ${b}`:``}`,id:w,name:g,value:u,onChange:e=>d?.(e.target.value),placeholder:`#4F46E5`,spellCheck:!1,maxLength:7,required:p,disabled:v,"aria-invalid":m?`true`:`false`,"aria-describedby":T,...S})]}),o(r,{error:m,hint:h,errorId:`${w}-error`,hintId:`${w}-hint`})]})}export{l as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import{useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";var c=[`sm`,`md`,`lg`];function l(l){let{value:u=`#000000`,onChange:d,label:f,required:p=!1,error:m,hint:h,name:g,id:_,disabled:v=!1,size:y=`md`,className:b=``,fieldClassName:x=``,"data-canvas":S,...C}=l;n(`AppColorField`,C),t(`AppColorField`,`size`,y,c);let w=a(),T=_||w,E=m?`${T}-error`:h?`${T}-hint`:void 0,D=e=>/^#[0-9a-f]{6}$/i.test(e),O=y===`sm`?` color-field-sm`:y===`lg`?` color-field-lg`:``,k=y===`sm`?` input-sm`:y===`lg`?` input-lg`:``;return s(`div`,{...e(`AppColorField`,l),className:`field${x?` ${x}`:``}`,children:[f&&s(`label`,{className:`label`,htmlFor:T,children:[f,p&&o(i,{})]}),s(`div`,{className:`color-field${O}`,children:[o(`input`,{type:`color`,className:`color-field-swatch`,value:D(u)?u:`#000000`,onChange:e=>d?.(e.target.value),disabled:v,"aria-label":`${f||`Colour`}, colour picker`,tabIndex:-1}),o(`input`,{type:`text`,className:`input color-field-hex${k}${m?` error`:``}${b?` ${b}`:``}`,id:T,name:g,value:u,onChange:e=>d?.(e.target.value),placeholder:`#4F46E5`,spellCheck:!1,maxLength:7,required:p,disabled:v,"aria-invalid":m?`true`:`false`,"aria-describedby":E,...C})]}),o(r,{error:m,hint:h,errorId:`${T}-error`,hintId:`${T}-hint`})]})}export{l as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import i from"./AppIcon.js";import a from"./renderIconProp.js";import o from"./AppModal.js";import s from"./AppSpinner.js";import{matchSegments as c}from"@webority/ui-elements/helpers";import{Fragment as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import"@webority/ui-elements/elements/command-palette";var g=`lg`;function _(n){let{open:r,onClose:i,query:a=``,onQueryChange:s,placeholder:c=`Search…`,groups:l=[],path:u=[],onPathChange:f,rootLabel:p,backLabel:h=`Back`,recentsKey:_,recentsLimit:y,recentsLabel:b,loading:x=!1,emptyText:S=`No results`,footer:C,ariaLabel:w=`Search`,highlight:T=!0,id:E,className:D=``,...O}=n;t(`AppCommandPalette`,O);let k=d(),A=E||k;return m(o,{...e(`AppCommandPalette`,n),open:r,onClose:i,hideHeader:!0,placement:`top`,size:g,ariaLabel:w,className:`wui-cmd-card${D?` ${D}`:``}`,children:m(v,{baseId:A,query:a,onQueryChange:s,placeholder:c,groups:l,path:u,onPathChange:f,rootLabel:p,backLabel:h,recentsKey:_,recentsLimit:y,recentsLabel:b,loading:x,emptyText:S,footer:C,ariaLabel:w,highlight:T,onClose:i,rest:O})})}function v({baseId:e,query:t,onQueryChange:o,placeholder:c,groups:l,path:d,onPathChange:g,rootLabel:_,backLabel:v,recentsKey:x,recentsLimit:S,recentsLabel:C,loading:w,emptyText:T,footer:E,ariaLabel:D,highlight:O,onClose:k,rest:A}){let j=p(null),M=`${e}-list`,N=l.filter(e=>e.items?.length),P=!w&&t.trim()!==``&&N.length===0;return f(()=>{j.current?.refresh?.()}),u(()=>{let e=j.current,t=e=>{let t=l.find(t=>String(t.key)===e.detail.groupKey)?.items?.find(t=>String(t.key)===e.detail.key);if(t){if(e.preventDefault(),t.page){o?.(``),g?.([...d,{key:t.page.key,label:t.page.label}]);return}t.onSelect?.(),k?.()}},n=e=>{e.preventDefault(),o?.(``),g?.(e.detail.path)};return e.addEventListener(`wui-command-palette:select`,t),e.addEventListener(`wui-command-palette:navigate`,n),()=>{e.removeEventListener(`wui-command-palette:select`,t),e.removeEventListener(`wui-command-palette:navigate`,n)}},[l,d,k,o,g]),h(`wui-command-palette`,{ref:j,path:JSON.stringify(d),"root-label":_,"recents-key":x,"recents-limit":S,"recents-label":C,...A,children:[h(`div`,{className:`wui-cmd-search`,children:[m(`span`,{className:`wui-cmd-search-icon`,"aria-hidden":`true`,children:m(i,{name:`search`,size:18})}),m(`input`,{className:`wui-cmd-input`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":M,"aria-autocomplete":`list`,"aria-label":D,placeholder:c,autoComplete:`off`,spellCheck:!1,"data-autofocus":``,value:t,onChange:e=>o?.(e.target.value)}),w&&m(s,{size:`sm`,className:`wui-cmd-spinner`})]}),h(`div`,{className:`wui-cmd-crumbs`,hidden:!0,children:[m(`button`,{type:`button`,className:`wui-cmd-back`,"aria-label":v,children:m(i,{name:`chevron-left`,size:16})}),m(`ol`,{className:`wui-cmd-trail`})]}),h(`div`,{className:`wui-cmd-list`,role:`listbox`,id:M,"aria-label":`Results`,"aria-busy":w?`true`:void 0,hidden:N.length===0,children:[m(`div`,{className:`wui-cmd-recents`}),N.map(o=>{let s=`${e}-${b(o.key)}`;return h(`div`,{className:`wui-cmd-group`,role:`group`,"aria-labelledby":s,children:[m(`div`,{className:`wui-cmd-group-label`,role:`presentation`,id:s,children:o.label}),o.items.map(e=>{let c=`${s}-${b(e.key)}`,l=e.description==null?null:`${c}-desc`,u=e.meta==null?null:`${c}-meta`;return h(`div`,{className:`wui-cmd-item`,role:`option`,id:c,"data-group-key":String(o.key),"data-key":String(e.key),"data-opens":e.page?String(e.page.key):void 0,"aria-label":e.ariaLabel||(typeof e.label==`string`?e.label:``)||void 0,"aria-describedby":[l,u].filter(Boolean).join(` `)||void 0,"aria-disabled":e.disabled?`true`:void 0,"aria-keyshortcuts":n(e.shortcut),children:[e.icon!=null&&m(`span`,{className:`wui-cmd-item-icon`,"aria-hidden":`true`,children:a(e.icon,{size:18})}),h(`span`,{className:`wui-cmd-item-text`,children:[m(`span`,{className:`wui-cmd-item-label`,children:O?y(e.label,t):e.label}),l&&m(`span`,{className:`wui-cmd-item-desc`,id:l,children:e.description})]}),u&&m(`span`,{className:`wui-cmd-item-meta`,id:u,children:e.meta}),r(e.shortcut),e.page&&m(`span`,{className:`wui-cmd-item-chevron`,"aria-hidden":`true`,children:m(i,{name:`chevron-right`,size:16})})]},e.key)})]},o.key)})]}),m(`div`,{className:`wui-cmd-empty`,role:`status`,children:P?T:null}),E!=null&&m(`div`,{className:`wui-cmd-footer`,children:E})]})}function y(e,t){if(typeof e!=`string`)return e;let n=c(e,t);if(n.length===1&&!n[0].match)return e;let r=0;return n.map(e=>{let t=r;return r+=e.text.length,e.match?m(`mark`,{className:`wui-cmd-mark`,children:e.text},t):m(l,{children:e.text},t)})}function b(e){return String(e).replace(/\s+/g,`_`)}export{_ as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import{shortcutAria as n,shortcutChip as r}from"../lib/shortcutChip.js";import i from"./AppIcon.js";import a from"./renderIconProp.js";import o from"./AppModal.js";import s from"./AppSpinner.js";import{matchSegments as c}from"@webority/ui-elements/helpers";import{Fragment as l,useEffect as u,useId as d,useLayoutEffect as f,useRef as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import"@webority/ui-elements/elements/command-palette";var g=`lg`;function _(n){let{open:r,onClose:i,query:a=``,onQueryChange:s,placeholder:c=`Search…`,groups:l=[],path:u=[],onPathChange:f,rootLabel:p,backLabel:h=`Back`,recentsKey:_,recentsLimit:y,recentsLabel:b,loading:x=!1,emptyText:S=`No results`,footer:C,ariaLabel:w=`Search`,highlight:T=!0,id:E,className:D=``,"data-canvas":O,...k}=n;t(`AppCommandPalette`,k);let A=d(),j=E||A;return m(o,{...e(`AppCommandPalette`,n),open:r,onClose:i,hideHeader:!0,placement:`top`,size:g,ariaLabel:w,className:`wui-cmd-card${D?` ${D}`:``}`,children:m(v,{baseId:j,query:a,onQueryChange:s,placeholder:c,groups:l,path:u,onPathChange:f,rootLabel:p,backLabel:h,recentsKey:_,recentsLimit:y,recentsLabel:b,loading:x,emptyText:S,footer:C,ariaLabel:w,highlight:T,onClose:i,rest:k})})}function v({baseId:e,query:t,onQueryChange:o,placeholder:c,groups:l,path:d,onPathChange:g,rootLabel:_,backLabel:v,recentsKey:x,recentsLimit:S,recentsLabel:C,loading:w,emptyText:T,footer:E,ariaLabel:D,highlight:O,onClose:k,rest:A}){let j=p(null),M=`${e}-list`,N=l.filter(e=>e.items?.length),P=!w&&t.trim()!==``&&N.length===0;return f(()=>{j.current?.refresh?.()}),u(()=>{let e=j.current,t=e=>{let t=l.find(t=>String(t.key)===e.detail.groupKey)?.items?.find(t=>String(t.key)===e.detail.key);if(t){if(e.preventDefault(),t.page){o?.(``),g?.([...d,{key:t.page.key,label:t.page.label}]);return}t.onSelect?.(),k?.()}},n=e=>{e.preventDefault(),o?.(``),g?.(e.detail.path)};return e.addEventListener(`wui-command-palette:select`,t),e.addEventListener(`wui-command-palette:navigate`,n),()=>{e.removeEventListener(`wui-command-palette:select`,t),e.removeEventListener(`wui-command-palette:navigate`,n)}},[l,d,k,o,g]),h(`wui-command-palette`,{ref:j,path:JSON.stringify(d),"root-label":_,"recents-key":x,"recents-limit":S,"recents-label":C,...A,children:[h(`div`,{className:`wui-cmd-search`,children:[m(`span`,{className:`wui-cmd-search-icon`,"aria-hidden":`true`,children:m(i,{name:`search`,size:18})}),m(`input`,{className:`wui-cmd-input`,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":M,"aria-autocomplete":`list`,"aria-label":D,placeholder:c,autoComplete:`off`,spellCheck:!1,"data-autofocus":``,value:t,onChange:e=>o?.(e.target.value)}),w&&m(s,{size:`sm`,className:`wui-cmd-spinner`})]}),h(`div`,{className:`wui-cmd-crumbs`,hidden:!0,children:[m(`button`,{type:`button`,className:`wui-cmd-back`,"aria-label":v,children:m(i,{name:`chevron-left`,size:16})}),m(`ol`,{className:`wui-cmd-trail`})]}),h(`div`,{className:`wui-cmd-list`,role:`listbox`,id:M,"aria-label":`Results`,"aria-busy":w?`true`:void 0,hidden:N.length===0,children:[m(`div`,{className:`wui-cmd-recents`}),N.map(o=>{let s=`${e}-${b(o.key)}`;return h(`div`,{className:`wui-cmd-group`,role:`group`,"aria-labelledby":s,children:[m(`div`,{className:`wui-cmd-group-label`,role:`presentation`,id:s,children:o.label}),o.items.map(e=>{let c=`${s}-${b(e.key)}`,l=e.description==null?null:`${c}-desc`,u=e.meta==null?null:`${c}-meta`;return h(`div`,{className:`wui-cmd-item`,role:`option`,id:c,"data-group-key":String(o.key),"data-key":String(e.key),"data-opens":e.page?String(e.page.key):void 0,"aria-label":e.ariaLabel||(typeof e.label==`string`?e.label:``)||void 0,"aria-describedby":[l,u].filter(Boolean).join(` `)||void 0,"aria-disabled":e.disabled?`true`:void 0,"aria-keyshortcuts":n(e.shortcut),children:[e.icon!=null&&m(`span`,{className:`wui-cmd-item-icon`,"aria-hidden":`true`,children:a(e.icon,{size:18})}),h(`span`,{className:`wui-cmd-item-text`,children:[m(`span`,{className:`wui-cmd-item-label`,children:O?y(e.label,t):e.label}),l&&m(`span`,{className:`wui-cmd-item-desc`,id:l,children:e.description})]}),u&&m(`span`,{className:`wui-cmd-item-meta`,id:u,children:e.meta}),r(e.shortcut),e.page&&m(`span`,{className:`wui-cmd-item-chevron`,"aria-hidden":`true`,children:m(i,{name:`chevron-right`,size:16})})]},e.key)})]},o.key)})]}),m(`div`,{className:`wui-cmd-empty`,role:`status`,children:P?T:null}),E!=null&&m(`div`,{className:`wui-cmd-footer`,children:E})]})}function y(e,t){if(typeof e!=`string`)return e;let n=c(e,t);if(n.length===1&&!n[0].match)return e;let r=0;return n.map(e=>{let t=r;return r+=e.text.length,e.match?m(`mark`,{className:`wui-cmd-mark`,children:e.text},t):m(l,{children:e.text},t)})}function b(e){return String(e).replace(/\s+/g,`_`)}export{_ as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{cloneElement as s,forwardRef as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/country-select";var f=[`sm`,`md`,`lg`],p=c(function(c,p){let{value:m,onChange:h,countries:g,placeholder:_=`Select country`,searchPlaceholder:v=`Search countries...`,searchable:y=!0,clearable:b=!1,size:x=`md`,floatingLabel:S=!1,disabled:C,label:w,required:T=!1,error:E,hint:D,help:O,helpLabel:k=`More information`,id:A,name:j,className:M=``,fieldClassName:N=``,"aria-label":P,"aria-labelledby":F,"aria-describedby":I,...L}=c;n(`AppCountrySelect`,L),t(`AppCountrySelect`,`size`,x,f);let R=l(),{setRef:z}=o({ref:p,value:m??``,onChange:h}),B=A||R,V=S&&w,H=E&&B?`${B}-error`:void 0,U=D&&B?`${B}-hint`:void 0,W=u(`wui-country-select`,{"aria-label":P||(typeof w==`string`?w:void 0),"aria-labelledby":F||void 0,"aria-describedby":H||U||I||void 0,"aria-invalid":E?`true`:void 0,ref:z,id:B,name:j,countries:Array.isArray(g)?g.join(`,`):void 0,placeholder:V?` `:_,"search-placeholder":v,searchable:y?``:void 0,clearable:b?``:void 0,size:x===`sm`||x===`lg`?x:void 0,disabled:C?``:void 0,required:T?``:void 0,className:M||void 0,...L});if(!w&&!E&&!D)return s(W,e(`AppCountrySelect`,c));let G=[`field`,N].filter(Boolean).join(` `);return d(`div`,{...e(`AppCountrySelect`,c),className:G,children:[w&&!V&&d(`label`,{className:`label`,htmlFor:B,children:[w,T&&u(a,{}),O&&u(i,{label:k,children:O})]}),V?d(`div`,{className:`field-float`,children:[W,d(`label`,{className:`float-label`,htmlFor:B,children:[w,T&&u(a,{})]})]}):W,u(r,{error:E,hint:D,errorId:H,hintId:U})]})});export{p as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{cloneElement as s,forwardRef as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/country-select";var f=[`sm`,`md`,`lg`],p=[`off`,`border`],m=c(function(c,m){let{value:h,onChange:g,countries:_,placeholder:v=`Select country`,searchPlaceholder:y=`Search countries...`,searchable:b=!0,clearable:x=!1,size:S=`md`,floatingLabel:C=`off`,disabled:w,label:T,required:E=!1,error:D,hint:O,help:k,helpLabel:A=`More information`,id:j,name:M,className:N=``,fieldClassName:P=``,"aria-label":F,"aria-labelledby":I,"aria-describedby":L,"data-canvas":R,...z}=c;n(`AppCountrySelect`,z),t(`AppCountrySelect`,`size`,S,f),t(`AppCountrySelect`,`floatingLabel`,C,p);let B=l(),{setRef:V}=o({ref:m,value:h??``,onChange:g}),H=j||B,U=C!==`off`&&T,W=D&&H?`${H}-error`:void 0,G=O&&H?`${H}-hint`:void 0,K=u(`wui-country-select`,{"aria-label":F||(typeof T==`string`?T:void 0),"aria-labelledby":I||void 0,"aria-describedby":W||G||L||void 0,"aria-invalid":D?`true`:void 0,ref:V,id:H,name:M,countries:Array.isArray(_)?_.join(`,`):void 0,placeholder:U?` `:v,"search-placeholder":y,searchable:b?``:void 0,clearable:x?``:void 0,size:S===`sm`||S===`lg`?S:void 0,disabled:w?``:void 0,required:E?``:void 0,className:N||void 0,...z});if(!T&&!D&&!O)return s(K,e(`AppCountrySelect`,c));let q=[`field`,P].filter(Boolean).join(` `);return d(`div`,{...e(`AppCountrySelect`,c),className:q,children:[T&&!U&&d(`label`,{className:`label`,htmlFor:H,children:[T,E&&u(a,{}),k&&u(i,{label:A,children:k})]}),U?d(`div`,{className:`field-float`,children:[K,d(`label`,{className:`float-label`,htmlFor:H,children:[T,E&&u(a,{})]})]}):K,u(r,{error:D,hint:O,errorId:W,hintId:G})]})});export{m as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes 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"../lib/FieldMessage.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{cloneElement as s,forwardRef as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/datepicker";var f=[`sm`,`md`,`lg`],p=c(function(c,p){let{value:m,onChange:h,label:g,required:_=!1,hint:v,error:y,name:b,min:x,max:S,placeholder:C=`Choose a date`,disabled:w,size:T,firstDay:E,displayFormat:D,id:O,ariaLabel:k,className:A=``,fieldClassName:j=``,...M}=c;r(`AppDatePicker`,M),n(`AppDatePicker`,`size`,T,f),typeof D==`string`&&D!==``&&/DD|YYYY|YY/.test(D)&&t(`[@webority/ui-react] <AppDatePicker> displayFormat "${D}" uses uppercase day or year tokens, which print as written; the tokens are yyyy, MMMM, MMM, MM, dd and d.`);let N=l(),P=O||N,{setRef:F}=o({ref:p,value:m??``,onChange:h}),I=!g&&!y&&!v,L=y?`${P}-error`:void 0,R=v?`${P}-hint`:void 0,z=u(`wui-datepicker`,{ref:F,value:m||void 0,id:P,name:b,min:x,max:S,placeholder:C,size:T||void 0,"first-day":E==null?void 0:String(E),"display-format":D||void 0,"aria-label":k||(typeof g==`string`?g:void 0),"aria-describedby":L||R,"aria-invalid":y?`true`:void 0,disabled:w?``:void 0,required:_?``:void 0,className:A||void 0,...M});return I?s(z,e(`AppDatePicker`,c)):d(`div`,{...e(`AppDatePicker`,c),className:`field${j?` ${j}`:``}`,children:[g&&d(`label`,{className:`label`,htmlFor:P,children:[g,_&&u(a,{})]}),z,u(i,{error:y,hint:v,errorId:L,hintId:R})]})});export{p as default};
1
+ import{wuiMarkerAttributes 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"../lib/FieldMessage.js";import a from"./AppRequiredMark.js";import o from"./useWuiControl.js";import{cloneElement as s,forwardRef as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/datepicker";var f=[`sm`,`md`,`lg`],p=c(function(c,p){let{value:m,onChange:h,label:g,required:_=!1,hint:v,error:y,name:b,min:x,max:S,placeholder:C=`Choose a date`,disabled:w,size:T,firstDay:E,displayFormat:D,id:O,ariaLabel:k,className:A=``,fieldClassName:j=``,"data-canvas":M,...N}=c;r(`AppDatePicker`,N),n(`AppDatePicker`,`size`,T,f),typeof D==`string`&&D!==``&&/DD|YYYY|YY/.test(D)&&t(`[@webority/ui-react] <AppDatePicker> displayFormat "${D}" uses uppercase day or year tokens, which print as written; the tokens are yyyy, MMMM, MMM, MM, dd and d.`);let P=l(),F=O||P,{setRef:I}=o({ref:p,value:m??``,onChange:h}),L=!g&&!y&&!v,R=y?`${F}-error`:void 0,z=v?`${F}-hint`:void 0,B=u(`wui-datepicker`,{ref:I,value:m||void 0,id:F,name:b,min:x,max:S,placeholder:C,size:T||void 0,"first-day":E==null?void 0:String(E),"display-format":D||void 0,"aria-label":k||(typeof g==`string`?g:void 0),"aria-describedby":R||z,"aria-invalid":y?`true`:void 0,disabled:w?``:void 0,required:_?``:void 0,className:A||void 0,...N});return L?s(B,e(`AppDatePicker`,c)):d(`div`,{...e(`AppDatePicker`,c),className:`field${j?` ${j}`:``}`,children:[g&&d(`label`,{className:`label`,htmlFor:F,children:[g,_&&u(a,{})]}),B,u(i,{error:y,hint:v,errorId:R,hintId:z})]})});export{p as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{cloneElement as o,forwardRef as s,useEffect as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/date-range";var f=[`sm`,`md`,`lg`],p=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)},m=s(function(s,m){let{start:h,end:g,onChange:_,label:v,required:y=!1,hint:b,error:x,startName:S,endName:C,min:w,max:T,placeholder:E=`Start to End`,disabled:D,size:O,firstDay:k,presets:A,id:j,ariaLabel:M,className:N=``,fieldClassName:P=``,...F}=s;n(`AppDateRangePicker`,F),t(`AppDateRangePicker`,`size`,O,f);let I=l(),L=j||I,{setRef:R,innerRef:z}=a({ref:m,onChange:_});c(()=>{let e=z.current;if(!e)return;let t=h===void 0?e.value.start:h,n=g===void 0?e.value.end:g;(e.value.start!==t||e.value.end!==n)&&(e.value={start:t,end:n})},[h,g,z]);let B=!v&&!x&&!b,V=x?`${L}-error`:void 0,H=b?`${L}-hint`:void 0,U=V||H,W=u(`wui-date-range`,{ref:R,id:L,"start-name":S,"end-name":C,min:w,max:T,placeholder:E,size:O||void 0,"first-day":k==null?void 0:String(k),presets:p(A),"aria-label":M||(typeof v==`string`?v:void 0),"aria-describedby":U,"aria-invalid":x?`true`:void 0,disabled:D?``:void 0,required:y?``:void 0,className:N||void 0,...F});return B?o(W,e(`AppDateRangePicker`,s)):d(`div`,{...e(`AppDateRangePicker`,s),className:`field${P?` ${P}`:``}`,children:[v&&d(`label`,{className:`label`,htmlFor:L,children:[v,y&&u(i,{})]}),W,u(r,{error:x,hint:b,errorId:V,hintId:H})]})});export{m as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{cloneElement as o,forwardRef as s,useEffect as c,useId as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/date-range";var f=[`sm`,`md`,`lg`],p=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)},m=s(function(s,m){let{start:h,end:g,onChange:_,label:v,required:y=!1,hint:b,error:x,startName:S,endName:C,min:w,max:T,placeholder:E=`Start to End`,disabled:D,size:O,firstDay:k,presets:A,id:j,ariaLabel:M,className:N=``,fieldClassName:P=``,"data-canvas":F,...I}=s;n(`AppDateRangePicker`,I),t(`AppDateRangePicker`,`size`,O,f);let L=l(),R=j||L,{setRef:z,innerRef:B}=a({ref:m,onChange:_});c(()=>{let e=B.current;if(!e)return;let t=h===void 0?e.value.start:h,n=g===void 0?e.value.end:g;(e.value.start!==t||e.value.end!==n)&&(e.value={start:t,end:n})},[h,g,B]);let V=!v&&!x&&!b,H=x?`${R}-error`:void 0,U=b?`${R}-hint`:void 0,W=H||U,G=u(`wui-date-range`,{ref:z,id:R,"start-name":S,"end-name":C,min:w,max:T,placeholder:E,size:O||void 0,"first-day":k==null?void 0:String(k),presets:p(A),"aria-label":M||(typeof v==`string`?v:void 0),"aria-describedby":W,"aria-invalid":x?`true`:void 0,disabled:D?``:void 0,required:y?``:void 0,className:N||void 0,...I});return V?o(G,e(`AppDateRangePicker`,s)):d(`div`,{...e(`AppDateRangePicker`,s),className:`field${P?` ${P}`:``}`,children:[v&&d(`label`,{className:`label`,htmlFor:R,children:[v,y&&u(i,{})]}),G,u(r,{error:x,hint:b,errorId:H,hintId:U})]})});export{m as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"../lib/FieldMessage.js";import{DEFAULT_MAX_SIZE_MB as i,acceptLabel as a,validateFile as o}from"@webority/ui-elements/helpers";import{useId as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";function d(d){let{label:f,id:p,onChange:m,multiple:h=!1,accept:g=``,maxSizeMb:_=i,error:v,hint:y,disabled:b=!1,className:x=``,fieldClassName:S=``,style:C,...w}=d;t(`AppDropZone`,w);let[T,E]=c(!1),[D,O]=c(``),k=s(),A=p||k,j=v||D,M=j?`${A}-error`:void 0,N=y&&!j?`${A}-hint`:void 0,P=M||N,F=g?a(g):`Any file type`,I=e=>{let t=Array.from(e||[]);if(!t.length)return;if(!h){let e=o(t[0],{accept:g,maxSizeMb:_});O(e||``),e||m(t[0]);return}let n=``,r=[];for(let e of t){let t=o(e,{accept:g,maxSizeMb:_});if(t){n||=t;continue}r.push(e)}O(n),r.length&&m(r)};return u(`div`,{...e(`AppDropZone`,d),className:`field${S?` ${S}`:``}`,children:[f?l(`label`,{className:`label`,htmlFor:A,children:f}):null,u(`div`,{className:`file-input file-input-tall${T?` dragging`:``}${j?` error`:``}${x?` ${x}`:``}`,style:C,"aria-disabled":b||void 0,onDragOver:e=>{e.preventDefault(),!b&&!T&&E(!0)},onDragLeave:e=>{e.preventDefault(),E(!1)},onDrop:e=>{e.preventDefault(),E(!1),b||I(e.dataTransfer.files)},children:[u(`label`,{htmlFor:A,className:`file-input-zone-label`,children:[l(`span`,{className:`file-input-icon`,children:l(n,{name:`upload`,size:24})}),u(`span`,{className:`file-input-title`,children:[l(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),l(`span`,{className:`file-input-text`,children:_>0?`${F}, up to ${_} MB`:F})]}),l(`input`,{id:A,type:`file`,"aria-describedby":P,accept:g,multiple:h||void 0,disabled:b||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:e=>I(e.target.files),...w})]}),l(r,{error:j,hint:y,errorId:M,hintId:N})]})}export{d as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import r from"../lib/FieldMessage.js";import{DEFAULT_MAX_SIZE_MB as i,acceptLabel as a,validateFile as o}from"@webority/ui-elements/helpers";import{useId as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";function d(d){let{label:f,id:p,onChange:m,multiple:h=!1,accept:g=``,maxSizeMb:_=i,error:v,hint:y,disabled:b=!1,className:x=``,fieldClassName:S=``,style:C,"data-canvas":w,...T}=d;t(`AppDropZone`,T);let[E,D]=c(!1),[O,k]=c(``),A=s(),j=p||A,M=v||O,N=M?`${j}-error`:void 0,P=y&&!M?`${j}-hint`:void 0,F=N||P,I=g?a(g):`Any file type`,L=e=>{let t=Array.from(e||[]);if(!t.length)return;if(!h){let e=o(t[0],{accept:g,maxSizeMb:_});k(e||``),e||m(t[0]);return}let n=``,r=[];for(let e of t){let t=o(e,{accept:g,maxSizeMb:_});if(t){n||=t;continue}r.push(e)}k(n),r.length&&m(r)};return u(`div`,{...e(`AppDropZone`,d),className:`field${S?` ${S}`:``}`,children:[f?l(`label`,{className:`label`,htmlFor:j,children:f}):null,u(`div`,{className:`file-input file-input-tall${E?` dragging`:``}${M?` error`:``}${x?` ${x}`:``}`,style:C,"aria-disabled":b||void 0,onDragOver:e=>{e.preventDefault(),!b&&!E&&D(!0)},onDragLeave:e=>{e.preventDefault(),D(!1)},onDrop:e=>{e.preventDefault(),D(!1),b||L(e.dataTransfer.files)},children:[u(`label`,{htmlFor:j,className:`file-input-zone-label`,children:[l(`span`,{className:`file-input-icon`,children:l(n,{name:`upload`,size:24})}),u(`span`,{className:`file-input-title`,children:[l(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),l(`span`,{className:`file-input-text`,children:_>0?`${I}, up to ${_} MB`:I})]}),l(`input`,{id:j,type:`file`,"aria-describedby":F,accept:g,multiple:h||void 0,disabled:b||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:e=>L(e.target.files),...T})]}),l(r,{error:M,hint:y,errorId:N,hintId:P})]})}export{d as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes 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{keyOf as a,linkOf as o,nameOf as s,sizeLabelOf as c,uploadErrorOf as l,uploadProgressOf as u,useItemUrl as d}from"../lib/fileItem.js";import f from"../lib/FileItemRow.js";import{DEFAULT_IMAGE_ACCEPT as p,DEFAULT_MAX_SIZE_MB as m,acceptLabel as h,isImageFile as g,isImageOnlyAccept as _,validateFile as v}from"@webority/ui-elements/helpers";import{useId as y,useState as b}from"react";import{Fragment as x,jsx as S,jsxs as C}from"react/jsx-runtime";function w(r){let{label:s=`Attachment`,value:c,name:l,onChange:u,multiple:d=!1,accept:h=p,maxSizeMb:w=m,optional:D=!1,validate:O=!0,error:k,id:A,...j}=r;t(`AppFileAttachment`,j);let M=y(),N=A||M,[P,F]=b(``),[I,L]=b(!1),R=d&&Array.isArray(c)?c:c?[c]:[],z=_(h),B=e=>e instanceof File?g(e):z||g(e),V=!d&&R.length===1&&B(R[0])&&(R[0]instanceof File||o(R[0])!==null),H=T(h,w);function U(e){if(!e.length)return;let t=[],n=``;for(let r of e){let e=O?v(r,{accept:h,maxSizeMb:w}):null;if(e){n||=e;continue}t.push(r)}if(F(n),t.length)if(d){let e=Array.isArray(c)?c:c?[c]:[],n=new Set(e.map(a)),r=e.concat(t.filter(e=>!n.has(a(e))));u(r)}else u(t[0])}function W(e){let t=Array.from(e.target.files||[]);e.target.value=``,U(t)}function G(e){F(``),u(d?R.filter((t,n)=>n!==e):null)}let K=k||P,q=K?`${N}-error`:void 0,J=d||R.length===0,Y=z?`image`:`file`,X=d?`Add ${Y}s`:`Add ${z?`an`:`a`} ${Y}`;return C(`div`,{...e(`AppFileAttachment`,r),className:`field`,children:[C(`label`,{className:`label`,htmlFor:N,children:[s,D&&S(`span`,{className:`label-optional`,children:` (optional)`})]}),J&&C(x,{children:[C(`label`,{className:`attach-drop${I?` dragging`:``}`,htmlFor:N,onDragEnter:e=>{e.preventDefault(),j.disabled||L(!0)},onDragOver:e=>{e.preventDefault(),j.disabled||L(!0)},onDragLeave:e=>{e.preventDefault(),L(!1)},onDrop:e=>{e.preventDefault(),L(!1),!j.disabled&&U(Array.from(e.dataTransfer?.files||[]))},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:X}),H&&S(`span`,{className:`attach-drop-hint`,children:H})]}),S(`span`,{className:`attach-drop-cta`,children:`Browse`})]}),S(`input`,{id:N,type:`file`,className:`visually-hidden`,name:l,accept:h||void 0,multiple:d||void 0,"aria-describedby":q,onChange:W,...j})]}),V?S(E,{item:R[0],isImage:!0,onRemove:()=>G(0)}):R.length>0&&S(`div`,{className:`attach-list`,children:R.map((e,t)=>S(f,{item:e,isImage:B(e),onRemove:()=>G(t)},a(e)))}),S(i,{error:K,errorId:`${N}-error`})]})}function T(e,t){let n=e?.trim()?h(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=d(e,t),f=s(e),p=c(e),m=u(e),h=l(e),g=o(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:f}),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:f}):f}),p&&S(`div`,{className:`attach-size`,children:p})]}),m!==null&&S(r,{value:m,size:`sm`,label:`Uploading ${f}`,className:`wui-attach-progress`}),h&&S(`div`,{className:`wui-attach-error`,children:h})]})}export{w as default};
1
+ import{wuiMarkerAttributes 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{keyOf as a,linkOf as o,nameOf as s,sizeLabelOf as c,uploadErrorOf as l,uploadProgressOf as u,useItemUrl as d}from"../lib/fileItem.js";import f from"../lib/FileItemRow.js";import{DEFAULT_IMAGE_ACCEPT as p,DEFAULT_MAX_SIZE_MB as m,acceptLabel as h,isImageFile as g,isImageOnlyAccept as _,validateFile as v}from"@webority/ui-elements/helpers";import{useId as y,useState as b}from"react";import{Fragment as x,jsx as S,jsxs as C}from"react/jsx-runtime";function w(r){let{label:s=`Attachment`,value:c,name:l,onChange:u,multiple:d=!1,accept:h=p,maxSizeMb:w=m,optional:D=!1,validate:O=!0,error:k,id:A,"data-canvas":j,...M}=r;t(`AppFileAttachment`,M);let N=y(),P=A||N,[F,I]=b(``),[L,R]=b(!1),z=d&&Array.isArray(c)?c:c?[c]:[],B=_(h),V=e=>e instanceof File?g(e):B||g(e),H=!d&&z.length===1&&V(z[0])&&(z[0]instanceof File||o(z[0])!==null),U=T(h,w);function W(e){if(!e.length)return;let t=[],n=``;for(let r of e){let e=O?v(r,{accept:h,maxSizeMb:w}):null;if(e){n||=e;continue}t.push(r)}if(I(n),t.length)if(d){let e=Array.isArray(c)?c:c?[c]:[],n=new Set(e.map(a)),r=e.concat(t.filter(e=>!n.has(a(e))));u(r)}else u(t[0])}function G(e){let t=Array.from(e.target.files||[]);e.target.value=``,W(t)}function K(e){I(``),u(d?z.filter((t,n)=>n!==e):null)}let q=k||F,J=q?`${P}-error`:void 0,Y=d||z.length===0,X=B?`image`:`file`,Z=d?`Add ${X}s`:`Add ${B?`an`:`a`} ${X}`;return C(`div`,{...e(`AppFileAttachment`,r),className:`field`,children:[C(`label`,{className:`label`,htmlFor:P,children:[s,D&&S(`span`,{className:`label-optional`,children:` (optional)`})]}),Y&&C(x,{children:[C(`label`,{className:`attach-drop${L?` dragging`:``}`,htmlFor:P,onDragEnter:e=>{e.preventDefault(),M.disabled||R(!0)},onDragOver:e=>{e.preventDefault(),M.disabled||R(!0)},onDragLeave:e=>{e.preventDefault(),R(!1)},onDrop:e=>{e.preventDefault(),R(!1),!M.disabled&&W(Array.from(e.dataTransfer?.files||[]))},children:[S(`span`,{className:`attach-drop-icon`,children:S(n,{name:B?`image`:`file-text`,size:18})}),C(`span`,{className:`attach-drop-copy`,children:[S(`span`,{className:`attach-drop-title`,children:Z}),U&&S(`span`,{className:`attach-drop-hint`,children:U})]}),S(`span`,{className:`attach-drop-cta`,children:`Browse`})]}),S(`input`,{id:P,type:`file`,className:`visually-hidden`,name:l,accept:h||void 0,multiple:d||void 0,"aria-describedby":J,onChange:G,...M})]}),H?S(E,{item:z[0],isImage:!0,onRemove:()=>K(0)}):z.length>0&&S(`div`,{className:`attach-list`,children:z.map((e,t)=>S(f,{item:e,isImage:V(e),onRemove:()=>K(t)},a(e)))}),S(i,{error:q,errorId:`${P}-error`})]})}function T(e,t){let n=e?.trim()?h(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=d(e,t),f=s(e),p=c(e),m=u(e),h=l(e),g=o(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:f}),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:f}):f}),p&&S(`div`,{className:`attach-size`,children:p})]}),m!==null&&S(r,{value:m,size:`sm`,label:`Uploading ${f}`,className:`wui-attach-progress`}),h&&S(`div`,{className:`wui-attach-error`,children:h})]})}export{w as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnUnknownProps.js";import r from"./withTooltip.js";import i from"./AppIcon.js";import a from"../lib/FieldMessage.js";import o from"./AppRequiredMark.js";import{keyOf as s}from"../lib/fileItem.js";import ee from"../lib/FileItemRow.js";import{DEFAULT_MAX_SIZE_MB as c,acceptLabel as l,isImageFile as u,isImageOnlyAccept as te,isPdfFile as ne,validateFile as d}from"@webority/ui-elements/helpers";import{useEffect as f,useId as re,useRef as ie,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";function g(g){let{label:_,value:v,name:ae,id:oe,onPick:y,multiple:b=!1,maxFiles:x,accept:S=`.jpg,.jpeg,.png`,maxSizeMb:C=c,required:se,error:w,hint:T,loading:E=!1,className:D=``,fieldClassName:O=``,style:k,...A}=g;n(`AppFilePicker`,A);let[ce,j]=p(null),[M,N]=p(null),[P,F]=p(!1),[le,I]=p(``),L=ie(null),ue=re(),R=oe||ue;f(()=>{if(!b&&v instanceof File&&u(v)){let e=URL.createObjectURL(v);return j(e),()=>URL.revokeObjectURL(e)}j(null)},[v,b]);let z=!b&&v&&!u(v)&&ne(v)?v instanceof File?v:v.url:null;f(()=>{if(!z){N(null);return}let e=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof z==`string`?{url:z}:z)).then(t=>{e&&(n=URL.createObjectURL(t),N(n))}).catch(e=>t(`[AppFilePicker] the PDF preview failed:`,e?.message)),()=>{e=!1,N(null),n&&URL.revokeObjectURL(n)}},[z]);let B=b?Array.isArray(v)?v:v?[v]:[]:[],V=w||le,H=V?`${R}-error`:void 0,U=T&&!V?`${R}-hint`:void 0,de=H||U,W=te(S),G=!b&&!!v,K=G&&(v instanceof File?u(v):W||u(v)),fe=v?.name,q=K?v?.url||ce:M,J=K?`image`:`file`,pe=_?`Change ${_}`:`Change ${J}`,Y=_?`Remove ${_}`:`Remove ${J}`,me=_?`${_} preview`:`Selected ${J} preview`,X=e=>{let t=d(e,{accept:S,maxSizeMb:C});return t?(I(t),!1):(I(``),y(e),!0)},Z=e=>{let t=Array.from(e||[]);if(!t.length)return;let n=Array.isArray(v)?v:v?[v]:[],r=new Set(n.map(s)),i=``,a=[];for(let e of t){let t=d(e,{accept:S,maxSizeMb:C});if(t){i||=t;continue}r.has(s(e))||(r.add(s(e)),a.push(e))}let o=n.concat(a);x&&o.length>x&&(o=o.slice(0,x),i||=`Up to ${x} files.`),I(i),y(o)},he=e=>{if(b){Z(e.target.files);return}let t=e.target.files?.[0]||null;t&&(X(t)||(e.target.value=``))},ge=e=>{if(e.preventDefault(),F(!1),E)return;if(b){Z(e.dataTransfer.files);return}let t=e.dataTransfer.files?.[0];t&&X(t)},_e=e=>{I(``),y(B.filter((t,n)=>n!==e))},ve=()=>L.current?.click(),Q=E?m(`span`,{className:`wui-file-busy`,children:m(`span`,{className:`spinner-border spinner-border-sm`,role:`status`,"aria-label":`Loading`})}):null,$=m(`input`,{id:R,name:ae,ref:L,type:`file`,"aria-describedby":de,accept:S,multiple:b||void 0,disabled:E||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:he,...A});return h(`div`,{...e(`AppFilePicker`,g),className:`field${O?` ${O}`:``}`,children:[h(`label`,{className:`label`,htmlFor:R,children:[_,se&&m(o,{})]}),G?h(`div`,{className:`file-preview${V?` error`:``}${D?` ${D}`:``}`,style:k,"aria-busy":E||void 0,children:[h(`button`,{type:`button`,className:`file-preview-open`,"aria-label":pe,onClick:ve,disabled:E,children:[q?m(`img`,{src:q,alt:me,className:`file-preview-img`}):h(`span`,{className:`file-preview-file`,children:[m(i,{name:`file-text`,size:28}),m(`span`,{className:`file-preview-file-name`,children:fe})]}),m(`span`,{className:`file-preview-overlay`,children:h(`span`,{className:`file-preview-cta`,children:[m(i,{name:K?`image`:`file-text`,size:16}),` `,K?`Change image`:`Change file`]})})]}),r(m(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":Y,onClick:()=>y(null),disabled:E,children:m(i,{name:`x`,size:16})}),Y),$,Q]}):h(`div`,{className:`file-input file-input-tall${P?` dragging`:``}${V?` error`:``}${b&&B.length>0?` has-files`:``}${D?` ${D}`:``}`,style:k,"aria-busy":E||void 0,onDragOver:e=>{e.preventDefault(),!E&&!P&&F(!0)},onDragLeave:e=>{e.preventDefault(),F(!1)},onDrop:ge,children:[h(`label`,{htmlFor:R,className:`file-input-zone-label`,children:[m(`span`,{className:`file-input-icon`,children:m(i,{name:`upload`,size:24})}),h(`span`,{className:`file-input-title`,children:[m(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),m(`span`,{className:`file-input-text`,children:C>0?`${l(S)}, up to ${C} MB`:l(S)})]}),$,Q,b&&B.length>0&&m(`div`,{className:`attach-list`,children:B.map((e,t)=>m(ee,{item:e,isImage:e instanceof File?u(e):W||u(e),noun:`file`,onRemove:()=>_e(t)},s(e)))})]}),m(a,{error:V,hint:T,errorId:H,hintId:U})]})}export{g as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import{devWarn as t}from"../lib/devWarn.js";import n from"./warnUnknownProps.js";import r from"./withTooltip.js";import i from"./AppIcon.js";import a from"../lib/FieldMessage.js";import o from"./AppRequiredMark.js";import{keyOf as s}from"../lib/fileItem.js";import ee from"../lib/FileItemRow.js";import{DEFAULT_MAX_SIZE_MB as c,acceptLabel as l,isImageFile as u,isImageOnlyAccept as te,isPdfFile as ne,validateFile as d}from"@webority/ui-elements/helpers";import{useEffect as f,useId as re,useRef as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";function _(_){let{label:v,value:y,name:ie,id:ae,onPick:b,multiple:x=!1,maxFiles:S,accept:C=`.jpg,.jpeg,.png`,maxSizeMb:w=c,required:oe,error:T,hint:E,loading:D=!1,className:O=``,fieldClassName:k=``,style:A,"data-canvas":se,...j}=_;n(`AppFilePicker`,j);let[ce,M]=m(null),[le,N]=m(null),[P,F]=m(!1),[ue,I]=m(``),L=p(null),de=re(),R=ae||de;f(()=>{if(!x&&y instanceof File&&u(y)){let e=URL.createObjectURL(y);return M(e),()=>URL.revokeObjectURL(e)}M(null)},[y,x]);let z=!x&&y&&!u(y)&&ne(y)?y instanceof File?y:y.url:null;f(()=>{if(!z){N(null);return}let e=!0,n=null;return import(`@webority/ui-elements/file-viewer`).then(e=>e.renderPdfFirstPage(typeof z==`string`?{url:z}:z)).then(t=>{e&&(n=URL.createObjectURL(t),N(n))}).catch(e=>t(`[AppFilePicker] the PDF preview failed:`,e?.message)),()=>{e=!1,N(null),n&&URL.revokeObjectURL(n)}},[z]);let B=x?Array.isArray(y)?y:y?[y]:[]:[],V=T||ue,H=V?`${R}-error`:void 0,U=E&&!V?`${R}-hint`:void 0,fe=H||U,W=te(C),G=!x&&!!y,K=G&&(y instanceof File?u(y):W||u(y)),pe=y?.name,q=K?y?.url||ce:le,J=K?`image`:`file`,me=v?`Change ${v}`:`Change ${J}`,Y=v?`Remove ${v}`:`Remove ${J}`,he=v?`${v} preview`:`Selected ${J} preview`,X=e=>{let t=d(e,{accept:C,maxSizeMb:w});return t?(I(t),!1):(I(``),b(e),!0)},Z=e=>{let t=Array.from(e||[]);if(!t.length)return;let n=Array.isArray(y)?y:y?[y]:[],r=new Set(n.map(s)),i=``,a=[];for(let e of t){let t=d(e,{accept:C,maxSizeMb:w});if(t){i||=t;continue}r.has(s(e))||(r.add(s(e)),a.push(e))}let o=n.concat(a);S&&o.length>S&&(o=o.slice(0,S),i||=`Up to ${S} files.`),I(i),b(o)},ge=e=>{if(x){Z(e.target.files);return}let t=e.target.files?.[0]||null;t&&(X(t)||(e.target.value=``))},_e=e=>{if(e.preventDefault(),F(!1),D)return;if(x){Z(e.dataTransfer.files);return}let t=e.dataTransfer.files?.[0];t&&X(t)},ve=e=>{I(``),b(B.filter((t,n)=>n!==e))},ye=()=>L.current?.click(),Q=D?h(`span`,{className:`wui-file-busy`,children:h(`span`,{className:`spinner-border spinner-border-sm`,role:`status`,"aria-label":`Loading`})}):null,$=h(`input`,{id:R,name:ie,ref:L,type:`file`,"aria-describedby":fe,accept:C,multiple:x||void 0,disabled:D||void 0,className:`visually-hidden`,onClick:e=>{e.currentTarget.value=``},onChange:ge,...j});return g(`div`,{...e(`AppFilePicker`,_),className:`field${k?` ${k}`:``}`,children:[g(`label`,{className:`label`,htmlFor:R,children:[v,oe&&h(o,{})]}),G?g(`div`,{className:`file-preview${V?` error`:``}${O?` ${O}`:``}`,style:A,"aria-busy":D||void 0,children:[g(`button`,{type:`button`,className:`file-preview-open`,"aria-label":me,onClick:ye,disabled:D,children:[q?h(`img`,{src:q,alt:he,className:`file-preview-img`}):g(`span`,{className:`file-preview-file`,children:[h(i,{name:`file-text`,size:28}),h(`span`,{className:`file-preview-file-name`,children:pe})]}),h(`span`,{className:`file-preview-overlay`,children:g(`span`,{className:`file-preview-cta`,children:[h(i,{name:K?`image`:`file-text`,size:16}),` `,K?`Change image`:`Change file`]})})]}),r(h(`button`,{type:`button`,className:`file-preview-remove`,"aria-label":Y,onClick:()=>b(null),disabled:D,children:h(i,{name:`x`,size:16})}),Y),$,Q]}):g(`div`,{className:`file-input file-input-tall${P?` dragging`:``}${V?` error`:``}${x&&B.length>0?` has-files`:``}${O?` ${O}`:``}`,style:A,"aria-busy":D||void 0,onDragOver:e=>{e.preventDefault(),!D&&!P&&F(!0)},onDragLeave:e=>{e.preventDefault(),F(!1)},onDrop:_e,children:[g(`label`,{htmlFor:R,className:`file-input-zone-label`,children:[h(`span`,{className:`file-input-icon`,children:h(i,{name:`upload`,size:24})}),g(`span`,{className:`file-input-title`,children:[h(`span`,{className:`browse`,children:`Click to upload`}),` or drag & drop`]}),h(`span`,{className:`file-input-text`,children:w>0?`${l(C)}, up to ${w} MB`:l(C)})]}),$,Q,x&&B.length>0&&h(`div`,{className:`attach-list`,children:B.map((e,t)=>h(ee,{item:e,isImage:e instanceof File?u(e):W||u(e),noun:`file`,onRemove:()=>ve(t)},s(e)))})]}),h(a,{error:V,hint:E,errorId:H,hintId:U})]})}export{_ as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes 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=>{let n=O[e]||(O[e]=Object.create(null));Object.assign(n,t.FULL_VARIANT_GLYPHS),j[s]=!1;let r=A[s];if(r){for(let e of r)e();r.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{name:n,size:r=16,variant:a,tooltip:h,tooltipPlacement:g,className:v,color:y,style:w,...E}=t;c(`AppIcon`,E),s(`AppIcon`,`variant`,a,m);let k=!!a&&a!==`linear`,j=h!=null&&h!==``,N=e(`AppIcon`,t),F=(e,t=!0)=>j?l(f(`span`,{className:`wui-icon-tip`,role:`img`,"aria-label":h,...t?N:void 0,children:e}),h,g):e,I=o[n]!==void 0,L=!I&&S.has(n),[,R]=d(0);u(()=>{let e=()=>R(e=>e+1);k&&I&&!_&&(b.add(e),x());let t=L?i(n):null;L&&C[n]===void 0&&((T[t]||=new Set).add(e),D(n));let r=k&&L?`${a}:${i(n)}`:null;return k&&L&&O[a]?.[n]===void 0&&((A[r]||=new Set).add(e),M(a,n)),()=>{b.delete(e),t&&T[t]?.delete(e),r&&A[r]?.delete(e)}},[n,k,I,L,a]);let z=P.get(n);if(z)return F(z({size:r,color:y,className:v,style:w}),!1);if(n===`hard-hat`)return F(f(`svg`,{width:r,height:r,viewBox:`0 0 24 24`,fill:`none`,className:v?`wui-icon ${v}`:`wui-icon`,"data-icon":n,"aria-hidden":`true`,style:{color:y,...w},...j?void 0:N,...E,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 B=k&&(_?.[a]?.[n]||L&&O?.[a]?.[n])||o[n]||C[n];return B?F(f(`svg`,{width:r,height:r,viewBox:`0 0 24 24`,fill:`none`,className:v?`wui-icon ${v}`:`wui-icon`,"data-icon":n,"aria-hidden":`true`,style:{color:y,...w},dangerouslySetInnerHTML:{__html:B},...j?void 0:N,...E})):null}export{I as default,N as iconNames,F as registerIcons};
1
+ import{wuiMarkerAttributes 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=>{let n=O[e]||(O[e]=Object.create(null));Object.assign(n,t.FULL_VARIANT_GLYPHS),j[s]=!1;let r=A[s];if(r){for(let e of r)e();r.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{name:n,size:r=16,variant:a,tooltip:h,tooltipPlacement:g,className:v,color:y,style:w,"data-canvas":E,...k}=t;c(`AppIcon`,k),s(`AppIcon`,`variant`,a,m);let j=!!a&&a!==`linear`,N=h!=null&&h!==``,F=e(`AppIcon`,t),I=(e,t=!0)=>N?l(f(`span`,{className:`wui-icon-tip`,role:`img`,"aria-label":h,...t?F:void 0,children:e}),h,g):e,L=o[n]!==void 0,R=!L&&S.has(n),[,z]=d(0);u(()=>{let e=()=>z(e=>e+1);j&&L&&!_&&(b.add(e),x());let t=R?i(n):null;R&&C[n]===void 0&&((T[t]||=new Set).add(e),D(n));let r=j&&R?`${a}:${i(n)}`:null;return j&&R&&O[a]?.[n]===void 0&&((A[r]||=new Set).add(e),M(a,n)),()=>{b.delete(e),t&&T[t]?.delete(e),r&&A[r]?.delete(e)}},[n,j,L,R,a]);let B=P.get(n);if(B)return I(B({size:r,color:y,className:v,style:w}),!1);if(n===`hard-hat`)return I(f(`svg`,{width:r,height:r,viewBox:`0 0 24 24`,fill:`none`,className:v?`wui-icon ${v}`:`wui-icon`,"data-icon":n,"aria-hidden":`true`,style:{color:y,...w},...N?void 0:F,...k,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=j&&(_?.[a]?.[n]||R&&O?.[a]?.[n])||o[n]||C[n];return V?I(f(`svg`,{width:r,height:r,viewBox:`0 0 24 24`,fill:`none`,className:v?`wui-icon ${v}`:`wui-icon`,"data-icon":n,"aria-hidden":`true`,style:{color:y,...w},dangerouslySetInnerHTML:{__html:V},...N?void 0:F,...k})):null}export{I as default,N as iconNames,F as registerIcons};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import ee from"../lib/FieldMessage.js";import te from"./AppPopover.js";import ne from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import{MASK_INPUT_TYPES as re,MASK_NAMES as ie,attachInputMask as ae,evaluatePassword as oe,formatMasked as a,isMaskPattern as se,postedMasked as ce}from"@webority/ui-elements/helpers";import{forwardRef as o,useEffect as s,useId as le,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 ue=[`sm`,`md`,`lg`,`xl`],de=[`bare`],fe=[!0,!1,`above`],p=o(function(o,p){let{label:m,required:h=!1,error:pe,hint:me,help:g,helpLabel:he=`More information`,type:_=`text`,size:v=`md`,leftIcon:y,rightIcon:b,onRightIconClick:x,rightIconLabel:ge,unit:S,id:_e,name:ve,className:ye=``,fieldClassName:C=``,disabled:w=!1,clearable:T=!1,showCount:E=!1,maxLength:D,prefix:O,suffix:k,action:A,floatingLabel:j=!1,variant:M,passwordRequirements:N=!1,requirementsPlacement:P=`auto`,mask:F,postFormatted:I=!1,onMaskChange:L,...R}=o;n(`AppInput`,R),t(`AppInput`,`size`,v,ue),t(`AppInput`,`variant`,M,de),t(`AppInput`,`floatingLabel`,j,fe),F!=null&&!se(F)&&t(`AppInput`,`mask`,F,ie),F!=null&&t(`AppInput`,`type`,_,re);let[z,be]=l(!1),[xe,Se]=l(``),B=pe||xe,Ce=le(),V=_e||Ce,H=_===`password`,we=H&&z?`text`:_,U=c(null),Te=e=>{U.current=e,typeof p==`function`?p(e):p&&(p.current=e)},W=String(R.value??R.defaultValue??``),[Ee,G]=l(()=>!!W),[K,q]=l(()=>W.length),De=T&&!w,J=T||E,Y=H&&!!N,[Oe,ke]=l(W);s(()=>{!Y||R.value===void 0||ke(String(R.value??``))},[R.value,Y]),s(()=>{if(!J||R.value===void 0)return;let e=String(R.value??``);G(!!e),q(e.length)},[R.value,J]);let Ae=e=>{G(!!e.target.value),q(e.target.value.length),R.onInput?.(e)},je=e=>{Y&&ke(e.target.value),J?Ae(e):R.onInput?.(e)},Me=F?{...R.value!==void 0&&{value:a(F,R.value)},...R.defaultValue!==void 0&&{defaultValue:a(F,R.defaultValue)}}:null,Ne=c(L);Ne.current=L,s(()=>{let e=U.current;if(!(!F||!e))return ae(e,{mask:F,postFormatted:I,onChange:(e,t)=>Ne.current?.(e,t),onInvalidChange:Se})},[F,I]);let Pe=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,Fe=De?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:!Ee,children:d(r,{name:`x`,size:16})}):null,Ie=B&&V?`${V}-error`:void 0,Le=me&&V?`${V}-hint`:void 0,X=Y&&P===`inline`,Re=X&&V?`${V}-requirements`:void 0,ze=Ie||(X?Re:Le),Be=[`input`,v===`sm`?`input-sm`:``,v===`lg`?`input-lg`:``,v===`xl`?`wui-input-xl`:``,B?`error`:``,H?`pw`:``,S?`num-input`:``,!(j&&m||O||k||S||H||b)&&T&&De?`has-clear`:``,M===`bare`?`input-bare`:``,ye].filter(Boolean).join(` `),Z=d(u.Control,{id:V,name:ve,type:we,className:Be,disabled:w,required:h,"aria-invalid":B?`true`:`false`,"aria-describedby":ze,maxLength:D,...R,onChange:Pe(R.onChange),onBlur:Pe(R.onBlur),...Me,placeholder:j?` `:R.placeholder,ref:Te,onInput:J||Y?je:R.onInput}),Q=N===!0||N,Ve=Q&&typeof Q==`object`&&Q.title||`Password requirements`,He=Y?oe(Oe,Q):null,Ue=Y?d(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:Re,"aria-label":X?Ve:void 0,children:He.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(j&&m&&!H)$=f(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:[Z,f(`label`,{className:`float-label`,htmlFor:V,children:[m,h&&d(i,{})]})]});else if(A)$=f(`div`,{className:`input-action-row`,children:[f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(r,{name:y,size:16})}),Z]}),d(`div`,{className:`input-action`,children:A})]});else if(O||k)$=f(`div`,{className:`input-affixed`,children:[O!=null&&d(`span`,{className:`affix affix-pre`,children:O}),Z,k!=null&&d(`span`,{className:`affix affix-suf`,children:k})]});else if(S)$=f(`div`,{className:`input-with-unit`,children:[Z,d(`span`,{className:`unit`,children:S})]});else if(H){let e=f(`button`,{type:`button`,className:`pw-toggle${z?` pw-revealed`:``}`,onClick:()=>be(e=>!e),"aria-label":z?`Hide password`:`Show password`,tabIndex:-1,children:[d(r,{name:`eye`,size:18,className:`pw-eye`}),d(r,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=j&&m?d(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:f(`div`,{className:`input-wrap`,children:[Z,e,f(`label`,{className:`float-label`,htmlFor:V,children:[m,h&&d(i,{})]})]})}):f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(r,{name:y,size:16})}),Z,e]});$=Y&&!X?d(te,{trigger:t,triggerType:`focus`,placement:P,title:Ve,className:`pw-popover`,children:Ue}):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":ge||b,children:d(r,{name:b,size:18})})]}):T?f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(r,{name:y,size:16})}),Z,Fe]}):y?f(`div`,{className:`input-icon`,children:[d(`span`,{className:`ic`,children:d(r,{name:y,size:16})}),Z]}):Z;return f(u.Group,{...e(`AppInput`,o),className:`field${C?` ${C}`:``}`,children:[m&&!j&&f(u.Label,{className:`label`,htmlFor:V,children:[m,h&&d(i,{}),g&&d(ne,{label:he,children:g})]}),$,X&&d(`div`,{className:`wui-pw-inline`,children:Ue}),d(ee,{error:B,hint:X?null:me,errorId:Ie,hintId:Le}),E&&f(`div`,{className:`field-count${D&&K>=D?` at-limit`:``}`,children:[K,D?` / ${D}`:``]})]})});export{p as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import ee from"../lib/FieldMessage.js";import te from"./AppPopover.js";import ne from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import{MASK_INPUT_TYPES as re,MASK_NAMES as ie,attachInputMask as ae,evaluatePassword as oe,formatMasked as a,isMaskPattern as se,postedMasked as ce}from"@webority/ui-elements/helpers";import{forwardRef as o,useEffect as s,useId as le,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 ue=[`sm`,`md`,`lg`,`xl`],de=[`bare`],fe=[`off`,`border`,`above`],pe=[`off`,`shown`],p=o(function(o,p){let{label:m,required:h=!1,error:me,hint:he,help:g,helpLabel:ge=`More information`,type:_=`text`,size:v=`md`,leftIcon:y,rightIcon:b,onRightIconClick:x,rightIconLabel:_e,unit:S,id:ve,name:ye,className:be=``,fieldClassName:C=``,disabled: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:xe,requirementsPlacement:P=`auto`,mask:F,postFormatted:I=!1,onMaskChange:L,"data-canvas":Se,...R}=o;n(`AppInput`,R),t(`AppInput`,`size`,v,ue),t(`AppInput`,`variant`,M,de),t(`AppInput`,`floatingLabel`,j,fe),t(`AppInput`,`passwordRequirements`,N,pe),F!=null&&!se(F)&&t(`AppInput`,`mask`,F,ie),F!=null&&t(`AppInput`,`type`,_,re);let[z,Ce]=l(!1),[we,Te]=l(``),B=me||we,Ee=le(),V=ve||Ee,H=_===`password`,De=H&&z?`text`:_,U=c(null),Oe=e=>{U.current=e,typeof p==`function`?p(e):p&&(p.current=e)},W=String(R.value??R.defaultValue??``),[ke,G]=l(()=>!!W),[K,q]=l(()=>W.length),Ae=T&&!w,J=T||E,Y=H&&N===`shown`,[je,Me]=l(W);s(()=>{!Y||R.value===void 0||Me(String(R.value??``))},[R.value,Y]),s(()=>{if(!J||R.value===void 0)return;let e=String(R.value??``);G(!!e),q(e.length)},[R.value,J]);let Ne=e=>{G(!!e.target.value),q(e.target.value.length),R.onInput?.(e)},Pe=e=>{Y&&Me(e.target.value),J?Ne(e):R.onInput?.(e)},Fe=F?{...R.value!==void 0&&{value:a(F,R.value)},...R.defaultValue!==void 0&&{defaultValue:a(F,R.defaultValue)}}:null,Ie=c(L);Ie.current=L,s(()=>{let e=U.current;if(!(!F||!e))return ae(e,{mask:F,postFormatted:I,onChange:(e,t)=>Ie.current?.(e,t),onInvalidChange:Te})},[F,I]);let Le=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,Re=Ae?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:!ke,children:d(r,{name:`x`,size:16})}):null,ze=B&&V?`${V}-error`:void 0,Be=he&&V?`${V}-hint`:void 0,X=Y&&P===`inline`,Ve=X&&V?`${V}-requirements`:void 0,He=ze||(X?Ve:Be),Ue=[`input`,v===`sm`?`input-sm`:``,v===`lg`?`input-lg`:``,v===`xl`?`wui-input-xl`:``,B?`error`:``,H?`pw`:``,S?`num-input`:``,!(j!==`off`&&m||O||k||S||H||b)&&T&&Ae?`has-clear`:``,M===`bare`?`input-bare`:``,be].filter(Boolean).join(` `),Z=d(u.Control,{id:V,name:ye,type:De,className:Ue,disabled:w,required:h,"aria-invalid":B?`true`:`false`,"aria-describedby":He,maxLength:D,...R,onChange:Le(R.onChange),onBlur:Le(R.onBlur),...Fe,placeholder:j===`off`?R.placeholder:` `,ref:Oe,onInput:J||Y?Pe:R.onInput}),Q=xe??!0,We=Q&&typeof Q==`object`&&Q.title||`Password requirements`,Ge=Y?oe(je,Q):null,Ke=Y?d(`ul`,{className:`pw-criteria`,"aria-live":`polite`,id:Ve,"aria-label":X?We:void 0,children:Ge.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(j!==`off`&&m&&!H)$=f(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:[Z,f(`label`,{className:`float-label`,htmlFor:V,children:[m,h&&d(i,{})]})]});else if(A)$=f(`div`,{className:`input-action-row`,children:[f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(r,{name:y,size:16})}),Z]}),d(`div`,{className:`input-action`,children:A})]});else if(O||k)$=f(`div`,{className:`input-affixed`,children:[O!=null&&d(`span`,{className:`affix affix-pre`,children:O}),Z,k!=null&&d(`span`,{className:`affix affix-suf`,children:k})]});else if(S)$=f(`div`,{className:`input-with-unit`,children:[Z,d(`span`,{className:`unit`,children:S})]});else if(H){let e=f(`button`,{type:`button`,className:`pw-toggle${z?` pw-revealed`:``}`,onClick:()=>Ce(e=>!e),"aria-label":z?`Hide password`:`Show password`,tabIndex:-1,children:[d(r,{name:`eye`,size:18,className:`pw-eye`}),d(r,{name:`eye-off`,size:18,className:`pw-eye-off`})]}),t=j!==`off`&&m?d(`div`,{className:j===`above`?`field-float wui-float-above`:`field-float`,children:f(`div`,{className:`input-wrap`,children:[Z,e,f(`label`,{className:`float-label`,htmlFor:V,children:[m,h&&d(i,{})]})]})}):f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(r,{name:y,size:16})}),Z,e]});$=Y&&!X?d(te,{trigger:t,triggerType:`focus`,placement:P,title:We,className:`pw-popover`,children:Ke}):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":_e||b,children:d(r,{name:b,size:18})})]}):T?f(`div`,{className:y?`input-icon`:`input-wrap`,children:[y&&d(`span`,{className:`ic`,children:d(r,{name:y,size:16})}),Z,Re]}):y?f(`div`,{className:`input-icon`,children:[d(`span`,{className:`ic`,children:d(r,{name:y,size:16})}),Z]}):Z;return f(u.Group,{...e(`AppInput`,o),className:`field${C?` ${C}`:``}`,children:[m&&j===`off`&&f(u.Label,{className:`label`,htmlFor:V,children:[m,h&&d(i,{}),g&&d(ne,{label:ge,children:g})]}),$,X&&d(`div`,{className:`wui-pw-inline`,children:Ke}),d(ee,{error:B,hint:X?null:he,errorId:ze,hintId:Be}),E&&f(`div`,{className:`field-count${D&&K>=D?` at-limit`:``}`,children:[K,D?` / ${D}`:``]})]})});export{p as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes 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 i from"./AppAlert.js";import a from"./AppButton.js";import te from"../lib/FieldMessage.js";import ne from"./AppRequiredMark.js";import re from"./AppModal.js";import{DEFAULT_MAX_SIZE_MB as ie,validateFile as o}from"@webority/ui-elements/helpers";import{useCallback as ae,useEffect as s,useId as oe,useRef as se,useState as c}from"react";import{Fragment as ce,jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/image-crop";var le=[`stacked`,`inline`,`profile`],ue=[`initials`,`avatar`],de=[`circle`,`rounded`,`square`],d={sm:72,md:120,lg:160},fe=`That image could not be cropped. Choose another one.`,pe=`That image could not be opened. Choose another one.`;function f(f){let{value:p,fallback:me,name:he,onPick:ge,onRemove:m,loading:h=!1,disabled:g=!1,accept:_=`image/png,image/jpeg,image/webp`,maxSizeMb:v=ie,crop:y,overlayIcon:_e=`image`,overlayLabel:b=`Update photo`,ariaLabel:ve=`Upload photo`,removeLabel:ye=`Remove photo`,label:be,hint:x,error:xe,layout:S=`stacked`,title:C,subtitle:w,required:Se=!1,variant:T=`initials`,size:E=`md`,shape:D=`circle`,className:O=``,...Ce}=f;n(`AppLogoPicker`,Ce),t(`AppLogoPicker`,`layout`,S,le),t(`AppLogoPicker`,`variant`,T,ue),t(`AppLogoPicker`,`shape`,D,de),t(`AppLogoPicker`,`size`,typeof E==`string`?E:null,Object.keys(d));let k=y===`free`?null:typeof y==`number`&&Number.isFinite(y)&&y>0?y:void 0;y!=null&&k===void 0&&t(`AppLogoPicker`,`crop`,String(y),[`free`,`a positive number`]);let A=se(null),j=se(null),M=oe(),[N,P]=c(null),[we,F]=c(``),[Te,I]=c(!1),[L,R]=c(!1),[z,B]=c(null),[V,H]=c(!1),[U,W]=c(`loading`),[G,K]=c(``),Ee=ae(e=>{if(j.current=e,!e)return;let t=()=>W(`ready`),n=()=>W(`error`);return e.addEventListener(`load`,t),e.addEventListener(`error`,n),()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),j.current=null}},[]);s(()=>()=>z&&URL.revokeObjectURL(z.url),[z]),s(()=>()=>N&&URL.revokeObjectURL(N),[N]),s(()=>{P(null),I(!1)},[p]);let q=h||g,J=N||(p&&!Te?p:null),Y=xe||we,De=x&&!Y?`${M}-hint`:void 0,Oe=Y?`${M}-error`:void 0,ke=!q&&(!!N||!!J&&!!m),Ae=()=>{q||A.current?.click()},je=e=>{F(``),I(!1),P(URL.createObjectURL(e)),ge(e)},Me=e=>{let t=k!==void 0&&e.type!==`image/svg+xml`,n=o(e,{accept:_,maxSizeMb:t?0:v});if(n){F(n);return}if(t){F(``),W(`loading`),K(``),B({file:e,url:URL.createObjectURL(e)});return}je(e)},Ne=async()=>{let{file:e}=z;H(!0),K(``);let t=null;try{t=await j.current?.toFile({name:e.name,type:e.type,maxBytes:v>0?v*1024*1024:0})}catch{t=null}if(H(!1),!t){K(fe);return}B(null);let n=o(t,{accept:_,maxSizeMb:v});n?F(n):je(t)},Pe=()=>{V||B(null)},Fe=e=>{let t=e.target.files?.[0];e.target.value=``,t&&Me(t)},Ie=e=>{if(e.preventDefault(),R(!1),q)return;let t=e.dataTransfer.files?.[0];t&&Me(t)},Le=()=>{P(null),F(``),I(!1),A.current&&(A.current.value=``),m?.()},X=typeof E==`number`?E:d[E]??d.md,Re=Math.max(14,Math.round(X*.18)),ze=Math.round(X*.5),Be=[`set-uploader`,T===`avatar`?`set-uploader--avatar`:``,D===`rounded`?`set-uploader--rounded`:D===`square`?`set-uploader--square`:``,L&&`is-dragging`].filter(Boolean).join(` `),Ve=S===`inline`,He=S===`profile`,Z=u(`div`,{className:`set-uploader-shell`,style:{"--wui-logo-size":`${X}px`},children:[l(`button`,{type:`button`,className:Be,onClick:Ae,disabled:q,"aria-busy":h||void 0,"aria-label":ve,"aria-describedby":Oe||De,onDragOver:e=>{e.preventDefault(),!q&&!L&&R(!0)},onDragLeave:e=>{e.preventDefault(),R(!1)},onDrop:Ie,...Ce,children:u(`span`,{className:`set-uploader-ring`,"data-overlay-label":b,children:[J?l(`img`,{className:`set-uploader-img`,src:J,alt:``,onError:()=>I(!0)}):l(`span`,{className:`set-uploader-logo`,children:me||T===`avatar`&&l(r,{name:`user`,size:ze})}),h?l(`span`,{className:`set-uploader-overlay is-loading`,"aria-hidden":`true`,children:l(r,{name:`refresh-cw`,size:Re,className:`wui-spin`})}):!g&&u(`span`,{className:`set-uploader-overlay`,children:[l(r,{name:_e,size:Re}),l(`span`,{children:b})]})]})}),ee(l(`button`,{type:`button`,className:`set-uploader-remove`,hidden:!ke,"aria-label":ye,onClick:Le,children:l(r,{name:`x`,size:14})}),ke?ye:null),l(`input`,{id:M,ref:A,type:`file`,name:he,hidden:!0,accept:_,onChange:Fe,disabled:q}),k!==void 0&&u(re,{open:!!z,title:`Crop photo`,subtitle:`Drag the frame and zoom to choose what to keep.`,size:`lg`,staticBackdrop:!0,dismissible:!V,onClose:Pe,footer:u(ce,{children:[l(a,{type:`button`,variant:`secondary`,disabled:V,onClick:Pe,children:`Cancel`}),l(a,{type:`button`,variant:`primary`,loading:V,disabled:U!==`ready`,onClick:Ne,children:`Apply`})]}),children:[U===`error`&&l(i,{variant:`danger`,children:pe}),G&&l(i,{variant:`danger`,children:G}),z&&U!==`error`&&l(`wui-image-crop`,{ref:Ee,src:z.url,aspect:k??`free`,round:k===1&&D===`circle`})]})]}),Ue=x&&!Y?l(`div`,{className:`set-uploader-hint`,id:De,children:x}):null,We=Y?l(te,{error:Y,errorId:Oe}):null,Q=be&&u(`label`,{className:`label`,htmlFor:M,children:[be,Se&&l(ne,{})]}),$=u(`div`,{className:`set-uploader-meta`,children:[C&&l(`div`,{className:`set-uploader-title`,children:C}),w&&l(`div`,{className:`set-uploader-subtitle`,children:w}),Ue,We]});return Ve?u(`div`,{...e(`AppLogoPicker`,f),className:`field set-uploader-field set-uploader-field--inline${O?` ${O}`:``}`,children:[Q,u(`div`,{className:`set-uploader-row`,children:[Z,$]})]}):He?u(`div`,{...e(`AppLogoPicker`,f),className:`field set-uploader-field set-uploader-field--profile${O?` ${O}`:``}`,children:[Q,Z,$]}):u(`div`,{...e(`AppLogoPicker`,f),className:`field set-uploader-field${O?` ${O}`:``}`,children:[Q,Z,Ue,We]})}export{f as default};
1
+ import{wuiMarkerAttributes 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 i from"./AppAlert.js";import a from"./AppButton.js";import te from"../lib/FieldMessage.js";import ne from"./AppRequiredMark.js";import re from"./AppModal.js";import{DEFAULT_MAX_SIZE_MB as ie,validateFile as o}from"@webority/ui-elements/helpers";import{useCallback as ae,useEffect as s,useId as oe,useRef as se,useState as c}from"react";import{Fragment as ce,jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/image-crop";var le=[`stacked`,`inline`,`profile`],ue=[`initials`,`avatar`],de=[`circle`,`rounded`,`square`],d={sm:72,md:120,lg:160},fe=`That image could not be cropped. Choose another one.`,pe=`That image could not be opened. Choose another one.`;function f(f){let{value:p,fallback:me,name:he,onPick:ge,onRemove:m,loading:h=!1,disabled:g=!1,accept:_=`image/png,image/jpeg,image/webp`,maxSizeMb:v=ie,crop:y,overlayIcon:_e=`image`,overlayLabel:b=`Update photo`,ariaLabel:ve=`Upload photo`,removeLabel:ye=`Remove photo`,label:be,hint:x,error:xe,layout:S=`stacked`,title:C,subtitle:w,required:Se=!1,variant:T=`initials`,size:E=`md`,shape:D=`circle`,className:O=``,"data-canvas":Ce,...we}=f;n(`AppLogoPicker`,we),t(`AppLogoPicker`,`layout`,S,le),t(`AppLogoPicker`,`variant`,T,ue),t(`AppLogoPicker`,`shape`,D,de),t(`AppLogoPicker`,`size`,typeof E==`string`?E:null,Object.keys(d));let k=y===`free`?null:typeof y==`number`&&Number.isFinite(y)&&y>0?y:void 0;y!=null&&k===void 0&&t(`AppLogoPicker`,`crop`,String(y),[`free`,`a positive number`]);let A=se(null),j=se(null),M=oe(),[N,P]=c(null),[Te,F]=c(``),[Ee,I]=c(!1),[L,R]=c(!1),[z,B]=c(null),[V,H]=c(!1),[U,W]=c(`loading`),[G,K]=c(``),De=ae(e=>{if(j.current=e,!e)return;let t=()=>W(`ready`),n=()=>W(`error`);return e.addEventListener(`load`,t),e.addEventListener(`error`,n),()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),j.current=null}},[]);s(()=>()=>z&&URL.revokeObjectURL(z.url),[z]),s(()=>()=>N&&URL.revokeObjectURL(N),[N]),s(()=>{P(null),I(!1)},[p]);let q=h||g,J=N||(p&&!Ee?p:null),Y=xe||Te,Oe=x&&!Y?`${M}-hint`:void 0,ke=Y?`${M}-error`:void 0,Ae=!q&&(!!N||!!J&&!!m),je=()=>{q||A.current?.click()},Me=e=>{F(``),I(!1),P(URL.createObjectURL(e)),ge(e)},Ne=e=>{let t=k!==void 0&&e.type!==`image/svg+xml`,n=o(e,{accept:_,maxSizeMb:t?0:v});if(n){F(n);return}if(t){F(``),W(`loading`),K(``),B({file:e,url:URL.createObjectURL(e)});return}Me(e)},Pe=async()=>{let{file:e}=z;H(!0),K(``);let t=null;try{t=await j.current?.toFile({name:e.name,type:e.type,maxBytes:v>0?v*1024*1024:0})}catch{t=null}if(H(!1),!t){K(fe);return}B(null);let n=o(t,{accept:_,maxSizeMb:v});n?F(n):Me(t)},Fe=()=>{V||B(null)},Ie=e=>{let t=e.target.files?.[0];e.target.value=``,t&&Ne(t)},Le=e=>{if(e.preventDefault(),R(!1),q)return;let t=e.dataTransfer.files?.[0];t&&Ne(t)},Re=()=>{P(null),F(``),I(!1),A.current&&(A.current.value=``),m?.()},X=typeof E==`number`?E:d[E]??d.md,ze=Math.max(14,Math.round(X*.18)),Be=Math.round(X*.5),Ve=[`set-uploader`,T===`avatar`?`set-uploader--avatar`:``,D===`rounded`?`set-uploader--rounded`:D===`square`?`set-uploader--square`:``,L&&`is-dragging`].filter(Boolean).join(` `),He=S===`inline`,Ue=S===`profile`,Z=u(`div`,{className:`set-uploader-shell`,style:{"--wui-logo-size":`${X}px`},children:[l(`button`,{type:`button`,className:Ve,onClick:je,disabled:q,"aria-busy":h||void 0,"aria-label":ve,"aria-describedby":ke||Oe,onDragOver:e=>{e.preventDefault(),!q&&!L&&R(!0)},onDragLeave:e=>{e.preventDefault(),R(!1)},onDrop:Le,...we,children:u(`span`,{className:`set-uploader-ring`,"data-overlay-label":b,children:[J?l(`img`,{className:`set-uploader-img`,src:J,alt:``,onError:()=>I(!0)}):l(`span`,{className:`set-uploader-logo`,children:me||T===`avatar`&&l(r,{name:`user`,size:Be})}),h?l(`span`,{className:`set-uploader-overlay is-loading`,"aria-hidden":`true`,children:l(r,{name:`refresh-cw`,size:ze,className:`wui-spin`})}):!g&&u(`span`,{className:`set-uploader-overlay`,children:[l(r,{name:_e,size:ze}),l(`span`,{children:b})]})]})}),ee(l(`button`,{type:`button`,className:`set-uploader-remove`,hidden:!Ae,"aria-label":ye,onClick:Re,children:l(r,{name:`x`,size:14})}),Ae?ye:null),l(`input`,{id:M,ref:A,type:`file`,name:he,hidden:!0,accept:_,onChange:Ie,disabled:q}),k!==void 0&&u(re,{open:!!z,title:`Crop photo`,subtitle:`Drag the frame and zoom to choose what to keep.`,size:`lg`,staticBackdrop:!0,dismissible:!V,onClose:Fe,footer:u(ce,{children:[l(a,{type:`button`,variant:`secondary`,disabled:V,onClick:Fe,children:`Cancel`}),l(a,{type:`button`,variant:`primary`,loading:V,disabled:U!==`ready`,onClick:Pe,children:`Apply`})]}),children:[U===`error`&&l(i,{variant:`danger`,children:pe}),G&&l(i,{variant:`danger`,children:G}),z&&U!==`error`&&l(`wui-image-crop`,{ref:De,src:z.url,aspect:k??`free`,round:k===1&&D===`circle`})]})]}),We=x&&!Y?l(`div`,{className:`set-uploader-hint`,id:Oe,children:x}):null,Ge=Y?l(te,{error:Y,errorId:ke}):null,Q=be&&u(`label`,{className:`label`,htmlFor:M,children:[be,Se&&l(ne,{})]}),$=u(`div`,{className:`set-uploader-meta`,children:[C&&l(`div`,{className:`set-uploader-title`,children:C}),w&&l(`div`,{className:`set-uploader-subtitle`,children:w}),We,Ge]});return He?u(`div`,{...e(`AppLogoPicker`,f),className:`field set-uploader-field set-uploader-field--inline${O?` ${O}`:``}`,children:[Q,u(`div`,{className:`set-uploader-row`,children:[Z,$]})]}):Ue?u(`div`,{...e(`AppLogoPicker`,f),className:`field set-uploader-field set-uploader-field--profile${O?` ${O}`:``}`,children:[Q,Z,$]}):u(`div`,{...e(`AppLogoPicker`,f),className:`field set-uploader-field${O?` ${O}`:``}`,children:[Q,Z,We,Ge]})}export{f as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{forwardRef as o,useEffect as s,useId as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/mention-input";var d=o(function(o,d){let{value:f,onChange:p,people:m,loadPeople:h,minChars:g,debounce:_,onSubmit:v,rows:y=3,placeholder:b,disabled:x=!1,name:S,id:C,label:w,error:T,hint:E,required:D=!1,help:O,helpLabel:k=`More information`,className:A=``,fieldClassName:j=``,...M}=o;t(`AppMentionInput`,M);let N=typeof h==`function`,P=c(),F=C||`mention-${P.replace(/[^a-zA-Z0-9_-]/g,``)}`,I=T?`${F}-error`:E?`${F}-hint`:void 0,{setRef:L,innerRef:R}=a({ref:d,value:f??``,on:{change:e=>{e.target===e.currentTarget&&p?.(e.currentTarget.value,{mentions:e.currentTarget.mentions})},"wui:mention-input:submit":()=>v?.()}});return s(()=>{let e=R.current;!e||N||(e.people=m||[])},[m,N,R]),s(()=>{let e=R.current;if(!e||!N)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await h(r.detail.query,{signal:n?.signal});i===t&&(e.people=a||[])}catch{i===t&&(e.people=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[N,h,R]),u(`div`,{...e(`AppMentionInput`,o),className:`field${j?` ${j}`:``}`,children:[w&&u(`label`,{className:`label`,htmlFor:`${F}-text`,children:[w,D&&l(i,{}),O&&l(r,{label:k,children:O})]}),l(`wui-mention-input`,{ref:L,id:F,class:A?`wui-mention-input ${A}`:`wui-mention-input`,label:typeof w==`string`?w:void 0,placeholder:b||void 0,rows:String(y),name:S||void 0,remote:N?``:void 0,"min-chars":g==null?void 0:String(g),debounce:_==null?void 0:String(_),disabled:x?``:void 0,"aria-describedby":I,"aria-invalid":T?`true`:void 0,...M}),l(n,{error:T,hint:E,errorId:`${F}-error`,hintId:`${F}-hint`})]})});export{d as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnUnknownProps.js";import n from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{forwardRef as o,useEffect as s,useId as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/mention-input";var d=o(function(o,d){let{value:f,onChange:p,people:m,loadPeople:h,minChars:g,debounce:_,onSubmit:v,rows:y=3,placeholder:b,disabled:x=!1,name:S,id:C,label:w,error:T,hint:E,required:D=!1,help:O,helpLabel:k=`More information`,className:A=``,fieldClassName:j=``,"data-canvas":M,...N}=o;t(`AppMentionInput`,N);let P=typeof h==`function`,F=c(),I=C||`mention-${F.replace(/[^a-zA-Z0-9_-]/g,``)}`,L=T?`${I}-error`:E?`${I}-hint`:void 0,{setRef:R,innerRef:z}=a({ref:d,value:f??``,on:{change:e=>{e.target===e.currentTarget&&p?.(e.currentTarget.value,{mentions:e.currentTarget.mentions})},"wui:mention-input:submit":()=>v?.()}});return s(()=>{let e=z.current;!e||P||(e.people=m||[])},[m,P,z]),s(()=>{let e=z.current;if(!e||!P)return;let t=0,n=null,r=async r=>{let i=++t;n?.abort(),n=typeof AbortController==`function`?new AbortController:null,e.loading=!0;try{let a=await h(r.detail.query,{signal:n?.signal});i===t&&(e.people=a||[])}catch{i===t&&(e.people=[])}finally{i===t&&(e.loading=!1)}};return e.addEventListener(`search`,r),()=>{t=-1,n?.abort(),e.removeEventListener(`search`,r),e.loading=!1}},[P,h,z]),u(`div`,{...e(`AppMentionInput`,o),className:`field${j?` ${j}`:``}`,children:[w&&u(`label`,{className:`label`,htmlFor:`${I}-text`,children:[w,D&&l(i,{}),O&&l(r,{label:k,children:O})]}),l(`wui-mention-input`,{ref:R,id:I,class:A?`wui-mention-input ${A}`:`wui-mention-input`,label:typeof w==`string`?w:void 0,placeholder:b||void 0,rows:String(y),name:S||void 0,remote:P?``:void 0,"min-chars":g==null?void 0:String(g),debounce:_==null?void 0:String(_),disabled:x?``:void 0,"aria-describedby":L,"aria-invalid":T?`true`:void 0,...N}),l(n,{error:T,hint:E,errorId:`${I}-error`,hintId:`${I}-hint`})]})});export{d as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{cloneElement as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";var o=[`high`,`low`],s=[`sm`,`md`],c=[`info`,`success`,`warning`,`danger`,`neutral`];function l(e,t,n){let r=n-t;if(!(r>0))return 0;let i=Math.min(100,Math.max(0,(e-t)/r*100));return Number(i.toFixed(2))}function u(e,t,n,r,i){if(t==null&&n==null)return i;let a=`mid`;return t!=null&&e<=t?a=`low`:n!=null&&e>=n&&(a=`high`),r===`low`?a===`low`?`success`:a===`high`?`danger`:`warning`:a===`high`?`success`:a===`low`?`danger`:`warning`}function d(d){let{value:f=0,min:p=0,max:m=100,tone:h=`info`,optimum:g=`high`,low:_,high:v,size:y=`md`,label:b,showLabel:x=!1,className:S=``,...C}=d;n(`AppMeter`,C),t(`AppMeter`,`tone`,h,c),t(`AppMeter`,`optimum`,g,o),t(`AppMeter`,`size`,y,s);let w=u(f,_,v,g,c.includes(h)?h:`info`),T=l(f,p,m),E=x&&!!b,D=i(`div`,{className:`progress${y===`sm`?` progress-sm`:``}${!E&&S?` ${S}`:``}`,role:`meter`,"aria-valuenow":f,"aria-valuemin":p,"aria-valuemax":m,"aria-label":b||void 0,...C,children:i(`div`,{className:`progress-bar wui-progress-${w}`,style:{width:`${T}%`}})});return E?a(`div`,{...e(`AppMeter`,d),className:`wui-progress-labelled${S?` ${S}`:``}`,children:[i(`div`,{className:`wui-progress-label`,"aria-hidden":`true`,children:b}),D]}):r(D,e(`AppMeter`,d))}export{d as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{cloneElement as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";var o=[`high`,`low`],s=[`sm`,`md`],c=[`info`,`success`,`warning`,`danger`,`neutral`];function l(e,t,n){let r=n-t;if(!(r>0))return 0;let i=Math.min(100,Math.max(0,(e-t)/r*100));return Number(i.toFixed(2))}function u(e,t,n,r,i){if(t==null&&n==null)return i;let a=`mid`;return t!=null&&e<=t?a=`low`:n!=null&&e>=n&&(a=`high`),r===`low`?a===`low`?`success`:a===`high`?`danger`:`warning`:a===`high`?`success`:a===`low`?`danger`:`warning`}function d(d){let{value:f=0,min:p=0,max:m=100,tone:h=`info`,optimum:g=`high`,low:_,high:v,size:y=`md`,label:b,showLabel:x=!1,className:S=``,"data-canvas":C,...w}=d;n(`AppMeter`,w),t(`AppMeter`,`tone`,h,c),t(`AppMeter`,`optimum`,g,o),t(`AppMeter`,`size`,y,s);let T=u(f,_,v,g,c.includes(h)?h:`info`),E=l(f,p,m),D=x&&!!b,O=i(`div`,{className:`progress${y===`sm`?` progress-sm`:``}${!D&&S?` ${S}`:``}`,role:`meter`,"aria-valuenow":f,"aria-valuemin":p,"aria-valuemax":m,"aria-label":b||void 0,...w,children:i(`div`,{className:`progress-bar wui-progress-${T}`,style:{width:`${E}%`}})});return D?a(`div`,{...e(`AppMeter`,d),className:`wui-progress-labelled${S?` ${S}`:``}`,children:[i(`div`,{className:`wui-progress-label`,"aria-hidden":`true`,children:b}),O]}):r(O,e(`AppMeter`,d))}export{d as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes 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"../lib/DiscardPrompt.js";import{useCallback as o,useEffect as s,useRef as c,useState as l}from"react";import{Modal as ee}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`default`,`danger`,`success`,`warning`],p=[`center`,`top`],m=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,h={sm:380,md:440,lg:640,xl:880},g=`wui-modal-fullscreen`,_=!1;function v(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||_||(_=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name — pass `ariaLabel` (or a string `title`)."))}function y(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(m));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function b(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function x(t){let{open:_,eyebrow:x,title:S,subtitle:C,headerIcon:w,tone:T=`default`,dismissible:te=!0,onClose:E,footer:D,size:O=`md`,placement:k=`center`,hideHeader:A=!1,staticBackdrop:j=!1,confirmDiscard:M,dirty:N=!1,ariaLabel:P,className:F=``,children:I,...L}=t;r(`AppModal`,L),n(`AppModal`,`tone`,T,f),n(`AppModal`,`placement`,k,p),n(`AppModal`,`size`,typeof O==`string`?O:null,[...Object.keys(h),`fullscreen`]);let{style:R,ref:z,"data-wui":B,"data-wui-props":V,...H}=L,U=B?{"data-wui":B,"data-wui-props":V}:e(`AppModal`,t),W=U[`data-wui`],G=U[`data-wui-props`];A&&!P&&typeof S!=`string`&&v();let K=c(null),q=c(null),[J,Y]=l(!1);s(()=>{_||Y(!1)},[_]),s(()=>{J&&q.current?.focus()},[J]),s(()=>{let e=K.current?.closest(`.modal`);e&&(M?e.setAttribute(`confirm-discard`,M):e.removeAttribute(`confirm-discard`))},[_,M]);let X=c(null),Z=o(e=>{X.current=e,typeof z==`function`?z(e):z&&(z.current=e)},[z]);s(()=>{let e=X.current?.dialog;e&&(e.setAttribute(`data-wui`,W),G===void 0?e.removeAttribute(`data-wui-props`):e.setAttribute(`data-wui-props`,G))},[_,W,G]),s(()=>{if(!_)return;let e=K.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(m));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`))||t()[0]||e).focus?.();let n=e.closest(`.modal`),r=b(),i=e=>y(e,n);return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[_]);let Q=()=>{if(M&&N){Y(!0);return}E?.()},ne=()=>{Y(!1),E?.()},re=()=>{Y(!1),(K.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},$=O===`fullscreen`,ie=typeof O==`number`?O:h[O]??h.md,ae=[`wui-modal`,T==="default"?``:`tone-${T}`,F].filter(Boolean).join(` `);return d(ee,{...H,ref:Z,show:_,onHide:Q,backdrop:!j||`static`,keyboard:!j,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:k!==`top`,className:$?`wui-modal-shell ${g}`:`wui-modal-shell`,style:$?R:{"--wui-modal-max-width":`${ie}px`,...R},dialogClassName:`wui-rb-dialog`,contentClassName:ae,backdropClassName:`wui-modal-dim`,"aria-label":P||(typeof S==`string`?S:void 0),children:[!A&&d(`div`,{className:`wui-modal-header`,children:[d(`div`,{className:`wui-modal-heading`,children:[w&&u(`span`,{className:`wui-modal-headicon`,children:u(i,{name:w,size:18})}),d(`div`,{className:`wui-modal-headtext`,children:[x&&u(`div`,{className:`wui-modal-eyebrow`,children:x}),u(`div`,{className:`wui-modal-title`,children:S}),C&&u(`div`,{className:`wui-modal-subtitle`,children:C})]})]}),te&&u(`button`,{type:`button`,className:`wui-modal-close`,onClick:Q,"aria-label":`Close`,children:u(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:u(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),u(`div`,{className:`wui-modal-body`,ref:K,children:I}),(D||J)&&d(`div`,{className:J?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[J&&u(a,{text:M,confirmRef:q,onDiscard:ne,onKeep:re}),D]})]})}export{x as default};
1
+ import{wuiMarkerAttributes 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"../lib/DiscardPrompt.js";import{useCallback as o,useEffect as s,useRef as c,useState as l}from"react";import{Modal as u}from"react-bootstrap";import{jsx as d,jsxs as f}from"react/jsx-runtime";var p=[`default`,`danger`,`success`,`warning`],m=[`center`,`top`],h=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,g={sm:380,md:440,lg:640,xl:880},ee=`wui-modal-fullscreen`,_=!1;function v(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||_||(_=!0,t("[@webority/ui-react] <AppModal hideHeader> has no accessible name — pass `ariaLabel` (or a string `title`)."))}function y(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(h));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function te(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function b(t){let{open:_,eyebrow:b,title:x,subtitle:S,headerIcon:C,tone:w=`default`,dismissible:T=!0,onClose:E,footer:D,size:O=`md`,placement:k=`center`,hideHeader:A=!1,staticBackdrop:j=!1,confirmDiscard:M,dirty:N=!1,ariaLabel:P,className:F=``,children:I,"data-canvas":ne,...L}=t;r(`AppModal`,L),n(`AppModal`,`tone`,w,p),n(`AppModal`,`placement`,k,m),n(`AppModal`,`size`,typeof O==`string`?O:null,[...Object.keys(g),`fullscreen`]);let{style:R,ref:z,"data-wui":B,"data-wui-props":V,...H}=L,U=B?{"data-wui":B,"data-wui-props":V}:e(`AppModal`,t),W=U[`data-wui`],G=U[`data-wui-props`];A&&!P&&typeof x!=`string`&&v();let K=c(null),q=c(null),[J,Y]=l(!1);s(()=>{_||Y(!1)},[_]),s(()=>{J&&q.current?.focus()},[J]),s(()=>{let e=K.current?.closest(`.modal`);e&&(M?e.setAttribute(`confirm-discard`,M):e.removeAttribute(`confirm-discard`))},[_,M]);let X=c(null),Z=o(e=>{X.current=e,typeof z==`function`?z(e):z&&(z.current=e)},[z]);s(()=>{let e=X.current?.dialog;e&&(e.setAttribute(`data-wui`,W),G===void 0?e.removeAttribute(`data-wui-props`):e.setAttribute(`data-wui-props`,G))},[_,W,G]),s(()=>{if(!_)return;let e=K.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(h));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`))||t()[0]||e).focus?.();let n=e.closest(`.modal`),r=te(),i=e=>y(e,n);return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[_]);let Q=()=>{if(M&&N){Y(!0);return}E?.()},re=()=>{Y(!1),E?.()},ie=()=>{Y(!1),(K.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},$=O===`fullscreen`,ae=typeof O==`number`?O:g[O]??g.md,oe=[`wui-modal`,w==="default"?``:`tone-${w}`,F].filter(Boolean).join(` `);return f(u,{...H,ref:Z,show:_,onHide:Q,backdrop:!j||`static`,keyboard:!j,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:k!==`top`,className:$?`wui-modal-shell ${ee}`:`wui-modal-shell`,style:$?R:{"--wui-modal-max-width":`${ae}px`,...R},dialogClassName:`wui-rb-dialog`,contentClassName:oe,backdropClassName:`wui-modal-dim`,"aria-label":P||(typeof x==`string`?x:void 0),children:[!A&&f(`div`,{className:`wui-modal-header`,children:[f(`div`,{className:`wui-modal-heading`,children:[C&&d(`span`,{className:`wui-modal-headicon`,children:d(i,{name:C,size:18})}),f(`div`,{className:`wui-modal-headtext`,children:[b&&d(`div`,{className:`wui-modal-eyebrow`,children:b}),d(`div`,{className:`wui-modal-title`,children:x}),S&&d(`div`,{className:`wui-modal-subtitle`,children:S})]})]}),T&&d(`button`,{type:`button`,className:`wui-modal-close`,onClick:Q,"aria-label":`Close`,children:d(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:d(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),d(`div`,{className:`wui-modal-body`,ref:K,children:I}),(D||J)&&f(`div`,{className:J?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[J&&d(a,{text:M,confirmRef:q,onDiscard:re,onKeep:ie}),D]})]})}export{b as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useNodeLabels.js";import s,{optionsEqual as c,readValues as l,writeValues as u}from"./useWuiControl.js";import{forwardRef as d,useEffect as f,useId as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import"@webority/ui-elements/elements/multiselect";var g=[`sm`,`lg`],_=[],v=(e,t)=>({...e,label:t}),y=d(function(d,y){let{values:b,onChange:x,options:S,placeholder:C=`Select…`,searchPlaceholder:w=`Search…`,searchable:T=!0,disabled:E=!1,icon:D,size:O,collapseChips:k=!1,allowCustom:A=!1,validateCustom:j,customPattern:M,customInvalidMessage:N,name:P,id:F,label:I,error:L,hint:R,required:z=!1,help:B,helpLabel:V=`More information`,fieldClassName:H=``,...U}=d;n(`AppMultiSelect`,U),t(`AppMultiSelect`,`size`,O,g);let W=p(),G=F||W,{setRef:K,innerRef:q}=s({ref:y,value:b,onChange:x,readValue:l,writeValue:u}),J=S||_,{portal:Y,toElementOptions:X}=o(J);return f(()=>{let e=q.current;if(!e)return;let t=X(J,v);c(t,e.options)||(e.options=t)},[J,q,X]),f(()=>{let e=q.current;e&&(e.validateCustom=j??null)},[j,q]),h(`div`,{...e(`AppMultiSelect`,d),className:`field${H?` ${H}`:``}`,children:[I&&h(`label`,{className:`label`,htmlFor:G,children:[I,z&&m(a,{}),B&&m(i,{label:V,children:B})]}),m(`wui-multiselect`,{"aria-label":typeof I==`string`?I:void 0,"aria-describedby":L?`${G}-error`:R?`${G}-hint`:void 0,"aria-invalid":L?`true`:void 0,id:G,ref:K,name:P,placeholder:C,"search-placeholder":w,icon:D||void 0,size:O||void 0,"collapse-chips":k?``:void 0,"allow-custom":A?``:void 0,"custom-pattern":M||void 0,"custom-invalid-message":N||void 0,searchable:T?``:void 0,disabled:E?``:void 0,required:z?``:void 0,...U}),Y,m(r,{error:L,hint:R,errorId:`${G}-error`,hintId:`${G}-hint`})]})});export{y as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./useNodeLabels.js";import s,{optionsEqual as c,readValues as l,writeValues as u}from"./useWuiControl.js";import{forwardRef as d,useEffect as f,useId as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import"@webority/ui-elements/elements/multiselect";var g=[`sm`,`lg`],_=[],v=(e,t)=>({...e,label:t}),y=d(function(d,y){let{values:b,onChange:x,options:S,placeholder:C=`Select…`,searchPlaceholder:w=`Search…`,searchable:T=!0,disabled:E=!1,icon:D,size:O,collapseChips:k=!1,allowCustom:A=!1,validateCustom:j,customPattern:M,customInvalidMessage:N,name:P,id:F,label:I,error:L,hint:R,required:z=!1,help:B,helpLabel:V=`More information`,fieldClassName:H=``,"data-canvas":U,...W}=d;n(`AppMultiSelect`,W),t(`AppMultiSelect`,`size`,O,g);let G=p(),K=F||G,{setRef:q,innerRef:J}=s({ref:y,value:b,onChange:x,readValue:l,writeValue:u}),Y=S||_,{portal:X,toElementOptions:Z}=o(Y);return f(()=>{let e=J.current;if(!e)return;let t=Z(Y,v);c(t,e.options)||(e.options=t)},[Y,J,Z]),f(()=>{let e=J.current;e&&(e.validateCustom=j??null)},[j,J]),h(`div`,{...e(`AppMultiSelect`,d),className:`field${H?` ${H}`:``}`,children:[I&&h(`label`,{className:`label`,htmlFor:K,children:[I,z&&m(a,{}),B&&m(i,{label:V,children:B})]}),m(`wui-multiselect`,{"aria-label":typeof I==`string`?I:void 0,"aria-describedby":L?`${K}-error`:R?`${K}-hint`:void 0,"aria-invalid":L?`true`:void 0,id:K,ref:q,name:P,placeholder:C,"search-placeholder":w,icon:D||void 0,size:O||void 0,"collapse-chips":k?``:void 0,"allow-custom":A?``:void 0,"custom-pattern":M||void 0,"custom-invalid-message":N||void 0,searchable:T?``:void 0,disabled:E?``:void 0,required:z?``:void 0,...W}),X,m(r,{error:L,hint:R,errorId:`${K}-error`,hintId:`${K}-hint`})]})});export{y as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/FieldMessage.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import{forwardRef as s,useEffect as c,useId as l,useState as u}from"react";import{Form as d}from"react-bootstrap";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`sm`,`md`,`lg`],h=e=>{if(e===``||e===null)return null;let t=parseFloat(e);return Number.isNaN(t)?null:t},g=(e,t)=>t>0&&Number.isFinite(e)?e.toFixed(t):String(e??``),_=s(function(s,_){let{label:v,required:y=!1,error:b,hint:x,help:S,helpLabel:C=`More information`,value:w,onChange:T,min:E,max:D,step:O=1,precision:k=0,unit:A,size:j=`md`,id:M,name:N,className:P=``,fieldClassName:F=``,disabled:I=!1,...L}=s;n(`AppNumberInput`,L),t(`AppNumberInput`,`size`,j,m);let R=l(),z=M||R,B=e=>{if(k===0)return Math.round(e);let t=10**k;return Math.round(e*t)/t},V=e=>{let t=e;return typeof E==`number`&&(t=Math.max(t,E)),typeof D==`number`&&(t=Math.min(t,D)),t},H=e=>g(e,k),[U,W]=u(()=>H(w));c(()=>{W(e=>h(e)===(w??``)?e:g(w,k))},[w,k]);let G=e=>{let t=(h(U)??V(0))+e*O,n=V(B(t));W(H(n)),T?.(n)},K=h(U),q=I||K!==null&&typeof E==`number`&&K<=E,J=I||K!==null&&typeof D==`number`&&K>=D,Y=b&&z?`${z}-error`:void 0,X=x&&z?`${z}-hint`:void 0,Z=Y||X,Q=[`input`,j===`sm`?`input-sm`:``,j===`lg`?`input-lg`:``,b?`error`:``,`num-input`,P].filter(Boolean).join(` `),$=RegExp(`^${typeof E==`number`&&E>=0?``:`-?`}\\d*${k>0?`(\\.\\d*)?`:``}$`),ee=e=>{let t=e.target.value;if(!$.test(t))return;W(t);let n=h(t);n!==null&&T?.(n)},te=e=>{let t=h(e.target.value);if(t===null)W(``),T?.(``);else{let e=V(B(t));W(H(e)),T?.(e)}L.onBlur?.(e)},ne=e=>{e.key===`ArrowUp`?(e.preventDefault(),G(1)):e.key===`ArrowDown`&&(e.preventDefault(),G(-1)),L.onKeyDown?.(e)},re=f(d.Control,{...L,id:z,name:N,type:`text`,inputMode:k>0?`decimal`:`numeric`,className:Q,disabled:I,required:y,"aria-invalid":b?`true`:`false`,"aria-describedby":Z,value:U,ref:_,onChange:ee,onBlur:te,onKeyDown:ne}),ie=p(`div`,{className:[`num-wrap`,j===`sm`?`num-wrap-sm`:``,j===`lg`?`num-wrap-lg`:``].filter(Boolean).join(` `),children:[f(`button`,{type:`button`,className:`num-btn`,"aria-label":`Decrease`,tabIndex:-1,disabled:q,onClick:()=>G(-1),children:f(r,{name:`minus`,size:16})}),re,A&&f(`span`,{className:`affix`,children:A}),f(`button`,{type:`button`,className:`num-btn`,"aria-label":`Increase`,tabIndex:-1,disabled:J,onClick:()=>G(1),children:f(r,{name:`plus`,size:16})})]});return p(d.Group,{...e(`AppNumberInput`,s),className:`field${F?` ${F}`:``}`,children:[v&&p(d.Label,{className:`label`,htmlFor:z,children:[v,y&&f(o,{}),S&&f(a,{label:C,children:S})]}),ie,f(i,{error:b,hint:x,errorId:Y,hintId:X})]})});export{_ as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/FieldMessage.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import{forwardRef as s,useEffect as c,useId as l,useState as u}from"react";import{Form as d}from"react-bootstrap";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`sm`,`md`,`lg`],h=e=>{if(e===``||e===null)return null;let t=parseFloat(e);return Number.isNaN(t)?null:t},g=(e,t)=>t>0&&Number.isFinite(e)?e.toFixed(t):String(e??``),_=s(function(s,_){let{label:v,required:y=!1,error:b,hint:x,help:S,helpLabel:C=`More information`,value:w,onChange:T,min:E,max:D,step:O=1,precision:k=0,unit:A,size:j=`md`,id:M,name:N,className:P=``,fieldClassName:F=``,disabled:I=!1,"data-canvas":ee,...L}=s;n(`AppNumberInput`,L),t(`AppNumberInput`,`size`,j,m);let R=l(),z=M||R,B=e=>{if(k===0)return Math.round(e);let t=10**k;return Math.round(e*t)/t},V=e=>{let t=e;return typeof E==`number`&&(t=Math.max(t,E)),typeof D==`number`&&(t=Math.min(t,D)),t},H=e=>g(e,k),[U,W]=u(()=>H(w));c(()=>{W(e=>h(e)===(w??``)?e:g(w,k))},[w,k]);let G=e=>{let t=(h(U)??V(0))+e*O,n=V(B(t));W(H(n)),T?.(n)},K=h(U),q=I||K!==null&&typeof E==`number`&&K<=E,J=I||K!==null&&typeof D==`number`&&K>=D,Y=b&&z?`${z}-error`:void 0,X=x&&z?`${z}-hint`:void 0,Z=Y||X,Q=[`input`,j===`sm`?`input-sm`:``,j===`lg`?`input-lg`:``,b?`error`:``,`num-input`,P].filter(Boolean).join(` `),$=RegExp(`^${typeof E==`number`&&E>=0?``:`-?`}\\d*${k>0?`(\\.\\d*)?`:``}$`),te=e=>{let t=e.target.value;if(!$.test(t))return;W(t);let n=h(t);n!==null&&T?.(n)},ne=e=>{let t=h(e.target.value);if(t===null)W(``),T?.(``);else{let e=V(B(t));W(H(e)),T?.(e)}L.onBlur?.(e)},re=e=>{e.key===`ArrowUp`?(e.preventDefault(),G(1)):e.key===`ArrowDown`&&(e.preventDefault(),G(-1)),L.onKeyDown?.(e)},ie=f(d.Control,{...L,id:z,name:N,type:`text`,inputMode:k>0?`decimal`:`numeric`,className:Q,disabled:I,required:y,"aria-invalid":b?`true`:`false`,"aria-describedby":Z,value:U,ref:_,onChange:te,onBlur:ne,onKeyDown:re}),ae=p(`div`,{className:[`num-wrap`,j===`sm`?`num-wrap-sm`:``,j===`lg`?`num-wrap-lg`:``].filter(Boolean).join(` `),children:[f(`button`,{type:`button`,className:`num-btn`,"aria-label":`Decrease`,tabIndex:-1,disabled:q,onClick:()=>G(-1),children:f(r,{name:`minus`,size:16})}),ie,A&&f(`span`,{className:`affix`,children:A}),f(`button`,{type:`button`,className:`num-btn`,"aria-label":`Increase`,tabIndex:-1,disabled:J,onClick:()=>G(1),children:f(r,{name:`plus`,size:16})})]});return p(d.Group,{...e(`AppNumberInput`,s),className:`field${F?` ${F}`:``}`,children:[v&&p(d.Label,{className:`label`,htmlFor:z,children:[v,y&&f(o,{}),S&&f(a,{label:C,children:S})]}),ae,f(i,{error:b,hint:x,errorId:Y,hintId:X})]})});export{_ as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{cloneElement as o,forwardRef as s,useId as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/otp";var d=[`numeric`,`alphanumeric`],f=s(function(s,f){let{value:p,onChange:m,onComplete:h,length:g=6,mode:_=`numeric`,label:v,required:y=!1,hint:b,error:x,disabled:S=!1,name:C,id:w,className:T=``,fieldClassName:E=``,...D}=s;n(`AppOtpInput`,D),t(`AppOtpInput`,`mode`,_,d);let O=c(),k=w||O,A=x?`${k}-error`:void 0,j=b?`${k}-hint`:void 0,M=A||j,{setRef:N}=a({ref:f,value:p??``,onChange:m,on:{complete:e=>h?.(e.detail)}}),P=l(`wui-otp`,{"aria-label":typeof v==`string`?v:void 0,ref:N,id:k,name:C,length:String(g),mode:_,"aria-describedby":M,"aria-invalid":x?`true`:void 0,disabled:S?``:void 0,required:y?``:void 0,className:T||void 0,...D});return!v&&!x&&!b?o(P,e(`AppOtpInput`,s)):u(`div`,{...e(`AppOtpInput`,s),className:`field${E?` ${E}`:``}`,children:[v&&u(`label`,{className:`label`,htmlFor:k,children:[v,y&&l(i,{})]}),P,l(r,{error:x,hint:b,errorId:A,hintId:j})]})});export{f as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{cloneElement as o,forwardRef as s,useId as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import"@webority/ui-elements/elements/otp";var d=[`numeric`,`alphanumeric`],f=s(function(s,f){let{value:p,onChange:m,onComplete:h,length:g=6,mode:_=`numeric`,label:v,required:y=!1,hint:b,error:x,disabled:S=!1,name:C,id:w,className:T=``,fieldClassName:E=``,"data-canvas":D,...O}=s;n(`AppOtpInput`,O),t(`AppOtpInput`,`mode`,_,d);let k=c(),A=w||k,j=x?`${A}-error`:void 0,M=b?`${A}-hint`:void 0,N=j||M,{setRef:P}=a({ref:f,value:p??``,onChange:m,on:{complete:e=>h?.(e.detail)}}),F=l(`wui-otp`,{"aria-label":typeof v==`string`?v:void 0,ref:P,id:A,name:C,length:String(g),mode:_,"aria-describedby":N,"aria-invalid":x?`true`:void 0,disabled:S?``:void 0,required:y?``:void 0,className:T||void 0,...O});return!v&&!x&&!b?o(F,e(`AppOtpInput`,s)):u(`div`,{...e(`AppOtpInput`,s),className:`field${E?` ${E}`:``}`,children:[v&&u(`label`,{className:`label`,htmlFor:A,children:[v,y&&l(i,{})]}),F,l(r,{error:x,hint:b,errorId:j,hintId:M})]})});export{f as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{forwardRef as o,useId as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/phone";var u=[`sm`,`md`,`lg`],d=o(function(o,d){let{value:f,onChange:p,country:m,disabled:h=!1,name:g,id:_,label:v=`Phone number`,placeholder:y,required:b=!1,hint:x,error:S,showFlag:C=!0,showDialCode:w=!0,size:T=`md`,fieldClassName:E=``,...D}=o;n(`AppPhoneNumberInput`,D),t(`AppPhoneNumberInput`,`size`,T,u);let O=s(),k=_||O,A=S&&k?`${k}-error`:void 0,j=!S&&x&&k?`${k}-hint`:void 0,{setRef:M}=a({ref:d,value:f??``,onChange:p,events:[`input`,`change`]});return l(`div`,{...e(`AppPhoneNumberInput`,o),className:`field app-phone-number-input${T===`sm`?` phone-sm`:``}${T===`lg`?` phone-lg`:``}${E?` ${E}`:``}`,children:[v&&l(`label`,{className:`label`,htmlFor:k,children:[v,b&&c(i,{})]}),c(`wui-phone`,{ref:M,id:k,name:g,"aria-label":typeof v==`string`?v:void 0,"aria-describedby":A||j,"aria-invalid":S?`true`:void 0,country:m,placeholder:y,required:b?``:void 0,disabled:h?``:void 0,"hide-flag":C?void 0:``,"hide-dial":w?void 0:``,"external-error":``,...D}),c(r,{error:S,hint:x,errorId:A,hintId:j})]})});export{d as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppRequiredMark.js";import a from"./useWuiControl.js";import{forwardRef as o,useId as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/phone";var u=[`sm`,`md`,`lg`],d=o(function(o,d){let{value:f,onChange:p,country:m,disabled:h=!1,name:g,id:_,label:v=`Phone number`,placeholder:y,required:b=!1,hint:x,error:S,showFlag:C=!0,showDialCode:w=!0,size:T=`md`,fieldClassName:E=``,"data-canvas":D,...O}=o;n(`AppPhoneNumberInput`,O),t(`AppPhoneNumberInput`,`size`,T,u);let k=s(),A=_||k,j=S&&A?`${A}-error`:void 0,M=!S&&x&&A?`${A}-hint`:void 0,{setRef:N}=a({ref:d,value:f??``,onChange:p,events:[`input`,`change`]});return l(`div`,{...e(`AppPhoneNumberInput`,o),className:`field app-phone-number-input${T===`sm`?` phone-sm`:``}${T===`lg`?` phone-lg`:``}${E?` ${E}`:``}`,children:[v&&l(`label`,{className:`label`,htmlFor:A,children:[v,b&&c(i,{})]}),c(`wui-phone`,{ref:N,id:A,name:g,"aria-label":typeof v==`string`?v:void 0,"aria-describedby":j||M,"aria-invalid":S?`true`:void 0,country:m,placeholder:y,required:b?``:void 0,disabled:h?``:void 0,"hide-flag":C?void 0:``,"hide-dial":w?void 0:``,"external-error":``,...O}),c(r,{error:S,hint:x,errorId:j,hintId:M})]})});export{d as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{cloneElement as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";var o=[`sm`,`md`],s=[`info`,`success`,`warning`,`danger`,`neutral`];function c(e,t){if(!(t>0))return 0;let n=Math.min(100,Math.max(0,e/t*100));return Number(n.toFixed(2))}function l(l){let{value:u=0,max:d=100,tone:f=`info`,size:p=`md`,label:m,showLabel:h=!1,striped:g=!1,animated:_=!1,indeterminate:v=!1,className:y=``,...b}=l;n(`AppProgress`,b),t(`AppProgress`,`tone`,f,s),t(`AppProgress`,`size`,p,o);let x=s.includes(f)?f:`info`,S=c(u,d),C=!v&&h&&!!m,w=`progress${p===`sm`?` progress-sm`:``}${!C&&y?` ${y}`:``}`,T=[`progress-bar`,`wui-progress-${x}`,g||_?`progress-bar-striped`:``,_?`progress-bar-animated`:``,v?`wui-progress-indeterminate`:``].filter(Boolean).join(` `),E=i(`div`,{className:w,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":d,...v?{}:{"aria-valuenow":u},"aria-label":m||void 0,...b,children:i(`div`,{className:T,style:v?void 0:{width:`${S}%`}})});return C?a(`div`,{...e(`AppProgress`,l),className:`wui-progress-labelled${y?` ${y}`:``}`,children:[i(`div`,{className:`wui-progress-label`,"aria-hidden":`true`,children:m}),E]}):r(E,e(`AppProgress`,l))}export{l as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import{cloneElement as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";var o=[`sm`,`md`],s=[`info`,`success`,`warning`,`danger`,`neutral`];function c(e,t){if(!(t>0))return 0;let n=Math.min(100,Math.max(0,e/t*100));return Number(n.toFixed(2))}function l(l){let{value:u=0,max:d=100,tone:f=`info`,size:p=`md`,label:m,showLabel:h=!1,striped:g=!1,animated:_=!1,indeterminate:v=!1,className:y=``,"data-canvas":b,...x}=l;n(`AppProgress`,x),t(`AppProgress`,`tone`,f,s),t(`AppProgress`,`size`,p,o);let S=s.includes(f)?f:`info`,C=c(u,d),w=!v&&h&&!!m,T=`progress${p===`sm`?` progress-sm`:``}${!w&&y?` ${y}`:``}`,E=[`progress-bar`,`wui-progress-${S}`,g||_?`progress-bar-striped`:``,_?`progress-bar-animated`:``,v?`wui-progress-indeterminate`:``].filter(Boolean).join(` `),D=i(`div`,{className:T,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":d,...v?{}:{"aria-valuenow":u},"aria-label":m||void 0,...x,children:i(`div`,{className:E,style:v?void 0:{width:`${C}%`}})});return w?a(`div`,{...e(`AppProgress`,l),className:`wui-progress-labelled${y?` ${y}`:``}`,children:[i(`div`,{className:`wui-progress-label`,"aria-hidden":`true`,children:m}),D]}):r(D,e(`AppProgress`,l))}export{l as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import{useId as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`default`,`card`];function u(u){let{label:d,options:f=[],name:p,value:m,defaultValue:h,onChange:g,variant:_=`default`,inline:v=!1,required:y=!1,disabled:b=!1,error:x,hint:S,help:C,helpLabel:w=`More information`,id:T,className:E=``,fieldClassName:D=``,style:O,...k}=u;n(`AppRadioGroup`,k),t(`AppRadioGroup`,`variant`,_,l);let A=o(),j=T||A,M=p||j,N=`${j}-error`,P=`${j}-hint`,F=m!==void 0;return c(`div`,{...e(`AppRadioGroup`,u),className:`field${D?` ${D}`:``}`,children:[d!=null&&c(`span`,{className:`label`,id:`${j}-label`,children:[d,y&&s(a,{}),C&&s(i,{label:w,children:C})]}),s(`div`,{className:[`wui-radio-group`,_===`card`?`wui-radio-group-card`:``,v?`wui-radio-group-inline`:``,E].filter(Boolean).join(` `),style:O,id:j,role:`radiogroup`,"aria-labelledby":d==null?void 0:`${j}-label`,"aria-required":y?`true`:void 0,"aria-invalid":x?`true`:void 0,"aria-describedby":x?N:S?P:void 0,...k,children:f.map((e,t)=>{let n=`${j}-${t}`,r=e.description==null?void 0:`${n}-desc`;return c(`div`,{className:`form-check`,children:[s(`input`,{type:`radio`,className:`form-check-input`,id:n,name:M,value:e.value,disabled:b||e.disabled||void 0,required:y||void 0,"aria-describedby":r,...F?{checked:m===e.value,onChange:()=>g?.(e.value)}:{defaultChecked:h===e.value,onChange:()=>g?.(e.value)}}),s(`label`,{className:`form-check-label`,htmlFor:n,children:e.label}),r&&s(`div`,{className:`wui-radio-option-desc`,id:r,children:e.description})]},e.value)})}),s(r,{error:x,hint:S,errorId:N,hintId:P})]})}export{u as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"../lib/FieldMessage.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import{useId as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`default`,`card`];function u(u){let{label:d,options:f=[],name:p,value:m,defaultValue:h,onChange:g,variant:_=`default`,inline:v=!1,required:y=!1,disabled:b=!1,error:x,hint:S,help:C,helpLabel:w=`More information`,id:T,className:E=``,fieldClassName:D=``,style:O,"data-canvas":k,...A}=u;n(`AppRadioGroup`,A),t(`AppRadioGroup`,`variant`,_,l);let j=o(),M=T||j,N=p||M,P=`${M}-error`,F=`${M}-hint`,I=m!==void 0;return c(`div`,{...e(`AppRadioGroup`,u),className:`field${D?` ${D}`:``}`,children:[d!=null&&c(`span`,{className:`label`,id:`${M}-label`,children:[d,y&&s(a,{}),C&&s(i,{label:w,children:C})]}),s(`div`,{className:[`wui-radio-group`,_===`card`?`wui-radio-group-card`:``,v?`wui-radio-group-inline`:``,E].filter(Boolean).join(` `),style:O,id:M,role:`radiogroup`,"aria-labelledby":d==null?void 0:`${M}-label`,"aria-required":y?`true`:void 0,"aria-invalid":x?`true`:void 0,"aria-describedby":x?P:S?F:void 0,...A,children:f.map((e,t)=>{let n=`${M}-${t}`,r=e.description==null?void 0:`${n}-desc`;return c(`div`,{className:`form-check`,children:[s(`input`,{type:`radio`,className:`form-check-input`,id:n,name:N,value:e.value,disabled:b||e.disabled||void 0,required:y||void 0,"aria-describedby":r,...I?{checked:m===e.value,onChange:()=>g?.(e.value)}:{defaultChecked:h===e.value,onChange:()=>g?.(e.value)}}),s(`label`,{className:`form-check-label`,htmlFor:n,children:e.label}),r&&s(`div`,{className:`wui-radio-option-desc`,id:r,children:e.description})]},e.value)})}),s(r,{error:x,hint:S,errorId:P,hintId:F})]})}export{u as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/FieldMessage.js";import a from"./AppRequiredMark.js";import{useId as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/rating";var u={sm:16,md:20,lg:28},d=e=>String(Math.round(e*100)/100),f=(e,t,n)=>e>=t?`full`:n&&e>=t-.5?`half`:`empty`;function p(r){let{value:p,defaultValue:h,onChange:g,max:_=5,readOnly:v=!1,half:y=!1,showValue:b=!1,size:x=`md`,label:S,name:C,required:w=!1,disabled:T=!1,error:E,hint:D,id:O,className:k=``,fieldClassName:A=``,...j}=r;n(`AppRating`,j),t(`AppRating`,`size`,x,Object.keys(u));let M=o(),[N,P]=s(h),F=u[x]??u.md,I=Array.from({length:_},(e,t)=>t+1),L=(...e)=>[`wui-rating`,`wui-rating-${x}`,...e,k].filter(Boolean).join(` `);if(v){let t=Number.isFinite(Number(p))?Math.min(Math.max(Number(p),0),_):0,n=y?Math.round(t*2)/2:Math.round(t),i=`${typeof S==`string`&&S?`${S}: `:``}${d(t)} out of ${_}`;return l(`span`,{className:L(`wui-rating-display`),id:O,role:`img`,"aria-label":i,...e(`AppRating`,r),...j,children:[c(`span`,{className:`wui-rating-stars`,"aria-hidden":`true`,children:I.map(e=>c(`span`,{className:`wui-rating-star wui-rating-star-${f(n,e,y)}`,children:c(m,{px:F})},e))}),b&&c(`span`,{className:`wui-rating-value`,"aria-hidden":`true`,children:d(t)})]})}let R=O||M,z=C||R,B=`${R}-error`,V=`${R}-hint`,H=Math.round(Number(p===void 0?N:p))||0,U=e=>{P(e),g?.(e)};return l(`div`,{...e(`AppRating`,r),className:`field${A?` ${A}`:``}`,children:[S!=null&&l(`span`,{className:`label`,id:`${R}-label`,children:[S,w&&c(a,{})]}),c(`wui-rating`,{class:L(`wui-rating-input`),id:R,role:`radiogroup`,"aria-labelledby":S==null?void 0:`${R}-label`,"aria-label":S==null?`Rating`:void 0,"aria-required":w?`true`:void 0,"aria-invalid":E?`true`:void 0,"aria-describedby":E?B:D?V:void 0,disabled:T?``:void 0,...j,children:I.map(e=>l(`label`,{className:`wui-rating-star wui-rating-star-${H>=e?`full`:`empty`}`,"data-value":e,children:[c(`input`,{type:`radio`,className:`visually-hidden`,name:z,value:e,"aria-label":`${e} ${e===1?`star`:`stars`}`,checked:H===e,onChange:()=>U(e),disabled:T||void 0,required:w||void 0}),c(m,{px:F})]},e))}),c(i,{error:E,hint:D,errorId:B,hintId:V})]})}function m({px:e}){return l(`span`,{className:`wui-rating-glyphs`,"aria-hidden":`true`,children:[c(r,{name:`star`,size:e}),c(`span`,{className:`wui-rating-fill`,children:c(r,{name:`star`,variant:`bold`,size:e})})]})}export{p as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"../lib/FieldMessage.js";import a from"./AppRequiredMark.js";import{useId as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import"@webority/ui-elements/elements/rating";var u={sm:16,md:20,lg:28},d=e=>String(Math.round(e*100)/100),f=(e,t,n)=>e>=t?`full`:n&&e>=t-.5?`half`:`empty`;function p(r){let{value:p,defaultValue:h,onChange:g,max:_=5,readOnly:v=!1,half:y=!1,showValue:b=!1,size:x=`md`,label:S,name:C,required:w=!1,disabled:T=!1,error:E,hint:D,id:O,className:k=``,fieldClassName:A=``,"data-canvas":j,...M}=r;n(`AppRating`,M),t(`AppRating`,`size`,x,Object.keys(u));let N=o(),[P,F]=s(h),I=u[x]??u.md,L=Array.from({length:_},(e,t)=>t+1),R=(...e)=>[`wui-rating`,`wui-rating-${x}`,...e,k].filter(Boolean).join(` `);if(v){let t=Number.isFinite(Number(p))?Math.min(Math.max(Number(p),0),_):0,n=y?Math.round(t*2)/2:Math.round(t),i=`${typeof S==`string`&&S?`${S}: `:``}${d(t)} out of ${_}`;return l(`span`,{className:R(`wui-rating-display`),id:O,role:`img`,"aria-label":i,...e(`AppRating`,r),...M,children:[c(`span`,{className:`wui-rating-stars`,"aria-hidden":`true`,children:L.map(e=>c(`span`,{className:`wui-rating-star wui-rating-star-${f(n,e,y)}`,children:c(m,{px:I})},e))}),b&&c(`span`,{className:`wui-rating-value`,"aria-hidden":`true`,children:d(t)})]})}let z=O||N,B=C||z,V=`${z}-error`,H=`${z}-hint`,U=Math.round(Number(p===void 0?P:p))||0,W=e=>{F(e),g?.(e)};return l(`div`,{...e(`AppRating`,r),className:`field${A?` ${A}`:``}`,children:[S!=null&&l(`span`,{className:`label`,id:`${z}-label`,children:[S,w&&c(a,{})]}),c(`wui-rating`,{class:R(`wui-rating-input`),id:z,role:`radiogroup`,"aria-labelledby":S==null?void 0:`${z}-label`,"aria-label":S==null?`Rating`:void 0,"aria-required":w?`true`:void 0,"aria-invalid":E?`true`:void 0,"aria-describedby":E?V:D?H:void 0,disabled:T?``:void 0,...M,children:L.map(e=>l(`label`,{className:`wui-rating-star wui-rating-star-${U>=e?`full`:`empty`}`,"data-value":e,children:[c(`input`,{type:`radio`,className:`visually-hidden`,name:B,value:e,"aria-label":`${e} ${e===1?`star`:`stars`}`,checked:U===e,onChange:()=>W(e),disabled:T||void 0,required:w||void 0}),c(m,{px:I})]},e))}),c(i,{error:E,hint:D,errorId:V,hintId:H})]})}function m({px:e}){return l(`span`,{className:`wui-rating-glyphs`,"aria-hidden":`true`,children:[c(r,{name:`star`,size:e}),c(`span`,{className:`wui-rating-fill`,children:c(r,{name:`star`,variant:`bold`,size:e})})]})}export{p as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes 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"../lib/FieldMessage.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./useWuiControl.js";import{forwardRef as c,useEffect as l,useId as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`html`,`markdown`],h=[`input`,`change`],g=`The editor couldn't load. Reload the page and try again.`,_=c(function(c,_){let{value:v,onChange:y,format:b,placeholder:x,name:S,label:C,error:w,hint:T,required:E=!1,disabled:D=!1,readOnly:O=!1,id:k,ariaLabel:A,className:j=``,fieldClassName:M=``,help:N,helpLabel:P=`More information`,...F}=c;r(`AppRichText`,F),n(`AppRichText`,`format`,b,m);let I=u(),L=k||I,[R,z]=d(!1),{setRef:B}=s({ref:_,value:v,onChange:y,events:h});return l(()=>{let e=!0;return import(`@webority/ui-elements/rich-text`).catch(n=>{t(`[AppRichText] the editor failed to load:`,n?.message),e&&z(!0)}),()=>{e=!1}},[]),p(`div`,{...e(`AppRichText`,c),className:`field${M?` ${M}`:``}`,children:[C&&p(`label`,{className:`label`,htmlFor:L,children:[C,E&&f(o,{}),N&&f(a,{label:P,children:N})]}),R?f(`div`,{className:`field-error`,role:`status`,children:g}):f(`wui-rich-text`,{ref:B,id:L,role:`group`,name:S,format:b||void 0,placeholder:x,"aria-label":A||(typeof C==`string`?C:void 0),"aria-describedby":w?`${L}-error`:T?`${L}-hint`:void 0,"aria-invalid":w?`true`:void 0,required:E?``:void 0,disabled:D?``:void 0,readonly:O?``:void 0,className:j||void 0,...F},b||`html`),f(i,{error:w,hint:T,errorId:`${L}-error`,hintId:`${L}-hint`})]})});export{_ as default};
1
+ import{wuiMarkerAttributes 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"../lib/FieldMessage.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./useWuiControl.js";import{forwardRef as c,useEffect as l,useId as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";var m=[`html`,`markdown`],h=[`input`,`change`],g=`The editor couldn't load. Reload the page and try again.`,_=c(function(c,_){let{value:v,onChange:y,format:b,placeholder:x,name:S,label:C,error:w,hint:T,required:E=!1,disabled:D=!1,readOnly:O=!1,id:k,ariaLabel:A,className:j=``,fieldClassName:M=``,help:N,helpLabel:P=`More information`,"data-canvas":F,...I}=c;r(`AppRichText`,I),n(`AppRichText`,`format`,b,m);let L=u(),R=k||L,[z,B]=d(!1),{setRef:V}=s({ref:_,value:v,onChange:y,events:h});return l(()=>{let e=!0;return import(`@webority/ui-elements/rich-text`).catch(n=>{t(`[AppRichText] the editor failed to load:`,n?.message),e&&B(!0)}),()=>{e=!1}},[]),p(`div`,{...e(`AppRichText`,c),className:`field${M?` ${M}`:``}`,children:[C&&p(`label`,{className:`label`,htmlFor:R,children:[C,E&&f(o,{}),N&&f(a,{label:P,children:N})]}),z?f(`div`,{className:`field-error`,role:`status`,children:g}):f(`wui-rich-text`,{ref:V,id:R,role:`group`,name:S,format:b||void 0,placeholder:x,"aria-label":A||(typeof C==`string`?C:void 0),"aria-describedby":w?`${R}-error`:T?`${R}-hint`:void 0,"aria-invalid":w?`true`:void 0,required:E?``:void 0,disabled:D?``:void 0,readonly:O?``:void 0,className:j||void 0,...I},b||`html`),f(i,{error:w,hint:T,errorId:`${R}-error`,hintId:`${R}-hint`})]})});export{_ as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{isTypingTarget as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{Form as l}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`sm`,`lg`];function p(p){let{value:m,onChange:h,placeholder:g=`Search…`,ariaLabel:_,iconSize:v,size:y,loading:b=!1,collapsible:x=!1,disabled:S=!1,className:C=``,form:w,onKeyDown:T,...E}=p;n(`AppSearch`,E),t(`AppSearch`,`size`,y,f);let D=v??18,[O,k]=c(!!m),A=s(null),j=s(null),M=!x||O||!!m,N=a(()=>{k(!0),requestAnimationFrame(()=>A.current?.focus())},[]);o(()=>{if(!x)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||i(e.target)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===j.current&&(e.preventDefault(),N())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[x,N]);let P=[`search-wrap`,m?`has-value`:``,y===`sm`?`search-sm`:y===`lg`?`search-lg`:``,b?`is-loading`:``,x?`wui-search-collapsible`:``,x&&!M?`is-collapsed`:``,C].filter(Boolean).join(` `);return d(`div`,{...e(`AppSearch`,p),className:P,style:v==null?void 0:{"--wui-search-icon-size":`${v}px`},ref:j,onBlur:e=>{x&&!e.currentTarget.contains(e.relatedTarget)&&!m&&k(!1)},children:[x&&u(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":_||g,"aria-expanded":M?`true`:`false`,onClick:N,children:u(r,{name:`search`,size:D})}),b&&u(`span`,{className:`search-spinner`,"aria-hidden":`true`}),u(r,{name:`search`,size:D,className:`search-icon`}),u(l.Control,{ref:A,type:`search`,className:`input search-input`,placeholder:g,value:m,onChange:e=>h?.(e.target.value),onKeyDown:e=>{T?.(e),x&&e.key===`Escape`&&!m&&k(!1)},"aria-label":_,form:w,disabled:S,...E}),!S&&u(`button`,{type:`button`,className:`search-clear`,"aria-label":`Clear search`,onClick:()=>h?.(``),hidden:!m,children:u(r,{name:`x`,size:16})})]})}export{p as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import{isTypingTarget as i}from"@webority/ui-elements/helpers";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{Form as l}from"react-bootstrap";import{jsx as u,jsxs as d}from"react/jsx-runtime";var f=[`sm`,`lg`];function p(p){let{value:m,onChange:h,placeholder:g=`Search…`,ariaLabel:_,iconSize:v,size:y,loading:b=!1,collapsible:x=!1,disabled:S=!1,className:C=``,form:w,onKeyDown:T,"data-canvas":E,...D}=p;n(`AppSearch`,D),t(`AppSearch`,`size`,y,f);let O=v??18,[k,A]=c(!!m),j=s(null),M=s(null),N=!x||k||!!m,P=a(()=>{A(!0),requestAnimationFrame(()=>j.current?.focus())},[]);o(()=>{if(!x)return;let e=e=>{e.key!==`/`||e.ctrlKey||e.altKey||e.metaKey||i(e.target)||[...document.querySelectorAll(`.search-wrap.wui-search-collapsible`)].find(e=>e.offsetParent!==null)===M.current&&(e.preventDefault(),P())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[x,P]);let F=[`search-wrap`,m?`has-value`:``,y===`sm`?`search-sm`:y===`lg`?`search-lg`:``,b?`is-loading`:``,x?`wui-search-collapsible`:``,x&&!N?`is-collapsed`:``,C].filter(Boolean).join(` `);return d(`div`,{...e(`AppSearch`,p),className:F,style:v==null?void 0:{"--wui-search-icon-size":`${v}px`},ref:M,onBlur:e=>{x&&!e.currentTarget.contains(e.relatedTarget)&&!m&&A(!1)},children:[x&&u(`button`,{type:`button`,className:`wui-search-toggle`,"aria-label":_||g,"aria-expanded":N?`true`:`false`,onClick:P,children:u(r,{name:`search`,size:O})}),b&&u(`span`,{className:`search-spinner`,"aria-hidden":`true`}),u(r,{name:`search`,size:O,className:`search-icon`}),u(l.Control,{ref:j,type:`search`,className:`input search-input`,placeholder:g,value:m,onChange:e=>h?.(e.target.value),onKeyDown:e=>{T?.(e),x&&e.key===`Escape`&&!m&&A(!1)},"aria-label":_,form:w,disabled:S,...D}),!S&&u(`button`,{type:`button`,className:`search-clear`,"aria-label":`Clear search`,onClick:()=>h?.(``),hidden:!m,children:u(r,{name:`x`,size:16})})]})}export{p as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./warnDeprecatedValue.js";import{useEffect as a,useId as o,useLayoutEffect as s,useRef as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d={sm:`segmented-sm`,md:``,lg:`segmented-lg`},f={xl:{use:`lg`,removeIn:`0.83.0`}};function p(p){let{options:m=[],value:h,onChange:g,label:_,name:v,size:y=`md`,fullWidth:b=!1,bordered:x=!0,disabled:S=!1,labelVisible:C=!1,className:w=``,...T}=p;n(`AppSegmented`,T),i(`AppSegmented`,`size`,y,f);let E=f[y]?.use??y;t(`AppSegmented`,`size`,E,Object.keys(d));let D=o(),O=v||D,k=c(null),A=c(null),j=[`segmented`,d[E]??``,b?`segmented-full`:``,x?``:`wui-segmented-borderless`,S?`is-disabled`:``,w].filter(Boolean).join(` `);s(()=>{let e=k.current,t=A.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`.segmented-option:has(.segmented-input:checked)`);if(!r||!e.offsetWidth){t.style.opacity=`0`;return}n||e.classList.remove(`is-animated`),t.style.width=`${r.offsetWidth}px`,t.style.transform=`translateX(${r.offsetLeft}px)`,t.style.opacity=`1`,n||requestAnimationFrame(()=>k.current?.classList.add(`is-animated`))};n(!0);let r=typeof ResizeObserver<`u`?new ResizeObserver(()=>n(!1)):null;return r?.observe(e),()=>r?.disconnect()},[h,m,y,b,C]),a(()=>{let e=requestAnimationFrame(()=>k.current?.classList.add(`is-animated`));return()=>cancelAnimationFrame(e)},[]);let M=C&&_,N=e(`AppSegmented`,p),P=u(`div`,{ref:k,className:j,role:`radiogroup`,"aria-label":_,"aria-disabled":S||void 0,...M?void 0:N,...T,children:[l(`span`,{className:`segmented-thumb`,ref:A,"aria-hidden":`true`}),m.map(e=>u(`label`,{className:`segmented-option`,children:[l(`input`,{type:`radio`,className:`segmented-input`,name:O,value:e.value,checked:e.value===h,disabled:S||e.disabled,onChange:()=>g?.(e.value)}),e.icon&&l(r,{name:e.icon,size:13}),e.note?u(`span`,{className:`segmented-option-text`,children:[l(`span`,{className:`segmented-option-label`,children:e.label}),l(`span`,{className:`segmented-option-note`,children:e.note})]}):e.label,e.count!=null&&l(`span`,{className:`wui-segmented-option-count`,children:e.count})]},e.value))]},`group`);return M?u(`div`,{className:`field`,...N,children:[l(`span`,{className:`label`,"aria-hidden":`true`,children:_}),P]},`field`):P}export{p as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import r from"./AppIcon.js";import i from"./warnDeprecatedValue.js";import{useEffect as a,useId as o,useLayoutEffect as s,useRef as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";var d={sm:`segmented-sm`,md:``,lg:`segmented-lg`},f={xl:{use:`lg`,removeIn:`0.83.0`}};function p(p){let{options:m=[],value:h,onChange:g,label:_,name:v,size:y=`md`,fullWidth:b=!1,bordered:x=!0,disabled:S=!1,labelVisible:C=!1,className:w=``,"data-canvas":T,...E}=p;n(`AppSegmented`,E),i(`AppSegmented`,`size`,y,f);let D=f[y]?.use??y;t(`AppSegmented`,`size`,D,Object.keys(d));let O=o(),k=v||O,A=c(null),j=c(null),M=[`segmented`,d[D]??``,b?`segmented-full`:``,x?``:`wui-segmented-borderless`,S?`is-disabled`:``,w].filter(Boolean).join(` `);s(()=>{let e=A.current,t=j.current;if(!e||!t)return;let n=n=>{let r=e.querySelector(`.segmented-option:has(.segmented-input:checked)`);if(!r||!e.offsetWidth){t.style.opacity=`0`;return}n||e.classList.remove(`is-animated`),t.style.width=`${r.offsetWidth}px`,t.style.transform=`translateX(${r.offsetLeft}px)`,t.style.opacity=`1`,n||requestAnimationFrame(()=>A.current?.classList.add(`is-animated`))};n(!0);let r=typeof ResizeObserver<`u`?new ResizeObserver(()=>n(!1)):null;return r?.observe(e),()=>r?.disconnect()},[h,m,y,b,C]),a(()=>{let e=requestAnimationFrame(()=>A.current?.classList.add(`is-animated`));return()=>cancelAnimationFrame(e)},[]);let N=C&&_,P=e(`AppSegmented`,p),F=u(`div`,{ref:A,className:M,role:`radiogroup`,"aria-label":_,"aria-disabled":S||void 0,...N?void 0:P,...E,children:[l(`span`,{className:`segmented-thumb`,ref:j,"aria-hidden":`true`}),m.map(e=>u(`label`,{className:`segmented-option`,children:[l(`input`,{type:`radio`,className:`segmented-input`,name:k,value:e.value,checked:e.value===h,disabled:S||e.disabled,onChange:()=>g?.(e.value)}),e.icon&&l(r,{name:e.icon,size:13}),e.note?u(`span`,{className:`segmented-option-text`,children:[l(`span`,{className:`segmented-option-label`,children:e.label}),l(`span`,{className:`segmented-option-note`,children:e.note})]}):e.label,e.count!=null&&l(`span`,{className:`wui-segmented-option-count`,children:e.count})]},e.value))]},`group`);return N?u(`div`,{className:`field`,...P,children:[l(`span`,{className:`label`,"aria-hidden":`true`,children:_}),F]},`field`):F}export{p as default};
@@ -1 +1 @@
1
- import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import ee from"./warnUnknownProps.js";import te from"../lib/FieldMessage.js";import n from"./AppInfoTip.js";import r from"./AppRequiredMark.js";import i from"./useNodeLabels.js";import a,{optionsEqual as o}from"./useWuiControl.js";import{forwardRef as s,useId as c,useLayoutEffect as l,useRef as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var ne=[`sm`,`lg`,`xl`],re=(e,t)=>({value:e.value,label:t,icon:e.icon}),m=s(function(s,m){let{value:h,onChange:g,options:_=[],placeholder:v=`Select...`,searchPlaceholder:y=`Search...`,searchable:b=!1,clearable:ie=!1,size:x,icon:ae,prefix:S,suffix:C,floatingLabel:w=!1,disabled:oe,label:T,required:E=!1,error:D,hint:O,help:k,helpLabel:A=`More information`,id:j,name:M,className:N=``,fieldClassName:P=``,"aria-label":F,"aria-labelledby":I,"aria-describedby":L,...R}=s;ee(`AppSelect`,R),t(`AppSelect`,`size`,x,ne);let z=c(),{setRef:B,innerRef:V}=a({ref:m,value:h??``,onChange:g}),{portal:H,toElementOptions:U}=i(_),W=u({el:null,options:null,map:null});l(()=>{let e=V.current;if(!e||W.current.el===e&&W.current.options===_&&W.current.map===U)return;W.current={el:e,options:_,map:U};let t=U(_,re);o(t,e.options)||(e.options=t)});let G=j||z,K=w&&T,q=D&&G?`${G}-error`:void 0,J=O&&G?`${G}-hint`:void 0,se=q||J||L,Y=!K&&(S!=null||C!=null),X=!T&&!D&&!O,Z=e(`AppSelect`,s),Q=p(d,{children:[f(`wui-select`,{"aria-label":F||(typeof T==`string`?T:void 0),"aria-labelledby":I||void 0,"aria-describedby":se||void 0,"aria-invalid":D?`true`:void 0,ref:B,value:h||void 0,id:G,name:M,placeholder:w&&T?` `:v,"search-placeholder":y,searchable:b?``:void 0,clearable:ie?``:void 0,size:x||void 0,icon:ae||void 0,disabled:oe?``:void 0,required:E?``:void 0,className:N||void 0,...X&&!Y?Z:null,...R}),H]}),$=Y?p(`div`,{...X?Z:null,className:`input-affixed`,children:[S!=null&&f(`span`,{className:`affix affix-pre`,children:S}),Q,C!=null&&f(`span`,{className:`affix affix-suf`,children:C})]}):Q;if(X)return $;let ce=[`field`,P].filter(Boolean).join(` `);return p(`div`,{...Z,className:ce,children:[T&&!K&&p(`label`,{className:`label`,htmlFor:G,children:[T,E&&f(r,{}),k&&f(n,{label:A,children:k})]}),K?p(`div`,{className:`field-float`,children:[Q,p(`label`,{className:`float-label`,htmlFor:G,children:[T,E&&f(r,{})]})]}):$,f(te,{error:D,hint:O,errorId:q,hintId:J})]})});export{m as default};
1
+ import{wuiMarkerAttributes as e}from"../lib/wuiMarker.js";import t from"./warnInvalidValue.js";import n from"./warnUnknownProps.js";import ee from"../lib/FieldMessage.js";import r from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import te from"./useNodeLabels.js";import a,{optionsEqual as o}from"./useWuiControl.js";import{forwardRef as s,useId as ne,useLayoutEffect as re,useRef as c}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import"@webority/ui-elements/elements/select";var f=[`sm`,`lg`,`xl`],p=[`off`,`border`],m=(e,t)=>({value:e.value,label:t,icon:e.icon}),h=s(function(s,h){let{value:g,onChange:_,options:v=[],placeholder:y=`Select...`,searchPlaceholder:ie=`Search...`,searchable:ae=!1,clearable:oe=!1,size:b,icon:se,prefix:x,suffix:S,floatingLabel:C=`off`,disabled:w,label:T,required:E=!1,error:D,hint:O,help:k,helpLabel:A=`More information`,id:j,name:M,className:N=``,fieldClassName:P=``,"aria-label":F,"aria-labelledby":I,"aria-describedby":L,"data-canvas":ce,...R}=s;n(`AppSelect`,R),t(`AppSelect`,`size`,b,f),t(`AppSelect`,`floatingLabel`,C,p);let z=ne(),{setRef:B,innerRef:V}=a({ref:h,value:g??``,onChange:_}),{portal:H,toElementOptions:U}=te(v),W=c({el:null,options:null,map:null});re(()=>{let e=V.current;if(!e||W.current.el===e&&W.current.options===v&&W.current.map===U)return;W.current={el:e,options:v,map:U};let t=U(v,m);o(t,e.options)||(e.options=t)});let G=j||z,K=C!==`off`&&T,q=D&&G?`${G}-error`:void 0,J=O&&G?`${G}-hint`:void 0,le=q||J||L,Y=!K&&(x!=null||S!=null),X=!T&&!D&&!O,Z=e(`AppSelect`,s),Q=d(l,{children:[u(`wui-select`,{"aria-label":F||(typeof T==`string`?T:void 0),"aria-labelledby":I||void 0,"aria-describedby":le||void 0,"aria-invalid":D?`true`:void 0,ref:B,value:g||void 0,id:G,name:M,placeholder:C!==`off`&&T?` `:y,"search-placeholder":ie,searchable:ae?``:void 0,clearable:oe?``:void 0,size:b||void 0,icon:se||void 0,disabled:w?``:void 0,required:E?``:void 0,className:N||void 0,...X&&!Y?Z:null,...R}),H]}),$=Y?d(`div`,{...X?Z:null,className:`input-affixed`,children:[x!=null&&u(`span`,{className:`affix affix-pre`,children:x}),Q,S!=null&&u(`span`,{className:`affix affix-suf`,children:S})]}):Q;if(X)return $;let ue=[`field`,P].filter(Boolean).join(` `);return d(`div`,{...Z,className:ue,children:[T&&!K&&d(`label`,{className:`label`,htmlFor:G,children:[T,E&&u(i,{}),k&&u(r,{label:A,children:k})]}),K?d(`div`,{className:`field-float`,children:[Q,d(`label`,{className:`float-label`,htmlFor:G,children:[T,E&&u(i,{})]})]}):$,u(ee,{error:D,hint:O,errorId:q,hintId:J})]})});export{h as default};