@box/metadata-filter 1.52.4 → 1.54.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 (28) hide show
  1. package/dist/chunks/index.js +58 -59
  2. package/dist/chunks/metadata-float-field.module.js +4 -6
  3. package/dist/chunks/types.js +2 -2
  4. package/dist/chunks/types2.js +2 -2
  5. package/dist/chunks/use-float-validation.js +13 -13
  6. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/date-conversion-utils.js +34 -35
  7. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.js +52 -52
  8. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-relative.js +92 -92
  9. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-date-validation.js +22 -22
  10. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-integer-validation.js +2 -2
  11. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js +19 -19
  12. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.js +12 -12
  13. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/utils.js +30 -33
  14. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +54 -54
  15. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +36 -39
  16. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/utils.js +11 -11
  17. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +55 -55
  18. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/utils.js +12 -12
  19. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +52 -52
  20. package/dist/esm/lib/components/metadata-filter-fields/field-processing-utils.js +10 -10
  21. package/dist/esm/lib/components/metadata-filter-fields/is-modified-utils.js +9 -13
  22. package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.js +67 -67
  23. package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields.js +53 -53
  24. package/dist/i18n/en-x-pseudo.js +54 -54
  25. package/dist/i18n/en-x-pseudo.properties +54 -54
  26. package/dist/styles/metadata-date-field.css +1 -1
  27. package/dist/styles/metadata-float-field.css +1 -1
  28. package/package.json +7 -7
@@ -1,21 +1,21 @@
1
- import { DateI18nProvider as xe, Text as Ae, Radio as i, Select as p, DatePicker as se } from "@box/blueprint-web";
1
+ import { DateI18nProvider as xe, Text as Ae, Radio as i, Select as p, DatePicker as ne } from "@box/blueprint-web";
2
2
  import Le from "clsx";
3
3
  import { useFormikContext as Ie, getIn as O, Field as oe } from "formik";
4
4
  import { useState as x, useRef as A, useCallback as Ne, useEffect as ie, useMemo as ce } from "react";
5
5
  import { useIntl as ke } from "react-intl";
6
6
  import { R as c } from "../../../../../../chunks/types.js";
7
7
  import { DEFAULT_MAX_DATE as ue } from "./constants.js";
8
- import { getRelativeFromToValues as Ee, convertToFormikValueRanged as me, getCustomFromToValues as de } from "./date-conversion-utils.js";
8
+ import { getRelativeFromToValues as Ee, getCustomFromToValues as me, convertToFormikValueRanged as de } from "./date-conversion-utils.js";
9
9
  import { s as f } from "../../../../../../chunks/metadata-date-field.module.js";
10
10
  import { E as G } from "../../../../../../chunks/types2.js";
11
11
  import { useDateValidation as Pe } from "./use-date-validation.js";
12
12
  import { getDynamicMaxMinValue as fe } from "./utils.js";
