@nilloq/ouds-web 0.1.5 → 0.1.7

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