@telefonica/mistica 16.5.0 → 16.6.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.
Files changed (74) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/callout.js +27 -15
  3. package/dist/card.css-mistica.js +5 -5
  4. package/dist/card.d.ts +9 -1
  5. package/dist/card.js +611 -475
  6. package/dist/community/advanced-data-card.css-mistica.js +14 -11
  7. package/dist/community/advanced-data-card.css.d.ts +1 -0
  8. package/dist/community/advanced-data-card.d.ts +1 -1
  9. package/dist/community/advanced-data-card.js +172 -85
  10. package/dist/cover-hero.css-mistica.js +14 -11
  11. package/dist/cover-hero.css.d.ts +1 -0
  12. package/dist/cover-hero.d.ts +1 -0
  13. package/dist/cover-hero.js +101 -59
  14. package/dist/empty-state.js +24 -15
  15. package/dist/header.css-mistica.js +6 -3
  16. package/dist/header.css.d.ts +1 -0
  17. package/dist/header.d.ts +3 -2
  18. package/dist/header.js +148 -79
  19. package/dist/hero.css-mistica.js +11 -8
  20. package/dist/hero.css.d.ts +1 -0
  21. package/dist/hero.d.ts +2 -1
  22. package/dist/hero.js +102 -68
  23. package/dist/highlighted-card.js +32 -23
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +4 -0
  26. package/dist/maybe-dismissable.js +8 -5
  27. package/dist/meter.d.ts +23 -0
  28. package/dist/meter.js +400 -0
  29. package/dist/package-version.js +1 -1
  30. package/dist/sheet-common.css-mistica.js +16 -10
  31. package/dist/sheet-common.css.d.ts +3 -1
  32. package/dist/sheet-common.js +78 -70
  33. package/dist/sheet-info.css-mistica.js +15 -4
  34. package/dist/sheet-info.css.d.ts +2 -0
  35. package/dist/sheet-info.d.ts +3 -0
  36. package/dist/sheet-info.js +61 -43
  37. package/dist/sheet-native.js +59 -48
  38. package/dist/sheet-types.d.ts +6 -1
  39. package/dist/sheet-web.js +6 -4
  40. package/dist/text-tokens.d.ts +10 -0
  41. package/dist/text-tokens.js +54 -38
  42. package/dist/theme-context-provider.js +60 -50
  43. package/dist/theme.d.ts +3 -2
  44. package/dist/utils/headings.d.ts +2 -0
  45. package/dist/utils/headings.js +11 -0
  46. package/dist/utils/types.d.ts +1 -0
  47. package/dist-es/callout.js +55 -43
  48. package/dist-es/card.css-mistica.js +2 -2
  49. package/dist-es/card.js +721 -588
  50. package/dist-es/community/advanced-data-card.css-mistica.js +3 -3
  51. package/dist-es/community/advanced-data-card.js +217 -130
  52. package/dist-es/cover-hero.css-mistica.js +3 -3
  53. package/dist-es/cover-hero.js +132 -90
  54. package/dist-es/empty-state.js +40 -31
  55. package/dist-es/header.css-mistica.js +2 -2
  56. package/dist-es/header.js +174 -104
  57. package/dist-es/hero.css-mistica.js +2 -2
  58. package/dist-es/hero.js +150 -115
  59. package/dist-es/highlighted-card.js +36 -27
  60. package/dist-es/index.js +1839 -1838
  61. package/dist-es/maybe-dismissable.js +17 -14
  62. package/dist-es/meter.js +346 -0
  63. package/dist-es/package-version.js +1 -1
  64. package/dist-es/sheet-common.css-mistica.js +2 -2
  65. package/dist-es/sheet-common.js +124 -116
  66. package/dist-es/sheet-info.css-mistica.js +2 -2
  67. package/dist-es/sheet-info.js +74 -56
  68. package/dist-es/sheet-native.js +59 -48
  69. package/dist-es/sheet-web.js +10 -8
  70. package/dist-es/style.css +1 -1
  71. package/dist-es/text-tokens.js +30 -20
  72. package/dist-es/theme-context-provider.js +88 -78
  73. package/dist-es/utils/headings.js +2 -0
  74. package/package.json +2 -1
@@ -29,13 +29,13 @@ function _async_to_generator(fn) {
29
29
  }
