@webority/ui-react 0.174.1 → 0.175.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 (102) hide show
  1. package/dist/canvas-kit/kit.js +96 -96
  2. package/dist/canvas-kit/manifest.json +133 -1
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/dist/components/AppAlert.js +1 -1
  5. package/dist/components/AppAvatar.js +1 -1
  6. package/dist/components/AppCalendar.js +1 -1
  7. package/dist/components/AppChart.js +1 -1
  8. package/dist/components/AppCheckbox.js +1 -1
  9. package/dist/components/AppChip.js +1 -1
  10. package/dist/components/AppChoiceCard.js +1 -1
  11. package/dist/components/AppCommentThread.js +1 -1
  12. package/dist/components/AppConfirmDialog.js +1 -1
  13. package/dist/components/AppConfirmProvider.js +1 -1
  14. package/dist/components/AppContextMenu.js +1 -1
  15. package/dist/components/AppDatePicker.js +1 -1
  16. package/dist/components/AppDateRangePicker.js +1 -1
  17. package/dist/components/AppDateTimePicker.js +1 -1
  18. package/dist/components/AppDropdown.js +1 -1
  19. package/dist/components/AppFileAttachment.js +1 -1
  20. package/dist/components/AppFilePicker.js +1 -1
  21. package/dist/components/AppFileViewer.js +1 -1
  22. package/dist/components/AppForm.js +1 -1
  23. package/dist/components/AppImagePicker.js +1 -1
  24. package/dist/components/AppInput.js +1 -1
  25. package/dist/components/AppLeadPopup.js +1 -1
  26. package/dist/components/AppLightbox.js +1 -1
  27. package/dist/components/AppLink.js +1 -1
  28. package/dist/components/AppMentionInput.js +1 -1
  29. package/dist/components/AppMonthPicker.js +1 -1
  30. package/dist/components/AppNumberInput.js +1 -1
  31. package/dist/components/AppOtpInput.js +1 -1
  32. package/dist/components/AppPageHeader.js +1 -1
  33. package/dist/components/AppPhoneNumberInput.js +1 -1
  34. package/dist/components/AppQueryBuilder.js +1 -1
  35. package/dist/components/AppRadio.js +1 -1
  36. package/dist/components/AppRichText.js +1 -1
  37. package/dist/components/AppSelect.js +1 -1
  38. package/dist/components/AppShell.js +1 -1
  39. package/dist/components/AppSlider.js +1 -1
  40. package/dist/components/AppSortableList.js +1 -1
  41. package/dist/components/AppSwitch.js +1 -1
  42. package/dist/components/AppTabs.js +1 -1
  43. package/dist/components/AppTextarea.js +1 -1
  44. package/dist/components/AppTimePicker.js +1 -1
  45. package/dist/components/AppTour.js +1 -1
  46. package/dist/components/AppTransferList.js +1 -1
  47. package/dist/components/AppTreePicker.js +1 -1
  48. package/dist/components/AppTreeView.js +1 -1
  49. package/dist/components/AppWhatsNew.js +1 -1
  50. package/dist/components/AppWizard.js +1 -1
  51. package/dist/components/AppWorkspaceSwitcher.js +1 -1
  52. package/dist/components/AppYearPicker.js +1 -1
  53. package/dist/components/toast.js +1 -1
  54. package/dist/guidance.json +1 -1
  55. package/dist/lib/CheckField.js +1 -1
  56. package/dist/lib/FileItemRow.js +1 -1
  57. package/dist/types/components/AppCalendar.d.ts +50 -2
  58. package/dist/types/components/AppChart.d.ts +3 -2
  59. package/dist/types/components/AppCheckbox.d.ts +4 -2
  60. package/dist/types/components/AppChoiceCard.d.ts +4 -0
  61. package/dist/types/components/AppCompareTable.d.ts +2 -2
  62. package/dist/types/components/AppConfirmDialog.d.ts +4 -0
  63. package/dist/types/components/AppContextMenu.d.ts +2 -0
  64. package/dist/types/components/AppCopyButton.d.ts +1 -1
  65. package/dist/types/components/AppDatePicker.d.ts +2 -1
  66. package/dist/types/components/AppDateRangePicker.d.ts +4 -1
  67. package/dist/types/components/AppDateTimePicker.d.ts +2 -1
  68. package/dist/types/components/AppDropdown.d.ts +2 -0
  69. package/dist/types/components/AppFileViewer.d.ts +50 -2
  70. package/dist/types/components/AppForm.d.ts +2 -2
  71. package/dist/types/components/AppFormSection.d.ts +2 -2
  72. package/dist/types/components/AppInput.d.ts +13 -1
  73. package/dist/types/components/AppLeadPopup.d.ts +2 -1
  74. package/dist/types/components/AppLightbox.d.ts +2 -0
  75. package/dist/types/components/AppMentionInput.d.ts +3 -1
  76. package/dist/types/components/AppMonthPicker.d.ts +2 -1
  77. package/dist/types/components/AppNumberInput.d.ts +4 -2
  78. package/dist/types/components/AppOtpInput.d.ts +17 -2
  79. package/dist/types/components/AppPhoneNumberInput.d.ts +7 -2
  80. package/dist/types/components/AppQueryBuilder.d.ts +3 -2
  81. package/dist/types/components/AppRadio.d.ts +11 -2
  82. package/dist/types/components/AppResult.d.ts +2 -2
  83. package/dist/types/components/AppRichText.d.ts +3 -2
  84. package/dist/types/components/AppRouteError.d.ts +2 -2
  85. package/dist/types/components/AppSelect.d.ts +3 -1
  86. package/dist/types/components/AppShell.d.ts +16 -0
  87. package/dist/types/components/AppSlider.d.ts +4 -2
  88. package/dist/types/components/AppSortableList.d.ts +4 -2
  89. package/dist/types/components/AppSwitch.d.ts +3 -2
  90. package/dist/types/components/AppTextarea.d.ts +3 -2
  91. package/dist/types/components/AppTimePicker.d.ts +19 -2
  92. package/dist/types/components/AppTour.d.ts +28 -2
  93. package/dist/types/components/AppTransferList.d.ts +4 -2
  94. package/dist/types/components/AppTreePicker.d.ts +3 -2
  95. package/dist/types/components/AppTreeView.d.ts +4 -2
  96. package/dist/types/components/AppWhatsNew.d.ts +2 -0
  97. package/dist/types/components/AppWizard.d.ts +16 -2
  98. package/dist/types/components/AppYearPicker.d.ts +3 -1
  99. package/dist/types/components/toast.d.ts +46 -4
  100. package/dist/types/lib/CheckField.d.ts +2 -1
  101. package/dist/types/lib/formFields.d.ts +2 -1
  102. package/package.json +8 -8
@@ -2,7 +2,7 @@
2
2
  "kind": "WeborityWeb",
3
3
  "library": {
4
4
  "name": "@webority/ui-react",
5
- "version": "0.174.1"
5
+ "version": "0.175.0"
6
6
  },
7
7
  "rendererProtocolVersion": 14,
8
8
  "platform": "Web",
@@ -4505,6 +4505,18 @@
4505
4505
  "description": "Alternative text for the image.",
4506
4506
  "default": ""
4507
4507
  },
4508
+ {
4509
+ "name": "imageHeight",
4510
+ "type": "number",
4511
+ "required": false,
4512
+ "description": "The image's intrinsic height in px."
4513
+ },
4514
+ {
4515
+ "name": "imageWidth",
4516
+ "type": "number",
4517
+ "required": false,
4518
+ "description": "The image's intrinsic width in px. Set it with imageHeight so the card keeps its size while the image loads."
4519
+ },
4508
4520
  {
4509
4521
  "name": "layout",
4510
4522
  "type": "enum",
@@ -6700,6 +6712,18 @@
6700
6712
  "required": false,
6701
6713
  "description": "URL of a custom illustration that replaces the tone artwork. Any source size is fine: the theme boxes it to the same footprint. It is decorative, so the title and message carry the meaning."
6702
6714
  },
6715
+ {
6716
+ "name": "imageHeight",
6717
+ "type": "number",
6718
+ "required": false,
6719
+ "description": "Height in px of the custom image, written as the img height. Unset, no height is written."
6720
+ },
6721
+ {
6722
+ "name": "imageWidth",
6723
+ "type": "number",
6724
+ "required": false,
6725
+ "description": "Width in px of the custom image, written as the img width. Unset, no width is written."
6726
+ },
6703
6727
  {
6704
6728
  "name": "loading",
6705
6729
  "type": "boolean",
@@ -7050,6 +7074,18 @@
7050
7074
  "required": false,
7051
7075
  "description": "A picture URL shown instead of the icon."
7052
7076
  },
7077
+ {
7078
+ "name": "imageHeight",
7079
+ "type": "number",
7080
+ "required": false,
7081
+ "description": "Picture height in pixels."
7082
+ },
7083
+ {
7084
+ "name": "imageWidth",
7085
+ "type": "number",
7086
+ "required": false,
7087
+ "description": "Picture width in pixels; reserves its box before it loads."
7088
+ },
7053
7089
  {
7054
7090
  "name": "items",
7055
7091
  "type": "array",
@@ -7090,6 +7126,18 @@
7090
7126
  "required": false,
7091
7127
  "description": "A picture URL shown instead of the icon."
7092
7128
  },
7129
+ {
7130
+ "name": "imageHeight",
7131
+ "type": "number",
7132
+ "required": false,
7133
+ "description": "Picture height in pixels."
7134
+ },
7135
+ {
7136
+ "name": "imageWidth",
7137
+ "type": "number",
7138
+ "required": false,
7139
+ "description": "Picture width in pixels; reserves its box before it loads."
7140
+ },
7093
7141
  {
7094
7142
  "name": "items",
7095
7143
  "type": "array",
@@ -9589,6 +9637,18 @@
9589
9637
  "required": false,
9590
9638
  "description": "URL of a picture that leads the row, such as an external logo or avatar. Pass image or icon, not both."
9591
9639
  },
9640
+ {
9641
+ "name": "imageHeight",
9642
+ "type": "number",
9643
+ "required": false,
9644
+ "description": "The picture's height in pixels. Give it with imageWidth so the row keeps its size as the picture loads."
9645
+ },
9646
+ {
9647
+ "name": "imageWidth",
9648
+ "type": "number",
9649
+ "required": false,
9650
+ "description": "The picture's width in pixels. Give it with imageHeight so the row keeps its size as the picture loads."
9651
+ },
9592
9652
  {
9593
9653
  "name": "key",
9594
9654
  "type": "string",
@@ -15319,6 +15379,18 @@
15319
15379
  "type": "url",
15320
15380
  "required": false,
15321
15381
  "description": "The thumbnail. It defaults to the full image."
15382
+ },
15383
+ {
15384
+ "name": "thumbHeight",
15385
+ "type": "number",
15386
+ "required": false,
15387
+ "description": "The thumbnail's height in pixels."
15388
+ },
15389
+ {
15390
+ "name": "thumbWidth",
15391
+ "type": "number",
15392
+ "required": false,
15393
+ "description": "The thumbnail's width in pixels. Set it with thumbHeight so its space is reserved before it loads."
15322
15394
  }
15323
15395
  ],
15324
15396
  "required": false,
@@ -24448,12 +24520,36 @@
24448
24520
  "required": false,
24449
24521
  "description": "Dark-mode twin of logoLight, swapped in under data-theme dark. Needs logoLight."
24450
24522
  },
24523
+ {
24524
+ "name": "logoDarkHeight",
24525
+ "type": "number",
24526
+ "required": false,
24527
+ "description": "Pixel height of the dark-mode logo, set on its img. Unset, the image keeps its own size."
24528
+ },
24529
+ {
24530
+ "name": "logoDarkWidth",
24531
+ "type": "number",
24532
+ "required": false,
24533
+ "description": "Pixel width of the dark-mode logo, set on its img. Unset, the image keeps its own size."
24534
+ },
24451
24535
  {
24452
24536
  "name": "logoLight",
24453
24537
  "type": "string",
24454
24538
  "required": false,
24455
24539
  "description": "Image URL of the full logo shown on the open sidebar. Ship it pre-trimmed; the library fixes only its height."
24456
24540
  },
24541
+ {
24542
+ "name": "logoLightHeight",
24543
+ "type": "number",
24544
+ "required": false,
24545
+ "description": "Pixel height of the full logo on the open sidebar, set on its img. Unset, the image keeps its own size."
24546
+ },
24547
+ {
24548
+ "name": "logoLightWidth",
24549
+ "type": "number",
24550
+ "required": false,
24551
+ "description": "Pixel width of the full logo on the open sidebar, set on its img. Give the size with the file to reserve its space before it loads. Unset, the image keeps its own size."
24552
+ },
24457
24553
  {
24458
24554
  "name": "markAllReadLabel",
24459
24555
  "type": "string",
@@ -24467,12 +24563,36 @@
24467
24563
  "required": false,
24468
24564
  "description": "Dark-mode twin of markLight."
24469
24565
  },
24566
+ {
24567
+ "name": "markDarkHeight",
24568
+ "type": "number",
24569
+ "required": false,
24570
+ "description": "Pixel height of the dark-mode mark, set on its img. Unset, the image keeps its own size."
24571
+ },
24572
+ {
24573
+ "name": "markDarkWidth",
24574
+ "type": "number",
24575
+ "required": false,
24576
+ "description": "Pixel width of the dark-mode mark, set on its img. Unset, the image keeps its own size."
24577
+ },
24470
24578
  {
24471
24579
  "name": "markLight",
24472
24580
  "type": "string",
24473
24581
  "required": false,
24474
24582
  "description": "Image URL of the square mark shown on the collapsed rail. Without one, the logo is clipped to a square."
24475
24583
  },
24584
+ {
24585
+ "name": "markLightHeight",
24586
+ "type": "number",
24587
+ "required": false,
24588
+ "description": "Pixel height of the square mark on the collapsed rail, set on its img. Unset, the image keeps its own size."
24589
+ },
24590
+ {
24591
+ "name": "markLightWidth",
24592
+ "type": "number",
24593
+ "required": false,
24594
+ "description": "Pixel width of the square mark on the collapsed rail, set on its img. Unset, the image keeps its own size."
24595
+ },
24476
24596
  {
24477
24597
  "name": "moreLabel",
24478
24598
  "type": "string",
@@ -30952,12 +31072,24 @@
30952
31072
  "required": false,
30953
31073
  "description": "Describes the picture. Leave it empty when the picture adds nothing."
30954
31074
  },
31075
+ {
31076
+ "name": "imageHeight",
31077
+ "type": "number",
31078
+ "required": false,
31079
+ "description": "The picture's intrinsic height in px. Set it with imageWidth so the picture keeps its space while it loads."
31080
+ },
30955
31081
  {
30956
31082
  "name": "imageSrc",
30957
31083
  "type": "string",
30958
31084
  "required": false,
30959
31085
  "description": "A picture shown under the text, loaded lazily."
30960
31086
  },
