@nilloq/ouds-web 0.1.6 → 0.1.8

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 (120) hide show
  1. package/README.md +17 -115
  2. package/dist/{alert-bsnEmrzb.js → alert-B4w3fDHo.js} +2 -2
  3. package/dist/{alert-By364Om4.js → alert-Chns046l.js} +1 -1
  4. package/dist/alert.js +1 -1
  5. package/dist/{badge-fffoaFuZ.js → badge-CDpWg-AO.js} +1 -1
  6. package/dist/badge.js +1 -1
  7. package/dist/{button-BUziAVbu.js → button-OgsnDYrO.js} +4 -3
  8. package/dist/{button-nN1Pcwm6.js → button-gcQ7CyWb.js} +3 -2
  9. package/dist/button.js +1 -1
  10. package/dist/checkbox-D7TFFuw3.js +196 -0
  11. package/dist/checkbox-DfYlHYR2.js +155 -0
  12. package/dist/checkbox.js +1 -1
  13. package/dist/chip-B3v4pWZD.js +92 -0
  14. package/dist/chip-DGfqitrQ.js +115 -0
  15. package/dist/chip.js +2 -0
  16. package/dist/{control-item-slots-BNXNsI1e.js → control-item-slots-BDoeNuk4.js} +5 -2
  17. package/dist/{control-item-slots-XV8Gjvf1.js → control-item-slots-Ddp7c8w8.js} +4 -1
  18. package/dist/elements-alert.js +1 -1
  19. package/dist/elements-badge.js +1 -1
  20. package/dist/elements-button.js +1 -1
  21. package/dist/elements-checkbox.js +1 -1
  22. package/dist/elements-chip.js +2 -0
  23. package/dist/elements-modal.js +1 -1
  24. package/dist/elements-radio.js +1 -1
  25. package/dist/elements-select.js +1 -1
  26. package/dist/elements-switch.js +1 -1
  27. package/dist/elements-tag.js +1 -1
  28. package/dist/elements-text-area.js +1 -1
  29. package/dist/elements-text-input.js +1 -1
  30. package/dist/elements.js +14 -13
  31. package/dist/index.js +13 -12
  32. package/dist/{modal-IEXNB8St.js → modal-BAvMVUIE.js} +2 -2
  33. package/dist/{modal-CHjaB_yR.js → modal-BnT5Kxjg.js} +1 -1
  34. package/dist/modal.js +1 -1
  35. package/dist/radio-CDq4r1_L.js +155 -0
  36. package/dist/radio-TaYThYkI.js +199 -0
  37. package/dist/radio.js +1 -1
  38. package/dist/{runtime-dom.esm-bundler-BeOO_l6v.js → runtime-dom.esm-bundler-DLryEdgJ.js} +1 -1
  39. package/dist/select-BWhJ-QB-.js +195 -0
  40. package/dist/select-BbeCpnsY.js +136 -0
  41. package/dist/select.js +1 -1
  42. package/dist/switch-BmxLKPbL.js +179 -0
  43. package/dist/switch-D5N-j5F7.js +140 -0
  44. package/dist/switch.js +1 -1
  45. package/dist/{tag-Un7w0uDf.js → tag--KKxqOf8.js} +17 -16
  46. package/dist/tag-D6j9yaoI.js +85 -0
  47. package/dist/tag.js +1 -1
  48. package/dist/text-area-Cmn22-fj.js +108 -0
  49. package/dist/text-area-Cr8RssdQ.js +165 -0
  50. package/dist/text-area.js +1 -1
  51. package/dist/text-input-DgFIuIOA.js +235 -0
  52. package/dist/text-input-i559HVOP.js +163 -0
  53. package/dist/text-input.js +1 -1
  54. package/dist/types/chip.d.ts +1 -0
  55. package/dist/types/components/alert/Alert.vue.d.ts +3 -3
  56. package/dist/types/components/badge/Badge.vue.d.ts +1 -1
  57. package/dist/types/components/button/Button.vue.d.ts +3 -1
  58. package/dist/types/components/button/button.types.d.ts +1 -0
  59. package/dist/types/components/checkbox/Checkbox.vue.d.ts +4 -15
  60. package/dist/types/components/checkbox/VueCheckbox.vue.d.ts +9 -3
  61. package/dist/types/components/checkbox/checkbox.types.d.ts +16 -0
  62. package/dist/types/components/chip/Chip.vue.d.ts +38 -0
  63. package/dist/types/components/chip/VueChip.vue.d.ts +32 -0
  64. package/dist/types/components/chip/chip.context.d.ts +2 -0
  65. package/dist/types/components/chip/chip.types.d.ts +27 -0
  66. package/dist/types/components/modal/Modal.vue.d.ts +8 -8
  67. package/dist/types/components/radio/Radio.vue.d.ts +2 -17
  68. package/dist/types/components/radio/VueRadio.vue.d.ts +8 -6
  69. package/dist/types/components/radio/radio.types.d.ts +16 -0
  70. package/dist/types/components/select/Select.vue.d.ts +2 -19
  71. package/dist/types/components/select/VueSelect.vue.d.ts +9 -3
  72. package/dist/types/components/select/select.types.d.ts +24 -0
  73. package/dist/types/components/shared/control-item-slots.d.ts +1 -0
  74. package/dist/types/components/switch/Switch.vue.d.ts +2 -14
  75. package/dist/types/components/switch/VueSwitch.vue.d.ts +9 -3
  76. package/dist/types/components/switch/switch.types.d.ts +13 -0
  77. package/dist/types/components/tag/Tag.vue.d.ts +3 -1
  78. package/dist/types/components/tag/tag.types.d.ts +1 -0
  79. package/dist/types/components/text-area/TextArea.vue.d.ts +2 -16
  80. package/dist/types/components/text-area/VueTextArea.vue.d.ts +9 -3
  81. package/dist/types/components/text-area/text-area.types.d.ts +18 -0
  82. package/dist/types/components/text-input/TextInput.vue.d.ts +2 -19
  83. package/dist/types/components/text-input/VueTextInput.vue.d.ts +9 -3
  84. package/dist/types/components/text-input/text-input.types.d.ts +25 -0
  85. package/dist/types/elements/chip.d.ts +4 -0
  86. package/dist/types/elements/index.d.ts +2 -0
  87. package/dist/types/vue/checkbox.d.ts +1 -1
  88. package/dist/types/vue/chip.d.ts +2 -0
  89. package/dist/types/vue/index.d.ts +8 -6
  90. package/dist/types/vue/radio.d.ts +1 -1
  91. package/dist/types/vue/select.d.ts +1 -1
  92. package/dist/types/vue/switch.d.ts +1 -1
  93. package/dist/types/vue/text-area.d.ts +1 -1
  94. package/dist/types/vue/text-input.d.ts +1 -1
  95. package/dist/vue-alert.js +1 -1
  96. package/dist/vue-button.js +1 -1
  97. package/dist/vue-checkbox.js +1 -1
  98. package/dist/vue-chip.js +2 -0
  99. package/dist/vue-modal.js +1 -1
  100. package/dist/vue-radio.js +1 -1
  101. package/dist/vue-select.js +1 -1
  102. package/dist/vue-switch.js +1 -1
  103. package/dist/vue-tag.js +1 -1
  104. package/dist/vue-text-area.js +1 -1
  105. package/dist/vue-text-input.js +1 -1
  106. package/dist/vue.js +12 -11
  107. package/package.json +15 -2
  108. package/dist/checkbox-PAgQqiIw.js +0 -145
  109. package/dist/checkbox-g6cqR6wz.js +0 -170
  110. package/dist/radio-Cmrtred_.js +0 -147
  111. package/dist/radio-CqVqsZ7n.js +0 -175
  112. package/dist/select-Bpou1HIY.js +0 -167
  113. package/dist/select-CWjTpHGb.js +0 -126
  114. package/dist/switch-CFv0JUeq.js +0 -132
  115. package/dist/switch-DEYsTCw5.js +0 -157
  116. package/dist/tag-BdB0YDBJ.js +0 -84
  117. package/dist/text-area-DkjEGpHg.js +0 -99
  118. package/dist/text-area-DqBoz2_d.js +0 -139
  119. package/dist/text-input-DnWjB1vE.js +0 -207
  120. package/dist/text-input-DxzwRS2R.js +0 -157
