@m4l/components 9.57.1-beta-hotfix-semantic-width-dynamicform.1 → 9.57.1-beta-hotfix-semantic-width-dynamicform.2

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.
@@ -1,7 +1,7 @@
1
- import { jsx as r, jsxs as C } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as E, useMemo as L, memo as A } from "react";
1
+ import { jsx as r, jsxs as w } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as E, useMemo as g, memo as L } from "react";
3
3
  import R from "clsx";
4
- import { useModuleDictionary as W, useEnvironment as g } from "@m4l/core";
4
+ import { useModuleDictionary as W, useEnvironment as A } from "@m4l/core";
5
5
  import { NotificationCheckCircleFill as O, NotificationWarningFill as T } from "@m4l/icons";
6
6
  import { Icon as H } from "@m4l/base";
7
7
  import { TEST_PROP_ID as z } from "../../../../test/constants_no_mock.js";
@@ -22,14 +22,14 @@ import { Chip as te } from "../../../Chip/Chip.js";
22
22
  const ie = /* @__PURE__ */ new Set([
23
23
  "RHFCheckableList"
24
24
  ]);
25
- function le(c) {
26
- const t = c.fieldType?.componentId;
25
+ function le(d) {
26
+ const t = d.fieldType?.componentId;
27
27
  return t && ie.has(t) ? "verticalGrow" : "default";
28
28
  }
29
- function ae(c) {
29
+ function ae(d) {
30
30
  const t = [];
31
31
  let e = [];
32
- return c.forEach((o) => {
32
+ return d.forEach((o) => {
33
33
  const a = le(o);
34
34
  if (a === "verticalGrow") {
35
35
  e.length > 0 && (t.push({
@@ -47,7 +47,7 @@ function ae(c) {
47
47
  fields: e
48
48
  }), t;
49
49
  }
50
- const b = A(function(t) {
50
+ const b = L(function(t) {
51
51
  const {
52
52
  field: e,
53
53
  currentSize: o,
@@ -55,36 +55,37 @@ const b = A(function(t) {
55
55
  fieldFlow: D,
56
56
  layout: f,
57
57
  readOnly: y = !1
58
- } = t, { getLabel: F } = W(), { host_api_remote: h } = g(), s = f === "verticalGrow";
58
+ } = t, { getLabel: F } = W(), { host_api_remote: h } = A(), n = f === "verticalGrow";
59
59
  if (typeof e.name != "string" || e.name.trim() === "")
60
60
  return null;
61
61
  const S = V(
62
62
  e,
63
63
  F
64
- ), i = j(e, F), n = ee(e), v = oe(e), d = B({
64
+ ), i = j(e, F), s = ee(e), v = oe(e), m = B({
65
65
  hasHelperMessage: !!S,
66
66
  label: i,
67
- mandatory: n,
67
+ mandatory: s,
68
68
  requestedSemanticWidth: e.metadata?.semanticWidth,
69
69
  size: o,
70
70
  symbol: v
71
- }), m = re(e, {
71
+ }), c = re(e, {
72
72
  size: o,
73
73
  getLabel: F,
74
74
  hostApiRemote: h,
75
75
  readOnly: y,
76
76
  suppressLabel: !0
77
77
  });
78
- return m ? /* @__PURE__ */ r(
78
+ return c ? /* @__PURE__ */ r(
79
79
  X,
80
80
  {
81
81
  ownerState: {
82
82
  readOnly: y,
83
83
  fieldFlow: D,
84
+ gridColumnSpan: m.gridColumnSpan,
84
85
  layout: f,
85
- isFullWidth: d.isFullWidth,
86
+ isFullWidth: m.isFullWidth,
86
87
  semanticWidth: e.metadata?.semanticWidth,
87
- wrapperWidth: d.wrapperWidth
88
+ wrapperWidth: m.wrapperWidth
88
89
  },
89
90
  className: R(
90
91
  a,
@@ -93,23 +94,23 @@ const b = A(function(t) {
93
94
  children: /* @__PURE__ */ r(
94
95
  x,
95
96
  {
96
- controlWidth: d.controlWidth,
97
+ controlWidth: m.controlWidth,
97
98
  labelOverflow: "visible",
98
- labelWidth: d.labelWidth,
99
+ labelWidth: m.labelWidth,
99
100
  property: i,
100
- value: m,
101
+ value: c,
101
102
  isForm: !0,
102
- mandatory: n,
103
+ mandatory: s,
103
104
  helperMessage: S,
104
105
  symbol: v,
105
- valueHeight: s ? "100%" : void 0
106
+ valueHeight: n ? "100%" : void 0
106
107
  }
107
108
  )
108
109
  }
109
110
  ) : null;
110
111
  });
111
112
  b.displayName = "DynamicFormFieldRow";
112
- const se = E((c, t) => {
113
+ const ne = E((d, t) => {
113
114
  const {
114
115
  data: e,
115
116
  currentSize: o,
@@ -119,17 +120,17 @@ const se = E((c, t) => {
119
120
  coupled: y = !1,
120
121
  actionFormIntroProps: F,
121
122
  renderActions: h,
122
- readOnly: s = !1,
123
+ readOnly: n = !1,
123
124
  suppressFormHeader: S = !0,
124
125
  submitFeedbackStatus: i,
125
- fieldFlow: n = "responsiveWrap"
126
- } = c, { getLabel: v } = W(), { visibleFields: d } = P(e), m = S ? null : Z(e.form), I = ae(d), w = L(
126
+ fieldFlow: s = "responsiveWrap"
127
+ } = d, { getLabel: v } = W(), { visibleFields: m } = P(e), c = S ? null : Z(e.form), I = ae(m), C = g(
127
128
  () => ({
128
129
  size: o,
129
- readOnly: s,
130
- fieldFlow: n
130
+ readOnly: n,
131
+ fieldFlow: s
131
132
  }),
132
- [o, n, s]
133
+ [o, s, n]
133
134
  ), M = !y && i ? /* @__PURE__ */ r(U, { children: /* @__PURE__ */ r(
134
135
  te,
135
136
  {
@@ -148,16 +149,16 @@ const se = E((c, t) => {
148
149
  opacity: !0
149
150
  }
150
151
  ) }) : null;
151
- return /* @__PURE__ */ C(
152
+ return /* @__PURE__ */ w(
152
153
  Y,
153
154
  {
154
155
  ref: t,
155
- ownerState: w,
156
+ ownerState: C,
156
157
  className: R(u.contentRoot),
157
158
  ...typeof f == "string" ? { "data-meta": f } : {},
158
159
  ...process.env.NODE_ENV !== "production" ? { [z]: D } : {},
159
160
  children: [
160
- m?.title && /* @__PURE__ */ C(
161
+ c?.title && /* @__PURE__ */ w(
161
162
  q,
162
163
  {
163
164
  className: u.formHeader,
@@ -169,10 +170,10 @@ const se = E((c, t) => {
169
170
  component: "h2",
170
171
  size: o,
171
172
  variant: "paragraphDens",
172
- children: m.title
173
+ children: c.title
173
174
  }
174
175
  ),
175
- m.description && /* @__PURE__ */ r(
176
+ c.description && /* @__PURE__ */ r(
176
177
  $,
177
178
  {
178
179
  className: u.formDescription,
@@ -180,7 +181,7 @@ const se = E((c, t) => {
180
181
  component: "p",
181
182
  size: o,
182
183
  variant: "bodyStandard",
183
- children: m.description
184
+ children: c.description
184
185
  }
185
186
  )
186
187
  ]
@@ -196,9 +197,9 @@ const se = E((c, t) => {
196
197
  field: l,
197
198
  currentSize: o,
198
199
  fieldWrapperClassName: a,
199
- fieldFlow: n,
200
+ fieldFlow: s,
200
201
  layout: p.layout,
201
- readOnly: s
202
+ readOnly: n
202
203
  },
203
204
  l.id
204
205
  ) : null;
@@ -207,7 +208,7 @@ const se = E((c, t) => {
207
208
  return /* @__PURE__ */ r(
208
209
  J,
209
210
  {
210
- ownerState: w,
211
+ ownerState: C,
211
212
  className: u.fieldsFlow,
212
213
  children: p.fields.map((l) => /* @__PURE__ */ r(
213
214
  b,
@@ -215,9 +216,9 @@ const se = E((c, t) => {
215
216
  field: l,
216
217
  currentSize: o,
217
218
  fieldWrapperClassName: a,
218
- fieldFlow: n,
219
+ fieldFlow: s,
219
220
  layout: p.layout,
220
- readOnly: s
221
+ readOnly: n
221
222
  },
222
223
  l.id
223
224
  ))
@@ -225,7 +226,7 @@ const se = E((c, t) => {
225
226
  `flow-${_}`
226
227
  );
227
228
  }),
228
- !y && !s && /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ r(G, { children: h ? h() : /* @__PURE__ */ r(
229
+ !y && !n && /* @__PURE__ */ r(Q, { children: /* @__PURE__ */ r(G, { children: h ? h() : /* @__PURE__ */ r(
229
230
  k,
230
231
  {
231
232
  size: o,
@@ -237,7 +238,7 @@ const se = E((c, t) => {
237
238
  }
238
239
  );
239
240
  });
240
- se.displayName = "DynamicFormContent";
241
+ ne.displayName = "DynamicFormContent";
241
242
  export {
242
- se as DynamicFormContent
243
+ ne as DynamicFormContent
243
244
  };
@@ -436,14 +436,14 @@ export type DynamicFormFieldFlow = 'responsiveWrap' | 'verticalStack';
436
436
  export type FieldDefaultValue = FieldCurrentValue;
437
437
  /**
438
438
  * Optional field-level metadata carried inside each field entry.
439
- * Drives layout hints resolved by DynamicFormContent (e.g. flex-wrap item sizing).
439
+ * Drives layout hints resolved by DynamicFormContent (e.g. semantic grid item sizing).
440
440
  */
441
441
  export interface FieldMetadata {
442
442
  /**
443
- * Semantic layout width for the field wrapper in the form flex-wrap container.
443
+ * Semantic layout width for the field wrapper in the form semantic grid.
444
444
  * Maps to the same `SemanticWidthOptions` used by `PropertyValue`, so field wrappers
445
- * share the same preferred widths as ContainerFlow-style semantic items while still
446
- * allowing rows to redistribute leftover space more naturally.
445
+ * share the same preferred widths as ContainerFlow-style semantic items while letting
446
+ * DynamicForm resolve the smallest grid span that can contain the field.
447
447
  * When `null` or absent the field wrapper spans the full available width.
448
448
  */
449
449
  semanticWidth?: SemanticWidthOptions;
@@ -515,9 +515,9 @@ export interface Field {
515
515
  description: string | null;
516
516
  /**
517
517
  * Optional field-level metadata from the API (e.g. `{ semanticWidth: 'bigName' }`).
518
- * `metadata.semanticWidth` drives the preferred flex width in `DynamicFormContent`,
519
- * using the same semantic catalog as `PropertyValue` while allowing rows to redistribute
520
- * remaining space more naturally.
518
+ * `metadata.semanticWidth` drives the preferred semantic grid span in
519
+ * `DynamicFormContent`, using the same semantic catalog as `PropertyValue` while
520
+ * keeping the rendered control width aligned with the backend contract.
521
521
  * When `null` or absent the field wrapper defaults to full available width.
522
522
  */
523
523
  metadata?: FieldMetadata | null;
@@ -665,9 +665,9 @@ interface DynamicFormPropsBase {
665
665
  */
666
666
  fieldWrapperClassName?: string;
667
667
  /**
668
- * Field layout policy. `responsiveWrap` keeps semantic widths and row wrapping;
669
- * `verticalStack` stacks fields full-width and lets growable fields consume the
670
- * available height. Defaults to `responsiveWrap`.
668
+ * Field layout policy. `responsiveWrap` composes semantic widths on the responsive
669
+ * form grid; `verticalStack` stacks fields full-width and lets growable fields
670
+ * consume the available height. Defaults to `responsiveWrap`.
671
671
  */
672
672
  fieldFlow?: DynamicFormFieldFlow;
673
673
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Label.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/Label/Label.styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAU3D,eAAO,MAAM,WAAW,EAAE,WA8IzB,CAAC"}
1
+ {"version":3,"file":"Label.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/Label/Label.styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAU3D,eAAO,MAAM,WAAW,EAAE,WAoJzB,CAAC"}
@@ -11,7 +11,13 @@ const n = {
11
11
  * @returns {object} - Los estilos aplicados al root del Label.
12
12
  */
13
13
  root: ({ theme: e, ownerState: s }) => ({
14
- width: "100%",
14
+ // `fit-content` instead of `100%`: the root must contribute a real intrinsic width so the
15
+ // layers above it can size a field from its content. Stretching to the parent made the label
16
+ // width unmeasurable, which forced consumers to guess it.
17
+ // `fit-content` en vez de `100%`: el root debe aportar un ancho intrínseco real para que las
18
+ // capas superiores puedan dimensionar un campo a partir de su contenido. Estirarse al padre
19
+ // hacía que el ancho del label no fuera medible y obligaba a los consumidores a estimarlo.
20
+ width: "fit-content",
15
21
  display: "flex",
16
22
  flexDirection: "row",
17
23
  alignItems: "center",
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyValue.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/PropertyValue/PropertyValue.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA2B,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAwB3E;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,oDA2JtD"}
1
+ {"version":3,"file":"PropertyValue.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/PropertyValue/PropertyValue.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA2B,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAyB3E;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,oDA2JtD"}
@@ -2,59 +2,59 @@ import { jsxs as y, jsx as t } from "@emotion/react/jsx-runtime";
2
2
  import f, { useId as D } from "react";
3
3
  import W from "clsx";
4
4
  import { TEST_PROP_ID as x } from "../../test/constants_no_mock.js";
5
- import { TEST_PROPS_DATA as F, COMPONENT_PREFIX as M, PROPERTY_VALUE_KEY_COMPONENT as s } from "./constants.js";
6
- import { getNameDataTestId as w, getPropDataTestId as $ } from "../../test/getNameDataTestId.js";
7
- import { Icon as j } from "@m4l/base";
8
- import { PropertyValueRootStyled as q, ContainerStartAdornmentStyled as L, ContainerPropertyAndValueStyled as Y, NameStyled as G, ValueStyled as H, TypographyValueStyled as J } from "./slots/PropertyValueSlots.js";
9
- import { getComponentSlotRoot as h } from "../../utils/getComponentSlotRoot.js";
5
+ import { PROPERTY_VALUE_CLASSNAMES as M, TEST_PROPS_DATA as F, COMPONENT_PREFIX as L, PROPERTY_VALUE_KEY_COMPONENT as s } from "./constants.js";
6
+ import { getNameDataTestId as w, getPropDataTestId as Y } from "../../test/getNameDataTestId.js";
7
+ import { Icon as $ } from "@m4l/base";
8
+ import { PropertyValueRootStyled as j, ContainerStartAdornmentStyled as q, ContainerPropertyAndValueStyled as U, NameStyled as G, ValueStyled as H, TypographyValueStyled as J } from "./slots/PropertyValueSlots.js";
9
+ import { getComponentSlotRoot as S } from "../../utils/getComponentSlotRoot.js";
10
10
  import { getNullGuard as K } from "../../utils/getNullGuard.js";
11
- import { Label as U } from "../Label/Label.js";
12
- import { useComponentSize as X } from "@m4l/graphics";
13
- function se(S) {
11
+ import { Label as X } from "../Label/Label.js";
12
+ import { useComponentSize as k } from "@m4l/graphics";
13
+ function me(h) {
14
14
  const {
15
15
  property: l,
16
16
  startAdornment: o,
17
17
  value: e,
18
- className: v,
18
+ className: E,
19
19
  isForm: n,
20
20
  labelOverflow: m,
21
21
  labelWidth: P,
22
22
  dataTestId: p = "",
23
23
  disabled: u = !1,
24
- controlWidth: E,
25
- mandatory: N,
24
+ controlWidth: N,
25
+ mandatory: v,
26
26
  mandatoryMessage: T,
27
27
  helperMessage: g,
28
28
  symbol: I,
29
29
  semanticWidth: a = "fullWidth",
30
- propertyWidth: b = 200,
31
- size: O = "medium",
30
+ propertyWidth: O = 200,
31
+ size: V = "medium",
32
32
  direction: c,
33
- valueHeight: V,
34
- iconVariant: _ = "outlined",
33
+ valueHeight: _,
34
+ iconVariant: b = "outlined",
35
35
  iconColor: R = "primary",
36
- borderStyle: z = "none"
37
- } = S, d = `property-value-${D()}`, { currentSize: i } = X(O), r = {
38
- propertyWidth: b,
39
- controlWidth: E,
36
+ borderStyle: A = "none"
37
+ } = h, d = `property-value-${D()}`, { currentSize: i } = k(V), r = {
38
+ propertyWidth: O,
39
+ controlWidth: N,
40
40
  disabled: n && u ? u : !1,
41
41
  isForm: !!n,
42
42
  labelOverflow: m,
43
43
  labelWidth: P,
44
44
  semanticWidth: a,
45
- valueHeight: V,
45
+ valueHeight: _,
46
46
  size: i,
47
47
  direction: n && c === void 0 ? "column" : c ?? "row",
48
- iconVariant: _,
48
+ iconVariant: b,
49
49
  iconColor: R,
50
- borderStyle: z
50
+ borderStyle: A
51
51
  }, C = () => o ? typeof o == "string" ? /* @__PURE__ */ t(
52
- j,
52
+ $,
53
53
  {
54
54
  src: o,
55
55
  color: "text.secondary"
56
56
  }
57
- ) : o : null, A = () => typeof e == "string" || typeof e == "number" || e === null || e === void 0 ? /* @__PURE__ */ t(
57
+ ) : o : null, z = () => typeof e == "string" || typeof e == "number" || e === null || e === void 0 ? /* @__PURE__ */ t(
58
58
  J,
59
59
  {
60
60
  id: d,
@@ -68,48 +68,48 @@ function se(S) {
68
68
  { size: i, id: d }
69
69
  ) : e;
70
70
  return /* @__PURE__ */ y(
71
- q,
71
+ j,
72
72
  {
73
73
  role: n ? "property-value-form-role" : "property-value-role",
74
74
  className: W(
75
- h(s),
76
- a && `${h(s)}-semanticWidth-${a}`,
77
- v
75
+ S(s),
76
+ a && `${S(s)}-semanticWidth-${a}`,
77
+ E
78
78
  ),
79
- ...$(s, "root", p),
79
+ ...Y(s, "root", p),
80
80
  ownerState: r,
81
81
  ...process.env.NODE_ENV !== "production" ? {
82
82
  [F]: JSON.stringify([
83
83
  { property: !!l, value: !!e }
84
84
  ]),
85
85
  [x]: w(
86
- M,
86
+ L,
87
87
  "root",
88
88
  p
89
89
  )
90
90
  } : {},
91
91
  children: [
92
- o && /* @__PURE__ */ t(L, { ownerState: r, children: C() }),
93
- /* @__PURE__ */ y(Y, { ownerState: r, children: [
94
- /* @__PURE__ */ t(G, { ownerState: r, children: l && /* @__PURE__ */ t(
95
- U,
92
+ o && /* @__PURE__ */ t(q, { ownerState: r, children: C() }),
93
+ /* @__PURE__ */ y(U, { ownerState: r, children: [
94
+ /* @__PURE__ */ t(G, { ownerState: r, className: M.name, children: l && /* @__PURE__ */ t(
95
+ X,
96
96
  {
97
97
  size: i,
98
98
  label: l,
99
99
  labelOverflow: m,
100
- mandatory: N,
100
+ mandatory: v,
101
101
  mandatoryMessage: T,
102
102
  helperMessage: g,
103
103
  symbol: I,
104
104
  htmlFor: d
105
105
  }
106
106
  ) }),
107
- /* @__PURE__ */ t(H, { role: "property-value-value-role", ownerState: r, children: A() })
107
+ /* @__PURE__ */ t(H, { role: "property-value-value-role", ownerState: r, children: z() })
108
108
  ] })
109
109
  ]
110
110
  }
111
111
  );
112
112
  }
113
113
  export {
114
- se as PropertyValue
114
+ me as PropertyValue
115
115
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyValue.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/PropertyValue/PropertyValue.styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAU9C,eAAO,MAAM,mBAAmB,EAAE,mBAsQjC,CAAC"}
1
+ {"version":3,"file":"PropertyValue.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/PropertyValue/PropertyValue.styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAU9C,eAAO,MAAM,mBAAmB,EAAE,mBA0QjC,CAAC"}