@codeandfunction/callaloo 4.7.4 → 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.
Files changed (69) hide show
  1. package/dist/callaloo.global.js +1 -1
  2. 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
  3. 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
  4. 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
  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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. package/dist/chunks/CLThemeProvider.vue_vue_type_script_setup_true_lang-jaJYKZL8.js +59 -0
  16. 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
  17. package/dist/chunks/CLToastProvider.vue_vue_type_script_setup_true_lang-DkGK0H4Z.js +35 -0
  18. package/dist/chunks/{base-theme--kHiV8Yr.js → context-CEvx70FY.js} +36 -47
  19. package/dist/chunks/context-dkA4VoF7.js +4 -0
  20. package/dist/chunks/magic-string.es-uPKorP4O.js +663 -0
  21. package/dist/chunks/{utils-C9p9W8oE.js → utils-BfOa9ckr.js} +1 -1
  22. package/dist/chunks/{utils-Dp9v2LTO.js → utils-BjZURPWx.js} +1 -1
  23. package/dist/chunks/{utils-DvIHDaPn.js → utils-C1xiySYN.js} +1 -1
  24. package/dist/chunks/{utils-DtSQZ0tk.js → utils-D00IXMTR.js} +1 -1
  25. package/dist/chunks/{utils-BFZ8uebw.js → utils-eBt2zUZl.js} +1 -1
  26. package/dist/chunks/{utils-BT2IMc_A.js → utils-nD3K7jh9.js} +1 -1
  27. package/dist/chunks/vue-test-utils.esm-bundler-BeQTU4qG.js +18679 -0
  28. package/dist/components/Buttons/CLA11yButton/CLA11yButton.js +1 -1
  29. package/dist/components/Buttons/CLButton/CLButton.js +1 -1
  30. package/dist/components/CLIcon/CLIcon.js +1 -1
  31. package/dist/components/CLTable/CLTable.js +2 -2
  32. package/dist/components/Containers/CLCard/CLCard.js +1 -1
  33. package/dist/components/Containers/CLCarousel/CLCarousel.js +2 -2
  34. package/dist/components/Containers/CLDisclosure/CLDisclosure.js +5 -5
  35. package/dist/components/Containers/CLDrawer/CLDrawer.js +1 -1
  36. package/dist/components/Form/CLCheckbox/CLCheckbox.js +3 -3
  37. package/dist/components/Form/CLInput/CLInput.js +5 -5
  38. package/dist/components/Form/CLRadioButton/CLRadioButton.js +2 -2
  39. package/dist/components/Form/CLSelect/CLSelect.js +3 -3
  40. package/dist/components/Form/CLTextArea/CLTextArea.js +2 -2
  41. package/dist/components/Indicators/CLBadge/CLBadge.js +1 -1
  42. package/dist/components/Indicators/CLBanner/CLBanner.js +6 -6
  43. package/dist/components/Indicators/CLPill/CLPill.js +1 -1
  44. package/dist/components/Indicators/CLProgress/CLProgress.js +2 -2
  45. package/dist/components/Loading/CLSkeleton/CLSkeleton.js +1 -1
  46. package/dist/components/Loading/CLSpinner/CLSpinner.js +1 -1
  47. package/dist/components/Modals/CLModal/CLModal.js +3 -3
  48. package/dist/components/Navigation/CLLink/CLLink.js +1 -1
  49. package/dist/components/Navigation/CLNavLink/CLNavLink.js +1 -1
  50. package/dist/components/Navigation/CLNavSection/CLNavSection.js +2 -2
  51. package/dist/components/Popups/CLDropdownMenu/CLDropdownMenu.js +2 -2
  52. package/dist/components/Popups/CLToast/CLToast.js +1 -1
  53. package/dist/components/Providers/CLThemeProvider/CLThemeProvider.js +6 -58
  54. package/dist/components/Providers/CLThemeProvider/base-theme.d.ts +7 -6
  55. package/dist/components/Providers/CLThemeProvider/context.d.ts +13 -0
  56. package/dist/components/Providers/CLThemeProvider/index.d.ts +1 -0
  57. package/dist/components/Providers/CLToastProvider/CLToastProvider.js +5 -44
  58. package/dist/components/Providers/CLToastProvider/context.d.ts +8 -0
  59. package/dist/components/Providers/CLToastProvider/index.d.ts +1 -0
  60. package/dist/components/Typography/CLHeading/CLHeading.js +1 -1
  61. package/dist/components/Typography/CLText/CLText.js +1 -1
  62. package/dist/composables/useTheme.d.ts +4 -14
  63. package/dist/composables/useTheme.js +38 -29
  64. package/dist/composables/useTheme.spec.js +88 -0
  65. package/dist/composables/useToast.d.ts +2 -2
  66. package/dist/composables/useToast.js +9 -6
  67. package/dist/composables/useToast.spec.js +45 -0
  68. package/dist/test-setup.d.ts +1 -0
  69. package/package.json +1 -1
@@ -1,32 +1,41 @@
1
1
  import '../assets/core.css';
2
- import { ref as t, inject as n } from "vue";
3
- import { D as o } from "../chunks/base-theme--kHiV8Yr.js";
4
- const a = t(o.borderRadius), r = t(o.darkMode), l = t(o.fontFamily), s = t(o.colors || {
5
- primary: {},
6
- secondary: {},
7
- neutral: {},
8
- danger: {},
9
- warning: {},
10
- success: {},
11
- info: {}
12
- }), c = (e) => {
13
- a.value = e;
14
- }, u = (e) => {
15
- s.value = { ...s.value, ...e };
16
- }, d = (e) => {
17
- r.value = e;
18
- }, i = (e) => {
19
- l.value = e;
20
- }, D = () => n("clll-theme", {
21
- borderRadius: a,
22
- colors: s,
23
- darkMode: r,
24
- fontFamily: l,
25
- setBorderRadius: c,
26
- setColors: u,
27
- setDarkMode: d,
28
- setFontFamily: i
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
- D as useTheme
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 | undefined;
3
+ visible: globalThis.ComputedRef<boolean>;
4
4
  showToast: (input: Omit<CLToastProps, "onDismiss">) => void;
5
- hideToast: (() => void) | undefined;
5
+ hideToast: () => void | undefined;
6
6
  };
@@ -1,15 +1,18 @@
1
1
  import '../assets/core.css';
2
- import { inject as e } from "vue";
3
- const a = () => {
4
- const o = e("clll-toast"), s = (t) => {
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?.value,
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
- a as useToast
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
+ });
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "ui components",
18
18
  "vuejs"
19
19
  ],
20
- "version": "4.7.4",
20
+ "version": "4.7.5",
21
21
  "license": "MIT",
22
22
  "type": "module",
23
23
  "unpkg": "dist/callaloo.global.js",