@m4l/components 9.1.47 → 9.1.48

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
@@ -128,7 +128,8 @@ import {
128
128
  import { SideBarOwnerState } from '../components/SideBar/types';
129
129
  import {
130
130
  PaperFormSlotsType,
131
- PaperFormOwnerState } from '../components/PaperForm/types';
131
+ PaperFormOwnerState,
132
+ } from '../components/PaperForm/types';
132
133
  import { WindowBaseOwnerState, WindowBaseType } from '../components/WindowBase';
133
134
  import { OwnerStateWindowConfirm, WindowConfirmType } from '../components/WindowConfirm';
134
135
  import { AppBarSlotsType, AppBarOwnerState } from '../components/AppBar/types';
@@ -147,6 +148,7 @@ import { BooleanFormatterOwnerState, PresentationType } from '../components/form
147
148
  import { ToggleIconButtonOwnerState, ToggleIconButtonSlotsType } from '../components/mui_extended/ToggleIconButton/types';
148
149
 
149
150
  import { PopoverOwnerState, PopoverSlotsType } from '../components/mui_extended/Popover/types';
151
+ import { PropertyVaLueOwnerState, PropertyValueType } from '../components/PropertyValue/types';
150
152
 
151
153
  declare module '@mui/material/styles' {
152
154
  // Define the slots in the theme
@@ -195,6 +197,7 @@ declare module '@mui/material/styles' {
195
197
  M4LToggleButton: ToggleButtonSlotsType;
196
198
  M4LBooleanFormatter: PresentationType;
197
199
  M4LToggleIconButton: ToggleIconButtonSlotsType;
200
+ M4LPropertyValue: PropertyValueType;
198
201
  }
199
202
 
200
203
  interface ComponentsPropsList {
@@ -243,6 +246,7 @@ declare module '@mui/material/styles' {
243
246
  M4LToggleButton: Partial<ToggleButtonOwnerState>;
244
247
  M4LBooleanFormatter: Partial<BooleanFormatterOwnerState>;
245
248
  M4LToggleIconButton: Partial<ToggleIconButtonOwnerState>;
249
+ M4LPropertyValue: Partial<PropertyVaLueOwnerState>;
246
250
  }
247
251
 
248
252
  interface Components {
@@ -535,31 +539,36 @@ declare module '@mui/material/styles' {
535
539
  defaultProps?: ComponentsPropsList['M4LAvatar'];
536
540
  styleOverrides?: ComponentsOverrides<Theme>['M4LAvatar'];
537
541
  variants?: ComponentsVariants['M4LAvatar'];
538
- M4LAccordion?: {
539
- defaultProps?: ComponentsPropsList['M4LAccordion'];
540
- styleOverrides?: ComponentsOverrides<Theme>['M4LAccordion'];
541
- variants?: ComponentsVariants['M4LAccordion'];
542
- };
543
- M4LPopper?: {
544
- defaultProps?: ComponentsPropsList['M4LPopper'];
545
- styleOverrides?: ComponentsOverrides<Theme>['M4LPopper'];
546
- variants?: ComponentsVariants['M4LPopper'];
547
- };
548
- M4LToggleButton?: {
549
- defaultProps?: ComponentsPropsList['M4LToggleButton'];
550
- styleOverrides?: ComponentsOverrides<Theme>['M4LToggleButton'];
551
- variants?: ComponentsVariants['M4LToggleButton'];
552
- };
553
- M4LBooleanFormatter?: {
554
- defaultProps?: ComponentsPropsList['M4LBooleanFormatter'];
555
- styleOverrides?: ComponentsOverrides<Theme>['M4LBooleanFormatter'];
556
- variants?: ComponentsVariants['M4LBooleanFormatter'];
557
- };
558
- M4LToggleIconButton?: {
559
- defaultProps?: ComponentsPropsList['M4LToggleIconButton'];
560
- styleOverrides?: ComponentsOverrides<Theme>['M4LToggleIconButton'];
561
- variants?: ComponentsVariants['M4LToggleIconButton'];
562
- };
542
+ M4LAccordion?: {
543
+ defaultProps?: ComponentsPropsList['M4LAccordion'];
544
+ styleOverrides?: ComponentsOverrides<Theme>['M4LAccordion'];
545
+ variants?: ComponentsVariants['M4LAccordion'];
546
+ };
547
+ M4LPopper?: {
548
+ defaultProps?: ComponentsPropsList['M4LPopper'];
549
+ styleOverrides?: ComponentsOverrides<Theme>['M4LPopper'];
550
+ variants?: ComponentsVariants['M4LPopper'];
551
+ };
552
+ M4LToggleButton?: {
553
+ defaultProps?: ComponentsPropsList['M4LToggleButton'];
554
+ styleOverrides?: ComponentsOverrides<Theme>['M4LToggleButton'];
555
+ variants?: ComponentsVariants['M4LToggleButton'];
556
+ };
557
+ M4LBooleanFormatter?: {
558
+ defaultProps?: ComponentsPropsList['M4LBooleanFormatter'];
559
+ styleOverrides?: ComponentsOverrides<Theme>['M4LBooleanFormatter'];
560
+ variants?: ComponentsVariants['M4LBooleanFormatter'];
561
+ };
562
+ M4LToggleIconButton?: {
563
+ defaultProps?: ComponentsPropsList['M4LToggleIconButton'];
564
+ styleOverrides?: ComponentsOverrides<Theme>['M4LToggleIconButton'];
565
+ variants?: ComponentsVariants['M4LToggleIconButton'];
566
+ M4LPropertyValue?: {
567
+ defaultProps?: ComponentsPropsList['M4LPropertyValue'];
568
+ styleOverrides?: ComponentsOverrides<Theme>['M4LPropertyValue'];
569
+ variants?: ComponentsVariants['M4LPropertyValue'];
570
+ };
571
+ }
572
+ }
563
573
  }
564
- }
565
574
  }
