jfs-components 0.0.58 → 0.0.60

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
@@ -57,7 +57,7 @@ function Button({
57
57
  const lineHeight = getVariableByName('button/lineHeight', modes) || 19;
58
58
  const fontSize = getVariableByName('button/fontSize', modes) || 16;
59
59
  const textColor = getVariableByName('button/foreground', modes) || '#0f0d0a';
60
- const iconColor = getVariableByName('button/icon/color', modes) ?? textColor;
60
+ const iconColor = textColor;
61
61
  const iconSize = getVariableByName('button/icon/size', modes) ?? 18;
62
62
  const [isHovered, setIsHovered] = useState(false);
63
63
  const [isPressed, setIsPressed] = useState(false);
@@ -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 = {
@@ -29,7 +29,7 @@ function ButtonGroup({
29
29
  style
30
30
  }) {
31
31
  // Resolve design tokens
32
- const gap = getVariableByName('buttonGroup/padding/gap', modes) ?? 12;
32
+ const gap = getVariableByName('buttonGroup/gap', modes) ?? 12;
33
33
  const paddingHorizontal = getVariableByName('buttonGroup/padding/horizontal', modes) ?? 0;
34
34
  const paddingVertical = getVariableByName('buttonGroup/padding/vertical', modes) ?? 0;
35
35
 
@@ -224,7 +224,7 @@ function Drawer({
224
224
 
225
225
  // Design Tokens
226
226
  const backgroundColor = getVariableByName('drawer/background', modes) || '#f5f5f5';
227
- const radius = getVariableByName('drawer/radius', modes) || 12;
227
+ const radius = getVariableByName('drawer/radius/top', modes) || 12;
228
228
 
229
229
  // Handle
230
230
  const handleColor = getVariableByName('drawer/handlebar/background', modes) || '#e0e0e3';
@@ -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
  },