@codeandfunction/callaloo 4.7.3 → 4.7.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/README.md +4 -4
- package/dist/callaloo.global.js +1 -1
- package/dist/chunks/{CLA11yButton.vue_vue_type_style_index_0_lang-fn1ix3QX.js → CLA11yButton.vue_vue_type_style_index_0_lang-zGLnnSIW.js} +1 -1
- package/dist/chunks/{CLButton.vue_vue_type_style_index_0_lang-D0vMBs0W.js → CLButton.vue_vue_type_style_index_0_lang-MvhnNzVW.js} +3 -3
- package/dist/chunks/{CLCard.vue_vue_type_style_index_0_lang-CfB_Fpy5.js → CLCard.vue_vue_type_style_index_0_lang-Sre7UYZd.js} +5 -5
- package/dist/chunks/{CLFormLabel.vue_vue_type_script_setup_true_lang-BcHOofhM.js → CLFormLabel.vue_vue_type_script_setup_true_lang-CIQxM6aH.js} +1 -1
- package/dist/chunks/{CLHeading.vue_vue_type_style_index_0_lang-DntAR1dI.js → CLHeading.vue_vue_type_style_index_0_lang-DH5oJc1C.js} +1 -1
- package/dist/chunks/{CLIcon.vue_vue_type_style_index_0_lang-CzJDIguL.js → CLIcon.vue_vue_type_style_index_0_lang-Dhr2tI-g.js} +1 -1
- package/dist/chunks/{CLInputMessages.vue_vue_type_style_index_0_lang-CF_lxNr8.js → CLInputMessages.vue_vue_type_style_index_0_lang-DTWvAACK.js} +1 -1
- package/dist/chunks/{CLLink.vue_vue_type_style_index_0_lang-CZZm1duI.js → CLLink.vue_vue_type_style_index_0_lang-BXysZqLn.js} +2 -2
- package/dist/chunks/{CLNavLink.vue_vue_type_script_setup_true_lang-BEBTiI0u.js → CLNavLink.vue_vue_type_script_setup_true_lang-Dhnmfa9W.js} +1 -1
- package/dist/chunks/{CLPill.vue_vue_type_style_index_0_lang-Eh8_1A7g.js → CLPill.vue_vue_type_style_index_0_lang-BQim03ge.js} +3 -3
- package/dist/chunks/{CLSkeleton.vue_vue_type_style_index_0_lang-DO-kZ629.js → CLSkeleton.vue_vue_type_style_index_0_lang-DduoX6Cu.js} +1 -1
- package/dist/chunks/{CLSpinner.vue_vue_type_style_index_0_lang-ByLBkPr8.js → CLSpinner.vue_vue_type_style_index_0_lang-DlXqnsi8.js} +1 -1
- package/dist/chunks/{CLText.vue_vue_type_style_index_0_lang-DVwTAVXM.js → CLText.vue_vue_type_style_index_0_lang-B-L8ECJL.js} +1 -1
- package/dist/chunks/CLThemeProvider.vue_vue_type_script_setup_true_lang-jaJYKZL8.js +59 -0
- package/dist/chunks/{CLToast.vue_vue_type_style_index_0_lang-BYHaeCZV.js → CLToast.vue_vue_type_style_index_0_lang-CzSDeL_X.js} +4 -4
- package/dist/chunks/CLToastProvider.vue_vue_type_script_setup_true_lang-DkGK0H4Z.js +35 -0
- package/dist/chunks/{base-theme--kHiV8Yr.js → context-CEvx70FY.js} +36 -47
- package/dist/chunks/context-dkA4VoF7.js +4 -0
- package/dist/chunks/magic-string.es-uPKorP4O.js +663 -0
- package/dist/chunks/{utils-C9p9W8oE.js → utils-BfOa9ckr.js} +1 -1
- package/dist/chunks/{utils-Dp9v2LTO.js → utils-BjZURPWx.js} +1 -1
- package/dist/chunks/{utils-DvIHDaPn.js → utils-C1xiySYN.js} +1 -1
- package/dist/chunks/{utils-DtSQZ0tk.js → utils-D00IXMTR.js} +1 -1
- package/dist/chunks/{utils-BFZ8uebw.js → utils-eBt2zUZl.js} +1 -1
- package/dist/chunks/{utils-BT2IMc_A.js → utils-nD3K7jh9.js} +1 -1
- package/dist/chunks/vue-test-utils.esm-bundler-BeQTU4qG.js +18679 -0
- package/dist/components/Buttons/CLA11yButton/CLA11yButton.js +1 -1
- package/dist/components/Buttons/CLButton/CLButton.js +1 -1
- package/dist/components/CLIcon/CLIcon.js +1 -1
- package/dist/components/CLTable/CLTable.js +2 -2
- package/dist/components/Containers/CLCard/CLCard.js +1 -1
- package/dist/components/Containers/CLCarousel/CLCarousel.js +2 -2
- package/dist/components/Containers/CLDisclosure/CLDisclosure.js +5 -5
- package/dist/components/Containers/CLDrawer/CLDrawer.js +1 -1
- package/dist/components/Form/CLCheckbox/CLCheckbox.js +3 -3
- package/dist/components/Form/CLInput/CLInput.js +5 -5
- package/dist/components/Form/CLRadioButton/CLRadioButton.js +2 -2
- package/dist/components/Form/CLSelect/CLSelect.js +3 -3
- package/dist/components/Form/CLTextArea/CLTextArea.js +2 -2
- package/dist/components/Indicators/CLBadge/CLBadge.css +1 -1
- package/dist/components/Indicators/CLBadge/CLBadge.js +1 -1
- package/dist/components/Indicators/CLBanner/CLBanner.js +6 -6
- package/dist/components/Indicators/CLPill/CLPill.js +1 -1
- package/dist/components/Indicators/CLProgress/CLProgress.js +2 -2
- package/dist/components/Loading/CLSkeleton/CLSkeleton.js +1 -1
- package/dist/components/Loading/CLSpinner/CLSpinner.js +1 -1
- package/dist/components/Modals/CLModal/CLModal.js +3 -3
- package/dist/components/Navigation/CLLink/CLLink.js +1 -1
- package/dist/components/Navigation/CLNavLink/CLNavLink.js +1 -1
- package/dist/components/Navigation/CLNavSection/CLNavSection.js +2 -2
- package/dist/components/Popups/CLDropdownMenu/CLDropdownMenu.js +2 -2
- package/dist/components/Popups/CLToast/CLToast.js +1 -1
- package/dist/components/Providers/CLThemeProvider/CLThemeProvider.js +6 -58
- package/dist/components/Providers/CLThemeProvider/base-theme.d.ts +7 -6
- package/dist/components/Providers/CLThemeProvider/context.d.ts +13 -0
- package/dist/components/Providers/CLThemeProvider/index.d.ts +1 -0
- package/dist/components/Providers/CLToastProvider/CLToastProvider.js +5 -44
- package/dist/components/Providers/CLToastProvider/context.d.ts +8 -0
- package/dist/components/Providers/CLToastProvider/index.d.ts +1 -0
- package/dist/components/Typography/CLHeading/CLHeading.js +1 -1
- package/dist/components/Typography/CLText/CLText.js +1 -1
- package/dist/composables/useTheme.d.ts +4 -14
- package/dist/composables/useTheme.js +38 -29
- package/dist/composables/useTheme.spec.js +88 -0
- package/dist/composables/useToast.d.ts +2 -2
- package/dist/composables/useToast.js +9 -6
- package/dist/composables/useToast.spec.js +45 -0
- package/dist/styles.css +1 -1
- package/dist/test-setup.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
import '../assets/core.css';
|
|
2
|
-
import { ref as
|
|
3
|
-
import { D as o } from "../chunks/
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
2
|
+
import { ref as a, inject as i } from "vue";
|
|
3
|
+
import { D as o, T as c } from "../chunks/context-CEvx70FY.js";
|
|
4
|
+
const l = a(
|
|
5
|
+
o.borderRadius
|
|
6
|
+
), s = a(o.darkMode), n = a(o.fontFamily), r = a(
|
|
7
|
+
o.colors || {
|
|
8
|
+
primary: {},
|
|
9
|
+
secondary: {},
|
|
10
|
+
neutral: {},
|
|
11
|
+
danger: {},
|
|
12
|
+
warning: {},
|
|
13
|
+
success: {},
|
|
14
|
+
info: {}
|
|
15
|
+
}
|
|
16
|
+
), m = () => {
|
|
17
|
+
const t = i(c, null);
|
|
18
|
+
return t || (console.warn(
|
|
19
|
+
"[Callaloo]: useTheme() must be used within a <CLThemeProvider />."
|
|
20
|
+
), {
|
|
21
|
+
borderRadius: l,
|
|
22
|
+
colors: r,
|
|
23
|
+
darkMode: s,
|
|
24
|
+
fontFamily: n,
|
|
25
|
+
setBorderRadius: (e) => {
|
|
26
|
+
l.value = e;
|
|
27
|
+
},
|
|
28
|
+
setColors: (e) => {
|
|
29
|
+
r.value = { ...r.value, ...e };
|
|
30
|
+
},
|
|
31
|
+
setDarkMode: (e) => {
|
|
32
|
+
s.value = e;
|
|
33
|
+
},
|
|
34
|
+
setFontFamily: (e) => {
|
|
35
|
+
n.value = e;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
30
39
|
export {
|
|
31
|
-
|
|
40
|
+
m as useTheme
|
|
32
41
|
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import '../assets/core.css';
|
|
2
|
+
import { defineComponent as r, h as e } from "vue";
|
|
3
|
+
import { d as p, b as f, a as v, i, m, g as s, v as o } from "../chunks/vue-test-utils.esm-bundler-BeQTU4qG.js";
|
|
4
|
+
import { useTheme as a } from "./useTheme.js";
|
|
5
|
+
import { _ as l } from "../chunks/CLThemeProvider.vue_vue_type_script_setup_true_lang-jaJYKZL8.js";
|
|
6
|
+
import { CLBorderRadius as n } from "../index.js";
|
|
7
|
+
p("useTheme", () => {
|
|
8
|
+
f(() => {
|
|
9
|
+
o.spyOn(console, "warn").mockImplementation(() => {
|
|
10
|
+
}), Object.defineProperty(window, "matchMedia", {
|
|
11
|
+
writable: !0,
|
|
12
|
+
value: o.fn().mockImplementation((t) => ({
|
|
13
|
+
matches: !1,
|
|
14
|
+
media: t,
|
|
15
|
+
onchange: null,
|
|
16
|
+
addListener: o.fn(),
|
|
17
|
+
// deprecated
|
|
18
|
+
removeListener: o.fn(),
|
|
19
|
+
// deprecated
|
|
20
|
+
addEventListener: o.fn(),
|
|
21
|
+
removeEventListener: o.fn(),
|
|
22
|
+
dispatchEvent: o.fn()
|
|
23
|
+
}))
|
|
24
|
+
});
|
|
25
|
+
}), v(() => {
|
|
26
|
+
o.restoreAllMocks();
|
|
27
|
+
}), i("should warn when used outside of CLThemeProvider", () => {
|
|
28
|
+
const t = r({
|
|
29
|
+
setup() {
|
|
30
|
+
return a(), () => e("div");
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
m(t), s(console.warn).toHaveBeenCalledWith(
|
|
34
|
+
"[Callaloo]: useTheme() must be used within a <CLThemeProvider />."
|
|
35
|
+
);
|
|
36
|
+
}), i("should not warn when used inside CLThemeProvider", () => {
|
|
37
|
+
const t = r({
|
|
38
|
+
setup() {
|
|
39
|
+
return a(), () => e("div");
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
m(l, {
|
|
43
|
+
slots: {
|
|
44
|
+
default: () => e(t)
|
|
45
|
+
}
|
|
46
|
+
}), s(console.warn).not.toHaveBeenCalled();
|
|
47
|
+
}), i("should provide theme state from the provider", () => {
|
|
48
|
+
let t;
|
|
49
|
+
const d = r({
|
|
50
|
+
setup() {
|
|
51
|
+
return t = a(), () => e("div");
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
m(l, {
|
|
55
|
+
props: {
|
|
56
|
+
themeConfig: {
|
|
57
|
+
borderRadius: n.Large
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
slots: {
|
|
61
|
+
default: () => e(d)
|
|
62
|
+
}
|
|
63
|
+
}), s(t.borderRadius.value).toBe(n.Large);
|
|
64
|
+
}), i("should allow multiple providers with isolated state", () => {
|
|
65
|
+
let t, d;
|
|
66
|
+
const u = r({
|
|
67
|
+
setup() {
|
|
68
|
+
return t = a(), () => e("div");
|
|
69
|
+
}
|
|
70
|
+
}), h = r({
|
|
71
|
+
setup() {
|
|
72
|
+
return d = a(), () => e("div");
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
m(r({
|
|
76
|
+
setup() {
|
|
77
|
+
return () => e("div", [
|
|
78
|
+
e(l, { themeConfig: { borderRadius: n.Small } }, {
|
|
79
|
+
default: () => e(u)
|
|
80
|
+
}),
|
|
81
|
+
e(l, { themeConfig: { borderRadius: n.Large } }, {
|
|
82
|
+
default: () => e(h)
|
|
83
|
+
})
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
})), s(t.borderRadius.value).toBe(n.Small), s(d.borderRadius.value).toBe(n.Large);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CLToastProps } from '../index.ts';
|
|
2
2
|
export declare const useToast: () => {
|
|
3
|
-
visible: boolean
|
|
3
|
+
visible: globalThis.ComputedRef<boolean>;
|
|
4
4
|
showToast: (input: Omit<CLToastProps, "onDismiss">) => void;
|
|
5
|
-
hideToast: (
|
|
5
|
+
hideToast: () => void | undefined;
|
|
6
6
|
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import '../assets/core.css';
|
|
2
|
-
import { inject as e } from "vue";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { inject as e, computed as a } from "vue";
|
|
3
|
+
import { T as i } from "../chunks/context-dkA4VoF7.js";
|
|
4
|
+
const l = () => {
|
|
5
|
+
const o = e(i, null);
|
|
6
|
+
o || console.warn("[Callaloo]: useToast() must be used within a <CLToastProvider />.");
|
|
7
|
+
const s = (t) => {
|
|
5
8
|
o?.showToast?.(t);
|
|
6
9
|
};
|
|
7
10
|
return {
|
|
8
|
-
visible: o?.visible
|
|
11
|
+
visible: a(() => o?.visible.value ?? !1),
|
|
9
12
|
showToast: s,
|
|
10
|
-
hideToast: o?.hideToast
|
|
13
|
+
hideToast: () => o?.hideToast()
|
|
11
14
|
};
|
|
12
15
|
};
|
|
13
16
|
export {
|
|
14
|
-
|
|
17
|
+
l as useToast
|
|
15
18
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import '../assets/core.css';
|
|
2
|
+
import { defineComponent as t, h as s, nextTick as l } from "vue";
|
|
3
|
+
import { d as m, b as v, a as c, i as a, m as n, g as o, v as r } from "../chunks/vue-test-utils.esm-bundler-BeQTU4qG.js";
|
|
4
|
+
import { useToast as i } from "./useToast.js";
|
|
5
|
+
import { _ as u } from "../chunks/CLToastProvider.vue_vue_type_script_setup_true_lang-DkGK0H4Z.js";
|
|
6
|
+
m("useToast", () => {
|
|
7
|
+
v(() => {
|
|
8
|
+
r.spyOn(console, "warn").mockImplementation(() => {
|
|
9
|
+
});
|
|
10
|
+
}), c(() => {
|
|
11
|
+
r.restoreAllMocks();
|
|
12
|
+
}), a("should warn when used outside of CLToastProvider", () => {
|
|
13
|
+
const e = t({
|
|
14
|
+
setup() {
|
|
15
|
+
return i(), () => s("div");
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
n(e), o(console.warn).toHaveBeenCalledWith(
|
|
19
|
+
"[Callaloo]: useToast() must be used within a <CLToastProvider />."
|
|
20
|
+
);
|
|
21
|
+
}), a("should not warn when used inside CLToastProvider", () => {
|
|
22
|
+
const e = t({
|
|
23
|
+
setup() {
|
|
24
|
+
return i(), () => s("div");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
n(u, {
|
|
28
|
+
slots: {
|
|
29
|
+
default: () => s(e)
|
|
30
|
+
}
|
|
31
|
+
}), o(console.warn).not.toHaveBeenCalled();
|
|
32
|
+
}), a("should have reactive visible state", async () => {
|
|
33
|
+
let e;
|
|
34
|
+
const d = t({
|
|
35
|
+
setup() {
|
|
36
|
+
return e = i(), () => s("div");
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
n(u, {
|
|
40
|
+
slots: {
|
|
41
|
+
default: () => s(d)
|
|
42
|
+
}
|
|
43
|
+
}), o(e.visible.value).toBe(!1), e.showToast({ message: "Test" }), await l(), o(e.visible.value).toBe(!0), e.hideToast(), await l(), o(e.visible.value).toBe(!1);
|
|
44
|
+
});
|
|
45
|
+
});
|