@dbcdk/react-components 0.0.168 → 0.0.170
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.
- package/dist/components/filter-field/FilterField.cjs +125 -89
- package/dist/components/filter-field/FilterField.d.ts +3 -1
- package/dist/components/filter-field/FilterField.js +127 -91
- package/dist/components/filter-field/FilterField.module.css +154 -174
- package/dist/components/forms/typeahead/Typeahead.cjs +66 -34
- package/dist/components/forms/typeahead/Typeahead.d.ts +7 -1
- package/dist/components/forms/typeahead/Typeahead.js +66 -34
- package/dist/components/nav-bar/NavBar.module.css +1 -1
- package/dist/components/overlay/modal/Modal.cjs +15 -6
- package/dist/components/overlay/modal/Modal.d.ts +1 -0
- package/dist/components/overlay/modal/Modal.js +15 -6
- package/package.json +2 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var react = require('react');
|
|
6
|
+
var Button = require('../../components/button/Button');
|
|
6
7
|
var Input = require('../../components/forms/input/Input');
|
|
7
8
|
var Typeahead = require('../../components/forms/typeahead/Typeahead');
|
|
8
9
|
var styles = require('./FilterField.module.css');
|
|
@@ -14,20 +15,20 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
14
15
|
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
15
16
|
|
|
16
17
|
const LABELS = {
|
|
17
|
-
is: "
|
|
18
|
-
isNot: "
|
|
19
|
-
contains: "
|
|
20
|
-
notContains: "
|
|
21
|
-
startsWith: "
|
|
22
|
-
endsWith: "
|
|
18
|
+
is: "er",
|
|
19
|
+
isNot: "er ikke",
|
|
20
|
+
contains: "indeholder",
|
|
21
|
+
notContains: "indeholder ikke",
|
|
22
|
+
startsWith: "starter med",
|
|
23
|
+
endsWith: "slutter med",
|
|
23
24
|
gt: ">",
|
|
24
25
|
lt: "<",
|
|
25
26
|
gte: "\u2265",
|
|
26
27
|
lte: "\u2264",
|
|
27
|
-
in: "",
|
|
28
|
-
notIn: "
|
|
29
|
-
isEmpty: "
|
|
30
|
-
isNotEmpty: "
|
|
28
|
+
in: "er en af",
|
|
29
|
+
notIn: "er ikke en af",
|
|
30
|
+
isEmpty: "er tom",
|
|
31
|
+
isNotEmpty: "er ikke tom"
|
|
31
32
|
};
|
|
32
33
|
const DEFAULT_TEXT_OPERATORS = [
|
|
33
34
|
"is",
|
|
@@ -55,10 +56,12 @@ function OperatorDropdown({
|
|
|
55
56
|
value,
|
|
56
57
|
onChange,
|
|
57
58
|
operators,
|
|
59
|
+
label,
|
|
58
60
|
size = "sm",
|
|
59
61
|
disabled
|
|
60
62
|
}) {
|
|
61
63
|
const popRef = react.useRef(null);
|
|
64
|
+
const contentId = react.useId();
|
|
62
65
|
const handleSelect = (op) => {
|
|
63
66
|
var _a;
|
|
64
67
|
onChange(op);
|
|
@@ -68,16 +71,21 @@ function OperatorDropdown({
|
|
|
68
71
|
Popover.Popover,
|
|
69
72
|
{
|
|
70
73
|
ref: popRef,
|
|
74
|
+
contentId,
|
|
71
75
|
minWidth: "140px",
|
|
72
76
|
matchTriggerWidth: false,
|
|
73
|
-
trigger: (toggle, icon) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
74
|
-
|
|
77
|
+
trigger: (toggle, icon, open) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
78
|
+
Button.Button,
|
|
75
79
|
{
|
|
76
|
-
|
|
80
|
+
variant: "outlined",
|
|
81
|
+
size,
|
|
77
82
|
onClick: toggle,
|
|
78
83
|
disabled,
|
|
79
|
-
"aria-label":
|
|
80
|
-
|
|
84
|
+
"aria-label": `Skift operator for ${label}`,
|
|
85
|
+
"aria-haspopup": "menu",
|
|
86
|
+
"aria-expanded": open,
|
|
87
|
+
"aria-controls": contentId,
|
|
88
|
+
className: [styles__default.default.operatorTrigger, open ? styles__default.default.operatorTriggerOpen : ""].filter(Boolean).join(" "),
|
|
81
89
|
children: [
|
|
82
90
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles__default.default.operatorText, children: LABELS[value] }),
|
|
83
91
|
icon
|
|
@@ -116,12 +124,21 @@ function FilterField({
|
|
|
116
124
|
maxWidth,
|
|
117
125
|
popoverWidth,
|
|
118
126
|
debounceTime = INPUT_DEBOUNCE_MS,
|
|
127
|
+
maxVisibleOptions,
|
|
128
|
+
allowCustomValue = false,
|
|
119
129
|
...inputProps
|
|
120
130
|
}) {
|
|
121
131
|
var _a, _b, _c, _d;
|
|
122
132
|
const filterFieldRef = react.useRef(null);
|
|
133
|
+
const reactId = react.useId();
|
|
134
|
+
const labelId = `filter-field-label-${reactId}`;
|
|
135
|
+
const valueInputId = `filter-field-value-${reactId}`;
|
|
123
136
|
const ops = react.useMemo(() => operators != null ? operators : DEFAULT_TEXT_OPERATORS, [operators]);
|
|
124
137
|
const shouldAutoFitTypeahead = control === "select" && single && !width;
|
|
138
|
+
const resolvedLabel = label != null ? label : field;
|
|
139
|
+
const describedBy = [inputProps["aria-describedby"]].filter(Boolean).join(" ") || void 0;
|
|
140
|
+
const labelledBy = [labelId, inputProps["aria-labelledby"]].filter(Boolean).join(" ");
|
|
141
|
+
const invalid = inputProps["aria-invalid"];
|
|
125
142
|
const [selectedOperator, setSelectedOperator] = react.useState(operator);
|
|
126
143
|
const active = isFilterActive(value);
|
|
127
144
|
react.useEffect(() => {
|
|
@@ -196,90 +213,109 @@ function FilterField({
|
|
|
196
213
|
clearDebounce();
|
|
197
214
|
};
|
|
198
215
|
}, []);
|
|
199
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
216
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
200
217
|
"div",
|
|
201
218
|
{
|
|
202
219
|
ref: filterFieldRef,
|
|
203
220
|
...dataCy ? { "data-cy": dataCy } : {},
|
|
204
221
|
className: [styles__default.default.filterField, styles__default.default[size], styles__default.default[variant], active ? styles__default.default.active : ""].filter(Boolean).join(" "),
|
|
205
|
-
children:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
218
|
-
"div",
|
|
219
|
-
{
|
|
220
|
-
className: [
|
|
221
|
-
styles__default.default.valueWrapper,
|
|
222
|
-
control === "input" ? "dbc-flex dbc-flex-grow" : "",
|
|
223
|
-
shouldAutoFitTypeahead ? styles__default.default.autoWidth : ""
|
|
224
|
-
].filter(Boolean).join(" "),
|
|
225
|
-
style: shouldAutoFitTypeahead ? maxWidth ? { maxWidth } : void 0 : { width, maxWidth },
|
|
226
|
-
children: control === "input" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
227
|
-
Input.Input,
|
|
222
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
className: [
|
|
226
|
+
styles__default.default.controlGroup,
|
|
227
|
+
invalid ? styles__default.default.invalid : "",
|
|
228
|
+
disabled ? styles__default.default.disabled : ""
|
|
229
|
+
].filter(Boolean).join(" "),
|
|
230
|
+
children: [
|
|
231
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { id: labelId, className: styles__default.default.label, children: resolvedLabel }),
|
|
232
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.operatorWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
233
|
+
OperatorDropdown,
|
|
228
234
|
{
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const next = e.currentTarget.value;
|
|
236
|
-
setLocalValue(next);
|
|
237
|
-
scheduleEmitValue(next);
|
|
238
|
-
},
|
|
239
|
-
onBlur: () => {
|
|
240
|
-
flushPendingValue();
|
|
241
|
-
},
|
|
242
|
-
fullWidth: true,
|
|
243
|
-
inputSize: size,
|
|
244
|
-
placeholder,
|
|
245
|
-
disabled,
|
|
246
|
-
autoComplete: (_a = inputProps.autoComplete) != null ? _a : "off",
|
|
247
|
-
autoCorrect: (_b = inputProps.autoCorrect) != null ? _b : "off",
|
|
248
|
-
autoCapitalize: (_c = inputProps.autoCapitalize) != null ? _c : "none",
|
|
249
|
-
spellCheck: (_d = inputProps.spellCheck) != null ? _d : false,
|
|
250
|
-
onClear: () => {
|
|
251
|
-
clearDebounce();
|
|
252
|
-
pendingValueRef.current = "";
|
|
253
|
-
setLocalValue("");
|
|
254
|
-
emit({ value: "" });
|
|
255
|
-
}
|
|
235
|
+
value: selectedOperator,
|
|
236
|
+
onChange: handleOperatorChange,
|
|
237
|
+
operators: ops,
|
|
238
|
+
label: resolvedLabel,
|
|
239
|
+
size,
|
|
240
|
+
disabled
|
|
256
241
|
}
|
|
257
|
-
)
|
|
258
|
-
|
|
242
|
+
) }),
|
|
243
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
244
|
+
"div",
|
|
259
245
|
{
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
246
|
+
className: [
|
|
247
|
+
styles__default.default.valueWrapper,
|
|
248
|
+
control === "input" ? "dbc-flex dbc-flex-grow" : "",
|
|
249
|
+
shouldAutoFitTypeahead ? styles__default.default.autoWidth : ""
|
|
250
|
+
].filter(Boolean).join(" "),
|
|
251
|
+
style: shouldAutoFitTypeahead ? maxWidth || minWidth ? { minWidth, maxWidth } : void 0 : { minWidth, width, maxWidth },
|
|
252
|
+
children: control === "input" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
253
|
+
Input.Input,
|
|
254
|
+
{
|
|
255
|
+
variant: "embedded",
|
|
256
|
+
...inputProps,
|
|
257
|
+
id: valueInputId,
|
|
258
|
+
"aria-labelledby": labelledBy,
|
|
259
|
+
"aria-describedby": describedBy,
|
|
260
|
+
fieldClassName: styles__default.default.embeddedInputField,
|
|
261
|
+
inputClassName: styles__default.default.embeddedInputElement,
|
|
262
|
+
value: localValue,
|
|
263
|
+
onChange: (e) => {
|
|
264
|
+
const next = e.currentTarget.value;
|
|
265
|
+
setLocalValue(next);
|
|
266
|
+
scheduleEmitValue(next);
|
|
267
|
+
},
|
|
268
|
+
onBlur: () => {
|
|
269
|
+
flushPendingValue();
|
|
270
|
+
},
|
|
271
|
+
fullWidth: true,
|
|
272
|
+
inputSize: size,
|
|
273
|
+
placeholder,
|
|
274
|
+
disabled,
|
|
275
|
+
autoComplete: (_a = inputProps.autoComplete) != null ? _a : "off",
|
|
276
|
+
autoCorrect: (_b = inputProps.autoCorrect) != null ? _b : "off",
|
|
277
|
+
autoCapitalize: (_c = inputProps.autoCapitalize) != null ? _c : "none",
|
|
278
|
+
spellCheck: (_d = inputProps.spellCheck) != null ? _d : false,
|
|
279
|
+
onClear: () => {
|
|
280
|
+
clearDebounce();
|
|
281
|
+
pendingValueRef.current = "";
|
|
282
|
+
setLocalValue("");
|
|
283
|
+
emit({ value: "" });
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
+
Typeahead.Typeahead,
|
|
288
|
+
{
|
|
289
|
+
options,
|
|
290
|
+
mode: single ? "single" : "multi",
|
|
291
|
+
selectedValue: single ? value != null ? value : null : Array.isArray(value) ? value : [],
|
|
292
|
+
onChange: (v) => emit({ value: v }),
|
|
293
|
+
minWidth,
|
|
294
|
+
popoverWidth,
|
|
295
|
+
maxVisibleOptions,
|
|
296
|
+
allowCustomValue,
|
|
297
|
+
popoverAnchorRef: filterFieldRef,
|
|
298
|
+
placeholder,
|
|
299
|
+
variant: "embedded",
|
|
300
|
+
inputProps: {
|
|
301
|
+
id: valueInputId,
|
|
302
|
+
"aria-labelledby": labelledBy,
|
|
303
|
+
"aria-describedby": describedBy,
|
|
304
|
+
inputSize: size,
|
|
305
|
+
fieldClassName: styles__default.default.embeddedInputField,
|
|
306
|
+
inputClassName: styles__default.default.embeddedInputElement
|
|
307
|
+
},
|
|
308
|
+
onClear: () => emit({ value: single ? "" : [] }),
|
|
309
|
+
disabled,
|
|
310
|
+
fullWidth: !shouldAutoFitTypeahead,
|
|
311
|
+
fitContent: shouldAutoFitTypeahead
|
|
312
|
+
}
|
|
313
|
+
)
|
|
278
314
|
}
|
|
279
315
|
)
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
)
|
|
283
319
|
}
|
|
284
320
|
);
|
|
285
321
|
}
|
|
@@ -29,9 +29,11 @@ export interface FilterFieldProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
29
29
|
maxWidth?: string;
|
|
30
30
|
popoverWidth?: string;
|
|
31
31
|
debounceTime?: number;
|
|
32
|
+
maxVisibleOptions?: number;
|
|
33
|
+
allowCustomValue?: boolean;
|
|
32
34
|
}
|
|
33
35
|
export declare const NUMBER_OPERATORS: Operator[];
|
|
34
|
-
export declare function FilterField({ field, control, operator, value, onChange, operators, options, single, size, variant, label, placeholder, disabled, 'data-cy': dataCy, minWidth, width, maxWidth, popoverWidth, debounceTime, ...inputProps }: FilterFieldProps & {
|
|
36
|
+
export declare function FilterField({ field, control, operator, value, onChange, operators, options, single, size, variant, label, placeholder, disabled, 'data-cy': dataCy, minWidth, width, maxWidth, popoverWidth, debounceTime, maxVisibleOptions, allowCustomValue, ...inputProps }: FilterFieldProps & {
|
|
35
37
|
'data-cy'?: string;
|
|
36
38
|
}): React.ReactElement;
|
|
37
39
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { useRef, useMemo, useState, useEffect } from 'react';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useId, useMemo, useState, useEffect } from 'react';
|
|
4
|
+
import { Button } from '../../components/button/Button';
|
|
4
5
|
import { Input } from '../../components/forms/input/Input';
|
|
5
6
|
import { Typeahead } from '../../components/forms/typeahead/Typeahead';
|
|
6
7
|
import styles from './FilterField.module.css';
|
|
@@ -8,20 +9,20 @@ import { Menu } from '../menu/Menu';
|
|
|
8
9
|
import { Popover } from '../popover/Popover';
|
|
9
10
|
|
|
10
11
|
const LABELS = {
|
|
11
|
-
is: "
|
|
12
|
-
isNot: "
|
|
13
|
-
contains: "
|
|
14
|
-
notContains: "
|
|
15
|
-
startsWith: "
|
|
16
|
-
endsWith: "
|
|
12
|
+
is: "er",
|
|
13
|
+
isNot: "er ikke",
|
|
14
|
+
contains: "indeholder",
|
|
15
|
+
notContains: "indeholder ikke",
|
|
16
|
+
startsWith: "starter med",
|
|
17
|
+
endsWith: "slutter med",
|
|
17
18
|
gt: ">",
|
|
18
19
|
lt: "<",
|
|
19
20
|
gte: "\u2265",
|
|
20
21
|
lte: "\u2264",
|
|
21
|
-
in: "",
|
|
22
|
-
notIn: "
|
|
23
|
-
isEmpty: "
|
|
24
|
-
isNotEmpty: "
|
|
22
|
+
in: "er en af",
|
|
23
|
+
notIn: "er ikke en af",
|
|
24
|
+
isEmpty: "er tom",
|
|
25
|
+
isNotEmpty: "er ikke tom"
|
|
25
26
|
};
|
|
26
27
|
const DEFAULT_TEXT_OPERATORS = [
|
|
27
28
|
"is",
|
|
@@ -49,10 +50,12 @@ function OperatorDropdown({
|
|
|
49
50
|
value,
|
|
50
51
|
onChange,
|
|
51
52
|
operators,
|
|
53
|
+
label,
|
|
52
54
|
size = "sm",
|
|
53
55
|
disabled
|
|
54
56
|
}) {
|
|
55
57
|
const popRef = useRef(null);
|
|
58
|
+
const contentId = useId();
|
|
56
59
|
const handleSelect = (op) => {
|
|
57
60
|
var _a;
|
|
58
61
|
onChange(op);
|
|
@@ -62,16 +65,21 @@ function OperatorDropdown({
|
|
|
62
65
|
Popover,
|
|
63
66
|
{
|
|
64
67
|
ref: popRef,
|
|
68
|
+
contentId,
|
|
65
69
|
minWidth: "140px",
|
|
66
70
|
matchTriggerWidth: false,
|
|
67
|
-
trigger: (toggle, icon) => /* @__PURE__ */ jsxs(
|
|
68
|
-
|
|
71
|
+
trigger: (toggle, icon, open) => /* @__PURE__ */ jsxs(
|
|
72
|
+
Button,
|
|
69
73
|
{
|
|
70
|
-
|
|
74
|
+
variant: "outlined",
|
|
75
|
+
size,
|
|
71
76
|
onClick: toggle,
|
|
72
77
|
disabled,
|
|
73
|
-
"aria-label":
|
|
74
|
-
|
|
78
|
+
"aria-label": `Skift operator for ${label}`,
|
|
79
|
+
"aria-haspopup": "menu",
|
|
80
|
+
"aria-expanded": open,
|
|
81
|
+
"aria-controls": contentId,
|
|
82
|
+
className: [styles.operatorTrigger, open ? styles.operatorTriggerOpen : ""].filter(Boolean).join(" "),
|
|
75
83
|
children: [
|
|
76
84
|
/* @__PURE__ */ jsx("span", { className: styles.operatorText, children: LABELS[value] }),
|
|
77
85
|
icon
|
|
@@ -110,12 +118,21 @@ function FilterField({
|
|
|
110
118
|
maxWidth,
|
|
111
119
|
popoverWidth,
|
|
112
120
|
debounceTime = INPUT_DEBOUNCE_MS,
|
|
121
|
+
maxVisibleOptions,
|
|
122
|
+
allowCustomValue = false,
|
|
113
123
|
...inputProps
|
|
114
124
|
}) {
|
|
115
125
|
var _a, _b, _c, _d;
|
|
116
126
|
const filterFieldRef = useRef(null);
|
|
127
|
+
const reactId = useId();
|
|
128
|
+
const labelId = `filter-field-label-${reactId}`;
|
|
129
|
+
const valueInputId = `filter-field-value-${reactId}`;
|
|
117
130
|
const ops = useMemo(() => operators != null ? operators : DEFAULT_TEXT_OPERATORS, [operators]);
|
|
118
131
|
const shouldAutoFitTypeahead = control === "select" && single && !width;
|
|
132
|
+
const resolvedLabel = label != null ? label : field;
|
|
133
|
+
const describedBy = [inputProps["aria-describedby"]].filter(Boolean).join(" ") || void 0;
|
|
134
|
+
const labelledBy = [labelId, inputProps["aria-labelledby"]].filter(Boolean).join(" ");
|
|
135
|
+
const invalid = inputProps["aria-invalid"];
|
|
119
136
|
const [selectedOperator, setSelectedOperator] = useState(operator);
|
|
120
137
|
const active = isFilterActive(value);
|
|
121
138
|
useEffect(() => {
|
|
@@ -190,90 +207,109 @@ function FilterField({
|
|
|
190
207
|
clearDebounce();
|
|
191
208
|
};
|
|
192
209
|
}, []);
|
|
193
|
-
return /* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ jsx(
|
|
194
211
|
"div",
|
|
195
212
|
{
|
|
196
213
|
ref: filterFieldRef,
|
|
197
214
|
...dataCy ? { "data-cy": dataCy } : {},
|
|
198
215
|
className: [styles.filterField, styles[size], styles[variant], active ? styles.active : ""].filter(Boolean).join(" "),
|
|
199
|
-
children:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
/* @__PURE__ */ jsx(
|
|
212
|
-
"div",
|
|
213
|
-
{
|
|
214
|
-
className: [
|
|
215
|
-
styles.valueWrapper,
|
|
216
|
-
control === "input" ? "dbc-flex dbc-flex-grow" : "",
|
|
217
|
-
shouldAutoFitTypeahead ? styles.autoWidth : ""
|
|
218
|
-
].filter(Boolean).join(" "),
|
|
219
|
-
style: shouldAutoFitTypeahead ? maxWidth ? { maxWidth } : void 0 : { width, maxWidth },
|
|
220
|
-
children: control === "input" ? /* @__PURE__ */ jsx(
|
|
221
|
-
Input,
|
|
216
|
+
children: /* @__PURE__ */ jsxs(
|
|
217
|
+
"div",
|
|
218
|
+
{
|
|
219
|
+
className: [
|
|
220
|
+
styles.controlGroup,
|
|
221
|
+
invalid ? styles.invalid : "",
|
|
222
|
+
disabled ? styles.disabled : ""
|
|
223
|
+
].filter(Boolean).join(" "),
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx("span", { id: labelId, className: styles.label, children: resolvedLabel }),
|
|
226
|
+
/* @__PURE__ */ jsx("div", { className: styles.operatorWrapper, children: /* @__PURE__ */ jsx(
|
|
227
|
+
OperatorDropdown,
|
|
222
228
|
{
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const next = e.currentTarget.value;
|
|
230
|
-
setLocalValue(next);
|
|
231
|
-
scheduleEmitValue(next);
|
|
232
|
-
},
|
|
233
|
-
onBlur: () => {
|
|
234
|
-
flushPendingValue();
|
|
235
|
-
},
|
|
236
|
-
fullWidth: true,
|
|
237
|
-
inputSize: size,
|
|
238
|
-
placeholder,
|
|
239
|
-
disabled,
|
|
240
|
-
autoComplete: (_a = inputProps.autoComplete) != null ? _a : "off",
|
|
241
|
-
autoCorrect: (_b = inputProps.autoCorrect) != null ? _b : "off",
|
|
242
|
-
autoCapitalize: (_c = inputProps.autoCapitalize) != null ? _c : "none",
|
|
243
|
-
spellCheck: (_d = inputProps.spellCheck) != null ? _d : false,
|
|
244
|
-
onClear: () => {
|
|
245
|
-
clearDebounce();
|
|
246
|
-
pendingValueRef.current = "";
|
|
247
|
-
setLocalValue("");
|
|
248
|
-
emit({ value: "" });
|
|
249
|
-
}
|
|
229
|
+
value: selectedOperator,
|
|
230
|
+
onChange: handleOperatorChange,
|
|
231
|
+
operators: ops,
|
|
232
|
+
label: resolvedLabel,
|
|
233
|
+
size,
|
|
234
|
+
disabled
|
|
250
235
|
}
|
|
251
|
-
)
|
|
252
|
-
|
|
236
|
+
) }),
|
|
237
|
+
/* @__PURE__ */ jsx(
|
|
238
|
+
"div",
|
|
253
239
|
{
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
240
|
+
className: [
|
|
241
|
+
styles.valueWrapper,
|
|
242
|
+
control === "input" ? "dbc-flex dbc-flex-grow" : "",
|
|
243
|
+
shouldAutoFitTypeahead ? styles.autoWidth : ""
|
|
244
|
+
].filter(Boolean).join(" "),
|
|
245
|
+
style: shouldAutoFitTypeahead ? maxWidth || minWidth ? { minWidth, maxWidth } : void 0 : { minWidth, width, maxWidth },
|
|
246
|
+
children: control === "input" ? /* @__PURE__ */ jsx(
|
|
247
|
+
Input,
|
|
248
|
+
{
|
|
249
|
+
variant: "embedded",
|
|
250
|
+
...inputProps,
|
|
251
|
+
id: valueInputId,
|
|
252
|
+
"aria-labelledby": labelledBy,
|
|
253
|
+
"aria-describedby": describedBy,
|
|
254
|
+
fieldClassName: styles.embeddedInputField,
|
|
255
|
+
inputClassName: styles.embeddedInputElement,
|
|
256
|
+
value: localValue,
|
|
257
|
+
onChange: (e) => {
|
|
258
|
+
const next = e.currentTarget.value;
|
|
259
|
+
setLocalValue(next);
|
|
260
|
+
scheduleEmitValue(next);
|
|
261
|
+
},
|
|
262
|
+
onBlur: () => {
|
|
263
|
+
flushPendingValue();
|
|
264
|
+
},
|
|
265
|
+
fullWidth: true,
|
|
266
|
+
inputSize: size,
|
|
267
|
+
placeholder,
|
|
268
|
+
disabled,
|
|
269
|
+
autoComplete: (_a = inputProps.autoComplete) != null ? _a : "off",
|
|
270
|
+
autoCorrect: (_b = inputProps.autoCorrect) != null ? _b : "off",
|
|
271
|
+
autoCapitalize: (_c = inputProps.autoCapitalize) != null ? _c : "none",
|
|
272
|
+
spellCheck: (_d = inputProps.spellCheck) != null ? _d : false,
|
|
273
|
+
onClear: () => {
|
|
274
|
+
clearDebounce();
|
|
275
|
+
pendingValueRef.current = "";
|
|
276
|
+
setLocalValue("");
|
|
277
|
+
emit({ value: "" });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
) : /* @__PURE__ */ jsx(
|
|
281
|
+
Typeahead,
|
|
282
|
+
{
|
|
283
|
+
options,
|
|
284
|
+
mode: single ? "single" : "multi",
|
|
285
|
+
selectedValue: single ? value != null ? value : null : Array.isArray(value) ? value : [],
|
|
286
|
+
onChange: (v) => emit({ value: v }),
|
|
287
|
+
minWidth,
|
|
288
|
+
popoverWidth,
|
|
289
|
+
maxVisibleOptions,
|
|
290
|
+
allowCustomValue,
|
|
291
|
+
popoverAnchorRef: filterFieldRef,
|
|
292
|
+
placeholder,
|
|
293
|
+
variant: "embedded",
|
|
294
|
+
inputProps: {
|
|
295
|
+
id: valueInputId,
|
|
296
|
+
"aria-labelledby": labelledBy,
|
|
297
|
+
"aria-describedby": describedBy,
|
|
298
|
+
inputSize: size,
|
|
299
|
+
fieldClassName: styles.embeddedInputField,
|
|
300
|
+
inputClassName: styles.embeddedInputElement
|
|
301
|
+
},
|
|
302
|
+
onClear: () => emit({ value: single ? "" : [] }),
|
|
303
|
+
disabled,
|
|
304
|
+
fullWidth: !shouldAutoFitTypeahead,
|
|
305
|
+
fitContent: shouldAutoFitTypeahead
|
|
306
|
+
}
|
|
307
|
+
)
|
|
272
308
|
}
|
|
273
309
|
)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
)
|
|
277
313
|
}
|
|
278
314
|
);
|
|
279
315
|
}
|