@m4l/components 9.1.7 → 9.1.8

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.
@@ -4,7 +4,7 @@ import { u as useSplitLayoutUtilityClasses } from "./classes/index.js";
4
4
  import clsx from "clsx";
5
5
  import { T as TEST_PROP_ID } from "../../test/constants_no_mock.js";
6
6
  import { g as getNameSplitLayoutDataTestId } from "./tests/utils.js";
7
- import { S as SplitterLayout } from "../../node_modules/react-splitter-layout.js";
7
+ import { S as SplitterLayout } from "../../internal_libs/react-splitter-layout.js";
8
8
  function SplitLayout(props) {
9
9
  const {
10
10
  splitPosition,
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { R as RootStyled, P as PopperStyled, T as ToolipStyled } from "./slots/TooltipSlots.js";
2
+ import { R as RootStyled, T as ToolipStyled } from "./slots/TooltipSlots.js";
3
3
  import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
4
4
  const Tooltip = (props) => {
5
5
  const { size, children, ...others } = props;
@@ -8,13 +8,11 @@ const Tooltip = (props) => {
8
8
  RootStyled,
9
9
  {
10
10
  ownerState: { size: currentSize },
11
- size: currentSize,
12
- components: {},
13
11
  ...others,
14
- slots: { popper: PopperStyled, tooltip: ToolipStyled },
12
+ slots: { tooltip: ToolipStyled },
15
13
  slotProps: {
16
14
  // @ts-ignore ownerState ignorado porque sobre escribe en tipos del styled
17
- popper: { ownerState: { size: currentSize } }
15
+ //popper: { ownerState: { size: currentSize } },
18
16
  },
19
17
  children
20
18
  }
@@ -1,61 +1,17 @@
1
1
  const tooltipStyles = {
2
- root: {},
3
- popper: {
4
- padding: "8px 12px"
5
- },
2
+ root: ({}) => ({}),
6
3
  /**
7
- * TODO: Documentar
4
+ * Estilos del componente Tooltip
8
5
  */
9
- tooltip: ({ theme, ownerState }) => ({
10
- display: "flex",
11
- alignItems: "center",
6
+ tooltip: ({ theme }) => ({
12
7
  background: theme.vars.palette.background.default,
13
- borderRadius: "2px",
8
+ padding: theme.vars.size.baseSpacings.sp2,
9
+ borderRadius: theme.vars.size.borderRadius.r1,
14
10
  boxShadow: theme.vars.customShadows.z3,
15
- width: "fit-content",
16
- color: theme.vars.palette.text.primary,
17
- ...theme.colorSchemes.finalTheme.typography.body,
18
- letterSpacing: "0.4px",
19
- minHeight: "32px",
20
- height: "32px",
21
- padding: "8px 12px",
22
- ...ownerState.size === "large" && {
23
- ...theme.generalSettings.isMobile ? {
24
- minHeight: "36px !important",
25
- height: "36px !important",
26
- fontSize: "16px !important",
27
- lineHeight: "28px !important"
28
- } : {
29
- minHeight: "28px !important",
30
- height: "28px !important",
31
- fontSize: "14px !important",
32
- lineHeight: "24px !important"
33
- }
34
- },
35
- ...ownerState.size === "medium" && {
36
- ...theme.generalSettings.isMobile ? {
37
- minHeight: "32px !important",
38
- height: "32px !important",
39
- fontSize: "14px !important",
40
- lineHeight: "17px !important"
41
- } : {
42
- minHeight: "24px !important",
43
- height: "24px !important",
44
- fontSize: "11px !important",
45
- lineHeight: "13px !important"
46
- }
47
- },
48
- ...ownerState.size === "small" && {
49
- ...theme.generalSettings.isMobile ? {
50
- minHeight: "28px !important",
51
- height: "28px !important",
52
- fontSize: "13px !important",
53
- lineHeight: "16px !important"
54
- } : {
55
- minHeight: "20px !important",
56
- height: "20px !important",
57
- fontSize: "10px !important",
58
- lineHeight: "12px !important"
11
+ ".MuiTooltip-arrow": {
12
+ "&::before": {
13
+ backgroundColor: theme.vars.palette.background.default,
14
+ borderRadius: theme.vars.size.borderRadius["r0-5"]
59
15
  }
60
16
  }
61
17
  })
@@ -7,7 +7,7 @@ const RootStyled = styled(Tooltip, {
7
7
  name: TOOLTIP_KEY_COMPONENT,
8
8
  slot: TooltipSlots.root
9
9
  })(tooltipStyles?.root);
10
- const PopperStyled = styled(Popper, {
10
+ styled(Popper, {
11
11
  name: TOOLTIP_KEY_COMPONENT,
12
12
  slot: TooltipSlots.popper
13
13
  })(tooltipStyles?.popper);
@@ -16,7 +16,6 @@ const ToolipStyled = styled("div", {
16
16
  slot: TooltipSlots.tooltip
17
17
  })(tooltipStyles?.tooltip);
18
18
  export {
19
- PopperStyled as P,
20
19
  RootStyled as R,
21
20
  ToolipStyled as T
22
21
  };
@@ -3,12 +3,21 @@ import { OverridesStyleRules } from '@mui/material/styles/overrides';
3
3
  import { TooltipSlots } from './slots';
4
4
  import { TOOLTIP_KEY_COMPONENT } from './constants';
5
5
  import { Sizes } from '@m4l/styles';
6
+ import { ArrowType } from '../Popover/types';
6
7
  export interface TooltipProps extends Omit<MUITooltipProps, 'sx'> {
7
8
  sx?: SxProps<Theme> | Partial<OverridesStyleRules<string, ComponentNameToClassKey, Theme>>;
8
9
  /**
9
10
  * Tamaño del componente, puede ser uno de los valores definidos en 'small' , 'medium' , 'large'.
10
11
  */
11
12
  size?: Sizes;
13
+ /**
14
+ * Tipo de flecha que se mostrará en el tooltip.
15
+ */
16
+ arrowType?: ArrowType;
17
+ /**
18
+ * Define la posición general del tooltip en relación con el elemento de referencia.
19
+ */
20
+ placement?: MUITooltipProps['placement'];
12
21
  }
13
22
  export type TooltipSlotsType = keyof typeof TooltipSlots;
14
23
  export type TooltipOwnerState = TooltipProps;
@@ -0,0 +1,158 @@
1
+ import { g as getDefaultExportFromCjs } from "../commonjs/index.js";
2
+ import require$$0 from "prop-types";
3
+ import React from "react";
4
+ var lib = { exports: {} };
5
+ (function(module, exports) {
6
+ !function(e, t) {
7
+ module.exports = t(require$$0, React);
8
+ }(window, function(e, t) {
9
+ return function(e2) {
10
+ var t2 = {};
11
+ function n(o) {
12
+ if (t2[o]) return t2[o].exports;
13
+ var r = t2[o] = { i: o, l: false, exports: {} };
14
+ return e2[o].call(r.exports, r, r.exports, n), r.l = true, r.exports;
15
+ }
16
+ return n.m = e2, n.c = t2, n.d = function(e3, t3, o) {
17
+ n.o(e3, t3) || Object.defineProperty(e3, t3, { enumerable: true, get: o });
18
+ }, n.r = function(e3) {
19
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e3, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e3, "__esModule", { value: true });
20
+ }, n.t = function(e3, t3) {
21
+ if (1 & t3 && (e3 = n(e3)), 8 & t3) return e3;
22
+ if (4 & t3 && "object" == typeof e3 && e3 && e3.__esModule) return e3;
23
+ var o = /* @__PURE__ */ Object.create(null);
24
+ if (n.r(o), Object.defineProperty(o, "default", { enumerable: true, value: e3 }), 2 & t3 && "string" != typeof e3) for (var r in e3) n.d(o, r, function(t4) {
25
+ return e3[t4];
26
+ }.bind(null, r));
27
+ return o;
28
+ }, n.n = function(e3) {
29
+ var t3 = e3 && e3.__esModule ? function() {
30
+ return e3.default;
31
+ } : function() {
32
+ return e3;
33
+ };
34
+ return n.d(t3, "a", t3), t3;
35
+ }, n.o = function(e3, t3) {
36
+ return Object.prototype.hasOwnProperty.call(e3, t3);
37
+ }, n.p = "", n(n.s = 2);
38
+ }([function(t2, n) {
39
+ t2.exports = e;
40
+ }, function(e2, n) {
41
+ e2.exports = t;
42
+ }, function(e2, t2, n) {
43
+ e2.exports = n(3);
44
+ }, function(e2, t2, n) {
45
+ n.r(t2);
46
+ var o = n(1), r = n.n(o), i = n(0), a = n.n(i);
47
+ function s(e3) {
48
+ var t3 = e3.size || 0, n2 = e3.percentage ? "%" : "px", o2 = "layout-pane", i2 = {};
49
+ return e3.primary ? o2 += " layout-pane-primary" : e3.vertical ? i2.height = "".concat(t3).concat(n2) : i2.width = "".concat(t3).concat(n2), r.a.createElement("div", { className: o2, style: i2 }, e3.children);
50
+ }
51
+ s.propTypes = { vertical: a.a.bool, primary: a.a.bool, size: a.a.number, percentage: a.a.bool, children: a.a.oneOfType([a.a.arrayOf(a.a.node), a.a.node]) }, s.defaultProps = { vertical: false, primary: false, size: 0, percentage: false, children: [] };
52
+ var c = s;
53
+ function l(e3) {
54
+ return (l = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e4) {
55
+ return typeof e4;
56
+ } : function(e4) {
57
+ return e4 && "function" == typeof Symbol && e4.constructor === Symbol && e4 !== Symbol.prototype ? "symbol" : typeof e4;
58
+ })(e3);
59
+ }
60
+ function u(e3, t3) {
61
+ for (var n2 = 0; n2 < t3.length; n2++) {
62
+ var o2 = t3[n2];
63
+ o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e3, o2.key, o2);
64
+ }
65
+ }
66
+ function p(e3) {
67
+ return (p = Object.setPrototypeOf ? Object.getPrototypeOf : function(e4) {
68
+ return e4.__proto__ || Object.getPrototypeOf(e4);
69
+ })(e3);
70
+ }
71
+ function d(e3, t3) {
72
+ return (d = Object.setPrototypeOf || function(e4, t4) {
73
+ return e4.__proto__ = t4, e4;
74
+ })(e3, t3);
75
+ }
76
+ function h(e3) {
77
+ if (void 0 === e3) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
78
+ return e3;
79
+ }
80
+ function f() {
81
+ if (document.body.createTextRange) {
82
+ var e3 = document.body.createTextRange();
83
+ e3.collapse(), e3.select();
84
+ } else window.getSelection ? window.getSelection().empty ? window.getSelection().empty() : window.getSelection().removeAllRanges && window.getSelection().removeAllRanges() : document.selection && document.selection.empty();
85
+ }
86
+ var y = function(e3) {
87
+ function t3(e4) {
88
+ var n3, o3, r2;
89
+ return function(e5, t4) {
90
+ if (!(e5 instanceof t4)) throw new TypeError("Cannot call a class as a function");
91
+ }(this, t3), o3 = this, (n3 = !(r2 = p(t3).call(this, e4)) || "object" !== l(r2) && "function" != typeof r2 ? h(o3) : r2).handleResize = n3.handleResize.bind(h(h(n3))), n3.handleMouseMove = n3.handleMouseMove.bind(h(h(n3))), n3.handleMouseUp = n3.handleMouseUp.bind(h(h(n3))), n3.handleTouchMove = n3.handleTouchMove.bind(h(h(n3))), n3.handleSplitterMouseDown = n3.handleSplitterMouseDown.bind(h(h(n3))), n3.state = { secondaryPaneSize: 0, resizing: false }, n3;
92
+ }
93
+ var n2, o2;
94
+ return function(e4, t4) {
95
+ if ("function" != typeof t4 && null !== t4) throw new TypeError("Super expression must either be null or a function");
96
+ e4.prototype = Object.create(t4 && t4.prototype, { constructor: { value: e4, writable: true, configurable: true } }), t4 && d(e4, t4);
97
+ }(t3, r.a.Component), n2 = t3, (o2 = [{ key: "componentDidMount", value: function() {
98
+ var e4;
99
+ if (window.addEventListener("resize", this.handleResize), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchend", this.handleMouseUp), document.addEventListener("touchmove", this.handleTouchMove), void 0 !== this.props.secondaryInitialSize) e4 = this.props.secondaryInitialSize;
100
+ else {
101
+ var t4, n3 = this.container.getBoundingClientRect();
102
+ t4 = this.splitter ? this.splitter.getBoundingClientRect() : { width: 4, height: 4 }, e4 = this.getSecondaryPaneSize(n3, t4, { left: n3.left + (n3.width - t4.width) / 2, top: n3.top + (n3.height - t4.height) / 2 }, false);
103
+ }
104
+ this.setState({ secondaryPaneSize: e4 });
105
+ } }, { key: "componentDidUpdate", value: function(e4, t4) {
106
+ t4.secondaryPaneSize !== this.state.secondaryPaneSize && this.props.onSecondaryPaneSizeChange && this.props.onSecondaryPaneSizeChange(this.state.secondaryPaneSize), t4.resizing !== this.state.resizing && (this.state.resizing ? this.props.onDragStart && this.props.onDragStart() : this.props.onDragEnd && this.props.onDragEnd());
107
+ } }, { key: "componentWillUnmount", value: function() {
108
+ window.removeEventListener("resize", this.handleResize), document.removeEventListener("mouseup", this.handleMouseUp), document.removeEventListener("mousemove", this.handleMouseMove), document.removeEventListener("touchend", this.handleMouseUp), document.removeEventListener("touchmove", this.handleTouchMove);
109
+ } }, { key: "getSecondaryPaneSize", value: function(e4, t4, n3, o3) {
110
+ var r2, i2, a2, s2;
111
+ this.props.vertical ? (r2 = e4.height, i2 = t4.height, a2 = n3.top - e4.top) : (r2 = e4.width, i2 = t4.width, a2 = n3.left - e4.left), o3 && (a2 -= i2 / 2), a2 < 0 ? a2 = 0 : a2 > r2 - i2 && (a2 = r2 - i2);
112
+ var c2 = r2 - i2 - (s2 = 1 === this.props.primaryIndex ? a2 : r2 - i2 - a2);
113
+ return this.props.percentage && (s2 = 100 * s2 / r2, c2 = 100 * c2 / r2, i2 = 100 * i2 / r2, r2 = 100), c2 < this.props.primaryMinSize ? s2 = Math.max(s2 - (this.props.primaryMinSize - c2), 0) : s2 < this.props.secondaryMinSize && (s2 = Math.min(r2 - i2 - this.props.primaryMinSize, this.props.secondaryMinSize)), s2;
114
+ } }, { key: "handleResize", value: function() {
115
+ if (this.splitter && !this.props.percentage) {
116
+ var e4 = this.container.getBoundingClientRect(), t4 = this.splitter.getBoundingClientRect(), n3 = this.getSecondaryPaneSize(e4, t4, { left: t4.left, top: t4.top }, false);
117
+ this.setState({ secondaryPaneSize: n3 });
118
+ }
119
+ } }, { key: "handleMouseMove", value: function(e4) {
120
+ if (this.state.resizing) {
121
+ var t4 = this.container.getBoundingClientRect(), n3 = this.splitter.getBoundingClientRect(), o3 = this.getSecondaryPaneSize(t4, n3, { left: e4.clientX, top: e4.clientY }, true);
122
+ f(), this.setState({ secondaryPaneSize: o3 });
123
+ }
124
+ } }, { key: "handleTouchMove", value: function(e4) {
125
+ this.handleMouseMove(e4.changedTouches[0]);
126
+ } }, { key: "handleSplitterMouseDown", value: function() {
127
+ f(), this.setState({ resizing: true });
128
+ } }, { key: "handleMouseUp", value: function() {
129
+ this.setState(function(e4) {
130
+ return e4.resizing ? { resizing: false } : null;
131
+ });
132
+ } }, { key: "render", value: function() {
133
+ var e4 = this, t4 = "splitter-layout";
134
+ this.props.customClassName && (t4 += " ".concat(this.props.customClassName)), this.props.vertical && (t4 += " splitter-layout-vertical"), this.state.resizing && (t4 += " layout-changing");
135
+ var n3 = r.a.Children.toArray(this.props.children).slice(0, 2);
136
+ 0 === n3.length && n3.push(r.a.createElement("div", null));
137
+ for (var o3 = [], i2 = 0 !== this.props.primaryIndex && 1 !== this.props.primaryIndex ? 0 : this.props.primaryIndex, a2 = 0; a2 < n3.length; ++a2) {
138
+ var s2 = true, l2 = null;
139
+ n3.length > 1 && a2 !== i2 && (s2 = false, l2 = this.state.secondaryPaneSize), o3.push(r.a.createElement(c, { vertical: this.props.vertical, percentage: this.props.percentage, primary: s2, size: l2 }, n3[a2]));
140
+ }
141
+ return r.a.createElement("div", { className: t4, ref: function(t5) {
142
+ e4.container = t5;
143
+ } }, o3[0], o3.length > 1 && r.a.createElement("div", { role: "separator", className: "layout-splitter", ref: function(t5) {
144
+ e4.splitter = t5;
145
+ }, onMouseDown: this.handleSplitterMouseDown, onTouchStart: this.handleSplitterMouseDown }), o3.length > 1 && o3[1]);
146
+ } }]) && u(n2.prototype, o2), t3;
147
+ }();
148
+ y.propTypes = { customClassName: a.a.string, vertical: a.a.bool, percentage: a.a.bool, primaryIndex: a.a.number, primaryMinSize: a.a.number, secondaryInitialSize: a.a.number, secondaryMinSize: a.a.number, onDragStart: a.a.func, onDragEnd: a.a.func, onSecondaryPaneSizeChange: a.a.func, children: a.a.arrayOf(a.a.node) }, y.defaultProps = { customClassName: "", vertical: false, percentage: false, primaryIndex: 0, primaryMinSize: 0, secondaryInitialSize: void 0, secondaryMinSize: 0, onDragStart: null, onDragEnd: null, onSecondaryPaneSizeChange: null, children: [] };
149
+ var m = y;
150
+ t2.default = m;
151
+ }]);
152
+ });
153
+ })(lib);
154
+ var libExports = lib.exports;
155
+ const SplitterLayout = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
156
+ export {
157
+ SplitterLayout as S
158
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.7",
3
+ "version": "9.1.8",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
@@ -0,0 +1,29 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Tooltip } from '../../../../../src/components/mui_extended/Tooltip';
3
+ declare const meta: Meta<typeof Tooltip>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Tooltip>;
6
+ /** Bottom Center Predeterminado 👑 */
7
+ export declare const BottomCenter: Story;
8
+ /** Bottom Left */
9
+ export declare const BottomtLeft: Story;
10
+ /** Bottom Right */
11
+ export declare const BottomRight: Story;
12
+ /** Top Center */
13
+ export declare const TopCenter: Story;
14
+ /** Top Start */
15
+ export declare const TopStart: Story;
16
+ /** Top End */
17
+ export declare const TopEnd: Story;
18
+ /** Top End */
19
+ export declare const LeftStart: Story;
20
+ /** Left End */
21
+ export declare const LeftEnd: Story;
22
+ /** Left Center */
23
+ export declare const LeftCenter: Story;
24
+ /** Right Center */
25
+ export declare const RightCenter: Story;
26
+ /** Right Start */
27
+ export declare const RightStart: Story;
28
+ /** Right End */
29
+ export declare const RightEnd: Story;
@@ -1,25 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { Tooltip } from '.';
3
- declare const meta: Meta<typeof Tooltip>;
4
- export default meta;
5
- type Story = StoryObj<typeof Tooltip>;
6
- /**
7
- * Base Tooltip component
8
- */
9
- export declare const Base: Story;
10
- /**
11
- * Tooltip in large size
12
- */
13
- export declare const TooltipSizeLarge: Story;
14
- /**
15
- * Tooltip in medium size
16
- */
17
- export declare const TooltipSizeMedium: Story;
18
- /**
19
- * Tooltip in small size
20
- */
21
- export declare const TooltipSizeSmall: Story;
22
- /**
23
- * Tooltip in focus mode
24
- */
25
- export declare const TooltipWithTab: Story;