@telefonica/mistica 14.40.0 → 14.42.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 (259) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/accordion.css-mistica.js +7 -7
  3. package/dist/avatar.css-mistica.js +1 -1
  4. package/dist/badge.css-mistica.js +3 -3
  5. package/dist/boxed.css-mistica.js +14 -5
  6. package/dist/boxed.css.d.ts +1 -0
  7. package/dist/boxed.d.ts +1 -0
  8. package/dist/boxed.js +11 -9
  9. package/dist/button-fixed-footer-layout.d.ts +1 -0
  10. package/dist/button-fixed-footer-layout.js +19 -14
  11. package/dist/button-group.css-mistica.js +1 -1
  12. package/dist/button-layout.css-mistica.js +17 -14
  13. package/dist/button-layout.css.d.ts +1 -0
  14. package/dist/button-layout.js +15 -15
  15. package/dist/button.css-mistica.js +30 -30
  16. package/dist/button.js +43 -35
  17. package/dist/callout.css-mistica.js +1 -1
  18. package/dist/card.css-mistica.js +15 -15
  19. package/dist/carousel.css-mistica.js +20 -20
  20. package/dist/carousel.d.ts +13 -0
  21. package/dist/carousel.js +325 -223
  22. package/dist/checkbox.css-mistica.js +10 -10
  23. package/dist/chip.css-mistica.js +4 -4
  24. package/dist/circle.css-mistica.js +2 -2
  25. package/dist/community/advanced-data-card.css-mistica.js +14 -14
  26. package/dist/community/blocks.css-mistica.js +3 -3
  27. package/dist/counter.css-mistica.js +7 -7
  28. package/dist/credit-card-expiration-field.js +30 -26
  29. package/dist/credit-card-number-field.css-mistica.js +7 -7
  30. package/dist/credit-card-number-field.js +59 -45
  31. package/dist/cvv-field.js +46 -41
  32. package/dist/date-field.css-mistica.js +14 -0
  33. package/dist/date-field.css.d.ts +1 -0
  34. package/dist/date-field.css.ts.vanilla.css-mistica.js +11 -0
  35. package/dist/date-field.js +41 -35
  36. package/dist/date-time-field.js +40 -34
  37. package/dist/date-time-picker.js +43 -45
  38. package/dist/decimal-field.js +26 -22
  39. package/dist/dialog-context.d.ts +24 -0
  40. package/dist/dialog-context.js +192 -0
  41. package/dist/dialog.css-mistica.js +17 -14
  42. package/dist/dialog.css.d.ts +1 -0
  43. package/dist/dialog.d.ts +14 -44
  44. package/dist/dialog.js +161 -245
  45. package/dist/double-field.css-mistica.js +5 -4
  46. package/dist/email-field.js +15 -11
  47. package/dist/empty-state-card.css-mistica.js +1 -1
  48. package/dist/empty-state.css-mistica.js +4 -4
  49. package/dist/feedback.css-mistica.js +17 -14
  50. package/dist/feedback.css.d.ts +5 -4
  51. package/dist/feedback.js +154 -147
  52. package/dist/fixed-footer-layout.css-mistica.js +2 -2
  53. package/dist/fixed-footer-layout.js +9 -8
  54. package/dist/header.css-mistica.js +3 -3
  55. package/dist/hero.css-mistica.js +4 -4
  56. package/dist/highlighted-card.css-mistica.js +7 -7
  57. package/dist/hooks.js +61 -52
  58. package/dist/horizontal-scroll.css-mistica.js +2 -2
  59. package/dist/iban-field.js +31 -27
  60. package/dist/icon-button.css-mistica.js +1 -1
  61. package/dist/icons/icon-amex.d.ts +1 -1
  62. package/dist/icons/icon-cvv-amex.d.ts +1 -1
  63. package/dist/icons/icon-cvv-visa-mc.d.ts +1 -1
  64. package/dist/icons/icon-mastercard.d.ts +1 -1
  65. package/dist/icons/icon-visa.d.ts +1 -1
  66. package/dist/image.css-mistica.js +3 -3
  67. package/dist/index.d.ts +2 -2
  68. package/dist/index.js +16 -4
  69. package/dist/inline.css-mistica.js +9 -6
  70. package/dist/inline.css.d.ts +1 -1
  71. package/dist/inline.js +9 -9
  72. package/dist/integer-field.js +17 -13
  73. package/dist/list.css-mistica.js +15 -15
  74. package/dist/loading-bar.css-mistica.js +4 -7
  75. package/dist/loading-bar.css.d.ts +0 -2
  76. package/dist/loading-bar.js +3 -6
  77. package/dist/loading-screen.css-mistica.js +6 -6
  78. package/dist/maybe-dismissable.css-mistica.js +1 -1
  79. package/dist/menu.css-mistica.js +3 -3
  80. package/dist/month-field.js +39 -33
  81. package/dist/navigation-bar.css-mistica.js +22 -22
  82. package/dist/navigation-breadcrumbs.css-mistica.js +5 -5
  83. package/dist/package-version.js +1 -1
  84. package/dist/password-field.js +46 -44
  85. package/dist/phone-number-field.js +50 -46
  86. package/dist/pin-field.css-mistica.js +12 -6
  87. package/dist/pin-field.css.d.ts +2 -0
  88. package/dist/pin-field.d.ts +3 -1
  89. package/dist/pin-field.js +129 -95
  90. package/dist/popover.css-mistica.js +5 -5
  91. package/dist/progress-bar.css-mistica.js +4 -4
  92. package/dist/radio-button.css-mistica.js +8 -8
  93. package/dist/responsive-layout.css-mistica.js +12 -9
  94. package/dist/responsive-layout.css.d.ts +2 -1
  95. package/dist/responsive-layout.d.ts +1 -1
  96. package/dist/responsive-layout.js +20 -17
  97. package/dist/screen-reader-only.css-mistica.js +2 -2
  98. package/dist/search-field.js +36 -35
  99. package/dist/select.css-mistica.js +16 -15
  100. package/dist/select.css.d.ts +1 -0
  101. package/dist/select.js +138 -143
  102. package/dist/sheet.css-mistica.js +13 -13
  103. package/dist/sheet.js +110 -128
  104. package/dist/skeletons.css-mistica.js +5 -5
  105. package/dist/skins/blau.js +2 -0
  106. package/dist/skins/movistar-legacy.js +2 -0
  107. package/dist/skins/movistar.js +2 -0
  108. package/dist/skins/o2-classic.js +1 -0
  109. package/dist/skins/o2.js +2 -0
  110. package/dist/skins/skin-contract.css-mistica.js +184 -182
  111. package/dist/skins/skin-contract.css.d.ts +2 -0
  112. package/dist/skins/telefonica.js +2 -0
  113. package/dist/skins/types/colors.d.ts +1 -0
  114. package/dist/skins/vivo-new.js +9 -7
  115. package/dist/skins/vivo.js +2 -0
  116. package/dist/slider.css-mistica.js +4 -4
  117. package/dist/slider.js +32 -32
  118. package/dist/snackbar.css-mistica.js +14 -14
  119. package/dist/spinner.css-mistica.js +1 -1
  120. package/dist/sprinkles.css-mistica.js +778 -772
  121. package/dist/stacking-group.css-mistica.js +2 -2
  122. package/dist/stepper.css-mistica.js +10 -10
  123. package/dist/switch-component.css-mistica.js +20 -20
  124. package/dist/tabs.css-mistica.js +10 -10
  125. package/dist/tag.css-mistica.js +1 -1
  126. package/dist/text-field-base.css-mistica.js +45 -21
  127. package/dist/text-field-base.css.d.ts +30 -7
  128. package/dist/text-field-base.d.ts +11 -0
  129. package/dist/text-field-base.js +175 -140
  130. package/dist/text-field-components.css-mistica.js +13 -21
  131. package/dist/text-field-components.css.d.ts +0 -3
  132. package/dist/text-field-components.d.ts +3 -0
  133. package/dist/text-field-components.js +38 -35
  134. package/dist/text-field.js +26 -22
  135. package/dist/text-link.css-mistica.js +3 -3
  136. package/dist/theme-context-provider.js +2 -2
  137. package/dist/tooltip.css-mistica.js +4 -4
  138. package/dist/touchable.css-mistica.js +3 -3
  139. package/dist/utils/aspect-ratio-support.css-mistica.js +3 -3
  140. package/dist/utils/platform.js +8 -11
  141. package/dist/video.css-mistica.js +2 -2
  142. package/dist-es/accordion.css-mistica.js +3 -3
  143. package/dist-es/avatar.css-mistica.js +1 -1
  144. package/dist-es/badge.css-mistica.js +2 -2
  145. package/dist-es/boxed.css-mistica.js +3 -2
  146. package/dist-es/boxed.js +17 -15
  147. package/dist-es/button-fixed-footer-layout.js +29 -24
  148. package/dist-es/button-group.css-mistica.js +1 -1
  149. package/dist-es/button-layout.css-mistica.js +7 -7
  150. package/dist-es/button-layout.js +23 -23
  151. package/dist-es/button.css-mistica.js +18 -18
  152. package/dist-es/button.js +65 -57
  153. package/dist-es/callout.css-mistica.js +1 -1
  154. package/dist-es/card.css-mistica.js +2 -2
  155. package/dist-es/carousel.css-mistica.js +2 -2
  156. package/dist-es/carousel.js +373 -280
  157. package/dist-es/checkbox.css-mistica.js +6 -6
  158. package/dist-es/chip.css-mistica.js +4 -4
  159. package/dist-es/circle.css-mistica.js +2 -2
  160. package/dist-es/community/advanced-data-card.css-mistica.js +3 -3
  161. package/dist-es/community/blocks.css-mistica.js +2 -2
  162. package/dist-es/counter.css-mistica.js +2 -2
  163. package/dist-es/credit-card-expiration-field.js +34 -30
  164. package/dist-es/credit-card-number-field.css-mistica.js +4 -4
  165. package/dist-es/credit-card-number-field.js +84 -70
  166. package/dist-es/cvv-field.js +68 -63
  167. package/dist-es/date-field.css-mistica.js +5 -0
  168. package/dist-es/date-field.css.ts.vanilla.css-mistica.js +2 -0
  169. package/dist-es/date-field.js +46 -40
  170. package/dist-es/date-time-field.js +47 -41
  171. package/dist-es/date-time-picker.js +55 -57
  172. package/dist-es/decimal-field.js +31 -27
  173. package/dist-es/dialog-context.js +125 -0
  174. package/dist-es/dialog.css-mistica.js +5 -5
  175. package/dist-es/dialog.js +192 -262
  176. package/dist-es/double-field.css-mistica.js +5 -4
  177. package/dist-es/email-field.js +16 -12
  178. package/dist-es/empty-state-card.css-mistica.js +1 -1
  179. package/dist-es/empty-state.css-mistica.js +3 -3
  180. package/dist-es/feedback.css-mistica.js +2 -2
  181. package/dist-es/feedback.js +191 -184
  182. package/dist-es/fixed-footer-layout.css-mistica.js +2 -2
  183. package/dist-es/fixed-footer-layout.js +21 -20
  184. package/dist-es/header.css-mistica.js +2 -2
  185. package/dist-es/hero.css-mistica.js +2 -2
  186. package/dist-es/highlighted-card.css-mistica.js +5 -5
  187. package/dist-es/hooks.js +60 -51
  188. package/dist-es/horizontal-scroll.css-mistica.js +2 -2
  189. package/dist-es/iban-field.js +42 -38
  190. package/dist-es/icon-button.css-mistica.js +1 -1
  191. package/dist-es/image.css-mistica.js +2 -2
  192. package/dist-es/index.js +1778 -1778
  193. package/dist-es/inline.css-mistica.js +3 -3
  194. package/dist-es/inline.js +18 -18
  195. package/dist-es/integer-field.js +21 -17
  196. package/dist-es/list.css-mistica.js +2 -2
  197. package/dist-es/loading-bar.css-mistica.js +2 -2
  198. package/dist-es/loading-bar.js +10 -13
  199. package/dist-es/loading-screen.css-mistica.js +2 -2
  200. package/dist-es/maybe-dismissable.css-mistica.js +1 -1
  201. package/dist-es/menu.css-mistica.js +2 -2
  202. package/dist-es/month-field.js +47 -41
  203. package/dist-es/navigation-bar.css-mistica.js +11 -11
  204. package/dist-es/navigation-breadcrumbs.css-mistica.js +2 -2
  205. package/dist-es/package-version.js +1 -1
  206. package/dist-es/password-field.js +54 -52
  207. package/dist-es/phone-number-field.js +53 -49
  208. package/dist-es/pin-field.css-mistica.js +2 -2
  209. package/dist-es/pin-field.js +145 -111
  210. package/dist-es/popover.css-mistica.js +2 -2
  211. package/dist-es/progress-bar.css-mistica.js +2 -2
  212. package/dist-es/radio-button.css-mistica.js +5 -5
  213. package/dist-es/responsive-layout.css-mistica.js +5 -5
  214. package/dist-es/responsive-layout.js +27 -24
  215. package/dist-es/screen-reader-only.css-mistica.js +2 -2
  216. package/dist-es/search-field.js +45 -44
  217. package/dist-es/select.css-mistica.js +11 -10
  218. package/dist-es/select.js +167 -172
  219. package/dist-es/sheet.css-mistica.js +2 -2
  220. package/dist-es/sheet.js +188 -206
  221. package/dist-es/skeletons.css-mistica.js +2 -2
  222. package/dist-es/skins/blau.js +2 -0
  223. package/dist-es/skins/movistar-legacy.js +2 -0
  224. package/dist-es/skins/movistar.js +2 -0
  225. package/dist-es/skins/o2-classic.js +1 -0
  226. package/dist-es/skins/o2.js +2 -0
  227. package/dist-es/skins/skin-contract.css-mistica.js +184 -182
  228. package/dist-es/skins/telefonica.js +2 -0
  229. package/dist-es/skins/vivo-new.js +9 -7
  230. package/dist-es/skins/vivo.js +2 -0
  231. package/dist-es/slider.css-mistica.js +2 -2
  232. package/dist-es/slider.js +36 -36
  233. package/dist-es/snackbar.css-mistica.js +5 -5
  234. package/dist-es/spinner.css-mistica.js +1 -1
  235. package/dist-es/sprinkles.css-mistica.js +778 -772
  236. package/dist-es/stacking-group.css-mistica.js +2 -2
  237. package/dist-es/stepper.css-mistica.js +2 -2
  238. package/dist-es/style.css +1 -1
  239. package/dist-es/switch-component.css-mistica.js +17 -17
  240. package/dist-es/tabs.css-mistica.js +8 -8
  241. package/dist-es/tag.css-mistica.js +1 -1
  242. package/dist-es/text-field-base.css-mistica.js +2 -2
  243. package/dist-es/text-field-base.js +189 -157
  244. package/dist-es/text-field-components.css-mistica.js +3 -2
  245. package/dist-es/text-field-components.js +52 -49
  246. package/dist-es/text-field.js +31 -27
  247. package/dist-es/text-link.css-mistica.js +3 -3
  248. package/dist-es/theme-context-provider.js +1 -1
  249. package/dist-es/tooltip.css-mistica.js +2 -2
  250. package/dist-es/touchable.css-mistica.js +2 -2
  251. package/dist-es/utils/aspect-ratio-support.css-mistica.js +3 -3
  252. package/dist-es/utils/platform.js +6 -6
  253. package/dist-es/video.css-mistica.js +2 -2
  254. package/package.json +2 -2
  255. package/dist/password-field.css-mistica.js +0 -13
  256. package/dist/password-field.css.d.ts +0 -1
  257. package/dist-es/password-field.css-mistica.js +0 -4
  258. /package/dist/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
  259. /package/dist-es/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
