@foxy.io/elements 1.30.0-beta.2 → 1.30.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.
Files changed (25) hide show
  1. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  2. package/dist/cdn/foxy-coupon-form.js +1 -1
  3. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  4. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  5. package/dist/cdn/foxy-gift-card-form.js +1 -1
  6. package/dist/cdn/foxy-native-integration-form.js +1 -1
  7. package/dist/cdn/foxy-store-form.js +1 -1
  8. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  9. package/dist/cdn/foxy-transaction.js +1 -1
  10. package/dist/cdn/{shared-7dd710e4.js → shared-fae08dfb.js} +1 -1
  11. package/dist/cdn/translations/admin-subscription-form/en.json +11 -11
  12. package/dist/cdn/translations/coupon-form/en.json +59 -55
  13. package/dist/cdn/translations/transaction/en.json +11 -11
  14. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js +24 -18
  15. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map +1 -1
  16. package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.d.ts +1 -0
  17. package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.js +39 -17
  18. package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.js.map +1 -1
  19. package/dist/elements/public/CouponForm/CouponForm.js +25 -18
  20. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  21. package/dist/elements/public/Transaction/Transaction.js +10 -13
  22. package/dist/elements/public/Transaction/Transaction.js.map +1 -1
  23. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js +0 -1
  24. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js.map +1 -1
  25. package/package.json +1 -1
@@ -1066,6 +1066,17 @@
1066
1066
  "helper_text": "",
1067
1067
  "checked": "Sent",
1068
1068
  "unchecked": "Not sent"
1069
+ },
1070
+ "process-webhook": {
1071
+ "idle": "Resend datafeed",
1072
+ "busy": "Resending datafeed...",
1073
+ "fail": "Failed to resend datafeed",
1074
+ "confirm": {
1075
+ "header": "Resend datafeed",
1076
+ "message": "Are you sure you'd like to resend XML datafeed for this transaction?",
1077
+ "confirm": "Yes",
1078
+ "cancel": "No"
1079
+ }
1069
1080
  }
1070
1081
  },
1071
1082
  "summary": {
@@ -1905,17 +1916,6 @@
1905
1916
  "cancel": "No"
1906
1917
  }
1907
1918
  },
1908
- "resend-datafeed": {
1909
- "idle": "Resend datafeed",
1910
- "busy": "Resending datafeed...",
1911
- "fail": "Failed to resend datafeed",
1912
- "confirm": {
1913
- "header": "Resend datafeed",
1914
- "message": "Are you sure you'd like to resend XML datafeed for this transaction?",
1915
- "confirm": "Yes",
1916
- "cancel": "No"
1917
- }
1918
- },
1919
1919
  "subscription": {
1920
1920
  "caption": "Go to subscription"
1921
1921
  }
@@ -513,12 +513,6 @@
513
513
  "helper_text": "",
514
514
  "checked": "Yes",
515
515
  "unchecked": "No"
516
- },
517
- "customer-auto-apply": {
518
- "label": "Enable auto-apply",
519
- "helper_text": "",
520
- "checked": "Yes",
521
- "unchecked": "No"
522
516
  }
523
517
  },
524
518
  "timeframe": {
@@ -537,55 +531,6 @@
537
531
  "helper_text": "The date and time when this coupon will expire. Leave blank for no expiration."
538
532
  }
539
533
  },
540
- "customer-subscription-restrictions": {
541
- "label": "Subscription restrictions",
542
- "placeholder": "Enter a product code and hit Enter",
543
- "helper_text": "This coupon will be applied only when a subscription includes a product with one of the codes in the list. Wildcards are allowed just like in product code restrictions.",
544
- "caption": "Add this code",
545
- "delete": "Delete this code",
546
- "v8n_too_long": "Unfortunately we are unable to store that many subscription restrictions at the moment. Please reduce the number of rules in this section until this message disappears."
547
- },
548
- "customer-attribute-restrictions": {
549
- "label": "Customer restrictions",
550
- "helper_text": "This coupon will be applied only when a customer record matches this query.",
551
- "v8n_too_long": "Unfortunately we are unable to store that many customer restrictions at the moment. Please reduce the number of rules in this section until this message disappears.",
552
- "query-builder": {
553
- "add_or_clause": "Add OR clause",
554
- "add_value": "Add value",
555
- "code": "Code",
556
- "date": "{{value, date}}",
557
- "date_created": "Created on",
558
- "date_modified": "Last updated on",
559
- "delete": "Delete",
560
- "field": "Field",
561
- "hidden": "Hidden",
562
- "is_defined_false": "Not defined",
563
- "is_defined_true": "Defined",
564
- "name": "Name",
565
- "operator_equal": "Equal",
566
- "operator_greaterthan": "Greater than",
567
- "operator_greaterthanorequal": "Greater than or equal",
568
- "operator_in": "One of",
569
- "operator_isdefined": "Is defined",
570
- "operator_lessthan": "Less than",
571
- "operator_lessthanorequal": "Less than or equal",
572
- "operator_not": "Not equal",
573
- "or": "Or",
574
- "query_builder_group": "Group of filters",
575
- "query_builder_rule": "Filter",
576
- "range_from": "From",
577
- "range_to": "To",
578
- "type": "Type",
579
- "type_any": "Field of unknown type",
580
- "type_attribute": "Key-value resource",
581
- "type_date": "Date field",
582
- "type_here": "Type here...",
583
- "type_number": "Numeric field",
584
- "type_string": "Text field",
585
- "used_codes": "Codes used",
586
- "value": "Value"
587
- }
588
- },
589
534
  "item-option-restrictions": {
590
535
  "label": "Item option restrictions",
591
536
  "helper_text": "This restricts the usage of a coupon code based on an item option's name and value. When defined, the coupon will only apply to items with the specified option name and value. Wildcards are allowed.",
@@ -647,6 +592,65 @@
647
592
  },
648
593
  "helper_text": "Limit which categories this coupon applies to. All changes are saved automatically."
649
594
  },
