@telefonica/mistica 14.41.0 → 14.42.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.
Files changed (142) hide show
  1. package/css/mistica.css +1 -1
  2. package/dist/boxed.css-mistica.js +14 -5
  3. package/dist/boxed.css.d.ts +1 -0
  4. package/dist/boxed.d.ts +1 -0
  5. package/dist/boxed.js +11 -9
  6. package/dist/button-fixed-footer-layout.d.ts +1 -0
  7. package/dist/button-fixed-footer-layout.js +19 -14
  8. package/dist/button-layout.css-mistica.js +16 -13
  9. package/dist/button-layout.css.d.ts +1 -0
  10. package/dist/button-layout.js +15 -15
  11. package/dist/button.js +43 -35
  12. package/dist/carousel.d.ts +13 -0
  13. package/dist/carousel.js +325 -223
  14. package/dist/credit-card-expiration-field.js +30 -26
  15. package/dist/credit-card-number-field.css-mistica.js +7 -7
  16. package/dist/credit-card-number-field.js +59 -45
  17. package/dist/cvv-field.js +46 -41
  18. package/dist/date-field.css-mistica.js +14 -0
  19. package/dist/date-field.css.d.ts +1 -0
  20. package/dist/date-field.css.ts.vanilla.css-mistica.js +11 -0
  21. package/dist/date-field.js +41 -35
  22. package/dist/date-time-field.js +40 -34
  23. package/dist/date-time-picker.js +43 -45
  24. package/dist/decimal-field.js +26 -22
  25. package/dist/dialog-context.d.ts +24 -0
  26. package/dist/dialog-context.js +192 -0
  27. package/dist/dialog.css-mistica.js +15 -12
  28. package/dist/dialog.css.d.ts +1 -0
  29. package/dist/dialog.d.ts +14 -44
  30. package/dist/dialog.js +163 -246
  31. package/dist/double-field.css-mistica.js +3 -2
  32. package/dist/email-field.js +15 -11
  33. package/dist/feedback.css-mistica.js +23 -14
  34. package/dist/feedback.css.d.ts +7 -4
  35. package/dist/feedback.js +157 -143
  36. package/dist/fixed-footer-layout.css-mistica.js +1 -1
  37. package/dist/fixed-footer-layout.js +9 -8
  38. package/dist/iban-field.js +31 -27
  39. package/dist/icons/icon-amex.d.ts +1 -1
  40. package/dist/icons/icon-cvv-amex.d.ts +1 -1
  41. package/dist/icons/icon-cvv-visa-mc.d.ts +1 -1
  42. package/dist/icons/icon-mastercard.d.ts +1 -1
  43. package/dist/icons/icon-visa.d.ts +1 -1
  44. package/dist/index.d.ts +2 -2
  45. package/dist/index.js +16 -4
  46. package/dist/inline.css-mistica.js +9 -6
  47. package/dist/inline.css.d.ts +1 -1
  48. package/dist/inline.js +9 -9
  49. package/dist/integer-field.js +17 -13
  50. package/dist/loading-bar.css-mistica.js +4 -7
  51. package/dist/loading-bar.css.d.ts +0 -2
  52. package/dist/loading-bar.js +3 -6
  53. package/dist/month-field.js +39 -33
  54. package/dist/package-version.js +1 -1
  55. package/dist/password-field.js +46 -44
  56. package/dist/phone-number-field.js +50 -46
  57. package/dist/pin-field.css-mistica.js +12 -6
  58. package/dist/pin-field.css.d.ts +2 -0
  59. package/dist/pin-field.d.ts +3 -1
  60. package/dist/pin-field.js +129 -95
  61. package/dist/responsive-layout.css-mistica.js +10 -7
  62. package/dist/responsive-layout.css.d.ts +2 -1
  63. package/dist/responsive-layout.d.ts +1 -1
  64. package/dist/responsive-layout.js +20 -17
  65. package/dist/search-field.js +36 -35
  66. package/dist/select.css-mistica.js +16 -15
  67. package/dist/select.css.d.ts +1 -0
  68. package/dist/select.js +138 -143
  69. package/dist/text-field-base.css-mistica.js +45 -21
  70. package/dist/text-field-base.css.d.ts +30 -7
  71. package/dist/text-field-base.d.ts +11 -0
  72. package/dist/text-field-base.js +175 -140
  73. package/dist/text-field-components.css-mistica.js +13 -21
  74. package/dist/text-field-components.css.d.ts +0 -3
  75. package/dist/text-field-components.d.ts +3 -0
  76. package/dist/text-field-components.js +38 -35
  77. package/dist/text-field.js +26 -22
  78. package/dist/text.css-mistica.js +7 -7
  79. package/dist/text.css.d.ts +0 -1
  80. package/dist/text.js +24 -24
  81. package/dist/theme-context-provider.js +2 -2
  82. package/dist/utils/platform.js +8 -11
  83. package/dist-es/boxed.css-mistica.js +3 -2
  84. package/dist-es/boxed.js +17 -15
  85. package/dist-es/button-fixed-footer-layout.js +29 -24
  86. package/dist-es/button-layout.css-mistica.js +7 -7
  87. package/dist-es/button-layout.js +23 -23
  88. package/dist-es/button.js +65 -57
  89. package/dist-es/carousel.js +373 -280
  90. package/dist-es/credit-card-expiration-field.js +34 -30
  91. package/dist-es/credit-card-number-field.css-mistica.js +4 -4
  92. package/dist-es/credit-card-number-field.js +84 -70
  93. package/dist-es/cvv-field.js +68 -63
  94. package/dist-es/date-field.css-mistica.js +5 -0
  95. package/dist-es/date-field.css.ts.vanilla.css-mistica.js +2 -0
  96. package/dist-es/date-field.js +46 -40
  97. package/dist-es/date-time-field.js +47 -41
  98. package/dist-es/date-time-picker.js +55 -57
  99. package/dist-es/decimal-field.js +31 -27
  100. package/dist-es/dialog-context.js +125 -0
  101. package/dist-es/dialog.css-mistica.js +3 -3
  102. package/dist-es/dialog.js +193 -262
  103. package/dist-es/double-field.css-mistica.js +3 -2
  104. package/dist-es/email-field.js +16 -12
  105. package/dist-es/feedback.css-mistica.js +2 -2
  106. package/dist-es/feedback.js +196 -182
  107. package/dist-es/fixed-footer-layout.css-mistica.js +1 -1
  108. package/dist-es/fixed-footer-layout.js +21 -20
  109. package/dist-es/iban-field.js +42 -38
  110. package/dist-es/index.js +1778 -1778
  111. package/dist-es/inline.css-mistica.js +3 -3
  112. package/dist-es/inline.js +18 -18
  113. package/dist-es/integer-field.js +21 -17
  114. package/dist-es/loading-bar.css-mistica.js +2 -2
  115. package/dist-es/loading-bar.js +10 -13
  116. package/dist-es/month-field.js +47 -41
  117. package/dist-es/package-version.js +1 -1
  118. package/dist-es/password-field.js +54 -52
  119. package/dist-es/phone-number-field.js +53 -49
  120. package/dist-es/pin-field.css-mistica.js +2 -2
  121. package/dist-es/pin-field.js +145 -111
  122. package/dist-es/responsive-layout.css-mistica.js +3 -3
  123. package/dist-es/responsive-layout.js +27 -24
  124. package/dist-es/search-field.js +45 -44
  125. package/dist-es/select.css-mistica.js +8 -7
  126. package/dist-es/select.js +167 -172
  127. package/dist-es/style.css +1 -1
  128. package/dist-es/text-field-base.css-mistica.js +2 -2
  129. package/dist-es/text-field-base.js +189 -157
  130. package/dist-es/text-field-components.css-mistica.js +3 -2
  131. package/dist-es/text-field-components.js +52 -49
  132. package/dist-es/text-field.js +31 -27
  133. package/dist-es/text.css-mistica.js +3 -3
  134. package/dist-es/text.js +32 -32
  135. package/dist-es/theme-context-provider.js +1 -1
  136. package/dist-es/utils/platform.js +6 -6
  137. package/package.json +1 -1
  138. package/dist/password-field.css-mistica.js +0 -13
  139. package/dist/password-field.css.d.ts +0 -1
  140. package/dist-es/password-field.css-mistica.js +0 -4
  141. /package/dist/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
  142. /package/dist-es/{password-field.css.ts.vanilla.css-mistica.js → boxed.css.ts.vanilla.css-mistica.js} +0 -0