@@ -0,0 +1,195 @@
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createSlots as o, createTextVNode as s, defineComponent as c, mergeModels as l, mergeProps as u, normalizeClass as d, normalizeStyle as f, openBlock as p, renderList as m, renderSlot as h, toDisplayString as g, toRef as _, unref as v, useAttrs as y, useId as b, useModel as x, useSlots as S, withCtx as C } from "vue";
2
+ //#region src/components/select/Select.vue?vue&type=script&setup=true&lang.ts
3
+ var w = ["id", "for"], T = [
4
+ "id",
5
+ "aria-describedby",
6
+ "aria-invalid",
7
+ "value",
8
+ "disabled",
9
+ "required"
10
+ ], E = ["selected"], D = ["value", "selected"], O = ["id"], k = ["id"], A = ["id"], j = [
11
+ "id",
12
+ "href",
13
+ "aria-labelledby"
14
+ ], M = { class: "visually-hidden" }, N = /* @__PURE__ */ c({
15
+ inheritAttrs: !1,
16
+ __name: "Select",
17
+ props: {
18
+ label: { default: "Select" },
19
+ options: { default: () => [] },
20
+ helperText: { default: "" },
21
+ errorText: { default: "" },
22
+ helperLink: { default: "" },
23
+ helperLinkHref: { default: "" },
24
+ helperLinkAria: { default: "on" },
25
+ value: { default: "" },
26
+ outlined: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ disabled: {
31
+ type: Boolean,
32
+ default: !1
33
+ },
34
+ required: {
35
+ type: Boolean,
36
+ default: !1
37
+ },
38
+ invalid: {
39
+ type: Boolean,
40
+ default: !1
41
+ },
42
+ maxWidth: {
43
+ type: Boolean,
44
+ default: !1
45
+ },
46
+ loading: {
47
+ type: Boolean,
48
+ default: !1
49
+ },
50
+ loadingText: { default: "Loading" }
51
+ },
52
+ setup(n) {
53
+ let o = y();
54
+ function c() {
55
+ let { class: e, style: t, ...n } = o;
56
+ return n;
57
+ }
58
+ let l = _(() => o.id), x = S(), C = b(), N = _(() => l.value || `ouds-select-${C}`), P = _(() => `${N.value}-label`), F = _(() => `${N.value}-helper`), I = _(() => `${N.value}-error`), L = _(() => `${N.value}-helper-link`), R = _(() => `${N.value}-loading`);
59
+ function z() {
60
+ let e = [o["aria-describedby"]];
61
+ return (n.helperText || x["helper-text"]) && !n.invalid && e.push(F.value), n.invalid && (n.errorText || x["error-text"]) && e.push(I.value), n.helperLinkHref && (n.helperLink || x["helper-link"]) && e.push(L.value), n.loading && e.push(R.value), e.filter(Boolean).join(" ") || void 0;
62
+ }
63
+ let B = t(() => ["select-input-container", { "select-input-container-outlined": n.outlined }]), V = t(() => ["select-input", { "component-max-width": n.maxWidth }]), H = t(() => ["select-input-field", { "loading-indeterminate": n.loading }]);
64
+ return (t, l) => (p(), i("div", {
65
+ class: d([V.value, v(o).class]),
66
+ style: f(v(o).style)
67
+ }, [
68
+ a("div", { class: d(B.value) }, [
69
+ h(t.$slots, "leading-icon"),
70
+ a("label", {
71
+ id: P.value,
72
+ for: N.value,
73
+ class: d({ "is-required": n.required })
74
+ }, [h(t.$slots, "label", {}, () => [s(g(n.label), 1)])], 10, w),
75
+ a("select", u(c(), {
76
+ id: N.value,
77
+ "aria-describedby": z(),
78
+ "aria-invalid": n.invalid || v(o)["aria-invalid"],
79
+ class: H.value,
80
+ value: n.value,
81
+ disabled: n.disabled,
82
+ required: n.required
83
+ }), [a("option", {
84
+ value: "",
85
+ disabled: "",
86
+ selected: n.value === ""
87
+ }, null, 8, E), h(t.$slots, "default", {}, () => [(p(!0), i(e, null, m(n.options, (e) => (p(), i("option", {
88
+ key: e.value,
89
+ value: e.value,
90
+ selected: e.value === n.value
91
+ }, g(e.label), 9, D))), 128))])], 16, T),
92
+ n.loading ? (p(), i(e, { key: 0 }, [l[0] ||= a("svg", {
93
+ viewBox: "0 0 40 40",
94
+ class: "loader",
95
+ "aria-hidden": "true"
96
+ }, [a("circle", {
97
+ class: "loader-inner",
98
+ cx: "20",
99
+ cy: "20",
100
+ r: "17"
101
+ })], -1), a("span", {
102
+ id: R.value,
103
+ role: "status",
104
+ class: "visually-hidden"
105
+ }, g(n.loadingText), 9, O)], 64)) : r("", !0)
106
+ ], 2),
107
+ (n.helperText || t.$slots["helper-text"]) && !n.invalid ? (p(), i("p", {
108
+ key: 0,
109
+ id: F.value,
110
+ class: "helper-text"
111
+ }, [h(t.$slots, "helper-text", {}, () => [s(g(n.helperText), 1)])], 8, k)) : r("", !0),
112
+ n.invalid && (n.errorText || t.$slots["error-text"]) ? (p(), i("p", {
113
+ key: 1,
114
+ id: I.value,
115
+ class: "error-text"
116
+ }, [h(t.$slots, "error-text", {}, () => [s(g(n.errorText), 1)])], 8, A)) : r("", !0),
117
+ n.helperLinkHref && (n.helperLink || t.$slots["helper-link"]) ? (p(), i("a", {
118
+ key: 2,
119
+ id: L.value,
120
+ href: n.helperLinkHref,
121
+ "aria-labelledby": `${L.value} ${P.value}`,
122
+ class: "link link-small"
123
+ }, [h(t.$slots, "helper-link", {}, () => [s(g(n.helperLink), 1)]), a("span", M, g(n.helperLinkAria), 1)], 8, j)) : r("", !0)
124
+ ], 6));
125
+ }
126
+ }), P = /* @__PURE__ */ c({
127
+ inheritAttrs: !1,
128
+ __name: "VueSelect",
129
+ props: /*@__PURE__*/ l({
130
+ label: {},
131
+ options: {},
132
+ helperText: {},
133
+ errorText: {},
134
+ helperLink: {},
135
+ helperLinkHref: {},
136
+ helperLinkAria: {},
137
+ outlined: { type: Boolean },
138
+ disabled: { type: Boolean },
139
+ required: { type: Boolean },
140
+ invalid: { type: Boolean },
141
+ maxWidth: { type: Boolean },
142
+ loading: { type: Boolean },
143
+ loadingText: {}
144
+ }, {
145
+ modelValue: { default: "" },
146
+ modelModifiers: {}
147
+ }),
148
+ emits: /*@__PURE__*/ l(["change"], ["update:modelValue"]),
149
+ setup(e, { emit: t }) {
150
+ let r = e, i = x(e, "modelValue"), a = t;
151
+ function s(e) {
152
+ i.value = e.target.value, a("change", e);
153
+ }
154
+ return (e, t) => (p(), n(N, u({
155
+ ...e.$attrs,
156
+ ...r
157
+ }, {
158
+ value: i.value,
159
+ onChange: s
160
+ }), o({ _: 2 }, [
161
+ e.$slots.label ? {
162
+ name: "label",
163
+ fn: C(() => [h(e.$slots, "label")]),
164
+ key: "0"
165
+ } : void 0,
166
+ e.$slots["leading-icon"] ? {
167
+ name: "leading-icon",
168
+ fn: C(() => [h(e.$slots, "leading-icon")]),
169
+ key: "1"
170
+ } : void 0,
171
+ e.$slots["helper-text"] ? {
172
+ name: "helper-text",
173
+ fn: C(() => [h(e.$slots, "helper-text")]),
174
+ key: "2"
175
+ } : void 0,
176
+ e.$slots["error-text"] ? {
177
+ name: "error-text",
178
+ fn: C(() => [h(e.$slots, "error-text")]),
179
+ key: "3"
180
+ } : void 0,
181
+ e.$slots["helper-link"] ? {
182
+ name: "helper-link",
183
+ fn: C(() => [h(e.$slots, "helper-link")]),
184
+ key: "4"
185
+ } : void 0,
186
+ e.$slots.default ? {
187
+ name: "default",
188
+ fn: C(() => [h(e.$slots, "default")]),
189
+ key: "5"
190
+ } : void 0
191
+ ]), 1040, ["value"]));
192
+ }
193
+ });
194
+ //#endregion
195
+ export { P as t };
@@ -0,0 +1,136 @@
1
+ import { A as e, M as t, N as n, S as r, _ as i, a, b as o, c as s, d as c, g as l, i as u, j as d, k as f, l as p, o as m, p as h, t as g, u as _, v, x as y } from "./runtime-dom.esm-bundler-DLryEdgJ.js";
2
+ //#region src/components/select/Select.vue?vue&type=script&setup=true&lang.ts
3
+ var b = ["id", "for"], x = [
4
+ "id",
5
+ "aria-describedby",
6
+ "aria-invalid",
7
+ "value",
8
+ "disabled",
9
+ "required"
10
+ ], S = ["selected"], C = ["value", "selected"], w = ["id"], T = ["id"], E = ["id"], D = [
11
+ "id",
12
+ "href",
13
+ "aria-labelledby"
14
+ ], O = { class: "visually-hidden" }, k = g(/* @__PURE__ */ c({
15
+ inheritAttrs: !1,
16
+ __name: "Select",
17
+ props: {
18
+ label: { default: "Select" },
19
+ options: { default: () => [] },
20
+ helperText: { default: "" },
21
+ errorText: { default: "" },
22
+ helperLink: { default: "" },
23
+ helperLinkHref: { default: "" },
24
+ helperLinkAria: { default: "on" },
25
+ value: { default: "" },
26
+ outlined: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ disabled: {
31
+ type: Boolean,
32
+ default: !1
33
+ },
34
+ required: {
35
+ type: Boolean,
36
+ default: !1
37
+ },
38
+ invalid: {
39
+ type: Boolean,
40
+ default: !1
41
+ },
42
+ maxWidth: {
43
+ type: Boolean,
44
+ default: !1
45
+ },
46
+ loading: {
47
+ type: Boolean,
48
+ default: !1
49
+ },
50
+ loadingText: { default: "Loading" }
51
+ },
52
+ setup(c) {
53
+ let g = o();
54
+ function k() {
55
+ let { class: e, style: t, ...n } = g;
56
+ return n;
57
+ }
58
+ let A = f(() => g.id), j = r(), M = y(), N = f(() => A.value || `ouds-select-${M}`), P = f(() => `${N.value}-label`), F = f(() => `${N.value}-helper`), I = f(() => `${N.value}-error`), L = f(() => `${N.value}-helper-link`), R = f(() => `${N.value}-loading`);
59
+ function z() {
60
+ let e = [g["aria-describedby"]];
61
+ return (c.helperText || j["helper-text"]) && !c.invalid && e.push(F.value), c.invalid && (c.errorText || j["error-text"]) && e.push(I.value), c.helperLinkHref && (c.helperLink || j["helper-link"]) && e.push(L.value), c.loading && e.push(R.value), e.filter(Boolean).join(" ") || void 0;
62
+ }
63
+ let B = a(() => ["select-input-container", { "select-input-container-outlined": c.outlined }]), V = a(() => ["select-input", { "component-max-width": c.maxWidth }]), H = a(() => ["select-input-field", { "loading-indeterminate": c.loading }]);
64
+ return (r, a) => (l(), p("div", {
65
+ class: d([V.value, e(g).class]),
66
+ style: t(e(g).style)
67
+ }, [
68
+ m("div", { class: d(B.value) }, [
69
+ v(r.$slots, "leading-icon"),
70
+ m("label", {
71
+ id: P.value,
72
+ for: N.value,
73
+ class: d({ "is-required": c.required })
74
+ }, [v(r.$slots, "label", {}, () => [_(n(c.label), 1)])], 10, b),
75
+ m("select", h(k(), {
76
+ id: N.value,
77
+ "aria-describedby": z(),
78
+ "aria-invalid": c.invalid || e(g)["aria-invalid"],
79
+ class: H.value,
80
+ value: c.value,
81
+ disabled: c.disabled,
82
+ required: c.required
83
+ }), [m("option", {
84
+ value: "",
85
+ disabled: "",
86
+ selected: c.value === ""
87
+ }, null, 8, S), v(r.$slots, "default", {}, () => [(l(!0), p(u, null, i(c.options, (e) => (l(), p("option", {
88
+ key: e.value,
89
+ value: e.value,
90
+ selected: e.value === c.value
91
+ }, n(e.label), 9, C))), 128))])], 16, x),
92
+ c.loading ? (l(), p(u, { key: 0 }, [a[0] ||= m("svg", {
93
+ viewBox: "0 0 40 40",
94
+ class: "loader",
95
+ "aria-hidden": "true"
96
+ }, [m("circle", {
97
+ class: "loader-inner",
98
+ cx: "20",
99
+ cy: "20",
100
+ r: "17"
101
+ })], -1), m("span", {
102
+ id: R.value,
103
+ role: "status",
104
+ class: "visually-hidden"
105
+ }, n(c.loadingText), 9, w)], 64)) : s("", !0)
106
+ ], 2),
107
+ (c.helperText || r.$slots["helper-text"]) && !c.invalid ? (l(), p("p", {
108
+ key: 0,
109
+ id: F.value,
110
+ class: "helper-text"
111
+ }, [v(r.$slots, "helper-text", {}, () => [_(n(c.helperText), 1)])], 8, T)) : s("", !0),
112
+ c.invalid && (c.errorText || r.$slots["error-text"]) ? (l(), p("p", {
113
+ key: 1,
114
+ id: I.value,
115
+ class: "error-text"
116
+ }, [v(r.$slots, "error-text", {}, () => [_(n(c.errorText), 1)])], 8, E)) : s("", !0),
117
+ c.helperLinkHref && (c.helperLink || r.$slots["helper-link"]) ? (l(), p("a", {
118
+ key: 2,
119
+ id: L.value,
120
+ href: c.helperLinkHref,
121
+ "aria-labelledby": `${L.value} ${P.value}`,
122
+ class: "link link-small"
123
+ }, [v(r.$slots, "helper-link", {}, () => [_(n(c.helperLink), 1)]), m("span", O, n(c.helperLinkAria), 1)], 8, D)) : s("", !0)
124
+ ], 6));
125
+ }
126
+ }), { shadowRoot: !1 }), A = class extends k {
127
+ connectedCallback() {
128
+ for (let e of Array.from(this.childNodes)) (e.nodeType === 8 || e.nodeType === 3 && !e.textContent?.trim()) && e.remove();
129
+ super.connectedCallback();
130
+ }
131
+ };
132
+ function j() {
133
+ typeof customElements < "u" && (customElements.get("ouds-select") || customElements.define("ouds-select", A));
134
+ }
135
+ //#endregion
136
+ export { j as n, A as t };
package/dist/select.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./select-CWjTpHGb.js";
1
+ import { n as e, t } from "./select-BbeCpnsY.js";
2
2
  //#region src/select.ts
