@m4l/graphics 7.1.5 → 7.2.0

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/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { G as r } from "./components/GlobalStyles/index.js";
2
- import { g as t } from "./contexts/LocalesContext/helper.js";
2
+ import { g as s } from "./contexts/LocalesContext/helper.js";
3
3
  import { F as m, a as p } from "./contexts/FormatterContext/index.js";
4
- import { L as u, a as f } from "./contexts/LocalesContext/index.js";
4
+ import { L as f, a as u } from "./contexts/LocalesContext/index.js";
5
5
  import { R as n, a as v } from "./contexts/ResponsiveContainerContext/index.js";
6
6
  import { H as l, a as T } from "./contexts/HostThemeContext/index.js";
7
- import { D as c, a as C } from "./contexts/DeviceTypeContext/index.js";
7
+ import { D as C, a as c } from "./contexts/DeviceTypeContext/index.js";
8
8
  import { d as h } from "./contexts/ThemeSettingsContext/constants.js";
9
9
  import { T as S, a as F } from "./contexts/ThemeSettingsContext/ThemeSettingsContext.js";
10
10
  import { u as D } from "./hooks/useFirstRender/index.js";
@@ -23,16 +23,17 @@ import { u as Y } from "./hooks/usePaginate/index.js";
23
23
  import { u as _ } from "./hooks/useRows/index.js";
24
24
  import { c as ee } from "./utils/strings.js";
25
25
  import { g as re } from "./utils/anchorEl.js";
26
+ import { g as se } from "./utils/getContrastTextColor/getContrastTextColor.js";
26
27
  export {
27
- c as DeviceTypeContext,
28
- C as DeviceTypeProvider,
28
+ C as DeviceTypeContext,
29
+ c as DeviceTypeProvider,
29
30
  m as FormatterContext,
30
31
  p as FormatterProvider,
31
32
  r as GlobalStyles,
32
33
  l as HostThemeContext,
33
34
  T as HostThemeProvider,
34
- u as LocalesContext,
35
- f as LocalesProvider,
35
+ f as LocalesContext,
36
+ u as LocalesProvider,
36
37
  n as ResponsiveContainerContext,
37
38
  v as ResponsiveContainerProvider,
38
39
  S as ThemeSettingsContext,
@@ -40,7 +41,8 @@ export {
40
41
  ee as capitalize,
41
42
  h as defaultThemeSettings,
42
43
  re as getAnchorElPositionWindow,
43
- t as getLocaleFromNetwork,
44
+ se as getContrastTextColor,
45
+ s as getLocaleFromNetwork,
44
46
  D as useFirstRender,
45
47
  b as useFormatter,
46
48
  j as useHostTheme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "7.1.5",
3
+ "version": "7.2.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team*",
6
6
  "type": "module",
@@ -0,0 +1,5 @@
1
+ import { HexColor, TextColor } from './types';
2
+ /**
3
+ * Obtiene el color de texto para un color de fondo dado.
4
+ */
5
+ export declare function getContrastTextColor(hex: HexColor, cache?: boolean): TextColor;
@@ -0,0 +1,10 @@
1
+ const r = /* @__PURE__ */ new Map();
2
+ function u(s, e = !0) {
3
+ if (e && r.has(s))
4
+ return r.get(s);
5
+ const t = s.replace("#", ""), n = t.length === 3 ? t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, c = parseInt(n.substr(0, 2), 16) * 299, f = parseInt(n.substr(2, 2), 16) * 587, a = parseInt(n.substr(4, 2), 16) * 114, o = c + f + a > 128e3 ? "#000000" : "#ffffff";
6
+ return e && r.set(s, o), o;
7
+ }
8
+ export {
9
+ u as g
10
+ };
@@ -0,0 +1,2 @@
1
+ export * from './getContrastTextColor';
2
+ export type { HexColor } from './types';
@@ -0,0 +1,2 @@
1
+ export type HexColor = `#${string}`;
2
+ export type TextColor = '#ffffff' | '#000000';
package/utils/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './strings';
2
2
  export * from './anchorEl';
3
+ export * from './getContrastTextColor';