@nilloq/ouds-web 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -6
  3. package/dist/alert-By364Om4.js +77 -0
  4. package/dist/alert-bsnEmrzb.js +89 -0
  5. package/dist/alert.js +2 -0
  6. package/dist/badge-fffoaFuZ.js +57 -0
  7. package/dist/badge-yaFEZnEW.js +54 -0
  8. package/dist/badge.js +2 -0
  9. package/dist/button-BUziAVbu.js +94 -0
  10. package/dist/{button-LlRiSiGS.js → button-nN1Pcwm6.js} +36 -21
  11. package/dist/button.js +1 -1
  12. package/dist/checkbox-PAgQqiIw.js +145 -0
  13. package/dist/checkbox-g6cqR6wz.js +170 -0
  14. package/dist/checkbox.js +1 -1
  15. package/dist/control-item-slots-BNXNsI1e.js +12 -0
  16. package/dist/control-item-slots-XV8Gjvf1.js +9 -0
  17. package/dist/elements-alert.js +2 -0
  18. package/dist/elements-badge.js +2 -0
  19. package/dist/elements-button.js +1 -1
  20. package/dist/elements-checkbox.js +1 -1
  21. package/dist/elements-modal.js +2 -0
  22. package/dist/elements-radio.js +2 -0
  23. package/dist/elements-select.js +1 -1
  24. package/dist/elements-switch.js +2 -0
  25. package/dist/elements-tag.js +1 -1
  26. package/dist/elements-text-area.js +2 -0
  27. package/dist/elements-text-input.js +1 -1
  28. package/dist/elements.js +13 -7
  29. package/dist/index.js +12 -6
  30. package/dist/modal-CHjaB_yR.js +181 -0
  31. package/dist/modal-IEXNB8St.js +193 -0
  32. package/dist/modal.js +2 -0
  33. package/dist/radio-Cmrtred_.js +147 -0
  34. package/dist/radio-CqVqsZ7n.js +175 -0
  35. package/dist/radio.js +5 -0
  36. package/dist/{runtime-dom.esm-bundler-BzNNnH8h.js → runtime-dom.esm-bundler-BeOO_l6v.js} +987 -839
  37. package/dist/select-Bpou1HIY.js +167 -0
  38. package/dist/select-CWjTpHGb.js +126 -0
  39. package/dist/select.js +1 -1
  40. package/dist/switch-CFv0JUeq.js +132 -0
  41. package/dist/switch-DEYsTCw5.js +157 -0
  42. package/dist/switch.js +5 -0
  43. package/dist/tag-BdB0YDBJ.js +84 -0
  44. package/dist/tag-Un7w0uDf.js +81 -0
  45. package/dist/tag.js +1 -1
  46. package/dist/text-area-DkjEGpHg.js +99 -0
  47. package/dist/text-area-DqBoz2_d.js +139 -0
  48. package/dist/text-area.js +5 -0
  49. package/dist/text-input-DnWjB1vE.js +207 -0
  50. package/dist/text-input-DxzwRS2R.js +157 -0
  51. package/dist/text-input.js +1 -1
  52. package/dist/types/alert.d.ts +1 -0
  53. package/dist/types/badge.d.ts +1 -0
  54. package/dist/types/components/alert/Alert.vue.d.ts +37 -0
  55. package/dist/types/components/alert/alert.context.d.ts +2 -0
  56. package/dist/types/components/alert/alert.options.d.ts +2 -0
  57. package/dist/types/components/alert/alert.types.d.ts +14 -0
  58. package/dist/types/components/badge/Badge.vue.d.ts +26 -0
  59. package/dist/types/components/badge/badge.options.d.ts +4 -0
  60. package/dist/types/components/badge/badge.types.d.ts +13 -0
  61. package/dist/types/components/button/Button.vue.d.ts +7 -4
  62. package/dist/types/components/button/button.options.d.ts +1 -1
  63. package/dist/types/components/button/button.types.d.ts +2 -0
  64. package/dist/types/components/checkbox/Checkbox.vue.d.ts +13 -6
  65. package/dist/types/components/checkbox/VueCheckbox.vue.d.ts +9 -5
  66. package/dist/types/components/checkbox/checkbox.context.d.ts +2 -0
  67. package/dist/types/components/checkbox/checkbox.types.d.ts +4 -0
  68. package/dist/types/components/modal/Modal.vue.d.ts +86 -0
  69. package/dist/types/components/modal/modal.context.d.ts +2 -0
  70. package/dist/types/components/modal/modal.options.d.ts +7 -0
  71. package/dist/types/components/modal/modal.types.d.ts +28 -0
  72. package/dist/types/components/radio/Radio.vue.d.ts +37 -0
  73. package/dist/types/components/radio/VueRadio.vue.d.ts +34 -0
  74. package/dist/types/components/radio/radio.context.d.ts +2 -0
  75. package/dist/types/components/radio/radio.types.d.ts +20 -0
  76. package/dist/types/components/select/Select.vue.d.ts +21 -4
  77. package/dist/types/components/select/VueSelect.vue.d.ts +15 -5
  78. package/dist/types/components/select/select.types.d.ts +10 -0
  79. package/dist/types/components/shared/control-item-slots.d.ts +2 -0
  80. package/dist/types/components/switch/Switch.vue.d.ts +32 -0
  81. package/dist/types/components/switch/VueSwitch.vue.d.ts +28 -0
  82. package/dist/types/components/switch/switch.context.d.ts +2 -0
  83. package/dist/types/components/switch/switch.types.d.ts +17 -0
  84. package/dist/types/components/tag/Tag.vue.d.ts +8 -3
  85. package/dist/types/components/tag/tag.options.d.ts +1 -1
  86. package/dist/types/components/tag/tag.types.d.ts +4 -0
  87. package/dist/types/components/text-area/TextArea.vue.d.ts +36 -0
  88. package/dist/types/components/text-area/VueTextArea.vue.d.ts +32 -0
  89. package/dist/types/components/text-area/text-area.types.d.ts +19 -0
  90. package/dist/types/components/text-input/TextInput.vue.d.ts +19 -15
  91. package/dist/types/components/text-input/VueTextInput.vue.d.ts +17 -13
  92. package/dist/types/components/text-input/text-input.types.d.ts +3 -0
  93. package/dist/types/elements/alert.d.ts +5 -0
  94. package/dist/types/elements/badge.d.ts +5 -0
  95. package/dist/types/elements/index.d.ts +13 -0
  96. package/dist/types/elements/modal.d.ts +5 -0
  97. package/dist/types/elements/radio.d.ts +4 -0
  98. package/dist/types/elements/switch.d.ts +4 -0
  99. package/dist/types/elements/text-area.d.ts +4 -0
  100. package/dist/types/modal.d.ts +1 -0
  101. package/dist/types/radio.d.ts +2 -0
  102. package/dist/types/switch.d.ts +2 -0
  103. package/dist/types/text-area.d.ts +2 -0
  104. package/dist/types/vue/alert.d.ts +3 -0
  105. package/dist/types/vue/badge.d.ts +3 -0
  106. package/dist/types/vue/index.d.ts +11 -0
  107. package/dist/types/vue/modal.d.ts +3 -0
  108. package/dist/types/vue/radio.d.ts +2 -0
  109. package/dist/types/vue/switch.d.ts +2 -0
  110. package/dist/types/vue/text-area.d.ts +2 -0
  111. package/dist/vue-alert.js +2 -0
  112. package/dist/vue-badge.js +2 -0
  113. package/dist/vue-button.js +1 -1
  114. package/dist/vue-checkbox.js +1 -1
  115. package/dist/vue-modal.js +2 -0
  116. package/dist/vue-radio.js +2 -0
  117. package/dist/vue-select.js +1 -1
  118. package/dist/vue-switch.js +2 -0
  119. package/dist/vue-tag.js +1 -1
  120. package/dist/vue-text-area.js +2 -0
  121. package/dist/vue-text-input.js +1 -1
  122. package/dist/vue.js +12 -6
  123. package/package.json +82 -10
  124. package/dist/button-BPOKh6G4.js +0 -79
  125. package/dist/checkbox-BYrgMhwO.js +0 -105
  126. package/dist/checkbox-D-A_bSBK.js +0 -79
  127. package/dist/select-CA6TVlpX.js +0 -58
  128. package/dist/select-CKHEHpJL.js +0 -80
  129. package/dist/tag-B2qhuHjk.js +0 -41
  130. package/dist/tag-BY32Hj5n.js +0 -44
  131. package/dist/text-input-DOUGu0A2.js +0 -180
  132. package/dist/text-input-t-iE4dFj.js +0 -130