@@ -14,7 +14,7 @@ _export(exports, {
14
14
  return E;
15
15
  },
16
16
  default: function() {
17
- return $;
17
+ return q;
18
18
  }
19
19
  });
20
20
  const _jsxruntime = require("react/jsx-runtime");
@@ -145,44 +145,44 @@ function _object_without_properties_loose(source, excluded) {
145
145
  }
146
146
  return target;
147
147
  }
148
- const j = (n)=>{
148
+ const A = (o)=>{
149
149
  try {
150
- return 1.1.toLocaleString(n.replace("_", "-"))[1];
150
+ return 1.1.toLocaleString(o.replace("_", "-"))[1];
151
151
  } catch (e) {
152
152
  return ".";
153
153
  }
154
- }, B = (n, r)=>{
155
- const s = String(n !== null && n !== void 0 ? n : "").replace(/[^.,\d]/g, ""), e = /[.,]/.exec(s), t = s.split(/[.,]/);
154
+ }, B = (o, r)=>{
155
+ const s = String(o !== null && o !== void 0 ? o : "").replace(/[^.,\d]/g, ""), e = /[.,]/.exec(s), t = s.split(/[.,]/);
156
156
  return t.length === 0 ? "" : e && r > 0 ? t.shift() + e[0] + t.join("").slice(0, r) : t[0];
157
157
  }, E = (_param)=>{
158
- var { inputRef: n, value: r, defaultValue: s, onChange: e, maxDecimals: t } = _param, c = _object_without_properties(_param, [
158
+ var { inputRef: o, value: r, defaultValue: s, onChange: e, maxDecimals: t } = _param, c = _object_without_properties(_param, [
159
159
  "inputRef",
160
160
  "value",
161
161
  "defaultValue",
162
162
  "onChange",
163
163
  "maxDecimals"
164
164
  ]);
165
- const { i18n: u } = (0, _hooks.useTheme)(), f = j(u.locale), m = (o)=>String(o !== null && o !== void 0 ? o : "").replace(/[.,]/g, f), [p, d] = _react.useState(s !== null && s !== void 0 ? s : ""), i = _react.useRef(null), l = typeof r < "u", g = l ? r : p, S = _react.useCallback((o)=>{
166
- l || d(o), i.current && (e == null || e((0, _dom.createChangeEvent)(i.current, o)));
165
+ const { i18n: u } = (0, _hooks.useTheme)(), f = A(u.locale), m = (n)=>String(n !== null && n !== void 0 ? n : "").replace(/[.,]/g, f), [p, d] = _react.useState(s !== null && s !== void 0 ? s : ""), i = _react.useRef(null), l = typeof r < "u", g = l ? r : p, h = _react.useCallback((n)=>{
166
+ l || d(n), i.current && (e == null || e((0, _dom.createChangeEvent)(i.current, n)));
167
167
  }, [
168
168
  l,
169
169
  e
170
- ]), h = (0, _rifm.useRifm)({
171
- format: (o)=>B(o, t),
170
+ ]), y = (0, _rifm.useRifm)({
171
+ format: (n)=>B(n, t),
172
172
  replace: m,
173
173
  value: g,
174
- onChange: S,
174
+ onChange: h,
175
175
  accept: /[\d.,]+/g
176
176
  });
177
177
  return /* @__PURE__ */ (0, _jsxruntime.jsx)("input", _object_spread_props(_object_spread({}, c), {
178
178
  type: "text",
179
179
  inputMode: "decimal",
180
- value: h.value,
181
- onChange: h.onChange,
182
- ref: (0, _common.combineRefs)(n, i)
180
+ value: y.value,
181
+ onChange: y.onChange,
182
+ ref: (0, _common.combineRefs)(o, i)
183
183
  }));
184
184
  }, L = (_param)=>{
185
- var { disabled: n, error: r, helperText: s, name: e, optional: t, validate: c, onChange: u, onChangeValue: f, onBlur: m, value: p, defaultValue: d, maxDecimals: i = 1 / 0 } = _param, l = _object_without_properties(_param, [
185
+ var { disabled: o, error: r, helperText: s, name: e, optional: t, validate: c, onChange: u, onChangeValue: f, onBlur: m, value: p, defaultValue: d, maxDecimals: i = 1 / 0, dataAttributes: l } = _param, g = _object_without_properties(_param, [
186
186
  "disabled",
187
187
  "error",
188
188
  "helperText",
@@ -194,9 +194,10 @@ const j = (n)=>{
194
194
  "onBlur",
195
195
  "value",
196
196
  "defaultValue",
197
- "maxDecimals"
197
+ "maxDecimals",
198
+ "dataAttributes"
198
199
  ]);
199
- const { texts: g } = (0, _hooks.useTheme)(), o = (0, _formcontext.useFieldProps)({
200
+ const { texts: h } = (0, _hooks.useTheme)(), D = (0, _formcontext.useFieldProps)({
200
201
  name: e,
201
202
  value: p,
202
203
  defaultValue: d,
@@ -204,16 +205,19 @@ const j = (n)=>{
204
205
  helperText: s,
205
206
  optional: t,
206
207
  error: r,
207
- disabled: n,
208
+ disabled: o,
208
209
  onBlur: m,
209
- validate: (a, V)=>a ? c == null ? void 0 : c(a, V) : t ? "" : g.formFieldErrorIsMandatory,
210
+ validate: (a, F)=>a ? c == null ? void 0 : c(a, F) : t ? "" : h.formFieldErrorIsMandatory,
210
211
  onChange: u,
211
212
  onChangeValue: f
212
213
  });
213
- return /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldbase.TextFieldBaseAutosuggest, _object_spread_props(_object_spread({}, l, o), {
214
+ return /* @__PURE__ */ (0, _jsxruntime.jsx)(_textfieldbase.TextFieldBaseAutosuggest, _object_spread_props(_object_spread({}, g, D), {
214
215
  inputComponent: E,
215
216
  inputProps: {
216
217
  maxDecimals: i
217
- }
218
+ },
219
+ dataAttributes: _object_spread({
220
+ "component-name": "DecimalField"
221
+ }, l)
218
222
  }));
219
- }, $ = L;
223
+ }, q = L;
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ import type { AlertProps, ConfirmProps, ExtendedDialogProps } from './dialog';
3
+ export declare const useDialog: () => {
4
+ alert: (params: AlertProps) => void;
5
+ confirm: (params: ConfirmProps) => void;
6
+ dialog: (params: ExtendedDialogProps) => void;
7
+ };
8
+ /**
9
+ * @deprecated Use useDialog to get this function
10
+ */
11
+ export declare const alert: (params: AlertProps) => void;
12
+ /**
13
+ * @deprecated Use useDialog to get this function
14
+ */
15
+ export declare const confirm: (params: ConfirmProps) => void;
16
+ /**
17
+ * @deprecated Use useDialog to get this function
18
+ */
19
+ export declare const dialog: (params: ExtendedDialogProps) => void;
20
+ type DialogRootProps = {
21
+ children?: React.ReactNode;
22
+ };
23
+ export declare const DialogRoot: ({ children }: DialogRootProps) => JSX.Element;
24
+ export {};
@@ -0,0 +1,192 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ DialogRoot: function() {
14
+ return C;
15
+ },
16
+ alert: function() {
17
+ return p;
18
+ },
19
+ confirm: function() {
20
+ return x;
21
+ },
22
+ dialog: function() {
23
+ return w;
24
+ },
25
+ useDialog: function() {
26
+ return f;
27
+ }
28
+ });
29
+ const _jsxruntime = require("react/jsx-runtime");
30
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
31
+ function _getRequireWildcardCache(nodeInterop) {
32
+ if (typeof WeakMap !== "function") return null;
33
+ var cacheBabelInterop = new WeakMap();
34
+ var cacheNodeInterop = new WeakMap();
35
+ return (_getRequireWildcardCache = function(nodeInterop) {
36
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
37
+ })(nodeInterop);
38
+ }
39
+ function _interop_require_wildcard(obj, nodeInterop) {
40
+ if (!nodeInterop && obj && obj.__esModule) {
41
+ return obj;
42
+ }
43
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
44
+ return {
45
+ default: obj
46
+ };
47
+ }
48
+ var cache = _getRequireWildcardCache(nodeInterop);
49
+ if (cache && cache.has(obj)) {
50
+ return cache.get(obj);
51
+ }
52
+ var newObj = {
53
+ __proto__: null
54
+ };
55
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
56
+ for(var key in obj){
57
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
58
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
59
+ if (desc && (desc.get || desc.set)) {
60
+ Object.defineProperty(newObj, key, desc);
61
+ } else {
62
+ newObj[key] = obj[key];
63
+ }
64
+ }
65
+ }
66
+ newObj.default = obj;
67
+ if (cache) {
68
+ cache.set(obj, newObj);
69
+ }
70
+ return newObj;
71
+ }
72
+ function _define_property(obj, key, value) {
73
+ if (key in obj) {
74
+ Object.defineProperty(obj, key, {
75
+ value: value,
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true
79
+ });
80
+ } else {
81
+ obj[key] = value;
82
+ }
83
+ return obj;
84
+ }
85
+ function _object_spread(target) {
86
+ for(var i = 1; i < arguments.length; i++){
87
+ var source = arguments[i] != null ? arguments[i] : {};
88
+ var ownKeys = Object.keys(source);
89
+ if (typeof Object.getOwnPropertySymbols === "function") {
90
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
91
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
92
+ }));
93
+ }
94
+ ownKeys.forEach(function(key) {
95
+ _define_property(target, key, source[key]);
96
+ });
97
+ }
98
+ return target;
99
+ }
100
+ function ownKeys(object, enumerableOnly) {
101
+ var keys = Object.keys(object);
102
+ if (Object.getOwnPropertySymbols) {
103
+ var symbols = Object.getOwnPropertySymbols(object);
104
+ if (enumerableOnly) {
105
+ symbols = symbols.filter(function(sym) {
106
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
107
+ });
108
+ }
109
+ keys.push.apply(keys, symbols);
110
+ }
111
+ return keys;
112
+ }
113
+ function _object_spread_props(target, source) {
114
+ source = source != null ? source : {};
115
+ if (Object.getOwnPropertyDescriptors) {
116
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
117
+ } else {
118
+ ownKeys(Object(source)).forEach(function(key) {
119
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
120
+ });
121
+ }
122
+ return target;
123
+ }
124
+ const c = /*#__PURE__*/ _react.createContext({
125
+ mounted: !1,
126
+ dialog: null,
127
+ setDialog: ()=>{}
128
+ }), m = /*#__PURE__*/ _react.lazy(()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require(/* webpackChunkName: "dialog" */ "./dialog.js")))), a = ()=>{
129
+ throw Error("Tried to show a dialog but the DialogRoot component was not mounted (missing ThemeContextProvider?)");
130
+ }, f = ()=>{
131
+ const { dialog: o, setDialog: s, mounted: i } = _react.useContext(c), n = _react.useCallback((t)=>{
132
+ if (i || a(), t && o) throw Error("Tried to show a dialog on top of another dialog");
133
+ s(t);
134
+ }, [
135
+ s,
136
+ o,
137
+ i
138
+ ]);
139
+ return _react.useMemo(()=>({
140
+ alert: (t)=>n(_object_spread({
141
+ type: "alert"
142
+ }, t)),
143
+ confirm: (t)=>n(_object_spread({
144
+ type: "confirm"
145
+ }, t)),
146
+ dialog: (t)=>n(_object_spread({
147
+ type: "dialog"
148
+ }, t))
149
+ }), [
150
+ n
151
+ ]);
152
+ }, g = {
153
+ alert: a,
154
+ confirm: a,
155
+ dialog: a
156
+ };
157
+ let l = g;
158
+ const D = ()=>{
159
+ const o = f();
160
+ return _react.useEffect(()=>(l = o, ()=>{
161
+ l = g;
162
+ }), [
163
+ o
164
+ ]), /* @__PURE__ */ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {});
165
+ }, p = (o)=>l.alert(o), x = (o)=>l.confirm(o), w = (o)=>l.dialog(o), C = (param)=>{
166
+ let { children: o } = param;
167
+ const { mounted: s } = _react.useContext(c), [i, n] = _react.useState(null), t = _react.useMemo(()=>({
168
+ mounted: !0,
169
+ dialog: i,
170
+ setDialog: n
171
+ }), [
172
+ i,
173
+ n
174
+ ]);
175
+ return s ? /* @__PURE__ */ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
176
+ children: o
177
+ }) : /* @__PURE__ */ (0, _jsxruntime.jsxs)(c.Provider, {
178
+ value: t,
179
+ children: [
180
+ /* @__PURE__ */ (0, _jsxruntime.jsx)(D, {}),
181
+ o,
182
+ i && /* @__PURE__ */ (0, _jsxruntime.jsx)(_react.Suspense, {
183
+ fallback: null,
184
+ children: /* @__PURE__ */ (0, _jsxruntime.jsx)(m, _object_spread_props(_object_spread({}, i), {
185
+ onDestroy: ()=>{
186
+ n(null);
187
+ }
188
+ }))
189
+ })
190
+ ]
191
+ });
192
+ };
@@ -9,40 +9,43 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ ANIMATION_DURATION_MS: function() {
13
+ return v;
14
+ },
12
15
  closedModalContent: function() {
13
- return _;
16
+ return y;
14
17
  },
