@telefonica/mistica 15.15.0 → 15.16.1

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