@foxy.io/elements 1.16.0-beta.4 → 1.16.0-beta.5

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 (71) hide show
  1. package/dist/cdn/foxy-item-card.js +1 -1
  2. package/dist/cdn/foxy-item-form.js +1 -1
  3. package/dist/cdn/foxy-item-option-form.js +1 -1
  4. package/dist/cdn/foxy-shipment-card.js +1 -1
  5. package/dist/cdn/foxy-transaction.js +2 -2
  6. package/dist/cdn/shared-cad5fe82.js +1 -0
  7. package/dist/cdn/shared-ce2aab66.js +1 -0
  8. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.d.ts +15 -5
  9. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js +21 -7
  10. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js.map +1 -1
  11. package/dist/elements/internal/InternalAsyncComboBoxControl/index.d.ts +2 -2
  12. package/dist/elements/internal/InternalAsyncComboBoxControl/index.js +3 -3
  13. package/dist/elements/internal/InternalAsyncComboBoxControl/index.js.map +1 -1
  14. package/dist/elements/internal/InternalCard/index.d.ts +0 -3
  15. package/dist/elements/internal/InternalCard/index.js +0 -3
  16. package/dist/elements/internal/InternalCard/index.js.map +1 -1
  17. package/dist/elements/internal/InternalDateControl/InternalDateControl.d.ts +9 -2
  18. package/dist/elements/internal/InternalDateControl/InternalDateControl.js +20 -8
  19. package/dist/elements/internal/InternalDateControl/InternalDateControl.js.map +1 -1
  20. package/dist/elements/internal/InternalDateControl/index.d.ts +2 -2
  21. package/dist/elements/internal/InternalDateControl/index.js +3 -3
  22. package/dist/elements/internal/InternalDateControl/index.js.map +1 -1
  23. package/dist/elements/internal/InternalForm/index.d.ts +3 -3
  24. package/dist/elements/internal/InternalForm/index.js +3 -3
  25. package/dist/elements/internal/InternalForm/index.js.map +1 -1
  26. package/dist/elements/internal/{InternalCreateControl → InternalForm/internal/InternalCreateControl}/InternalCreateControl.d.ts +1 -1
  27. package/dist/elements/internal/{InternalCreateControl → InternalForm/internal/InternalCreateControl}/InternalCreateControl.js +1 -1
  28. package/dist/elements/internal/InternalForm/internal/InternalCreateControl/InternalCreateControl.js.map +1 -0
  29. package/dist/elements/internal/{InternalCreateControl → InternalForm/internal/InternalCreateControl}/index.d.ts +1 -1
  30. package/dist/elements/internal/{InternalCreateControl → InternalForm/internal/InternalCreateControl}/index.js +1 -1
  31. package/dist/elements/internal/InternalForm/internal/InternalCreateControl/index.js.map +1 -0
  32. package/dist/elements/internal/{InternalDeleteControl → InternalForm/internal/InternalDeleteControl}/InternalDeleteControl.d.ts +1 -1
  33. package/dist/elements/internal/{InternalDeleteControl → InternalForm/internal/InternalDeleteControl}/InternalDeleteControl.js +1 -1
  34. package/dist/elements/internal/InternalForm/internal/InternalDeleteControl/InternalDeleteControl.js.map +1 -0
  35. package/dist/elements/internal/{InternalDeleteControl → InternalForm/internal/InternalDeleteControl}/index.d.ts +2 -2
  36. package/dist/elements/internal/{InternalDeleteControl → InternalForm/internal/InternalDeleteControl}/index.js +2 -2
  37. package/dist/elements/internal/InternalForm/internal/InternalDeleteControl/index.js.map +1 -0
  38. package/dist/elements/internal/{InternalTimestampsControl → InternalForm/internal/InternalTimestampsControl}/InternalTimestampsControl.d.ts +1 -1
  39. package/dist/elements/internal/{InternalTimestampsControl → InternalForm/internal/InternalTimestampsControl}/InternalTimestampsControl.js +1 -1
  40. package/dist/elements/internal/InternalForm/internal/InternalTimestampsControl/InternalTimestampsControl.js.map +1 -0
  41. package/dist/elements/internal/{InternalTimestampsControl → InternalForm/internal/InternalTimestampsControl}/index.d.ts +0 -0
  42. package/dist/elements/internal/{InternalTimestampsControl → InternalForm/internal/InternalTimestampsControl}/index.js +0 -0
  43. package/dist/elements/internal/InternalForm/internal/InternalTimestampsControl/index.js.map +1 -0
  44. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.d.ts +9 -1
  45. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js +16 -3
  46. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js.map +1 -1
  47. package/dist/elements/internal/InternalIntegerControl/index.d.ts +2 -2
  48. package/dist/elements/internal/InternalIntegerControl/index.js +3 -3
  49. package/dist/elements/internal/InternalIntegerControl/index.js.map +1 -1
  50. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.d.ts +9 -1
  51. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js +16 -3
  52. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js.map +1 -1
  53. package/dist/elements/internal/InternalNumberControl/index.d.ts +3 -3
  54. package/dist/elements/internal/InternalNumberControl/index.js +4 -4
  55. package/dist/elements/internal/InternalNumberControl/index.js.map +1 -1
  56. package/dist/elements/internal/InternalTextControl/InternalTextControl.d.ts +9 -1
  57. package/dist/elements/internal/InternalTextControl/InternalTextControl.js +15 -2
  58. package/dist/elements/internal/InternalTextControl/InternalTextControl.js.map +1 -1
  59. package/dist/elements/internal/InternalTextControl/index.d.ts +2 -2
  60. package/dist/elements/internal/InternalTextControl/index.js +3 -3
  61. package/dist/elements/internal/InternalTextControl/index.js.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/cdn/shared-072abf87.js +0 -1
  64. package/dist/cdn/shared-935ba2fc.js +0 -1
  65. package/dist/cdn/shared-d3ffe0ef.js +0 -1
  66. package/dist/elements/internal/InternalCreateControl/InternalCreateControl.js.map +0 -1
  67. package/dist/elements/internal/InternalCreateControl/index.js.map +0 -1
  68. package/dist/elements/internal/InternalDeleteControl/InternalDeleteControl.js.map +0 -1
  69. package/dist/elements/internal/InternalDeleteControl/index.js.map +0 -1
  70. package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.js.map +0 -1
  71. package/dist/elements/internal/InternalTimestampsControl/index.js.map +0 -1