15
18
  closedOpactityLayer: function() {
16
- return y;
19
+ return f;
17
20
  },
18
21
  dialogActions: function() {
19
- return f;
22
+ return l;
20
23
  },
21
24
  dialogContent: function() {
22
- return l;
25
+ return a;
23
26
  },
24
27
  iconContainer: function() {
25
- return a;
28
+ return d;
26
29
  },
27
30
  modalCloseButtonContainer: function() {
28
- return d;
31
+ return o;
29
32
  },
30
33
  modalContent: function() {
31
- return o;
34
+ return r;
32
35
  },
33
36
  modalOpacityLayer: function() {
34
- return g;
37
+ return t;
35
38
  },
36
39
  variants: function() {
37
- return r;
40
+ return i;
38
41
  },
39
42
  wrapper: function() {
40
- return t;
43
+ return e;
41
44
  }
42
45
  });
43
46
  require("./sprinkles.css.ts.vanilla.css-mistica.js");
44
47
  require("./dialog.css.ts.vanilla.css-mistica.js");
45
- var _ = "_3dl29lb", y = "_3dl29l6", f = "_3dl29ll _1y2v1nf6u", l = "_3dl29lj _1y2v1nfh2 _1y2v1nfig", a = "_3dl29lm", d = "_3dl29l8 _1y2v1nf6o _1y2v1nf7x _1y2v1nf96 _1y2v1nfaf _1y2v1nfgb _1y2v1nfjn _1y2v1nfkh", o = "_3dl29la _1y2v1nf35 _1y2v1nfj7", g = "_3dl29l5 _1y2v1nfgc _1y2v1nfgg _1y2v1nfgp _1y2v1nfgv _1y2v1nfgm _1y2v1nfjn _1y2v1nfkh _1y2v1nfkw _1y2v1nfk2 _1y2v1nf3g", r = {
46
- dialog: "_3dl29ld _1y2v1nfgg _1y2v1nfgm _1y2v1nfgs _1y2v1nf9c _1y2v1nfal _1y2v1nf70 _1y2v1nf83",
47
- default: "_3dl29ld _1y2v1nfgg _1y2v1nfgm _1y2v1nfgs _1y2v1nf6u _1y2v1nf83 _1y2v1nf9c _1y2v1nfal"
48
- }, t = "_3dl29l3 _1y2v1nfga";
48
+ var v = 200, y = "_3dl29lb", f = "_3dl29l6", l = "_3dl29ll _1y2v1nf6w", a = "_3dl29lj _1y2v1nfh4 _1y2v1nfii", d = "_3dl29lm", o = "_3dl29l8 _1y2v1nf6q _1y2v1nf7z _1y2v1nf98 _1y2v1nfah _1y2v1nfgd _1y2v1nfjp _1y2v1nfkj", r = "_3dl29la _1y2v1nf36 _1y2v1nfj9", t = "_3dl29l5 _1y2v1nfge _1y2v1nfgi _1y2v1nfgr _1y2v1nfgx _1y2v1nfgo _1y2v1nfjp _1y2v1nfkj _1y2v1nfky _1y2v1nfk4 _1y2v1nf3h", i = {
49
+ dialog: "_3dl29ld _1y2v1nfgi _1y2v1nfgo _1y2v1nfgu _1y2v1nf9e _1y2v1nfan _1y2v1nf72 _1y2v1nf85",
50
+ default: "_3dl29ld _1y2v1nfgi _1y2v1nfgo _1y2v1nfgu _1y2v1nf6w _1y2v1nf85 _1y2v1nf9e _1y2v1nfan"
51
+ }, e = "_3dl29l3 _1y2v1nfgc";
@@ -1,3 +1,4 @@
1
+ export declare const ANIMATION_DURATION_MS = 200;
1
2
  export declare const wrapper: string;