@@ -79,17 +79,19 @@ function _object_without_properties_loose(source, excluded) {
79
79
  return target;
80
80
  }
81
81
  import { jsx as t } from "react/jsx-runtime";
82
- import * as a from "react";
83
- import { useFieldProps as x } from "./form-context.js";
82
+ import * as c from "react";
83
+ import { useFieldProps as z } from "./form-context.js";
84
84
  import { TextFieldBaseAutosuggest as O } from "./text-field-base.js";
85
85
  import { isInputTypeSupported as b } from "./utils/dom.js";
86
- import { isServerSide as v } from "./utils/environment.js";
87
- import E from "./generated/mistica-icons/icon-calendar-regular.js";
86
+ import { isServerSide as A } from "./utils/environment.js";
87
+ import N from "./generated/mistica-icons/icon-calendar-regular.js";
88
88
  import { getLocalDateString as r } from "./utils/time.js";
89
89
  import { useTheme as j } from "./hooks.js";
90
- import { isFirefox as z } from "./utils/platform.js";
91
- const A = /*#__PURE__*/ a.lazy(()=>import(/* webpackChunkName: "date-time-picker" */ "./date-time-picker.js")), B = (_param)=>{
92
- var { disabled: l, error: g, helperText: D, name: y, optional: m, validate: s, onChange: F, onChangeValue: n, onBlur: R, value: S, defaultValue: h, min: o, max: i } = _param, d = _object_without_properties(_param, [
90
+ import { isFirefox as v } from "./utils/platform.js";
91
+ import { iconContainer as B } from "./date-field.css-mistica.js";
92
+ import { iconSize as C } from "./text-field-base.css-mistica.js";
93
+ const E = /*#__PURE__*/ c.lazy(()=>import(/* webpackChunkName: "date-time-picker" */ "./date-time-picker.js")), L = (_param)=>{
94
+ var { disabled: D, error: F, helperText: g, name: S, optional: f, validate: s, onChange: R, onChangeValue: n, onBlur: k, value: y, defaultValue: I, min: i, max: o, dataAttributes: d } = _param, u = _object_without_properties(_param, [
93
95
  "disabled",
94
96
  "error",
95
97
  "helperText",
@@ -102,43 +104,47 @@ const A = /*#__PURE__*/ a.lazy(()=>import(/* webpackChunkName: "date-time-picker
102
104
  "value",
103
105
  "defaultValue",
104
106
  "min",
105
- "max"
107
+ "max",
108
+ "dataAttributes"
106
109
  ]);
107
- const k = (e)=>e, I = a.useMemo(()=>z() ? !1 : b("date"), []), { texts: T } = j(), f = (e)=>!(o && e && e < r(o) || i && e && e > r(i)), u = x({
108
- name: y,
109
- value: S,
110
- defaultValue: h,
111
- processValue: k,
112
- helperText: D,
113
- optional: m,
114
- error: g,
115
- disabled: l,
116
- onBlur: R,
117
- validate: (e, c)=>f(e) ? s == null ? void 0 : s(e, c) : T.formDateOutOfRangeError,
118
- onChange: F,
119
- onChangeValue: (e, c)=>{
120
- f(e) && (n == null || n(e, c));
110
+ const T = (e)=>e, h = c.useMemo(()=>v() ? !1 : b("date"), []), { texts: x } = j(), a = (e)=>!(i && e && e < r(i) || o && e && e > r(o)), p = z({
111
+ name: S,
112
+ value: y,
113
+ defaultValue: I,
114
+ processValue: T,
115
+ helperText: g,
116
+ optional: f,
117
+ error: F,
118
+ disabled: D,
119
+ onBlur: k,
120
+ validate: (e, m)=>a(e) ? s == null ? void 0 : s(e, m) : x.formDateOutOfRangeError,
121
+ onChange: R,
122
+ onChangeValue: (e, m)=>{
123
+ a(e) && (n == null || n(e, m));
121
124
  }
122
- }), p = /* @__PURE__ */ t(O, _object_spread_props(_object_spread({}, d, u), {
123
- min: o ? r(o) : void 0,
124
- max: i ? r(i) : void 0,
125
+ }), l = /* @__PURE__ */ t(O, _object_spread_props(_object_spread({}, u, p), {
126
+ min: i ? r(i) : void 0,
127
+ max: o ? r(o) : void 0,
125
128
  type: "date",
126
129
  endIconOverlay: /* @__PURE__ */ t("div", {
127
- style: {
128
- position: "absolute",
129
- top: 16,
130
- right: 16,
131
- pointerEvents: "none"
132
- },
133
- children: /* @__PURE__ */ t(E, {})
134
- })
130
+ className: B,
131
+ children: /* @__PURE__ */ t(N, {
132
+ size: C
133
+ })
134
+ }),
135
+ dataAttributes: _object_spread({
136
+ "component-name": "DateField"
137
+ }, d)
135
138
  }));
136
- return I || v() ? p : /* @__PURE__ */ t(a.Suspense, {
137
- fallback: p,
138
- children: /* @__PURE__ */ t(A, _object_spread_props(_object_spread({}, d, u), {
139
- optional: m,
140
- isValidDate: (e)=>f(r(e.toDate()))
139
+ return h || A() ? l : /* @__PURE__ */ t(c.Suspense, {
140
+ fallback: l,
141
+ children: /* @__PURE__ */ t(E, _object_spread_props(_object_spread({}, u, p), {
142
+ optional: f,
143
+ isValidDate: (e)=>a(r(e.toDate())),
144
+ dataAttributes: _object_spread({
145
+ "component-name": "DateField"
146
+ }, d)
141
147
  }))
142
148
  });
143
- }, K = B;
144
- export { K as default };
149
+ }, Y = L;
150
+ export { Y as default };
@@ -79,21 +79,23 @@ function _object_without_properties_loose(source, excluded) {
79
79
  return target;
80
80
  }
81
81
  import { jsx as r } from "react/jsx-runtime";
82
- import * as m from "react";
83
- import { useFieldProps as I } from "./form-context.js";
84
- import { TextFieldBaseAutosuggest as x } from "./text-field-base.js";
82
+ import * as c from "react";
83
+ import { useFieldProps as x } from "./form-context.js";
84
+ import { TextFieldBaseAutosuggest as z } from "./text-field-base.js";
85
85
  import { isInputTypeSupported as O } from "./utils/dom.js";
86
86
  import { isServerSide as b } from "./utils/environment.js";
87
- import { getLocalDateTimeString as o } from "./utils/time.js";
87
+ import { getLocalDateTimeString as i } from "./utils/time.js";
88
88
  import w from "./generated/mistica-icons/icon-calendar-regular.js";
89
- import { isFirefox as E } from "./utils/platform.js";
90
- import { useTheme as V } from "./hooks.js";
91
- const j = /*#__PURE__*/ m.lazy(()=>import(/* webpackChunkName: "date-time-picker" */ "./date-time-picker.js")), z = (_param)=>{
92
- var { disabled: T, error: g, helperText: F, name: h, optional: f, validate: n, onChange: y, onChangeValue: a, onBlur: R, value: S, defaultValue: k, min: i, /**
89
+ import { isFirefox as A } from "./utils/platform.js";
90
+ import { useTheme as N } from "./hooks.js";
91
+ import { iconSize as V } from "./text-field-base.css-mistica.js";
92
+ import { iconContainer as j } from "./date-field.css-mistica.js";
93
+ const B = /*#__PURE__*/ c.lazy(()=>import(/* webpackChunkName: "date-time-picker" */ "./date-time-picker.js")), C = (_param)=>{
94
+ var { disabled: F, error: g, helperText: S, name: R, optional: f, validate: n, onChange: h, onChangeValue: m, onBlur: k, value: y, defaultValue: I, min: o, /**
93
95
  * When typing a datetime value into the input field (inside a test for example), some browsers like Chrome
94
96
  * force the year to have exactly 6 digits. In order to prevent this, in case max value was not provided we
95
97
  * set it so that it only accepts datetime values with years having up to 4 digits.
96
- */ max: s = /* @__PURE__ */ new Date("9999-12-31T23:59") } = _param, l = _object_without_properties(_param, [
98
+ */ max: s = /* @__PURE__ */ new Date("9999-12-31T23:59"), dataAttributes: l } = _param, u = _object_without_properties(_param, [
97
99
  "disabled",
98
100
  "error",
99
101
  "helperText",
@@ -106,47 +108,51 @@ const j = /*#__PURE__*/ m.lazy(()=>import(/* webpackChunkName: "date-time-picker
106
108
  "value",
107
109
  "defaultValue",
108
110
  "min",
109
- "max"
111
+ "max",
112
+ "dataAttributes"
110
113
  ]);
111
- const u = m.useMemo(()=>E() ? !1 : O("datetime-local"), []), d = (e)=>u ? e : e.replace(/\s/, "T"), { texts: v } = V(), c = (e)=>{
112
- const t = d(e);
113
- return !(i && t && t < o(i) || s && t && t > o(s));
114
- }, p = I({
115
- name: h,
116
- value: S,
117
- defaultValue: k,
118
- processValue: d,
119
- helperText: F,
114
+ const d = c.useMemo(()=>A() ? !1 : O("datetime-local"), []), p = (e)=>d ? e : e.replace(/\s/, "T"), { texts: v } = N(), a = (e)=>{
115
+ const t = p(e);
116
+ return !(o && t && t < i(o) || s && t && t > i(s));
117
+ }, D = x({
118
+ name: R,
119
+ value: y,
120
+ defaultValue: I,
121
+ processValue: p,
122
+ helperText: S,
120
123
  optional: f,
121
124
  error: g,
122
- disabled: T,
123
- onBlur: R,
124
- validate: (e, t)=>c(e) ? n == null ? void 0 : n(e, t) : v.formDateOutOfRangeError,
125
- onChange: y,
125
+ disabled: F,
126
+ onBlur: k,
127
+ validate: (e, t)=>a(e) ? n == null ? void 0 : n(e, t) : v.formDateOutOfRangeError,
128
+ onChange: h,
126
129
  onChangeValue: (e, t)=>{
127
- c(e) && (a == null || a(e, t));
130
+ a(e) && (m == null || m(e, t));
128
131
  }
129
- }), D = /* @__PURE__ */ r(x, _object_spread_props(_object_spread({}, l, p), {
130
- min: i ? o(i) : void 0,
131
- max: s ? o(s) : void 0,
132
+ }), T = /* @__PURE__ */ r(z, _object_spread_props(_object_spread({}, u, D), {
133
+ min: o ? i(o) : void 0,
134
+ max: s ? i(s) : void 0,
132
135
  type: "datetime-local",
133
136
  endIconOverlay: /* @__PURE__ */ r("div", {
134
- style: {
135
- position: "absolute",
136
- top: 16,
137
- right: 16,
138
- pointerEvents: "none"
139
- },
140
- children: /* @__PURE__ */ r(w, {})
141
- })
137
+ className: j,
138
+ children: /* @__PURE__ */ r(w, {
139
+ size: V
140
+ })
141
+ }),
142
+ dataAttributes: _object_spread({
143
+ "component-name": "DateTimeField"
144
+ }, l)
142
145
  }));
143
- return u || b() ? D : /* @__PURE__ */ r(m.Suspense, {
144
- fallback: D,
145
- children: /* @__PURE__ */ r(j, _object_spread_props(_object_spread({}, l, p), {
146
+ return d || b() ? T : /* @__PURE__ */ r(c.Suspense, {
147
+ fallback: T,
148
+ children: /* @__PURE__ */ r(B, _object_spread_props(_object_spread({}, u, D), {
146
149
  optional: f,
147
150
  withTime: !0,
148
- isValidDate: (e)=>c(o(e.toDate()))
151
+ isValidDate: (e)=>a(i(e.toDate())),
152
+ dataAttributes: _object_spread({
153
+ "component-name": "DateTimeField"
154
+ }, l)
149
155
  }))
150
156
  });
151
- }, K = z;
152
- export { K as default };
157
+ }, Y = C;
158
+ export { Y as default };
@@ -78,24 +78,24 @@ function _object_without_properties_loose(source, excluded) {
78
78
  }
79
79
  return target;
80
80
  }
81
- import { jsxs as P, Fragment as R, jsx as r } from "react/jsx-runtime";
81
+ import { jsxs as R, Fragment as H, jsx as n } from "react/jsx-runtime";
82
82
  import * as d from "react";
83
- import { TextFieldBaseAutosuggest as H } from "./text-field-base.js";
84
- import S from "./generated/mistica-icons/icon-calendar-regular.js";
85
- import F from "react-datetime";
86
- import I from "./overlay.js";
83
+ import { TextFieldBaseAutosuggest as I, FieldEndIcon as g } from "./text-field-base.js";
84
+ import F from "./generated/mistica-icons/icon-calendar-regular.js";
85
+ import S from "react-datetime";
86
+ import E from "./overlay.js";
87
87
  import { DEFAULT_WIDTH as L } from "./text-field-components.css-mistica.js";
88
- import g from "./icon-button.js";
89
88
  import { cancelEvent as T, createChangeEvent as B } from "./utils/dom.js";
90
- import { useTheme as E, useElementDimensions as V } from "./hooks.js";
91
- import Y from "./generated/mistica-icons/icon-close-regular.js";
89
+ import { useTheme as V, useElementDimensions as Y } from "./hooks.js";
90
+ import N from "./generated/mistica-icons/icon-close-regular.js";
92
91
  import { reactDatePicker as j } from "./date-time-picker.css-mistica.js";
93
- import { vars as z } from "./skins/skin-contract.css-mistica.js";
92
+ import { vars as A } from "./skins/skin-contract.css-mistica.js";
94
93
  import "moment/locale/es";
95
94
  import "moment/locale/de";
96
95
  import "moment/locale/pt-br";
97
96
  import "moment/locale/en-gb";
98
- const A = {
97
+ import { endIcon as h } from "./text-field-base.css-mistica.js";
98
+ const O = {
99
99
  es: "es",
100
100
  // spanish
101
101
  ca: "es",
@@ -109,95 +109,93 @@ const A = {
109
109
  pt: "pt-br",
110
110
  // portuguese
111
111
  en: "en-gb"
112
- }, O = (a)=>{
112
+ }, q = (a)=>{
113
113
  const i = a.toLocaleLowerCase().split("-")[0];
114
- return A[i] || "en-gb";
115
- }, ie = (_param)=>{
116
- var { withTime: a, mode: i, isValidDate: h, optional: u } = _param, t = _object_without_properties(_param, [
114
+ return O[i] || "en-gb";
115
+ }, ae = (_param)=>{
116
+ var { withTime: a, mode: i, isValidDate: y, optional: m } = _param, o = _object_without_properties(_param, [
117
117
  "withTime",
118
118
  "mode",
119
119
  "isValidDate",
120
120
  "optional"
121
121
  ]);
122
- const [m, y] = d.useState(!1), { texts: x, i18n: { locale: b } } = E(), n = d.useRef(null), { height: k, ref: v } = V(), l = (e)=>{
123
- t.disabled || y(e);
124
- }, C = ()=>{
122
+ const [u, x] = d.useState(!1), { texts: b, i18n: { locale: k } } = V(), r = d.useRef(null), { height: v, ref: C } = Y(), c = (e)=>{
123
+ o.disabled || x(e);
124
+ }, D = ()=>{
125
125
  var f;
126
- const { top: e = 0, bottom: o = 0, left: c = 0 } = ((f = n.current) == null ? void 0 : f.getBoundingClientRect()) || {}, M = 260 + o < window.innerHeight;
126
+ const { top: e = 0, bottom: t = 0, left: l = 0 } = ((f = r.current) == null ? void 0 : f.getBoundingClientRect()) || {}, P = 260 + t < window.innerHeight;
127
127
  return {
128
128
  width: L,
129
- top: M ? o : e - k,
130
- left: c,
129
+ top: P ? t : e - v,
130
+ left: l,
131
131
  position: "absolute",
132
- borderRadius: z.borderRadii.input,
132
+ borderRadius: A.borderRadii.input,
133
133
  overflow: "hidden",
134
134
  boxShadow: "0px 5px 5px -3px rgba(0,0,0,0.2), 0px 8px 10px 1px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12)"
135
135
  };
136
136
  }, s = ()=>{
137
- var o;
138
- const e = (o = n.current) == null ? void 0 : o.value;
137
+ var t;
138
+ const e = (t = r.current) == null ? void 0 : t.value;
139
139
  return e ? new Date(e) : void 0;
140
- }, D = (e)=>a ? e.format("yyyy-MM-DD HH:mm") : i === "year-month" ? e.format("yyyy-MM") : e.format("yyyy-MM-DD"), p = (e)=>{
141
- var c;
142
- const o = typeof e == "string" ? e : D(e);
143
- n.current && (n.current.focus(), (c = t.onChange) == null || c.call(t, B(n.current, o)));
144
- }, w = ()=>s() && u ? /* @__PURE__ */ r(g, {
145
- "aria-label": x.clearButton,
146
- size: 32,
147
- onPress: ()=>{
148
- p("");
149
- },
150
- children: /* @__PURE__ */ r(Y, {})
151
- }) : /* @__PURE__ */ r(g, {
152
- disabled: t.disabled,
140
+ }, w = (e)=>a ? e.format("yyyy-MM-DD HH:mm") : i === "year-month" ? e.format("yyyy-MM") : e.format("yyyy-MM-DD"), p = (e)=>{
141
+ var l;
142
+ const t = typeof e == "string" ? e : w(e);
143
+ r.current && (r.current.focus(), (l = o.onChange) == null || l.call(o, B(r.current, t)));
144
+ }, M = ()=>s() && m ? /* @__PURE__ */ n(g, {
145
+ Icon: N,
146
+ "aria-label": b.clearButton,
147
+ className: h,
148
+ onPress: ()=>p("")
149
+ }) : /* @__PURE__ */ n(g, {
150
+ Icon: F,
153
151
  "aria-label": "",
154
- size: 32,
155
- onPress: ()=>l(!m),
156
- children: /* @__PURE__ */ r(S, {})
152
+ disabled: o.disabled,
153
+ className: h,
154
+ onPress: ()=>c(!u)
157
155
  });
158
- return /* @__PURE__ */ P(R, {
156
+ return /* @__PURE__ */ R(H, {
159
157
  children: [
160
- /* @__PURE__ */ r(H, _object_spread_props(_object_spread({}, t), {
158
+ /* @__PURE__ */ n(I, _object_spread_props(_object_spread({}, o), {
161
159
  style: {
162
- cursor: "default"
160
+ cursor: "pointer"
163
161
  },
164
- required: !u,
162
+ required: !m,
165
163
  type: "text",
166
164
  autoComplete: "off",
167
165
  shrinkLabel: !!s(),
168
- endIcon: w(),
166
+ endIcon: M(),
169
167
  inputRef: (e)=>{
170
- var o;
171
- (o = t == null ? void 0 : t.inputRef) == null || o.call(t, e), n.current = e;
168
+ var t;
169
+ (t = o == null ? void 0 : o.inputRef) == null || t.call(o, e), r.current = e;
172
170
  },
173
171
  readOnly: !0,
174
- onKeyDown: ()=>l(!0),
172
+ onKeyDown: ()=>c(!0),
175
173
  onClick: ()=>{
176
- l(!0);
174
+ c(!0);
177
175
  }
178
176
  })),
179
- m && /* @__PURE__ */ r(I, {
177
+ u && /* @__PURE__ */ n(E, {
180
178
  onPress: (e)=>{
181
- T(e), l(!1);
179
+ T(e), c(!1);
182
180
  },
183
181
  disableScroll: !0,
184
- children: /* @__PURE__ */ r("div", {
185
- ref: v,
186
- style: C(),
182
+ children: /* @__PURE__ */ n("div", {
183
+ ref: C,
184
+ style: D(),
187
185
  className: j,
188
- children: /* @__PURE__ */ r(F, {
186
+ children: /* @__PURE__ */ n(S, {
189
187
  initialViewMode: i === "year-month" ? "months" : void 0,
190
188
  dateFormat: i === "year-month" ? "YYYY-MM" : void 0,
191
189
  timeFormat: a ? "HH:mm" : !1,
192
190
  initialValue: s(),
193
- locale: O(b),
191
+ locale: q(k),
194
192
  input: !1,
195
193
  onChange: p,
196
- isValidDate: h
194
+ isValidDate: y
197
195
  })
198
196
  })
199
197
  })
200
198
  ]
201
199
  });
202
200
  };
203
- export { ie as default };
201
+ export { ae as default };
@@ -79,51 +79,51 @@ function _object_without_properties_loose(source, excluded) {
79
79
  return target;
80
80
  }
81
81
  import { jsx as x } from "react/jsx-runtime";
82
- import * as y from "react";
83
- import { useFieldProps as D } from "./form-context.js";
82
+ import * as S from "react";
83
+ import { useFieldProps as V } from "./form-context.js";
84
84
  import { useTheme as C } from "./hooks.js";
85
- import { TextFieldBaseAutosuggest as F } from "./text-field-base.js";
86
- import { createChangeEvent as R } from "./utils/dom.js";
85
+ import { TextFieldBaseAutosuggest as R } from "./text-field-base.js";
86
+ import { createChangeEvent as b } from "./utils/dom.js";
87
87
  import { useRifm as I } from "rifm";
88
- import { combineRefs as b } from "./utils/common.js";
89
- const j = (n)=>{
88
+ import { combineRefs as j } from "./utils/common.js";
89
+ const A = (o)=>{
90
90
  try {
91
- return 1.1.toLocaleString(n.replace("_", "-"))[1];
91
+ return 1.1.toLocaleString(o.replace("_", "-"))[1];
92
92
  } catch (e) {
93
93
  return ".";
94
94
  }
95
- }, B = (n, r)=>{
96
- const s = String(n !== null && n !== void 0 ? n : "").replace(/[^.,\d]/g, ""), e = /[.,]/.exec(s), t = s.split(/[.,]/);
95
+ }, B = (o, r)=>{
96
+ const s = String(o !== null && o !== void 0 ? o : "").replace(/[^.,\d]/g, ""), e = /[.,]/.exec(s), t = s.split(/[.,]/);
97
97
  return t.length === 0 ? "" : e && r > 0 ? t.shift() + e[0] + t.join("").slice(0, r) : t[0];
98
98
  }, E = (_param)=>{
99
- var { inputRef: n, value: r, defaultValue: s, onChange: e, maxDecimals: t } = _param, c = _object_without_properties(_param, [
99
+ var { inputRef: o, value: r, defaultValue: s, onChange: e, maxDecimals: t } = _param, c = _object_without_properties(_param, [
100
100
  "inputRef",
101
101
  "value",
102
102
  "defaultValue",
103
103
  "onChange",
104
104
  "maxDecimals"
105
105
  ]);
106
- const { i18n: u } = C(), f = j(u.locale), m = (o)=>String(o !== null && o !== void 0 ? o : "").replace(/[.,]/g, f), [p, d] = y.useState(s !== null && s !== void 0 ? s : ""), i = y.useRef(null), l = typeof r < "u", g = l ? r : p, S = y.useCallback((o)=>{
107
- l || d(o), i.current && (e == null || e(R(i.current, o)));
106
+ const { i18n: u } = C(), f = A(u.locale), m = (n)=>String(n !== null && n !== void 0 ? n : "").replace(/[.,]/g, f), [p, d] = S.useState(s !== null && s !== void 0 ? s : ""), i = S.useRef(null), l = typeof r < "u", g = l ? r : p, h = S.useCallback((n)=>{
107
+ l || d(n), i.current && (e == null || e(b(i.current, n)));
108
108
  }, [
109
109
  l,
110
110
  e
111
- ]), h = I({
112
- format: (o)=>B(o, t),
111
+ ]), y = I({
112
+ format: (n)=>B(n, t),
113
113
  replace: m,
114
114
  value: g,
115
- onChange: S,
115
+ onChange: h,
116
116
  accept: /[\d.,]+/g
117
117
  });
118
118
  return /* @__PURE__ */ x("input", _object_spread_props(_object_spread({}, c), {
119
119
  type: "text",
120
120
  inputMode: "decimal",
121
- value: h.value,
122
- onChange: h.onChange,
123
- ref: b(n, i)
121
+ value: y.value,
122
+ onChange: y.onChange,
123
+ ref: j(o, i)
124
124
  }));
125
125
  }, L = (_param)=>{
126
- 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, [
126
+ 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, [
127
127
  "disabled",
128
128
  "error",
129
129
  "helperText",
@@ -135,9 +135,10 @@ const j = (n)=>{
135
135
  "onBlur",
136
136
  "value",
137
137
  "defaultValue",
138
- "maxDecimals"
138
+ "maxDecimals",
139
+ "dataAttributes"
139
140
  ]);
140
- const { texts: g } = C(), o = D({
141
+ const { texts: h } = C(), D = V({
141
142
  name: e,
142
143
  value: p,
143
144
  defaultValue: d,
@@ -145,17 +146,20 @@ const j = (n)=>{
145
146
  helperText: s,
146
147
  optional: t,
147
148
  error: r,
148
- disabled: n,
149
+ disabled: o,
149
150
  onBlur: m,
150
- validate: (a, V)=>a ? c == null ? void 0 : c(a, V) : t ? "" : g.formFieldErrorIsMandatory,
151
+ validate: (a, F)=>a ? c == null ? void 0 : c(a, F) : t ? "" : h.formFieldErrorIsMandatory,
151
152
  onChange: u,
152
153
  onChangeValue: f
153
154
  });
154
- return /* @__PURE__ */ x(F, _object_spread_props(_object_spread({}, l, o), {
155
+ return /* @__PURE__ */ x(R, _object_spread_props(_object_spread({}, g, D), {
155
156
  inputComponent: E,
156
157
  inputProps: {
157
158
  maxDecimals: i
158
- }
159
+ },
160
+ dataAttributes: _object_spread({
161
+ "component-name": "DecimalField"
162
+ }, l)
159
163
  }));
160
- }, $ = L;
161
- export { E as DecimalInput, $ as default };
164
+ }, q = L;
165
+ export { E as DecimalInput, q as default };
@@ -0,0 +1,125 @@
1
+ "use client";
2
+ function _define_property(obj, key, value) {
3
+ if (key in obj) {
4
+ Object.defineProperty(obj, key, {
5
+ value: value,
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true
9
+ });
10
+ } else {
11
+ obj[key] = value;
12
+ }
13
+ return obj;
14
+ }
15
+ function _object_spread(target) {
16
+ for(var i = 1; i < arguments.length; i++){
17
+ var source = arguments[i] != null ? arguments[i] : {};
18
+ var ownKeys = Object.keys(source);
19
+ if (typeof Object.getOwnPropertySymbols === "function") {
20
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
21
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
22
+ }));
23
+ }
24
+ ownKeys.forEach(function(key) {
25
+ _define_property(target, key, source[key]);
26
+ });
27
+ }
28
+ return target;
29
+ }
30
+ function ownKeys(object, enumerableOnly) {
31
+ var keys = Object.keys(object);
32
+ if (Object.getOwnPropertySymbols) {
33
+ var symbols = Object.getOwnPropertySymbols(object);
34
+ if (enumerableOnly) {
35
+ symbols = symbols.filter(function(sym) {
36
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
37
+ });
38
+ }
39
+ keys.push.apply(keys, symbols);
40
+ }
41
+ return keys;
42
+ }
43
+ function _object_spread_props(target, source) {
44
+ source = source != null ? source : {};
45
+ if (Object.getOwnPropertyDescriptors) {
46
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
47
+ } else {
48
+ ownKeys(Object(source)).forEach(function(key) {
49
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
50
+ });
51
+ }
52
+ return target;
53
+ }
54
+ import { jsx as r, Fragment as u, jsxs as d } from "react/jsx-runtime";
55
+ import * as e from "react";
56
+ const c = /*#__PURE__*/ e.createContext({
57
+ mounted: !1,
58
+ dialog: null,
59
+ setDialog: ()=>{}
60
+ }), m = /*#__PURE__*/ e.lazy(()=>import(/* webpackChunkName: "dialog" */ "./dialog.js")), a = ()=>{
61
+ throw Error("Tried to show a dialog but the DialogRoot component was not mounted (missing ThemeContextProvider?)");
62
+ }, f = ()=>{
63
+ const { dialog: o, setDialog: s, mounted: i } = e.useContext(c), n = e.useCallback((t)=>{
64
+ if (i || a(), t && o) throw Error("Tried to show a dialog on top of another dialog");
65
+ s(t);
66
+ }, [
67
+ s,
68
+ o,
69
+ i
70
+ ]);
71
+ return e.useMemo(()=>({
72
+ alert: (t)=>n(_object_spread({
73
+ type: "alert"
74
+ }, t)),
75
+ confirm: (t)=>n(_object_spread({
76
+ type: "confirm"
77
+ }, t)),
78
+ dialog: (t)=>n(_object_spread({
79
+ type: "dialog"
80
+ }, t))
81
+ }), [
82
+ n
83
+ ]);
84
+ }, g = {
85
+ alert: a,
86
+ confirm: a,
87
+ dialog: a
88
+ };
89
+ let l = g;
90
+ const D = ()=>{
91
+ const o = f();
92
+ return e.useEffect(()=>(l = o, ()=>{
93
+ l = g;
94
+ }), [
95
+ o
96
+ ]), /* @__PURE__ */ r(u, {});
97
+ }, p = (o)=>l.alert(o), x = (o)=>l.confirm(o), w = (o)=>l.dialog(o), C = (param)=>{
98
+ let { children: o } = param;
99
+ const { mounted: s } = e.useContext(c), [i, n] = e.useState(null), t = e.useMemo(()=>({
100
+ mounted: !0,
101
+ dialog: i,
102
+ setDialog: n
103
+ }), [
104
+ i,
105
+ n
106
+ ]);
107
+ return s ? /* @__PURE__ */ r(u, {
108
+ children: o
109
+ }) : /* @__PURE__ */ d(c.Provider, {
110
+ value: t,
111
+ children: [
112
+ /* @__PURE__ */ r(D, {}),
113
+ o,
114
+ i && /* @__PURE__ */ r(e.Suspense, {
115
+ fallback: null,
116
+ children: /* @__PURE__ */ r(m, _object_spread_props(_object_spread({}, i), {
117
+ onDestroy: ()=>{
118
+ n(null);
119
+ }
120
+ }))
121
+ })
122
+ ]
123
+ });
124
+ };
125
+ export { C as DialogRoot, p as alert, x as confirm, w as dialog, f as useDialog };