@m4l/graphics 7.2.9 → 7.2.11-beta-improvement-13-global-scrollbars-hidden-by-default.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.
@@ -0,0 +1,56 @@
1
+ import { ExtendedTheme } from './getDateRangePickerPopupGlobalStyles';
2
+ /**
3
+ * Hybrid scrollbar styling for a **consistent gutter/thumb on Chromium/WebKit** (Chrome, Edge, Opera,
4
+ * Safari) via `::-webkit-scrollbar*` pseudo-elements, plus **Firefox-only** `scrollbar-color` /
5
+ * `scrollbar-width` inside `@supports (-moz-appearance: none)` so standard scrollbar properties never
6
+ * apply on Blink (mixing them with `::-webkit-scrollbar` breaks sizing).
7
+ *
8
+ * **Hide / reveal (WebKit):** The scrollbar gutter stays sized (`::-webkit-scrollbar` width/height).
9
+ * `--m4l-scrollbar-opacity` is `0` on `*` and `1` on `*:hover` / `*:focus-within`. The thumb uses
10
+ * `color-mix(in srgb, …)` with that variable so the thumb is fully transparent at `0` and uses the
11
+ * theme active color at `1`. This module does **not** add `@property`, `transition`, or
12
+ * `prefers-reduced-motion` rules; changes are effectively **instant** (a fade could be added by
13
+ * registering the custom property and transitioning it on `*`, but that is out of scope here).
14
+ *
15
+ * **Geometry (tokens):** `baseSpacings['sp1-5']` (thumb column), `sp0-5` (inset via transparent
16
+ * thumb border), `borderRadius['r1']`. Gutter = `calc(sp1-5 + sp0-5 + sp0-5)` on WebKit when
17
+ * visible. Firefox uses `scrollbar-width: none` by default and **`auto`** (platform default width)
18
+ * plus `scrollbar-color` when the container is hovered or has `:focus-within`; thumb radius is not
19
+ * controllable there.
20
+ */
21
+ export declare function getScrollbarHoverRevealGlobalStyles(theme: ExtendedTheme): {
22
+ '*': {
23
+ '--m4l-scrollbar-opacity': number;
24
+ };
25
+ '*:hover, *:focus-within': {
26
+ '--m4l-scrollbar-opacity': number;
27
+ };
28
+ '@supports (-moz-appearance: none)': {
29
+ '*': {
30
+ scrollbarWidth: string;
31
+ scrollbarColor: string;
32
+ };
33
+ '*:hover, *:focus-within': {
34
+ scrollbarWidth: string;
35
+ scrollbarColor: string;
36
+ };
37
+ };
38
+ '*::-webkit-scrollbar': {
39
+ width: string;
40
+ height: string;
41
+ };
42
+ '*::-webkit-scrollbar-track': {
43
+ backgroundColor: string;
44
+ };
45
+ '*::-webkit-scrollbar-thumb': {
46
+ backgroundColor: string;
47
+ backgroundClip: string;
48
+ border: string;
49
+ borderRadius: string;
50
+ WebkitBorderRadius: string;
51
+ };
52
+ '*::-webkit-scrollbar-corner': {
53
+ backgroundColor: string;
54
+ };
55
+ };
56
+ //# sourceMappingURL=getScrollbarHoverRevealGlobalStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getScrollbarHoverRevealGlobalStyles.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/components/GlobalStyles/getScrollbarHoverRevealGlobalStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDvE"}
@@ -0,0 +1,44 @@
1
+ function b(r) {
2
+ const a = `${r.vars.palette.default.active}`, o = "transparent", c = r.vars.size.baseSpacings["sp1-5"], t = r.vars.size.baseSpacings["sp0-5"], s = r.vars.size.borderRadius.r1, l = `calc(${c} + ${t} + ${t})`, i = `color-mix(in srgb, ${a} calc(var(--m4l-scrollbar-opacity, 0) * 100%), transparent)`;
3
+ return {
4
+ // Drive opacity from the scroll container; pseudos inherit the computed value via color-mix.
5
+ "*": {
6
+ "--m4l-scrollbar-opacity": 0
7
+ },
8
+ "*:hover, *:focus-within": {
9
+ "--m4l-scrollbar-opacity": 1
10
+ },
11
+ // Firefox — do not expose scrollbar-* on global `*` outside this block (avoids Chromium conflicts).
12
+ "@supports (-moz-appearance: none)": {
13
+ "*": {
14
+ scrollbarWidth: "none",
15
+ scrollbarColor: `${a} ${o}`
16
+ },
17
+ "*:hover, *:focus-within": {
18
+ scrollbarWidth: "auto",
19
+ scrollbarColor: `${a} ${o}`
20
+ }
21
+ },
22
+ // WebKit / Blink — fixed gutter; thumb alpha follows --m4l-scrollbar-opacity (see file doc).
23
+ "*::-webkit-scrollbar": {
24
+ width: `${l} !important`,
25
+ height: `${l} !important`
26
+ },
27
+ "*::-webkit-scrollbar-track": {
28
+ backgroundColor: o
29
+ },
30
+ "*::-webkit-scrollbar-thumb": {
31
+ backgroundColor: i,
32
+ backgroundClip: "padding-box",
33
+ border: `${t} solid transparent`,
34
+ borderRadius: s,
35
+ WebkitBorderRadius: s
36
+ },
37
+ "*::-webkit-scrollbar-corner": {
38
+ backgroundColor: o
39
+ }
40
+ };
41
+ }
42
+ export {
43
+ b as getScrollbarHoverRevealGlobalStyles
44
+ };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Estilos globales
2
+ * Application-wide global styles (MUI `GlobalStyles`).
3
3
  * @author Juan Escobar - automatic
