@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
|
@@ -39,6 +39,8 @@ export interface CalendarProps {
|
|
|
39
39
|
closeOnSelect?: boolean;
|
|
40
40
|
/** Whether calendar is readonly (display only, no date selection allowed). Default: false */
|
|
41
41
|
readonly?: boolean;
|
|
42
|
+
/** Controlled focused date — navigates the calendar view to this date */
|
|
43
|
+
focusedValue?: DateValue;
|
|
42
44
|
/** Compound components (CalendarTrigger, CalendarContent, etc.) */
|
|
43
45
|
children?: ReactNode;
|
|
44
46
|
}
|
|
@@ -112,7 +112,7 @@ const DEFAULT_RANGE_PRESETS = [
|
|
|
112
112
|
shortcut: '9'
|
|
113
113
|
}
|
|
114
114
|
];
|
|
115
|
-
const Calendar = ({ type = 'single', showTime = false, showKeyboardHints = true, value, defaultValue, onChange, minDate, maxDate, isDateUnavailable, disallowDisabledDatesInRange = false, open, defaultOpen, onOpenChange, closeOnSelect = true, readonly = false, children })=>{
|
|
115
|
+
const Calendar = ({ type = 'single', showTime = false, showKeyboardHints = true, value, defaultValue, onChange, minDate, maxDate, isDateUnavailable, disallowDisabledDatesInRange = false, open, defaultOpen, onOpenChange, closeOnSelect = true, readonly = false, focusedValue, children })=>{
|
|
116
116
|
const isRange = 'range' === type;
|
|
117
117
|
const numOfMonths = isRange ? 2 : 1;
|
|
118
118
|
const hasUnavailableDateInRange = useCallback((start, end)=>{
|
|
@@ -176,6 +176,7 @@ const Calendar = ({ type = 'single', showTime = false, showKeyboardHints = true,
|
|
|
176
176
|
max: maxDate,
|
|
177
177
|
isDateUnavailable: isDateUnavailable,
|
|
178
178
|
outsideDaySelectable: true,
|
|
179
|
+
focusedValue: focusedValue,
|
|
179
180
|
closeOnSelect: closeOnSelect,
|
|
180
181
|
children: /*#__PURE__*/ jsx(CalendarProvider, {
|
|
181
182
|
value: contextValue,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FC, HTMLAttributes } from 'react';
|
|
2
2
|
import type { ExprNode, FieldMetadata } from './types';
|
|
3
|
-
export interface
|
|
3
|
+
export interface FilterInputProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange'> {
|
|
4
4
|
/**
|
|
5
5
|
* Available fields from backend API config
|
|
6
6
|
*/
|
|
@@ -28,9 +28,9 @@ export interface QueryBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'chi
|
|
|
28
28
|
showKeyboardHint?: boolean;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* FilterInput - Self-contained filter component.
|
|
32
32
|
* Handles autocomplete flow (field → operator → value), chip creation, and expression management.
|
|
33
33
|
* Supports multiple conditions joined by AND/OR connectors.
|
|
34
34
|
* Just pass `fields` config from backend API and it works.
|
|
35
35
|
*/
|
|
36
|
-
export declare const
|
|
36
|
+
export declare const FilterInput: FC<FilterInputProps>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef } from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { FilterInputProvider, useFilterInputContextValue } from "./FilterInputContext/index.js";
|
|
5
|
+
import { FilterInputErrors, parseFilterInputErrors } from "./FilterInputErrors/index.js";
|
|
6
|
+
import { FilterInputField } from "./FilterInputField/index.js";
|
|
7
|
+
import { FilterInputMenu } from "./FilterInputMenu/FilterInputMenu.js";
|
|
8
|
+
import { useFilterInputAutocomplete, useFilterInputExpression } from "./hooks/index.js";
|
|
9
|
+
const FilterInput = ({ fields = [], value, onChange, placeholder = 'Type to filter...', error = false, showKeyboardHint = false, className, ...props })=>{
|
|
10
|
+
const inputRef = useRef(null);
|
|
11
|
+
const containerRef = useRef(null);
|
|
12
|
+
const buildingChipRef = useRef(null);
|
|
13
|
+
const { conditions, chips, upsertCondition, removeCondition, removeConditionAtIndex, clearAll, setConnectorValue } = useFilterInputExpression({
|
|
14
|
+
fields,
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
error
|
|
18
|
+
});
|
|
19
|
+
const autocomplete = useFilterInputAutocomplete({
|
|
20
|
+
fields,
|
|
21
|
+
conditions,
|
|
22
|
+
chips,
|
|
23
|
+
upsertCondition,
|
|
24
|
+
removeCondition,
|
|
25
|
+
removeConditionAtIndex,
|
|
26
|
+
clearAll,
|
|
27
|
+
setConnectorValue,
|
|
28
|
+
containerRef,
|
|
29
|
+
buildingChipRef,
|
|
30
|
+
inputRef
|
|
31
|
+
});
|
|
32
|
+
const contextValue = useFilterInputContextValue({
|
|
33
|
+
chips,
|
|
34
|
+
autocomplete,
|
|
35
|
+
buildingChipRef,
|
|
36
|
+
inputRef,
|
|
37
|
+
placeholder,
|
|
38
|
+
error,
|
|
39
|
+
showKeyboardHint
|
|
40
|
+
});
|
|
41
|
+
const errors = useMemo(()=>parseFilterInputErrors(conditions, fields), [
|
|
42
|
+
conditions,
|
|
43
|
+
fields
|
|
44
|
+
]);
|
|
45
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
46
|
+
ref: containerRef,
|
|
47
|
+
className: cn('relative flex w-full flex-col gap-4', className),
|
|
48
|
+
onFocus: autocomplete.handleFocus,
|
|
49
|
+
onBlur: autocomplete.handleBlur,
|
|
50
|
+
children: [
|
|
51
|
+
/*#__PURE__*/ jsx(FilterInputProvider, {
|
|
52
|
+
value: contextValue,
|
|
53
|
+
children: /*#__PURE__*/ jsx(FilterInputField, {
|
|
54
|
+
...props
|
|
55
|
+
})
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ jsx(FilterInputMenu, {
|
|
58
|
+
fields: fields,
|
|
59
|
+
autocomplete: autocomplete
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ jsx(FilterInputErrors, {
|
|
62
|
+
errors: errors
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
FilterInput.displayName = 'FilterInput';
|
|
68
|
+
export { FilterInput };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import type { FilterInputContextValue } from './types';
|
|
3
|
+
interface FilterInputProviderProps {
|
|
4
|
+
value: FilterInputContextValue;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const FilterInputProvider: FC<FilterInputProviderProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FilterInputContext } from "./FilterInputContext.js";
|
|
3
|
+
const FilterInputProvider = ({ value, children })=>/*#__PURE__*/ jsx(FilterInputContext.Provider, {
|
|
4
|
+
value: value,
|
|
5
|
+
children: children
|
|
6
|
+
});
|
|
7
|
+
FilterInputProvider.displayName = 'FilterInputProvider';
|
|
8
|
+
export { FilterInputProvider };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { FilterInputProvider } from './FilterInputProvider';
|
|
2
|
+
export type { BuildingChipData, FilterInputContextValue } from './types';
|
|
3
|
+
export { useFilterInputContext } from './useFilterInputContext';
|
|
4
|
+
export { useFilterInputContextValue } from './useFilterInputContextValue';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FilterInputProvider } from "./FilterInputProvider.js";
|
|
2
|
+
import { useFilterInputContext } from "./useFilterInputContext.js";
|
|
3
|
+
import { useFilterInputContextValue } from "./useFilterInputContextValue.js";
|
|
4
|
+
export { FilterInputProvider, useFilterInputContext, useFilterInputContextValue };
|
package/dist/components/{QueryBar/QueryBarContext → FilterInput/FilterInputContext}/types.d.ts
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ChangeEvent, KeyboardEvent, Ref, RefObject } from 'react';
|
|
2
|
-
import type { ChipSegment } from '../
|
|
3
|
-
import type {
|
|
2
|
+
import type { ChipSegment } from '../FilterInputField/FilterInputChip';
|
|
3
|
+
import type { FilterInputChipData } from '../types';
|
|
4
4
|
export interface BuildingChipData {
|
|
5
5
|
attribute: string;
|
|
6
6
|
operator?: string;
|
|
7
7
|
value?: string;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
10
|
-
chips:
|
|
9
|
+
export interface FilterInputContextValue {
|
|
10
|
+
chips: FilterInputChipData[];
|
|
11
11
|
buildingChipData: BuildingChipData | null;
|
|
12
12
|
buildingChipRef: Ref<HTMLDivElement>;
|
|
13
13
|
inputText: string;
|
|
@@ -35,4 +35,6 @@ export interface QueryBarContextValue {
|
|
|
35
35
|
onCustomAttributeCommit: (customText: string) => void;
|
|
36
36
|
/** Ref to the currently open menu content element */
|
|
37
37
|
menuRef: RefObject<HTMLDivElement | null>;
|
|
38
|
+
/** Close autocomplete menu (used by connector chip to enforce single-dropdown constraint) */
|
|
39
|
+
closeAutocompleteMenu: () => void;
|
|
38
40
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { FilterInputContext } from "./FilterInputContext.js";
|
|
3
|
+
const useFilterInputContext = ()=>{
|
|
4
|
+
const ctx = useContext(FilterInputContext);
|
|
5
|
+
if (!ctx) throw new Error('useFilterInputContext must be used within a <FilterInput> component');
|
|
6
|
+
return ctx;
|
|
7
|
+
};
|
|
8
|
+
export { useFilterInputContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
import type { ChipSegment } from '../
|
|
3
|
-
import type {
|
|
4
|
-
import type { BuildingChipData,
|
|
2
|
+
import type { ChipSegment } from '../FilterInputField/FilterInputChip';
|
|
3
|
+
import type { FilterInputChipData, MenuState } from '../types';
|
|
4
|
+
import type { BuildingChipData, FilterInputContextValue } from './types';
|
|
5
5
|
interface AutocompleteForContext {
|
|
6
6
|
buildingChipData: BuildingChipData | null;
|
|
7
7
|
inputText: string;
|
|
@@ -24,9 +24,10 @@ interface AutocompleteForContext {
|
|
|
24
24
|
handleCustomValueCommit: (customText: string) => void;
|
|
25
25
|
handleCustomAttributeCommit: (customText: string) => void;
|
|
26
26
|
menuRef: RefObject<HTMLDivElement | null>;
|
|
27
|
+
closeAutocompleteMenu: () => void;
|
|
27
28
|
}
|
|
28
|
-
interface
|
|
29
|
-
chips:
|
|
29
|
+
interface UseFilterInputContextValueOptions {
|
|
30
|
+
chips: FilterInputChipData[];
|
|
30
31
|
autocomplete: AutocompleteForContext;
|
|
31
32
|
buildingChipRef: RefObject<HTMLDivElement | null>;
|
|
32
33
|
inputRef: RefObject<HTMLInputElement | null>;
|
|
@@ -34,5 +35,5 @@ interface UseQueryBarContextValueOptions {
|
|
|
34
35
|
error: boolean;
|
|
35
36
|
showKeyboardHint: boolean;
|
|
36
37
|
}
|
|
37
|
-
export declare const
|
|
38
|
+
export declare const useFilterInputContextValue: ({ chips, autocomplete, buildingChipRef, inputRef, placeholder, error, showKeyboardHint, }: UseFilterInputContextValueOptions) => FilterInputContextValue;
|
|
38
39
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
const
|
|
2
|
+
const useFilterInputContextValue = ({ chips, autocomplete, buildingChipRef, inputRef, placeholder, error, showKeyboardHint })=>useMemo(()=>({
|
|
3
3
|
chips,
|
|
4
4
|
buildingChipData: autocomplete.buildingChipData,
|
|
5
5
|
buildingChipRef,
|
|
@@ -26,7 +26,8 @@ const useQueryBarContextValue = ({ chips, autocomplete, buildingChipRef, inputRe
|
|
|
26
26
|
onCancelSegmentEdit: autocomplete.cancelSegmentEdit,
|
|
27
27
|
onCustomValueCommit: autocomplete.handleCustomValueCommit,
|
|
28
28
|
onCustomAttributeCommit: autocomplete.handleCustomAttributeCommit,
|
|
29
|
-
menuRef: autocomplete.menuRef
|
|
29
|
+
menuRef: autocomplete.menuRef,
|
|
30
|
+
closeAutocompleteMenu: autocomplete.closeAutocompleteMenu
|
|
30
31
|
}), [
|
|
31
32
|
chips,
|
|
32
33
|
autocomplete.buildingChipData,
|
|
@@ -50,10 +51,11 @@ const useQueryBarContextValue = ({ chips, autocomplete, buildingChipRef, inputRe
|
|
|
50
51
|
autocomplete.handleCustomValueCommit,
|
|
51
52
|
autocomplete.handleCustomAttributeCommit,
|
|
52
53
|
autocomplete.menuRef,
|
|
54
|
+
autocomplete.closeAutocompleteMenu,
|
|
53
55
|
buildingChipRef,
|
|
54
56
|
inputRef,
|
|
55
57
|
placeholder,
|
|
56
58
|
error,
|
|
57
59
|
showKeyboardHint
|
|
58
60
|
]);
|
|
59
|
-
export {
|
|
61
|
+
export { useFilterInputContextValue };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Alert } from "../../Alert/Alert.js";
|
|
3
|
+
import { AlertContent } from "../../Alert/AlertContent.js";
|
|
4
|
+
import { AlertDescription } from "../../Alert/AlertDescription.js";
|
|
5
|
+
import { AlertIcon } from "../../Alert/AlertIcon.js";
|
|
6
|
+
import { AlertTitle } from "../../Alert/AlertTitle.js";
|
|
7
|
+
const FilterInputErrors = ({ errors })=>{
|
|
8
|
+
if (0 === errors.length) return null;
|
|
9
|
+
const title = 1 === errors.length ? 'Filter contains 1 issue:' : `Filter contains ${errors.length} issues:`;
|
|
10
|
+
return /*#__PURE__*/ jsxs(Alert, {
|
|
11
|
+
color: "destructive",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsx(AlertIcon, {}),
|
|
14
|
+
/*#__PURE__*/ jsxs(AlertContent, {
|
|
15
|
+
children: [
|
|
16
|
+
/*#__PURE__*/ jsx(AlertTitle, {
|
|
17
|
+
children: title
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ jsx(AlertDescription, {
|
|
20
|
+
lineClamp: 0,
|
|
21
|
+
children: /*#__PURE__*/ jsx("ul", {
|
|
22
|
+
className: "list-disc ms-[21px]",
|
|
23
|
+
children: errors.map((err, idx)=>/*#__PURE__*/ jsx("li", {
|
|
24
|
+
children: err
|
|
25
|
+
}, idx))
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
FilterInputErrors.displayName = 'FilterInputErrors';
|
|
34
|
+
export { FilterInputErrors };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Condition, FieldMetadata } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Parse conditions into human-readable error messages.
|
|
4
|
+
* Pure function — no React, no side effects.
|
|
5
|
+
*/
|
|
6
|
+
export declare const parseFilterInputErrors: (conditions: Condition[], fields: FieldMetadata[]) => string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isValidFieldValue } from "../hooks/useFilterInputAutocomplete/valueCommitHelpers.js";
|
|
2
|
+
import { getFieldValues } from "../lib/index.js";
|
|
3
|
+
const parseFilterInputErrors = (conditions, fields)=>{
|
|
4
|
+
const errors = [];
|
|
5
|
+
for (const condition of conditions){
|
|
6
|
+
if (!condition.error) continue;
|
|
7
|
+
const field = fields.find((f)=>f.name === condition.field);
|
|
8
|
+
const label = field?.label || condition.field;
|
|
9
|
+
switch(condition.error){
|
|
10
|
+
case 'attribute':
|
|
11
|
+
errors.push(`Unknown field ${condition.field}`);
|
|
12
|
+
break;
|
|
13
|
+
case 'value':
|
|
14
|
+
if (field && Array.isArray(condition.value)) {
|
|
15
|
+
const fv = getFieldValues(field);
|
|
16
|
+
if (fv.length > 0) {
|
|
17
|
+
const invalidValues = condition.value.filter((v)=>!isValidFieldValue(fv, v));
|
|
18
|
+
if (invalidValues.length > 0) {
|
|
19
|
+
const formatted = invalidValues.map((v)=>String(v)).join(', ');
|
|
20
|
+
errors.push(`Invalid value for ${label}: ${formatted}`);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
errors.push(`Invalid value for ${label}`);
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
errors.push(`Invalid condition for ${label}`);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return errors;
|
|
33
|
+
};
|
|
34
|
+
export { parseFilterInputErrors };
|
package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/ChipsWithGaps.d.ts
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type { ChipSegment } from './
|
|
2
|
+
import type { FilterInputChipData } from '../types';
|
|
3
|
+
import type { ChipSegment } from './FilterInputChip';
|
|
4
4
|
interface ChipsWithGapsProps {
|
|
5
|
-
chips:
|
|
5
|
+
chips: FilterInputChipData[];
|
|
6
6
|
hideLeadingGap?: boolean;
|
|
7
7
|
hideTrailingGap?: boolean;
|
|
8
8
|
onChipClick: (chipId: string, segment: ChipSegment, anchorRect: DOMRect) => void;
|
|
@@ -17,7 +17,7 @@ interface ChipsWithGapsProps {
|
|
|
17
17
|
export declare const ChipsWithGaps: FC<ChipsWithGapsProps>;
|
|
18
18
|
/** Trailing gap rendered once after chipsAfter in the parent layout. */
|
|
19
19
|
export declare const TrailingGap: FC<{
|
|
20
|
-
chips:
|
|
20
|
+
chips: FilterInputChipData[];
|
|
21
21
|
onGapClick: (conditionIndex: number, afterConnector: boolean) => void;
|
|
22
22
|
}>;
|
|
23
23
|
export {};
|
package/dist/components/{QueryBar/QueryBarInput → FilterInput/FilterInputField}/ChipsWithGaps.js
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CONNECTOR_ID_PATTERN } from "../lib/index.js";
|
|
3
|
+
import { FilterInputChip } from "./FilterInputChip/FilterInputChip.js";
|
|
4
|
+
import { FilterInputConnectorChip } from "./FilterInputConnectorChip/index.js";
|
|
2
5
|
import { InsertionGap } from "./InsertionGap/index.js";
|
|
3
|
-
import { QueryBarChip } from "./QueryBarChip/QueryBarChip.js";
|
|
4
|
-
import { QueryBarConnectorChip } from "./QueryBarConnectorChip/index.js";
|
|
5
6
|
const ChipsWithGaps = ({ chips, hideLeadingGap, hideTrailingGap, onChipClick, onConnectorChange, onChipRemove, onGapClick })=>{
|
|
6
7
|
const elements = [];
|
|
7
8
|
let connectorIndex = 0;
|
|
@@ -11,18 +12,21 @@ const ChipsWithGaps = ({ chips, hideLeadingGap, hideTrailingGap, onChipClick, on
|
|
|
11
12
|
const isConnector = 'and' === chip.variant || 'or' === chip.variant;
|
|
12
13
|
if (isCondition) elements.push(/*#__PURE__*/ jsx("div", {
|
|
13
14
|
className: "shrink-0 cursor-pointer hover:z-10",
|
|
14
|
-
children: /*#__PURE__*/ jsx(
|
|
15
|
+
children: /*#__PURE__*/ jsx(FilterInputChip, {
|
|
15
16
|
chipId: chip.id,
|
|
16
17
|
attribute: chip.attribute ?? '',
|
|
17
18
|
operator: chip.operator,
|
|
18
19
|
value: chip.value,
|
|
19
20
|
error: chip.error,
|
|
21
|
+
valueParts: chip.valueParts,
|
|
22
|
+
valueSeparator: chip.valueSeparator,
|
|
23
|
+
errorValueIndices: chip.errorValueIndices,
|
|
20
24
|
onRemove: ()=>onChipRemove(chip.id),
|
|
21
25
|
onSegmentClick: (segment, anchorRect)=>onChipClick(chip.id, segment, anchorRect)
|
|
22
26
|
})
|
|
23
27
|
}, chip.id));
|
|
24
28
|
else if (isConnector) {
|
|
25
|
-
const match = chip.id.match(
|
|
29
|
+
const match = chip.id.match(CONNECTOR_ID_PATTERN);
|
|
26
30
|
const condIdx = match ? Number(match[1]) : 0;
|
|
27
31
|
const isFirst = 0 === connectorIndex;
|
|
28
32
|
const isLast = connectorIndex === connectorCount - 1;
|
|
@@ -31,7 +35,7 @@ const ChipsWithGaps = ({ chips, hideLeadingGap, hideTrailingGap, onChipClick, on
|
|
|
31
35
|
}, `gap-before-${chip.id}`));
|
|
32
36
|
elements.push(/*#__PURE__*/ jsx("div", {
|
|
33
37
|
className: "shrink-0",
|
|
34
|
-
children: /*#__PURE__*/ jsx(
|
|
38
|
+
children: /*#__PURE__*/ jsx(FilterInputConnectorChip, {
|
|
35
39
|
chipId: chip.id,
|
|
36
40
|
variant: chip.variant,
|
|
37
41
|
onChange: onConnectorChange
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FC, type FocusEvent, type KeyboardEvent, type ReactNode } from 'react';
|
|
2
|
-
import type { ChipSegment } from './
|
|
2
|
+
import type { ChipSegment } from './FilterInputChip';
|
|
3
3
|
export interface EditingContextValue {
|
|
4
4
|
editingChipId: string | null;
|
|
5
5
|
editingSegment: ChipSegment | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes } from 'react';
|
|
2
|
+
import type { ChipErrorSegment } from '../../types';
|
|
3
|
+
export type ChipSegment = 'attribute' | 'operator' | 'value';
|
|
4
|
+
export interface FilterInputChipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
5
|
+
chipId?: string;
|
|
6
|
+
attribute: string;
|
|
7
|
+
operator?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
error?: ChipErrorSegment;
|
|
10
|
+
valueParts?: string[];
|
|
11
|
+
valueSeparator?: string;
|
|
12
|
+
errorValueIndices?: number[];
|
|
13
|
+
building?: boolean;
|
|
14
|
+
onRemove?: () => void;
|
|
15
|
+
onSegmentClick?: (segment: ChipSegment, anchorRect: DOMRect) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const FilterInputChip: FC<FilterInputChipProps>;
|
|
@@ -3,11 +3,13 @@ import { useCallback, useRef } from "react";
|
|
|
3
3
|
import { cn } from "../../../../utils/cn.js";
|
|
4
4
|
import { chipVariants } from "./classes.js";
|
|
5
5
|
import { useEditingContext } from "./EditingContext.js";
|
|
6
|
+
import { FilterInputRemoveButton } from "./FilterInputRemoveButton.js";
|
|
6
7
|
import { OperatorSegment } from "./OperatorSegment.js";
|
|
7
|
-
import { QueryBarRemoveButton } from "./QueryBarRemoveButton.js";
|
|
8
8
|
import { Segment } from "./Segment.js";
|
|
9
|
-
|
|
9
|
+
import { ValueSegment } from "./ValueSegment.js";
|
|
10
|
+
const FilterInputChip = ({ chipId, attribute, operator, value, error = false, valueParts, valueSeparator, errorValueIndices, building = false, onRemove, onSegmentClick, className, ...props })=>{
|
|
10
11
|
const interactive = !building;
|
|
12
|
+
const hasError = !!error;
|
|
11
13
|
const chipRef = useRef(null);
|
|
12
14
|
const editing = useEditingContext();
|
|
13
15
|
const isEditingThisChip = null != editing && null != chipId && editing.editingChipId === chipId;
|
|
@@ -33,15 +35,16 @@ const QueryBarChip = ({ chipId, attribute, operator, value, error = false, build
|
|
|
33
35
|
return /*#__PURE__*/ jsxs("div", {
|
|
34
36
|
ref: chipRef,
|
|
35
37
|
className: cn(chipVariants({
|
|
36
|
-
error,
|
|
38
|
+
error: hasError,
|
|
37
39
|
interactive
|
|
38
40
|
}), 'max-w-[600px]', className),
|
|
39
|
-
"data-slot": "
|
|
41
|
+
"data-slot": "filter-input-condition-chip",
|
|
40
42
|
...props,
|
|
41
43
|
children: [
|
|
42
44
|
/*#__PURE__*/ jsx(Segment, {
|
|
43
45
|
variant: "attribute",
|
|
44
46
|
className: "shrink-0",
|
|
47
|
+
error: true === error || 'attribute' === error,
|
|
45
48
|
onClick: interactive ? (e)=>handleSegmentClick('attribute', e) : void 0,
|
|
46
49
|
...segmentEditProps('attribute'),
|
|
47
50
|
children: attribute
|
|
@@ -51,19 +54,22 @@ const QueryBarChip = ({ chipId, attribute, operator, value, error = false, build
|
|
|
51
54
|
onClick: interactive ? (e)=>handleSegmentClick('operator', e) : void 0,
|
|
52
55
|
children: operator
|
|
53
56
|
}),
|
|
54
|
-
value && /*#__PURE__*/ jsx(
|
|
55
|
-
variant: "value",
|
|
57
|
+
value && /*#__PURE__*/ jsx(ValueSegment, {
|
|
56
58
|
className: "min-w-0 max-w-[400px]",
|
|
59
|
+
error: 'value' !== activeSegment && (true === error || 'value' === error),
|
|
60
|
+
valueParts: valueParts,
|
|
61
|
+
valueSeparator: valueSeparator,
|
|
62
|
+
errorValueIndices: errorValueIndices,
|
|
57
63
|
onClick: interactive ? (e)=>handleSegmentClick('value', e) : void 0,
|
|
58
64
|
...segmentEditProps('value'),
|
|
59
65
|
children: value
|
|
60
66
|
}),
|
|
61
|
-
onRemove && /*#__PURE__*/ jsx(
|
|
62
|
-
error:
|
|
67
|
+
onRemove && /*#__PURE__*/ jsx(FilterInputRemoveButton, {
|
|
68
|
+
error: hasError,
|
|
63
69
|
onRemove: onRemove
|
|
64
70
|
})
|
|
65
71
|
]
|
|
66
72
|
});
|
|
67
73
|
};
|
|
68
|
-
|
|
69
|
-
export {
|
|
74
|
+
FilterInputChip.displayName = 'FilterInputChip';
|
|
75
|
+
export { FilterInputChip };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { X } from "../../../../icons/X.js";
|
|
3
3
|
import { removeButtonVariants } from "./classes.js";
|
|
4
|
-
const
|
|
4
|
+
const FilterInputRemoveButton = ({ error, onRemove })=>/*#__PURE__*/ jsx("button", {
|
|
5
5
|
type: "button",
|
|
6
6
|
onClick: (e)=>{
|
|
7
7
|
e.stopPropagation();
|
|
@@ -10,11 +10,11 @@ const QueryBarRemoveButton = ({ error, onRemove })=>/*#__PURE__*/ jsx("button",
|
|
|
10
10
|
className: removeButtonVariants({
|
|
11
11
|
error
|
|
12
12
|
}),
|
|
13
|
-
"data-slot": "
|
|
13
|
+
"data-slot": "filter-input-chip-delete",
|
|
14
14
|
"aria-label": "Remove filter",
|
|
15
15
|
children: /*#__PURE__*/ jsx(X, {
|
|
16
16
|
size: "sm"
|
|
17
17
|
})
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
export {
|
|
19
|
+
FilterInputRemoveButton.displayName = 'FilterInputRemoveButton';
|
|
20
|
+
export { FilterInputRemoveButton };
|
|
@@ -2,15 +2,16 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { cn } from "../../../../utils/cn.js";
|
|
4
4
|
import { segmentContainer, segmentTextVariants } from "./classes.js";
|
|
5
|
-
const Segment = ({ variant, children, className, editing, editText, onEditChange, onEditKeyDown, onEditBlur, ...props })=>{
|
|
5
|
+
const Segment = ({ variant, children, className, error, editing, editText, onEditChange, onEditKeyDown, onEditBlur, ...props })=>{
|
|
6
6
|
const textRef = useRef(null);
|
|
7
7
|
const inputRef = useRef(null);
|
|
8
8
|
const sizerRef = useRef(null);
|
|
9
9
|
const lastTextWidthRef = useRef(0);
|
|
10
10
|
const [inputWidth, setInputWidth] = useState(void 0);
|
|
11
11
|
useEffect(()=>{
|
|
12
|
-
if (editing
|
|
13
|
-
|
|
12
|
+
if (editing) return;
|
|
13
|
+
const width = textRef.current?.getBoundingClientRect().width ?? 8 * children.length;
|
|
14
|
+
lastTextWidthRef.current = width;
|
|
14
15
|
}, [
|
|
15
16
|
editing,
|
|
16
17
|
children
|
|
@@ -34,7 +35,7 @@ const Segment = ({ variant, children, className, editing, editText, onEditChange
|
|
|
34
35
|
]);
|
|
35
36
|
useEffect(()=>{
|
|
36
37
|
if (!editing) return void setInputWidth(void 0);
|
|
37
|
-
const sizerWidth = sizerRef.current?.getBoundingClientRect().width ?? 0;
|
|
38
|
+
const sizerWidth = sizerRef.current?.getBoundingClientRect().width ?? (editText?.length ?? 0) * 8;
|
|
38
39
|
setInputWidth(Math.max(20, lastTextWidthRef.current, sizerWidth));
|
|
39
40
|
}, [
|
|
40
41
|
editing,
|
|
@@ -60,7 +61,8 @@ const Segment = ({ variant, children, className, editing, editText, onEditChange
|
|
|
60
61
|
onBlur: onEditBlur,
|
|
61
62
|
"aria-label": `Filter ${variant}`,
|
|
62
63
|
className: cn(segmentTextVariants({
|
|
63
|
-
variant
|
|
64
|
+
variant,
|
|
65
|
+
error
|
|
64
66
|
}), 'bg-transparent border-none outline-none p-0 m-0'),
|
|
65
67
|
style: {
|
|
66
68
|
width: `${inputWidth ?? Math.max(20, lastTextWidthRef.current)}px`
|
|
@@ -69,7 +71,8 @@ const Segment = ({ variant, children, className, editing, editText, onEditChange
|
|
|
69
71
|
/*#__PURE__*/ jsx("span", {
|
|
70
72
|
ref: sizerRef,
|
|
71
73
|
className: cn(segmentTextVariants({
|
|
72
|
-
variant
|
|
74
|
+
variant,
|
|
75
|
+
error
|
|
73
76
|
}), 'invisible absolute whitespace-pre'),
|
|
74
77
|
"aria-hidden": true,
|
|
75
78
|
children: editText || ' '
|
|
@@ -78,7 +81,8 @@ const Segment = ({ variant, children, className, editing, editText, onEditChange
|
|
|
78
81
|
}) : /*#__PURE__*/ jsx("p", {
|
|
79
82
|
ref: textRef,
|
|
80
83
|
className: segmentTextVariants({
|
|
81
|
-
variant
|
|
84
|
+
variant,
|
|
85
|
+
error
|
|
82
86
|
}),
|
|
83
87
|
children: children
|
|
84
88
|
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FC, FocusEvent, HTMLAttributes, KeyboardEvent } from 'react';
|
|
2
|
+
interface ValueSegmentProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: string;
|
|
4
|
+
error?: boolean;
|
|
5
|
+
/** Individual display parts for multi-value chips */
|
|
6
|
+
valueParts?: string[];
|
|
7
|
+
/** Separator between parts (default: ", ") */
|
|
8
|
+
valueSeparator?: string;
|
|
9
|
+
/** Indices of invalid values in valueParts */
|
|
10
|
+
errorValueIndices?: number[];
|
|
11
|
+
editing?: boolean;
|
|
12
|
+
editText?: string;
|
|
13
|
+
onEditChange?: (text: string) => void;
|
|
14
|
+
onEditKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
15
|
+
onEditBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const ValueSegment: FC<ValueSegmentProps>;
|
|
18
|
+
export {};
|