jfs-components 0.0.59 → 0.0.61

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.
@@ -42,7 +42,12 @@ function cloneChildrenWithModes(children, modes, forcedModes) {
42
42
  ...modes,
43
43
  ...existingModes
44
44
  } : modes;
45
- const processedChildren = hasChildren ? cloneChildrenWithModes(childChildren, modes, forcedModes) : undefined;
45
+ let processedChildren;
46
+ if (hasChildren) {
47
+ const childArray = _react.default.Children.toArray(childChildren);
48
+ const processed = cloneChildrenWithModes(childArray, modes, forcedModes);
49
+ processedChildren = processed.length === 1 ? processed[0] : processed;
50
+ }
46
51
  result.push(/*#__PURE__*/_react.default.cloneElement(child, {
47
52
  ...child.props,
48
53
  modes: mergedModes
@@ -68,7 +68,7 @@ function Button({
68
68
  const hoverBg = getVariableByName('button/background', hoverModes) || backgroundColor;
69
69
  const hoverBorderColor = getVariableByName('button/border/color', hoverModes) || borderColor;
70
70
  const hoverTextColor = getVariableByName('button/foreground', hoverModes) || textColor;
71
- const hoverIconColor = getVariableByName('button/icon/color', hoverModes) ?? hoverTextColor;
71
+ const hoverIconColor = hoverTextColor;
72
72
  const pressedModes = {
73
73
  ...modes,
74
74
  "Button / State": "Pressed"
@@ -76,7 +76,7 @@ function Button({
76
76
  const pressedBg = getVariableByName('button/background', pressedModes) || backgroundColor;
77
77
  const pressedBorderColor = getVariableByName('button/border/color', pressedModes) || borderColor;
78
78
  const pressedTextColor = getVariableByName('button/foreground', pressedModes) || textColor;
79
- const pressedIconColor = getVariableByName('button/icon/color', pressedModes) ?? pressedTextColor;
79
+ const pressedIconColor = pressedTextColor;
80
80
  const activeTextColor = isPressed && !disabled ? pressedTextColor : isHovered && !disabled ? hoverTextColor : textColor;
81
81
  const activeIconColor = isPressed && !disabled ? pressedIconColor : isHovered && !disabled ? hoverIconColor : iconColor;
82
82
  const baseLabelTextStyle = {
@@ -79,7 +79,8 @@ function ListGroup({
79
79
  // propagate modes. Both props are interchangeable; when both are provided
80
80
  // the slot items render first, followed by children.
81
81
  const rawItems = [...(listGroupSlot ? flattenChildren(listGroupSlot) : []), ...(children ? flattenChildren(children) : [])];
82
- const processedSlot = rawItems.length > 0 ? cloneChildrenWithModes(rawItems, modes) : null;
82
+ const keyedItems = React.Children.toArray(rawItems);
83
+ const processedSlot = keyedItems.length > 0 ? cloneChildrenWithModes(keyedItems, modes) : null;
83
84
 
84
85
  // Use provided accessibilityLabel or fall back to label
85
86
  const defaultAccessibilityLabel = accessibilityLabel || label || "List group";
@@ -19,12 +19,19 @@ function SlotGrid({
19
19
  maxColumns = SLOT_GRID_MAX_COLUMNS
20
20
  }) {
21
21
  const [maxItemWidth, setMaxItemWidth] = useState(null);
22
+ const [measureTimedOut, setMeasureTimedOut] = useState(false);
22
23
  const itemWidthsRef = useRef(new Map());
23
24
  const totalItems = items.length;
24
25
  useEffect(() => {
25
26
  itemWidthsRef.current.clear();
26
27
  setMaxItemWidth(null);
28
+ setMeasureTimedOut(false);
27
29
  }, [totalItems]);
30
+ useEffect(() => {
31
+ if (maxItemWidth !== null) return;
32
+ const timer = setTimeout(() => setMeasureTimedOut(true), 500);
33
+ return () => clearTimeout(timer);
34
+ }, [maxItemWidth, totalItems]);
28
35
  const handleItemLayout = useCallback((index, width) => {
29
36
  itemWidthsRef.current.set(index, width);
30
37
  if (itemWidthsRef.current.size >= totalItems && totalItems > 0) {
@@ -40,7 +47,7 @@ function SlotGrid({
40
47
  return /*#__PURE__*/_jsx(View, {
41
48
  style: {
42
49
  gap,
43
- ...(isMeasured ? {} : {
50
+ ...(isMeasured || measureTimedOut ? {} : {
44
51
  opacity: 0
45
52
  })
46
53
  },