@foxy.io/elements 1.15.0-beta.3 → 1.15.0-beta.4

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 (149) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  5. package/dist/cdn/foxy-attribute-card.js +1 -1
  6. package/dist/cdn/foxy-attribute-form.js +1 -1
  7. package/dist/cdn/foxy-cancellation-form.js +1 -1
  8. package/dist/cdn/foxy-collection-page.js +1 -1
  9. package/dist/cdn/foxy-collection-pages.js +1 -1
  10. package/dist/cdn/foxy-coupon-card.js +1 -1
  11. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  12. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  13. package/dist/cdn/foxy-coupon-form.js +1 -1
  14. package/dist/cdn/foxy-custom-field-card.js +1 -1
  15. package/dist/cdn/foxy-custom-field-form.js +1 -1
  16. package/dist/cdn/foxy-customer-card.js +1 -1
  17. package/dist/cdn/foxy-customer-form.js +1 -1
  18. package/dist/cdn/foxy-customer-portal-settings.js +1 -169
  19. package/dist/cdn/foxy-customer-portal.js +2 -2
  20. package/dist/cdn/foxy-customer.js +1 -1
  21. package/dist/cdn/foxy-customers-table.js +1 -1
  22. package/dist/cdn/foxy-discount-card.js +1 -1
  23. package/dist/cdn/foxy-donation.js +1 -1
  24. package/dist/cdn/foxy-email-template-form.js +1 -1
  25. package/dist/cdn/foxy-error-entry-card.js +1 -1
  26. package/dist/cdn/foxy-form-dialog.js +1 -1
  27. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  28. package/dist/cdn/foxy-gift-card-card.js +1 -0
  29. package/dist/cdn/foxy-gift-card-code-form.js +1 -0
  30. package/dist/cdn/foxy-gift-card-codes-form.js +1 -0
  31. package/dist/cdn/foxy-gift-card-form.js +1 -0
  32. package/dist/cdn/foxy-i18n.js +1 -1
  33. package/dist/cdn/foxy-items-form.js +1 -1
  34. package/dist/cdn/foxy-pagination.js +1 -1
  35. package/dist/cdn/foxy-payment-card.js +1 -1
  36. package/dist/cdn/foxy-payment-method-card.js +1 -1
  37. package/dist/cdn/foxy-query-builder.js +1 -1
  38. package/dist/cdn/foxy-sign-in-form.js +1 -1
  39. package/dist/cdn/foxy-spinner.js +1 -1
  40. package/dist/cdn/foxy-subscription-card.js +1 -1
  41. package/dist/cdn/foxy-subscription-form.js +3 -3
  42. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  43. package/dist/cdn/foxy-table.js +1 -1
  44. package/dist/cdn/foxy-tax-card.js +1 -1
  45. package/dist/cdn/foxy-tax-form.js +1 -1
  46. package/dist/cdn/foxy-template-config-form.js +1 -1
  47. package/dist/cdn/foxy-template-form.js +1 -1
  48. package/dist/cdn/foxy-transaction-card.js +1 -1
  49. package/dist/cdn/foxy-transactions-table.js +1 -1
  50. package/dist/cdn/foxy-user-form.js +1 -1
  51. package/dist/cdn/foxy-users-table.js +1 -1
  52. package/dist/cdn/{shared-b2330475.js → shared-00db6da0.js} +1 -1
  53. package/dist/cdn/{shared-9af7b5f0.js → shared-02945b27.js} +1 -1
  54. package/dist/cdn/{shared-b03b6d72.js → shared-07049bfe.js} +1 -1
  55. package/dist/cdn/{shared-ccea5a33.js → shared-08c63028.js} +1 -1
  56. package/dist/cdn/shared-0e4d19e2.js +1 -0
  57. package/dist/cdn/{shared-a4e6ecb0.js → shared-1497778c.js} +1 -1
  58. package/dist/cdn/{shared-f875a4f8.js → shared-1f307a03.js} +1 -1
  59. package/dist/cdn/{shared-4038cb18.js → shared-203923ef.js} +1 -1
  60. package/dist/cdn/shared-301a57fe.js +1 -0
  61. package/dist/cdn/{shared-a11160e7.js → shared-347cb5d5.js} +1 -1
  62. package/dist/cdn/{shared-0bda8ecb.js → shared-3b8cfbb1.js} +1 -1
  63. package/dist/cdn/{shared-51b5e223.js → shared-40b5267a.js} +1 -1
  64. package/dist/cdn/{shared-ff149b55.js → shared-47223541.js} +1 -1
  65. package/dist/cdn/{shared-8f7a66c4.js → shared-4dc6d228.js} +1 -1
  66. package/dist/cdn/{shared-a8d96c23.js → shared-680cb883.js} +1 -1
  67. package/dist/cdn/{shared-c6a4b2d6.js → shared-80ce089c.js} +1 -1
  68. package/dist/cdn/shared-8a5ec3cf.js +1 -0
  69. package/dist/cdn/shared-d4d7391d.js +302 -0
  70. package/dist/cdn/{shared-0fcdd1c4.js → shared-e563e7b0.js} +1 -1
  71. package/dist/cdn/{shared-cd3c902e.js → shared-e68b9c83.js} +1 -1
  72. package/dist/cdn/{shared-d9a260f0.js → shared-f7805cfe.js} +1 -1
  73. package/dist/cdn/translations/shared/en.json +178 -0
  74. package/dist/elements/private/FrequencyInput/FrequencyInput.d.ts +2 -1
  75. package/dist/elements/private/FrequencyInput/FrequencyInput.js +3 -1
  76. package/dist/elements/private/FrequencyInput/FrequencyInput.js.map +1 -1
  77. package/dist/elements/public/CollectionPage/CollectionPage.js +3 -1
  78. package/dist/elements/public/CollectionPage/CollectionPage.js.map +1 -1
  79. package/dist/elements/public/CollectionPage/types.d.ts +2 -0
  80. package/dist/elements/public/CollectionPage/types.js.map +1 -1
  81. package/dist/elements/public/CouponCard/CouponCard.js +2 -2
  82. package/dist/elements/public/CouponCard/CouponCard.js.map +1 -1
  83. package/dist/elements/public/GiftCardCard/GiftCardCard.d.ts +26 -0
  84. package/dist/elements/public/GiftCardCard/GiftCardCard.js +118 -0
  85. package/dist/elements/public/GiftCardCard/GiftCardCard.js.map +1 -0
  86. package/dist/elements/public/GiftCardCard/index.d.ts +5 -0
  87. package/dist/elements/public/GiftCardCard/index.js +7 -0
  88. package/dist/elements/public/GiftCardCard/index.js.map +1 -0
  89. package/dist/elements/public/GiftCardCard/types.d.ts +36 -0
  90. package/dist/elements/public/GiftCardCard/types.js +2 -0
  91. package/dist/elements/public/GiftCardCard/types.js.map +1 -0
  92. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.d.ts +55 -0
  93. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +292 -0
  94. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -0
  95. package/dist/elements/public/GiftCardCodeForm/index.d.ts +10 -0
  96. package/dist/elements/public/GiftCardCodeForm/index.js +12 -0
  97. package/dist/elements/public/GiftCardCodeForm/index.js.map +1 -0
  98. package/dist/elements/public/GiftCardCodeForm/types.d.ts +40 -0
  99. package/dist/elements/public/GiftCardCodeForm/types.js +2 -0
  100. package/dist/elements/public/GiftCardCodeForm/types.js.map +1 -0
  101. package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.d.ts +29 -0
  102. package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js +209 -0
  103. package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js.map +1 -0
  104. package/dist/elements/public/GiftCardCodesForm/index.d.ts +8 -0
  105. package/dist/elements/public/GiftCardCodesForm/index.js +12 -0
  106. package/dist/elements/public/GiftCardCodesForm/index.js.map +1 -0
  107. package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.d.ts +19 -0
  108. package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.js +48 -0
  109. package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.js.map +1 -0
  110. package/dist/elements/public/GiftCardCodesForm/types.d.ts +16 -0
  111. package/dist/elements/public/GiftCardCodesForm/types.js +2 -0
  112. package/dist/elements/public/GiftCardCodesForm/types.js.map +1 -0
  113. package/dist/elements/public/GiftCardForm/GiftCardForm.d.ts +66 -0
  114. package/dist/elements/public/GiftCardForm/GiftCardForm.js +650 -0
  115. package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -0
  116. package/dist/elements/public/GiftCardForm/currencies.d.ts +1 -0
  117. package/dist/elements/public/GiftCardForm/currencies.js +173 -0
  118. package/dist/elements/public/GiftCardForm/currencies.js.map +1 -0
  119. package/dist/elements/public/GiftCardForm/index.d.ts +18 -0
  120. package/dist/elements/public/GiftCardForm/index.js +20 -0
  121. package/dist/elements/public/GiftCardForm/index.js.map +1 -0
  122. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.d.ts +19 -0
  123. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js +98 -0
  124. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js.map +1 -0
  125. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.d.ts +33 -0
  126. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js +52 -0
  127. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js.map +1 -0
  128. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.d.ts +26 -0
  129. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js +53 -0
  130. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js.map +1 -0
  131. package/dist/elements/public/GiftCardForm/types.d.ts +52 -0
  132. package/dist/elements/public/GiftCardForm/types.js +2 -0
  133. package/dist/elements/public/GiftCardForm/types.js.map +1 -0
  134. package/dist/elements/public/index.d.ts +4 -0
  135. package/dist/elements/public/index.defined.d.ts +4 -0
  136. package/dist/elements/public/index.defined.js +4 -0
  137. package/dist/elements/public/index.defined.js.map +1 -1
  138. package/dist/elements/public/index.js +4 -0
  139. package/dist/elements/public/index.js.map +1 -1
  140. package/dist/mixins/themeable.js +12 -0
  141. package/dist/mixins/themeable.js.map +1 -1
  142. package/dist/utils/parse-duration.d.ts +1 -1
  143. package/dist/utils/parse-duration.js +7 -3
  144. package/dist/utils/parse-duration.js.map +1 -1
  145. package/package.json +1 -1
  146. package/dist/cdn/shared-6b7602c7.js +0 -1
  147. package/dist/cdn/shared-710ed658.js +0 -134
  148. package/dist/cdn/shared-800a5471.js +0 -1
  149. package/dist/cdn/shared-87ca7818.js +0 -1