595
+ "customer-restrictions": {
596
+ "label": "Customer restrictions",
597
+ "helper_text": "",
598
+ "customer-attribute-restrictions": {
599
+ "label": "Customer attribute restrictions",
600
+ "helper_text": "This restricts the usage of the coupon based on an attribute name and value. When defined, the coupon will only apply if the customer has the specified attribute name and value. Wildcards are allowed.",
601
+ "v8n_too_long": "Unfortunately we are unable to store that many customer attribute restrictions at the moment. Please reduce the number of rules in this section until this message disappears.",
602
+ "query-builder": {
603
+ "add_or_clause": "Add OR clause",
604
+ "add_value": "Add value",
605
+ "code": "Code",
606
+ "date": "{{value, date}}",
607
+ "date_created": "Created on",
608
+ "date_modified": "Last updated on",
609
+ "delete": "Delete",
610
+ "field": "Field",
611
+ "hidden": "Hidden",
612
+ "is_defined_false": "Not defined",
613
+ "is_defined_true": "Defined",
614
+ "name": "Name",
615
+ "operator_equal": "Equal",
616
+ "operator_greaterthan": "Greater than",
617
+ "operator_greaterthanorequal": "Greater than or equal",
618
+ "operator_in": "One of",
619
+ "operator_isdefined": "Is defined",
620
+ "operator_lessthan": "Less than",
621
+ "operator_lessthanorequal": "Less than or equal",
622
+ "operator_not": "Not equal",
623
+ "or": "Or",
624
+ "query_builder_group": "Group of filters",
625
+ "query_builder_rule": "Filter",
626
+ "range_from": "From",
627
+ "range_to": "To",
628
+ "type": "Type",
629
+ "type_any": "Field of unknown type",
630
+ "type_attribute": "Key-value resource",
631
+ "type_date": "Date field",
632
+ "type_here": "Type here...",
633
+ "type_number": "Numeric field",
634
+ "type_string": "Text field",
635
+ "used_codes": "Codes used",
636
+ "value": "Value"
637
+ }
638
+ },
639
+ "customer-subscription-restrictions": {
640
+ "label": "Customer subscription restrictions",
641
+ "placeholder": "Enter a product code and hit Enter",
642
+ "helper_text": "This restricts the usage of the coupon based on product codes in the current customer's active subscriptions. When defined, the coupon will only apply if the customer has an active subscription with a matching product code. Wildcards are allowed.",
643
+ "caption": "Add this code",
644
+ "delete": "Delete this code",
645
+ "v8n_too_long": "Unfortunately we are unable to store that many subscription restrictions at the moment. Please reduce the number of rules in this section until this message disappears."
646
+ },
647
+ "customer-auto-apply": {
648
+ "label": "Auto apply coupon for matching customers",
649
+ "helper_text": "If enabled, when a customer authenticates on the checkout, this coupon will automatically apply if the above two customer restrictions are met.",
650
+ "checked": "Yes",
651
+ "unchecked": "No"
652
+ }
653
+ },
650
654
  "taxes": {
651
655
  "label": "Tax settings",
652
656
  "helper_text": "",
@@ -827,6 +827,17 @@
827
827
  "helper_text": "",
828
828
  "checked": "Sent",
829
829
  "unchecked": "Not sent"
830
+ },
831
+ "process-webhook": {
832
+ "idle": "Resend datafeed",
833
+ "busy": "Resending datafeed...",
834
+ "fail": "Failed to resend datafeed",
835
+ "confirm": {
836
+ "header": "Resend datafeed",
837
+ "message": "Are you sure you'd like to resend XML datafeed for this transaction?",
838
+ "confirm": "Yes",
839
+ "cancel": "No"
840
+ }
830
841
  }
831
842
  },
832
843
  "summary": {
@@ -1666,17 +1677,6 @@
1666
1677
  "cancel": "No"
1667
1678
  }
1668
1679
  },
1669
- "resend-datafeed": {
1670
- "idle": "Resend datafeed",
1671
- "busy": "Resending datafeed...",
1672
- "fail": "Failed to resend datafeed",
1673
- "confirm": {
1674
- "header": "Resend datafeed",
1675
- "message": "Are you sure you'd like to resend XML datafeed for this transaction?",
1676
- "confirm": "Yes",
1677
- "cancel": "No"
1678
- }
1679
- },
1680
1680
  "subscription": {
1681
1681
  "caption": "Go to subscription"
1682
1682
  }
@@ -87,6 +87,26 @@ div:has(> select)::after{
87
87
  this._value = newValue;
88
88
  this.__newItem = '';
89
89
  };
90
+ const helperAndError = html `
91
+ <div
92
+ class=${classMap({
93
+ 'transition-colors text-xs mt-xs': true,
94
+ 'text-secondary group-hover-text-body': !isSummaryItem && isInteractive,
95
+ 'text-disabled': !isSummaryItem && this.disabled,
96
+ 'text-secondary': isSummaryItem,
97
+ })}
98
+ ?hidden=${!this.helperText}
99
+ >
100
+ ${this.helperText}
101
+ </div>
102
+
103
+ <div
104
+ class="mt-xs text-xs leading-xs text-error"
105
+ ?hidden=${!this.__isErrorVisible || !this._errorMessage || this.disabled || this.readonly}
106
+ >
107
+ ${this._errorMessage}
108
+ </div>
109
+ `;
90
110
  return html `
91
111
  <div class="group">
92
112
  <div
@@ -101,8 +121,11 @@ div:has(> select)::after{
101
121
  ${this.label}
102
122
  </div>
103
123
 
124
+ ${isSummaryItem ? helperAndError : ''}
125
+
104
126
  <div
105
127
  class=${classMap({
128
+ 'mt-s': isSummaryItem,
106
129
  'transition-colors': true,
107
130
  'border border-contrast-10 rounded': !isSummaryItem,
108
131
  'group-hover-border-contrast-20': !isSummaryItem && isInteractive,
@@ -304,24 +327,7 @@ div:has(> select)::after{
304
327
  </div>
305
328
  </div>
306
329
 
307
- <div
308
- class=${classMap({
309
- 'transition-colors text-xs mt-xs': true,
310
- 'text-secondary group-hover-text-body': !isSummaryItem && isInteractive,
311
- 'text-disabled': !isSummaryItem && this.disabled,
312
- 'text-secondary': isSummaryItem,
313
- })}
314
- ?hidden=${!this.helperText}
315
- >
316
- ${this.helperText}
317
- </div>
318
-
319
- <div
320
- class="mt-xs text-xs leading-xs text-error"
321
- ?hidden=${!this.__isErrorVisible || !this._errorMessage || this.disabled || this.readonly}
322
- >
323
- ${this._errorMessage}
324
- </div>
330
+ ${isSummaryItem ? '' : helperAndError}
325
331
  </div>
326
332
  `;
