@telefonica/mistica 15.15.0 → 15.16.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.
package/dist-es/table.js CHANGED
@@ -77,30 +77,30 @@ function _object_without_properties_loose(source, excluded) {
77
77
  }
78
78
  return target;
79
79
  }
80
- import { jsxs as y, jsx as e } from "react/jsx-runtime";
81
- import * as K from "react";
82
- import { getPrefixedDataAttributes as Q } from "./utils/dom.js";
83
- import { table as U, boxed as X, collapsedRowsInMobile as H, fullWidth as D, hiddenHeadersInDesktop as V, hiddenHeadersInMobile as W, cellTextAlign as O, verticalAlign as S, rowFirstItem as N, rowLastItem as L, rowLastCollapsedItem as M, mobileCellHeading as ee, collapsedRowTitle as te, actionsTableCell as E, topActions as le, scrollContainer as re, scrollOverResponsiveLayout as ae, vars as oe } from "./table.css-mistica.js";
84
- import { vars as Y } from "./skins/skin-contract.css-mistica.js";
85
- import se, { Text1 as _, textProps as m, Text2 as ne } from "./text.js";
86
- import { InternalBoxed as ie } from "./boxed.js";
87
- import n from "classnames";
88
- import ce from "./box.js";
89
- import { applyCssVars as de } from "./utils/css.js";
90
- import me from "./inline.js";
91
- import { IconButton as pe, ToggleIconButton as be } from "./icon-button.js";
92
- import { iconContainerSize as j, iconSize as he } from "./icon-button.css-mistica.js";
93
- import { TableActionsHeader as ue } from "./table-actions-header.js";
94
- const C = {
80
+ import { jsxs as f, jsx as e } from "react/jsx-runtime";
81
+ import * as U from "react";
82
+ import { getPrefixedDataAttributes as X } from "./utils/dom.js";
83
+ import { table as V, boxed as W, collapsedRowsInMobile as O, fullWidth as M, hiddenHeadersInDesktop as ee, hiddenHeadersInMobile as te, cellTextAlign as E, verticalAlign as L, rowFirstItem as N, rowLastItem as R, rowLastCollapsedItem as H, collapsedRowHeaderItem as le, mobileCellHeading as re, collapsedRowTitle as ae, actionsTableCell as Y, topActions as oe, scrollContainer as se, scrollOverResponsiveLayout as ne, vars as ie } from "./table.css-mistica.js";
84
+ import { vars as _ } from "./skins/skin-contract.css-mistica.js";
85
+ import ce, { Text1 as j, textProps as b, Text2 as me } from "./text.js";
86
+ import { InternalBoxed as de } from "./boxed.js";
87
+ import c from "classnames";
88
+ import pe from "./box.js";
89
+ import { applyCssVars as be } from "./utils/css.js";
90
+ import he from "./inline.js";
91
+ import { IconButton as ue, ToggleIconButton as ge } from "./icon-button.js";
92
+ import { iconContainerSize as F, iconSize as ye } from "./icon-button.css-mistica.js";
93
+ import { TableActionsHeader as fe } from "./table-actions-header.js";
94
+ const P = {
95
95
  default: "8px",
96
96
  boxed: "16px"
97
- }, F = "1px", ge = (a)=>a.Icon ? /* @__PURE__ */ e(pe, _object_spread_props(_object_spread({}, a), {
97
+ }, G = "1px", ke = (a)=>a.Icon ? /* @__PURE__ */ e(ue, _object_spread_props(_object_spread({}, a), {
98
98
  "aria-label": a.label,
99
99
  small: !0,
100
100
  type: "neutral",
101
101
  backgroundType: "transparent",
102
102
  bleedY: !0
103
- })) : /* @__PURE__ */ e(be, _object_spread_props(_object_spread({}, a), {
103
+ })) : /* @__PURE__ */ e(ge, _object_spread_props(_object_spread({}, a), {
104
104
  checkedProps: _object_spread_props(_object_spread({}, a.checkedProps), {
105
105
  "aria-label": a.checkedProps.label,
106
106
  type: "brand",
@@ -113,8 +113,8 @@ const C = {
113
113
  }),
114
114
  small: !0,
115
115
  bleedY: !0
116
- })), G = "left", we = /*#__PURE__*/ K.forwardRef((_param, R)=>{
117
- var { dataAttributes: a, heading: i = [], content: f = [], boxed: p, responsive: Z, fullWidth: b = !0, maxHeight: k, emptyCase: I, columnTextAlign: x = G, rowVerticalAlign: A = "middle", columnWidth: c, hideHeaders: h, scrollOverResponsiveLayout: q } = _param, T = _object_without_properties(_param, [
116
+ })), Z = "left", we = /*#__PURE__*/ U.forwardRef((_param, $)=>{
117
+ var { dataAttributes: a, heading: m = [], content: k = [], boxed: h, responsive: q, fullWidth: u = !0, maxHeight: v, emptyCase: A, columnTextAlign: T = Z, rowVerticalAlign: C = "middle", columnWidth: d, hideHeaders: g, scrollOverResponsiveLayout: J, rowHeaderIndex: s } = _param, S = _object_without_properties(_param, [
118
118
  "dataAttributes",
119
119
  "heading",
120
120
  "content",
@@ -127,177 +127,183 @@ const C = {
127
127
  "rowVerticalAlign",
128
128
  "columnWidth",
129
129
  "hideHeaders",
130
- "scrollOverResponsiveLayout"
130
+ "scrollOverResponsiveLayout",
131
+ "rowHeaderIndex"
131
132
  ]);
132
- const w = (t)=>{
133
- var _x_t;
134
- return Array.isArray(x) ? (_x_t = x[t]) !== null && _x_t !== void 0 ? _x_t : G : x;
135
- }, l = Z === "collapse-rows", P = h === !0 || h === "mobile", J = h === !0 || h === "desktop", u = f.some((t)=>!Array.isArray(t) && t.actions.length > 0), $ = /* @__PURE__ */ y("table", {
136
- className: n(U, {
137
- [X]: p,
138
- [H]: l,
139
- [D]: b,
140
- [V]: J,
141
- [W]: P || l
133
+ const x = (l)=>{
134
+ var _T_l;
135
+ return Array.isArray(T) ? (_T_l = T[l]) !== null && _T_l !== void 0 ? _T_l : Z : T;
136
+ }, r = q === "collapse-rows", z = g === !0 || g === "mobile", K = g === !0 || g === "desktop", y = k.some((l)=>!Array.isArray(l) && l.actions.length > 0), B = /* @__PURE__ */ f("table", {
137
+ className: c(V, {
138
+ [W]: h,
139
+ [O]: r,
140
+ [M]: u,
141
+ [ee]: K,
142
+ [te]: z || r
142
143
  }),
143
- "aria-label": T["aria-label"],
144
- "aria-labelledby": T["aria-labelledby"],
145
- "aria-describedby": T["aria-describedby"],
144
+ "aria-label": S["aria-label"],
145
+ "aria-labelledby": S["aria-labelledby"],
146
+ "aria-describedby": S["aria-describedby"],
146
147
  children: [
147
- i.length > 0 && /* @__PURE__ */ e("thead", {
148
- children: /* @__PURE__ */ y(_, {
148
+ m.length > 0 && /* @__PURE__ */ e("thead", {
149
+ children: /* @__PURE__ */ f(j, {
149
150
  as: "tr",
150
151
  medium: !0,
151
152
  transform: "uppercase",
152
- color: Y.colors.textSecondary,
153
+ color: _.colors.textSecondary,
153
154
  wordBreak: !1,
154
155
  children: [
155
- i.map((t, o)=>/* @__PURE__ */ e("th", {
156
+ m.map((l, o)=>/* @__PURE__ */ e("th", {
156
157
  scope: "col",
157
- className: n(O[w(o)], S[A], {
158
+ className: c(E[x(o)], L[C], {
158
159
  [N]: o === 0,
159
- [L]: o === i.length - 1 && !u
160
+ [R]: o === m.length - 1 && !y
160
161
  }),
161
162
  style: {
162
- minWidth: c == null ? void 0 : c[o],
163
- width: c == null ? void 0 : c[o]
163
+ minWidth: d == null ? void 0 : d[o],
164
+ width: d == null ? void 0 : d[o]
164
165
  },
165
- children: t
166
+ children: l
166
167
  }, o)),
167
- u && /* @__PURE__ */ e(ue, {})
168
+ y && /* @__PURE__ */ e(fe, {})
168
169
  ]
169
170
  })
170
171
  }),
171
172
  /* @__PURE__ */ e("tbody", {
172
- children: f.length > 0 ? f.map((t, o)=>{
173
- var _t_actions;
174
- const g = Array.isArray(t) ? t : t.cells, s = Array.isArray(t) ? [] : (_t_actions = t.actions) !== null && _t_actions !== void 0 ? _t_actions : [], B = /* @__PURE__ */ e(me, {
173
+ children: k.length > 0 ? k.map((l, o)=>{
174
+ var _l_actions;
175
+ const n = Array.isArray(l) ? l : l.cells, i = Array.isArray(l) ? [] : (_l_actions = l.actions) !== null && _l_actions !== void 0 ? _l_actions : [], D = /* @__PURE__ */ e(he, {
175
176
  space: 16,
176
- children: s.map((d, r)=>"Icon" in d || "checkedProps" in d ? /* @__PURE__ */ e(ge, _object_spread({}, d), r) : d)
177
- }), v = s.length ? `calc(${j.small} * ${s.length} + 16px * ${s.length - 1})` : "0px";
177
+ children: i.map((p, t)=>"Icon" in p || "checkedProps" in p ? /* @__PURE__ */ e(ke, _object_spread({}, p), t) : p)
178
+ }), I = i.length ? `calc(${F.small} * ${i.length} + 16px * ${i.length - 1})` : "0px";
178
179
  return(// Add position relative because in collapse-rows mode, actions are positioned absolutely in the row
179
- /* @__PURE__ */ y("tr", {
180
+ /* @__PURE__ */ f("tr", {
180
181
  style: {
181
182
  position: "relative"
182
183
  },
183
184
  children: [
184
- g.map((d, r)=>/* @__PURE__ */ y("td", {
185
- className: n(S[A], {
186
- [N]: r === 0,
187
- [L]: r === g.length - 1 && !u,
188
- [M]: r === g.length - 1 && l
185
+ n.map((p, t)=>{
186
+ const Q = s === n.length - 1 ? t === n.length - 2 || n.length === 1 : t === n.length - 1;
187
+ return /* @__PURE__ */ f(t === s ? "th" : "td", {
188
+ className: c(L[C], {
189
+ [N]: t === 0,
190
+ [R]: t === n.length - 1 && !y,
191
+ [H]: Q && r,
192
+ [le]: t === s && r
189
193
  }),
190
194
  style: {
191
195
  // add space between top actions and content
192
- marginRight: l && s.length ? `calc(${v} + 8px)` : void 0
196
+ marginRight: r && i.length ? `calc(${I} + 8px)` : void 0
193
197
  },
198
+ scope: t === s ? "row" : void 0,
194
199
  children: [
195
- r !== 0 && l && i[r] && !P && // this is aria-hidden because screen readers already read the column heading from the th
200
+ t !== s && r && m[t] && !z && // this is aria-hidden because screen readers already read the column heading from the th
196
201
  /* @__PURE__ */ e("div", {
197
- className: ee,
202
+ className: re,
198
203
  "aria-hidden": !0,
199
- children: /* @__PURE__ */ e(_, {
204
+ children: /* @__PURE__ */ e(j, {
200
205
  medium: !0,
201
- color: Y.colors.textSecondary,
202
- children: i[r]
206
+ color: _.colors.textSecondary,
207
+ children: m[t]
203
208
  })
204
209
  }),
205
- /* @__PURE__ */ e(se, _object_spread_props(_object_spread({
206
- desktopSize: m.text2.desktopSize,
207
- desktopLineHeight: m.text2.desktopLineHeight
208
- }, r === 0 && l ? {
209
- mobileSize: m.text4.mobileSize,
210
- mobileLineHeight: m.text4.mobileLineHeight
210
+ /* @__PURE__ */ e(ce, _object_spread_props(_object_spread({
211
+ desktopSize: b.text2.desktopSize,
212
+ desktopLineHeight: b.text2.desktopLineHeight
213
+ }, t === s && r ? {
214
+ mobileSize: b.text4.mobileSize,
215
+ mobileLineHeight: b.text4.mobileLineHeight
211
216
  } : {
212
- mobileSize: m.text2.mobileSize,
213
- mobileLineHeight: m.text2.mobileLineHeight
217
+ mobileSize: b.text2.mobileSize,
218
+ mobileLineHeight: b.text2.mobileLineHeight
214
219
  }), {
215
220
  as: "div",
216
221
  wordBreak: !1,
217
222
  children: /* @__PURE__ */ e("div", {
218
- className: n(O[w(r)], {
219
- [te]: r === 0 && l
223
+ className: c(E[x(t)], {
224
+ [ae]: t === s && r
220
225
  }),
221
- children: d
226
+ children: p
222
227
  })
223
228
  }))
224
229
  ]
225
- }, r)),
226
- s.length > 0 ? /* @__PURE__ */ e("td", {
227
- className: n(S[A], E, L, {
228
- [N]: g.length === 0
230
+ });
231
+ }),
232
+ i.length > 0 ? /* @__PURE__ */ e("td", {
233
+ className: c(L[C], Y, R, {
234
+ [N]: n.length === 0
229
235
  }),
230
236
  align: "right",
231
237
  style: {
232
- width: `calc(${v} + 12px)`
238
+ width: `calc(${I} + 12px)`
233
239
  },
234
- children: B
235
- }) : u && /* @__PURE__ */ e("td", {
236
- className: E
240
+ children: D
241
+ }) : y && /* @__PURE__ */ e("td", {
242
+ className: Y
237
243
  }),
238
- l && s.length > 0 && /* @__PURE__ */ e("td", {
239
- className: le,
244
+ r && i.length > 0 && /* @__PURE__ */ e("td", {
245
+ className: oe,
240
246
  style: {
241
247
  position: "absolute",
242
- top: `calc(${p ? C.boxed : C.default} - ${F} + (${j.small} - ${he.small}) / 2)`,
243
- right: p ? `calc(${C.boxed} - ${F})` : 0,
244
- width: v
248
+ top: `calc(${h ? P.boxed : P.default} - ${G} + (${F.small} - ${ye.small}) / 2)`,
249
+ right: h ? `calc(${P.boxed} - ${G})` : 0,
250
+ width: I
245
251
  },
246
- children: B
252
+ children: D
247
253
  })
248
254
  ]
249
255
  }, o));
250
256
  }) : /* @__PURE__ */ e("tr", {
251
257
  children: /* @__PURE__ */ e("td", {
252
- colSpan: i.length,
253
- className: n({
254
- [M]: l
258
+ colSpan: m.length,
259
+ className: c({
260
+ [H]: r
255
261
  }),
256
- children: typeof I == "string" ? /* @__PURE__ */ e(ce, {
262
+ children: typeof A == "string" ? /* @__PURE__ */ e(pe, {
257
263
  paddingY: 56,
258
- children: /* @__PURE__ */ e(ne, {
264
+ children: /* @__PURE__ */ e(me, {
259
265
  regular: !0,
260
266
  textAlign: "center",
261
267
  as: "div",
262
- children: I
268
+ children: A
263
269
  })
264
- }) : I
270
+ }) : A
265
271
  })
266
272
  })
267
273
  })
268
274
  ]
269
- }), z = function() {
270
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
275
+ }), w = function() {
276
+ let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
271
277
  return {
272
- className: n(re, {
273
- [ae]: t,
274
- [H]: l,
275
- [D]: b
278
+ className: c(se, {
279
+ [ne]: l,
280
+ [O]: r,
281
+ [M]: u
276
282
  }),
277
- style: de({
278
- [oe.maxHeight]: typeof k == "number" ? `${k}px` : k !== null && k !== void 0 ? k : "auto"
283
+ style: be({
284
+ [ie.maxHeight]: typeof v == "number" ? `${v}px` : v !== null && v !== void 0 ? v : "auto"
279
285
  })
280
286
  };
281
287
  };
282
- return p ? /* @__PURE__ */ e(ie, {
283
- desktopOnly: l,
288
+ return h ? /* @__PURE__ */ e(de, {
289
+ desktopOnly: r,
284
290
  width: "fit-content",
285
291
  maxWidth: "100%",
286
292
  minWidth: {
287
- desktop: b ? "100%" : "auto",
288
- mobile: l || b ? "100%" : "auto"
293
+ desktop: u ? "100%" : "auto",
294
+ mobile: r || u ? "100%" : "auto"
289
295
  },
290
- ref: R,
296
+ ref: $,
291
297
  dataAttributes: _object_spread({
292
298
  "component-name": "Table"
293
299
  }, a),
294
- children: /* @__PURE__ */ e("div", _object_spread_props(_object_spread({}, z()), {
295
- children: $
300
+ children: /* @__PURE__ */ e("div", _object_spread_props(_object_spread({}, w()), {
301
+ children: B
296
302
  }))
297
303
  }) : /* @__PURE__ */ e("div", _object_spread_props(_object_spread({
298
- ref: R
299
- }, Q(a, "Table"), z(q)), {
300
- children: $
304
+ ref: $
305
+ }, X(a, "Table"), w(J)), {
306
+ children: B
301
307
  }));
302
308
  });
303
309
  export { we as Table };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/mistica",
3
- "version": "15.15.0",
3
+ "version": "15.16.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",