2
3
  export declare const modalOpacityLayer: string;
3
4
  export declare const closedOpactityLayer: string;
package/dist/dialog.d.ts CHANGED
@@ -5,63 +5,33 @@ import type { ExclusifyUnion } from './utils/utility-types';
5
5
  interface BaseDialogProps {
6
6
  className?: string;
7
7
  title?: string;
8
- icon?: React.ReactElement;
9
8
  message: string;
10
9
  acceptText?: string;
11
10
  onAccept?: () => void;
12
11
  destructive?: boolean;
13
- }
14
- interface AlertProps extends BaseDialogProps {
15
- showClose?: boolean;
16
- }
17
- interface ConfirmProps extends BaseDialogProps {
18
- showClose?: boolean;
12
+ /** @deprecated this does nothing */
13
+ forceWeb?: boolean;
14
+ /** @deprecated this does nothing */
19
15
  showCancel?: boolean;
16
+ }
17
+ export type AlertProps = BaseDialogProps;
18
+ export interface ConfirmProps extends BaseDialogProps {
20
19
  cancelText?: string;
21
20
  onCancel?: () => void;
22
21
  }
23
- interface ExtendedDialogProps extends BaseDialogProps {
22
+ export interface ExtendedDialogProps extends BaseDialogProps {
23
+ icon?: React.ReactElement;
24
24
  subtitle?: string;
25
25
  extra?: React.ReactNode;
26
- forceWeb?: boolean;
27
- showClose?: boolean;
28
- showCancel?: boolean;
29
26
  cancelText?: string;
30
27
  onCancel?: () => void;
31
28
  link?: RendersNullableElement<typeof ButtonLink>;
32
29
  }
33
- type DialogProps = ExclusifyUnion<AlertProps | ConfirmProps | ExtendedDialogProps>;
34
- type DialogRootProps = {
35
- children?: React.ReactNode;
30
+ export type DialogProps = ExclusifyUnion<AlertProps | ConfirmProps | ExtendedDialogProps> & {
31
+ type: 'dialog' | 'alert' | 'confirm';
36
32
  };
37
- type DialogRootState = {
38
- dialogProps: DialogProps | null;
39
- isClosing: boolean;
40
- instanceNumber: number;
33
+ type ModalDialogProps = DialogProps & {
34
+ onDestroy: () => void;
41
35
  };
42
- export default class DialogRoot extends React.Component<DialogRootProps, DialogRootState> {
43
- state: DialogRootState;
44
- componentDidMount(): void;
45
- componentWillUnmount(): void;
46
- show(props: DialogProps): void;
47
- callback: null | (() => void);
48
- handleCloseFinished: () => void;
49
- handleBack: () => void;
50
- close(): void;
51
- createCancelHandler(onCancel?: () => void): () => void;
52
- createAcceptHandler(onAccept?: () => void): () => void;
53
- render(): React.ReactNode;
54
- }
55
- /**
56
- * Shows alert dialog with supplied props
57
- */
58
- export declare const alert: (props: AlertProps) => void;
59
- /**
60
- * Shows confirm dialog with supplied props
61
- */
62
- export declare const confirm: (props: ConfirmProps) => void;
63
- /**
64
- * Shows dialog with supplied props
65
- */
66
- export declare const dialog: (props: ExtendedDialogProps) => void;
67
- export {};
36
+ declare const ModalDialog: (props: ModalDialogProps) => JSX.Element;
37
+ export default ModalDialog;