31087
+ {
31088
+ "name": "imageWidth",
31089
+ "type": "number",
31090
+ "required": false,
31091
+ "description": "The picture's intrinsic width in px. Set it with imageHeight so the picture keeps its space while it loads."
31092
+ },
30961
31093
  {
30962
31094
  "name": "linkLabel",
30963
31095
  "type": "string",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "webority-web",
3
- "version": "0.174.1",
3
+ "version": "0.175.0",
4
4
  "platform": "Web",
5
5
  "kitModuleVersion": 2,
6
6
  "rendererProtocolVersion": 14,
7
7
  "library": {
8
8
  "name": "@webority/ui-react",
9
- "version": "0.174.1"
9
+ "version": "0.175.0"
10
10
  },
11
11
  "files": {
12
12
  "manifest.json": {
13
- "sha256": "30851193ce7fd084f14f77ca78e3fe786ab7f70e2ea50c6b70213306c4c66040",
14
- "bytes": 1130753
13
+ "sha256": "f50ccfd697b65a457402bcb62f48ee4bfc6452bd07af69d9fbe308220671ca4e",
14
+ "bytes": 1135985
15
15
  },
16
16
  "kit.js": {
17
- "sha256": "d4488cbb1c96c90bc30d1557a790a1a3e5e49f8e1fada5eb9b4a7f991a45f6c7",
18
- "bytes": 10142199
17
+ "sha256": "e255195536be23787352ee2954c8381af132ddb27ac85a5df8b1297c41c417fd",
18
+ "bytes": 10149018
19
19
  },
20
20
  "kit.css": {
21
21
  "sha256": "13b14f71fb6ea024945f95cba617b4f1d49f44a65ba7c7ed05d2354805539ef6",
@@ -1 +1 @@
1
- import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";import{Alert as c}from"react-bootstrap";var l={info:`info`,success:`check`,warning:`alert-triangle`,danger:`x`},u=e.filter(e=>e!==`primary`),d=[`sm`,`md`,`lg`],f=[`alert`,`status`,`none`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`];function m(e,t,r,i,a,s){return i?/* @__PURE__ */ o(`span`,{className:`alert-icon alert-icon-image`,style:s!==void 0&&s>0?{width:s,height:s}:void 0,children:/* @__PURE__ */ o(`img`,{src:i,alt:a})}):e?typeof e==`string`?/* @__PURE__ */ o(`span`,{className:`alert-icon`,children:/* @__PURE__ */ o(n,{name:e,size:t,variant:r})}):/* @__PURE__ */ o(`span`,{className:`alert-icon`,children:e}):null}function h(e){let{marker:n,props:h}=t(`AppAlert`,e),{tone:g=`info`,children:_,title:v,icon:y,iconVariant:b,iconSize:x,image:S,imageAlt:C=``,imageSize:w,className:T=``,onClose:E,dismissible:D,bordered:O=!0,accent:k=!1,size:A=`md`,action:j,role:M=`alert`,...N}=h;i(`AppAlert`,N),r(`AppAlert`,`tone`,g,u),r(`AppAlert`,`size`,A,d),r(`AppAlert`,`role`,M,f),r(`AppAlert`,`iconVariant`,b,p);let P=y===void 0?l[g]:y===`none`?null:y,F=!!S||!!P,I=j!=null&&j!==!1,L=v?/* @__PURE__ */ o(`div`,{className:`alert-heading`,children:v}):null,R=F&&!!L&&!!_,z=x!==void 0&&x>0?x:A===`lg`?R?17:15:R?13:11,B=[F?`alert-has-icon`:``,I?`alert-has-action`:``,R?`alert-stack`:``,O?``:`alert-borderless`,k?`alert-accent`:``,A===`sm`?`alert-sm`:``,A===`lg`?`alert-lg`:``,T].filter(Boolean).join(` `);return/* @__PURE__ */ o(c,{className:B||void 0,...E?{onClose:E}:null,dismissible:D??typeof E==`function`,transition:!1,role:M===`none`?void 0:M,...n,...N,variant:g,children:F||I?/* @__PURE__ */ s(a,{children:[F&&m(P,z,b,S,C,w),/* @__PURE__ */ s(`div`,{className:`alert-content`,children:[L,_]}),I&&/* @__PURE__ */ o(`div`,{className:`alert-action`,children:j})]}):/* @__PURE__ */ s(a,{children:[L,_]})})}export{h as default};
1
+ import{TONES as e}from"../lib/vocabulary.js";import{splitMarkerProps as t}from"../lib/wuiMarker.js";import n from"./AppIcon.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";import{Alert as c}from"react-bootstrap";var l={info:`info`,success:`check`,warning:`alert-triangle`,danger:`x`},u=e.filter(e=>e!==`primary`),d=[`sm`,`md`,`lg`],f=[`alert`,`status`,`none`],p=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`];function m(e,t,r,i,a,s){if(i){let e=s!==void 0&&s>0?{width:s,height:s}:void 0;return/* @__PURE__ */ o(`span`,{className:`alert-icon alert-icon-image`,style:e,children:/* @__PURE__ */ o(`img`,{src:i,alt:a,width:e?.width,height:e?.height})})}return e?typeof e==`string`?/* @__PURE__ */ o(`span`,{className:`alert-icon`,children:/* @__PURE__ */ o(n,{name:e,size:t,variant:r})}):/* @__PURE__ */ o(`span`,{className:`alert-icon`,children:e}):null}function h(e){let{marker:n,props:h}=t(`AppAlert`,e),{tone:g=`info`,children:_,title:v,icon:y,iconVariant:b,iconSize:x,image:S,imageAlt:C=``,imageSize:w,className:T=``,onClose:E,dismissible:D,bordered:O=!0,accent:k=!1,size:A=`md`,action:j,role:M=`alert`,...N}=h;i(`AppAlert`,N),r(`AppAlert`,`tone`,g,u),r(`AppAlert`,`size`,A,d),r(`AppAlert`,`role`,M,f),r(`AppAlert`,`iconVariant`,b,p);let P=y===void 0?l[g]:y===`none`?null:y,F=!!S||!!P,I=j!=null&&j!==!1,L=v?/* @__PURE__ */ o(`div`,{className:`alert-heading`,children:v}):null,R=F&&!!L&&!!_,z=x!==void 0&&x>0?x:A===`lg`?R?17:15:R?13:11,B=[F?`alert-has-icon`:``,I?`alert-has-action`:``,R?`alert-stack`:``,O?``:`alert-borderless`,k?`alert-accent`:``,A===`sm`?`alert-sm`:``,A===`lg`?`alert-lg`:``,T].filter(Boolean).join(` `);return/* @__PURE__ */ o(c,{className:B||void 0,...E?{onClose:E}:null,dismissible:D??typeof E==`function`,transition:!1,role:M===`none`?void 0:M,...n,...N,variant:g,children:F||I?/* @__PURE__ */ s(a,{children:[F&&m(P,z,b,S,C,w),/* @__PURE__ */ s(`div`,{className:`alert-content`,children:[L,_]}),I&&/* @__PURE__ */ o(`div`,{className:`alert-action`,children:j})]}):/* @__PURE__ */ s(a,{children:[L,_]})})}export{h as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./renderIconProp.js";import s from"./warnUnknownProps.js";import c from"./withTooltip.js";import{initialsOf as l}from"@webority/ui-elements/helpers";import{useState as u}from"react";import{Fragment as d,jsx as f,jsxs as p}from"react/jsx-runtime";import{AVATAR_TEXT as m}from"@webority/ui-elements/text";var ee=[`circle`,`rounded`,`square`],te=[...r,`auto`],h=[`none`,`online`,`offline`,`away`,`busy`],g=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],ne=/* @__PURE__ */ new Set([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),_={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function re(e){return l(e)||`?`}function v(e){let t=e||``,n=0;for(let e=0;e<t.length;e+=1)n=Math.imul(n,31)+t.charCodeAt(e)>>>0;return n%360}function y(e){if(typeof e==`number`)return e;let t=_[e];if(t!=null)return t;let n=Number.parseInt(e,10);return Number.isNaN(n)?32:n}function b(r){let{marker:l,props:_}=i(`AppAvatar`,r),b=n(`avatar`,m),{name:x,src:S,size:C=`md`,shape:w=`circle`,tone:T=`primary`,status:E=`none`,ring:D=!1,label:O,icon:k,iconVariant:A,badge:j,href:M,onClick:N,linkComponent:P,tooltip:F,tooltipPlacement:I,className:L=``,photoLabel:R=b.photoLabel,...z}=_;s(`AppAvatar`,z),a(`AppAvatar`,`shape`,w,ee),a(`AppAvatar`,`tone`,T,te),a(`AppAvatar`,`status`,E,h),a(`AppAvatar`,`iconVariant`,A,g);let{style:B,...V}=z,[H,U]=u(null),W=H!=null&&H===S,G=typeof C==`string`&&ne.has(C),K=G?null:typeof C==`number`||/^\d+$/.test(C)?`${C}px`:C,q=M!=null||N!=null,J=S!=null&&S!==``&&!W,Y=[`avatar`,G&&C!==`md`?`avatar-${C}`:``,w===`circle`?``:`avatar-${w}`,T===`primary`?``:`avatar-${T}`,D?`avatar-ring`:``,q?`avatar-clickable`:``,L].filter(Boolean).join(` `),X={};K&&(X[`--avatar-size`]=K),T===`auto`&&(X[`--avatar-hue`]=v(x));let Z=Object.keys(X).length||B?{...X,...B}:void 0,ie=/* @__PURE__ */ f(`span`,{className:`avatar-face`,"aria-hidden":`true`,children:k!=null&&k!==!1&&k!==``?o(k,{size:Math.round(y(C)*.55),variant:A}):re(x)}),ae=/* @__PURE__ */ p(d,{children:[E!==`none`&&/* @__PURE__ */ f(`span`,{className:`avatar-status avatar-status-${E}`,"aria-hidden":`true`}),j!=null&&/* @__PURE__ */ f(`span`,{className:`avatar-badge`,children:j}),O!=null&&/* @__PURE__ */ f(`span`,{className:`avatar-label`,"aria-hidden":`true`,children:O})]}),Q=/* @__PURE__ */ p(d,{children:[ie,J&&/* @__PURE__ */ f(`img`,{className:`avatar-img`,src:S,alt:q?``:x||R,onError:()=>U(S)}),ae]});if(M!=null){let n=e(P,{href:M});return c(/* @__PURE__ */ f(t,{link:n,className:Y,style:Z,...l,...V,"aria-label":O||x,onClick:N,children:Q}),F,I)}if(N!=null)return c(/* @__PURE__ */ f(`button`,{type:`button`,className:Y,style:Z,...l,...V,"aria-label":O||x,onClick:N,children:Q}),F,I);if(J)return c(/* @__PURE__ */ f(`span`,{className:Y,style:Z,...l,...V,children:Q}),F,I);let $=O?.trim()||x?.trim();return c($?/* @__PURE__ */ f(`span`,{className:Y,style:Z,...l,...V,role:`img`,"aria-label":$,children:Q}):/* @__PURE__ */ f(`span`,{className:Y,style:Z,...l,...V,"aria-hidden":`true`,children:Q}),F,I)}export{b as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useWuiText.js";import{TONES as r}from"../lib/vocabulary.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import i from"./assertValidValue.js";import a from"./renderIconProp.js";import o from"./warnUnknownProps.js";import s from"./withTooltip.js";import{initialsOf as c}from"@webority/ui-elements/helpers";import{useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{AVATAR_TEXT as te}from"@webority/ui-elements/text";var ne=[`circle`,`rounded`,`square`],p=[...r,`auto`],m=[`none`,`online`,`offline`,`away`,`busy`],re=[`linear`,`outline`,`bold`,`bulk`,`broken`,`twotone`],h=/* @__PURE__ */ new Set([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),g={xs:20,sm:24,md:32,lg:48,xl:64,"2xl":96};function _(e){return c(e)||`?`}function v(e){let t=e||``,n=0;for(let e=0;e<t.length;e+=1)n=Math.imul(n,31)+t.charCodeAt(e)>>>0;return n%360}function y(e){if(typeof e==`number`)return e;let t=g[e];if(t!=null)return t;let n=Number.parseInt(e,10);return Number.isNaN(n)?32:n}function b(r){let{marker:c,props:b}=ee(`AppAvatar`,r),x=n(`avatar`,te),{name:S,src:C,size:w=`md`,shape:T=`circle`,tone:E=`primary`,status:D=`none`,ring:O=!1,label:k,icon:A,iconVariant:j,badge:M,href:N,onClick:P,linkComponent:ie,tooltip:F,tooltipPlacement:I,className:ae=``,photoLabel:L=x.photoLabel,...R}=b;o(`AppAvatar`,R),i(`AppAvatar`,`shape`,T,ne),i(`AppAvatar`,`tone`,E,p),i(`AppAvatar`,`status`,D,m),i(`AppAvatar`,`iconVariant`,j,re);let{style:z,...B}=R,[V,H]=l(null),U=V!=null&&V===C,W=typeof w==`string`&&h.has(w),G=W?null:typeof w==`number`||/^\d+$/.test(w)?`${w}px`:w,K=typeof w==`number`?w:/^\d+$/.test(w)?Number(w):h.has(w)?g[w]:void 0,q=N!=null||P!=null,J=C!=null&&C!==``&&!U,Y=[`avatar`,W&&w!==`md`?`avatar-${w}`:``,T===`circle`?``:`avatar-${T}`,E===`primary`?``:`avatar-${E}`,O?`avatar-ring`:``,q?`avatar-clickable`:``,ae].filter(Boolean).join(` `),X={};G&&(X[`--avatar-size`]=G),E===`auto`&&(X[`--avatar-hue`]=v(S));let Z=Object.keys(X).length||z?{...X,...z}:void 0,oe=/* @__PURE__ */ d(`span`,{className:`avatar-face`,"aria-hidden":`true`,children:A!=null&&A!==!1&&A!==``?a(A,{size:Math.round(y(w)*.55),variant:j}):_(S)}),se=/* @__PURE__ */ f(u,{children:[D!==`none`&&/* @__PURE__ */ d(`span`,{className:`avatar-status avatar-status-${D}`,"aria-hidden":`true`}),M!=null&&/* @__PURE__ */ d(`span`,{className:`avatar-badge`,children:M}),k!=null&&/* @__PURE__ */ d(`span`,{className:`avatar-label`,"aria-hidden":`true`,children:k})]}),Q=/* @__PURE__ */ f(u,{children:[oe,J&&/* @__PURE__ */ d(`img`,{className:`avatar-img`,src:C,alt:q?``:S||L,onError:()=>H(C),width:K,height:K}),se]});if(N!=null){let n=e(ie,{href:N});return s(/* @__PURE__ */ d(t,{link:n,className:Y,style:Z,...c,...B,"aria-label":k||S,onClick:P,children:Q}),F,I)}if(P!=null)return s(/* @__PURE__ */ d(`button`,{type:`button`,className:Y,style:Z,...c,...B,"aria-label":k||S,onClick:P,children:Q}),F,I);if(J)return s(/* @__PURE__ */ d(`span`,{className:Y,style:Z,...c,...B,children:Q}),F,I);let $=k?.trim()||S?.trim();return s($?/* @__PURE__ */ d(`span`,{className:Y,style:Z,...c,...B,role:`img`,"aria-label":$,children:Q}):/* @__PURE__ */ d(`span`,{className:Y,style:Z,...c,...B,"aria-hidden":`true`,children:Q}),F,I)}export{b as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{createElement as a,forwardRef as o,useCallback as s,useEffect as c,useLayoutEffect as l,useRef as u,useState as d}from"react";import{jsx as f}from"react/jsx-runtime";import{CALENDAR_TEXT as p}from"@webority/ui-elements/text";var m=`wui-calendar:event-click`,h=`wui-calendar:date-click`,g=`wui-calendar:range-change`,_=[`month`,`week`,`day`,`list`],v=o(function(o,v){let{marker:y,props:b}=n(`AppCalendar`,o),x=t(`calendar`,p),{label:S,events:C,eventsUrl:w,view:T,date:E,emptyText:D,errorText:O,firstDay:k,timeZone:A,onEventClick:j,onDateClick:M,onRangeChange:N,className:P=``,style:F,...I}=b;i(`AppCalendar`,I),r(`AppCalendar`,`view`,T,_);let L=u(null),R=u(``),z=u({onEventClick:j,onDateClick:M,onRangeChange:N}),[B,V]=d(!1),H=s(e=>{L.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]);return c(()=>{z.current={onEventClick:j,onDateClick:M,onRangeChange:N}}),l(()=>{let e=L.current;if(!e)return;let t=C==null?``:JSON.stringify(C);t!==R.current&&(R.current=t,e.events=C??null)}),c(()=>{let e=L.current;if(!e)throw Error(`AppCalendar: the <wui-calendar> element is not mounted`);let t=[[m,e=>{if(!(e instanceof CustomEvent))throw Error(`${m} arrived without a detail`);let t=e.detail;z.current.onEventClick?.(t)===!1&&e.preventDefault()}],[h,e=>{if(!(e instanceof CustomEvent))throw Error(`${h} arrived without a detail`);let t=e.detail;z.current.onDateClick?.(t)}],[g,e=>{if(!(e instanceof CustomEvent))throw Error(`${g} arrived without a detail`);let t=e.detail;z.current.onRangeChange?.(t)}]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),c(()=>{let t=!0;return import(`@webority/ui-elements/calendar`).catch(n=>{e(`[AppCalendar] the calendar failed to load:`,n?.message),t&&V(!0)}),()=>{t=!1}},[]),B?/* @__PURE__ */ f(`div`,{...y,className:P||void 0,style:F,role:`status`,children:/* @__PURE__ */ f(`p`,{className:`wui-calendar-status-text`,children:O||x.loadFailedText})}):a(`wui-calendar`,{ref:H,label:S||void 0,"events-url":w||void 0,view:T||void 0,date:E||void 0,"empty-text":D||void 0,"error-text":O||void 0,"first-day":k==null?void 0:String(k),"time-zone":A||void 0,className:P||void 0,style:F,...y,...I})});export{v as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./assertValidValue.js";import i from"./warnUnknownProps.js";import{createElement as a,useCallback as o,useEffect as s,useLayoutEffect as c,useRef as l,useState as u}from"react";import{jsx as d}from"react/jsx-runtime";import{CALENDAR_TEXT as f}from"@webority/ui-elements/text";var p=`wui-calendar:event-click`,m=`wui-calendar:date-click`,h=`wui-calendar:range-change`,g=[`month`,`week`,`day`,`list`];function _({ref:_,...v}){let{marker:y,props:b}=n(`AppCalendar`,v),x=t(`calendar`,f),{label:S,events:C,eventsUrl:w,view:T,date:E,emptyText:D,errorText:O,firstDay:k,timeZone:A,onEventClick:j,onDateClick:M,onRangeChange:N,className:P=``,style:F,...I}=b;i(`AppCalendar`,I),r(`AppCalendar`,`view`,T,g);let L=l(null),R=l(``),z=l({onEventClick:j,onDateClick:M,onRangeChange:N}),[B,V]=u(!1),H=o(e=>{L.current=e,typeof _==`function`?_(e):_&&(_.current=e)},[_]);return s(()=>{z.current={onEventClick:j,onDateClick:M,onRangeChange:N}}),c(()=>{let e=L.current;if(!e)return;let t=C==null?``:JSON.stringify(C);t!==R.current&&(R.current=t,e.events=C??null)}),s(()=>{let e=L.current;if(!e)throw Error(`AppCalendar: the <wui-calendar> element is not mounted`);let t=[[p,e=>{if(!(e instanceof CustomEvent))throw Error(`${p} arrived without a detail`);let t=e.detail;z.current.onEventClick?.(t)===!1&&e.preventDefault()}],[m,e=>{if(!(e instanceof CustomEvent))throw Error(`${m} arrived without a detail`);let t=e.detail;z.current.onDateClick?.(t)}],[h,e=>{if(!(e instanceof CustomEvent))throw Error(`${h} arrived without a detail`);let t=e.detail;z.current.onRangeChange?.(t)}]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),s(()=>{let t=!0;return import(`@webority/ui-elements/calendar`).catch(n=>{e(`[AppCalendar] the calendar failed to load:`,n?.message),t&&V(!0)}),()=>{t=!1}},[]),B?/* @__PURE__ */ d(`div`,{...y,className:P||void 0,style:F,role:`status`,children:/* @__PURE__ */ d(`p`,{className:`wui-calendar-status-text`,children:O||x.loadFailedText})}):a(`wui-calendar`,{ref:H,label:S||void 0,"events-url":w||void 0,view:T||void 0,date:E||void 0,"empty-text":D||void 0,"error-text":O||void 0,"first-day":k==null?void 0:String(k),"time-zone":A||void 0,className:P||void 0,style:F,...y,...I})}export{_ as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{forwardRef as i,useCallback as te,useEffect as a,useLayoutEffect as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";import{CHART_TEXT as u}from"@webority/ui-elements/text";var d=(e,t)=>{if(!(e instanceof CustomEvent))throw Error(`${t} arrived without a CustomEvent`);return e.detail},f=`wui-chart:select`,p=`wui-chart:legend-change`,m=`wui-chart:ready`,h=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],ne=[`none`,`stacked`,`percent`],g=[`ready`,`loading`,`empty`,`error`],re=[`auto`,`svg`,`canvas`],ie=[`chart`,`table`],_=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},v=!1;function y(){!v&&_()&&(v=!0,e("[@webority/ui-react] <AppChart> has no `title`, which names the chart for assistive tech and its exported files."))}var b=e=>e===``?void 0:e,x=e=>Array.isArray(e)?e.map(x):e==null||Object.getPrototypeOf(e)!==Object.prototype?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``).map(([e,t])=>[e,x(t)])),S=e=>({type:b(e.type),title:b(e.title),description:b(e.description),data:e.data,x:x(e.x),series:x(e.series),group:x(e.group),to:x(e.to),size:x(e.size),trend:e.trend,zoom:e.zoom,bands:x(e.bands),stack:b(e.stack),y:x(e.y),target:x(e.target),centerLabel:b(e.centerLabel),sliceValues:e.sliceValues,valueLabels:b(e.valueLabels),height:e.height!==void 0&&e.height>0?e.height:void 0,state:b(e.state),emptyText:b(e.emptyText),errorText:b(e.errorText),loadingText:b(e.loadingText),renderer:b(e.renderer),timeZone:b(e.timeZone)}),ae=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),oe=e=>{try{return JSON.stringify(e)}catch{return null}},C=i(function(i,v){let{marker:b,props:x}=n(`AppChart`,i),C=t(`chart`,u),{type:w,title:T,description:se,data:ce,x:le,series:ue,group:de,to:E,size:D,trend:O,zoom:k,bands:A,stack:j,y:M,target:N,centerLabel:P,sliceValues:F,valueLabels:I,height:L,state:R,loading:z,error:B,emptyText:fe,errorText:V,loadingText:pe,renderer:H,timeZone:me,view:U,onSelect:W,onLegendChange:G,onReady:K,className:q=``,style:J,...Y}=x;ee(`AppChart`,Y),r(`AppChart`,`type`,w,h),r(`AppChart`,`stack`,j,ne),r(`AppChart`,`state`,R,g),r(`AppChart`,`renderer`,H,re),r(`AppChart`,`view`,U,ie),T||y();let X=!!B;_()&&z&&X&&e("[@webority/ui-react] <AppChart> takes `loading` or `error`, not both; `error` is shown.");let he=X?`error`:z?`loading`:R,ge=X?B:V,Z=s(null),Q=s({props:null,signature:null}),$=s({onSelect:W,onLegendChange:G,onReady:K}),[_e,ve]=c(!1),ye=te(e=>{Z.current=e,typeof v==`function`?v(e):v&&(v.current=e)},[v]);return a(()=>{$.current={onSelect:W,onLegendChange:G,onReady:K}}),o(()=>{let e=Z.current;if(!e)return;let t={type:w,title:T,description:se,data:ce,x:le,series:ue,group:de,to:E,size:D,trend:O,zoom:k,bands:A,stack:j,y:M,target:N,centerLabel:P,sliceValues:F,valueLabels:I,height:L,state:he,emptyText:fe,errorText:ge,loadingText:pe,renderer:H,timeZone:me};if(ae(t,Q.current.props))return;Q.current.props=t;let n=S(t),r=oe(n);(r===null||r!==Q.current.signature)&&(Q.current.signature=r,e.spec=n)}),a(()=>{let e=Z.current;if(!e)throw Error(`AppChart: the <wui-chart> element is not mounted`);let t=[[f,e=>$.current.onSelect?.(d(e,f))],[p,e=>$.current.onLegendChange?.(d(e,p))],[m,e=>$.current.onReady?.(d(e,m))]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),a(()=>{let t=!0;return import(`@webority/ui-elements/chart`).catch(n=>{e(`[AppChart] the chart failed to load:`,n?.message),t&&ve(!0)}),()=>{t=!1}},[]),_e?/* @__PURE__ */ l(`div`,{...b,className:q||void 0,style:J,role:`status`,children:/* @__PURE__ */ l(`p`,{className:`wui-chart-state-text`,children:V||C.errorText})}):/* @__PURE__ */ l(`wui-chart`,{ref:ye,view:U||void 0,className:q||void 0,style:J,...b,...Y})});export{C as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./assertValidValue.js";import ee from"./warnUnknownProps.js";import{useCallback as te,useEffect as i,useLayoutEffect as ne,useRef as a,useState as re}from"react";import{jsx as o}from"react/jsx-runtime";import{CHART_TEXT as s}from"@webority/ui-elements/text";var c=(e,t)=>{if(!(e instanceof CustomEvent))throw Error(`${t} arrived without a CustomEvent`);return e.detail},l=`wui-chart:select`,u=`wui-chart:legend-change`,d=`wui-chart:ready`,ie=[`line`,`area`,`column`,`bar`,`donut`,`heatmap`,`calendar`,`funnel`,`gauge`,`waterfall`,`treemap`,`sankey`,`scatter`,`bubble`,`multiples`],ae=[`none`,`stacked`,`percent`],f=[`ready`,`loading`,`empty`,`error`],p=[`auto`,`svg`,`canvas`],m=[`chart`,`table`],h=()=>{try{return process.env.NODE_ENV!==`production`}catch{return!0}},g=!1;function _(){!g&&h()&&(g=!0,e("[@webority/ui-react] <AppChart> has no `title`, which names the chart for assistive tech and its exported files."))}var v=e=>e===``?void 0:e,y=e=>Array.isArray(e)?e.map(y):e==null||Object.getPrototypeOf(e)!==Object.prototype?e:Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``).map(([e,t])=>[e,y(t)])),oe=e=>({type:v(e.type),title:v(e.title),description:v(e.description),data:e.data,x:y(e.x),series:y(e.series),group:y(e.group),to:y(e.to),size:y(e.size),trend:e.trend,zoom:e.zoom,bands:y(e.bands),stack:v(e.stack),y:y(e.y),target:y(e.target),centerLabel:v(e.centerLabel),sliceValues:e.sliceValues,valueLabels:v(e.valueLabels),height:e.height!==void 0&&e.height>0?e.height:void 0,state:v(e.state),emptyText:v(e.emptyText),errorText:v(e.errorText),loadingText:v(e.loadingText),renderer:v(e.renderer),timeZone:v(e.timeZone)}),se=(e,t)=>t!=null&&Object.keys(e).every(n=>Object.is(e[n],t[n])),ce=e=>{try{return JSON.stringify(e)}catch{return null}};function b({ref:g,...v}){let{marker:y,props:b}=n(`AppChart`,v),le=t(`chart`,s),{type:x,title:S,description:ue,data:de,x:fe,series:C,group:w,to:T,size:E,trend:D,zoom:O,bands:k,stack:A,y:j,target:M,centerLabel:N,sliceValues:P,valueLabels:F,height:I,state:L,loading:R,error:z,emptyText:B,errorText:V,loadingText:pe,renderer:H,timeZone:me,view:U,onSelect:W,onLegendChange:G,onReady:K,className:q=``,style:J,...Y}=b;ee(`AppChart`,Y),r(`AppChart`,`type`,x,ie),r(`AppChart`,`stack`,A,ae),r(`AppChart`,`state`,L,f),r(`AppChart`,`renderer`,H,p),r(`AppChart`,`view`,U,m),S||_();let X=!!z;h()&&R&&X&&e("[@webority/ui-react] <AppChart> takes `loading` or `error`, not both; `error` is shown.");let he=X?`error`:R?`loading`:L,ge=X?z:V,Z=a(null),Q=a({props:null,signature:null}),$=a({onSelect:W,onLegendChange:G,onReady:K}),[_e,ve]=re(!1),ye=te(e=>{Z.current=e,typeof g==`function`?g(e):g&&(g.current=e)},[g]);return i(()=>{$.current={onSelect:W,onLegendChange:G,onReady:K}}),ne(()=>{let e=Z.current;if(!e)return;let t={type:x,title:S,description:ue,data:de,x:fe,series:C,group:w,to:T,size:E,trend:D,zoom:O,bands:k,stack:A,y:j,target:M,centerLabel:N,sliceValues:P,valueLabels:F,height:I,state:he,emptyText:B,errorText:ge,loadingText:pe,renderer:H,timeZone:me};if(se(t,Q.current.props))return;Q.current.props=t;let n=oe(t),r=ce(n);(r===null||r!==Q.current.signature)&&(Q.current.signature=r,e.spec=n)}),i(()=>{let e=Z.current;if(!e)throw Error(`AppChart: the <wui-chart> element is not mounted`);let t=[[l,e=>$.current.onSelect?.(c(e,l))],[u,e=>$.current.onLegendChange?.(c(e,u))],[d,e=>$.current.onReady?.(c(e,d))]];for(let[n,r]of t)e.addEventListener(n,r);return()=>{for(let[n,r]of t)e.removeEventListener(n,r)}},[]),i(()=>{let t=!0;return import(`@webority/ui-elements/chart`).catch(n=>{e(`[AppChart] the chart failed to load:`,n?.message),t&&ve(!0)}),()=>{t=!1}},[]),_e?/* @__PURE__ */ o(`div`,{...y,className:q||void 0,style:J,role:`status`,children:/* @__PURE__ */ o(`p`,{className:`wui-chart-state-text`,children:V||le.errorText})}):/* @__PURE__ */ o(`wui-chart`,{ref:ye,view:U||void 0,className:q||void 0,style:J,...y,...Y})}export{b as default};
@@ -1 +1 @@
1
- import e from"../lib/CheckField.js";import{BOX_SIZES as t}from"../lib/fieldState.js";import n from"../lib/labelWithHelp.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{forwardRef as s}from"react";import{jsx as c}from"react/jsx-runtime";import{CHECKBOX_TEXT as l}from"@webority/ui-elements/text";var u=[`circle`];function d(e,t){if(t!=null&&t!==``)throw Error(`<AppCheckbox> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}var f=s(function(s,f){let{marker:p,props:m}=i(`AppCheckbox`,s),h=r(`checkbox`,l),{label:g,id:_,name:v,error:y,helperText:b,shape:x,help:S,helpLabel:C=h.helpLabel,readOnly:w=!1,loading:T=!1,size:E=`md`,controlOnly:D=!1,className:O=``,...k}=m;if(o(`AppCheckbox`,k),D&&(d(`label`,g),d(`error`,y),d(`helperText`,b),E!==`md`))throw Error(`<AppCheckbox> controlOnly draws no field, so it takes no size; draw the label or message on the page.`);a(`AppCheckbox`,`shape`,x,u),a(`AppCheckbox`,`size`,E,t);let A=x===`circle`?`form-check form-check-circle`:`form-check`;return/* @__PURE__ */ c(e,{rootProps:p,ref:f,label:n(g,S,C),id:_,name:v,error:y,hint:b,className:O,rest:k,inputType:`checkbox`,wrapperClass:A,readOnly:w,loading:T,size:E,controlOnly:D})});export{f as default};
1
+ import e from"../lib/CheckField.js";import{BOX_SIZES as t}from"../lib/fieldState.js";import n from"../lib/labelWithHelp.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./assertValidValue.js";import o from"./warnUnknownProps.js";import{jsx as s}from"react/jsx-runtime";import{CHECKBOX_TEXT as c}from"@webority/ui-elements/text";var l=[`circle`];function u(e,t){if(t!=null&&t!==``)throw Error(`<AppCheckbox> controlOnly draws no field, so it takes no ${e}; draw the label or message on the page.`)}function d({ref:d,...f}){let{marker:p,props:m}=i(`AppCheckbox`,f),h=r(`checkbox`,c),{label:g,id:_,name:v,error:y,helperText:b,shape:x,help:S,helpLabel:C=h.helpLabel,readOnly:w=!1,loading:T=!1,size:E=`md`,controlOnly:D=!1,className:O=``,...k}=m;if(o(`AppCheckbox`,k),D&&(u(`label`,g),u(`error`,y),u(`helperText`,b),E!==`md`))throw Error(`<AppCheckbox> controlOnly draws no field, so it takes no size; draw the label or message on the page.`);a(`AppCheckbox`,`shape`,x,l),a(`AppCheckbox`,`size`,E,t);let A=x===`circle`?`form-check form-check-circle`:`form-check`;return/* @__PURE__ */ s(e,{rootProps:p,ref:d,label:n(g,S,C),id:_,name:v,error:y,hint:b,className:O,rest:k,inputType:`checkbox`,wrapperClass:A,readOnly:w,loading:T,size:E,controlOnly:D})}export{d as default};
@@ -1 +1 @@
1
- import e from"../lib/useWuiText.js";import{TONES as t}from"../lib/vocabulary.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";import{CHIP_TEXT as l,fillText as u}from"@webority/ui-elements/text";var d=[`soft`,`outline`,`solid`],f=[`sm`,`md`];function p(p){let{marker:m,props:h}=n(`AppChip`,p),g=e(`chip`,l),{label:_,children:v,tone:y=`neutral`,variant:b=`soft`,size:x=`md`,leadingIcon:S,avatar:C,onRemove:w,onClick:T,selected:E,count:D,disabled:O=!1,removeLabel:k,className:A=``,...j}=h;if(a(`AppChip`,j),i(`AppChip`,`tone`,y,t),i(`AppChip`,`variant`,b,d),i(`AppChip`,`size`,x,f),E!=null&&!T)throw RangeError(`[@webority/ui-react] <AppChip> received selected without onClick. Only a clickable chip can be the chosen filter: pass onClick, or omit selected.`);let M=_??v,N=D==null?null:/* @__PURE__ */ s(`span`,{className:`wui-chip-count`,children:D}),P={},F={};for(let[e,t]of Object.entries(j))T&&(e.startsWith(`aria-`)||e.startsWith(`data-`))?P[e]=t:F[e]=t;let I=[`chip`,y&&y!==`neutral`?y:``,b===`outline`?`chip-outline`:b===`solid`?`chip-solid`:``,x===`sm`?`chip-sm`:``,T?`chip-clickable`:``,w?`chip-removable`:``,O?`is-disabled`:``,A].filter(Boolean).join(` `),L=C?/* @__PURE__ */ s(`span`,{className:`chip-avatar`,children:typeof C==`string`?/* @__PURE__ */ s(`img`,{src:C,alt:``}):C}):S?/* @__PURE__ */ s(`span`,{className:`chip-ic`,children:/* @__PURE__ */ s(r,{name:S,size:x===`sm`?12:14})}):null,R=T?/* @__PURE__ */ c(`button`,{type:`button`,className:`chip-body`,"aria-pressed":E??void 0,...P,onClick:T,disabled:O,children:[L,/* @__PURE__ */ s(`span`,{className:`chip-label`,children:M}),N]}):/* @__PURE__ */ c(o,{children:[L,/* @__PURE__ */ s(`span`,{className:`chip-label`,children:M}),N]});return/* @__PURE__ */ c(`span`,{className:I,...m,...F,children:[R,w&&/* @__PURE__ */ s(`button`,{type:`button`,className:`chip-remove`,onClick:w,disabled:O,"aria-label":k||(typeof M==`string`?u(g.removeText,{content:M}):g.removeLabel),children:/* @__PURE__ */ s(r,{name:`x`,size:x===`sm`?12:14})})]})}export{p as default};
1
+ import e from"../lib/useWuiText.js";import{TONES as t}from"../lib/vocabulary.js";import{splitMarkerProps as n}from"../lib/wuiMarker.js";import r from"./AppIcon.js";import i from"./assertValidValue.js";import a from"./warnUnknownProps.js";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";import{CHIP_TEXT as l,fillText as u}from"@webority/ui-elements/text";var d=[`soft`,`outline`,`solid`],f=[`sm`,`md`];function p(p){let{marker:m,props:h}=n(`AppChip`,p),g=e(`chip`,l),{label:_,children:v,tone:y=`neutral`,variant:b=`soft`,size:x=`md`,leadingIcon:S,avatar:C,onRemove:w,onClick:T,selected:E,count:D,disabled:O=!1,removeLabel:k,className:A=``,...j}=h;if(a(`AppChip`,j),i(`AppChip`,`tone`,y,t),i(`AppChip`,`variant`,b,d),i(`AppChip`,`size`,x,f),E!=null&&!T)throw RangeError(`[@webority/ui-react] <AppChip> received selected without onClick. Only a clickable chip can be the chosen filter: pass onClick, or omit selected.`);let M=_??v,N=D==null?null:/* @__PURE__ */ s(`span`,{className:`wui-chip-count`,children:D}),P={},F={};for(let[e,t]of Object.entries(j))T&&(e.startsWith(`aria-`)||e.startsWith(`data-`))?P[e]=t:F[e]=t;let I=[`chip`,y&&y!==`neutral`?y:``,b===`outline`?`chip-outline`:b===`solid`?`chip-solid`:``,x===`sm`?`chip-sm`:``,T?`chip-clickable`:``,w?`chip-removable`:``,O?`is-disabled`:``,A].filter(Boolean).join(` `),L=C?/* @__PURE__ */ s(`span`,{className:`chip-avatar`,children:typeof C==`string`?/* @__PURE__ */ s(`img`,{src:C,alt:``,width:18,height:18}):C}):S?/* @__PURE__ */ s(`span`,{className:`chip-ic`,children:/* @__PURE__ */ s(r,{name:S,size:x===`sm`?12:14})}):null,R=T?/* @__PURE__ */ c(`button`,{type:`button`,className:`chip-body`,"aria-pressed":E??void 0,...P,onClick:T,disabled:O,children:[L,/* @__PURE__ */ s(`span`,{className:`chip-label`,children:M}),N]}):/* @__PURE__ */ c(o,{children:[L,/* @__PURE__ */ s(`span`,{className:`chip-label`,children:M}),N]});return/* @__PURE__ */ c(`span`,{className:I,...m,...F,children:[R,w&&/* @__PURE__ */ s(`button`,{type:`button`,className:`chip-remove`,onClick:w,disabled:O,"aria-label":k||(typeof M==`string`?u(g.removeText,{content:M}):g.removeLabel),children:/* @__PURE__ */ s(r,{name:`x`,size:x===`sm`?12:14})})]})}export{p as default};
@@ -1 +1 @@
1
- import{FIELD_BUSY_CLASS as e,blockWhenReadOnly as t}from"../lib/fieldState.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./AppInfoTip.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{CHOICE_CARD_TEXT as d}from"@webority/ui-elements/text";var f={sm:` wui-struct-card-sm`,md:``,lg:` wui-struct-card-lg`},p={inline:``,stacked:` wui-struct-card-stacked`},m={filled:` wui-struct-card-filled`},h={sm:16,md:18,lg:22};function g(g){let{marker:_,props:v}=r(`AppChoiceCard`,g),y=n(`choiceCard`,d),{name:b,multiple:x=!1,value:S,checked:C,onChange:w,icon:T,iconNode:E,iconSize:D,image:O,imageAlt:k=``,children:A,title:j,description:M,help:N,helpLabel:P=y.helpLabel,checkIcon:F=`check`,checkSize:I=18,hideCheck:L=!1,disabled:R=!1,readOnly:z=!1,loading:B=!1,size:V=`md`,layout:H=`inline`,selectedStyle:U,className:W=``,...G}=v;s(`AppChoiceCard`,G),o(`AppChoiceCard`,`size`,V,Object.keys(f)),o(`AppChoiceCard`,`layout`,H,Object.keys(p)),o(`AppChoiceCard`,`selectedStyle`,U,Object.keys(m));let K=f[V]??``,q=p[H]??``,J=U?m[U]??``:``,Y=D??h[V]??h.md;return/* @__PURE__ */ u(`label`,{className:`struct-card${O?` struct-card-img-card`:``}${K}${q}${J}${L?` wui-struct-card-no-check`:``}${W?` ${W}`:``}${B?` ${e}`:``}`,"aria-disabled":R||void 0,"aria-busy":B||void 0,..._,...G,children:[/* @__PURE__ */ l(`input`,{type:x?`checkbox`:`radio`,name:b,value:S,className:`struct-card-input`,checked:C,onChange:w,onClick:t(z||B),"aria-readonly":z||void 0,disabled:R||B}),O?/* @__PURE__ */ l(`span`,{className:`struct-card-media`,children:/* @__PURE__ */ l(`img`,{className:`struct-card-img`,src:O,alt:k})}):E||T?/* @__PURE__ */ l(`span`,{className:`struct-card-ic`,children:E||T&&/* @__PURE__ */ u(c,{children:[/* @__PURE__ */ l(`span`,{className:`wui-struct-card-glyph`,children:/* @__PURE__ */ l(i,{name:T,size:Y})}),/* @__PURE__ */ l(`span`,{className:`wui-struct-card-glyph-on`,children:/* @__PURE__ */ l(i,{name:T,size:Y,variant:`bold`})})]})}):null,/* @__PURE__ */ u(`span`,{className:`struct-card-body`,children:[A||/* @__PURE__ */ u(c,{children:[j&&/* @__PURE__ */ l(`span`,{className:`struct-card-title`,children:j}),M&&/* @__PURE__ */ l(`span`,{className:`struct-card-desc`,children:M})]}),N&&/* @__PURE__ */ l(a,{label:P,children:N})]}),!L&&/* @__PURE__ */ l(`span`,{className:`struct-card-check`,children:/* @__PURE__ */ l(i,{name:F,size:I})})]})}export{g as default};
1
+ import{FIELD_BUSY_CLASS as e,blockWhenReadOnly as t}from"../lib/fieldState.js";import n from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppIcon.js";import a from"./AppInfoTip.js";import o from"./assertValidValue.js";import s from"./warnUnknownProps.js";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{CHOICE_CARD_TEXT as d}from"@webority/ui-elements/text";var f={sm:` wui-struct-card-sm`,md:``,lg:` wui-struct-card-lg`},p={inline:``,stacked:` wui-struct-card-stacked`},m={filled:` wui-struct-card-filled`},h={sm:16,md:18,lg:22};function g(g){let{marker:_,props:v}=r(`AppChoiceCard`,g),y=n(`choiceCard`,d),{name:b,multiple:x=!1,value:S,checked:C,onChange:w,icon:T,iconNode:E,iconSize:D,image:O,imageAlt:k=``,imageWidth:A,imageHeight:j,children:M,title:N,description:P,help:F,helpLabel:I=y.helpLabel,checkIcon:L=`check`,checkSize:R=18,hideCheck:z=!1,disabled:B=!1,readOnly:V=!1,loading:H=!1,size:U=`md`,layout:W=`inline`,selectedStyle:G,className:K=``,...q}=v;s(`AppChoiceCard`,q),o(`AppChoiceCard`,`size`,U,Object.keys(f)),o(`AppChoiceCard`,`layout`,W,Object.keys(p)),o(`AppChoiceCard`,`selectedStyle`,G,Object.keys(m));let J=f[U]??``,Y=p[W]??``,X=G?m[G]??``:``,Z=D??h[U]??h.md;return/* @__PURE__ */ u(`label`,{className:`struct-card${O?` struct-card-img-card`:``}${J}${Y}${X}${z?` wui-struct-card-no-check`:``}${K?` ${K}`:``}${H?` ${e}`:``}`,"aria-disabled":B||void 0,"aria-busy":H||void 0,..._,...q,children:[/* @__PURE__ */ l(`input`,{type:x?`checkbox`:`radio`,name:b,value:S,className:`struct-card-input`,checked:C,onChange:w,onClick:t(V||H),"aria-readonly":V||void 0,disabled:B||H}),O?/* @__PURE__ */ l(`span`,{className:`struct-card-media`,children:/* @__PURE__ */ l(`img`,{className:`struct-card-img`,src:O,alt:k,width:A,height:j})}):E||T?/* @__PURE__ */ l(`span`,{className:`struct-card-ic`,children:E||T&&/* @__PURE__ */ u(c,{children:[/* @__PURE__ */ l(`span`,{className:`wui-struct-card-glyph`,children:/* @__PURE__ */ l(i,{name:T,size:Z})}),/* @__PURE__ */ l(`span`,{className:`wui-struct-card-glyph-on`,children:/* @__PURE__ */ l(i,{name:T,size:Z,variant:`bold`})})]})}):null,/* @__PURE__ */ u(`span`,{className:`struct-card-body`,children:[M||/* @__PURE__ */ u(c,{children:[N&&/* @__PURE__ */ l(`span`,{className:`struct-card-title`,children:N}),P&&/* @__PURE__ */ l(`span`,{className:`struct-card-desc`,children:P})]}),F&&/* @__PURE__ */ l(a,{label:I,children:F})]}),!z&&/* @__PURE__ */ l(`span`,{className:`struct-card-check`,children:/* @__PURE__ */ l(i,{name:L,size:R})})]})}export{g as default};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{FILL_VARIANTS as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAvatar.js";import s from"./AppBadge.js";import c from"./AppButton.js";import l from"./AppIcon.js";import u from"./AppMarkdown.js";import d from"./assertValidValue.js";import f from"./warnUnknownProps.js";import{COMMENT_REACTIONS as p,formatDateTime as m,formatFileSize as h,formatNumber as g,initialsOf as _,mentionTextFromValue as v,parseMentionValue as y,toInstant as b}from"@webority/ui-elements/helpers";import{Fragment as x,useEffect as S,useId as C,useRef as w}from"react";import{jsx as T,jsxs as E}from"react/jsx-runtime";import{COMMENT_THREAD_TEXT as D,fillText as O}from"@webority/ui-elements/text";var k=[`stacked`,`inline`],A=[`list`,`conversation`],j=()=>import(`@webority/ui-elements/elements/comment-thread`),M=()=>import(`@webority/ui-elements/elements/mention-input`),N=e=>y(e??``).map((e,t)=>({key:`segment-${t}`,seg:e})),P=e=>e.localName===`wui-mention-input`;function F(e){let{marker:t,props:s}=a(`AppCommentThread`,e),l=r(`commentThread`,D),{comments:u=[],onPost:m,onReply:h,onEdit:g,onDelete:_,onReact:v,people:y,loadPeople:b,reactionChoices:x,allowReplies:O=!0,allowReactions:N=!0,composerPlaceholder:F,variant:L=`list`,composer:R=`stacked`,author:z,postLabel:B=l.postLabel,postVariant:V,composerRows:H,readOnly:U=!1,markdown:W=!1,linkComponent:G,label:K=l.label,internalLabel:ee=l.internalLabel,attachmentsLabel:te=l.attachmentsLabel,composerLabel:ne=l.composerLabel,noCommentsText:re=l.noCommentsText,reactionsLabel:ie=l.reactionsLabel,repliesToLabel:ae=l.repliesToLabel,editedLabel:oe=l.editedLabel,deletedText:se=l.deletedText,replyLabel:ce=l.replyLabel,editLabel:le=l.editLabel,deleteLabel:ue=l.deleteLabel,deleteConfirmText:de=l.deleteConfirmText,cancelLabel:fe=l.cancelLabel,addReactionLabel:pe=l.addReactionLabel,chooseReactionLabel:me=l.chooseReactionLabel,peopleLabel:he=l.peopleLabel,id:ge,className:_e=``,...q}=s;f(`AppCommentThread`,q),d(`AppCommentThread`,`variant`,L,A),d(`AppCommentThread`,`composer`,R,k),V!==void 0&&d(`AppCommentThread`,`postVariant`,V,i);let J=n(`wui-comment-thread`,j);n(`wui-mention-input`,M);let ve=C(),Y=ge||`comment-thread-${ve.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=w(null),Z=typeof b==`function`,ye=x?.length?x:p,Q=R===`inline`,be=H??(Q?1:3),xe={reactionsLabel:ie,repliesToLabel:ae,editedLabel:oe,deletedText:se,replyLabel:ce,editLabel:le,deleteLabel:ue,deleteConfirmText:de,cancelLabel:fe,addReactionLabel:pe},$=w({onPost:m,onReply:h,onEdit:g,onDelete:_,onReact:v,loadPeople:b});return $.current={onPost:m,onReply:h,onEdit:g,onDelete:_,onReact:v,loadPeople:b},S(()=>{let e=X.current;if(e&&J)return e.submit=async e=>{let t=$.current;e.intent===`post`?await t.onPost?.(e.body):e.intent===`reply`?await t.onReply?.(e.parentId,e.body):e.intent===`edit`?await t.onEdit?.(e.commentId,e.body):e.intent===`delete`?await t.onDelete?.(e.commentId):e.intent===`react`&&await t.onReact?.(e.commentId,e.emoji)},()=>{e.submit=void 0}},[J]),S(()=>{let e=X.current;e&&J&&!Z&&(e.people=y||[])},[y,Z,J]),S(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target;if(!(e instanceof CustomEvent)||!(n instanceof HTMLElement)||!P(n))throw TypeError(`<wui-comment-thread> search came from something other than a mention box.`);let r=e.detail;if(typeof r!=`object`||!r||!(`query`in r)||typeof r.query!=`string`)throw TypeError(`<wui-comment-thread> search carried no query.`);let i=r.query,{loadPeople:a}=$.current;if(typeof a!=`function`)throw Error(`<AppCommentThread> is remote but has no loadPeople.`);let o=(t.get(n)??0)+1;t.set(n,o),n.loading=!0;try{let e=await a(i);t.get(n)===o&&(n.people=e||[])}catch(e){t.get(n)===o&&(n.people=[],n.searchFailed=!0,reportError(e))}finally{t.get(n)===o&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ E(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,L===`conversation`&&`wui-comment-thread--conversation`,_e].filter(Boolean).join(` `),controlled:``,"read-only":U?``:void 0,remote:Z?``:void 0,"reaction-choices":x?.length?x.join(` `):void 0,"no-replies":O?void 0:``,"no-reactions":N?void 0:``,"composer-placeholder":F,...t,...q,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:u.length?/* @__PURE__ */ T(`ol`,{className:`wui-comment-list`,"aria-label":K,children:u.map(e=>/* @__PURE__ */ T(I,{comment:e,topLevel:!0,readOnly:U,allowReplies:O,allowReactions:N,markdown:W,linkComponent:G,internalLabel:ee,attachmentsLabel:te,text:xe},e.id))}):/* @__PURE__ */ T(`p`,{className:`wui-comment-empty`,children:re})}),!U&&N&&/* @__PURE__ */ T(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":me,"data-wui-picker":``,popover:`auto`,children:ye.map(e=>/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!U&&/* @__PURE__ */ E(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&z?/* @__PURE__ */ T(o,{name:z,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ T(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:ne,"people-label":he,placeholder:F??l.composerPlaceholder,rows:String(be),remote:Z?``:void 0}),/* @__PURE__ */ T(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ T(c,{variant:V??(Q?`outline`:`soft`),size:`sm`,"data-wui-action":`post`,children:B})}),/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ T(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function I({comment:n,topLevel:r=!1,readOnly:i,allowReplies:a,allowReactions:o,markdown:d,linkComponent:f,internalLabel:p,attachmentsLabel:y,text:S}){let{id:C,author:w,at:D,value:k,edited:A,mine:j,internal:M,attachments:P=[],deleted:F,canEdit:L,canDelete:R,reactions:z=[],replies:B=[]}=n,V=w?.name||``,H=b(D),U=!i&&!F&&L,W=!i&&!F&&R,G=r&&a,K=[`wui-comment`,M&&`wui-comment--internal`,j&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ E(`li`,{className:K,"data-wui-comment":C,"data-value":k??``,"data-wui-deleted":F?``:void 0,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ E(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ T(`span`,{className:`avatar-face`,children:_(V)||`?`}),w?.src&&/* @__PURE__ */ T(`img`,{className:`avatar-img`,src:w.src,alt:``,onError:e=>{e.currentTarget.hidden=!0}})]}),/* @__PURE__ */ E(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-author`,children:V}),/* @__PURE__ */ T(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(H)?new Date(H).toISOString():void 0,children:m(D)}),A&&!F&&/* @__PURE__ */ T(`span`,{className:`wui-comment-edited`,children:S.editedLabel}),M&&/* @__PURE__ */ T(s,{className:`wui-comment-internal-badge`,children:p})]}),F?/* @__PURE__ */ T(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:S.deletedText}):/* @__PURE__ */ T(`div`,{className:d?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:d?/* @__PURE__ */ T(u,{value:v(k??``).text,headings:`text`}):N(k).map(({key:e,seg:t})=>`text`in t?/* @__PURE__ */ T(x,{children:t.text},e):/* @__PURE__ */ E(`span`,{className:`wui-mention`,"data-mention-id":t.id,children:[`@`,t.label]},e))}),!F&&P.length>0&&/* @__PURE__ */ T(`ul`,{className:`wui-comment-attachments`,"aria-label":y,children:P.map(n=>{let r=e(f,{to:n.to,href:n.href,routeHref:!1});return/* @__PURE__ */ E(`li`,{children:[/* @__PURE__ */ E(t,{link:r,className:`wui-comment-attachment`,...n.to?{}:{download:!0},children:[/* @__PURE__ */ T(l,{name:`paperclip`,size:14}),n.name]}),typeof n.sizeBytes==`number`&&/* @__PURE__ */ T(`span`,{className:`wui-comment-attachment-size`,children:h(n.sizeBytes)})]},n.to??n.href)})}),U&&/* @__PURE__ */ T(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),o&&!F&&(z.length>0||!i)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":S.reactionsLabel,children:[z.map(e=>i?/* @__PURE__ */ E(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:g(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ E(`button`,{type:`button`,className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,"data-wui-emoji":e.emoji,"aria-pressed":e.mine?`true`:`false`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:g(e.count,{decimals:0})})]},e.emoji)),!i&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":S.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ T(l,{name:`emoji-smile`,size:16})})]}),!i&&!F&&(G||U||W)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[G&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:S.replyLabel}),U&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:S.editLabel}),W&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:S.deleteLabel})]}),W&&/* @__PURE__ */ E(`div`,{className:`wui-comment-confirm`,"data-wui-comment-confirm":``,hidden:!0,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-confirm-text`,children:S.deleteConfirmText}),/* @__PURE__ */ T(c,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:S.deleteLabel}),/* @__PURE__ */ T(c,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:S.cancelLabel})]}),!i&&/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),r&&B.length>0&&/* @__PURE__ */ T(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":O(S.repliesToLabel,{name:V}),children:B.map(e=>/* @__PURE__ */ T(I,{comment:e,readOnly:i,allowReactions:o,markdown:d,linkComponent:f,internalLabel:p,attachmentsLabel:y,text:S},e.id))}),G&&!i&&!F&&/* @__PURE__ */ T(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{F as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{TargetLink as t}from"../lib/TargetLink.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{FILL_VARIANTS as i}from"../lib/vocabulary.js";import{splitMarkerProps as a}from"../lib/wuiMarker.js";import o from"./AppAvatar.js";import s from"./AppBadge.js";import c from"./AppButton.js";import l from"./AppIcon.js";import u from"./AppMarkdown.js";import d from"./assertValidValue.js";import f from"./warnUnknownProps.js";import{COMMENT_REACTIONS as p,formatDateTime as m,formatFileSize as h,formatNumber as g,initialsOf as _,mentionTextFromValue as v,parseMentionValue as y,toInstant as b}from"@webority/ui-elements/helpers";import{Fragment as x,useEffect as S,useId as C,useRef as w}from"react";import{jsx as T,jsxs as E}from"react/jsx-runtime";import{COMMENT_THREAD_TEXT as D,fillText as O}from"@webority/ui-elements/text";var k=[`stacked`,`inline`],A=[`list`,`conversation`],j=()=>import(`@webority/ui-elements/elements/comment-thread`),M=()=>import(`@webority/ui-elements/elements/mention-input`),N=24,P=e=>y(e??``).map((e,t)=>({key:`segment-${t}`,seg:e})),F=e=>e.localName===`wui-mention-input`;function I(e){let{marker:t,props:s}=a(`AppCommentThread`,e),l=r(`commentThread`,D),{comments:u=[],onPost:m,onReply:h,onEdit:g,onDelete:_,onReact:v,people:y,loadPeople:b,reactionChoices:x,allowReplies:O=!0,allowReactions:N=!0,composerPlaceholder:P,variant:I=`list`,composer:L=`stacked`,author:R,postLabel:z=l.postLabel,postVariant:B,composerRows:V,readOnly:H=!1,markdown:U=!1,linkComponent:W,label:G=l.label,internalLabel:K=l.internalLabel,attachmentsLabel:te=l.attachmentsLabel,composerLabel:ne=l.composerLabel,noCommentsText:re=l.noCommentsText,reactionsLabel:ie=l.reactionsLabel,repliesToLabel:ae=l.repliesToLabel,editedLabel:oe=l.editedLabel,deletedText:se=l.deletedText,replyLabel:ce=l.replyLabel,editLabel:le=l.editLabel,deleteLabel:ue=l.deleteLabel,deleteConfirmText:de=l.deleteConfirmText,cancelLabel:fe=l.cancelLabel,addReactionLabel:pe=l.addReactionLabel,chooseReactionLabel:me=l.chooseReactionLabel,peopleLabel:he=l.peopleLabel,id:ge,className:_e=``,...q}=s;f(`AppCommentThread`,q),d(`AppCommentThread`,`variant`,I,A),d(`AppCommentThread`,`composer`,L,k),B!==void 0&&d(`AppCommentThread`,`postVariant`,B,i);let J=n(`wui-comment-thread`,j);n(`wui-mention-input`,M);let ve=C(),Y=ge||`comment-thread-${ve.replace(/[^a-zA-Z0-9_-]/g,``)}`,X=w(null),Z=typeof b==`function`,ye=x?.length?x:p,Q=L===`inline`,be=V??(Q?1:3),xe={reactionsLabel:ie,repliesToLabel:ae,editedLabel:oe,deletedText:se,replyLabel:ce,editLabel:le,deleteLabel:ue,deleteConfirmText:de,cancelLabel:fe,addReactionLabel:pe},$=w({onPost:m,onReply:h,onEdit:g,onDelete:_,onReact:v,loadPeople:b});return $.current={onPost:m,onReply:h,onEdit:g,onDelete:_,onReact:v,loadPeople:b},S(()=>{let e=X.current;if(e&&J)return e.submit=async e=>{let t=$.current;e.intent===`post`?await t.onPost?.(e.body):e.intent===`reply`?await t.onReply?.(e.parentId,e.body):e.intent===`edit`?await t.onEdit?.(e.commentId,e.body):e.intent===`delete`?await t.onDelete?.(e.commentId):e.intent===`react`&&await t.onReact?.(e.commentId,e.emoji)},()=>{e.submit=void 0}},[J]),S(()=>{let e=X.current;e&&J&&!Z&&(e.people=y||[])},[y,Z,J]),S(()=>{let e=X.current;if(!e||!Z)return;let t=/* @__PURE__ */ new WeakMap,n=async e=>{let n=e.target;if(!(e instanceof CustomEvent)||!(n instanceof HTMLElement)||!F(n))throw TypeError(`<wui-comment-thread> search came from something other than a mention box.`);let r=e.detail;if(typeof r!=`object`||!r||!(`query`in r)||typeof r.query!=`string`)throw TypeError(`<wui-comment-thread> search carried no query.`);let i=r.query,{loadPeople:a}=$.current;if(typeof a!=`function`)throw Error(`<AppCommentThread> is remote but has no loadPeople.`);let o=(t.get(n)??0)+1;t.set(n,o),n.loading=!0;try{let e=await a(i);t.get(n)===o&&(n.people=e||[])}catch(e){t.get(n)===o&&(n.people=[],n.searchFailed=!0,reportError(e))}finally{t.get(n)===o&&(n.loading=!1)}};return e.addEventListener(`search`,n),()=>e.removeEventListener(`search`,n)},[Z]),/* @__PURE__ */ E(`wui-comment-thread`,{ref:X,id:Y,class:[`wui-comment-thread`,I===`conversation`&&`wui-comment-thread--conversation`,_e].filter(Boolean).join(` `),controlled:``,"read-only":H?``:void 0,remote:Z?``:void 0,"reaction-choices":x?.length?x.join(` `):void 0,"no-replies":O?void 0:``,"no-reactions":N?void 0:``,"composer-placeholder":P,...t,...q,children:[/* @__PURE__ */ T(`div`,{className:`wui-comment-items`,"data-wui-items":``,children:u.length?/* @__PURE__ */ T(`ol`,{className:`wui-comment-list`,"aria-label":G,children:u.map(e=>/* @__PURE__ */ T(ee,{comment:e,topLevel:!0,readOnly:H,allowReplies:O,allowReactions:N,markdown:U,linkComponent:W,internalLabel:K,attachmentsLabel:te,text:xe},e.id))}):/* @__PURE__ */ T(`p`,{className:`wui-comment-empty`,children:re})}),!H&&N&&/* @__PURE__ */ T(`div`,{className:`wui-reaction-picker`,role:`group`,"aria-label":me,"data-wui-picker":``,popover:`auto`,children:ye.map(e=>/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-choice`,"data-wui-emoji":e,children:e},e))}),!H&&/* @__PURE__ */ E(`div`,{className:Q?`wui-comment-composer wui-comment-composer-inline`:`wui-comment-composer`,"data-wui-composer":``,children:[Q&&R?/* @__PURE__ */ T(o,{name:R,size:`sm`,tone:`auto`,className:`wui-comment-composer-avatar`}):null,/* @__PURE__ */ T(`wui-mention-input`,{id:`${Y}-new`,class:`wui-mention-input`,label:ne,"people-label":he,placeholder:P??l.composerPlaceholder,rows:String(be),remote:Z?``:void 0}),/* @__PURE__ */ T(`div`,{className:`wui-comment-form-actions`,children:/* @__PURE__ */ T(c,{variant:B??(Q?`outline`:`soft`),size:`sm`,"data-wui-action":`post`,children:z})}),/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]}),/* @__PURE__ */ T(`span`,{className:`visually-hidden`,"data-wui-live":``,"aria-live":`polite`,"aria-atomic":`true`})]})}function ee({comment:n,topLevel:r=!1,readOnly:i,allowReplies:a,allowReactions:o,markdown:d,linkComponent:f,internalLabel:p,attachmentsLabel:y,text:S}){let{id:C,author:w,at:D,value:k,edited:A,mine:j,internal:M,attachments:F=[],deleted:I,canEdit:L,canDelete:R,reactions:z=[],replies:B=[]}=n,V=w?.name||``,H=b(D),U=!i&&!I&&L,W=!i&&!I&&R,G=r&&a,K=[`wui-comment`,M&&`wui-comment--internal`,j&&`wui-comment--mine`].filter(Boolean).join(` `);return/* @__PURE__ */ E(`li`,{className:K,"data-wui-comment":C,"data-value":k??``,"data-wui-deleted":I?``:void 0,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-row`,children:[/* @__PURE__ */ E(`span`,{className:`avatar avatar-sm wui-comment-avatar`,"aria-hidden":`true`,children:[/* @__PURE__ */ T(`span`,{className:`avatar-face`,children:_(V)||`?`}),w?.src&&/* @__PURE__ */ T(`img`,{className:`avatar-img`,src:w.src,alt:``,onError:e=>{e.currentTarget.hidden=!0},width:N,height:N})]}),/* @__PURE__ */ E(`div`,{className:`wui-comment-main`,children:[/* @__PURE__ */ E(`div`,{className:`wui-comment-head`,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-author`,children:V}),/* @__PURE__ */ T(`time`,{className:`wui-comment-time`,dateTime:Number.isFinite(H)?new Date(H).toISOString():void 0,children:m(D)}),A&&!I&&/* @__PURE__ */ T(`span`,{className:`wui-comment-edited`,children:S.editedLabel}),M&&/* @__PURE__ */ T(s,{className:`wui-comment-internal-badge`,children:p})]}),I?/* @__PURE__ */ T(`div`,{className:`wui-comment-text wui-comment-text-deleted`,children:S.deletedText}):/* @__PURE__ */ T(`div`,{className:d?`wui-comment-text wui-comment-text--markdown`:`wui-comment-text`,"data-wui-text":``,children:d?/* @__PURE__ */ T(u,{value:v(k??``).text,headings:`text`}):P(k).map(({key:e,seg:t})=>`text`in t?/* @__PURE__ */ T(x,{children:t.text},e):/* @__PURE__ */ E(`span`,{className:`wui-mention`,"data-mention-id":t.id,children:[`@`,t.label]},e))}),!I&&F.length>0&&/* @__PURE__ */ T(`ul`,{className:`wui-comment-attachments`,"aria-label":y,children:F.map(n=>{let r=e(f,{to:n.to,href:n.href,routeHref:!1});return/* @__PURE__ */ E(`li`,{children:[/* @__PURE__ */ E(t,{link:r,className:`wui-comment-attachment`,...n.to?{}:{download:!0},children:[/* @__PURE__ */ T(l,{name:`paperclip`,size:14}),n.name]}),typeof n.sizeBytes==`number`&&/* @__PURE__ */ T(`span`,{className:`wui-comment-attachment-size`,children:h(n.sizeBytes)})]},n.to??n.href)})}),U&&/* @__PURE__ */ T(`div`,{className:`wui-comment-editor`,"data-wui-editor":``,hidden:!0}),o&&!I&&(z.length>0||!i)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-reactions`,role:`group`,"aria-label":S.reactionsLabel,children:[z.map(e=>i?/* @__PURE__ */ E(`span`,{className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:g(e.count,{decimals:0})})]},e.emoji):/* @__PURE__ */ E(`button`,{type:`button`,className:e.mine?`wui-reaction wui-reaction-mine`:`wui-reaction`,"data-wui-emoji":e.emoji,"aria-pressed":e.mine?`true`:`false`,children:[/* @__PURE__ */ T(`span`,{className:`wui-reaction-emoji`,children:e.emoji}),/* @__PURE__ */ T(`span`,{className:`wui-reaction-count`,children:g(e.count,{decimals:0})})]},e.emoji)),!i&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-reaction-add`,"data-wui-action":`react-menu`,"aria-label":S.addReactionLabel,"aria-haspopup":`true`,"aria-expanded":`false`,children:/* @__PURE__ */ T(l,{name:`emoji-smile`,size:16})})]}),!i&&!I&&(G||U||W)&&/* @__PURE__ */ E(`div`,{className:`wui-comment-actions`,"data-wui-actions":``,children:[G&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`reply`,children:S.replyLabel}),U&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`edit`,children:S.editLabel}),W&&/* @__PURE__ */ T(`button`,{type:`button`,className:`wui-comment-action`,"data-wui-action":`delete`,children:S.deleteLabel})]}),W&&/* @__PURE__ */ E(`div`,{className:`wui-comment-confirm`,"data-wui-comment-confirm":``,hidden:!0,children:[/* @__PURE__ */ T(`span`,{className:`wui-comment-confirm-text`,children:S.deleteConfirmText}),/* @__PURE__ */ T(c,{tone:`danger`,size:`sm`,"data-wui-action":`confirm-delete`,children:S.deleteLabel}),/* @__PURE__ */ T(c,{variant:`ghost`,size:`sm`,"data-wui-action":`cancel-delete`,children:S.cancelLabel})]}),!i&&/* @__PURE__ */ T(`div`,{className:`wui-comment-error`,"data-wui-error":``,hidden:!0})]})]}),r&&B.length>0&&/* @__PURE__ */ T(`ol`,{className:`wui-comment-list wui-comment-replies`,"aria-label":O(S.repliesToLabel,{name:V}),children:B.map(e=>/* @__PURE__ */ T(ee,{comment:e,readOnly:i,allowReactions:o,markdown:d,linkComponent:f,internalLabel:p,attachmentsLabel:y,text:S},e.id))}),G&&!i&&!I&&/* @__PURE__ */ T(`div`,{className:`wui-comment-reply`,"data-wui-reply":``,hidden:!0})]})}export{I as default};
@@ -1 +1 @@
1
- import{newIdempotencyKey as e}from"../web-core/dist/api/idempotencyKey.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppIcon.js";import te from"./AppInput.js";import i from"./AppModal.js";import a from"./assertValidValue.js";import{MODAL_ICONS as ne}from"./ModalIcons.js";import o from"./warnUnknownProps.js";import{useEffect as s,useRef as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{CONFIRM_DIALOG_TEXT as re,fillText as ie}from"@webority/ui-elements/text";var p=[`sm`,`md`,`lg`,`xl`],m=[`default`,`plain`],h=[`success`,`danger`,`warning`,`info`,`primary`];function g(g){let{marker:_,props:v}=ee(`AppConfirmDialog`,g),y=t(`confirmDialog`,re),{open:b,title:x,variant:S=`default`,description:C,confirmLabel:w=y.confirmLabel,cancelLabel:T=y.cancelLabel,typePhraseLabel:E=y.typePhraseLabel,tone:D,image:O,icon:k,iconSize:A,confirmPhrase:j,onConfirm:M,onClose:N,loading:P=!1,idempotent:F=!1,staticBackdrop:I=!0,placement:L=`center`,size:R=`md`,className:z=``,children:B,...V}=v;o(`AppConfirmDialog`,V),a(`AppConfirmDialog`,`tone`,D,h),a(`AppConfirmDialog`,`size`,typeof R==`string`?R:null,p),a(`AppConfirmDialog`,`variant`,S,m);let[H,U]=l(``),W=c(null);if(s(()=>{b||(U(``),W.current=null)},[b]),!b)return null;let G=!!j&&H.trim()!==j,[K,...q]=E.split(`{phrase}`),J=q.join(j??`,`),Y=S===`plain`,X=Y?`sm`:`md`,Z=Y||O||k?null:ne[D===`danger`?`delete`:D??`info`],Q=A!==void 0&&A>0?{"--wui-confirm-icon-size":`${A}px`}:void 0,$=()=>{P||N?.()},ae=()=>{if(!F)return M();let t=W.current;return t===null&&(t=e(),W.current=t),M({idempotencyKey:t})};return/* @__PURE__ */ d(i,{..._,...V,open:b,hideHeader:!0,title:x,onClose:$,staticBackdrop:I,closeOnEscape:!I,placement:L,size:R,className:[`wui-confirm`,Y&&`wui-confirm-plain`,z].filter(Boolean).join(` `),footer:/* @__PURE__ */ f(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ d(n,{tone:`neutral`,...Y?{}:{variant:`soft`},size:X,disabled:P,onClick:$,children:T}),/* @__PURE__ */ d(n,{tone:D===`danger`?`danger`:void 0,size:X,disabled:G,loading:P,onClick:ae,children:w})]}),children:/* @__PURE__ */ f(`div`,{className:`wui-confirm-content`,children:[!Y&&O?/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:/* @__PURE__ */ d(`img`,{src:O,alt:``,"aria-hidden":`true`})}):!Y&&k?/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:typeof k==`string`?/* @__PURE__ */ d(r,{name:k,size:80}):k}):Z&&/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:/* @__PURE__ */ d(Z,{size:120})}),/* @__PURE__ */ d(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:x}),C&&/* @__PURE__ */ d(`p`,{className:`wui-confirm-msg`,children:C}),B!=null&&B!==!1&&/* @__PURE__ */ d(`div`,{className:`wui-confirm-body`,children:B}),j&&/* @__PURE__ */ d(te,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ f(u,{children:[K,/* @__PURE__ */ d(`strong`,{children:j}),J]}),value:H,onChange:e=>U(e.target.value),"aria-label":ie(E,{phrase:j}),disabled:P})]})})}export{g as default};
1
+ import{newIdempotencyKey as e}from"../web-core/dist/api/idempotencyKey.js";import t from"../lib/useWuiText.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import n from"./AppButton.js";import r from"./AppIcon.js";import te from"./AppInput.js";import i from"./AppModal.js";import a from"./assertValidValue.js";import{MODAL_ICONS as ne}from"./ModalIcons.js";import o from"./warnUnknownProps.js";import{useEffect as s,useRef as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import{CONFIRM_DIALOG_TEXT as re,fillText as ie}from"@webority/ui-elements/text";var p=[`sm`,`md`,`lg`,`xl`],m=[`default`,`plain`],h=[`success`,`danger`,`warning`,`info`,`primary`];function g(g){let{marker:_,props:v}=ee(`AppConfirmDialog`,g),y=t(`confirmDialog`,re),{open:b,title:x,variant:S=`default`,description:C,confirmLabel:w=y.confirmLabel,cancelLabel:T=y.cancelLabel,typePhraseLabel:E=y.typePhraseLabel,tone:D,image:O,imageWidth:k,imageHeight:A,icon:j,iconSize:M,confirmPhrase:N,onConfirm:P,onClose:F,loading:I=!1,idempotent:L=!1,staticBackdrop:R=!0,placement:z=`center`,size:B=`md`,className:V=``,children:H,...U}=v;o(`AppConfirmDialog`,U),a(`AppConfirmDialog`,`tone`,D,h),a(`AppConfirmDialog`,`size`,typeof B==`string`?B:null,p),a(`AppConfirmDialog`,`variant`,S,m);let[W,G]=l(``),K=c(null);if(s(()=>{b||(G(``),K.current=null)},[b]),!b)return null;let q=!!N&&W.trim()!==N,[J,...ae]=E.split(`{phrase}`),oe=ae.join(N??`,`),Y=S===`plain`,X=Y?`sm`:`md`,Z=Y||O||j?null:ne[D===`danger`?`delete`:D??`info`],Q=M!==void 0&&M>0?{"--wui-confirm-icon-size":`${M}px`}:void 0,$=()=>{I||F?.()},se=()=>{if(!L)return P();let t=K.current;return t===null&&(t=e(),K.current=t),P({idempotencyKey:t})};return/* @__PURE__ */ d(i,{..._,...U,open:b,hideHeader:!0,title:x,onClose:$,staticBackdrop:R,closeOnEscape:!R,placement:z,size:B,className:[`wui-confirm`,Y&&`wui-confirm-plain`,V].filter(Boolean).join(` `),footer:/* @__PURE__ */ f(`div`,{className:`wui-confirm-actions`,children:[/* @__PURE__ */ d(n,{tone:`neutral`,...Y?{}:{variant:`soft`},size:X,disabled:I,onClick:$,children:T}),/* @__PURE__ */ d(n,{tone:D===`danger`?`danger`:void 0,size:X,disabled:q,loading:I,onClick:se,children:w})]}),children:/* @__PURE__ */ f(`div`,{className:`wui-confirm-content`,children:[!Y&&O?/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:/* @__PURE__ */ d(`img`,{src:O,width:k,height:A,alt:``,"aria-hidden":`true`})}):!Y&&j?/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:typeof j==`string`?/* @__PURE__ */ d(r,{name:j,size:80}):j}):Z&&/* @__PURE__ */ d(`span`,{className:`wui-confirm-icon`,style:Q,children:/* @__PURE__ */ d(Z,{size:120})}),/* @__PURE__ */ d(`h3`,{className:`wui-confirm-title`,tabIndex:-1,"data-autofocus":``,children:x}),C&&/* @__PURE__ */ d(`p`,{className:`wui-confirm-msg`,children:C}),H!=null&&H!==!1&&/* @__PURE__ */ d(`div`,{className:`wui-confirm-body`,children:H}),N&&/* @__PURE__ */ d(te,{fieldClassName:`mt-3 mb-0 w-100 text-start`,label:/* @__PURE__ */ f(u,{children:[J,/* @__PURE__ */ d(`strong`,{children:N}),oe]}),value:W,onChange:e=>G(e.target.value),"aria-label":ie(E,{phrase:N}),disabled:I})]})})}export{g as default};
@@ -1 +1 @@
1
- import e from"../lib/useWuiText.js";import t from"./AppConfirmDialog.js";import{createContext as n,useCallback as r,useContext as i,useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{CONFIRM_PROVIDER_TEXT as u}from"@webority/ui-elements/text";var d=n(null);function f(n){let{children:i}=n,f=e(`confirmProvider`,u),[p,m]=s(null),[h,g]=s(!1),_=o(null),v=r((e={})=>new Promise(t=>{_.current?.(!1),_.current=t,m({...e,title:e.title||f.title})}),[f.title]),y=e=>{_.current?.(e),_.current=null,g(!1),m(null)};return a(()=>()=>_.current?.(!1),[]),/* @__PURE__ */ l(d.Provider,{value:v,children:[i,/* @__PURE__ */ c(t,{open:!!p,title:p?.title,description:p?.description,confirmLabel:p?.confirmLabel,cancelLabel:p?.cancelLabel,tone:p?.tone,icon:p?.icon,confirmPhrase:p?.confirmPhrase,loading:h,onConfirm:async()=>{let e=p?.onRun;if(typeof e!=`function`)y(!0);else{g(!0);try{await e(),y(!0)}catch{g(!1)}}},onClose:()=>y(!1)})]})}function p(){let e=i(d);if(!e)throw Error(`useConfirm needs an <AppConfirmProvider> above it.`);return e}export{f as default,p as useConfirm};
1
+ import e from"../lib/useWuiText.js";import t from"./AppConfirmDialog.js";import{createContext as n,useCallback as r,useContext as i,useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{CONFIRM_PROVIDER_TEXT as u}from"@webority/ui-elements/text";var d=n(null);function f(n){let{children:i}=n,f=e(`confirmProvider`,u),[p,m]=s(null),[h,g]=s(!1),_=o(null),v=r((e={})=>new Promise(t=>{_.current?.(!1),_.current=t,m({...e,title:e.title||f.title})}),[f.title]),y=e=>{_.current?.(e),_.current=null,g(!1),m(null)};return a(()=>()=>_.current?.(!1),[]),/* @__PURE__ */ l(d,{value:v,children:[i,/* @__PURE__ */ c(t,{open:!!p,title:p?.title,description:p?.description,confirmLabel:p?.confirmLabel,cancelLabel:p?.cancelLabel,tone:p?.tone,icon:p?.icon,confirmPhrase:p?.confirmPhrase,loading:h,onConfirm:async()=>{let e=p?.onRun;if(typeof e!=`function`)y(!0);else{g(!0);try{await e(),y(!0)}catch{g(!1)}}},onClose:()=>y(!1)})]})}function p(){let e=i(d);if(!e)throw Error(`useConfirm needs an <AppConfirmProvider> above it.`);return e}export{f as default,p as useConfirm};
@@ -1 +1 @@
1
- import{linkTarget as e}from"../lib/linkTarget.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import a from"../lib/useWuiText.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./renderIconProp.js";import c from"./warnUnknownProps.js";import{useEffect as l,useLayoutEffect as u,useRef as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{CONTEXT_MENU_TEXT as h}from"@webority/ui-elements/text";var g=()=>import(`@webority/ui-elements/elements/context-menu`);function _(e){i(`wui-context-menu`,g);let{marker:t,props:n}=o(`AppContextMenu`,e),r=a(`contextMenu`,h),{items:s=[],target:f,trigger:_,children:y,ariaLabel:x=r.ariaLabel,disabled:S=!1,open:C,onOpen:w,onBeforeOpen:T,menuClassName:E=``,linkComponent:D,...O}=n;c(`AppContextMenu`,O);let k=d(null);return l(()=>{let e=k.current;if(!e||!w)return;let t=e=>{if(!v(e))throw TypeError(`<wui-context-menu> dispatched wui-context-menu:open without a CustomEvent.`);w(e.detail)};return e.addEventListener(`wui-context-menu:open`,t),()=>e.removeEventListener(`wui-context-menu:open`,t)},[w]),l(()=>{let e=k.current;if(!e||!T)return;let t=e=>{if(!v(e))throw TypeError(`<wui-context-menu> dispatched wui-context-menu:beforeopen without a CustomEvent.`);T(e)};return e.addEventListener(`wui-context-menu:beforeopen`,t),()=>e.removeEventListener(`wui-context-menu:beforeopen`,t)},[T]),u(()=>{let e=k.current;if(!e)throw Error(`<AppContextMenu> has no menu element to open.`);e.toggleAttribute(`open`,!!C)},[C]),/* @__PURE__ */ m(`wui-context-menu`,{ref:k,target:f,trigger:_,disabled:S,...t,...O,children:[y,/* @__PURE__ */ p(`div`,{className:`dropdown-menu wui-context-menu-panel${E?` ${E}`:``}`,popover:`auto`,role:`menu`,"aria-label":x,tabIndex:-1,children:b(s,D,r.searchPlaceholder)})]})}function v(e){return e instanceof CustomEvent}var y=e=>`dropdown-item${e.tone===`danger`?` danger`:``}${e.disabled?` disabled`:``}`;function b(i,a,o){return i.map(i=>{if(i.divider)return/* @__PURE__ */ p(`hr`,{className:`dropdown-divider`},i.key);if(i.items!=null){let e=i.searchPlaceholder||o;return/* @__PURE__ */ m(`div`,{className:`wui-context-menu-sub`,role:`none`,"data-searchable":i.searchable?``:void 0,children:[/* @__PURE__ */ m(`button`,{type:`button`,className:y(i),role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":`false`,tabIndex:-1,"data-key":i.key,"aria-disabled":i.disabled?`true`:void 0,children:[s(i.icon,{size:16}),i.label,s(`chevron-right`,{size:14,className:`wui-context-menu-chevron`})]}),/* @__PURE__ */ m(`div`,{className:`dropdown-menu wui-context-menu-subpanel`,popover:`auto`,role:`menu`,"aria-label":i.label,tabIndex:-1,children:[i.searchable?/* @__PURE__ */ p(`input`,{type:`search`,className:`wui-context-menu-search`,autoComplete:`off`,placeholder:e,"aria-label":e}):null,b(i.items,a,o)]})]},i.key)}let c=!!i.to&&!i.disabled,l=/* @__PURE__ */ m(f,{children:[i.image?/* @__PURE__ */ p(`img`,{src:i.image,alt:``}):s(i.icon,{size:16}),i.label,n(i.shortcut)]}),u={className:y(i),role:`menuitem`,tabIndex:-1,"data-key":i.key,"aria-checked":i.checked||void 0,"data-hint":i.hint||void 0,"aria-keyshortcuts":t(i.shortcut),"aria-disabled":i.disabled||void 0,onClick:i.disabled?void 0:i.onClick,children:l};return c?/* @__PURE__ */ p(r,{link:e(a,{to:i.to}),...u},i.key):/* @__PURE__ */ p(`button`,{type:`button`,...u},i.key)})}export{_ as default};
1
+ import{linkTarget as e}from"../lib/linkTarget.js";import{shortcutAria as t,shortcutChip as n}from"../lib/shortcutChip.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import a from"../lib/useWuiText.js";import{splitMarkerProps as o}from"../lib/wuiMarker.js";import s from"./renderIconProp.js";import c from"./warnUnknownProps.js";import{useEffect as l,useLayoutEffect as u,useRef as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{CONTEXT_MENU_TEXT as h}from"@webority/ui-elements/text";var g=()=>import(`@webority/ui-elements/elements/context-menu`);function _(e){i(`wui-context-menu`,g);let{marker:t,props:n}=o(`AppContextMenu`,e),r=a(`contextMenu`,h),{items:s=[],target:f,trigger:_,children:y,ariaLabel:x=r.ariaLabel,disabled:S=!1,open:C,onOpen:w,onBeforeOpen:T,menuClassName:E=``,linkComponent:D,...O}=n;c(`AppContextMenu`,O);let k=d(null);return l(()=>{let e=k.current;if(!e||!w)return;let t=e=>{if(!v(e))throw TypeError(`<wui-context-menu> dispatched wui-context-menu:open without a CustomEvent.`);w(e.detail)};return e.addEventListener(`wui-context-menu:open`,t),()=>e.removeEventListener(`wui-context-menu:open`,t)},[w]),l(()=>{let e=k.current;if(!e||!T)return;let t=e=>{if(!v(e))throw TypeError(`<wui-context-menu> dispatched wui-context-menu:beforeopen without a CustomEvent.`);T(e)};return e.addEventListener(`wui-context-menu:beforeopen`,t),()=>e.removeEventListener(`wui-context-menu:beforeopen`,t)},[T]),u(()=>{let e=k.current;if(!e)throw Error(`<AppContextMenu> has no menu element to open.`);e.toggleAttribute(`open`,!!C)},[C]),/* @__PURE__ */ m(`wui-context-menu`,{ref:k,target:f,trigger:_,disabled:S,...t,...O,children:[y,/* @__PURE__ */ p(`div`,{className:`dropdown-menu wui-context-menu-panel${E?` ${E}`:``}`,popover:`auto`,role:`menu`,"aria-label":x,tabIndex:-1,children:b(s,D,r.searchPlaceholder)})]})}function v(e){return e instanceof CustomEvent}var y=e=>`dropdown-item${e.tone===`danger`?` danger`:``}${e.disabled?` disabled`:``}`;function b(i,a,o){return i.map(i=>{if(i.divider)return/* @__PURE__ */ p(`hr`,{className:`dropdown-divider`},i.key);if(i.items!=null){let e=i.searchPlaceholder||o;return/* @__PURE__ */ m(`div`,{className:`wui-context-menu-sub`,role:`none`,"data-searchable":i.searchable?``:void 0,children:[/* @__PURE__ */ m(`button`,{type:`button`,className:y(i),role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":`false`,tabIndex:-1,"data-key":i.key,"aria-disabled":i.disabled?`true`:void 0,children:[s(i.icon,{size:16}),i.label,s(`chevron-right`,{size:14,className:`wui-context-menu-chevron`})]}),/* @__PURE__ */ m(`div`,{className:`dropdown-menu wui-context-menu-subpanel`,popover:`auto`,role:`menu`,"aria-label":i.label,tabIndex:-1,children:[i.searchable?/* @__PURE__ */ p(`input`,{type:`search`,className:`wui-context-menu-search`,autoComplete:`off`,placeholder:e,"aria-label":e}):null,b(i.items,a,o)]})]},i.key)}let c=!!i.to&&!i.disabled,l=/* @__PURE__ */ m(f,{children:[i.image?/* @__PURE__ */ p(`img`,{src:i.image,alt:``,width:i.imageWidth,height:i.imageHeight}):s(i.icon,{size:16}),i.label,n(i.shortcut)]}),u={className:y(i),role:`menuitem`,tabIndex:-1,"data-key":i.key,"aria-checked":i.checked||void 0,"data-hint":i.hint||void 0,"aria-keyshortcuts":t(i.shortcut),"aria-disabled":i.disabled||void 0,onClick:i.disabled?void 0:i.onClick,children:l};return c?/* @__PURE__ */ p(r,{link:e(a,{to:i.to}),...u},i.key):/* @__PURE__ */ p(`button`,{type:`button`,...u},i.key)})}export{_ as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import ee from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import ne from"./AppRequiredMark.js";import a from"./assertValidValue.js";import o from"./textOf.js";import s from"./useWuiControl.js";import c from"./warnUnknownProps.js";import{cloneElement as l,forwardRef as u,useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{DATE_PICKER_TEXT as m}from"@webority/ui-elements/text";var h=[`sm`,`md`,`lg`,`xl`],g=()=>import(`@webority/ui-elements/elements/datepicker`),_=u(function(u,_){let re=ee(`wui-datepicker`,g),v=r(`datePicker`,m),{marker:y,props:ie}=i(`AppDatePicker`,u),{value:b,onChange:x,label:S,required:C=!1,optional:w=!1,optionalLabel:T=v.optionalLabel,helperText:E,error:D,valid:O=!1,name:k,min:A,max:j,placeholder:M=v.placeholder,disabled:N,readOnly:P=!1,loading:F=!1,defaultValue:I,help:L,helpLabel:R=v.helpLabel,size:z,firstDay:B,displayFormat:V,id:H,ariaLabel:U,"aria-invalid":W,className:G=``,fieldClassName:K=``,...q}=ie,J=n(k),Y=D??J;c(`AppDatePicker`,q),a(`AppDatePicker`,`size`,z,h),typeof V==`string`&&V!==``&&/DD|YYYY|YY/.test(V)&&e(`[@webority/ui-react] <AppDatePicker> displayFormat "${V}" uses uppercase day or year tokens, which print as written; the tokens are yyyy, MMMM, MMM, MM, dd and d.`);let ae=d(),X=H||ae,{setRef:oe}=s({ready:re,ref:_,value:b??(I===void 0?``:void 0),defaultValue:I,onChange:x}),se=!S&&!Y&&!E,Z=Y?`${X}-error`:void 0,Q=E?`${X}-hint`:void 0,ce=Z||Q,le=[G,O&&!Y?`wui-valid`:``].filter(Boolean).join(` `),$=/* @__PURE__ */ f(`wui-datepicker`,{ref:oe,id:X,name:k,value:(b??I)||void 0,min:A,max:j,placeholder:M,size:z||void 0,"first-day":B==null?void 0:String(B),"display-format":V||void 0,"aria-label":U||o(S)||void 0,"aria-describedby":ce,"aria-invalid":W??(Y?`true`:void 0),disabled:N?``:void 0,readonly:P?``:void 0,loading:F?``:void 0,required:C?``:void 0,className:le||void 0,...q});return se?l($,y):/* @__PURE__ */ p(`div`,{...y,className:`field${K?` ${K}`:``}`,children:[S&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:X,children:[S,w&&!C&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${T}`}),C&&/* @__PURE__ */ f(ne,{}),L&&/* @__PURE__ */ f(te,{label:R,children:L})]}),$,/* @__PURE__ */ f(t,{error:Y,hint:E,errorId:Z,hintId:Q})]})});export{_ as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import t from"../lib/FieldMessage.js";import{useFieldError as n}from"../lib/formFields.js";import r from"../lib/useElementEntry.js";import i from"../lib/useWuiText.js";import{splitMarkerProps as ee}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import o from"./assertValidValue.js";import s from"./textOf.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{cloneElement as u,useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{DATE_PICKER_TEXT as m}from"@webority/ui-elements/text";var h=[`sm`,`md`,`lg`,`xl`],g=()=>import(`@webority/ui-elements/elements/datepicker`);function _({ref:_,...ne}){let re=r(`wui-datepicker`,g),v=i(`datePicker`,m),{marker:y,props:b}=ee(`AppDatePicker`,ne),{value:x,onChange:S,label:C,required:w=!1,optional:T=!1,optionalLabel:E=v.optionalLabel,helperText:D,error:O,valid:k=!1,name:A,min:j,max:M,placeholder:N=v.placeholder,disabled:P,readOnly:F=!1,loading:I=!1,defaultValue:L,help:R,helpLabel:ie=v.helpLabel,size:z,firstDay:B,displayFormat:V,id:H,ariaLabel:U,"aria-invalid":W,className:G=``,fieldClassName:K=``,...q}=b,J=n(A),Y=O??J;l(`AppDatePicker`,q),o(`AppDatePicker`,`size`,z,h),typeof V==`string`&&V!==``&&/DD|YYYY|YY/.test(V)&&e(`[@webority/ui-react] <AppDatePicker> displayFormat "${V}" uses uppercase day or year tokens, which print as written; the tokens are yyyy, MMMM, MMM, MM, dd and d.`);let ae=d(),X=H||ae,{setRef:oe}=c({ready:re,ref:_,value:x??(L===void 0?``:void 0),defaultValue:L,onChange:S}),se=!C&&!Y&&!D,Z=Y?`${X}-error`:void 0,Q=D?`${X}-hint`:void 0,ce=Z||Q,le=[G,k&&!Y?`wui-valid`:``].filter(Boolean).join(` `),$=/* @__PURE__ */ f(`wui-datepicker`,{ref:oe,id:X,name:A,value:(x??L)||void 0,min:j,max:M,placeholder:N,size:z||void 0,"first-day":B==null?void 0:String(B),"display-format":V||void 0,"aria-label":U||s(C)||void 0,"aria-describedby":ce,"aria-invalid":W??(Y?`true`:void 0),disabled:P?``:void 0,readonly:F?``:void 0,loading:I?``:void 0,required:w?``:void 0,className:le||void 0,...q});return se?u($,y):/* @__PURE__ */ p(`div`,{...y,className:`field${K?` ${K}`:``}`,children:[C&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:X,children:[C,T&&!w&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${E}`}),w&&/* @__PURE__ */ f(a,{}),R&&/* @__PURE__ */ f(te,{label:ie,children:R})]}),$,/* @__PURE__ */ f(t,{error:Y,hint:D,errorId:Z,hintId:Q})]})}export{_ as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import i from"./AppInfoTip.js";import a from"./AppRequiredMark.js";import te from"./assertValidValue.js";import o from"./textOf.js";import s from"./useWuiControl.js";import c from"./warnUnknownProps.js";import{cloneElement as l,forwardRef as u,useEffect as d,useId as ne,useRef as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{DATE_RANGE_PICKER_TEXT as re}from"@webority/ui-elements/text";var ie=[`sm`,`md`,`lg`,`xl`],ae=()=>import(`@webority/ui-elements/elements/date-range`),oe=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)},h=u(function(u,h){let g=n(`wui-date-range`,ae),_=ee(`dateRangePicker`,re),{marker:v,props:se}=r(`AppDateRangePicker`,u),{start:y,end:b,defaultStart:x,defaultEnd:S,onChange:C,open:w,onOpenChange:T,label:E,help:D,helpLabel:ce=_.helpLabel,required:O=!1,optional:k=!1,optionalLabel:A=_.optionalLabel,helperText:j,error:M,startName:N,endName:P,min:F,max:I,placeholder:L=_.placeholder,disabled:R,readOnly:z=!1,loading:B=!1,size:V,firstDay:H,timeZone:le,financialYearStart:U,presets:W,id:ue,ariaLabel:de,className:fe=``,fieldClassName:G=``,...K}=se,pe=t(N),me=t(P),q=M??pe??me;c(`AppDateRangePicker`,K),te(`AppDateRangePicker`,`size`,V,ie);let he=ne(),J=ue||he,{setRef:ge,innerRef:Y}=s({ready:g,ref:e=>{typeof h==`function`?h(e):h&&(h.current=e)},onChange:C}),X=f(!1);d(()=>{if(!g)return;let e=Y.current;if(!e)return;let t=y===void 0?!X.current&&x!==void 0?x:e.value.start:y,n=b===void 0?!X.current&&S!==void 0?S:e.value.end:b;(e.value.start!==t||e.value.end!==n)&&(e.value={start:t,end:n}),X.current=!0},[g,y,b,x,S,Y]),d(()=>{if(!g||w===void 0)return;let e=Y.current;e&&e.open!==w&&(e.open=w)},[g,w,Y]),d(()=>{let e=Y.current;if(!g||!e||!T)return;let t=t=>{t instanceof CustomEvent&&t.target===e&&T(!!t.detail?.open)};return e.addEventListener(`wui-date-range:openchange`,t),()=>e.removeEventListener(`wui-date-range:openchange`,t)},[g,T,Y]);let _e=!E&&!q&&!j,Z=q?`${J}-error`:void 0,Q=j?`${J}-hint`:void 0,ve=Z||Q,$=/* @__PURE__ */ p(`wui-date-range`,{ref:ge,id:J,"start-name":N,"end-name":P,min:F,max:I,placeholder:L,size:V||void 0,"first-day":H==null?void 0:String(H),"time-zone":le||void 0,"financial-year-start":U==null?void 0:String(U),presets:oe(W),"aria-label":de||o(E)||void 0,"aria-describedby":ve,"aria-invalid":q?`true`:void 0,disabled:R?``:void 0,readonly:z?``:void 0,loading:B?``:void 0,required:O?``:void 0,className:fe||void 0,...K});return _e?l($,v):/* @__PURE__ */ m(`div`,{...v,className:`field${G?` ${G}`:``}`,children:[E&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:J,children:[E,k&&!O&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${A}`}),O&&/* @__PURE__ */ p(a,{}),D&&/* @__PURE__ */ p(i,{label:ce,children:D})]}),$,/* @__PURE__ */ p(e,{error:q,hint:j,errorId:Z,hintId:Q})]})});export{h as default};
1
+ import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import ee from"../lib/useWuiText.js";import{splitMarkerProps as r}from"../lib/wuiMarker.js";import te from"./AppInfoTip.js";import i from"./AppRequiredMark.js";import ne from"./assertValidValue.js";import a from"./textOf.js";import o from"./useWuiControl.js";import re from"./warnUnknownProps.js";import{cloneElement as s,useEffect as c,useId as ie,useRef as ae}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{DATE_RANGE_PICKER_TEXT as d}from"@webority/ui-elements/text";var oe=[`sm`,`md`,`lg`,`xl`],se=()=>import(`@webority/ui-elements/elements/date-range`),ce=e=>{if(e?.length)return e.every(e=>typeof e==`string`)?e.join(`,`):JSON.stringify(e)};function f({ref:f,...p}){let m=n(`wui-date-range`,se),h=ee(`dateRangePicker`,d),{marker:g,props:_}=r(`AppDateRangePicker`,p),{start:v,end:y,defaultStart:b,defaultEnd:x,onChange:le,open:S,onOpenChange:C,label:w,help:T,helpLabel:E=h.helpLabel,required:D=!1,optional:O=!1,optionalLabel:k=h.optionalLabel,helperText:A,error:j,startName:M,endName:N,min:P,max:F,placeholder:I=h.placeholder,disabled:L,readOnly:R=!1,loading:z=!1,size:B,firstDay:V,timeZone:H,financialYearStart:U,presets:W,id:ue,ariaLabel:de,className:fe=``,fieldClassName:G=``,...K}=_,pe=t(M),me=t(N),q=j??pe??me;re(`AppDateRangePicker`,K),ne(`AppDateRangePicker`,`size`,B,oe);let he=ie(),J=ue||he,{setRef:ge,innerRef:Y}=o({ready:m,ref:e=>{typeof f==`function`?f(e):f&&(f.current=e)},onChange:le}),X=ae(!1);c(()=>{if(!m)return;let e=Y.current;if(!e)return;let t=v===void 0?!X.current&&b!==void 0?b:e.value.start:v,n=y===void 0?!X.current&&x!==void 0?x:e.value.end:y;(e.value.start!==t||e.value.end!==n)&&(e.value={start:t,end:n}),X.current=!0},[m,v,y,b,x,Y]),c(()=>{if(!m||S===void 0)return;let e=Y.current;e&&e.open!==S&&(e.open=S)},[m,S,Y]),c(()=>{let e=Y.current;if(!m||!e||!C)return;let t=t=>{t instanceof CustomEvent&&t.target===e&&C(!!t.detail?.open)};return e.addEventListener(`wui-date-range:openchange`,t),()=>e.removeEventListener(`wui-date-range:openchange`,t)},[m,C,Y]);let _e=!w&&!q&&!A,Z=q?`${J}-error`:void 0,Q=A?`${J}-hint`:void 0,ve=Z||Q,$=/* @__PURE__ */ l(`wui-date-range`,{ref:ge,id:J,"start-name":M,"end-name":N,min:P,max:F,placeholder:I,size:B||void 0,"first-day":V==null?void 0:String(V),"time-zone":H||void 0,"financial-year-start":U==null?void 0:String(U),presets:ce(W),"aria-label":de||a(w)||void 0,"aria-describedby":ve,"aria-invalid":q?`true`:void 0,disabled:L?``:void 0,readonly:R?``:void 0,loading:z?``:void 0,required:D?``:void 0,className:fe||void 0,...K});return _e?s($,g):/* @__PURE__ */ u(`div`,{...g,className:`field${G?` ${G}`:``}`,children:[w&&/* @__PURE__ */ u(`label`,{className:`label`,htmlFor:J,children:[w,O&&!D&&/* @__PURE__ */ l(`span`,{className:`label-optional`,children:` ${k}`}),D&&/* @__PURE__ */ l(i,{}),T&&/* @__PURE__ */ l(te,{label:E,children:T})]}),$,/* @__PURE__ */ l(e,{error:q,hint:A,errorId:Z,hintId:Q})]})}export{f as default};
@@ -1 +1 @@
1
- import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./textOf.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{timeZoneLabel as u}from"@webority/ui-elements/helpers";import{forwardRef as d,useId as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{DATE_PICKER_TEXT as h,TIME_PICKER_TEXT as g,fillText as _}from"@webority/ui-elements/text";var v=`Asia/Kolkata`,y=async()=>(await Promise.all([import(`@webority/ui-elements/elements/datepicker`),import(`@webority/ui-elements/elements/timepicker`)]),import(`@webority/ui-elements/elements/date-time`));function b(e,t){if(t!==void 0&&t!==``&&Number.isNaN(Date.parse(t)))throw Error(`<AppDateTimePicker> ${e} "${t}" is not an ISO UTC date-time.`)}var x=d(function(d,x){let S=n(`wui-date-time`,y),C=r(`datePicker`,h),w=r(`timePicker`,g),{marker:T,props:E}=i(`AppDateTimePicker`,d),{value:D,defaultValue:O,onChange:k,label:A,required:j=!1,optional:M=!1,optionalLabel:N=C.optionalLabel,helperText:P,error:F,name:I,min:L,max:R,disabled:z,readOnly:B=!1,help:V,helpLabel:H=C.helpLabel,zone:U=v,id:W,className:G=``,fieldClassName:K=``,...q}=E,J=t(I),Y=F??J;l(`AppDateTimePicker`,q),b(`value`,D),b(`defaultValue`,O),b(`min`,L),b(`max`,R);let X=f(),Z=W||X,Q=Y?`${Z}-error`:void 0,$=`${Z}-hint`,ee=P??_(C.zoneNote,{zone:u(U)}),{setRef:te}=c({ready:S,ref:x,value:D??(O===void 0?``:void 0),defaultValue:O,onChange:k});return/* @__PURE__ */ m(`div`,{...T,className:`field${K?` ${K}`:``}`,children:[A&&/* @__PURE__ */ m(`label`,{className:`label`,htmlFor:`${Z}-date`,children:[A,M&&!j&&/* @__PURE__ */ p(`span`,{className:`label-optional`,children:` ${N}`}),j&&/* @__PURE__ */ p(o,{}),V&&/* @__PURE__ */ p(a,{label:H,children:V})]}),/* @__PURE__ */ p(`wui-date-time`,{ref:te,id:Z,name:I,value:(D??O)||void 0,min:L,max:R,zone:U,"date-placeholder":C.placeholder,"time-placeholder":w.placeholder,"time-label":C.dateTimeLabel,"aria-label":s(A)||void 0,"aria-describedby":Q||$,"aria-invalid":Y?`true`:void 0,disabled:z?``:void 0,readonly:B?``:void 0,required:j?``:void 0,className:G||void 0,...q}),/* @__PURE__ */ p(e,{error:Y,hint:ee,errorId:Q,hintId:$})]})});export{x as default};
1
+ import e from"../lib/FieldMessage.js";import{useFieldError as t}from"../lib/formFields.js";import n from"../lib/useElementEntry.js";import r from"../lib/useWuiText.js";import{splitMarkerProps as i}from"../lib/wuiMarker.js";import a from"./AppInfoTip.js";import o from"./AppRequiredMark.js";import s from"./textOf.js";import c from"./useWuiControl.js";import l from"./warnUnknownProps.js";import{timeZoneLabel as u}from"@webority/ui-elements/helpers";import{useId as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{DATE_PICKER_TEXT as m,TIME_PICKER_TEXT as h,fillText as g}from"@webority/ui-elements/text";var _=`Asia/Kolkata`,v=async()=>(await Promise.all([import(`@webority/ui-elements/elements/datepicker`),import(`@webority/ui-elements/elements/timepicker`)]),import(`@webority/ui-elements/elements/date-time`));function y(e,t){if(t!==void 0&&t!==``&&Number.isNaN(Date.parse(t)))throw Error(`<AppDateTimePicker> ${e} "${t}" is not an ISO UTC date-time.`)}function b({ref:b,...x}){let S=n(`wui-date-time`,v),C=r(`datePicker`,m),w=r(`timePicker`,h),{marker:T,props:E}=i(`AppDateTimePicker`,x),{value:D,defaultValue:O,onChange:k,label:A,required:j=!1,optional:M=!1,optionalLabel:N=C.optionalLabel,helperText:P,error:F,name:I,min:L,max:R,disabled:z,readOnly:B=!1,help:V,helpLabel:H=C.helpLabel,zone:U=_,id:W,className:G=``,fieldClassName:K=``,...q}=E,J=t(I),Y=F??J;l(`AppDateTimePicker`,q),y(`value`,D),y(`defaultValue`,O),y(`min`,L),y(`max`,R);let X=d(),Z=W||X,Q=Y?`${Z}-error`:void 0,$=`${Z}-hint`,ee=P??g(C.zoneNote,{zone:u(U)}),{setRef:te}=c({ready:S,ref:b,value:D??(O===void 0?``:void 0),defaultValue:O,onChange:k});return/* @__PURE__ */ p(`div`,{...T,className:`field${K?` ${K}`:``}`,children:[A&&/* @__PURE__ */ p(`label`,{className:`label`,htmlFor:`${Z}-date`,children:[A,M&&!j&&/* @__PURE__ */ f(`span`,{className:`label-optional`,children:` ${N}`}),j&&/* @__PURE__ */ f(o,{}),V&&/* @__PURE__ */ f(a,{label:H,children:V})]}),/* @__PURE__ */ f(`wui-date-time`,{ref:te,id:Z,name:I,value:(D??O)||void 0,min:L,max:R,zone:U,"date-placeholder":C.placeholder,"time-placeholder":w.placeholder,"time-label":C.dateTimeLabel,"aria-label":s(A)||void 0,"aria-describedby":Q||$,"aria-invalid":Y?`true`:void 0,disabled:z?``:void 0,readonly:B?``:void 0,required:j?``:void 0,className:G||void 0,...q}),/* @__PURE__ */ f(e,{error:Y,hint:ee,errorId:Q,hintId:$})]})}export{b as default};
@@ -1 +1 @@
1
- import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{shortcutAria as n,shortcutChip as ee}from"../lib/shortcutChip.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import a from"../lib/useWuiText.js";import{TONES as o}from"../lib/vocabulary.js";import{splitMarkerProps as te}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import ne from"./warnUnknownProps.js";import re from"./withTooltip.js";import{Fragment as ie,useEffect as u,useId as ae,useRef as d,useState as f}from"react";import{Fragment as oe,jsx as p,jsxs as m}from"react/jsx-runtime";import{DROPDOWN_TEXT as h}from"@webority/ui-elements/text";var g=[`sm`,`md`,`lg`,`xl`],se=[`neutral`],_=[`sm`,`md`,`lg`,`fit`],ce=[`_blank`,`_self`],le=/^data-[a-z0-9]+(?:-[a-z0-9]+)*$/,ue=()=>import(`@webority/ui-elements/elements/dropdown`),v=e=>e.description?/* @__PURE__ */ m(`span`,{className:`wui-dropdown-item-body`,children:[/* @__PURE__ */ p(`span`,{className:`wui-dropdown-item-label`,children:e.label}),/* @__PURE__ */ p(`span`,{className:`wui-dropdown-item-desc`,children:e.description})]}):e.label,y=!1;function de(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!y&&(y=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function b(y){i(`wui-dropdown`,ue);let b=a(`dropdown`,h),{marker:x,props:S}=te(`AppDropdown`,y),{icon:C,iconSize:w,toggleClassName:T,toggleVariant:E,menuWidth:D,label:O,ariaLabel:k,align:A=`end`,items:j=[],menuClassName:M=``,linkComponent:N,children:P,trigger:F,open:I,onOpenChange:L,searchable:R,searchPlaceholder:z,noMatchText:B,...V}=S;if(ne(`AppDropdown`,V),R&&P!=null)throw Error(`<AppDropdown> searchable filters items, so it takes items and no children.`);if(!R&&(z!==void 0||B!==void 0))throw Error(`<AppDropdown> searchPlaceholder and noMatchText need searchable.`);for(let e of j){if(c(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,g),c(`AppDropdown`,`items[].tone`,e.tone,o),c(`AppDropdown`,`items[].target`,e.target,ce),(e.target||e.rel)&&!e.href&&!e.to)throw RangeError(`<AppDropdown> item "${e.key}" takes target and rel only with href or to.`);for(let t of Object.keys(e.data??{}))if(!le.test(t))throw RangeError(`<AppDropdown> item "${e.key}" has a data key "${t}" that is not data-<name> in lowercase.`);if(R&&e.label!=null&&typeof e.label!=`string`)throw RangeError(`<AppDropdown> searchable filters rows by their text, so every item label must be a string.`)}F||k||O||de(),c(`AppDropdown`,`toggleVariant`,E,se),c(`AppDropdown`,`menuWidth`,D,_),E&&!F&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let fe=(T??(F?`wui-dropdown-trigger`:`topbar-icon-btn`))+(F&&E===`neutral`?` wui-dropdown-trigger-neutral`:``),pe=[`dropdown-menu`,A===`end`?`dropdown-menu-end`:``,D&&_.includes(D)?`wui-dropdown-menu-${D}`:``,R?`wui-dropdown-menu-searchable`:``,M].filter(Boolean).join(` `),[H,U]=f(``),W=d(null),G=z??b.searchPlaceholder,me=B??b.noMatchText,K=H.trim().toLowerCase(),q=K?j.filter(e=>!e.divider&&e.header==null&&(typeof e.label==`string`?e.label:``).toLowerCase().includes(K)):j,J=C??(F?void 0:`more-horizontal`),Y=ae(),X=I!==void 0,[he,ge]=f(!1),Z=X?!!I:he,Q=d(null);Q.current=(e,t)=>{X||ge(e),L?.(e,t)};let $=d(null);return u(()=>{let e=$.current;if(!e)return;let t=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-dropdown> toggle arrived without its detail.`);t.preventDefault(),Q.current?.(t.detail.open,{source:t.detail.source})}};return e.addEventListener(`wui-dropdown-toggle`,t),()=>e.removeEventListener(`wui-dropdown-toggle`,t)},[]),u(()=>{R&&Z&&W.current?.focus(),Z||U(``)},[Z,R]),u(()=>{let e=W.current;if(!R||!e)return;let t=t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault(),t.stopPropagation();let n=Array.from(e.closest(`.dropdown-menu`)?.querySelectorAll(`.dropdown-item`)??[]);(t.key===`ArrowDown`?n[0]:n[n.length-1])?.focus()}else t.key!==`Tab`&&t.key!==`Escape`&&t.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[R]),/* @__PURE__ */ m(`wui-dropdown`,{...x,...V,ref:$,class:[`dropdown`,V.className].filter(Boolean).join(` `),align:A,open:Z?``:void 0,children:[/* @__PURE__ */ p(`button`,{type:`button`,id:Y,"data-wui-dropdown-trigger":!0,"aria-expanded":Z?`true`:`false`,className:fe,title:O,"aria-label":k??(F?void 0:O),children:F??(J===void 0?null:/* @__PURE__ */ p(s,{name:J,size:w??20}))}),/* @__PURE__ */ m(`div`,{className:pe,"aria-labelledby":Y,"data-wui-dropdown-menu":!0,popover:`auto`,children:[R?/* @__PURE__ */ m(`div`,{className:`wui-dropdown-search`,children:[/* @__PURE__ */ p(s,{name:`search`,size:14}),/* @__PURE__ */ p(`input`,{ref:W,type:`search`,className:`wui-dropdown-search-input`,autoComplete:`off`,placeholder:G,"aria-label":G,value:H,onChange:e=>U(e.target.value)})]}):null,P??q.map(e=>{if(e.to&&e.href)throw RangeError(`AppDropdown: an item takes to or href, not both.`);if(e.header!=null)return/* @__PURE__ */ p(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ p(`hr`,{className:`dropdown-divider`},e.key);if(e.disabled)return/* @__PURE__ */ p(ie,{children:re(/* @__PURE__ */ m(`button`,{type:`button`,className:[`dropdown-item`,e.tone===`danger`&&`danger`,`wui-dropdown-item-disabled`,e.hiddenFrom&&g.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `),"aria-disabled":`true`,...e.data,children:[e.image?/* @__PURE__ */ p(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),v(e),e.disabledReason&&/* @__PURE__ */ m(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let i=[`dropdown-item`,e.tone===`danger`&&`danger`,e.hiddenFrom&&g.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0,a=/* @__PURE__ */ m(oe,{children:[e.image?/* @__PURE__ */ p(`img`,{src:e.image,alt:``}):l(e.icon,{size:16}),v(e),ee(e.shortcut)]}),o={className:i,onClick:e.onClick,"aria-keyshortcuts":n(e.shortcut),...e.data};return e.to?/* @__PURE__ */ p(r,{link:t(N,{to:e.to}),target:e.target,rel:e.rel,...o,children:a},e.key):e.href?/* @__PURE__ */ p(r,{link:t(N,{href:e.href,external:!0}),target:e.target,rel:e.rel,...o,children:a},e.key):/* @__PURE__ */ p(`button`,{type:`button`,...o,children:a},e.key)}),R&&K&&q.length===0?/* @__PURE__ */ p(`div`,{className:`wui-dropdown-empty`,role:`status`,children:me}):null]})]})}export{b as default};
1
+ import{devWarn as e}from"../lib/devWarn.js";import{linkTarget as t}from"../lib/linkTarget.js";import{shortcutAria as n,shortcutChip as ee}from"../lib/shortcutChip.js";import{TargetLink as r}from"../lib/TargetLink.js";import i from"../lib/useElementEntry.js";import a from"../lib/useWuiText.js";import{TONES as o}from"../lib/vocabulary.js";import{splitMarkerProps as te}from"../lib/wuiMarker.js";import s from"./AppIcon.js";import c from"./assertValidValue.js";import l from"./renderIconProp.js";import ne from"./warnUnknownProps.js";import re from"./withTooltip.js";import{Fragment as ie,useEffect as u,useId as ae,useRef as d,useState as f}from"react";import{Fragment as oe,jsx as p,jsxs as m}from"react/jsx-runtime";import{DROPDOWN_TEXT as h}from"@webority/ui-elements/text";var g=[`sm`,`md`,`lg`,`xl`],se=[`neutral`],_=[`sm`,`md`,`lg`,`fit`],ce=[`_blank`,`_self`],le=/^data-[a-z0-9]+(?:-[a-z0-9]+)*$/,ue=()=>import(`@webority/ui-elements/elements/dropdown`),v=e=>e.description?/* @__PURE__ */ m(`span`,{className:`wui-dropdown-item-body`,children:[/* @__PURE__ */ p(`span`,{className:`wui-dropdown-item-label`,children:e.label}),/* @__PURE__ */ p(`span`,{className:`wui-dropdown-item-desc`,children:e.description})]}):e.label,y=!1;function de(){let t=!0;try{t=process.env.NODE_ENV!==`production`}catch{t=!0}t&&!y&&(y=!0,e("[@webority/ui-react] <AppDropdown> icon-only toggle has no accessible name — pass `label` or `ariaLabel`."))}function b(y){i(`wui-dropdown`,ue);let b=a(`dropdown`,h),{marker:x,props:S}=te(`AppDropdown`,y),{icon:C,iconSize:w,toggleClassName:T,toggleVariant:E,menuWidth:D,label:O,ariaLabel:k,align:A=`end`,items:j=[],menuClassName:M=``,linkComponent:N,children:P,trigger:F,open:I,onOpenChange:L,searchable:R,searchPlaceholder:z,noMatchText:B,...V}=S;if(ne(`AppDropdown`,V),R&&P!=null)throw Error(`<AppDropdown> searchable filters items, so it takes items and no children.`);if(!R&&(z!==void 0||B!==void 0))throw Error(`<AppDropdown> searchPlaceholder and noMatchText need searchable.`);for(let e of j){if(c(`AppDropdown`,`items[].hiddenFrom`,e.hiddenFrom,g),c(`AppDropdown`,`items[].tone`,e.tone,o),c(`AppDropdown`,`items[].target`,e.target,ce),(e.target||e.rel)&&!e.href&&!e.to)throw RangeError(`<AppDropdown> item "${e.key}" takes target and rel only with href or to.`);for(let t of Object.keys(e.data??{}))if(!le.test(t))throw RangeError(`<AppDropdown> item "${e.key}" has a data key "${t}" that is not data-<name> in lowercase.`);if(R&&e.label!=null&&typeof e.label!=`string`)throw RangeError(`<AppDropdown> searchable filters rows by their text, so every item label must be a string.`)}F||k||O||de(),c(`AppDropdown`,`toggleVariant`,E,se),c(`AppDropdown`,`menuWidth`,D,_),E&&!F&&e(`AppDropdown: toggleVariant needs a trigger; the icon toggle ignores it.`);let fe=(T??(F?`wui-dropdown-trigger`:`topbar-icon-btn`))+(F&&E===`neutral`?` wui-dropdown-trigger-neutral`:``),pe=[`dropdown-menu`,A===`end`?`dropdown-menu-end`:``,D&&_.includes(D)?`wui-dropdown-menu-${D}`:``,R?`wui-dropdown-menu-searchable`:``,M].filter(Boolean).join(` `),[H,U]=f(``),W=d(null),G=z??b.searchPlaceholder,me=B??b.noMatchText,K=H.trim().toLowerCase(),q=K?j.filter(e=>!e.divider&&e.header==null&&(typeof e.label==`string`?e.label:``).toLowerCase().includes(K)):j,J=C??(F?void 0:`more-horizontal`),Y=ae(),X=I!==void 0,[he,ge]=f(!1),Z=X?!!I:he,Q=d(null);Q.current=(e,t)=>{X||ge(e),L?.(e,t)};let $=d(null);return u(()=>{let e=$.current;if(!e)return;let t=t=>{if(t.target===e){if(!(t instanceof CustomEvent))throw TypeError(`<wui-dropdown> toggle arrived without its detail.`);t.preventDefault(),Q.current?.(t.detail.open,{source:t.detail.source})}};return e.addEventListener(`wui-dropdown-toggle`,t),()=>e.removeEventListener(`wui-dropdown-toggle`,t)},[]),u(()=>{R&&Z&&W.current?.focus(),Z||U(``)},[Z,R]),u(()=>{let e=W.current;if(!R||!e)return;let t=t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){t.preventDefault(),t.stopPropagation();let n=Array.from(e.closest(`.dropdown-menu`)?.querySelectorAll(`.dropdown-item`)??[]);(t.key===`ArrowDown`?n[0]:n[n.length-1])?.focus()}else t.key!==`Tab`&&t.key!==`Escape`&&t.stopPropagation()};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[R]),/* @__PURE__ */ m(`wui-dropdown`,{...x,...V,ref:$,class:[`dropdown`,V.className].filter(Boolean).join(` `),align:A,open:Z?``:void 0,children:[/* @__PURE__ */ p(`button`,{type:`button`,id:Y,"data-wui-dropdown-trigger":!0,"aria-expanded":Z?`true`:`false`,className:fe,title:O,"aria-label":k??(F?void 0:O),children:F??(J===void 0?null:/* @__PURE__ */ p(s,{name:J,size:w??20}))}),/* @__PURE__ */ m(`div`,{className:pe,"aria-labelledby":Y,"data-wui-dropdown-menu":!0,popover:`auto`,children:[R?/* @__PURE__ */ m(`div`,{className:`wui-dropdown-search`,children:[/* @__PURE__ */ p(s,{name:`search`,size:14}),/* @__PURE__ */ p(`input`,{ref:W,type:`search`,className:`wui-dropdown-search-input`,autoComplete:`off`,placeholder:G,"aria-label":G,value:H,onChange:e=>U(e.target.value)})]}):null,P??q.map(e=>{if(e.to&&e.href)throw RangeError(`AppDropdown: an item takes to or href, not both.`);if(e.header!=null)return/* @__PURE__ */ p(`div`,{className:`dropdown-header`,children:e.header},e.key);if(e.divider)return/* @__PURE__ */ p(`hr`,{className:`dropdown-divider`},e.key);if(e.disabled)return/* @__PURE__ */ p(ie,{children:re(/* @__PURE__ */ m(`button`,{type:`button`,className:[`dropdown-item`,e.tone===`danger`&&`danger`,`wui-dropdown-item-disabled`,e.hiddenFrom&&g.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `),"aria-disabled":`true`,...e.data,children:[e.image?/* @__PURE__ */ p(`img`,{src:e.image,alt:``,width:e.imageWidth,height:e.imageHeight}):l(e.icon,{size:16}),v(e),e.disabledReason&&/* @__PURE__ */ m(`span`,{className:`visually-hidden wui-dropdown-item-reason`,children:[`: `,e.disabledReason]})]}),e.disabledReason,`auto`)},e.key);let i=[`dropdown-item`,e.tone===`danger`&&`danger`,e.hiddenFrom&&g.includes(e.hiddenFrom)&&`wui-hidden-from-${e.hiddenFrom}`].filter(Boolean).join(` `)||void 0,a=/* @__PURE__ */ m(oe,{children:[e.image?/* @__PURE__ */ p(`img`,{src:e.image,alt:``,width:e.imageWidth,height:e.imageHeight}):l(e.icon,{size:16}),v(e),ee(e.shortcut)]}),o={className:i,onClick:e.onClick,"aria-keyshortcuts":n(e.shortcut),...e.data};return e.to?/* @__PURE__ */ p(r,{link:t(N,{to:e.to}),target:e.target,rel:e.rel,...o,children:a},e.key):e.href?/* @__PURE__ */ p(r,{link:t(N,{href:e.href,external:!0}),target:e.target,rel:e.rel,...o,children:a},e.key):/* @__PURE__ */ p(`button`,{type:`button`,...o,children:a},e.key)}),R&&K&&q.length===0?/* @__PURE__ */ p(`div`,{className:`wui-dropdown-empty`,role:`status`,children:me}):null]})]})}export{b as default};