@foxy.io/elements 1.40.0-beta.1 → 1.40.0-beta.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-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +2 -2
- 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 -14
- package/dist/cdn/foxy-filter-attribute-form.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-codes-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-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-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-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-0c134ce7.js → shared-0098edce.js} +1 -1
- package/dist/cdn/shared-00e02b35.js +1 -0
- package/dist/cdn/{shared-2508187b.js → shared-0c2879b9.js} +1 -1
- package/dist/cdn/shared-4a32f76a.js +1 -0
- package/dist/cdn/shared-511fcf8e.js +15 -0
- package/dist/cdn/shared-5cd33249.js +1 -0
- package/dist/cdn/shared-653368ea.js +1 -0
- package/dist/cdn/shared-e0da7113.js +1 -0
- package/dist/cdn/{shared-2ab1e9eb.js → shared-e21ddeae.js} +1 -1
- package/dist/cdn/translations/native-integration-form/en.json +82 -17
- package/dist/cdn/translations/tax-form/en.json +8 -3
- package/dist/cdn/translations/template-config-form/en.json +6 -6
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js +10 -9
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js.map +1 -1
- package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js +15 -23
- package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js.map +1 -1
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js +10 -9
- package/dist/elements/internal/InternalResourcePickerControl/InternalResourcePickerControl.js.map +1 -1
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js +44 -40
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js.map +1 -1
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.d.ts +1 -0
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +24 -2
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
- package/dist/elements/internal/InternalSwitchControl/InternalSwitchControl.js +8 -2
- package/dist/elements/internal/InternalSwitchControl/InternalSwitchControl.js.map +1 -1
- package/dist/elements/internal/InternalTextControl/InternalTextControl.js +14 -13
- package/dist/elements/internal/InternalTextControl/InternalTextControl.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.d.ts +1 -2
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js +28 -45
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/index.d.ts +1 -0
- package/dist/elements/public/NativeIntegrationForm/index.js +1 -0
- package/dist/elements/public/NativeIntegrationForm/index.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.d.ts +12 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.js +123 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.js.map +1 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.d.ts +8 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.js +10 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.js.map +1 -0
- package/dist/elements/public/TaxForm/TaxForm.d.ts +0 -4
- package/dist/elements/public/TaxForm/TaxForm.js +17 -31
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.js +73 -53
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.js +70 -54
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-27cfa174.js +0 -1
- package/dist/cdn/shared-2c81b7df.js +0 -1
- package/dist/cdn/shared-80a1bf6f.js +0 -1
- package/dist/cdn/shared-afe24913.js +0 -1
- package/dist/cdn/shared-c05643e6.js +0 -1
- package/dist/cdn/shared-eea8debb.js +0 -1
|
@@ -75,65 +75,69 @@ export class InternalSelectControl extends InternalEditableControl {
|
|
|
75
75
|
__renderSummaryItemLayout() {
|
|
76
76
|
const selection = this.options.find(v => v.value === this._value);
|
|
77
77
|
return html `
|
|
78
|
-
<div class="
|
|
79
|
-
<div class="flex-
|
|
80
|
-
<label class="text-m text-body" for="select"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
${this._errorMessage}
|
|
87
|
-
</p>
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
<div
|
|
91
|
-
class=${classMap({
|
|
92
|
-
'relative rounded-s transition-colors transition-opacity': true,
|
|
78
|
+
<div class="leading-xs">
|
|
79
|
+
<div class="flex items-center gap-s">
|
|
80
|
+
<label class="text-m text-body flex-1 whitespace-nowrap" for="select">
|
|
81
|
+
${this.label}
|
|
82
|
+
</label>
|
|
83
|
+
<div
|
|
84
|
+
class=${classMap({
|
|
85
|
+
'relative rounded-s transition-colors transition-opacity min-w-0': true,
|
|
93
86
|
'focus-within-ring-2 focus-within-ring-primary-50': !this.disabled && !this.readonly,
|
|
94
87
|
'text-body hover-opacity-80 cursor-pointer': !this.disabled && !this.readonly,
|
|
95
88
|
'text-secondary': this.readonly,
|
|
96
89
|
'text-disabled': this.disabled,
|
|
97
90
|
'font-medium': !this.readonly,
|
|
98
91
|
})}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
>
|
|
93
|
+
<div class="flex items-center gap-xs min-w-0">
|
|
94
|
+
<div class="truncate min-w-0">
|
|
95
|
+
${selection
|
|
103
96
|
? 'label' in selection
|
|
104
97
|
? this.t(selection.label)
|
|
105
98
|
: selection.rawLabel
|
|
106
99
|
: this.placeholder}
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
</div>
|
|
101
|
+
${this.readonly
|
|
109
102
|
? ''
|
|
110
|
-
: 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>`}
|
|
111
|
-
|
|
103
|
+
: 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>`}
|
|
104
|
+
</div>
|
|
112
105
|
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
<select
|
|
107
|
+
class=${classMap({
|
|
115
108
|
'absolute inset-0 opacity-0': true,
|
|
116
109
|
'cursor-pointer': !this.disabled && !this.readonly,
|
|
117
110
|
})}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
id="select"
|
|
112
|
+
?disabled=${this.disabled}
|
|
113
|
+
?hidden=${this.readonly}
|
|
114
|
+
@blur=${() => (this.__isErrorVisible = true)}
|
|
115
|
+
@change=${(evt) => {
|
|
123
116
|
evt.stopPropagation();
|
|
124
117
|
this._value = evt.target.value;
|
|
125
118
|
}}
|
|
119
|
+
>
|
|
120
|
+
<option value="" ?selected=${!selection} disabled hidden>${this.placeholder}</option>
|
|
121
|
+
${this.options.map(option => html `
|
|
122
|
+
<option
|
|
123
|
+
value=${option.value}
|
|
124
|
+
?selected=${selection && option.value === this._value}
|
|
125
|
+
>
|
|
126
|
+
${'label' in option ? this.t(option.label) : option.rawLabel}
|
|
127
|
+
</option>
|
|
128
|
+
`)}
|
|
129
|
+
</select>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<div style="max-width: 32rem">
|
|
134
|
+
<p class="text-xs text-secondary">${this.helperText}</p>
|
|
135
|
+
<p
|
|
136
|
+
class="text-xs text-error"
|
|
137
|
+
?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}
|
|
126
138
|
>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<option
|
|
130
|
-
value=${option.value}
|
|
131
|
-
?selected=${selection && option.value === this._value}
|
|
132
|
-
>
|
|
133
|
-
${'label' in option ? this.t(option.label) : option.rawLabel}
|
|
134
|
-
</option>
|
|
135
|
-
`)}
|
|
136
|
-
</select>
|
|
139
|
+
${this._errorMessage}
|
|
140
|
+
</p>
|
|
137
141
|
</div>
|
|
138
142
|
</div>
|
|
139
143
|
`;
|
|
@@ -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;
|
|
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;IAyHnC,CAAC;IA5IC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,OAA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SACnD,CAAC;;0BAEU,IAAI,CAAC,QAAQ;wBACf,IAAI,CAAC,QAAQ;sBACf,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;wBAClC,CAAC,GAAU,EAAE,EAAE;YACvB,GAAG,CAAC,eAAe,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,GAAI,GAAG,CAAC,MAA4B,CAAC,KAAK,CAAC;QACxD,CAAC;;2CAE4B,CAAC,SAAS,oBAAoB,IAAI,CAAC,WAAW;gBACzE,IAAI,CAAC,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,EAAE,CACP,IAAI,CAAA;;8BAEQ,MAAM,CAAC,KAAK;kCACR,SAAS,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM;;wBAEnD,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ;;mBAE/D,CACJ;;;;;;8CAM+B,IAAI,CAAC,UAAU;;;sBAGvC,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;;cAEhE,IAAI,CAAC,aAAa;;;;KAI3B,CAAC;IACJ,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"]}
|
|
@@ -4,6 +4,7 @@ import { InternalEditableControl } from '../InternalEditableControl/InternalEdit
|
|
|
4
4
|
export declare class InternalSummaryControl extends InternalEditableControl {
|
|
5
5
|
static get properties(): PropertyDeclarations;
|
|
6
6
|
static get styles(): CSSResultArray;
|
|
7
|
+
unsafeHelperText: boolean;
|
|
7
8
|
layout: null | 'section' | 'details';
|
|
8
9
|
count: number | null;
|
|
9
10
|
open: boolean;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { svg } from 'lit-html';
|
|
2
2
|
import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
|
|
3
|
+
import { unsafeHTML } from 'lit-html/directives/unsafe-html';
|
|
3
4
|
import { html, css } from 'lit-element';
|
|
4
5
|
export class InternalSummaryControl extends InternalEditableControl {
|
|
5
6
|
constructor() {
|
|
6
7
|
super(...arguments);
|
|
8
|
+
this.unsafeHelperText = false;
|
|
7
9
|
this.layout = null;
|
|
8
10
|
this.count = null;
|
|
9
11
|
this.open = false;
|
|
@@ -11,6 +13,7 @@ export class InternalSummaryControl extends InternalEditableControl {
|
|
|
11
13
|
static get properties() {
|
|
12
14
|
return {
|
|
13
15
|
...super.properties,
|
|
16
|
+
unsafeHelperText: { type: Boolean, attribute: 'unsafe-helper-text' },
|
|
14
17
|
layout: {},
|
|
15
18
|
count: { type: Number },
|
|
16
19
|
open: { type: Boolean },
|
|
@@ -35,6 +38,21 @@ details summary > div{
|
|
|
35
38
|
details[open] summary > div{
|
|
36
39
|
border-radius:var(--lumo-border-radius) var(--lumo-border-radius) 0 0;
|
|
37
40
|
}
|
|
41
|
+
|
|
42
|
+
.with-unsafe a{
|
|
43
|
+
text-decoration:underline;
|
|
44
|
+
transition:color 0.1s ease-in-out;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.with-unsafe a:hover{
|
|
48
|
+
color:var(--lumo-primary-text-color);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.with-unsafe a:focus{
|
|
52
|
+
outline:none;
|
|
53
|
+
box-shadow:0 0 0 2px var(--lumo-primary-color-50pct);
|
|
54
|
+
border-radius:var(--lumo-border-radius-s);
|
|
55
|
+
}
|
|
38
56
|
`,
|
|
39
57
|
];
|
|
40
58
|
}
|
|
@@ -74,7 +92,9 @@ details[open] summary > div{
|
|
|
74
92
|
${svg `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2em; height: 1.2em"><path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" /></svg>`}
|
|
75
93
|
</span>
|
|
76
94
|
</p>
|
|
77
|
-
<p class="text-s text-secondary" ?hidden=${!this.helperText}
|
|
95
|
+
<p class="text-s text-secondary with-unsafe" ?hidden=${!this.helperText}>
|
|
96
|
+
${this.unsafeHelperText ? unsafeHTML(this.helperText) : this.helperText}
|
|
97
|
+
</p>
|
|
78
98
|
</div>
|
|
79
99
|
</summary>
|
|
80
100
|
<div class="overflow-hidden grid" style="gap: 1px">
|
|
@@ -86,7 +106,9 @@ details[open] summary > div{
|
|
|
86
106
|
return html `
|
|
87
107
|
<div class="leading-s mb-s" ?hidden=${!this.label && !this.helperText}>
|
|
88
108
|
<p class="font-medium text-body text-l" ?hidden=${!this.label}>${this.label}</p>
|
|
89
|
-
<p class="text-s text-secondary" ?hidden=${!this.helperText}
|
|
109
|
+
<p class="text-s text-secondary with-unsafe" ?hidden=${!this.helperText}>
|
|
110
|
+
${this.unsafeHelperText ? unsafeHTML(this.helperText) : this.helperText}
|
|
111
|
+
</p>
|
|
90
112
|
</div>
|
|
91
113
|
<div class="rounded overflow-hidden grid" style="gap: 1px">
|
|
92
114
|
<slot></slot>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSummaryControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSummaryControl/InternalSummaryControl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAkB,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAAnE;;
|
|
1
|
+
{"version":3,"file":"InternalSummaryControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSummaryControl/InternalSummaryControl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAkB,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAAnE;;QAkDE,qBAAgB,GAAG,KAAK,CAAC;QAEzB,WAAM,GAAiC,IAAI,CAAC;QAE5C,UAAK,GAAkB,IAAI,CAAC;QAE5B,SAAI,GAAG,KAAK,CAAC;IA8Df,CAAC;IArHC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,gBAAgB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE;YACpE,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SACxB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,GAAG,KAAK,CAAC,MAAM;YACf,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCF;SACF,CAAC;IACJ,CAAC;IAUD,cAAc;QACZ,OAAO;IACT,CAAC;IAED,aAAa;QACX,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7B,OAAO,IAAI,CAAA;;;kBAGC,IAAI,CAAC,IAAI;oBACP,CAAC,GAAU,EAAE,EAAE;gBACvB,MAAM,OAAO,GAAG,GAAG,CAAC,aAAmC,CAAC;gBACxD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBACzB,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,OAAO;oBAAE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnF,CAAC;;;;;;wBAMa,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU;;;;0BAI7B,CAAC,IAAI,CAAC,KAAK;;;oBAGjB,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE;;;;;;oBAMrE,GAAG,CAAA,uTAAuT;;;qEAGzQ,CAAC,IAAI,CAAC,UAAU;kBACnE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU;;;;;;;;OAQhF,CAAC;SACH;QAED,OAAO,IAAI,CAAA;4CAC6B,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU;0DACjB,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK;+DACpB,CAAC,IAAI,CAAC,UAAU;YACnE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU;;;;;;KAM5E,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations } from 'lit-element';\nimport { svg, TemplateResult } from 'lit-html';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html';\nimport { html, css } from 'lit-element';\n\nexport class InternalSummaryControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n unsafeHelperText: { type: Boolean, attribute: 'unsafe-helper-text' },\n layout: {},\n count: { type: Number },\n open: { type: Boolean },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n ::slotted(*) {\n min-width: 100%;\n }\n\n :host(:not([layout='section'])) slot::slotted(*) {\n background-color: var(--lumo-contrast-5pct);\n padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px);\n }\n\n details summary > div {\n border-radius: var(--lumo-border-radius);\n }\n\n details[open] summary > div {\n border-radius: var(--lumo-border-radius) var(--lumo-border-radius) 0 0;\n }\n\n .with-unsafe a {\n text-decoration: underline;\n transition: color 0.1s ease-in-out;\n }\n\n .with-unsafe a:hover {\n color: var(--lumo-primary-text-color);\n }\n\n .with-unsafe a:focus {\n outline: none;\n box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);\n border-radius: var(--lumo-border-radius-s);\n }\n `,\n ];\n }\n\n unsafeHelperText = false;\n\n layout: null | 'section' | 'details' = null;\n\n count: number | null = null;\n\n open = false;\n\n renderLightDom(): void {\n return;\n }\n\n renderControl(): TemplateResult {\n if (this.layout === 'details') {\n return html`\n <details\n class=\"rounded overflow-hidden\"\n ?open=${this.open}\n @toggle=${(evt: Event) => {\n const details = evt.currentTarget as HTMLDetailsElement;\n this.open = details.open;\n if (!evt.composed && !evt.bubbles) this.dispatchEvent(new CustomEvent('toggle'));\n }}\n >\n <summary class=\"select-none cursor-pointer focus-outline-none group\">\n <div\n class=\"leading-s bg-contrast-5 group-focus-ring-2 group-focus-ring-inset group-focus-ring-primary-50\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n ?hidden=${!this.label && !this.helperText}\n >\n <p\n class=\"font-medium uppercase text-s tracking-wider flex items-center justify-between gap-s\"\n ?hidden=${!this.label}\n >\n <span>\n ${this.label}${typeof this.count === 'number' ? ` (${this.count})` : ''}\n </span>\n <span\n class=\"flex items-center justify-center transition-colors text-tertiary group-hover-text-body\"\n style=\"transform: scale(1.35)\"\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1.2em; height: 1.2em\"><path fill-rule=\"evenodd\" d=\"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z\" clip-rule=\"evenodd\" /></svg>`}\n </span>\n </p>\n <p class=\"text-s text-secondary with-unsafe\" ?hidden=${!this.helperText}>\n ${this.unsafeHelperText ? unsafeHTML(this.helperText) : this.helperText}\n </p>\n </div>\n </summary>\n <div class=\"overflow-hidden grid\" style=\"gap: 1px\">\n <slot></slot>\n </div>\n </details>\n `;\n }\n\n return html`\n <div class=\"leading-s mb-s\" ?hidden=${!this.label && !this.helperText}>\n <p class=\"font-medium text-body text-l\" ?hidden=${!this.label}>${this.label}</p>\n <p class=\"text-s text-secondary with-unsafe\" ?hidden=${!this.helperText}>\n ${this.unsafeHelperText ? unsafeHTML(this.helperText) : this.helperText}\n </p>\n </div>\n <div class=\"rounded overflow-hidden grid\" style=\"gap: 1px\">\n <slot></slot>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -26,8 +26,14 @@ export class InternalSwitchControl extends InternalEditableControl {
|
|
|
26
26
|
<label class="text-m text-body" for="input">${this.label}</label>
|
|
27
27
|
${this.helperTextAsToolip
|
|
28
28
|
? ''
|
|
29
|
-
: html `<p class="text-xs text-secondary"
|
|
30
|
-
|
|
29
|
+
: html `<p class="text-xs text-secondary" style="max-width: 32rem">
|
|
30
|
+
${this.helperText}
|
|
31
|
+
</p>`}
|
|
32
|
+
<p
|
|
33
|
+
class="text-xs text-error"
|
|
34
|
+
style="max-width: 32rem"
|
|
35
|
+
?hidden=${this.disabled || this.readonly}
|
|
36
|
+
>
|
|
31
37
|
${this._errorMessage}
|
|
32
38
|
</p>
|
|
33
39
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSwitchControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSwitchControl/InternalSwitchControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAwB,GAAG,EAAkB,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,OAAO,qBAAsB,SAAQ,uBAAuB;IAAlE;;QAWE,uBAAkB,GAAG,KAAK,CAAC;QAE3B,eAAU,GAAkB,IAAI,CAAC;QAEjC,cAAS,GAAkB,IAAI,CAAC;QAEhC,WAAM,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalSwitchControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSwitchControl/InternalSwitchControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAwB,GAAG,EAAkB,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,OAAO,qBAAsB,SAAQ,uBAAuB;IAAlE;;QAWE,uBAAkB,GAAG,KAAK,CAAC;QAE3B,eAAU,GAAkB,IAAI,CAAC;QAEjC,cAAS,GAAkB,IAAI,CAAC;QAEhC,WAAM,GAAG,KAAK,CAAC;IAoGjB,CAAC;IApHC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,kBAAkB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE;YAC1E,UAAU,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE;YACxC,SAAS,EAAE,EAAE,SA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S,EAAE,CAAC,IAAI,CAAC,QAAQ;aAC1B,CAAC;;;;;;;;gCAQU,IAAI,CAAC,QAAQ;gCACb,IAAI,CAAC,QAAQ;+BACd,OAAO;8BACR,CAAC,GAAU,EAAE,EAAE;gBACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAiC,CAAC;gBACvD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;YACnE,CAAC;;;;aAIR;UACH,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,UAAU;YAC1C,CAAC,CAAC,IAAI,CAAA;;;;;kBAKE,GAAG,CAAA,yfAAyf;;;;;;;;;4DASld,IAAI,CAAC,UAAU;;aAE9D;YACH,CAAC,CAAC,EAAE;;KAET,CAAC;IACJ,CAAC;IAED,IAAc,MAAM;QAClB,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;QACnC,IAAI,IAAI,CAAC,SAAS,IAAI,aAAa,KAAK,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QACpE,IAAI,IAAI,CAAC,UAAU,IAAI,aAAa,KAAK,IAAI,CAAC,UAAU;YAAE,OAAO,KAAK,CAAC;QACvE,OAAO,CAAC,CAAC,aAAa,CAAC;IACzB,CAAC;IAED,IAAc,MAAM,CAAC,KAAc;QACjC,IAAI,IAAI,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;aAC/D,IAAI,IAAI,CAAC,UAAU,IAAI,KAAK,KAAK,KAAK;YAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;;YACvE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { html, PropertyDeclarations, svg, TemplateResult } from 'lit-element';\nimport { classMap } from '../../../utils/class-map';\n\nexport class InternalSwitchControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n helperTextAsToolip: { type: Boolean, attribute: 'helper-text-as-tooltip' },\n falseAlias: { attribute: 'false-alias' },\n trueAlias: { attribute: 'true-alias' },\n invert: { type: Boolean },\n };\n }\n\n helperTextAsToolip = false;\n\n falseAlias: string | null = null;\n\n trueAlias: string | null = null;\n\n invert = false;\n\n renderControl(): TemplateResult {\n const checked = this.invert ? !this._value : !!this._value;\n return html`\n <div class=\"flex items-start gap-s leading-xs text-m\">\n <div class=\"flex-1\">\n <label class=\"text-m text-body\" for=\"input\">${this.label}</label>\n ${this.helperTextAsToolip\n ? ''\n : html`<p class=\"text-xs text-secondary\" style=\"max-width: 32rem\">\n ${this.helperText}\n </p>`}\n <p\n class=\"text-xs text-error\"\n style=\"max-width: 32rem\"\n ?hidden=${this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </p>\n </div>\n\n ${this.readonly\n ? html`<p class=\"text-secondary\">${checked ? this.t('checked') : this.t('unchecked')}</p>`\n : html`\n <div style=\"height: calc(1em * var(--lumo-line-height-xs))\" class=\"flex items-center\">\n <div\n style=\"border-radius: var(--lumo-size-xl); width: calc((1em * var(--lumo-line-height-xs)) - 3px + var(--lumo-space-m))\"\n class=${classMap({\n 'cursor-pointer group transition-colors relative': true,\n 'flex flex-shrink-0 items-center': true,\n 'bg-success': !this.disabled && checked,\n 'bg-contrast-20 hover-bg-contrast-30': !this.disabled && !checked,\n 'bg-contrast-10': this.disabled,\n 'focus-within-ring-2 focus-within-ring-primary-50': true,\n })}\n @click=${() => (this._value = !this._value)}\n >\n <div\n style=\"margin: 1.5px; width: calc((1em * var(--lumo-line-height-xs)) - 6px); height: calc((1em * var(--lumo-line-height-xs)) - 6px)\"\n class=${classMap({\n 'transition-all transform block rounded-full': true,\n 'translate-x-m': checked,\n 'translate-x-0': !checked,\n 'bg-base': this.disabled,\n 'bg-tint': !this.disabled,\n })}\n ></div>\n\n <input\n class=\"opacity-0 absolute inset-0 focus-outline-none\"\n type=\"checkbox\"\n id=\"input\"\n switch\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?checked=${checked}\n @change=${(evt: Event) => {\n const checkbox = evt.currentTarget as HTMLInputElement;\n this._value = this.invert ? !checkbox.checked : checkbox.checked;\n }}\n />\n </div>\n </div>\n `}\n ${this.helperTextAsToolip && this.helperText\n ? html`\n <div\n class=\"transition-colors text-tertiary flex-shrink-0 cursor-pointer hover-text-body\"\n id=\"trigger\"\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: calc(1em * var(--lumo-line-height-xs)); height: calc(1em * var(--lumo-line-height-xs)); margin-right: -0.12em\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z\" /></svg>`}\n </div>\n <vcf-tooltip\n for=\"trigger\"\n style=\"--lumo-base-color: black; max-width: 30rem\"\n class=\"mt-s\"\n theme=\"light\"\n position=\"bottom\"\n >\n <span class=\"text-s\" style=\"color: white\">${this.helperText}</span>\n </vcf-tooltip>\n `\n : ''}\n </div>\n `;\n }\n\n protected get _value(): boolean {\n const originalValue = super._value;\n if (this.trueAlias && originalValue === this.trueAlias) return true;\n if (this.falseAlias && originalValue === this.falseAlias) return false;\n return !!originalValue;\n }\n\n protected set _value(value: boolean) {\n if (this.trueAlias && value === true) super._value = this.trueAlias;\n else if (this.falseAlias && value === false) super._value = this.falseAlias;\n else super._value = value;\n }\n}\n"]}
|
|
@@ -78,19 +78,10 @@ export class InternalTextControl extends InternalEditableControl {
|
|
|
78
78
|
}
|
|
79
79
|
__renderSummaryItemLayout() {
|
|
80
80
|
return html `
|
|
81
|
-
<div class="
|
|
82
|
-
<div>
|
|
83
|
-
<label class="text-m text-body" for="input">${this.label}</label>
|
|
84
|
-
<p class="text-xs text-secondary">${this.helperText}</p>
|
|
85
|
-
<p
|
|
86
|
-
class="text-xs text-error"
|
|
87
|
-
?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}
|
|
88
|
-
>
|
|
89
|
-
${this._errorMessage}
|
|
90
|
-
</p>
|
|
91
|
-
</div>
|
|
81
|
+
<div class="leading-xs">
|
|
82
|
+
<div class="flex items-center gap-xs">
|
|
83
|
+
<label class="text-m text-body flex-1 whitespace-nowrap" for="input">${this.label}</label>
|
|
92
84
|
|
|
93
|
-
<div class="flex-1 flex items-center gap-xs" style="min-width: 30%">
|
|
94
85
|
${this.prefix ? html `<div>${this.prefix}</div>` : ''}
|
|
95
86
|
|
|
96
87
|
<input
|
|
@@ -120,7 +111,7 @@ export class InternalTextControl extends InternalEditableControl {
|
|
|
120
111
|
<button
|
|
121
112
|
aria-label=${this.t('clear')}
|
|
122
113
|
class=${classMap({
|
|
123
|
-
'rounded-full transition-colors': true,
|
|
114
|
+
'flex-shrink-0 rounded-full transition-colors': true,
|
|
124
115
|
'focus-outline-none focus-ring-2 focus-ring-primary-50': true,
|
|
125
116
|
'cursor-pointer text-tertiary hover-text-body': !this.disabled,
|
|
126
117
|
'cursor-default text-disabled': this.disabled,
|
|
@@ -136,6 +127,16 @@ export class InternalTextControl extends InternalEditableControl {
|
|
|
136
127
|
${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>`}
|
|
137
128
|
</button>
|
|
138
129
|
</div>
|
|
130
|
+
|
|
131
|
+
<div style="max-width: 32rem">
|
|
132
|
+
<p class="text-xs text-secondary">${this.helperText}</p>
|
|
133
|
+
<p
|
|
134
|
+
class="text-xs text-error"
|
|
135
|
+
?hidden=${!this.__isErrorVisible || this.disabled || this.readonly}
|
|
136
|
+
>
|
|
137
|
+
${this._errorMessage}
|
|
138
|
+
</p>
|
|
139
|
+
</div>
|
|
139
140
|
</div>
|
|
140
141
|
`;
|
|
141
142
|
}
|
|
@@ -1 +1 @@
|
|
|
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,GAAyC,IAAI,CAAC;QAEpD,WAAM,GAAkB,IAAI,CAAC;QAE7B,WAAM,GAAkB,IAAI,CAAC;QAErB,qBAAgB,GAAG,KAAK,CAAC;
|
|
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,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C,gBAAgB,GAAG,IAAI,CAAC;qBACnC,CAAC,GAAU,EAAE,EAAE;YACtB,GAAG,CAAC,eAAe,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,GAAI,GAAG,CAAC,MAA2B,CAAC,KAAK,CAAC;QACvD,CAAC;;;YAGD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,2CAA2C,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC,EAAE;;;yBAGxE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;oBACpB,QAAQ,CAAC;YACf,8CAA8C,EAAE,IAAI;YACpD,uDAAuD,EAAE,IAAI;YAC7D,8CAA8C,EAAE,CAAC,IAAI,CAAC,QAAQ;YAC9D,8BAA8B,EAAE,IAAI,CAAC,QAAQ;SAC9C,CAAC;;wBAEU,IAAI,CAAC,QAAQ;sBACf,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM;qBAC9B,GAAG,EAAE;YACZ,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,CAAC;;cAEC,GAAG,CAAA,sWAAsW;;;;;8CAKzU,IAAI,CAAC,UAAU;;;sBAGvC,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;;cAEhE,IAAI,CAAC,aAAa;;;;KAI3B,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' | 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\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 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"]}
|
|
@@ -15,6 +15,7 @@ declare const Base: typeof InternalForm & import("lit-element").Constructor<impo
|
|
|
15
15
|
export declare class NativeIntegrationForm extends Base<Data> {
|
|
16
16
|
static get properties(): PropertyDeclarations;
|
|
17
17
|
static get v8n(): NucleonV8N<Data>;
|
|
18
|
+
itemCategoryBase: string | null;
|
|
18
19
|
store: string | null;
|
|
19
20
|
private readonly __createConfigGetterFor;
|
|
20
21
|
private readonly __createConfigSetterFor;
|
|
@@ -22,8 +23,6 @@ export declare class NativeIntegrationForm extends Base<Data> {
|
|
|
22
23
|
private readonly __providerSetValue;
|
|
23
24
|
private readonly __templateProviderOptions;
|
|
24
25
|
private readonly __avalaraAddressValidationCountriesOptions;
|
|
25
|
-
private readonly __codeMappingsGetValue;
|
|
26
|
-
private readonly __codeMappingsSetValue;
|
|
27
26
|
private readonly __onesourceCompanyRoleOptions;
|
|
28
27
|
private readonly __onesourceProductOrderPriorityGetValue;
|
|
29
28
|
private readonly __onesourceProductOrderPrioritySetValue;
|
|
@@ -16,6 +16,7 @@ const Base = TranslatableMixin(InternalForm, NS);
|
|
|
16
16
|
export class NativeIntegrationForm extends Base {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
+
this.itemCategoryBase = null;
|
|
19
20
|
this.store = null;
|
|
20
21
|
this.__createConfigGetterFor = memoize((key) => {
|
|
21
22
|
return () => { var _a; return (_a = this.__config) === null || _a === void 0 ? void 0 : _a[key]; };
|
|
@@ -38,22 +39,6 @@ export class NativeIntegrationForm extends Base {
|
|
|
38
39
|
{ value: 'custom_tax', label: 'option_custom_tax' },
|
|
39
40
|
];
|
|
40
41
|
this.__avalaraAddressValidationCountriesOptions = [{ value: 'US' }, { value: 'CA' }];
|
|
41
|
-
this.__codeMappingsGetValue = () => {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
const mappings = (_b = (_a = this.__config) === null || _a === void 0 ? void 0 : _a.category_to_product_tax_code_mappings) !== null && _b !== void 0 ? _b : {};
|
|
44
|
-
return Object.entries(mappings).map(([foxyCategory, vndTaxCode]) => {
|
|
45
|
-
return { value: `${foxyCategory}:${vndTaxCode}` };
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
this.__codeMappingsSetValue = (value) => {
|
|
49
|
-
const mappings = {};
|
|
50
|
-
for (const { value: mapping } of value) {
|
|
51
|
-
const [foxyCategory, vndTaxCode] = mapping.split(':');
|
|
52
|
-
if (foxyCategory && vndTaxCode)
|
|
53
|
-
mappings[foxyCategory] = vndTaxCode;
|
|
54
|
-
}
|
|
55
|
-
this.__config = { category_to_product_tax_code_mappings: mappings };
|
|
56
|
-
};
|
|
57
42
|
this.__onesourceCompanyRoleOptions = [
|
|
58
43
|
{ value: 'B', label: 'option_buyer' },
|
|
59
44
|
{ value: 'M', label: 'option_middleman' },
|
|
@@ -84,6 +69,7 @@ export class NativeIntegrationForm extends Base {
|
|
|
84
69
|
static get properties() {
|
|
85
70
|
return {
|
|
86
71
|
...super.properties,
|
|
72
|
+
itemCategoryBase: { attribute: 'item-category-base' },
|
|
87
73
|
store: {},
|
|
88
74
|
};
|
|
89
75
|
}
|
|
@@ -112,13 +98,6 @@ export class NativeIntegrationForm extends Base {
|
|
|
112
98
|
({ provider: p = 'avalara', config: c = '{}' }) => {
|
|
113
99
|
return p !== 'avalara' || !!parse(c).company_code || 'avalara-company-code:v8n_required';
|
|
114
100
|
},
|
|
115
|
-
({ provider: p = 'avalara', config: c = '{}' }) => {
|
|
116
|
-
if (p !== 'avalara')
|
|
117
|
-
return true;
|
|
118
|
-
const mappings = parse(c).category_to_product_tax_code_mappings;
|
|
119
|
-
const err = 'avalara-category-to-product-tax-code-mappings:v8n_required';
|
|
120
|
-
return (mappings && Object.entries(mappings).length > 0) || err;
|
|
121
|
-
},
|
|
122
101
|
({ provider: p = 'avalara', config: c = '{}' }) => {
|
|
123
102
|
return p !== 'taxjar' || !!parse(c).api_token || 'taxjar-api-token:v8n_required';
|
|
124
103
|
},
|
|
@@ -256,7 +235,7 @@ export class NativeIntegrationForm extends Base {
|
|
|
256
235
|
infer=""
|
|
257
236
|
href=${ifDefined((_b = this.store) !== null && _b !== void 0 ? _b : void 0)}
|
|
258
237
|
id="storeLoader"
|
|
259
|
-
@
|
|
238
|
+
@update=${() => this.requestUpdate()}
|
|
260
239
|
>
|
|
261
240
|
</foxy-nucleon>
|
|
262
241
|
`;
|
|
@@ -315,8 +294,9 @@ export class NativeIntegrationForm extends Base {
|
|
|
315
294
|
this.edit({ provider, config: newConfig });
|
|
316
295
|
}
|
|
317
296
|
__renderAvalaraConfig() {
|
|
318
|
-
var _a, _b, _c;
|
|
297
|
+
var _a, _b, _c, _d, _e, _f;
|
|
319
298
|
const isActive = (_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.is_active;
|
|
299
|
+
const itemCategories = (_d = (_c = this.__storeLoader) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d._links['fx:item_categories'].href;
|
|
320
300
|
const serviceUrlPlaceholder = typeof isActive === 'boolean'
|
|
321
301
|
? this.t(`avalara-group-one.avalara-service-url.placeholder_${isActive ? 'active' : 'inactive'}`)
|
|
322
302
|
: void 0;
|
|
@@ -361,16 +341,6 @@ export class NativeIntegrationForm extends Base {
|
|
|
361
341
|
</foxy-internal-summary-control>
|
|
362
342
|
|
|
363
343
|
<foxy-internal-summary-control infer="avalara-group-two">
|
|
364
|
-
<foxy-internal-editable-list-control
|
|
365
|
-
layout="summary-item"
|
|
366
|
-
infer="avalara-category-to-product-tax-code-mappings"
|
|
367
|
-
.getValue=${this.__codeMappingsGetValue}
|
|
368
|
-
.setValue=${this.__codeMappingsSetValue}
|
|
369
|
-
>
|
|
370
|
-
</foxy-internal-editable-list-control>
|
|
371
|
-
</foxy-internal-summary-control>
|
|
372
|
-
|
|
373
|
-
<foxy-internal-summary-control infer="avalara-group-three">
|
|
374
344
|
<foxy-internal-switch-control
|
|
375
345
|
json-template=${defaults.avalara}
|
|
376
346
|
json-path="use_ava_tax"
|
|
@@ -387,7 +357,7 @@ export class NativeIntegrationForm extends Base {
|
|
|
387
357
|
>
|
|
388
358
|
</foxy-internal-switch-control>
|
|
389
359
|
|
|
390
|
-
${((
|
|
360
|
+
${((_e = this.__config) === null || _e === void 0 ? void 0 : _e.use_address_validation) ? html `
|
|
391
361
|
<foxy-internal-editable-list-control
|
|
392
362
|
json-template=${defaults.avalara}
|
|
393
363
|
json-path="address_validation_countries"
|
|
@@ -416,9 +386,22 @@ export class NativeIntegrationForm extends Base {
|
|
|
416
386
|
>
|
|
417
387
|
</foxy-internal-switch-control>
|
|
418
388
|
</foxy-internal-summary-control>
|
|
389
|
+
|
|
390
|
+
<foxy-internal-native-integration-form-code-map-control
|
|
391
|
+
item-category-base=${ifDefined((_f = this.itemCategoryBase) !== null && _f !== void 0 ? _f : void 0)}
|
|
392
|
+
item-categories=${ifDefined(itemCategories)}
|
|
393
|
+
json-template=${defaults.avalara}
|
|
394
|
+
json-path="category_to_product_tax_code_mappings"
|
|
395
|
+
property="config"
|
|
396
|
+
layout="summary-item"
|
|
397
|
+
infer="avalara-category-to-product-tax-code-mappings"
|
|
398
|
+
>
|
|
399
|
+
</foxy-internal-native-integration-form-code-map-control>
|
|
419
400
|
`;
|
|
420
401
|
}
|
|
421
402
|
__renderTaxJarConfig() {
|
|
403
|
+
var _a, _b, _c;
|
|
404
|
+
const itemCategories = (_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:item_categories'].href;
|
|
422
405
|
return html `
|
|
423
406
|
<foxy-internal-summary-control infer="taxjar-group-one">
|
|
424
407
|
<foxy-internal-password-control
|
|
@@ -439,15 +422,15 @@ export class NativeIntegrationForm extends Base {
|
|
|
439
422
|
</foxy-internal-switch-control>
|
|
440
423
|
</foxy-internal-summary-control>
|
|
441
424
|
|
|
442
|
-
<foxy-internal-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
</foxy-internal-
|
|
425
|
+
<foxy-internal-native-integration-form-code-map-control
|
|
426
|
+
item-category-base=${ifDefined((_c = this.itemCategoryBase) !== null && _c !== void 0 ? _c : void 0)}
|
|
427
|
+
item-categories=${ifDefined(itemCategories)}
|
|
428
|
+
json-template=${defaults.taxjar}
|
|
429
|
+
json-path="category_to_product_tax_code_mappings"
|
|
430
|
+
property="config"
|
|
431
|
+
infer="taxjar-category-to-product-tax-code-mappings"
|
|
432
|
+
>
|
|
433
|
+
</foxy-internal-native-integration-form-code-map-control>
|
|
451
434
|
`;
|
|
452
435
|
}
|
|
453
436
|
__renderOneSourceConfig() {
|