@m4l/components 9.1.95 → 9.1.96

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/@types/types.d.ts CHANGED
@@ -144,6 +144,7 @@ import { MenuDividerOwnerState, MenuDividerSlotsType } from '../components/mui_e
144
144
  import { NavLinkOwnerState, NavLinkSlotsType } from '../components/mui_extended/NavLink/types';
145
145
 
146
146
  import { RHFSelectSlotsType, RHFSelectOwnerState } from '../components/hook-form/RHFSelect/types';
147
+ import { ScrollBarSlotsType, ScrollBarOwnerState } from '../components/ScrollBar/types';
147
148
  import { StackOwnerState, StackSlotsType } from '../components/mui_extended/Stack/types';
148
149
  import { RHFCheckBoxOwnerState, RHFCheckBoxSlotsType } from '../components/hook-form/RHFCheckbox/types';
149
150
  import { AreasAdminOwnerState, AreasAdminType } from '../components/areas/components/AreasAdmin/types';
@@ -210,6 +211,7 @@ declare module '@mui/material/styles' {
210
211
  M4LMenuDivider: MenuDividerSlotsType;
211
212
  M4LNavLink: NavLinkSlotsType;
212
213
  M4LRHFSelect: RHFSelectSlotsType;
214
+ M4LScrollBar: ScrollBarSlotsType;
213
215
  M4LAreasAdmin: AreasAdminType;
214
216
  M4LStack: StackSlotsType;
215
217
  M4LDateTimePicker: DateTimePickerSlotsType;
@@ -274,6 +276,7 @@ declare module '@mui/material/styles' {
274
276
  M4LMenuDivider: Partial<MenuDividerOwnerState>;
275
277
  M4LNavLink: Partial<NavLinkOwnerState>;
276
278
  M4LRHFSelect: Partial<RHFSelectOwnerState>;
279
+ M4LScrollBar: Partial<ScrollBarOwnerState>;
277
280
  M4LAreasAdmin: Partial<AreasAdminOwnerState>;
278
281
  M4LStack: Partial<StackOwnerState>;
279
282
  M4LDateTimePicker: Partial<DateTimePickerOwnerState>;
@@ -562,6 +565,10 @@ declare module '@mui/material/styles' {
562
565
  styleOverrides?: ComponentsOverrides<Theme>['M4LRHFSelect'];
563
566
  variants?: ComponentsVariants['M4LRHFSelect'];
564
567
  };
568
+ M4LScrollBar?: {
569
+ defaultProps?: ComponentsPropsList['M4LScrollBar'];
570
+ styleOverrides?: ComponentsOverrides<Theme>['M4LScrollBar'];
571
+ variants?: ComponentsVariants['M4LScrollBar'];
565
572
  M4LAreasAdmin?: {
566
573
  defaultProps?: ComponentsPropsList['M4LAreasAdmin'];
567
574
  styleOverrides?: ComponentsOverrides<Theme>['M4LAreasAdmin'];
@@ -583,5 +590,6 @@ declare module '@mui/material/styles' {
583
590
  styleOverrides?: ComponentsOverrides<Theme>['M4LDivider'];
584
591
  variants?: ComponentsVariants['M4LDivider'];
585
592
  };
593
+ }
586
594
  }
587
595
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { S as ScrollBar } from "../../../ScrollBar/index.js";
2
+ import { S as ScrollBar } from "../../../ScrollBar/ScrollBar.js";
3
3
  import { u as useAppliedFilters } from "./useAppliedFilters.js";
4
4
  import { g as AppliedFiltersStyled, h as AppliedFilterInnerContainerStyled } from "../../slots/dynamicFilterSlots.js";
5
5
  import { A as AppliedFilterChip } from "../AppliedFilterChip/AppliedFilterChip.js";
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { useNetwork } from "@m4l/core";
4
4
  import { useHostTheme } from "@m4l/graphics";
5
5
  import ReactJson from "@microlink/react-json-view";
6
- import { S as ScrollBar } from "../../../ScrollBar/index.js";
6
+ import { S as ScrollBar } from "../../../ScrollBar/ScrollBar.js";
7
7
  function DetailDialog(props) {
8
8
  const { log_id } = props;
9
9
  const { networkOperation } = useNetwork();
@@ -1,7 +1,4 @@
1
- import { ReactElement } from 'react';
2
- interface ScrollBarProps {
3
- children?: ReactElement;
4
- }
1
+ import { ScrollBarProps } from './types';
5
2
  /**
6
3
  * TODO: Documentar
7
4
  */
@@ -0,0 +1,46 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Box } from "@mui/material";
3
+ import { useIsMobile } from "@m4l/graphics";
4
+ import clsx from "clsx";
5
+ import { c as classScrollRoot, S as SCROLL_KEY_COMPONENT } from "./constants.js";
6
+ import { g as getPropDataTestId } from "../../test/getNameDataTestId.js";
7
+ import { R as RootScrollBar, S as SimpleBarStyled } from "./slots/ScrollBarSlots.js";
8
+ import { S as ScrollBarSlots } from "./slots/ScrollBarEnum.js";
9
+ function ScrollBar(props) {
10
+ const {
11
+ orientation,
12
+ children,
13
+ className,
14
+ dataTestId
15
+ } = props;
16
+ const isMobile = useIsMobile();
17
+ const ownerState = {
18
+ orientation,
19
+ children
20
+ };
21
+ if (isMobile) {
22
+ return /* @__PURE__ */ jsx(Box, { sx: { overflowX: "auto", width: "100%" }, children });
23
+ }
24
+ return /* @__PURE__ */ jsx(
25
+ RootScrollBar,
26
+ {
27
+ ownerState: { ...ownerState },
28
+ id: "RootStyle",
29
+ className: clsx(classScrollRoot, className),
30
+ ...getPropDataTestId(SCROLL_KEY_COMPONENT, ScrollBarSlots.root, dataTestId),
31
+ children: /* @__PURE__ */ jsx(
32
+ SimpleBarStyled,
33
+ {
34
+ orientation: props.orientation,
35
+ autoHide: false,
36
+ ownerState: {},
37
+ className: "simplebar",
38
+ children
39
+ }
40
+ )
41
+ }
42
+ );
43
+ }
44
+ export {
45
+ ScrollBar as S
46
+ };
@@ -0,0 +1,2 @@
1
+ import { ScrollBarStyles } from './types';
2
+ export declare const scrollBarStyles: ScrollBarStyles;
@@ -0,0 +1,65 @@
1
+ import "simplebar-react/dist/simplebar.min.css";
2
+ const scrollBarStyles = {
3
+ /**
4
+ * 👾 Estilos para el Componente ScrollBar 👾
5
+ */
6
+ root: ({ theme }) => ({
7
+ flexGrow: "1",
8
+ width: "100%",
9
+ height: "100%",
10
+ overflow: "hidden",
11
+ minHeight: "inherit",
12
+ "& .simplebar-scrollbar.simplebar-visible:before": {
13
+ opacity: "1"
14
+ },
15
+ '& .simplebar-content-wrapper[style*="overflow: hidden scroll;"] .simplebar-content': {},
16
+ '& .simplebar-content-wrapper[style*="overflow: scroll hidden;"] .simplebar-content': {
17
+ marginBottom: "9px"
18
+ },
19
+ "& .simplebar-track.simplebar-horizontal .simplebar-scrollbar:before": {
20
+ backgroundColor: theme.vars.palette.default.focusOpacity,
21
+ borderRadius: "2px",
22
+ height: "5px"
23
+ },
24
+ "& .simplebar-track.simplebar-vertical .simplebar-scrollbar:before": {
25
+ background: theme.vars.palette.general.scrollBar,
26
+ borderRadius: "2px"
27
+ }
28
+ }),
29
+ /**
30
+ * 👾 Estilos para el Componente ScrollBar 👾
31
+ */
32
+ scrollBar: () => ({
33
+ height: "100%",
34
+ "& .simplebar-scrollbar": {
35
+ "&:before": {
36
+ // backgroundColor: alpha(theme.colorSchemes.finalTheme.palette.grey[600], 0.48),
37
+ },
38
+ "&.simplebar-visible:before": {
39
+ opacity: 1
40
+ }
41
+ },
42
+ "& .simplebar-track.simplebar-vertical": {
43
+ width: 10
44
+ },
45
+ "& .simplebar-track.simplebar-horizontal .simplebar-scrollbar": {
46
+ height: 6
47
+ },
48
+ "& .simplebar-mask": {
49
+ zIndex: "inherit"
50
+ },
51
+ "& .simplebar-content": {
52
+ display: "flex",
53
+ flexDirection: "column",
54
+ height: "100%"
55
+ },
56
+ '& .simplebar-content-wrapper[style*="overflow: hidden scroll;"] ': {
57
+ "& .simplebar-content": {
58
+ marginRight: "12px"
59
+ }
60
+ }
61
+ })
62
+ };
63
+ export {
64
+ scrollBarStyles as s
65
+ };
@@ -0,0 +1,2 @@
1
+ export declare const SCROLL_KEY_COMPONENT = "M4LScrollBar";
2
+ export declare const classScrollRoot: string;
@@ -0,0 +1,7 @@
1
+ import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
2
+ const SCROLL_KEY_COMPONENT = "M4LScrollBar";
3
+ const classScrollRoot = getComponentSlotRoot(SCROLL_KEY_COMPONENT);
4
+ export {
5
+ SCROLL_KEY_COMPONENT as S,
6
+ classScrollRoot as c
7
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum ScrollBarSlots {
2
+ root = "root",
3
+ scrollBar = "scrollBar"
4
+ }
@@ -0,0 +1,8 @@
1
+ var ScrollBarSlots = /* @__PURE__ */ ((ScrollBarSlots2) => {
2
+ ScrollBarSlots2["root"] = "root";
3
+ ScrollBarSlots2["scrollBar"] = "scrollBar";
4
+ return ScrollBarSlots2;
5
+ })(ScrollBarSlots || {});
6
+ export {
7
+ ScrollBarSlots as S
8
+ };
@@ -0,0 +1,6 @@
1
+ export declare const RootScrollBar: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').ScrollBarProps> & Record<string, unknown> & {
2
+ ownerState: Partial<import('../types').ScrollBarProps> & Record<string, unknown>;
3
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
4
+ export declare const SimpleBarStyled: import('@emotion/styled').StyledComponent<Pick<import('simplebar-react').Props & import('react').RefAttributes<import('simplebar-core').default | null>, keyof import('simplebar-react').Props | keyof import('react').RefAttributes<import('simplebar-core').default | null>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').ScrollBarProps> & Record<string, unknown> & {
5
+ ownerState: Partial<import('../types').ScrollBarProps> & Record<string, unknown>;
6
+ }, {}, {}>;
@@ -0,0 +1,17 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import SimpleBarReact from "simplebar-react";
3
+ import { S as SCROLL_KEY_COMPONENT } from "../constants.js";
4
+ import { S as ScrollBarSlots } from "./ScrollBarEnum.js";
5
+ import { s as scrollBarStyles } from "../ScrollBar.styles.js";
6
+ const RootScrollBar = styled("div", {
7
+ name: SCROLL_KEY_COMPONENT,
8
+ slot: ScrollBarSlots.root
9
+ })(scrollBarStyles?.root);
10
+ const SimpleBarStyled = styled(SimpleBarReact, {
11
+ name: SCROLL_KEY_COMPONENT,
12
+ slot: ScrollBarSlots.scrollBar
13
+ })(scrollBarStyles?.scrollBar);
14
+ export {
15
+ RootScrollBar as R,
16
+ SimpleBarStyled as S
17
+ };
@@ -0,0 +1,2 @@
1
+ export * from './ScrollBarSlots';
2
+ export * from './ScrollBarEnum';
@@ -1,7 +1,49 @@
1
- import { SxProps } from '@mui/material';
1
+ import { SxProps, Theme } from '@mui/material';
2
2
  import { ReactNode } from 'react';
3
3
  import { Props as SimpleProps } from 'simplebar-react';
4
+ import { SCROLL_KEY_COMPONENT } from './constants';
5
+ import { OverridesStyleRules } from '@mui/material/styles/overrides';
6
+ import { ScrollBarSlots } from './slots';
7
+ /**
8
+ * Props for the ScrollBar component.
9
+ */
4
10
  export interface ScrollBarProps extends SimpleProps {
11
+ /**
12
+ * The content of the ScrollBar.
13
+ */
5
14
  children: ReactNode;
15
+ /**
16
+ * The system prop that allows defining system overrides as well as additional CSS styles.
17
+ */
6
18
  sx?: SxProps;
19
+ /**
20
+ * The orientation of the ScrollBar.
21
+ * @default 'vertical'
22
+ */
23
+ orientation?: 'vertical' | 'horizontal';
24
+ /**
25
+ * The class name of the ScrollBar.
26
+ */
27
+ className?: string;
28
+ /**
29
+ * The data-testid attribute for testing purposes.
30
+ */
31
+ dataTestId?: string;
7
32
  }
33
+ /**
34
+ * The owner state for the ScrollBar component.
35
+ */
36
+ export type ownerState = ScrollBarProps;
37
+ /**
38
+ * The owner state for the ScrollBar component.
39
+ * @deprecated This type is redundant and can be removed.
40
+ */
41
+ export type ScrollBarOwnerState = ScrollBarProps & {};
42
+ /**
43
+ * The type for the ScrollBar slots.
44
+ */
45
+ export type ScrollBarSlotsType = keyof typeof ScrollBarSlots;
46
+ /**
47
+ * The styles for the ScrollBar component.
48
+ */
49
+ export type ScrollBarStyles = OverridesStyleRules<ScrollBarSlots, typeof SCROLL_KEY_COMPONENT, Theme>;
@@ -5,7 +5,6 @@ import clsx from "clsx";
5
5
  import { A as AreaChip } from "./subcomponents/AreaChip/AreaChip.js";
6
6
  import { shallow } from "zustand/shallow";
7
7
  import { I as ICONS } from "../../icons.js";
8
- import { S as ScrollBar } from "../../../ScrollBar/index.js";
9
8
  import { A as AreaChipMobile } from "./subcomponents/AreaChipMobile/AreaChipMobile.js";
10
9
  import { useRef } from "react";
11
10
  import { g as getAreasDictionary, A as AREAS_DICCTIONARY } from "../../dictionary.js";
@@ -14,6 +13,7 @@ import { useIsMobile } from "@m4l/graphics";
14
13
  import { A as AREAS_ADMIN_KEY_COMPONENT } from "./constants.js";
15
14
  import { a as getComponentSlotRoot } from "../../../../utils/getComponentSlotRoot.js";
16
15
  import { g as getPropDataTestId } from "../../../../test/getNameDataTestId.js";
16
+ import { S as ScrollBar } from "../../../ScrollBar/ScrollBar.js";
17
17
  import { u as useComponentSize } from "../../../../hooks/useComponentSize/useComponentSize.js";
18
18
  import { T as Typography } from "../../../mui_extended/Typography/Typography.js";
19
19
  import { A as AreasAdminSlots } from "./slots/AreasAdminEnum.js";
@@ -41,7 +41,7 @@ export * from './PropertyValue/PropertyValue';
41
41
  export * from './MenuActions';
42
42
  export type { MenuAction, ComponentActionProps } from './MenuActions/types';
43
43
  export * from './extended/React-Resizable';
44
- export * from './ScrollBar';
44
+ export * from './ScrollBar/ScrollBar';
45
45
  export { ScrollToTop } from './ScrollToTop';
46
46
  export * from './extended/React-Splitter/SplitLayout/SplitLayout';
47
47
  export * from './ToastContainer';
package/index.js CHANGED
@@ -130,7 +130,7 @@ import { a as a9 } from "./components/MenuActions/dictionary.js";
130
130
  import { a as a10, M as M11 } from "./components/MenuActions/MenuActions.js";
131
131
  import { R as R16 } from "./components/extended/React-Resizable/Resizable/Resizable.js";
132
132
  import { R as R17 } from "./components/extended/React-Resizable/ResizableBox/ResizableBox.js";
133
- import { S as S3 } from "./components/ScrollBar/index.js";
133
+ import { S as S3 } from "./components/ScrollBar/ScrollBar.js";
134
134
  import { S as S4 } from "./components/extended/React-Splitter/SplitLayout/SplitLayout.js";
135
135
  import { T as T3 } from "./components/ToastContainer/ToastContainer.js";
136
136
  import { T as T4 } from "./components/ToastContainer/subcomponents/ToastMessage/ToastMessage.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.95",
3
+ "version": "9.1.96",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
@@ -1 +0,0 @@
1
- export declare const componentName = "M4LScrollBar";
@@ -1,4 +0,0 @@
1
- const componentName = "M4LScrollBar";
2
- export {
3
- componentName as c
4
- };
@@ -1,9 +0,0 @@
1
- import { ScrollBarClassesType } from './types';
2
- export declare const scrollBarClasses: ScrollBarClassesType;
3
- export declare function getScrollBarUtilityClass(slot: string): string;
4
- /**
5
- * TODO: Documentar
6
- */
7
- export declare const getScrollBarUtilityClasses: () => {
8
- root: string;
9
- };
@@ -1,23 +0,0 @@
1
- import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
2
- import { unstable_composeClasses } from "@mui/base";
3
- import { c as componentName } from "./constants.js";
4
- generateUtilityClasses(componentName, [
5
- /* elements */
6
- "root"
7
- /* states or variants of elements */
8
- ]);
9
- function getScrollBarUtilityClass(slot) {
10
- return generateUtilityClass(componentName, slot);
11
- }
12
- const getScrollBarUtilityClasses = () => {
13
- const slots = {
14
- root: ["root"]
15
- };
16
- const composedClasses = unstable_composeClasses(slots, getScrollBarUtilityClass, {});
17
- return {
18
- ...composedClasses
19
- };
20
- };
21
- export {
22
- getScrollBarUtilityClasses as g
23
- };
@@ -1,6 +0,0 @@
1
- import { getScrollBarUtilityClasses } from '.';
2
- export interface ScrollBarClassesType {
3
- root: string;
4
- }
5
- export type StackClassesKey = keyof ScrollBarClassesType;
6
- export type ScrollBarClasses = ReturnType<typeof getScrollBarUtilityClasses>;
@@ -1,17 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Box } from "@mui/material";
3
- import { R as RootStyle, S as SimpleBarStyle } from "./styles.js";
4
- import { g as getScrollBarUtilityClasses } from "./classes/index.js";
5
- function ScrollBar(props) {
6
- const { children } = props;
7
- const userAgent = typeof navigator === "undefined" ? "SSR" : navigator.userAgent;
8
- const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
9
- if (isMobile) {
10
- return /* @__PURE__ */ jsx(Box, { sx: { overflowX: "auto", width: "100%" }, children });
11
- }
12
- const classes = getScrollBarUtilityClasses();
13
- return /* @__PURE__ */ jsx(RootStyle, { id: "RootStyle", className: classes.root, children: /* @__PURE__ */ jsx(SimpleBarStyle, { autoHide: false, children }) });
14
- }
15
- export {
16
- ScrollBar as S
17
- };
@@ -1,3 +0,0 @@
1
- export declare const RootStyle: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
2
- export declare const SimpleBarStyle: import('@emotion/styled').StyledComponent<import('simplebar-react').Props & import('react').RefAttributes<import('simplebar-core').default | null> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, {}, {}>;
3
- export declare const SimpleBarStyle2: import('@emotion/styled').StyledComponent<import('simplebar-react').Props & import('react').RefAttributes<import('simplebar-core').default | null> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, {}, {}>;
@@ -1,46 +0,0 @@
1
- import { styled, alpha } from "@mui/material/styles";
2
- import SimpleBarReact from "simplebar-react";
3
- import "simplebar-react/dist/simplebar.min.css";
4
- const RootStyle = styled("div")(({ theme }) => ({
5
- flexGrow: "1",
6
- height: "100%",
7
- overflow: "hidden",
8
- ...theme.components?.M4LScrollBar?.styleOverrides || {}
9
- }));
10
- const SimpleBarStyle = styled(SimpleBarReact)`
11
- height: 100%;
12
- `;
13
- styled(SimpleBarReact)(({ theme }) => ({
14
- height: "100%",
15
- "& .simplebar-scrollbar": {
16
- "&:before": {
17
- backgroundColor: alpha(theme.colorSchemes.finalTheme.palette.grey[600], 0.48)
18
- },
19
- "&.simplebar-visible:before": {
20
- opacity: 1
21
- }
22
- },
23
- "& .simplebar-track.simplebar-vertical": {
24
- width: 10
25
- },
26
- "& .simplebar-track.simplebar-horizontal .simplebar-scrollbar": {
27
- height: 6
28
- },
29
- "& .simplebar-mask": {
30
- zIndex: "inherit"
31
- },
32
- "& .simplebar-content": {
33
- display: "flex",
34
- flexDirection: "column",
35
- height: "100%"
36
- },
37
- '& .simplebar-content-wrapper[style*="overflow: hidden scroll;"] ': {
38
- "& .simplebar-content": {
39
- marginRight: "12px"
40
- }
41
- }
42
- }));
43
- export {
44
- RootStyle as R,
45
- SimpleBarStyle as S
46
- };