@@ -1 +1 @@
1
- import"./shared-bb824ab4.js";import"./shared-0ced76a0.js";import"./shared-f875a4f8.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{C as e}from"./shared-51b5e223.js";import"./shared-710ed658.js";import"./shared-0fcdd1c4.js";import"./shared-a8d96c23.js";import{s,h as t}from"./shared-63eaded9.js";import{S as i,T as r,a}from"./shared-cd3c902e.js";import"./shared-ec861f31.js";import"./shared-36629ded.js";import{m as n}from"./shared-c1dadefe.js";import{G as l}from"./shared-9af7b5f0.js";import"./shared-df573cea.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import{c as o}from"./shared-4e709717.js";import{C as d}from"./shared-51e28c83.js";import{N as h}from"./shared-423a4840.js";import{i as m}from"./shared-6d45a07b.js";import{v as c}from"./shared-b738ee96.js";let C,f,p,g,u=e=>e;const y=[{property:"is_merchant",icon:s(C||(C=u`<svg class="fill-current h-full w-full" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M22.8961 8.89L21.7932 4.52C21.5622 3.62 20.7429 3 19.7871 3H5.1979C4.25259 3 3.42283 3.63 3.20225 4.52L2.0994 8.89C1.84732 9.91 2.07839 10.95 2.75061 11.77C2.83464 11.88 2.95017 11.96 3.0447 12.06V19C3.0447 20.1 3.99001 21 5.14538 21H19.8501C21.0055 21 21.9508 20.1 21.9508 19V12.06C22.0453 11.97 22.1609 11.88 22.2449 11.78C22.9171 10.96 23.1587 9.91 22.8961 8.89ZM19.7556 4.99L20.8584 9.36C20.9635 9.78 20.8689 10.2 20.5958 10.53C20.4488 10.71 20.1337 11 19.6085 11C18.9678 11 18.4111 10.51 18.3376 9.86L17.7284 5L19.7556 4.99ZM13.5481 5H15.6067L16.1739 9.52C16.2264 9.91 16.1004 10.3 15.8273 10.59C15.5962 10.85 15.2601 11 14.8295 11C14.1258 11 13.5481 10.41 13.5481 9.69V5ZM8.81106 9.52L9.38874 5H11.4474V9.69C11.4474 10.41 10.8697 11 10.0925 11C9.73536 11 9.40975 10.85 9.15767 10.59C8.89509 10.3 8.76905 9.91 8.81106 9.52ZM4.13705 9.36L5.1979 5H7.26706L6.65787 9.86C6.57384 10.51 6.02766 11 5.38696 11C4.87229 11 4.54669 10.71 4.41014 10.53C4.12655 10.21 4.03202 9.78 4.13705 9.36ZM5.14538 19V12.97C5.22941 12.98 5.30293 13 5.38696 13C6.30075 13 7.13052 12.64 7.73971 12.05C8.36992 12.65 9.21019 13 10.166 13C11.0798 13 11.8991 12.64 12.5082 12.07C13.1279 12.64 13.9682 13 14.9135 13C15.7958 13 16.6361 12.65 17.2663 12.05C17.8755 12.64 18.7052 13 19.619 13C19.7031 13 19.7766 12.98 19.8606 12.97V19H5.14538Z" /></svg>`)),key:"merchant"},{property:"is_programmer",icon:s(f||(f=u`<svg class="fill-current h-full w-full" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 3C0 1.34315 1.34315 0 3 0H17C18.6569 0 20 1.34315 20 3V15C20 16.6569 18.6569 18 17 18H3C1.34315 18 0 16.6569 0 15V3ZM3 2C2.44772 2 2 2.44772 2 3V15C2 15.5523 2.44772 16 3 16H17C17.5523 16 18 15.5523 18 15V3C18 2.44772 17.5523 2 17 2H3ZM4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L9.70711 8.29289C9.89464 8.48043 10 8.73478 10 9C10 9.26522 9.89464 9.51957 9.70711 9.70711L5.70711 13.7071C5.31658 14.0976 4.68342 14.0976 4.29289 13.7071C3.90237 13.3166 3.90237 12.6834 4.29289 12.2929L7.58579 9L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289ZM9 13C9 12.4477 9.44771 12 10 12H15C15.5523 12 16 12.4477 16 13C16 13.5523 15.5523 14 15 14H10C9.44771 14 9 13.5523 9 13Z"/></svg>`)),key:"backend_developer"},{property:"is_front_end_developer",icon:s(p||(p=u`<svg class="fill-current h-full w-full" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.2747 4.03847C14.8058 4.1902 15.1132 4.74368 14.9615 5.27472L10.9615 19.2747C10.8098 19.8058 10.2563 20.1132 9.72528 19.9615C9.19424 19.8098 8.88675 19.2563 9.03848 18.7253L13.0385 4.72528C13.1902 4.19424 13.7437 3.88675 14.2747 4.03847ZM6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.7071L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289ZM17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C22.8946 11.4804 23 11.7348 23 12C23 12.2652 22.8946 12.5196 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z" /></svg>`)),key:"frontend_developer"},{property:"is_designer",icon:s(g||(g=u`<svg class="fill-current h-full w-full" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 20C4.49 20 0 15.51 0 10C0 4.49 4.49 0 10 0C15.51 0 20 4.04 20 9C20 12.31 17.31 15 14 15H12.23C11.95 15 11.73 15.22 11.73 15.5C11.73 15.62 11.78 15.73 11.86 15.83C12.27 16.3 12.5 16.89 12.5 17.5C12.5 18.88 11.38 20 10 20ZM10 2C5.59 2 2 5.59 2 10C2 14.41 5.59 18 10 18C10.28 18 10.5 17.78 10.5 17.5C10.5 17.34 10.42 17.22 10.36 17.15C9.95 16.69 9.73 16.1 9.73 15.5C9.73 14.12 10.85 13 12.23 13H14C16.21 13 18 11.21 18 9C18 5.14 14.41 2 10 2Z" /><path d="M4.5 11C5.32843 11 6 10.3284 6 9.5C6 8.67157 5.32843 8 4.5 8C3.67157 8 3 8.67157 3 9.5C3 10.3284 3.67157 11 4.5 11Z" /><path d="M7.5 7C8.32843 7 9 6.32843 9 5.5C9 4.67157 8.32843 4 7.5 4C6.67157 4 6 4.67157 6 5.5C6 6.32843 6.67157 7 7.5 7Z" /><path d="M12.5 7C13.3284 7 14 6.32843 14 5.5C14 4.67157 13.3284 4 12.5 4C11.6716 4 11 4.67157 11 5.5C11 6.32843 11.6716 7 12.5 7Z" /><path d="M15.5 11C16.3284 11 17 10.3284 17 9.5C17 8.67157 16.3284 8 15.5 8C14.6716 8 14 8.67157 14 9.5C14 10.3284 14.6716 11 15.5 11Z" /></svg>`)),key:"designer"}];let v,x,_,$=e=>e;const b=i(r(d(a(h,"user-form"))));class w extends b{constructor(){super(...arguments),this.__getValidator=n((e=>()=>!this.errors.some((s=>s.startsWith(e))))),this.__bindField=n((e=>s=>{const t=s.target;this.edit({[e]:t.value})}))}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"x-checkbox":e,"foxy-i18n":customElements.get("foxy-i18n"),"x-group":l}}static get v8n(){return[({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({email:e})=>e&&e.length>0||"email_required",({email:e})=>e&&e.length<=100||"email_too_long",({email:e})=>e&&c(e)||"email_invalid_email",({phone:e})=>!e||e.length<=50||"phone_too_long"]}render(){const e=this.in({idle:{template:{dirty:"valid"}}}),s=this.in({idle:{snapshot:{dirty:"valid"}}}),i=e||s,r=this.in("busy"),a=this.in("fail"),n=r||a||this.disabled;return t(v||(v=$` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="grid grid-cols-1 sm-grid-cols-2 gap-m"> ${0} </div> <x-group frame> ${0} </x-group> <vaadin-button data-testid="action" theme="${0}" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </vaadin-button> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </div> `),this.lang,this.ns,this.__handleConfirmHide,this.in("busy"),["first_name","last_name","email","phone"].map((e=>t(x||(x=$` <vaadin-text-field error-message="${0}" data-testid="${0}" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> `),this.__getErrorMessage(e),e,n,this.readonly,this.t(e),m(this.form[e]),this.__getValidator(e),this.__bindField(e),this.__handleKeyDown))),y.map(((e,s)=>t(_||(_=$` <hr class="${0}" style="margin-left:calc((var(--lumo-space-m) * 2) + 1.125rem)"> <x-checkbox class="w-full p-m" ?readonly="${0}" ?disabled="${0}" ?checked="${0}" @change="${0}"> <div class="flex items-start leading-s"> <div class="flex-1 flex flex-col"> <foxy-i18n key="${0}" lang="${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-s text-secondary" lang="${0}" key="${0}_explainer" ns="${0}"> </foxy-i18n> </div> <div class="mt-xs" style="width:1.125rem;height:1.125rem">${0}</div> </div> </x-checkbox> `),s>0?"border-contrast-10":"hidden",this.readonly,n,this.form[e.property],(s=>{const t=s.target;this.edit({[e.property]:t.checked})}),e.key,this.lang,this.ns,this.lang,e.key,this.ns,e.icon))),this.in("idle")?"primary "+(this.href?"error":"success"):"",this.in({idle:"template"})&&!i||n,this.__handleActionClick,this.lang,this.href?"delete":"create",this.ns,o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!r&&!a}),a?"error":r?"busy":"empty",this.lang,this.ns)}__getErrorMessage(e){const s=this.errors.find((s=>s.startsWith(e)));return s?this.t(s.replace(e,"v8n")):""}__handleActionClick(e){if(this.in({idle:"snapshot"})){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}__handleConfirmHide(e){e.detail.cancelled||this.delete()}__handleKeyDown(e){"Enter"===e.key&&this.submit()}}customElements.define("foxy-user-form",w);export{w as U,y as r};
1
+ import"./shared-bb824ab4.js";import"./shared-0ced76a0.js";import"./shared-1f307a03.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{C as e}from"./shared-40b5267a.js";import"./shared-d4d7391d.js";import"./shared-e563e7b0.js";import"./shared-680cb883.js";import{s,h as t}from"./shared-63eaded9.js";import{S as i,T as r,a}from"./shared-e68b9c83.js";import"./shared-36629ded.js";import"./shared-ec861f31.js";import{m as n}from"./shared-c1dadefe.js";import{G as l}from"./shared-02945b27.js";import"./shared-df573cea.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import{c as o}from"./shared-4e709717.js";import{C as d}from"./shared-51e28c83.js";import{N as h}from"./shared-423a4840.js";import{i as m}from"./shared-6d45a07b.js";import{v as c}from"./shared-b738ee96.js";let C,f,p,g,u=e=>e;const y=[{property:"is_merchant",icon:s(C||(C=u`<svg class="fill-current h-full w-full" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M22.8961 8.89L21.7932 4.52C21.5622 3.62 20.7429 3 19.7871 3H5.1979C4.25259 3 3.42283 3.63 3.20225 4.52L2.0994 8.89C1.84732 9.91 2.07839 10.95 2.75061 11.77C2.83464 11.88 2.95017 11.96 3.0447 12.06V19C3.0447 20.1 3.99001 21 5.14538 21H19.8501C21.0055 21 21.9508 20.1 21.9508 19V12.06C22.0453 11.97 22.1609 11.88 22.2449 11.78C22.9171 10.96 23.1587 9.91 22.8961 8.89ZM19.7556 4.99L20.8584 9.36C20.9635 9.78 20.8689 10.2 20.5958 10.53C20.4488 10.71 20.1337 11 19.6085 11C18.9678 11 18.4111 10.51 18.3376 9.86L17.7284 5L19.7556 4.99ZM13.5481 5H15.6067L16.1739 9.52C16.2264 9.91 16.1004 10.3 15.8273 10.59C15.5962 10.85 15.2601 11 14.8295 11C14.1258 11 13.5481 10.41 13.5481 9.69V5ZM8.81106 9.52L9.38874 5H11.4474V9.69C11.4474 10.41 10.8697 11 10.0925 11C9.73536 11 9.40975 10.85 9.15767 10.59C8.89509 10.3 8.76905 9.91 8.81106 9.52ZM4.13705 9.36L5.1979 5H7.26706L6.65787 9.86C6.57384 10.51 6.02766 11 5.38696 11C4.87229 11 4.54669 10.71 4.41014 10.53C4.12655 10.21 4.03202 9.78 4.13705 9.36ZM5.14538 19V12.97C5.22941 12.98 5.30293 13 5.38696 13C6.30075 13 7.13052 12.64 7.73971 12.05C8.36992 12.65 9.21019 13 10.166 13C11.0798 13 11.8991 12.64 12.5082 12.07C13.1279 12.64 13.9682 13 14.9135 13C15.7958 13 16.6361 12.65 17.2663 12.05C17.8755 12.64 18.7052 13 19.619 13C19.7031 13 19.7766 12.98 19.8606 12.97V19H5.14538Z" /></svg>`)),key:"merchant"},{property:"is_programmer",icon:s(f||(f=u`<svg class="fill-current h-full w-full" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 3C0 1.34315 1.34315 0 3 0H17C18.6569 0 20 1.34315 20 3V15C20 16.6569 18.6569 18 17 18H3C1.34315 18 0 16.6569 0 15V3ZM3 2C2.44772 2 2 2.44772 2 3V15C2 15.5523 2.44772 16 3 16H17C17.5523 16 18 15.5523 18 15V3C18 2.44772 17.5523 2 17 2H3ZM4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L9.70711 8.29289C9.89464 8.48043 10 8.73478 10 9C10 9.26522 9.89464 9.51957 9.70711 9.70711L5.70711 13.7071C5.31658 14.0976 4.68342 14.0976 4.29289 13.7071C3.90237 13.3166 3.90237 12.6834 4.29289 12.2929L7.58579 9L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289ZM9 13C9 12.4477 9.44771 12 10 12H15C15.5523 12 16 12.4477 16 13C16 13.5523 15.5523 14 15 14H10C9.44771 14 9 13.5523 9 13Z"/></svg>`)),key:"backend_developer"},{property:"is_front_end_developer",icon:s(p||(p=u`<svg class="fill-current h-full w-full" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.2747 4.03847C14.8058 4.1902 15.1132 4.74368 14.9615 5.27472L10.9615 19.2747C10.8098 19.8058 10.2563 20.1132 9.72528 19.9615C9.19424 19.8098 8.88675 19.2563 9.03848 18.7253L13.0385 4.72528C13.1902 4.19424 13.7437 3.88675 14.2747 4.03847ZM6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.7071L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289ZM17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C22.8946 11.4804 23 11.7348 23 12C23 12.2652 22.8946 12.5196 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z" /></svg>`)),key:"frontend_developer"},{property:"is_designer",icon:s(g||(g=u`<svg class="fill-current h-full w-full" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 20C4.49 20 0 15.51 0 10C0 4.49 4.49 0 10 0C15.51 0 20 4.04 20 9C20 12.31 17.31 15 14 15H12.23C11.95 15 11.73 15.22 11.73 15.5C11.73 15.62 11.78 15.73 11.86 15.83C12.27 16.3 12.5 16.89 12.5 17.5C12.5 18.88 11.38 20 10 20ZM10 2C5.59 2 2 5.59 2 10C2 14.41 5.59 18 10 18C10.28 18 10.5 17.78 10.5 17.5C10.5 17.34 10.42 17.22 10.36 17.15C9.95 16.69 9.73 16.1 9.73 15.5C9.73 14.12 10.85 13 12.23 13H14C16.21 13 18 11.21 18 9C18 5.14 14.41 2 10 2Z" /><path d="M4.5 11C5.32843 11 6 10.3284 6 9.5C6 8.67157 5.32843 8 4.5 8C3.67157 8 3 8.67157 3 9.5C3 10.3284 3.67157 11 4.5 11Z" /><path d="M7.5 7C8.32843 7 9 6.32843 9 5.5C9 4.67157 8.32843 4 7.5 4C6.67157 4 6 4.67157 6 5.5C6 6.32843 6.67157 7 7.5 7Z" /><path d="M12.5 7C13.3284 7 14 6.32843 14 5.5C14 4.67157 13.3284 4 12.5 4C11.6716 4 11 4.67157 11 5.5C11 6.32843 11.6716 7 12.5 7Z" /><path d="M15.5 11C16.3284 11 17 10.3284 17 9.5C17 8.67157 16.3284 8 15.5 8C14.6716 8 14 8.67157 14 9.5C14 10.3284 14.6716 11 15.5 11Z" /></svg>`)),key:"designer"}];let v,x,_,b=e=>e;const $=i(r(d(a(h,"user-form"))));class w extends ${constructor(){super(...arguments),this.__getValidator=n((e=>()=>!this.errors.some((s=>s.startsWith(e))))),this.__bindField=n((e=>s=>{const t=s.target;this.edit({[e]:t.value})}))}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"x-checkbox":e,"foxy-i18n":customElements.get("foxy-i18n"),"x-group":l}}static get v8n(){return[({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({email:e})=>e&&e.length>0||"email_required",({email:e})=>e&&e.length<=100||"email_too_long",({email:e})=>e&&c(e)||"email_invalid_email",({phone:e})=>!e||e.length<=50||"phone_too_long"]}render(){const e=this.in({idle:{template:{dirty:"valid"}}}),s=this.in({idle:{snapshot:{dirty:"valid"}}}),i=e||s,r=this.in("busy"),a=this.in("fail"),n=r||a||this.disabled;return t(v||(v=b` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="grid grid-cols-1 sm-grid-cols-2 gap-m"> ${0} </div> <x-group frame> ${0} </x-group> <vaadin-button data-testid="action" theme="${0}" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </vaadin-button> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </div> `),this.lang,this.ns,this.__handleConfirmHide,this.in("busy"),["first_name","last_name","email","phone"].map((e=>t(x||(x=b` <vaadin-text-field error-message="${0}" data-testid="${0}" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> `),this.__getErrorMessage(e),e,n,this.readonly,this.t(e),m(this.form[e]),this.__getValidator(e),this.__bindField(e),this.__handleKeyDown))),y.map(((e,s)=>t(_||(_=b` <hr class="${0}" style="margin-left:calc((var(--lumo-space-m) * 2) + 1.125rem)"> <x-checkbox class="w-full p-m" ?readonly="${0}" ?disabled="${0}" ?checked="${0}" @change="${0}"> <div class="flex items-start leading-s"> <div class="flex-1 flex flex-col"> <foxy-i18n key="${0}" lang="${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-s text-secondary" lang="${0}" key="${0}_explainer" ns="${0}"> </foxy-i18n> </div> <div class="mt-xs" style="width:1.125rem;height:1.125rem">${0}</div> </div> </x-checkbox> `),s>0?"border-contrast-10":"hidden",this.readonly,n,this.form[e.property],(s=>{const t=s.target;this.edit({[e.property]:t.checked})}),e.key,this.lang,this.ns,this.lang,e.key,this.ns,e.icon))),this.in("idle")?"primary "+(this.href?"error":"success"):"",this.in({idle:"template"})&&!i||n,this.__handleActionClick,this.lang,this.href?"delete":"create",this.ns,o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!r&&!a}),a?"error":r?"busy":"empty",this.lang,this.ns)}__getErrorMessage(e){const s=this.errors.find((s=>s.startsWith(e)));return s?this.t(s.replace(e,"v8n")):""}__handleActionClick(e){if(this.in({idle:"snapshot"})){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}__handleConfirmHide(e){e.detail.cancelled||this.delete()}__handleKeyDown(e){"Enter"===e.key&&this.submit()}}customElements.define("foxy-user-form",w);export{w as U,y as r};
@@ -0,0 +1 @@
1
+ import{_ as e}from"./shared-63eaded9.js";import{p as r}from"./shared-0e4d19e2.js";function s(s){var t;const a=r(s),n=null!==(t={y:"yearly",m:"monthly",w:"weekly",d:"daily"}[a.units])&&void 0!==t?t:a.units;return e(e({},a),{},{units:n})}export{s as p};
@@ -0,0 +1,302 @@
1
+ import{k as e,P as t,A as a,L as s,j as i,h as r,_ as n}from"./shared-63eaded9.js";import{F as l}from"./shared-46ee137f.js";import{E as o,C as d,T as h}from"./shared-df573cea.js";import"./shared-f0a83bd6.js";import"./shared-36629ded.js";import{a as u}from"./shared-bb824ab4.js";import{h as c,P as p}from"./shared-ff79f3f9.js";import"./shared-ec861f31.js";import"./foxy-i18n.js";import{Q as m,T as v,U as g,V as b,W as f,X as _,Y as y,Z as x,b as w,$ as E,a0 as k,a1 as T,a2 as $,a3 as A,a4 as S,a5 as C,m as V,a6 as I}from"./shared-c1dadefe.js";import{p as M}from"./shared-0e4d19e2.js";import{c as z}from"./shared-e68b9c83.js";import{s as j}from"./shared-b0f0e8b5.js";import{i as q}from"./shared-30131f76.js";var L={raise:m,send:v,sendParent:g,sendUpdate:b,log:f,cancel:_,start:y,stop:x,assign:w,after:E,done:k,respond:T,forwardTo:$,escalate:A,choose:S,pure:C};const H=c`<dom-module id="lumo-text-area" theme-for="vaadin-text-area">
2
+ <template>
3
+ <style include="lumo-text-field">
4
+ [part="input-field"],
5
+ [part="input-field"] ::slotted(textarea) {
6
+ /* Equal to the implicit padding in vaadin-text-field */
7
+ padding-top: calc((var(--lumo-text-field-size) - 1em * var(--lumo-line-height-s)) / 2);
8
+ padding-bottom: calc((var(--lumo-text-field-size) - 1em * var(--lumo-line-height-s)) / 2);
9
+ height: auto;
10
+ box-sizing: border-box;
11
+ transition: background-color 0.1s;
12
+ line-height: var(--lumo-line-height-s);
13
+ }
14
+
15
+ :host(:not([readonly])) [part="input-field"]::after {
16
+ display: none;
17
+ }
18
+
19
+ :host([readonly]) [part="input-field"] {
20
+ border: 1px dashed var(--lumo-contrast-30pct);
21
+ }
22
+
23
+ :host([readonly]) [part="input-field"]::after {
24
+ border: none;
25
+ }
26
+
27
+ :host(:hover:not([readonly]):not([focused]):not([invalid])) [part="input-field"] {
28
+ background-color: var(--lumo-contrast-20pct);
29
+ }
30
+
31
+ @media (pointer: coarse) {
32
+ :host(:hover:not([readonly]):not([focused]):not([invalid])) [part="input-field"] {
33
+ background-color: var(--lumo-contrast-10pct);
34
+ }
35
+
36
+ :host(:active:not([readonly]):not([focused])) [part="input-field"] {
37
+ background-color: var(--lumo-contrast-20pct);
38
+ }
39
+ }
40
+
41
+ [part="value"],
42
+ [part="input-field"] ::slotted(textarea) {
43
+ line-height: inherit;
44
+ --_lumo-text-field-overflow-mask-image: none;
45
+ }
46
+
47
+ /* Vertically align icon prefix/suffix with the first line of text */
48
+ [part="input-field"] ::slotted(iron-icon) {
49
+ margin-top: calc((var(--lumo-icon-size-m) - 1em * var(--lumo-line-height-s)) / -2);
50
+ }
51
+
52
+ [part="input-field"] [part="value"],
53
+ [part="input-field"] ::slotted(textarea) {
54
+ white-space: pre-wrap; /* override \`nowrap\` from <vaadin-text-field> */
55
+ align-self: stretch; /* override \`baseline\` from <vaadin-text-field> */
56
+ }
57
+ </style>
58
+ </template>
59
+ </dom-module>`;document.head.appendChild(H.content);
60
+ /**
61
+ @license
62
+ Copyright (c) 2017 Vaadin Ltd.
63
+ This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
64
+ */
65
+ class F extends(o(u(d(h(p))))){static get template(){return c`
66
+ <style include="vaadin-text-field-shared-styles">
67
+ .vaadin-text-area-container {
68
+ flex: auto;
69
+ max-height: inherit; /* MSIE 11 */
70
+ min-height: inherit; /* MSIE 11 */
71
+ }
72
+
73
+ /* The label, helper text and the error message should neither grow nor shrink. */
74
+ [part="label"],
75
+ [part="helper-text"],
76
+ [part="error-message"] {
77
+ flex: none;
78
+ }
79
+
80
+ [part="input-field"] {
81
+ overflow: auto;
82
+ -webkit-overflow-scrolling: touch;
83
+ }
84
+
85
+ [part="value"] {
86
+ resize: none;
87
+ }
88
+
89
+ [part="value"],
90
+ [part="input-field"] ::slotted(*) {
91
+ align-self: flex-start;
92
+ }
93
+
94
+ @keyframes vaadin-text-area-appear {
95
+ to {
96
+ opacity: 1;
97
+ }
98
+ }
99
+
100
+ :host {
101
+ animation: 1ms vaadin-text-area-appear;
102
+ }
103
+
104
+ /* Workaround https://bugzilla.mozilla.org/show_bug.cgi?id=1739079 */
105
+ :host([disabled]) [part='value'] {
106
+ user-select: none;
107
+ }
108
+ </style>
109
+
110
+ <div class="vaadin-text-area-container">
111
+
112
+ <label part="label" on-click="focus" id="[[_labelId]]">[[label]]</label>
113
+
114
+ <div part="input-field" id="[[_inputId]]">
115
+
116
+ <slot name="prefix"></slot>
117
+
118
+ <slot name="textarea">
119
+ <textarea part="value"></textarea>
120
+ </slot>
121
+
122
+ <div part="clear-button" id="clearButton" role="button" aria-label\$="[[i18n.clear]]"></div>
123
+ <slot name="suffix"></slot>
124
+
125
+ </div>
126
+
127
+ <div part="helper-text" id="[[_helperTextId]]">
128
+ <slot name="helper">[[helperText]]</slot>
129
+ </div>
130
+
131
+ <div part="error-message" id="[[_errorId]]" aria-live="assertive" aria-hidden\$="[[_getErrorMessageAriaHidden(invalid, errorMessage, _errorId)]]">[[errorMessage]]</div>
132
+
133
+ </div>
134
+ `}static get is(){return"vaadin-text-area"}static get version(){return"2.9.0"}static get properties(){return{pattern:{type:String}}}static get observers(){return["_textAreaValueChanged(value)"]}ready(){super.ready(),this._updateHeight(),this.addEventListener("animationend",this._onAnimationEnd)}_onAnimationEnd(e){0===e.animationName.indexOf("vaadin-text-area-appear")&&this._updateHeight()}get _slottedTagName(){return"textarea"}_textAreaValueChanged(e){this._updateHeight()}_updateHeight(){const e=this.root.querySelector("[part=input-field]"),t=e.scrollTop,a=this.inputElement,s=this.value?this.value.length:0;if(this._oldValueLength>=s){const t=getComputedStyle(e).height,s=getComputedStyle(a).width;e.style.display="block",e.style.height=t,a.style.maxWidth=s,a.style.height="auto"}this._oldValueLength=s;const i=a.scrollHeight;i>a.clientHeight&&(a.style.height=i+"px"),a.style.removeProperty("max-width"),e.style.removeProperty("display"),e.style.removeProperty("height"),e.scrollTop=t,this._dispatchIronResizeEventIfNeeded("InputHeight",i)}checkValidity(){if(!super.checkValidity())return!1;if(!this.pattern||!this.inputElement.value)return!0;try{const e=this.inputElement.value.match(this.pattern);return!!e&&e[0]===e.input}catch(e){return!0}}}customElements.define(F.is,F);class O extends CustomEvent{constructor(e){super("change",{detail:e})}}const P=c`<dom-module id="lumo-custom-field" theme-for="vaadin-custom-field">
135
+ <template>
136
+ <style include="lumo-required-field">
137
+ :host {
138
+ --lumo-text-field-size: var(--lumo-size-m);
139
+ color: var(--lumo-body-text-color);
140
+ font-size: var(--lumo-font-size-m);
141
+ /* align with text-field height + vertical paddings */
142
+ line-height: calc(var(--lumo-text-field-size) + 2 * var(--lumo-space-xs));
143
+ font-family: var(--lumo-font-family);
144
+ -webkit-font-smoothing: antialiased;
145
+ -moz-osx-font-smoothing: grayscale;
146
+ -webkit-tap-highlight-color: transparent;
147
+ padding: 0;
148
+ }
149
+
150
+ :host::before {
151
+ margin-top: var(--lumo-space-xs);
152
+ height: var(--lumo-text-field-size);
153
+ box-sizing: border-box;
154
+ display: inline-flex;
155
+ align-items: center;
156
+ }
157
+
158
+ /* align with text-field label */
159
+ :host([has-label]) [part="label"] {
160
+ padding-bottom: calc(0.5em - var(--lumo-space-xs));
161
+ }
162
+
163
+ :host(:not([has-label])) [part="label"],
164
+ :host(:not([has-label]))::before {
165
+ display: none;
166
+ }
167
+
168
+ /* align with text-field error message */
169
+ :host([invalid]) [part="error-message"]:not(:empty)::before {
170
+ height: calc(0.4em - var(--lumo-space-xs));
171
+ }
172
+
173
+ :host([focused]:not([readonly]):not([disabled])) [part="label"] {
174
+ color: var(--lumo-primary-text-color);
175
+ }
176
+
177
+ :host(:hover:not([readonly]):not([disabled]):not([focused])) [part="label"],
178
+ :host(:hover:not([readonly]):not([disabled]):not([focused])) [part="helper-text"],
179
+ :host(:hover:not([readonly]):not([disabled]):not([focused])) [part="helper-text"] ::slotted(*) {
180
+ color: var(--lumo-body-text-color);
181
+ }
182
+
183
+ :host([has-helper]) [part="helper-text"]::before {
184
+ content: "";
185
+ display: block;
186
+ height: 0.4em;
187
+ }
188
+
189
+ [part="helper-text"],
190
+ [part="helper-text"] ::slotted(*) {
191
+ display: block;
192
+ color: var(--lumo-secondary-text-color);
193
+ font-size: var(--lumo-font-size-xs);
194
+ line-height: var(--lumo-line-height-xs);
195
+ margin-left: calc(var(--lumo-border-radius-m) / 4);
196
+ transition: color 0.2s;
197
+ }
198
+
199
+ /* helper-text position */
200
+
201
+ :host([has-helper][theme~="helper-above-field"]) [part="helper-text"]::before {
202
+ display: none;
203
+ }
204
+
205
+ :host([has-helper][theme~="helper-above-field"]) [part="helper-text"]::after {
206
+ content: "";
207
+ display: block;
208
+ height: 0.4em;
209
+ }
210
+
211
+ :host([has-helper][theme~="helper-above-field"]) [part="label"] {
212
+ order: 0;
213
+ padding-bottom: 0.4em;
214
+ }
215
+
216
+ :host([has-helper][theme~="helper-above-field"]) [part="helper-text"] {
217
+ order: 1;
218
+ }
219
+
220
+ :host([has-helper][theme~="helper-above-field"]) .inputs-wrapper {
221
+ order: 2;
222
+ }
223
+
224
+ :host([has-helper][theme~="helper-above-field"]) [part="error-message"] {
225
+ order: 3;
226
+ }
227
+
228
+ /* Touch device adjustment */
229
+ @media (pointer: coarse) {
230
+ :host(:hover:not([readonly]):not([disabled]):not([focused])) [part="label"] {
231
+ color: var(--lumo-secondary-text-color);
232
+ }
233
+ }
234
+
235
+ /* Disabled style */
236
+
237
+ :host([disabled]) [part="label"] {
238
+ color: var(--lumo-disabled-text-color);
239
+ -webkit-text-fill-color: var(--lumo-disabled-text-color);
240
+ }
241
+
242
+ /* Small theme */
243
+
244
+ :host([theme~="small"]) {
245
+ font-size: var(--lumo-font-size-s);
246
+ --lumo-text-field-size: var(--lumo-size-s);
247
+ }
248
+
249
+ :host([theme~="small"][has-label]) [part="label"] {
250
+ font-size: var(--lumo-font-size-xs);
251
+ }
252
+
253
+ :host([theme~="small"][has-label]) [part="error-message"] {
254
+ font-size: var(--lumo-font-size-xxs);
255
+ }
256
+ </style>
257
+ </template>
258
+ </dom-module>`;document.head.appendChild(P.content);const N=e=>class extends e{static get properties(){return{inputs:{type:Array,readOnly:!0},i18n:{type:Object,value:()=>({parseValue:function(e){return e.split("\t")},formatValue:function(e){return e.join("\t")}})},__errorId:String,__labelId:String,__helperTextId:String,__hasSlottedHelper:Boolean}}connectedCallback(){super.connectedCallback(),this.__observer&&this.__observer.connect()}disconnectedCallback(){super.disconnectedCallback(),this.__observer&&this.__observer.disconnect()}ready(){super.ready(),this.__setInputsFromSlot(),this.__observer=new l(this.$.slot,(()=>{this.__setInputsFromSlot()})),this.$.helperSlot.addEventListener("slotchange",this.__onHelperSlotChange.bind(this)),this.__onHelperSlotChange();const e=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor);this.addEventListener("keydown",(t=>{if(9===t.keyCode){if("slot"===t.target.parentElement.localName&&!t.defaultPrevented&&e){const e=t.target.parentElement;e.setAttribute("tabindex",-1),setTimeout((()=>e.removeAttribute("tabindex")))}this.inputs.indexOf(t.target)<this.inputs.length-1&&!t.shiftKey||this.inputs.indexOf(t.target)>0&&t.shiftKey?this.dispatchEvent(new CustomEvent("internal-tab")):this.__setValue()}})),this.addEventListener("focusin",(()=>this.setAttribute("focused",""))),this.addEventListener("focusout",(e=>{const t=this.getRootNode().activeElement;this.inputs.some((e=>t===e||e.shadowRoot&&e.shadowRoot.contains(t)))||this.removeAttribute("focused")}));var t=N._uniqueId=1+N._uniqueId||1;this.__errorId=`${this.constructor.is}-error-${t}`,this.__labelId=`${this.constructor.is}-label-${t}`,this.__helperTextId=`${this.constructor.is}-helper-${t}`}focus(){this.inputs&&this.inputs[0]&&this.inputs[0].focus()}__updateValue(e){e&&e.stopPropagation(),this.__setValue(),this.validate(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value}}))}__setValue(){this.__settingValue=!0,this.value=this.i18n.formatValue.apply(this,[this.inputs.map((e=>e.value))]),this.__settingValue=!1}__queryAllAssignedElements(e){const t=[];let a;return"SLOT"===e.tagName?a=e.assignedNodes({flatten:!0}).filter((e=>e.nodeType===Node.ELEMENT_NODE)):(t.push(e),a=Array.from(e.children)),a.forEach((e=>t.push(...this.__queryAllAssignedElements(e)))),t}__getInputsFromSlot(){return this.__queryAllAssignedElements(this.$.slot).filter((e=>e.validate||e.checkValidity))}__setInputsFromSlot(){this._setInputs(this.__getInputsFromSlot()),this.__setValue()}__valueChanged(e,t){if(this.__settingValue||!this.inputs)return;const a=this.i18n.parseValue(e);a&&0!=a.length?(this.inputs.forEach(((e,t)=>e.value=a[t])),void 0!==t&&this.validate()):console.warn("Value parser has not provided values array")}__onHelperSlotChange(){const e=this.$.helperSlot.assignedNodes({flatten:!0});this.__hasSlottedHelper=e.filter((e=>3!==e.nodeType)).length>0,this.__hasSlottedHelper?this.setAttribute("has-helper","slotted"):""!==this.helperText&&null!==this.helperText||this.removeAttribute("has-helper")}}
259
+ /**
260
+ @license
261
+ Copyright (c) 2018 Vaadin Ltd.
262
+ This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
263
+ */;class U extends(o(N(h(p)))){static get template(){return c`
264
+ <style>
265
+ :host {
266
+ display: inline-flex;
267
+ }
268
+
269
+ :host::before {
270
+ content: "\\2003";
271
+ width: 0;
272
+ display: inline-block;
273
+ /* Size and position this element on the same vertical position as the input-field element
274
+ to make vertical align for the host element work as expected */
275
+ }
276
+
277
+ :host([hidden]) {
278
+ display: none !important;
279
+ }
280
+
281
+ .container {
282
+ width: 100%;
283
+ display: flex;
284
+ flex-direction: column;
285
+ }
286
+
287
+ .inputs-wrapper {
288
+ flex: none;
289
+ }
290
+ </style>
291
+
292
+ <div class="container">
293
+ <label part="label" on-click="focus" id="[[__labelId]]">[[label]]</label>
294
+ <div class="inputs-wrapper" on-change="__updateValue">
295
+ <slot id="slot"></slot>
296
+ </div>
297
+ <div part="helper-text" id="[[__helperTextId]]">
298
+ <slot name="helper" id="helperSlot">[[helperText]]</slot>
299
+ </div>
300
+ <div part="error-message" id="[[__errorId]]" aria-live="assertive" aria-hidden\$="[[__getErrorMessageAriaHidden(invalid, errorMessage, __errorId)]]">[[errorMessage]]</div>
301
+ </div>
302
+ `}static get is(){return"vaadin-custom-field"}static get version(){return"1.3.0"}static get properties(){return{label:{type:String,value:"",observer:"_labelChanged"},name:String,required:{type:Boolean,reflectToAttribute:!0},value:{type:String,observer:"__valueChanged",notify:!0},invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1,observer:"__invalidChanged"},errorMessage:{type:String,value:"",observer:"__errorMessageChanged"},helperText:{type:String,value:"",observer:"__helperTextChanged"}}}static get observers(){return["__getActiveErrorId(invalid, errorMessage, __errorId, helperText, __helperTextId, __hasSlottedHelper)","__getActiveLabelId(label, __labelId)","__toggleHasValue(value)"]}__invalidChanged(e){this.__setOrToggleAttribute("aria-invalid",e,this)}__errorMessageChanged(e){this.__setOrToggleAttribute("has-error-message",!!e,this)}__helperTextChanged(e){this.__setOrToggleAttribute("has-helper",!!e,this)}__toggleHasValue(e){null!==e&&""!==e.trim()?this.setAttribute("has-value",""):this.removeAttribute("has-value")}_labelChanged(e){""!==e&&null!=e?this.setAttribute("has-label",""):this.removeAttribute("has-label")}validate(){return!(this.invalid=!this.checkValidity())}checkValidity(){return!(this.inputs.filter((e=>!(e.validate||e.checkValidity).call(e))).length||this.required&&!this.value.trim())}__setOrToggleAttribute(e,t,a){e&&a&&a.hasAttribute(e)===!t&&(t?a.setAttribute(e,"boolean"==typeof t?"":t):a.removeAttribute(e))}__getActiveErrorId(e,t,a,s,i,r){const n=[];(s||r)&&n.push(i),t&&e&&n.push(a),n.length>0?this.setAttribute("aria-describedby",n.join(" ")):this.removeAttribute("aria-describedby")}__getActiveLabelId(e,t){this.__setOrToggleAttribute("aria-labelledby",e?t:void 0,this)}__getErrorMessageAriaHidden(e,t,a){return(!(t&&e?a:void 0)).toString()}}customElements.define(U.is,U);class D extends CustomEvent{constructor(e){super("change",{detail:e})}}class B extends D{}const R=e((e=>s=>{const{element:i,name:r,strings:n}=s.committer;if(2!==n.length||""!==n[0]||""!==n[1])throw new Error("live directive bindings must not contain any static values");if(s.committer.parts.length>1)throw new Error("live directive must be the only directive for an attribute or property");if(s instanceof t)i[r]!==e&&s.setValue(e);else{if(!(s instanceof a))throw new Error("live directive can only be used on attributes or properties");i.getAttribute(r)!==e&&s.setValue(e)}}));let Y,W,X=e=>e;class K extends s{constructor(){super(...arguments),this.label="",this.value="",this.disabled=!1,this.readonly=!1,this.errorMessage="",this.__i18n={formatValue:e=>e.join(""),parseValue:e=>{const{count:t,units:a}=M(e);return[t.toString(),a]}},this.__getItems=V((e=>{const t=M(e).count;return[{value:"d",label:this.__t("day",{count:t})},{value:"w",label:this.__t("week",{count:t})},{value:"m",label:this.__t("month",{count:t})},{value:"y",label:this.__t("year",{count:t})}]}))}static get properties(){return{checkValidity:{attribute:!1},errorMessage:{type:String,attribute:"error-message"},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},label:{type:String},value:{type:String},lang:{type:String}}}static get styles(){return i(Y||(Y=X`:host{display:block}vaadin-custom-field{width:100%;font-size:0;line-height:0;padding-top:0!important}vaadin-custom-field::part(label){padding-bottom:var(--lumo-space-s)}vaadin-custom-field::part(error-message)[aria-hidden=false]{padding-top:var(--lumo-space-xs)}vaadin-combo-box,vaadin-integer-field{width:calc(50% - (var(--lumo-space-s)/ 2))}vaadin-integer-field{margin-right:var(--lumo-space-s);padding:0}vaadin-combo-box::part(text-field){padding:0}`))}connectedCallback(){super.connectedCallback(),this.__untrackTranslations=customElements.get("foxy-i18n").onTranslationChange((()=>{var e,t;null===(t=(e=this.__getItems.cache).clear)||void 0===t||t.call(e),this.requestUpdate()}))}render(){return r(W||(W=X` <vaadin-custom-field data-testid="field" .i18n="${0}" .label="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" .errorMessage="${0}" .checkValidity="${0}" @change="${0}"> <vaadin-integer-field data-testid="value" min="1" max="999" has-controls prevent-invalid-input ?invalid="${0}" ?disabled="${0}" ?readonly="${0}"> </vaadin-integer-field> <vaadin-combo-box data-testid="units" item-value-path="value" item-label-path="label" .items="${0}" ?invalid="${0}" ?disabled="${0}" ?readonly="${0}"> </vaadin-combo-box> </vaadin-custom-field> `),this.__i18n,this.label,R(this.value),this.disabled,this.readonly,this.errorMessage,this.checkValidity,this.__handleChange,!this.checkValidity(),this.disabled,this.readonly,this.__getItems(this.value),!this.checkValidity(),this.disabled,this.readonly)}updated(e){super.updated(e);const t=this.renderRoot.firstElementChild;t.value!==this.value&&(t.value=this.value)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this.__untrackTranslations)||void 0===e||e.call(this)}checkValidity(){return!0}get __t(){return customElements.get("foxy-i18n").i18next.getFixedT(this.lang)}__handleChange(e){const t=e.target;this.value=t.value,this.dispatchEvent(new B(this.value))}}const G=I({id:"choice",type:"parallel",context:{defaultCustomValue:"",customValue:null,custom:!1,items:[],value:null,type:"text",min:null,max:null},states:{mutability:{initial:"editable",states:{editable:{},readonly:{}},on:{SET_READONLY:[{target:".editable",cond:"isPayloadFalsey"},{target:".readonly",cond:"isPayloadTruthy"}]}},interactivity:{initial:"enabled",states:{enabled:{},disabled:{}},on:{SET_DISABLED:[{target:".enabled",cond:"isPayloadFalsey"},{target:".disabled",cond:"isPayloadTruthy"}]}},selection:{initial:"unknown",states:{unknown:{always:[{target:"multiple",cond:"isValueArray"},{target:"single"}]},none:{},single:{},multiple:{}}},extension:{initial:"unknown",states:{unknown:{always:[{target:"present",cond:"hasCustom"},{target:"absent"}]},absent:{},present:{initial:"unknown",states:{unknown:{always:[{target:"selected",cond:"hasCustomValue"},{target:"available"}]},available:{on:{SET_TYPE:{actions:"setType"}}},selected:{initial:"unknown",states:{unknown:{always:[{target:"integer",cond:"showsIntegerField"},{target:"textarea",cond:"showsTextarea"},{target:"frequency",cond:"showsFrequency"},{target:"text"}]},text:{},frequency:{},textarea:{},integer:{type:"parallel",states:{min:{initial:"unknown",states:{unknown:{always:[{target:"custom",cond:"hasMinConstraint"},{target:"none"}]},none:{},custom:{}}},max:{initial:"unknown",states:{unknown:{always:[{target:"custom",cond:"hasMaxConstraint"},{target:"none"}]},none:{},custom:{}}}}}}}}}}}},on:{SET_DEFAULT_CUSTOM_VALUE:{actions:"setDefaultCustomValue"},SET_CUSTOM:{actions:"setCustom",target:[".selection.unknown",".extension.unknown"]},SET_VALUE:{actions:"setValue",target:[".selection.unknown",".extension.unknown"]},SET_ITEMS:{actions:"setItems",target:[".selection.unknown",".extension.unknown"]},SET_TYPE:{actions:"setType",target:".extension.unknown"},SET_MIN:{actions:"setMin",target:".extension.unknown"},SET_MAX:{actions:"setMax",target:".extension.unknown"}}},{guards:{isPayloadFalsey:(e,t)=>!t.data,isPayloadTruthy:(e,t)=>!!t.data,isValueArray:e=>Array.isArray(e.value),showsIntegerField:e=>"integer"===e.type,showsFrequency:e=>"frequency"===e.type,showsTextarea:e=>"textarea"===e.type,hasMinConstraint:e=>"number"==typeof e.min,hasMaxConstraint:e=>"number"==typeof e.max,hasCustomValue:e=>"string"==typeof e.customValue,hasCustom:e=>e.custom},actions:{setDefaultCustomValue:L.assign({defaultCustomValue:(e,t)=>t.data}),setValue:L.assign({value:(e,t)=>t.data,customValue:(e,t)=>Array.isArray(t.data)?t.data.find((t=>!e.items.includes(t))):e.items.includes(t.data)?null:t.data}),setCustom:L.assign({custom:(e,t)=>t.data}),setItems:L.assign({items:(e,t)=>t.data}),setType:L.assign({type:(e,t)=>t.data}),setMin:L.assign({min:(e,t)=>t.data}),setMax:L.assign({max:(e,t)=>t.data})}});let Q,Z,J,ee,te,ae,se,ie,re,ne,le,oe,de,he=e=>e;const ue=`@foxy.io/elements::other[${(Math.pow(10,10)*Math.random()).toFixed(0)}]`;class ce extends z{constructor(){super(...arguments),this.getText=e=>e,this.__service=q(G).onChange((()=>this.requestUpdate())).onTransition((({changed:e})=>e&&this.requestUpdate())).start()}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"vaadin-text-field":customElements.get("vaadin-text-field"),"x-frequency-input":K,"vaadin-text-area":customElements.get("vaadin-text-area"),"iron-icon":customElements.get("iron-icon")}}static get styles(){return[super.styles,i(J||(J=he`:host{--item-width:calc((var(--lumo-space-m) * 2) + 1.25rem)}.ml-xxl{margin-left:var(--item-width)}.item{height:var(--lumo-size-l);width:var(--item-width)}.radio{height:1.25rem;width:1.25rem}.check{height:1.125rem;width:1.125rem}.dot{height:.5rem;width:.5rem}`))]}static get properties(){return n(n({},super.properties),{},{defaultCustomValue:{type:String,attribute:"default-custom-value"},disabled:{type:Boolean},readonly:{type:Boolean},custom:{type:Boolean},type:{type:String},min:{type:Number},max:{type:Number},value:{type:Array},items:{type:Array},getText:{attribute:!1}})}get defaultCustomValue(){return this.__service.state.context.defaultCustomValue}set defaultCustomValue(e){this.__service.send("SET_DEFAULT_CUSTOM_VALUE",{data:e})}get readonly(){return this.__service.state.matches("mutability.readonly")}set readonly(e){this.__service.send("SET_READONLY",{data:e})}get disabled(){return this.__service.state.matches("interactivity.disabled")}set disabled(e){this.__service.send("SET_DISABLED",{data:e})}get custom(){return this.__service.state.matches("extension.present")}set custom(e){this.__service.send("SET_CUSTOM",{data:e})}get type(){return this.__service.state.context.type}set type(e){this.__service.send("SET_TYPE",{data:e})}get min(){return this.__service.state.context.min}set min(e){this.__service.send("SET_MIN",{data:e})}get max(){return this.__service.state.context.max}set max(e){this.__service.send("SET_MAX",{data:e})}get value(){return this.__service.state.context.value}set value(e){this.__service.send("SET_VALUE",{data:e})}get items(){return this.__service.state.context.items}set items(e){this.__service.send("SET_ITEMS",{data:e})}render(){const e=this.custom?[...this.items,ue]:this.items,t=Array.isArray(this.value),a=this.__service.state.matches("extension.present.selected"),s=r(ee||(ee=he` ${0} `),e.map(((e,s,i)=>{var n;const l=this.custom&&s===i.length-1,o=l?a:t?!!(null===(n=this.value)||void 0===n?void 0:n.includes(e)):e===String(this.value),d=this.disabled||!this._isI18nReady,h=j({value:l?ue:e,name:t?e:"choice","data-testid":`item-${e}`,"?disabled":d,"@change":t=>{if(this.readonly)return t.preventDefault();const a=t.target.checked,s=e===ue?this.defaultCustomValue:e,i=this.value;Array.isArray(i)?this.value=e===ue?a?[...i,s]:i.slice(0,i.length-1):a?[s,...i]:i.filter((e=>e!==s)):this.value=a?s:null,this.dispatchEvent(new O(this.value))}}),u=r(te||(te=he` <div> ${0} </div> `),e===ue?this._t("choice.other").toString():r(ae||(ae=he`<slot name="${0}">${0}</slot>`),`${e}-label`,this.getText(e)));return r(se||(se=he` <div class="ml-xxl border-t border-contrast-10 ${0}"></div> ${0} <div class="mr-m ml-xxl"> ${0} ${0} </div> `),s?"":"hidden",t?function(e,t,a,s,i){const n="transition ease-in-out duration-200",l=`${n} transform ${a?"scale-100":"scale-0"} ${e?"text-contrast-70":"text-tint"}`;return r(Z||(Z=he` <label class="group flex items-center ${0}"> <div class="item flex items-center justify-center flex-shrink-0 text-primary-contrast"> <div class="check rounded-s ${0} ${0} ${0} focus-within-shadow-outline"> <iron-icon icon="lumo:checkmark" class="block w-full h-full ${0}"></iron-icon> <input type="checkbox" class="sr-only" .checked="${0}" ...="${0}"> </div> </div> <div class="font-lumo leading-m ${0}">${0}</div> </label> `),t||e?"":"cursor-pointer","border "+(e?"border-dashed border-contrast-30":"border-transparent"),n,e?"":t?a?"bg-primary-50":"bg-contrast-10":a?"bg-primary":"bg-contrast-20 group-hover-bg-contrast-30",l,a,s,t?"text-disabled":e?"text-secondary":"text-body",i)}(this.readonly,d,o,h,u):function(e,t,a,s,i){const n="transition ease-in-out duration-200",l=`${n} ${t||e?"":"shadow-xs"} transform ${a?"scale-100":"scale-0"} ${e?"bg-contrast-70":"bg-tint"}`;return r(Q||(Q=he` <label class="group flex items-center ${0}"> <div class="item flex items-center justify-center flex-shrink-0"> <div class="flex radio rounded-full ${0} ${0} ${0} focus-within-shadow-outline"> <div class="dot m-auto rounded-full ${0}"></div> <input type="radio" class="sr-only" .checked="${0}" ...="${0}"> </div> </div> <div class="font-lumo leading-m ${0}">${0}</div> </label> `),t||e?"":"cursor-pointer","border "+(e?"border-dashed border-contrast-30":"border-transparent"),n,e?"":t?a?"bg-primary-50":"bg-contrast-10":a?"bg-primary":"bg-contrast-20 group-hover-bg-contrast-30",l,a,s,t?"text-disabled":e?"text-secondary":"text-body",i)}(this.readonly,d,o,h,u),e===ue&&a?this.__field:"",e!==ue?r(ie||(ie=he`<slot name="${0}"></slot>`),e):"")})));return r(re||(re=he`<form>${0}</form> `),s)}get __field(){const e=j({placeholder:this._t("choice.other").toString(),class:"w-full mb-m",value:this.__service.state.context.customValue,max:this.max,min:this.min,"?disabled":this.disabled,"?readonly":this.readonly,"data-testid":"field","@change":e=>{e.stopPropagation();const t=e.target.value;Array.isArray(this.value)?this.value=this.value.slice(0,this.value.length-1).concat(t):this.value=t,this.dispatchEvent(new O(this.value))}});return"frequency"===this.type?r(ne||(ne=he`<x-frequency-input ...="${0}"></x-frequency-input>`),e):"integer"===this.type?r(le||(le=he`<vaadin-integer-field ...="${0}" has-controls></vaadin-integer-field>`),e):"textarea"===this.type?r(oe||(oe=he`<vaadin-text-area ...="${0}"></vaadin-text-area>`),e):r(de||(de=he`<vaadin-text-field ...="${0}"></vaadin-text-field>`),e)}}export{ce as C,D,K as F,U as a,O as b,L as c};
@@ -1 +1 @@
1
- import{L as e,j as t,_ as s,h as i}from"./shared-63eaded9.js";import{A as a}from"./shared-4fa5f144.js";import{C as o}from"./shared-51e28c83.js";import{T as n,R as l,a as d}from"./shared-cd3c902e.js";import{F as r}from"./shared-c1dadefe.js";import{c}from"./shared-4e709717.js";class h extends CustomEvent{constructor(e=!1){super("hide",{detail:{cancelled:e}})}}class u extends CustomEvent{constructor(){super("show")}}let p,m=e=>e;class v extends(n(l(e))){static get styles(){return[super.styles,t(p||(p=m`:host{position:relative;z-index:200}`))]}}let b,_,y,g,f,w,x,$=e=>e;class D extends(d(o(n(e)))){constructor(){super(...arguments),this.closable=!1,this.editable=!1,this.header="",this.alert=!1,this.__handleKeyDown=e=>{"Escape"===e.key&&D.openDialogs[0]===this&&this.closable&&this.hide(this.editable)},this.__connected=!1,this.__visible=!1}static get properties(){return s(s({},super.properties),{},{__connected:{attribute:!1},__visible:{attribute:!1},centered:{type:Boolean},closable:{type:Boolean},editable:{type:Boolean},header:{type:String},alert:{type:Boolean},open:{type:Boolean,noAccessor:!0}})}static get styles(){return[super.styles,t(b||(b=$`.grid-cols-header{grid-template-columns:1fr auto 1fr}.scale-85{--tw-scale-x:0.85;--tw-scale-y:0.85}`))]}get open(){return this.__visible&&this.__connected}set open(e){e===this.open||(e?this.show():this.hide(this.editable))}connectedCallback(){super.connectedCallback(),addEventListener("keydown",this.__handleKeyDown)}disconnectedCallback(){var e;super.disconnectedCallback(),removeEventListener("keydown",this.__handleKeyDown),null===(e=D.dialogWindows.get(this))||void 0===e||e.remove(),D.dialogWindows.delete(this)}createRenderRoot(){const e=new v,t=document.querySelectorAll(D.dialogWindowsHost),s=Array.from(t).pop();return e.addEventListener("fetch",(e=>{e instanceof r&&(e.stopImmediatePropagation(),e.preventDefault(),e.respondWith(new a(this).fetch(e.request)))})),null==s||s.appendChild(e),D.dialogWindows.set(this,e),e.shadowRoot}render(e){if(!this.__connected)return i(_||(_=$``));const t=D.openDialogs[0]===this,s=D.openDialogs[1]===this,a=D.openDialogs[2]===this,o=!t&&!s&&!a;return i(y||(y=$` <div class="${0}"> <div id="backdrop" class="${0}" tabindex="-1" @click="${0}"></div> <div role="dialog" aria-labelledby="dialog-title" class="${0}"> <div class="${0}"> <div class="h-l grid grid-cols-header text-m font-lumo font-medium border-b border-contrast-10"> ${0} <h1 id="dialog-title" class="truncate self-center text-center"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </h1> ${0} </div> <div class="flex-1 overflow-y-auto overflow-x-hidden overscroll-contain"> <div class="p-m relative">${0}</div> </div> </div> </div> </div> `),c({"z-50 fixed inset-0":!0,"pointer-events-none":!this.__visible}),c({"select-none ease-in-out transition duration-500 absolute inset-0 bg-shade-50 focus-outline-none":!0,"opacity-100":this.__visible,"opacity-0":!this.__visible}),(()=>this.closable&&this.hide(this.editable)),c({"transform origin-bottom ease-in-out transition duration-500 relative h-full ml-auto sm-origin-center sm-max-w-modal":!0,"flex justify-center items-end sm-items-center mr-auto":this.alert,"translate-y-full sm-translate-y-0":!this.__visible,"sm-translate-x-full":!this.alert&&!this.__visible,"sm-opacity-0 sm-scale-110":this.alert&&!this.__visible,"translate-y-0 translate-x-0":t&&this.__visible,"scale-95 -translate-y-s sm-translate-y-0":s&&this.__visible,"scale-90 -translate-y-m sm-translate-y-0":a&&this.__visible,"opacity-0 scale-85 -translate-y-l sm-translate-y-0":o&&this.__visible}),c({"overflow-hidden flex flex-col bg-base rounded-t-l sm-rounded-b-l":!0,"absolute inset-0 mt-xl sm-m-xl":!this.alert,"shadow-xxl":this.__visible}),this.closable&&!this.hiddenSelector.matches("close-button",!0)?i(g||(g=$` <vaadin-button id="close-button" theme="tertiary-inline" class="mr-auto m-s px-s" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </vaadin-button> `),this.disabledSelector.matches("close-button",!0),(()=>this.hide(this.editable)),this.lang,this.editable?"cancel":"close",this.ns):i(f||(f=$`<div></div>`)),this.ns,this.lang,this.header,this.editable&&!this.hiddenSelector.matches("save-button",!0)?i(w||(w=$` <vaadin-button data-testid="save-button" ?disabled="${0}" theme="primary" class="ml-auto h-auto min-h-0 min-w-0 m-xs px-m" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="save"></foxy-i18n> </vaadin-button> `),this.disabledSelector.matches("save-button",!0),this.save,this.ns,this.lang):i(x||(x=$`<div></div>`)),null==e?void 0:e())}async hide(e=!1){var t;null===(t=this.__returnFocusTo)||void 0===t||t.focus(),await this.__setOpenDialogs(D.openDialogs.filter((e=>e!==this))),await this.__setConnected(!1),this.dispatchEvent(new D.HideEvent(!!e))}async show(e){this.__returnFocusTo=e,await this.__setConnected(!0),await this.__setOpenDialogs([this,...D.openDialogs]);const t=this.renderRoot.querySelector("#close-button");null==t||t.focus(),this.dispatchEvent(new D.ShowEvent)}async save(){await this.hide(!1)}async __setOpenDialogs(e){D.openDialogs.length=0,D.openDialogs.push(...e),await Promise.all([Promise.all(D.openDialogs.map((e=>e.requestUpdate()))),new Promise((e=>{this.renderRoot.querySelector("#backdrop").addEventListener("transitionend",e,{once:!0}),this.__visible=D.openDialogs.includes(this)}))])}async __setConnected(e){this.__connected=e,await this.updateComplete.then((()=>this.getBoundingClientRect()))}}D.dialogWindowsHost="#foxy-dialog-windows-host, body",D.dialogWindows=new WeakMap,D.openDialogs=[],D.ShowEvent=u,D.HideEvent=h,customElements.define("foxy-dialog-window",v);export{D};
1
+ import{L as e,j as t,_ as s,h as i}from"./shared-63eaded9.js";import{A as a}from"./shared-4fa5f144.js";import{C as o}from"./shared-51e28c83.js";import{T as n,R as l,a as d}from"./shared-e68b9c83.js";import{F as r}from"./shared-c1dadefe.js";import{c}from"./shared-4e709717.js";class h extends CustomEvent{constructor(e=!1){super("hide",{detail:{cancelled:e}})}}class u extends CustomEvent{constructor(){super("show")}}let p,m=e=>e;class v extends(n(l(e))){static get styles(){return[super.styles,t(p||(p=m`:host{position:relative;z-index:200}`))]}}let b,_,y,g,f,w,x,$=e=>e;class D extends(d(o(n(e)))){constructor(){super(...arguments),this.closable=!1,this.editable=!1,this.header="",this.alert=!1,this.__handleKeyDown=e=>{"Escape"===e.key&&D.openDialogs[0]===this&&this.closable&&this.hide(this.editable)},this.__connected=!1,this.__visible=!1}static get properties(){return s(s({},super.properties),{},{__connected:{attribute:!1},__visible:{attribute:!1},centered:{type:Boolean},closable:{type:Boolean},editable:{type:Boolean},header:{type:String},alert:{type:Boolean},open:{type:Boolean,noAccessor:!0}})}static get styles(){return[super.styles,t(b||(b=$`.grid-cols-header{grid-template-columns:1fr auto 1fr}.scale-85{--tw-scale-x:0.85;--tw-scale-y:0.85}`))]}get open(){return this.__visible&&this.__connected}set open(e){e===this.open||(e?this.show():this.hide(this.editable))}connectedCallback(){super.connectedCallback(),addEventListener("keydown",this.__handleKeyDown)}disconnectedCallback(){var e;super.disconnectedCallback(),removeEventListener("keydown",this.__handleKeyDown),null===(e=D.dialogWindows.get(this))||void 0===e||e.remove(),D.dialogWindows.delete(this)}createRenderRoot(){const e=new v,t=document.querySelectorAll(D.dialogWindowsHost),s=Array.from(t).pop();return e.addEventListener("fetch",(e=>{e instanceof r&&(e.stopImmediatePropagation(),e.preventDefault(),e.respondWith(new a(this).fetch(e.request)))})),null==s||s.appendChild(e),D.dialogWindows.set(this,e),e.shadowRoot}render(e){if(!this.__connected)return i(_||(_=$``));const t=D.openDialogs[0]===this,s=D.openDialogs[1]===this,a=D.openDialogs[2]===this,o=!t&&!s&&!a;return i(y||(y=$` <div class="${0}"> <div id="backdrop" class="${0}" tabindex="-1" @click="${0}"></div> <div role="dialog" aria-labelledby="dialog-title" class="${0}"> <div class="${0}"> <div class="h-l grid grid-cols-header text-m font-lumo font-medium border-b border-contrast-10"> ${0} <h1 id="dialog-title" class="truncate self-center text-center"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </h1> ${0} </div> <div class="flex-1 overflow-y-auto overflow-x-hidden overscroll-contain"> <div class="p-m relative">${0}</div> </div> </div> </div> </div> `),c({"z-50 fixed inset-0":!0,"pointer-events-none":!this.__visible}),c({"select-none ease-in-out transition duration-500 absolute inset-0 bg-shade-50 focus-outline-none":!0,"opacity-100":this.__visible,"opacity-0":!this.__visible}),(()=>this.closable&&this.hide(this.editable)),c({"transform origin-bottom ease-in-out transition duration-500 relative h-full ml-auto sm-origin-center sm-max-w-modal":!0,"flex justify-center items-end sm-items-center mr-auto":this.alert,"translate-y-full sm-translate-y-0":!this.__visible,"sm-translate-x-full":!this.alert&&!this.__visible,"sm-opacity-0 sm-scale-110":this.alert&&!this.__visible,"translate-y-0 translate-x-0":t&&this.__visible,"scale-95 -translate-y-s sm-translate-y-0":s&&this.__visible,"scale-90 -translate-y-m sm-translate-y-0":a&&this.__visible,"opacity-0 scale-85 -translate-y-l sm-translate-y-0":o&&this.__visible}),c({"overflow-hidden flex flex-col bg-base rounded-t-l sm-rounded-b-l":!0,"absolute inset-0 mt-xl sm-m-xl":!this.alert,"shadow-xxl":this.__visible}),this.closable&&!this.hiddenSelector.matches("close-button",!0)?i(g||(g=$` <vaadin-button id="close-button" theme="tertiary-inline" class="mr-auto m-s px-s" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> </vaadin-button> `),this.disabledSelector.matches("close-button",!0),(()=>this.hide(this.editable)),this.lang,this.editable?"cancel":"close",this.ns):i(f||(f=$`<div></div>`)),this.ns,this.lang,this.header,this.editable&&!this.hiddenSelector.matches("save-button",!0)?i(w||(w=$` <vaadin-button data-testid="save-button" ?disabled="${0}" theme="primary" class="ml-auto h-auto min-h-0 min-w-0 m-xs px-m" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="save"></foxy-i18n> </vaadin-button> `),this.disabledSelector.matches("save-button",!0),this.save,this.ns,this.lang):i(x||(x=$`<div></div>`)),null==e?void 0:e())}async hide(e=!1){var t;null===(t=this.__returnFocusTo)||void 0===t||t.focus(),await this.__setOpenDialogs(D.openDialogs.filter((e=>e!==this))),await this.__setConnected(!1),this.dispatchEvent(new D.HideEvent(!!e))}async show(e){this.__returnFocusTo=e,await this.__setConnected(!0),await this.__setOpenDialogs([this,...D.openDialogs]);const t=this.renderRoot.querySelector("#close-button");null==t||t.focus(),this.dispatchEvent(new D.ShowEvent)}async save(){await this.hide(!1)}async __setOpenDialogs(e){D.openDialogs.length=0,D.openDialogs.push(...e),await Promise.all([Promise.all(D.openDialogs.map((e=>e.requestUpdate()))),new Promise((e=>{this.renderRoot.querySelector("#backdrop").addEventListener("transitionend",e,{once:!0}),this.__visible=D.openDialogs.includes(this)}))])}async __setConnected(e){this.__connected=e,await this.updateComplete.then((()=>this.getBoundingClientRect()))}}D.dialogWindowsHost="#foxy-dialog-windows-host, body",D.dialogWindows=new WeakMap,D.openDialogs=[],D.ShowEvent=u,D.HideEvent=h,customElements.define("foxy-dialog-window",v);export{D};