@@ -3,8 +3,8 @@ const labelStyles = {
3
3
  * Estilos para el contenedor raíz del Label.
4
4
  * @author Bruce Escobar - automatic
5
5
  * @createdAt 2024-10-22 09:34:39 - automatic
6
- * @updatedAt 2024-10-22 19:27:23 - automatic
7
- * @updatedUser Bruce Escobar - automatic
6
+ * @updatedAt 2024-12-30 12:00:12 - automatic
7
+ * @updatedUser cesar - automatic
8
8
  */
9
9
  root: ({ ownerState, theme }) => ({
10
10
  display: "flex",
@@ -37,11 +37,10 @@ const labelStyles = {
37
37
  * Estilos para el slot Typography.
38
38
  * @author Bruce Escobar - automatic
39
39
  * @createdAt 2024-10-22 09:34:39 - automatic
40
- * @updatedAt 2024-10-22 19:27:23 - automatic
41
- * @updatedUser Bruce Escobar - automatic
40
+ * @updatedAt 2024-12-30 12:00:12 - automatic
41
+ * @updatedUser cesar - automatic
42
42
  */
43
43
  typographyStyled: ({ theme, ownerState }) => ({
44
- marginInlineStart: theme.spacing(0.4),
45
44
  "& .MuiTypography-root": {
46
45
  color: theme.vars.palette.text.secondary,
47
46
  [theme.breakpoints.up("sm")]: {
@@ -59,11 +58,10 @@ const labelStyles = {
59
58
  * Estilos para el mensaje obligatorio.
60
59
  * @author Bruce Escobar - automatic
61
60
  * @createdAt 2024-10-22 09:34:39 - automatic
62
- * @updatedAt 2024-10-22 19:27:23 - automatic
63
- * @updatedUser Bruce Escobar - automatic
61
+ * @updatedAt 2024-12-30 12:00:12 - automatic
62
+ * @updatedUser cesar - automatic
64
63
  */
65
64
  typographyMandatoryMessageStyled: ({ theme, ownerState }) => ({
66
- marginInlineStart: theme.spacing(0.4),
67
65
  "& .MuiTypography-root": {
68
66
  color: theme.vars.palette.text.primary,
69
67
  [theme.breakpoints.up("sm")]: {
@@ -78,8 +76,8 @@ const labelStyles = {
78
76
  * Estilos para el icono del mensaje de ayuda.
79
77
  * @author Bruce Escobar - automatic
80
78
  * @createdAt 2024-10-22 09:34:39 - automatic
81
- * @updatedAt 2024-10-22 19:27:23 - automatic
82
- * @updatedUser Bruce Escobar - automatic
79
+ * @updatedAt 2024-12-30 12:00:12 - automatic
80
+ * @updatedUser cesar - automatic
83
81
  */
84
82
  iconHelperMessageStyled: ({ theme }) => ({
85
83
  height: "24px",
@@ -97,8 +95,8 @@ const labelStyles = {
97
95
  * Estilos para el componente Skeleton.
98
96
  * @author Bruce Escobar - automatic
99
97
  * @createdAt 2024-10-22 09:34:39 - automatic
100
- * @updatedAt 2024-10-22 19:27:23 - automatic
101
- * @updatedUser Bruce Escobar - automatic
98
+ * @updatedAt 2024-12-30 12:00:12 - automatic
99
+ * @updatedUser cesar - automatic
102
100
  */
103
101
  skeletonStyled: ({ ownerState, theme }) => ({
104
102
  // borderRadius:theme.vars.size.borderRadius.r1,
@@ -1,5 +1,9 @@
1
1
  import { PropertyValueProps } from './types';
2
2
  /**
3
- * TODO: Documentar
3
+ * PropertyValue component is used to display a property and its value in a form or not.
4
+ * @author cesar - automatic
5
+ * @createdAt 2024-12-19 14:44:17 - automatic
6
+ * @updatedAt 2024-12-30 09:30:27 - automatic
7
+ * @updatedUser cesar - automatic
4
8
  */
5
9
  export declare function PropertyValue(props: PropertyValueProps): import("react/jsx-runtime").JSX.Element;
@@ -1,195 +1,82 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { P as PropertyValueRoot } from "./styles.js";
3
- import { useResponsiveDesktop } from "@m4l/graphics";
4
- import { p as propertyValueUtilityClasses } from "./classes/index.js";
5
2
  import clsx from "clsx";
6
3
  import { T as TEST_PROP_ID } from "../../test/constants_no_mock.js";
7
- import { T as TEST_PROPS_DATA, C as COMPONENT_PREFIX } from "./constants.js";
8
- import { g as getNameDataTestId } from "../../test/getNameDataTestId.js";
4
+ import { T as TEST_PROPS_DATA, P as PROPERTY_VALUE_KEY_COMPONENT, C as COMPONENT_PREFIX } from "./constants.js";
5
+ import { a as getPropDataTestId, g as getNameDataTestId } from "../../test/getNameDataTestId.js";
6
+ import { P as PropertyValueRootStyled, a as PropertyStyled, V as ValueStyled } from "./slots/PropertyValueSlots.js";
7
+ import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
9
8
  import { L as Label } from "../Label/Label.js";
9
+ import { T as Typography } from "../mui_extended/Typography/Typography.js";
10
10
  import { I as Icon } from "../Icon/Icon.js";
11
11
  function PropertyValue(props) {
12
12
  const {
13
13
  property,
14
- iconProperty,
14
+ startAdornment,
15
15
  value,
16
- propertyWidth = 200,
17
- valueHeight = "auto",
18
- valueWidth = "100",
19
- valueWidthMobile,
20
- isForm,
21
16
  className,
17
+ isForm,
22
18
  dataTestId = "",
23
19
  disabled = false,
24
20
  mandatory,
25
21
  mandatoryMessage,
26
- helperMessage
22
+ helperMessage,
23
+ semanticWidth = "fullWidth"
27
24
  } = props;
28
- const isDesktop = useResponsiveDesktop();
29
- const getValueW = () => {
30
- if (valueWidthMobile && !isDesktop) {
31
- return valueWidthMobile;
32
- }
33
- if (valueWidth === 75 && isDesktop) {
34
- return 75;
35
- } else if (valueWidth === 75 && !isDesktop) {
36
- return 100;
37
- }
38
- if (valueWidth === 50 && isDesktop) {
39
- return 50;
40
- } else if (valueWidth === 50 && !isDesktop) {
41
- return 100;
42
- }
43
- if (valueWidth === 25 && isDesktop || valueWidth === 12.5 && isDesktop) {
44
- return valueWidth;
45
- }
46
- if (valueWidth === 25 && !isDesktop) {
47
- return 50;
48
- }
49
- if (valueWidth === 12.5 && !isDesktop) {
50
- return 25;
51
- }
52
- return 100;
53
- };
54
25
  const ownerState = {
55
26
  disabled: isForm && disabled ? disabled : false,
56
27
  isForm: isForm ? true : false,
57
- isMobile: !isDesktop
28
+ semanticWidth
29
+ };
30
+ const renderIcon = () => {
31
+ if (!startAdornment) {
32
+ return null;
33
+ }
34
+ if (typeof startAdornment === "string") {
35
+ return /* @__PURE__ */ jsx(
36
+ Icon,
37
+ {
38
+ src: startAdornment
39
+ }
40
+ );
41
+ }
42
+ return startAdornment;
43
+ };
44
+ const renderValue = () => {
45
+ if (typeof value === "string") {
46
+ return /* @__PURE__ */ jsx(Typography, { variant: "bodyDens", children: value });
47
+ }
48
+ return value;
58
49
  };
59
- const classes = propertyValueUtilityClasses(ownerState);
60
- if (!isForm) {
61
- return /* @__PURE__ */ jsxs(
62
- PropertyValueRoot,
63
- {
64
- className: clsx(classes.root, className),
65
- style: {
66
- gridTemplateColumns: propertyWidth ? `${propertyWidth}px 1fr` : "150px 1fr"
67
- },
68
- ...process.env.NODE_ENV !== "production" ? {
69
- [TEST_PROPS_DATA]: JSON.stringify([
70
- { property: property ? true : false, value: value ? true : false }
71
- ]),
72
- [TEST_PROP_ID]: getNameDataTestId(
73
- COMPONENT_PREFIX,
74
- "root",
75
- dataTestId
76
- )
77
- } : {},
78
- children: [
79
- /* @__PURE__ */ jsxs(
80
- "div",
81
- {
82
- className: classes.property,
83
- style: {
84
- width: propertyWidth && isDesktop ? propertyWidth : "150px",
85
- minWidth: propertyWidth && isDesktop ? propertyWidth : "150px"
86
- },
87
- ...process.env.NODE_ENV !== "production" ? {
88
- [TEST_PROP_ID]: getNameDataTestId(
89
- COMPONENT_PREFIX,
90
- "property",
91
- dataTestId
92
- )
93
- } : {},
94
- children: [
95
- iconProperty ? /* @__PURE__ */ jsx(Icon, { src: iconProperty, className: classes.iconProperty }) : null,
96
- /* @__PURE__ */ jsx(
97
- Label,
98
- {
99
- label: property,
100
- mandatory,
101
- mandatoryMessage,
102
- helperMessage
103
- }
104
- )
105
- ]
106
- }
107
- ),
108
- /* @__PURE__ */ jsx(
109
- "div",
110
- {
111
- className: classes.value,
112
- style: {
113
- width: `${getValueW()}%`,
114
- maxWidth: `${getValueW()}%`,
115
- height: valueHeight
116
- },
117
- ...process.env.NODE_ENV !== "production" ? {
118
- [TEST_PROP_ID]: getNameDataTestId(
119
- COMPONENT_PREFIX,
120
- "value",
121
- dataTestId
122
- )
123
- } : {},
124
- children: value
125
- }
126
- )
127
- ]
128
- }
129
- );
130
- }
131
50
  return /* @__PURE__ */ jsxs(
132
- PropertyValueRoot,
51
+ PropertyValueRootStyled,
133
52
  {
134
- className: clsx(classes.root, className),
135
- style: { gridTemplateColumns: propertyWidth ? `${propertyWidth}px 1fr` : "150px 1fr" },
53
+ role: isForm ? "property-value-form-role" : "property-value-role",
54
+ className: clsx(getComponentSlotRoot(PROPERTY_VALUE_KEY_COMPONENT), className),
55
+ ...getPropDataTestId(PROPERTY_VALUE_KEY_COMPONENT, "root", dataTestId),
56
+ ownerState,
136
57
  ...process.env.NODE_ENV !== "production" ? {
137
- [TEST_PROPS_DATA]: JSON.stringify([
138
- { property: property ? true : false, value: value ? true : false }
139
- ]),
140
- [TEST_PROP_ID]: getNameDataTestId(
141
- COMPONENT_PREFIX,
142
- "root",
143
- dataTestId
144
- )
58
+ [TEST_PROPS_DATA]: JSON.stringify([{ property: !!property, value: !!value }]),
59
+ [TEST_PROP_ID]: getNameDataTestId(COMPONENT_PREFIX, "root", dataTestId)
145
60
  } : {},
146
61
  children: [
147
- /* @__PURE__ */ jsxs(
148
- "div",
149
- {
150
- className: clsx(classes.root, className),
151
- style: { width: propertyWidth ? `${propertyWidth}px 1fr` : "150px 1fr" },
152
- ...process.env.NODE_ENV !== "production" ? {
153
- [TEST_PROPS_DATA]: JSON.stringify([
154
- { property: property ? true : false, value: value ? true : false }
155
- ]),
156
- [TEST_PROP_ID]: getNameDataTestId(
157
- COMPONENT_PREFIX,
158
- "root",
159
- dataTestId
160
- )
161
- } : {},
162
- children: [
163
- iconProperty ? /* @__PURE__ */ jsx(Icon, { src: iconProperty, className: classes.iconProperty }) : null,
164
- /* @__PURE__ */ jsx(
165
- Label,
166
- {
167
- label: property,
168
- mandatory,
169
- mandatoryMessage,
170
- helperMessage
171
- }
172
- )
173
- ]
174
- }
175
- ),
62
+ /* @__PURE__ */ jsxs(PropertyStyled, { ownerState, children: [
63
+ renderIcon(),
64
+ /* @__PURE__ */ jsx(
65
+ Label,
66
+ {
67
+ label: property,
68
+ mandatory,
69
+ mandatoryMessage,
70
+ helperMessage
71
+ }
72
+ )
73
+ ] }),
176
74
  /* @__PURE__ */ jsx(
177
- "div",
75
+ ValueStyled,
178
76
  {
179
- className: classes.value,
180
- style: {
181
- width: `${getValueW()}%`,
182
- maxWidth: `${getValueW()}%`,
183
- height: valueHeight
184
- },
185
- ...process.env.NODE_ENV !== "production" ? {
186
- [TEST_PROP_ID]: getNameDataTestId(
187
- COMPONENT_PREFIX,
188
- "value",
189
- dataTestId
190
- )
191
- } : {},
192
- children: value
77
+ role: "property-value-value-role",
78
+ ownerState,
79
+ children: renderValue()
193
80
  }
194
81
  )
195
82
  ]
@@ -0,0 +1,2 @@
1
+ import { PropertyValueStyles } from './types';
2
+ export declare const propertyValueStyles: PropertyValueStyles;
@@ -0,0 +1,99 @@
1
+ const CONTAINER_QUERY_NAME = "container";
2
+ const propertyValueStyles = {
3
+ /**
4
+ * Property Value Root Styles
5
+ * @author cesar - automatic
6
+ * @createdAt 2024-12-19 14:44:17 - automatic
7
+ * @updatedAt 2025-01-02 08:01:12 - automatic
8
+ * @updatedUser cesar - automatic
9
+ */
10
+ Root: ({ theme, ownerState }) => {
11
+ const createSemanticStyle = (minWidth, maxWidth) => ({
12
+ minWidth,
13
+ maxWidth,
14
+ [`@container ${CONTAINER_QUERY_NAME} (max-width: ${parseInt(minWidth, 10)}px)`]: {
15
+ minWidth: "100%",
16
+ maxWidth: "100%"
17
+ }
18
+ });
19
+ const semanticStylesMap = {
20
+ email: createSemanticStyle("260px", "400px"),
21
+ shortName: createSemanticStyle("40px", "90px"),
22
+ mediumName: createSemanticStyle("80px", "260px"),
23
+ bigName: createSemanticStyle("330px", "520px"),
24
+ shortId: createSemanticStyle("16px", "44px"),
25
+ mediumId: createSemanticStyle("28px", "60px"),
26
+ bigId: createSemanticStyle("36px", "200px"),
27
+ shortDescription: createSemanticStyle("324px", "796px"),
28
+ mediumDescription: createSemanticStyle("796px", "1500px"),
29
+ bigDescription: {
30
+ minWidth: "100%",
31
+ maxWidth: "100%"
32
+ },
33
+ shortNumber: createSemanticStyle("30px", "50px"),
34
+ mediumNumber: createSemanticStyle("44px", "60px"),
35
+ bigNumber: createSemanticStyle("61px", "162px"),
36
+ percentNumber: createSemanticStyle("30px", "50px"),
37
+ fullWidth: {
38
+ minWidth: "100%",
39
+ maxWidth: "100%"
40
+ }
41
+ };
42
+ const semanticStyle = ownerState?.semanticWidth && semanticStylesMap[ownerState.semanticWidth] ? semanticStylesMap[ownerState.semanticWidth] : {};
43
+ return {
44
+ display: "flex",
45
+ flexDirection: ownerState?.isForm ? "column" : "row",
46
+ justifyContent: ownerState?.isForm ? "space-between" : "center",
47
+ alignItems: "flex-start",
48
+ gap: theme.vars.size.baseSpacings["sp0-5"],
49
+ color: theme.palette.text.primary,
50
+ paddingTop: !ownerState?.isForm ? theme.vars.size.baseSpacings.sp1 : void 0,
51
+ paddingBottom: !ownerState?.isForm ? theme.vars.size.baseSpacings.sp1 : void 0,
52
+ borderBottom: !ownerState?.isForm ? `${theme.vars.palette.border.disabled} solid 1px` : "none",
53
+ "&:hover": !ownerState?.isForm && {
54
+ background: theme.vars.palette.background?.hover
55
+ },
56
+ ...semanticStyle,
57
+ [`@container ${CONTAINER_QUERY_NAME} (min-width: 0px) and (max-width: 400px)`]: {
58
+ flexDirection: "column"
59
+ },
60
+ ...theme.generalSettings.isMobile && {
61
+ flexDirection: "column"
62
+ },
63
+ variants: []
64
+ };
65
+ },
66
+ /**
67
+ * Property Styles
68
+ * @author cesar - automatic
69
+ * @createdAt 2024-12-26 11:44:46 - automatic
70
+ * @updatedAt 2025-01-02 08:01:12 - automatic
71
+ * @updatedUser cesar - automatic
72
+ */
73
+ property: ({ theme, ownerState }) => ({
74
+ display: "flex",
75
+ alignItems: "center",
76
+ minWidth: "200px",
77
+ width: ownerState?.semanticWidth ? "auto" : "200px",
78
+ fontSize: theme.typography.body2.fontSize,
79
+ color: theme.palette.text.primary
80
+ }),
81
+ /**
82
+ * Value Styles (Form and No Form Combined)
83
+ * @author cesar - automatic
84
+ * @createdAt 2024-12-26 11:44:46 - automatic
85
+ * @updatedAt 2025-01-02 08:01:12 - automatic
86
+ * @updatedUser cesar - automatic
87
+ */
88
+ value: ({ theme, ownerState }) => ({
89
+ width: "100%",
90
+ display: "flex",
91
+ justifyContent: "flex-start",
92
+ ...ownerState?.isForm && {
93
+ gap: theme.vars.size.baseSpacings["sp0-5"]
94
+ }
95
+ })
96
+ };
97
+ export {
98
+ propertyValueStyles as p
99
+ };
@@ -1,3 +1,4 @@
1
1
  export declare const COMPONENT_PREFIX = "m4l-property-value";
2
2
  export declare const PREFIX_TEST_ATTRIBUTE = "data-testid";
3
3
  export declare const TEST_PROPS_DATA = "m4l-property-value-data";
4
+ export declare const PROPERTY_VALUE_KEY_COMPONENT = "M4LPropertyValue";
@@ -1,6 +1,8 @@
1
1
  const COMPONENT_PREFIX = "m4l-property-value";
2
2
  const TEST_PROPS_DATA = `${COMPONENT_PREFIX}-data`;
3
+ const PROPERTY_VALUE_KEY_COMPONENT = "M4LPropertyValue";
3
4
  export {
4
5
  COMPONENT_PREFIX as C,
6
+ PROPERTY_VALUE_KEY_COMPONENT as P,
5
7
  TEST_PROPS_DATA as T
6
8
  };
@@ -0,0 +1,5 @@
1
+ export declare enum PropertyValueSlots {
2
+ Root = "Root",
3
+ property = "property",
4
+ value = "value"
5
+ }
@@ -0,0 +1,9 @@
1
+ var PropertyValueSlots = /* @__PURE__ */ ((PropertyValueSlots2) => {
2
+ PropertyValueSlots2["Root"] = "Root";
3
+ PropertyValueSlots2["property"] = "property";
4
+ PropertyValueSlots2["value"] = "value";
5
+ return PropertyValueSlots2;
6
+ })(PropertyValueSlots || {});
7
+ export {
8
+ PropertyValueSlots as P
9
+ };
@@ -0,0 +1,9 @@
1
+ export declare const PropertyValueRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PropertyVaLueOwnerState> & Record<string, unknown> & {
2
+ ownerState: Partial<import('../types').PropertyVaLueOwnerState> & 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 PropertyStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PropertyVaLueOwnerState> & Record<string, unknown> & {
5
+ ownerState: Partial<import('../types').PropertyVaLueOwnerState> & Record<string, unknown>;
6
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
7
+ export declare const ValueStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PropertyVaLueOwnerState> & Record<string, unknown> & {
8
+ ownerState: Partial<import('../types').PropertyVaLueOwnerState> & Record<string, unknown>;
9
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
@@ -0,0 +1,21 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { P as PROPERTY_VALUE_KEY_COMPONENT } from "../constants.js";
3
+ import { p as propertyValueStyles } from "../PropertyValue.styles.js";
4
+ import { P as PropertyValueSlots } from "./PropertyValueEnum.js";
5
+ const PropertyValueRootStyled = styled("div", {
6
+ name: PROPERTY_VALUE_KEY_COMPONENT,
7
+ slot: PropertyValueSlots.Root
8
+ })(propertyValueStyles?.Root);
9
+ const PropertyStyled = styled("div", {
10
+ name: PROPERTY_VALUE_KEY_COMPONENT,
11
+ slot: PropertyValueSlots.property
12
+ })(propertyValueStyles?.property);
13
+ const ValueStyled = styled("div", {
14
+ name: PROPERTY_VALUE_KEY_COMPONENT,
15
+ slot: PropertyValueSlots.value
16
+ })(propertyValueStyles?.value);
17
+ export {
18
+ PropertyValueRootStyled as P,
19
+ ValueStyled as V,
20
+ PropertyStyled as a
21
+ };
@@ -0,0 +1,2 @@
1
+ export * from './PropertyValueEnum';
2
+ export * from './PropertyValueSlots';
@@ -1,23 +1,97 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { LabelProps } from '../Label/types';
3
+ import { PROPERTY_VALUE_KEY_COMPONENT } from './constants';
4
+ import { Theme } from '@mui/material';
5
+ import { OverridesStyleRules } from '@mui/material/styles/overrides';
6
+ import { PropertyValueSlots } from './slots/PropertyValueEnum';
7
+ /**
8
+ * Tipos de valores posibles para los componentes dentro de `PropertyValue`.
9
+ */
10
+ export type PropertyValueType = keyof typeof PropertyValueSlots;
11
+ /**
12
+ * Propiedades relacionadas con la configuración de la propiedad (`property`) en el componente `PropertyValue`.
13
+ */
3
14
  export interface PropertyProps {
15
+ /**
16
+ * Ancho del contenedor de la propiedad, en píxeles.
17
+ */
4
18
  propertyWidth?: number;
5
- iconProperty?: string;
19
+ /**
20
+ * Icono que se muestra junto a la propiedad.
21
+ */
22
+ startAdornment?: ReactNode;
6
23
  }
24
+ /**
25
+ * Propiedades relacionadas con la configuración del valor (`value`) en el componente `PropertyValue`.
26
+ */
7
27
  export interface ValueProps {
28
+ /**
29
+ * Altura del contenedor del valor, en píxeles o como cadena (e.g., `'auto'`).
30
+ */
8
31
  valueHeight?: number | string;
32
+ /**
33
+ * @deprecated Esta propiedad está obsoleta y será eliminada en futuras versiones.
34
+ * Utiliza `semanticWidth` o `valueWidthMobile` en su lugar.
35
+ *
36
+ * Ancho del contenedor del valor como porcentaje para escritorios.
37
+ */
9
38
  valueWidth?: number;
39
+ /**
40
+ * Ancho del contenedor del valor como porcentaje para dispositivos móviles.
41
+ */
10
42
  valueWidthMobile?: number;
11
43
  }
44
+ /**
45
+ * Valores posibles para la propiedad semanticWidth
46
+ */
47
+ export type SemanticWidthOptions = 'email' | 'shortName' | 'mediumName' | 'bigName' | 'shortId' | 'mediumId' | 'bigId' | 'shortDescription' | 'mediumDescription' | 'bigDescription' | 'shortNumber' | 'mediumNumber' | 'bigNumber' | 'percentNumber' | 'fullWidth';
48
+ /**
49
+ * Propiedades principales para el componente `PropertyValue`.
50
+ */
12
51
  export interface PropertyValueProps extends PropertyProps, ValueProps, Omit<LabelProps, 'label'> {
52
+ /**
53
+ * Nombre de la propiedad que se muestra.
54
+ */
13
55
  property: string;
56
+ /**
57
+ * Valor asociado a la propiedad. Puede ser un número, una cadena o un nodo React.
58
+ */
14
59
  value: number | string | ReactNode;
60
+ /**
61
+ * Indica si el componente debe mostrarse como parte de un formulario.
62
+ */
15
63
  isForm?: boolean;
64
+ /**
65
+ * Clase CSS personalizada para el componente.
66
+ */
16
67
  className?: string;
68
+ /**
69
+ * Identificador de prueba utilizado para pruebas automatizadas.
70
+ */
17
71
  dataTestId?: string;
72
+ /**
73
+ * Indica si el componente está deshabilitado.
74
+ */
18
75
  disabled?: boolean;
76
+ /**
77
+ * Define el ancho semántico del componente según el contenido.
78
+ */
79
+ semanticWidth?: SemanticWidthOptions;
19
80
  }
20
- export interface OwnerState extends Pick<PropertyValueProps, 'disabled'> {
81
+ /**
82
+ * Estado del propietario para el componente `PropertyValue`, utilizado para personalizar estilos y comportamientos.
83
+ */
84
+ export interface PropertyVaLueOwnerState extends Pick<PropertyValueProps, 'disabled' | 'semanticWidth'> {
85
+ /**
86
+ * Indica si el componente está en modo formulario.
87
+ */
21
88
  isForm: boolean;
22
- isMobile: boolean;
89
+ /**
90
+ * Propiedades adicionales para estilos o comportamientos personalizados.
91
+ */
92
+ [key: string]: unknown;
23
93
  }
94
+ /**
95
+ * Definición de estilos para el componente `PropertyValue`.
96
+ */
97
+ export type PropertyValueStyles = OverridesStyleRules<PropertyValueType, typeof PROPERTY_VALUE_KEY_COMPONENT, Theme>;
@@ -3,8 +3,8 @@ const windowConfirmStyles = {
3
3
  * Wrapper Window Confirm Styles
4
4
  * @author cesar - automatic
5
5
  * @createdAt 2024-11-21 08:55:01 - automatic
6
- * @updatedAt 2024-12-30 14:36:09 - automatic
7
- * @updatedUser Andrés Quintero - automatic
6
+ * @updatedAt 2024-12-20 12:09:44 - automatic
7
+ * @updatedUser cesar - automatic
8
8
  */
9
9
  wrapperWindowConfirm: ({ theme, ownerState }) => ({
10
10
  display: "flex",
@@ -36,10 +36,10 @@ const windowConfirmStyles = {
36
36
  * Wrapper Window Confirm Content Styles
37
37
  * @author cesar - automatic
38
38
  * @createdAt 2024-11-22 10:58:23 - automatic
39
- * @updatedAt 2024-12-30 14:36:09 - automatic
40
- * @updatedUser Andrés Quintero - automatic
39
+ * @updatedAt 2024-12-20 12:09:44 - automatic
40
+ * @updatedUser cesar - automatic
41
41
  */
42
- windowConfirmContent: ({ theme, ownerState }) => ({
42
+ windowConfirmContent: ({ theme }) => ({
43
43
  display: "flex",
44
44
  padding: theme.vars.size.baseSpacings.sp0,
45
45
  width: "100%",
@@ -48,29 +48,14 @@ const windowConfirmStyles = {
48
48
  alignItems: "center",
49
49
  gap: theme.vars.size.baseSpacings.sp3,
50
50
  alignSelf: "stretch",
51
- borderRadius: theme.vars.size.borderRadius.r0,
52
- ...theme.generalSettings.isMobile ? {
53
- ...ownerState.windowBaseSize === "small" && {
54
- height: theme.vars.size.mobile.small.container
55
- },
56
- ...ownerState.windowBaseSize === "medium" && {
57
- height: theme.vars.size.mobile.medium.container
58
- }
59
- } : {
60
- ...ownerState.windowBaseSize === "small" && {
61
- height: theme.vars.size.desktop.small.container
62
- },
63
- ...ownerState.windowBaseSize === "medium" && {
64
- height: theme.vars.size.desktop.medium.container
65
- }
66
- }
51
+ borderRadius: theme.vars.size.borderRadius.r0
67
52
  }),
68
53
  /**
69
54
  * Container Illustration Styles
70
55
  * @author cesar - automatic
71
56
  * @createdAt 2024-11-19 11:57:37 - automatic
72
- * @updatedAt 2024-12-30 14:36:09 - automatic
73
- * @updatedUser Andrés Quintero - automatic
57
+ * @updatedAt 2024-12-20 12:09:44 - automatic
58
+ * @updatedUser cesar - automatic
74
59
  */
75
60
  illustrationContainer: ({ theme }) => ({
76
61
  display: "flex",
@@ -85,8 +70,8 @@ const windowConfirmStyles = {
85
70
  * Icon Illustration Styles
86
71
  * @author cesar - automatic
87
72
  * @createdAt 2024-11-19 11:57:37 - automatic
88
- * @updatedAt 2024-12-30 14:36:09 - automatic
89
- * @updatedUser Andrés Quintero - automatic
73
+ * @updatedAt 2024-12-20 12:09:44 - automatic
74
+ * @updatedUser cesar - automatic
90
75
  */
91
76
  illustrationIcon: () => ({
92
77
  width: "auto !important",
@@ -99,8 +84,8 @@ const windowConfirmStyles = {
99
84
  * Text Content Styles
100
85
  * @author cesar - automatic
101
86
  * @createdAt 2024-11-19 11:57:37 - automatic
102
- * @updatedAt 2024-12-30 14:36:09 - automatic
103
- * @updatedUser Andrés Quintero - automatic
87
+ * @updatedAt 2024-12-20 12:09:44 - automatic
88
+ * @updatedUser cesar - automatic
104
89
  */
105
90
  textContent: ({ theme }) => ({
106
91
  display: "flex",
@@ -113,8 +98,8 @@ const windowConfirmStyles = {
113
98
  * Title Illustration Styles
114
99
  * @author cesar - automatic
115
100
  * @createdAt 2024-11-19 11:57:37 - automatic
116
- * @updatedAt 2024-12-30 14:36:09 - automatic
117
- * @updatedUser Andrés Quintero - automatic
101
+ * @updatedAt 2024-12-20 12:09:44 - automatic
102
+ * @updatedUser cesar - automatic
118
103
  */
119
104
  title: ({ theme }) => ({
120
105
  color: theme.vars.palette.text.primary,
@@ -125,8 +110,8 @@ const windowConfirmStyles = {
125
110
  * Message Illustration Styles
126
111
  * @author cesar - automatic
127
112
  * @createdAt 2024-11-21 08:55:01 - automatic
128
- * @updatedAt 2024-12-30 14:36:09 - automatic
129
- * @updatedUser Andrés Quintero - automatic
113
+ * @updatedAt 2024-12-20 12:09:44 - automatic
114
+ * @updatedUser cesar - automatic
130
115
  */
131
116
  message: ({ theme }) => ({
132
117
  textAlign: "center",
@@ -136,8 +121,8 @@ const windowConfirmStyles = {
136
121
  * Actions Container Styles
137
122
  * @author cesar - automatic
138
123
  * @createdAt 2024-11-19 11:57:37 - automatic
139
- * @updatedAt 2024-12-30 14:36:09 - automatic
140
- * @updatedUser Andrés Quintero - automatic
124
+ * @updatedAt 2024-12-20 12:09:44 - automatic
125
+ * @updatedUser cesar - automatic
141
126
  */
142
127
  actionsContainer: ({ theme }) => ({
143
128
  padding: theme.vars.size.baseSpacings.sp3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.47",
3
+ "version": "9.1.48",
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 = "M4LPropertyValue";
@@ -1,4 +0,0 @@
1
- const componentName = "M4LPropertyValue";
2
- export {
3
- componentName as c
4
- };
@@ -1,13 +0,0 @@
1
- import { PropertyValueClassesType } from './types';
2
- import { OwnerState } from '../types';
3
- export declare const propertyValueClasses: PropertyValueClassesType;
4
- export declare function getPropertyValueUtilityClass(slot: string): string;
5
- /**
6
- * TODO: Documentar
7
- */
8
- export declare const propertyValueUtilityClasses: (ownerState: OwnerState) => {
9
- value: string;
10
- root: string;
11
- property: string;
12
- iconProperty: string;
13
- };
@@ -1,40 +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(
5
- componentName,
6
- [
7
- /* elements */
8
- "root",
9
- "property",
10
- "iconProperty",
11
- "value",
12
- /* states or variants of elements */
13
- "isDisabled",
14
- "variantIsForm",
15
- "isMobile"
16
- ]
17
- );
18
- function getPropertyValueUtilityClass(slot) {
19
- return generateUtilityClass(componentName, slot);
20
- }
21
- const propertyValueUtilityClasses = (ownerState) => {
22
- const slots = {
23
- root: [
24
- "root",
25
- ownerState.disabled && "isDisabled",
26
- ownerState.isForm && "variantIsForm",
27
- ownerState.isMobile && "isMobile"
28
- ],
29
- property: ["property"],
30
- iconProperty: ["iconProperty"],
31
- value: ["value"]
32
- };
33
- const composedClasses = unstable_composeClasses(slots, getPropertyValueUtilityClass, {});
34
- return {
35
- ...composedClasses
36
- };
37
- };
38
- export {
39
- propertyValueUtilityClasses as p
40
- };
@@ -1,12 +0,0 @@
1
- import { propertyValueUtilityClasses } from '.';
2
- export interface PropertyValueClassesType {
3
- root: string;
4
- property: string;
5
- value: string;
6
- iconProperty: string;
7
- isDisabled: string;
8
- variantIsForm: string;
9
- isMobile: string;
10
- }
11
- export type PropertyValueClassesKey = keyof PropertyValueClassesType;
12
- export type Classes = ReturnType<typeof propertyValueUtilityClasses>;
@@ -1,7 +0,0 @@
1
- import { styled } from "@mui/material";
2
- const PropertyValueRoot = styled("div")(({ theme }) => ({
3
- ...theme.components?.M4LPropertyValue?.styleOverrides || {}
4
- }));
5
- export {
6
- PropertyValueRoot as P
7
- };
@@ -1 +0,0 @@
1
- export declare const ICON_PREFIX = "M4LPropertyValue";
@@ -1,5 +0,0 @@
1
- import { PropertyValueClassesKey } from '../classes/types';
2
- /**
3
- * TODO: Documentar
4
- */
5
- export declare const getNamePropertyValueDataTestId: (KEY: PropertyValueClassesKey, DATATESTID: string) => string;