3
3
  e();
4
4
  //#endregion
@@ -0,0 +1,179 @@
1
+ import { n as e } from "./control-item-slots-Ddp7c8w8.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, normalizeStyle as p, openBlock as m, renderSlot as h, resolveDynamicComponent as g, toDisplayString as _, toRef as v, unref as y, useAttrs as b, useId as x, useModel as S, withCtx as C } from "vue";
3
+ //#region src/components/switch/switch.context.ts
4
+ var w = Symbol("ouds-switch-element-id"), T = { class: "control-item-assets-container" }, E = [
5
+ "id",
6
+ "value",
7
+ "checked",
8
+ "disabled",
9
+ "required",
10
+ "aria-describedby",
11
+ "aria-invalid"
12
+ ], D = [
13
+ "id",
14
+ "aria-checked",
15
+ "aria-labelledby",
16
+ "aria-describedby",
17
+ "aria-invalid"
18
+ ], O = { class: "control-item-text-container" }, k = ["id"], A = {
19
+ key: 0,
20
+ class: "control-item-assets-container"
21
+ }, j = /* @__PURE__ */ c({
22
+ inheritAttrs: !1,
23
+ __name: "Switch",
24
+ props: {
25
+ label: { default: "Switch" },
26
+ description: { default: "" },
27
+ value: { default: "" },
28
+ checked: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ disabled: {
33
+ type: Boolean,
34
+ default: !1
35
+ },
36
+ required: {
37
+ type: Boolean,
38
+ default: !1
39
+ },
40
+ divider: {
41
+ type: Boolean,
42
+ default: !1
43
+ },
44
+ readonly: {
45
+ type: Boolean,
46
+ default: !1
47
+ },
48
+ invalid: {
49
+ type: Boolean,
50
+ default: !1
51
+ },
52
+ reverse: {
53
+ type: Boolean,
54
+ default: !1
55
+ },
56
+ maxWidth: {
57
+ type: Boolean,
58
+ default: !1
59
+ }
60
+ },
61
+ setup(o) {
62
+ let c = b();
63
+ function u() {
64
+ let { class: e, style: t, ...n } = c;
65
+ return n;
66
+ }
67
+ let S = v(() => c.id), j = x(), M = l(w, void 0), N = e(M !== void 0), P = v(() => M ? `${S.value || M}-input` : S.value || `ouds-switch-${j}`), F = v(() => `${P.value}-label`), I = v(() => `${P.value}-description`);
68
+ function L() {
69
+ let e = [c["aria-describedby"]];
70
+ return (o.description || N("description")) && e.push(I.value), e.filter(Boolean).join(" ") || void 0;
71
+ }
72
+ function R() {
73
+ return [c["aria-labelledby"], F.value].filter(Boolean).join(" ");
74
+ }
75
+ let z = t(() => ["switch-item", {
76
+ "control-item-divider": o.divider,
77
+ "control-item-reverse": o.reverse,
78
+ "component-max-width": o.maxWidth
79
+ }]);
80
+ return (e, t) => (m(), i("div", {
81
+ class: f([z.value, y(c).class]),
82
+ style: p(y(c).style)
83
+ }, [
84
+ a("div", T, [o.readonly ? (m(), i("span", d({ key: 1 }, u(), {
85
+ id: P.value,
86
+ class: "control-item-indicator",
87
+ role: "switch",
88
+ "aria-readonly": "true",
89
+ "aria-disabled": "true",
90
+ tabindex: "0",
91
+ "aria-checked": o.checked,
92
+ "aria-labelledby": R(),
93
+ "aria-describedby": L(),
94
+ "aria-invalid": o.invalid || y(c)["aria-invalid"]
95
+ }), null, 16, D)) : (m(), i("input", d({ key: 0 }, u(), {
96
+ id: P.value,
97
+ class: "control-item-indicator",
98
+ type: "checkbox",
99
+ role: "switch",
100
+ value: o.value,
101
+ checked: o.checked,
102
+ disabled: o.disabled,
103
+ required: o.required,
104
+ "aria-describedby": L(),
105
+ "aria-invalid": o.invalid || y(c)["aria-invalid"]
106
+ }), null, 16, E))]),
107
+ a("div", O, [(m(), n(g(o.readonly ? "span" : "label"), {
108
+ id: F.value,
109
+ class: f(["control-item-label", { "is-required": o.required }]),
110
+ for: o.readonly ? void 0 : P.value
111
+ }, {
112
+ default: C(() => [h(e.$slots, "label", {}, () => [s(_(o.label), 1)])]),
113
+ _: 3
114
+ }, 8, [
115
+ "id",
116
+ "class",
117
+ "for"
118
+ ])), o.description || y(N)("description") ? (m(), i("p", {
119
+ key: 0,
120
+ id: I.value,
121
+ class: "control-item-description"
122
+ }, [h(e.$slots, "description", {}, () => [s(_(o.description), 1)])], 8, k)) : r("", !0)]),
123
+ y(N)("asset") ? (m(), i("div", A, [h(e.$slots, "asset")])) : r("", !0)
124
+ ], 6));
125
+ }
126
+ }), M = /* @__PURE__ */ c({
127
+ inheritAttrs: !1,
128
+ __name: "VueSwitch",
129
+ props: /*@__PURE__*/ u({
130
+ label: {},
131
+ description: {},
132
+ value: {},
133
+ disabled: { type: Boolean },
134
+ required: { type: Boolean },
135
+ divider: { type: Boolean },
136
+ readonly: { type: Boolean },
137
+ invalid: { type: Boolean },
138
+ reverse: { type: Boolean },
139
+ maxWidth: { type: Boolean }
140
+ }, {
141
+ modelValue: {
142
+ type: Boolean,
143
+ default: !1
144
+ },
145
+ modelModifiers: {}
146
+ }),
147
+ emits: /*@__PURE__*/ u(["change"], ["update:modelValue"]),
148
+ setup(e, { emit: t }) {
149
+ let r = e, i = S(e, "modelValue"), a = t;
150
+ function s(e) {
151
+ i.value = e.target.checked, a("change", e);
152
+ }
153
+ return (e, t) => (m(), n(j, d({
154
+ ...e.$attrs,
155
+ ...r
156
+ }, {
157
+ checked: i.value,
158
+ onChange: s
159
+ }), o({ _: 2 }, [
160
+ e.$slots.label ? {
161
+ name: "label",
162
+ fn: C(() => [h(e.$slots, "label")]),
163
+ key: "0"
164
+ } : void 0,
165
+ e.$slots.asset ? {
166
+ name: "asset",
167
+ fn: C(() => [h(e.$slots, "asset")]),
168
+ key: "1"
169
+ } : void 0,
170
+ e.$slots.description ? {
171
+ name: "description",
172
+ fn: C(() => [h(e.$slots, "description")]),
173
+ key: "2"
174
+ } : void 0
175
+ ]), 1040, ["checked"]));
176
+ }
177
+ });
178
+ //#endregion
179
+ export { M as t };
@@ -0,0 +1,140 @@
1
+ import { A as e, M as t, N as n, T as r, a as i, b as a, c as o, d as s, f as c, g as l, j as u, k as d, l as f, o as p, p as m, s as h, t as g, u as _, v, x as y, y as b } from "./runtime-dom.esm-bundler-DLryEdgJ.js";
2
+ import { r as x, t as S } from "./control-item-slots-BDoeNuk4.js";
3
+ //#region src/components/switch/switch.context.ts
4
+ var C = Symbol("ouds-switch-element-id"), w = { class: "control-item-assets-container" }, T = [
5
+ "id",
6
+ "value",
7
+ "checked",
8
+ "disabled",
9
+ "required",
10
+ "aria-describedby",
11
+ "aria-invalid"
12
+ ], E = [
13
+ "id",
14
+ "aria-checked",
15
+ "aria-labelledby",
16
+ "aria-describedby",
17
+ "aria-invalid"
18
+ ], D = { class: "control-item-text-container" }, O = ["id"], k = {
19
+ key: 0,
20
+ class: "control-item-assets-container"
21
+ }, A = /* @__PURE__ */ s({
22
+ inheritAttrs: !1,
23
+ __name: "Switch",
24
+ props: {
25
+ label: { default: "Switch" },
26
+ description: { default: "" },
27
+ value: { default: "" },
28
+ checked: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ disabled: {
33
+ type: Boolean,
34
+ default: !1
35
+ },
36
+ required: {
37
+ type: Boolean,
38
+ default: !1
39
+ },
40
+ divider: {
41
+ type: Boolean,
42
+ default: !1
43
+ },
44
+ readonly: {
45
+ type: Boolean,
46
+ default: !1
47
+ },
48
+ invalid: {
49
+ type: Boolean,
50
+ default: !1
51
+ },
52
+ reverse: {
53
+ type: Boolean,
54
+ default: !1
55
+ },
56
+ maxWidth: {
57
+ type: Boolean,
58
+ default: !1
59
+ }
60
+ },
61
+ setup(s) {
62
+ let g = a();
63
+ function S() {
64
+ let { class: e, style: t, ...n } = g;
65
+ return n;
66
+ }
67
+ let A = d(() => g.id), j = y(), M = c(C, void 0), N = x(M !== void 0), P = d(() => M ? `${A.value || M}-input` : A.value || `ouds-switch-${j}`), F = d(() => `${P.value}-label`), I = d(() => `${P.value}-description`);
68
+ function L() {
69
+ let e = [g["aria-describedby"]];
70
+ return (s.description || N("description")) && e.push(I.value), e.filter(Boolean).join(" ") || void 0;
71
+ }
72
+ function R() {
73
+ return [g["aria-labelledby"], F.value].filter(Boolean).join(" ");
74
+ }
75
+ let z = i(() => ["switch-item", {
76
+ "control-item-divider": s.divider,
77
+ "control-item-reverse": s.reverse,
78
+ "component-max-width": s.maxWidth
79
+ }]);
80
+ return (i, a) => (l(), f("div", {
81
+ class: u([z.value, e(g).class]),
82
+ style: t(e(g).style)
83
+ }, [
84
+ p("div", w, [s.readonly ? (l(), f("span", m({ key: 1 }, S(), {
85
+ id: P.value,
86
+ class: "control-item-indicator",
87
+ role: "switch",
88
+ "aria-readonly": "true",
89
+ "aria-disabled": "true",
90
+ tabindex: "0",
91
+ "aria-checked": s.checked,
92
+ "aria-labelledby": R(),
93
+ "aria-describedby": L(),
94
+ "aria-invalid": s.invalid || e(g)["aria-invalid"]
95
+ }), null, 16, E)) : (l(), f("input", m({ key: 0 }, S(), {
96
+ id: P.value,
97
+ class: "control-item-indicator",
98
+ type: "checkbox",
99
+ role: "switch",
100
+ value: s.value,
101
+ checked: s.checked,
102
+ disabled: s.disabled,
103
+ required: s.required,
104
+ "aria-describedby": L(),
105
+ "aria-invalid": s.invalid || e(g)["aria-invalid"]
106
+ }), null, 16, T))]),
107
+ p("div", D, [(l(), h(b(s.readonly ? "span" : "label"), {
108
+ id: F.value,
109
+ class: u(["control-item-label", { "is-required": s.required }]),
110
+ for: s.readonly ? void 0 : P.value
111
+ }, {
112
+ default: r(() => [v(i.$slots, "label", {}, () => [_(n(s.label), 1)])]),
113
+ _: 3
114
+ }, 8, [
115
+ "id",
116
+ "class",
117
+ "for"
118
+ ])), s.description || e(N)("description") ? (l(), f("p", {
119
+ key: 0,
120
+ id: I.value,
121
+ class: "control-item-description"
122
+ }, [v(i.$slots, "description", {}, () => [_(n(s.description), 1)])], 8, O)) : o("", !0)]),
123
+ e(N)("asset") ? (l(), f("div", k, [v(i.$slots, "asset")])) : o("", !0)
124
+ ], 6));
125
+ }
126
+ }), j = 0, M = g(A, {
127
+ shadowRoot: !1,
128
+ configureApp(e) {
129
+ e.provide(C, `ouds-switch-element-${j++}`);
130
+ }
131
+ }), N = class extends M {
132
+ connectedCallback() {
133
+ S(this), super.connectedCallback();
134
+ }
135
+ };
136
+ function P() {
137
+ typeof customElements < "u" && (customElements.get("ouds-switch") || customElements.define("ouds-switch", N));
138
+ }
139
+ //#endregion
140
+ export { P as n, N as t };
package/dist/switch.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./switch-CFv0JUeq.js";
1
+ import { n as e, t } from "./switch-D5N-j5F7.js";
2
2
  //#region src/switch.ts
3
3
  e();
4
4
  //#endregion