@solfacil/girassol 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +2 -1
- package/.vscode/settings.json +9 -0
- package/README.md +1 -1
- package/cli/src/commands/create:component.ts +91 -0
- package/cli/src/commands/generate:plugin.ts +1 -1
- package/cli/src/commands/generate:types.ts +1 -1
- package/cli/src/commands/girassol.ts +1 -1
- package/cli/src/extensions/cli-extension.ts +1 -1
- package/cli/src/templates/components/component.spec.ts.ejs +20 -0
- package/cli/src/templates/components/component.stories.mdx.ejs +74 -0
- package/cli/src/templates/components/component.vue.ejs +23 -0
- package/cli/src/templates/components/index.ts.ejs +10 -0
- package/dist/girassol.es.js +979 -131
- package/dist/girassol.umd.js +5 -5
- package/dist/style.css +1 -1
- package/dist/theme/solfacil/colors.d.ts +2 -2
- package/dist/theme/solfacil/index.d.ts +2 -0
- package/dist/theme/solfacil/utilities.d.ts +2 -0
- package/dist/types/components/dropdown/Dropdown.vue.d.ts +75 -0
- package/dist/types/components/dropdown/dropdown.spec.d.ts +1 -0
- package/dist/types/components/dropdown/index.d.ts +2 -0
- package/dist/types/components/forms/button/Button.vue.d.ts +4 -4
- package/dist/types/components/forms/checkbox/CheckboxGroup.vue.d.ts +1 -1
- package/dist/types/components/forms/checkbox/checkbox-type.d.ts +2 -2
- package/dist/types/components/forms/checkbox/index.d.ts +1 -1
- package/dist/types/components/forms/input/index.d.ts +1 -1
- package/dist/types/components/forms/radio/RadioGroup.vue.d.ts +1 -1
- package/dist/types/components/forms/radio/index.d.ts +1 -1
- package/dist/types/components/forms/radio/radio-type.d.ts +2 -2
- package/dist/types/components/forms/switch/index.d.ts +1 -1
- package/dist/types/components/forms/textarea/Textarea.vue.d.ts +50 -0
- package/dist/types/components/forms/textarea/index.d.ts +2 -0
- package/dist/types/components/forms/textarea/textarea.spec.d.ts +1 -0
- package/dist/types/components/forms/textfield/Textfield.vue.d.ts +1 -1
- package/dist/types/components/forms/textfield/index.d.ts +1 -1
- package/dist/types/composables/use-toast/Toast.vue.d.ts +66 -0
- package/dist/types/composables/use-toast/index.d.ts +9 -0
- package/dist/types/composables/use-toast/types.d.ts +23 -0
- package/dist/types/composables/use-toast/use-toast.spec.d.ts +1 -0
- package/dist/types/composables/use-toast/useTimer.d.ts +9 -0
- package/dist/types/composables/use-toast/useTransition.d.ts +57 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/vite.config.d.ts +1 -1
- package/package.json +62 -31
- package/theme/solfacil/borders.ts +2 -2
- package/theme/solfacil/colors.ts +4 -4
- package/theme/solfacil/effects.ts +3 -3
- package/theme/solfacil/index.ts +4 -2
- package/theme/solfacil/miscs.ts +2 -2
- package/theme/solfacil/spacing.ts +1 -1
- package/theme/solfacil/typography.ts +2 -2
- package/theme/solfacil/utilities.ts +71 -3
- package/vite.config.ts +17 -5
- package/windi.config.ts +5 -3
package/dist/girassol.es.js
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, toDisplayString, createCommentVNode, createVNode, mergeProps, isRef, ref, createBlock, withCtx, withDirectives, vShow, vModelText, Fragment, renderList, getCurrentScope, onScopeDispose, watch, withModifiers, withKeys, createTextVNode, reactive, onMounted, onUnmounted, Transition as Transition$1, normalizeStyle, render as render$7 } from "vue";
|
|
2
21
|
var Button_vue_vue_type_style_index_0_lang = "";
|
|
3
|
-
const _hoisted_1$
|
|
4
|
-
const _hoisted_2$
|
|
5
|
-
const _hoisted_3$
|
|
6
|
-
const _sfc_main$
|
|
22
|
+
const _hoisted_1$i = ["data-testid"];
|
|
23
|
+
const _hoisted_2$g = { class: "icon -left" };
|
|
24
|
+
const _hoisted_3$e = { class: "icon -right" };
|
|
25
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
7
26
|
props: {
|
|
8
27
|
variant: { default: "primary" },
|
|
9
28
|
dense: { type: Boolean, default: false },
|
|
@@ -27,23 +46,23 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
27
46
|
`]),
|
|
28
47
|
type: "button"
|
|
29
48
|
}, [
|
|
30
|
-
createElementVNode("div", _hoisted_2$
|
|
49
|
+
createElementVNode("div", _hoisted_2$g, [
|
|
31
50
|
renderSlot(_ctx.$slots, "icon-left")
|
|
32
51
|
]),
|
|
33
52
|
renderSlot(_ctx.$slots, "default"),
|
|
34
|
-
createElementVNode("div", _hoisted_3$
|
|
53
|
+
createElementVNode("div", _hoisted_3$e, [
|
|
35
54
|
renderSlot(_ctx.$slots, "icon-right")
|
|
36
55
|
])
|
|
37
|
-
], 10, _hoisted_1$
|
|
56
|
+
], 10, _hoisted_1$i);
|
|
38
57
|
};
|
|
39
58
|
}
|
|
40
59
|
});
|
|
41
|
-
_sfc_main$
|
|
42
|
-
app.component("SolButton", _sfc_main$
|
|
60
|
+
_sfc_main$b.install = (app) => {
|
|
61
|
+
app.component("SolButton", _sfc_main$b);
|
|
43
62
|
};
|
|
44
63
|
var Input_vue_vue_type_style_index_0_lang = "";
|
|
45
|
-
const _hoisted_1$
|
|
46
|
-
const _sfc_main$
|
|
64
|
+
const _hoisted_1$h = ["id", "data-testid", "value"];
|
|
65
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
47
66
|
props: {
|
|
48
67
|
id: null,
|
|
49
68
|
modelValue: null,
|
|
@@ -63,20 +82,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
63
82
|
value: __props.modelValue,
|
|
64
83
|
class: normalizeClass(["sol-input-core", { "-invert": __props.invert, "-error": __props.error }]),
|
|
65
84
|
onInput: emitInput
|
|
66
|
-
}, null, 42, _hoisted_1$
|
|
85
|
+
}, null, 42, _hoisted_1$h);
|
|
67
86
|
};
|
|
68
87
|
}
|
|
69
88
|
});
|
|
70
|
-
_sfc_main$
|
|
71
|
-
app.component("SolInput", _sfc_main$
|
|
89
|
+
_sfc_main$a.install = (app) => {
|
|
90
|
+
app.component("SolInput", _sfc_main$a);
|
|
72
91
|
};
|
|
73
92
|
var Textfield_vue_vue_type_style_index_0_lang = "";
|
|
74
|
-
const _hoisted_1$
|
|
75
|
-
const _hoisted_2$
|
|
76
|
-
const _hoisted_3$
|
|
77
|
-
const _hoisted_4$
|
|
78
|
-
const _hoisted_5 = ["id"];
|
|
79
|
-
const _sfc_main$
|
|
93
|
+
const _hoisted_1$g = ["id", "data-testid"];
|
|
94
|
+
const _hoisted_2$f = ["for"];
|
|
95
|
+
const _hoisted_3$d = { class: "container-input" };
|
|
96
|
+
const _hoisted_4$6 = ["id"];
|
|
97
|
+
const _hoisted_5$3 = ["id"];
|
|
98
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
80
99
|
props: {
|
|
81
100
|
id: null,
|
|
82
101
|
class: null,
|
|
@@ -106,11 +125,11 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
106
125
|
return null;
|
|
107
126
|
}
|
|
108
127
|
return (_ctx, _cache) => {
|
|
109
|
-
var
|
|
128
|
+
var _a2;
|
|
110
129
|
return openBlock(), createElementBlock("div", {
|
|
111
130
|
id: `textfield-${__props.id}`,
|
|
112
131
|
"data-testid": `textfield-${__props.id}`,
|
|
113
|
-
class: normalizeClass([[`${(
|
|
132
|
+
class: normalizeClass([[`${(_a2 = _ctx.$props.class) != null ? _a2 : ""}`, { "-invert": __props.invert }], "sol-textfield-core"])
|
|
114
133
|
}, [
|
|
115
134
|
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
116
135
|
__props.label ? (openBlock(), createElementBlock("label", {
|
|
@@ -119,20 +138,20 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
119
138
|
class: "label"
|
|
120
139
|
}, [
|
|
121
140
|
createElementVNode("span", null, toDisplayString(__props.label), 1)
|
|
122
|
-
], 8, _hoisted_2$
|
|
141
|
+
], 8, _hoisted_2$f)) : createCommentVNode("", true)
|
|
123
142
|
]),
|
|
124
|
-
createElementVNode("div", _hoisted_3$
|
|
143
|
+
createElementVNode("div", _hoisted_3$d, [
|
|
125
144
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
126
|
-
createVNode(_sfc_main$
|
|
145
|
+
createVNode(_sfc_main$a, mergeProps(_ctx.$attrs, {
|
|
146
|
+
id: __props.id,
|
|
127
147
|
modelValue: unref(model),
|
|
128
148
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
129
|
-
id: __props.id,
|
|
130
149
|
"data-testid": `input-${__props.id}`,
|
|
131
150
|
class: [__props.error && "-error", "input"],
|
|
132
151
|
invert: __props.invert,
|
|
133
152
|
"aria-invalid": !!__props.error,
|
|
134
153
|
"aria-describedby": ariaDescribedby(__props.hint, __props.error)
|
|
135
|
-
}), null, 16, ["
|
|
154
|
+
}), null, 16, ["id", "modelValue", "data-testid", "class", "invert", "aria-invalid", "aria-describedby"])
|
|
136
155
|
]),
|
|
137
156
|
renderSlot(_ctx.$slots, "icon")
|
|
138
157
|
]),
|
|
@@ -140,51 +159,51 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
140
159
|
key: 0,
|
|
141
160
|
id: `hint-${__props.id}`,
|
|
142
161
|
class: "hint"
|
|
143
|
-
}, toDisplayString(__props.hint), 9, _hoisted_4$
|
|
162
|
+
}, toDisplayString(__props.hint), 9, _hoisted_4$6)) : __props.error ? (openBlock(), createElementBlock("span", {
|
|
144
163
|
key: 1,
|
|
145
164
|
id: `error-${__props.id}`,
|
|
146
165
|
class: "error"
|
|
147
|
-
}, toDisplayString(__props.error), 9, _hoisted_5)) : createCommentVNode("", true)
|
|
148
|
-
], 10, _hoisted_1$
|
|
166
|
+
}, toDisplayString(__props.error), 9, _hoisted_5$3)) : createCommentVNode("", true)
|
|
167
|
+
], 10, _hoisted_1$g);
|
|
149
168
|
};
|
|
150
169
|
}
|
|
151
170
|
});
|
|
152
|
-
const _hoisted_1$
|
|
171
|
+
const _hoisted_1$f = {
|
|
153
172
|
preserveAspectRatio: "xMidYMid meet",
|
|
154
173
|
viewBox: "0 0 24 24",
|
|
155
174
|
width: "1.2em",
|
|
156
175
|
height: "1.2em"
|
|
157
176
|
};
|
|
158
|
-
const _hoisted_2$
|
|
177
|
+
const _hoisted_2$e = /* @__PURE__ */ createElementVNode("g", { fill: "currentColor" }, [
|
|
159
178
|
/* @__PURE__ */ createElementVNode("path", { d: "M15 12a3 3 0 1 1-6 0a3 3 0 0 1 6 0z" }),
|
|
160
179
|
/* @__PURE__ */ createElementVNode("path", { d: "M21.894 11.553C19.736 7.236 15.904 5 12 5c-3.903 0-7.736 2.236-9.894 6.553a1 1 0 0 0 0 .894C4.264 16.764 8.096 19 12 19c3.903 0 7.736-2.236 9.894-6.553a1 1 0 0 0 0-.894zM12 17c-2.969 0-6.002-1.62-7.87-5C5.998 8.62 9.03 7 12 7c2.969 0 6.002 1.62 7.87 5c-1.868 3.38-4.901 5-7.87 5z" })
|
|
161
180
|
], -1);
|
|
162
|
-
const _hoisted_3$
|
|
163
|
-
_hoisted_2$
|
|
181
|
+
const _hoisted_3$c = [
|
|
182
|
+
_hoisted_2$e
|
|
164
183
|
];
|
|
165
|
-
function render$
|
|
166
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
184
|
+
function render$6(_ctx, _cache) {
|
|
185
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$f, _hoisted_3$c);
|
|
167
186
|
}
|
|
168
|
-
var EyeOn = { name: "mi-eye", render: render$
|
|
169
|
-
const _hoisted_1$
|
|
187
|
+
var EyeOn = { name: "mi-eye", render: render$6 };
|
|
188
|
+
const _hoisted_1$e = {
|
|
170
189
|
preserveAspectRatio: "xMidYMid meet",
|
|
171
190
|
viewBox: "0 0 24 24",
|
|
172
191
|
width: "1.2em",
|
|
173
192
|
height: "1.2em"
|
|
174
193
|
};
|
|
175
|
-
const _hoisted_2$
|
|
194
|
+
const _hoisted_2$d = /* @__PURE__ */ createElementVNode("path", {
|
|
176
195
|
fill: "currentColor",
|
|
177
196
|
d: "M4.707 3.293a1 1 0 0 0-1.414 1.414l2.424 2.424c-1.43 1.076-2.678 2.554-3.611 4.422a1 1 0 0 0 0 .894C4.264 16.764 8.096 19 12 19c1.555 0 3.1-.355 4.53-1.055l2.763 2.762a1 1 0 0 0 1.414-1.414l-16-16zm10.307 13.135c-.98.383-2 .572-3.014.572c-2.969 0-6.002-1.62-7.87-5c.817-1.479 1.858-2.62 3.018-3.437l2.144 2.144a3 3 0 0 0 4.001 4.001l1.72 1.72zm3.538-2.532c.483-.556.926-1.187 1.318-1.896c-1.868-3.38-4.9-5-7.87-5c-.112 0-.224.002-.336.007L9.879 5.223A10.215 10.215 0 0 1 12 5c3.903 0 7.736 2.236 9.894 6.553a1 1 0 0 1 0 .894a13.106 13.106 0 0 1-1.925 2.865l-1.417-1.416z"
|
|
178
197
|
}, null, -1);
|
|
179
|
-
const _hoisted_3$
|
|
180
|
-
_hoisted_2$
|
|
198
|
+
const _hoisted_3$b = [
|
|
199
|
+
_hoisted_2$d
|
|
181
200
|
];
|
|
182
|
-
function render(_ctx, _cache) {
|
|
183
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
201
|
+
function render$5(_ctx, _cache) {
|
|
202
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$e, _hoisted_3$b);
|
|
184
203
|
}
|
|
185
|
-
var EyeOff = { name: "mi-eye-off", render };
|
|
186
|
-
const _hoisted_1$
|
|
187
|
-
const _sfc_main$
|
|
204
|
+
var EyeOff = { name: "mi-eye-off", render: render$5 };
|
|
205
|
+
const _hoisted_1$d = ["aria-label"];
|
|
206
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
188
207
|
props: {
|
|
189
208
|
id: { default: "" },
|
|
190
209
|
label: { default: "Sua senha" }
|
|
@@ -193,7 +212,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
193
212
|
const passwordIsVisible = ref(false);
|
|
194
213
|
const inputType = computed(() => passwordIsVisible.value ? "text" : "password");
|
|
195
214
|
return (_ctx, _cache) => {
|
|
196
|
-
return openBlock(), createBlock(_sfc_main$
|
|
215
|
+
return openBlock(), createBlock(_sfc_main$9, {
|
|
197
216
|
id: __props.id,
|
|
198
217
|
required: "",
|
|
199
218
|
type: unref(inputType),
|
|
@@ -213,23 +232,108 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
213
232
|
withDirectives(createVNode(unref(EyeOff), { "aria-hidden": "true" }, null, 512), [
|
|
214
233
|
[vShow, !passwordIsVisible.value]
|
|
215
234
|
])
|
|
216
|
-
], 8, _hoisted_1$
|
|
235
|
+
], 8, _hoisted_1$d)
|
|
217
236
|
]),
|
|
218
237
|
_: 1
|
|
219
238
|
}, 8, ["id", "type", "label"]);
|
|
220
239
|
};
|
|
221
240
|
}
|
|
222
241
|
});
|
|
223
|
-
_sfc_main$
|
|
224
|
-
app.component("SolTextfield", _sfc_main$
|
|
242
|
+
_sfc_main$9.install = (app) => {
|
|
243
|
+
app.component("SolTextfield", _sfc_main$9);
|
|
225
244
|
};
|
|
226
|
-
_sfc_main$
|
|
227
|
-
app.component("SolTextfieldPassword", _sfc_main$
|
|
245
|
+
_sfc_main$8.install = (app) => {
|
|
246
|
+
app.component("SolTextfieldPassword", _sfc_main$8);
|
|
247
|
+
};
|
|
248
|
+
var Textarea_vue_vue_type_style_index_0_lang = "";
|
|
249
|
+
const _hoisted_1$c = ["id", "data-testid"];
|
|
250
|
+
const _hoisted_2$c = ["for"];
|
|
251
|
+
const _hoisted_3$a = { class: "container-textarea" };
|
|
252
|
+
const _hoisted_4$5 = ["id", "data-testid", "invert", "aria-invalid", "aria-describedby"];
|
|
253
|
+
const _hoisted_5$2 = ["id"];
|
|
254
|
+
const _hoisted_6$2 = ["id"];
|
|
255
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
256
|
+
props: {
|
|
257
|
+
id: null,
|
|
258
|
+
class: null,
|
|
259
|
+
modelValue: { default: "" },
|
|
260
|
+
label: { default: "label" },
|
|
261
|
+
hint: null,
|
|
262
|
+
invert: { type: Boolean },
|
|
263
|
+
resize: { default: "both" },
|
|
264
|
+
error: null
|
|
265
|
+
},
|
|
266
|
+
emits: ["update:modelValue"],
|
|
267
|
+
setup(__props, { emit }) {
|
|
268
|
+
const props = __props;
|
|
269
|
+
const model = computed({
|
|
270
|
+
get: () => props.modelValue,
|
|
271
|
+
set: (inputValue) => {
|
|
272
|
+
emit("update:modelValue", inputValue);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
function showHint(hint, error) {
|
|
276
|
+
return !!hint && !error;
|
|
277
|
+
}
|
|
278
|
+
function ariaDescribedby(hint, error) {
|
|
279
|
+
if (error)
|
|
280
|
+
return `error-${props.id}`;
|
|
281
|
+
if (showHint(hint, error))
|
|
282
|
+
return `hint-${props.id}`;
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
return (_ctx, _cache) => {
|
|
286
|
+
var _a2;
|
|
287
|
+
return openBlock(), createElementBlock("div", {
|
|
288
|
+
id: `textarea-${__props.id}`,
|
|
289
|
+
"data-testid": `textarea-${__props.id}`,
|
|
290
|
+
class: normalizeClass([[`${(_a2 = _ctx.$props.class) != null ? _a2 : ""}`, { "-invert": __props.invert }], "sol-textarea-core"])
|
|
291
|
+
}, [
|
|
292
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
293
|
+
__props.label ? (openBlock(), createElementBlock("label", {
|
|
294
|
+
key: 0,
|
|
295
|
+
for: `input-${__props.id}`,
|
|
296
|
+
class: "label"
|
|
297
|
+
}, [
|
|
298
|
+
createElementVNode("span", null, toDisplayString(__props.label), 1)
|
|
299
|
+
], 8, _hoisted_2$c)) : createCommentVNode("", true)
|
|
300
|
+
]),
|
|
301
|
+
createElementVNode("div", _hoisted_3$a, [
|
|
302
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
303
|
+
withDirectives(createElementVNode("textarea", mergeProps(_ctx.$attrs, {
|
|
304
|
+
id: `input-${__props.id}`,
|
|
305
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
306
|
+
"data-testid": `input-${__props.id}`,
|
|
307
|
+
class: [__props.error && "-error", "textarea"],
|
|
308
|
+
invert: __props.invert,
|
|
309
|
+
style: { resize: __props.resize },
|
|
310
|
+
"aria-invalid": !!__props.error,
|
|
311
|
+
"aria-describedby": ariaDescribedby(__props.hint, __props.error)
|
|
312
|
+
}), null, 16, _hoisted_4$5), [
|
|
313
|
+
[vModelText, unref(model)]
|
|
314
|
+
])
|
|
315
|
+
])
|
|
316
|
+
]),
|
|
317
|
+
showHint(__props.hint, __props.error) ? (openBlock(), createElementBlock("span", {
|
|
318
|
+
key: 0,
|
|
319
|
+
id: `hint-${__props.id}`,
|
|
320
|
+
class: "hint"
|
|
321
|
+
}, toDisplayString(__props.hint), 9, _hoisted_5$2)) : __props.error ? (openBlock(), createElementBlock("span", {
|
|
322
|
+
key: 1,
|
|
323
|
+
id: `error-${__props.id}`,
|
|
324
|
+
class: "error"
|
|
325
|
+
}, toDisplayString(__props.error), 9, _hoisted_6$2)) : createCommentVNode("", true)
|
|
326
|
+
], 10, _hoisted_1$c);
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
_sfc_main$7.install = (app) => {
|
|
331
|
+
app.component("SolTextarea", _sfc_main$7);
|
|
228
332
|
};
|
|
229
333
|
var Radio_vue_vue_type_style_index_0_lang = "";
|
|
230
|
-
const _hoisted_1$
|
|
231
|
-
const _hoisted_2$
|
|
232
|
-
const _sfc_main$
|
|
334
|
+
const _hoisted_1$b = ["id", "data-testid", "checked", "value", "name"];
|
|
335
|
+
const _hoisted_2$b = ["for"];
|
|
336
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
233
337
|
props: {
|
|
234
338
|
id: null,
|
|
235
339
|
name: null,
|
|
@@ -242,32 +346,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
242
346
|
setup(__props, { emit }) {
|
|
243
347
|
return (_ctx, _cache) => {
|
|
244
348
|
return openBlock(), createElementBlock("div", {
|
|
245
|
-
class: normalizeClass(["sol-radio-core",
|
|
349
|
+
class: normalizeClass(["sol-radio-core", _ctx.$props.class])
|
|
246
350
|
}, [
|
|
247
351
|
createElementVNode("input", mergeProps(_ctx.$attrs, {
|
|
352
|
+
id: `radio-${__props.name}-${__props.id}`,
|
|
248
353
|
type: "radio",
|
|
249
354
|
class: "radio",
|
|
250
|
-
id: `radio-${__props.name}-${__props.id}`,
|
|
251
355
|
"data-testid": `radio-${__props.name}-${__props.id}`,
|
|
252
356
|
checked: __props.checked,
|
|
253
357
|
value: __props.value,
|
|
254
358
|
name: __props.name,
|
|
255
359
|
onChange: _cache[0] || (_cache[0] = ($event) => emit("change", __props.value))
|
|
256
|
-
}), null, 16, _hoisted_1$
|
|
360
|
+
}), null, 16, _hoisted_1$b),
|
|
257
361
|
createElementVNode("label", {
|
|
258
362
|
class: "label",
|
|
259
363
|
for: `radio-${__props.name}-${__props.id}`
|
|
260
|
-
}, toDisplayString(__props.label), 9, _hoisted_2$
|
|
364
|
+
}, toDisplayString(__props.label), 9, _hoisted_2$b)
|
|
261
365
|
], 2);
|
|
262
366
|
};
|
|
263
367
|
}
|
|
264
368
|
});
|
|
265
369
|
var RadioGroup_vue_vue_type_style_index_0_lang = "";
|
|
266
|
-
const _hoisted_1$
|
|
267
|
-
const _hoisted_2$
|
|
268
|
-
const _hoisted_3$
|
|
269
|
-
const _hoisted_4$
|
|
270
|
-
const _sfc_main$
|
|
370
|
+
const _hoisted_1$a = ["aria-labelledby"];
|
|
371
|
+
const _hoisted_2$a = ["id", "data-testid"];
|
|
372
|
+
const _hoisted_3$9 = ["id"];
|
|
373
|
+
const _hoisted_4$4 = ["id"];
|
|
374
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
271
375
|
props: {
|
|
272
376
|
id: null,
|
|
273
377
|
title: null,
|
|
@@ -307,10 +411,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
307
411
|
id: `radio-group-title-${__props.id}`
|
|
308
412
|
}, () => [
|
|
309
413
|
createElementVNode("legend", {
|
|
310
|
-
class: normalizeClass(["title", { "sr-only": __props.hideTitle }]),
|
|
311
414
|
id: `radio-group-title-${__props.id}`,
|
|
415
|
+
class: normalizeClass(["title", { "sr-only": __props.hideTitle }]),
|
|
312
416
|
"data-testid": `radio-group-title-${__props.id}`
|
|
313
|
-
}, toDisplayString(__props.title), 11, _hoisted_2$
|
|
417
|
+
}, toDisplayString(__props.title), 11, _hoisted_2$a)
|
|
314
418
|
]),
|
|
315
419
|
createElementVNode("ul", {
|
|
316
420
|
class: normalizeClass(["container-radios", { "flex-col": __props.direction === "column" }])
|
|
@@ -320,11 +424,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
320
424
|
direction: __props.direction
|
|
321
425
|
}, () => [
|
|
322
426
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.radios, (radio, index) => {
|
|
323
|
-
var
|
|
427
|
+
var _a2;
|
|
324
428
|
return openBlock(), createElementBlock("li", { key: index }, [
|
|
325
|
-
createVNode(_sfc_main$
|
|
429
|
+
createVNode(_sfc_main$6, mergeProps(_ctx.$attrs, {
|
|
430
|
+
id: (_a2 = radio == null ? void 0 : radio.id) != null ? _a2 : `${radio.value}`,
|
|
326
431
|
class: ["radio", { "mb-micro": __props.direction === "column", "mr-micro": __props.direction === "row" }],
|
|
327
|
-
id: (_a = radio == null ? void 0 : radio.id) != null ? _a : `${radio.value}`,
|
|
328
432
|
name: radio.name,
|
|
329
433
|
value: radio.value,
|
|
330
434
|
label: radio.label,
|
|
@@ -332,7 +436,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
332
436
|
"aria-invalid": !!__props.error,
|
|
333
437
|
"aria-describedby": ariaDescribedby(__props.hint, __props.error),
|
|
334
438
|
onChange: ($event) => emitUpdatedValue(radio)
|
|
335
|
-
}), null, 16, ["
|
|
439
|
+
}), null, 16, ["id", "class", "name", "value", "label", "checked", "aria-invalid", "aria-describedby", "onChange"])
|
|
336
440
|
]);
|
|
337
441
|
}), 128))
|
|
338
442
|
])
|
|
@@ -341,25 +445,25 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
341
445
|
key: 0,
|
|
342
446
|
id: `hint-${__props.id}`,
|
|
343
447
|
class: "hint"
|
|
344
|
-
}, toDisplayString(__props.hint), 9, _hoisted_3$
|
|
448
|
+
}, toDisplayString(__props.hint), 9, _hoisted_3$9)) : __props.error ? (openBlock(), createElementBlock("p", {
|
|
345
449
|
key: 1,
|
|
346
450
|
id: `error-${__props.id}`,
|
|
347
451
|
class: "error"
|
|
348
|
-
}, toDisplayString(__props.error), 9, _hoisted_4$
|
|
349
|
-
], 8, _hoisted_1$
|
|
452
|
+
}, toDisplayString(__props.error), 9, _hoisted_4$4)) : createCommentVNode("", true)
|
|
453
|
+
], 8, _hoisted_1$a);
|
|
350
454
|
};
|
|
351
455
|
}
|
|
352
456
|
});
|
|
353
|
-
_sfc_main$
|
|
354
|
-
app.component("SolRadio", _sfc_main$
|
|
457
|
+
_sfc_main$6.install = (app) => {
|
|
458
|
+
app.component("SolRadio", _sfc_main$6);
|
|
355
459
|
};
|
|
356
|
-
_sfc_main$
|
|
357
|
-
app.component("SolRadioGroup", _sfc_main$
|
|
460
|
+
_sfc_main$5.install = (app) => {
|
|
461
|
+
app.component("SolRadioGroup", _sfc_main$5);
|
|
358
462
|
};
|
|
359
463
|
var Checkbox_vue_vue_type_style_index_0_lang = "";
|
|
360
|
-
const _hoisted_1$
|
|
361
|
-
const _hoisted_2$
|
|
362
|
-
const _sfc_main$
|
|
464
|
+
const _hoisted_1$9 = ["id", "data-testid", "checked", "value", "name"];
|
|
465
|
+
const _hoisted_2$9 = ["for"];
|
|
466
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
363
467
|
props: {
|
|
364
468
|
id: null,
|
|
365
469
|
name: null,
|
|
@@ -372,32 +476,32 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
372
476
|
setup(__props, { emit }) {
|
|
373
477
|
return (_ctx, _cache) => {
|
|
374
478
|
return openBlock(), createElementBlock("div", {
|
|
375
|
-
class: normalizeClass(["sol-checkbox-core",
|
|
479
|
+
class: normalizeClass(["sol-checkbox-core", _ctx.$props.class])
|
|
376
480
|
}, [
|
|
377
481
|
createElementVNode("input", mergeProps(_ctx.$attrs, {
|
|
482
|
+
id: `checkbox-${__props.name}-${__props.id}`,
|
|
378
483
|
type: "checkbox",
|
|
379
484
|
class: "checkbox",
|
|
380
|
-
id: `checkbox-${__props.name}-${__props.id}`,
|
|
381
485
|
"data-testid": `checkbox-${__props.name}-${__props.id}`,
|
|
382
486
|
checked: __props.checked,
|
|
383
487
|
value: __props.value,
|
|
384
488
|
name: __props.name,
|
|
385
489
|
onChange: _cache[0] || (_cache[0] = ($event) => emit("change", __props.value))
|
|
386
|
-
}), null, 16, _hoisted_1$
|
|
490
|
+
}), null, 16, _hoisted_1$9),
|
|
387
491
|
createElementVNode("label", {
|
|
388
492
|
class: "label",
|
|
389
493
|
for: `checkbox-${__props.name}-${__props.id}`
|
|
390
|
-
}, toDisplayString(__props.label), 9, _hoisted_2$
|
|
494
|
+
}, toDisplayString(__props.label), 9, _hoisted_2$9)
|
|
391
495
|
], 2);
|
|
392
496
|
};
|
|
393
497
|
}
|
|
394
498
|
});
|
|
395
499
|
var CheckboxGroup_vue_vue_type_style_index_0_lang = "";
|
|
396
|
-
const _hoisted_1$
|
|
397
|
-
const _hoisted_2$
|
|
398
|
-
const _hoisted_3$
|
|
399
|
-
const _hoisted_4$
|
|
400
|
-
const _sfc_main$
|
|
500
|
+
const _hoisted_1$8 = ["aria-labelledby"];
|
|
501
|
+
const _hoisted_2$8 = ["id", "data-testid"];
|
|
502
|
+
const _hoisted_3$8 = ["id"];
|
|
503
|
+
const _hoisted_4$3 = ["id"];
|
|
504
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
401
505
|
props: {
|
|
402
506
|
id: null,
|
|
403
507
|
title: null,
|
|
@@ -422,21 +526,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
422
526
|
return null;
|
|
423
527
|
}
|
|
424
528
|
function isChecked(value) {
|
|
425
|
-
var
|
|
426
|
-
return (
|
|
529
|
+
var _a2;
|
|
530
|
+
return (_a2 = props == null ? void 0 : props.modelValue) == null ? void 0 : _a2.includes(value);
|
|
427
531
|
}
|
|
428
532
|
function sanitizeNewModelValue(value) {
|
|
429
533
|
return Array.isArray(props == null ? void 0 : props.modelValue) ? [...props.modelValue, value] : [value];
|
|
430
534
|
}
|
|
431
535
|
function emitUpdatedValue(checkbox) {
|
|
432
|
-
var
|
|
536
|
+
var _a2;
|
|
433
537
|
emit("change", checkbox.value);
|
|
434
|
-
const checked = isChecked(checkbox.value) ? (
|
|
538
|
+
const checked = isChecked(checkbox.value) ? (_a2 = props.modelValue) == null ? void 0 : _a2.filter((value) => value !== checkbox.value) : sanitizeNewModelValue(checkbox.value);
|
|
435
539
|
emit("update:modelValue", checked);
|
|
436
540
|
}
|
|
437
541
|
return (_ctx, _cache) => {
|
|
438
542
|
return openBlock(), createElementBlock("fieldset", {
|
|
439
|
-
role: "group",
|
|
440
543
|
class: "sol-checkbox-group-core",
|
|
441
544
|
"aria-labelledby": `checkbox-group-title-${__props.id}`
|
|
442
545
|
}, [
|
|
@@ -444,10 +547,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
444
547
|
id: `checkbox-group-title-${__props.id}`
|
|
445
548
|
}, () => [
|
|
446
549
|
createElementVNode("legend", {
|
|
447
|
-
class: normalizeClass(["title", { "sr-only": __props.hideTitle }]),
|
|
448
550
|
id: `checkbox-group-title-${__props.id}`,
|
|
551
|
+
class: normalizeClass(["title", { "sr-only": __props.hideTitle }]),
|
|
449
552
|
"data-testid": `checkbox-group-title-${__props.id}`
|
|
450
|
-
}, toDisplayString(__props.title), 11, _hoisted_2$
|
|
553
|
+
}, toDisplayString(__props.title), 11, _hoisted_2$8)
|
|
451
554
|
]),
|
|
452
555
|
createElementVNode("ul", {
|
|
453
556
|
class: normalizeClass(["container-checkboxes", { "flex-col": __props.direction === "column" }])
|
|
@@ -457,11 +560,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
457
560
|
direction: __props.direction
|
|
458
561
|
}, () => [
|
|
459
562
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.checkboxes, (checkbox, index) => {
|
|
460
|
-
var
|
|
563
|
+
var _a2;
|
|
461
564
|
return openBlock(), createElementBlock("li", { key: index }, [
|
|
462
|
-
createVNode(_sfc_main$
|
|
565
|
+
createVNode(_sfc_main$4, mergeProps(_ctx.$attrs, {
|
|
566
|
+
id: (_a2 = checkbox == null ? void 0 : checkbox.id) != null ? _a2 : `${checkbox.value}`,
|
|
463
567
|
class: ["checkbox", { "mb-micro": __props.direction === "column", "mr-micro": __props.direction === "row" }],
|
|
464
|
-
id: (_a = checkbox == null ? void 0 : checkbox.id) != null ? _a : `${checkbox.value}`,
|
|
465
568
|
label: checkbox.label,
|
|
466
569
|
name: checkbox.name,
|
|
467
570
|
value: checkbox.value,
|
|
@@ -469,7 +572,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
469
572
|
"aria-invalid": !!__props.error,
|
|
470
573
|
"aria-describedby": ariaDescribedby(__props.hint, __props.error),
|
|
471
574
|
onChange: ($event) => emitUpdatedValue(checkbox)
|
|
472
|
-
}), null, 16, ["
|
|
575
|
+
}), null, 16, ["id", "class", "label", "name", "value", "checked", "aria-invalid", "aria-describedby", "onChange"])
|
|
473
576
|
]);
|
|
474
577
|
}), 128))
|
|
475
578
|
])
|
|
@@ -478,27 +581,27 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
478
581
|
key: 0,
|
|
479
582
|
id: `hint-${__props.id}`,
|
|
480
583
|
class: "hint"
|
|
481
|
-
}, toDisplayString(__props.hint), 9, _hoisted_3$
|
|
584
|
+
}, toDisplayString(__props.hint), 9, _hoisted_3$8)) : __props.error ? (openBlock(), createElementBlock("p", {
|
|
482
585
|
key: 1,
|
|
483
586
|
id: `error-${__props.id}`,
|
|
484
587
|
class: "error"
|
|
485
|
-
}, toDisplayString(__props.error), 9, _hoisted_4$
|
|
486
|
-
], 8, _hoisted_1$
|
|
588
|
+
}, toDisplayString(__props.error), 9, _hoisted_4$3)) : createCommentVNode("", true)
|
|
589
|
+
], 8, _hoisted_1$8);
|
|
487
590
|
};
|
|
488
591
|
}
|
|
489
592
|
});
|
|
490
|
-
_sfc_main$
|
|
491
|
-
app.component("SolCheckbox", _sfc_main$
|
|
593
|
+
_sfc_main$4.install = (app) => {
|
|
594
|
+
app.component("SolCheckbox", _sfc_main$4);
|
|
492
595
|
};
|
|
493
|
-
_sfc_main$
|
|
494
|
-
app.component("SolCheckboxGroup", _sfc_main$
|
|
596
|
+
_sfc_main$3.install = (app) => {
|
|
597
|
+
app.component("SolCheckboxGroup", _sfc_main$3);
|
|
495
598
|
};
|
|
496
599
|
var Switch_vue_vue_type_style_index_0_lang = "";
|
|
497
|
-
const _hoisted_1 = ["
|
|
498
|
-
const _hoisted_2 = { class: "switch-container" };
|
|
499
|
-
const _hoisted_3 = ["id", "aria-labelledby", "data-testid", "checked", "value", "name"];
|
|
500
|
-
const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "ellipse" }, null, -1);
|
|
501
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
600
|
+
const _hoisted_1$7 = ["id", "for", "data-testid"];
|
|
601
|
+
const _hoisted_2$7 = { class: "switch-container" };
|
|
602
|
+
const _hoisted_3$7 = ["id", "aria-checked", "aria-labelledby", "data-testid", "checked", "value", "name"];
|
|
603
|
+
const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("span", { class: "ellipse" }, null, -1);
|
|
604
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
502
605
|
props: {
|
|
503
606
|
id: null,
|
|
504
607
|
name: null,
|
|
@@ -516,48 +619,793 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
516
619
|
class: normalizeClass(["sol-switch-core", [_ctx.$props.class, { "-horizontal": __props.horizontalLabel }]])
|
|
517
620
|
}, [
|
|
518
621
|
createElementVNode("label", {
|
|
622
|
+
id: `switch-label-${__props.name}-${__props.id}`,
|
|
519
623
|
class: normalizeClass(["label", { "mb-1": !__props.horizontalLabel, "sr-only": __props.hideLabel }]),
|
|
520
624
|
for: `switch-${__props.name}-${__props.id}`,
|
|
521
|
-
id: `switch-label-${__props.name}-${__props.id}`,
|
|
522
625
|
"data-testid": `switch-label-${__props.name}-${__props.id}`
|
|
523
|
-
}, toDisplayString(__props.label), 11, _hoisted_1),
|
|
524
|
-
createElementVNode("div", _hoisted_2, [
|
|
626
|
+
}, toDisplayString(__props.label), 11, _hoisted_1$7),
|
|
627
|
+
createElementVNode("div", _hoisted_2$7, [
|
|
525
628
|
createElementVNode("input", mergeProps(_ctx.$attrs, {
|
|
629
|
+
id: `switch-${__props.name}-${__props.id}`,
|
|
526
630
|
type: "checkbox",
|
|
527
631
|
class: "switch",
|
|
528
632
|
role: "switch",
|
|
529
|
-
|
|
633
|
+
"aria-checked": __props.checked,
|
|
530
634
|
"aria-labelledby": `switch-label-${__props.name}-${__props.id}`,
|
|
531
635
|
"data-testid": `switch-${__props.name}-${__props.id}`,
|
|
532
636
|
checked: __props.checked,
|
|
533
637
|
value: __props.value,
|
|
534
638
|
name: __props.name,
|
|
535
639
|
onChange: _cache[0] || (_cache[0] = ($event) => emit("change", __props.value))
|
|
536
|
-
}), null, 16, _hoisted_3),
|
|
537
|
-
_hoisted_4
|
|
640
|
+
}), null, 16, _hoisted_3$7),
|
|
641
|
+
_hoisted_4$2
|
|
538
642
|
])
|
|
539
643
|
], 2);
|
|
540
644
|
};
|
|
541
645
|
}
|
|
542
646
|
});
|
|
543
|
-
_sfc_main.install = (app) => {
|
|
544
|
-
app.component("SolSwitch", _sfc_main);
|
|
647
|
+
_sfc_main$2.install = (app) => {
|
|
648
|
+
app.component("SolSwitch", _sfc_main$2);
|
|
649
|
+
};
|
|
650
|
+
function tryOnScopeDispose(fn) {
|
|
651
|
+
if (getCurrentScope()) {
|
|
652
|
+
onScopeDispose(fn);
|
|
653
|
+
return true;
|
|
654
|
+
}
|
|
655
|
+
return false;
|
|
656
|
+
}
|
|
657
|
+
const isClient = typeof window !== "undefined";
|
|
658
|
+
const isString = (val) => typeof val === "string";
|
|
659
|
+
const noop = () => {
|
|
660
|
+
};
|
|
661
|
+
function unrefElement(elRef) {
|
|
662
|
+
var _a2;
|
|
663
|
+
const plain = unref(elRef);
|
|
664
|
+
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
|
|
665
|
+
}
|
|
666
|
+
const defaultWindow = isClient ? window : void 0;
|
|
667
|
+
isClient ? window.document : void 0;
|
|
668
|
+
isClient ? window.navigator : void 0;
|
|
669
|
+
isClient ? window.location : void 0;
|
|
670
|
+
function useEventListener(...args) {
|
|
671
|
+
let target;
|
|
672
|
+
let event;
|
|
673
|
+
let listener;
|
|
674
|
+
let options;
|
|
675
|
+
if (isString(args[0])) {
|
|
676
|
+
[event, listener, options] = args;
|
|
677
|
+
target = defaultWindow;
|
|
678
|
+
} else {
|
|
679
|
+
[target, event, listener, options] = args;
|
|
680
|
+
}
|
|
681
|
+
if (!target)
|
|
682
|
+
return noop;
|
|
683
|
+
let cleanup = noop;
|
|
684
|
+
const stopWatch = watch(() => unrefElement(target), (el) => {
|
|
685
|
+
cleanup();
|
|
686
|
+
if (!el)
|
|
687
|
+
return;
|
|
688
|
+
el.addEventListener(event, listener, options);
|
|
689
|
+
cleanup = () => {
|
|
690
|
+
el.removeEventListener(event, listener, options);
|
|
691
|
+
cleanup = noop;
|
|
692
|
+
};
|
|
693
|
+
}, { immediate: true, flush: "post" });
|
|
694
|
+
const stop = () => {
|
|
695
|
+
stopWatch();
|
|
696
|
+
cleanup();
|
|
697
|
+
};
|
|
698
|
+
tryOnScopeDispose(stop);
|
|
699
|
+
return stop;
|
|
700
|
+
}
|
|
701
|
+
function onClickOutside(target, handler, options = {}) {
|
|
702
|
+
const { window: window2 = defaultWindow, ignore, capture = true } = options;
|
|
703
|
+
if (!window2)
|
|
704
|
+
return;
|
|
705
|
+
const shouldListen = ref(true);
|
|
706
|
+
const listener = (event) => {
|
|
707
|
+
const el = unrefElement(target);
|
|
708
|
+
const composedPath = event.composedPath();
|
|
709
|
+
if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
|
|
710
|
+
return;
|
|
711
|
+
if (ignore && ignore.length > 0) {
|
|
712
|
+
if (ignore.some((target2) => {
|
|
713
|
+
const el2 = unrefElement(target2);
|
|
714
|
+
return el2 && (event.target === el2 || composedPath.includes(el2));
|
|
715
|
+
}))
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
handler(event);
|
|
719
|
+
};
|
|
720
|
+
const cleanup = [
|
|
721
|
+
useEventListener(window2, "click", listener, { passive: true, capture }),
|
|
722
|
+
useEventListener(window2, "pointerdown", (e) => {
|
|
723
|
+
const el = unrefElement(target);
|
|
724
|
+
shouldListen.value = !!el && !e.composedPath().includes(el);
|
|
725
|
+
}, { passive: true })
|
|
726
|
+
];
|
|
727
|
+
const stop = () => cleanup.forEach((fn) => fn());
|
|
728
|
+
return stop;
|
|
729
|
+
}
|
|
730
|
+
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
731
|
+
const globalKey = "__vueuse_ssr_handlers__";
|
|
732
|
+
_global[globalKey] = _global[globalKey] || {};
|
|
733
|
+
_global[globalKey];
|
|
734
|
+
var _a, _b;
|
|
735
|
+
isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
|
|
736
|
+
const _hoisted_1$6 = {
|
|
737
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
738
|
+
viewBox: "0 0 24 24",
|
|
739
|
+
width: "1.2em",
|
|
740
|
+
height: "1.2em"
|
|
741
|
+
};
|
|
742
|
+
const _hoisted_2$6 = /* @__PURE__ */ createElementVNode("path", {
|
|
743
|
+
fill: "currentColor",
|
|
744
|
+
d: "M10 4a6 6 0 1 0 0 12a6 6 0 0 0 0-12zm-8 6a8 8 0 1 1 14.32 4.906l5.387 5.387a1 1 0 0 1-1.414 1.414l-5.387-5.387A8 8 0 0 1 2 10z"
|
|
745
|
+
}, null, -1);
|
|
746
|
+
const _hoisted_3$6 = [
|
|
747
|
+
_hoisted_2$6
|
|
748
|
+
];
|
|
749
|
+
function render$4(_ctx, _cache) {
|
|
750
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$6, _hoisted_3$6);
|
|
751
|
+
}
|
|
752
|
+
var IconSearch = { name: "mi-search", render: render$4 };
|
|
753
|
+
var Dropdown_vue_vue_type_style_index_0_lang = "";
|
|
754
|
+
const _hoisted_1$5 = ["data-testid"];
|
|
755
|
+
const _hoisted_2$5 = ["id", "disabled", "data-testid", "aria-expanded", "aria-controls", "aria-activedescendant", "onClick", "onKeyup"];
|
|
756
|
+
const _hoisted_3$5 = { class: "dropdown-container" };
|
|
757
|
+
const _hoisted_4$1 = ["id", "data-testid", "aria-labelledby"];
|
|
758
|
+
const _hoisted_5$1 = ["id", "data-testid", "selected", "aria-selected", "onClick", "onKeyup"];
|
|
759
|
+
const _hoisted_6$1 = {
|
|
760
|
+
key: 0,
|
|
761
|
+
class: "no-data"
|
|
762
|
+
};
|
|
763
|
+
const _hoisted_7 = /* @__PURE__ */ createTextVNode(" Sem dados ");
|
|
764
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
765
|
+
props: {
|
|
766
|
+
id: null,
|
|
767
|
+
disabled: { type: Boolean },
|
|
768
|
+
loading: { type: Boolean, default: false },
|
|
769
|
+
searchable: { type: Boolean, default: false },
|
|
770
|
+
closeOnSelect: { type: Boolean, default: true },
|
|
771
|
+
fetchOnSearch: { type: Boolean, default: false },
|
|
772
|
+
isMultipleSelect: { type: Boolean },
|
|
773
|
+
searchPlaceholder: null,
|
|
774
|
+
selected: null,
|
|
775
|
+
options: { default: () => [] }
|
|
776
|
+
},
|
|
777
|
+
emits: ["closeDropdown", "search", "update:selected"],
|
|
778
|
+
setup(__props, { emit }) {
|
|
779
|
+
const props = __props;
|
|
780
|
+
const el = ref();
|
|
781
|
+
const isDropdownOpen = ref(false);
|
|
782
|
+
const elementFocus = ref("");
|
|
783
|
+
const filter = ref("");
|
|
784
|
+
const filtered = computed(() => {
|
|
785
|
+
var _a2;
|
|
786
|
+
return props.fetchOnSearch ? props.options : (_a2 = props.options) == null ? void 0 : _a2.filter((option) => typeof option === "string" ? option.includes(filter.value) : option.name.includes(filter.value));
|
|
787
|
+
});
|
|
788
|
+
const selectedSanitize = computed(() => Array.isArray(props.selected) ? props.selected.join(", ").trim() : props.selected);
|
|
789
|
+
onClickOutside(el, () => {
|
|
790
|
+
if (isDropdownOpen.value)
|
|
791
|
+
close2();
|
|
792
|
+
});
|
|
793
|
+
function toggleDropdown() {
|
|
794
|
+
if (!props.disabled) {
|
|
795
|
+
isDropdownOpen.value ? close2() : open();
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
function open() {
|
|
799
|
+
isDropdownOpen.value = true;
|
|
800
|
+
}
|
|
801
|
+
function close2() {
|
|
802
|
+
resetStates();
|
|
803
|
+
emit("closeDropdown");
|
|
804
|
+
}
|
|
805
|
+
function sanitizeMultipleSelection(selectedValue) {
|
|
806
|
+
const selected = new Set(props.selected);
|
|
807
|
+
selected.has(selectedValue) ? selected.delete(selectedValue) : selected.add(selectedValue);
|
|
808
|
+
return [...selected];
|
|
809
|
+
}
|
|
810
|
+
function select(selected) {
|
|
811
|
+
const value = typeof selected === "string" ? selected : selected.value;
|
|
812
|
+
const sanitize = props.isMultipleSelect ? sanitizeMultipleSelection(value) : value;
|
|
813
|
+
emit("update:selected", sanitize);
|
|
814
|
+
if (props.closeOnSelect && !props.isMultipleSelect)
|
|
815
|
+
close2();
|
|
816
|
+
}
|
|
817
|
+
function isSelected(option) {
|
|
818
|
+
if (Array.isArray(props.selected)) {
|
|
819
|
+
return typeof option === "string" ? props.selected.includes(option) : props.selected.includes(option.value);
|
|
820
|
+
}
|
|
821
|
+
return typeof option === "string" ? option === props.selected : option.value === props.selected;
|
|
822
|
+
}
|
|
823
|
+
const listItemFocusIndex = ref(0);
|
|
824
|
+
function navigation({ key, code }) {
|
|
825
|
+
const focusListItem = (index) => {
|
|
826
|
+
const indexItem = index != null ? index : listItemFocusIndex.value;
|
|
827
|
+
if (!!index)
|
|
828
|
+
listItemFocusIndex.value = index;
|
|
829
|
+
setTimeout(() => {
|
|
830
|
+
const list = el.value.children[1].lastChild;
|
|
831
|
+
const item = list.children[indexItem];
|
|
832
|
+
elementFocus.value = item.id;
|
|
833
|
+
item.focus();
|
|
834
|
+
}, 0);
|
|
835
|
+
};
|
|
836
|
+
const focusSearch = () => {
|
|
837
|
+
var _a2;
|
|
838
|
+
if (props.searchable) {
|
|
839
|
+
listItemFocusIndex.value = 0;
|
|
840
|
+
(_a2 = el.value.children[1].firstChild.firstElementChild) == null ? void 0 : _a2.focus();
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
switch (code) {
|
|
844
|
+
case "ArrowUp":
|
|
845
|
+
listItemFocusIndex.value > 0 && (listItemFocusIndex.value -= 1);
|
|
846
|
+
return focusListItem();
|
|
847
|
+
case "ArrowDown":
|
|
848
|
+
if (!isDropdownOpen.value) {
|
|
849
|
+
open();
|
|
850
|
+
return focusListItem(0);
|
|
851
|
+
}
|
|
852
|
+
listItemFocusIndex.value < filtered.value.length - 1 && (listItemFocusIndex.value += 1);
|
|
853
|
+
return focusListItem();
|
|
854
|
+
case "Home":
|
|
855
|
+
return focusListItem(0);
|
|
856
|
+
case "End":
|
|
857
|
+
return focusListItem(props.options.length - 1);
|
|
858
|
+
case "Escape":
|
|
859
|
+
return close2();
|
|
860
|
+
default:
|
|
861
|
+
!["Enter", "NumpadEnter", "Space"].includes(code) && focusSearch();
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function resetStates() {
|
|
865
|
+
isDropdownOpen.value = false;
|
|
866
|
+
listItemFocusIndex.value = 0;
|
|
867
|
+
filter.value = "";
|
|
868
|
+
}
|
|
869
|
+
function getOption(option, key) {
|
|
870
|
+
return typeof option === "string" ? option : option[key != null ? key : "value"];
|
|
871
|
+
}
|
|
872
|
+
return (_ctx, _cache) => {
|
|
873
|
+
return openBlock(), createElementBlock("div", {
|
|
874
|
+
ref_key: "el",
|
|
875
|
+
ref: el,
|
|
876
|
+
class: "sol-dropdown-core",
|
|
877
|
+
"data-testid": `dropdown-${__props.id}`,
|
|
878
|
+
onKeydownPassive: navigation
|
|
879
|
+
}, [
|
|
880
|
+
createElementVNode("button", {
|
|
881
|
+
id: `toggle-dropdown-${__props.id}`,
|
|
882
|
+
role: "combobox",
|
|
883
|
+
disabled: __props.disabled,
|
|
884
|
+
"data-testid": `toggle-dropdown-${__props.id}`,
|
|
885
|
+
class: "button-toggle-dropdown toggle-dropdown",
|
|
886
|
+
"aria-haspopup": "listbox",
|
|
887
|
+
"aria-expanded": isDropdownOpen.value,
|
|
888
|
+
"aria-controls": `dropdown-list-${__props.id}`,
|
|
889
|
+
"aria-activedescendant": elementFocus.value,
|
|
890
|
+
onClick: withModifiers(toggleDropdown, ["stop"]),
|
|
891
|
+
onKeyup: withKeys(toggleDropdown, ["space"])
|
|
892
|
+
}, [
|
|
893
|
+
renderSlot(_ctx.$slots, "toggle-dropdown", {
|
|
894
|
+
toggle: { open, close: close2, toggleDropdown },
|
|
895
|
+
selectedSanitized: unref(selectedSanitize),
|
|
896
|
+
selected: __props.selected
|
|
897
|
+
}, () => [
|
|
898
|
+
createTextVNode(toDisplayString(unref(selectedSanitize) || "Selecione"), 1)
|
|
899
|
+
])
|
|
900
|
+
], 40, _hoisted_2$5),
|
|
901
|
+
withDirectives(createElementVNode("div", _hoisted_3$5, [
|
|
902
|
+
__props.searchable ? (openBlock(), createElementBlock("div", {
|
|
903
|
+
key: 0,
|
|
904
|
+
class: normalizeClass(["search-container", { "-loading": __props.loading }])
|
|
905
|
+
}, [
|
|
906
|
+
renderSlot(_ctx.$slots, "search", { filter: filter.value }, () => [
|
|
907
|
+
createVNode(_sfc_main$a, {
|
|
908
|
+
id: `search-dropdown-${__props.id}`,
|
|
909
|
+
modelValue: filter.value,
|
|
910
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filter.value = $event),
|
|
911
|
+
"data-testid": `search-dropdown-${__props.id}`,
|
|
912
|
+
role: "searchbox",
|
|
913
|
+
class: "search",
|
|
914
|
+
"aria-autocomplete": "list",
|
|
915
|
+
placeholder: __props.searchPlaceholder,
|
|
916
|
+
"aria-expanded": isDropdownOpen.value,
|
|
917
|
+
"aria-haspopup": "listbox",
|
|
918
|
+
"aria-controls": `dropdown-list-${__props.id}`,
|
|
919
|
+
"aria-activedescendant": elementFocus.value,
|
|
920
|
+
"aria-label": `Pesquisar dentro da lista ${__props.id}`,
|
|
921
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
922
|
+
}, ["stop"])),
|
|
923
|
+
onInput: _cache[2] || (_cache[2] = ($event) => {
|
|
924
|
+
var _a2;
|
|
925
|
+
return emit("search", (_a2 = $event.target) == null ? void 0 : _a2.value);
|
|
926
|
+
})
|
|
927
|
+
}, null, 8, ["id", "modelValue", "data-testid", "placeholder", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-label"]),
|
|
928
|
+
createVNode(unref(IconSearch), {
|
|
929
|
+
"aria-hidden": "true",
|
|
930
|
+
class: "icon"
|
|
931
|
+
})
|
|
932
|
+
])
|
|
933
|
+
], 2)) : createCommentVNode("", true),
|
|
934
|
+
createElementVNode("ul", {
|
|
935
|
+
id: `dropdown-list-${__props.id}`,
|
|
936
|
+
"data-testid": `dropdown-list-${__props.id}`,
|
|
937
|
+
role: "listbox",
|
|
938
|
+
tabindex: "-1",
|
|
939
|
+
"aria-labelledby": `toggle-dropdown-${__props.id}`,
|
|
940
|
+
class: "dropdown-list-core"
|
|
941
|
+
}, [
|
|
942
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(filtered), (option, index) => {
|
|
943
|
+
return openBlock(), createElementBlock("li", {
|
|
944
|
+
id: `option-${__props.id}-${getOption(option, "value")}`,
|
|
945
|
+
key: index,
|
|
946
|
+
"data-testid": `option-${__props.id}-${getOption(option, "value")}`,
|
|
947
|
+
role: "option",
|
|
948
|
+
tabindex: "-1",
|
|
949
|
+
class: "dropdown-item",
|
|
950
|
+
selected: isSelected(option),
|
|
951
|
+
"aria-selected": isSelected(option),
|
|
952
|
+
onClick: ($event) => select(option),
|
|
953
|
+
onKeyup: [
|
|
954
|
+
withKeys(($event) => select(option), ["enter"]),
|
|
955
|
+
withKeys(($event) => select(option), ["space"])
|
|
956
|
+
]
|
|
957
|
+
}, [
|
|
958
|
+
renderSlot(_ctx.$slots, "default", {
|
|
959
|
+
text: getOption(option, "name"),
|
|
960
|
+
option,
|
|
961
|
+
isSelect: isSelected
|
|
962
|
+
}, () => [
|
|
963
|
+
createTextVNode(toDisplayString(getOption(option, "name")), 1)
|
|
964
|
+
])
|
|
965
|
+
], 40, _hoisted_5$1);
|
|
966
|
+
}), 128)),
|
|
967
|
+
!unref(filtered).length ? (openBlock(), createElementBlock("li", _hoisted_6$1, [
|
|
968
|
+
renderSlot(_ctx.$slots, "no-data", {}, () => [
|
|
969
|
+
_hoisted_7
|
|
970
|
+
])
|
|
971
|
+
])) : createCommentVNode("", true)
|
|
972
|
+
], 8, _hoisted_4$1)
|
|
973
|
+
], 512), [
|
|
974
|
+
[vShow, isDropdownOpen.value]
|
|
975
|
+
])
|
|
976
|
+
], 40, _hoisted_1$5);
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
_sfc_main$1.install = (app) => {
|
|
981
|
+
app.component("SolDropdown", _sfc_main$1);
|
|
545
982
|
};
|
|
546
983
|
var windiBase = "";
|
|
547
984
|
var windiComponents = "";
|
|
548
985
|
var windiUtilities = "";
|
|
549
986
|
var style = "";
|
|
987
|
+
const TOAST_GAP = 12;
|
|
988
|
+
const DEFAULT_OPTIONS = {
|
|
989
|
+
type: "success",
|
|
990
|
+
timeout: 5e3,
|
|
991
|
+
showIcon: true,
|
|
992
|
+
showCloseButton: true,
|
|
993
|
+
position: "top-right",
|
|
994
|
+
hideProgressBar: false
|
|
995
|
+
};
|
|
996
|
+
const _hoisted_1$4 = {
|
|
997
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
998
|
+
viewBox: "0 0 24 24",
|
|
999
|
+
width: "1.2em",
|
|
1000
|
+
height: "1.2em"
|
|
1001
|
+
};
|
|
1002
|
+
const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("path", {
|
|
1003
|
+
fill: "currentColor",
|
|
1004
|
+
d: "M12 4a8 8 0 1 0 0 16a8 8 0 0 0 0-16zM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12zm14.664-3.247a1 1 0 0 1 .083 1.411l-5.333 6a1 1 0 0 1-1.495 0l-2.666-3a1 1 0 0 1 1.494-1.328l1.92 2.159l4.586-5.16a1 1 0 0 1 1.411-.082z"
|
|
1005
|
+
}, null, -1);
|
|
1006
|
+
const _hoisted_3$4 = [
|
|
1007
|
+
_hoisted_2$4
|
|
1008
|
+
];
|
|
1009
|
+
function render$3(_ctx, _cache) {
|
|
1010
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_3$4);
|
|
1011
|
+
}
|
|
1012
|
+
var Success = { name: "mi-circle-check", render: render$3 };
|
|
1013
|
+
const _hoisted_1$3 = {
|
|
1014
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
1015
|
+
viewBox: "0 0 24 24",
|
|
1016
|
+
width: "1.2em",
|
|
1017
|
+
height: "1.2em"
|
|
1018
|
+
};
|
|
1019
|
+
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("path", {
|
|
1020
|
+
fill: "currentColor",
|
|
1021
|
+
d: "M12 4a8 8 0 1 0 0 16a8 8 0 0 0 0-16zM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12zm5.793-4.207a1 1 0 0 1 1.414 0L12 10.586l2.793-2.793a1 1 0 1 1 1.414 1.414L13.414 12l2.793 2.793a1 1 0 0 1-1.414 1.414L12 13.414l-2.793 2.793a1 1 0 0 1-1.414-1.414L10.586 12L7.793 9.207a1 1 0 0 1 0-1.414z"
|
|
1022
|
+
}, null, -1);
|
|
1023
|
+
const _hoisted_3$3 = [
|
|
1024
|
+
_hoisted_2$3
|
|
1025
|
+
];
|
|
1026
|
+
function render$2(_ctx, _cache) {
|
|
1027
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$3, _hoisted_3$3);
|
|
1028
|
+
}
|
|
1029
|
+
var Error$1 = { name: "mi-circle-error", render: render$2 };
|
|
1030
|
+
const _hoisted_1$2 = {
|
|
1031
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
1032
|
+
viewBox: "0 0 24 24",
|
|
1033
|
+
width: "1.2em",
|
|
1034
|
+
height: "1.2em"
|
|
1035
|
+
};
|
|
1036
|
+
const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("g", { fill: "currentColor" }, [
|
|
1037
|
+
/* @__PURE__ */ createElementVNode("path", { d: "M12 4a8 8 0 1 0 0 16a8 8 0 0 0 0-16zM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12z" }),
|
|
1038
|
+
/* @__PURE__ */ createElementVNode("path", { d: "M12 14a1 1 0 0 1-1-1V7a1 1 0 1 1 2 0v6a1 1 0 0 1-1 1zm-1.5 2.5a1.5 1.5 0 1 1 3 0a1.5 1.5 0 0 1-3 0z" })
|
|
1039
|
+
], -1);
|
|
1040
|
+
const _hoisted_3$2 = [
|
|
1041
|
+
_hoisted_2$2
|
|
1042
|
+
];
|
|
1043
|
+
function render$1(_ctx, _cache) {
|
|
1044
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_3$2);
|
|
1045
|
+
}
|
|
1046
|
+
var Info = { name: "mi-circle-warning", render: render$1 };
|
|
1047
|
+
const _hoisted_1$1 = {
|
|
1048
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
1049
|
+
viewBox: "0 0 24 24",
|
|
1050
|
+
width: "1.2em",
|
|
1051
|
+
height: "1.2em"
|
|
1052
|
+
};
|
|
1053
|
+
const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("path", {
|
|
1054
|
+
fill: "currentColor",
|
|
1055
|
+
d: "M5.293 5.293a1 1 0 0 1 1.414 0L12 10.586l5.293-5.293a1 1 0 1 1 1.414 1.414L13.414 12l5.293 5.293a1 1 0 0 1-1.414 1.414L12 13.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L10.586 12L5.293 6.707a1 1 0 0 1 0-1.414z"
|
|
1056
|
+
}, null, -1);
|
|
1057
|
+
const _hoisted_3$1 = [
|
|
1058
|
+
_hoisted_2$1
|
|
1059
|
+
];
|
|
1060
|
+
function render(_ctx, _cache) {
|
|
1061
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_3$1);
|
|
1062
|
+
}
|
|
1063
|
+
var Close = { name: "mi-close", render };
|
|
1064
|
+
function useTimer(callback, delay) {
|
|
1065
|
+
const timer = reactive({
|
|
1066
|
+
id: null,
|
|
1067
|
+
intervalId: null,
|
|
1068
|
+
startTime: 0,
|
|
1069
|
+
remaining: delay
|
|
1070
|
+
});
|
|
1071
|
+
const progress = ref(100);
|
|
1072
|
+
function stop() {
|
|
1073
|
+
clearInterval(timer.intervalId);
|
|
1074
|
+
clearTimeout(timer.id);
|
|
1075
|
+
timer.remaining -= Date.now() - timer.startTime;
|
|
1076
|
+
}
|
|
1077
|
+
function start() {
|
|
1078
|
+
timer.startTime = Date.now();
|
|
1079
|
+
clearTimeout(timer.id);
|
|
1080
|
+
timer.intervalId = setInterval(() => {
|
|
1081
|
+
progress.value--;
|
|
1082
|
+
}, delay / 100 - 5);
|
|
1083
|
+
timer.id = setTimeout(callback, timer.remaining);
|
|
1084
|
+
}
|
|
1085
|
+
function clear() {
|
|
1086
|
+
clearInterval(timer.intervalId);
|
|
1087
|
+
clearTimeout(timer.id);
|
|
1088
|
+
progress.value = 100;
|
|
1089
|
+
}
|
|
1090
|
+
onMounted(() => {
|
|
1091
|
+
if (delay <= 0)
|
|
1092
|
+
return;
|
|
1093
|
+
});
|
|
1094
|
+
onUnmounted(() => {
|
|
1095
|
+
clear();
|
|
1096
|
+
});
|
|
1097
|
+
return {
|
|
1098
|
+
start,
|
|
1099
|
+
stop,
|
|
1100
|
+
clear,
|
|
1101
|
+
progress
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
function usePosition(fn) {
|
|
1105
|
+
const stylePosition = computed(() => {
|
|
1106
|
+
const { position, offset } = fn();
|
|
1107
|
+
switch (position) {
|
|
1108
|
+
case "top-left":
|
|
1109
|
+
return {
|
|
1110
|
+
left: "0",
|
|
1111
|
+
top: `${offset}px`
|
|
1112
|
+
};
|
|
1113
|
+
case "bottom-left":
|
|
1114
|
+
return {
|
|
1115
|
+
left: "0",
|
|
1116
|
+
bottom: `${offset}px`
|
|
1117
|
+
};
|
|
1118
|
+
case "bottom-right":
|
|
1119
|
+
return {
|
|
1120
|
+
right: "0",
|
|
1121
|
+
bottom: `${offset}px`
|
|
1122
|
+
};
|
|
1123
|
+
case "top-center":
|
|
1124
|
+
return {
|
|
1125
|
+
top: `${offset}px`,
|
|
1126
|
+
left: "0",
|
|
1127
|
+
right: "0",
|
|
1128
|
+
marginRight: "auto",
|
|
1129
|
+
marginLeft: "auto"
|
|
1130
|
+
};
|
|
1131
|
+
case "bottom-center":
|
|
1132
|
+
return {
|
|
1133
|
+
bottom: `${offset}px`,
|
|
1134
|
+
left: "0",
|
|
1135
|
+
right: "0",
|
|
1136
|
+
marginRight: "auto",
|
|
1137
|
+
marginLeft: "auto"
|
|
1138
|
+
};
|
|
1139
|
+
default:
|
|
1140
|
+
return {
|
|
1141
|
+
right: "0",
|
|
1142
|
+
top: `${offset}px`
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
return {
|
|
1147
|
+
stylePosition
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
var Transition = /* @__PURE__ */ ((Transition2) => {
|
|
1151
|
+
Transition2["top-left"] = "bounce-left";
|
|
1152
|
+
Transition2["top-right"] = "bounce-right";
|
|
1153
|
+
Transition2["top-center"] = "bounce-down";
|
|
1154
|
+
Transition2["bottom-left"] = "bounce-left";
|
|
1155
|
+
Transition2["bottom-center"] = "bounce-up";
|
|
1156
|
+
Transition2["bottom-right"] = "bounce-right";
|
|
1157
|
+
return Transition2;
|
|
1158
|
+
})(Transition || {});
|
|
1159
|
+
var Toast_vue_vue_type_style_index_0_lang = "";
|
|
1160
|
+
const _hoisted_1 = ["id", "data-testid"];
|
|
1161
|
+
const _hoisted_2 = { class: "content-wrapper" };
|
|
1162
|
+
const _hoisted_3 = {
|
|
1163
|
+
key: 0,
|
|
1164
|
+
class: "icon-container",
|
|
1165
|
+
"aria-hidden": "true"
|
|
1166
|
+
};
|
|
1167
|
+
const _hoisted_4 = { class: "content" };
|
|
1168
|
+
const _hoisted_5 = {
|
|
1169
|
+
key: 0,
|
|
1170
|
+
class: "description"
|
|
1171
|
+
};
|
|
1172
|
+
const _hoisted_6 = ["data-testid"];
|
|
1173
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1174
|
+
props: {
|
|
1175
|
+
id: null,
|
|
1176
|
+
type: { default: DEFAULT_OPTIONS.type },
|
|
1177
|
+
visible: { type: Boolean, default: false },
|
|
1178
|
+
title: null,
|
|
1179
|
+
description: null,
|
|
1180
|
+
timeout: null,
|
|
1181
|
+
hideProgressBar: { type: Boolean, default: DEFAULT_OPTIONS.hideProgressBar },
|
|
1182
|
+
showIcon: { type: Boolean, default: DEFAULT_OPTIONS.showIcon },
|
|
1183
|
+
offset: { default: 0 },
|
|
1184
|
+
onClose: null,
|
|
1185
|
+
onCloseHandler: null,
|
|
1186
|
+
position: { default: DEFAULT_OPTIONS.position }
|
|
1187
|
+
},
|
|
1188
|
+
setup(__props) {
|
|
1189
|
+
const props = __props;
|
|
1190
|
+
const { start, stop, progress } = useTimer(() => {
|
|
1191
|
+
var _a2;
|
|
1192
|
+
(_a2 = props.onCloseHandler) == null ? void 0 : _a2.call(props);
|
|
1193
|
+
}, props.timeout);
|
|
1194
|
+
const { stylePosition } = usePosition(() => ({
|
|
1195
|
+
offset: props.offset,
|
|
1196
|
+
position: props.position
|
|
1197
|
+
}));
|
|
1198
|
+
const isMultiline = computed(() => props.title && props.description);
|
|
1199
|
+
function onMouseEnter() {
|
|
1200
|
+
if (props.timeout > 0) {
|
|
1201
|
+
stop();
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
function onMouseLeave() {
|
|
1205
|
+
start();
|
|
1206
|
+
}
|
|
1207
|
+
onMounted(() => {
|
|
1208
|
+
start();
|
|
1209
|
+
});
|
|
1210
|
+
return (_ctx, _cache) => {
|
|
1211
|
+
return openBlock(), createBlock(Transition$1, {
|
|
1212
|
+
name: unref(Transition)[__props.position],
|
|
1213
|
+
type: "animation"
|
|
1214
|
+
}, {
|
|
1215
|
+
default: withCtx(() => [
|
|
1216
|
+
__props.visible ? (openBlock(), createElementBlock("div", {
|
|
1217
|
+
key: 0,
|
|
1218
|
+
id: `toast-${__props.type}-${__props.id}`,
|
|
1219
|
+
role: "status",
|
|
1220
|
+
"data-testid": `toast-${__props.type}-${__props.id}`,
|
|
1221
|
+
style: normalizeStyle(unref(stylePosition)),
|
|
1222
|
+
class: normalizeClass(["sol-toast-core", [`-${__props.type}`, { "-multiline": unref(isMultiline) }]]),
|
|
1223
|
+
onKeyup: _cache[1] || (_cache[1] = withKeys((...args) => __props.onCloseHandler && __props.onCloseHandler(...args), ["esc"])),
|
|
1224
|
+
onMouseenter: onMouseEnter,
|
|
1225
|
+
onMouseleave: onMouseLeave,
|
|
1226
|
+
onFocusin: onMouseEnter,
|
|
1227
|
+
onFocusout: onMouseLeave
|
|
1228
|
+
}, [
|
|
1229
|
+
createElementVNode("section", _hoisted_2, [
|
|
1230
|
+
__props.showIcon ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
1231
|
+
renderSlot(_ctx.$slots, "icon-status", { type: __props.type }, () => [
|
|
1232
|
+
__props.type === "success" ? (openBlock(), createBlock(unref(Success), {
|
|
1233
|
+
key: 0,
|
|
1234
|
+
class: "icon"
|
|
1235
|
+
})) : createCommentVNode("", true),
|
|
1236
|
+
__props.type === "info" ? (openBlock(), createBlock(unref(Info), {
|
|
1237
|
+
key: 1,
|
|
1238
|
+
class: "icon"
|
|
1239
|
+
})) : createCommentVNode("", true),
|
|
1240
|
+
__props.type === "danger" ? (openBlock(), createBlock(unref(Error$1), {
|
|
1241
|
+
key: 2,
|
|
1242
|
+
class: "icon"
|
|
1243
|
+
})) : createCommentVNode("", true)
|
|
1244
|
+
])
|
|
1245
|
+
])) : createCommentVNode("", true),
|
|
1246
|
+
createElementVNode("div", _hoisted_4, [
|
|
1247
|
+
createElementVNode("p", {
|
|
1248
|
+
class: normalizeClass(["title", { "-multiline": unref(isMultiline) }])
|
|
1249
|
+
}, [
|
|
1250
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
1251
|
+
createTextVNode(toDisplayString(__props.title), 1)
|
|
1252
|
+
])
|
|
1253
|
+
], 2),
|
|
1254
|
+
__props.description ? (openBlock(), createElementBlock("p", _hoisted_5, [
|
|
1255
|
+
renderSlot(_ctx.$slots, "description", {}, () => [
|
|
1256
|
+
createTextVNode(toDisplayString(__props.description), 1)
|
|
1257
|
+
])
|
|
1258
|
+
])) : createCommentVNode("", true)
|
|
1259
|
+
])
|
|
1260
|
+
]),
|
|
1261
|
+
createElementVNode("button", {
|
|
1262
|
+
type: "button",
|
|
1263
|
+
class: normalizeClass(["close", { "-multiline": unref(isMultiline) }]),
|
|
1264
|
+
"data-testid": `toast-close-button-${__props.type}-${__props.id}`,
|
|
1265
|
+
"aria-label": "close notification",
|
|
1266
|
+
onClick: _cache[0] || (_cache[0] = (...args) => __props.onCloseHandler && __props.onCloseHandler(...args))
|
|
1267
|
+
}, [
|
|
1268
|
+
createVNode(unref(Close), { class: "icon" })
|
|
1269
|
+
], 10, _hoisted_6),
|
|
1270
|
+
!__props.hideProgressBar ? (openBlock(), createElementBlock("div", {
|
|
1271
|
+
key: 0,
|
|
1272
|
+
class: "progressbar",
|
|
1273
|
+
"aria-hidden": "true",
|
|
1274
|
+
style: normalizeStyle({ width: `${unref(progress)}%` })
|
|
1275
|
+
}, null, 4)) : createCommentVNode("", true)
|
|
1276
|
+
], 46, _hoisted_1)) : createCommentVNode("", true)
|
|
1277
|
+
]),
|
|
1278
|
+
_: 3
|
|
1279
|
+
}, 8, ["name"]);
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
const toasts = {
|
|
1284
|
+
"top-left": [],
|
|
1285
|
+
"top-right": [],
|
|
1286
|
+
"top-center": [],
|
|
1287
|
+
"bottom-left": [],
|
|
1288
|
+
"bottom-right": [],
|
|
1289
|
+
"bottom-center": []
|
|
1290
|
+
};
|
|
1291
|
+
function useToast() {
|
|
1292
|
+
let toastId = 0;
|
|
1293
|
+
function clearAllToasts() {
|
|
1294
|
+
Object.entries(toasts).forEach(([position, toastsInAPosition]) => {
|
|
1295
|
+
if (toastsInAPosition.length) {
|
|
1296
|
+
toastsInAPosition.forEach((toast) => {
|
|
1297
|
+
var _a2;
|
|
1298
|
+
const id = (_a2 = toast.toastVNode.props) == null ? void 0 : _a2.id;
|
|
1299
|
+
close(id, position);
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
const createToast = (content, options) => {
|
|
1305
|
+
const id = toastId++;
|
|
1306
|
+
const initializedOptions = options ? initializeOptions(options) : DEFAULT_OPTIONS;
|
|
1307
|
+
if (options == null ? void 0 : options.showOneToast)
|
|
1308
|
+
clearAllToasts();
|
|
1309
|
+
const transformContent = typeof content === "string" ? { title: content } : content;
|
|
1310
|
+
setupVNode(id, initializedOptions, transformContent);
|
|
1311
|
+
return {
|
|
1312
|
+
close: () => close(id, initializedOptions.position)
|
|
1313
|
+
};
|
|
1314
|
+
};
|
|
1315
|
+
return {
|
|
1316
|
+
createToast,
|
|
1317
|
+
clearAllToasts
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function initializeOptions(options) {
|
|
1321
|
+
const processedOptions = __spreadProps(__spreadValues(__spreadValues({}, DEFAULT_OPTIONS), options), {
|
|
1322
|
+
showIcon: options.showIcon
|
|
1323
|
+
});
|
|
1324
|
+
processedOptions.hideProgressBar = !!(processedOptions.timeout && (processedOptions == null ? void 0 : processedOptions.timeout) <= 0);
|
|
1325
|
+
if (options.hideProgressBar) {
|
|
1326
|
+
processedOptions.hideProgressBar = options.hideProgressBar;
|
|
1327
|
+
}
|
|
1328
|
+
return processedOptions;
|
|
1329
|
+
}
|
|
1330
|
+
function setupVNode(id, options, content) {
|
|
1331
|
+
setTimeout(() => {
|
|
1332
|
+
const verticalOffset = moveToastsOnAdd(options, toasts, TOAST_GAP);
|
|
1333
|
+
const container = document.createElement("div");
|
|
1334
|
+
document.body.appendChild(container);
|
|
1335
|
+
const toastVNode = createVNode(_sfc_main, setupVNodeProps(options, id, verticalOffset, close, content));
|
|
1336
|
+
render$7(toastVNode, container);
|
|
1337
|
+
toasts[options.position].push({ toastVNode, container });
|
|
1338
|
+
if (toastVNode.component)
|
|
1339
|
+
toastVNode.component.props.visible = true;
|
|
1340
|
+
}, 1);
|
|
1341
|
+
}
|
|
1342
|
+
function setupVNodeProps(options, id, offset, closeFn, content) {
|
|
1343
|
+
return __spreadProps(__spreadValues(__spreadValues({}, options), content), {
|
|
1344
|
+
id,
|
|
1345
|
+
offset,
|
|
1346
|
+
visible: false,
|
|
1347
|
+
onCloseHandler() {
|
|
1348
|
+
closeFn(id, options.position ? options.position : "top-right");
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
function moveToastsOnAdd(options, toasts2, toastGap) {
|
|
1353
|
+
if (!options.position)
|
|
1354
|
+
throw new Error("no position");
|
|
1355
|
+
return toasts2[options.position].reduce((acc, { toastVNode }) => {
|
|
1356
|
+
const offsetHeight = toastVNode.el.offsetHeight + toastGap;
|
|
1357
|
+
acc += offsetHeight || 0;
|
|
1358
|
+
return acc;
|
|
1359
|
+
}, toastGap);
|
|
1360
|
+
}
|
|
1361
|
+
function moveToastsOnClose(index, toastArr, position, toastHeight) {
|
|
1362
|
+
for (let i = index; i < toastArr.length; i++) {
|
|
1363
|
+
const { toastVNode } = toastArr[i];
|
|
1364
|
+
if (!toastVNode.el)
|
|
1365
|
+
return;
|
|
1366
|
+
const verticalPosition = position.split("-")[0] || "top";
|
|
1367
|
+
const positionLessOneToast = parseInt(toastVNode.el.style[verticalPosition], 10) - toastHeight - TOAST_GAP;
|
|
1368
|
+
if (!toastVNode.component)
|
|
1369
|
+
return;
|
|
1370
|
+
toastVNode.component.props.offset = positionLessOneToast;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
function close(id, position) {
|
|
1374
|
+
var _a2;
|
|
1375
|
+
const toastArr = toasts[position];
|
|
1376
|
+
const index = toastArr.findIndex(({ toastVNode: toastVNode2 }) => {
|
|
1377
|
+
var _a3;
|
|
1378
|
+
return id === ((_a3 = toastVNode2 == null ? void 0 : toastVNode2.props) == null ? void 0 : _a3.id);
|
|
1379
|
+
});
|
|
1380
|
+
if (index === -1)
|
|
1381
|
+
return;
|
|
1382
|
+
const { container, toastVNode } = toastArr[index];
|
|
1383
|
+
const height = (_a2 = toastVNode == null ? void 0 : toastVNode.el) == null ? void 0 : _a2.offsetHeight;
|
|
1384
|
+
toasts[position].splice(index, 1);
|
|
1385
|
+
moveToastsOnClose(index, toastArr, position, height);
|
|
1386
|
+
if (!toastVNode.component)
|
|
1387
|
+
return;
|
|
1388
|
+
const componentProps = toastVNode.component.props;
|
|
1389
|
+
componentProps.visible = false;
|
|
1390
|
+
componentProps.onClose && componentProps.onClose();
|
|
1391
|
+
setTimeout(() => {
|
|
1392
|
+
render$7(null, container);
|
|
1393
|
+
document.body.removeChild(container);
|
|
1394
|
+
}, 1e3);
|
|
1395
|
+
}
|
|
550
1396
|
console.log("%c\u{1F33B}[Girassol]\u{1F33B}", "padding: 8px;background: #212121;color: gold; font-family: 'Fira code'; font-weight: bold; font-size: 1.2rem");
|
|
551
1397
|
const components = {
|
|
552
|
-
SolButton: _sfc_main$
|
|
553
|
-
SolInput: _sfc_main$
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
1398
|
+
SolButton: _sfc_main$b,
|
|
1399
|
+
SolInput: _sfc_main$a,
|
|
1400
|
+
SolTextarea: _sfc_main$7,
|
|
1401
|
+
SolTextfield: _sfc_main$9,
|
|
1402
|
+
SolTextfieldPassword: _sfc_main$8,
|
|
1403
|
+
SolRadio: _sfc_main$6,
|
|
1404
|
+
SolRadioGroup: _sfc_main$5,
|
|
1405
|
+
SolCheckbox: _sfc_main$4,
|
|
1406
|
+
SolCheckboxGroup: _sfc_main$3,
|
|
1407
|
+
SolSwitch: _sfc_main$2,
|
|
1408
|
+
SolDropdown: _sfc_main$1
|
|
561
1409
|
};
|
|
562
1410
|
function install(App) {
|
|
563
1411
|
for (const component in components) {
|
|
@@ -568,4 +1416,4 @@ const componentsNames = [];
|
|
|
568
1416
|
for (const component in components) {
|
|
569
1417
|
componentsNames.push(component);
|
|
570
1418
|
}
|
|
571
|
-
export { _sfc_main$
|
|
1419
|
+
export { _sfc_main$b as SolButton, _sfc_main$4 as SolCheckbox, _sfc_main$3 as SolCheckboxGroup, _sfc_main$1 as SolDropdown, _sfc_main$a as SolInput, _sfc_main$6 as SolRadio, _sfc_main$5 as SolRadioGroup, _sfc_main$2 as SolSwitch, _sfc_main$7 as SolTextarea, _sfc_main$9 as SolTextfield, _sfc_main$8 as SolTextfieldPassword, componentsNames, install, useToast };
|