@adyen/bento-vue2 1.2.0 → 1.3.0
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/README.md +60 -29
- package/dist/@types/components.d.ts +12 -0
- package/dist/@types/packages/vue2/src/components/button/components/loading-button/loading-button.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue.d.ts +76 -30
- package/dist/@types/packages/vue2/src/components/country/composables/index.d.ts +0 -1
- package/dist/@types/packages/vue2/src/components/country/country.vue.d.ts +1 -2
- package/dist/@types/packages/vue2/src/components/date-picker/date-picker.vue.d.ts +11 -1
- package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.vue.d.ts +11 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-country/dropdown-country.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/filter-bar/components/date-range-filter/date-range-filter.vue.d.ts +0 -2
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/form-layout-field-tip.vue.d.ts +10 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/composable/use-form-layout-group-percentage.d.ts +3 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/form-layout-group.types.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/form-layout-group.vue.d.ts +23 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-title/form-layout-title.vue.d.ts +33 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-title/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/form-layout/components/index.d.ts +3 -0
- package/dist/@types/packages/vue2/src/components/form-layout/form-layout.types.d.ts +1 -0
- package/dist/@types/packages/vue2/src/components/form-layout/form-layout.vue.d.ts +33 -0
- package/dist/@types/packages/vue2/src/components/form-layout/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/input-field/input-field.vue.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +53 -22
- package/dist/@types/packages/vue2/src/components/modal/components/base-modal/__mocks__/base-modal.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/modal/components/base-modal/base-modal.vue.d.ts +51 -44
- package/dist/@types/packages/vue2/src/components/modal/components/modal-default/modal-default.vue.d.ts +3 -3
- package/dist/@types/packages/vue2/src/components/modal/modal.vue.d.ts +4 -12
- package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +50 -4
- package/dist/@types/packages/vue2/src/components/search-bar/search-bar.vue.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/sidepanel/components/sidepanel-page.vue.d.ts +68 -0
- package/dist/@types/packages/vue2/src/components/sidepanel/index.d.ts +3 -0
- package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.keys.d.ts +2 -0
- package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.types.d.ts +21 -0
- package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.vue.d.ts +43 -0
- package/dist/@types/packages/vue2/src/components/tabs/tabs.types.d.ts +1 -1
- package/dist/@types/packages/vue2/src/components/textarea/textarea.vue.d.ts +2 -1
- package/dist/@types/packages/vue2/src/components/timeline/timeline.types.d.ts +1 -1
- package/dist/@types/packages/vue2/src/composables/index.d.ts +1 -0
- package/dist/@types/packages/vue2/src/composables/use-form-layout-loading/use-form-layout-loading.d.ts +4 -0
- package/dist/@types/packages/vue2/src/index.d.ts +2 -0
- package/dist/@types/packages/vue2/src/types/utils-events.d.ts +0 -1
- package/dist/@types/packages/vue2/src/utils/ts/dev-environment.d.ts +1 -0
- package/dist/accordion.js +1 -1
- package/dist/alert.js +3 -3
- package/dist/assets/arrow-left.css +1 -0
- package/dist/assets/base-button.css +1 -1
- package/dist/assets/button.css +1 -1
- package/dist/assets/calendar.css +1 -1
- package/dist/assets/checkbox.css +1 -1
- package/dist/assets/controls-group.css +1 -1
- package/dist/assets/copy.css +1 -1
- package/dist/assets/dropdown-default-textbox.css +1 -1
- package/dist/assets/dropdown.css +1 -1
- package/dist/assets/error-message.css +1 -1
- package/dist/assets/footer-actions.css +1 -0
- package/dist/assets/grid-layout.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index40.css +1 -0
- package/dist/assets/index41.css +1 -0
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/assets/listbox-option-tag.css +1 -1
- package/dist/assets/listbox.css +1 -1
- package/dist/assets/loading-button.css +1 -1
- package/dist/assets/tooltip.css +1 -1
- package/dist/avatar-image.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/button.js +3 -3
- package/dist/card.js +3 -3
- package/dist/checkbox.js +93 -84
- package/dist/checkbox.js.map +1 -1
- package/dist/chunks/arrow-left.1d5d08bd.js +26 -0
- package/dist/chunks/arrow-left.1d5d08bd.js.map +1 -0
- package/dist/chunks/{base-button.d4487ac9.js → base-button.98379576.js} +2 -2
- package/dist/chunks/{base-button.d4487ac9.js.map → base-button.98379576.js.map} +1 -1
- package/dist/chunks/{button-actions.cf73ed47.js → button-actions.bd397c79.js} +2 -2
- package/dist/chunks/{button-actions.cf73ed47.js.map → button-actions.bd397c79.js.map} +1 -1
- package/dist/chunks/{button.c27a7ce2.js → button.d0c9527d.js} +2 -2
- package/dist/chunks/{button.c27a7ce2.js.map → button.d0c9527d.js.map} +1 -1
- package/dist/chunks/{calendar.8f50a65a.js → calendar.0ae43a96.js} +6 -6
- package/dist/chunks/calendar.0ae43a96.js.map +1 -0
- package/dist/chunks/{checkbox.c06daf12.js → checkbox.f8457c93.js} +3 -3
- package/dist/chunks/{checkbox.c06daf12.js.map → checkbox.f8457c93.js.map} +1 -1
- package/dist/chunks/controls-group.b827382b.js +87 -0
- package/dist/chunks/controls-group.b827382b.js.map +1 -0
- package/dist/chunks/{copy.b62beae5.js → copy.5a4cbd4d.js} +3 -3
- package/dist/chunks/{copy.b62beae5.js.map → copy.5a4cbd4d.js.map} +1 -1
- package/dist/chunks/{dropdown-default-textbox.a5eca928.js → dropdown-default-textbox.819e43f7.js} +32 -30
- package/dist/chunks/dropdown-default-textbox.819e43f7.js.map +1 -0
- package/dist/chunks/{dropdown.368486b1.js → dropdown.c05678d0.js} +142 -139
- package/dist/chunks/dropdown.c05678d0.js.map +1 -0
- package/dist/chunks/{error-message.a581a172.js → error-message.0433b539.js} +2 -2
- package/dist/chunks/{error-message.a581a172.js.map → error-message.0433b539.js.map} +1 -1
- package/dist/chunks/footer-actions.67642347.js +98 -0
- package/dist/chunks/footer-actions.67642347.js.map +1 -0
- package/dist/chunks/form-layout.types.a7a1438d.js +5 -0
- package/dist/chunks/form-layout.types.a7a1438d.js.map +1 -0
- package/dist/chunks/{index.3b6fc08a.js → index.0cf00b47.js} +6 -6
- package/dist/chunks/{index.3b6fc08a.js.map → index.0cf00b47.js.map} +1 -1
- package/dist/chunks/{index.f0d99471.js → index.10aaf539.js} +198 -192
- package/dist/chunks/{index.f0d99471.js.map → index.10aaf539.js.map} +1 -1
- package/dist/chunks/{index.ad39b625.js → index.133e4da0.js} +2 -2
- package/dist/chunks/{index.ad39b625.js.map → index.133e4da0.js.map} +1 -1
- package/dist/chunks/{index.175f9e2d.js → index.56858f4e.js} +15 -14
- package/dist/chunks/index.56858f4e.js.map +1 -0
- package/dist/chunks/{index.d07f9800.js → index.73d50fa6.js} +2 -2
- package/dist/chunks/{index.d07f9800.js.map → index.73d50fa6.js.map} +1 -1
- package/dist/chunks/{index.3dfea3bd.js → index.f0f8ed98.js} +3 -3
- package/dist/chunks/{index.3dfea3bd.js.map → index.f0f8ed98.js.map} +1 -1
- package/dist/chunks/{listbox-option-tag.c7e9a228.js → listbox-option-tag.8d6cccac.js} +3 -3
- package/dist/chunks/{listbox-option-tag.c7e9a228.js.map → listbox-option-tag.8d6cccac.js.map} +1 -1
- package/dist/chunks/{listbox.f51e92cd.js → listbox.116ed0c1.js} +177 -177
- package/dist/chunks/listbox.116ed0c1.js.map +1 -0
- package/dist/chunks/{loading-button.6d34f66f.js → loading-button.1c201f87.js} +10 -10
- package/dist/chunks/loading-button.1c201f87.js.map +1 -0
- package/dist/chunks/{tooltip.9af34fba.js → tooltip.2aff4fa6.js} +2 -2
- package/dist/chunks/tooltip.2aff4fa6.js.map +1 -0
- package/dist/chunks/use-form-layout-loading.d03e5d48.js +12 -0
- package/dist/chunks/use-form-layout-loading.d03e5d48.js.map +1 -0
- package/dist/code-snippet.js +6 -6
- package/dist/code-snippet.js.map +1 -1
- package/dist/country.js +149 -174
- package/dist/country.js.map +1 -1
- package/dist/currency.js +1 -1
- package/dist/data-grid.js +482 -499
- package/dist/data-grid.js.map +1 -1
- package/dist/date-picker.js +80 -74
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range-picker.js +2 -2
- package/dist/date.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.js +72 -67
- package/dist/dropdown.js.map +1 -1
- package/dist/filter-bar.js +268 -265
- package/dist/filter-bar.js.map +1 -1
- package/dist/focus-trap.js +1 -1
- package/dist/form-layout.js +174 -0
- package/dist/form-layout.js.map +1 -0
- package/dist/header.js +3 -3
- package/dist/index.js +164 -155
- package/dist/index.js.map +1 -1
- package/dist/info-icon.js +2 -2
- package/dist/input-field.js +69 -67
- package/dist/input-field.js.map +1 -1
- package/dist/internal.js +6 -6
- package/dist/link.js +2 -2
- package/dist/loading-indicator.js +1 -1
- package/dist/menu.js +4 -4
- package/dist/modal.js +203 -324
- package/dist/modal.js.map +1 -1
- package/dist/pagination.js +4 -4
- package/dist/payment-method.js +2 -2
- package/dist/popover.js +4 -4
- package/dist/popper-container.js +2 -2
- package/dist/radio-group.js +97 -99
- package/dist/radio-group.js.map +1 -1
- package/dist/search-bar.js +2 -2
- package/dist/segmented-control.js +4 -4
- package/dist/sidepanel.js +218 -0
- package/dist/sidepanel.js.map +1 -0
- package/dist/status.js +2 -2
- package/dist/structured-list.js +1 -1
- package/dist/summary-grid.js +3 -3
- package/dist/tabs.js +3 -3
- package/dist/tabs.js.map +1 -1
- package/dist/tag.js +3 -3
- package/dist/textarea.js +84 -82
- package/dist/textarea.js.map +1 -1
- package/dist/timeline.js +23 -23
- package/dist/timeline.js.map +1 -1
- package/dist/toast.js +2 -2
- package/dist/toggle.js +2 -2
- package/dist/typography.js +1 -1
- package/dist/web-types.json +455 -73
- package/package.json +10 -8
- package/dist/@types/packages/vue2/src/components/country/composables/useCountryFlag.d.ts +0 -2
- package/dist/chunks/calendar.8f50a65a.js.map +0 -1
- package/dist/chunks/controls-group.9d58a091.js +0 -64
- package/dist/chunks/controls-group.9d58a091.js.map +0 -1
- package/dist/chunks/dropdown-default-textbox.a5eca928.js.map +0 -1
- package/dist/chunks/dropdown.368486b1.js.map +0 -1
- package/dist/chunks/index.175f9e2d.js.map +0 -1
- package/dist/chunks/listbox.f51e92cd.js.map +0 -1
- package/dist/chunks/loading-button.6d34f66f.js.map +0 -1
- package/dist/chunks/tooltip.9af34fba.js.map +0 -1
package/dist/radio-group.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { B
|
|
3
|
-
import { u as
|
|
1
|
+
import { defineComponent as y, toRefs as S, computed as o, toRef as b } from "vue";
|
|
2
|
+
import { B, b as I, a as R, d as T } from "./chunks/index.56858f4e.js";
|
|
3
|
+
import { u as V } from "./chunks/aria-label.ac9651a5.js";
|
|
4
4
|
import { g as f } from "./chunks/unique-id.a2a2b458.js";
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
import { g as
|
|
8
|
-
import { n as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import "./
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import { u as A } from "./chunks/use-has-slot.068222e6.js";
|
|
6
|
+
import { u as L } from "./chunks/use-default-slot-validator.83d977a1.js";
|
|
7
|
+
import { g as D } from "./chunks/get-slot-text.e5c766d0.js";
|
|
8
|
+
import { n as m } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
9
|
+
import { u as x } from "./chunks/use-form-layout-loading.d03e5d48.js";
|
|
10
|
+
import { C as O } from "./chunks/controls-group.b827382b.js";
|
|
11
|
+
import { E as k } from "./chunks/error-message.0433b539.js";
|
|
12
|
+
import "./assets/index22.css";
|
|
13
|
+
var d = /* @__PURE__ */ ((a) => (a.DISABLED = "disabled", a.READONLY = "readonly", a.ERROR = "error", a))(d || {}), u = /* @__PURE__ */ ((a) => (a.HORIZONTAL = "horizontal", a.VERTICAL = "vertical", a))(u || {}), n = /* @__PURE__ */ ((a) => (a.UPDATE = "update:model-value", a))(n || {});
|
|
14
|
+
const M = y({
|
|
14
15
|
name: "radio-button",
|
|
15
|
-
components: { BentoTypography:
|
|
16
|
+
components: { BentoTypography: B },
|
|
16
17
|
props: {
|
|
17
18
|
/**
|
|
18
19
|
* Disable the radio button (optional)
|
|
@@ -53,136 +54,132 @@ const x = p({
|
|
|
53
54
|
},
|
|
54
55
|
emits: [n.UPDATE],
|
|
55
56
|
setup(a, { slots: e, emit: r }) {
|
|
56
|
-
const t =
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
[`b-radio-button--${
|
|
60
|
-
[`b-radio-button--${
|
|
61
|
-
})),
|
|
62
|
-
[`b-radio-button__input--${
|
|
63
|
-
})),
|
|
64
|
-
ariaLabel:
|
|
65
|
-
label:
|
|
66
|
-
}),
|
|
57
|
+
const t = A(e), { value: l } = S(a), c = f("radio-button"), p = f("description"), s = t("default"), i = t("description");
|
|
58
|
+
L("radio-button", s, i);
|
|
59
|
+
const _ = o(() => ({
|
|
60
|
+
[`b-radio-button--${d.DISABLED}`]: a.disabled,
|
|
61
|
+
[`b-radio-button--${d.READONLY}`]: a.readonly
|
|
62
|
+
})), g = o(() => ({
|
|
63
|
+
[`b-radio-button__input--${d.ERROR}`]: a.hasError
|
|
64
|
+
})), h = V({
|
|
65
|
+
ariaLabel: D(e)("default"),
|
|
66
|
+
label: l.value
|
|
67
|
+
}), v = o(() => a.hasError), E = o(() => a.value === a.modelValue);
|
|
67
68
|
return {
|
|
68
69
|
// Values
|
|
69
|
-
ariaLabel:
|
|
70
|
-
ariaInvalid:
|
|
71
|
-
isChecked:
|
|
72
|
-
defaultSlotValue:
|
|
73
|
-
descriptionSlotValue:
|
|
74
|
-
conditionalClassContainer:
|
|
75
|
-
conditionalClassInput:
|
|
70
|
+
ariaLabel: h,
|
|
71
|
+
ariaInvalid: v,
|
|
72
|
+
isChecked: E,
|
|
73
|
+
defaultSlotValue: s,
|
|
74
|
+
descriptionSlotValue: i,
|
|
75
|
+
conditionalClassContainer: _,
|
|
76
|
+
conditionalClassInput: g,
|
|
76
77
|
radioButtonId: c,
|
|
77
|
-
descriptionId:
|
|
78
|
+
descriptionId: p,
|
|
78
79
|
// Events
|
|
79
80
|
onChange: () => {
|
|
80
81
|
!a.disabled && !a.readonly && r(n.UPDATE, a.value);
|
|
81
82
|
},
|
|
82
|
-
onClick: (
|
|
83
|
-
a.readonly &&
|
|
83
|
+
onClick: (C) => {
|
|
84
|
+
a.readonly && C.preventDefault();
|
|
84
85
|
},
|
|
85
86
|
// Enums
|
|
86
|
-
BentoTypographyVariant:
|
|
87
|
-
BentoTypographyElement:
|
|
87
|
+
BentoTypographyVariant: I,
|
|
88
|
+
BentoTypographyElement: R
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
});
|
|
91
|
-
var
|
|
92
|
+
var P = function() {
|
|
92
93
|
var e = this, r = e._self._c;
|
|
93
|
-
return e._self._setupProxy, r("div", { staticClass: "b-radio-button", class: e.conditionalClassContainer, attrs: { "data-testid": "radio-button-container" } }, [r("input", { staticClass: "b-radio-button__input", class: e.conditionalClassInput, attrs: { id: e.radioButtonId, "aria-checked": e.isChecked, "aria-label": e.ariaLabel, "aria-invalid": e.ariaInvalid, "aria-describedby": e.descriptionSlotValue ? e.descriptionId : "", disabled: e.disabled, "aria-readonly": e.readonly, type: "radio", role: "radio" }, domProps: { checked: e.isChecked, value: e.value }, on: { click: e.onClick, change: e.onChange } }), e.defaultSlotValue ? r("label", { staticClass: "b-radio-button__label-container", attrs: { for: e.radioButtonId } }, [e.defaultSlotValue ? r("bento-typography", { staticClass: "b-radio-button__label", attrs: { el: e.BentoTypographyElement.SPAN, variant: e.BentoTypographyVariant.BODY } }, [e._t("default")], 2) : e._e(), e.defaultSlotValue && e.descriptionSlotValue ? r("bento-typography", { staticClass: "b-radio-button__description", attrs: { id: e.descriptionId, el: e.BentoTypographyElement.SPAN, variant: e.BentoTypographyVariant.BODY } }, [e._t("description")], 2) : e._e()], 1) : e._e()]);
|
|
94
|
-
},
|
|
95
|
-
x,
|
|
94
|
+
return e._self._setupProxy, r("div", { staticClass: "b-radio-button", class: e.conditionalClassContainer, attrs: { "data-testid": "radio-button-container" } }, [r("input", { staticClass: "b-radio-button__input", class: e.conditionalClassInput, attrs: { id: e.radioButtonId, "aria-checked": e.isChecked, "aria-label": e.ariaLabel, "aria-invalid": e.ariaInvalid, "aria-describedby": e.descriptionSlotValue ? e.descriptionId : "", disabled: e.disabled, "aria-readonly": e.readonly ? e.readonly : void 0, type: "radio", role: "radio" }, domProps: { checked: e.isChecked, value: e.value }, on: { click: e.onClick, change: e.onChange } }), e.defaultSlotValue ? r("label", { staticClass: "b-radio-button__label-container", attrs: { for: e.radioButtonId } }, [e.defaultSlotValue ? r("bento-typography", { staticClass: "b-radio-button__label", attrs: { el: e.BentoTypographyElement.SPAN, variant: e.BentoTypographyVariant.BODY } }, [e._t("default")], 2) : e._e(), e.defaultSlotValue && e.descriptionSlotValue ? r("bento-typography", { staticClass: "b-radio-button__description", attrs: { id: e.descriptionId, el: e.BentoTypographyElement.SPAN, variant: e.BentoTypographyVariant.BODY } }, [e._t("description")], 2) : e._e()], 1) : e._e()]);
|
|
95
|
+
}, N = [], U = /* @__PURE__ */ m(
|
|
96
96
|
M,
|
|
97
97
|
P,
|
|
98
|
+
N,
|
|
98
99
|
!1,
|
|
99
100
|
null,
|
|
100
|
-
"
|
|
101
|
+
"6afbb307",
|
|
101
102
|
null,
|
|
102
103
|
null
|
|
103
104
|
);
|
|
104
|
-
const
|
|
105
|
+
const $ = U.exports, q = y({
|
|
105
106
|
name: "bento-radio-group",
|
|
106
|
-
components: { ControlsGroup:
|
|
107
|
+
components: { ControlsGroup: O, ErrorMessage: k, RadioButton: $ },
|
|
107
108
|
props: {
|
|
109
|
+
/**
|
|
110
|
+
* Descriptive supporting text visbile underneath the label.
|
|
111
|
+
*/
|
|
112
|
+
description: { type: String, default: null },
|
|
108
113
|
/**
|
|
109
114
|
* If set to true, renders all radio-buttons in the group in a disabled state.
|
|
110
115
|
*/
|
|
111
|
-
disabled: {
|
|
112
|
-
type: Boolean,
|
|
113
|
-
default: !1
|
|
114
|
-
},
|
|
116
|
+
disabled: { type: Boolean, default: !1 },
|
|
115
117
|
/**
|
|
116
118
|
* If string is passed, all radio-buttons in an error state and renders the string beneath the buttons.
|
|
117
119
|
*/
|
|
118
|
-
errorMessage: {
|
|
119
|
-
type: String,
|
|
120
|
-
default: null
|
|
121
|
-
},
|
|
120
|
+
errorMessage: { type: String, default: null },
|
|
122
121
|
/**
|
|
123
122
|
* The form id the radio group is associated with. Defaults to null, as a radio group can also be used standalone.
|
|
124
123
|
*/
|
|
125
|
-
formId: {
|
|
126
|
-
type: String,
|
|
127
|
-
default: null
|
|
128
|
-
},
|
|
124
|
+
formId: { type: String, default: null },
|
|
129
125
|
/**
|
|
130
126
|
* If set to true, renders all radio-buttons in the group in an error state.
|
|
131
127
|
*
|
|
132
128
|
* @deprecated Use "errorMessage" prop instead
|
|
133
129
|
*/
|
|
134
|
-
hasError: {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
hasError: { type: Boolean, default: !1 },
|
|
131
|
+
/**
|
|
132
|
+
* Shows/hides the group label.
|
|
133
|
+
*/
|
|
134
|
+
hideLabel: { type: Boolean, default: null },
|
|
138
135
|
/**
|
|
139
136
|
* The radio group's items.
|
|
140
137
|
*/
|
|
141
|
-
items: {
|
|
142
|
-
type: Array,
|
|
143
|
-
required: !0
|
|
144
|
-
},
|
|
138
|
+
items: { type: Array, required: !0 },
|
|
145
139
|
/**
|
|
146
140
|
* The name associated with the group. Required for accessibility purposes.
|
|
147
141
|
*/
|
|
148
|
-
label: {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
label: { type: String, required: !0 },
|
|
143
|
+
/**
|
|
144
|
+
* Determines the initially selected value of the group. Corresponds to the BentoRadioButtonItem's value.
|
|
145
|
+
* Defaults to no value selected.
|
|
146
|
+
*/
|
|
147
|
+
modelValue: { type: [Number, String, null], default: null },
|
|
148
|
+
/**
|
|
149
|
+
* Indicates the field is optional.
|
|
150
|
+
*/
|
|
151
|
+
optional: { type: Boolean, default: !1 },
|
|
152
152
|
/**
|
|
153
153
|
* If set to true, renders all radio-buttons in the group in a readonly state.
|
|
154
154
|
*/
|
|
155
|
-
readonly: {
|
|
156
|
-
type: Boolean,
|
|
157
|
-
default: !1
|
|
158
|
-
},
|
|
155
|
+
readonly: { type: Boolean, default: !1 },
|
|
159
156
|
/**
|
|
160
|
-
*
|
|
161
|
-
* Defaults to no value selected.
|
|
157
|
+
* Indicates the field is required.
|
|
162
158
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
required: { type: Boolean, default: !1 },
|
|
160
|
+
/**
|
|
161
|
+
* Tooltip message.
|
|
162
|
+
*/
|
|
163
|
+
tooltipText: { type: String, default: null },
|
|
167
164
|
/**
|
|
168
165
|
* The radio group's layout. It can be vertical or horizontal. Defaults to vertical.
|
|
169
166
|
*/
|
|
170
167
|
variant: {
|
|
171
168
|
type: String,
|
|
172
|
-
default:
|
|
173
|
-
validator: (a) => Object.values(
|
|
169
|
+
default: u.VERTICAL,
|
|
170
|
+
validator: (a) => Object.values(u).includes(a)
|
|
174
171
|
}
|
|
175
172
|
},
|
|
176
173
|
emits: [n.UPDATE],
|
|
177
174
|
setup(a, { emit: e }) {
|
|
178
|
-
const r =
|
|
179
|
-
() => !a.disabled && !
|
|
180
|
-
),
|
|
181
|
-
"b-radio-group__buttons--horizontal": a.variant ===
|
|
182
|
-
})),
|
|
183
|
-
e(n.UPDATE,
|
|
175
|
+
const r = b(a, "modelValue"), t = f("error"), { isReadOnly: l } = x(b(a, "readonly")), c = o(
|
|
176
|
+
() => !a.disabled && !l.value && (!!a.errorMessage || a.hasError)
|
|
177
|
+
), p = o(() => !a.disabled && !l.value && !!a.errorMessage), s = o(() => ({
|
|
178
|
+
"b-radio-group__buttons--horizontal": a.variant === u.HORIZONTAL
|
|
179
|
+
})), i = (_) => {
|
|
180
|
+
e(n.UPDATE, _);
|
|
184
181
|
};
|
|
185
|
-
return a.hasError &&
|
|
182
|
+
return a.hasError && T(
|
|
186
183
|
'BentoRadioGroup "hasError" property',
|
|
187
184
|
`Use the BentoRadioGroup "errorMessage" property instead to indicate that there is a modifier error.
|
|
188
185
|
Having the field as "undefined" will hide/remove the error.
|
|
@@ -192,34 +189,35 @@ const U = N.exports, $ = p({
|
|
|
192
189
|
// Values
|
|
193
190
|
inputValue: r,
|
|
194
191
|
errorId: t,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
isReadOnly: l,
|
|
193
|
+
shouldShowError: c,
|
|
194
|
+
shouldShowErrorMessage: p,
|
|
195
|
+
conditionalClasses: s,
|
|
198
196
|
// Methods
|
|
199
|
-
onInput:
|
|
197
|
+
onInput: i
|
|
200
198
|
};
|
|
201
199
|
}
|
|
202
200
|
});
|
|
203
201
|
var w = function() {
|
|
204
202
|
var e = this, r = e._self._c;
|
|
205
|
-
return e._self._setupProxy, r("div", { staticClass: "b-radio-group" }, [r("controls-group", { staticClass: "b-radio-group__buttons", class: e.conditionalClasses, attrs: {
|
|
206
|
-
return r("radio-button", { key: t.value, attrs: { "model-value": e.inputValue, value: t.value, disabled: e.disabled || t.disabled, readonly: e.
|
|
203
|
+
return e._self._setupProxy, r("div", { staticClass: "b-radio-group" }, [r("controls-group", { staticClass: "b-radio-group__buttons", class: e.conditionalClasses, attrs: { "aria-describedby": e.shouldShowErrorMessage ? e.errorId : "", description: e.description, disabled: e.disabled, form: e.formId, label: e.label, optional: e.optional, required: e.required, "hide-label": e.hideLabel, "tooltip-text": e.tooltipText } }, e._l(e.items, function(t) {
|
|
204
|
+
return r("radio-button", { key: t.value, attrs: { "model-value": e.inputValue, value: t.value, disabled: e.disabled || t.disabled, readonly: e.isReadOnly || t.readonly, "has-error": e.shouldShowError || t.hasError }, on: { "update:model-value": e.onInput }, scopedSlots: e._u([t.description ? { key: "description", fn: function() {
|
|
207
205
|
return [e._v(e._s(t.description))];
|
|
208
206
|
}, proxy: !0 } : null], null, !0) }, [e._v(" " + e._s(t.label) + " ")]);
|
|
209
207
|
}), 1), e.shouldShowErrorMessage ? r("error-message", { staticClass: "b-radio-group__error-message", attrs: { id: e.errorId, "error-message": e.errorMessage } }) : e._e()], 1);
|
|
210
|
-
},
|
|
211
|
-
|
|
208
|
+
}, F = [], G = /* @__PURE__ */ m(
|
|
209
|
+
q,
|
|
212
210
|
w,
|
|
213
|
-
|
|
211
|
+
F,
|
|
214
212
|
!1,
|
|
215
213
|
null,
|
|
216
|
-
"
|
|
214
|
+
"fc63e591",
|
|
217
215
|
null,
|
|
218
216
|
null
|
|
219
217
|
);
|
|
220
|
-
const
|
|
218
|
+
const te = G.exports;
|
|
221
219
|
export {
|
|
222
|
-
|
|
223
|
-
|
|
220
|
+
te as BentoRadioGroup,
|
|
221
|
+
u as BentoRadioGroupVariant
|
|
224
222
|
};
|
|
225
223
|
//# sourceMappingURL=radio-group.js.map
|
package/dist/radio-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","sources":["../src/components/radio-group/components/radio-button/radio-button.types.ts","../src/components/radio-group/radio-group.types.ts","../src/components/radio-group/components/radio-button/radio-button.vue","../src/components/radio-group/radio-group.vue"],"sourcesContent":["export enum BentoRadioButtonStateClass {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n","export enum BentoRadioGroupVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoRadioGroupItem {\n value: string | number;\n label: string;\n description?: string;\n disabled?: boolean;\n readonly?: boolean;\n hasError?: boolean;\n}\n\nexport type BentoRadioGroupItems = Array<BentoRadioGroupItem>;\n\nexport enum BentoRadioGroupEvent {\n UPDATE = 'update:model-value',\n}\n","<template>\n <div class=\"b-radio-button\" data-testid=\"radio-button-container\" :class=\"conditionalClassContainer\">\n <input\n :id=\"radioButtonId\"\n :aria-checked=\"isChecked\"\n :aria-label=\"ariaLabel\"\n :aria-invalid=\"ariaInvalid\"\n :aria-describedby=\"descriptionSlotValue ? descriptionId : ''\"\n :checked=\"isChecked\"\n :disabled=\"disabled\"\n :aria-readonly=\"readonly\"\n :value=\"value\"\n type=\"radio\"\n class=\"b-radio-button__input\"\n :class=\"conditionalClassInput\"\n role=\"radio\"\n @click=\"onClick\"\n @change=\"onChange\"\n />\n <label v-if=\"defaultSlotValue\" :for=\"radioButtonId\" class=\"b-radio-button__label-container\">\n <bento-typography\n v-if=\"defaultSlotValue\"\n class=\"b-radio-button__label\"\n :el=\"BentoTypographyElement.SPAN\"\n :variant=\"BentoTypographyVariant.BODY\"\n >\n <slot></slot>\n </bento-typography>\n <bento-typography\n v-if=\"defaultSlotValue && descriptionSlotValue\"\n :id=\"descriptionId\"\n class=\"b-radio-button__description\"\n :el=\"BentoTypographyElement.SPAN\"\n :variant=\"BentoTypographyVariant.BODY\"\n >\n <slot name=\"description\"></slot>\n </bento-typography>\n </label>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '@/components/typography';\n import type { HTMLAttributes } from 'vue/types/jsx';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/utils/ts/unique-id';\n import { computed, ComputedRef, defineComponent, toRefs } from 'vue';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { BentoRadioButtonStateClass } from './radio-button.types';\n import { BentoRadioGroupEvent } from '../../radio-group.types';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n\n /**\n * Radio buttons are used when two or more options are mutually exclusive,\n * the user can only select a single option from a list of pre-defined options.\n * The label tag area is also clickable.\n * Only to be used internally.\n *\n * @usage\n * import { RadioButton } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { RadioButton },\n * template: `\n * <radio-button\n * disabled\n * value=\"inputRadio\"\n * >\n * Label text\n * <template #description>Description text below label</template>\n * </radio-button>\n * `,\n * }\n */\n export default defineComponent({\n name: 'radio-button',\n components: { BentoTypography },\n props: {\n /**\n * Disable the radio button (optional)\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Shows radio-button in error state (optional)\n */\n hasError: {\n type: Boolean,\n default: false,\n },\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on radio component.\n */\n modelValue: {\n type: [String, Number],\n default: null,\n },\n /**\n * Sets the radio button to readonly (optional)\n */\n readonly: {\n type: Boolean,\n default: false,\n },\n /**\n * Indicates the value of the input that will be returned when it's checked\n */\n value: {\n type: [String, Number],\n required: true,\n },\n },\n emits: [BentoRadioGroupEvent.UPDATE],\n setup(props, { slots, emit }) {\n const hasSlot = useHasSlot(slots);\n const { value } = toRefs(props);\n const radioButtonId = generateUid('radio-button');\n const descriptionId = generateUid('description');\n\n const defaultSlotValue = hasSlot('default');\n const descriptionSlotValue = hasSlot('description');\n\n useDefaultSlotValidator('radio-button', defaultSlotValue, descriptionSlotValue);\n\n const conditionalClassContainer = computed(() => ({\n [`b-radio-button--${BentoRadioButtonStateClass.DISABLED}`]: props.disabled,\n [`b-radio-button--${BentoRadioButtonStateClass.READONLY}`]: props.readonly,\n }));\n const conditionalClassInput = computed(() => ({\n [`b-radio-button__input--${BentoRadioButtonStateClass.ERROR}`]: props.hasError,\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: getSlotText(slots)('default'),\n label: value.value as string,\n });\n const ariaInvalid = computed<HTMLAttributes['aria-invalid']>(() => props.hasError);\n\n const isChecked: ComputedRef<boolean> = computed(() => props.value === props.modelValue);\n\n const onChange = () => {\n if (!props.disabled && !props.readonly) {\n emit(BentoRadioGroupEvent.UPDATE, props.value);\n }\n };\n\n // readonly attr doesn't work with radio button, so we need to manually ignore the click instead\n const onClick = event => {\n if (props.readonly) {\n event.preventDefault();\n }\n };\n\n return {\n // Values\n ariaLabel,\n ariaInvalid,\n isChecked,\n defaultSlotValue,\n descriptionSlotValue,\n conditionalClassContainer,\n conditionalClassInput,\n radioButtonId,\n descriptionId,\n\n // Events\n onChange,\n onClick,\n\n // Enums\n BentoTypographyVariant,\n BentoTypographyElement,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./radio-button.scss\" />\n","<template>\n <div class=\"b-radio-group\">\n <controls-group\n class=\"b-radio-group__buttons\"\n :class=\"conditionalClasses\"\n :form=\"formId\"\n :disabled=\"disabled\"\n :label=\"label\"\n :aria-describedby=\"shouldShowErrorMessage ? errorId : ''\"\n >\n <radio-button\n v-for=\"item in items\"\n :key=\"item.value\"\n :model-value=\"inputValue\"\n :value=\"item.value\"\n :disabled=\"disabled || item.disabled\"\n :readonly=\"readonly || item.readonly\"\n :has-error=\"shouldShowError || item.hasError\"\n @update:model-value=\"onInput\"\n >\n {{ item.label }}\n <template v-if=\"item.description\" #description>{{ item.description }}</template>\n </radio-button>\n </controls-group>\n <error-message\n v-if=\"shouldShowErrorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-radio-group__error-message\"\n />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, toRef } from 'vue';\n import { ControlsGroup, ErrorMessage } from '@/components/internal';\n import RadioButton from './components/radio-button/radio-button.vue';\n import { generateUid } from '@/utils/ts/unique-id';\n import { deprecate } from '@/utils/ts/deprecate';\n import { BentoRadioGroupEvent, BentoRadioGroupItems, BentoRadioGroupVariant } from './radio-group.types';\n\n /**\n * A radio group component should be used whenever it is necessary to use a set of radio buttons\n * This component conforms to the official WAI-ARIA guidelines for grouping controls: https://www.w3.org/WAI/tutorials/forms/grouping/\n *\n * import { BentoRadioGroup, BentoRadioGroupVariant } from '@adyen/bento-vue2/';\n *\n * export default {\n * components: { BentoRadioGroup },\n * template: `\n * <bento-radio-group\n * label=\"Your group label\"\n * :items=\"[\n * { value: 1, label: 'Your label' },\n * { value: 2, label: 'Another label', description: 'Your descriptive sub label' },\n * ]\"\n * :variant=\"BentoRadioGroupVariant.HORIZONTAL\"\n * />\n * `\n * };\n */\n export default defineComponent({\n name: 'bento-radio-group',\n components: { ControlsGroup, ErrorMessage, RadioButton },\n props: {\n /**\n * If set to true, renders all radio-buttons in the group in a disabled state.\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * If string is passed, all radio-buttons in an error state and renders the string beneath the buttons.\n */\n errorMessage: {\n type: String,\n default: null,\n },\n /**\n * The form id the radio group is associated with. Defaults to null, as a radio group can also be used standalone.\n */\n formId: {\n type: String,\n default: null,\n },\n /**\n * If set to true, renders all radio-buttons in the group in an error state.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n hasError: {\n type: Boolean,\n default: false,\n },\n /**\n * The radio group's items.\n */\n items: {\n type: Array as PropType<BentoRadioGroupItems>,\n required: true,\n },\n /**\n * The name associated with the group. Required for accessibility purposes.\n */\n label: {\n type: String,\n required: true,\n },\n /**\n * If set to true, renders all radio-buttons in the group in a readonly state.\n */\n readonly: {\n type: Boolean,\n default: false,\n },\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoRadioButtonItem's value.\n * Defaults to no value selected.\n */\n modelValue: {\n type: [Number, String, null],\n default: null,\n },\n /**\n * The radio group's layout. It can be vertical or horizontal. Defaults to vertical.\n */\n variant: {\n type: String as PropType<BentoRadioGroupVariant | `${BentoRadioGroupVariant}`>,\n default: BentoRadioGroupVariant.VERTICAL,\n validator: (value: BentoRadioGroupVariant) => Object.values(BentoRadioGroupVariant).includes(value),\n },\n },\n emits: [BentoRadioGroupEvent.UPDATE],\n setup(props, { emit }) {\n const inputValue = toRef(props, 'modelValue');\n const errorId = generateUid('error');\n\n const shouldShowError = computed(\n () => !props.disabled && !props.readonly && (!!props.errorMessage || props.hasError)\n );\n const shouldShowErrorMessage = computed(() => !props.disabled && !props.readonly && !!props.errorMessage);\n\n const conditionalClasses = computed(() => ({\n 'b-radio-group__buttons--horizontal': props.variant === BentoRadioGroupVariant.HORIZONTAL,\n }));\n\n const onInput = value => {\n emit(BentoRadioGroupEvent.UPDATE, value);\n };\n\n if (props.hasError) {\n deprecate(\n 'BentoRadioGroup \"hasError\" property',\n `Use the BentoRadioGroup \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-radio-group errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n return {\n // Values\n inputValue,\n errorId,\n shouldShowError,\n shouldShowErrorMessage,\n conditionalClasses,\n\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./radio-group.scss\" />\n"],"names":["BentoRadioButtonStateClass","BentoRadioButtonStateClass2","BentoRadioGroupVariant","BentoRadioGroupVariant2","BentoRadioGroupEvent","BentoRadioGroupEvent2","_sfc_main$1","defineComponent","BentoTypography","props","slots","emit","hasSlot","useHasSlot","value","toRefs","radioButtonId","generateUid","descriptionId","defaultSlotValue","descriptionSlotValue","useDefaultSlotValidator","conditionalClassContainer","computed","conditionalClassInput","ariaLabel","useAriaLabel","getSlotText","ariaInvalid","isChecked","event","BentoTypographyVariant","BentoTypographyElement","_sfc_main","ControlsGroup","ErrorMessage","RadioButton","inputValue","toRef","errorId","shouldShowError","shouldShowErrorMessage","conditionalClasses","onInput","deprecate"],"mappings":";;;;;;;;;;;AAAY,IAAAA,IAAA,kBAA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AAAP;AAAA,MAEA,SAAAE;AAAA,MACA,iBAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,oBAAAC;AAAA;AAAA,MACA,SAAAC;AAAA,IAGA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"radio-group.js","sources":["../src/components/radio-group/components/radio-button/radio-button.types.ts","../src/components/radio-group/radio-group.types.ts","../src/components/radio-group/components/radio-button/radio-button.vue","../src/components/radio-group/radio-group.vue"],"sourcesContent":["export enum BentoRadioButtonStateClass {\n DISABLED = 'disabled',\n READONLY = 'readonly',\n ERROR = 'error',\n}\n","export enum BentoRadioGroupVariant {\n HORIZONTAL = 'horizontal',\n VERTICAL = 'vertical',\n}\n\nexport interface BentoRadioGroupItem {\n value: string | number;\n label: string;\n description?: string;\n disabled?: boolean;\n readonly?: boolean;\n hasError?: boolean;\n}\n\nexport type BentoRadioGroupItems = Array<BentoRadioGroupItem>;\n\nexport enum BentoRadioGroupEvent {\n UPDATE = 'update:model-value',\n}\n","<template>\n <div class=\"b-radio-button\" data-testid=\"radio-button-container\" :class=\"conditionalClassContainer\">\n <input\n :id=\"radioButtonId\"\n :aria-checked=\"isChecked\"\n :aria-label=\"ariaLabel\"\n :aria-invalid=\"ariaInvalid\"\n :aria-describedby=\"descriptionSlotValue ? descriptionId : ''\"\n :checked=\"isChecked\"\n :disabled=\"disabled\"\n :aria-readonly=\"readonly ? readonly : undefined\"\n :value=\"value\"\n type=\"radio\"\n class=\"b-radio-button__input\"\n :class=\"conditionalClassInput\"\n role=\"radio\"\n @click=\"onClick\"\n @change=\"onChange\"\n />\n <label v-if=\"defaultSlotValue\" :for=\"radioButtonId\" class=\"b-radio-button__label-container\">\n <bento-typography\n v-if=\"defaultSlotValue\"\n class=\"b-radio-button__label\"\n :el=\"BentoTypographyElement.SPAN\"\n :variant=\"BentoTypographyVariant.BODY\"\n >\n <slot></slot>\n </bento-typography>\n <bento-typography\n v-if=\"defaultSlotValue && descriptionSlotValue\"\n :id=\"descriptionId\"\n class=\"b-radio-button__description\"\n :el=\"BentoTypographyElement.SPAN\"\n :variant=\"BentoTypographyVariant.BODY\"\n >\n <slot name=\"description\"></slot>\n </bento-typography>\n </label>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '@/components/typography';\n import type { HTMLAttributes } from 'vue/types/jsx';\n import { useAriaLabel } from '@/utils/ts/aria-label';\n import { generateUid } from '@/utils/ts/unique-id';\n import { computed, ComputedRef, defineComponent, toRefs } from 'vue';\n import { useDefaultSlotValidator, useHasSlot } from '@/composables';\n import { BentoRadioButtonStateClass } from './radio-button.types';\n import { BentoRadioGroupEvent } from '../../radio-group.types';\n import { getSlotText } from '@/utils/ts/get-slot-text';\n\n /**\n * Radio buttons are used when two or more options are mutually exclusive,\n * the user can only select a single option from a list of pre-defined options.\n * The label tag area is also clickable.\n * Only to be used internally.\n *\n * @usage\n * import { RadioButton } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { RadioButton },\n * template: `\n * <radio-button\n * disabled\n * value=\"inputRadio\"\n * >\n * Label text\n * <template #description>Description text below label</template>\n * </radio-button>\n * `,\n * }\n */\n export default defineComponent({\n name: 'radio-button',\n components: { BentoTypography },\n props: {\n /**\n * Disable the radio button (optional)\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n /**\n * Shows radio-button in error state (optional)\n */\n hasError: {\n type: Boolean,\n default: false,\n },\n /**\n * This property should not be used directly.\n * It will be used by v-model directive on radio component.\n */\n modelValue: {\n type: [String, Number],\n default: null,\n },\n /**\n * Sets the radio button to readonly (optional)\n */\n readonly: {\n type: Boolean,\n default: false,\n },\n /**\n * Indicates the value of the input that will be returned when it's checked\n */\n value: {\n type: [String, Number],\n required: true,\n },\n },\n emits: [BentoRadioGroupEvent.UPDATE],\n setup(props, { slots, emit }) {\n const hasSlot = useHasSlot(slots);\n const { value } = toRefs(props);\n const radioButtonId = generateUid('radio-button');\n const descriptionId = generateUid('description');\n\n const defaultSlotValue = hasSlot('default');\n const descriptionSlotValue = hasSlot('description');\n\n useDefaultSlotValidator('radio-button', defaultSlotValue, descriptionSlotValue);\n\n const conditionalClassContainer = computed(() => ({\n [`b-radio-button--${BentoRadioButtonStateClass.DISABLED}`]: props.disabled,\n [`b-radio-button--${BentoRadioButtonStateClass.READONLY}`]: props.readonly,\n }));\n const conditionalClassInput = computed(() => ({\n [`b-radio-button__input--${BentoRadioButtonStateClass.ERROR}`]: props.hasError,\n }));\n\n const ariaLabel = useAriaLabel({\n ariaLabel: getSlotText(slots)('default'),\n label: value.value as string,\n });\n const ariaInvalid = computed<HTMLAttributes['aria-invalid']>(() => props.hasError);\n\n const isChecked: ComputedRef<boolean> = computed(() => props.value === props.modelValue);\n\n const onChange = () => {\n if (!props.disabled && !props.readonly) {\n emit(BentoRadioGroupEvent.UPDATE, props.value);\n }\n };\n\n // readonly attr doesn't work with radio button, so we need to manually ignore the click instead\n const onClick = event => {\n if (props.readonly) {\n event.preventDefault();\n }\n };\n\n return {\n // Values\n ariaLabel,\n ariaInvalid,\n isChecked,\n defaultSlotValue,\n descriptionSlotValue,\n conditionalClassContainer,\n conditionalClassInput,\n radioButtonId,\n descriptionId,\n\n // Events\n onChange,\n onClick,\n\n // Enums\n BentoTypographyVariant,\n BentoTypographyElement,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./radio-button.scss\" />\n","<template>\n <div class=\"b-radio-group\">\n <controls-group\n class=\"b-radio-group__buttons\"\n :aria-describedby=\"shouldShowErrorMessage ? errorId : ''\"\n :class=\"conditionalClasses\"\n :description=\"description\"\n :disabled=\"disabled\"\n :form=\"formId\"\n :label=\"label\"\n :optional=\"optional\"\n :required=\"required\"\n :hide-label=\"hideLabel\"\n :tooltip-text=\"tooltipText\"\n >\n <radio-button\n v-for=\"item in items\"\n :key=\"item.value\"\n :model-value=\"inputValue\"\n :value=\"item.value\"\n :disabled=\"disabled || item.disabled\"\n :readonly=\"isReadOnly || item.readonly\"\n :has-error=\"shouldShowError || item.hasError\"\n @update:model-value=\"onInput\"\n >\n {{ item.label }}\n <template v-if=\"item.description\" #description>{{ item.description }}</template>\n </radio-button>\n </controls-group>\n <error-message\n v-if=\"shouldShowErrorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-radio-group__error-message\"\n />\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType, toRef } from 'vue';\n import { ControlsGroup, ErrorMessage } from '@/components/internal';\n import RadioButton from './components/radio-button/radio-button.vue';\n import { generateUid } from '@/utils/ts/unique-id';\n import { deprecate } from '@/utils/ts/deprecate';\n import { BentoRadioGroupEvent, BentoRadioGroupItems, BentoRadioGroupVariant } from './radio-group.types';\n import { useFormLayoutFieldLoading } from '@/composables/use-form-layout-loading/use-form-layout-loading';\n\n /**\n * A radio group component should be used whenever it is necessary to use a set of radio buttons\n * This component conforms to the official WAI-ARIA guidelines for grouping controls: https://www.w3.org/WAI/tutorials/forms/grouping/\n *\n * import { BentoRadioGroup, BentoRadioGroupVariant } from '@adyen/bento-vue2/';\n *\n * export default {\n * components: { BentoRadioGroup },\n * template: `\n * <bento-radio-group\n * label=\"Your group label\"\n * :items=\"[\n * { value: 1, label: 'Your label' },\n * { value: 2, label: 'Another label', description: 'Your descriptive sub label' },\n * ]\"\n * :variant=\"BentoRadioGroupVariant.HORIZONTAL\"\n * />\n * `\n * };\n */\n export default defineComponent({\n name: 'bento-radio-group',\n components: { ControlsGroup, ErrorMessage, RadioButton },\n props: {\n /**\n * Descriptive supporting text visbile underneath the label.\n */\n description: { type: String, default: null },\n\n /**\n * If set to true, renders all radio-buttons in the group in a disabled state.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * If string is passed, all radio-buttons in an error state and renders the string beneath the buttons.\n */\n errorMessage: { type: String, default: null },\n\n /**\n * The form id the radio group is associated with. Defaults to null, as a radio group can also be used standalone.\n */\n formId: { type: String, default: null },\n\n /**\n * If set to true, renders all radio-buttons in the group in an error state.\n *\n * @deprecated Use \"errorMessage\" prop instead\n */\n hasError: { type: Boolean, default: false },\n\n /**\n * Shows/hides the group label.\n */\n hideLabel: { type: Boolean, default: null },\n\n /**\n * The radio group's items.\n */\n items: { type: Array as PropType<BentoRadioGroupItems>, required: true },\n\n /**\n * The name associated with the group. Required for accessibility purposes.\n */\n label: { type: String, required: true },\n\n /**\n * Determines the initially selected value of the group. Corresponds to the BentoRadioButtonItem's value.\n * Defaults to no value selected.\n */\n modelValue: { type: [Number, String, null], default: null },\n\n /**\n * Indicates the field is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * If set to true, renders all radio-buttons in the group in a readonly state.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Indicates the field is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Tooltip message.\n */\n tooltipText: { type: String, default: null },\n\n /**\n * The radio group's layout. It can be vertical or horizontal. Defaults to vertical.\n */\n variant: {\n type: String as PropType<BentoRadioGroupVariant | `${BentoRadioGroupVariant}`>,\n default: BentoRadioGroupVariant.VERTICAL,\n validator: (value: BentoRadioGroupVariant) => Object.values(BentoRadioGroupVariant).includes(value),\n },\n },\n emits: [BentoRadioGroupEvent.UPDATE],\n setup(props, { emit }) {\n const inputValue = toRef(props, 'modelValue');\n const errorId = generateUid('error');\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n const shouldShowError = computed(\n () => !props.disabled && !isReadOnly.value && (!!props.errorMessage || props.hasError)\n );\n const shouldShowErrorMessage = computed(() => !props.disabled && !isReadOnly.value && !!props.errorMessage);\n\n const conditionalClasses = computed(() => ({\n 'b-radio-group__buttons--horizontal': props.variant === BentoRadioGroupVariant.HORIZONTAL,\n }));\n\n const onInput = value => {\n emit(BentoRadioGroupEvent.UPDATE, value);\n };\n\n if (props.hasError) {\n deprecate(\n 'BentoRadioGroup \"hasError\" property',\n `Use the BentoRadioGroup \"errorMessage\" property instead to indicate that there is a modifier error.\n Having the field as \"undefined\" will hide/remove the error.\n <bento-radio-group errorMessage=\"Error message text\" />`,\n '2.0.0'\n );\n }\n\n return {\n // Values\n inputValue,\n errorId,\n isReadOnly,\n shouldShowError,\n shouldShowErrorMessage,\n conditionalClasses,\n\n // Methods\n onInput,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./radio-group.scss\" />\n"],"names":["BentoRadioButtonStateClass","BentoRadioButtonStateClass2","BentoRadioGroupVariant","BentoRadioGroupVariant2","BentoRadioGroupEvent","BentoRadioGroupEvent2","_sfc_main$1","defineComponent","BentoTypography","props","slots","emit","hasSlot","useHasSlot","value","toRefs","radioButtonId","generateUid","descriptionId","defaultSlotValue","descriptionSlotValue","useDefaultSlotValidator","conditionalClassContainer","computed","conditionalClassInput","ariaLabel","useAriaLabel","getSlotText","ariaInvalid","isChecked","event","BentoTypographyVariant","BentoTypographyElement","_sfc_main","ControlsGroup","ErrorMessage","RadioButton","inputValue","toRef","errorId","isReadOnly","useFormLayoutFieldLoading","shouldShowError","shouldShowErrorMessage","conditionalClasses","onInput","deprecate"],"mappings":";;;;;;;;;;;;AAAY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,WAAA,YACAA,EAAA,WAAA,YACAA,EAAA,QAAA,SAHQA,IAAAD,KAAA,CAAA,CAAA,GCAAE,IAAA,kBAAAC,OACRA,EAAA,aAAA,cACAA,EAAA,WAAA,YAFQA,IAAAD,KAAA,CAAA,CAAA,GAgBAE,IAAA,kBAAAC,OACRA,EAAA,SAAA,sBADQA,IAAAD,KAAA,CAAA,CAAA;AC0DZ,MAAAE,IAAAC,EAAA;AAAA,EAAA,MAAA;AAAA,EACA,YAAA,EAAA,iBAAAC,EAAA;AAAA,EACA,OAAA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IACA,UAAA;AAAA,MAIA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;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from "./chunks/debounce.f8d92e44.js";
|
|
|
4
4
|
import { S as m } from "./chunks/search.a8055e95.js";
|
|
5
5
|
import { C as _ } from "./chunks/cross-circle-fill.d5e9ae44.js";
|
|
6
6
|
import { n as h } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
7
|
-
import { u as R } from "./chunks/dropdown.
|
|
8
|
-
import "./assets/
|
|
7
|
+
import { u as R } from "./chunks/dropdown.c05678d0.js";
|
|
8
|
+
import "./assets/index31.css";
|
|
9
9
|
var a = /* @__PURE__ */ ((r) => (r.CLEAR = "clear", r.ESCAPE = "escape-pressed", r.INPUT = "input", r.UPDATE = "update:search-term", r))(a || {}), b = /* @__PURE__ */ ((r) => (r.CLEAR = "search-clear", r.INPUT = "search-input", r.UPDATE = "update:search-term", r))(b || {});
|
|
10
10
|
const y = {
|
|
11
11
|
"en-US": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent as _, computed as a, toRef as f, ref as m, onMounted as v, onUnmounted as C } from "vue";
|
|
2
|
-
import { B as h, a as y, b as B } from "./chunks/index.
|
|
2
|
+
import { B as h, a as y, b as B } from "./chunks/index.56858f4e.js";
|
|
3
3
|
import { g as p } from "./chunks/unique-id.a2a2b458.js";
|
|
4
|
-
import { C as k } from "./chunks/listbox.
|
|
4
|
+
import { C as k } from "./chunks/listbox.116ed0c1.js";
|
|
5
5
|
import { n as b } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
6
|
-
import { B as S } from "./chunks/dropdown.
|
|
7
|
-
import "./assets/
|
|
6
|
+
import { B as S } from "./chunks/dropdown.c05678d0.js";
|
|
7
|
+
import "./assets/index33.css";
|
|
8
8
|
const I = _({
|
|
9
9
|
name: "bento-segmented-control-button",
|
|
10
10
|
components: { BentoTypography: h, CheckmarkIcon: k },
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { defineComponent as O, ref as r, inject as b, computed as c, watch as A, nextTick as S, toRefs as x, provide as N } from "vue";
|
|
2
|
+
import { B as R, a as L } from "./chunks/button.d0c9527d.js";
|
|
3
|
+
import { B as U, a as F, b as G } from "./chunks/index.56858f4e.js";
|
|
4
|
+
import { F as $ } from "./chunks/footer-actions.67642347.js";
|
|
5
|
+
import { A as H } from "./chunks/arrow-left.1d5d08bd.js";
|
|
6
|
+
import { u as w } from "./chunks/i18n.155748d6.js";
|
|
7
|
+
import { n as V } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
|
|
8
|
+
import { B as Y } from "./chunks/index.133e4da0.js";
|
|
9
|
+
import { C as j } from "./chunks/cross.a2cadac5.js";
|
|
10
|
+
import "./assets/index32.css";
|
|
11
|
+
var h = /* @__PURE__ */ ((l) => (l.UPDATE_ACTIVE_PAGE = "update:active-page", l.UPDATE_IS_OPEN = "update:is-open", l))(h || {}), E = /* @__PURE__ */ ((l) => (l.TRANSITION_LEVEL_DEEPER = "b-sidepanel-page__animation--level-deeper", l.TRANSITION_LEVEL_UPPER = "b-sidepanel-page__animation--level-upper", l))(E || {});
|
|
12
|
+
const k = Symbol("sidepanel registerPage injection key"), D = Symbol("sidepanel config data injection key"), J = {
|
|
13
|
+
"en-US": {
|
|
14
|
+
goToPreviousPage: "Go to previous page"
|
|
15
|
+
}
|
|
16
|
+
}, K = {
|
|
17
|
+
i18n: { messages: J }
|
|
18
|
+
}, z = /* @__PURE__ */ O({
|
|
19
|
+
...K,
|
|
20
|
+
__name: "sidepanel-page",
|
|
21
|
+
props: {
|
|
22
|
+
/**
|
|
23
|
+
* List of actions that will be used to render the buttons.
|
|
24
|
+
* First element in the list will be rendered as "primary".
|
|
25
|
+
* All elements after the first will be rendered as "secondary".
|
|
26
|
+
*
|
|
27
|
+
* ```
|
|
28
|
+
* [{
|
|
29
|
+
* title: 'Primary',
|
|
30
|
+
* event: () => { ... },
|
|
31
|
+
* icon: FourPeopleIcon
|
|
32
|
+
* }, {
|
|
33
|
+
* title: 'Secondary',
|
|
34
|
+
* event: () => { ... }
|
|
35
|
+
* }]
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
actions: {
|
|
39
|
+
type: Array,
|
|
40
|
+
default: null
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* Text label that is displayed left to the action buttons
|
|
44
|
+
*/
|
|
45
|
+
actionsLabel: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: null
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* If passed - sets first button color to red
|
|
51
|
+
*/
|
|
52
|
+
destructiveActions: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: !1
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Identifier of the page, used with activePage prop to handle sidepanel navigation
|
|
58
|
+
*/
|
|
59
|
+
pageId: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* ID of the page for the back button to navigate to. Only use it to overwrite the default back behavior
|
|
65
|
+
* Used when the back button should not take the user to the natural previous page
|
|
66
|
+
* Set to `null` to hide back button in the page
|
|
67
|
+
*/
|
|
68
|
+
previousPage: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: void 0
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Title of the sidepanel page
|
|
74
|
+
*/
|
|
75
|
+
title: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: null
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
setup(l) {
|
|
81
|
+
const a = l, { t } = w(), e = r(null), o = r(!1), f = r(!0), i = r(!1), p = b(k);
|
|
82
|
+
p({ title: a.title, pageId: a.pageId });
|
|
83
|
+
const { activePage: s, animation: _, goToPreviousPage: g, hasPreviousPages: u, isOpen: d } = b(D), v = c(() => s.value ? s.value === a.pageId : !0), T = c(() => a.previousPage ? !0 : a.previousPage === null ? !1 : u.value && v.value), I = c(() => ({
|
|
84
|
+
"b-sidepanel-page__header--with-border": o.value && !f.value
|
|
85
|
+
})), C = c(() => ({
|
|
86
|
+
"b-sidepanel-page__actions--with-border": o.value && !i.value
|
|
87
|
+
})), m = () => {
|
|
88
|
+
e.value && (f.value = e.value.scrollTop === 0, i.value = e.value.scrollHeight - e.value.clientHeight === e.value.scrollTop);
|
|
89
|
+
}, P = async (n) => {
|
|
90
|
+
n && (await S(), o.value = e.value && e.value.scrollHeight > e.value.clientHeight);
|
|
91
|
+
};
|
|
92
|
+
return A(() => d.value, P, { immediate: !0 }), A(() => v.value, P, { immediate: !0 }), { __sfc: !0, props: a, t, contentElement: e, hasScroll: o, isScrollAtTop: f, isScrollAtBottom: i, registerPage: p, activePage: s, animation: _, goToPreviousPage: g, hasPreviousPages: u, isOpen: d, showPage: v, showBackButton: T, headerConditionalClasses: I, actionsConditionalClasses: C, onScroll: m, calculateScroll: P, updateAnimation: () => {
|
|
93
|
+
_.value === E.TRANSITION_LEVEL_UPPER && (_.value = E.TRANSITION_LEVEL_DEEPER);
|
|
94
|
+
}, BentoButton: R, BentoButtonVariant: L, BentoTypography: U, BentoTypographyElement: F, BentoTypographyVariant: G, FooterActions: $, ArrowLeftIcon: H };
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
var M = function() {
|
|
98
|
+
var a = this, t = a._self._c, e = a._self._setupProxy;
|
|
99
|
+
return t("Transition", { attrs: { name: e.animation, mode: "out-in" }, on: { "after-leave": e.updateAnimation } }, [t("div", { directives: [{ name: "show", rawName: "v-show", value: e.showPage, expression: "showPage" }], staticClass: "b-sidepanel-page" }, [t("div", { staticClass: "b-sidepanel-page__header", class: e.headerConditionalClasses }, [e.showBackButton ? t(e.BentoButton, { attrs: { variant: e.BentoButtonVariant.TERTIARY }, on: { click: function(o) {
|
|
100
|
+
return e.goToPreviousPage(a.previousPage);
|
|
101
|
+
} } }, [t(e.ArrowLeftIcon, { attrs: { "svg-title": e.t("goToPreviousPage") } })], 1) : a._e(), t(e.BentoTypography, { staticClass: "b-sidepanel-page__title", attrs: { el: e.BentoTypographyElement.H2, variant: e.BentoTypographyVariant.TITLE } }, [a._v(" " + a._s(a.title) + " ")])], 1), t("div", { ref: "contentElement", staticClass: "b-sidepanel-page__content", on: { scroll: e.onScroll } }, [t(e.BentoTypography, { attrs: { el: e.BentoTypographyElement.DIV, variant: e.BentoTypographyVariant.BODY } }, [a._t("default")], 2)], 1), a.actions ? t("div", { staticClass: "b-sidepanel-page__actions", class: e.actionsConditionalClasses }, [t(e.FooterActions, { attrs: { actions: a.actions, "actions-label": a.actionsLabel, "destructive-actions": a.destructiveActions } })], 1) : a._e()])]);
|
|
102
|
+
}, q = [], Q = /* @__PURE__ */ V(
|
|
103
|
+
z,
|
|
104
|
+
M,
|
|
105
|
+
q,
|
|
106
|
+
!1,
|
|
107
|
+
null,
|
|
108
|
+
"29ddfe34",
|
|
109
|
+
null,
|
|
110
|
+
null
|
|
111
|
+
);
|
|
112
|
+
const _e = Q.exports, W = {
|
|
113
|
+
"en-US": {
|
|
114
|
+
close: "Close"
|
|
115
|
+
}
|
|
116
|
+
}, X = {
|
|
117
|
+
i18n: { messages: W }
|
|
118
|
+
}, Z = /* @__PURE__ */ O({
|
|
119
|
+
...X,
|
|
120
|
+
__name: "sidepanel",
|
|
121
|
+
props: {
|
|
122
|
+
/**
|
|
123
|
+
* The id of the current active page
|
|
124
|
+
* Should be the same id as the BentoSidepanelPage to be displayed
|
|
125
|
+
* If the component only has one page, it can be left null/undefined.
|
|
126
|
+
*/
|
|
127
|
+
activePage: {
|
|
128
|
+
type: String,
|
|
129
|
+
default: null
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* If set to true, it allows the sidepanel to be closed
|
|
133
|
+
*/
|
|
134
|
+
isDismissible: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: !1
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Controls the sidepanel's state from the outside. Set it to true to open the sidepanel
|
|
140
|
+
*/
|
|
141
|
+
isOpen: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: null
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
setup(l, { emit: a }) {
|
|
147
|
+
const t = l, { activePage: e, isOpen: o } = x(t), { t: f } = w(), i = r(null), p = r([]), s = r([]), _ = c(() => s.value.length > 1), g = r(E.TRANSITION_LEVEL_DEEPER), u = r(!1), d = c(() => s.value[s.value.length - 1]), v = c(() => p.value.some((n) => n.pageId === e.value)), T = (n) => {
|
|
148
|
+
if (n) {
|
|
149
|
+
const y = s.value.indexOf(n);
|
|
150
|
+
y !== -1 ? s.value = s.value.slice(0, y + 1) : s.value = [n];
|
|
151
|
+
} else
|
|
152
|
+
s.value.pop();
|
|
153
|
+
g.value = E.TRANSITION_LEVEL_UPPER, a(h.UPDATE_ACTIVE_PAGE, d.value);
|
|
154
|
+
};
|
|
155
|
+
A(
|
|
156
|
+
() => e.value,
|
|
157
|
+
async () => {
|
|
158
|
+
if (await S(), e.value && !v.value) {
|
|
159
|
+
console.error(`The activePage passed "${e.value}" does not match the id of any SidepanelPage`);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
e.value !== d.value && s.value.push(e.value);
|
|
163
|
+
},
|
|
164
|
+
{ immediate: !0 }
|
|
165
|
+
);
|
|
166
|
+
const I = c(() => ({
|
|
167
|
+
"b-sidepanel__hide": u.value
|
|
168
|
+
})), C = (n) => {
|
|
169
|
+
u.value && n.pseudoElement === "::backdrop" && (i.value.close(), s.value[0] && a(h.UPDATE_ACTIVE_PAGE, s.value[0]), s.value = [], u.value = !1, a(h.UPDATE_IS_OPEN, !1));
|
|
170
|
+
}, m = (n) => {
|
|
171
|
+
n && n.preventDefault(), i.value.open && (u.value = !0);
|
|
172
|
+
}, P = ({ target: n }) => {
|
|
173
|
+
n && n.tagName === "DIALOG" && m();
|
|
174
|
+
};
|
|
175
|
+
A(
|
|
176
|
+
() => o.value,
|
|
177
|
+
async () => {
|
|
178
|
+
await S(), i.value && (o.value ? (i.value.showModal(), s.value.length || s.value.push(e.value)) : i.value.open && m());
|
|
179
|
+
},
|
|
180
|
+
{ immediate: !0 }
|
|
181
|
+
);
|
|
182
|
+
const B = ({ title: n, pageId: y }) => {
|
|
183
|
+
p.value.push({ title: n, pageId: y });
|
|
184
|
+
};
|
|
185
|
+
return N(D, {
|
|
186
|
+
activePage: e,
|
|
187
|
+
animation: g,
|
|
188
|
+
goToPreviousPage: T,
|
|
189
|
+
hasPreviousPages: _,
|
|
190
|
+
isOpen: o
|
|
191
|
+
}), N(k, B), { __sfc: !0, props: t, emit: a, activePage: e, isOpen: o, t: f, sidepanel: i, pages: p, previousPages: s, hasPreviousPages: _, animation: g, isClosing: u, lastPage: d, isActivePageValid: v, goToPreviousPage: T, conditionalClasses: I, closeSidepanelAfterAnimation: C, startCloseSidepanelAnimation: m, closeSidepanelOnClickOutside: P, registerPage: B, BentoButton: R, BentoButtonVariant: L, BentoFocusTrap: Y, CrossIcon: j };
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
var ee = function() {
|
|
195
|
+
var a = this, t = a._self._c, e = a._self._setupProxy;
|
|
196
|
+
return t("dialog", { ref: "sidepanel", staticClass: "b-sidepanel", class: e.conditionalClasses, on: { animationend: e.closeSidepanelAfterAnimation, click: function(o) {
|
|
197
|
+
a.isDismissible && e.closeSidepanelOnClickOutside(o);
|
|
198
|
+
}, keydown: function(o) {
|
|
199
|
+
return !o.type.indexOf("key") && a._k(o.keyCode, "esc", 27, o.key, ["Esc", "Escape"]) ? null : e.startCloseSidepanelAnimation.apply(null, arguments);
|
|
200
|
+
} } }, [t(e.BentoFocusTrap, [t("div", { staticClass: "b-sidepanel__close-button" }, [t(e.BentoButton, { attrs: { variant: e.BentoButtonVariant.TERTIARY }, on: { click: e.startCloseSidepanelAnimation } }, [t(e.CrossIcon, { attrs: { "svg-title": e.t("close") } })], 1)], 1), a._t("default")], 2)], 1);
|
|
201
|
+
}, ae = [], te = /* @__PURE__ */ V(
|
|
202
|
+
Z,
|
|
203
|
+
ee,
|
|
204
|
+
ae,
|
|
205
|
+
!1,
|
|
206
|
+
null,
|
|
207
|
+
"039416a2",
|
|
208
|
+
null,
|
|
209
|
+
null
|
|
210
|
+
);
|
|
211
|
+
const de = te.exports;
|
|
212
|
+
export {
|
|
213
|
+
de as BentoSidepanel,
|
|
214
|
+
E as BentoSidepanelAnimation,
|
|
215
|
+
h as BentoSidepanelEvent,
|
|
216
|
+
_e as BentoSidepanelPage
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=sidepanel.js.map
|