@foxy.io/elements 1.14.0-beta.7 → 1.14.0-beta.8
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-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +17 -17
- package/dist/cdn/foxy-customer-portal.js +2 -2
- package/dist/cdn/foxy-customer.js +4 -4
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +2 -2
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +3 -3
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -14
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/{shared-50c7a176.js → shared-00070cc4.js} +5 -5
- package/dist/cdn/shared-007c4e34.js +1 -0
- package/dist/cdn/shared-07134f93.js +14 -0
- package/dist/cdn/{shared-09feabf8.js → shared-0f9809ab.js} +1 -1
- package/dist/cdn/{shared-8edee4e1.js → shared-31d03530.js} +7 -7
- package/dist/cdn/{shared-691da586.js → shared-4ba926ca.js} +1 -1
- package/dist/cdn/{shared-1bafffd0.js → shared-5d94bacb.js} +1 -1
- package/dist/cdn/{shared-6ecbc785.js → shared-7007dedb.js} +1 -1
- package/dist/cdn/{shared-7629a1a5.js → shared-a3d2c48e.js} +1 -1
- package/dist/cdn/{shared-c66e9946.js → shared-b24377bf.js} +1 -1
- package/dist/cdn/{shared-0ba88744.js → shared-c5ae5d33.js} +1 -1
- package/dist/cdn/{shared-6f7f752e.js → shared-ca7c3b9a.js} +1 -1
- package/dist/cdn/shared-d01035c5.js +1 -0
- package/dist/cdn/{shared-16e28f3b.js → shared-d05c93a5.js} +1 -1
- package/dist/cdn/{shared-4d3c7828.js → shared-da787055.js} +1 -1
- package/dist/cdn/{shared-a6c047b1.js → shared-daf6b763.js} +1 -1
- package/dist/cdn/shared-fe8a7aa2.js +1 -0
- package/dist/elements/private/Checkbox/Checkbox.d.ts +3 -1
- package/dist/elements/private/Checkbox/Checkbox.js +43 -14
- package/dist/elements/private/Checkbox/Checkbox.js.map +1 -1
- package/dist/elements/private/Choice/Choice.js +7 -5
- package/dist/elements/private/Choice/Choice.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +3 -2
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +68 -50
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/types.d.ts +14 -0
- package/dist/elements/public/EmailTemplateForm/types.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountriesList.js +11 -2
- package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountryCard.d.ts +2 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.js +36 -4
- package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +55 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +247 -55
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/types.d.ts +34 -0
- package/dist/elements/public/TemplateConfigForm/types.js.map +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.d.ts +2 -1
- package/dist/elements/public/TemplateForm/TemplateForm.js +71 -52
- package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
- package/dist/elements/public/TemplateForm/types.d.ts +14 -0
- package/dist/elements/public/TemplateForm/types.js.map +1 -1
- package/dist/mixins/themeable.js +22 -8
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-3f35fa81.js +0 -1
- package/dist/cdn/shared-ace85f1b.js +0 -1
- package/dist/cdn/shared-d8852c42.js +0 -1
|
@@ -7,12 +7,13 @@ import { NucleonElement } from "../NucleonElement/NucleonElement.js";
|
|
|
7
7
|
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
8
8
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
9
9
|
import { classMap } from "../../../utils/class-map.js";
|
|
10
|
-
import {
|
|
10
|
+
import { live } from 'lit-html/directives/live';
|
|
11
11
|
const NS = 'template-form';
|
|
12
12
|
const Base = ScopedElementsMixin(ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS))));
|
|
13
13
|
export class TemplateForm extends Base {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
|
+
this.templates = {};
|
|
16
17
|
this.__cacheState = 'idle';
|
|
17
18
|
this.__contentChoice = 'default';
|
|
18
19
|
}
|
|
@@ -80,13 +81,17 @@ export class TemplateForm extends Base {
|
|
|
80
81
|
}
|
|
81
82
|
__renderDescription() {
|
|
82
83
|
var _a, _b;
|
|
84
|
+
const scope = 'description';
|
|
83
85
|
return html `
|
|
84
86
|
<div>
|
|
85
|
-
${this.renderTemplateOrSlot(
|
|
87
|
+
${this.renderTemplateOrSlot(`${scope}:before`)}
|
|
86
88
|
|
|
87
89
|
<vaadin-text-field
|
|
90
|
+
data-testid=${scope}
|
|
88
91
|
class="w-full mb-s"
|
|
89
|
-
label=${this.t(
|
|
92
|
+
label=${this.t(scope)}
|
|
93
|
+
?disabled=${!this.in('idle') || this.disabledSelector.matches(scope)}
|
|
94
|
+
?readonly=${this.readonlySelector.matches(scope)}
|
|
90
95
|
.value=${(_b = (_a = this.form) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : ''}
|
|
91
96
|
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
92
97
|
@input=${(evt) => {
|
|
@@ -95,30 +100,40 @@ export class TemplateForm extends Base {
|
|
|
95
100
|
>
|
|
96
101
|
</vaadin-text-field>
|
|
97
102
|
|
|
98
|
-
${this.renderTemplateOrSlot(
|
|
103
|
+
${this.renderTemplateOrSlot(`${scope}:after`)}
|
|
99
104
|
</div>
|
|
100
105
|
`;
|
|
101
106
|
}
|
|
102
107
|
__renderContent() {
|
|
103
108
|
var _a;
|
|
109
|
+
const scope = 'content';
|
|
110
|
+
const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope);
|
|
111
|
+
const isReadonly = this.readonlySelector.matches(scope);
|
|
104
112
|
const contentChoice = this.form.content_url
|
|
105
113
|
? 'url'
|
|
106
114
|
: this.form.content
|
|
107
115
|
? 'clipboard'
|
|
108
116
|
: this.__contentChoice;
|
|
109
117
|
return html `
|
|
110
|
-
<div>
|
|
111
|
-
${this.renderTemplateOrSlot(
|
|
118
|
+
<div data-testid="content">
|
|
119
|
+
${this.renderTemplateOrSlot(`${scope}:before`)}
|
|
112
120
|
|
|
113
121
|
<x-group frame>
|
|
114
|
-
<foxy-i18n
|
|
122
|
+
<foxy-i18n
|
|
123
|
+
class=${classMap({ 'transition-colors': true, 'text-disabled': isDisabled })}
|
|
124
|
+
lang=${this.lang}
|
|
125
|
+
slot="header"
|
|
126
|
+
key="template"
|
|
127
|
+
ns=${this.ns}
|
|
128
|
+
>
|
|
129
|
+
</foxy-i18n>
|
|
115
130
|
|
|
116
131
|
<x-choice
|
|
117
|
-
data-testid="
|
|
132
|
+
data-testid="content-type"
|
|
118
133
|
.value=${contentChoice}
|
|
119
134
|
.items=${['default', 'url', 'clipboard']}
|
|
120
|
-
?readonly=${
|
|
121
|
-
?disabled=${
|
|
135
|
+
?readonly=${isReadonly}
|
|
136
|
+
?disabled=${isDisabled}
|
|
122
137
|
@change=${(evt) => {
|
|
123
138
|
if (evt instanceof ChoiceChangeEvent) {
|
|
124
139
|
this.edit({ content: '', content_url: '' });
|
|
@@ -146,9 +161,12 @@ export class TemplateForm extends Base {
|
|
|
146
161
|
<div slot="url" ?hidden=${contentChoice !== 'url'}>
|
|
147
162
|
<div class="flex items-center mt-0 mb-m">
|
|
148
163
|
<vaadin-text-field
|
|
149
|
-
data-testid="
|
|
150
|
-
value=${ifDefined(this.form.content_url)}
|
|
164
|
+
data-testid="content-url"
|
|
151
165
|
class="mr-s flex-grow"
|
|
166
|
+
?readonly=${isReadonly}
|
|
167
|
+
?disabled=${isDisabled}
|
|
168
|
+
.value=${this.form.content_url}
|
|
169
|
+
@keydown=${(evt) => evt.key === 'Enter' && this.submit()}
|
|
152
170
|
@input=${(evt) => {
|
|
153
171
|
const value = evt.currentTarget.value;
|
|
154
172
|
this.edit({ content: '', content_url: value });
|
|
@@ -156,51 +174,51 @@ export class TemplateForm extends Base {
|
|
|
156
174
|
>
|
|
157
175
|
</vaadin-text-field>
|
|
158
176
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
<vaadin-button
|
|
178
|
+
data-testid="cache"
|
|
179
|
+
class="relative"
|
|
180
|
+
?hidden=${isReadonly || this.form.content_url !== ((_a = this.data) === null || _a === void 0 ? void 0 : _a.content_url)}
|
|
181
|
+
?disabled=${isDisabled || this.__cacheState === 'busy'}
|
|
182
|
+
@click=${this.__cache}
|
|
183
|
+
>
|
|
184
|
+
<foxy-i18n
|
|
185
|
+
class=${classMap({
|
|
186
|
+
'relative transition-opacity': true,
|
|
187
|
+
'opacity-0': this.__cacheState !== 'idle',
|
|
188
|
+
})}
|
|
189
|
+
lang=${this.lang}
|
|
190
|
+
key="cache"
|
|
191
|
+
ns=${this.ns}
|
|
192
|
+
>
|
|
193
|
+
</foxy-i18n>
|
|
176
194
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
`
|
|
194
|
-
: ''}
|
|
195
|
+
<div
|
|
196
|
+
class=${classMap({
|
|
197
|
+
'absolute inset-0 flex transition-opacity': true,
|
|
198
|
+
'opacity-0': this.__cacheState === 'idle',
|
|
199
|
+
})}
|
|
200
|
+
>
|
|
201
|
+
<foxy-spinner
|
|
202
|
+
layout="no-label"
|
|
203
|
+
class="m-auto"
|
|
204
|
+
state=${this.__cacheState === 'fail' ? 'error' : 'busy'}
|
|
205
|
+
lang=${this.lang}
|
|
206
|
+
ns=${this.ns}
|
|
207
|
+
>
|
|
208
|
+
</foxy-spinner>
|
|
209
|
+
</div>
|
|
210
|
+
</vaadin-button>
|
|
195
211
|
</div>
|
|
196
212
|
</div>
|
|
197
213
|
|
|
198
214
|
<div slot="clipboard" ?hidden=${contentChoice !== 'clipboard'}>
|
|
199
215
|
<vaadin-text-area
|
|
200
216
|
id="cached-content"
|
|
201
|
-
data-testid="content"
|
|
217
|
+
data-testid="content-clipboard"
|
|
202
218
|
class="w-full mb-m"
|
|
203
|
-
|
|
219
|
+
?readonly=${isReadonly}
|
|
220
|
+
?disabled=${isDisabled}
|
|
221
|
+
.value=${live(this.form.content)}
|
|
204
222
|
@input=${(evt) => {
|
|
205
223
|
const value = evt.currentTarget.value;
|
|
206
224
|
this.edit({ content: value, content_url: '' });
|
|
@@ -211,14 +229,15 @@ export class TemplateForm extends Base {
|
|
|
211
229
|
</x-choice>
|
|
212
230
|
</x-group>
|
|
213
231
|
|
|
214
|
-
${this.renderTemplateOrSlot(
|
|
232
|
+
${this.renderTemplateOrSlot(`${scope}:after`)}
|
|
215
233
|
</div>
|
|
216
234
|
`;
|
|
217
235
|
}
|
|
218
236
|
__renderTimestamps() {
|
|
237
|
+
const scope = 'timestamps';
|
|
219
238
|
return html `
|
|
220
239
|
<div>
|
|
221
|
-
${this.renderTemplateOrSlot(
|
|
240
|
+
${this.renderTemplateOrSlot(`${scope}:before`)}
|
|
222
241
|
|
|
223
242
|
<x-property-table
|
|
224
243
|
data-testid="timestamps"
|
|
@@ -233,7 +252,7 @@ export class TemplateForm extends Base {
|
|
|
233
252
|
>
|
|
234
253
|
</x-property-table>
|
|
235
254
|
|
|
236
|
-
${this.renderTemplateOrSlot(
|
|
255
|
+
${this.renderTemplateOrSlot(`${scope}:after`)}
|
|
237
256
|
</div>
|
|
238
257
|
`;
|
|
239
258
|
}
|
|
@@ -1 +1 @@
|
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GAAoB,EAAE,EAAE;YAC/B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS;gBAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAC3C,CAAC;;;;;;kBAMO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;wBACxD,MAAM;sBACR,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU;mBAC5D,WAAW;;0BAEJ,EAAE,QAAQ,MAAM,SAAS,IAAI;;;UAG7C,IAAI,CAAC,oBAAoB,CAAC,GAAG,MAAM,QAAQ,CAAC;;KAEjD,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,OAAO;;QACnB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAE3B,IAAI;YACF,MAAM,GAAG,eAAG,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,mCAAI,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAEjF,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;SACnD;QAAC,WAAM;YACN,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;SAC5B;IACH,CAAC;CACF","sourcesContent":["import { CSSResultArray, PropertyDeclarations, TemplateResult, css, html } from 'lit-element';\nimport { Choice, Group, PropertyTable } from '../../private/index';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { ChoiceChangeEvent } from '../../private/events';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { Data } from './types';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst NS = 'template-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\nexport class TemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __cacheState: { attribute: false },\n __contentChoice: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n #cached-content::part(input-field) {\n max-height: 15em;\n }\n `,\n ];\n }\n\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-property-table': PropertyTable,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n private __cacheState: 'idle' | 'busy' | 'fail' = 'idle';\n\n private __contentChoice: 'default' | 'url' | 'clipboard' = 'default';\n\n render(): TemplateResult {\n const { hiddenSelector, href, lang, ns } = this;\n const action = href ? 'delete' : 'create';\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('content', true) ? '' : this.__renderContent()}\n ${hiddenSelector.matches('timestamps', true) || !href ? '' : this.__renderTimestamps()}\n ${hiddenSelector.matches(action) ? '' : this.__renderAction(action)}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderDescription() {\n return html`\n <div>\n ${this.renderTemplateOrSlot('description:before')}\n\n <vaadin-text-field\n class=\"w-full mb-s\"\n label=${this.t('description')}\n .value=${this.form?.description ?? ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n this.edit({ description: (evt.currentTarget as TextFieldElement).value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderContent() {\n const contentChoice = this.form.content_url\n ? 'url'\n : this.form.content\n ? 'clipboard'\n : this.__contentChoice;\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('content:before')}\n\n <x-group frame>\n <foxy-i18n lang=${this.lang} slot=\"header\" key=\"template\" ns=${this.ns}></foxy-i18n>\n\n <x-choice\n data-testid=\"template-type\"\n .value=${contentChoice}\n .items=${['default', 'url', 'clipboard']}\n ?readonly=${this.readonlySelector.matches('content', true)}\n ?disabled=${this.in('busy') || this.disabledSelector.matches('content', true)}\n @change=${(evt: Event) => {\n if (evt instanceof ChoiceChangeEvent) {\n this.edit({ content: '', content_url: '' });\n this.__contentChoice = evt.detail as 'url' | 'clipboard' | 'default';\n }\n }}\n >\n ${['default', 'url', 'clipboard'].map(value => {\n return html`\n <div slot=\"${value}-label\" class=\"py-s leading-s\">\n <foxy-i18n class=\"block\" lang=${this.lang} key=\"template_${value}\" ns=${this.ns}>\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-s opacity-70\"\n lang=${this.lang}\n key=\"template_${value}_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"url\" ?hidden=${contentChoice !== 'url'}>\n <div class=\"flex items-center mt-0 mb-m\">\n <vaadin-text-field\n data-testid=\"content_url\"\n value=${ifDefined(this.form.content_url)}\n class=\"mr-s flex-grow\"\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextFieldElement).value;\n this.edit({ content: '', content_url: value });\n }}\n >\n </vaadin-text-field>\n\n ${this.form.content_url === this.data?.content_url\n ? html`\n <vaadin-button\n class=\"relative\"\n ?disabled=${this.__cacheState === 'busy'}\n @click=${this.__cache}\n >\n <foxy-i18n\n class=${classMap({\n 'relative transition-opacity': true,\n 'opacity-0': this.__cacheState !== 'idle',\n })}\n lang=${this.lang}\n key=\"cache\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex transition-opacity': true,\n 'opacity-0': this.__cacheState === 'idle',\n })}\n >\n <foxy-spinner\n layout=\"no-label\"\n class=\"m-auto\"\n state=${this.__cacheState === 'fail' ? 'error' : 'busy'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n </vaadin-button>\n `\n : ''}\n </div>\n </div>\n\n <div slot=\"clipboard\" ?hidden=${contentChoice !== 'clipboard'}>\n <vaadin-text-area\n id=\"cached-content\"\n data-testid=\"content\"\n class=\"w-full mb-m\"\n .value=${this.form.content}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextAreaElement).value;\n this.edit({ content: value, content_url: '' });\n }}\n >\n </vaadin-text-area>\n </div>\n </x-choice>\n </x-group>\n\n ${this.renderTemplateOrSlot('content:after')}\n </div>\n `;\n }\n\n private __renderTimestamps() {\n return html`\n <div>\n ${this.renderTemplateOrSlot('timestamps:before')}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot('timestamps:after')}\n </div>\n `;\n }\n\n private __renderAction(action: string) {\n const { disabledSelector, href, lang, ns } = this;\n\n const isTemplateValid = this.in({ idle: { template: { dirty: 'valid' } } });\n const isSnapshotValid = this.in({ idle: { snapshot: { dirty: 'valid' } } });\n const isDisabled = !this.in('idle') || disabledSelector.matches(action, true);\n const isValid = isTemplateValid || isSnapshotValid;\n\n const handleClick = (evt: Event) => {\n if (action === 'delete') {\n const confirm = this.renderRoot.querySelector('#confirm');\n (confirm as InternalConfirmDialog).show(evt.currentTarget as HTMLElement);\n } else {\n this.submit();\n }\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${action}:before`)}\n\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${lang}\n ns=${ns}\n id=\"confirm\"\n data-testid=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.delete();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=${this.in('idle') ? `primary ${href ? 'error' : 'success'}` : ''}\n data-testid=${action}\n ?disabled=${(this.in({ idle: 'template' }) && !isValid) || isDisabled}\n @click=${handleClick}\n >\n <foxy-i18n ns=${ns} key=${action} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${action}:after`)}\n </div>\n `;\n }\n\n private async __cache(): Promise<void> {\n this.__cacheState = 'busy';\n\n try {\n const url = this.data?._links['fx:cache'].href ?? '';\n const response = await new TemplateForm.API(this).fetch(url, { method: 'POST' });\n\n this.__cacheState = response.ok ? 'idle' : 'fail';\n } catch {\n this.__cacheState = 'fail';\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TemplateForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateForm/TemplateForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,+BAA4B;AAEnE,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,gCAA6B;AACzD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,MAAM,EAAE,GAAG,eAAe,CAAC;AAC3B,MAAM,IAAI,GAAG,mBAAmB,CAC9B,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CACzE,CAAC;AAEF,MAAM,OAAO,YAAa,SAAQ,IAAU;IAA5C;;QAmCE,cAAS,GAAc,EAAE,CAAC;QAElB,iBAAY,GAA6B,MAAM,CAAC;QAEhD,oBAAe,GAAoC,SAAS,CAAC;IAsRvE,CAAC;IA5TC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,YAAY,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAClC,eAAe,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SACtC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,M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AC,oBAAoB,CAAC,GAAG,MAAM,QAAQ,CAAC;;KAEjD,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,OAAO;;QACnB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAE3B,IAAI;YACF,MAAM,GAAG,eAAG,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,mCAAI,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAEjF,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;SACnD;QAAC,WAAM;YACN,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;SAC5B;IACH,CAAC;CACF","sourcesContent":["import { CSSResultArray, PropertyDeclarations, TemplateResult, css, html } from 'lit-element';\nimport { Choice, Group, PropertyTable } from '../../private/index';\nimport { Data, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\n\nimport { ChoiceChangeEvent } from '../../private/events';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { live } from 'lit-html/directives/live';\n\nconst NS = 'template-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\nexport class TemplateForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __cacheState: { attribute: false },\n __contentChoice: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n #cached-content::part(input-field) {\n max-height: 15em;\n }\n `,\n ];\n }\n\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-property-table': PropertyTable,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n templates: Templates = {};\n\n private __cacheState: 'idle' | 'busy' | 'fail' = 'idle';\n\n private __contentChoice: 'default' | 'url' | 'clipboard' = 'default';\n\n render(): TemplateResult {\n const { hiddenSelector, href, lang, ns } = this;\n const action = href ? 'delete' : 'create';\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('content', true) ? '' : this.__renderContent()}\n ${hiddenSelector.matches('timestamps', true) || !href ? '' : this.__renderTimestamps()}\n ${hiddenSelector.matches(action) ? '' : this.__renderAction(action)}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isBusy ? 'busy' : 'empty'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderDescription() {\n const scope = 'description';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n data-testid=${scope}\n class=\"w-full mb-s\"\n label=${this.t(scope)}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches(scope)}\n ?readonly=${this.readonlySelector.matches(scope)}\n .value=${this.form?.description ?? ''}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n this.edit({ description: (evt.currentTarget as TextFieldElement).value });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderContent() {\n const scope = 'content';\n const isDisabled = !this.in('idle') || this.disabledSelector.matches(scope);\n const isReadonly = this.readonlySelector.matches(scope);\n const contentChoice = this.form.content_url\n ? 'url'\n : this.form.content\n ? 'clipboard'\n : this.__contentChoice;\n\n return html`\n <div data-testid=\"content\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-group frame>\n <foxy-i18n\n class=${classMap({ 'transition-colors': true, 'text-disabled': isDisabled })}\n lang=${this.lang}\n slot=\"header\"\n key=\"template\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <x-choice\n data-testid=\"content-type\"\n .value=${contentChoice}\n .items=${['default', 'url', 'clipboard']}\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n @change=${(evt: Event) => {\n if (evt instanceof ChoiceChangeEvent) {\n this.edit({ content: '', content_url: '' });\n this.__contentChoice = evt.detail as 'url' | 'clipboard' | 'default';\n }\n }}\n >\n ${['default', 'url', 'clipboard'].map(value => {\n return html`\n <div slot=\"${value}-label\" class=\"py-s leading-s\">\n <foxy-i18n class=\"block\" lang=${this.lang} key=\"template_${value}\" ns=${this.ns}>\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-s opacity-70\"\n lang=${this.lang}\n key=\"template_${value}_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"url\" ?hidden=${contentChoice !== 'url'}>\n <div class=\"flex items-center mt-0 mb-m\">\n <vaadin-text-field\n data-testid=\"content-url\"\n class=\"mr-s flex-grow\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${this.form.content_url}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextFieldElement).value;\n this.edit({ content: '', content_url: value });\n }}\n >\n </vaadin-text-field>\n\n <vaadin-button\n data-testid=\"cache\"\n class=\"relative\"\n ?hidden=${isReadonly || this.form.content_url !== this.data?.content_url}\n ?disabled=${isDisabled || this.__cacheState === 'busy'}\n @click=${this.__cache}\n >\n <foxy-i18n\n class=${classMap({\n 'relative transition-opacity': true,\n 'opacity-0': this.__cacheState !== 'idle',\n })}\n lang=${this.lang}\n key=\"cache\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex transition-opacity': true,\n 'opacity-0': this.__cacheState === 'idle',\n })}\n >\n <foxy-spinner\n layout=\"no-label\"\n class=\"m-auto\"\n state=${this.__cacheState === 'fail' ? 'error' : 'busy'}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-spinner>\n </div>\n </vaadin-button>\n </div>\n </div>\n\n <div slot=\"clipboard\" ?hidden=${contentChoice !== 'clipboard'}>\n <vaadin-text-area\n id=\"cached-content\"\n data-testid=\"content-clipboard\"\n class=\"w-full mb-m\"\n ?readonly=${isReadonly}\n ?disabled=${isDisabled}\n .value=${live(this.form.content)}\n @input=${(evt: CustomEvent) => {\n const value = (evt.currentTarget as TextAreaElement).value;\n this.edit({ content: value, content_url: '' });\n }}\n >\n </vaadin-text-area>\n </div>\n </x-choice>\n </x-group>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderTimestamps() {\n const scope = 'timestamps';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n }\n\n private __renderAction(action: string) {\n const { disabledSelector, href, lang, ns } = this;\n\n const isTemplateValid = this.in({ idle: { template: { dirty: 'valid' } } });\n const isSnapshotValid = this.in({ idle: { snapshot: { dirty: 'valid' } } });\n const isDisabled = !this.in('idle') || disabledSelector.matches(action, true);\n const isValid = isTemplateValid || isSnapshotValid;\n\n const handleClick = (evt: Event) => {\n if (action === 'delete') {\n const confirm = this.renderRoot.querySelector('#confirm');\n (confirm as InternalConfirmDialog).show(evt.currentTarget as HTMLElement);\n } else {\n this.submit();\n }\n };\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${action}:before`)}\n\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${lang}\n ns=${ns}\n id=\"confirm\"\n data-testid=\"confirm\"\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.delete();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=${this.in('idle') ? `primary ${href ? 'error' : 'success'}` : ''}\n data-testid=${action}\n ?disabled=${(this.in({ idle: 'template' }) && !isValid) || isDisabled}\n @click=${handleClick}\n >\n <foxy-i18n ns=${ns} key=${action} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot(`${action}:after`)}\n </div>\n `;\n }\n\n private async __cache(): Promise<void> {\n this.__cacheState = 'busy';\n\n try {\n const url = this.data?._links['fx:cache'].href ?? '';\n const response = await new TemplateForm.API(this).fetch(url, { method: 'POST' });\n\n this.__cacheState = response.ok ? 'idle' : 'fail';\n } catch {\n this.__cacheState = 'fail';\n }\n }\n}\n"]}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import { Rels } from '@foxy.io/sdk/backend';
|
|
2
|
+
import { Renderer } from '../../../mixins/configurable';
|
|
2
3
|
import { Resource } from '@foxy.io/sdk/core';
|
|
4
|
+
import { TemplateForm } from './TemplateForm';
|
|
3
5
|
export declare type Data = Resource<Rels.CartIncludeTemplate> | Resource<Rels.CheckoutTemplate> | Resource<Rels.CartTemplate>;
|
|
6
|
+
export declare type Templates = {
|
|
7
|
+
'description:before'?: Renderer<TemplateForm>;
|
|
8
|
+
'description:after'?: Renderer<TemplateForm>;
|
|
9
|
+
'content:before'?: Renderer<TemplateForm>;
|
|
10
|
+
'content:after'?: Renderer<TemplateForm>;
|
|
11
|
+
'timestamps:before'?: Renderer<TemplateForm>;
|
|
12
|
+
'timestamps:after'?: Renderer<TemplateForm>;
|
|
13
|
+
'create:before'?: Renderer<TemplateForm>;
|
|
14
|
+
'create:after'?: Renderer<TemplateForm>;
|
|
15
|
+
'delete:before'?: Renderer<TemplateForm>;
|
|
16
|
+
'delete:after'?: Renderer<TemplateForm>;
|
|
17
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\n\nexport type Data =\n | Resource<Rels.CartIncludeTemplate>\n | Resource<Rels.CheckoutTemplate>\n | Resource<Rels.CartTemplate>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Renderer } from '../../../mixins/configurable';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { TemplateForm } from './TemplateForm';\n\nexport type Data =\n | Resource<Rels.CartIncludeTemplate>\n | Resource<Rels.CheckoutTemplate>\n | Resource<Rels.CartTemplate>;\n\nexport type Templates = {\n 'description:before'?: Renderer<TemplateForm>;\n 'description:after'?: Renderer<TemplateForm>;\n 'content:before'?: Renderer<TemplateForm>;\n 'content:after'?: Renderer<TemplateForm>;\n 'timestamps:before'?: Renderer<TemplateForm>;\n 'timestamps:after'?: Renderer<TemplateForm>;\n 'create:before'?: Renderer<TemplateForm>;\n 'create:after'?: Renderer<TemplateForm>;\n 'delete:before'?: Renderer<TemplateForm>;\n 'delete:after'?: Renderer<TemplateForm>;\n};\n"]}
|
package/dist/mixins/themeable.js
CHANGED
|
@@ -1292,6 +1292,10 @@ input::-webkit-date-and-time-value{
|
|
|
1292
1292
|
border-color: var(--lumo-contrast-20pct, hsla(214, 53%, 23%, 0.16));
|
|
1293
1293
|
}
|
|
1294
1294
|
|
|
1295
|
+
.border-contrast-30 {
|
|
1296
|
+
border-color: var(--lumo-contrast-30pct, hsla(214, 50%, 22%, 0.26));
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1295
1299
|
.border-contrast-50 {
|
|
1296
1300
|
border-color: var(--lumo-contrast-50pct, hsla(214, 45%, 20%, 0.5));
|
|
1297
1301
|
}
|
|
@@ -1366,6 +1370,10 @@ input::-webkit-date-and-time-value{
|
|
|
1366
1370
|
background-color: var(--lumo-contrast-20pct, hsla(214, 53%, 23%, 0.16));
|
|
1367
1371
|
}
|
|
1368
1372
|
|
|
1373
|
+
.bg-contrast-70 {
|
|
1374
|
+
background-color: var(--lumo-contrast-70pct, hsla(214, 42%, 18%, 0.72));
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1369
1377
|
.bg-contrast {
|
|
1370
1378
|
background-color: var(--lumo-contrast, hsl(214, 35%, 15%));
|
|
1371
1379
|
}
|
|
@@ -1667,14 +1675,14 @@ input::-webkit-date-and-time-value{
|
|
|
1667
1675
|
color: var(--lumo-tint, #fff);
|
|
1668
1676
|
}
|
|
1669
1677
|
|
|
1670
|
-
.text-contrast-20 {
|
|
1671
|
-
color: var(--lumo-contrast-20pct, hsla(214, 53%, 23%, 0.16));
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
1678
|
.text-contrast-30 {
|
|
1675
1679
|
color: var(--lumo-contrast-30pct, hsla(214, 50%, 22%, 0.26));
|
|
1676
1680
|
}
|
|
1677
1681
|
|
|
1682
|
+
.text-contrast-70 {
|
|
1683
|
+
color: var(--lumo-contrast-70pct, hsla(214, 42%, 18%, 0.72));
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1678
1686
|
.text-contrast {
|
|
1679
1687
|
color: var(--lumo-contrast, hsl(214, 35%, 15%));
|
|
1680
1688
|
}
|
|
@@ -1886,6 +1894,10 @@ input::-webkit-date-and-time-value{
|
|
|
1886
1894
|
--tw-ring-color: var(--lumo-primary-color-50pct, hsla(214, 90%, 52%, 0.5));
|
|
1887
1895
|
}
|
|
1888
1896
|
|
|
1897
|
+
.ring-error-50 {
|
|
1898
|
+
--tw-ring-color: var(--lumo-error-color-50pct, hsla(3, 100%, 60%, 0.5));
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1889
1901
|
.ring-success-50 {
|
|
1890
1902
|
--tw-ring-color: var(--lumo-success-color-50pct, hsla(145, 76%, 44%, 0.55));
|
|
1891
1903
|
}
|
|
@@ -1898,10 +1910,6 @@ input::-webkit-date-and-time-value{
|
|
|
1898
1910
|
--tw-ring-color: var(--lumo-primary-color-50pct, hsla(214, 90%, 52%, 0.5));
|
|
1899
1911
|
}
|
|
1900
1912
|
|
|
1901
|
-
.focus-ring-error-50:focus {
|
|
1902
|
-
--tw-ring-color: var(--lumo-error-color-50pct, hsla(3, 100%, 60%, 0.5));
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
1913
|
.ring-offset-4 {
|
|
1906
1914
|
--tw-ring-offset-width: 4px;
|
|
1907
1915
|
}
|
|
@@ -1972,6 +1980,12 @@ input::-webkit-date-and-time-value{
|
|
|
1972
1980
|
transition-duration: 150ms;
|
|
1973
1981
|
}
|
|
1974
1982
|
|
|
1983
|
+
.transition-transform {
|
|
1984
|
+
transition-property: transform;
|
|
1985
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
1986
|
+
transition-duration: 150ms;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1975
1989
|
.duration-100 {
|
|
1976
1990
|
transition-duration: 100ms;
|
|
1977
1991
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeable.js","sourceRoot":"","sources":["../../src/mixins/themeable.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAA0C,UAAU,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,wBAAqB;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAI/D,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,WAAkB,EACkB,EAAE;IACtC,OAAO,MAAM,gBAAiB,SAAQ,WAAW;QAC/C,MAAM,KAAK,MAAM;YACf,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;YAEjC,OAAO;gBACL,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClF,GAAG
|
|
1
|
+
{"version":3,"file":"themeable.js","sourceRoot":"","sources":["../../src/mixins/themeable.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAA0C,UAAU,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,wBAAqB;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAI/D,MAAM,CAAC,MAAM,cAAc,GAAG,CAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqHF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAgB,SAAU,SAAQ,mBAAmB,CACzD,eAAe,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAC5C;CAAG","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport { CSSResult, CSSResultArray, Constructor, LitElement, css } from 'lit-element';\n\nimport { ResponsiveMixin } from './responsive';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\n\ntype Base = Constructor<LitElement> & { styles?: CSSResult | CSSResultArray | CSSStyleSheet };\n\nexport const ThemeableMixin = <TBase extends Base>(\n BaseElement: TBase\n): TBase & { styles: CSSResultArray } => {\n return class ThemeableElement extends BaseElement {\n static get styles(): CSSResultArray {\n const originalCSS = super.styles;\n\n return [\n ...(originalCSS ? (Array.isArray(originalCSS) ? originalCSS : [originalCSS]) : []),\n css`\n @tailwind base;\n\n * {\n -webkit-tap-highlight-color: transparent;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n :host {\n display: block;\n }\n\n details > summary::-webkit-details-marker {\n display: none;\n }\n\n details > summary {\n list-style: none;\n }\n\n vaadin-select {\n margin-top: -4px;\n margin-bottom: -4px;\n }\n\n vaadin-text-area,\n vaadin-text-field,\n vaadin-date-picker,\n vaadin-email-field,\n vaadin-number-field,\n vaadin-custom-field,\n vaadin-integer-field,\n vaadin-password-field,\n vaadin-combo-box::part(text-field) {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n vaadin-date-picker::part(text-field) {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n vaadin-button {\n margin: 0;\n }\n\n vaadin-checkbox::part(checkbox) {\n margin: 0;\n }\n\n vaadin-checkbox::part(label) {\n margin: 0.1875em var(--lumo-space-m);\n }\n\n .appearance-none {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n }\n\n .appearance-none::-webkit-calendar-picker-indicator,\n .appearance-none::-webkit-outer-spin-button,\n .appearance-none::-webkit-inner-spin-button,\n .appearance-none::-webkit-list-button {\n opacity: 0 !important;\n width: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n\n input::-webkit-date-and-time-value {\n text-align: inherit !important;\n }\n\n @tailwind components;\n\n @tailwind utilities;\n\n @layer utilities {\n .border-radius-overflow-fix {\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n }\n\n @variants sm, md, lg, xl {\n .grid-rows-auto {\n grid-auto-rows: 1fr;\n }\n\n .icon-inline {\n --iron-icon-height: 1em;\n --iron-icon-width: 1em;\n }\n\n .bg-blurred {\n backdrop-filter: blur(25px);\n background: var(--lumo-tint-80pct);\n }\n\n .max-w-modal {\n max-width: 28rem;\n }\n\n .w-narrow-modal {\n width: 18rem;\n }\n\n .snap-x-mandatory {\n scroll-snap-type: x mandatory;\n }\n\n .snap-start {\n scroll-snap-align: start;\n }\n }\n }\n `,\n ];\n }\n };\n};\n\n/**\n * One of the base classes for each rel-specific element in the collection\n * providing shared TailwindCSS styles for Shadow DOM content.\n * This class MUST NOT be used on its own (hence the `abstract` keyword) or\n * referenced externally (outside of the package).\n *\n * @deprecated\n */\nexport abstract class Themeable extends ScopedElementsMixin(\n ResponsiveMixin(ThemeableMixin(LitElement))\n) {}\n"]}
|