13
- import r from "../../../../messages.js";
14
- import { jsx as l, jsxs as L } from "react/jsx-runtime";
13
+ import l from "../../../../messages.js";
14
+ import { jsx as t, jsxs as L } from "react/jsx-runtime";
15
15
  const ve = {
16
- next: r.nextDaysAmt,
17
- past: r.pastDaysAmt,
18
- olderThan: r.olderThanDaysAmt
16
+ next: l.nextDaysAmt,
17
+ past: l.pastDaysAmt,
18
+ olderThan: l.olderThanDaysAmt
19
19
  }, $e = [1, 3, 15, 45, 60, 120, 365], ge = (u) => u in ve || u === "today" || u === "customRange", Ye = ({
20
20
  customDateFilterOptions: u,
21
21
  disableForm: C,
@@ -28,193 +28,193 @@ const ve = {
28
28
  const [X, I] = x(c.FROM), [_, N] = x(!1), m = `${h}.value.range.gt`, d = `${h}.value.range.lt`, H = `${h}.value.relativeType`, k = `${h}.value.relativeDays`, q = `${h}.value.customType`, E = `${h}.value.customDays`, {
29
29
  values: F,
30
30
  setFieldTouched: pe,
31
- setFieldValue: s
31
+ setFieldValue: n
32
32
  } = Ie(), {
33
33
  validateDates: z,
34
- fromDatePickerValue: T,
35
- toDatePickerValue: y,
34
+ fromDatePickerValue: y,
35
+ toDatePickerValue: T,
36
36
  fromErrorType: J,
37
37
  toErrorType: K
38
- } = Pe(F, m, d, j, !0), n = ke(), g = O(F, H), v = O(F, q), Fe = T || y;
38
+ } = Pe(F, m, d, j, !0), s = ke(), g = O(F, H), v = O(F, q), Fe = y || T;
39
39
  let P = "anyTime", $ = "anyTime";
40
40
  ge(g) ? P = g : v ? $ = v : Fe && (P = "customRange", $ = "customRange");
41
- const [D, Q] = x(P), W = A(g), Y = A(v), S = O(F, k), Z = O(F, E), [w, ee] = x($), V = A(T), M = A(y), ae = {
42
- clearDatePickerAriaLabel: n.formatMessage(r.clearSelectedDate),
43
- nextMonthAriaLabel: n.formatMessage(r.switchToNextMonth),
44
- openCalendarDropdownAriaLabel: n.formatMessage(r.openCalendar),
45
- previousMonthAriaLabel: n.formatMessage(r.switchToNextMonth)
46
- }, Te = () => {
47
- s(m, void 0), s(d, void 0), V.current = void 0, M.current = void 0;
48
- }, ye = (e) => {
49
- const a = me(e, c.FROM);
50
- V.current = e, s(m, a), I(c.FROM);
41
+ const [D, Q] = x(P), W = A(g), Y = A(v), S = O(F, k), Z = O(F, E), [w, ee] = x($), V = A(y), M = A(T), ae = {
42
+ clearDatePickerAriaLabel: s.formatMessage(l.clearSelectedDate),
43
+ nextMonthAriaLabel: s.formatMessage(l.switchToNextMonth),
44
+ openCalendarDropdownAriaLabel: s.formatMessage(l.openCalendar),
45
+ previousMonthAriaLabel: s.formatMessage(l.switchToNextMonth)
46
+ }, ye = () => {
47
+ n(m, void 0), n(d, void 0), V.current = void 0, M.current = void 0;
48
+ }, Te = (e) => {
49
+ const a = de(e, c.FROM);
50
+ V.current = e, n(m, a), I(c.FROM);
51
51
  }, De = (e) => {
52
- const a = me(e, c.TO);
53
- M.current = e, s(d, a), I(c.TO);
52
+ const a = de(e, c.TO);
53
+ M.current = e, n(d, a), I(c.TO);
54
54
  }, te = (e) => {
55
55
  const a = e === c.FROM ? m : d;
56
56
  pe(a, !0), I(e);
57
57
  }, Ve = (e) => {
58
58
  let a;
59
- ge(e) && (a = e), e === "customRange" && (V.current = void 0, M.current = void 0), s(H, a), Q(e), s(k, void 0), N(!0);
59
+ ge(e) && (a = e), e === "customRange" && (V.current = void 0, M.current = void 0), n(H, a), Q(e), n(k, void 0), N(!0);
60
60
  }, Me = (e) => {
61
- s(q, e), ee(e), s(E, void 0), Te();
62
- const a = u.find((t) => t.name === e);
61
+ n(q, e), ee(e), n(E, void 0), ye();
62
+ const a = u.find((r) => r.name === e);
63
63
  if (a && a.type === "text") {
64
64
  const {
65
- from: t,
65
+ from: r,
66
66
  to: o
67
- } = de(a.from, a.to);
68
- s(m, t), s(d, o);
67
+ } = me(a.from, a.to);
68
+ n(m, r), n(d, o);
69
69
  }
70
70
  }, le = Ne(() => {
71
71
  const {
72
72
  from: e,
73
73
  to: a
74
74
  } = Ee(D, S);
75
- s(m, e), s(d, a);
76
- }, [m, S, D, s, d]);
75
+ n(m, e), n(d, a);
76
+ }, [m, S, D, n, d]);
77
77
  ie(() => {
78
78
  _ && (le(), N(!1));
79
79
  }, [_, le]), ie(() => {
80
80
  const e = W.current !== g, a = Y.current !== v;
81
81
  (e || a) && (Q(g ?? "anyTime"), ee(v), W.current = g, Y.current = v);
82
82
  }, [g, v]);