@@ -0,0 +1,193 @@
1
+ import { A as e, C as t, D as n, M as r, O as i, T as a, a as o, b as s, c, d as l, f as u, g as d, h as f, j as p, l as m, m as h, n as g, o as _, p as v, s as y, t as b, u as x, v as S, x as C, y as w } from "./runtime-dom.esm-bundler-BeOO_l6v.js";
2
+ import { n as T, t as E } from "./control-item-slots-BNXNsI1e.js";
3
+ //#region src/components/modal/modal.context.ts
4
+ var D = Symbol("ouds-modal-element-id"), ee = [
5
+ "id",
6
+ "aria-labelledby",
7
+ "aria-describedby"
8
+ ], O = { class: "modal-header" }, k = {
9
+ key: 0,
10
+ class: "modal-subtitle"
11
+ }, A = ["aria-hidden"], j = {
12
+ key: 0,
13
+ class: "visually-hidden"
14
+ }, M = ["aria-label"], N = ["id"], P = /* @__PURE__ */ l({
15
+ inheritAttrs: !1,
16
+ __name: "Modal",
17
+ props: {
18
+ open: {
19
+ type: Boolean,
20
+ default: !1
21
+ },
22
+ label: { default: "Dialog" },
23
+ description: { default: "" },
24
+ subtitle: { default: "" },
25
+ headingLevel: { default: "h2" },
26
+ type: { default: "dialog" },
27
+ size: { default: "default" },
28
+ variant: { default: "neutral" },
29
+ iconLabel: { default: "" },
30
+ fixedHeight: {
31
+ type: Boolean,
32
+ default: !1
33
+ },
34
+ nonBlurred: {
35
+ type: Boolean,
36
+ default: !1
37
+ },
38
+ stickyActions: {
39
+ type: Boolean,
40
+ default: !1
41
+ },
42
+ horizontalActions: {
43
+ type: Boolean,
44
+ default: !1
45
+ },
46
+ dismissible: {
47
+ type: Boolean,
48
+ default: !0
49
+ },
50
+ closeLabel: { default: "Close dialog" },
51
+ closeOnEscape: {
52
+ type: Boolean,
53
+ default: !0
54
+ },
55
+ closeOnBackdrop: {
56
+ type: Boolean,
57
+ default: !1
58
+ }
59
+ },
60
+ emits: [
61
+ "update:open",
62
+ "show",
63
+ "close",
64
+ "cancel"
65
+ ],
66
+ setup(l, { expose: b, emit: E }) {
67
+ let P = l, F = E, I = s(), L = u(D, void 0), R = L ? g() : void 0, z = T(!!L), B = C(), V = i(), H = o(() => `${L || `ouds-modal-${B}`}-title`), U = o(() => `${L || `ouds-modal-${B}`}-description`), W = o(() => P.iconLabel || {
68
+ neutral: "",
69
+ negative: "Error",
70
+ positive: "Success",
71
+ info: "Information",
72
+ warning: "Warning"
73
+ }[P.variant]);
74
+ function G() {
75
+ return P.stickyActions && !!(P.description || z("description") || z("default"));
76
+ }
77
+ let K = !1, q = !1;
78
+ function J(e) {
79
+ R && Reflect.set(R, "open", e), F("update:open", e);
80
+ }
81
+ function Y() {
82
+ V.value && !V.value.open && (K && X(), V.value.returnValue = "", V.value.showModal(), K = !0, J(!0), F("show"));
83
+ }
84
+ function X() {
85
+ K && V.value && !V.value.open && (K = !1, J(!1), F("close", V.value.returnValue));
86
+ }
87
+ function Z(e) {
88
+ V.value?.open && (V.value.close(e), X());
89
+ }
90
+ function Q(e) {
91
+ if (P.closeOnEscape || e.preventDefault(), R) {
92
+ let t = new CustomEvent("cancel", {
93
+ detail: [e],
94
+ cancelable: !0
95
+ });
96
+ R.dispatchEvent(t) || e.preventDefault();
97
+ } else F("cancel", e);
98
+ }
99
+ function $(e) {
100
+ let t = V.value;
101
+ if (!t || e.target !== t) return !1;
102
+ let n = t.getBoundingClientRect();
103
+ return e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom;
104
+ }
105
+ function te(e) {
106
+ P.closeOnBackdrop && q && $(e) && Z(), q = !1;
107
+ }
108
+ return t(() => P.open, (e) => {
109
+ e ? Y() : Z();
110
+ }, { flush: "post" }), f(() => {
111
+ P.open && Y();
112
+ }), h(() => {
113
+ K = !1, V.value?.open && V.value.close();
114
+ }), b({
115
+ showModal: Y,
116
+ close: Z
117
+ }), (t, i) => (d(), m("dialog", v({
118
+ ref_key: "dialog",
119
+ ref: V
120
+ }, e(I), {
121
+ id: e(L) ? `${e(I).id || e(L)}-dialog` : e(I).id || `ouds-modal-${e(B)}`,
122
+ class: ["modal-base", [l.type === "fullscreen" ? "modal-fullscreen-dialog" : "modal-dialog", {
123
+ "modal-small": l.type === "dialog" && l.size === "small",
124
+ "modal-fixed-height": l.type === "dialog" && l.fixedHeight,
125
+ "modal-non-blurred": l.type === "dialog" && l.nonBlurred
126
+ }]],
127
+ "aria-labelledby": e(I)["aria-labelledby"] || H.value,
128
+ "aria-describedby": e(I)["aria-describedby"] || (l.description || e(z)("description") ? U.value : void 0),
129
+ onCancel: Q,
130
+ onClose: X,
131
+ onPointerdown: i[1] ||= (e) => n(q) ? q.value = $(e) : q = $(e),
132
+ onClick: te
133
+ }), [
134
+ _("div", O, [
135
+ S(t.$slots, "previous"),
136
+ l.subtitle || e(z)("subtitle") ? (d(), m("p", k, [S(t.$slots, "subtitle", {}, () => [x(r(l.subtitle), 1)])])) : c("", !0),
137
+ (d(), y(w(l.headingLevel), {
138
+ id: H.value,
139
+ class: "modal-title"
140
+ }, {
141
+ default: a(() => [l.variant !== "neutral" || e(z)("icon") ? (d(), m("span", {
142
+ key: 0,
143
+ class: p(["modal-icon", l.variant !== "neutral" && `modal-icon-${l.variant}`]),
144
+ "aria-hidden": !W.value || void 0
145
+ }, [W.value ? (d(), m("span", j, r(W.value), 1)) : c("", !0), l.variant === "neutral" ? S(t.$slots, "icon", {}, void 0, void 0, 1) : c("", !0)], 10, A)) : c("", !0), S(t.$slots, "title", {}, () => [x(r(l.label), 1)])]),
146
+ _: 3
147
+ }, 8, ["id"])),
148
+ l.dismissible ? (d(), m("button", {
149
+ key: 1,
150
+ type: "button",
151
+ class: "btn btn-close",
152
+ "aria-label": l.closeLabel,
153
+ onClick: i[0] ||= (e) => Z()
154
+ }, null, 8, M)) : c("", !0)
155
+ ]),
156
+ _("div", { class: p(["modal-body", { "pt-large": !l.description && !e(z)("description") && e(z)("default") }]) }, [
157
+ l.description || e(z)("description") ? (d(), m("p", {
158
+ key: 0,
159
+ id: U.value
160
+ }, [S(t.$slots, "description", {}, () => [x(r(l.description), 1)])], 8, N)) : c("", !0),
161
+ S(t.$slots, "default"),
162
+ e(z)("actions") && !G() ? (d(), m("div", {
163
+ key: 1,
164
+ class: p(["modal-footer", { "modal-footer-horizontal": l.horizontalActions }])
165
+ }, [S(t.$slots, "actions", { close: Z })], 2)) : c("", !0)
166
+ ], 2),
167
+ e(z)("actions") && G() ? (d(), m("div", {
168
+ key: 0,
169
+ class: p(["modal-footer", { "modal-footer-horizontal": l.horizontalActions }])
170
+ }, [S(t.$slots, "actions", { close: Z })], 2)) : c("", !0)
171
+ ], 16, ee));
172
+ }
173
+ }), F = ["dialog", "fullscreen"], I = ["default", "small"], L = [
174
+ "neutral",
175
+ "negative",
176
+ "positive",
177
+ "info",
178
+ "warning"
179
+ ], R = 0, z = b(P, {
180
+ shadowRoot: !1,
181
+ configureApp(e) {
182
+ e.provide(D, `ouds-modal-element-${R++}`);
183
+ }
184
+ }), B = class extends z {
185
+ connectedCallback() {
186
+ E(this), super.connectedCallback();
187
+ }
188
+ };
189
+ function V() {
190
+ typeof customElements < "u" && (customElements.get("ouds-modal") || customElements.define("ouds-modal", B));
191
+ }
192
+ //#endregion
193
+ export { L as a, F as i, V as n, I as r, B as t };
package/dist/modal.js ADDED
@@ -0,0 +1,2 @@
1
+ import { a as e, i as t, n, r, t as i } from "./modal-IEXNB8St.js";
2
+ export { i as OudsModal, n as defineOudsModal, r as modalSizes, t as modalTypes, e as modalVariants };
@@ -0,0 +1,147 @@
1
+ import { A as e, M as t, T as n, a as r, b as i, c as a, d as o, f as s, g as c, j as l, k as u, l as d, o as f, p, s as m, t as h, u as g, v as _, x as v, y } from "./runtime-dom.esm-bundler-BeOO_l6v.js";
2
+ import { n as b, t as x } from "./control-item-slots-BNXNsI1e.js";
3
+ //#region src/components/radio/radio.context.ts
4
+ var S = Symbol("ouds-radio-element-id"), C = { class: "control-item-assets-container" }, w = [
5
+ "id",
6
+ "name",
7
+ "value",
8
+ "checked",
9
+ "disabled",
10
+ "required",
11
+ "aria-describedby",
12
+ "aria-invalid"
13
+ ], T = [
14
+ "id",
15
+ "aria-checked",
16
+ "aria-labelledby",
17
+ "aria-describedby",
18
+ "aria-invalid"
19
+ ], E = { class: "control-item-text-container" }, D = ["id"], O = ["id"], k = {
20
+ key: 0,
21
+ class: "control-item-assets-container"
22
+ }, A = /* @__PURE__ */ o({
23
+ inheritAttrs: !1,
24
+ __name: "Radio",
25
+ props: {
26
+ label: { default: "Radio" },
27
+ description: { default: "" },
28
+ value: { default: "" },
29
+ checked: {
30
+ type: Boolean,
31
+ default: !1
32
+ },
33
+ disabled: {
34
+ type: Boolean,
35
+ default: !1
36
+ },
37
+ required: {
38
+ type: Boolean,
39
+ default: !1
40
+ },
41
+ divider: {
42
+ type: Boolean,
43
+ default: !1
44
+ },
45
+ outlined: {
46
+ type: Boolean,
47
+ default: !1
48
+ },
49
+ extraLabel: { default: "" },
50
+ name: { default: "" },
51
+ readonly: {
52
+ type: Boolean,
53
+ default: !1
54
+ },
55
+ invalid: {
56
+ type: Boolean,
57
+ default: !1
58
+ },
59
+ reverse: {
60
+ type: Boolean,
61
+ default: !1
62
+ },
63
+ maxWidth: {
64
+ type: Boolean,
65
+ default: !1
66
+ }
67
+ },
68
+ setup(o) {
69
+ let h = i(), x = u(() => h.id), A = v(), j = s(S, void 0), M = b(j !== void 0), N = u(() => j ? `${x.value || j}-input` : x.value || `ouds-radio-${A}`), P = u(() => `${N.value}-label`), F = u(() => `${N.value}-extra-label`), I = u(() => `${N.value}-description`);
70
+ function L() {
71
+ let e = [h["aria-describedby"]];
72
+ return (o.extraLabel || M("extra-label")) && e.push(F.value), (o.description || M("description")) && e.push(I.value), e.filter(Boolean).join(" ") || void 0;
73
+ }
74
+ function R() {
75
+ return [h["aria-labelledby"], P.value].filter(Boolean).join(" ");
76
+ }
77
+ let z = r(() => ["radio-button-item", {
78
+ "control-item-divider": o.divider,
79
+ "radio-button-item-outlined": o.outlined,
80
+ "control-item-reverse": o.reverse,
81
+ "component-max-width": o.maxWidth
82
+ }]);
83
+ return (r, i) => (c(), d("div", { class: l(z.value) }, [
84
+ f("div", C, [o.readonly ? (c(), d("span", p({ key: 1 }, e(h), {
85
+ id: N.value,
86
+ class: "control-item-indicator",
87
+ role: "radio",
88
+ "aria-disabled": "true",
89
+ tabindex: "0",
90
+ "aria-checked": o.checked,
91
+ "aria-labelledby": R(),
92
+ "aria-describedby": L(),
93
+ "aria-invalid": o.invalid || e(h)["aria-invalid"]
94
+ }), null, 16, T)) : (c(), d("input", p({ key: 0 }, e(h), {
95
+ id: N.value,
96
+ class: "control-item-indicator",
97
+ type: "radio",
98
+ name: o.name,
99
+ value: o.value,
100
+ checked: o.checked,
101
+ disabled: o.disabled,
102
+ required: o.required,
103
+ "aria-describedby": L(),
104
+ "aria-invalid": o.invalid || e(h)["aria-invalid"]
105
+ }), null, 16, w))]),
106
+ f("div", E, [
107
+ (c(), m(y(o.readonly ? "span" : "label"), {
108
+ id: P.value,
109
+ class: l(["control-item-label", { "is-required": o.required }]),
110
+ for: o.readonly ? void 0 : N.value
111
+ }, {
112
+ default: n(() => [_(r.$slots, "label", {}, () => [g(t(o.label), 1)])]),
113
+ _: 3
114
+ }, 8, [
115
+ "id",
116
+ "class",
117
+ "for"
118
+ ])),
119
+ o.extraLabel || e(M)("extra-label") ? (c(), d("p", {
120
+ key: 0,
121
+ id: F.value,
122
+ class: "radio-button-extra-label"
123
+ }, [_(r.$slots, "extra-label", {}, () => [g(t(o.extraLabel), 1)])], 8, D)) : a("", !0),
124
+ o.description || e(M)("description") ? (c(), d("p", {
125
+ key: 1,
126
+ id: I.value,
127
+ class: "control-item-description"
128
+ }, [_(r.$slots, "description", {}, () => [g(t(o.description), 1)])], 8, O)) : a("", !0)
129
+ ]),
130
+ e(M)("asset") ? (c(), d("div", k, [_(r.$slots, "asset")])) : a("", !0)
131
+ ], 2));
132
+ }
133
+ }), j = 0, M = h(A, {
134
+ shadowRoot: !1,
135
+ configureApp(e) {
136
+ e.provide(S, `ouds-radio-element-${j++}`);
137
+ }
138
+ }), N = class extends M {
139
+ connectedCallback() {
140
+ x(this), super.connectedCallback();
141
+ }
142
+ };
143
+ function P() {
144
+ typeof customElements < "u" && (customElements.get("ouds-radio") || customElements.define("ouds-radio", N));
145
+ }
146
+ //#endregion
147
+ export { P as n, N as t };
@@ -0,0 +1,175 @@
1
+ import { t as e } from "./control-item-slots-XV8Gjvf1.js";
2
+ import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createSlots as o, createTextVNode as s, defineComponent as c, inject as l, mergeModels as u, mergeProps as d, normalizeClass as f, openBlock as p, renderSlot as m, resolveDynamicComponent as h, toDisplayString as g, toRef as _, unref as v, useAttrs as y, useId as b, useModel as x, withCtx as S } from "vue";
3
+ //#region src/components/radio/radio.context.ts
4
+ var C = Symbol("ouds-radio-element-id"), w = { class: "control-item-assets-container" }, T = [
5
+ "id",
6
+ "name",
7
+ "value",
8
+ "checked",
9
+ "disabled",
10
+ "required",
11
+ "aria-describedby",
12
+ "aria-invalid"
13
+ ], E = [
14
+ "id",
15
+ "aria-checked",
16
+ "aria-labelledby",
17
+ "aria-describedby",
18
+ "aria-invalid"
19
+ ], D = { class: "control-item-text-container" }, O = ["id"], k = ["id"], A = {
20
+ key: 0,
21
+ class: "control-item-assets-container"
22
+ }, j = /* @__PURE__ */ c({
23
+ inheritAttrs: !1,
24
+ __name: "Radio",
25
+ props: {
26
+ label: { default: "Radio" },
27
+ description: { default: "" },
28
+ value: { default: "" },
29
+ checked: {
30
+ type: Boolean,
31
+ default: !1
32
+ },
33
+ disabled: {
34
+ type: Boolean,
35
+ default: !1
36
+ },
37
+ required: {
38
+ type: Boolean,
39
+ default: !1
40
+ },
41
+ divider: {
42
+ type: Boolean,
43
+ default: !1
44
+ },
45
+ outlined: {
46
+ type: Boolean,
47
+ default: !1
48
+ },
49
+ extraLabel: { default: "" },
50
+ name: { default: "" },
51
+ readonly: {
52
+ type: Boolean,
53
+ default: !1
54
+ },
55
+ invalid: {
56
+ type: Boolean,
57
+ default: !1
58
+ },
59
+ reverse: {
60
+ type: Boolean,
61
+ default: !1
62
+ },
63
+ maxWidth: {
64
+ type: Boolean,
65
+ default: !1
66
+ }
67
+ },
68
+ setup(o) {
69
+ let c = y(), u = _(() => c.id), x = b(), j = l(C, void 0), M = e(j !== void 0), N = _(() => j ? `${u.value || j}-input` : u.value || `ouds-radio-${x}`), P = _(() => `${N.value}-label`), F = _(() => `${N.value}-extra-label`), I = _(() => `${N.value}-description`);
70
+ function L() {
71
+ let e = [c["aria-describedby"]];
72
+ return (o.extraLabel || M("extra-label")) && e.push(F.value), (o.description || M("description")) && e.push(I.value), e.filter(Boolean).join(" ") || void 0;
73
+ }
74
+ function R() {
75
+ return [c["aria-labelledby"], P.value].filter(Boolean).join(" ");
76
+ }
77
+ let z = t(() => ["radio-button-item", {
78
+ "control-item-divider": o.divider,
79
+ "radio-button-item-outlined": o.outlined,
80
+ "control-item-reverse": o.reverse,
81
+ "component-max-width": o.maxWidth
82
+ }]);
83
+ return (e, t) => (p(), i("div", { class: f(z.value) }, [
84
+ a("div", w, [o.readonly ? (p(), i("span", d({ key: 1 }, v(c), {
85
+ id: N.value,
86
+ class: "control-item-indicator",
87
+ role: "radio",
88
+ "aria-disabled": "true",
89
+ tabindex: "0",
90
+ "aria-checked": o.checked,
91
+ "aria-labelledby": R(),
92
+ "aria-describedby": L(),
93
+ "aria-invalid": o.invalid || v(c)["aria-invalid"]
94
+ }), null, 16, E)) : (p(), i("input", d({ key: 0 }, v(c), {
95
+ id: N.value,
96
+ class: "control-item-indicator",
97
+ type: "radio",
98
+ name: o.name,
99
+ value: o.value,
100
+ checked: o.checked,
101
+ disabled: o.disabled,
102
+ required: o.required,
103
+ "aria-describedby": L(),
104
+ "aria-invalid": o.invalid || v(c)["aria-invalid"]
105
+ }), null, 16, T))]),
106
+ a("div", D, [
107
+ (p(), n(h(o.readonly ? "span" : "label"), {
108
+ id: P.value,
109
+ class: f(["control-item-label", { "is-required": o.required }]),
110
+ for: o.readonly ? void 0 : N.value
111
+ }, {
112
+ default: S(() => [m(e.$slots, "label", {}, () => [s(g(o.label), 1)])]),
113
+ _: 3
114
+ }, 8, [
115
+ "id",
116
+ "class",
117
+ "for"
118
+ ])),
119
+ o.extraLabel || v(M)("extra-label") ? (p(), i("p", {
120
+ key: 0,
121
+ id: F.value,
122
+ class: "radio-button-extra-label"
123
+ }, [m(e.$slots, "extra-label", {}, () => [s(g(o.extraLabel), 1)])], 8, O)) : r("", !0),
124
+ o.description || v(M)("description") ? (p(), i("p", {
125
+ key: 1,
126
+ id: I.value,
127
+ class: "control-item-description"
128
+ }, [m(e.$slots, "description", {}, () => [s(g(o.description), 1)])], 8, k)) : r("", !0)
129
+ ]),
130
+ v(M)("asset") ? (p(), i("div", A, [m(e.$slots, "asset")])) : r("", !0)
131
+ ], 2));
132
+ }
133
+ }), M = /* @__PURE__ */ c({
134
+ inheritAttrs: !1,
135
+ __name: "VueRadio",
136
+ props: /*@__PURE__*/ u({ value: { default: "" } }, {
137
+ modelValue: { default: "" },
138
+ modelModifiers: {}
139
+ }),
140
+ emits: /*@__PURE__*/ u(["change"], ["update:modelValue"]),
141
+ setup(e, { emit: t }) {
142
+ let r = x(e, "modelValue"), i = t;
143
+ function a(e) {
144
+ r.value = e.target.value, i("change", e);
145
+ }
146
+ return (t, i) => (p(), n(j, d(t.$attrs, {
147
+ value: e.value,
148
+ checked: r.value === e.value,
149
+ onChange: a
150
+ }), o({ _: 2 }, [
151
+ t.$slots.label ? {
152
+ name: "label",
153
+ fn: S(() => [m(t.$slots, "label")]),
154
+ key: "0"
155
+ } : void 0,
156
+ t.$slots.asset ? {
157
+ name: "asset",
158
+ fn: S(() => [m(t.$slots, "asset")]),
159
+ key: "1"
160
+ } : void 0,
161
+ t.$slots["extra-label"] ? {
162
+ name: "extra-label",
163
+ fn: S(() => [m(t.$slots, "extra-label")]),
164
+ key: "2"
165
+ } : void 0,
166
+ t.$slots.description ? {
167
+ name: "description",
168
+ fn: S(() => [m(t.$slots, "description")]),
169
+ key: "3"
170
+ } : void 0
171
+ ]), 1040, ["value", "checked"]));
172
+ }
173
+ });
174
+ //#endregion
175
+ export { M as t };
package/dist/radio.js ADDED
@@ -0,0 +1,5 @@
1
+ import { n as e, t } from "./radio-Cmrtred_.js";
2
+ //#region src/radio.ts
3
+ e();
4
+ //#endregion
5
+ export { t as OudsRadio, e as defineOudsRadio };