@nilloq/ouds-web 0.1.5 → 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 +17 -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 +1 -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-CtTr5yfe.js +0 -151
  132. package/dist/text-input-l1F2arKl.js +0 -201
@@ -0,0 +1,167 @@
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, openBlock as f, renderList as p, renderSlot as m, toDisplayString as h, toRef as g, unref as _, useAttrs as v, useId as y, useModel as b, useSlots as x, withCtx as S } from "vue";
2
+ //#region src/components/select/Select.vue?vue&type=script&setup=true&lang.ts
3
+ var C = ["id", "for"], w = [
4
+ "id",
5
+ "aria-describedby",
6
+ "aria-invalid",
7
+ "value",
8
+ "disabled",
9
+ "required"
10
+ ], T = ["selected"], E = ["value", "selected"], D = ["id"], O = ["id"], k = ["id"], A = [
11
+ "id",
12
+ "href",
13
+ "aria-labelledby"
14
+ ], j = /* @__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 = v(), c = g(() => o.id), l = x(), b = y(), S = g(() => c.value || `ouds-select-${b}`), j = g(() => `${S.value}-label`), M = g(() => `${S.value}-helper`), N = g(() => `${S.value}-error`), P = g(() => `${S.value}-helper-link`), F = g(() => `${S.value}-loading`);
52
+ function I() {
53
+ let e = [o["aria-describedby"]];
54
+ return (n.helperText || l["helper-text"]) && !n.invalid && e.push(M.value), n.invalid && (n.errorText || l["error-text"]) && e.push(N.value), n.helperLinkHref && (n.helperLink || l["helper-link"]) && e.push(P.value), n.loading && e.push(F.value), e.filter(Boolean).join(" ") || void 0;
55
+ }
56
+ let L = t(() => ["select-input-container", { "select-input-container-outlined": n.outlined }]), R = t(() => ["select-input", { "component-max-width": n.maxWidth }]), z = t(() => ["select-input-field", { "loading-indeterminate": n.loading }]);
57
+ return (t, c) => (f(), i("div", { class: d(R.value) }, [
58
+ a("div", { class: d(L.value) }, [
59
+ m(t.$slots, "leading-icon"),
60
+ a("label", {
61
+ id: j.value,
62
+ for: S.value,
63
+ class: d({ "is-required": n.required })
64
+ }, [m(t.$slots, "label", {}, () => [s(h(n.label), 1)])], 10, C),
65
+ a("select", u(_(o), {
66
+ id: S.value,
67
+ "aria-describedby": I(),
68
+ "aria-invalid": n.invalid || _(o)["aria-invalid"],
69
+ class: z.value,
70
+ value: n.value,
71
+ disabled: n.disabled,
72
+ required: n.required
73
+ }), [a("option", {
74
+ value: "",
75
+ disabled: "",
76
+ selected: n.value === ""
77
+ }, null, 8, T), m(t.$slots, "default", {}, () => [(f(!0), i(e, null, p(n.options, (e) => (f(), i("option", {
78
+ key: e.value,
79
+ value: e.value,
80
+ selected: e.value === n.value
81
+ }, h(e.label), 9, E))), 128))])], 16, w),
82
+ n.loading ? (f(), i(e, { key: 0 }, [c[0] ||= a("svg", {
83
+ viewBox: "0 0 40 40",
84
+ class: "loader",
85
+ "aria-hidden": "true"
86
+ }, [a("circle", {
87
+ class: "loader-inner",
88
+ cx: "20",
89
+ cy: "20",
90
+ r: "17"
91
+ })], -1), a("span", {
92
+ id: F.value,
93
+ role: "status",
94
+ class: "visually-hidden"
95
+ }, "Loading", 8, D)], 64)) : r("", !0)
96
+ ], 2),
97
+ (n.helperText || t.$slots["helper-text"]) && !n.invalid ? (f(), i("p", {
98
+ key: 0,
99
+ id: M.value,
100
+ class: "helper-text"
101
+ }, [m(t.$slots, "helper-text", {}, () => [s(h(n.helperText), 1)])], 8, O)) : r("", !0),
102
+ n.invalid && (n.errorText || t.$slots["error-text"]) ? (f(), i("p", {
103
+ key: 1,
104
+ id: N.value,
105
+ class: "error-text"
106
+ }, [m(t.$slots, "error-text", {}, () => [s(h(n.errorText), 1)])], 8, k)) : r("", !0),
107
+ n.helperLinkHref && (n.helperLink || t.$slots["helper-link"]) ? (f(), i("a", {
108
+ key: 2,
109
+ id: P.value,
110
+ href: n.helperLinkHref,
111
+ "aria-labelledby": `${P.value} ${j.value}`,
112
+ class: "link link-small"
113
+ }, [m(t.$slots, "helper-link", {}, () => [s(h(n.helperLink), 1)]), c[1] ||= a("span", { class: "visually-hidden" }, "on", -1)], 8, A)) : r("", !0)
114
+ ], 2));
115
+ }
116
+ }), M = /* @__PURE__ */ c({
117
+ inheritAttrs: !1,
118
+ __name: "VueSelect",
119
+ props: {
120
+ modelValue: { default: "" },
121
+ modelModifiers: {}
122
+ },
123
+ emits: /*@__PURE__*/ l(["change"], ["update:modelValue"]),
124
+ setup(e, { emit: t }) {
125
+ let r = b(e, "modelValue"), i = t;
126
+ function a(e) {
127
+ r.value = e.target.value, i("change", e);
128
+ }
129
+ return (e, t) => (f(), n(j, u(e.$attrs, {
130
+ value: r.value,
131
+ onChange: a
132
+ }), o({ _: 2 }, [
133
+ e.$slots.label ? {
134
+ name: "label",
135
+ fn: S(() => [m(e.$slots, "label")]),
136
+ key: "0"
137
+ } : void 0,
138
+ e.$slots["leading-icon"] ? {
139
+ name: "leading-icon",
140
+ fn: S(() => [m(e.$slots, "leading-icon")]),
141
+ key: "1"
142
+ } : void 0,
143
+ e.$slots["helper-text"] ? {
144
+ name: "helper-text",
145
+ fn: S(() => [m(e.$slots, "helper-text")]),
146
+ key: "2"
147
+ } : void 0,
148
+ e.$slots["error-text"] ? {
149
+ name: "error-text",
150
+ fn: S(() => [m(e.$slots, "error-text")]),
151
+ key: "3"
152
+ } : void 0,
153
+ e.$slots["helper-link"] ? {
154
+ name: "helper-link",
155
+ fn: S(() => [m(e.$slots, "helper-link")]),
156
+ key: "4"
157
+ } : void 0,
158
+ e.$slots.default ? {
159
+ name: "default",
160
+ fn: S(() => [m(e.$slots, "default")]),
161
+ key: "5"
162
+ } : void 0
163
+ ]), 1040, ["value"]));
164
+ }
165
+ });
166
+ //#endregion
167
+ export { M as t };
@@ -0,0 +1,126 @@
1
+ import { A as e, M as t, S as n, _ as r, a as i, b as a, c as o, d as s, g as c, i as l, j as u, k as d, l as f, o as p, p as m, t as h, u as g, v as _, x as v } from "./runtime-dom.esm-bundler-BeOO_l6v.js";
2
+ //#region src/components/select/Select.vue?vue&type=script&setup=true&lang.ts
3
+ var y = ["id", "for"], b = [
4
+ "id",
5
+ "aria-describedby",
6
+ "aria-invalid",
7
+ "value",
8
+ "disabled",
9
+ "required"
10
+ ], x = ["selected"], S = ["value", "selected"], C = ["id"], w = ["id"], T = ["id"], E = [
11
+ "id",
12
+ "href",
13
+ "aria-labelledby"
14
+ ], D = h(/* @__PURE__ */ s({
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(s) {
51
+ let h = a(), D = d(() => h.id), O = n(), k = v(), A = d(() => D.value || `ouds-select-${k}`), j = d(() => `${A.value}-label`), M = d(() => `${A.value}-helper`), N = d(() => `${A.value}-error`), P = d(() => `${A.value}-helper-link`), F = d(() => `${A.value}-loading`);
52
+ function I() {
53
+ let e = [h["aria-describedby"]];
54
+ return (s.helperText || O["helper-text"]) && !s.invalid && e.push(M.value), s.invalid && (s.errorText || O["error-text"]) && e.push(N.value), s.helperLinkHref && (s.helperLink || O["helper-link"]) && e.push(P.value), s.loading && e.push(F.value), e.filter(Boolean).join(" ") || void 0;
55
+ }
56
+ let L = i(() => ["select-input-container", { "select-input-container-outlined": s.outlined }]), R = i(() => ["select-input", { "component-max-width": s.maxWidth }]), z = i(() => ["select-input-field", { "loading-indeterminate": s.loading }]);
57
+ return (n, i) => (c(), f("div", { class: u(R.value) }, [
58
+ p("div", { class: u(L.value) }, [
59
+ _(n.$slots, "leading-icon"),
60
+ p("label", {
61
+ id: j.value,
62
+ for: A.value,
63
+ class: u({ "is-required": s.required })
64
+ }, [_(n.$slots, "label", {}, () => [g(t(s.label), 1)])], 10, y),
65
+ p("select", m(e(h), {
66
+ id: A.value,
67
+ "aria-describedby": I(),
68
+ "aria-invalid": s.invalid || e(h)["aria-invalid"],
69
+ class: z.value,
70
+ value: s.value,
71
+ disabled: s.disabled,
72
+ required: s.required
73
+ }), [p("option", {
74
+ value: "",
75
+ disabled: "",
76
+ selected: s.value === ""
77
+ }, null, 8, x), _(n.$slots, "default", {}, () => [(c(!0), f(l, null, r(s.options, (e) => (c(), f("option", {
78
+ key: e.value,
79
+ value: e.value,
80
+ selected: e.value === s.value
81
+ }, t(e.label), 9, S))), 128))])], 16, b),
82
+ s.loading ? (c(), f(l, { key: 0 }, [i[0] ||= p("svg", {
83
+ viewBox: "0 0 40 40",
84
+ class: "loader",
85
+ "aria-hidden": "true"
86
+ }, [p("circle", {
87
+ class: "loader-inner",
88
+ cx: "20",
89
+ cy: "20",
90
+ r: "17"
91
+ })], -1), p("span", {
92
+ id: F.value,
93
+ role: "status",
94
+ class: "visually-hidden"
95
+ }, "Loading", 8, C)], 64)) : o("", !0)
96
+ ], 2),
97
+ (s.helperText || n.$slots["helper-text"]) && !s.invalid ? (c(), f("p", {
98
+ key: 0,
99
+ id: M.value,
100
+ class: "helper-text"
101
+ }, [_(n.$slots, "helper-text", {}, () => [g(t(s.helperText), 1)])], 8, w)) : o("", !0),
102
+ s.invalid && (s.errorText || n.$slots["error-text"]) ? (c(), f("p", {
103
+ key: 1,
104
+ id: N.value,
105
+ class: "error-text"
106
+ }, [_(n.$slots, "error-text", {}, () => [g(t(s.errorText), 1)])], 8, T)) : o("", !0),
107
+ s.helperLinkHref && (s.helperLink || n.$slots["helper-link"]) ? (c(), f("a", {
108
+ key: 2,
109
+ id: P.value,
110
+ href: s.helperLinkHref,
111
+ "aria-labelledby": `${P.value} ${j.value}`,
112
+ class: "link link-small"
113
+ }, [_(n.$slots, "helper-link", {}, () => [g(t(s.helperLink), 1)]), i[1] ||= p("span", { class: "visually-hidden" }, "on", -1)], 8, E)) : o("", !0)
114
+ ], 2));
115
+ }
116
+ }), { shadowRoot: !1 }), O = class extends D {
117
+ connectedCallback() {
118
+ for (let e of Array.from(this.childNodes)) (e.nodeType === 8 || e.nodeType === 3 && !e.textContent?.trim()) && e.remove();
119
+ super.connectedCallback();
120
+ }
121
+ };
122
+ function k() {
123
+ typeof customElements < "u" && (customElements.get("ouds-select") || customElements.define("ouds-select", O));
124
+ }
125
+ //#endregion
126
+ export { k as n, O 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-CWjTpHGb.js";
2
2
  //#region src/select.ts
3
3
  e();
4
4
  //#endregion
@@ -0,0 +1,132 @@
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/switch/switch.context.ts
4
+ var S = Symbol("ouds-switch-element-id"), C = { class: "control-item-assets-container" }, w = [
5
+ "id",
6
+ "value",
7
+ "checked",
8
+ "disabled",
9
+ "required",
10
+ "aria-describedby",
11
+ "aria-invalid"
12
+ ], T = [
13
+ "id",
14
+ "aria-checked",
15
+ "aria-labelledby",
16
+ "aria-describedby",
17
+ "aria-invalid"
18
+ ], E = { class: "control-item-text-container" }, D = ["id"], O = {
19
+ key: 0,
20
+ class: "control-item-assets-container"
21
+ }, k = /* @__PURE__ */ o({
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 h = i(), x = u(() => h.id), k = v(), A = s(S, void 0), j = b(A !== void 0), M = u(() => A ? `${x.value || A}-input` : x.value || `ouds-switch-${k}`), N = u(() => `${M.value}-label`), P = u(() => `${M.value}-description`);
63
+ function F() {
64
+ let e = [h["aria-describedby"]];
65
+ return (o.description || j("description")) && e.push(P.value), e.filter(Boolean).join(" ") || void 0;
66
+ }
67
+ function I() {
68
+ return [h["aria-labelledby"], N.value].filter(Boolean).join(" ");
69
+ }
70
+ let L = r(() => ["switch-item", {
71
+ "control-item-divider": o.divider,
72
+ "control-item-reverse": o.reverse,
73
+ "component-max-width": o.maxWidth
74
+ }]);
75
+ return (r, i) => (c(), d("div", { class: l(L.value) }, [
76
+ f("div", C, [o.readonly ? (c(), d("span", p({ key: 1 }, e(h), {
77
+ id: M.value,
78
+ class: "control-item-indicator",
79
+ role: "switch",
80
+ "aria-readonly": "true",
81
+ "aria-disabled": "true",
82
+ tabindex: "0",
83
+ "aria-checked": o.checked,
84
+ "aria-labelledby": I(),
85
+ "aria-describedby": F(),
86
+ "aria-invalid": o.invalid || e(h)["aria-invalid"]
87
+ }), null, 16, T)) : (c(), d("input", p({ key: 0 }, e(h), {
88
+ id: M.value,
89
+ class: "control-item-indicator",
90
+ type: "checkbox",
91
+ role: "switch",
92
+ value: o.value,
93
+ checked: o.checked,
94
+ disabled: o.disabled,
95
+ required: o.required,
96
+ "aria-describedby": F(),
97
+ "aria-invalid": o.invalid || e(h)["aria-invalid"]
98
+ }), null, 16, w))]),
99
+ f("div", E, [(c(), m(y(o.readonly ? "span" : "label"), {
100
+ id: N.value,
101
+ class: l(["control-item-label", { "is-required": o.required }]),
102
+ for: o.readonly ? void 0 : M.value
103
+ }, {
104
+ default: n(() => [_(r.$slots, "label", {}, () => [g(t(o.label), 1)])]),
105
+ _: 3
106
+ }, 8, [
107
+ "id",
108
+ "class",
109
+ "for"
110
+ ])), o.description || e(j)("description") ? (c(), d("p", {
111
+ key: 0,
112
+ id: P.value,
113
+ class: "control-item-description"
114
+ }, [_(r.$slots, "description", {}, () => [g(t(o.description), 1)])], 8, D)) : a("", !0)]),
115
+ e(j)("asset") ? (c(), d("div", O, [_(r.$slots, "asset")])) : a("", !0)
116
+ ], 2));
117
+ }
118
+ }), A = 0, j = h(k, {
119
+ shadowRoot: !1,
120
+ configureApp(e) {
121
+ e.provide(S, `ouds-switch-element-${A++}`);
122
+ }
123
+ }), M = class extends j {
124
+ connectedCallback() {
125
+ x(this), super.connectedCallback();
126
+ }
127
+ };
128
+ function N() {
129
+ typeof customElements < "u" && (customElements.get("ouds-switch") || customElements.define("ouds-switch", M));
130
+ }
131
+ //#endregion
132
+ export { N as n, M as t };
@@ -0,0 +1,157 @@
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/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__ */ 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 = y(), u = _(() => c.id), x = b(), A = l(C, void 0), j = e(A !== void 0), M = _(() => A ? `${u.value || A}-input` : u.value || `ouds-switch-${x}`), N = _(() => `${M.value}-label`), P = _(() => `${M.value}-description`);
63
+ function F() {
64
+ let e = [c["aria-describedby"]];
65
+ return (o.description || j("description")) && e.push(P.value), e.filter(Boolean).join(" ") || void 0;
66
+ }
67
+ function I() {
68
+ return [c["aria-labelledby"], N.value].filter(Boolean).join(" ");
69
+ }
70
+ let L = t(() => ["switch-item", {
71
+ "control-item-divider": o.divider,
72
+ "control-item-reverse": o.reverse,
73
+ "component-max-width": o.maxWidth
74
+ }]);
75
+ return (e, t) => (p(), i("div", { class: f(L.value) }, [
76
+ a("div", w, [o.readonly ? (p(), i("span", d({ key: 1 }, v(c), {
77
+ id: M.value,
78
+ class: "control-item-indicator",
79
+ role: "switch",
80
+ "aria-readonly": "true",
81
+ "aria-disabled": "true",
82
+ tabindex: "0",
83
+ "aria-checked": o.checked,
84
+ "aria-labelledby": I(),
85
+ "aria-describedby": F(),
86
+ "aria-invalid": o.invalid || v(c)["aria-invalid"]
87
+ }), null, 16, E)) : (p(), i("input", d({ key: 0 }, v(c), {
88
+ id: M.value,
89
+ class: "control-item-indicator",
90
+ type: "checkbox",
91
+ role: "switch",
92
+ value: o.value,
93
+ checked: o.checked,
94
+ disabled: o.disabled,
95
+ required: o.required,
96
+ "aria-describedby": F(),
97
+ "aria-invalid": o.invalid || v(c)["aria-invalid"]
98
+ }), null, 16, T))]),
99
+ a("div", D, [(p(), n(h(o.readonly ? "span" : "label"), {
100
+ id: N.value,
101
+ class: f(["control-item-label", { "is-required": o.required }]),
102
+ for: o.readonly ? void 0 : M.value
103
+ }, {
104
+ default: S(() => [m(e.$slots, "label", {}, () => [s(g(o.label), 1)])]),
105
+ _: 3
106
+ }, 8, [
107
+ "id",
108
+ "class",
109
+ "for"
110
+ ])), o.description || v(j)("description") ? (p(), i("p", {
111
+ key: 0,
112
+ id: P.value,
113
+ class: "control-item-description"
114
+ }, [m(e.$slots, "description", {}, () => [s(g(o.description), 1)])], 8, O)) : r("", !0)]),
115
+ v(j)("asset") ? (p(), i("div", k, [m(e.$slots, "asset")])) : r("", !0)
116
+ ], 2));
117
+ }
118
+ }), j = /* @__PURE__ */ c({
119
+ inheritAttrs: !1,
120
+ __name: "VueSwitch",
121
+ props: {
122
+ modelValue: {
123
+ type: Boolean,
124
+ default: !1
125
+ },
126
+ modelModifiers: {}
127
+ },
128
+ emits: /*@__PURE__*/ u(["change"], ["update:modelValue"]),
129
+ setup(e, { emit: t }) {
130
+ let r = x(e, "modelValue"), i = t;
131
+ function a(e) {
132
+ r.value = e.target.checked, i("change", e);
133
+ }
134
+ return (e, t) => (p(), n(A, d(e.$attrs, {
135
+ checked: r.value,
136
+ onChange: a
137
+ }), o({ _: 2 }, [
138
+ e.$slots.label ? {
139
+ name: "label",
140
+ fn: S(() => [m(e.$slots, "label")]),
141
+ key: "0"
142
+ } : void 0,
143
+ e.$slots.asset ? {
144
+ name: "asset",
145
+ fn: S(() => [m(e.$slots, "asset")]),
146
+ key: "1"
147
+ } : void 0,
148
+ e.$slots.description ? {
149
+ name: "description",
150
+ fn: S(() => [m(e.$slots, "description")]),
151
+ key: "2"
152
+ } : void 0
153
+ ]), 1040, ["checked"]));
154
+ }
155
+ });
156
+ //#endregion
157
+ export { j as t };
package/dist/switch.js ADDED
@@ -0,0 +1,5 @@
1
+ import { n as e, t } from "./switch-CFv0JUeq.js";
2
+ //#region src/switch.ts
3
+ e();
4
+ //#endregion
5
+ export { t as OudsSwitch, e as defineOudsSwitch };
@@ -0,0 +1,84 @@
1
+ import { a as e, c as t, d as n, g as r, i, j as a, l as o, o as s, t as c, u as l, v as u } from "./runtime-dom.esm-bundler-BeOO_l6v.js";
2
+ //#region src/components/tag/Tag.vue?vue&type=script&setup=true&lang.ts
3
+ var d = {
4
+ key: 1,
5
+ class: "tag-status-icon",
6
+ "aria-hidden": "true"
7
+ }, f = {
8
+ key: 2,
9
+ class: "tag-bullet",
10
+ "aria-hidden": "true"
11
+ }, p = /* @__PURE__ */ n({
12
+ __name: "Tag",
13
+ props: {
14
+ variant: { default: "neutral" },
15
+ statusIcon: {
16
+ type: Boolean,
17
+ default: !1
18
+ },
19
+ size: { default: "medium" },
20
+ muted: {
21
+ type: Boolean,
22
+ default: !1
23
+ },
24
+ bullet: {
25
+ type: Boolean,
26
+ default: !1
27
+ },
28
+ disabled: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ loading: {
33
+ type: Boolean,
34
+ default: !1
35
+ }
36
+ },
37
+ setup(n) {
38
+ let c = e(() => n.variant.startsWith("categorical-")), p = e(() => [
39
+ "positive",
40
+ "info",
41
+ "warning",
42
+ "negative"
43
+ ].includes(n.variant)), m = e(() => [
44
+ "tag",
45
+ n.variant !== "neutral" && `tag-${n.variant}`,
46
+ {
47
+ "tag-muted": n.muted && !c.value,
48
+ "tag-small": n.size === "small",
49
+ disabled: n.disabled,
50
+ loading: n.loading
51
+ }
52
+ ]);
53
+ return (e, c) => (r(), o("span", { class: a(m.value) }, [n.loading ? (r(), o(i, { key: 0 }, [c[0] ||= s("svg", {
54
+ viewBox: "0 0 40 40",
55
+ class: "tag-loader",
56
+ "aria-hidden": "true"
57
+ }, [s("circle", {
58
+ class: "tag-loader-inner",
59
+ cx: "20",
60
+ cy: "20",
61
+ r: "15"
62
+ })], -1), c[1] ||= s("span", {
63
+ role: "status",
64
+ class: "visually-hidden"
65
+ }, "Loading", -1)], 64)) : n.statusIcon && p.value ? (r(), o("span", d)) : n.bullet ? (r(), o("span", f)) : t("", !0), u(e.$slots, "default", {}, () => [c[2] ||= l("Tag", -1)])], 2));
66
+ }
67
+ }), m = [
68
+ "neutral",
69
+ "accent",
70
+ "positive",
71
+ "info",
72
+ "warning",
73
+ "negative",
74
+ "categorical-1",
75
+ "categorical-2",
76
+ "categorical-3",
77
+ "categorical-4",
78
+ "categorical-5"
79
+ ], h = ["medium", "small"], g = c(p, { shadowRoot: !1 });
80
+ function _() {
81
+ typeof customElements < "u" && (customElements.get("ouds-tag") || customElements.define("ouds-tag", g));
82
+ }
83
+ //#endregion
84
+ export { m as i, _ as n, h as r, g as t };