@box/metadata-filter 1.26.4 → 1.26.6

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.
@@ -1,117 +1,114 @@
1
- import { Text as K, DateI18nProvider as Q, DatePicker as P } from "@box/blueprint-web";
2
- import { useFormikContext as W, Field as y } from "formik";
3
- import { useState as Y, useRef as E, useMemo as I } from "react";
4
- import { useIntl as Z } from "react-intl";
1
+ import { Text as J, DateI18nProvider as K, DatePicker as k } from "@box/blueprint-web";
2
+ import { useFormikContext as Q, Field as P } from "formik";
3
+ import { useState as W, useRef as y, useMemo as E } from "react";
4
+ import { useIntl as Y } from "react-intl";
5
5
  import n from "../../../../messages.js";
6
6
  import { R as a } from "../../../../../../chunks/types.js";
7
- import { DEFAULT_MAX_DATE as $ } from "./constants.js";
8
- import { convertToFormikValue as B } from "./date-conversion-utils.js";
9
- import { MetadataDateFieldRelative as ee } from "./metadata-date-field-relative.js";
7
+ import { DEFAULT_MAX_DATE as I } from "./constants.js";
8
+ import { convertToFormikValueRanged as $ } from "./date-conversion-utils.js";
9
+ import { MetadataDateFieldRelative as Z } from "./metadata-date-field-relative.js";
10
10
  import { s as i } from "../../../../../../chunks/metadata-date-field.module.js";
11
11
  import { E as g } from "../../../../../../chunks/types2.js";
