@box/metadata-filter 1.26.3 → 1.26.5
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
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
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
|
|
8
|
-
import {
|
|
9
|
-
import { MetadataDateFieldRelative as
|
|
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 {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
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(
|
|
18
|
+
}) => f ? /* @__PURE__ */ t(Z, {
|
|
20
19
|
...s
|
|
21
|
-
}) : /* @__PURE__ */ t(
|
|
20
|
+
}) : /* @__PURE__ */ t(ae, {
|
|
22
21
|
...s
|
|
23
|
-
}),
|
|
22
|
+
}), ae = ({
|
|
24
23
|
customFieldLabels: f = [],
|
|
25
24
|
direction: s = "horizontal",
|
|
26
|
-
disableForm:
|
|
27
|
-
fieldNamePrefix:
|
|
28
|
-
label:
|
|
29
|
-
locale:
|
|
30
|
-
portalElement:
|
|
25
|
+
disableForm: p,
|
|
26
|
+
fieldNamePrefix: v,
|
|
27
|
+
label: D,
|
|
28
|
+
locale: O,
|
|
29
|
+
portalElement: L,
|
|
31
30
|
hasAccordion: S
|
|
32
31
|
}) => {
|
|
33
|
-
const [
|
|
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:
|
|
37
|
-
} =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
validateDates: b,
|
|
41
|
-
fromDatePickerValue: d,
|
|
35
|
+
setFieldValue: T
|
|
36
|
+
} = Q(), {
|
|
37
|
+
validateDates: V,
|
|
38
|
+
fromDatePickerValue: c,
|
|
42
39
|
toDatePickerValue: u,
|
|
43
|
-
fromErrorType:
|
|
44
|
-
toErrorType:
|
|
45
|
-
} =
|
|
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,
|
|
51
|
-
const r =
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
const r =
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
const r = e === a.FROM ? m :
|
|
58
|
-
G(r, !0),
|
|
59
|
-
},
|
|
60
|
-
return /* @__PURE__ */
|
|
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": `${
|
|
63
|
-
children: [!S && /* @__PURE__ */ t(
|
|
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:
|
|
69
|
-
}), /* @__PURE__ */ t(
|
|
70
|
-
locale:
|
|
71
|
-
children: /* @__PURE__ */
|
|
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(
|
|
70
|
+
children: [/* @__PURE__ */ t(P, {
|
|
74
71
|
name: m,
|
|
75
|
-
validate: (e) =>
|
|
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(
|
|
78
|
+
children: /* @__PURE__ */ t(k, {
|
|
82
79
|
...e,
|
|
83
|
-
...
|
|
80
|
+
...A,
|
|
84
81
|
calendarAriaLabel: o.formatMessage(n.selectFromDate),
|
|
85
|
-
error:
|
|
86
|
-
isDisabled:
|
|
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:
|
|
89
|
-
onBlur: () =>
|
|
90
|
-
onChange: (l) =>
|
|
91
|
-
portalElement:
|
|
92
|
-
value:
|
|
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(
|
|
96
|
-
name:
|
|
97
|
-
validate: (e) =>
|
|
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(
|
|
100
|
+
children: /* @__PURE__ */ t(k, {
|
|
104
101
|
...e,
|
|
105
|
-
...
|
|
102
|
+
...A,
|
|
106
103
|
calendarAriaLabel: o.formatMessage(n.selectToDate),
|
|
107
|
-
error:
|
|
108
|
-
isDisabled:
|
|
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:
|
|
112
|
-
onBlur: () =>
|
|
113
|
-
onChange: (l) =>
|
|
114
|
-
portalElement:
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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.
|
|
3
|
+
"version": "1.26.5",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.16.0",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"react-intl": "6.4.2"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@box/blueprint-web": "^12.
|
|
15
|
-
"@box/blueprint-web-assets": "^4.
|
|
16
|
-
"@box/storybook-utils": "^0.14.
|
|
14
|
+
"@box/blueprint-web": "^12.66.0",
|
|
15
|
+
"@box/blueprint-web-assets": "^4.66.0",
|
|
16
|
+
"@box/storybook-utils": "^0.14.2",
|
|
17
17
|
"react": "^18.3.0",
|
|
18
18
|
"react-dom": "^18.3.0",
|
|
19
19
|
"react-intl": "6.4.2"
|