30
30
  const I = (e)=>Array.isArray(e) ? e.length ? e.join(`
31
31
 
32
- `) : void 0 : e, a = (e, param)=>{
33
- let { title: r, subtitle: t, description: n, selectedId: s, items: o } = param;
32
+ `) : void 0 : e, l = (e, param)=>{
33
+ let { title: i, subtitle: t, description: r, selectedId: s, items: n } = param;
34
34
  return e({
35
- title: r,
35
+ title: i,
36
36
  subtitle: t,
37
37
  // TODO: add multiline support to native sheet
38
- description: I(n),
38
+ description: I(r),
39
39
  content: [
40
40
  {
41
41
  type: "LIST",
@@ -45,26 +45,26 @@ const I = (e)=>Array.isArray(e) ? e.length ? e.join(`
45
45
  selectedIds: typeof s == "string" ? [
46
46
  s
47
47
  ] : [],
48
- items: o
48
+ items: n
49
49
  }
50
50
  ]
51
51
  }).then((param)=>{
52
- let { action: i, result: d } = param;
53
- return i === "SUBMIT" ? {
54
- action: i,
52
+ let { action: o, result: d } = param;
53
+ return o === "SUBMIT" ? {
54
+ action: o,
55
55
  selectedId: d[0].selectedIds[0]
56
56
  } : {
57
- action: i,
57
+ action: o,
58
58
  selectedId: null
59
59
  };
60
60
  });
61
61
  }, T = (e, param)=>{
62
- let { title: r, subtitle: t, description: n, items: s } = param;
62
+ let { title: i, subtitle: t, description: r, items: s } = param;
63
63
  return e({
64
- title: r,
64
+ title: i,
65
65
  subtitle: t,
66
66
  // TODO: add multiline support to native sheet
67
- description: I(n),
67
+ description: I(r),
68
68
  content: [
69
69
  {
70
70
  type: "LIST",
@@ -76,61 +76,72 @@ const I = (e)=>Array.isArray(e) ? e.length ? e.join(`
76
76
  }
77
77
  ]
78
78
  }).then((param)=>{
79
- let { action: o, result: i } = param;
80
- return o === "SUBMIT" ? {
81
- action: o,
82
- selectedId: i[0].selectedIds[0]
79
+ let { action: n, result: o } = param;
80
+ return n === "SUBMIT" ? {
81
+ action: n,
82
+ selectedId: o[0].selectedIds[0]
83
83
  } : {
84
- action: o,
84
+ action: n,
85
85
  selectedId: null
86
86
  };
87
87
  });
88
88
  }, N = function() {
89
89
  var _ref = _async_to_generator(function*(e, param) {
90
- let { title: r, subtitle: t, description: n, items: s } = param;
91
- yield e({
92
- title: r,
90
+ let { title: i, subtitle: t, description: r, items: s, button: n } = param;
91
+ const o = {
92
+ type: "LIST",
93
+ id: "list-0",
94
+ listType: "INFORMATIVE",
95
+ autoSubmit: !1,
96
+ selectedIds: [],
97
+ items: s
98
+ };
99
+ return yield e({
100
+ title: i,
93
101
  subtitle: t,
94
102
  // TODO: add multiline support to native sheet
95
- description: I(n),
96
- content: [
103
+ description: I(r),
104
+ content: n ? [
105
+ o,
97
106
  {
98
- type: "LIST",
99
- id: "list-0",
100
- listType: "INFORMATIVE",
101
- autoSubmit: !1,
102
- selectedIds: [],
103
- items: s
107
+ type: "BOTTOM_ACTIONS",
108
+ id: "bottom-actions-0",
109
+ button: n
104
110
  }
111
+ ] : [
112
+ o
105
113
  ]
106
- });
114
+ }).then(()=>({
115
+ // this is an informative sheet, it can only be dismissed
116
+ action: "DISMISS"
117
+ }));
107
118
  });
108
119
  return function N(e, _) {
109
120
  return _ref.apply(this, arguments);
110
121
  };
111
- }(), p = (e, param)=>{
112
- let { title: r, subtitle: t, description: n, button: s, secondaryButton: o, link: i } = param;
122
+ }(), h = (e, param)=>{
123
+ let { title: i, subtitle: t, description: r, button: s, secondaryButton: n, link: o } = param;
113
124
  return e({
114
- title: r,
125
+ title: i,
115
126
  subtitle: t,
116
127
  // TODO: add multiline support to native sheet
117
- description: I(n),
128
+ description: I(r),
118
129
  content: [
119
130
  {
120
131
  type: "BOTTOM_ACTIONS",
121
132
  id: "bottom-actions-0",
122
133
  button: s,
123
- secondaryButton: o,
124
- link: i
134
+ secondaryButton: n,
135
+ link: o
125
136
  }
126
137
  ]
127
138
  }).then((param)=>{
128
- let { action: d, result: l } = param;
139
+ let { action: d, result: u } = param;
129
140
  if (d === "SUBMIT") {
130
- const u = l.find((param)=>{
131
- let { id: S } = param;
132
- return S === "bottom-actions-0";
133
- }), c = u == null ? void 0 : u.selectedIds[0];
141
+ const S = u.find((param)=>{
142
+ let { id: a } = param;
143
+ return a === "bottom-actions-0";
144
+ }), c = S == null ? void 0 : S.selectedIds[0];
134
145
  if (c === "PRIMARY" || c === "SECONDARY" || c === "LINK") return {
135
146
  action: c
136
147
  };
@@ -139,10 +150,10 @@ const I = (e)=>Array.isArray(e) ? e.length ? e.join(`
139
150
  action: "DISMISS"
140
151
  };
141
152
  });
142
- }, h = (e, r)=>{
153
+ }, p = (e, i)=>{
143
154
  let t;
144
- const { type: n, props: s } = r;
145
- switch(n){
155
+ const { type: r, props: s } = i;
156
+ switch(r){
146
157
  case "INFO":
147
158
  t = N(e, s);
148
159
  break;
@@ -150,15 +161,15 @@ const I = (e)=>Array.isArray(e) ? e.length ? e.join(`
150
161
  t = T(e, s);
151
162
  break;
152
163
  case "RADIO_LIST":
153
- t = a(e, s);
164
+ t = l(e, s);
154
165
  break;
155
166
  case "ACTIONS":
156
- t = p(e, s);
167
+ t = h(e, s);
157
168
  break;
158
169
  default:
159
- const o = n;
160
- throw new Error(`Unknown sheet type: ${o}`);
170
+ const n = r;
171
+ throw new Error(`Unknown sheet type: ${n}`);
161
172
  }
162
173
  return t;
163
174
  };
164
- export { h as showNativeSheet };
175
+ export { p as showNativeSheet };
@@ -53,17 +53,19 @@ function _object_spread_props(target, source) {
53
53
  }
54
54
  import { jsx as c } from "react/jsx-runtime";
55
55
  import * as o from "react";
56
- import { useTheme as l } from "./hooks.js";
57
- import u from "./image.js";
58
- const S = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-actions" */ "./sheet-actions.js")), I = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-info" */ "./sheet-info.js")), p = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-action-list" */ "./sheet-actions-list.js")), d = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-radio-list" */ "./sheet-radio-list.js")), w = (param)=>{
56
+ import { useTheme as S } from "./hooks.js";
57
+ import l from "./image.js";
58
+ const u = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-actions" */ "./sheet-actions.js")), I = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-info" */ "./sheet-info.js")), p = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-action-list" */ "./sheet-actions-list.js")), f = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-radio-list" */ "./sheet-radio-list.js")), w = (param)=>{
59
59
  let { sheetProps: t, onResolve: e } = param;
60
- const { isDarkMode: s } = l(), r = o.useRef(null), i = (n)=>{
60
+ const { isDarkMode: s } = S(), r = o.useRef(null), i = (n)=>{
61
61
  r.current = n;
62
62
  }, a = ()=>{
63
63
  if (!e) throw new Error("onResolve handler is not set");
64
64
  switch(t.type){
65
65
  case "INFO":
66
- e(void 0);
66
+ e({
67
+ action: "DISMISS"
68
+ });
67
69
  break;
68
70
  case "ACTIONS_LIST":
69
71
  r.current ? e({
@@ -104,9 +106,9 @@ const S = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-actions" *
104
106
  onSelect: i
105
107
  }));
106
108
  case "RADIO_LIST":
107
- return /* @__PURE__ */ c(d, _object_spread_props(_object_spread({}, t.props), {
109
+ return /* @__PURE__ */ c(f, _object_spread_props(_object_spread({}, t.props), {
108
110
  items: t.props.items.map((n)=>_object_spread_props(_object_spread({}, n), {
109
- asset: n.icon && /* @__PURE__ */ c(u, {
111
+ asset: n.icon && /* @__PURE__ */ c(l, {
110
112
  circular: !0,
111
113
  src: s && n.icon.urlDark ? n.icon.urlDark : n.icon.url,
112
114
  width: n.icon.size === "small" ? 24 : 40
@@ -116,7 +118,7 @@ const S = /*#__PURE__*/ o.lazy(()=>import(/* webpackChunkName: "sheet-actions" *
116
118
  onSelect: i
117
119
  }));
118
120
  case "ACTIONS":
119
- return /* @__PURE__ */ c(S, _object_spread_props(_object_spread({}, t.props), {
121
+ return /* @__PURE__ */ c(u, _object_spread_props(_object_spread({}, t.props), {
120
122
  buttonLink: t.props.link,
121
123
  onClose: a,
122
124
  onPressButton: i