@open-xamu-co/ui-components-vue 3.1.0-next.6 → 3.1.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,80 +0,0 @@
1
- import { inject as g, computed as u } from "vue";
2
- import { useUtils as A } from "@open-xamu-co/ui-common-helpers";
3
- import { eColors as s } from "@open-xamu-co/ui-common-enums";
4
- function w(e) {
5
- const { countriesUrl: o = "https://countries.xamu.com.co/api/v1", ...n } = g("xamu") || {};
6
- return e({ ...n, countriesUrl: o });
7
- }
8
- function b(e) {
9
- function o(a) {
10
- return a.map((l) => {
11
- var i, d;
12
- if (typeof l != "string") return !1;
13
- const c = l.split(":", 2), r = ((d = (i = c[1]) == null ? void 0 : i.toLowerCase) == null ? void 0 : d.call(i)) === "asc" ? "asc" : "desc";
14
- return [c[0], r];
15
- }).filter((l) => !!l);
16
- }
17
- const n = e;
18
- return Array.isArray(n) ? o(n) : typeof n == "string" ? o([n]) : [];
19
- }
20
- function h(e) {
21
- if (Array.isArray(e))
22
- return [e[0], e[1] || s.LIGHT];
23
- if (typeof e == "object" && e !== null) {
24
- const o = Object.entries(e).filter(([n, a]) => a);
25
- return h([o[0][0]]);
26
- }
27
- return h([e]);
28
- }
29
- function G(e, o) {
30
- return w((n) => {
31
- const { getModifierClasses: a, getPropData: l } = A(n), c = u(() => {
32
- const [t, f] = h(e.theme ?? s.SECONDARY), m = [t, f || s.LIGHT];
33
- return e.invertTheme || m.reverse(), m;
34
- }), r = u(() => [c.value[1], c.value[0]]), i = u(() => [
35
- s.DANGER,
36
- r.value[1] === s.DARK ? s.DARK : s.LIGHT
37
- ]), d = u(() => {
38
- var f;
39
- let t;
40
- if (typeof e.shadow == "boolean") t = e.shadow;
41
- else {
42
- if (!((f = e.shadow) != null && f.length)) return [];
43
- t = e.shadow.some((m) => r.value[0] === m);
44
- }
45
- return t ? a([{ shadow: t }], { prefix: "" }) : [];
46
- }), v = u(() => {
47
- if (!e.theme) return [];
48
- const t = o ? r.value : [r.value[0]];
49
- return a([t.join("-")], { modifier: "tm", divider: "-" });
50
- }), y = u(() => {
51
- if (!e.theme) return [];
52
- const t = o ? i.value : [i.value[0]];
53
- return a([t.join("-")], { modifier: "tm", divider: "-" });
54
- }), T = u(() => {
55
- const t = e.tooltip && l(e.tooltip), f = r.value[1] !== s.LIGHT;
56
- return t ? {
57
- "aria-label": t,
58
- "data-tooltip": t,
59
- "data-tooltip-position": e.tooltipPosition,
60
- "data-tooltip-text": e.tooltipAsText ?? !0,
61
- "data-tooltip-bg": r.value[0],
62
- "data-tooltip-color": f ? r.value[1] : void 0
63
- } : null;
64
- });
65
- return {
66
- invertedThemeValues: c,
67
- themeValues: r,
68
- dangerThemeValues: i,
69
- themeClasses: v,
70
- dangerThemeClasses: y,
71
- shadowClasses: d,
72
- tooltipAttributes: T
73
- };
74
- });
75
- }
76
- export {
77
- G as a,
78
- b,
79
- w as u
80
- };
@@ -1 +0,0 @@
1
- "use strict";const u=require("vue"),p=require("@open-xamu-co/ui-common-helpers"),i=require("@open-xamu-co/ui-common-enums");function C(e){const{countriesUrl:r="https://countries.xamu.com.co/api/v1",...s}=u.inject("xamu")||{};return e({...s,countriesUrl:r})}function g(e){function r(l){return l.map(a=>{var n,m;if(typeof a!="string")return!1;const c=a.split(":",2),o=((m=(n=c[1])==null?void 0:n.toLowerCase)==null?void 0:m.call(n))==="asc"?"asc":"desc";return[c[0],o]}).filter(a=>!!a)}const s=e;return Array.isArray(s)?r(s):typeof s=="string"?r([s]):[]}function h(e){if(Array.isArray(e))return[e[0],e[1]||i.eColors.LIGHT];if(typeof e=="object"&&e!==null){const r=Object.entries(e).filter(([s,l])=>l);return h([r[0][0]])}return h([e])}function A(e,r){return C(s=>{const{getModifierClasses:l,getPropData:a}=p.useUtils(s),c=u.computed(()=>{const[t,d]=h(e.theme??i.eColors.SECONDARY),f=[t,d||i.eColors.LIGHT];return e.invertTheme||f.reverse(),f}),o=u.computed(()=>[c.value[1],c.value[0]]),n=u.computed(()=>[i.eColors.DANGER,o.value[1]===i.eColors.DARK?i.eColors.DARK:i.eColors.LIGHT]),m=u.computed(()=>{var d;let t;if(typeof e.shadow=="boolean")t=e.shadow;else{if(!((d=e.shadow)!=null&&d.length))return[];t=e.shadow.some(f=>o.value[0]===f)}return t?l([{shadow:t}],{prefix:""}):[]}),v=u.computed(()=>{if(!e.theme)return[];const t=r?o.value:[o.value[0]];return l([t.join("-")],{modifier:"tm",divider:"-"})}),y=u.computed(()=>{if(!e.theme)return[];const t=r?n.value:[n.value[0]];return l([t.join("-")],{modifier:"tm",divider:"-"})}),T=u.computed(()=>{const t=e.tooltip&&a(e.tooltip),d=o.value[1]!==i.eColors.LIGHT;return t?{"aria-label":t,"data-tooltip":t,"data-tooltip-position":e.tooltipPosition,"data-tooltip-text":e.tooltipAsText??!0,"data-tooltip-bg":o.value[0],"data-tooltip-color":d?o.value[1]:void 0}:null});return{invertedThemeValues:c,themeValues:o,dangerThemeValues:n,themeClasses:v,dangerThemeClasses:y,shadowClasses:m,tooltipAttributes:T}})}exports.useHelpers=C;exports.useOrderBy=g;exports.useTheme=A;