327
333
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InternalEditableListControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalEditableListControl/InternalEditableListControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,MAAM,OAAO,2BAA4B,SAAQ,uBAAuB;IAAxE;;QAsCE,gBAAW,GAA4B,EAAE,CAAC;QAE1C,YAAO,GAAa,EAAE,CAAC;QAEvB,WAAM,GAAyC,IAAI,CAAC;QAEpD,UAAK,GAAW,EAAE,CAAC;QAEnB,UAAK,GAAsB,IAAI,CAAC;QAExB,qBAAgB,GAAG,KAA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YACvE,eAAe,EAAE,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ;YAChD,gBAAgB,EAAE,aAAa;SAChC,CAAC;oBACQ,CAAC,IAAI,CAAC,UAAU;;YAExB,IAAI,CAAC,UAAU;;;;;oBAKP,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;;YAEvF,IAAI,CAAC,aAAa;;;KAGzB,CAAC;IACJ,CAAC;IAED,IAAc,MAAM;;QAClB,OAAO,OAAC,KAAK,CAAC,MAAM,mCAAI,EAAE,CAAW,CAAC;IACxC,CAAC;IAED,IAAc,MAAM,CAAC,QAAgB;QACnC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;IAC1B,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { Item, Option, Unit } from './types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { html, css } from 'lit-element';\nimport { classMap } from '../../../utils/class-map';\nimport { repeat } from 'lit-html/directives/repeat';\nimport { spread } from '@open-wc/lit-helpers';\nimport { live } from 'lit-html/directives/live';\n\nexport class InternalEditableListControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n inputParams: { attribute: false },\n options: { type: Array },\n layout: {},\n units: { type: Array },\n range: {},\n __isErrorVisible: { attribute: false },\n __newItem: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n div:has(> select) {\n position: relative;\n }\n\n div:has(> select)::after {\n content: ' ';\n position: absolute;\n top: 50%;\n margin-top: -2px;\n right: 10px;\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid currentColor;\n }\n `,\n ];\n }\n\n inputParams: Record<string, unknown> = {};\n\n options: Option[] = [];\n\n layout: 'standalone' | 'summary-item' | null = null;\n\n units: Unit[] = [];\n\n range: null | 'optional' = null;\n\n private __isErrorVisible = false;\n\n private __newItem = '';\n\n render(): TemplateResult {\n const isSummaryItem = this.layout === 'summary-item';\n const isInteractive = !this.disabled && !this.readonly;\n\n const deleteButtonClass = classMap({\n 'w-xs h-xs rounded-s transition-colors flex-shrink-0': true,\n 'focus-outline-none focus-ring-2 ring-inset ring-error-50': true,\n 'text-tertiary hover-bg-error-10 hover-text-error': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n 'flex items-center justify-center': !this.readonly,\n 'hidden': this.readonly,\n 'mr-xs': !isSummaryItem,\n });\n\n const itemClass = classMap({\n 'transition-colors flex items-center': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'group-hover-divide-contrast-20': !isSummaryItem && isInteractive,\n 'pl-s border border-contrast-10 rounded-s': isSummaryItem,\n 'ml-s h-m': !isSummaryItem,\n });\n\n const isAddButtonDisabled = this.disabled || !this.__newItem;\n\n const addItem = () => {\n const newValue = [...this._value];\n const unit = this.renderRoot.querySelector('select')?.value;\n\n this.__newItem\n .split('\\n')\n .map(code => code.trim())\n .filter(code => code.length > 0)\n .forEach(value => {\n if (!newValue.some(item => item.value === value)) {\n newValue.push({ value, unit });\n }\n });\n\n this._value = newValue;\n this.__newItem = '';\n };\n\n return html`\n <div class=\"group\">\n <div\n class=${classMap({\n 'transition-colors mb-xs': true,\n 'text-secondary group-hover-text-body': !isSummaryItem && isInteractive,\n 'text-disabled': !isSummaryItem && this.disabled,\n 'font-medium text-s': !isSummaryItem,\n 'text-m': isSummaryItem,\n })}\n >\n ${this.label}\n </div>\n\n <div\n class=${classMap({\n 'transition-colors': true,\n 'border border-contrast-10 rounded': !isSummaryItem,\n 'group-hover-border-contrast-20': !isSummaryItem && isInteractive,\n })}\n >\n <ol\n class=${classMap({\n 'transition-colors font-medium': true,\n 'divide-y divide-contrast-10': !isSummaryItem,\n 'flex flex-wrap gap-s': isSummaryItem,\n })}\n >\n ${repeat(\n this._value,\n item => item.value,\n (item, index) => {\n return html`\n <li class=${itemClass}>\n <div class=\"flex-1 mr-s\">${item.label ?? item.value}</div>\n\n <button\n aria-label=${this.t('delete')}\n class=${deleteButtonClass}\n ?disabled=${this.disabled}\n @click=${() => {\n this._value = this._value.filter((_, i) => i !== index);\n }}\n >\n <iron-icon icon=\"lumo:cross\" class=\"icon-inline text-xl\"></iron-icon>\n </button>\n </li>\n `;\n }\n )}\n </ol>\n\n <div\n style=${isSummaryItem\n ? ''\n : this._value.length === 0\n ? 'border-radius: calc(var(--lumo-border-radius-m) - 1px)'\n : 'border-radius: 0 0 calc(var(--lumo-border-radius-m) - 1px) calc(var(--lumo-border-radius-m) - 1px)'}\n class=${classMap({\n 'transition-colors pl-s h-m flex items-center gap-xs': true,\n 'focus-within-ring-2 focus-within-ring-primary-50': !isSummaryItem,\n 'bg-contrast-10 group-hover-bg-contrast-20': !isSummaryItem && isInteractive,\n 'bg-contrast-5': !isSummaryItem && this.disabled,\n 'flex': !this.readonly,\n 'hidden': this.readonly,\n 'rounded-s border border-contrast-10': isSummaryItem,\n 'mt-s': isSummaryItem && this._value.length > 0,\n })}\n >\n ${this.range\n ? html`\n <foxy-i18n infer=\"\" class=\"text-disabled font-medium\" key=\"range_from\">\n </foxy-i18n>\n\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'bg-transparent appearance-none h-m font-medium focus-outline-none': true,\n 'text-disabled': this.disabled,\n })}\n list=\"list\"\n ...=${spread(this.inputParams)}\n .value=${live(this.__newItem.split('..')[0] ?? '')}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addItem()}\n @change=${(evt: Event) => evt.stopPropagation()}\n @input=${(evt: InputEvent) => {\n const newFrom = (evt.currentTarget as HTMLInputElement).value.trim();\n const oldTo = this.__newItem.split('..')[1] ?? '';\n this.__newItem = oldTo ? `${newFrom}..${oldTo}` : newFrom;\n }}\n @paste=${(evt: ClipboardEvent) => {\n evt.preventDefault();\n\n const newFrom = evt.clipboardData?.getData('text') ?? '';\n const oldTo = this.__newItem.split('..')[1] ?? '';\n this.__newItem = oldTo ? `${newFrom}..${oldTo}` : newFrom;\n\n addItem();\n }}\n @blur=${() => {\n this.__isErrorVisible = true;\n }}\n />\n\n <foxy-i18n infer=\"\" class=\"text-disabled font-medium\" key=\"range_to\"></foxy-i18n>\n\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'bg-transparent appearance-none h-m font-medium focus-outline-none': true,\n 'text-disabled': this.disabled,\n })}\n list=\"list\"\n ...=${spread(this.inputParams)}\n .value=${live(this.__newItem.split('..')[1] ?? '')}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addItem()}\n @change=${(evt: Event) => evt.stopPropagation()}\n @input=${(evt: InputEvent) => {\n const newTo = (evt.currentTarget as HTMLInputElement).value.trim();\n const oldFrom = this.__newItem.split('..')[0] ?? '';\n this.__newItem = oldFrom ? `${oldFrom}..${newTo}` : newTo;\n }}\n @paste=${(evt: ClipboardEvent) => {\n evt.preventDefault();\n\n const newTo = evt.clipboardData?.getData('text') ?? '';\n const oldFrom = this.__newItem.split('..')[0] ?? '';\n this.__newItem = oldFrom ? `${oldFrom}..${newTo}` : newTo;\n\n addItem();\n }}\n @blur=${() => {\n this.__isErrorVisible = true;\n }}\n />\n `\n : html`\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'w-full bg-transparent appearance-none h-m font-medium focus-outline-none':\n true,\n 'text-disabled': this.disabled,\n })}\n list=\"list\"\n ...=${spread(this.inputParams)}\n .value=${live(this.__newItem)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addItem()}\n @change=${(evt: Event) => evt.stopPropagation()}\n @input=${(evt: InputEvent) => {\n this.__newItem = (evt.currentTarget as HTMLInputElement).value.trim();\n }}\n @paste=${(evt: ClipboardEvent) => {\n evt.preventDefault();\n this.__newItem = evt.clipboardData?.getData('text') ?? '';\n addItem();\n }}\n @blur=${() => {\n this.__isErrorVisible = true;\n }}\n />\n `}\n\n <div\n class=${classMap({\n 'relative': true,\n 'hover-text-base focus-within-text-primary-contrast': !this.disabled,\n 'text-disabled': this.disabled,\n })}\n ?hidden=${this.units.length === 0}\n >\n <select\n style=\"min-width: 8rem\"\n class=${classMap({\n 'transition-colors rounded-s mx-xs px-s': true,\n 'bg-contrast-5 appearance-none h-xs font-medium focus-outline-none': true,\n 'hover-bg-contrast focus-bg-primary': !this.disabled,\n })}\n ?disabled=${this.disabled}\n >\n ${this.units.map(({ label, value }) => {\n return html`<option value=${value}>${label ?? value}</option>`;\n })}\n </select>\n </div>\n\n <datalist id=\"list\">\n ${this.options.map(({ label, value }) => {\n if (this._value.some(item => item.value === value)) return;\n return html`<option value=${value}>${label ?? value}</option>`;\n })}\n </datalist>\n\n <div class=\"mr-xs ml-auto\" ?hidden=${!this.__newItem}>\n <button\n aria-label=${this.t('submit')}\n class=${classMap({\n 'w-xs h-xs flex-shrink-0 ring-inset ring-success-50 focus-outline-none': true,\n 'flex items-center justify-center rounded-s transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': isAddButtonDisabled,\n 'bg-contrast-5 text-body cursor-pointer': !isAddButtonDisabled,\n 'hover-bg-success hover-text-success-contrast': !isAddButtonDisabled,\n 'focus-ring-2': !isAddButtonDisabled,\n })}\n ?disabled=${isAddButtonDisabled}\n @click=${addItem}\n >\n <iron-icon icon=\"lumo:plus\" class=\"icon-inline text-l\"></iron-icon>\n </button>\n </div>\n </div>\n </div>\n\n <div\n class=${classMap({\n 'transition-colors text-xs mt-xs': true,\n 'text-secondary group-hover-text-body': !isSummaryItem && isInteractive,\n 'text-disabled': !isSummaryItem && this.disabled,\n 'text-secondary': isSummaryItem,\n })}\n ?hidden=${!this.helperText}\n >\n ${this.helperText}\n </div>\n\n <div\n class=\"mt-xs text-xs leading-xs text-error\"\n ?hidden=${!this.__isErrorVisible || !this._errorMessage || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </div>\n </div>\n `;\n }\n\n protected get _value(): Item[] {\n return (super._value ?? []) as Item[];\n }\n\n protected set _value(newValue: Item[]) {\n super._value = newValue;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalEditableListControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalEditableListControl/InternalEditableListControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,MAAM,OAAO,2BAA4B,SAAQ,uBAAuB;IAAxE;;QAsCE,gBAAW,GAA4B,EAAE,CAAC;QAE1C,YAAO,GAAa,EAAE,CAAC;QAEvB,WAAM,GAAyC,IAAI,CAAC;QAEpD,UAAK,GAAW,EAAE,CAAC;QAEnB,UAAK,GAAsB,IAAI,CAAC;QAExB,qBAAgB,GAAG,KAAK,CAAC;QAEzB,cAAS,GAAG,EAAE,CAAC;IA4SzB,CAAC;IA7VC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YACjC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YACxB,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YACtB,KAAK,EAAE,EAAE;YACT,gBAAgB,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YACtC,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SAChC,CAAC;IACJ,CAAC;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;UAQtB,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc;;KAExC,CAAC;IACJ,CAAC;IAED,IAAc,MAAM;;QAClB,OAAO,OAAC,KAAK,CAAC,MAAM,mCAAI,EAAE,CAAW,CAAC;IACxC,CAAC;IAED,IAAc,MAAM,CAAC,QAAgB;QACnC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;IAC1B,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { Item, Option, Unit } from './types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { html, css } from 'lit-element';\nimport { classMap } from '../../../utils/class-map';\nimport { repeat } from 'lit-html/directives/repeat';\nimport { spread } from '@open-wc/lit-helpers';\nimport { live } from 'lit-html/directives/live';\n\nexport class InternalEditableListControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n inputParams: { attribute: false },\n options: { type: Array },\n layout: {},\n units: { type: Array },\n range: {},\n __isErrorVisible: { attribute: false },\n __newItem: { attribute: false },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n ...super.styles,\n css`\n div:has(> select) {\n position: relative;\n }\n\n div:has(> select)::after {\n content: ' ';\n position: absolute;\n top: 50%;\n margin-top: -2px;\n right: 10px;\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid currentColor;\n }\n `,\n ];\n }\n\n inputParams: Record<string, unknown> = {};\n\n options: Option[] = [];\n\n layout: 'standalone' | 'summary-item' | null = null;\n\n units: Unit[] = [];\n\n range: null | 'optional' = null;\n\n private __isErrorVisible = false;\n\n private __newItem = '';\n\n render(): TemplateResult {\n const isSummaryItem = this.layout === 'summary-item';\n const isInteractive = !this.disabled && !this.readonly;\n\n const deleteButtonClass = classMap({\n 'w-xs h-xs rounded-s transition-colors flex-shrink-0': true,\n 'focus-outline-none focus-ring-2 ring-inset ring-error-50': true,\n 'text-tertiary hover-bg-error-10 hover-text-error': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n 'flex items-center justify-center': !this.readonly,\n 'hidden': this.readonly,\n 'mr-xs': !isSummaryItem,\n });\n\n const itemClass = classMap({\n 'transition-colors flex items-center': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'group-hover-divide-contrast-20': !isSummaryItem && isInteractive,\n 'pl-s border border-contrast-10 rounded-s': isSummaryItem,\n 'ml-s h-m': !isSummaryItem,\n });\n\n const isAddButtonDisabled = this.disabled || !this.__newItem;\n\n const addItem = () => {\n const newValue = [...this._value];\n const unit = this.renderRoot.querySelector('select')?.value;\n\n this.__newItem\n .split('\\n')\n .map(code => code.trim())\n .filter(code => code.length > 0)\n .forEach(value => {\n if (!newValue.some(item => item.value === value)) {\n newValue.push({ value, unit });\n }\n });\n\n this._value = newValue;\n this.__newItem = '';\n };\n\n const helperAndError = html`\n <div\n class=${classMap({\n 'transition-colors text-xs mt-xs': true,\n 'text-secondary group-hover-text-body': !isSummaryItem && isInteractive,\n 'text-disabled': !isSummaryItem && this.disabled,\n 'text-secondary': isSummaryItem,\n })}\n ?hidden=${!this.helperText}\n >\n ${this.helperText}\n </div>\n\n <div\n class=\"mt-xs text-xs leading-xs text-error\"\n ?hidden=${!this.__isErrorVisible || !this._errorMessage || this.disabled || this.readonly}\n >\n ${this._errorMessage}\n </div>\n `;\n\n return html`\n <div class=\"group\">\n <div\n class=${classMap({\n 'transition-colors mb-xs': true,\n 'text-secondary group-hover-text-body': !isSummaryItem && isInteractive,\n 'text-disabled': !isSummaryItem && this.disabled,\n 'font-medium text-s': !isSummaryItem,\n 'text-m': isSummaryItem,\n })}\n >\n ${this.label}\n </div>\n\n ${isSummaryItem ? helperAndError : ''}\n\n <div\n class=${classMap({\n 'mt-s': isSummaryItem,\n 'transition-colors': true,\n 'border border-contrast-10 rounded': !isSummaryItem,\n 'group-hover-border-contrast-20': !isSummaryItem && isInteractive,\n })}\n >\n <ol\n class=${classMap({\n 'transition-colors font-medium': true,\n 'divide-y divide-contrast-10': !isSummaryItem,\n 'flex flex-wrap gap-s': isSummaryItem,\n })}\n >\n ${repeat(\n this._value,\n item => item.value,\n (item, index) => {\n return html`\n <li class=${itemClass}>\n <div class=\"flex-1 mr-s\">${item.label ?? item.value}</div>\n\n <button\n aria-label=${this.t('delete')}\n class=${deleteButtonClass}\n ?disabled=${this.disabled}\n @click=${() => {\n this._value = this._value.filter((_, i) => i !== index);\n }}\n >\n <iron-icon icon=\"lumo:cross\" class=\"icon-inline text-xl\"></iron-icon>\n </button>\n </li>\n `;\n }\n )}\n </ol>\n\n <div\n style=${isSummaryItem\n ? ''\n : this._value.length === 0\n ? 'border-radius: calc(var(--lumo-border-radius-m) - 1px)'\n : 'border-radius: 0 0 calc(var(--lumo-border-radius-m) - 1px) calc(var(--lumo-border-radius-m) - 1px)'}\n class=${classMap({\n 'transition-colors pl-s h-m flex items-center gap-xs': true,\n 'focus-within-ring-2 focus-within-ring-primary-50': !isSummaryItem,\n 'bg-contrast-10 group-hover-bg-contrast-20': !isSummaryItem && isInteractive,\n 'bg-contrast-5': !isSummaryItem && this.disabled,\n 'flex': !this.readonly,\n 'hidden': this.readonly,\n 'rounded-s border border-contrast-10': isSummaryItem,\n 'mt-s': isSummaryItem && this._value.length > 0,\n })}\n >\n ${this.range\n ? html`\n <foxy-i18n infer=\"\" class=\"text-disabled font-medium\" key=\"range_from\">\n </foxy-i18n>\n\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'bg-transparent appearance-none h-m font-medium focus-outline-none': true,\n 'text-disabled': this.disabled,\n })}\n list=\"list\"\n ...=${spread(this.inputParams)}\n .value=${live(this.__newItem.split('..')[0] ?? '')}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addItem()}\n @change=${(evt: Event) => evt.stopPropagation()}\n @input=${(evt: InputEvent) => {\n const newFrom = (evt.currentTarget as HTMLInputElement).value.trim();\n const oldTo = this.__newItem.split('..')[1] ?? '';\n this.__newItem = oldTo ? `${newFrom}..${oldTo}` : newFrom;\n }}\n @paste=${(evt: ClipboardEvent) => {\n evt.preventDefault();\n\n const newFrom = evt.clipboardData?.getData('text') ?? '';\n const oldTo = this.__newItem.split('..')[1] ?? '';\n this.__newItem = oldTo ? `${newFrom}..${oldTo}` : newFrom;\n\n addItem();\n }}\n @blur=${() => {\n this.__isErrorVisible = true;\n }}\n />\n\n <foxy-i18n infer=\"\" class=\"text-disabled font-medium\" key=\"range_to\"></foxy-i18n>\n\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'bg-transparent appearance-none h-m font-medium focus-outline-none': true,\n 'text-disabled': this.disabled,\n })}\n list=\"list\"\n ...=${spread(this.inputParams)}\n .value=${live(this.__newItem.split('..')[1] ?? '')}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addItem()}\n @change=${(evt: Event) => evt.stopPropagation()}\n @input=${(evt: InputEvent) => {\n const newTo = (evt.currentTarget as HTMLInputElement).value.trim();\n const oldFrom = this.__newItem.split('..')[0] ?? '';\n this.__newItem = oldFrom ? `${oldFrom}..${newTo}` : newTo;\n }}\n @paste=${(evt: ClipboardEvent) => {\n evt.preventDefault();\n\n const newTo = evt.clipboardData?.getData('text') ?? '';\n const oldFrom = this.__newItem.split('..')[0] ?? '';\n this.__newItem = oldFrom ? `${oldFrom}..${newTo}` : newTo;\n\n addItem();\n }}\n @blur=${() => {\n this.__isErrorVisible = true;\n }}\n />\n `\n : html`\n <input\n placeholder=${this.placeholder}\n class=${classMap({\n 'w-full bg-transparent appearance-none h-m font-medium focus-outline-none':\n true,\n 'text-disabled': this.disabled,\n })}\n list=\"list\"\n ...=${spread(this.inputParams)}\n .value=${live(this.__newItem)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addItem()}\n @change=${(evt: Event) => evt.stopPropagation()}\n @input=${(evt: InputEvent) => {\n this.__newItem = (evt.currentTarget as HTMLInputElement).value.trim();\n }}\n @paste=${(evt: ClipboardEvent) => {\n evt.preventDefault();\n this.__newItem = evt.clipboardData?.getData('text') ?? '';\n addItem();\n }}\n @blur=${() => {\n this.__isErrorVisible = true;\n }}\n />\n `}\n\n <div\n class=${classMap({\n 'relative': true,\n 'hover-text-base focus-within-text-primary-contrast': !this.disabled,\n 'text-disabled': this.disabled,\n })}\n ?hidden=${this.units.length === 0}\n >\n <select\n style=\"min-width: 8rem\"\n class=${classMap({\n 'transition-colors rounded-s mx-xs px-s': true,\n 'bg-contrast-5 appearance-none h-xs font-medium focus-outline-none': true,\n 'hover-bg-contrast focus-bg-primary': !this.disabled,\n })}\n ?disabled=${this.disabled}\n >\n ${this.units.map(({ label, value }) => {\n return html`<option value=${value}>${label ?? value}</option>`;\n })}\n </select>\n </div>\n\n <datalist id=\"list\">\n ${this.options.map(({ label, value }) => {\n if (this._value.some(item => item.value === value)) return;\n return html`<option value=${value}>${label ?? value}</option>`;\n })}\n </datalist>\n\n <div class=\"mr-xs ml-auto\" ?hidden=${!this.__newItem}>\n <button\n aria-label=${this.t('submit')}\n class=${classMap({\n 'w-xs h-xs flex-shrink-0 ring-inset ring-success-50 focus-outline-none': true,\n 'flex items-center justify-center rounded-s transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': isAddButtonDisabled,\n 'bg-contrast-5 text-body cursor-pointer': !isAddButtonDisabled,\n 'hover-bg-success hover-text-success-contrast': !isAddButtonDisabled,\n 'focus-ring-2': !isAddButtonDisabled,\n })}\n ?disabled=${isAddButtonDisabled}\n @click=${addItem}\n >\n <iron-icon icon=\"lumo:plus\" class=\"icon-inline text-l\"></iron-icon>\n </button>\n </div>\n </div>\n </div>\n\n ${isSummaryItem ? '' : helperAndError}\n </div>\n `;\n }\n\n protected get _value(): Item[] {\n return (super._value ?? []) as Item[];\n }\n\n protected set _value(newValue: Item[]) {\n super._value = newValue;\n }\n}\n"]}
@@ -6,5 +6,6 @@ export declare class InternalQueryBuilderControl extends InternalEditableControl
6
6
  static get properties(): PropertyDeclarations;