12
- import { useDateInternationalization as ae } from "./use-date-internationalization.js";
13
- import { useDateValidation as re } from "./use-date-validation.js";
14
- import { getDynamicMaxMinValue as w } from "./utils.js";
15
- import { jsx as t, jsxs as z } from "react/jsx-runtime";
16
- const ve = ({
12
+ import { useDateValidation as ee } from "./use-date-validation.js";
13
+ import { getDynamicMaxMinValue as B } from "./utils.js";
14
+ import { jsx as t, jsxs as w } from "react/jsx-runtime";
15
+ const Fe = ({
17
16
  canUseRelativeDates: f,
18
17
  ...s
19
- }) => f ? /* @__PURE__ */ t(ee, {
18
+ }) => f ? /* @__PURE__ */ t(Z, {
20
19
  ...s
21
- }) : /* @__PURE__ */ t(te, {
20
+ }) : /* @__PURE__ */ t(ae, {
22
21
  ...s
23
- }), te = ({
22
+ }), ae = ({
24
23
  customFieldLabels: f = [],
25
24
  direction: s = "horizontal",
26
- disableForm: v,
27
- fieldNamePrefix: D,
28
- label: O,
29
- locale: M,
30
- portalElement: T,
25
+ disableForm: p,
26
+ fieldNamePrefix: v,
27
+ label: D,
28
+ locale: O,
29
+ portalElement: L,
31
30
  hasAccordion: S
32
31
  }) => {
33
- const [L, h] = Y(a.FROM), m = `${D}.value.range.gt`, c = `${D}.value.range.lt`, {
32
+ const [R, M] = W(a.FROM), m = `${v}.value.range.gt`, d = `${v}.value.range.lt`, {
34
33
  values: j,
35
34
  setFieldTouched: G,
36
- setFieldValue: V
37
- } = W(), {
38
- localTimezone: R
39
- } = ae(M), {
40
- validateDates: b,
41
- fromDatePickerValue: d,
35
+ setFieldValue: T
36
+ } = Q(), {
37
+ validateDates: V,
38
+ fromDatePickerValue: c,
42
39
  toDatePickerValue: u,
43
- fromErrorType: x,
44
- toErrorType: A
45
- } = re(j, m, c, M, !1), o = Z(), F = E(d), p = E(u), C = {
40
+ fromErrorType: b,
41
+ toErrorType: x
42
+ } = ee(j, m, d, O, !0), o = Y(), h = y(c), F = y(u), A = {
46
43
  clearDatePickerAriaLabel: o.formatMessage(n.clearSelectedDate),
47
44
  nextMonthAriaLabel: o.formatMessage(n.switchToNextMonth),
48
45
  openCalendarDropdownAriaLabel: o.formatMessage(n.openCalendar),
49
46
  previousMonthAriaLabel: o.formatMessage(n.switchToNextMonth)
50
- }, [X, _] = f, H = (e) => {
51
- const r = B(e, R, a.FROM);
52
- F.current = e, V(m, r), h(a.FROM);
53
- }, U = (e) => {
54
- const r = B(e, R, a.TO);
55
- p.current = e, V(c, r), h(a.TO);
56
- }, N = (e) => {
57
- const r = e === a.FROM ? m : c;
58
- G(r, !0), h(e);
59
- }, q = I(() => w(u, $), [u]), J = I(() => w(d), [d]), k = (e, r, l) => !!(r === g.MAX && e === g.OVERLAPPING || e === g.OVERLAPPING && l);
60
- return /* @__PURE__ */ z("div", {
47
+ }, [X, _] = f, z = (e) => {
48
+ const r = $(e, a.FROM);
49
+ h.current = e, T(m, r), M(a.FROM);
50
+ }, H = (e) => {
51
+ const r = $(e, a.TO);
52
+ F.current = e, T(d, r), M(a.TO);
53
+ }, C = (e) => {
54
+ const r = e === a.FROM ? m : d;
55
+ G(r, !0), M(e);
56
+ }, U = E(() => B(u, I), [u]), q = E(() => B(c), [c]), N = (e, r, l) => !!(r === g.MAX && e === g.OVERLAPPING || e === g.OVERLAPPING && l);
57
+ return /* @__PURE__ */ w("div", {
61
58
  className: i.container,
62
- "data-testid": `${O}-field`,
63
- children: [!S && /* @__PURE__ */ t(K, {
59
+ "data-testid": `${D}-field`,
60
+ children: [!S && /* @__PURE__ */ t(J, {
64
61
  as: "span",
65
62
  className: i.rangeFieldLabel,
66
63
  color: "textOnLightSecondary",
67
64
  variant: "bodyDefaultBold",
68
- children: O
69
- }), /* @__PURE__ */ t(Q, {
70
- locale: M,
71
- children: /* @__PURE__ */ z("div", {
65
+ children: D
66
+ }), /* @__PURE__ */ t(K, {
67
+ locale: O,
68
+ children: /* @__PURE__ */ w("div", {
72
69
  className: `${i.rangeInputsContainer} ${s === "vertical" ? i.verticalLayout : ""}`,
73
- children: [/* @__PURE__ */ t(y, {
70
+ children: [/* @__PURE__ */ t(P, {
74
71
  name: m,
75
- validate: (e) => b(F.current, p.current, a.FROM),
72
+ validate: (e) => V(h.current, F.current, a.FROM),
76
73
  children: ({
77
74
  field: e,
78
75
  meta: r
79
76
  }) => /* @__PURE__ */ t("div", {
80
77
  className: i.inputContainer,
81
- children: /* @__PURE__ */ t(P, {
78
+ children: /* @__PURE__ */ t(k, {
82
79
  ...e,
83
- ...C,
80
+ ...A,
84
81
  calendarAriaLabel: o.formatMessage(n.selectFromDate),
85
- error: k(x, A, L !== a.FROM) ? void 0 : r.error,
86
- isDisabled: v,
82
+ error: N(b, x, R !== a.FROM) ? void 0 : r.error,
83
+ isDisabled: p,
87
84
  label: X || o.formatMessage(n.fieldFromLabel),
88
- maxValue: q,
89
- onBlur: () => N(a.FROM),
90
- onChange: (l) => H(l),
91
- portalElement: T,
92
- value: d
85
+ maxValue: U,
86
+ onBlur: () => C(a.FROM),
87
+ onChange: (l) => z(l),
88
+ portalElement: L,
89
+ value: c
93
90
  })
94
91
  })
95
- }), /* @__PURE__ */ t(y, {
96
- name: c,
97
- validate: (e) => b(F.current, p.current, a.TO),
92
+ }), /* @__PURE__ */ t(P, {
93
+ name: d,
94
+ validate: (e) => V(h.current, F.current, a.TO),
98
95
  children: ({
99
96
  field: e,
100
97
  meta: r
101
98
  }) => /* @__PURE__ */ t("div", {
102
99
  className: i.inputContainer,
103
- children: /* @__PURE__ */ t(P, {
100
+ children: /* @__PURE__ */ t(k, {
104
101
  ...e,
105
- ...C,
102
+ ...A,
106
103
  calendarAriaLabel: o.formatMessage(n.selectToDate),
107
- error: k(A, x, L !== a.TO) ? void 0 : r.error,
108
- isDisabled: v,
104
+ error: N(x, b, R !== a.TO) ? void 0 : r.error,
105
+ isDisabled: p,
109
106
  label: _ || o.formatMessage(n.fieldToLabel),
110
- maxValue: $,
111
- minValue: J,
112
- onBlur: () => N(a.TO),
113
- onChange: (l) => U(l),
114
- portalElement: T,
107
+ maxValue: I,
108
+ minValue: q,
109
+ onBlur: () => C(a.TO),
110
+ onChange: (l) => H(l),
111
+ portalElement: L,
115
112
  value: u
116
113
  })
117
114
  })
@@ -121,7 +118,7 @@ const ve = ({
121
118
  });
122
119
  };
123
120
  export {
124
- ve as MetadataDateField,
125
- te as MetadataDateFieldNonRelative,
126
- ve as default
121
+ Fe as MetadataDateField,
122
+ ae as MetadataDateFieldNonRelative,
123
+ Fe as default
127
124
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-filter",
3
- "version": "1.26.4",
3
+ "version": "1.26.6",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.16.0",
@@ -11,7 +11,7 @@
11
11
  "react-intl": "6.4.2"
12
12
  },
13
13
  "devDependencies": {
14
- "@box/blueprint-web": "^12.66.0",
14
+ "@box/blueprint-web": "^12.67.0",
15
15
  "@box/blueprint-web-assets": "^4.66.0",
16
16
  "@box/storybook-utils": "^0.14.2",
17
17
  "react": "^18.3.0",