@wallarm-org/design-system 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Fragment as external_react_Fragment, useMemo, useRef } from "react";
2
+ import { Fragment as external_react_Fragment, useCallback, useMemo, useRef } from "react";
3
3
  import { cn } from "../../../../utils/cn.js";
4
4
  import { DropdownMenu, DropdownMenuContent, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator } from "../../../DropdownMenu/index.js";
5
+ import { useFloatingRecomputeOn } from "../../hooks/useFloatingRecomputeOn.js";
5
6
  import { buildValueMenuSections } from "../../lib/buildValueMenuSections.js";
6
7
  import { MenuEmptyState } from "../MenuEmptyState.js";
7
8
  import { NestedValueMenuItem } from "./NestedValueMenuItem.js";
@@ -41,13 +42,20 @@ const NestedValueMenu = ({ values, onSelect, onCommit, open = false, onOpenChang
41
42
  if (el) rowElsRef.current.set(id, el);
42
43
  else rowElsRef.current.delete(id);
43
44
  };
45
+ const openParentIdRef = useRef(state.openParentId);
46
+ openParentIdRef.current = state.openParentId;
47
+ const getSubmenuAnchorRect = useCallback(()=>{
48
+ const id = openParentIdRef.current;
49
+ return id && rowElsRef.current.get(id)?.getBoundingClientRect() || null;
50
+ }, []);
44
51
  const submenuPositioning = useMemo(()=>({
45
52
  placement: 'right-start',
46
53
  gutter: 4,
47
- getAnchorRect: ()=>state.openParentId && rowElsRef.current.get(state.openParentId)?.getBoundingClientRect() || null
54
+ getAnchorRect: getSubmenuAnchorRect
48
55
  }), [
49
- state.openParentId
56
+ getSubmenuAnchorRect
50
57
  ]);
58
+ useFloatingRecomputeOn(state.openParentId, null != state.openParentId);
51
59
  const openParentRow = state.openParentRow;
52
60
  const submenuSelectAllRow = openParentRow && multiSelect ? {
53
61
  id: SELECT_ALL_ID,
@@ -49,12 +49,30 @@ const useValueMenuState = ({ values, open, multiSelect, initialValues, highlight
49
49
  blurCommitRef,
50
50
  commitChecked
51
51
  ]);
52
- const flatItems = useMemo(()=>values.map((opt)=>({
52
+ const flatItems = useMemo(()=>{
53
+ const items = values.map((opt)=>({
53
54
  id: String(opt.value),
54
55
  label: opt.label,
55
56
  value: opt.value
56
- })), [
57
- values
57
+ }));
58
+ const known = new Set(items.map((item)=>item.id));
59
+ const selected = multiSelect ? checkedValues : null != highlightValue ? [
60
+ highlightValue
61
+ ] : [];
62
+ const orphans = selected.filter((value)=>!known.has(String(value))).map((value)=>({
63
+ id: String(value),
64
+ label: String(value),
65
+ value
66
+ }));
67
+ return orphans.length > 0 ? [
68
+ ...orphans,
69
+ ...items
70
+ ] : items;
71
+ }, [
72
+ values,
73
+ multiSelect,
74
+ checkedValues,
75
+ highlightValue
58
76
  ]);
59
77
  const handleItemSelect = (item)=>{
60
78
  if (multiSelect) {
@@ -8,7 +8,7 @@ interface DeriveOptions {
8
8
  conditions: Condition[];
9
9
  buildingMultiValue: string | undefined;
10
10
  dateRangeFromValue: string | null | undefined;
11
- /** Segment text when inline-editing a value. */
11
+ /** Segment text when inline-editing a value — set only once the user typed. */
12
12
  segmentFilterText?: string;
13
13
  /** Which triplet is being built: 0 = base, 1 = paired second. */
14
14
  buildingSide?: 0 | 1;
@@ -1,4 +1,5 @@
1
1
  import { NO_VALUE_PLACEHOLDER, chipIdToConditionIndex, collectLeaves, getDateDisplayLabel, getFieldValues, getOperatorLabel, hasStaticAllowlist, isMultiSelectOperator, isNoValueOperator } from "../../../lib/index.js";
2
+ import { resolveMultiValues } from "./valueResolution.js";
2
3
  const displayBaseValue = (value, field)=>{
3
4
  const options = collectLeaves(getFieldValues(field));
4
5
  const resolve = (v)=>options.find((opt)=>String(opt.value) === String(v))?.label ?? String(v ?? '');
@@ -19,6 +20,7 @@ const deriveAutocompleteValues = ({ editingChipId, selectedField, selectedOperat
19
20
  } : rawEditingCondition;
20
21
  const editingMultiValues = (()=>{
21
22
  if (!editingCondition || !selectedOperator || !isMultiSelectOperator(selectedOperator)) return [];
23
+ if (void 0 !== segmentFilterText && selectedField) return resolveMultiValues(selectedField, segmentFilterText.trim()).resolved;
22
24
  const values = Array.isArray(editingCondition.value) ? editingCondition.value : null != editingCondition.value ? [
23
25
  editingCondition.value
24
26
  ] : [];
@@ -19,6 +19,7 @@ export declare const useChipEditing: ({ conditions, chips, fields, setMenuAnchor
19
19
  editingSegment: import("../../FilterInputField/FilterInputChip").SegmentVariant | null;
20
20
  editingSide: 0 | 1;
21
21
  isBuildingEdit: boolean;
22
+ userHasTyped: boolean;
22
23
  setEditingSegment: import("react").Dispatch<import("react").SetStateAction<import("../../FilterInputField/FilterInputChip").SegmentVariant | null>>;
23
24
  segmentFilterText: string;
24
25
  segmentMenuFilterText: string;
@@ -117,6 +117,7 @@ const useChipEditing = ({ conditions, chips, fields, setMenuAnchor, setSelectedF
117
117
  editingSegment,
118
118
  editingSide,
119
119
  isBuildingEdit,
120
+ userHasTyped,
120
121
  setEditingSegment,
121
122
  segmentFilterText: segmentDisplayText,
122
123
  segmentMenuFilterText,
@@ -132,6 +133,7 @@ const useChipEditing = ({ conditions, chips, fields, setMenuAnchor, setSelectedF
132
133
  editingSegment,
133
134
  editingSide,
134
135
  isBuildingEdit,
136
+ userHasTyped,
135
137
  segmentDisplayText,
136
138
  segmentMenuFilterText,
137
139
  handleSegmentFilterChange,
@@ -214,13 +214,13 @@ const useFilterInputAutocomplete = ({ fields, conditions, chips, upsertCondition
214
214
  conditions,
215
215
  buildingMultiValue,
216
216
  dateRangeFromValue: dateRange.fromValue,
217
- segmentFilterText: editing.editingSegment === SEGMENT_VARIANT.value ? editing.segmentMenuFilterText : void 0,
217
+ segmentFilterText: editing.editingSegment === SEGMENT_VARIANT.value && editing.userHasTyped ? editing.segmentFilterText : void 0,
218
218
  buildingSide,
219
219
  buildingBase,
220
220
  editingSide: editing.editingSide
221
221
  });
222
222
  const isMultiValueValueEdit = null != editing.editingChipId && editing.editingSegment === SEGMENT_VARIANT.value && null != selectedOperator && isMultiSelectOperator(selectedOperator);
223
- const liveSegmentFilterText = isMultiValueValueEdit && null != buildingMultiValue && '' === editing.segmentMenuFilterText ? buildingMultiValue : editing.segmentFilterText;
223
+ const liveSegmentFilterText = isMultiValueValueEdit && null != buildingMultiValue && !editing.userHasTyped ? buildingMultiValue : editing.segmentFilterText;
224
224
  return {
225
225
  inputText,
226
226
  menuState,
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.11.0",
3
- "generatedAt": "2026-09-01T09:21:47.920Z",
2
+ "version": "1.12.0",
3
+ "generatedAt": "2026-09-01T11:01:25.480Z",
4
4
  "components": [
5
5
  {
6
6
  "name": "Accordion",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",