83
- const Re = ce(() => fe(y, ue), [y]), Ce = ce(() => fe(T), [T]), re = (e, a, t) => !!(a === G.MAX && e === G.OVERLAPPING || e === G.OVERLAPPING && t), B = (e) => {
83
+ const Re = ce(() => fe(T, ue), [T]), Ce = ce(() => fe(y), [y]), re = (e, a, r) => !!(a === G.MAX && e === G.OVERLAPPING || e === G.OVERLAPPING && r), B = (e) => {
84
84
  if (e !== D)
85
85
  return null;
86
86
  const a = (o) => {
87
87
  const R = ve[e];
88
88
  return {
89
89
  value: String(o),
90
- label: n.formatMessage(R, {
90
+ label: s.formatMessage(R, {
91
91
  count: o
92
92
  })
93
93
  };
94
- }, t = $e.map(a);
95
- return /* @__PURE__ */ l(p, {
94
+ }, r = $e.map(a);
95
+ return /* @__PURE__ */ t(p, {
96
96
  className: f.dateSelect,
97
97
  defaultValue: S === void 0 ? "" : String(S),
98
- label: n.formatMessage(r.relativeDaysSelectLabel),
98
+ label: s.formatMessage(l.relativeDaysSelectLabel),
99
99
  onValueChange: (o) => {
100
- s(k, Number(o)), N(!0);
100
+ n(k, Number(o)), N(!0);
101
101
  },
102
- placeholder: n.formatMessage(r.selectValuePlaceholder),
103
- children: /* @__PURE__ */ l(p.Content, {
102
+ placeholder: s.formatMessage(l.selectValuePlaceholder),
103
+ children: /* @__PURE__ */ t(p.Content, {
104
104
  container: b,
105
- children: t == null ? void 0 : t.map((o) => /* @__PURE__ */ l(p.Option, {
105
+ children: r?.map((o) => /* @__PURE__ */ t(p.Option, {
106
106
  text: o.label,
107
107
  value: o.value,
108
108
  children: o.label
109
109
  }, o.value))
110
110
  })
111
111
  });
112
- }, be = (e, a) => e !== w ? null : /* @__PURE__ */ l(p, {
112
+ }, be = (e, a) => e !== w ? null : /* @__PURE__ */ t(p, {
113
113
  className: f.dateSelect,
114
114
  defaultValue: Z === void 0 ? "" : String(Z),
115
- label: n.formatMessage(r.relativeDaysSelectLabel),
116
- onValueChange: (t) => {
117
- const o = a.find((R) => R.name === t);
115
+ label: s.formatMessage(l.relativeDaysSelectLabel),
116
+ onValueChange: (r) => {
117
+ const o = a.find((R) => R.name === r);
118
118
  if (o) {
119
119
  const {
120
120
  from: R,
121
121
  to: Oe
122
- } = de(o.from, o.to);
123
- s(m, R), s(d, Oe), s(E, o.name);
122
+ } = me(o.from, o.to);
123
+ n(m, R), n(d, Oe), n(E, o.name);
124
124
  }
125
125
  },
126
- placeholder: n.formatMessage(r.selectValuePlaceholder),
127
- children: /* @__PURE__ */ l(p.Content, {
126
+ placeholder: s.formatMessage(l.selectValuePlaceholder),
127
+ children: /* @__PURE__ */ t(p.Content, {
128
128
  container: b,
129
- children: a.map((t) => /* @__PURE__ */ l(p.Option, {
130
- text: t.name,
131
- value: t.name,
132
- children: t.name
133
- }, t.name))
129
+ children: a.map((r) => /* @__PURE__ */ t(p.Option, {
130
+ text: r.name,
131
+ value: r.name,
132
+ children: r.name
133
+ }, r.name))
134
134
  })
135
135
  }), Se = () => /* @__PURE__ */ L(i.Group, {
136
136
  disabled: C,
137
137
  loop: !1,
138
138
  onValueChange: Me,
139
139
  value: w,
140
- children: [/* @__PURE__ */ l(i.Item, {
141
- label: n.formatMessage(r.relativeDateFilterAnyTime),
140
+ children: [/* @__PURE__ */ t(i.Item, {
141
+ label: s.formatMessage(l.relativeDateFilterAnyTime),
142
142
  value: "anyTime"
143
143
  }), u.map((e) => {
144
144
  if (e.type === "text")
145
- return /* @__PURE__ */ l(i.Item, {
145
+ return /* @__PURE__ */ t(i.Item, {
146
146
  label: e.name,
147
147
  value: e.name
148
148
  }, e.name);
149
149
  const {
150
150
  name: a,
151
- options: t
151
+ options: r
152
152
  } = e;
153
- return /* @__PURE__ */ l(i.Item, {
154
- description: t ? be(a, t) : void 0,
153
+ return /* @__PURE__ */ t(i.Item, {
154
+ description: r ? be(a, r) : void 0,
155
155
  label: a,
156
156
  value: a
157
157
  }, a);
158
- }), /* @__PURE__ */ l(i.Item, {
159
- description: ne(),
160
- label: n.formatMessage(r.relativeDateFilterCustomRange),
158
+ }), /* @__PURE__ */ t(i.Item, {
159
+ description: se(),
160
+ label: s.formatMessage(l.relativeDateFilterCustomRange),
161
161
  value: "customRange"
162
162
  })]
163
- }), ne = () => !u && D !== "customRange" || u && w !== "customRange" ? null : /* @__PURE__ */ L("div", {
163
+ }), se = () => !u && D !== "customRange" || u && w !== "customRange" ? null : /* @__PURE__ */ L("div", {
164
164
  className: Le(f.rangeInputsContainer, f.verticalLayout, f.dateSelect),
165
- children: [/* @__PURE__ */ l(oe, {
165
+ children: [/* @__PURE__ */ t(oe, {
166
166
  name: m,
167
167
  validate: (e) => z(V.current, M.current, c.FROM),
168
168
  children: ({
169
169
  field: e,
170
170
  meta: a
171
- }) => /* @__PURE__ */ l("div", {
171
+ }) => /* @__PURE__ */ t("div", {
172
172
  className: f.inputContainer,
173
- children: /* @__PURE__ */ l(se, {
173
+ children: /* @__PURE__ */ t(ne, {
174
174
  ...e,
175
175
  ...ae,
176
- calendarAriaLabel: n.formatMessage(r.selectStartDate),
176
+ calendarAriaLabel: s.formatMessage(l.selectStartDate),
177
177
  error: re(J, K, X !== c.FROM) ? void 0 : a.error,
178
178
  isDisabled: C,
179
- label: n.formatMessage(r.fieldStartDateLabel),
179
+ label: s.formatMessage(l.fieldStartDateLabel),
180
180
  maxValue: Re,
181
181
  onBlur: () => te(c.FROM),
182
- onChange: (t) => ye(t),
182
+ onChange: (r) => Te(r),
183
183
  portalElement: b,
184
- value: T
184
+ value: y
185
185
  })
186
186
  })
187
- }), /* @__PURE__ */ l(oe, {
187
+ }), /* @__PURE__ */ t(oe, {
188
188
  name: d,
189
189
  validate: (e) => z(V.current, M.current, c.TO),
190
190
  children: ({
191
191
  field: e,
192
192
  meta: a
193
- }) => /* @__PURE__ */ l("div", {
193
+ }) => /* @__PURE__ */ t("div", {
194
194
  className: f.inputContainer,
195
- children: /* @__PURE__ */ l(se, {
195
+ children: /* @__PURE__ */ t(ne, {
196
196
  ...e,
197
197
  ...ae,
198
- calendarAriaLabel: n.formatMessage(r.selectEndDate),
198
+ calendarAriaLabel: s.formatMessage(l.selectEndDate),
199
199
  error: re(K, J, X !== c.TO) ? void 0 : a.error,
200
200
  isDisabled: C,
201
- label: n.formatMessage(r.fieldEndDateLabel),
201
+ label: s.formatMessage(l.fieldEndDateLabel),
202
202
  maxValue: ue,
203
203
  minValue: Ce,
204
204
  onBlur: () => te(c.TO),
205
- onChange: (t) => De(t),
205
+ onChange: (r) => De(r),
206
206
  portalElement: b,
207
- value: y
207
+ value: T
208
208
  })
209
209
  })
210
210
  })]
211
211
  });
212
- return /* @__PURE__ */ l(xe, {
212
+ return /* @__PURE__ */ t(xe, {
213
213
  locale: j,
214
214
  children: /* @__PURE__ */ L("div", {
215
215
  className: f.container,
216
216
  "data-testid": `${U}-field`,
217
- children: [!he && /* @__PURE__ */ l(Ae, {
217
+ children: [!he && /* @__PURE__ */ t(Ae, {
218
218
  as: "span",
219
219
  className: f.rangeFieldLabel,
220
220
  color: "textOnLightSecondary",
@@ -225,27 +225,27 @@ const ve = {
225
225
  loop: !1,
226
226
  onValueChange: Ve,
227
227
  value: D,
228
- children: [/* @__PURE__ */ l(i.Item, {
229
- label: n.formatMessage(r.relativeDateFilterAnyTime),
228
+ children: [/* @__PURE__ */ t(i.Item, {
229
+ label: s.formatMessage(l.relativeDateFilterAnyTime),
230
230
  value: "anyTime"
231
- }), /* @__PURE__ */ l(i.Item, {
232
- label: n.formatMessage(r.relativeDateFilterToday),
231
+ }), /* @__PURE__ */ t(i.Item, {
232
+ label: s.formatMessage(l.relativeDateFilterToday),
233
233
  value: "today"
234
- }), /* @__PURE__ */ l(i.Item, {
234
+ }), /* @__PURE__ */ t(i.Item, {
235
235
  description: B("next"),
236
- label: n.formatMessage(r.relativeDateFilterNext),
236
+ label: s.formatMessage(l.relativeDateFilterNext),
237
237
  value: "next"
238
- }), /* @__PURE__ */ l(i.Item, {
238
+ }), /* @__PURE__ */ t(i.Item, {
239
239
  description: B("past"),
240
- label: n.formatMessage(r.relativeDateFilterPast),
240
+ label: s.formatMessage(l.relativeDateFilterPast),
241
241
  value: "past"
242
- }), /* @__PURE__ */ l(i.Item, {
242
+ }), /* @__PURE__ */ t(i.Item, {
243
243
  description: B("olderThan"),
244
- label: n.formatMessage(r.relativeDateFilterOlderThan),
244
+ label: s.formatMessage(l.relativeDateFilterOlderThan),
245
245
  value: "olderThan"
246
- }), /* @__PURE__ */ l(i.Item, {
247
- description: ne(),
248
- label: n.formatMessage(r.relativeDateFilterCustomRange),
246
+ }), /* @__PURE__ */ t(i.Item, {
247
+ description: se(),
248
+ label: s.formatMessage(l.relativeDateFilterCustomRange),
249
249
  value: "customRange"
250
250
  })]
251
251
  })]
@@ -1,35 +1,35 @@
1
- import { getIn as E } from "formik";
2
- import { useMemo as V, useState as c } from "react";
3
- import { useIntl as _ } from "react-intl";
4
- import { R as M } from "../../../../../../chunks/types.js";
5
- import { DEFAULT_MAX_DATE as F } from "./constants.js";
6
- import { convertToDatePickerValue as D } from "./date-conversion-utils.js";
7
- import { E as A } from "../../../../../../chunks/types2.js";
8
- import { useDateInternationalization as x } from "./use-date-internationalization.js";
9
- import i from "../../../../messages.js";
10
- const B = (f, R, d, I, t) => {
1
+ import { getIn as p } from "formik";
2
+ import { useMemo as E, useState as c } from "react";
3
+ import { useIntl as X } from "react-intl";
4
+ import { R as V } from "../../../../../../chunks/types.js";
5
+ import { DEFAULT_MAX_DATE as D } from "./constants.js";
6
+ import { convertToDatePickerValue as M } from "./date-conversion-utils.js";
7
+ import { E as d } from "../../../../../../chunks/types2.js";
8
+ import { useDateInternationalization as _ } from "./use-date-internationalization.js";
9
+ import m from "../../../../messages.js";
10
+ const B = (i, F, A, R, t) => {
11
11
  const {
12
12
  formatCalendarDate: a
13
- } = x(I), s = _(), l = E(f, R), u = E(f, d), T = V(() => D(l, t), [t, l]), g = V(() => D(u, t), [t, u]), [v, y] = c(null), [O, X] = c(null), m = (r, o) => r === M.FROM ? y(o) : X(o);
13
+ } = _(R), n = X(), l = p(i, F), f = p(i, A), I = E(() => M(l, t), [t, l]), T = E(() => M(f, t), [t, f]), [g, v] = c(null), [y, O] = c(null), s = (r, o) => r === V.FROM ? v(o) : O(o);
14
14
  return {
15
15
  validateDates: (r, o, e) => {
16
- const p = e === M.FROM, n = p ? r : o;
17
- if ((n == null ? void 0 : n.compare(F)) > 0)
18
- return m(e, A.MAX), s.formatMessage(i.beforeDateValidationError, {
19
- date: a(F)
16
+ const u = e === V.FROM;
17
+ if ((u ? r : o)?.compare(D) > 0)
18
+ return s(e, d.MAX), n.formatMessage(m.beforeDateValidationError, {
19
+ date: a(D)
20
20
  });
21
21
  if (r && o && r.compare(o) > 0)
22
- return m(e, A.OVERLAPPING), p ? s.formatMessage(i.beforeDateValidationError, {
22
+ return s(e, d.OVERLAPPING), u ? n.formatMessage(m.beforeDateValidationError, {
23
23
  date: a(o)
24
- }) : s.formatMessage(i.afterDateValidationError, {
24
+ }) : n.formatMessage(m.afterDateValidationError, {
25
25
  date: a(r)
26
26
  });
27
- m(e, null);
27
+ s(e, null);
28
28
  },
29
- fromDatePickerValue: T,
30
- toDatePickerValue: g,
31
- fromErrorType: v,
32
- toErrorType: O
29
+ fromDatePickerValue: I,
30
+ toDatePickerValue: T,
31
+ fromErrorType: g,
32
+ toErrorType: y
33
33
  };
34
34
  };
35
35
  export {
@@ -2,7 +2,7 @@ import { useState as n } from "react";
2
2
  import { useIntl as m } from "react-intl";
3
3
  import s from "../../../../messages.js";
4
4
  import { E as i } from "../../../../../../chunks/types2.js";
5
- const a = (r) => r != null && r.length ? /^[-+]?\d+$/.test(r.trim()) : !0, c = () => {
5
+ const a = (r) => r?.length ? /^[-+]?\d+$/.test(r.trim()) : !0, d = () => {
6
6
  const r = m(), [o, t] = n(null);
7
7
  return {
8
8
  validatePositiveInteger: (e) => {
@@ -17,5 +17,5 @@ const a = (r) => r != null && r.length ? /^[-+]?\d+$/.test(r.trim()) : !0, c = (
17
17
  };
18
18
  export {
19
19
  a as isIntegerOrBlank,
20
- c as useIntegerValidation
20
+ d as useIntegerValidation
21
21
  };
@@ -4,45 +4,45 @@ import { useIntl as V, FormattedMessage as x } from "react-intl";
4
4
  import i from "../../../../messages.js";
5
5
  import { jsx as t, jsxs as C } from "react/jsx-runtime";
6
6
  const O = ({
7
- disableForm: m,
7
+ disableForm: u,
8
8
  fieldNamePrefix: s,
9
- label: d,
10
- portalElement: h,
11
- hasAccordion: p,
12
- placeholder: v
9
+ label: r,
10
+ portalElement: m,
11
+ hasAccordion: h,
12
+ placeholder: p
13
13
  }) => {
14
14
  const {
15
- setFieldValue: c,
16
- values: g
17
- } = E(), f = V(), r = `${s}.value.enum[0]`, n = F(g, `${s}.options`, []).map(({
15
+ setFieldValue: d,
16
+ values: v
17
+ } = E(), g = V(), n = `${s}.value.enum[0]`, f = F(v, `${s}.options`, []).map(({
18
18
  key: a
19
- }) => a), u = v || f.formatMessage(i.selectValuePlaceholder);
19
+ }) => a), c = p || g.formatMessage(i.selectValuePlaceholder);
20
20
  return /* @__PURE__ */ t("div", {
21
- "data-testid": `${d}-field`,
21
+ "data-testid": `${r}-field`,
22
22
  children: /* @__PURE__ */ t(M, {
23
- name: r,
23
+ name: n,
24
24
  children: ({
25
25
  field: a
26
26
  }) => /* @__PURE__ */ t(l, {
27
27
  "data-target-id": `Select-${s}`,
28
- disabled: m,
29
- hideLabel: p,
30
- label: d,
28
+ disabled: u,
29
+ hideLabel: h,
30
+ label: r,
31
31
  onValueChange: (e) => {
32
- e === o ? c(r, "") : c(r, e);
32
+ e === o ? d(n, "") : d(n, e);
33
33
  },
34
- placeholder: u,
34
+ placeholder: c,
35
35
  ...a,
36
36
  value: a.value === o ? "" : a.value,
37
37
  children: /* @__PURE__ */ C(l.Content, {
38
- container: h,
38
+ container: m,
39
39
  children: [/* @__PURE__ */ t(l.Option, {
40
- text: u,
40
+ text: c,
41
41
  value: o,
42
42
  children: /* @__PURE__ */ t(x, {
43
43
  ...i.selectValuePlaceholder
44
44
  })
45
- }), n == null ? void 0 : n.map((e) => /* @__PURE__ */ t(l.Option, {
45
+ }), f?.map((e) => /* @__PURE__ */ t(l.Option, {
46
46
  text: e,
47
47
  value: e,
48
48
  children: e
@@ -1,15 +1,15 @@
1
- import { R as B } from "../../../../../../chunks/types.js";
2
- import { createFieldValue as R } from "./utils.js";
3
- const b = (u, s, V) => (r, m, o, k) => {
4
- V == null || V(r), s == null || s(u, r);
5
- const a = R(r === "isBlank" || r === "isNotBlank" ? "" : m, r === "isBlank" || r === "isNotBlank" ? "" : o, r, !0);
6
- k.setFieldValue(u, a);
7
- }, f = (u, s, V, r) => (m, o, k) => {
8
- V(r);
9
- const t = R(r === B.FROM ? m : o, r === B.TO ? m : o, s, !0);
10
- k.setFieldValue(u, t);
1
+ import { R as l } from "../../../../../../chunks/types.js";
2
+ import { createFieldValue as i } from "./utils.js";
3
+ const d = (n, o, a) => (t, e, r, s) => {
4
+ a?.(t), o?.(n, t);
5
+ const V = i(t === "isBlank" || t === "isNotBlank" ? "" : e, t === "isBlank" || t === "isNotBlank" ? "" : r, t, !0);
6
+ s.setFieldValue(n, V);
7
+ }, k = (n, o, a, t) => (e, r, s) => {
8
+ a(t);
9
+ const c = i(t === l.FROM ? e : r, t === l.TO ? e : r, o, !0);
10
+ s.setFieldValue(n, c);
11
11
  };
12
12
  export {
13
- b as createAdvancedFilterOptionHandler,
14
- f as createInputChangeHandler
13
+ d as createAdvancedFilterOptionHandler,
14
+ k as createInputChangeHandler
15
15
  };
@@ -1,63 +1,60 @@
1
- let E = /* @__PURE__ */ function(r) {
1
+ let t = /* @__PURE__ */ (function(r) {
2
2
  return r.EQUALS = "equals", r.GREATER_THAN = "greaterThanOrEqual", r.LESS_THAN = "lessThanOrEqual", r.BETWEEN = "between", r.IS_BLANK = "isBlank", r.IS_NOT_BLANK = "isNotBlank", r;
3
- }({});
4
- const f = (r, t) => r && (t == null ? void 0 : t.some(([u]) => u === r)) ? r : E.EQUALS;
5
- let s = /* @__PURE__ */ function(r) {
3
+ })({});
4
+ const L = (r, e) => r && e?.some(([N]) => N === r) ? r : t.EQUALS;
5
+ let E = /* @__PURE__ */ (function(r) {
6
6
  return r.BOTH = "both", r.SINGLE = "single", r.NONE = "none", r;
7
- }({});
8
- const A = (r) => r === E.IS_BLANK || r === E.IS_NOT_BLANK ? s.NONE : r === E.BETWEEN ? s.BOTH : [E.EQUALS, E.GREATER_THAN, E.LESS_THAN].includes(r) ? s.SINGLE : s.NONE, S = (r) => r.lt && !r.gt ? {
7
+ })({});
8
+ const _ = (r) => r === t.IS_BLANK || r === t.IS_NOT_BLANK ? E.NONE : r === t.BETWEEN ? E.BOTH : [t.EQUALS, t.GREATER_THAN, t.LESS_THAN].includes(r) ? E.SINGLE : E.NONE, g = (r) => r.lt && !r.gt ? {
9
9
  from: r.lt,
10
10
  to: ""
11
11
  } : {
12
12
  from: r.gt || "",
13
13
  to: r.lt || ""
14
- }, L = (r) => {
15
- var t, n, u, e, N, g;
16
- return r.advancedFilterOption === E.LESS_THAN ? {
17
- from: ((n = (t = r.value) == null ? void 0 : t.range) == null ? void 0 : n.lt) || "",
18
- to: ""
19
- } : {
20
- from: ((e = (u = r.value) == null ? void 0 : u.range) == null ? void 0 : e.gt) || "",
21
- to: ((g = (N = r.value) == null ? void 0 : N.range) == null ? void 0 : g.lt) || ""
22
- };
23
- }, T = (r) => typeof r == "object" && r !== null, _ = (r) => T(r) && "advancedFilterOption" in r && "value" in r && typeof r.advancedFilterOption == "string", B = (r, t) => {
24
- if (!T(r))
14
+ }, f = (r) => r.advancedFilterOption === t.LESS_THAN ? {
15
+ from: r.value?.range?.lt || "",
16
+ to: ""
17
+ } : {
18
+ from: r.value?.range?.gt || "",
19
+ to: r.value?.range?.lt || ""
20
+ }, S = (r) => typeof r == "object" && r !== null, T = (r) => S(r) && "advancedFilterOption" in r && "value" in r && typeof r.advancedFilterOption == "string", A = (r, e) => {
21
+ if (!S(r))
25
22
  return {
26
23
  from: "",
27
24
  to: ""
28
25
  };
29
26
  const n = r;
30
- return n.range && !t ? S(n.range) : t && _(r) ? L(r) : n.range ? S(n.range) : {
27
+ return n.range && !e ? g(n.range) : e && T(r) ? f(r) : n.range ? g(n.range) : {
31
28
  from: "",
32
29
  to: ""
33
30
  };
34
- }, I = (r, t, n, u) => {
35
- if (u) {
36
- if (n === E.IS_BLANK || n === E.IS_NOT_BLANK)
31
+ }, B = (r, e, n, N) => {
32
+ if (N) {
33
+ if (n === t.IS_BLANK || n === t.IS_NOT_BLANK)
37
34
  return {
38
35
  value: {
39
36
  range: {}
40
37
  },
41
38
  advancedFilterOption: n
42
39
  };
43
- const N = {};
44
- return r && (n === E.LESS_THAN ? N.lt = r : N.gt = r), t && n === E.BETWEEN && (N.lt = t), {
40
+ const s = {};
41
+ return r && (n === t.LESS_THAN ? s.lt = r : s.gt = r), e && n === t.BETWEEN && (s.lt = e), {
45
42
  value: {
46
- range: N
43
+ range: s
47
44
  },
48
45
  advancedFilterOption: n
49
46
  };
50
47
  }
51
- const e = {};
52
- return r && (e.gt = r), t && (e.lt = t), {
53
- range: e
48
+ const u = {};
49
+ return r && (u.gt = r), e && (u.lt = e), {
50
+ range: u
54
51
  };
55
52
  };
56
53
  export {
57
- E as FloatAdvancedFilterOption,
58
- s as FloatInputDisplayState,
59
- I as createFieldValue,
60
- f as getInitialAdvancedFilterValue,
61
- A as getInputDisplayState,
62
- B as getInputValues
54
+ t as FloatAdvancedFilterOption,
55
+ E as FloatInputDisplayState,
56
+ B as createFieldValue,
57
+ L as getInitialAdvancedFilterValue,
58
+ _ as getInputDisplayState,
59
+ A as getInputValues
63
60
  };