@foxy.io/elements 1.53.1 → 1.53.3
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.
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-store-transaction-folder-form.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/{shared-3ce475ee.js → shared-842078ca.js} +1 -1
- package/dist/cdn/shared-909b8221.js +1 -0
- package/dist/cdn/{shared-8146467b.js → shared-9d4fecb9.js} +1 -1
- package/dist/cdn/shared-a339f79c.js +1 -0
- package/dist/cdn/{shared-fe72474f.js → shared-e44d4a56.js} +1 -1
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js +1 -1
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js.map +1 -1
- package/dist/elements/internal/InternalNativeDateControl/InternalNativeDateControl.js +1 -1
- package/dist/elements/internal/InternalNativeDateControl/InternalNativeDateControl.js.map +1 -1
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js +1 -1
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js.map +1 -1
- package/dist/elements/internal/InternalTextControl/InternalTextControl.js +1 -1
- package/dist/elements/internal/InternalTextControl/InternalTextControl.js.map +1 -1
- package/dist/elements/public/ReportForm/utils.js +12 -12
- package/dist/elements/public/ReportForm/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-8aeb0657.js +0 -1
- package/dist/cdn/shared-d1125001.js +0 -1
- /package/dist/cdn/{shared-75771f16.js → shared-01cd4e3c.js} +0 -0
- /package/dist/cdn/{shared-d9bc3fec.js → shared-7995d26e.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-515003f6.js";import"./shared-
|
|
1
|
+
import"./shared-515003f6.js";import"./shared-01cd4e3c.js";import{I as e}from"./shared-2bb1f0f4.js";import{I as t}from"./shared-ad26f72d.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-form-dialog.js";import"./shared-9b35fe34.js";import{_ as s,m as i,F as r}from"./shared-8f9014ff.js";import{h as o,s as l}from"./shared-ba5c42c7.js";import{s as a}from"./shared-53e476fd.js";import{g as n}from"./shared-bab2ea2c.js";import{i as d}from"./shared-53e42a77.js";import{c as h}from"./shared-4e709717.js";import{u}from"./shared-2b39e4d4.js";let c,f=e=>e;let p,y,m,v,x,b,_,g,$=e=>e;customElements.define("foxy-internal-resource-picker-control-form",class extends t{constructor(){super(...arguments),this.selectionProps={}}static get properties(){return s(s({},super.properties),{},{selectionProps:{attribute:!1}})}renderBody(){return o(c||(c=f` <foxy-internal-async-list-control infer="selection" form="foxy-null" hide-delete-button hide-create-button @itemclick="${0}" ...="${0}"> </foxy-internal-async-list-control> `),(e=>{e.preventDefault(),this.edit({selection:e.detail}),this.submit()}),a(this.selectionProps))}}),customElements.define("foxy-internal-resource-picker-control",class extends e{constructor(){super(...arguments),this.getDisplayValueOptions=e=>({resource:e}),this.showCopyIdButton=!1,this.virtualHost=u("internal-resource-picker-control-"),this.getItemUrl=null,this.formProps={},this.filters=[],this.extendFilter=null,this.layout=null,this.first=null,this.item=null,this.form=null,this.__isErrorVisible=!1,this.__getItemRenderer=i((e=>new Function("ctx",`return ctx.html\`\n <${null!=e?e:"foxy-null"}\n related=\${JSON.stringify(ctx.related)}\n parent=\${ctx.parent}\n infer="card"\n href=\${ctx.href}\n ...=\${ctx.spread(ctx.props)}\n >\n </${null!=e?e:"foxy-null"}>\``)))}static get properties(){return s(s({},super.properties),{},{getDisplayValueOptions:{attribute:!1},showCopyIdButton:{type:Boolean,attribute:"show-copy-id-button"},virtualHost:{},getItemUrl:{attribute:!1},formProps:{type:Object},filters:{type:Array},extendFilter:{type:Function,attribute:!1},layout:{},first:{},item:{},form:{},__isErrorVisible:{attribute:!1}})}renderControl(){var e;const t=s(s({},this.formProps),{},{".selectionProps":{".extendFilter":this.extendFilter,".filters":this.filters,".first":this.first,".item":this.item}});return o(p||(p=$` <foxy-form-dialog parent="foxy://${0}/select" header="header" infer="dialog" alert .props="${0}" .form="${0}" @fetch="${0}" @hide="${0}"> </foxy-form-dialog> ${0} `),this.virtualHost,t,null!==(e=this.form)&&void 0!==e?e:"foxy-internal-resource-picker-control-form",this.__handleFetchEvent,(()=>this.__isErrorVisible=!0),"summary-item"===this.layout?this.__renderSummaryItemLayout():this.__renderStandaloneLayout())}reportValidity(){this.__isErrorVisible=!0,super.reportValidity()}updated(e){var t,s;super.updated(e),e.has("item")&&(null===(s=(t=this.__getItemRenderer.cache).clear)||void 0===s||s.call(t))}_handleHostClick(e){var t;if("summary-item"!==this.layout)return;const s=e.composedPath(),i=new Set(["BUTTON"]);s.some((e=>i.has(e.tagName)))||(null===(t=this.renderRoot.querySelector("button"))||void 0===t||t.click(),super._handleHostClick(e))}__clear(){this._value="",this.dispatchEvent(new CustomEvent("clear"))}__renderSummaryItemLayout(){const e=this.renderRoot.querySelector("#value");return o(y||(y=$` <div class="leading-xs"> <div class="flex items-center gap-xs"> <div class="text-m text-body whitespace-nowrap flex-1">${0}</div> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <div class="truncate min-w-0"> ${0} </div> </button> <button aria-label="${0}" class="${0}" style="width:1em;height:1em" ?disabled="${0}" ?hidden="${0}" @click="${0}"> ${0} </button> </div> <div style="max-width:32rem"> <div class="text-xs text-secondary">${0}</div> <div class="text-xs text-error" ?hidden="${0}"> ${0} </div> </div> </div> <foxy-nucleon infer="" href="${0}" id="value" @update="${0}"> </foxy-nucleon> `),this.label,this.t("select"),h({"text-right min-w-0 transition-colors transition-opacity":!0,"rounded-s focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"cursor-pointer text-body hover-opacity-80":!this.disabled&&!this.readonly,"font-medium":!this.readonly}),this.disabled||this.readonly,(e=>{if(this.disabled||this.readonly)return;const t=e.currentTarget,s=this.renderRoot.querySelector("foxy-form-dialog");s.href="",s.show(t)}),this._value?o(m||(m=$` <foxy-i18n infer="" key="value" .options="${0}"> </foxy-i18n> `),(null==e?void 0:e.data)?this.getDisplayValueOptions(e.data):{context:(null==e?void 0:e.in("fail"))?"fail":"busy"}):this.placeholder,this.t("clear"),h({"rounded-full transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer text-tertiary hover-text-body":!this.disabled,"cursor-default text-disabled":this.disabled}),this.disabled,this.readonly||!this._value,this.__clear,l(v||(v=$`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" /></svg>`)),this.helperText,this.disabled||this.readonly||!this.__isErrorVisible,this._errorMessage,d(this._value||void 0),(()=>this.requestUpdate()))}__renderStandaloneLayout(){var e,t,s,i,r;const l=this.__valueLoader,u="string"==typeof this._value?n(this._value):void 0,c="string"==typeof this._value?null===(e=this.getItemUrl)||void 0===e?void 0:e.call(this,this._value,null!==(t=null==l?void 0:l.data)&&void 0!==t?t:null):void 0;return o(x||(x=$` <div class="block group"> <div class="${0}"> <span class="mr-auto text-l">${0}</span> ${0} ${0} ${0} </div> <div class="text-secondary text-s" ?hidden="${0}">${0}</div> <button class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" ?disabled="${0}" @click="${0}"> <div class="${0}"> <foxy-nucleon class="block" infer="" href="${0}" id="valueLoader" @update="${0}"> ${0} </foxy-nucleon> </div> </button> <div class="mt-xs text-xs leading-xs text-error" ?hidden="${0}"> ${0} </div> </div> `),h({"flex items-center gap-s transition-colors font-medium":!0,"text-disabled":this.disabled}),this.label,c?o(b||(b=$` <a class="text-body rounded transition-opacity hover-opacity-90 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="view"></foxy-i18n> </a> `),c):"",this.showCopyIdButton&&null!==u?o(_||(_=$` <foxy-copy-to-clipboard layout="text" theme="contrast tertiary-inline" infer="copy-id" text="${0}"> </foxy-copy-to-clipboard> `),u):"",this.readonly||!this._value?"":o(g||(g=$` <vaadin-button theme="error tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="clear"></foxy-i18n> </vaadin-button> `),this.disabled,this.__clear),!this.helperText,this.helperText,h({"block w-full bg-contrast-5 rounded text-left transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer hover-bg-contrast-10":!this.disabled&&!this.readonly,"cursor-default":this.disabled||this.readonly,"mt-s":!!this.label||!!this.helperText}),this.disabled||this.readonly,(e=>{const t=e.currentTarget,s=this.renderRoot.querySelector("foxy-form-dialog");s.href="",s.show(t)}),h({"transition-opacity":!0,"opacity-50":this.disabled}),d(this._value||void 0),(()=>this.requestUpdate()),this.__getItemRenderer(this.item)({html:o,data:null!==(s=null==l?void 0:l.data)&&void 0!==s?s:null,href:this._value||"",related:[],parent:"",props:{},spread:a,simplifyNsLoading:this.simplifyNsLoading,disabled:this.disabled,disabledControls:this.disabledControls,readonly:this.readonly,readonlyControls:this.readonlyControls,hidden:this.hidden,hiddenControls:this.hiddenControls,templates:this.templates,previous:null,next:null,group:null!==(r=null===(i=this.nucleon)||void 0===i?void 0:i.group)&&void 0!==r?r:"",lang:this.lang,ns:this.ns}),!this._errorMessage||this.disabled||this.readonly,this._errorMessage)}__handleFetchEvent(e){if(!(e instanceof r))return;if(e.defaultPrevented)return;const{url:t,method:s}=e.request;return t===`foxy://${this.virtualHost}/select`&&"POST"===s?e.respondWith(this.__handleSelect(e.request)):t===`foxy://${this.virtualHost}/empty`&&"GET"===s?e.respondWith(this.__handleEmpty()):void 0}async __handleSelect(e){const t=await e.clone().json();return this._value=t.selection,new Response(JSON.stringify({_links:{self:{href:`foxy://${this.virtualHost}/empty`}},message:"Resource selected."}))}async __handleEmpty(){return new Response(JSON.stringify({_links:{self:{href:`foxy://${this.virtualHost}/empty`}},message:"Resource selected."}))}get __valueLoader(){return this.renderRoot.querySelector("#valueLoader")}});
|
|
@@ -150,7 +150,7 @@ input{
|
|
|
150
150
|
if (this.layout !== 'summary-item')
|
|
151
151
|
return;
|
|
152
152
|
const composedPath = evt.composedPath();
|
|
153
|
-
const noOp = new Set(['INPUT', 'LABEL']);
|
|
153
|
+
const noOp = new Set(['INPUT', 'LABEL', 'SELECT']);
|
|
154
154
|
if (!composedPath.some(el => noOp.has(el.tagName))) {
|
|
155
155
|
(_a = this.renderRoot.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
156
156
|
super._handleHostClick(evt);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalFrequencyControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalFrequencyControl/InternalFrequencyControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,uBAAuB;IAArE;;QA6DE,qBAAgB,GAAG,KAAK,CAAC;QAEzB,YAAO,GAAG;YACR,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE;YAC5B,EAAE,KAAK,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C,KAAK,CAAC;YAC7D,IAAI,KAAK,KAAK,eAAe,EAAE;gBAC7B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;aACrB;iBAAM;gBACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;aAC5D;QACH,CAAC;;2CAE4B,CAAC,SAAS,oBAAoB,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;gBACzE,IAAI,CAAC,gBAAgB,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,KAAK,CAAC;YACzD,CAAC,CAAC,IAAI,CAAA;8DACwC,KAAK,KAAK,KAAK;wBACrD,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC;;mBAE5B;YACH,CAAC,CAAC,EAAE;gBACJ,IAAI,CAAC,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,EAAE,CACP,IAAI,CAAA;;8BAEQ,MAAM,CAAC,KAAK;kCACR,KAAK,KAAK,KAAK,IAAI,MAAM,CAAC,KAAK,MAAK,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAA;;wBAE9D,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC;;mBAEpC,CACJ;;;;;;8CAM+B,IAAI,CAAC,UAAU;kDACX,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;cAClE,IAAI,CAAC,aAAa;;;;KAI3B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { CustomFieldElement, CustomFieldI18n } from '@vaadin/vaadin-custom-field';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { css, html, svg } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\n\n/**\n * Internal control displaying a custom field for frequency input.\n *\n * @since 1.17.0\n * @element foxy-internal-frequency-control\n */\nexport class InternalFrequencyControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n allowTwiceAMonth: { type: Boolean, attribute: 'allow-twice-a-month' },\n options: { attribute: false },\n layout: {},\n max: { type: Number },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n :host {\n display: block;\n }\n\n vaadin-custom-field {\n width: 100%;\n font-size: 0;\n line-height: 0;\n padding-top: 0 !important;\n }\n\n vaadin-custom-field::part(label) {\n padding-bottom: var(--lumo-space-s);\n }\n\n vaadin-custom-field::part(error-message)[aria-hidden='false'] {\n padding-top: var(--lumo-space-xs);\n }\n\n vaadin-integer-field,\n vaadin-combo-box {\n width: calc(50% - (var(--lumo-space-s) / 2));\n }\n\n vaadin-integer-field {\n margin-right: var(--lumo-space-s);\n padding: 0;\n }\n\n vaadin-combo-box::part(text-field) {\n padding: 0;\n }\n\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n input {\n -moz-appearance: textfield;\n }\n `,\n ];\n }\n\n allowTwiceAMonth = false;\n\n options = [\n { value: 'd', label: 'day' },\n { value: 'w', label: 'week' },\n { value: 'm', label: 'month' },\n { value: 'y', label: 'year' },\n ];\n\n layout: 'summary-item' | 'standalone' | null = null;\n\n max: number | null = 999;\n\n private __i18n: CustomFieldI18n = {\n formatValue: inputValues => inputValues.join(''),\n parseValue: value => {\n const normalizedValue = value.startsWith('.') ? `0${value}` : value;\n const count = parseFloat(value.substring(0, Math.max(normalizedValue.length - 1, 0)));\n const units = normalizedValue[normalizedValue.length - 1] ?? '';\n\n return isNaN(count) ? ['0', ''] : [count.toString(), units];\n },\n };\n\n renderControl(): TemplateResult {\n if (this.layout === 'summary-item') return this.__renderSummaryItemLayout();\n\n const value = (this._value ?? '') as string;\n const count = parseFloat(this.__i18n.parseValue(value)[0] as string);\n const items = this.options.map(({ value, label }) => ({\n label: this.t(label, { count }),\n value,\n }));\n\n return html`\n <vaadin-custom-field\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .errorMessage=${this._errorMessage ?? ''}\n .helperText=${this.helperText}\n .label=${this.label}\n .value=${value}\n .i18n=${this.__i18n}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as CustomFieldElement;\n this._value = field.value as string;\n }}\n >\n <vaadin-integer-field\n max=${ifDefined(this.max || undefined)}\n min=\"1\"\n prevent-invalid-input\n has-controls\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?invalid=${!this._checkValidity()}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n >\n </vaadin-integer-field>\n\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?invalid=${!this._checkValidity()}\n .items=${items}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n >\n </vaadin-combo-box>\n </vaadin-custom-field>\n `;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n const field = this.renderRoot.querySelector('vaadin-custom-field');\n if (field && field.value !== this._value) field.value = (this._value ?? '') as string;\n }\n\n protected _handleHostClick(evt: MouseEvent): void {\n if (this.layout !== 'summary-item') return;\n const composedPath = evt.composedPath() as HTMLElement[];\n const noOp = new Set(['INPUT', 'LABEL']);\n if (!composedPath.some(el => noOp.has(el.tagName))) {\n this.renderRoot.querySelector('input')?.focus();\n super._handleHostClick(evt);\n }\n }\n\n private __renderSummaryItemLayout() {\n const value = (this._value ?? '') as string;\n const [strCount, units] = this.__i18n.parseValue(value);\n const count = parseFloat(strCount as string);\n const selection =\n this._value === '.5m' && !this.allowTwiceAMonth\n ? undefined\n : this.options.find(v => v.value === units);\n\n return html`\n <div class=\"leading-xs\">\n <div class=\"flex items-center gap-xs\">\n <label class=\"text-m text-body flex-1 whitespace-nowrap\" for=\"input\">${this.label}</label>\n\n <input\n placeholder=${this.placeholder}\n inputmode=\"numeric\"\n style=\"min-width: 10ch\"\n class=${classMap({\n 'w-full appearance-none text-right bg-transparent transition-colors': true,\n 'text-m rounded-s focus-outline-none': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n type=\"number\"\n step=\"1\"\n min=\"1\"\n max=${ifDefined(this.max ?? void 0)}\n id=\"input\"\n .value=${value === '.5m' ? (this.allowTwiceAMonth ? 2 : '') : count}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @input=${(evt: Event) => {\n evt.stopPropagation();\n const input = evt.currentTarget as HTMLInputElement;\n const resolvedUnits = units || this.options[0].value;\n this._value = this.__i18n.formatValue([input.value, resolvedUnits]);\n }}\n />\n\n <div\n class=${classMap({\n 'relative rounded-s transition-colors transition-opacity': true,\n 'focus-within-ring-2 focus-within-ring-primary-50': !this.disabled && !this.readonly,\n 'text-body hover-opacity-80 cursor-pointer': !this.disabled && !this.readonly,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n >\n <div class=\"flex items-center gap-xs\">\n <div class=\"whitespace-nowrap\">\n ${value === '.5m'\n ? this.t('times_a_month')\n : selection\n ? this.t(selection.label, { count })\n : this.t('select')}\n </div>\n ${this.readonly\n ? ''\n : svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: scale(1.25)\"><path fill-rule=\"evenodd\" d=\"M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z\" clip-rule=\"evenodd\" /></svg>`}\n </div>\n\n <select\n class=${classMap({\n 'absolute inset-0 opacity-0': true,\n 'cursor-pointer': !this.disabled && !this.readonly,\n })}\n id=\"select\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly}\n @change=${(evt: Event) => {\n evt.stopPropagation();\n const value = (evt.currentTarget as HTMLSelectElement).value;\n if (value === 'times_a_month') {\n this._value = '.5m';\n } else {\n this._value = this.__i18n.formatValue([count || 1, value]);\n }\n }}\n >\n <option value=\"\" ?selected=${!selection} disabled hidden>${this.t('select')}</option>\n ${this.allowTwiceAMonth && (count === 2 || value === '.5m')\n ? html`\n <option value=\"times_a_month\" ?selected=${value === '.5m'}>\n ${this.t('times_a_month')}\n </option>\n `\n : ''}\n ${this.options.map(\n option =>\n html`\n <option\n value=${option.value}\n ?selected=${value !== '.5m' && option.value === selection?.value}\n >\n ${this.t(option.label, { count })}\n </option>\n `\n )}\n </select>\n </div>\n </div>\n\n <div style=\"max-width: 32rem\">\n <p class=\"text-xs text-secondary\">${this.helperText}</p>\n <p class=\"text-xs text-error\" ?hidden=${this.disabled || this.readonly}>\n ${this._errorMessage}\n </p>\n </div>\n </div>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalFrequencyControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalFrequencyControl/InternalFrequencyControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,uBAAuB;IAArE;;QA6DE,qBAAgB,GAAG,KAAK,CAAC;QAEzB,Y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,GAAU,EAAE,EAAE;YACvB,GAAG,CAAC,eAAe,EAAE,CAAC;YACtB,MAAM,KAAK,GAAI,GAAG,CAAC,aAAmC,CAAC,KAAK,CAAC;YAC7D,IAAI,KAAK,KAAK,eAAe,EAAE;gBAC7B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;aACrB;iBAAM;gBACL,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;aAC5D;QACH,CAAC;;2CAE4B,CAAC,SAAS,oBAAoB,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;gBACzE,IAAI,CAAC,gBAAgB,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,KAAK,CAAC;YACzD,CAAC,CAAC,IAAI,CAAA;8DACwC,KAAK,KAAK,KAAK;wBACrD,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC;;mBAE5B;YACH,CAAC,CAAC,EAAE;gBACJ,IAAI,CAAC,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,EAAE,CACP,IAAI,CAAA;;8BAEQ,MAAM,CAAC,KAAK;kCACR,KAAK,KAAK,KAAK,IAAI,MAAM,CAAC,KAAK,MAAK,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAA;;wBAE9D,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC;;mBAEpC,CACJ;;;;;;8CAM+B,IAAI,CAAC,UAAU;kDACX,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;cAClE,IAAI,CAAC,aAAa;;;;KAI3B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { CustomFieldElement, CustomFieldI18n } from '@vaadin/vaadin-custom-field';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { css, html, svg } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\n\n/**\n * Internal control displaying a custom field for frequency input.\n *\n * @since 1.17.0\n * @element foxy-internal-frequency-control\n */\nexport class InternalFrequencyControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n allowTwiceAMonth: { type: Boolean, attribute: 'allow-twice-a-month' },\n options: { attribute: false },\n layout: {},\n max: { type: Number },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n :host {\n display: block;\n }\n\n vaadin-custom-field {\n width: 100%;\n font-size: 0;\n line-height: 0;\n padding-top: 0 !important;\n }\n\n vaadin-custom-field::part(label) {\n padding-bottom: var(--lumo-space-s);\n }\n\n vaadin-custom-field::part(error-message)[aria-hidden='false'] {\n padding-top: var(--lumo-space-xs);\n }\n\n vaadin-integer-field,\n vaadin-combo-box {\n width: calc(50% - (var(--lumo-space-s) / 2));\n }\n\n vaadin-integer-field {\n margin-right: var(--lumo-space-s);\n padding: 0;\n }\n\n vaadin-combo-box::part(text-field) {\n padding: 0;\n }\n\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n input {\n -moz-appearance: textfield;\n }\n `,\n ];\n }\n\n allowTwiceAMonth = false;\n\n options = [\n { value: 'd', label: 'day' },\n { value: 'w', label: 'week' },\n { value: 'm', label: 'month' },\n { value: 'y', label: 'year' },\n ];\n\n layout: 'summary-item' | 'standalone' | null = null;\n\n max: number | null = 999;\n\n private __i18n: CustomFieldI18n = {\n formatValue: inputValues => inputValues.join(''),\n parseValue: value => {\n const normalizedValue = value.startsWith('.') ? `0${value}` : value;\n const count = parseFloat(value.substring(0, Math.max(normalizedValue.length - 1, 0)));\n const units = normalizedValue[normalizedValue.length - 1] ?? '';\n\n return isNaN(count) ? ['0', ''] : [count.toString(), units];\n },\n };\n\n renderControl(): TemplateResult {\n if (this.layout === 'summary-item') return this.__renderSummaryItemLayout();\n\n const value = (this._value ?? '') as string;\n const count = parseFloat(this.__i18n.parseValue(value)[0] as string);\n const items = this.options.map(({ value, label }) => ({\n label: this.t(label, { count }),\n value,\n }));\n\n return html`\n <vaadin-custom-field\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .errorMessage=${this._errorMessage ?? ''}\n .helperText=${this.helperText}\n .label=${this.label}\n .value=${value}\n .i18n=${this.__i18n}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as CustomFieldElement;\n this._value = field.value as string;\n }}\n >\n <vaadin-integer-field\n max=${ifDefined(this.max || undefined)}\n min=\"1\"\n prevent-invalid-input\n has-controls\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?invalid=${!this._checkValidity()}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n >\n </vaadin-integer-field>\n\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?invalid=${!this._checkValidity()}\n .items=${items}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n >\n </vaadin-combo-box>\n </vaadin-custom-field>\n `;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n const field = this.renderRoot.querySelector('vaadin-custom-field');\n if (field && field.value !== this._value) field.value = (this._value ?? '') as string;\n }\n\n protected _handleHostClick(evt: MouseEvent): void {\n if (this.layout !== 'summary-item') return;\n const composedPath = evt.composedPath() as HTMLElement[];\n const noOp = new Set(['INPUT', 'LABEL', 'SELECT']);\n if (!composedPath.some(el => noOp.has(el.tagName))) {\n this.renderRoot.querySelector('input')?.focus();\n super._handleHostClick(evt);\n }\n }\n\n private __renderSummaryItemLayout() {\n const value = (this._value ?? '') as string;\n const [strCount, units] = this.__i18n.parseValue(value);\n const count = parseFloat(strCount as string);\n const selection =\n this._value === '.5m' && !this.allowTwiceAMonth\n ? undefined\n : this.options.find(v => v.value === units);\n\n return html`\n <div class=\"leading-xs\">\n <div class=\"flex items-center gap-xs\">\n <label class=\"text-m text-body flex-1 whitespace-nowrap\" for=\"input\">${this.label}</label>\n\n <input\n placeholder=${this.placeholder}\n inputmode=\"numeric\"\n style=\"min-width: 10ch\"\n class=${classMap({\n 'w-full appearance-none text-right bg-transparent transition-colors': true,\n 'text-m rounded-s focus-outline-none': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n type=\"number\"\n step=\"1\"\n min=\"1\"\n max=${ifDefined(this.max ?? void 0)}\n id=\"input\"\n .value=${value === '.5m' ? (this.allowTwiceAMonth ? 2 : '') : count}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @input=${(evt: Event) => {\n evt.stopPropagation();\n const input = evt.currentTarget as HTMLInputElement;\n const resolvedUnits = units || this.options[0].value;\n this._value = this.__i18n.formatValue([input.value, resolvedUnits]);\n }}\n />\n\n <div\n class=${classMap({\n 'relative rounded-s transition-colors transition-opacity': true,\n 'focus-within-ring-2 focus-within-ring-primary-50': !this.disabled && !this.readonly,\n 'text-body hover-opacity-80 cursor-pointer': !this.disabled && !this.readonly,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n >\n <div class=\"flex items-center gap-xs\">\n <div class=\"whitespace-nowrap\">\n ${value === '.5m'\n ? this.t('times_a_month')\n : selection\n ? this.t(selection.label, { count })\n : this.t('select')}\n </div>\n ${this.readonly\n ? ''\n : svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: scale(1.25)\"><path fill-rule=\"evenodd\" d=\"M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z\" clip-rule=\"evenodd\" /></svg>`}\n </div>\n\n <select\n class=${classMap({\n 'absolute inset-0 opacity-0': true,\n 'cursor-pointer': !this.disabled && !this.readonly,\n })}\n id=\"select\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly}\n @change=${(evt: Event) => {\n evt.stopPropagation();\n const value = (evt.currentTarget as HTMLSelectElement).value;\n if (value === 'times_a_month') {\n this._value = '.5m';\n } else {\n this._value = this.__i18n.formatValue([count || 1, value]);\n }\n }}\n >\n <option value=\"\" ?selected=${!selection} disabled hidden>${this.t('select')}</option>\n ${this.allowTwiceAMonth && (count === 2 || value === '.5m')\n ? html`\n <option value=\"times_a_month\" ?selected=${value === '.5m'}>\n ${this.t('times_a_month')}\n </option>\n `\n : ''}\n ${this.options.map(\n option =>\n html`\n <option\n value=${option.value}\n ?selected=${value !== '.5m' && option.value === selection?.value}\n >\n ${this.t(option.label, { count })}\n </option>\n `\n )}\n </select>\n </div>\n </div>\n\n <div style=\"max-width: 32rem\">\n <p class=\"text-xs text-secondary\">${this.helperText}</p>\n <p class=\"text-xs text-error\" ?hidden=${this.disabled || this.readonly}>\n ${this._errorMessage}\n </p>\n </div>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -108,7 +108,7 @@ export class InternalNativeDateControl extends InternalEditableControl {
|
|
|
108
108
|
_handleHostClick(evt) {
|
|
109
109
|
var _a;
|
|
110
110
|
const composedPath = evt.composedPath();
|
|
111
|
-
const noOp = new Set(['INPUT', 'LABEL']);
|
|
111
|
+
const noOp = new Set(['INPUT', 'LABEL', 'BUTTON']);
|
|
112
112
|
if (!composedPath.some(el => noOp.has(el.tagName))) {
|
|
113
113
|
(_a = this.renderRoot.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
114
114
|
super._handleHostClick(evt);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalNativeDateControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalNativeDateControl/InternalNativeDateControl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAAtE;;QAwBE,WAAM,GAA8B,MAAM,CAAC;QAEnC,qBAAgB,GAAG,KAAK,CAAC;IAoFnC,CAAC;IA7GC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE;YACV,gBAAgB,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SACvC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,KAAK,CAAC,MAAM;YACZ,GAAG;;;;;;;OAQF;SACF,CAAC;IACJ,CAAC;IAMD,cAAc;QACZ,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,KAAK,CAAC,cAAc,EAAE,CAAC;IACzB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAA;;;iFAGkE,IAAI,CAAC,KAAK;;;0BAGjE,IAAI,CAAC,WAAW;oBACtB,QAAQ,CAAC;YACf,6DAA6D,EAAE,IAAI;YACnE,qCAAqC,EAAE,IAAI;YAC3C,gBAAgB,EAAE,IAAI,CAAC,QAAQ;YAC/B,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ;SAC9B,CAAC;mBACK,IAAI,CAAC,MAAM;;q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QAA+B,CAAC;IACjD,CAAC;IAES,gBAAgB,CAAC,GAAe;;QACxC,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,EAAmB,CAAC;QACzD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalNativeDateControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalNativeDateControl/InternalNativeDateControl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAAtE;;QAwBE,WAAM,GAA8B,MAAM,CAAC;QAEnC,qBAAgB,GAAG,KAAK,CAAC;IAoFnC,CAAC;IA7GC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE;YACV,gBAAgB,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SACvC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,KAAK,CAAC,MAAM;YACZ,GAAG;;;;;;;OAQF;SACF,CAAC;IACJ,CAAC;IAMD,cAAc;QACZ,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,KAAK,CAAC,cAAc,EAAE,CAAC;IACzB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAA;;;iFAGkE,IAAI,CAAC,KAAK;;;0BAGjE,IAAI,CAAC,WAAW;oBACtB,QAAQ,CAAC;YACf,6DAA6D,EAAE,IAAI;YACnE,qCAAqC,EAAE,IAAI;YAC3C,gBAAgB,EAAE,IAAI,CAAC,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AAM;;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;IAES,gBAAgB,CAAC,GAAe;;QACxC,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,EAAmB,CAAC;QACzD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE;YAClD,MAAA,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,0CAAE,KAAK,GAAG;YAChD,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;SAC7B;IACH,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { html, css, svg } from 'lit-element';\nimport { classMap } from '../../../utils/class-map';\nimport { live } from 'lit-html/directives/live';\n\n/**\n * Internal control displaying a basic text box with date input.\n *\n * @since 1.51.0\n * @element foxy-internal-native-date-control\n */\nexport class InternalNativeDateControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n format: {},\n __isErrorVisible: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n input::-webkit-contacts-auto-fill-button {\n visibility: hidden;\n display: none !important;\n pointer-events: none;\n position: absolute;\n right: 0;\n }\n `,\n ];\n }\n\n format: 'date' | 'datetime-local' = 'date';\n\n private __isErrorVisible = false;\n\n reportValidity(): void {\n this.__isErrorVisible = true;\n super.reportValidity();\n }\n\n renderControl(): TemplateResult {\n return html`\n <div class=\"leading-xs\">\n <div class=\"flex items-center gap-xs\">\n <label class=\"text-m text-body flex-1 whitespace-nowrap\" for=\"input\">${this.label}</label>\n\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'appearance-none text-right bg-transparent transition-colors': true,\n 'text-m rounded-s focus-outline-none': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n type=${this.format}\n id=\"input\"\n .value=${live(this._value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @blur=${() => (this.__isErrorVisible = true)}\n @input=${(evt: Event) => {\n evt.stopPropagation();\n this._value = (evt.target as HTMLInputElement).value;\n }}\n />\n\n <button\n aria-label=${this.t('clear')}\n class=${classMap({\n 'flex-shrink-0 rounded-full transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer text-tertiary hover-text-body': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n })}\n style=\"width: 1em; height: 1em;\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly || !this._value}\n @click=${() => {\n this._value = '';\n this.dispatchEvent(new CustomEvent('clear'));\n }}\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em\"><path d=\"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z\" /></svg>`}\n </button>\n </div>\n\n <div style=\"max-width: 32rem\">\n <p class=\"text-xs text-secondary\">${this.helperText}</p>\n <p\n class=\"text-xs text-error\"\n ?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </p>\n </div>\n </div>\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 protected _handleHostClick(evt: MouseEvent): void {\n const composedPath = evt.composedPath() as HTMLElement[];\n const noOp = new Set(['INPUT', 'LABEL', 'BUTTON']);\n if (!composedPath.some(el => noOp.has(el.tagName))) {\n this.renderRoot.querySelector('input')?.focus();\n super._handleHostClick(evt);\n }\n }\n}\n"]}
|
|
@@ -147,7 +147,7 @@ export class InternalSelectControl extends InternalEditableControl {
|
|
|
147
147
|
if (this.layout !== 'summary-item')
|
|
148
148
|
return;
|
|
149
149
|
const composedPath = evt.composedPath();
|
|
150
|
-
const noOp = new Set(['SELECT', 'LABEL']);
|
|
150
|
+
const noOp = new Set(['SELECT', 'LABEL', 'BUTTON']);
|
|
151
151
|
if (!composedPath.some(el => noOp.has(el.tagName))) {
|
|
152
152
|
(_a = this.renderRoot.querySelector('select')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
153
153
|
super._handleHostClick(evt);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSelectControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSelectControl/InternalSelectControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,uBAAuB;IAAlE;;QAWE,uCAAuC;QACvC,YAAO,GAAa,EAAE,CAAC;QAEvB,kGAAkG;QAClG,WAAM,GAAyC,IAAI,CAAC;QAEpD,oEAAoE;QACpE,UAAK,GAAkB,IAAI,CAAC;QAEpB,qBAAgB,GAAG,KAAK,CAAC;IAmInC,CAA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,CAAC,EAAE;YAClD,MAAA,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,0CAAE,KAAK,GAAG;YACjD,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;SAC7B;IACH,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { ComboBoxElement } from '@vaadin/vaadin-combo-box';\nimport type { Option } from './types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\n/**\n * Internal control wrapper for select elements.\n *\n * @since 1.21.0\n * @element foxy-internal-select-control\n */\nexport class InternalSelectControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n options: { type: Array },\n layout: {},\n theme: { type: String },\n __isErrorVisible: { attribute: false },\n };\n }\n\n /** List of radio buttons to render. */\n options: Option[] = [];\n\n /** Standalone renders Vaadin Combo Box. Summary item renders a special UI for summary control. */\n layout: 'summary-item' | 'standalone' | null = null;\n\n /** Same as the \"theme\" attribute/property of `vaadin-combo-box`. */\n theme: string | null = null;\n\n private __isErrorVisible = false;\n\n renderControl(): TemplateResult {\n if (this.layout === 'summary-item') return this.__renderSummaryItemLayout();\n\n return html`\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n error-message=${ifDefined(this._errorMessage)}\n item-id-path=\"value\"\n helper-text=${this.helperText}\n placeholder=${this.placeholder}\n label=${this.label}\n class=\"w-full\"\n theme=${ifDefined(this.theme ?? undefined)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n clear-button-visible\n .checkValidity=${this._checkValidity}\n .items=${this.options.map(option => ({\n label: 'label' in option ? this.t(option.label) : option.rawLabel,\n value: option.value,\n }))}\n .value=${this._value}\n @change=${(evt: CustomEvent) => {\n evt.stopPropagation();\n const comboBox = evt.currentTarget as ComboBoxElement;\n this._value = comboBox.value;\n comboBox.validate();\n }}\n >\n </vaadin-combo-box>\n `;\n }\n\n reportValidity(): void {\n this.__isErrorVisible = true;\n super.reportValidity();\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n const comboBox = this.renderRoot.querySelector('vaadin-combo-box');\n if (comboBox && comboBox.value !== this._value) comboBox.value = this._value as string;\n }\n\n private __renderSummaryItemLayout() {\n const selection = this.options.find(v => v.value === this._value);\n\n return html`\n <div class=\"leading-xs\">\n <div class=\"flex items-center gap-s\">\n <label class=\"text-m text-body flex-1 whitespace-nowrap\" for=\"select\">\n ${this.label}\n </label>\n <div\n class=${classMap({\n 'relative rounded-s transition-colors transition-opacity min-w-0': true,\n 'focus-within-ring-2 focus-within-ring-primary-50': !this.disabled && !this.readonly,\n 'text-body hover-opacity-80 cursor-pointer': !this.disabled && !this.readonly,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n >\n <div class=\"flex items-center gap-xs min-w-0\">\n <div class=\"truncate min-w-0\">\n ${selection\n ? 'label' in selection\n ? this.t(selection.label)\n : selection.rawLabel\n : this.placeholder}\n </div>\n ${this.readonly\n ? ''\n : svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"flex-shrink-0\" style=\"width: 1em; height: 1em; transform: scale(1.25)\"><path fill-rule=\"evenodd\" d=\"M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z\" clip-rule=\"evenodd\" /></svg>`}\n </div>\n\n <select\n class=${classMap({\n 'absolute inset-0 opacity-0': true,\n 'cursor-pointer': !this.disabled && !this.readonly,\n })}\n id=\"select\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly}\n @blur=${() => (this.__isErrorVisible = true)}\n @change=${(evt: Event) => {\n evt.stopPropagation();\n this._value = (evt.target as HTMLSelectElement).value;\n }}\n >\n <option value=\"\" ?selected=${!selection} disabled hidden>${this.placeholder}</option>\n ${this.options.map(\n option =>\n html`\n <option\n value=${option.value}\n ?selected=${selection && option.value === this._value}\n >\n ${'label' in option ? this.t(option.label) : option.rawLabel}\n </option>\n `\n )}\n </select>\n </div>\n </div>\n\n <div style=\"max-width: 32rem\">\n <p class=\"text-xs text-secondary\">${this.helperText}</p>\n <p\n class=\"text-xs text-error\"\n ?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </p>\n </div>\n </div>\n `;\n }\n\n protected _handleHostClick(evt: MouseEvent): void {\n if (this.layout !== 'summary-item') return;\n const composedPath = evt.composedPath() as HTMLElement[];\n const noOp = new Set(['SELECT', 'LABEL']);\n if (!composedPath.some(el => noOp.has(el.tagName))) {\n this.renderRoot.querySelector('select')?.focus();\n super._handleHostClick(evt);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalSelectControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSelectControl/InternalSelectControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,uBAAuB;IAAlE;;QAWE,uCAAuC;QACvC,YAAO,GAAa,EAAE,CAAC;QAEvB,kGAAkG;QAClG,WAAM,GAAyC,IAAI,CAAC;QAEpD,oEAAoE;QACpE,UAAK,GAAkB,IAAI,CAAC;QAEpB,qBAAgB,GAAG,KAAK,CAA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C,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE;YAClD,MAAA,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,0CAAE,KAAK,GAAG;YACjD,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;SAC7B;IACH,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { ComboBoxElement } from '@vaadin/vaadin-combo-box';\nimport type { Option } from './types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\n/**\n * Internal control wrapper for select elements.\n *\n * @since 1.21.0\n * @element foxy-internal-select-control\n */\nexport class InternalSelectControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n options: { type: Array },\n layout: {},\n theme: { type: String },\n __isErrorVisible: { attribute: false },\n };\n }\n\n /** List of radio buttons to render. */\n options: Option[] = [];\n\n /** Standalone renders Vaadin Combo Box. Summary item renders a special UI for summary control. */\n layout: 'summary-item' | 'standalone' | null = null;\n\n /** Same as the \"theme\" attribute/property of `vaadin-combo-box`. */\n theme: string | null = null;\n\n private __isErrorVisible = false;\n\n renderControl(): TemplateResult {\n if (this.layout === 'summary-item') return this.__renderSummaryItemLayout();\n\n return html`\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n error-message=${ifDefined(this._errorMessage)}\n item-id-path=\"value\"\n helper-text=${this.helperText}\n placeholder=${this.placeholder}\n label=${this.label}\n class=\"w-full\"\n theme=${ifDefined(this.theme ?? undefined)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n clear-button-visible\n .checkValidity=${this._checkValidity}\n .items=${this.options.map(option => ({\n label: 'label' in option ? this.t(option.label) : option.rawLabel,\n value: option.value,\n }))}\n .value=${this._value}\n @change=${(evt: CustomEvent) => {\n evt.stopPropagation();\n const comboBox = evt.currentTarget as ComboBoxElement;\n this._value = comboBox.value;\n comboBox.validate();\n }}\n >\n </vaadin-combo-box>\n `;\n }\n\n reportValidity(): void {\n this.__isErrorVisible = true;\n super.reportValidity();\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n const comboBox = this.renderRoot.querySelector('vaadin-combo-box');\n if (comboBox && comboBox.value !== this._value) comboBox.value = this._value as string;\n }\n\n private __renderSummaryItemLayout() {\n const selection = this.options.find(v => v.value === this._value);\n\n return html`\n <div class=\"leading-xs\">\n <div class=\"flex items-center gap-s\">\n <label class=\"text-m text-body flex-1 whitespace-nowrap\" for=\"select\">\n ${this.label}\n </label>\n <div\n class=${classMap({\n 'relative rounded-s transition-colors transition-opacity min-w-0': true,\n 'focus-within-ring-2 focus-within-ring-primary-50': !this.disabled && !this.readonly,\n 'text-body hover-opacity-80 cursor-pointer': !this.disabled && !this.readonly,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n >\n <div class=\"flex items-center gap-xs min-w-0\">\n <div class=\"truncate min-w-0\">\n ${selection\n ? 'label' in selection\n ? this.t(selection.label)\n : selection.rawLabel\n : this.placeholder}\n </div>\n ${this.readonly\n ? ''\n : svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"flex-shrink-0\" style=\"width: 1em; height: 1em; transform: scale(1.25)\"><path fill-rule=\"evenodd\" d=\"M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z\" clip-rule=\"evenodd\" /></svg>`}\n </div>\n\n <select\n class=${classMap({\n 'absolute inset-0 opacity-0': true,\n 'cursor-pointer': !this.disabled && !this.readonly,\n })}\n id=\"select\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly}\n @blur=${() => (this.__isErrorVisible = true)}\n @change=${(evt: Event) => {\n evt.stopPropagation();\n this._value = (evt.target as HTMLSelectElement).value;\n }}\n >\n <option value=\"\" ?selected=${!selection} disabled hidden>${this.placeholder}</option>\n ${this.options.map(\n option =>\n html`\n <option\n value=${option.value}\n ?selected=${selection && option.value === this._value}\n >\n ${'label' in option ? this.t(option.label) : option.rawLabel}\n </option>\n `\n )}\n </select>\n </div>\n </div>\n\n <div style=\"max-width: 32rem\">\n <p class=\"text-xs text-secondary\">${this.helperText}</p>\n <p\n class=\"text-xs text-error\"\n ?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </p>\n </div>\n </div>\n `;\n }\n\n protected _handleHostClick(evt: MouseEvent): void {\n if (this.layout !== 'summary-item') return;\n const composedPath = evt.composedPath() as HTMLElement[];\n const noOp = new Set(['SELECT', 'LABEL', 'BUTTON']);\n if (!composedPath.some(el => noOp.has(el.tagName))) {\n this.renderRoot.querySelector('select')?.focus();\n super._handleHostClick(evt);\n }\n }\n}\n"]}
|
|
@@ -83,7 +83,7 @@ export class InternalTextControl extends InternalEditableControl {
|
|
|
83
83
|
if (this.layout !== 'summary-item')
|
|
84
84
|
return;
|
|
85
85
|
const composedPath = evt.composedPath();
|
|
86
|
-
const noOp = new Set(['INPUT', 'LABEL']);
|
|
86
|
+
const noOp = new Set(['INPUT', 'LABEL', 'BUTTON']);
|
|
87
87
|
if (!composedPath.some(el => noOp.has(el.tagName))) {
|
|
88
88
|
(_a = this.renderRoot.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
89
89
|
super._handleHostClick(evt);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalTextControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalTextControl/InternalTextControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uB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c,EAAE,CAAC;gBACrB,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,GAAG;aACxB;QACH,CAAC;mBACQ,CAAC,GAAU,EAAE,EAAE;YACtB,MAAM,KAAK,GAAG,GAAG,CAAC,aAAiC,CAAC;YACpD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;QAC5B,CAAC;;;KAGN,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { TextFieldElement } from '@vaadin/vaadin-text-field';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { html, css, svg } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { live } from 'lit-html/directives/live';\n\n/**\n * Internal control displaying a basic text box.\n *\n * @since 1.17.0\n * @element foxy-internal-text-control\n */\nexport class InternalTextControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n layout: {},\n prefix: {},\n suffix: {},\n __isErrorVisible: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n input::-webkit-contacts-auto-fill-button {\n visibility: hidden;\n display: none !important;\n pointer-events: none;\n position: absolute;\n right: 0;\n }\n `,\n ];\n }\n\n layout: 'summary-item' | 'standalone' | 'pill' | null = null;\n\n prefix: string | null = null;\n\n suffix: string | null = null;\n\n private __isErrorVisible = false;\n\n reportValidity(): void {\n this.__isErrorVisible = true;\n super.reportValidity();\n }\n\n renderControl(): TemplateResult {\n if (this.layout === 'summary-item') return this.__renderSummaryItemLayout();\n if (this.layout === 'pill') return this.__renderPillLayout();\n\n return html`\n <vaadin-text-field\n error-message=${ifDefined(this._errorMessage)}\n helper-text=${this.helperText}\n placeholder=${this.placeholder}\n label=${this.label}\n class=\"w-full\"\n ?clear-button-visible=${!this.suffix}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${this._value}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @input=${(evt: CustomEvent) => {\n const field = evt.currentTarget as TextFieldElement;\n this._value = field.value;\n }}\n >\n ${this.prefix ? html`<div slot=\"prefix\">${this.prefix}</div>` : ''}\n ${this.suffix ? html`<div class=\"pr-s font-medium\" slot=\"suffix\">${this.suffix}</div>` : ''}\n </vaadin-text-field>\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 protected _handleHostClick(evt: MouseEvent): void {\n if (this.layout !== 'summary-item') return;\n const composedPath = evt.composedPath() as HTMLElement[];\n const noOp = new Set(['INPUT', 'LABEL']);\n if (!composedPath.some(el => noOp.has(el.tagName))) {\n this.renderRoot.querySelector('input')?.focus();\n super._handleHostClick(evt);\n }\n }\n\n private __renderSummaryItemLayout() {\n return html`\n <div class=\"leading-xs\">\n <div class=\"flex items-center gap-xs\">\n <label class=\"text-m text-body flex-1 whitespace-nowrap\" for=\"input\">${this.label}</label>\n\n ${this.prefix ? html`<div>${this.prefix}</div>` : ''}\n\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'w-full appearance-none text-right bg-transparent transition-colors': true,\n 'text-m rounded-s focus-outline-none': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n type=\"text\"\n id=\"input\"\n .value=${live(this._value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @blur=${() => (this.__isErrorVisible = true)}\n @input=${(evt: Event) => {\n evt.stopPropagation();\n this._value = (evt.target as HTMLInputElement).value;\n }}\n />\n\n ${this.suffix ? html`<div class=\"font-medium text-secondary\">${this.suffix}</div>` : ''}\n\n <button\n aria-label=${this.t('clear')}\n class=${classMap({\n 'flex-shrink-0 rounded-full transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer text-tertiary hover-text-body': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n })}\n style=\"width: 1em; height: 1em;\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly || !this._value}\n @click=${() => {\n this._value = '';\n this.dispatchEvent(new CustomEvent('clear'));\n }}\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em\"><path d=\"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z\" /></svg>`}\n </button>\n </div>\n\n <div style=\"max-width: 32rem\">\n <p class=\"text-xs text-secondary\">${this.helperText}</p>\n <p\n class=\"text-xs text-error\"\n ?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </p>\n </div>\n </div>\n `;\n }\n\n private __renderPillLayout() {\n const content = this._value || this.placeholder;\n const contentClass =\n 'relative block whitespace-pre text-center text-xl font-medium px-s py-xs -my-xs opacity-0';\n\n return html`\n <div class=\"text-center flex items-center gap-s relative\" style=\"min-width: 6rem\">\n <span class=${contentClass}>${content}</span>\n <input\n placeholder=${this.placeholder}\n aria-label=${this.label}\n class=${classMap({\n 'text-center appearance-none transition-all text-xl font-medium rounded': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'px-s py-xs -my-xs absolute inset-0': true,\n 'hover-bg-contrast-10': !this.disabled && !this.readonly,\n 'bg-transparent': this.readonly,\n 'bg-contrast-5': !this.readonly,\n 'text-disabled': this.disabled && !this.readonly,\n })}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .value=${this._value ?? ''}\n @keydown=${(evt: KeyboardEvent) => {\n if (evt.key === 'Enter') {\n evt.preventDefault();\n this.nucleon?.submit();\n }\n }}\n @input=${(evt: Event) => {\n const input = evt.currentTarget as HTMLInputElement;\n this._value = input.value;\n }}\n />\n </div>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalTextControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalTextControl/InternalTextControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,uBAAuB;IAAhE;;QA0BE,WAAM,GAAkD,IAAI,CAAC;QAE7D,WAAM,GAAkB,IAAI,CAAC;QAE7B,WAAM,GAAkB,IAAI,CAAC;QAErB,qBAAgB,GAAG,KAAK,CAAC;IA2JnC,CAAC;IA1LC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,gBAAgB,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SACvC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,KAAK,CAAC,MAAM;YACZ,GAAG;;;;;;;OAQF;SACF,CAAC;IACJ,CAAC;IAUD,cAAc;QACZ,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,KAAK,CAAC,cAAc,EAAE,CAAC;IACzB,CAAC;IAED,aAAa;QACX,IAAI,IAAI,CAAC,MAAM,KAAK,cAAc;YAAE,OAAO,IAAI,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,CAAC,IAAI,CAAC,QAAQ;YAC/B,eAAe,EAAE,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ;SACjD,CAAC;sBACU,IAAI,CAAC,QAAQ;sBACb,IAAI,CAAC,QAAQ;mBAChB,MAAA,IAAI,CAAC,MAAM,mCAAI,EAAE;qBACf,CAAC,GAAkB,EAAE,EAAE;;YAChC,IAAI,GAAG,CAAC,GAAG,KAAK,OAAO,EAAE;gBACvB,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,GAAG;aACxB;QACH,CAAC;mBACQ,CAAC,GAAU,EAAE,EAAE;YACtB,MAAM,KAAK,GAAG,GAAG,CAAC,aAAiC,CAAC;YACpD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;QAC5B,CAAC;;;KAGN,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { TextFieldElement } from '@vaadin/vaadin-text-field';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { html, css, svg } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { live } from 'lit-html/directives/live';\n\n/**\n * Internal control displaying a basic text box.\n *\n * @since 1.17.0\n * @element foxy-internal-text-control\n */\nexport class InternalTextControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n layout: {},\n prefix: {},\n suffix: {},\n __isErrorVisible: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n input::-webkit-contacts-auto-fill-button {\n visibility: hidden;\n display: none !important;\n pointer-events: none;\n position: absolute;\n right: 0;\n }\n `,\n ];\n }\n\n layout: 'summary-item' | 'standalone' | 'pill' | null = null;\n\n prefix: string | null = null;\n\n suffix: string | null = null;\n\n private __isErrorVisible = false;\n\n reportValidity(): void {\n this.__isErrorVisible = true;\n super.reportValidity();\n }\n\n renderControl(): TemplateResult {\n if (this.layout === 'summary-item') return this.__renderSummaryItemLayout();\n if (this.layout === 'pill') return this.__renderPillLayout();\n\n return html`\n <vaadin-text-field\n error-message=${ifDefined(this._errorMessage)}\n helper-text=${this.helperText}\n placeholder=${this.placeholder}\n label=${this.label}\n class=\"w-full\"\n ?clear-button-visible=${!this.suffix}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${this._value}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @input=${(evt: CustomEvent) => {\n const field = evt.currentTarget as TextFieldElement;\n this._value = field.value;\n }}\n >\n ${this.prefix ? html`<div slot=\"prefix\">${this.prefix}</div>` : ''}\n ${this.suffix ? html`<div class=\"pr-s font-medium\" slot=\"suffix\">${this.suffix}</div>` : ''}\n </vaadin-text-field>\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 protected _handleHostClick(evt: MouseEvent): void {\n if (this.layout !== 'summary-item') return;\n const composedPath = evt.composedPath() as HTMLElement[];\n const noOp = new Set(['INPUT', 'LABEL', 'BUTTON']);\n if (!composedPath.some(el => noOp.has(el.tagName))) {\n this.renderRoot.querySelector('input')?.focus();\n super._handleHostClick(evt);\n }\n }\n\n private __renderSummaryItemLayout() {\n return html`\n <div class=\"leading-xs\">\n <div class=\"flex items-center gap-xs\">\n <label class=\"text-m text-body flex-1 whitespace-nowrap\" for=\"input\">${this.label}</label>\n\n ${this.prefix ? html`<div>${this.prefix}</div>` : ''}\n\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'w-full appearance-none text-right bg-transparent transition-colors': true,\n 'text-m rounded-s focus-outline-none': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'font-medium': !this.readonly,\n })}\n type=\"text\"\n id=\"input\"\n .value=${live(this._value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @blur=${() => (this.__isErrorVisible = true)}\n @input=${(evt: Event) => {\n evt.stopPropagation();\n this._value = (evt.target as HTMLInputElement).value;\n }}\n />\n\n ${this.suffix ? html`<div class=\"font-medium text-secondary\">${this.suffix}</div>` : ''}\n\n <button\n aria-label=${this.t('clear')}\n class=${classMap({\n 'flex-shrink-0 rounded-full transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer text-tertiary hover-text-body': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n })}\n style=\"width: 1em; height: 1em;\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly || !this._value}\n @click=${() => {\n this._value = '';\n this.dispatchEvent(new CustomEvent('clear'));\n }}\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em\"><path d=\"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z\" /></svg>`}\n </button>\n </div>\n\n <div style=\"max-width: 32rem\">\n <p class=\"text-xs text-secondary\">${this.helperText}</p>\n <p\n class=\"text-xs text-error\"\n ?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </p>\n </div>\n </div>\n `;\n }\n\n private __renderPillLayout() {\n const content = this._value || this.placeholder;\n const contentClass =\n 'relative block whitespace-pre text-center text-xl font-medium px-s py-xs -my-xs opacity-0';\n\n return html`\n <div class=\"text-center flex items-center gap-s relative\" style=\"min-width: 6rem\">\n <span class=${contentClass}>${content}</span>\n <input\n placeholder=${this.placeholder}\n aria-label=${this.label}\n class=${classMap({\n 'text-center appearance-none transition-all text-xl font-medium rounded': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'px-s py-xs -my-xs absolute inset-0': true,\n 'hover-bg-contrast-10': !this.disabled && !this.readonly,\n 'bg-transparent': this.readonly,\n 'bg-contrast-5': !this.readonly,\n 'text-disabled': this.disabled && !this.readonly,\n })}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .value=${this._value ?? ''}\n @keydown=${(evt: KeyboardEvent) => {\n if (evt.key === 'Enter') {\n evt.preventDefault();\n this.nucleon?.submit();\n }\n }}\n @input=${(evt: Event) => {\n const input = evt.currentTarget as HTMLInputElement;\n this._value = input.value;\n }}\n />\n </div>\n `;\n }\n}\n"]}
|
|
@@ -11,38 +11,38 @@ export function getPreviousQuarter(now = new Date()) {
|
|
|
11
11
|
const previousQuarter = currentQuarter === 0 ? quarters.length - 1 : currentQuarter - 1;
|
|
12
12
|
const previousQuarterYear = now.getFullYear() - (currentQuarter === 0 ? 1 : 0);
|
|
13
13
|
const previousQuarterStart = quarters[previousQuarter][0];
|
|
14
|
-
const start = safeDate(previousQuarterYear, previousQuarterStart);
|
|
14
|
+
const start = safeDate(previousQuarterYear, previousQuarterStart, 1);
|
|
15
15
|
const previousQuarterEnd = quarters[previousQuarter][2];
|
|
16
|
-
const end = new Date(
|
|
16
|
+
const end = new Date(safeDate(previousQuarterYear, previousQuarterEnd + 1, 1).getTime() - 1);
|
|
17
17
|
return { start, end };
|
|
18
18
|
}
|
|
19
19
|
export function getCurrentQuarter(now = new Date()) {
|
|
20
20
|
const currentMonth = now.getMonth();
|
|
21
21
|
const currentQuarter = quarters.findIndex(months => months.includes(currentMonth));
|
|
22
22
|
const currentQuarterStart = quarters[currentQuarter][0];
|
|
23
|
-
const start = safeDate(now.getFullYear(), currentQuarterStart);
|
|
23
|
+
const start = safeDate(now.getFullYear(), currentQuarterStart, 1);
|
|
24
24
|
const currentQuarterEnd = quarters[currentQuarter][2];
|
|
25
|
-
const end = new Date(safeDate(now.getFullYear(), currentQuarterEnd + 1).getTime() - 1);
|
|
25
|
+
const end = new Date(safeDate(now.getFullYear(), currentQuarterEnd + 1, 1).getTime() - 1);
|
|
26
26
|
return { start, end };
|
|
27
27
|
}
|
|
28
28
|
export function getPreviousMonth(now = new Date()) {
|
|
29
|
-
const start = safeDate(now.getFullYear(), now.getMonth() - 1);
|
|
30
|
-
const end = new Date(safeDate(now.getFullYear(), now.getMonth()).getTime() - 1);
|
|
29
|
+
const start = safeDate(now.getFullYear(), now.getMonth() - 1, 1);
|
|
30
|
+
const end = new Date(safeDate(now.getFullYear(), now.getMonth(), 1).getTime() - 1);
|
|
31
31
|
return { start, end };
|
|
32
32
|
}
|
|
33
33
|
export function getCurrentMonth(now = new Date()) {
|
|
34
|
-
const start = safeDate(now.getFullYear(), now.getMonth());
|
|
35
|
-
const end = new Date(safeDate(now.getFullYear(), now.getMonth() + 1).getTime() - 1);
|
|
34
|
+
const start = safeDate(now.getFullYear(), now.getMonth(), 1);
|
|
35
|
+
const end = new Date(safeDate(now.getFullYear(), now.getMonth() + 1, 1).getTime() - 1);
|
|
36
36
|
return { start, end };
|
|
37
37
|
}
|
|
38
38
|
export function getPreviousYear(now = new Date()) {
|
|
39
|
-
const start = safeDate(now.getFullYear() - 1, 0);
|
|
40
|
-
const end = new Date(safeDate(now.getFullYear(), 0).getTime() - 1);
|
|
39
|
+
const start = safeDate(now.getFullYear() - 1, 0, 1);
|
|
40
|
+
const end = new Date(safeDate(now.getFullYear(), 0, 1).getTime() - 1);
|
|
41
41
|
return { start, end };
|
|
42
42
|
}
|
|
43
43
|
export function getCurrentYear(now = new Date()) {
|
|
44
|
-
const start = safeDate(now.getFullYear(), 0);
|
|
45
|
-
const end = new Date(safeDate(now.getFullYear() + 1, 0).getTime() - 1);
|
|
44
|
+
const start = safeDate(now.getFullYear(), 0, 1);
|
|
45
|
+
const end = new Date(safeDate(now.getFullYear() + 1, 0, 1).getTime() - 1);
|
|
46
46
|
return { start, end };
|
|
47
47
|
}
|
|
48
48
|
export function getLast365Days(now = new Date()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/elements/public/ReportForm/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAMpD,MAAM,QAAQ,GAAS;IACrB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;CACZ,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,GAAG,GAAG,IAAI,IAAI,EAAE;IACjD,MAAM,YAAY,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IACpC,MAAM,cAAc,GAAG,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IACnF,MAAM,eAAe,GAAG,cAAc,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC;IACxF,MAAM,mBAAmB,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/E,MAAM,oBAAoB,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,QAAQ,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/elements/public/ReportForm/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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I,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACzD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEzD,OAAO,GAAG,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAgB;;IACpD,mBAAO,sCAAsC,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAG,CAAC,oCAAK,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,QAAgB;;IAC1D,mBAAO,gCAAgC,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAG,CAAC,oCAAK,EAAE,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAgB;;IAChD,mBAAO,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAG,CAAC,oCAAK,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import { safeDate } from '../../../utils/safe-date';\n\ntype Quarter = [number, number, number];\ntype Year = [Quarter, Quarter, Quarter, Quarter];\ntype Range = { start: Date; end: Date };\n\nconst quarters: Year = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [9, 10, 11],\n];\n\nexport function getPreviousQuarter(now = new Date()): Range {\n const currentMonth = now.getMonth();\n const currentQuarter = quarters.findIndex(months => months.includes(currentMonth));\n const previousQuarter = currentQuarter === 0 ? quarters.length - 1 : currentQuarter - 1;\n const previousQuarterYear = now.getFullYear() - (currentQuarter === 0 ? 1 : 0);\n\n const previousQuarterStart = quarters[previousQuarter][0];\n const start = safeDate(previousQuarterYear, previousQuarterStart, 1);\n\n const previousQuarterEnd = quarters[previousQuarter][2];\n const end = new Date(safeDate(previousQuarterYear, previousQuarterEnd + 1, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getCurrentQuarter(now = new Date()): Range {\n const currentMonth = now.getMonth();\n const currentQuarter = quarters.findIndex(months => months.includes(currentMonth));\n\n const currentQuarterStart = quarters[currentQuarter][0];\n const start = safeDate(now.getFullYear(), currentQuarterStart, 1);\n\n const currentQuarterEnd = quarters[currentQuarter][2];\n const end = new Date(safeDate(now.getFullYear(), currentQuarterEnd + 1, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getPreviousMonth(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), now.getMonth() - 1, 1);\n const end = new Date(safeDate(now.getFullYear(), now.getMonth(), 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getCurrentMonth(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), now.getMonth(), 1);\n const end = new Date(safeDate(now.getFullYear(), now.getMonth() + 1, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getPreviousYear(now = new Date()): Range {\n const start = safeDate(now.getFullYear() - 1, 0, 1);\n const end = new Date(safeDate(now.getFullYear(), 0, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getCurrentYear(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), 0, 1);\n const end = new Date(safeDate(now.getFullYear() + 1, 0, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getLast365Days(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), now.getMonth(), now.getDate() - 365);\n const end = new Date(\n safeDate(now.getFullYear(), now.getMonth(), now.getDate() + 1).getTime() - 1\n );\n\n return { start, end };\n}\n\nexport function getLast30Days(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), now.getMonth(), now.getDate() - 30);\n const end = new Date(\n safeDate(now.getFullYear(), now.getMonth(), now.getDate() + 1).getTime() - 1\n );\n\n return { start, end };\n}\n\nexport function toAPIDateTime(date: Date): string {\n const YYYY = date.getFullYear().toString().padStart(4, '0');\n const MM = (date.getMonth() + 1).toString().padStart(2, '0');\n const DD = date.getDate().toString().padStart(2, '0');\n const hh = date.getHours().toString().padStart(2, '0');\n const mm = date.getMinutes().toString().padStart(2, '0');\n const ss = date.getSeconds().toString().padStart(2, '0');\n\n return `${YYYY}-${MM}-${DD}T${hh}:${mm}:${ss}`;\n}\n\nexport function toDateTimePickerValue(apiValue: string): string {\n return /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}/.exec(apiValue)?.[0] ?? '';\n}\n\nexport function toNativeDateTimePickerValue(apiValue: string): string {\n return /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}/.exec(apiValue)?.[0] ?? '';\n}\n\nexport function toDatePickerValue(apiValue: string): string {\n return /^\\d{4}-\\d{2}-\\d{2}/.exec(apiValue)?.[0] ?? '';\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./shared-8df8e77c.js";import"./shared-a0baefff.js";import"./shared-a0309d5f.js";import"./shared-a20ef119.js";import{I as e}from"./shared-2bb1f0f4.js";import{_ as t}from"./shared-8f9014ff.js";import{c as i,h as a,s}from"./shared-ba5c42c7.js";import{i as l}from"./shared-53e42a77.js";import{c as o}from"./shared-4e709717.js";let n,r,d,h,u,c,p=e=>e;customElements.define("foxy-internal-frequency-control",class extends e{constructor(){super(...arguments),this.allowTwiceAMonth=!1,this.options=[{value:"d",label:"day"},{value:"w",label:"week"},{value:"m",label:"month"},{value:"y",label:"year"}],this.layout=null,this.max=999,this.__i18n={formatValue:e=>e.join(""),parseValue:e=>{var t;const i=e.startsWith(".")?`0${e}`:e,a=parseFloat(e.substring(0,Math.max(i.length-1,0))),s=null!==(t=i[i.length-1])&&void 0!==t?t:"";return isNaN(a)?["0",""]:[a.toString(),s]}}}static get properties(){return t(t({},super.properties),{},{allowTwiceAMonth:{type:Boolean,attribute:"allow-twice-a-month"},options:{attribute:!1},layout:{},max:{type:Number}})}static get styles(){return[super.styles,i(n||(n=p`: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}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input{-moz-appearance:textfield}`))]}renderControl(){var e,t;if("summary-item"===this.layout)return this.__renderSummaryItemLayout();const i=null!==(e=this._value)&&void 0!==e?e:"",s=parseFloat(this.__i18n.parseValue(i)[0]),o=this.options.map((({value:e,label:t})=>({label:this.t(t,{count:s}),value:e})));return a(r||(r=p` <vaadin-custom-field ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .errorMessage="${0}" .helperText="${0}" .label="${0}" .value="${0}" .i18n="${0}" @change="${0}"> <vaadin-integer-field max="${0}" min="1" prevent-invalid-input has-controls ?disabled="${0}" ?readonly="${0}" ?invalid="${0}" @keydown="${0}"> </vaadin-integer-field> <vaadin-combo-box item-value-path="value" item-label-path="label" ?disabled="${0}" ?readonly="${0}" ?invalid="${0}" .items="${0}" @keydown="${0}"> </vaadin-combo-box> </vaadin-custom-field> `),this.disabled,this.readonly,this._checkValidity,null!==(t=this._errorMessage)&&void 0!==t?t:"",this.helperText,this.label,i,this.__i18n,(e=>{const t=e.currentTarget;this._value=t.value}),l(this.max||void 0),this.disabled,this.readonly,!this._checkValidity(),(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),this.disabled,this.readonly,!this._checkValidity(),o,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}))}updated(e){var t;super.updated(e);const i=this.renderRoot.querySelector("vaadin-custom-field");i&&i.value!==this._value&&(i.value=null!==(t=this._value)&&void 0!==t?t:"")}_handleHostClick(e){var t;if("summary-item"!==this.layout)return;const i=e.composedPath(),a=new Set(["INPUT","LABEL"]);i.some((e=>a.has(e.tagName)))||(null===(t=this.renderRoot.querySelector("input"))||void 0===t||t.focus(),super._handleHostClick(e))}__renderSummaryItemLayout(){var e,t;const i=null!==(e=this._value)&&void 0!==e?e:"",[n,r]=this.__i18n.parseValue(i),m=parseFloat(n),v=".5m"!==this._value||this.allowTwiceAMonth?this.options.find((e=>e.value===r)):void 0;return a(d||(d=p` <div class="leading-xs"> <div class="flex items-center gap-xs"> <label class="text-m text-body flex-1 whitespace-nowrap" for="input">${0}</label> <input placeholder="${0}" inputmode="numeric" style="min-width:10ch" class="${0}" type="number" step="1" min="1" max="${0}" id="input" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> <div class="${0}"> <div class="flex items-center gap-xs"> <div class="whitespace-nowrap"> ${0} </div> ${0} </div> <select class="${0}" id="select" ?disabled="${0}" ?hidden="${0}" @change="${0}"> <option value="" ?selected="${0}" disabled="disabled" hidden>${0}</option> ${0} ${0} </select> </div> </div> <div style="max-width:32rem"> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> </div> `),this.label,this.placeholder,o({"w-full appearance-none text-right bg-transparent transition-colors":!0,"text-m rounded-s focus-outline-none":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),l(null!==(t=this.max)&&void 0!==t?t:void 0),".5m"===i?this.allowTwiceAMonth?2:"":m,this.disabled,this.readonly,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{e.stopPropagation();const t=e.currentTarget,i=r||this.options[0].value;this._value=this.__i18n.formatValue([t.value,i])}),o({"relative rounded-s transition-colors transition-opacity":!0,"focus-within-ring-2 focus-within-ring-primary-50":!this.disabled&&!this.readonly,"text-body hover-opacity-80 cursor-pointer":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),".5m"===i?this.t("times_a_month"):v?this.t(v.label,{count:m}):this.t("select"),this.readonly?"":s(h||(h=p`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25)"><path fill-rule="evenodd" d="M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z" clip-rule="evenodd" /></svg>`)),o({"absolute inset-0 opacity-0":!0,"cursor-pointer":!this.disabled&&!this.readonly}),this.disabled,this.readonly,(e=>{e.stopPropagation();const t=e.currentTarget.value;this._value="times_a_month"===t?".5m":this.__i18n.formatValue([m||1,t])}),!v,this.t("select"),!this.allowTwiceAMonth||2!==m&&".5m"!==i?"":a(u||(u=p` <option value="times_a_month" ?selected="${0}"> ${0} </option> `),".5m"===i,this.t("times_a_month")),this.options.map((e=>a(c||(c=p` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.value,".5m"!==i&&e.value===(null==v?void 0:v.value),this.t(e.label,{count:m})))),this.helperText,this.disabled||this.readonly,this._errorMessage)}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./shared-a0baefff.js";import{I as e}from"./shared-2bb1f0f4.js";import{_ as t}from"./shared-8f9014ff.js";import{c as s,h as i,s as r}from"./shared-ba5c42c7.js";import{i as l}from"./shared-53e42a77.js";import{c as a}from"./shared-4e709717.js";import{l as o}from"./shared-d0aed1c1.js";let n,d,u,h,c,p,f,m,v,x=e=>e;customElements.define("foxy-internal-text-control",class extends e{constructor(){super(...arguments),this.layout=null,this.prefix=null,this.suffix=null,this.__isErrorVisible=!1}static get properties(){return t(t({},super.properties),{},{layout:{},prefix:{},suffix:{},__isErrorVisible:{attribute:!1}})}static get styles(){return[super.styles,s(n||(n=x`input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}`))]}reportValidity(){this.__isErrorVisible=!0,super.reportValidity()}renderControl(){return"summary-item"===this.layout?this.__renderSummaryItemLayout():"pill"===this.layout?this.__renderPillLayout():i(d||(d=x` <vaadin-text-field error-message="${0}" helper-text="${0}" placeholder="${0}" label="${0}" class="w-full" ?clear-button-visible="${0}" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @input="${0}"> ${0} ${0} </vaadin-text-field> `),l(this._errorMessage),this.helperText,this.placeholder,this.label,!this.suffix,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}),this.prefix?i(u||(u=x`<div slot="prefix">${0}</div>`),this.prefix):"",this.suffix?i(h||(h=x`<div class="pr-s font-medium" slot="suffix">${0}</div>`),this.suffix):"")}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}_handleHostClick(e){var t;if("summary-item"!==this.layout)return;const s=e.composedPath(),i=new Set(["INPUT","LABEL"]);s.some((e=>i.has(e.tagName)))||(null===(t=this.renderRoot.querySelector("input"))||void 0===t||t.focus(),super._handleHostClick(e))}__renderSummaryItemLayout(){return i(c||(c=x` <div class="leading-xs"> <div class="flex items-center gap-xs"> <label class="text-m text-body flex-1 whitespace-nowrap" for="input">${0}</label> ${0} <input placeholder="${0}" class="${0}" type="text" id="input" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @blur="${0}" @input="${0}"> ${0} <button aria-label="${0}" class="${0}" style="width:1em;height:1em" ?disabled="${0}" ?hidden="${0}" @click="${0}"> ${0} </button> </div> <div style="max-width:32rem"> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> </div> `),this.label,this.prefix?i(p||(p=x`<div>${0}</div>`),this.prefix):"",this.placeholder,a({"w-full appearance-none text-right bg-transparent transition-colors":!0,"text-m rounded-s focus-outline-none":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),o(this._value),this.disabled,this.readonly,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(()=>this.__isErrorVisible=!0),(e=>{e.stopPropagation(),this._value=e.target.value}),this.suffix?i(f||(f=x`<div class="font-medium text-secondary">${0}</div>`),this.suffix):"",this.t("clear"),a({"flex-shrink-0 rounded-full transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer text-tertiary hover-text-body":!this.disabled,"cursor-default text-disabled":this.disabled}),this.disabled,this.readonly||!this._value,(()=>{this._value="",this.dispatchEvent(new CustomEvent("clear"))}),r(m||(m=x`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" /></svg>`)),this.helperText,!this.__isErrorVisible||this.disabled||this.readonly,this._errorMessage)}__renderPillLayout(){var e;const t=this._value||this.placeholder;return i(v||(v=x` <div class="text-center flex items-center gap-s relative" style="min-width:6rem"> <span class="${0}">${0}</span> <input placeholder="${0}" aria-label="${0}" class="${0}" ?disabled="${0}" ?readonly="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </div> `),"relative block whitespace-pre text-center text-xl font-medium px-s py-xs -my-xs opacity-0",t,this.placeholder,this.label,a({"text-center appearance-none transition-all text-xl font-medium rounded":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"px-s py-xs -my-xs absolute inset-0":!0,"hover-bg-contrast-10":!this.disabled&&!this.readonly,"bg-transparent":this.readonly,"bg-contrast-5":!this.readonly,"text-disabled":this.disabled&&!this.readonly}),this.disabled,this.readonly,null!==(e=this._value)&&void 0!==e?e:"",(e=>{var t;"Enter"===e.key&&(e.preventDefault(),null===(t=this.nucleon)||void 0===t||t.submit())}),(e=>{const t=e.currentTarget;this._value=t.value}))}});
|
|
File without changes
|
|
File without changes
|