7
7
  operators: Operator[];
8
8
  disableOr: boolean;
9
+ layout: 'standalone' | 'summary-item' | null;
9
10
  renderControl(): TemplateResult;
10
11
  }
@@ -7,43 +7,65 @@ export class InternalQueryBuilderControl extends InternalEditableControl {
7
7
  super(...arguments);
8
8
  this.operators = Object.values(Operator);
9
9
  this.disableOr = false;
10
+ this.layout = null;
10
11
  }
11
12
  static get properties() {
12
13
  return {
13
14
  ...super.properties,
14
15
  operators: { type: Array },
15
16
  disableOr: { type: Boolean, attribute: 'disable-or' },
17
+ layout: {},
16
18
  };
17
19
  }
18
20
  renderControl() {
21
+ var _a;
19
22
  const { label, helperText, _errorMessage: error } = this;
20
23
  const showError = error && !this.disabled && !this.readonly;
24
+ const layout = (_a = this.layout) !== null && _a !== void 0 ? _a : 'standalone';
25
+ const builder = html `
26
+ <foxy-query-builder
27
+ infer="query-builder"
28
+ class=${classMap({ 'mt-xs': layout === 'summary-item' })}
29
+ style=${layout === 'summary-item'
30
+ ? '--lumo-border-radius: var(--lumo-border-radius-s)'
31
+ : ''}
32
+ .operators=${this.operators}
33
+ .value=${this._value}
34
+ ?disable-or=${this.disableOr}
35
+ @change=${(evt) => {
36
+ var _a;
37
+ const queryBuilder = evt.currentTarget;
38
+ this._value = (_a = queryBuilder.value) !== null && _a !== void 0 ? _a : '';
39
+ }}
40
+ >
41
+ </foxy-query-builder>
42
+ `;
21
43
  return html `
22
44
  <section
23
45
  class=${classMap({
24
- 'grid gap-xs leading-xs transition-colors': true,
25
- 'text-secondary hover-text-body': !this.disabled && !this.readonly,
46
+ 'grid gap-xs leading-xs transition-colors text-secondary': true,
47
+ 'hover-text-body': layout === 'standalone' && !this.disabled && !this.readonly,
26
48
  'text-disabled': this.disabled,
27
49
  'text-body': this.readonly,
28
50
  })}
29
51
  >
30
- ${label ? html `<p class="text-s font-medium">${label}</p>` : ''}
31
-
32
- <foxy-query-builder
33
- infer="query-builder"
34
- .operators=${this.operators}
35
- .value=${this._value}
36
- ?disable-or=${this.disableOr}
37
- @change=${(evt) => {
38
- var _a;
39
- const queryBuilder = evt.currentTarget;
40
- this._value = (_a = queryBuilder.value) !== null && _a !== void 0 ? _a : '';
41
- }}
42
- >
43
- </foxy-query-builder>
44
-
52
+ ${label
53
+ ? html `
54
+ <p
55
+ class=${classMap({
56
+ 'text-s font-medium': layout === 'standalone',
57
+ 'text-m text-body': layout === 'summary-item',
58
+ 'hidden': !label,
59
+ })}
60
+ >
61
+ ${label}
62
+ </p>
63
+ `
64
+ : ''}
65
+ ${layout === 'standalone' ? builder : ''}
45
66
  ${helperText ? html `<p class="text-xs">${helperText}</p>` : ''}
46
67
  ${showError ? html `<p class="text-xs text-error">${error}</p>` : ''}
68
+ ${layout === 'summary-item' ? builder : ''}
47
69
  </section>
48
70
  `;
49
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InternalQueryBuilderControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,QAAQ,EAAE,2CAAwC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,2BAA4B,SAAQ,uBAAuB;IAAxE;;QASE,cAAS,GAAe,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEhD,cAAS,GAAG,KAAK,CAAC;IAkCpB,CAAC;IA5CC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,SAAS,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YAC1B,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE;SACtD,CAAC;IACJ,CAAC;IAMD,aAAa;QACX,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QACzD,MAAM,SAAS,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QAE5D,OAAO,IAAI,CAAA;;gBAEC,QAAQ,CAAC;YACf,0CAA0C,EAAE,IAAI;YAChD,gCAAgC,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ;YAClE,eAAe,EAAE,IAAI,CAAC,QAAQ;YAC9B,WAAW,EAAE,IAAI,CAAC,QAAQ;SAC3B,CAAC;;UAEA,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,iCAAiC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE;;;;uBAIhD,IAAI,CAAC,SAAS;mBAClB,IAAI,CAAC,MAAM;wBACN,IAAI,CAAC,SAAS;oBAClB,CAAC,GAAgB,EAAE,EAAE;;YAC7B,MAAM,YAAY,GAAG,GAAG,CAAC,aAA6B,CAAC;YACvD,IAAI,CAAC,MAAM,SAAG,YAAY,CAAC,KAAK,mCAAI,EAAE,CAAC;QACzC,CAAC;;;;UAID,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,UAAU,MAAM,CAAC,CAAC,CAAC,EAAE;UAC5D,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA,iCAAiC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE;;KAEtE,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { QueryBuilder } from '../../public/QueryBuilder/QueryBuilder';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { Operator } from '../../public/QueryBuilder/types';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\nexport class InternalQueryBuilderControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n operators: { type: Array },\n disableOr: { type: Boolean, attribute: 'disable-or' },\n };\n }\n\n operators: Operator[] = Object.values(Operator);\n\n disableOr = false;\n\n renderControl(): TemplateResult {\n const { label, helperText, _errorMessage: error } = this;\n const showError = error && !this.disabled && !this.readonly;\n\n return html`\n <section\n class=${classMap({\n 'grid gap-xs leading-xs transition-colors': true,\n 'text-secondary hover-text-body': !this.disabled && !this.readonly,\n 'text-disabled': this.disabled,\n 'text-body': this.readonly,\n })}\n >\n ${label ? html`<p class=\"text-s font-medium\">${label}</p>` : ''}\n\n <foxy-query-builder\n infer=\"query-builder\"\n .operators=${this.operators}\n .value=${this._value}\n ?disable-or=${this.disableOr}\n @change=${(evt: CustomEvent) => {\n const queryBuilder = evt.currentTarget as QueryBuilder;\n this._value = queryBuilder.value ?? '';\n }}\n >\n </foxy-query-builder>\n\n ${helperText ? html`<p class=\"text-xs\">${helperText}</p>` : ''}\n ${showError ? html`<p class=\"text-xs text-error\">${error}</p>` : ''}\n </section>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalQueryBuilderControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,QAAQ,EAAE,2CAAwC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,2BAA4B,SAAQ,uBAAuB;IAAxE;;QAUE,cAAS,GAAe,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEhD,cAAS,GAAG,KAAK,CAAC;QAElB,WAAM,GAAyC,IAAI,CAAC;IAqDtD,CAAC;IAlEC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;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BAC7C,kBAAkB,EAAE,MAAM,KAAK,cAAc;gBAC7C,QAAQ,EAAE,CAAC,KAAK;aACjB,CAAC;;kBAEA,KAAK;;aAEV;YACH,CAAC,CAAC,EAAE;UACJ,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;UACtC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,UAAU,MAAM,CAAC,CAAC,CAAC,EAAE;UAC5D,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA,iCAAiC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE;UACjE,MAAM,KAAK,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;;KAE7C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { QueryBuilder } from '../../public/QueryBuilder/QueryBuilder';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { Operator } from '../../public/QueryBuilder/types';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\nexport class InternalQueryBuilderControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n operators: { type: Array },\n disableOr: { type: Boolean, attribute: 'disable-or' },\n layout: {},\n };\n }\n\n operators: Operator[] = Object.values(Operator);\n\n disableOr = false;\n\n layout: 'standalone' | 'summary-item' | null = null;\n\n renderControl(): TemplateResult {\n const { label, helperText, _errorMessage: error } = this;\n const showError = error && !this.disabled && !this.readonly;\n const layout = this.layout ?? 'standalone';\n const builder = html`\n <foxy-query-builder\n infer=\"query-builder\"\n class=${classMap({ 'mt-xs': layout === 'summary-item' })}\n style=${layout === 'summary-item'\n ? '--lumo-border-radius: var(--lumo-border-radius-s)'\n : ''}\n .operators=${this.operators}\n .value=${this._value}\n ?disable-or=${this.disableOr}\n @change=${(evt: CustomEvent) => {\n const queryBuilder = evt.currentTarget as QueryBuilder;\n this._value = queryBuilder.value ?? '';\n }}\n >\n </foxy-query-builder>\n `;\n\n return html`\n <section\n class=${classMap({\n 'grid gap-xs leading-xs transition-colors text-secondary': true,\n 'hover-text-body': layout === 'standalone' && !this.disabled && !this.readonly,\n 'text-disabled': this.disabled,\n 'text-body': this.readonly,\n })}\n >\n ${label\n ? html`\n <p\n class=${classMap({\n 'text-s font-medium': layout === 'standalone',\n 'text-m text-body': layout === 'summary-item',\n 'hidden': !label,\n })}\n >\n ${label}\n </p>\n `\n : ''}\n ${layout === 'standalone' ? builder : ''}\n ${helperText ? html`<p class=\"text-xs\">${helperText}</p>` : ''}\n ${showError ? html`<p class=\"text-xs text-error\">${error}</p>` : ''}\n ${layout === 'summary-item' ? builder : ''}\n </section>\n `;\n }\n}\n"]}
@@ -201,18 +201,6 @@ export class CouponForm extends Base {
201
201
  >
202
202
  </foxy-internal-async-list-control>
203
203
 
204
- <foxy-internal-query-builder-control
205
- infer="item-option-restrictions"
206
- disable-or
207
- .operators=${this.__itemOptionRestrictionsOperators}
208
- .getValue=${this.__itemOptionRestrictionsGetValue}
209
- .setValue=${this.__itemOptionRestrictionsSetValue}
210
- >
211
- </foxy-internal-query-builder-control>
212
-
213
- <foxy-internal-query-builder-control infer="customer-attribute-restrictions">
214
- </foxy-internal-query-builder-control>
215
-
216
204
  <foxy-internal-editable-list-control
217
205
  infer="product-code-restrictions"
218
206
  .getValue=${this.__productCodeRestrictionsGetValue}
@@ -224,12 +212,32 @@ export class CouponForm extends Base {
224
212
  >
225
213
  </foxy-internal-editable-list-control>
226
214
 
227
- <foxy-internal-editable-list-control
228
- infer="customer-subscription-restrictions"
229
- .getValue=${this.__customerSubscriptionRestrictionsGetValue}
230
- .setValue=${this.__customerSubscriptionRestrictionsSetValue}
215
+ <foxy-internal-query-builder-control
216
+ infer="item-option-restrictions"
217
+ disable-or
218
+ .operators=${this.__itemOptionRestrictionsOperators}
219
+ .getValue=${this.__itemOptionRestrictionsGetValue}
220
+ .setValue=${this.__itemOptionRestrictionsSetValue}
231
221
  >
232
- </foxy-internal-editable-list-control>
222
+ </foxy-internal-query-builder-control>
223
+
224
+ <foxy-internal-summary-control infer="customer-restrictions">
225
+ <foxy-internal-query-builder-control
226
+ layout="summary-item"
227
+ infer="customer-attribute-restrictions"
228
+ >
229
+ </foxy-internal-query-builder-control>
230
+
231
+ <foxy-internal-editable-list-control
232
+ layout="summary-item"
233
+ infer="customer-subscription-restrictions"
234
+ .getValue=${this.__customerSubscriptionRestrictionsGetValue}
235
+ .setValue=${this.__customerSubscriptionRestrictionsSetValue}
236
+ >
237
+ </foxy-internal-editable-list-control>
238
+
239
+ <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control>
240
+ </foxy-internal-summary-control>
233
241
 
234
242
  <foxy-internal-async-resource-link-list-control
235
243
  foreign-key-for-uri="item_category_uri"
@@ -297,7 +305,6 @@ export class CouponForm extends Base {
297
305
  </foxy-internal-switch-control>
298
306
  <foxy-internal-switch-control infer="is-taxable"></foxy-internal-switch-control>
299
307
  <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control>
300
- <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control>
301
308
  </foxy-internal-summary-control>
302
309
 
303
310
  <foxy-internal-async-list-control