@wallarm-org/design-system 0.40.0-rc-feature-AS-982.7 → 0.40.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/DropdownMenu/DropdownMenuCheckboxItem.d.ts +15 -0
- package/dist/components/DropdownMenu/DropdownMenuCheckboxItem.js +32 -0
- package/dist/components/DropdownMenu/DropdownMenuContent.js +6 -2
- package/dist/components/DropdownMenu/DropdownMenuItemIndicator.d.ts +2 -0
- package/dist/components/DropdownMenu/DropdownMenuItemIndicator.js +14 -0
- package/dist/components/DropdownMenu/DropdownMenuRadioGroup.d.ts +9 -0
- package/dist/components/DropdownMenu/DropdownMenuRadioGroup.js +17 -0
- package/dist/components/DropdownMenu/DropdownMenuRadioItem.d.ts +13 -0
- package/dist/components/DropdownMenu/DropdownMenuRadioItem.js +28 -0
- package/dist/components/DropdownMenu/classes.d.ts +1 -0
- package/dist/components/DropdownMenu/classes.js +2 -1
- package/dist/components/DropdownMenu/index.d.ts +3 -0
- package/dist/components/DropdownMenu/index.js +4 -1
- package/dist/components/FilterInput/FilterInput.d.ts +8 -5
- package/dist/components/FilterInput/FilterInputContext/types.d.ts +9 -12
- package/dist/components/FilterInput/FilterInputContext/useFilterInputContextValue.d.ts +2 -4
- package/dist/components/FilterInput/FilterInputContext/useFilterInputContextValue.js +0 -4
- package/dist/components/FilterInput/FilterInputErrors/parseFilterInputErrors.js +2 -1
- package/dist/components/FilterInput/FilterInputField/ChipsWithGaps.d.ts +1 -1
- package/dist/components/FilterInput/FilterInputField/ChipsWithGaps.js +1 -1
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/FilterInputChip.d.ts +1 -1
- package/dist/components/FilterInput/FilterInputField/FilterInputChip/FilterInputChip.js +2 -2
- package/dist/components/FilterInput/FilterInputField/FilterInputField.js +40 -11
- package/dist/components/FilterInput/FilterInputMenu/FilterInputDateValueMenu/constants.d.ts +2 -2
- package/dist/components/FilterInput/FilterInputMenu/FilterInputFieldMenu/FilterInputFieldMenu.d.ts +1 -1
- package/dist/components/FilterInput/FilterInputMenu/FilterInputMenu.d.ts +1 -1
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/FilterInputValueMenu.d.ts +6 -5
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/useValueMenuDisplayValues.d.ts +14 -4
- package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/useValueMenuState.d.ts +5 -3
- package/dist/components/FilterInput/FilterInputMenu/hooks/useKeyboardNav.d.ts +1 -1
- package/dist/components/FilterInput/FilterInputMenu/hooks/useKeyboardNav.js +2 -5
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/{lib/deriveAutocompleteValues.d.ts → deriveAutocompleteValues.d.ts} +3 -3
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/{lib/deriveAutocompleteValues.js → deriveAutocompleteValues.js} +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useBlurCommit.d.ts +16 -5
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipActions.d.ts +2 -2
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipActions.js +5 -5
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipEditing.d.ts +8 -7
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipEditing.js +12 -15
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.d.ts +10 -9
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +83 -52
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFocusManagement.d.ts +11 -9
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFocusManagement.js +20 -47
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useInputHandlers.d.ts +4 -6
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useInputHandlers.js +15 -32
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/{useMenuFlow/types.d.ts → useMenuFlow.d.ts} +17 -14
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow.js +260 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuPositioning.d.ts +8 -25
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuPositioning.js +22 -39
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useResetState.d.ts +19 -10
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useResetState.js +3 -3
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/{lib/valueResolution.d.ts → valueCommitHelpers.d.ts} +7 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/{lib/valueResolution.js → valueCommitHelpers.js} +25 -3
- package/dist/components/FilterInput/hooks/useFilterInputExpression/buildChips.js +2 -1
- package/dist/components/FilterInput/hooks/useFilterInputPositioning.d.ts +4 -9
- package/dist/components/FilterInput/hooks/useFilterInputPositioning.js +6 -7
- package/dist/components/FilterInput/hooks/useFilterInputSelection/lib/dom.d.ts +4 -4
- package/dist/components/FilterInput/hooks/useFilterInputSelection/useFilterInputSelection.d.ts +2 -2
- package/dist/components/FilterInput/hooks/useFilterInputSelection/useSelectionClipboard.d.ts +5 -2
- package/dist/components/FilterInput/lib/applyAcceptChar.d.ts +4 -3
- package/dist/components/FilterInput/lib/applyKnownFieldHelpers.d.ts +25 -13
- package/dist/components/FilterInput/lib/constants.d.ts +34 -10
- package/dist/components/FilterInput/lib/dom.d.ts +11 -15
- package/dist/components/FilterInput/lib/dom.js +9 -14
- package/dist/components/FilterInput/lib/fields.d.ts +19 -10
- package/dist/components/FilterInput/lib/index.d.ts +1 -3
- package/dist/components/FilterInput/lib/index.js +2 -4
- package/dist/components/FilterInput/lib/menuFilterText.d.ts +17 -6
- package/dist/components/FilterInput/lib/operators.d.ts +21 -11
- package/dist/components/FilterInput/lib/serializeExpression.d.ts +12 -5
- package/dist/components/SimpleCharts/LineChart/LineChartLine.js +2 -6
- package/dist/components/SimpleCharts/LineChart/LineChartTooltip.js +3 -3
- package/dist/components/SimpleCharts/LineChart/LineChartXAxis.js +12 -3
- package/dist/components/SimpleCharts/LineChart/LineChartYAxis.js +6 -15
- package/dist/components/SimpleCharts/LineChart/LineChartZoomBrush.js +19 -8
- package/dist/components/SimpleCharts/LineChart/classes.js +1 -1
- package/dist/components/SimpleCharts/LineChart/constants.d.ts +1 -1
- package/dist/components/SimpleCharts/LineChart/constants.js +2 -2
- package/dist/components/SimpleCharts/LineChart/lib/formatRange.d.ts +5 -9
- package/dist/components/SimpleCharts/LineChart/lib/formatRange.js +1 -6
- package/dist/components/SimpleCharts/LineChart/lib/renderAxisTick.d.ts +13 -0
- package/dist/components/SimpleCharts/LineChart/lib/renderAxisTick.js +20 -0
- package/dist/components/SimpleCharts/LineChart/lib/sampleData.js +3 -3
- package/dist/components/SimpleCharts/hooks/useChartTimeFormatters.d.ts +0 -5
- package/dist/components/SimpleCharts/hooks/useChartTimeFormatters.js +1 -2
- package/dist/metadata/components.json +901 -9
- package/package.json +1 -1
- package/dist/components/FilterInput/FilterInputField/hooks/useSegmentEditKeyboard.d.ts +0 -37
- package/dist/components/FilterInput/FilterInputField/hooks/useSegmentEditKeyboard.js +0 -78
- package/dist/components/FilterInput/hooks/useAutoCleanupDetachedElement.d.ts +0 -12
- package/dist/components/FilterInput/hooks/useAutoCleanupDetachedElement.js +0 -22
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/lib/getInitialSegmentText.d.ts +0 -9
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/lib/getInitialSegmentText.js +0 -8
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/lib/index.d.ts +0 -3
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/lib/index.js +0 -4
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useAutocompleteState.d.ts +0 -36
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useAutocompleteState.js +0 -51
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipCascade.d.ts +0 -46
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useChipCascade.js +0 -103
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/index.d.ts +0 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/index.js +0 -2
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/types.js +0 -0
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/useFieldFlow.d.ts +0 -11
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/useFieldFlow.js +0 -95
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/useMenuFlow.d.ts +0 -20
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/useMenuFlow.js +0 -45
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/useOperatorFlow.d.ts +0 -11
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/useOperatorFlow.js +0 -87
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/useValueFlow.d.ts +0 -14
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useMenuFlow/useValueFlow.js +0 -107
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useSegmentEditFlow.d.ts +0 -36
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useSegmentEditFlow.js +0 -69
- package/dist/components/FilterInput/hooks/useFloatingRecomputeOn.d.ts +0 -14
- package/dist/components/FilterInput/hooks/useFloatingRecomputeOn.js +0 -18
- package/dist/components/FilterInput/hooks/useResizeTracker.d.ts +0 -10
- package/dist/components/FilterInput/hooks/useResizeTracker.js +0 -21
- package/dist/components/FilterInput/lib/segmentMenu.d.ts +0 -4
- package/dist/components/FilterInput/lib/segmentMenu.js +0 -7
- package/dist/components/FilterInput/lib/validation.d.ts +0 -9
- package/dist/components/FilterInput/lib/validation.js +0 -24
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type FC, type HTMLAttributes, type Ref } from 'react';
|
|
2
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { dropdownMenuItemVariants } from './classes';
|
|
4
|
+
type DropdownMenuCheckboxItemVariantsProps = VariantProps<typeof dropdownMenuItemVariants>;
|
|
5
|
+
export interface DropdownMenuCheckboxItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id'>, DropdownMenuCheckboxItemVariantsProps {
|
|
6
|
+
checked: boolean;
|
|
7
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
8
|
+
/** Optional — auto-generated via useId() if omitted */
|
|
9
|
+
value?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
closeOnSelect?: boolean;
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
}
|
|
14
|
+
export declare const DropdownMenuCheckboxItem: FC<DropdownMenuCheckboxItemProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { Menu } from "@ark-ui/react/menu";
|
|
4
|
+
import { Check } from "../../icons/index.js";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { useTestId } from "../../utils/testId.js";
|
|
7
|
+
import { dropdownMenuItemVariants } from "./classes.js";
|
|
8
|
+
import { DropdownMenuItemIndicator } from "./DropdownMenuItemIndicator.js";
|
|
9
|
+
const DropdownMenuCheckboxItem = ({ children, checked, onCheckedChange, value, disabled, closeOnSelect, variant = 'default', className, ...props })=>{
|
|
10
|
+
const autoId = useId();
|
|
11
|
+
const testId = useTestId('checkbox-item');
|
|
12
|
+
return /*#__PURE__*/ jsxs(Menu.CheckboxItem, {
|
|
13
|
+
...props,
|
|
14
|
+
value: value ?? autoId,
|
|
15
|
+
checked: checked,
|
|
16
|
+
onCheckedChange: onCheckedChange,
|
|
17
|
+
disabled: disabled,
|
|
18
|
+
closeOnSelect: closeOnSelect ?? false,
|
|
19
|
+
"data-testid": testId,
|
|
20
|
+
className: cn(dropdownMenuItemVariants({
|
|
21
|
+
variant
|
|
22
|
+
}), className),
|
|
23
|
+
children: [
|
|
24
|
+
children,
|
|
25
|
+
/*#__PURE__*/ jsx(DropdownMenuItemIndicator, {
|
|
26
|
+
children: /*#__PURE__*/ jsx(Check, {})
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
DropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem';
|
|
32
|
+
export { DropdownMenuCheckboxItem };
|
|
@@ -3,13 +3,14 @@ import { Children, isValidElement } from "react";
|
|
|
3
3
|
import { Menu } from "@ark-ui/react/menu";
|
|
4
4
|
import { Portal } from "@ark-ui/react/portal";
|
|
5
5
|
import { cn } from "../../utils/cn.js";
|
|
6
|
-
import { useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { TestIdProvider, useTestId } from "../../utils/testId.js";
|
|
7
7
|
import { ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaScrollbar, ScrollAreaViewport } from "../ScrollArea/index.js";
|
|
8
8
|
import { dropdownMenuClassNames } from "./classes.js";
|
|
9
9
|
import { DropdownMenuFooter } from "./DropdownMenuFooter.js";
|
|
10
10
|
import { DropdownMenuInput } from "./DropdownMenuInput.js";
|
|
11
11
|
const DropdownMenuContent = ({ className, children, ref, ...props })=>{
|
|
12
12
|
const testId = useTestId('content');
|
|
13
|
+
const cascadeBase = useTestId();
|
|
13
14
|
const childArray = Children.toArray(children);
|
|
14
15
|
const inputChildren = childArray.filter((child)=>/*#__PURE__*/ isValidElement(child) && child.type === DropdownMenuInput);
|
|
15
16
|
const footerChildren = childArray.filter((child)=>/*#__PURE__*/ isValidElement(child) && child.type === DropdownMenuFooter);
|
|
@@ -32,7 +33,10 @@ const DropdownMenuContent = ({ className, children, ref, ...props })=>{
|
|
|
32
33
|
/*#__PURE__*/ jsx(ScrollAreaViewport, {
|
|
33
34
|
children: /*#__PURE__*/ jsx(ScrollAreaContent, {
|
|
34
35
|
className: cn('flex flex-col gap-1 !min-w-0'),
|
|
35
|
-
children:
|
|
36
|
+
children: /*#__PURE__*/ jsx(TestIdProvider, {
|
|
37
|
+
value: cascadeBase,
|
|
38
|
+
children: menuChildren
|
|
39
|
+
})
|
|
36
40
|
})
|
|
37
41
|
}),
|
|
38
42
|
/*#__PURE__*/ jsx(ScrollAreaScrollbar, {}),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Menu } from "@ark-ui/react/menu";
|
|
3
|
+
import { useTestId } from "../../utils/testId.js";
|
|
4
|
+
import { dropdownMenuItemIndicatorClassName } from "./classes.js";
|
|
5
|
+
const DropdownMenuItemIndicator = ({ children })=>{
|
|
6
|
+
const testId = useTestId('item-indicator');
|
|
7
|
+
return /*#__PURE__*/ jsx(Menu.ItemIndicator, {
|
|
8
|
+
"data-testid": testId,
|
|
9
|
+
className: dropdownMenuItemIndicatorClassName,
|
|
10
|
+
children: children
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
DropdownMenuItemIndicator.displayName = 'DropdownMenuItemIndicator';
|
|
14
|
+
export { DropdownMenuItemIndicator };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type FC, type HTMLAttributes, type Ref } from 'react';
|
|
2
|
+
export interface DropdownMenuRadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
3
|
+
value?: string;
|
|
4
|
+
onValueChange?: (details: {
|
|
5
|
+
value: string;
|
|
6
|
+
}) => void;
|
|
7
|
+
ref?: Ref<HTMLDivElement>;
|
|
8
|
+
}
|
|
9
|
+
export declare const DropdownMenuRadioGroup: FC<DropdownMenuRadioGroupProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { Menu } from "@ark-ui/react/menu";
|
|
4
|
+
import { useTestId } from "../../utils/testId.js";
|
|
5
|
+
const DropdownMenuRadioGroup = ({ value, onValueChange, ...props })=>{
|
|
6
|
+
const id = useId();
|
|
7
|
+
const testId = useTestId('radio-group');
|
|
8
|
+
return /*#__PURE__*/ jsx(Menu.RadioItemGroup, {
|
|
9
|
+
...props,
|
|
10
|
+
id: id,
|
|
11
|
+
value: value,
|
|
12
|
+
onValueChange: onValueChange,
|
|
13
|
+
"data-testid": testId
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
DropdownMenuRadioGroup.displayName = 'DropdownMenuRadioGroup';
|
|
17
|
+
export { DropdownMenuRadioGroup };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { dropdownMenuItemVariants } from './classes';
|
|
4
|
+
type DropdownMenuRadioItemVariantsProps = VariantProps<typeof dropdownMenuItemVariants>;
|
|
5
|
+
export interface DropdownMenuRadioItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id'>, DropdownMenuRadioItemVariantsProps {
|
|
6
|
+
/** Required — identifies this radio within the group */
|
|
7
|
+
value: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
closeOnSelect?: boolean;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
export declare const DropdownMenuRadioItem: FC<DropdownMenuRadioItemProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Menu } from "@ark-ui/react/menu";
|
|
3
|
+
import { Check } from "../../icons/index.js";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { dropdownMenuItemVariants } from "./classes.js";
|
|
7
|
+
import { DropdownMenuItemIndicator } from "./DropdownMenuItemIndicator.js";
|
|
8
|
+
const DropdownMenuRadioItem = ({ children, value, disabled, closeOnSelect, variant = 'default', className, ...props })=>{
|
|
9
|
+
const testId = useTestId('radio-item');
|
|
10
|
+
return /*#__PURE__*/ jsxs(Menu.RadioItem, {
|
|
11
|
+
...props,
|
|
12
|
+
value: value,
|
|
13
|
+
disabled: disabled,
|
|
14
|
+
closeOnSelect: closeOnSelect ?? false,
|
|
15
|
+
"data-testid": testId,
|
|
16
|
+
className: cn(dropdownMenuItemVariants({
|
|
17
|
+
variant
|
|
18
|
+
}), className),
|
|
19
|
+
children: [
|
|
20
|
+
children,
|
|
21
|
+
/*#__PURE__*/ jsx(DropdownMenuItemIndicator, {
|
|
22
|
+
children: /*#__PURE__*/ jsx(Check, {})
|
|
23
|
+
})
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
DropdownMenuRadioItem.displayName = 'DropdownMenuRadioItem';
|
|
28
|
+
export { DropdownMenuRadioItem };
|
|
@@ -3,6 +3,7 @@ export declare const dropdownMenuItemVariants: (props?: ({
|
|
|
3
3
|
variant?: "destructive" | "brand" | "default" | null | undefined;
|
|
4
4
|
inset?: boolean | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export declare const dropdownMenuItemIndicatorClassName: string;
|
|
6
7
|
export declare const dropdownMenuLabelVariants: (props?: ({
|
|
7
8
|
inset?: boolean | null | undefined;
|
|
8
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -18,6 +18,7 @@ const dropdownMenuItemVariants = cva([
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
+
const dropdownMenuItemIndicatorClassName = cn('ml-auto flex items-center justify-center', 'size-16 shrink-0', '[&_svg]:icon-md [&_svg]:shrink-0 [&_svg]:text-current');
|
|
21
22
|
const dropdownMenuLabelVariants = cva('flex justify-between gap-8 px-8 pt-8 pb-2 text-xs font-medium text-text-secondary', {
|
|
22
23
|
variants: {
|
|
23
24
|
inset: {
|
|
@@ -25,4 +26,4 @@ const dropdownMenuLabelVariants = cva('flex justify-between gap-8 px-8 pt-8 pb-2
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
|
-
export { dropdownMenuClassNames, dropdownMenuItemVariants, dropdownMenuLabelVariants };
|
|
29
|
+
export { dropdownMenuClassNames, dropdownMenuItemIndicatorClassName, dropdownMenuItemVariants, dropdownMenuLabelVariants };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { dropdownMenuClassNames, dropdownMenuItemVariants, dropdownMenuLabelVariants, } from './classes';
|
|
2
2
|
export { DropdownMenu } from './DropdownMenu';
|
|
3
|
+
export { DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, } from './DropdownMenuCheckboxItem';
|
|
3
4
|
export { DropdownMenuContent } from './DropdownMenuContent';
|
|
4
5
|
export { DropdownMenuContextTrigger } from './DropdownMenuContextTrigger';
|
|
5
6
|
export { DropdownMenuFooter } from './DropdownMenuFooter';
|
|
@@ -11,6 +12,8 @@ export { DropdownMenuItemDescription } from './DropdownMenuItemDescription';
|
|
|
11
12
|
export { DropdownMenuItemIcon } from './DropdownMenuItemIcon';
|
|
12
13
|
export { DropdownMenuItemText } from './DropdownMenuItemText';
|
|
13
14
|
export { DropdownMenuLabel } from './DropdownMenuLabel';
|
|
15
|
+
export { DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, } from './DropdownMenuRadioGroup';
|
|
16
|
+
export { DropdownMenuRadioItem, type DropdownMenuRadioItemProps, } from './DropdownMenuRadioItem';
|
|
14
17
|
export { DropdownMenuSeparator } from './DropdownMenuSeparator';
|
|
15
18
|
export { DropdownMenuShortcut } from './DropdownMenuShortcut';
|
|
16
19
|
export { DropdownMenuTrigger } from './DropdownMenuTrigger';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dropdownMenuClassNames, dropdownMenuItemVariants, dropdownMenuLabelVariants } from "./classes.js";
|
|
2
2
|
import { DropdownMenu } from "./DropdownMenu.js";
|
|
3
|
+
import { DropdownMenuCheckboxItem } from "./DropdownMenuCheckboxItem.js";
|
|
3
4
|
import { DropdownMenuContent } from "./DropdownMenuContent.js";
|
|
4
5
|
import { DropdownMenuContextTrigger } from "./DropdownMenuContextTrigger.js";
|
|
5
6
|
import { DropdownMenuFooter } from "./DropdownMenuFooter.js";
|
|
@@ -11,8 +12,10 @@ import { DropdownMenuItemDescription } from "./DropdownMenuItemDescription.js";
|
|
|
11
12
|
import { DropdownMenuItemIcon } from "./DropdownMenuItemIcon.js";
|
|
12
13
|
import { DropdownMenuItemText } from "./DropdownMenuItemText.js";
|
|
13
14
|
import { DropdownMenuLabel } from "./DropdownMenuLabel.js";
|
|
15
|
+
import { DropdownMenuRadioGroup } from "./DropdownMenuRadioGroup.js";
|
|
16
|
+
import { DropdownMenuRadioItem } from "./DropdownMenuRadioItem.js";
|
|
14
17
|
import { DropdownMenuSeparator } from "./DropdownMenuSeparator.js";
|
|
15
18
|
import { DropdownMenuShortcut } from "./DropdownMenuShortcut.js";
|
|
16
19
|
import { DropdownMenuTrigger } from "./DropdownMenuTrigger.js";
|
|
17
20
|
import { DropdownMenuTriggerItem } from "./DropdownMenuTriggerItem.js";
|
|
18
|
-
export { DropdownMenu, DropdownMenuContent, DropdownMenuContextTrigger, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuInput, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDescription, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem, dropdownMenuClassNames, dropdownMenuItemVariants, dropdownMenuLabelVariants };
|
|
21
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuContextTrigger, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuInput, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDescription, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, DropdownMenuTriggerItem, dropdownMenuClassNames, dropdownMenuItemVariants, dropdownMenuLabelVariants };
|
|
@@ -2,15 +2,18 @@ import type { FC, HTMLAttributes } from 'react';
|
|
|
2
2
|
import type { ExprNode, FieldMetadata } from './types';
|
|
3
3
|
export interface FilterInputProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange'> {
|
|
4
4
|
/**
|
|
5
|
-
* Filter-field configurations driving the autocomplete.
|
|
6
|
-
* **reserved** and auto-wired
|
|
7
|
-
*
|
|
5
|
+
* Filter-field configurations driving the autocomplete. Most fields are
|
|
6
|
+
* passed through as-is, but a few names are **reserved** and auto-wired
|
|
7
|
+
* with design-system helpers (`acceptChar` / `normalize` / `getSuggestions`
|
|
8
|
+
* / `validate`). Current reserved names:
|
|
8
9
|
*
|
|
9
10
|
* - `status_code` — HTTP status code field (mask suggestions, format
|
|
10
11
|
* validation, digit-or-X input filter, partial-input normalization).
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* Consumer-supplied callbacks always override the auto-wiring, so you can
|
|
14
|
+
* opt out per-field. For the same helpers on a field with a different
|
|
15
|
+
* `name`, import the factories (`createStatusCodeSuggestions`, …) and
|
|
16
|
+
* attach them manually.
|
|
14
17
|
*/
|
|
15
18
|
fields?: FieldMetadata[];
|
|
16
19
|
value?: ExprNode | null;
|
|
@@ -22,13 +22,10 @@ export interface FilterInputContextValue {
|
|
|
22
22
|
onInputKeyDown: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
23
23
|
onInputClick: () => void;
|
|
24
24
|
onGapClick: (conditionIndex: number, afterConnector: boolean) => void;
|
|
25
|
-
onChipClick: (chipId: string, segment: ChipSegment,
|
|
26
|
-
/** Click on a
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onSwitchEditSegment: (targetSegment: ChipSegment) => boolean;
|
|
30
|
-
/** Remove the inline-edited chip — Backspace on empty attribute w/o op/value. */
|
|
31
|
-
onRemoveEditingChip: () => void;
|
|
25
|
+
onChipClick: (chipId: string, segment: ChipSegment, anchorRect: DOMRect) => void;
|
|
26
|
+
/** Click on a segment of the *building* (in-progress) chip — re-opens the
|
|
27
|
+
* corresponding menu and enters inline-edit without committing the chip. */
|
|
28
|
+
onBuildingChipClick: (segment: ChipSegment, anchorRect: DOMRect) => void;
|
|
32
29
|
onConnectorChange: (chipId: string, value: 'and' | 'or') => void;
|
|
33
30
|
onChipRemove: (chipId: string) => void;
|
|
34
31
|
onClear: () => void;
|
|
@@ -42,14 +39,14 @@ export interface FilterInputContextValue {
|
|
|
42
39
|
onCustomOperatorCommit: (customText: string) => void;
|
|
43
40
|
/** Ref to the currently open menu content element */
|
|
44
41
|
menuRef: RefObject<HTMLDivElement | null>;
|
|
45
|
-
/** Close autocomplete menu (connector chip
|
|
42
|
+
/** Close autocomplete menu (used by connector chip to enforce single-dropdown constraint) */
|
|
46
43
|
closeAutocompleteMenu: () => void;
|
|
47
|
-
/** Register/unregister a chip DOM element for selection tracking
|
|
44
|
+
/** Register/unregister a chip DOM element for selection tracking */
|
|
48
45
|
registerChipRef: (id: string, el: HTMLElement | null) => void;
|
|
49
|
-
/**
|
|
46
|
+
/** Direct ref to the attribute segment <input> — attached by Segment when editing. */
|
|
50
47
|
segmentAttributeInputRef: RefObject<HTMLInputElement | null>;
|
|
51
|
-
/**
|
|
48
|
+
/** Direct ref to the operator segment <input> — attached by Segment when editing. */
|
|
52
49
|
segmentOperatorInputRef: RefObject<HTMLInputElement | null>;
|
|
53
|
-
/**
|
|
50
|
+
/** Direct ref to the value segment <input> — attached by Segment when editing. */
|
|
54
51
|
segmentValueInputRef: RefObject<HTMLInputElement | null>;
|
|
55
52
|
}
|
|
@@ -9,10 +9,8 @@ interface AutocompleteForContext {
|
|
|
9
9
|
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
10
|
handleKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
11
11
|
handleInputClick: () => void;
|
|
12
|
-
handleChipClick: (chipId: string, segment: ChipSegment,
|
|
13
|
-
handleBuildingChipClick: (segment: ChipSegment,
|
|
14
|
-
switchEditSegment: (targetSegment: ChipSegment) => boolean;
|
|
15
|
-
removeEditingChip: () => void;
|
|
12
|
+
handleChipClick: (chipId: string, segment: ChipSegment, anchorRect: DOMRect) => void;
|
|
13
|
+
handleBuildingChipClick: (segment: ChipSegment, anchorRect: DOMRect) => void;
|
|
16
14
|
handleConnectorChange: (chipId: string, value: 'and' | 'or') => void;
|
|
17
15
|
handleChipRemove: (chipId: string) => void;
|
|
18
16
|
handleClear: () => void;
|
|
@@ -17,8 +17,6 @@ const useFilterInputContextValue = ({ chips, autocomplete, buildingChipRef, inpu
|
|
|
17
17
|
onInputClick: autocomplete.handleInputClick,
|
|
18
18
|
onChipClick: autocomplete.handleChipClick,
|
|
19
19
|
onBuildingChipClick: autocomplete.handleBuildingChipClick,
|
|
20
|
-
onSwitchEditSegment: autocomplete.switchEditSegment,
|
|
21
|
-
onRemoveEditingChip: autocomplete.removeEditingChip,
|
|
22
20
|
onConnectorChange: autocomplete.handleConnectorChange,
|
|
23
21
|
onChipRemove: autocomplete.handleChipRemove,
|
|
24
22
|
onClear: autocomplete.handleClear,
|
|
@@ -49,8 +47,6 @@ const useFilterInputContextValue = ({ chips, autocomplete, buildingChipRef, inpu
|
|
|
49
47
|
autocomplete.handleInputClick,
|
|
50
48
|
autocomplete.handleChipClick,
|
|
51
49
|
autocomplete.handleBuildingChipClick,
|
|
52
|
-
autocomplete.switchEditSegment,
|
|
53
|
-
autocomplete.removeEditingChip,
|
|
54
50
|
autocomplete.handleConnectorChange,
|
|
55
51
|
autocomplete.handleChipRemove,
|
|
56
52
|
autocomplete.handleClear,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SEGMENT_VARIANT } from "../FilterInputField/FilterInputChip/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isValidFieldValue } from "../hooks/useFilterInputAutocomplete/valueCommitHelpers.js";
|
|
3
|
+
import { getFieldValues, hasStaticAllowlist } from "../lib/index.js";
|
|
3
4
|
const parseFilterInputErrors = (conditions, fields)=>{
|
|
4
5
|
const errors = [];
|
|
5
6
|
for (const condition of conditions){
|
|
@@ -5,7 +5,7 @@ interface ChipsWithGapsProps {
|
|
|
5
5
|
chips: FilterInputChipData[];
|
|
6
6
|
hideLeadingGap?: boolean;
|
|
7
7
|
hideTrailingGap?: boolean;
|
|
8
|
-
onChipClick: (chipId: string, segment: ChipSegment,
|
|
8
|
+
onChipClick: (chipId: string, segment: ChipSegment, anchorRect: DOMRect) => void;
|
|
9
9
|
onConnectorChange: (chipId: string, value: 'and' | 'or') => void;
|
|
10
10
|
onChipRemove: (chipId: string) => void;
|
|
11
11
|
onGapClick: (conditionIndex: number, afterConnector: boolean) => void;
|
|
@@ -30,7 +30,7 @@ const ChipsWithGaps = ({ chips, hideLeadingGap, hideTrailingGap, onChipClick, on
|
|
|
30
30
|
errorValueIndices: chip.errorValueIndices,
|
|
31
31
|
disabled: chip.disabled,
|
|
32
32
|
onRemove: chip.disabled ? void 0 : ()=>onChipRemove(chip.id),
|
|
33
|
-
onSegmentClick: chip.disabled ? void 0 : (segment,
|
|
33
|
+
onSegmentClick: chip.disabled ? void 0 : (segment, anchorRect)=>onChipClick(chip.id, segment, anchorRect)
|
|
34
34
|
})
|
|
35
35
|
}, chip.id));
|
|
36
36
|
else if (isConnector) {
|
|
@@ -16,6 +16,6 @@ export interface FilterInputChipProps extends Omit<HTMLAttributes<HTMLDivElement
|
|
|
16
16
|
/** When true, the chip cannot be edited or removed (dimmed appearance) */
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
onRemove?: () => void;
|
|
19
|
-
onSegmentClick?: (segment: ChipSegment,
|
|
19
|
+
onSegmentClick?: (segment: ChipSegment, anchorRect: DOMRect) => void;
|
|
20
20
|
}
|
|
21
21
|
export declare const FilterInputChip: FC<FilterInputChipProps>;
|
|
@@ -18,9 +18,9 @@ const FilterInputChip = ({ ref, chipId, attribute, operator, value, error = fals
|
|
|
18
18
|
if (!onSegmentClick) return;
|
|
19
19
|
if (activeSegment === segment) return;
|
|
20
20
|
e.stopPropagation();
|
|
21
|
-
const anchorEl = internalRef.current;
|
|
21
|
+
const anchorEl = segment === SEGMENT_VARIANT.attribute ? internalRef.current : e.currentTarget;
|
|
22
22
|
if (!anchorEl) return;
|
|
23
|
-
onSegmentClick(segment, anchorEl);
|
|
23
|
+
onSegmentClick(segment, anchorEl.getBoundingClientRect());
|
|
24
24
|
}, [
|
|
25
25
|
onSegmentClick,
|
|
26
26
|
activeSegment
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
2
3
|
import { cn } from "../../../utils/cn.js";
|
|
3
4
|
import { inputVariants } from "../../Input/classes.js";
|
|
4
5
|
import { ScrollArea, ScrollAreaScrollbar, ScrollAreaViewport } from "../../ScrollArea/index.js";
|
|
5
6
|
import { useFilterInputContext } from "../FilterInputContext/index.js";
|
|
7
|
+
import { isMenuRelated } from "../lib/index.js";
|
|
6
8
|
import { ChipsWithGaps, TrailingGap } from "./ChipsWithGaps.js";
|
|
7
9
|
import { ACTIONS_PADDING, COLLAPSED_MAX_HEIGHT, filterInputContainerVariants, filterInputInnerVariants } from "./classes.js";
|
|
8
10
|
import { EditingProvider } from "./FilterInputChip/context/EditingContext.js";
|
|
9
11
|
import { FilterInputChip } from "./FilterInputChip/FilterInputChip.js";
|
|
12
|
+
import { SEGMENT_VARIANT } from "./FilterInputChip/segmentVariant.js";
|
|
10
13
|
import { FilterInputFieldActions } from "./FilterInputFieldActions.js";
|
|
11
14
|
import { FilterInputSearch } from "./FilterInputSearch.js";
|
|
12
15
|
import { useChipsSplitting } from "./hooks/useChipsSplitting.js";
|
|
13
16
|
import { useExpandCollapse } from "./hooks/useExpandCollapse.js";
|
|
14
|
-
import { useSegmentEditKeyboard } from "./hooks/useSegmentEditKeyboard.js";
|
|
15
17
|
const FilterInputField = ({ className, ...props })=>{
|
|
16
|
-
const { chips, buildingChipData, buildingChipRef, insertIndex, insertAfterConnector, error, onInputClick, onGapClick, onChipClick, onBuildingChipClick, onConnectorChange, onChipRemove, editingChipId, editingSegment, segmentFilterText, onSegmentFilterChange, onCancelSegmentEdit, onCustomValueCommit, onCustomAttributeCommit, onCustomOperatorCommit,
|
|
18
|
+
const { chips, buildingChipData, buildingChipRef, insertIndex, insertAfterConnector, error, onInputClick, onGapClick, onChipClick, onBuildingChipClick, onConnectorChange, onChipRemove, editingChipId, editingSegment, segmentFilterText, onSegmentFilterChange, onCancelSegmentEdit, onCustomValueCommit, onCustomAttributeCommit, onCustomOperatorCommit, menuRef } = useFilterInputContext();
|
|
17
19
|
const hasContent = chips.length > 0 || null != buildingChipData;
|
|
18
20
|
const { isExpanded, isOverflowing, innerRef, toggleExpand, multiRow } = useExpandCollapse();
|
|
19
21
|
const { chipsBefore, chipsAfter, hideTrailingGap, hideLeadingGap } = useChipsSplitting(chips, insertIndex, insertAfterConnector);
|
|
@@ -23,20 +25,47 @@ const FilterInputField = ({ className, ...props })=>{
|
|
|
23
25
|
onChipRemove,
|
|
24
26
|
onGapClick
|
|
25
27
|
};
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
+
const handleSegmentEditKeyDown = useCallback((e)=>{
|
|
29
|
+
if ('Escape' === e.key) {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
onCancelSegmentEdit();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if ('Enter' === e.key && !e.defaultPrevented) {
|
|
35
|
+
if (editingSegment === SEGMENT_VARIANT.value) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
onCustomValueCommit(segmentFilterText);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (editingSegment === SEGMENT_VARIANT.attribute) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
onCustomAttributeCommit(segmentFilterText);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (editingSegment === SEGMENT_VARIANT.operator) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
onCustomOperatorCommit(segmentFilterText);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if ('ArrowDown' === e.key) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
menuRef.current?.focus();
|
|
54
|
+
}
|
|
55
|
+
}, [
|
|
56
|
+
onCancelSegmentEdit,
|
|
28
57
|
editingSegment,
|
|
29
58
|
segmentFilterText,
|
|
30
|
-
chips,
|
|
31
|
-
buildingChipData,
|
|
32
|
-
menuRef,
|
|
33
|
-
onCancelSegmentEdit,
|
|
34
59
|
onCustomValueCommit,
|
|
35
60
|
onCustomAttributeCommit,
|
|
36
61
|
onCustomOperatorCommit,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
62
|
+
menuRef
|
|
63
|
+
]);
|
|
64
|
+
const handleSegmentEditBlur = useCallback((e)=>{
|
|
65
|
+
if (!isMenuRelated(e.relatedTarget)) onCancelSegmentEdit();
|
|
66
|
+
}, [
|
|
67
|
+
onCancelSegmentEdit
|
|
68
|
+
]);
|
|
40
69
|
return /*#__PURE__*/ jsx(EditingProvider, {
|
|
41
70
|
editingChipId: editingChipId,
|
|
42
71
|
editingSegment: editingSegment,
|
|
@@ -10,8 +10,8 @@ export interface DatePreset {
|
|
|
10
10
|
export declare const DATE_PRESETS: DatePreset[];
|
|
11
11
|
/** Check if a value string is a relative date preset (e.g. "30m", "7d") */
|
|
12
12
|
export declare const isDatePreset: (value: string) => boolean;
|
|
13
|
-
/** Format a date string for chip display (e.g. "Mar 4, 2026").
|
|
14
|
-
*
|
|
13
|
+
/** Format a date string for chip display (e.g. "Mar 4, 2026").
|
|
14
|
+
* Handles both ISO (YYYY-MM-DD, parsed as UTC) and locale formats (parsed as local time). */
|
|
15
15
|
export declare const formatDateForChip: (value: string) => string;
|
|
16
16
|
/** Get display label for a date value — preset label or formatted date */
|
|
17
17
|
export declare const getDateDisplayLabel: (value: string) => string;
|
package/dist/components/FilterInput/FilterInputMenu/FilterInputFieldMenu/FilterInputFieldMenu.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface FilterInputFieldMenuProps {
|
|
|
16
16
|
positioning?: Record<string, unknown>;
|
|
17
17
|
/** Ref to the query bar input — ArrowUp on first item returns focus here */
|
|
18
18
|
inputRef?: RefObject<HTMLInputElement | null>;
|
|
19
|
-
/** Ref to the menu content
|
|
19
|
+
/** Ref to the menu content element — shared across menus for focus management */
|
|
20
20
|
menuRef?: RefObject<HTMLDivElement | null>;
|
|
21
21
|
className?: string;
|
|
22
22
|
}
|
|
@@ -24,7 +24,7 @@ export interface FilterInputAutocompleteState {
|
|
|
24
24
|
segmentFilterText: string;
|
|
25
25
|
segmentMenuFilterText: string;
|
|
26
26
|
editingSegment: ChipSegment | null;
|
|
27
|
-
/**
|
|
27
|
+
/** Ref for multi-select blur commit — set by value menu, called by blur handler */
|
|
28
28
|
blurCommitRef: RefObject<(() => boolean) | null>;
|
|
29
29
|
}
|
|
30
30
|
export interface FilterInputMenuProps {
|
package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/FilterInputValueMenu.d.ts
CHANGED
|
@@ -23,15 +23,16 @@ export interface FilterInputValueMenuProps {
|
|
|
23
23
|
width?: 'standard' | 'compact' | number;
|
|
24
24
|
positioning?: Record<string, unknown>;
|
|
25
25
|
onBuildingValueChange?: (preview: string | undefined) => void;
|
|
26
|
-
/** Fires
|
|
26
|
+
/** Fires on explicit multi-select toggle (click or keyboard) — use to react
|
|
27
|
+
* only to user-initiated toggles, not to initialization. */
|
|
27
28
|
onItemToggle?: () => void;
|
|
28
|
-
/**
|
|
29
|
+
/** Ref to the query bar input — ArrowUp on first item returns focus here */
|
|
29
30
|
inputRef?: RefObject<HTMLInputElement | null>;
|
|
30
|
-
/**
|
|
31
|
+
/** Text to filter values by label */
|
|
31
32
|
filterText?: string;
|
|
32
|
-
/**
|
|
33
|
+
/** Ref to the menu content element — shared across menus for focus management */
|
|
33
34
|
menuRef?: RefObject<HTMLDivElement | null>;
|
|
34
|
-
/**
|
|
35
|
+
/** Ref set by this component to allow blur handler to commit multi-select values */
|
|
35
36
|
blurCommitRef?: RefObject<(() => boolean) | null>;
|
|
36
37
|
className?: string;
|
|
37
38
|
}
|
|
@@ -12,10 +12,20 @@ interface UseValueMenuDisplayValuesOptions {
|
|
|
12
12
|
highlightValue?: ConditionValue;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Compose the dropdown list
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Compose the final dropdown list shown to the user.
|
|
16
|
+
*
|
|
17
|
+
* The parent helper (`values`) is free to change shape between renders — for
|
|
18
|
+
* instance a dynamic `getSuggestions` may narrow its result after a selection
|
|
19
|
+
* is made. This hook keeps the user's currently-selected entries pinned at
|
|
20
|
+
* the top of the list with a stable presentation:
|
|
21
|
+
*
|
|
22
|
+
* 1. Every option the menu has ever rendered is remembered in a `Map` keyed
|
|
23
|
+
* by value. When a selected entry is no longer in the current `values`,
|
|
24
|
+
* the remembered option (with its original label/badge) is used.
|
|
25
|
+
* 2. If nothing has been seen for that value either, a plain-text option is
|
|
26
|
+
* fabricated so the user can still see and toggle it.
|
|
27
|
+
* 3. Unchecked items come from `filteredValues` (already filter-sorted) so
|
|
28
|
+
* the search query still applies to them.
|
|
19
29
|
*/
|
|
20
30
|
export declare const useValueMenuDisplayValues: ({ values, filteredValues, multiSelect, checkedValues, highlightValue, }: UseValueMenuDisplayValuesOptions) => ValueOption[];
|
|
21
31
|
export {};
|
package/dist/components/FilterInput/FilterInputMenu/FilterInputValueMenu/useValueMenuState.d.ts
CHANGED
|
@@ -13,12 +13,14 @@ interface UseValueMenuStateOptions {
|
|
|
13
13
|
onEscape?: () => void;
|
|
14
14
|
onOpenChange?: (open: boolean) => void;
|
|
15
15
|
onBuildingValueChange?: (preview: string | undefined) => void;
|
|
16
|
-
/** Fires
|
|
17
|
-
* onBuildingValueChange which also fires
|
|
16
|
+
/** Fires whenever the user explicitly toggles an item in multi-select mode
|
|
17
|
+
* (click or keyboard). Distinct from onBuildingValueChange, which also fires
|
|
18
|
+
* on mount with the initial preview — use this when you need to react only
|
|
19
|
+
* to actual user-initiated toggles. */
|
|
18
20
|
onItemToggle?: () => void;
|
|
19
21
|
inputRef?: RefObject<HTMLInputElement | null>;
|
|
20
22
|
menuRef?: RefObject<HTMLDivElement | null>;
|
|
21
|
-
/**
|
|
23
|
+
/** Ref to register blur commit function — called by blur handler before state reset. Returns true if committed. */
|
|
22
24
|
blurCommitRef?: RefObject<(() => boolean) | null>;
|
|
23
25
|
}
|
|
24
26
|
export declare const useValueMenuState: ({ values, open, multiSelect, initialValues, highlightValue, onSelect, onCommit, onEscape, onOpenChange, onBuildingValueChange, onItemToggle, inputRef, menuRef, blurCommitRef, }: UseValueMenuStateOptions) => {
|
|
@@ -12,7 +12,7 @@ interface UseKeyboardNavOptions {
|
|
|
12
12
|
arrowRightSelectsActive?: boolean;
|
|
13
13
|
/** When provided, ArrowUp on the first item returns focus to this input */
|
|
14
14
|
inputRef?: RefObject<HTMLInputElement | null>;
|
|
15
|
-
/** Ref to the menu content element for scoped queries
|
|
15
|
+
/** Ref to the menu content element — used for scoped queries and focus management */
|
|
16
16
|
menuRef?: RefObject<HTMLDivElement | null>;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
@@ -141,11 +141,7 @@ const useKeyboardNav = ({ items, open, onSelect, onClose, onArrowRight, onPendin
|
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
const isSegmentInput = e.target?.closest?.('[data-slot^="segment-"]');
|
|
144
|
-
if (isSegmentInput)
|
|
145
|
-
const isEnterWithHighlight = 'Enter' === e.key && activeIndexRef.current >= 0;
|
|
146
|
-
const isNavOrClose = 'Escape' === e.key || 'ArrowDown' === e.key || 'ArrowUp' === e.key;
|
|
147
|
-
if (!isNavOrClose && !isEnterWithHighlight) return;
|
|
148
|
-
}
|
|
144
|
+
if (isSegmentInput && 'Escape' !== e.key && 'ArrowDown' !== e.key && 'ArrowUp' !== e.key) return;
|
|
149
145
|
const { items: list, onSelect: select, onClose: close, onArrowRight: arrowRight } = stateRef.current;
|
|
150
146
|
if (0 === list.length) return;
|
|
151
147
|
switch(e.key){
|
|
@@ -158,6 +154,7 @@ const useKeyboardNav = ({ items, open, onSelect, onClose, onArrowRight, onPendin
|
|
|
158
154
|
e.preventDefault();
|
|
159
155
|
e.stopPropagation();
|
|
160
156
|
navigate('ArrowDown' === e.key ? 1 : -1);
|
|
157
|
+
stateRef.current.menuRef?.current?.focus();
|
|
161
158
|
break;
|
|
162
159
|
case 'Enter':
|
|
163
160
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BuildingChipData } from '
|
|
2
|
-
import type { Condition, FieldMetadata, FilterOperator } from '
|
|
1
|
+
import type { BuildingChipData } from '../../FilterInputContext/types';
|
|
2
|
+
import type { Condition, FieldMetadata, FilterOperator } from '../../types';
|
|
3
3
|
interface DeriveOptions {
|
|
4
4
|
editingChipId: string | null;
|
|
5
5
|
selectedField: FieldMetadata | null;
|
|
@@ -7,7 +7,7 @@ interface DeriveOptions {
|
|
|
7
7
|
conditions: Condition[];
|
|
8
8
|
buildingMultiValue: string | undefined;
|
|
9
9
|
dateRangeFromValue: string | null | undefined;
|
|
10
|
-
/** Segment text when inline-editing a value
|
|
10
|
+
/** Segment text when inline-editing a value — used to derive checked values from text */
|
|
11
11
|
segmentFilterText?: string;
|
|
12
12
|
}
|
|
13
13
|
export interface DerivedAutocompleteValues {
|