4
4
  * @createdAt 2024-10-06 20:07:17 - automatic
5
5
  * @updatedAt 2024-10-06 20:07:18 - automatic
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/components/GlobalStyles/index.tsx"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,wBAAgB,YAAY,qDA8H3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/graphics/src/components/GlobalStyles/index.tsx"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,wBAAgB,YAAY,qDAiH3B"}
@@ -1,15 +1,17 @@
1
- import { jsx as o, Fragment as a } from "@emotion/react/jsx-runtime";
2
- import { useTheme as e } from "@mui/material/styles";
1
+ import { jsx as o, Fragment as r } from "@emotion/react/jsx-runtime";
2
+ import { useTheme as a } from "@mui/material/styles";
3
3
  import { GlobalStyles as i } from "@mui/material";
4
- import { globalRemSize as r } from "@m4l/styles";
4
+ import { globalRemSize as e } from "@m4l/styles";
5
5
  import { getDateRangePickerPopupGlobalStyles as n } from "./getDateRangePickerPopupGlobalStyles.js";
6
- function d() {
7
- const t = e();
8
- return /* @__PURE__ */ o(a, { children: /* @__PURE__ */ o(
6
+ import { getScrollbarHoverRevealGlobalStyles as p } from "./getScrollbarHoverRevealGlobalStyles.js";
7
+ function h() {
8
+ const t = a();
9
+ return /* @__PURE__ */ o(r, { children: /* @__PURE__ */ o(
9
10
  i,
10
11
  {
11
12
  styles: {
12
13
  ...n(t),
14
+ ...p(t),
13
15
  // box-sizing is not inherited; apply to all elements so layout matches previous CssBaseline-like behavior
14
16
  "*, *::before, *::after": {
15
17
  boxSizing: "border-box"
@@ -59,17 +61,6 @@ function d() {
59
61
  width: "100vw",
60
62
  height: "100vh"
61
63
  },
62
- "*::-webkit-scrollbar": {
63
- width: `${t.vars.size.baseSpacings.sp1}!important`,
64
- height: `${t.vars.size.baseSpacings.sp1}!important`
65
- },
66
- "*::-webkit-scrollbar-track": {
67
- backgroundColor: "transparent"
68
- },
69
- "*::-webkit-scrollbar-thumb": {
70
- backgroundColor: `${t.vars.palette.default.focusOpacity}!important`,
71
- borderRadius: `${t.vars.size.borderRadius["r0-5"]}!important`
72
- },
73
64
  "& #root": {
74
65
  width: "100%",
75
66
  height: "100%"
@@ -99,9 +90,9 @@ function d() {
99
90
  }
100
91
  },
101
92
  "& html": {
102
- fontSize: r.desktop,
93
+ fontSize: e.desktop,
103
94
  [t.breakpoints.down("sm")]: {
104
- fontSize: r.mobile
95
+ fontSize: e.mobile
105
96
  }
106
97
  },
107
98
  // Global styles for native tags html
@@ -117,5 +108,5 @@ function d() {
117
108
  ) });
118
109
  }
119
110
  export {
120
- d as GlobalStyles
111
+ h as GlobalStyles
121
112
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "7.2.9",
3
+ "version": "7.2.11-beta-improvement-13-global-scrollbars-hidden-by-default.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/test/setup.d.ts DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../../packages/graphics/src/test/setup.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
package/test/utils.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { cleanup, screen, renderHook } from '@testing-library/react';
2
- import { default as React, act } from 'react';
3
- /**
4
- * customRender
5
- */
6
- declare const customRender: (ui: React.ReactElement, options?: {}) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
7
- export { default as userEvent } from '@testing-library/user-event';
8
- export { customRender as render, renderHook, screen, cleanup, act };
9
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../packages/graphics/src/test/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAgC,MAAM,wBAAwB,CAAC;AAClF,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAWnC;;GAEG;AACH,QAAA,MAAM,YAAY,GAAI,IAAI,KAAK,CAAC,YAAY,EAAE,YAAY,iIASzD,CAAC;AACF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC"}