@foxy.io/elements 1.18.0-beta.17 → 1.18.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.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-i18n-editor.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.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-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-report-form.js +2 -2
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-sign-in-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-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -0
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-card.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-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-e119731e.js → shared-07fb5be2.js} +1 -1
- package/dist/cdn/{shared-4c338ca6.js → shared-17d24760.js} +1 -1
- package/dist/cdn/{shared-e3ce88dc.js → shared-196fa627.js} +21 -11
- package/dist/cdn/{shared-40537775.js → shared-1f0841ec.js} +1 -1
- package/dist/cdn/{shared-71deb26e.js → shared-210387cb.js} +1 -1
- package/dist/cdn/shared-222fe491.js +1 -0
- package/dist/cdn/shared-262caea4.js +1 -0
- package/dist/cdn/{shared-74277a73.js → shared-344485cf.js} +5 -5
- package/dist/cdn/shared-4308cdab.js +1 -0
- package/dist/cdn/{shared-6003864d.js → shared-5643d0ed.js} +1 -1
- package/dist/cdn/{shared-29376ba1.js → shared-56d26968.js} +1 -1
- package/dist/cdn/{shared-facfe95a.js → shared-62c8cfa2.js} +4 -4
- package/dist/cdn/{shared-2f1e04ae.js → shared-6b622399.js} +1 -1
- package/dist/cdn/{shared-cfec6ec1.js → shared-8a5bdad3.js} +7 -7
- package/dist/cdn/{shared-8d533e0c.js → shared-98652709.js} +1 -1
- package/dist/cdn/{shared-ad8141c4.js → shared-aebbceea.js} +1 -1
- package/dist/cdn/shared-b0a6d48f.js +1 -0
- package/dist/cdn/{shared-7661b51a.js → shared-b0ff4590.js} +1 -1
- package/dist/cdn/{shared-6e6ed30a.js → shared-b7219771.js} +1 -1
- package/dist/cdn/{shared-a46a2f49.js → shared-ce1ae7e1.js} +1 -1
- package/dist/cdn/{shared-cced7800.js → shared-d5f242df.js} +1 -1
- package/dist/cdn/shared-da6cc488.js +1 -0
- package/dist/cdn/{shared-6bf8883f.js → shared-e08bcb6c.js} +1 -1
- package/dist/cdn/{shared-4457dc27.js → shared-fdac2851.js} +1 -1
- package/dist/cdn/translations/email-template-card/en.json +1 -1
- package/dist/cdn/translations/subscription-settings-form/en.json +92 -0
- package/dist/elements/internal/InternalDeleteControl/InternalDeleteControl.js +1 -1
- package/dist/elements/internal/InternalDeleteControl/InternalDeleteControl.js.map +1 -1
- package/dist/elements/internal/InternalEditableControl/InternalEditableControl.d.ts +1 -0
- package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js +18 -0
- package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js.map +1 -1
- package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.d.ts +1 -0
- package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js +15 -6
- package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map +1 -1
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.d.ts +2 -0
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js +6 -0
- package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js.map +1 -1
- package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js +32 -4
- package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js.map +1 -1
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.d.ts +1 -3
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js +16 -30
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js.map +1 -1
- package/dist/elements/internal/InternalSelectControl/index.d.ts +1 -1
- package/dist/elements/internal/InternalSelectControl/index.js +1 -1
- package/dist/elements/internal/InternalSelectControl/index.js.map +1 -1
- package/dist/elements/public/AddressForm/AddressForm.js +1 -1
- package/dist/elements/public/AddressForm/AddressForm.js.map +1 -1
- package/dist/elements/public/AttributeForm/AttributeForm.js +1 -1
- package/dist/elements/public/AttributeForm/AttributeForm.js.map +1 -1
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js +1 -1
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.js +1 -1
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js +1 -1
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js.map +1 -1
- package/dist/elements/public/CustomerForm/CustomerForm.js +1 -1
- package/dist/elements/public/CustomerForm/CustomerForm.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +2 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +1 -1
- package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
- package/dist/elements/public/GiftCardForm/GiftCardForm.js +1 -1
- package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
- package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/InternalGiftCardFormProvisioningControl.d.ts +3 -3
- package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/InternalGiftCardFormProvisioningControl.js +3 -2
- package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/InternalGiftCardFormProvisioningControl.js.map +1 -1
- package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/index.d.ts +1 -1
- package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/index.js +1 -1
- package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.d.ts +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.d.ts +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.d.ts +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.d.ts +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.d.ts +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.d.ts +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.js +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.d.ts +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.d.ts +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.d.ts +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js +2 -2
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js.map +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.d.ts +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js +1 -1
- package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js.map +1 -1
- package/dist/elements/public/NucleonElement/NucleonElement.d.ts +2 -0
- package/dist/elements/public/NucleonElement/NucleonElement.js +30 -0
- package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
- package/dist/elements/public/ReportForm/ReportForm.js +1 -1
- package/dist/elements/public/ReportForm/ReportForm.js.map +1 -1
- package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.d.ts +33 -0
- package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.js +208 -0
- package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.js.map +1 -0
- package/dist/elements/public/SubscriptionSettingsForm/index.d.ts +9 -0
- package/dist/elements/public/SubscriptionSettingsForm/index.js +11 -0
- package/dist/elements/public/SubscriptionSettingsForm/index.js.map +1 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.d.ts +12 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.js +128 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.js.map +1 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.d.ts +2 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.js +26 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.js.map +1 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.d.ts +6 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.js +12 -0
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.js.map +1 -0
- package/dist/elements/public/SubscriptionSettingsForm/types.d.ts +3 -0
- package/dist/elements/public/SubscriptionSettingsForm/types.js +2 -0
- package/dist/elements/public/SubscriptionSettingsForm/types.js.map +1 -0
- package/dist/elements/public/TaxForm/TaxForm.js +1 -1
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.js +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
- package/dist/elements/public/UserForm/UserForm.js +1 -1
- package/dist/elements/public/UserForm/UserForm.js.map +1 -1
- package/dist/elements/public/index.d.ts +1 -0
- package/dist/elements/public/index.defined.d.ts +1 -0
- package/dist/elements/public/index.defined.js +1 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +1 -0
- package/dist/elements/public/index.js.map +1 -1
- package/dist/mixins/themeable.js +13 -7164
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-40d82f6b.js +0 -1
- package/dist/cdn/shared-5504f415.js +0 -11
- package/dist/cdn/shared-92bd849f.js +0 -1
- package/dist/cdn/shared-b7423eab.js +0 -1
- package/dist/cdn/shared-bd194cdf.js +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"day": "{{ count }} day",
|
|
3
|
+
"day_plural": "{{ count }} days",
|
|
4
|
+
"day_suffix": "day",
|
|
5
|
+
"day_suffix_plural": "days",
|
|
6
|
+
"modification-url": {
|
|
7
|
+
"label": "Modification URL",
|
|
8
|
+
"placeholder": "https://example.com/edit-subscription",
|
|
9
|
+
"helper_text": "Enter a full URL or a path to the page under your Store URL where customers can modify their subscription. If present, subscriptions in the Customer Portal will show an Edit link that will send subscribers to this page."
|
|
10
|
+
},
|
|
11
|
+
"past-due-amount-handling": {
|
|
12
|
+
"label": "Past due amount value",
|
|
13
|
+
"option_increment": "Contains the sum of all missed payments",
|
|
14
|
+
"option_replace": "Contains the last missed payment amount",
|
|
15
|
+
"option_ignore": "Doesn't change",
|
|
16
|
+
"helper_text": "This setting determines how you'd like to handle past due amounts when we try to process a subscription and that subscritpion fails."
|
|
17
|
+
},
|
|
18
|
+
"automatically-charge-past-due-amount": {
|
|
19
|
+
"label": "",
|
|
20
|
+
"option_checked": "Charge past due amount with subscription payment",
|
|
21
|
+
"helper_text": ""
|
|
22
|
+
},
|
|
23
|
+
"clear-past-due-amounts-on-success": {
|
|
24
|
+
"label": "",
|
|
25
|
+
"option_checked": "Clear past due amount on successful payment",
|
|
26
|
+
"helper_text": ""
|
|
27
|
+
},
|
|
28
|
+
"reset-nextdate-on-makeup-payment": {
|
|
29
|
+
"label": "",
|
|
30
|
+
"option_checked": "Reset next transaction date on make-up payment",
|
|
31
|
+
"helper_text": ""
|
|
32
|
+
},
|
|
33
|
+
"reattempt-schedule": {
|
|
34
|
+
"label": "Reattempt schedule",
|
|
35
|
+
"placeholder": "Period in days, e.g. 14",
|
|
36
|
+
"helper_text": "",
|
|
37
|
+
"v8n_too_long": "This schedule is too large. Please reduce the number of entries."
|
|
38
|
+
},
|
|
39
|
+
"reminder-email-schedule": {
|
|
40
|
+
"label": "Failed subscription payment email schedule",
|
|
41
|
+
"placeholder": "Period in days, e.g. 14",
|
|
42
|
+
"helper_text": "Number of days after the initial failure that an email notification to the customer should be sent. This only happens for active subscriptions which still have a past due amount. If a reattempt is successful, no additional reminder email will be sent.",
|
|
43
|
+
"v8n_too_long": "This schedule is too large. Please reduce the number of entries."
|
|
44
|
+
},
|
|
45
|
+
"expiring-soon-payment-reminder-schedule": {
|
|
46
|
+
"label": "Payment method expiration email schedule",
|
|
47
|
+
"placeholder": "Period in days, e.g. 14",
|
|
48
|
+
"helper_text": "Number of days until the payment card expires that an email notification should be sent to the customer. This only happens for customers with active subscriptions.",
|
|
49
|
+
"v8n_too_long": "This schedule is too large. Please reduce the number of entries."
|
|
50
|
+
},
|
|
51
|
+
"cancellation-schedule": {
|
|
52
|
+
"label": "Cancel failed subscriptions after",
|
|
53
|
+
"placeholder": "Don't cancel",
|
|
54
|
+
"helper_text": "A single number representing the number of days after the initial failure that a subscription should be set to cancel (assuming a successful payment hasn't been made in the meantime)."
|
|
55
|
+
},
|
|
56
|
+
"send-email-receipts-for-automated-billing": {
|
|
57
|
+
"label": "",
|
|
58
|
+
"option_checked": "Send email receipts for automated billing",
|
|
59
|
+
"helper_text": ""
|
|
60
|
+
},
|
|
61
|
+
"reattempt-bypass": {
|
|
62
|
+
"label": "Reattempt behavior",
|
|
63
|
+
"helper_text": "Determines whether Foxy should reattempt the subscription charge if the transaction's previous error string does or doesn't contain specific text.",
|
|
64
|
+
"option_reattempt_if_exists": "Reattempt on certain errors",
|
|
65
|
+
"option_skip_if_exists": "Skip on certain errors",
|
|
66
|
+
"option_always_reattempt": "Always reattempt",
|
|
67
|
+
"option_never_reattempt": "Never reattempt",
|
|
68
|
+
"reattempt-bypass-strings": {
|
|
69
|
+
"label": "",
|
|
70
|
+
"placeholder": "Add errors...",
|
|
71
|
+
"helper_text": "",
|
|
72
|
+
"v8n_too_long": "This list is too large. Please reduce the number of entries."
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"timestamps": {
|
|
76
|
+
"date_created": "Created on",
|
|
77
|
+
"date_modified": "Last updated",
|
|
78
|
+
"date": "{{value, date}}"
|
|
79
|
+
},
|
|
80
|
+
"spinner": {
|
|
81
|
+
"loading_busy": "Loading",
|
|
82
|
+
"loading_error": "Failed to load"
|
|
83
|
+
},
|
|
84
|
+
"delete": {
|
|
85
|
+
"delete": "Delete",
|
|
86
|
+
"cancel": "Cancel",
|
|
87
|
+
"delete_prompt": "Are you sure you'd like to remove these subscription settings? You won't be able to bring them back."
|
|
88
|
+
},
|
|
89
|
+
"create": {
|
|
90
|
+
"create": "Create"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -11,7 +11,7 @@ export class InternalDeleteControl extends InternalControl {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
/** Same as the "theme" attribute of the `vaadin-button` element. */
|
|
14
|
-
this.theme = '
|
|
14
|
+
this.theme = 'error';
|
|
15
15
|
}
|
|
16
16
|
static get properties() {
|
|
17
17
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalDeleteControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalDeleteControl/InternalDeleteControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,SAAQ,eAAe;IAA1D;;QAQE,oEAAoE;QACpE,UAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"InternalDeleteControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalDeleteControl/InternalDeleteControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,SAAQ,eAAe;IAA1D;;QAQE,oEAAoE;QACpE,UAAK,GAAG,OAAO,CAAC;IA8BlB,CAAC;IAtCC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAKD,aAAa;QACX,OAAO,IAAI,CAAA;;;;;;;;;gBASC,CAAC,GAAoB,EAAE,EAAE,WAAC,OAAA,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,WAAI,IAAI,CAAC,OAAO,0CAAE,MAAM,GAAE,CAAA,EAAA;;;;;;gBAMzE,IAAI,CAAC,KAAK;;oBAEN,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;iBACjC,CAAC,GAAgB,EAAE,EAAE;YAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,UAAU,CAA0B,CAAC;YACnF,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,aAA8B,CAAC,CAAC;QACnD,CAAC;;;;KAIJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { InternalConfirmDialog } from '../InternalConfirmDialog/InternalConfirmDialog';\nimport type { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\n\nimport { InternalControl } from '../InternalControl/InternalControl';\nimport { html } from 'lit-element';\n\n/**\n * Internal control displaying a \"Delete\" button that triggers resource\n * deletion in Nucleon on click.\n *\n * @since 1.17.0\n * @element foxy-internal-delete-control\n */\nexport class InternalDeleteControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n theme: { type: String },\n };\n }\n\n /** Same as the \"theme\" attribute of the `vaadin-button` element. */\n theme = 'error';\n\n renderControl(): TemplateResult {\n return html`\n <foxy-internal-confirm-dialog\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n infer=\"\"\n id=\"confirm\"\n @hide=${(evt: DialogHideEvent) => !evt.detail.cancelled && this.nucleon?.delete()}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n data-testid=\"delete\"\n theme=${this.theme}\n class=\"w-full\"\n ?disabled=${this.disabled || this.readonly}\n @click=${(evt: CustomEvent) => {\n const confirm = this.renderRoot.querySelector('#confirm') as InternalConfirmDialog;\n confirm.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n infer=\"\" key=\"delete\"></foxy-i18n>\n </vaadin-button>\n `;\n }\n}\n"]}
|
|
@@ -62,6 +62,7 @@ export declare class InternalEditableControl extends InternalControl {
|
|
|
62
62
|
resetProperty(): void;
|
|
63
63
|
/** Restores the default label translation. */
|
|
64
64
|
resetLabel(): void;
|
|
65
|
+
reportValidity(): void;
|
|
65
66
|
/**
|
|
66
67
|
* A shortcut to get the inferred value from the NucleonElement instance
|
|
67
68
|
* up the DOM tree. If no such value or instance exists, returns `undefined`.
|
|
@@ -123,6 +123,24 @@ export class InternalEditableControl extends InternalControl {
|
|
|
123
123
|
this.requestUpdate('label', this.__label);
|
|
124
124
|
this.__label = null;
|
|
125
125
|
}
|
|
126
|
+
reportValidity() {
|
|
127
|
+
const walker = this.ownerDocument.createTreeWalker(this.renderRoot, NodeFilter.SHOW_ELEMENT);
|
|
128
|
+
do {
|
|
129
|
+
const node = walker.currentNode;
|
|
130
|
+
const methods = ['reportValidity', 'validate'];
|
|
131
|
+
for (const method of methods) {
|
|
132
|
+
if (method in node) {
|
|
133
|
+
try {
|
|
134
|
+
node[method]();
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
catch (_a) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
} while (walker.nextNode());
|
|
143
|
+
}
|
|
126
144
|
/**
|
|
127
145
|
* A shortcut to get the inferred value from the NucleonElement instance
|
|
128
146
|
* up the DOM tree. If no such value or instance exists, returns `undefined`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalEditableControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalEditableControl/InternalEditableControl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AAErE;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAA5D;;QAcE,aAAQ,GAAG,GAAY,EAAE,wBAAC,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAC,CAAC;QAE5D,aAAQ,GAAG,CAAC,QAAiB,EAAQ,EAAE,wBAAC,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAC,CAAC;QAElF,kBAAa,GAAkB,IAAI,CAAC;QAEpC,iBAAY,GAAkB,IAAI,CAAC;QAEnC,gBAAW,GAAkB,IAAI,CAAC;QAElC,eAAU,GAAkB,IAAI,CAAC;QAEjC,YAAO,GAAkB,IAAI,CAAC;IAwIxC,CAAC;IAjKC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE;YAC/C,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE;YACxE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE;YACtE,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAA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{ PropertyDeclarations } from 'lit-element';\nimport { InternalControl } from '../InternalControl/InternalControl';\n\n/**\n * An internal base class for controls that have editing functionality, e.g. a text field.\n * Instances of this class will provide shortcuts for translatable placeholder, label, helper\n * text and more. Unlike a regular control, editable control can not only read from a NucleonElement\n * instance up the DOM tree, but also send changes to it and trigger validation process.\n *\n * @element foxy-internal-editable-control\n * @since 1.17.0\n */\nexport class InternalEditableControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n placeholder: { type: String, noAccessor: true },\n helperText: { type: String, attribute: 'helper-text', noAccessor: true },\n v8nPrefix: { type: String, attribute: 'v8n-prefix', noAccessor: true },\n getValue: { attribute: false },\n setValue: { attribute: false },\n property: { type: String, noAccessor: true },\n label: { type: String, noAccessor: true },\n };\n }\n\n getValue = (): unknown => this.nucleon?.form[this.property];\n\n setValue = (newValue: unknown): void => this.nucleon?.edit({ [this.property]: newValue });\n\n private __placeholder: string | null = null;\n\n private __helperText: string | null = null;\n\n private __v8nPrefix: string | null = null;\n\n private __property: string | null = null;\n\n private __label: string | null = null;\n\n /**\n * Translated placeholder text for this control. You can set your own placeholder text\n * if the default key in the inferred namespace doesn't work for you. Use `.resetPlaceholder()`\n * to restore the default translation.\n */\n get placeholder(): string {\n return typeof this.__placeholder === 'string' ? this.__placeholder : this.t('placeholder');\n }\n\n set placeholder(newValue: string) {\n this.requestUpdate('placeholder', this.__placeholder);\n this.__placeholder = newValue;\n }\n\n /**\n * Translated helper text for this control. You can set your own helper text\n * if the default key in the inferred namespace doesn't work for you. Use `.resetHelperText()`\n * to restore the default translation.\n */\n get helperText(): string {\n return typeof this.__helperText === 'string' ? this.__helperText : this.t('helper_text');\n }\n\n set helperText(newValue: string) {\n this.requestUpdate('helperText', this.__helperText);\n this.__helperText = newValue;\n }\n\n /**\n * A prefix for all v8n errors related to this control. You can set your own v8n prefix\n * if the default one doesn't work for you. Use `.resetV8nPrefix()`\n * to restore the default v8n prefix.\n */\n get v8nPrefix(): string {\n if (typeof this.__v8nPrefix === 'string') return this.__v8nPrefix;\n if (typeof this.infer === 'string') return `${this.infer}:`;\n return '';\n }\n\n set v8nPrefix(newValue: string) {\n this.requestUpdate('v8nPrefix', this.__v8nPrefix);\n this.__v8nPrefix = newValue;\n }\n\n /**\n * Name of the property to bind to inferred from the control name by converting it to snake_case.\n * You can set your own property name if the default inference method produces an incorrect result.\n * Use `.resetProperty()` to restore the default property name.\n */\n get property(): string {\n if (typeof this.__property === 'string') return this.__property;\n if (typeof this.infer === 'string') return this.infer.replace(/-/g, '_');\n return '';\n }\n\n set property(newValue: string) {\n this.requestUpdate('property', this.__property);\n this.__property = newValue;\n }\n\n /**\n * Translated label for this control. You can set your own label if the default key in the inferred\n * namespace doesn't work for you. Use `.resetLabel()` to restore the default translation.\n */\n get label(): string {\n return typeof this.__label === 'string' ? this.__label : this.t('label');\n }\n\n set label(newValue: string) {\n this.requestUpdate('label', this.__label);\n this.__label = newValue;\n }\n\n /** Restores the default placeholder translation. */\n resetPlaceholder(): void {\n this.requestUpdate('placeholder', this.__placeholder);\n this.__placeholder = null;\n }\n\n /** Restores the default helper text translation. */\n resetHelperText(): void {\n this.requestUpdate('helperText', this.__helperText);\n this.__helperText = null;\n }\n\n /** Restores the default v8n prefix for errors. */\n resetV8nPrefix(): void {\n this.requestUpdate('v8nPrefix', this.__v8nPrefix);\n this.__v8nPrefix = null;\n }\n\n /** Restores the default property name. */\n resetProperty(): void {\n this.requestUpdate('property', this.__property);\n this.__property = null;\n }\n\n /** Restores the default label translation. */\n resetLabel(): void {\n this.requestUpdate('label', this.__label);\n this.__label = null;\n }\n\n /**\n * A shortcut to get the inferred value from the NucleonElement instance\n * up the DOM tree. If no such value or instance exists, returns `undefined`.\n * Assigning a value to this property will dispatch a cancelable `change` event\n * with the new value in the detail and write changes to the NucleonElement instance if permitted.\n */\n\n protected get _value(): unknown | undefined {\n return this.getValue();\n }\n\n protected set _value(newValue: unknown | undefined) {\n const event = new CustomEvent('change', { cancelable: true, detail: newValue });\n const useDefaultAction = this.dispatchEvent(event);\n if (useDefaultAction) this.setValue(newValue);\n }\n /** A shortcut returning the first v8n error associated with this control. */\n\n protected get _error(): string | undefined {\n return this.nucleon?.errors.find(v => v.startsWith(this.v8nPrefix));\n }\n /** A shortcut returning the localized text of the first v8n error associated with this control. */\n\n protected get _errorMessage(): string | undefined {\n return this._error ? this.t(this._error.substring(this.v8nPrefix.length)) : undefined;\n }\n /** A helper returning a `.checkValidity()` function for use with Vaadin elements. */\n\n protected get _checkValidity(): () => boolean {\n return () => !this._error;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalEditableControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalEditableControl/InternalEditableControl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AAErE;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAA5D;;QAcE,aAAQ,GAAG,GAAY,EAAE,wBAAC,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAC,CAAC;QAE5D,aAAQ,GAAG,CAAC,QAAiB,EAAQ,EAAE,wBAAC,IAAI,CAAC,OAAO,0CAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAC,CAAC;QAElF,kBAAa,GAAkB,IAAI,CAAC;QAEpC,iBAAY,GAAkB,IAAI,CAAC;QAEnC,gBAAW,GAAkB,IAAI,CAAC;QAElC,eAAU,GAAkB,IAAI,CAAC;QAEjC,YAAO,GAAkB,IAAI,CAAC;IA8JxC,CAAC;IAvLC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE;YAC/C,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,UAA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GAAG,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChF,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,gBAAgB;YAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IACD,6EAA6E;IAE7E,IAAc,MAAM;;QAClB,aAAO,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;IACtE,CAAC;IACD,mGAAmG;IAEnG,IAAc,aAAa;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxF,CAAC;IACD,qFAAqF;IAErF,IAAc,cAAc;QAC1B,OAAO,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport { InternalControl } from '../InternalControl/InternalControl';\n\n/**\n * An internal base class for controls that have editing functionality, e.g. a text field.\n * Instances of this class will provide shortcuts for translatable placeholder, label, helper\n * text and more. Unlike a regular control, editable control can not only read from a NucleonElement\n * instance up the DOM tree, but also send changes to it and trigger validation process.\n *\n * @element foxy-internal-editable-control\n * @since 1.17.0\n */\nexport class InternalEditableControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n placeholder: { type: String, noAccessor: true },\n helperText: { type: String, attribute: 'helper-text', noAccessor: true },\n v8nPrefix: { type: String, attribute: 'v8n-prefix', noAccessor: true },\n getValue: { attribute: false },\n setValue: { attribute: false },\n property: { type: String, noAccessor: true },\n label: { type: String, noAccessor: true },\n };\n }\n\n getValue = (): unknown => this.nucleon?.form[this.property];\n\n setValue = (newValue: unknown): void => this.nucleon?.edit({ [this.property]: newValue });\n\n private __placeholder: string | null = null;\n\n private __helperText: string | null = null;\n\n private __v8nPrefix: string | null = null;\n\n private __property: string | null = null;\n\n private __label: string | null = null;\n\n /**\n * Translated placeholder text for this control. You can set your own placeholder text\n * if the default key in the inferred namespace doesn't work for you. Use `.resetPlaceholder()`\n * to restore the default translation.\n */\n get placeholder(): string {\n return typeof this.__placeholder === 'string' ? this.__placeholder : this.t('placeholder');\n }\n\n set placeholder(newValue: string) {\n this.requestUpdate('placeholder', this.__placeholder);\n this.__placeholder = newValue;\n }\n\n /**\n * Translated helper text for this control. You can set your own helper text\n * if the default key in the inferred namespace doesn't work for you. Use `.resetHelperText()`\n * to restore the default translation.\n */\n get helperText(): string {\n return typeof this.__helperText === 'string' ? this.__helperText : this.t('helper_text');\n }\n\n set helperText(newValue: string) {\n this.requestUpdate('helperText', this.__helperText);\n this.__helperText = newValue;\n }\n\n /**\n * A prefix for all v8n errors related to this control. You can set your own v8n prefix\n * if the default one doesn't work for you. Use `.resetV8nPrefix()`\n * to restore the default v8n prefix.\n */\n get v8nPrefix(): string {\n if (typeof this.__v8nPrefix === 'string') return this.__v8nPrefix;\n if (typeof this.infer === 'string') return `${this.infer}:`;\n return '';\n }\n\n set v8nPrefix(newValue: string) {\n this.requestUpdate('v8nPrefix', this.__v8nPrefix);\n this.__v8nPrefix = newValue;\n }\n\n /**\n * Name of the property to bind to inferred from the control name by converting it to snake_case.\n * You can set your own property name if the default inference method produces an incorrect result.\n * Use `.resetProperty()` to restore the default property name.\n */\n get property(): string {\n if (typeof this.__property === 'string') return this.__property;\n if (typeof this.infer === 'string') return this.infer.replace(/-/g, '_');\n return '';\n }\n\n set property(newValue: string) {\n this.requestUpdate('property', this.__property);\n this.__property = newValue;\n }\n\n /**\n * Translated label for this control. You can set your own label if the default key in the inferred\n * namespace doesn't work for you. Use `.resetLabel()` to restore the default translation.\n */\n get label(): string {\n return typeof this.__label === 'string' ? this.__label : this.t('label');\n }\n\n set label(newValue: string) {\n this.requestUpdate('label', this.__label);\n this.__label = newValue;\n }\n\n /** Restores the default placeholder translation. */\n resetPlaceholder(): void {\n this.requestUpdate('placeholder', this.__placeholder);\n this.__placeholder = null;\n }\n\n /** Restores the default helper text translation. */\n resetHelperText(): void {\n this.requestUpdate('helperText', this.__helperText);\n this.__helperText = null;\n }\n\n /** Restores the default v8n prefix for errors. */\n resetV8nPrefix(): void {\n this.requestUpdate('v8nPrefix', this.__v8nPrefix);\n this.__v8nPrefix = null;\n }\n\n /** Restores the default property name. */\n resetProperty(): void {\n this.requestUpdate('property', this.__property);\n this.__property = null;\n }\n\n /** Restores the default label translation. */\n resetLabel(): void {\n this.requestUpdate('label', this.__label);\n this.__label = null;\n }\n\n reportValidity(): void {\n const walker = this.ownerDocument.createTreeWalker(this.renderRoot, NodeFilter.SHOW_ELEMENT);\n\n do {\n type Input = Node & Record<string, () => unknown>;\n\n const node = walker.currentNode as Input;\n const methods = ['reportValidity', 'validate'];\n\n for (const method of methods) {\n if (method in node) {\n try {\n node[method]();\n break;\n } catch {\n continue;\n }\n }\n }\n } while (walker.nextNode());\n }\n\n /**\n * A shortcut to get the inferred value from the NucleonElement instance\n * up the DOM tree. If no such value or instance exists, returns `undefined`.\n * Assigning a value to this property will dispatch a cancelable `change` event\n * with the new value in the detail and write changes to the NucleonElement instance if permitted.\n */\n\n protected get _value(): unknown | undefined {\n return this.getValue();\n }\n\n protected set _value(newValue: unknown | undefined) {\n const event = new CustomEvent('change', { cancelable: true, detail: newValue });\n const useDefaultAction = this.dispatchEvent(event);\n if (useDefaultAction) this.setValue(newValue);\n }\n /** A shortcut returning the first v8n error associated with this control. */\n\n protected get _error(): string | undefined {\n return this.nucleon?.errors.find(v => v.startsWith(this.v8nPrefix));\n }\n /** A shortcut returning the localized text of the first v8n error associated with this control. */\n\n protected get _errorMessage(): string | undefined {\n return this._error ? this.t(this._error.substring(this.v8nPrefix.length)) : undefined;\n }\n /** A helper returning a `.checkValidity()` function for use with Vaadin elements. */\n\n protected get _checkValidity(): () => boolean {\n return () => !this._error;\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import type { Item, Option } from './types';
|
|
|
3
3
|
import { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';
|
|
4
4
|
export declare class InternalEditableListControl extends InternalEditableControl {
|
|
5
5
|
static get properties(): PropertyDeclarations;
|
|
6
|
+
inputParams: Record<string, unknown>;
|
|
6
7
|
options: Option[];
|
|
7
8
|
private __newItem;
|
|
8
9
|
render(): TemplateResult;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
|
|
2
2
|
import { classMap } from "../../../utils/class-map.js";
|
|
3
3
|
import { repeat } from 'lit-html/directives/repeat';
|
|
4
|
+
import { spread } from '@open-wc/lit-helpers';
|
|
4
5
|
import { live } from 'lit-html/directives/live';
|
|
5
6
|
import { html } from 'lit-element';
|
|
6
7
|
export class InternalEditableListControl extends InternalEditableControl {
|
|
7
8
|
constructor() {
|
|
8
9
|
super(...arguments);
|
|
10
|
+
this.inputParams = {};
|
|
9
11
|
this.options = [];
|
|
10
12
|
this.__newItem = '';
|
|
11
13
|
}
|
|
12
14
|
static get properties() {
|
|
13
15
|
return {
|
|
14
16
|
...super.properties,
|
|
17
|
+
inputParams: { attribute: false },
|
|
15
18
|
options: { type: Array },
|
|
16
19
|
__newItem: { attribute: false },
|
|
17
20
|
};
|
|
@@ -29,6 +32,7 @@ export class InternalEditableListControl extends InternalEditableControl {
|
|
|
29
32
|
'transition-colors h-m ml-s flex items-center': true,
|
|
30
33
|
'text-secondary': this.readonly,
|
|
31
34
|
'text-disabled': this.disabled,
|
|
35
|
+
'group-hover-divide-contrast-20': !this.disabled && !this.readonly,
|
|
32
36
|
});
|
|
33
37
|
const isAddButtonDisabled = this.disabled || !this.__newItem;
|
|
34
38
|
const addItem = () => {
|
|
@@ -40,17 +44,21 @@ export class InternalEditableListControl extends InternalEditableControl {
|
|
|
40
44
|
return html `
|
|
41
45
|
<div class="group">
|
|
42
46
|
<div
|
|
43
|
-
class
|
|
47
|
+
class=${classMap({
|
|
48
|
+
'transition-colors mb-xs font-medium text-s text-secondary': true,
|
|
49
|
+
'group-hover-text-body': !this.disabled && !this.readonly,
|
|
50
|
+
})}
|
|
44
51
|
>
|
|
45
52
|
${this.label}
|
|
46
53
|
</div>
|
|
47
54
|
|
|
48
55
|
<div
|
|
49
|
-
class
|
|
56
|
+
class=${classMap({
|
|
57
|
+
'border border-contrast-10 rounded transition-colors': true,
|
|
58
|
+
'group-hover-border-contrast-20': !this.disabled && !this.readonly,
|
|
59
|
+
})}
|
|
50
60
|
>
|
|
51
|
-
<ol
|
|
52
|
-
class="transition-colors divide-y divide-contrast-10 font-medium group-hover-divide-contrast-20"
|
|
53
|
-
>
|
|
61
|
+
<ol class="transition-colors divide-y divide-contrast-10 font-medium">
|
|
54
62
|
${repeat(this._value, item => item.value, (item, index) => {
|
|
55
63
|
var _a;
|
|
56
64
|
return html `
|
|
@@ -79,7 +87,7 @@ export class InternalEditableListControl extends InternalEditableControl {
|
|
|
79
87
|
class=${classMap({
|
|
80
88
|
'transition-colors bg-contrast-10 pl-s h-m flex items-center': true,
|
|
81
89
|
'focus-within-ring-2 focus-within-ring-primary-50': true,
|
|
82
|
-
'group-hover-bg-contrast-20':
|
|
90
|
+
'group-hover-bg-contrast-20': !this.disabled && !this.readonly,
|
|
83
91
|
'flex': !this.readonly,
|
|
84
92
|
'hidden': this.readonly,
|
|
85
93
|
})}
|
|
@@ -88,6 +96,7 @@ export class InternalEditableListControl extends InternalEditableControl {
|
|
|
88
96
|
placeholder=${this.placeholder}
|
|
89
97
|
class="w-full bg-transparent appearance-none h-m font-medium focus-outline-none"
|
|
90
98
|
list="list"
|
|
99
|
+
...=${spread(this.inputParams)}
|
|
91
100
|
.value=${live(this.__newItem)}
|
|
92
101
|
?disabled=${this.disabled}
|
|
93
102
|
?readonly=${this.readonly}
|
package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map
CHANGED
|
@@ -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,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,OAAO,2BAA4B,SAAQ,uBAAuB;IAAxE;;
|
|
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,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;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,OAAO,2BAA4B,SAAQ,uBAAuB;IAAxE;;QAUE,gBAAW,GAA4B,EAAE,CAAC;QAE1C,YAAO,GAAa,EAAE,CAAC;QAEf,cAAS,GAAG,EAAE,CAAC;IA0IzB,CAAC;IAvJC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YACjC,OAAO,EAAE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AAE,CAAC,GAAG,CAAC,eAAe,EAAE;uBACtC,CAAC,GAAe,EAAE,EAAE;YAC3B,IAAI,CAAC,SAAS,GAAI,GAAG,CAAC,aAAkC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACxE,CAAC;;;;gBAIC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;YACtC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC;gBAAE,OAAO;YAC3D,OAAO,IAAI,CAAA,iBAAiB,KAAK,IAAI,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,KAAK,WAAW,CAAC;QACjE,CAAC,CAAC;;;6CAG6B,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW;;6BAE5D,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;wBACrB,QAAQ,CAAC;YACf,6EAA6E,EAC3E,IAAI;YACN,iEAAiE,EAAE,IAAI;YACvE,4CAA4C,EAAE,mBAAmB;YACjE,2CAA2C,EAAE,CAAC,mBAAmB;YACjE,8CAA8C,EAAE,CAAC,mBAAmB;YACpE,cAAc,EAAE,CAAC,mBAAmB;SACrC,CAAC;4BACU,mBAAmB;yBACtB,OAAO;;;;;;;;;YASpB,IAAI,CAAC,UAAU;;;KAGtB,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 { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { Item, Option } from './types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\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';\nimport { html } from 'lit-element';\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 __newItem: { attribute: false },\n };\n }\n\n inputParams: Record<string, unknown> = {};\n\n options: Option[] = [];\n\n private __newItem = '';\n\n render(): TemplateResult {\n const deleteButtonClass = classMap({\n 'w-xs h-xs mr-xs rounded-full 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 });\n\n const itemClass = classMap({\n 'transition-colors h-m ml-s flex items-center': true,\n 'text-secondary': this.readonly,\n 'text-disabled': this.disabled,\n 'group-hover-divide-contrast-20': !this.disabled && !this.readonly,\n });\n\n const isAddButtonDisabled = this.disabled || !this.__newItem;\n\n const addItem = () => {\n if (!this.__newItem) return;\n this._value = [...this._value, { value: this.__newItem }];\n this.__newItem = '';\n };\n\n return html`\n <div class=\"group\">\n <div\n class=${classMap({\n 'transition-colors mb-xs font-medium text-s text-secondary': true,\n 'group-hover-text-body': !this.disabled && !this.readonly,\n })}\n >\n ${this.label}\n </div>\n\n <div\n class=${classMap({\n 'border border-contrast-10 rounded transition-colors': true,\n 'group-hover-border-contrast-20': !this.disabled && !this.readonly,\n })}\n >\n <ol class=\"transition-colors divide-y divide-contrast-10 font-medium\">\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=${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 bg-contrast-10 pl-s h-m flex items-center': true,\n 'focus-within-ring-2 focus-within-ring-primary-50': true,\n 'group-hover-bg-contrast-20': !this.disabled && !this.readonly,\n 'flex': !this.readonly,\n 'hidden': this.readonly,\n })}\n >\n <input\n placeholder=${this.placeholder}\n class=\"w-full bg-transparent appearance-none h-m font-medium focus-outline-none\"\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 />\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=\"transition-opacity ${this.__newItem ? 'opacity-100' : 'opacity-0'}\">\n <button\n aria-label=${this.t('submit')}\n class=${classMap({\n 'w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50 focus-outline-none':\n true,\n 'flex items-center justify-center rounded-full transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': isAddButtonDisabled,\n 'bg-success-10 text-success 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 class=\"transition-colors mt-xs text-xs text-secondary group-hover-text-body\">\n ${this.helperText}\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"]}
|
|
@@ -8,6 +8,8 @@ import { InternalEditableControl } from '../InternalEditableControl/InternalEdit
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class InternalIntegerControl extends InternalEditableControl {
|
|
10
10
|
static get properties(): PropertyDeclarations;
|
|
11
|
+
prefix: string | null;
|
|
12
|
+
suffix: string | null;
|
|
11
13
|
min: number | null;
|
|
12
14
|
max: number | null;
|
|
13
15
|
renderControl(): TemplateResult;
|
|
@@ -10,12 +10,16 @@ import { html } from 'lit-element';
|
|
|
10
10
|
export class InternalIntegerControl extends InternalEditableControl {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
+
this.prefix = null;
|
|
14
|
+
this.suffix = null;
|
|
13
15
|
this.min = null;
|
|
14
16
|
this.max = null;
|
|
15
17
|
}
|
|
16
18
|
static get properties() {
|
|
17
19
|
return {
|
|
18
20
|
...super.properties,
|
|
21
|
+
prefix: {},
|
|
22
|
+
suffix: {},
|
|
19
23
|
min: { type: Number },
|
|
20
24
|
max: { type: Number },
|
|
21
25
|
};
|
|
@@ -42,6 +46,8 @@ export class InternalIntegerControl extends InternalEditableControl {
|
|
|
42
46
|
this._value = parseInt(field.value);
|
|
43
47
|
}}
|
|
44
48
|
>
|
|
49
|
+
${this.prefix ? html `<div slot="prefix">${this.prefix}</div>` : ''}
|
|
50
|
+
${this.suffix ? html `<div class="pr-s font-medium" slot="suffix">${this.suffix}</div>` : ''}
|
|
45
51
|
</vaadin-integer-field>
|
|
46
52
|
`;
|
|
47
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalIntegerControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalIntegerControl/InternalIntegerControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAAnE;;
|
|
1
|
+
{"version":3,"file":"InternalIntegerControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalIntegerControl/InternalIntegerControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,uBAAuB;IAAnE;;QAWE,WAAM,GAAkB,IAAI,CAAC;QAE7B,WAAM,GAAkB,IAAI,CAAC;QAE7B,QAAG,GAAkB,IAAI,CAAC;QAE1B,QAAG,GAAkB,IAAI,CAAC;IAoC5B,CAAC;IApDC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACrB,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACtB,CAAC;IACJ,CAAC;IAUD,aAAa;;QACX,OAAO,IAAI,CAAA;;wBAES,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;sBAC/B,IAAI,CAAC,WAAW;sBAChB,IAAI,CAAC,UAAU;gBACrB,IAAI,CAAC,KAAK;;cAEZ,SAAS,OAAC,IAAI,CAAC,GAAG,mCAAI,SAAS,CAAC;cAChC,SAAS,OAAC,IAAI,CAAC,GAAG,mCAAI,SAAS,CAAC;oBAC1B,IAAI,CAAC,QAAQ;oBACb,IAAI,CAAC,QAAQ;yBACR,IAAI,CAAC,cAAc;iBAC3B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;;mBAEjB,CAAC,GAAkB,EAAE,EAAE,WAAC,OAAA,GAAG,CAAC,GAAG,KAAK,OAAO,WAAI,IAAI,CAAC,OAAO,0CAAE,MAAM,GAAE,CAAA,EAAA;kBACtE,CAAC,GAAgB,EAAE,EAAE;YAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,aAAoC,CAAC;YACvD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;;UAEC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC,EAAE;UAChE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,+CAA+C,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC,EAAE;;KAE9F,CAAC;IACJ,CAAC;IAED,IAAc,MAAM;;QAClB,aAAQ,KAAK,CAAC,MAA6B,mCAAI,CAAC,CAAC;IACnD,CAAC;IAED,IAAc,MAAM,CAAC,QAAgB;QACnC,KAAK,CAAC,MAAM,GAAG,QAA+B,CAAC;IACjD,CAAC;CACF","sourcesContent":["import type { IntegerFieldElement } from '@vaadin/vaadin-text-field/vaadin-integer-field';\nimport type { PropertyDeclarations, TemplateResult } from 'lit-element';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\n/**\n * Internal control displaying a basic integer box.\n *\n * @since 1.17.0\n * @element foxy-internal-integer-control\n */\nexport class InternalIntegerControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n prefix: {},\n suffix: {},\n min: { type: Number },\n max: { type: Number },\n };\n }\n\n prefix: string | null = null;\n\n suffix: string | null = null;\n\n min: number | null = null;\n\n max: number | null = null;\n\n renderControl(): TemplateResult {\n return html`\n <vaadin-integer-field\n error-message=${ifDefined(this._errorMessage)}\n placeholder=${this.placeholder}\n helper-text=${this.helperText}\n label=${this.label}\n class=\"w-full\"\n min=${ifDefined(this.min ?? undefined)}\n max=${ifDefined(this.max ?? undefined)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${String(this._value)}\n clear-button-visible\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.nucleon?.submit()}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as IntegerFieldElement;\n this._value = parseInt(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-integer-field>\n `;\n }\n\n protected get _value(): number {\n return (super._value as number | undefined) ?? 0;\n }\n\n protected set _value(newValue: number) {\n super._value = newValue as unknown | undefined;\n }\n}\n"]}
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
|
|
2
2
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
3
3
|
import { html } from 'lit-html';
|
|
4
|
+
import { classMap } from "../../../utils/class-map.js";
|
|
5
|
+
import { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles';
|
|
6
|
+
import { css } from 'lit-element';
|
|
7
|
+
registerStyles('vaadin-radio-group', css `:host([theme~='list']) label{
|
|
8
|
+
padding-bottom:var(--lumo-space-xs);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([theme~='list']) [part='group-field']{
|
|
12
|
+
display:flex;
|
|
13
|
+
border:thin solid var(--lumo-contrast-10pct);
|
|
14
|
+
border-radius:var(--lumo-border-radius-l);
|
|
15
|
+
transition:border-color 0.15s ease;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([theme~='list']:not([disabled]):not([readonly]):hover) [part='group-field']{
|
|
19
|
+
border-color:var(--lumo-contrast-20pct);
|
|
20
|
+
}
|
|
21
|
+
`);
|
|
4
22
|
/**
|
|
5
23
|
* Internal control wrapper for `vaadin-radio-group` element.
|
|
6
24
|
*
|
|
@@ -23,14 +41,18 @@ export class InternalRadioGroupControl extends InternalEditableControl {
|
|
|
23
41
|
};
|
|
24
42
|
}
|
|
25
43
|
renderControl() {
|
|
26
|
-
var _a;
|
|
44
|
+
var _a, _b;
|
|
45
|
+
const isList = !!((_a = this.theme) === null || _a === void 0 ? void 0 : _a.includes('list'));
|
|
27
46
|
return html `
|
|
28
47
|
<vaadin-radio-group
|
|
29
48
|
error-message=${ifDefined(this._errorMessage)}
|
|
30
49
|
helper-text=${this.helperText}
|
|
31
50
|
label=${this.label}
|
|
32
|
-
class
|
|
33
|
-
|
|
51
|
+
class=${classMap({
|
|
52
|
+
'w-full': true,
|
|
53
|
+
'group divide-y divide-contrast-10': isList,
|
|
54
|
+
})}
|
|
55
|
+
theme=${ifDefined((_b = this.theme) !== null && _b !== void 0 ? _b : undefined)}
|
|
34
56
|
?disabled=${this.disabled || this.readonly}
|
|
35
57
|
.checkValidity=${this._checkValidity}
|
|
36
58
|
.value=${this._value}
|
|
@@ -40,7 +62,13 @@ export class InternalRadioGroupControl extends InternalEditableControl {
|
|
|
40
62
|
}}
|
|
41
63
|
>
|
|
42
64
|
${this.options.map(option => html `
|
|
43
|
-
<vaadin-radio-button
|
|
65
|
+
<vaadin-radio-button
|
|
66
|
+
value=${option.value}
|
|
67
|
+
class=${classMap({
|
|
68
|
+
'block p-s transition-colors': isList,
|
|
69
|
+
'group-hover-divide-contrast-20': isList && !this.disabled && !this.readonly,
|
|
70
|
+
})}
|
|
71
|
+
>
|
|
44
72
|
<foxy-i18n infer="" key=${option.label}></foxy-i18n>
|
|
45
73
|
</vaadin-radio-button>
|
|
46
74
|
`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalRadioGroupControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalRadioGroupControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,cAAc,CACZ,oBAAoB,EACpB,GAAG;;;;;;;;;;;;;;GAeF,CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAAtE;;QASE,uCAAuC;QACvC,YAAO,GAAa,EAAE,CAAC;QAEvB,sEAAsE;QACtE,UAAK,GAAkB,IAAI,CAAC;IAuC9B,CAAC;IAnDC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YACxB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAQD,aAAa;;QACX,MAAM,MAAM,GAAG,CAAC,QAAC,IAAI,CAAC,KAAK,0CAAE,QAAQ,CAAC,MAAM,EAAC,CAAC;QAE9C,OAAO,IAAI,CAAA;;wBAES,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;sBAC/B,IAAI,CAAC,UAAU;gBACrB,IAAI,CAAC,KAAK;gBACV,QAAQ,CAAC;YACf,QAAQ,EAAE,IAAI;YACd,mCAAmC,EAAE,MAAM;SAC5C,CAAC;gBACM,SAAS,OAAC,IAAI,CAAC,KAAK,mCAAI,SAAS,CAAC;oBAC9B,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;yBACzB,IAAI,CAAC,cAAc;iBAC3B,IAAI,CAAC,MAAuB;kBAC3B,CAAC,GAAgB,EAAE,EAAE;YAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,aAAkC,CAAC;YACrD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;QAC5B,CAAC;;UAEC,IAAI,CAAC,OAAO,CAAC,GAAG,CAChB,MAAM,CAAC,EAAE,CAAC,IAAI,CAAA;;sBAEF,MAAM,CAAC,KAAK;sBACZ,QAAQ,CAAC;YACf,6BAA6B,EAAE,MAAM;YACrC,gCAAgC,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ;SAC7E,CAAC;;wCAEwB,MAAM,CAAC,KAAK;;WAEzC,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { RadioGroupElement } from '@vaadin/vaadin-radio-button/vaadin-radio-group';\nimport type { Option } from './types';\n\nimport { InternalEditableControl } from '../InternalEditableControl/InternalEditableControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\nimport { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles';\nimport { css } from 'lit-element';\n\nregisterStyles(\n 'vaadin-radio-group',\n css`\n :host([theme~='list']) label {\n padding-bottom: var(--lumo-space-xs);\n }\n\n :host([theme~='list']) [part='group-field'] {\n display: flex;\n border: thin solid var(--lumo-contrast-10pct);\n border-radius: var(--lumo-border-radius-l);\n transition: border-color 0.15s ease;\n }\n\n :host([theme~='list']:not([disabled]):not([readonly]):hover) [part='group-field'] {\n border-color: var(--lumo-contrast-20pct);\n }\n `\n);\n\n/**\n * Internal control wrapper for `vaadin-radio-group` element.\n *\n * @since 1.17.0\n * @element foxy-internal-radio-group-control\n */\nexport class InternalRadioGroupControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n options: { type: Array },\n theme: { type: String },\n };\n }\n\n /** List of radio buttons to render. */\n options: Option[] = [];\n\n /** Same as the \"theme\" attribute/property of `vaadin-radio-group`. */\n theme: string | null = null;\n\n renderControl(): TemplateResult {\n const isList = !!this.theme?.includes('list');\n\n return html`\n <vaadin-radio-group\n error-message=${ifDefined(this._errorMessage)}\n helper-text=${this.helperText}\n label=${this.label}\n class=${classMap({\n 'w-full': true,\n 'group divide-y divide-contrast-10': isList,\n })}\n theme=${ifDefined(this.theme ?? undefined)}\n ?disabled=${this.disabled || this.readonly}\n .checkValidity=${this._checkValidity}\n .value=${this._value as string | null}\n @change=${(evt: CustomEvent) => {\n const field = evt.currentTarget as RadioGroupElement;\n this._value = field.value;\n }}\n >\n ${this.options.map(\n option => html`\n <vaadin-radio-button\n value=${option.value}\n class=${classMap({\n 'block p-s transition-colors': isList,\n 'group-hover-divide-contrast-20': isList && !this.disabled && !this.readonly,\n })}\n >\n <foxy-i18n infer=\"\" key=${option.label}></foxy-i18n>\n </vaadin-radio-button>\n `\n )}\n </vaadin-radio-group>\n `;\n }\n}\n"]}
|
|
@@ -11,9 +11,7 @@ export declare class InternalSelectControl extends InternalEditableControl {
|
|
|
11
11
|
static get properties(): PropertyDeclarations;
|
|
12
12
|
/** List of radio buttons to render. */
|
|
13
13
|
options: Option[];
|
|
14
|
-
/** Same as the "theme" attribute/property of `vaadin-
|
|
14
|
+
/** Same as the "theme" attribute/property of `vaadin-combo-box`. */
|
|
15
15
|
theme: string | null;
|
|
16
|
-
private __renderer;
|
|
17
16
|
renderControl(): TemplateResult;
|
|
18
|
-
updated(changes: Map<keyof this, unknown>): void;
|
|
19
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InternalEditableControl } from "../InternalEditableControl/InternalEditableControl.js";
|
|
2
|
-
import { html, render } from 'lit-html';
|
|
3
2
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
3
|
+
import { html } from 'lit-html';
|
|
4
4
|
/**
|
|
5
5
|
* Internal control wrapper for `vaadin-select` element.
|
|
6
6
|
*
|
|
@@ -12,20 +12,8 @@ export class InternalSelectControl extends InternalEditableControl {
|
|
|
12
12
|
super(...arguments);
|
|
13
13
|
/** List of radio buttons to render. */
|
|
14
14
|
this.options = [];
|
|
15
|
-
/** Same as the "theme" attribute/property of `vaadin-
|
|
15
|
+
/** Same as the "theme" attribute/property of `vaadin-combo-box`. */
|
|
16
16
|
this.theme = null;
|
|
17
|
-
this.__renderer = root => {
|
|
18
|
-
const items = this.options.map(({ label, value }) => {
|
|
19
|
-
return html `
|
|
20
|
-
<vaadin-item value=${value}>
|
|
21
|
-
<foxy-i18n lang=${this.lang} key=${label} ns=${this.ns}></foxy-i18n>
|
|
22
|
-
</vaadin-item>
|
|
23
|
-
`;
|
|
24
|
-
});
|
|
25
|
-
if (!root.firstElementChild)
|
|
26
|
-
root.appendChild(document.createElement('vaadin-list-box'));
|
|
27
|
-
render(items, root.firstElementChild);
|
|
28
|
-
};
|
|
29
17
|
}
|
|
30
18
|
static get properties() {
|
|
31
19
|
return {
|
|
@@ -35,34 +23,32 @@ export class InternalSelectControl extends InternalEditableControl {
|
|
|
35
23
|
};
|
|
36
24
|
}
|
|
37
25
|
renderControl() {
|
|
38
|
-
var _a;
|
|
39
26
|
return html `
|
|
40
|
-
<vaadin-
|
|
27
|
+
<vaadin-combo-box
|
|
28
|
+
item-value-path="value"
|
|
29
|
+
item-label-path="label"
|
|
41
30
|
error-message=${ifDefined(this._errorMessage)}
|
|
42
|
-
|
|
31
|
+
item-id-path="value"
|
|
43
32
|
helper-text=${this.helperText}
|
|
44
|
-
|
|
33
|
+
placeholder=${this.placeholder}
|
|
45
34
|
label=${this.label}
|
|
46
|
-
|
|
35
|
+
class="w-full"
|
|
36
|
+
theme=${this.theme}
|
|
47
37
|
?disabled=${this.disabled}
|
|
48
38
|
?readonly=${this.readonly}
|
|
39
|
+
clear-button-visible
|
|
49
40
|
.checkValidity=${this._checkValidity}
|
|
50
|
-
.
|
|
41
|
+
.items=${this.options.map(({ value, label }) => ({ value, label: this.t(label) }))}
|
|
51
42
|
.value=${this._value}
|
|
52
43
|
@change=${(evt) => {
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
evt.stopPropagation();
|
|
45
|
+
const comboBox = evt.currentTarget;
|
|
46
|
+
this._value = comboBox.value;
|
|
47
|
+
comboBox.validate();
|
|
55
48
|
}}
|
|
56
49
|
>
|
|
57
|
-
</vaadin-
|
|
50
|
+
</vaadin-combo-box>
|
|
58
51
|
`;
|
|
59
52
|
}
|
|
60
|
-
updated(changes) {
|
|
61
|
-
var _a;
|
|
62
|
-
super.updated(changes);
|
|
63
|
-
if (changes.has('ns') || changes.has('lang') || changes.has('options')) {
|
|
64
|
-
(_a = this.renderRoot.querySelector('vaadin-select')) === null || _a === void 0 ? void 0 : _a.render();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
53
|
}
|
|
68
54
|
//# sourceMappingURL=InternalSelectControl.js.map
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"InternalSelectControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSelectControl/InternalSelectControl.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,8DAA2D;AAC7F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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 } from 'lit-html';\n\n/**\n * Internal control wrapper for `vaadin-select` element.\n *\n * @since 1.19.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 theme: { type: String },\n };\n }\n\n /** List of radio buttons to render. */\n options: Option[] = [];\n\n /** Same as the \"theme\" attribute/property of `vaadin-combo-box`. */\n theme: string | null = null;\n\n renderControl(): TemplateResult {\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=${this.theme}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n clear-button-visible\n .checkValidity=${this._checkValidity}\n .items=${this.options.map(({ value, label }) => ({ value, label: this.t(label) }))}\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSelectControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalSelectControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAElC,6CAA0C;AAC1C,oCAAiC;AAEjC,OAAO,EAAE,qBAAqB,IAAI,OAAO,EAAE,mCAAgC;AAE3E,cAAc,CAAC,MAAM,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;AAE/D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-combo-box';\n\nimport '../InternalEditableControl/index';\nimport '../../public/I18n/index';\n\nimport { InternalSelectControl as Control } from './InternalSelectControl';\n\ncustomElements.define('foxy-internal-select-control', Control);\n\nexport { Control as InternalSelectControl };\n"]}
|