@wallarm-org/design-system 0.12.0 → 0.13.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.
- package/dist/components/Calendar/Calendar.d.ts +2 -0
- package/dist/components/Calendar/Calendar.js +2 -1
- package/dist/components/{QueryBar/QueryBar.d.ts → FilterInput/FilterInput.d.ts} +3 -3
- package/dist/components/FilterInput/FilterInput.js +68 -0
- package/dist/components/FilterInput/FilterInputContext/FilterInputContext.d.ts +2 -0
- package/dist/components/FilterInput/FilterInputContext/FilterInputContext.js +3 -0
- package/dist/components/FilterInput/FilterInputContext/FilterInputProvider.d.ts +8 -0
- package/dist/components/FilterInput/FilterInputContext/FilterInputProvider.js +8 -0
- package/dist/components/FilterInput/FilterInputContext/index.d.ts +4 -0
- package/dist/components/FilterInput/FilterInputContext/index.js +4 -0
- package/dist/components/{QueryBar/QueryBarContext → FilterInput/FilterInputContext}/types.d.ts +6 -4
- package/dist/components/FilterInput/FilterInputContext/useFilterInputContext.d.ts +2 -0
- package/dist/components/FilterInput/FilterInputContext/useFilterInputContext.js +8 -0
- package/dist/components/{QueryBar/QueryBarContext/useQueryBarContextValue.d.ts → FilterInput/FilterInputContext/useFilterInputContextValue.d.ts} +7 -6
- package/dist/components/{QueryBar/QueryBarContext/useQueryBarContextValue.js → FilterInput/FilterInputContext/useFilterInputContextValue.js} +5 -3
- package/dist/components/FilterInput/FilterInputErrors/FilterInputErrors.d.ts +5 -0
- package/dist/components/FilterInput/FilterInputErrors/FilterInputErrors.js +34 -0
- package/dist/components/FilterInput/FilterInputErrors/index.d.ts +2 -0
- package/dist/components/FilterInput/FilterInputErrors/index.js +3 -0
- package/dist/components/FilterInput/FilterInputErrors/parseFilterInputErrors.d.ts +6 -0
- package/dist/components/FilterInput/FilterInputErrors/parseFilterInputErrors.js +34 -0
- package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/ChipsWithGaps.d.ts +4 -4
- package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/ChipsWithGaps.js +9 -5
- package/dist/components/{QueryBar/QueryBarInput/QueryBarChip → FilterInput/FilterInputField/FilterInputChip}/EditingContext.d.ts +1 -1
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/FilterInputChip.d.ts +17 -0
- package/dist/components/{QueryBar/QueryBarInput/QueryBarChip/QueryBarChip.js → FilterInput/FilterInputField/FilterInputChip/FilterInputChip.js} +16 -10
- package/dist/components/{QueryBar/QueryBarInput/QueryBarChip/QueryBarRemoveButton.d.ts → FilterInput/FilterInputField/FilterInputChip/FilterInputRemoveButton.d.ts} +1 -1
- package/dist/components/{QueryBar/QueryBarInput/QueryBarChip/QueryBarRemoveButton.js → FilterInput/FilterInputField/FilterInputChip/FilterInputRemoveButton.js} +4 -4
- package/dist/components/{QueryBar/QueryBarInput/QueryBarChip → FilterInput/FilterInputField/FilterInputChip}/Segment.d.ts +1 -0
- package/dist/components/{QueryBar/QueryBarInput/QueryBarChip → FilterInput/FilterInputField/FilterInputChip}/Segment.js +11 -7
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/ValueSegment.d.ts +18 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/ValueSegment.js +47 -0
- package/dist/components/{QueryBar/QueryBarInput/QueryBarChip → FilterInput/FilterInputField/FilterInputChip}/classes.d.ts +2 -1
- package/dist/components/{QueryBar/QueryBarInput/QueryBarChip → FilterInput/FilterInputField/FilterInputChip}/classes.js +27 -3
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/index.d.ts +5 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/index.js +6 -0
- package/dist/components/{QueryBar/QueryBarInput/QueryBarConnectorChip/QueryBarConnectorChip.d.ts → FilterInput/FilterInputField/FilterInputConnectorChip/FilterInputConnectorChip.d.ts} +3 -3
- package/dist/components/{QueryBar/QueryBarInput/QueryBarConnectorChip/QueryBarConnectorChip.js → FilterInput/FilterInputField/FilterInputConnectorChip/FilterInputConnectorChip.js} +29 -9
- package/dist/components/FilterInput/FilterInputField/FilterInputConnectorChip/index.d.ts +1 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputConnectorChip/index.js +2 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputField.d.ts +4 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputField.js +152 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputFieldActions.d.ts +7 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputFieldActions.js +62 -0
- package/dist/components/FilterInput/FilterInputField/FilterInputSearch.d.ts +7 -0
- package/dist/components/{QueryBar/QueryBarInput/QueryBarFilterInput.js → FilterInput/FilterInputField/FilterInputSearch.js} +9 -8
- package/dist/components/FilterInput/FilterInputField/classes.d.ts +19 -0
- package/dist/components/FilterInput/FilterInputField/classes.js +54 -0
- package/dist/components/FilterInput/FilterInputField/hooks/useChipsSplitting.d.ts +11 -0
- package/dist/components/FilterInput/FilterInputField/hooks/useChipsSplitting.js +28 -0
- package/dist/components/FilterInput/FilterInputField/hooks/useExpandCollapse.d.ts +14 -0
- package/dist/components/FilterInput/FilterInputField/hooks/useExpandCollapse.js +35 -0
- package/dist/components/FilterInput/FilterInputField/index.d.ts +2 -0
- package/dist/components/FilterInput/FilterInputField/index.js +3 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/ApplyButton.d.ts +7 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/ApplyButton.js +15 -0
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarDateValueMenu/QueryBarDateValueMenu.d.ts → FilterInput/FilterInputMenu/FilterInputDateValueMenu/FilterInputDateValueMenu.d.ts} +6 -8
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/FilterInputDateValueMenu.js +95 -0
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarDateValueMenu → FilterInput/FilterInputMenu/FilterInputDateValueMenu}/constants.d.ts +5 -2
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarDateValueMenu → FilterInput/FilterInputMenu/FilterInputDateValueMenu}/constants.js +16 -5
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/index.d.ts +3 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/index.js +3 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/utils.d.ts +5 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/utils.js +21 -0
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarFieldMenu/QueryBarFieldMenu.d.ts → FilterInput/FilterInputMenu/FilterInputFieldMenu/FilterInputFieldMenu.d.ts} +2 -2
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarFieldMenu/QueryBarFieldMenu.js → FilterInput/FilterInputMenu/FilterInputFieldMenu/FilterInputFieldMenu.js} +5 -5
- package/dist/components/FilterInput/FilterInputMenu/FilterInputFieldMenu/index.d.ts +1 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputFieldMenu/index.js +2 -0
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarMenu.d.ts → FilterInput/FilterInputMenu/FilterInputMenu.d.ts} +9 -6
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarMenu.js → FilterInput/FilterInputMenu/FilterInputMenu.js} +27 -27
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarOperatorMenu.d.ts → FilterInput/FilterInputMenu/FilterInputOperatorMenu.d.ts} +9 -3
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarOperatorMenu.js → FilterInput/FilterInputMenu/FilterInputOperatorMenu.js} +34 -12
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarValueMenu/QueryBarValueMenu.d.ts → FilterInput/FilterInputMenu/FilterInputValueMenu/FilterInputValueMenu.d.ts} +4 -2
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarValueMenu/QueryBarValueMenu.js → FilterInput/FilterInputMenu/FilterInputValueMenu/FilterInputValueMenu.js} +5 -4
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarValueMenu → FilterInput/FilterInputMenu/FilterInputValueMenu}/ValueMenuItem.d.ts +1 -1
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/index.d.ts +1 -0
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/index.js +2 -0
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarValueMenu → FilterInput/FilterInputMenu/FilterInputValueMenu}/useValueMenuState.d.ts +7 -5
- package/dist/components/{QueryBar/QueryBarMenu/QueryBarValueMenu → FilterInput/FilterInputMenu/FilterInputValueMenu}/useValueMenuState.js +31 -8
- package/dist/components/{QueryBar/QueryBarMenu → FilterInput/FilterInputMenu/hooks}/useKeyboardNav.d.ts +3 -3
- package/dist/components/{QueryBar/QueryBarMenu → FilterInput/FilterInputMenu/hooks}/useKeyboardNav.js +3 -1
- package/dist/components/FilterInput/FilterInputMenu/index.d.ts +5 -0
- package/dist/components/FilterInput/FilterInputMenu/index.js +6 -0
- package/dist/components/FilterInput/hooks/index.d.ts +2 -0
- package/dist/components/FilterInput/hooks/index.js +3 -0
- package/dist/components/{QueryBar/hooks/useQueryBarAutocomplete → FilterInput/hooks/useFilterInputAutocomplete}/deriveAutocompleteValues.d.ts +3 -2
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/deriveAutocompleteValues.js +49 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/index.d.ts +1 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/index.js +2 -0
- package/dist/components/{QueryBar/hooks/useQueryBarAutocomplete → FilterInput/hooks/useFilterInputAutocomplete}/useChipEditing.d.ts +5 -4
- package/dist/components/{QueryBar/hooks/useQueryBarAutocomplete → FilterInput/hooks/useFilterInputAutocomplete}/useChipEditing.js +25 -8
- package/dist/components/{QueryBar/hooks/useQueryBarAutocomplete/useQueryBarAutocomplete.d.ts → FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.d.ts} +19 -16
- package/dist/components/{QueryBar/hooks/useQueryBarAutocomplete/useQueryBarAutocomplete.js → FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js} +70 -115
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFocusManagement.d.ts +22 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFocusManagement.js +67 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useInputHandlers.d.ts +27 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useInputHandlers.js +104 -0
- package/dist/components/{QueryBar/hooks/useQueryBarAutocomplete → FilterInput/hooks/useFilterInputAutocomplete}/useMenuFlow.d.ts +3 -3
- package/dist/components/{QueryBar/hooks/useQueryBarAutocomplete → FilterInput/hooks/useFilterInputAutocomplete}/useMenuFlow.js +30 -83
- package/dist/components/{QueryBar/hooks/useQueryBarAutocomplete → FilterInput/hooks/useFilterInputAutocomplete}/useMenuPositioning.d.ts +2 -3
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuPositioning.js +36 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/valueCommitHelpers.d.ts +34 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/valueCommitHelpers.js +81 -0
- package/dist/components/{QueryBar/hooks/useQueryBarExpression → FilterInput/hooks/useFilterInputExpression}/buildChips.d.ts +2 -2
- package/dist/components/{QueryBar/hooks/useQueryBarExpression → FilterInput/hooks/useFilterInputExpression}/buildChips.js +54 -23
- package/dist/components/FilterInput/hooks/useFilterInputExpression/index.d.ts +1 -0
- package/dist/components/FilterInput/hooks/useFilterInputExpression/index.js +2 -0
- package/dist/components/{QueryBar/hooks/useQueryBarExpression/useQueryBarExpression.d.ts → FilterInput/hooks/useFilterInputExpression/useFilterInputExpression.d.ts} +5 -5
- package/dist/components/{QueryBar/hooks/useQueryBarExpression/useQueryBarExpression.js → FilterInput/hooks/useFilterInputExpression/useFilterInputExpression.js} +15 -15
- package/dist/components/FilterInput/hooks/useFilterInputPositioning.d.ts +29 -0
- package/dist/components/FilterInput/hooks/useFilterInputPositioning.js +19 -0
- package/dist/components/FilterInput/index.d.ts +4 -0
- package/dist/components/FilterInput/index.js +4 -0
- package/dist/components/{QueryBar → FilterInput}/lib/conditions.d.ts +2 -2
- package/dist/components/{QueryBar → FilterInput}/lib/constants.d.ts +10 -2
- package/dist/components/{QueryBar → FilterInput}/lib/constants.js +29 -7
- package/dist/components/FilterInput/lib/dom.d.ts +17 -0
- package/dist/components/FilterInput/lib/dom.js +12 -0
- package/dist/components/FilterInput/lib/fields.d.ts +12 -0
- package/dist/components/FilterInput/lib/fields.js +10 -0
- package/dist/components/FilterInput/lib/index.d.ts +8 -0
- package/dist/components/FilterInput/lib/index.js +8 -0
- package/dist/components/{QueryBar → FilterInput}/types.d.ts +26 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/metadata/components.json +2987 -2954
- package/package.json +1 -1
- package/dist/components/QueryBar/QueryBar.js +0 -60
- package/dist/components/QueryBar/QueryBarContext/QueryBarContext.d.ts +0 -2
- package/dist/components/QueryBar/QueryBarContext/QueryBarContext.js +0 -3
- package/dist/components/QueryBar/QueryBarContext/QueryBarProvider.d.ts +0 -8
- package/dist/components/QueryBar/QueryBarContext/QueryBarProvider.js +0 -8
- package/dist/components/QueryBar/QueryBarContext/index.d.ts +0 -4
- package/dist/components/QueryBar/QueryBarContext/index.js +0 -4
- package/dist/components/QueryBar/QueryBarContext/useQueryBarContext.d.ts +0 -2
- package/dist/components/QueryBar/QueryBarContext/useQueryBarContext.js +0 -8
- package/dist/components/QueryBar/QueryBarInput/QueryBarChip/QueryBarChip.d.ts +0 -13
- package/dist/components/QueryBar/QueryBarInput/QueryBarChip/index.d.ts +0 -5
- package/dist/components/QueryBar/QueryBarInput/QueryBarChip/index.js +0 -6
- package/dist/components/QueryBar/QueryBarInput/QueryBarConnectorChip/index.d.ts +0 -1
- package/dist/components/QueryBar/QueryBarInput/QueryBarConnectorChip/index.js +0 -2
- package/dist/components/QueryBar/QueryBarInput/QueryBarFilterInput.d.ts +0 -6
- package/dist/components/QueryBar/QueryBarInput/QueryBarInput.d.ts +0 -4
- package/dist/components/QueryBar/QueryBarInput/QueryBarInput.js +0 -133
- package/dist/components/QueryBar/QueryBarInput/QueryBarInputActions.d.ts +0 -2
- package/dist/components/QueryBar/QueryBarInput/QueryBarInputActions.js +0 -37
- package/dist/components/QueryBar/QueryBarInput/classes.d.ts +0 -12
- package/dist/components/QueryBar/QueryBarInput/classes.js +0 -35
- package/dist/components/QueryBar/QueryBarInput/index.d.ts +0 -2
- package/dist/components/QueryBar/QueryBarInput/index.js +0 -3
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/CalendarNav.d.ts +0 -2
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/CalendarNav.js +0 -22
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/DateCalendar.d.ts +0 -14
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/DateCalendar.js +0 -100
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/DatePresets.d.ts +0 -8
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/DatePresets.js +0 -66
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/DayView.d.ts +0 -2
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/DayView.js +0 -42
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/MonthView.d.ts +0 -2
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/MonthView.js +0 -34
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/QueryBarDateValueMenu.js +0 -107
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/YearView.d.ts +0 -2
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/YearView.js +0 -33
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/index.d.ts +0 -4
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/index.js +0 -4
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/styles.d.ts +0 -4
- package/dist/components/QueryBar/QueryBarMenu/QueryBarDateValueMenu/styles.js +0 -4
- package/dist/components/QueryBar/QueryBarMenu/QueryBarFieldMenu/index.d.ts +0 -1
- package/dist/components/QueryBar/QueryBarMenu/QueryBarFieldMenu/index.js +0 -2
- package/dist/components/QueryBar/QueryBarMenu/QueryBarValueMenu/index.d.ts +0 -1
- package/dist/components/QueryBar/QueryBarMenu/QueryBarValueMenu/index.js +0 -2
- package/dist/components/QueryBar/QueryBarMenu/index.d.ts +0 -5
- package/dist/components/QueryBar/QueryBarMenu/index.js +0 -6
- package/dist/components/QueryBar/hooks/index.d.ts +0 -3
- package/dist/components/QueryBar/hooks/index.js +0 -4
- package/dist/components/QueryBar/hooks/useQueryBarAutocomplete/deriveAutocompleteValues.js +0 -50
- package/dist/components/QueryBar/hooks/useQueryBarAutocomplete/index.d.ts +0 -1
- package/dist/components/QueryBar/hooks/useQueryBarAutocomplete/index.js +0 -2
- package/dist/components/QueryBar/hooks/useQueryBarAutocomplete/useMenuPositioning.js +0 -49
- package/dist/components/QueryBar/hooks/useQueryBarExpression/index.d.ts +0 -1
- package/dist/components/QueryBar/hooks/useQueryBarExpression/index.js +0 -2
- package/dist/components/QueryBar/index.d.ts +0 -4
- package/dist/components/QueryBar/index.js +0 -4
- package/dist/components/QueryBar/lib/dom.d.ts +0 -2
- package/dist/components/QueryBar/lib/dom.js +0 -2
- package/dist/components/QueryBar/lib/index.d.ts +0 -7
- package/dist/components/QueryBar/lib/index.js +0 -7
- /package/dist/components/{QueryBar/QueryBarContext → FilterInput/FilterInputContext}/types.js +0 -0
- /package/dist/components/{QueryBar/QueryBarInput/QueryBarChip → FilterInput/FilterInputField/FilterInputChip}/EditingContext.js +0 -0
- /package/dist/components/{QueryBar/QueryBarInput/QueryBarChip → FilterInput/FilterInputField/FilterInputChip}/OperatorSegment.d.ts +0 -0
- /package/dist/components/{QueryBar/QueryBarInput/QueryBarChip → FilterInput/FilterInputField/FilterInputChip}/OperatorSegment.js +0 -0
- /package/dist/components/{QueryBar/QueryBarInput/QueryBarConnectorChip → FilterInput/FilterInputField/FilterInputConnectorChip}/classes.d.ts +0 -0
- /package/dist/components/{QueryBar/QueryBarInput/QueryBarConnectorChip → FilterInput/FilterInputField/FilterInputConnectorChip}/classes.js +0 -0
- /package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/InsertionGap/InsertionGap.d.ts +0 -0
- /package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/InsertionGap/InsertionGap.js +0 -0
- /package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/InsertionGap/classes.d.ts +0 -0
- /package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/InsertionGap/classes.js +0 -0
- /package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/InsertionGap/index.d.ts +0 -0
- /package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/InsertionGap/index.js +0 -0
- /package/dist/components/{QueryBar/QueryBarMenu/QueryBarDateValueMenu → FilterInput/FilterInputMenu/FilterInputDateValueMenu}/hooks.d.ts +0 -0
- /package/dist/components/{QueryBar/QueryBarMenu/QueryBarDateValueMenu → FilterInput/FilterInputMenu/FilterInputDateValueMenu}/hooks.js +0 -0
- /package/dist/components/{QueryBar/QueryBarMenu/QueryBarFieldMenu → FilterInput/FilterInputMenu/FilterInputFieldMenu}/FieldMenuSections.d.ts +0 -0
- /package/dist/components/{QueryBar/QueryBarMenu/QueryBarFieldMenu → FilterInput/FilterInputMenu/FilterInputFieldMenu}/FieldMenuSections.js +0 -0
- /package/dist/components/{QueryBar/QueryBarMenu/QueryBarValueMenu → FilterInput/FilterInputMenu/FilterInputValueMenu}/ValueMenuItem.js +0 -0
- /package/dist/components/{QueryBar/QueryBarMenu → FilterInput/FilterInputMenu}/MenuEmptyState.d.ts +0 -0
- /package/dist/components/{QueryBar/QueryBarMenu → FilterInput/FilterInputMenu}/MenuEmptyState.js +0 -0
- /package/dist/components/{QueryBar/hooks/useQueryBarExpression → FilterInput/hooks/useFilterInputExpression}/expression.d.ts +0 -0
- /package/dist/components/{QueryBar/hooks/useQueryBarExpression → FilterInput/hooks/useFilterInputExpression}/expression.js +0 -0
- /package/dist/components/{QueryBar → FilterInput}/lib/conditions.js +0 -0
- /package/dist/components/{QueryBar → FilterInput}/lib/filterSort.d.ts +0 -0
- /package/dist/components/{QueryBar → FilterInput}/lib/filterSort.js +0 -0
- /package/dist/components/{QueryBar → FilterInput}/lib/operators.d.ts +0 -0
- /package/dist/components/{QueryBar → FilterInput}/lib/operators.js +0 -0
- /package/dist/components/{QueryBar → FilterInput}/types.js +0 -0
|
@@ -1,41 +1,72 @@
|
|
|
1
1
|
import { getDateDisplayLabel, getOperatorLabel } from "../../lib/index.js";
|
|
2
|
+
import { getInvalidValueIndices } from "../useFilterInputAutocomplete/valueCommitHelpers.js";
|
|
2
3
|
const makeConditionChip = (i, conditions, fields, error)=>{
|
|
3
4
|
const condition = conditions[i];
|
|
4
|
-
const chipError = condition?.error || error;
|
|
5
|
+
const chipError = condition?.error || (error ? true : void 0);
|
|
5
6
|
if (!condition) return {
|
|
6
7
|
id: `chip-${i}`,
|
|
7
8
|
variant: 'chip',
|
|
8
9
|
attribute: '',
|
|
9
10
|
operator: '',
|
|
10
11
|
value: '',
|
|
11
|
-
error
|
|
12
|
+
error: error || void 0
|
|
12
13
|
};
|
|
13
14
|
const field = fields.find((f)=>f.name === condition.field);
|
|
14
|
-
|
|
15
|
-
let hasInvalidDate = false;
|
|
16
|
-
if (field?.type === 'date') if (Array.isArray(condition.value)) {
|
|
17
|
-
const parts = condition.value.map((v)=>getDateDisplayLabel(String(v)));
|
|
18
|
-
hasInvalidDate = parts.some((p)=>'Invalid Date' === p);
|
|
19
|
-
displayValue = parts.join(' – ');
|
|
20
|
-
} else {
|
|
21
|
-
displayValue = getDateDisplayLabel(String(condition.value ?? ''));
|
|
22
|
-
hasInvalidDate = 'Invalid Date' === displayValue;
|
|
23
|
-
}
|
|
24
|
-
else if (Array.isArray(condition.value)) displayValue = condition.value.map((v)=>field?.values?.find((opt)=>opt.value === v)?.label ?? String(v)).join(', ');
|
|
25
|
-
else {
|
|
26
|
-
displayValue = String(condition.value ?? '');
|
|
27
|
-
if (field?.values) {
|
|
28
|
-
const opt = field.values.find((o)=>o.value === condition.value);
|
|
29
|
-
if (opt) displayValue = opt.label;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
15
|
+
const baseChip = {
|
|
33
16
|
id: `chip-${i}`,
|
|
34
17
|
variant: 'chip',
|
|
35
18
|
attribute: field?.label || condition.field,
|
|
36
|
-
operator: getOperatorLabel(condition.operator, field?.type || 'string')
|
|
19
|
+
operator: getOperatorLabel(condition.operator, field?.type || 'string')
|
|
20
|
+
};
|
|
21
|
+
if (field?.type === 'date') {
|
|
22
|
+
if (Array.isArray(condition.value)) {
|
|
23
|
+
const parts = condition.value.map((v)=>getDateDisplayLabel(String(v)));
|
|
24
|
+
const invalidIndices = parts.reduce((acc, p, idx)=>{
|
|
25
|
+
if ('Invalid Date' === p) acc.push(idx);
|
|
26
|
+
return acc;
|
|
27
|
+
}, []);
|
|
28
|
+
return {
|
|
29
|
+
...baseChip,
|
|
30
|
+
value: parts.join(' – '),
|
|
31
|
+
error: chipError || (invalidIndices.length > 0 ? 'value' : void 0),
|
|
32
|
+
...invalidIndices.length > 0 && {
|
|
33
|
+
valueParts: parts,
|
|
34
|
+
valueSeparator: ' – ',
|
|
35
|
+
errorValueIndices: invalidIndices
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const displayValue = getDateDisplayLabel(String(condition.value ?? ''));
|
|
40
|
+
return {
|
|
41
|
+
...baseChip,
|
|
42
|
+
value: displayValue,
|
|
43
|
+
error: chipError || ('Invalid Date' === displayValue ? 'value' : void 0)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(condition.value)) {
|
|
47
|
+
const valueParts = condition.value.map((v)=>field?.values?.find((opt)=>opt.value === v)?.label ?? String(v));
|
|
48
|
+
const invalidIndices = field ? getInvalidValueIndices(field, condition.value) : [];
|
|
49
|
+
return {
|
|
50
|
+
...baseChip,
|
|
51
|
+
value: valueParts.join(', '),
|
|
52
|
+
error: chipError || (invalidIndices.length > 0 ? 'value' : void 0),
|
|
53
|
+
...valueParts.length > 1 && {
|
|
54
|
+
valueParts
|
|
55
|
+
},
|
|
56
|
+
...invalidIndices.length > 0 && {
|
|
57
|
+
errorValueIndices: invalidIndices
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
let displayValue = String(condition.value ?? '');
|
|
62
|
+
if (field?.values) {
|
|
63
|
+
const opt = field.values.find((o)=>o.value === condition.value);
|
|
64
|
+
if (opt) displayValue = opt.label;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
...baseChip,
|
|
37
68
|
value: displayValue,
|
|
38
|
-
error: chipError
|
|
69
|
+
error: chipError
|
|
39
70
|
};
|
|
40
71
|
};
|
|
41
72
|
const buildChips = (conditions, connectors, fields, error)=>{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFilterInputExpression } from './useFilterInputExpression';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Condition, ExprNode, FieldMetadata, FilterOperator } from '../../types';
|
|
2
|
-
interface
|
|
1
|
+
import type { ChipErrorSegment, Condition, ExprNode, FieldMetadata, FilterOperator } from '../../types';
|
|
2
|
+
interface UseFilterInputExpressionOptions {
|
|
3
3
|
fields: FieldMetadata[];
|
|
4
4
|
value?: ExprNode | null;
|
|
5
5
|
onChange?: (expression: ExprNode | null) => void;
|
|
6
6
|
error: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const useFilterInputExpression: ({ fields, value, onChange, error, }: UseFilterInputExpressionOptions) => {
|
|
9
9
|
conditions: Condition[];
|
|
10
10
|
connectors: ("and" | "or")[];
|
|
11
|
-
chips: import("../..").
|
|
12
|
-
upsertCondition: (field: FieldMetadata, operator: FilterOperator, val: string | number | boolean | null | Array<string | number | boolean>, editingChipId?: string | null, atIndex?: number, error?:
|
|
11
|
+
chips: import("../..").FilterInputChipData[];
|
|
12
|
+
upsertCondition: (field: FieldMetadata, operator: FilterOperator, val: string | number | boolean | null | Array<string | number | boolean>, editingChipId?: string | null, atIndex?: number, error?: ChipErrorSegment, dateOrigin?: "relative" | "absolute") => void;
|
|
13
13
|
removeCondition: (chipId: string) => void;
|
|
14
14
|
removeConditionAtIndex: (idx: number) => void;
|
|
15
15
|
clearAll: () => void;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
-
import { chipIdToConditionIndex } from "../../lib/index.js";
|
|
2
|
+
import { CONNECTOR_ID_PATTERN, chipIdToConditionIndex } from "../../lib/index.js";
|
|
3
3
|
import { buildChips } from "./buildChips.js";
|
|
4
4
|
import { buildExpression, expressionToConditions } from "./expression.js";
|
|
5
5
|
const EMPTY_STATE = {
|
|
6
6
|
conditions: [],
|
|
7
7
|
connectors: []
|
|
8
8
|
};
|
|
9
|
-
const
|
|
9
|
+
const removeConnectorAtConditionIndex = (connectors, idx)=>{
|
|
10
|
+
const updated = [
|
|
11
|
+
...connectors
|
|
12
|
+
];
|
|
13
|
+
if (0 === idx && updated.length > 0) updated.splice(0, 1);
|
|
14
|
+
else if (idx > 0 && idx - 1 < updated.length) updated.splice(idx - 1, 1);
|
|
15
|
+
return updated;
|
|
16
|
+
};
|
|
17
|
+
const useFilterInputExpression = ({ fields, value, onChange, error })=>{
|
|
10
18
|
const [state, setState] = useState(EMPTY_STATE);
|
|
11
19
|
useEffect(()=>{
|
|
12
20
|
if (void 0 !== value) {
|
|
@@ -72,7 +80,7 @@ const useQueryBarExpression = ({ fields, value, onChange, error })=>{
|
|
|
72
80
|
const missing = newConditions.length - 1 - prev.connectors.length;
|
|
73
81
|
newConnectors = missing > 0 ? [
|
|
74
82
|
...prev.connectors,
|
|
75
|
-
...Array(missing).fill('and')
|
|
83
|
+
...new Array(missing).fill('and')
|
|
76
84
|
] : prev.connectors;
|
|
77
85
|
}
|
|
78
86
|
const next = {
|
|
@@ -90,11 +98,7 @@ const useQueryBarExpression = ({ fields, value, onChange, error })=>{
|
|
|
90
98
|
if (null === idx) return;
|
|
91
99
|
setState((prev)=>{
|
|
92
100
|
const newConditions = prev.conditions.filter((_, i)=>i !== idx);
|
|
93
|
-
const newConnectors =
|
|
94
|
-
...prev.connectors
|
|
95
|
-
];
|
|
96
|
-
if (0 === idx && newConnectors.length > 0) newConnectors.splice(0, 1);
|
|
97
|
-
else if (idx > 0 && idx - 1 < newConnectors.length) newConnectors.splice(idx - 1, 1);
|
|
101
|
+
const newConnectors = removeConnectorAtConditionIndex(prev.connectors, idx);
|
|
98
102
|
const next = {
|
|
99
103
|
conditions: newConditions,
|
|
100
104
|
connectors: newConnectors
|
|
@@ -109,11 +113,7 @@ const useQueryBarExpression = ({ fields, value, onChange, error })=>{
|
|
|
109
113
|
setState((prev)=>{
|
|
110
114
|
if (idx < 0 || idx >= prev.conditions.length) return prev;
|
|
111
115
|
const newConditions = prev.conditions.filter((_, i)=>i !== idx);
|
|
112
|
-
const newConnectors =
|
|
113
|
-
...prev.connectors
|
|
114
|
-
];
|
|
115
|
-
if (0 === idx && newConnectors.length > 0) newConnectors.splice(0, 1);
|
|
116
|
-
else if (idx > 0 && idx - 1 < newConnectors.length) newConnectors.splice(idx - 1, 1);
|
|
116
|
+
const newConnectors = removeConnectorAtConditionIndex(prev.connectors, idx);
|
|
117
117
|
const next = {
|
|
118
118
|
conditions: newConditions,
|
|
119
119
|
connectors: newConnectors
|
|
@@ -131,7 +131,7 @@ const useQueryBarExpression = ({ fields, value, onChange, error })=>{
|
|
|
131
131
|
onChange
|
|
132
132
|
]);
|
|
133
133
|
const setConnectorValue = useCallback((connectorId, value)=>{
|
|
134
|
-
const match = connectorId.match(
|
|
134
|
+
const match = connectorId.match(CONNECTOR_ID_PATTERN);
|
|
135
135
|
if (!match) return;
|
|
136
136
|
const condIdx = Number(match[1]);
|
|
137
137
|
const connectorIdx = condIdx - 1;
|
|
@@ -161,4 +161,4 @@ const useQueryBarExpression = ({ fields, value, onChange, error })=>{
|
|
|
161
161
|
setConnectorValue
|
|
162
162
|
};
|
|
163
163
|
};
|
|
164
|
-
export {
|
|
164
|
+
export { useFilterInputExpression };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
interface UseFilterInputPositioningProps {
|
|
3
|
+
/** Ref to the trigger element (used for X anchor and container lookup via closest) */
|
|
4
|
+
anchorRef?: RefObject<HTMLElement | null>;
|
|
5
|
+
/** Explicit container ref (skips closest lookup) */
|
|
6
|
+
containerRef?: RefObject<HTMLElement | null>;
|
|
7
|
+
/** Override horizontal anchor calculation (receives containerRect, returns left px) */
|
|
8
|
+
getAnchorLeft?: (containerRect: DOMRect) => number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Shared positioning hook for all FilterInput dropdowns.
|
|
12
|
+
* Anchors vertically to the query bar container and horizontally to the trigger element.
|
|
13
|
+
* @param deps - extra values that force positioning recalculation (e.g. insertIndex)
|
|
14
|
+
*/
|
|
15
|
+
export declare const useFilterInputPositioning: ({ anchorRef, containerRef, getAnchorLeft }: UseFilterInputPositioningProps, deps?: unknown[]) => {
|
|
16
|
+
placement: "bottom-start";
|
|
17
|
+
gutter: number;
|
|
18
|
+
getAnchorRect: () => {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
top: number;
|
|
24
|
+
bottom: number;
|
|
25
|
+
left: number;
|
|
26
|
+
right: number;
|
|
27
|
+
} | null;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { QUERY_BAR_SELECTOR, buildContainerAnchoredRect } from "../lib/index.js";
|
|
3
|
+
const useFilterInputPositioning = ({ anchorRef, containerRef, getAnchorLeft }, deps = [])=>useMemo(()=>({
|
|
4
|
+
placement: 'bottom-start',
|
|
5
|
+
gutter: 4,
|
|
6
|
+
getAnchorRect: ()=>{
|
|
7
|
+
const containerEl = containerRef?.current ?? anchorRef?.current?.closest(QUERY_BAR_SELECTOR);
|
|
8
|
+
const containerRect = containerEl?.getBoundingClientRect();
|
|
9
|
+
if (!containerRect) return null;
|
|
10
|
+
const left = getAnchorLeft ? getAnchorLeft(containerRect) : anchorRef?.current?.getBoundingClientRect().left ?? containerRect.left;
|
|
11
|
+
return buildContainerAnchoredRect(containerRect, left);
|
|
12
|
+
}
|
|
13
|
+
}), [
|
|
14
|
+
anchorRef,
|
|
15
|
+
containerRef,
|
|
16
|
+
getAnchorLeft,
|
|
17
|
+
...deps
|
|
18
|
+
]);
|
|
19
|
+
export { useFilterInputPositioning };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { FilterInput, type FilterInputProps } from './FilterInput';
|
|
2
|
+
export { FilterInputChip, type FilterInputChipProps } from './FilterInputField';
|
|
3
|
+
export { FilterInputFieldMenu, type FilterInputFieldMenuProps, FilterInputOperatorMenu, type FilterInputOperatorMenuProps, FilterInputValueMenu, type FilterInputValueMenuProps, type ValueOption, } from './FilterInputMenu';
|
|
4
|
+
export type { Condition, ExprNode, FieldMetadata, FieldType, FieldValueOption, FilterInputChipData, FilterInputChipVariant, FilterOperator, Group, } from './types';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FilterInput } from "./FilterInput.js";
|
|
2
|
+
import { FilterInputChip } from "./FilterInputField/index.js";
|
|
3
|
+
import { FilterInputFieldMenu, FilterInputOperatorMenu, FilterInputValueMenu } from "./FilterInputMenu/index.js";
|
|
4
|
+
export { FilterInput, FilterInputChip, FilterInputFieldMenu, FilterInputOperatorMenu, FilterInputValueMenu };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FilterInputChipData } from '../types';
|
|
2
2
|
/** Map a chip ID (e.g. "chip-2") back to condition index */
|
|
3
3
|
export declare const chipIdToConditionIndex: (chipId: string) => number | null;
|
|
4
4
|
/**
|
|
@@ -6,4 +6,4 @@ export declare const chipIdToConditionIndex: (chipId: string) => number | null;
|
|
|
6
6
|
* When `afterConnector` is true, split AFTER the connector preceding the target chip.
|
|
7
7
|
* When false, split BEFORE the connector.
|
|
8
8
|
*/
|
|
9
|
-
export declare const findChipSplitIndex: (chips:
|
|
9
|
+
export declare const findChipSplitIndex: (chips: FilterInputChipData[], conditionInsertIndex: number, afterConnector?: boolean) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldType,
|
|
1
|
+
import type { FieldType, FilterInputChipVariant, FilterOperator } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Operators that require no value (unary)
|
|
4
4
|
*/
|
|
@@ -11,10 +11,18 @@ export declare const MULTI_SELECT_OPERATORS: readonly FilterOperator[];
|
|
|
11
11
|
* Pattern to extract condition index from chip ID (e.g. "chip-2" → 2)
|
|
12
12
|
*/
|
|
13
13
|
export declare const CHIP_ID_PATTERN: RegExp;
|
|
14
|
+
/**
|
|
15
|
+
* Pattern to extract condition index from connector ID (e.g. "connector-2" → 2)
|
|
16
|
+
*/
|
|
17
|
+
export declare const CONNECTOR_ID_PATTERN: RegExp;
|
|
18
|
+
/**
|
|
19
|
+
* DOM selector for the FilterInput root element
|
|
20
|
+
*/
|
|
21
|
+
export declare const QUERY_BAR_SELECTOR = "[data-slot=\"filter-input\"]";
|
|
14
22
|
/**
|
|
15
23
|
* Labels for non-chip filter chip variants (connectors, brackets)
|
|
16
24
|
*/
|
|
17
|
-
export declare const VARIANT_LABELS: Partial<Record<
|
|
25
|
+
export declare const VARIANT_LABELS: Partial<Record<FilterInputChipVariant, string>>;
|
|
18
26
|
/**
|
|
19
27
|
* Operator Symbol Mapping
|
|
20
28
|
* Maps operators to their raw symbol displayed on the right side of menus
|
|
@@ -7,6 +7,8 @@ const MULTI_SELECT_OPERATORS = [
|
|
|
7
7
|
'not_in'
|
|
8
8
|
];
|
|
9
9
|
const CHIP_ID_PATTERN = /^chip-(\d+)$/;
|
|
10
|
+
const CONNECTOR_ID_PATTERN = /^connector-(\d+)$/;
|
|
11
|
+
const QUERY_BAR_SELECTOR = '[data-slot="filter-input"]';
|
|
10
12
|
const VARIANT_LABELS = {
|
|
11
13
|
and: 'AND',
|
|
12
14
|
or: 'OR',
|
|
@@ -45,19 +47,39 @@ const OPERATOR_LABELS = {
|
|
|
45
47
|
};
|
|
46
48
|
const OPERATOR_LABELS_BY_TYPE = {
|
|
47
49
|
string: {
|
|
50
|
+
'=': 'is',
|
|
51
|
+
'!=': 'is not',
|
|
52
|
+
in: 'in',
|
|
53
|
+
like: 'like',
|
|
54
|
+
not_like: 'not like',
|
|
48
55
|
is_null: 'is set',
|
|
49
56
|
is_not_null: 'is not set'
|
|
50
57
|
},
|
|
51
|
-
integer: {
|
|
52
|
-
|
|
58
|
+
integer: {
|
|
59
|
+
'=': 'is',
|
|
60
|
+
'!=': 'is not',
|
|
61
|
+
'>': 'greater',
|
|
62
|
+
'<': 'less',
|
|
63
|
+
'>=': 'greater or equal',
|
|
64
|
+
'<=': 'less or equal',
|
|
65
|
+
in: 'in'
|
|
66
|
+
},
|
|
67
|
+
float: {
|
|
68
|
+
'=': 'is',
|
|
69
|
+
'!=': 'is not',
|
|
70
|
+
'>': 'greater',
|
|
71
|
+
'<': 'less',
|
|
72
|
+
'>=': 'greater or equal',
|
|
73
|
+
'<=': 'less or equal'
|
|
74
|
+
},
|
|
53
75
|
date: {
|
|
76
|
+
'=': 'is',
|
|
77
|
+
'!=': 'is not',
|
|
54
78
|
'>': 'after',
|
|
55
|
-
'>=': 'on or after',
|
|
56
79
|
'<': 'before',
|
|
80
|
+
'>=': 'on or after',
|
|
57
81
|
'<=': 'on or before',
|
|
58
|
-
|
|
59
|
-
'!=': 'not on',
|
|
60
|
-
between: 'between'
|
|
82
|
+
between: 'in between'
|
|
61
83
|
},
|
|
62
84
|
boolean: {
|
|
63
85
|
'=': 'is true',
|
|
@@ -141,4 +163,4 @@ const OPERATORS_BY_TYPE = {
|
|
|
141
163
|
]
|
|
142
164
|
]
|
|
143
165
|
};
|
|
144
|
-
export { CHIP_ID_PATTERN, MULTI_SELECT_OPERATORS, NO_VALUE_OPERATORS, OPERATORS_BY_TYPE, OPERATOR_LABELS, OPERATOR_LABELS_BY_TYPE, OPERATOR_SYMBOLS, VARIANT_LABELS };
|
|
166
|
+
export { CHIP_ID_PATTERN, CONNECTOR_ID_PATTERN, MULTI_SELECT_OPERATORS, NO_VALUE_OPERATORS, OPERATORS_BY_TYPE, OPERATOR_LABELS, OPERATOR_LABELS_BY_TYPE, OPERATOR_SYMBOLS, QUERY_BAR_SELECTOR, VARIANT_LABELS };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Check if an element belongs to a menu/portal overlay (dropdown, date-picker, etc.) */
|
|
2
|
+
export declare const isMenuRelated: (el: HTMLElement | null) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Build a DOMRect-compatible object anchored vertically to the container
|
|
5
|
+
* and horizontally to the given left position. Used by all FilterInput dropdowns
|
|
6
|
+
* so they share the same vertical gap from the container bottom edge.
|
|
7
|
+
*/
|
|
8
|
+
export declare const buildContainerAnchoredRect: (containerRect: DOMRect, anchorLeft: number, anchorRight?: number) => {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
top: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
left: number;
|
|
16
|
+
right: number;
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const isMenuRelated = (el)=>!!(el?.closest('[role="menu"]') || el?.closest('[data-scope="menu"]') || el?.closest('[data-scope="date-picker"]') || el?.closest('[data-part="content"]'));
|
|
2
|
+
const buildContainerAnchoredRect = (containerRect, anchorLeft, anchorRight = containerRect.right)=>({
|
|
3
|
+
x: anchorLeft,
|
|
4
|
+
y: containerRect.top,
|
|
5
|
+
width: anchorRight - anchorLeft,
|
|
6
|
+
height: containerRect.height,
|
|
7
|
+
top: containerRect.top,
|
|
8
|
+
bottom: containerRect.bottom,
|
|
9
|
+
left: anchorLeft,
|
|
10
|
+
right: anchorRight
|
|
11
|
+
});
|
|
12
|
+
export { buildContainerAnchoredRect, isMenuRelated };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldMetadata, FieldValueOption } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Get normalized value options for a field.
|
|
4
|
+
* `values` (full FieldValueOption[]) takes precedence over `options` (string[] shorthand).
|
|
5
|
+
* `options` strings are converted to `{ value: s, label: s }`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getFieldValues: (field: FieldMetadata) => FieldValueOption[];
|
|
8
|
+
/**
|
|
9
|
+
* Check if a field has predefined values (from `values` or `options`).
|
|
10
|
+
* Returns false for freeform fields (`options: []` or no values at all).
|
|
11
|
+
*/
|
|
12
|
+
export declare const hasFieldValues: (field: FieldMetadata) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const getFieldValues = (field)=>{
|
|
2
|
+
const fromValues = field.values ?? [];
|
|
3
|
+
const fromOptions = field.options?.map((s)=>({
|
|
4
|
+
value: s,
|
|
5
|
+
label: s
|
|
6
|
+
})) ?? [];
|
|
7
|
+
return fromValues.length > 0 ? fromValues : fromOptions;
|
|
8
|
+
};
|
|
9
|
+
const hasFieldValues = (field)=>getFieldValues(field).length > 0;
|
|
10
|
+
export { getFieldValues, hasFieldValues };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { DatePreset } from '../FilterInputMenu/FilterInputDateValueMenu/constants';
|
|
2
|
+
export { DATE_PRESETS, formatDateForChip, getDateDisplayLabel, isDatePreset, } from '../FilterInputMenu/FilterInputDateValueMenu/constants';
|
|
3
|
+
export { chipIdToConditionIndex, findChipSplitIndex } from './conditions';
|
|
4
|
+
export { CONNECTOR_ID_PATTERN, NO_VALUE_OPERATORS, OPERATOR_LABELS, OPERATOR_LABELS_BY_TYPE, OPERATOR_SYMBOLS, OPERATORS_BY_TYPE, QUERY_BAR_SELECTOR, VARIANT_LABELS, } from './constants';
|
|
5
|
+
export { buildContainerAnchoredRect, isMenuRelated } from './dom';
|
|
6
|
+
export { getFieldValues, hasFieldValues } from './fields';
|
|
7
|
+
export { filterAndSort } from './filterSort';
|
|
8
|
+
export { getOperatorFromLabel, getOperatorLabel, isBetweenOperator, isMultiSelectOperator, isNoValueOperator, } from './operators';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DATE_PRESETS, formatDateForChip, getDateDisplayLabel, isDatePreset } from "../FilterInputMenu/FilterInputDateValueMenu/constants.js";
|
|
2
|
+
import { chipIdToConditionIndex, findChipSplitIndex } from "./conditions.js";
|
|
3
|
+
import { CONNECTOR_ID_PATTERN, NO_VALUE_OPERATORS, OPERATORS_BY_TYPE, OPERATOR_LABELS, OPERATOR_LABELS_BY_TYPE, OPERATOR_SYMBOLS, QUERY_BAR_SELECTOR, VARIANT_LABELS } from "./constants.js";
|
|
4
|
+
import { buildContainerAnchoredRect, isMenuRelated } from "./dom.js";
|
|
5
|
+
import { getFieldValues, hasFieldValues } from "./fields.js";
|
|
6
|
+
import { filterAndSort } from "./filterSort.js";
|
|
7
|
+
import { getOperatorFromLabel, getOperatorLabel, isBetweenOperator, isMultiSelectOperator, isNoValueOperator } from "./operators.js";
|
|
8
|
+
export { CONNECTOR_ID_PATTERN, DATE_PRESETS, NO_VALUE_OPERATORS, OPERATORS_BY_TYPE, OPERATOR_LABELS, OPERATOR_LABELS_BY_TYPE, OPERATOR_SYMBOLS, QUERY_BAR_SELECTOR, VARIANT_LABELS, buildContainerAnchoredRect, chipIdToConditionIndex, filterAndSort, findChipSplitIndex, formatDateForChip, getDateDisplayLabel, getFieldValues, getOperatorFromLabel, getOperatorLabel, hasFieldValues, isBetweenOperator, isDatePreset, isMenuRelated, isMultiSelectOperator, isNoValueOperator };
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* FilterInput Chip Variant Types
|
|
4
4
|
*/
|
|
5
|
-
export type
|
|
5
|
+
export type FilterInputChipVariant = 'chip' | 'and' | 'or' | '(' | ')';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* FilterInput Chip Data Interface
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
/** Which segment of a chip has an error: attribute or value (true = whole chip) */
|
|
10
|
+
export type ChipErrorSegment = boolean | 'attribute' | 'value';
|
|
11
|
+
export interface FilterInputChipData {
|
|
10
12
|
id: string;
|
|
11
|
-
variant:
|
|
13
|
+
variant: FilterInputChipVariant;
|
|
12
14
|
attribute?: string;
|
|
13
15
|
operator?: string;
|
|
14
16
|
value?: string;
|
|
15
|
-
error?:
|
|
17
|
+
error?: ChipErrorSegment;
|
|
18
|
+
/** Individual display parts for multi-value chips (avoids comma-split issues) */
|
|
19
|
+
valueParts?: string[];
|
|
20
|
+
/** Separator between valueParts (default: ", ") */
|
|
21
|
+
valueSeparator?: string;
|
|
22
|
+
/** Indices of invalid values in a multi-value chip (e.g. "in" operator) */
|
|
23
|
+
errorValueIndices?: number[];
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Field Type for filter attributes
|
|
@@ -45,6 +53,12 @@ export interface FieldMetadata {
|
|
|
45
53
|
operators?: FilterOperator[];
|
|
46
54
|
default?: string | number | boolean;
|
|
47
55
|
values?: FieldValueOption[];
|
|
56
|
+
/**
|
|
57
|
+
* Shorthand for simple string values (e.g. `["GET", "POST", "PUT"]`).
|
|
58
|
+
* Automatically converted to `FieldValueOption[]` where `value === label`.
|
|
59
|
+
* Empty array `[]` means freeform input — no dropdown, user types any value.
|
|
60
|
+
*/
|
|
61
|
+
options?: string[];
|
|
48
62
|
}
|
|
49
63
|
/**
|
|
50
64
|
* Expression Tree Types
|
|
@@ -57,8 +71,8 @@ export interface Condition {
|
|
|
57
71
|
field: string;
|
|
58
72
|
operator: FilterOperator;
|
|
59
73
|
value: string | number | boolean | null | Array<string | number | boolean>;
|
|
60
|
-
/** Per-condition validation error
|
|
61
|
-
error?:
|
|
74
|
+
/** Per-condition validation error: true = whole chip, 'attribute'/'value' = specific segment */
|
|
75
|
+
error?: ChipErrorSegment;
|
|
62
76
|
/** For date fields: tracks whether the value originated as relative preset or absolute date */
|
|
63
77
|
dateOrigin?: 'relative' | 'absolute';
|
|
64
78
|
}
|
|
@@ -81,7 +95,7 @@ export type MenuState = 'closed' | 'field' | 'operator' | 'value';
|
|
|
81
95
|
/**
|
|
82
96
|
* Item in a dropdown menu
|
|
83
97
|
*/
|
|
84
|
-
export interface
|
|
98
|
+
export interface FilterInputDropdownItem {
|
|
85
99
|
/** Unique identifier */
|
|
86
100
|
id: string;
|
|
87
101
|
/** Display label */
|
|
@@ -100,18 +114,18 @@ export interface QueryBarDropdownItem {
|
|
|
100
114
|
/** Whether item shows a submenu arrow */
|
|
101
115
|
hasSubmenu?: boolean;
|
|
102
116
|
/** Custom renderer for item content */
|
|
103
|
-
renderContent?: (item:
|
|
117
|
+
renderContent?: (item: FilterInputDropdownItem) => ReactNode;
|
|
104
118
|
}
|
|
105
119
|
/**
|
|
106
120
|
* Section in a dropdown menu (group of items)
|
|
107
121
|
*/
|
|
108
|
-
export interface
|
|
122
|
+
export interface FilterInputDropdownSection {
|
|
109
123
|
/** Unique identifier */
|
|
110
124
|
id: string;
|
|
111
125
|
/** Optional section title/header */
|
|
112
126
|
title?: string;
|
|
113
127
|
/** Items in this section */
|
|
114
|
-
items:
|
|
128
|
+
items: FilterInputDropdownItem[];
|
|
115
129
|
/** Whether to show separator after this section */
|
|
116
130
|
showSeparator?: boolean;
|
|
117
131
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { DateTime, type DateTimeProps } from './components/DateTime';
|
|
|
12
12
|
export { Drawer, DrawerBody, type DrawerBodyProps, DrawerClose, type DrawerCloseProps, DrawerContent, type DrawerContentProps, DrawerFooter, DrawerFooterControls, type DrawerFooterControlsProps, type DrawerFooterProps, DrawerHeader, type DrawerHeaderProps, DrawerPositioner, type DrawerPositionerProps, type DrawerProps, DrawerResizeHandle, DrawerTitle, type DrawerTitleProps, DrawerTrigger, type DrawerTriggerProps, drawerContentVariants, drawerPositionerVariants, useDrawerContext, } from './components/Drawer';
|
|
13
13
|
export { DropdownMenu, DropdownMenuContent, DropdownMenuContextTrigger, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuInput, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDescription, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem, } from './components/DropdownMenu';
|
|
14
14
|
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, } from './components/Field';
|
|
15
|
+
export { type Condition, type ExprNode, type FieldMetadata, type FieldType, FilterInput, FilterInputChip, type FilterInputChipData, type FilterInputChipProps, type FilterInputChipVariant, FilterInputFieldMenu, type FilterInputFieldMenuProps, FilterInputOperatorMenu, type FilterInputOperatorMenuProps, type FilterInputProps, type FilterOperator, type Group, } from './components/FilterInput';
|
|
15
16
|
export { Flex, type FlexProps } from './components/Flex';
|
|
16
17
|
export { Heading, type HeadingProps } from './components/Heading';
|
|
17
18
|
export { Input, type InputProps } from './components/Input';
|
|
@@ -24,7 +25,6 @@ export { NumberInput, type NumberInputProps } from './components/NumberInput';
|
|
|
24
25
|
export { NumericBadge, type NumericBadgeProps, } from './components/NumericBadge';
|
|
25
26
|
export { OverflowTooltip, OverflowTooltipContent, type OverflowTooltipContentProps, type OverflowTooltipProps, } from './components/OverflowTooltip';
|
|
26
27
|
export { Popover, PopoverContent, PopoverTrigger } from './components/Popover';
|
|
27
|
-
export { type Condition, type ExprNode, type FieldMetadata, type FieldType, type FilterOperator, type Group, QueryBar, QueryBarChip, type QueryBarChipData, type QueryBarChipProps, type QueryBarChipVariant, QueryBarFieldMenu, type QueryBarFieldMenuProps, QueryBarOperatorMenu, type QueryBarOperatorMenuProps, type QueryBarProps, } from './components/QueryBar';
|
|
28
28
|
export { Radio, RadioDescription, type RadioDescriptionProps, RadioGroup, type RadioGroupProps, RadioIndicator, RadioLabel, type RadioLabelProps, type RadioProps, } from './components/Radio';
|
|
29
29
|
export { ScrollArea, ScrollAreaContent, type ScrollAreaContentProps, ScrollAreaCorner, type ScrollAreaProps, ScrollAreaScrollbar, type ScrollAreaScrollbarProps, ScrollAreaViewport, type ScrollAreaViewportProps, } from './components/ScrollArea';
|
|
30
30
|
export { SegmentedControl, SegmentedControlButton, type SegmentedControlButtonProps, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, SegmentedControlSeparator, type SegmentedControlSeparatorProps, } from './components/SegmentedControl';
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { DateTime } from "./components/DateTime/index.js";
|
|
|
12
12
|
import { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerFooter, DrawerFooterControls, DrawerHeader, DrawerPositioner, DrawerResizeHandle, DrawerTitle, DrawerTrigger, drawerContentVariants, drawerPositionerVariants, useDrawerContext } from "./components/Drawer/index.js";
|
|
13
13
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuContextTrigger, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuInput, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDescription, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem } from "./components/DropdownMenu/index.js";
|
|
14
14
|
import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle } from "./components/Field/index.js";
|
|
15
|
+
import { FilterInput, FilterInputChip, FilterInputFieldMenu, FilterInputOperatorMenu } from "./components/FilterInput/index.js";
|
|
15
16
|
import { Flex } from "./components/Flex/index.js";
|
|
16
17
|
import { Heading } from "./components/Heading/index.js";
|
|
17
18
|
import { Input } from "./components/Input/index.js";
|
|
@@ -24,7 +25,6 @@ import { NumberInput } from "./components/NumberInput/index.js";
|
|
|
24
25
|
import { NumericBadge } from "./components/NumericBadge/index.js";
|
|
25
26
|
import { OverflowTooltip, OverflowTooltipContent } from "./components/OverflowTooltip/index.js";
|
|
26
27
|
import { Popover, PopoverContent, PopoverTrigger } from "./components/Popover/index.js";
|
|
27
|
-
import { QueryBar, QueryBarChip, QueryBarFieldMenu, QueryBarOperatorMenu } from "./components/QueryBar/index.js";
|
|
28
28
|
import { Radio, RadioDescription, RadioGroup, RadioIndicator, RadioLabel } from "./components/Radio/index.js";
|
|
29
29
|
import { ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaScrollbar, ScrollAreaViewport } from "./components/ScrollArea/index.js";
|
|
30
30
|
import { SegmentedControl, SegmentedControlButton, SegmentedControlItem, SegmentedControlSeparator } from "./components/SegmentedControl/index.js";
|
|
@@ -46,4 +46,4 @@ import { ToggleButton } from "./components/ToggleButton/index.js";
|
|
|
46
46
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./components/Tooltip/index.js";
|
|
47
47
|
import { Tour, beaconStepEffect, useTour, waitForStepEvent } from "./components/Tour/index.js";
|
|
48
48
|
import { TestIdProvider, useTestId } from "./utils/testId.js";
|
|
49
|
-
export { Alert, AlertClose, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle, Badge, Button, Calendar, CalendarApplyButton, CalendarBody, CalendarContent, CalendarDayName, CalendarFooter, CalendarFooterControls, CalendarGrid, CalendarGrids, CalendarHeader, CalendarInputHeader, CalendarKeyboardHints, CalendarPresetItem, CalendarPresets, CalendarProvider, CalendarResetButton, CalendarTrigger, Card, CardContent, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxDescription, CheckboxGroup, CheckboxIndicator, CheckboxLabel, Code, Country, CountryFlag, CountryName, DAY_NAMES, DEFAULT_RANGE_PRESETS, DEFAULT_SINGLE_PRESETS, DateInput, DateRangeEndValue, DateRangeInput, DateRangeProvider, DateRangeSeparator, DateRangeStartValue, DateTime, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerFooter, DrawerFooterControls, DrawerHeader, DrawerPositioner, DrawerResizeHandle, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuContextTrigger, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuInput, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDescription, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Flex, HStack, Heading, Input, InputGroup, InputGroupAddon, InputGroupText, Ip, IpAddress, IpCountry, IpList, IpPort, IpProvider, Kbd, KbdGroup, Link, Loader, MONTH_NAMES, NumberInput, NumericBadge, OverflowTooltip, OverflowTooltipContent, Popover, PopoverContent, PopoverTrigger,
|
|
49
|
+
export { Alert, AlertClose, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle, Badge, Button, Calendar, CalendarApplyButton, CalendarBody, CalendarContent, CalendarDayName, CalendarFooter, CalendarFooterControls, CalendarGrid, CalendarGrids, CalendarHeader, CalendarInputHeader, CalendarKeyboardHints, CalendarPresetItem, CalendarPresets, CalendarProvider, CalendarResetButton, CalendarTrigger, Card, CardContent, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxDescription, CheckboxGroup, CheckboxIndicator, CheckboxLabel, Code, Country, CountryFlag, CountryName, DAY_NAMES, DEFAULT_RANGE_PRESETS, DEFAULT_SINGLE_PRESETS, DateInput, DateRangeEndValue, DateRangeInput, DateRangeProvider, DateRangeSeparator, DateRangeStartValue, DateTime, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerFooter, DrawerFooterControls, DrawerHeader, DrawerPositioner, DrawerResizeHandle, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuContextTrigger, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuInput, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDescription, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FilterInput, FilterInputChip, FilterInputFieldMenu, FilterInputOperatorMenu, Flex, HStack, Heading, Input, InputGroup, InputGroupAddon, InputGroupText, Ip, IpAddress, IpCountry, IpList, IpPort, IpProvider, Kbd, KbdGroup, Link, Loader, MONTH_NAMES, NumberInput, NumericBadge, OverflowTooltip, OverflowTooltipContent, Popover, PopoverContent, PopoverTrigger, Radio, RadioDescription, RadioGroup, RadioIndicator, RadioLabel, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaScrollbar, ScrollAreaViewport, SegmentedControl, SegmentedControlButton, SegmentedControlItem, SegmentedControlSeparator, SegmentedTabs, SegmentedTabsButton, SegmentedTabsContent, SegmentedTabsList, SegmentedTabsSeparator, SegmentedTabsTrigger, SegmentedTabsTriggerButton, Select, SelectButton, SelectClearTrigger, SelectContent, SelectFooter, SelectGroup, SelectGroupLabel, SelectHeader, SelectInput, SelectOption, SelectOptionDescription, SelectOptionIndicator, SelectOptionText, SelectPositioner, SelectSearchInput, SelectSeparator, Separator, Skeleton, Stack, Switch, SwitchControl, SwitchDescription, SwitchLabel, Table, TableActionBar, TableEmptyState, TableSettingsMenu, Tabs, TabsButton, TabsContent, TabsLineActions, TabsList, TabsSeparator, TabsTrigger, Tag, TagClose, TestIdProvider, Text, Textarea, ThemeProvider, TimeInput, Toast, ToastActions, Toaster, ToggleButton, Tooltip, TooltipContent, TooltipTrigger, Tour, VStack, beaconStepEffect, cardVariants, createTableColumnHelper, datacenters, drawerContentVariants, drawerPositionerVariants, proxyTypes, sourceLabels, toaster, useCalendarContext, useDateRangeContext, useDrawerContext, useTestId, useTheme, useTour, waitForStepEvent };
|