@@ -1 +1 @@
1
- export{a as ItemCard}from"./shared-d3ffe0ef.js";import"./shared-4e63d6e0.js";import"./foxy-spinner.js";import"./shared-35de1004.js";import"./shared-e090608c.js";import"./shared-ea9af4b0.js";import"./shared-2eee69db.js";import"./shared-7f33a83a.js";import"./shared-bc94606b.js";import"./shared-64657919.js";import"./shared-3026cee0.js";import"./shared-935ba2fc.js";import"./shared-757bb517.js";import"./shared-007660a6.js";import"./shared-92d6f937.js";import"./shared-1ddccf4d.js";import"./shared-9d4835ed.js";import"./shared-06014421.js";import"./shared-d3bf9ac0.js";import"./shared-4e709717.js";import"./shared-1b064836.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";
1
+ export{a as ItemCard}from"./shared-cad5fe82.js";import"./shared-4e63d6e0.js";import"./foxy-spinner.js";import"./shared-35de1004.js";import"./shared-e090608c.js";import"./shared-ea9af4b0.js";import"./shared-2eee69db.js";import"./shared-7f33a83a.js";import"./shared-bc94606b.js";import"./shared-64657919.js";import"./shared-3026cee0.js";import"./shared-06014421.js";import"./shared-d3bf9ac0.js";import"./shared-1b064836.js";import"./shared-9d4835ed.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./shared-4e709717.js";
@@ -1 +1 @@
1
- import"./shared-5097c880.js";import"./shared-60e98fbf.js";import"./shared-f7bddf72.js";import{I as e,a as t}from"./shared-072abf87.js";import{h as r,L as i,c as o}from"./shared-7f33a83a.js";import{i as n}from"./shared-d3bf9ac0.js";import"./foxy-collection-page.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import{p as s}from"./shared-4e63d6e0.js";import"./shared-bc94606b.js";import"./shared-35de1004.js";import{I as a,_ as l}from"./shared-2eee69db.js";import{T as c,a as d}from"./shared-ea9af4b0.js";import{c as f}from"./shared-4e709717.js";import{I as m}from"./shared-935ba2fc.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-coupon-card.js";import"./shared-f3f9f752.js";import{A as u}from"./shared-9d4835ed.js";import"./foxy-discount-builder.js";import"./shared-38f8a319.js";import{m as p}from"./shared-3026cee0.js";import"./shared-b8f492a4.js";import{s as h}from"./shared-2061be9a.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./shared-007660a6.js";import"./shared-e090608c.js";import"./foxy-spinner.js";import"./shared-64657919.js";import"./shared-06014421.js";import"./shared-1b064836.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./shared-92d6f937.js";import"./shared-757bb517.js";import"./shared-1ddccf4d.js";import"./shared-0479553e.js";import"./shared-fe8ec1f9.js";import"./shared-7819b0b0.js";import"./shared-bbfdfee2.js";import"./shared-5e75308a.js";import"./shared-22103348.js";import"./shared-e6f3e9f0.js";import"./shared-874bbae5.js";import"./foxy-cancellation-form.js";import"./shared-c4f0a219.js";import"./foxy-collection-pages.js";import"./shared-a8e21a41.js";import"./shared-34998df6.js";import"./foxy-table.js";import"./shared-c3c424cd.js";import"./foxy-nucleon-element.js";import"./shared-2bb49907.js";import"./shared-f0ba30e8.js";import"./shared-e59c65e3.js";let y,x=e=>e;customElements.define("foxy-internal-integer-control",class extends e{renderControl(){return r(y||(y=x` <vaadin-integer-field error-message="${0}" placeholder="${0}" helper-text="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" has-controls @keydown="${0}" @change="${0}"> </vaadin-integer-field> `),n(this._errorMessage),this.placeholder,this.helperText,this.label,this.disabled,this.readonly,this._checkValidity,this._value,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{const t=e.currentTarget;this._value=parseInt(t.value)}))}});let b,g=e=>e;class v extends(c(d(a(i)))){constructor(){super(...arguments),this.summary="",this.open=!1}static get properties(){return l(l({},super.properties),{},{summary:{type:String},open:{type:Boolean}})}render(){return r(b||(b=g` <details class="w-full border border-contrast-10 rounded-t-l rounded-b-l" ?open="${0}" @toggle="${0}"> <summary class="${0}"> <div class="flex items-center h-m pl-m pr-s"> <div class="flex items-center flex-1"> <foxy-i18n class="flex items-center text-xs tracking-wide uppercase font-bold text-body" key="${0}" infer> </foxy-i18n> <slot name="actions"></slot> </div> <iron-icon class="icon-inline text-xl text-body" icon="icons:expand-${0}"> </iron-icon> </div> </summary> <div class="border-t border-contrast-10"> <slot></slot> </div> </details> `),this.open,(e=>{this.open=e.currentTarget.open}),f({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"transition-colors cursor-pointer hover-bg-contrast-5":!0,"rounded-t-l":!0,"rounded-b-l":!this.open}),this.summary,this.open?"less":"more")}}customElements.define("foxy-internal-collapsible-card",v);let $,_,j,k,w=e=>e;customElements.define("foxy-internal-collection-card",class extends m{constructor(){super(...arguments),this.related=[],this.limit=20,this.first="",this.form="",this.item="",this.open=!1}static get properties(){return l(l({},super.properties),{},{related:{type:Array},first:{type:String},limit:{type:Number},form:{type:String},item:{type:String},open:{type:Boolean}})}renderControl(){var e,t;let i;try{const e=new URL(this.first);e.searchParams.set("limit",String(this.limit)),i=e.toString()}catch(e){i=this.first}const o=new Function("ctx",`return ctx.html\`<${this.item} related=\${JSON.stringify(ctx.related)} parent=\${ctx.parent} class="p-m" infer href=\${ctx.href}></${this.item}>\``);return r(_||(_=w` <foxy-internal-collapsible-card summary="title" infer ?open="${0}" @toggle="${0}"> ${0} <foxy-pagination class="px-m pb-s" first="${0}" infer="pagination"> <foxy-collection-page related="${0}" class="-mx-m block divide-y divide-contrast-10 mb-s" group="${0}" infer="card" .item="${0}"> </foxy-collection-page> </foxy-pagination> </foxy-internal-collapsible-card> `),this.open,(e=>{this.open=e.currentTarget.open}),this.form?r(j||(j=w` <foxy-form-dialog related="${0}" parent="${0}" group="${0}" infer="dialog" id="form" .form="${0}"> </foxy-form-dialog> ${0} `),JSON.stringify(this.related),i,n(null===(e=this.nucleon)||void 0===e?void 0:e.group),this.form,this.readonly?"":r(k||(k=w` <button class="h-xs w-xs rounded-full text-success flex items-center justify-center text-l focus-outline-none focus-ring-2 focus-ring-primary-50" slot="actions" @click="${0}"> <iron-icon class="icon-inline" icon="icons:add"></iron-icon> </button> `),(e=>{e.preventDefault(),e.stopPropagation();const t=this.renderRoot.querySelector("#form");t.header="header_create",t.href="",t.show(e.currentTarget)}))):"",i,JSON.stringify(this.related),n(null===(t=this.nucleon)||void 0===t?void 0:t.group),(e=>{if(this.form&&e.data){const t=this.disabledSelector.matches("card",!0);return r($||($=w` <button ?disabled="${0}" class="${0}" @click="${0}"> ${0} </button> `),t,f({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block transition-colors":!0,"hover-bg-contrast-5":!t}),(t=>{const r=this.renderRoot.querySelector("#form"),i=t.currentTarget;r.header="header_update",r.href=e.href,r.show(i)}),o(e))}return o(e)}))}});let S,E=e=>e;customElements.define("foxy-internal-async-combo-box-control",class extends e{constructor(){super(...arguments),this.itemLabelPath="",this.itemValuePath="",this.first=""}static get properties(){return l(l({},super.properties),{},{itemLabelPath:{type:String,attribute:"item-label-path"},itemValuePath:{type:String,attribute:"item-value-path"},first:{type:String}})}renderControl(){var e=this;return r(S||(S=E` <vaadin-combo-box item-value-path="${0}" item-label-path="${0}" error-message="${0}" item-id-path="_links.self.href" helper-text="${0}" placeholder="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .dataProvider="${0}" .value="${0}" @change="${0}"> </vaadin-combo-box> `),this.itemValuePath,this.itemLabelPath,n(this._errorMessage),this.helperText,this.placeholder,this.label,this.disabled,this.readonly,this._checkValidity,(async function(t,r){const i=new URL(e.first);i.searchParams.set("offset",String(t.page*t.pageSize)),i.searchParams.set("limit",String(t.pageSize)),t.filter&&i.searchParams.set(e.itemLabelPath,`*${t.filter}*`);const o=await new u(e).fetch(i.toString());if(!o.ok)throw new Error(await o.text());const n=await o.json();r(Array.from(Object.values(n._embedded))[0],n.total_items)}),this._value,(e=>{const t=e.currentTarget;this._value=t.value}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}});let q,C=e=>e;customElements.define("foxy-internal-item-form-line-item-discount-control",class extends m{constructor(){super(...arguments),this.infer="line-item-discount"}renderControl(){var e,t,i,o;return r(q||(q=C` <foxy-internal-collapsible-card summary="title" infer> <div class="space-y-m p-m"> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="coupon" @change="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="discount-name"></foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}"> </foxy-discount-builder> </div> </foxy-internal-collapsible-card> `),n(null===(e=this.nucleon)||void 0===e?void 0:e.coupons),(e=>{var t;e.preventDefault();const r=e.detail;null===(t=this.nucleon)||void 0===t||t.edit({discount_name:r.name,discount_type:r.coupon_discount_type,discount_details:r.coupon_discount_details})}),{type:null===(t=this.nucleon)||void 0===t?void 0:t.form.discount_type,name:null===(i=this.nucleon)||void 0===i?void 0:i.form.discount_name,details:null===(o=this.nucleon)||void 0===o?void 0:o.form.discount_details})}});let P,V,T=e=>e;customElements.define("foxy-internal-frequency-control",class extends e{constructor(){super(...arguments),this.__i18n={formatValue:e=>e.join(""),parseValue:e=>{const{count:t,units:r}=s(e);return[t.toString(),r]}},this.__getItems=p((e=>{const t=s(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 styles(){return[super.styles,o(P||(P=T`: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}`))]}renderControl(){var e;const t=null!==(e=this._value)&&void 0!==e?e:"";return r(V||(V=T` <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,t,this.disabled,this.readonly,this._errorMessage,this._checkValidity,(e=>{const t=e.currentTarget;this._value=t.value}),!!this._error,this.disabled,this.readonly,this.__getItems(t),!!this._error,this.disabled,this.readonly)}updated(e){var t;super.updated(e);const r=this.renderRoot.firstElementChild,i=null===(t=this.nucleon)||void 0===t?void 0:t.form[this.property];r.value!==i&&(r.value=i)}});let L,N=e=>e;customElements.define("foxy-internal-date-control",class extends e{constructor(){super(...arguments),this.format="unix"}static get properties(){return l(l({},super.properties),{},{format:{type:String}})}renderControl(){var e;let t;return t="unix"===this.format?h(new Date(null!==(e=this._value)&&void 0!==e?e:0)):this._value,r(L||(L=N` <vaadin-date-picker error-message="${0}" placeholder="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @change="${0}"> </vaadin-date-picker> `),n(this._errorMessage),this.placeholder,this.label,this.disabled,this.readonly,this._checkValidity,t,(e=>{var t;const r=e.currentTarget.value;"unix"===this.format&&(null===(t=this.nucleon)||void 0===t||t.edit({[this.property]:new Date(r).getTime()}))}))}});let A,I,O,R=e=>e;customElements.define("foxy-internal-item-form-subscription-control",class extends m{constructor(){super(...arguments),this.infer="subscription"}renderControl(){var e,t,i,o,n;let s;try{const r=null!==(o=null===(i=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links)["fx:subscription"])||void 0===i?void 0:i.href)&&void 0!==o?o:"",n=new URL(r);n.searchParams.set("zoom","last_transaction,transaction_template:items"),s=n.toString()}catch(e){s=null}return r(A||(A=R` <foxy-internal-collapsible-card summary="title" lang="${0}" ns="${0}"> ${0} </foxy-internal-collapsible-card> `),this.lang,this.ns,s?r(I||(I=R` <foxy-form-dialog related="${0}" header="update" infer="form" href="${0}" form="foxy-subscription-form"> </foxy-form-dialog> <button ?disabled="${0}" @click="${0}"> <foxy-subscription-card hiddencontrols="${0}" class="p-m" infer="card" href="${0}"> </foxy-subscription-card> </button> `),(null===(n=this.nucleon)||void 0===n?void 0:n.href)?JSON.stringify([this.nucleon.href]):"",s,this.disabled,(e=>{const t=e.currentTarget;t.previousElementSibling.show(t)}),this.hiddenSelector.zoom("card").toString(),s):r(O||(O=R` <div class="space-y-m p-m"> <foxy-internal-frequency-control infer="frequency" property="subscription_frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control infer="start" property="subscription_start_date"> </foxy-internal-date-control> <foxy-internal-date-control infer="end" property="subscription_end_date"> </foxy-internal-date-control> <foxy-internal-date-control infer="next" property="subscription_next_transaction_date"> </foxy-internal-date-control> </div> `)))}});let z,J=e=>e;customElements.define("foxy-internal-item-form-inventory-control",class extends m{constructor(){super(...arguments),this.infer="inventory"}renderControl(){var e;return r(z||(z=J` <foxy-internal-collapsible-card summary="title" lang="${0}" ns="${0}"> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" property="item_category_uri" first="${0}" class="col-span-2" infer="category"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="code"></foxy-internal-text-control> <foxy-internal-text-control infer="parent-code"></foxy-internal-text-control> </div> </foxy-internal-collapsible-card> `),this.lang,this.ns,n(null===(e=this.nucleon)||void 0===e?void 0:e.itemCategories))}});let M,B=e=>e;customElements.define("foxy-internal-item-form-shipping-control",class extends m{constructor(){super(...arguments),this.infer="shipping"}renderControl(){var e;return r(M||(M=B` <foxy-internal-collapsible-card summary="title" lang="${0}" ns="${0}"> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-async-combo-box-control item-value-path="address_name" item-label-path="address_name" first="${0}" class="col-span-2" infer="shipto"> </foxy-internal-async-combo-box-control> <foxy-internal-integer-control infer="width"></foxy-internal-integer-control> <foxy-internal-integer-control infer="height"></foxy-internal-integer-control> <foxy-internal-integer-control infer="length"></foxy-internal-integer-control> <foxy-internal-integer-control infer="weight"></foxy-internal-integer-control> </div> </foxy-internal-collapsible-card> `),this.lang,this.ns,n(null===(e=this.nucleon)||void 0===e?void 0:e.customerAddresses))}});let D,U=e=>e;customElements.define("foxy-internal-item-form-cart-control",class extends m{constructor(){super(...arguments),this.infer="cart"}renderControl(){return r(D||(D=U` <foxy-internal-collapsible-card summary="title" lang="${0}" ns="${0}"> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-date-control class="col-span-2" infer="expires" format="unix"> </foxy-internal-date-control> <foxy-internal-text-control class="col-span-2" infer="url"></foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="image"></foxy-internal-text-control> <foxy-internal-integer-control infer="quantity-min"></foxy-internal-integer-control> <foxy-internal-integer-control infer="quantity-max"></foxy-internal-integer-control> </div> </foxy-internal-collapsible-card> `),this.lang,this.ns)}});let G,F,H=e=>e;class K extends(d(t,"item-form")){constructor(){super(...arguments),this.customerAddresses="",this.itemCategories="",this.coupons="",this.__itemsLink=""}static get properties(){return l(l({},super.properties),{},{customerAddresses:{type:String,attribute:"customer-addresses"},itemCategories:{type:String,attribute:"item-categories"},coupons:{type:String}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!!e&&e.length<=255||"name:v8n_too_long",({price:e})=>"number"==typeof e&&!isNaN(e)||"price:v8n_required",({price:e})=>"number"==typeof e&&e>=0||"price:v8n_negative",({quantity:e})=>"number"==typeof e&&e>=1||"quantity:v8n_less_than_one"]}renderBody(){return r(G||(G=H` <foxy-internal-text-control infer="name"></foxy-internal-text-control> <div class="grid grid-cols-2 gap-m"> <foxy-internal-number-control infer="price"></foxy-internal-number-control> <foxy-internal-integer-control infer="quantity"></foxy-internal-integer-control> </div> <foxy-internal-item-form-subscription-control></foxy-internal-item-form-subscription-control> <foxy-internal-item-form-line-item-discount-control></foxy-internal-item-form-line-item-discount-control> <foxy-internal-item-form-cart-control></foxy-internal-item-form-cart-control> <foxy-internal-item-form-shipping-control></foxy-internal-item-form-shipping-control> <foxy-internal-item-form-inventory-control></foxy-internal-item-form-inventory-control> ${0} ${0} `),this.data?r(F||(F=H` <foxy-internal-collection-card infer="discount-details" first="${0}" limit="5" item="foxy-discount-detail-card"> </foxy-internal-collection-card> <foxy-internal-collection-card infer="coupon-details" first="${0}" limit="5" item="foxy-coupon-detail-card"> </foxy-internal-collection-card> <foxy-internal-collection-card infer="attributes" first="${0}" limit="5" item="foxy-attribute-card" form="foxy-attribute-form"> </foxy-internal-collection-card> <foxy-internal-collection-card related="${0}" infer="item-options" first="${0}" limit="5" item="foxy-item-option-card" form="foxy-item-option-form"> </foxy-internal-collection-card> `),this.data._links["fx:discount_details"].href,this.data._links["fx:coupon_details"].href,this.data._links["fx:attributes"].href,JSON.stringify([this.data._links["fx:transaction"].href,this.data._links["fx:shipment"],this.__itemsLink]),this.data._links["fx:item_options"].href):"",super.renderBody())}async _sendGet(){const e=await super._sendGet(),t=await super._fetch(e._links["fx:transaction"].href);return this.__itemsLink=t._links["fx:items"].href,e}}customElements.define("foxy-item-form",K);export{K as ItemForm};
1
+ import"./shared-5097c880.js";import"./shared-60e98fbf.js";import"./shared-f7bddf72.js";import{I as e,a as t,b as r}from"./shared-ce2aab66.js";import{i}from"./shared-d3bf9ac0.js";import{h as o,L as n,c as s}from"./shared-7f33a83a.js";import"./foxy-collection-page.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import{p as a}from"./shared-4e63d6e0.js";import"./shared-bc94606b.js";import"./shared-35de1004.js";import{I as l,_ as c}from"./shared-2eee69db.js";import{T as d,a as f}from"./shared-ea9af4b0.js";import{c as m}from"./shared-4e709717.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-coupon-card.js";import"./shared-f3f9f752.js";import{A as u}from"./shared-9d4835ed.js";import"./foxy-discount-builder.js";import"./shared-38f8a319.js";import{m as p}from"./shared-3026cee0.js";import"./shared-b8f492a4.js";import{s as h}from"./shared-2061be9a.js";import{p as y}from"./shared-c4f0a219.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./shared-007660a6.js";import"./shared-e090608c.js";import"./shared-06014421.js";import"./shared-1b064836.js";import"./shared-64657919.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./foxy-spinner.js";import"./shared-757bb517.js";import"./shared-92d6f937.js";import"./shared-1ddccf4d.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./shared-0479553e.js";import"./shared-fe8ec1f9.js";import"./shared-7819b0b0.js";import"./shared-bbfdfee2.js";import"./shared-5e75308a.js";import"./shared-22103348.js";import"./shared-e6f3e9f0.js";import"./shared-874bbae5.js";import"./foxy-cancellation-form.js";import"./foxy-collection-pages.js";import"./shared-a8e21a41.js";import"./shared-34998df6.js";import"./foxy-table.js";import"./shared-c3c424cd.js";import"./foxy-nucleon-element.js";import"./shared-2bb49907.js";import"./shared-f0ba30e8.js";import"./shared-e59c65e3.js";let x,b=e=>e;customElements.define("foxy-internal-integer-control",class extends e{renderControl(){return o(x||(x=b` <vaadin-integer-field error-message="${0}" placeholder="${0}" helper-text="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" has-controls @keydown="${0}" @change="${0}"> </vaadin-integer-field> `),i(this._errorMessage),this.placeholder,this.helperText,this.label,this.disabled,this.readonly,this._checkValidity,String(this._value),(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{const t=e.currentTarget;this._value=parseInt(t.value)}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:0}set _value(e){super._value=e}});let g,v=e=>e;class $ extends(d(f(l(n)))){constructor(){super(...arguments),this.summary="",this.open=!1}static get properties(){return c(c({},super.properties),{},{summary:{type:String},open:{type:Boolean}})}render(){return o(g||(g=v` <details class="w-full border border-contrast-10 rounded-t-l rounded-b-l" ?open="${0}" @toggle="${0}"> <summary class="${0}"> <div class="flex items-center h-m pl-m pr-s"> <div class="flex items-center flex-1"> <foxy-i18n class="flex items-center text-xs tracking-wide uppercase font-bold text-body" key="${0}" infer> </foxy-i18n> <slot name="actions"></slot> </div> <iron-icon class="icon-inline text-xl text-body" icon="icons:expand-${0}"> </iron-icon> </div> </summary> <div class="border-t border-contrast-10"> <slot></slot> </div> </details> `),this.open,(e=>{this.open=e.currentTarget.open}),m({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"transition-colors cursor-pointer hover-bg-contrast-5":!0,"rounded-t-l":!0,"rounded-b-l":!this.open}),this.summary,this.open?"less":"more")}}customElements.define("foxy-internal-collapsible-card",$);let _,j,k,S,w=e=>e;customElements.define("foxy-internal-collection-card",class extends t{constructor(){super(...arguments),this.related=[],this.limit=20,this.first="",this.form="",this.item="",this.open=!1}static get properties(){return c(c({},super.properties),{},{related:{type:Array},first:{type:String},limit:{type:Number},form:{type:String},item:{type:String},open:{type:Boolean}})}renderControl(){var e,t;let r;try{const e=new URL(this.first);e.searchParams.set("limit",String(this.limit)),r=e.toString()}catch(e){r=this.first}const n=new Function("ctx",`return ctx.html\`<${this.item} related=\${JSON.stringify(ctx.related)} parent=\${ctx.parent} class="p-m" infer href=\${ctx.href}></${this.item}>\``);return o(j||(j=w` <foxy-internal-collapsible-card summary="title" infer ?open="${0}" @toggle="${0}"> ${0} <foxy-pagination class="px-m pb-s" first="${0}" infer="pagination"> <foxy-collection-page related="${0}" class="-mx-m block divide-y divide-contrast-10 mb-s" group="${0}" infer="card" .item="${0}"> </foxy-collection-page> </foxy-pagination> </foxy-internal-collapsible-card> `),this.open,(e=>{this.open=e.currentTarget.open}),this.form?o(k||(k=w` <foxy-form-dialog related="${0}" parent="${0}" group="${0}" infer="dialog" id="form" .form="${0}"> </foxy-form-dialog> ${0} `),JSON.stringify(this.related),r,i(null===(e=this.nucleon)||void 0===e?void 0:e.group),this.form,this.readonly?"":o(S||(S=w` <button class="h-xs w-xs rounded-full text-success flex items-center justify-center text-l focus-outline-none focus-ring-2 focus-ring-primary-50" slot="actions" @click="${0}"> <iron-icon class="icon-inline" icon="icons:add"></iron-icon> </button> `),(e=>{e.preventDefault(),e.stopPropagation();const t=this.renderRoot.querySelector("#form");t.header="header_create",t.href="",t.show(e.currentTarget)}))):"",r,JSON.stringify(this.related),i(null===(t=this.nucleon)||void 0===t?void 0:t.group),(e=>{if(this.form&&e.data){const t=this.disabledSelector.matches("card",!0);return o(_||(_=w` <button ?disabled="${0}" class="${0}" @click="${0}"> ${0} </button> `),t,m({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block transition-colors":!0,"hover-bg-contrast-5":!t}),(t=>{const r=this.renderRoot.querySelector("#form"),i=t.currentTarget;r.header="header_update",r.href=e.href,r.show(i)}),n(e))}return n(e)}))}});let E,P=e=>e;customElements.define("foxy-internal-async-combo-box-control",class extends e{constructor(){super(...arguments),this.itemLabelPath=null,this.itemValuePath=null,this.first=null}static get properties(){return c(c({},super.properties),{},{itemLabelPath:{type:String,attribute:"item-label-path"},itemValuePath:{type:String,attribute:"item-value-path"},first:{type:String}})}renderControl(){var e,t,r=this;return o(E||(E=P` <vaadin-combo-box item-value-path="${0}" item-label-path="${0}" error-message="${0}" item-id-path="_links.self.href" helper-text="${0}" placeholder="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .dataProvider="${0}" .value="${0}" @change="${0}"> </vaadin-combo-box> `),i(null!==(e=this.itemValuePath)&&void 0!==e?e:void 0),i(null!==(t=this.itemLabelPath)&&void 0!==t?t:void 0),i(this._errorMessage),this.helperText,this.placeholder,this.label,this.disabled,this.readonly,this._checkValidity,(async function(e,t){if(!r.first)return t([],0);const i=new URL(r.first);i.searchParams.set("offset",String(e.page*e.pageSize)),i.searchParams.set("limit",String(e.pageSize)),e.filter&&r.itemLabelPath&&i.searchParams.set(r.itemLabelPath,`*${e.filter}*`);const o=await new u(r).fetch(i.toString());if(!o.ok)throw new Error(await o.text());const n=await o.json();t(Array.from(Object.values(n._embedded))[0],n.total_items)}),this._value,(e=>{const t=e.currentTarget;this._value=t.value}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}});let q,C=e=>e;customElements.define("foxy-internal-item-form-line-item-discount-control",class extends t{constructor(){super(...arguments),this.infer="line-item-discount"}renderControl(){var e,t,r,n;return o(q||(q=C` <foxy-internal-collapsible-card summary="title" infer> <div class="space-y-m p-m"> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="coupon" @change="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="discount-name"></foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}"> </foxy-discount-builder> </div> </foxy-internal-collapsible-card> `),i(null===(e=this.nucleon)||void 0===e?void 0:e.coupons),(e=>{var t;e.preventDefault();const r=e.detail;null===(t=this.nucleon)||void 0===t||t.edit({discount_name:r.name,discount_type:r.coupon_discount_type,discount_details:r.coupon_discount_details})}),{type:null===(t=this.nucleon)||void 0===t?void 0:t.form.discount_type,name:null===(r=this.nucleon)||void 0===r?void 0:r.form.discount_name,details:null===(n=this.nucleon)||void 0===n?void 0:n.form.discount_details})}});let T,V,L=e=>e;customElements.define("foxy-internal-frequency-control",class extends e{constructor(){super(...arguments),this.__i18n={formatValue:e=>e.join(""),parseValue:e=>{const{count:t,units:r}=a(e);return[t.toString(),r]}},this.__getItems=p((e=>{const t=a(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 styles(){return[super.styles,s(T||(T=L`: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}`))]}renderControl(){var e;const t=null!==(e=this._value)&&void 0!==e?e:"";return o(V||(V=L` <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,t,this.disabled,this.readonly,this._errorMessage,this._checkValidity,(e=>{const t=e.currentTarget;this._value=t.value}),!!this._error,this.disabled,this.readonly,this.__getItems(t),!!this._error,this.disabled,this.readonly)}updated(e){var t;super.updated(e);const r=this.renderRoot.firstElementChild,i=null===(t=this.nucleon)||void 0===t?void 0:t.form[this.property];r.value!==i&&(r.value=i)}});let N,A=e=>e;customElements.define("foxy-internal-date-control",class extends e{constructor(){super(...arguments),this.format=null}static get properties(){return c(c({},super.properties),{},{format:{type:String}})}renderControl(){var e;let t;return t="unix"===this.format?h(new Date(1e3*(null!==(e=this._value)&&void 0!==e?e:0))):this._value,o(N||(N=A` <vaadin-date-picker error-message="${0}" placeholder="${0}" helper-text="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),i(this._errorMessage),this.placeholder,this.helperText,this.label,this.disabled,this.readonly,this._checkValidity,t,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{var t,r;const i=e.currentTarget;"unix"===this.format?this._value=Math.floor((null!==(r=null===(t=y(i.value))||void 0===t?void 0:t.getTime())&&void 0!==r?r:0)/1e3):this._value=i.value}))}});let M,O,R,z=e=>e;customElements.define("foxy-internal-item-form-subscription-control",class extends t{constructor(){super(...arguments),this.infer="subscription"}renderControl(){var e,t,r,i,n;let s;try{const o=null!==(i=null===(r=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links)["fx:subscription"])||void 0===r?void 0:r.href)&&void 0!==i?i:"",n=new URL(o);n.searchParams.set("zoom","last_transaction,transaction_template:items"),s=n.toString()}catch(e){s=null}return o(M||(M=z` <foxy-internal-collapsible-card summary="title" lang="${0}" ns="${0}"> ${0} </foxy-internal-collapsible-card> `),this.lang,this.ns,s?o(O||(O=z` <foxy-form-dialog related="${0}" header="update" infer="form" href="${0}" form="foxy-subscription-form"> </foxy-form-dialog> <button ?disabled="${0}" @click="${0}"> <foxy-subscription-card hiddencontrols="${0}" class="p-m" infer="card" href="${0}"> </foxy-subscription-card> </button> `),(null===(n=this.nucleon)||void 0===n?void 0:n.href)?JSON.stringify([this.nucleon.href]):"",s,this.disabled,(e=>{const t=e.currentTarget;t.previousElementSibling.show(t)}),this.hiddenSelector.zoom("card").toString(),s):o(R||(R=z` <div class="space-y-m p-m"> <foxy-internal-frequency-control infer="frequency" property="subscription_frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control infer="start" property="subscription_start_date"> </foxy-internal-date-control> <foxy-internal-date-control infer="end" property="subscription_end_date"> </foxy-internal-date-control> <foxy-internal-date-control infer="next" property="subscription_next_transaction_date"> </foxy-internal-date-control> </div> `)))}});let I,J=e=>e;customElements.define("foxy-internal-item-form-inventory-control",class extends t{constructor(){super(...arguments),this.infer="inventory"}renderControl(){var e;return o(I||(I=J` <foxy-internal-collapsible-card summary="title" lang="${0}" ns="${0}"> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" property="item_category_uri" first="${0}" class="col-span-2" infer="category"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="code"></foxy-internal-text-control> <foxy-internal-text-control infer="parent-code"></foxy-internal-text-control> </div> </foxy-internal-collapsible-card> `),this.lang,this.ns,i(null===(e=this.nucleon)||void 0===e?void 0:e.itemCategories))}});let B,D=e=>e;customElements.define("foxy-internal-item-form-shipping-control",class extends t{constructor(){super(...arguments),this.infer="shipping"}renderControl(){var e;return o(B||(B=D` <foxy-internal-collapsible-card summary="title" lang="${0}" ns="${0}"> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-async-combo-box-control item-value-path="address_name" item-label-path="address_name" first="${0}" class="col-span-2" infer="shipto"> </foxy-internal-async-combo-box-control> <foxy-internal-integer-control infer="width"></foxy-internal-integer-control> <foxy-internal-integer-control infer="height"></foxy-internal-integer-control> <foxy-internal-integer-control infer="length"></foxy-internal-integer-control> <foxy-internal-integer-control infer="weight"></foxy-internal-integer-control> </div> </foxy-internal-collapsible-card> `),this.lang,this.ns,i(null===(e=this.nucleon)||void 0===e?void 0:e.customerAddresses))}});let U,G=e=>e;customElements.define("foxy-internal-item-form-cart-control",class extends t{constructor(){super(...arguments),this.infer="cart"}renderControl(){return o(U||(U=G` <foxy-internal-collapsible-card summary="title" lang="${0}" ns="${0}"> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-date-control class="col-span-2" infer="expires" format="unix"> </foxy-internal-date-control> <foxy-internal-text-control class="col-span-2" infer="url"></foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="image"></foxy-internal-text-control> <foxy-internal-integer-control infer="quantity-min"></foxy-internal-integer-control> <foxy-internal-integer-control infer="quantity-max"></foxy-internal-integer-control> </div> </foxy-internal-collapsible-card> `),this.lang,this.ns)}});let F,H,K=e=>e;class Q extends(f(r,"item-form")){constructor(){super(...arguments),this.customerAddresses="",this.itemCategories="",this.coupons="",this.__itemsLink=""}static get properties(){return c(c({},super.properties),{},{customerAddresses:{type:String,attribute:"customer-addresses"},itemCategories:{type:String,attribute:"item-categories"},coupons:{type:String}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!!e&&e.length<=255||"name:v8n_too_long",({price:e})=>"number"==typeof e&&!isNaN(e)||"price:v8n_required",({price:e})=>"number"==typeof e&&e>=0||"price:v8n_negative",({quantity:e})=>"number"==typeof e&&e>=1||"quantity:v8n_less_than_one"]}renderBody(){return o(F||(F=K` <foxy-internal-text-control infer="name"></foxy-internal-text-control> <div class="grid grid-cols-2 gap-m"> <foxy-internal-number-control infer="price"></foxy-internal-number-control> <foxy-internal-integer-control infer="quantity"></foxy-internal-integer-control> </div> <foxy-internal-item-form-subscription-control></foxy-internal-item-form-subscription-control> <foxy-internal-item-form-line-item-discount-control></foxy-internal-item-form-line-item-discount-control> <foxy-internal-item-form-cart-control></foxy-internal-item-form-cart-control> <foxy-internal-item-form-shipping-control></foxy-internal-item-form-shipping-control> <foxy-internal-item-form-inventory-control></foxy-internal-item-form-inventory-control> ${0} ${0} `),this.data?o(H||(H=K` <foxy-internal-collection-card infer="discount-details" first="${0}" limit="5" item="foxy-discount-detail-card"> </foxy-internal-collection-card> <foxy-internal-collection-card infer="coupon-details" first="${0}" limit="5" item="foxy-coupon-detail-card"> </foxy-internal-collection-card> <foxy-internal-collection-card infer="attributes" first="${0}" limit="5" item="foxy-attribute-card" form="foxy-attribute-form"> </foxy-internal-collection-card> <foxy-internal-collection-card related="${0}" infer="item-options" first="${0}" limit="5" item="foxy-item-option-card" form="foxy-item-option-form"> </foxy-internal-collection-card> `),this.data._links["fx:discount_details"].href,this.data._links["fx:coupon_details"].href,this.data._links["fx:attributes"].href,JSON.stringify([this.data._links["fx:transaction"].href,this.data._links["fx:shipment"],this.__itemsLink]),this.data._links["fx:item_options"].href):"",super.renderBody())}async _sendGet(){const e=await super._sendGet(),t=await super._fetch(e._links["fx:transaction"].href);return this.__itemsLink=t._links["fx:items"].href,e}}customElements.define("foxy-item-form",Q);export{Q as ItemForm};
@@ -1 +1 @@
1
- export{b as ItemOptionForm}from"./shared-072abf87.js";import"./shared-5097c880.js";import"./shared-60e98fbf.js";import"./shared-007660a6.js";import"./shared-e090608c.js";import"./shared-ea9af4b0.js";import"./shared-2eee69db.js";import"./shared-7f33a83a.js";import"./shared-d3bf9ac0.js";import"./shared-935ba2fc.js";import"./shared-4e63d6e0.js";import"./shared-64657919.js";import"./shared-3026cee0.js";import"./shared-757bb517.js";import"./shared-92d6f937.js";import"./shared-1ddccf4d.js";import"./shared-9d4835ed.js";import"./shared-06014421.js";import"./shared-4e709717.js";import"./shared-1b064836.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./foxy-spinner.js";import"./shared-35de1004.js";import"./shared-bc94606b.js";
1
+ export{c as ItemOptionForm}from"./shared-ce2aab66.js";import"./shared-5097c880.js";import"./shared-60e98fbf.js";import"./shared-007660a6.js";import"./shared-e090608c.js";import"./shared-ea9af4b0.js";import"./shared-2eee69db.js";import"./shared-7f33a83a.js";import"./shared-06014421.js";import"./shared-3026cee0.js";import"./shared-d3bf9ac0.js";import"./shared-1b064836.js";import"./shared-9d4835ed.js";import"./shared-64657919.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./foxy-spinner.js";import"./shared-35de1004.js";import"./shared-bc94606b.js";import"./shared-4e63d6e0.js";import"./shared-757bb517.js";import"./shared-92d6f937.js";import"./shared-1ddccf4d.js";import"./shared-4e709717.js";
@@ -1,4 +1,4 @@
1
- import"./foxy-address-card.js";import"./foxy-item-form.js";import{I as e}from"./shared-d3ffe0ef.js";import"./shared-4e63d6e0.js";import{_ as r}from"./shared-2eee69db.js";import{h as s}from"./shared-7f33a83a.js";import{i as t}from"./shared-d3bf9ac0.js";import{a as i}from"./shared-ea9af4b0.js";import{B as o}from"./shared-3026cee0.js";import"./shared-35de1004.js";import"./shared-e090608c.js";import"./shared-bc94606b.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-64657919.js";import"./shared-06014421.js";import"./shared-1b064836.js";import"./shared-9d4835ed.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./shared-4e709717.js";import"./shared-5097c880.js";import"./shared-60e98fbf.js";import"./shared-007660a6.js";import"./shared-f7bddf72.js";import"./shared-072abf87.js";import"./shared-935ba2fc.js";import"./shared-757bb517.js";import"./shared-92d6f937.js";import"./shared-1ddccf4d.js";import"./foxy-collection-page.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./foxy-discount-detail-card.js";import"./shared-fe8ec1f9.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-38f8a319.js";import"./shared-7819b0b0.js";import"./shared-f3f9f752.js";import"./shared-bbfdfee2.js";import"./shared-5e75308a.js";import"./shared-22103348.js";import"./foxy-coupon-card.js";import"./foxy-discount-builder.js";import"./shared-e6f3e9f0.js";import"./shared-b8f492a4.js";import"./shared-2061be9a.js";import"./foxy-subscription-card.js";import"./shared-874bbae5.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./shared-c4f0a219.js";import"./foxy-collection-pages.js";import"./shared-a8e21a41.js";import"./shared-34998df6.js";import"./foxy-table.js";import"./shared-c3c424cd.js";import"./foxy-nucleon-element.js";import"./shared-2bb49907.js";import"./shared-f0ba30e8.js";import"./shared-e59c65e3.js";let a,d,c=e=>e;class n extends(i(e,"shipment-card")){constructor(){super(...arguments),this.__customerAddresses="",this.__currencyDisplay="",this.__itemCategories="",this.__editable=!1,this.__currency="",this.__coupons=""}static get properties(){return r(r({},super.properties),{},{__customerAddresses:{attribute:!1},__currencyDisplay:{attribute:!1},__itemCategories:{attribute:!1},__editable:{attribute:!1},__currency:{attribute:!1},__coupons:{attribute:!1}})}get hiddenSelector(){return new o(`${super.hiddenSelector.toString()} address:not=full-address`)}get readonlySelector(){return this.__editable?super.readonlySelector:o.True}renderBody(){var e,r,i;let o;if(this.data)try{const e=new URL(this.data._links["fx:items"].href);e.searchParams.set("zoom","item_options"),o=e.toString()}catch(e){}return s(d||(d=c` <div class="space-y-m"> <foxy-address-card infer="address" href="${0}"> <div slot="full-address:after" class="flex items-center text-m space-x-s text-secondary"> <iron-icon icon="maps:local-shipping" class="icon-inline flex-shrink-0"></iron-icon> <span class="truncate"> ${0} &bull; <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> </span> </div> </foxy-address-card> <foxy-internal-collection-card infer="items" first="${0}" limit="5" item="foxy-item-card" open .form="${0}"> </foxy-internal-collection-card> </div> `),t(null===(e=this.data)||void 0===e?void 0:e._links["fx:customer_address"].href),null===(r=this.data)||void 0===r?void 0:r.shipping_service_description,JSON.stringify({amount:`${null===(i=this.data)||void 0===i?void 0:i.total_shipping} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),t(o),(({html:e,dialog:r,handleFetch:s,handleUpdate:t})=>e(a||(a=c`
1
+ import"./foxy-address-card.js";import"./foxy-item-form.js";import{I as e}from"./shared-cad5fe82.js";import"./shared-4e63d6e0.js";import{_ as r}from"./shared-2eee69db.js";import{h as s}from"./shared-7f33a83a.js";import{i as t}from"./shared-d3bf9ac0.js";import{a as i}from"./shared-ea9af4b0.js";import{B as o}from"./shared-3026cee0.js";import"./shared-35de1004.js";import"./shared-e090608c.js";import"./shared-bc94606b.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-64657919.js";import"./shared-06014421.js";import"./shared-1b064836.js";import"./shared-9d4835ed.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./shared-4e709717.js";import"./shared-5097c880.js";import"./shared-60e98fbf.js";import"./shared-007660a6.js";import"./shared-f7bddf72.js";import"./shared-ce2aab66.js";import"./shared-757bb517.js";import"./shared-92d6f937.js";import"./shared-1ddccf4d.js";import"./foxy-collection-page.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./foxy-discount-detail-card.js";import"./shared-fe8ec1f9.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-38f8a319.js";import"./shared-7819b0b0.js";import"./shared-f3f9f752.js";import"./shared-bbfdfee2.js";import"./shared-5e75308a.js";import"./shared-22103348.js";import"./foxy-coupon-card.js";import"./foxy-discount-builder.js";import"./shared-e6f3e9f0.js";import"./shared-b8f492a4.js";import"./shared-2061be9a.js";import"./shared-c4f0a219.js";import"./foxy-subscription-card.js";import"./shared-874bbae5.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./foxy-collection-pages.js";import"./shared-a8e21a41.js";import"./shared-34998df6.js";import"./foxy-table.js";import"./shared-c3c424cd.js";import"./foxy-nucleon-element.js";import"./shared-2bb49907.js";import"./shared-f0ba30e8.js";import"./shared-e59c65e3.js";let a,d,c=e=>e;class n extends(i(e,"shipment-card")){constructor(){super(...arguments),this.__customerAddresses="",this.__currencyDisplay="",this.__itemCategories="",this.__editable=!1,this.__currency="",this.__coupons=""}static get properties(){return r(r({},super.properties),{},{__customerAddresses:{attribute:!1},__currencyDisplay:{attribute:!1},__itemCategories:{attribute:!1},__editable:{attribute:!1},__currency:{attribute:!1},__coupons:{attribute:!1}})}get hiddenSelector(){return new o(`${super.hiddenSelector.toString()} address:not=full-address`)}get readonlySelector(){return this.__editable?super.readonlySelector:o.True}renderBody(){var e,r,i;let o;if(this.data)try{const e=new URL(this.data._links["fx:items"].href);e.searchParams.set("zoom","item_options"),o=e.toString()}catch(e){}return s(d||(d=c` <div class="space-y-m"> <foxy-address-card infer="address" href="${0}"> <div slot="full-address:after" class="flex items-center text-m space-x-s text-secondary"> <iron-icon icon="maps:local-shipping" class="icon-inline flex-shrink-0"></iron-icon> <span class="truncate"> ${0} &bull; <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> </span> </div> </foxy-address-card> <foxy-internal-collection-card infer="items" first="${0}" limit="5" item="foxy-item-card" open .form="${0}"> </foxy-internal-collection-card> </div> `),t(null===(e=this.data)||void 0===e?void 0:e._links["fx:customer_address"].href),null===(r=this.data)||void 0===r?void 0:r.shipping_service_description,JSON.stringify({amount:`${null===(i=this.data)||void 0===i?void 0:i.total_shipping} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),t(o),(({html:e,dialog:r,handleFetch:s,handleUpdate:t})=>e(a||(a=c`
2
2
  <foxy-item-form
3
3
  disabledcontrols=${0}
4
4
  readonlycontrols=${0}
@@ -1,4 +1,4 @@
1
- import"./shared-757bb517.js";import"./shared-35de1004.js";import{h as t}from"./shared-e090608c.js";import"./shared-bc94606b.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-applied-tax-card.js";import"./foxy-custom-field-card.js";import"./foxy-discount-card.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-item-form.js";import"./shared-4e63d6e0.js";import{a as i}from"./shared-072abf87.js";import"./foxy-customer-card.js";import"./foxy-form-dialog.js";import"./foxy-customer.js";import{h as o,c as e}from"./shared-7f33a83a.js";import{i as r}from"./shared-d3bf9ac0.js";import{I as a}from"./shared-935ba2fc.js";import{_ as s}from"./shared-2eee69db.js";import{N as c}from"./shared-1b064836.js";import{a as n}from"./shared-ea9af4b0.js";import{B as d}from"./shared-3026cee0.js";import"./shared-007660a6.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-64657919.js";import"./shared-06014421.js";import"./shared-4e709717.js";import"./shared-9d4835ed.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./shared-38f8a319.js";import"./shared-7819b0b0.js";import"./shared-5097c880.js";import"./shared-60e98fbf.js";import"./shared-f7bddf72.js";import"./shared-f3f9f752.js";import"./shared-11c2efc8.js";import"./shared-92d6f937.js";import"./shared-1ddccf4d.js";import"./shared-bbfdfee2.js";import"./shared-5e75308a.js";import"./shared-22103348.js";import"./shared-9d7aaf7a.js";import"./shared-fe8ec1f9.js";import"./foxy-address-card.js";import"./shared-d3ffe0ef.js";import"./foxy-collection-page.js";import"./shared-d519a301.js";import"./foxy-pagination.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-coupon-card.js";import"./foxy-discount-builder.js";import"./shared-e6f3e9f0.js";import"./shared-b8f492a4.js";import"./shared-2061be9a.js";import"./foxy-subscription-card.js";import"./shared-874bbae5.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./shared-c4f0a219.js";import"./foxy-collection-pages.js";import"./shared-a8e21a41.js";import"./shared-34998df6.js";import"./foxy-table.js";import"./shared-c3c424cd.js";import"./foxy-nucleon-element.js";import"./shared-2bb49907.js";import"./shared-f0ba30e8.js";import"./shared-e59c65e3.js";import"./shared-99065f2a.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./foxy-customer-form.js";import"./shared-b738ee96.js";import"./foxy-address-form.js";import"./shared-7f3ca8e7.js";
1
+ import"./shared-757bb517.js";import"./shared-35de1004.js";import{h as t}from"./shared-e090608c.js";import"./shared-bc94606b.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-applied-tax-card.js";import"./foxy-custom-field-card.js";import"./foxy-discount-card.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-item-form.js";import"./shared-4e63d6e0.js";import{a as i,b as o}from"./shared-ce2aab66.js";import"./foxy-customer-card.js";import"./foxy-form-dialog.js";import"./foxy-customer.js";import{h as e,c as r}from"./shared-7f33a83a.js";import{i as a}from"./shared-d3bf9ac0.js";import{_ as c}from"./shared-2eee69db.js";import{N as s}from"./shared-1b064836.js";import{a as n}from"./shared-ea9af4b0.js";import{B as d}from"./shared-3026cee0.js";import"./shared-007660a6.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-64657919.js";import"./shared-06014421.js";import"./shared-4e709717.js";import"./shared-9d4835ed.js";import"./shared-7684cb05.js";import"./shared-f3655f42.js";import"./shared-38f8a319.js";import"./shared-7819b0b0.js";import"./shared-5097c880.js";import"./shared-60e98fbf.js";import"./shared-f7bddf72.js";import"./shared-f3f9f752.js";import"./shared-11c2efc8.js";import"./shared-92d6f937.js";import"./shared-1ddccf4d.js";import"./shared-bbfdfee2.js";import"./shared-5e75308a.js";import"./shared-22103348.js";import"./shared-9d7aaf7a.js";import"./shared-fe8ec1f9.js";import"./foxy-address-card.js";import"./shared-cad5fe82.js";import"./foxy-collection-page.js";import"./shared-d519a301.js";import"./foxy-pagination.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-coupon-card.js";import"./foxy-discount-builder.js";import"./shared-e6f3e9f0.js";import"./shared-b8f492a4.js";import"./shared-2061be9a.js";import"./shared-c4f0a219.js";import"./foxy-subscription-card.js";import"./shared-874bbae5.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./foxy-collection-pages.js";import"./shared-a8e21a41.js";import"./shared-34998df6.js";import"./foxy-table.js";import"./shared-c3c424cd.js";import"./foxy-nucleon-element.js";import"./shared-2bb49907.js";import"./shared-f0ba30e8.js";import"./shared-e59c65e3.js";import"./shared-99065f2a.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./foxy-customer-form.js";import"./shared-b738ee96.js";import"./foxy-address-form.js";import"./shared-7f3ca8e7.js";
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -61,4 +61,4 @@ found at http://polymer.github.io/PATENTS.txt
61
61
  <g id="voicemail"><path d="M18.5 6C15.46 6 13 8.46 13 11.5c0 1.33.47 2.55 1.26 3.5H9.74c.79-.95 1.26-2.17 1.26-3.5C11 8.46 8.54 6 5.5 6S0 8.46 0 11.5 2.46 17 5.5 17h13c3.04 0 5.5-2.46 5.5-5.5S21.54 6 18.5 6zm-13 9C3.57 15 2 13.43 2 11.5S3.57 8 5.5 8 9 9.57 9 11.5 7.43 15 5.5 15zm13 0c-1.93 0-3.5-1.57-3.5-3.5S16.57 8 18.5 8 22 9.57 22 11.5 20.43 15 18.5 15z"></path></g>
62
62
  <g id="vpn-key"><path d="M12.65 10C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H17v4h4v-4h2v-4H12.65zM7 14c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></g>
63
63
  </defs></svg>
64
- </iron-iconset-svg>`;document.head.appendChild(l.content);let h,m=t=>t;customElements.define("foxy-internal-transaction-customer-control",class extends a{renderControl(){var t,i,e,a;return o(h||(h=m` <foxy-internal-collapsible-card summary="customer" infer open> <foxy-form-dialog header="header" infer="dialog" form="foxy-customer" href="${0}" id="dialog"> </foxy-form-dialog> <button class="w-full text-left block rounded-b-l transition-colors hover-bg-contrast-5 focus-outline-none focus-ring-2 focus-ring-primary-50" @click="${0}"> <foxy-customer-card infer="card" class="p-m" href="${0}"> </foxy-customer-card> </button> </foxy-internal-collapsible-card> `),r(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:customer"].href),(t=>{this.renderRoot.querySelector("#dialog").show(t.currentTarget)}),r(null===(a=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===a?void 0:a._links["fx:customer"].href))}});let p,v=t=>t;customElements.define("foxy-internal-transaction-post-action-control",class extends a{constructor(){super(...arguments),this.theme="",this.state="idle",this.href="",this.icon=""}static get properties(){return s(s({},super.properties),{},{theme:{type:String},state:{type:String},href:{type:String},icon:{type:String}})}renderControl(){const t=this.state,i="fail"===t?"error":"idle"===t?this.theme:"";return o(p||(p=v` <vaadin-button class="w-full" theme="${0} tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer></foxy-i18n> </vaadin-button> `),i,"busy"===t||this.disabled,this.submit,t)}async submit(){if("busy"!==this.state)try{this.state="busy";const t=await new c.API(this).fetch(this.href,{method:"POST"});this.state=t.ok?"idle":"fail",t.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.state="fail"}}});let f,u,g,z,y,x=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends a{renderControl(){var t,i,e,r,a,s,c,n;return o(f||(f=x` <div class="divide-y divide-contrast-10"> ${0} ${0} ${0} ${0} </div> `),(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:capture"])?this.__renderCaptureAction():"",(null===(r=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===r?void 0:r._links["fx:void"])?this.__renderVoidAction():"",(null===(s=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===s?void 0:s._links["fx:refund"])?this.__renderRefundAction():"",(null===(n=null===(c=this.nucleon)||void 0===c?void 0:c.data)||void 0===n?void 0:n._links["fx:send_emails"])?this.__renderSendEmailsAction():"")}__renderSendEmailsAction(){var t,i,e;return o(u||(u=x` <foxy-internal-transaction-post-action-control infer="send-emails" theme="contrast" href="${0}" key="send_emails" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:send_emails"].href),null===(e=this.nucleon)||void 0===e?void 0:e.refresh)}__renderCaptureAction(){var t,i,e;return o(g||(g=x` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" key="capture" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:capture"].href),null===(e=this.nucleon)||void 0===e?void 0:e.refresh)}__renderVoidAction(){var t,i,e,a;return o(z||(z=x` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" key="void" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(e=null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:void"])||void 0===e?void 0:e.href),null===(a=this.nucleon)||void 0===a?void 0:a.refresh)}__renderRefundAction(){var t,i,e,a;return o(y||(y=x` <foxy-internal-transaction-post-action-control theme="contrast" infer="refund" href="${0}" key="refund" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(e=null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:refund"])||void 0===e?void 0:e.href),null===(a=this.nucleon)||void 0===a?void 0:a.refresh)}});let V,j,M,H,b,_,L,$=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends a{renderControl(){var t;return o(V||(V=$` <div class="border-t border-transparent"> <div class="h-m flex items-center justify-between"> <div class="text-xl font-bold">${0}</div> <div>${0}</div> </div> <div class="border-t border-contrast-10 mb-s"></div> ${0} </div> `),this.__renderPrice(),(null===(t=this.nucleon)||void 0===t?void 0:t.data)?this.__renderStatus():"",this.__renderTotals())}__renderStatus(){var t,i;const e={authorized:"bg-success text-success-contrast",completed:"bg-success text-success-contrast",declined:"bg-error text-error-contrast",rejected:"bg-error text-error-contrast"},r=(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i.status)||"completed";return o(j||(j=$` <foxy-i18n class="flex items-center h-xs px-s text-s font-semibold rounded ${0}" lang="${0}" key="transaction_${0}" ns="${0}"> </foxy-i18n> `),r in e?e[r]:"bg-contrast-5 text-contrast",this.lang,r,this.ns)}__renderPrice(){var t;const i=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==i?void 0:i.currency_code;return i?o(H||(H=$` <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> `),JSON.stringify({amount:`${i.total_order} ${e}`})):o(M||(M=$`--`))}__renderTotals(){var t;const i=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==i?void 0:i.currency_code;return["total_item_price","total_shipping","total_tax"].map((t=>o(b||(b=$` <div class="flex justify-between text-m text-secondary"> <foxy-i18n key="${0}" infer></foxy-i18n> ${0} </div> `),t,i?o(_||(_=$` <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> `),JSON.stringify({amount:`${i[t]} ${e}`})):o(L||(L=$`<span>--</span>`)))))}});let k,C,S=t=>t;class w extends(n(i,"transaction")){static get styles(){return[...super.styles,e(k||(k=S`#body{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(18.75 * var(--lumo-space-m)),1fr))}#body>:first-child{grid-column-start:1;grid-column-end:-2}`))]}get readonlySelector(){var t,i,o;return Boolean(null!==(i=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==i?i:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])?super.readonlySelector:new d(`${super.readonlySelector} attributes custom-fields`)}renderBody(){var t,i,e,a,s,c;return o(C||(C=S` <div id="body" class="gap-m"> <foxy-internal-collection-card infer="shipments" first="${0}" item="foxy-shipment-card" open> </foxy-internal-collection-card> <div class="grid gap-m self-start"> <foxy-internal-transaction-summary-control infer="summary"> </foxy-internal-transaction-summary-control> <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <foxy-internal-collection-card infer="payments" class="max-w-full overflow-hidden" first="${0}" limit="1" item="foxy-payment-card" open> </foxy-internal-collection-card> <foxy-internal-collection-card infer="discounts" first="${0}" limit="5" item="foxy-discount-card"> </foxy-internal-collection-card> <foxy-internal-collection-card infer="applied-taxes" first="${0}" limit="5" item="foxy-applied-tax-card"> </foxy-internal-collection-card> <foxy-internal-collection-card related="${0}" infer="custom-fields" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card"> </foxy-internal-collection-card> <foxy-internal-collection-card related="${0}" infer="attributes" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card"> </foxy-internal-collection-card> <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> </div> </div> `),r(null===(t=this.data)||void 0===t?void 0:t._links["fx:shipments"].href),r(null===(i=this.data)||void 0===i?void 0:i._links["fx:payments"].href),r(null===(e=this.data)||void 0===e?void 0:e._links["fx:discounts"].href),r(null===(a=this.data)||void 0===a?void 0:a._links["fx:applied_taxes"].href),JSON.stringify([this.href]),r(null===(s=this.data)||void 0===s?void 0:s._links["fx:custom_fields"].href),JSON.stringify([this.href]),r(null===(c=this.data)||void 0===c?void 0:c._links["fx:attributes"].href))}}customElements.define("foxy-transaction",w);export{w as Transaction};
64
+ </iron-iconset-svg>`;document.head.appendChild(l.content);let h,m=t=>t;customElements.define("foxy-internal-transaction-customer-control",class extends i{renderControl(){var t,i,o,r;return e(h||(h=m` <foxy-internal-collapsible-card summary="customer" infer open> <foxy-form-dialog header="header" infer="dialog" form="foxy-customer" href="${0}" id="dialog"> </foxy-form-dialog> <button class="w-full text-left block rounded-b-l transition-colors hover-bg-contrast-5 focus-outline-none focus-ring-2 focus-ring-primary-50" @click="${0}"> <foxy-customer-card infer="card" class="p-m" href="${0}"> </foxy-customer-card> </button> </foxy-internal-collapsible-card> `),a(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:customer"].href),(t=>{this.renderRoot.querySelector("#dialog").show(t.currentTarget)}),a(null===(r=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===r?void 0:r._links["fx:customer"].href))}});let p,v=t=>t;customElements.define("foxy-internal-transaction-post-action-control",class extends i{constructor(){super(...arguments),this.theme="",this.state="idle",this.href="",this.icon=""}static get properties(){return c(c({},super.properties),{},{theme:{type:String},state:{type:String},href:{type:String},icon:{type:String}})}renderControl(){const t=this.state,i="fail"===t?"error":"idle"===t?this.theme:"";return e(p||(p=v` <vaadin-button class="w-full" theme="${0} tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer></foxy-i18n> </vaadin-button> `),i,"busy"===t||this.disabled,this.submit,t)}async submit(){if("busy"!==this.state)try{this.state="busy";const t=await new s.API(this).fetch(this.href,{method:"POST"});this.state=t.ok?"idle":"fail",t.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.state="fail"}}});let f,u,g,z,y,x=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends i{renderControl(){var t,i,o,r,a,c,s,n;return e(f||(f=x` <div class="divide-y divide-contrast-10"> ${0} ${0} ${0} ${0} </div> `),(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:capture"])?this.__renderCaptureAction():"",(null===(r=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===r?void 0:r._links["fx:void"])?this.__renderVoidAction():"",(null===(c=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===c?void 0:c._links["fx:refund"])?this.__renderRefundAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:send_emails"])?this.__renderSendEmailsAction():"")}__renderSendEmailsAction(){var t,i,o;return e(u||(u=x` <foxy-internal-transaction-post-action-control infer="send-emails" theme="contrast" href="${0}" key="send_emails" @done="${0}"> </foxy-internal-transaction-post-action-control> `),a(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:send_emails"].href),null===(o=this.nucleon)||void 0===o?void 0:o.refresh)}__renderCaptureAction(){var t,i,o;return e(g||(g=x` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" key="capture" @done="${0}"> </foxy-internal-transaction-post-action-control> `),a(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:capture"].href),null===(o=this.nucleon)||void 0===o?void 0:o.refresh)}__renderVoidAction(){var t,i,o,r;return e(z||(z=x` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" key="void" @done="${0}"> </foxy-internal-transaction-post-action-control> `),a(null===(o=null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:void"])||void 0===o?void 0:o.href),null===(r=this.nucleon)||void 0===r?void 0:r.refresh)}__renderRefundAction(){var t,i,o,r;return e(y||(y=x` <foxy-internal-transaction-post-action-control theme="contrast" infer="refund" href="${0}" key="refund" @done="${0}"> </foxy-internal-transaction-post-action-control> `),a(null===(o=null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i._links["fx:refund"])||void 0===o?void 0:o.href),null===(r=this.nucleon)||void 0===r?void 0:r.refresh)}});let V,M,j,H,b,_,L,$=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends i{renderControl(){var t;return e(V||(V=$` <div class="border-t border-transparent"> <div class="h-m flex items-center justify-between"> <div class="text-xl font-bold">${0}</div> <div>${0}</div> </div> <div class="border-t border-contrast-10 mb-s"></div> ${0} </div> `),this.__renderPrice(),(null===(t=this.nucleon)||void 0===t?void 0:t.data)?this.__renderStatus():"",this.__renderTotals())}__renderStatus(){var t,i;const o={authorized:"bg-success text-success-contrast",completed:"bg-success text-success-contrast",declined:"bg-error text-error-contrast",rejected:"bg-error text-error-contrast"},r=(null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===i?void 0:i.status)||"completed";return e(M||(M=$` <foxy-i18n class="flex items-center h-xs px-s text-s font-semibold rounded ${0}" lang="${0}" key="transaction_${0}" ns="${0}"> </foxy-i18n> `),r in o?o[r]:"bg-contrast-5 text-contrast",this.lang,r,this.ns)}__renderPrice(){var t;const i=null===(t=this.nucleon)||void 0===t?void 0:t.data,o=null==i?void 0:i.currency_code;return i?e(H||(H=$` <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> `),JSON.stringify({amount:`${i.total_order} ${o}`})):e(j||(j=$`--`))}__renderTotals(){var t;const i=null===(t=this.nucleon)||void 0===t?void 0:t.data,o=null==i?void 0:i.currency_code;return["total_item_price","total_shipping","total_tax"].map((t=>e(b||(b=$` <div class="flex justify-between text-m text-secondary"> <foxy-i18n key="${0}" infer></foxy-i18n> ${0} </div> `),t,i?e(_||(_=$` <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> `),JSON.stringify({amount:`${i[t]} ${o}`})):e(L||(L=$`<span>--</span>`)))))}});let k,C,S=t=>t;class w extends(n(o,"transaction")){static get styles(){return[...super.styles,r(k||(k=S`#body{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(18.75 * var(--lumo-space-m)),1fr))}#body>:first-child{grid-column-start:1;grid-column-end:-2}`))]}get readonlySelector(){var t,i,o;return Boolean(null!==(i=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==i?i:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])?super.readonlySelector:new d(`${super.readonlySelector} attributes custom-fields`)}renderBody(){var t,i,o,r,c,s;return e(C||(C=S` <div id="body" class="gap-m"> <foxy-internal-collection-card infer="shipments" first="${0}" item="foxy-shipment-card" open> </foxy-internal-collection-card> <div class="grid gap-m self-start"> <foxy-internal-transaction-summary-control infer="summary"> </foxy-internal-transaction-summary-control> <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <foxy-internal-collection-card infer="payments" class="max-w-full overflow-hidden" first="${0}" limit="1" item="foxy-payment-card" open> </foxy-internal-collection-card> <foxy-internal-collection-card infer="discounts" first="${0}" limit="5" item="foxy-discount-card"> </foxy-internal-collection-card> <foxy-internal-collection-card infer="applied-taxes" first="${0}" limit="5" item="foxy-applied-tax-card"> </foxy-internal-collection-card> <foxy-internal-collection-card related="${0}" infer="custom-fields" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card"> </foxy-internal-collection-card> <foxy-internal-collection-card related="${0}" infer="attributes" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card"> </foxy-internal-collection-card> <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> </div> </div> `),a(null===(t=this.data)||void 0===t?void 0:t._links["fx:shipments"].href),a(null===(i=this.data)||void 0===i?void 0:i._links["fx:payments"].href),a(null===(o=this.data)||void 0===o?void 0:o._links["fx:discounts"].href),a(null===(r=this.data)||void 0===r?void 0:r._links["fx:applied_taxes"].href),JSON.stringify([this.href]),a(null===(c=this.data)||void 0===c?void 0:c._links["fx:custom_fields"].href),JSON.stringify([this.href]),a(null===(s=this.data)||void 0===s?void 0:s._links["fx:attributes"].href))}}customElements.define("foxy-transaction",w);export{w as Transaction};
@@ -0,0 +1 @@
1
+ import"./foxy-spinner.js";import{C as i}from"./shared-06014421.js";import{T as e,a as t}from"./shared-ea9af4b0.js";import{N as s}from"./shared-1b064836.js";import{c as r}from"./shared-4e709717.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-4e63d6e0.js";import{_ as n}from"./shared-2eee69db.js";import{i as l}from"./shared-d3bf9ac0.js";let o,d,c=i=>i;const h=i(e(t(s)));class p extends h{renderBody(){return a(o||(o=c``))}render(){return a(d||(d=c` <div aria-busy="${0}" aria-live="polite" class="relative"> <div class="${0}"> ${0} </div> <div class="${0}"> <foxy-spinner layout="${0}" class="m-auto" state="${0}" lang="${0}" ns="${0} spinner"> </foxy-spinner> </div> </div> `),this.in("busy"),r({"transition duration-500 ease-in-out":!0,"opacity-0 pointer-events-none":!this.in({idle:"snapshot"})}),this.renderBody(),r({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in({idle:"snapshot"})}),this.in("busy")?"no-label":"horizontal",this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns)}}customElements.define("foxy-internal-card",p);let u,f,y,v,m,x,_=i=>i;class $ extends(t(p,"item-card")){constructor(){super(...arguments),this.__currencyDisplay="",this.__currency=""}static get properties(){return n(n({},super.properties),{},{__currencyDisplay:{attribute:!1},__currency:{attribute:!1}})}renderBody(){var i,e,t,s,r,n,o,d,c;const h=null!==(e=null===(i=this.data)||void 0===i?void 0:i.quantity)&&void 0!==e?e:0,p=null!==(s=null===(t=this.data)||void 0===t?void 0:t.price)&&void 0!==s?s:0,w=h*p,L=null===(n=null===(r=this.data)||void 0===r?void 0:r._embedded)||void 0===n?void 0:n["fx:item_options"];return a(u||(u=_` <div class="flex items-start space-x-m leading-m"> <div class="w-l h-l relative flex-shrink-0"> <img class="relative w-full h-full object-cover rounded" src="${0}" alt="" @error="${0}"> <div class="border border-contrast-10 absolute inset-0 rounded"></div> </div> <div class="flex-1"> <div class="flex-1 h-l flex items-center"> <div class="flex-1 leading-s"> <div class="font-semibold text-m">${0}</div> <div class="text-secondary text-m"> ${0} &times; <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> &equals; <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> </div> </div> ${0} </div> ${0} </div> </div> `),l(null===(o=this.data)||void 0===o?void 0:o.image),(i=>{i.currentTarget.src=$.__placeholder}),null===(d=this.data)||void 0===d?void 0:d.name,h,JSON.stringify({amount:`${p} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),JSON.stringify({amount:`${w} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),(null===(c=this.data)||void 0===c?void 0:c.subscription_frequency)?a(f||(f=_` <div class="w-xs h-xs flex items-center justify-center rounded-full bg-contrast-5"> <iron-icon icon="icons:autorenew" class="icon-inline text-s"></iron-icon> </div> `)):"",L&&L.length>0?a(y||(y=_` <div class="mt-s"> ${0} </div> `),L.map((i=>a(v||(v=_` <div class="flex items-center text-m space-x-xs leading-m"> <div class="flex-1 text-tertiary">${0}: ${0}</div> ${0} ${0} </div> `),i.name,i.value,i.price_mod?a(m||(m=_` <div class="${0} rounded px-xs"> <foxy-i18n options="${0}" key="price" infer> </foxy-i18n> </div> `),i.price_mod>0?"text-success":"text-error",JSON.stringify({amount:`${i.price_mod} ${this.__currency}`,currencyDisplay:this.__currencyDisplay})):"",i.weight_mod?a(x||(x=_` <div class="${0} rounded px-xs"> ${0} <foxy-i18n key="wgt" infer></foxy-i18n> </div> `),i.price_mod>0?"text-success":"text-error",i.weight_mod):"")))):"")}async _sendGet(){const i=await super._sendGet(),[e,t]=await Promise.all([super._fetch(i._links["fx:transaction"].href),super._fetch(i._links["fx:store"].href)]);return this.__currency=e.currency_code,this.__currencyDisplay=t.use_international_currency_symbol?"code":"symbol",i}}$.__placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E',customElements.define("foxy-item-card",$);export{p as I,$ as a};
@@ -0,0 +1 @@
1
+ import"./shared-5097c880.js";import"./shared-60e98fbf.js";import{I as e,_ as t}from"./shared-2eee69db.js";import{L as r,f as n,h as i,c as s}from"./shared-7f33a83a.js";import{C as l}from"./shared-06014421.js";import{a,T as o}from"./shared-ea9af4b0.js";import{N as d}from"./shared-1b064836.js";import{i as c}from"./shared-d3bf9ac0.js";import"./foxy-spinner.js";import"./shared-4e63d6e0.js";import"./shared-757bb517.js";import"./shared-92d6f937.js";import{a6 as h}from"./shared-3026cee0.js";import{c as u}from"./shared-4e709717.js";let p,f,m,y,v=e=>e;class _ extends(l(a(o(e(r))))){constructor(){super(...arguments),this.nucleon=null,this.infer=""}static get inferredProperties(){return[...super.inferredProperties,"nucleon"]}static get properties(){return t(t({},super.properties),{},{nucleon:{attribute:!1}})}inferFromElement(e,t){return"nucleon"===e&&t instanceof d?t:super.inferFromElement(e,t)}applyInferredProperties(e){var t;super.applyInferredProperties(e),this.nucleon=null!==(t=e.get("nucleon"))&&void 0!==t?t:null}updated(e){super.updated(e),this.style.display=this.hidden?"none":"",n(i(p||(p=v` <slot name="${0}:before" slot="before"></slot> <slot name="${0}:after" slot="after"></slot> `),this.infer,this.infer),this)}renderControl(){return i(f||(f=v``))}render(){return this.hidden?i(m||(m=v``)):i(y||(y=v` ${0} ${0} ${0} `),this.renderTemplateOrSlot("before",this.nucleon),this.renderControl(),this.renderTemplateOrSlot("after",this.nucleon))}}customElements.define("foxy-internal-control",_);class x extends _{constructor(){super(...arguments),this.__placeholder=null,this.__helperText=null,this.__v8nPrefix=null,this.__property=null,this.__label=null}static get properties(){return t(t({},super.properties),{},{__placeholder:{attribute:!1},__helperText:{attribute:!1},__v8nPrefix:{attribute:!1},__property:{attribute:!1},__label:{attribute:!1},placeholder:{type:String,noAccessor:!0},helperText:{type:String,attribute:"helper-text",noAccessor:!0},v8nPrefix:{type:String,attribute:"v8n-prefix",noAccessor:!0},property:{type:String,noAccessor:!0},label:{type:String,noAccessor:!0}})}get placeholder(){return"string"==typeof this.__placeholder?this.__placeholder:this.t("placeholder")}set placeholder(e){this.__placeholder=e}get helperText(){return"string"==typeof this.__helperText?this.__helperText:this.t("helper_text")}set helperText(e){this.__helperText=e}get v8nPrefix(){return"string"==typeof this.__v8nPrefix?this.__v8nPrefix:`${this.infer}:`}set v8nPrefix(e){this.__v8nPrefix=e}get property(){return"string"==typeof this.__property?this.__property:this.infer.replace(/-/g,"_")}set property(e){this.__property=e}get label(){return"string"==typeof this.__label?this.__label:this.t("label")}set label(e){this.__label=e}get _value(){var e;return null===(e=this.nucleon)||void 0===e?void 0:e.form[this.property]}set _value(e){var t;const r=new CustomEvent("change",{cancelable:!0,detail:e});this.dispatchEvent(r)&&(null===(t=this.nucleon)||void 0===t||t.edit({[this.property]:e}))}get _error(){var e;return null===(e=this.nucleon)||void 0===e?void 0:e.errors.find((e=>e.startsWith(this.v8nPrefix)))}get _errorMessage(){return this._error?this.t(this._error.substring(0,this.v8nPrefix.length)):void 0}get _checkValidity(){return()=>!this._error}}customElements.define("foxy-internal-editable-control",x);let g,b=e=>e;customElements.define("foxy-internal-number-control",class extends x{renderControl(){return i(g||(g=b` <vaadin-number-field error-message="${0}" placeholder="${0}" helper-text="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" has-controls @keydown="${0}" @change="${0}"> </vaadin-number-field> `),c(this._errorMessage),this.placeholder,this.helperText,this.label,this.disabled,this.readonly,this._checkValidity,String(this._value),(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{const t=e.currentTarget;this._value=parseFloat(t.value)}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:0}set _value(e){super._value=e}});let $,T=e=>e;customElements.define("foxy-internal-text-control",class extends x{renderControl(){return i($||($=T` <vaadin-text-field error-message="${0}" helper-text="${0}" placeholder="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> `),c(this._errorMessage),this.helperText,this.placeholder,this.label,this.disabled,this.readonly,this._checkValidity,this._value,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{const t=e.currentTarget;this._value=t.value}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}});let w,I=e=>e;customElements.define("foxy-internal-create-control",class extends _{constructor(){super(...arguments),this.infer="create"}renderControl(){return i(w||(w=I` <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> `),this.disabled||this.__isInvalid,(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.submit()}),this.ns,this.lang)}get __isCleanTemplateInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{template:{clean:"invalid"}}}))}get __isDirtyTemplateInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{template:{dirty:"invalid"}}}))}get __isCleanSnapshotInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{snapshot:{clean:"invalid"}}}))}get __isDirtySnapshotInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{snapshot:{dirty:"invalid"}}}))}get __isTemplateInvalid(){return this.__isCleanTemplateInvalid||this.__isDirtyTemplateInvalid}get __isSnapshotInvalid(){return this.__isCleanSnapshotInvalid||this.__isDirtySnapshotInvalid}get __isInvalid(){return this.__isSnapshotInvalid||this.__isTemplateInvalid}});let k,S=e=>e;customElements.define("foxy-internal-delete-control",class extends _{constructor(){super(...arguments),this.infer="delete"}renderControl(){return i(k||(k=S` <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> <vaadin-button data-testid="delete" theme="primary error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> `),this.lang,this.ns,(e=>{var t;return!e.detail.cancelled&&(null===(t=this.nucleon)||void 0===t?void 0:t.delete())}),this.disabled||this.readonly,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang)}});let E,j,P=e=>e;customElements.define("foxy-internal-timestamps-control",class extends _{constructor(){super(...arguments),this.infer="timestamps"}static get styles(){return[super.styles,s(E||(E=P`.max-w-0{max-width:0}`))]}renderControl(){return i(j||(j=P` <table class="font-lumo text-m leading-m w-full"> <tbody class="divide-y divide-contrast-10"> <tr> <td class="max-w-0 truncate py-s text-secondary w-1-3 pr-m"> <foxy-i18n lang="${0}" key="date_created" ns="${0}"></foxy-i18n> </td> <td class="max-w-0 truncate py-s text-body w-2-3"> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"> </foxy-i18n> </td> </tr> <tr> <td class="max-w-0 truncate py-s text-secondary w-1-3 pr-m"> <foxy-i18n lang="${0}" key="date_modified" ns="${0}"></foxy-i18n> </td> <td class="max-w-0 truncate py-s text-body w-2-3"> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"> </foxy-i18n> </td> </tr> </tbody> </table> `),this.lang,this.ns,JSON.stringify({value:h(this,"nucleon.form.date_created")}),this.lang,this.ns,this.lang,this.ns,JSON.stringify({value:h(this,"nucleon.form.date_modified")}),this.lang,this.ns)}});let C,A,V,B=e=>e;const D=l(o(a(d)));class O extends D{renderBody(){return this.data?i(C||(C=B` <foxy-internal-timestamps-control infer="timestamps"></foxy-internal-timestamps-control> <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> `)):i(A||(A=B`<foxy-internal-create-control infer="create"></foxy-internal-create-control>`))}render(){const e=!(this.in("idle")||this.in({busy:"fetching"})&&this.data);return i(V||(V=B` <div aria-busy="${0}" aria-live="polite" class="relative"> <div class="${0}"> ${0} </div> <div class="${0}"> <foxy-spinner layout="${0}" class="m-auto" state="${0}" infer="spinner"> </foxy-spinner> </div> </div> `),this.in("busy"),u({"grid grid-cols-1 gap-m":!0,"transition-opacity":!0,"opacity-0 pointer-events-none":e}),this.renderBody(),u({"transition-opacity absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!e}),this.in("fail")?"vertical":"no-label",this.in("fail")?"error":"busy")}}customElements.define("foxy-internal-form",O);let q,F=e=>e;class M extends(a(O,"item-option-form")){static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!!e&&e.length<=100||"name:v8n_too_long",({value:e})=>!!e||"value:v8n_required",({value:e})=>!!e&&e.length<=1024||"value:v8n_too_long"]}renderBody(){return i(q||(q=F` <foxy-internal-text-control infer="name"></foxy-internal-text-control> <foxy-internal-text-control infer="value"></foxy-internal-text-control> <foxy-internal-number-control infer="price-mod"></foxy-internal-number-control> <foxy-internal-number-control infer="weight-mod"></foxy-internal-number-control> ${0} `),super.renderBody())}}customElements.define("foxy-item-option-form",M);export{x as I,_ as a,O as b,M as c};
@@ -1,11 +1,21 @@
1
- import { TemplateResult } from 'lit-html';
2
- import { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';
1
+ import type { TemplateResult } from 'lit-html';
3
2
  import { PropertyDeclarations } from 'lit-element';
3
+ import { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';
4
+ /**
5
+ * Internal control displaying a combo box where items are loaded from
6
+ * a hAPI collection.
7
+ *
8
+ * @since 1.17.0
9
+ * @tag foxy-internal-async-combo-box-control
10
+ */
4
11
  export declare class InternalAsyncComboBoxControl extends InternalEditableControl {
5
12
  static get properties(): PropertyDeclarations;
6
- itemLabelPath: string;
7
- itemValuePath: string;
8
- first: string;
13
+ /** Same as `itemLabelPath` property of Vaadin's `ComboBoxElement`. */
14
+ itemLabelPath: string | null;
15
+ /** Same as `itemValuePath` property of Vaadin's `ComboBoxElement`. */
16
+ itemValuePath: string | null;
17
+ /** URL of the first page of the hAPI collection serving as a source for items. */
18
+ first: string | null;
9
19
  renderControl(): TemplateResult;
10
20
  protected get _value(): string;
11
21
  protected set _value(newValue: string);
@@ -1,13 +1,23 @@
1
+ import { ifDefined } from 'lit-html/directives/if-defined';
1
2
  import { html } from 'lit-html';
2
3
  import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
3
4
  import { API } from "../../public/NucleonElement/API.js";
4
- import { ifDefined } from 'lit-html/directives/if-defined';
5
+ /**
6
+ * Internal control displaying a combo box where items are loaded from
7
+ * a hAPI collection.
8
+ *
9
+ * @since 1.17.0
10
+ * @tag foxy-internal-async-combo-box-control
11
+ */
5
12
  export class InternalAsyncComboBoxControl extends InternalEditableControl {
6
13
  constructor() {
7
14
  super(...arguments);
8
- this.itemLabelPath = '';
9
- this.itemValuePath = '';
10
- this.first = '';
15
+ /** Same as `itemLabelPath` property of Vaadin's `ComboBoxElement`. */
16
+ this.itemLabelPath = null;
17
+ /** Same as `itemValuePath` property of Vaadin's `ComboBoxElement`. */
18
+ this.itemValuePath = null;
19
+ /** URL of the first page of the hAPI collection serving as a source for items. */
20
+ this.first = null;
11
21
  }
12
22
  static get properties() {
13
23
  return {
@@ -18,12 +28,16 @@ export class InternalAsyncComboBoxControl extends InternalEditableControl {
18
28
  };
19
29
  }
20
30
  renderControl() {
31
+ var _a, _b;
21
32
  const dataProvider = async (params, callback) => {
33
+ if (!this.first)
34
+ return callback([], 0);
22
35
  const url = new URL(this.first);
23
36
  url.searchParams.set('offset', String(params.page * params.pageSize));
24
37
  url.searchParams.set('limit', String(params.pageSize));
25
- if (params.filter)
38
+ if (params.filter && this.itemLabelPath) {
26
39
  url.searchParams.set(this.itemLabelPath, `*${params.filter}*`);
40
+ }
27
41
  const response = await new API(this).fetch(url.toString());
28
42
  if (!response.ok)
29
43
  throw new Error(await response.text());
@@ -33,8 +47,8 @@ export class InternalAsyncComboBoxControl extends InternalEditableControl {
33
47
  };
34
48
  return html `
35
49
  <vaadin-combo-box
36
- item-value-path=${this.itemValuePath}
37
- item-label-path=${this.itemLabelPath}
50
+ item-value-path=${ifDefined((_a = this.itemValuePath) !== null && _a !== void 0 ? _a : undefined)}
51
+ item-label-path=${ifDefined((_b = this.itemLabelPath) !== null && _b !== void 0 ? _b : undefined)}
38
52
  error-message=${ifDefined(this._errorMessage)}
39
53
  item-id-path="_links.self.href"
40
54
  helper-text=${this.helperText}
@@ -1 +1 @@
1
- {"version":3,"file":"InternalAsyncComboBoxControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAE7F,OAAO,EAAE,GAAG,EAAE,2CAAwC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,MAAM,OAAO,4BAA6B,SAAQ,uBAAuB;IAAzE;;QAUE,kBAAa,GAAG,EAAE,CAAC;QAEnB,kBAAa,GAAG,EAAE,CAAC;QAEnB,UAAK,GAAG,EAAE,CAAC;IAkDb,CAAC;IA/DC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAC7D,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAC7D,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAQD,aAAa;QACX,MAAM,YAAY,GAAyB,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;YACpE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEhC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACtE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACvD,IAAI,MAAM,CAAC,MAAM;gBAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;YAElF,MAAM,QAAQ,GAAG,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAEzD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAc,CAAC;YAExE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACpC,CAAC,CAAC;QAEF,OAAO,IAAI,CAAA;;0BAEW,IAAI,CAAC,aAAa;0BAClB,IAAI,CAAC,aAAa;wBACpB,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;;sBAE/B,IAAI,CAAC,UAAU;sBACf,IAAI,CAAC,WAAW;gBACtB,IAAI,CAAC,KAAK;;oBAEN,IAAI,CAAC,QAAQ;oBACb,IAAI,CAAC,QAAQ;yBACR,IAAI,CAAC,cAAc;wBACpB,YAAY;iBACnB,IAAI,CAAC,MAAM;kBACV,CAAC,GAAgB,EAAE,EAAE;YAC7B,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAgC,CAAC;YACtD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC/B,CAAC;;;KAGJ,CAAC;IACJ,CAAC;IAED,IAAc,MAAM;;QAClB,aAAQ,KAAK,CAAC,MAA6B,mCAAI,EAAE,CAAC;IACpD,CAAC;IAED,IAAc,MAAM,CAAC,QAAgB;QACnC,KAAK,CAAC,MAAM,GAAG,QAA+B,CAAC;IACjD,CAAC;CACF","sourcesContent":["import { html, TemplateResult } from 'lit-html';\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ComboBoxDataProvider, ComboBoxElement } from '@vaadin/vaadin-combo-box';\nimport { API } from '../../public/NucleonElement/API';\nimport { PropertyDeclarations } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport class InternalAsyncComboBoxControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n itemLabelPath: { type: String, attribute: 'item-label-path' },\n itemValuePath: { type: String, attribute: 'item-value-path' },\n first: { type: String },\n };\n }\n\n itemLabelPath = '';\n\n itemValuePath = '';\n\n first = '';\n\n renderControl(): TemplateResult {\n const dataProvider: ComboBoxDataProvider = async (params, callback) => {\n const url = new URL(this.first);\n\n url.searchParams.set('offset', String(params.page * params.pageSize));\n url.searchParams.set('limit', String(params.pageSize));\n if (params.filter) url.searchParams.set(this.itemLabelPath, `*${params.filter}*`);\n\n const response = await new API(this).fetch(url.toString());\n if (!response.ok) throw new Error(await response.text());\n\n const json = await response.json();\n const items = Array.from(Object.values(json._embedded))[0] as unknown[];\n\n callback(items, json.total_items);\n };\n\n return html`\n <vaadin-combo-box\n item-value-path=${this.itemValuePath}\n item-label-path=${this.itemLabelPath}\n error-message=${ifDefined(this._errorMessage)}\n item-id-path=\"_links.self.href\"\n helper-text=${this.helperText}\n placeholder=${this.placeholder}\n label=${this.label}\n class=\"w-full\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .dataProvider=${dataProvider}\n .value=${this._value}\n @change=${(evt: CustomEvent) => {\n const comboBox = evt.currentTarget as ComboBoxElement;\n this._value = comboBox.value;\n }}\n >\n </vaadin-combo-box>\n `;\n }\n\n protected get _value(): string {\n return (super._value as string | undefined) ?? '';\n }\n\n protected set _value(newValue: string) {\n super._value = newValue as unknown | undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalAsyncComboBoxControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,GAAG,EAAE,2CAAwC;AAEtD;;;;;;GAMG;AACH,MAAM,OAAO,4BAA6B,SAAQ,uBAAuB;IAAzE;;QAUE,sEAAsE;QACtE,kBAAa,GAAkB,IAAI,CAAC;QAEpC,sEAAsE;QACtE,kBAAa,GAAkB,IAAI,CAAC;QAEpC,kFAAkF;QAClF,UAAK,GAAkB,IAAI,CAAC;IAsD9B,CAAC;IAtEC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAC7D,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAC7D,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAWD,aAAa;;QACX,MAAM,YAAY,GAAyB,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;YACpE,IAAI,CAAC,IAAI,CAAC,KAAK;gBAAE,OAAO,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAExC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACtE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAEvD,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,EAAE;gBACvC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;aAChE;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAEzD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAc,CAAC;YAExE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACpC,CAAC,CAAC;QAEF,OAAO,IAAI,CAAA;;0BAEW,SAAS,OAAC,IAAI,CAAC,aAAa,mCAAI,SAAS,CAAC;0BAC1C,SAAS,OAAC,IAAI,CAAC,aAAa,mCAAI,SAAS,CAAC;wBAC5C,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;;sBAE/B,IAAI,CAAC,UAAU;sBACf,IAAI,CAAC,WAAW;gBACtB,IAAI,CAAC,KAAK;;oBAEN,IAAI,CAAC,QAAQ;oBACb,IAAI,CAAC,QAAQ;yBACR,IAAI,CAAC,cAAc;wBACpB,YAAY;iBACnB,IAAI,CAAC,MAAM;kBACV,CAAC,GAAgB,EAAE,EAAE;YAC7B,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAgC,CAAC;YACtD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC/B,CAAC;;;KAGJ,CAAC;IACJ,CAAC;IAED,IAAc,MAAM;;QAClB,aAAQ,KAAK,CAAC,MAA6B,mCAAI,EAAE,CAAC;IACpD,CAAC;IAED,IAAc,MAAM,CAAC,QAAgB;QACnC,KAAK,CAAC,MAAM,GAAG,QAA+B,CAAC;IACjD,CAAC;CACF","sourcesContent":["import type { ComboBoxDataProvider, ComboBoxElement } from '@vaadin/vaadin-combo-box';\nimport type { TemplateResult } from 'lit-html';\n\nimport { PropertyDeclarations } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { API } from '../../public/NucleonElement/API';\n\n/**\n * Internal control displaying a combo box where items are loaded from\n * a hAPI collection.\n *\n * @since 1.17.0\n * @tag foxy-internal-async-combo-box-control\n */\nexport class InternalAsyncComboBoxControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n itemLabelPath: { type: String, attribute: 'item-label-path' },\n itemValuePath: { type: String, attribute: 'item-value-path' },\n first: { type: String },\n };\n }\n\n /** Same as `itemLabelPath` property of Vaadin's `ComboBoxElement`. */\n itemLabelPath: string | null = null;\n\n /** Same as `itemValuePath` property of Vaadin's `ComboBoxElement`. */\n itemValuePath: string | null = null;\n\n /** URL of the first page of the hAPI collection serving as a source for items. */\n first: string | null = null;\n\n renderControl(): TemplateResult {\n const dataProvider: ComboBoxDataProvider = async (params, callback) => {\n if (!this.first) return callback([], 0);\n\n const url = new URL(this.first);\n url.searchParams.set('offset', String(params.page * params.pageSize));\n url.searchParams.set('limit', String(params.pageSize));\n\n if (params.filter && this.itemLabelPath) {\n url.searchParams.set(this.itemLabelPath, `*${params.filter}*`);\n }\n\n const response = await new API(this).fetch(url.toString());\n if (!response.ok) throw new Error(await response.text());\n\n const json = await response.json();\n const items = Array.from(Object.values(json._embedded))[0] as unknown[];\n\n callback(items, json.total_items);\n };\n\n return html`\n <vaadin-combo-box\n item-value-path=${ifDefined(this.itemValuePath ?? undefined)}\n item-label-path=${ifDefined(this.itemLabelPath ?? undefined)}\n error-message=${ifDefined(this._errorMessage)}\n item-id-path=\"_links.self.href\"\n helper-text=${this.helperText}\n placeholder=${this.placeholder}\n label=${this.label}\n class=\"w-full\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .dataProvider=${dataProvider}\n .value=${this._value}\n @change=${(evt: CustomEvent) => {\n const comboBox = evt.currentTarget as ComboBoxElement;\n this._value = comboBox.value;\n }}\n >\n </vaadin-combo-box>\n `;\n }\n\n protected get _value(): string {\n return (super._value as string | undefined) ?? '';\n }\n\n protected set _value(newValue: string) {\n super._value = newValue as unknown | undefined;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import '@vaadin/vaadin-combo-box';
2
2
  import '../InternalEditableControl/index';
3
- import { InternalAsyncComboBoxControl } from './InternalAsyncComboBoxControl';
4
- export { InternalAsyncComboBoxControl };
3
+ import { InternalAsyncComboBoxControl as Control } from './InternalAsyncComboBoxControl';
4
+ export { Control as InternalAsyncComboBoxControl };
@@ -1,6 +1,6 @@
1
1
  import '@vaadin/vaadin-combo-box';
2
2
  import "../InternalEditableControl/index.js";
3
- import { InternalAsyncComboBoxControl } from "./InternalAsyncComboBoxControl.js";
4
- customElements.define('foxy-internal-async-combo-box-control', InternalAsyncComboBoxControl);
5
- export { InternalAsyncComboBoxControl };
3
+ import { InternalAsyncComboBoxControl as Control } from "./InternalAsyncComboBoxControl.js";
4
+ customElements.define('foxy-internal-async-combo-box-control', Control);
5
+ export { Control as InternalAsyncComboBoxControl };
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncComboBoxControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAClC,6CAA0C;AAC1C,OAAO,EAAE,4BAA4B,EAAE,0CAAuC;AAE9E,cAAc,CAAC,MAAM,CAAC,uCAAuC,EAAE,4BAA4B,CAAC,CAAC;AAE7F,OAAO,EAAE,4BAA4B,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-combo-box';\nimport '../InternalEditableControl/index';\nimport { InternalAsyncComboBoxControl } from './InternalAsyncComboBoxControl';\n\ncustomElements.define('foxy-internal-async-combo-box-control', InternalAsyncComboBoxControl);\n\nexport { InternalAsyncComboBoxControl };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalAsyncComboBoxControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAClC,6CAA0C;AAC1C,OAAO,EAAE,4BAA4B,IAAI,OAAO,EAAE,0CAAuC;AAEzF,cAAc,CAAC,MAAM,CAAC,uCAAuC,EAAE,OAAO,CAAC,CAAC;AAExE,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-combo-box';\nimport '../InternalEditableControl/index';\nimport { InternalAsyncComboBoxControl as Control } from './InternalAsyncComboBoxControl';\n\ncustomElements.define('foxy-internal-async-combo-box-control', Control);\n\nexport { Control as InternalAsyncComboBoxControl };\n"]}
@@ -1,6 +1,3 @@
1
1
  import '../../public/Spinner/index';
2
- import '../InternalCreateControl/index';
3
- import '../InternalDeleteControl/index';
4
- import '../InternalTimestampsControl/index';
5
2
  import { InternalCard } from './InternalCard';
6
3
  export { InternalCard };
@@ -1,7 +1,4 @@
1
1
  import "../../public/Spinner/index.js";
2
- import "../InternalCreateControl/index.js";
3
- import "../InternalDeleteControl/index.js";
4
- import "../InternalTimestampsControl/index.js";
5
2
  import { InternalCard } from "./InternalCard.js";
6
3
  customElements.define('foxy-internal-card', InternalCard);
7
4
  export { InternalCard };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalCard/index.ts"],"names":[],"mappings":"AAAA,uCAAoC;AACpC,2CAAwC;AACxC,2CAAwC;AACxC,+CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE,0BAAuB;AAE9C,cAAc,CAAC,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import '../../public/Spinner/index';\nimport '../InternalCreateControl/index';\nimport '../InternalDeleteControl/index';\nimport '../InternalTimestampsControl/index';\nimport { InternalCard } from './InternalCard';\n\ncustomElements.define('foxy-internal-card', InternalCard);\n\nexport { InternalCard };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalCard/index.ts"],"names":[],"mappings":"AAAA,uCAAoC;AACpC,OAAO,EAAE,YAAY,EAAE,0BAAuB;AAE9C,cAAc,CAAC,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import '../../public/Spinner/index';\nimport { InternalCard } from './InternalCard';\n\ncustomElements.define('foxy-internal-card', InternalCard);\n\nexport { InternalCard };\n"]}
@@ -1,7 +1,14 @@
1
- import { TemplateResult, PropertyDeclarations } from 'lit-element';
1
+ import type { TemplateResult, PropertyDeclarations } from 'lit-element';
2
2
  import { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';
3
+ /**
4
+ * Internal control displaying a basic date picker box.
5
+ *
6
+ * @since 1.17.0
7
+ * @tag foxy-internal-date-control
8
+ */
3
9
  export declare class InternalDateControl extends InternalEditableControl {
4
10
  static get properties(): PropertyDeclarations;
5
- format: string;
11
+ /** Date format. If `unix`, expects and outputs a UNIX timestamp (number), otherwise defaults to ISO 8601 date. */
12
+ format: 'unix' | null;
6
13
  renderControl(): TemplateResult;
7
14
  }
@@ -1,11 +1,19 @@
1
- import { html } from 'lit-element';
2
- import { ifDefined } from 'lit-html/directives/if-defined';
3
- import { serializeDate } from "../../../utils/serialize-date.js";
4
1
  import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
2
+ import { serializeDate } from "../../../utils/serialize-date.js";
3
+ import { parseDate } from "../../../utils/parse-date.js";
4
+ import { ifDefined } from 'lit-html/directives/if-defined';
5
+ import { html } from 'lit-element';
6
+ /**
7
+ * Internal control displaying a basic date picker box.
8
+ *
9
+ * @since 1.17.0
10
+ * @tag foxy-internal-date-control
11
+ */
5
12
  export class InternalDateControl extends InternalEditableControl {
6
13
  constructor() {
7
14
  super(...arguments);
8
- this.format = 'unix';
15
+ /** Date format. If `unix`, expects and outputs a UNIX timestamp (number), otherwise defaults to ISO 8601 date. */
16
+ this.format = null;
9
17
  }
10
18
  static get properties() {
11
19
  return {
@@ -17,7 +25,7 @@ export class InternalDateControl extends InternalEditableControl {
17
25
  var _a;
18
26
  let value;
19
27
  if (this.format === 'unix') {
20
- value = serializeDate(new Date((_a = this._value) !== null && _a !== void 0 ? _a : 0));
28
+ value = serializeDate(new Date(((_a = this._value) !== null && _a !== void 0 ? _a : 0) * 1000));
21
29
  }
22
30
  else {
23
31
  value = this._value;
@@ -26,18 +34,22 @@ export class InternalDateControl extends InternalEditableControl {
26
34
  <vaadin-date-picker
27
35
  error-message=${ifDefined(this._errorMessage)}
28
36
  placeholder=${this.placeholder}
37
+ helper-text=${this.helperText}
29
38
  label=${this.label}
30
39
  class="w-full"
31
40
  ?disabled=${this.disabled}
32
41
  ?readonly=${this.readonly}
33
42
  .checkValidity=${this._checkValidity}
34
43
  .value=${value}
44
+ @keydown=${(evt) => { var _a; return evt.key === 'Enter' && ((_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.submit()); }}
35
45
  @change=${(evt) => {
36
- var _a;
46
+ var _a, _b;
37
47
  const field = evt.currentTarget;
38
- const fieldValue = field.value;
39
48
  if (this.format === 'unix') {
40
- (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.edit({ [this.property]: new Date(fieldValue).getTime() });
49
+ this._value = Math.floor(((_b = (_a = parseDate(field.value)) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0) / 1000);
50
+ }
51
+ else {
52
+ this._value = field.value;
41
53
  }
42
54
  }}
43
55
  >
@@ -1 +1 @@
1
- {"version":3,"file":"InternalDateControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalDateControl/InternalDateControl.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAwB,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAE7F,MAAM,OAAO,mBAAoB,SAAQ,uBAAuB;IAAhE;;QAQE,WAAM,GAAG,MAAM,CAAC;IAiClB,CAAC;IAxCC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACzB,CAAC;IACJ,CAAC;IAID,aAAa;;QACX,IAAI,KAAa,CAAC;QAElB,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;YAC1B,KAAK,GAAG,aAAa,CAAC,IAAI,IAAI,OAAE,IAAI,CAAC,MAAiB,mCAAI,CAAC,CAAC,CAAC,CAAC;SAC/D;aAAM;YACL,KAAK,GAAG,IAAI,CAAC,MAAgB,CAAC;SAC/B;QAED,OAAO,IAAI,CAAA;;wBAES,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;sBAC/B,IAAI,CAAC,WAAW;gBACtB,IAAI,CAAC,KAAK;;oBAEN,IAAI,CAAC,QAAQ;oBACb,IAAI,CAAC,QAAQ;yBACR,IAAI,CAAC,cAAc;iBAC3B,KAAK;kBACJ,CAAC,GAAgB,EAAE,EAAE;;YAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,aAAkC,CAAC;YACrD,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;YAE/B,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE;aACzE;QACH,CAAC;;;KAGJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { DatePickerElement } from '@vaadin/vaadin-date-picker';\nimport { TemplateResult, html, PropertyDeclarations } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\n\nexport class InternalDateControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n format: { type: String },\n };\n }\n\n format = 'unix';\n\n renderControl(): TemplateResult {\n let value: string;\n\n if (this.format === 'unix') {\n value = serializeDate(new Date((this._value as number) ?? 0));\n } else {\n value = this._value as string;\n }\n\n return html`\n <vaadin-date-picker\n error-message=${ifDefined(this._errorMessage)}\n placeholder=${this.placeholder}\n label=${this.label}\n class=\"w-full\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${value}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as DatePickerElement;\n const fieldValue = field.value;\n\n if (this.format === 'unix') {\n this.nucleon?.edit({ [this.property]: new Date(fieldValue).getTime() });\n }\n }}\n >\n </vaadin-date-picker>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalDateControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalDateControl/InternalDateControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,SAAS,EAAE,qCAAkC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,uBAAuB;IAAhE;;QAQE,kHAAkH;QAClH,WAAM,GAAkB,IAAI,CAAC;IAoC/B,CAAC;IA5CC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACzB,CAAC;IACJ,CAAC;IAKD,aAAa;;QACX,IAAI,KAAa,CAAC;QAElB,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;YAC1B,KAAK,GAAG,aAAa,CAAC,IAAI,IAAI,CAAC,OAAE,IAAI,CAAC,MAAiB,mCAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;SACxE;aAAM;YACL,KAAK,GAAG,IAAI,CAAC,MAAgB,CAAC;SAC/B;QAED,OAAO,IAAI,CAAA;;wBAES,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;sBAC/B,IAAI,CAAC,WAAW;sBAChB,IAAI,CAAC,UAAU;gBACrB,IAAI,CAAC,KAAK;;oBAEN,IAAI,CAAC,QAAQ;oBACb,IAAI,CAAC,QAAQ;yBACR,IAAI,CAAC,cAAc;iBAC3B,KAAK;mBACH,CAAC,GAAkB,EAAE,EAAE,WAAC,OAAA,GAAG,CAAC,GAAG,KAAK,OAAO,WAAI,IAAI,CAAC,OAAO,0CAAE,MAAM,GAAE,CAAA,EAAA;kBACtE,CAAC,GAAgB,EAAE,EAAE;;YAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,aAAkC,CAAC;YAErD,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,aAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,0CAAE,OAAO,qCAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;aAC3E;iBAAM;gBACL,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;aAC3B;QACH,CAAC;;;KAGJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult, PropertyDeclarations } from 'lit-element';\nimport type { DatePickerElement } from '@vaadin/vaadin-date-picker';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { parseDate } from '../../../utils/parse-date';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\n/**\n * Internal control displaying a basic date picker box.\n *\n * @since 1.17.0\n * @tag foxy-internal-date-control\n */\nexport class InternalDateControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n format: { type: String },\n };\n }\n\n /** Date format. If `unix`, expects and outputs a UNIX timestamp (number), otherwise defaults to ISO 8601 date. */\n format: 'unix' | null = null;\n\n renderControl(): TemplateResult {\n let value: string;\n\n if (this.format === 'unix') {\n value = serializeDate(new Date(((this._value as number) ?? 0) * 1000));\n } else {\n value = this._value as string;\n }\n\n return html`\n <vaadin-date-picker\n error-message=${ifDefined(this._errorMessage)}\n placeholder=${this.placeholder}\n helper-text=${this.helperText}\n label=${this.label}\n class=\"w-full\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${value}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as DatePickerElement;\n\n if (this.format === 'unix') {\n this._value = Math.floor((parseDate(field.value)?.getTime() ?? 0) / 1000);\n } else {\n this._value = field.value;\n }\n }}\n >\n </vaadin-date-picker>\n `;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import '@vaadin/vaadin-date-picker';
2
2
  import '../InternalEditableControl/index';
3
- import { InternalDateControl } from './InternalDateControl';
4
- export { InternalDateControl };
3
+ import { InternalDateControl as Control } from './InternalDateControl';
4
+ export { Control as InternalDateControl };
@@ -1,6 +1,6 @@
1
1
  import '@vaadin/vaadin-date-picker';
2
2
  import "../InternalEditableControl/index.js";
3
- import { InternalDateControl } from "./InternalDateControl.js";
4
- customElements.define('foxy-internal-date-control', InternalDateControl);
5
- export { InternalDateControl };
3
+ import { InternalDateControl as Control } from "./InternalDateControl.js";
4
+ customElements.define('foxy-internal-date-control', Control);
5
+ export { Control as InternalDateControl };
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalDateControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,6CAA0C;AAC1C,OAAO,EAAE,mBAAmB,EAAE,iCAA8B;AAE5D,cAAc,CAAC,MAAM,CAAC,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-date-picker';\nimport '../InternalEditableControl/index';\nimport { InternalDateControl } from './InternalDateControl';\n\ncustomElements.define('foxy-internal-date-control', InternalDateControl);\n\nexport { InternalDateControl };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalDateControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,6CAA0C;AAC1C,OAAO,EAAE,mBAAmB,IAAI,OAAO,EAAE,iCAA8B;AAEvE,cAAc,CAAC,MAAM,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-date-picker';\nimport '../InternalEditableControl/index';\nimport { InternalDateControl as Control } from './InternalDateControl';\n\ncustomElements.define('foxy-internal-date-control', Control);\n\nexport { Control as InternalDateControl };\n"]}
@@ -1,6 +1,6 @@
1
1
  import '../../public/Spinner/index';
2
- import '../InternalCreateControl/index';
3
- import '../InternalDeleteControl/index';
4
- import '../InternalTimestampsControl/index';
2
+ import './internal/InternalCreateControl/index';
3
+ import './internal/InternalDeleteControl/index';
4
+ import './internal/InternalTimestampsControl/index';
5
5
  import { InternalForm } from './InternalForm';
6
6
  export { InternalForm };