jfs-components 0.0.59 → 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.
- package/lib/commonjs/components/Button/Button.js +2 -2
- package/lib/commonjs/components/Section/Section.js +8 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/utils/react-utils.js +6 -1
- package/lib/module/components/Button/Button.js +2 -2
- package/lib/module/components/Section/Section.js +8 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/utils/react-utils.js +6 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Section/Section.tsx +9 -1
- package/src/icons/registry.ts +1 -1
- package/src/utils/react-utils.ts +6 -3
|
@@ -37,7 +37,12 @@ export function cloneChildrenWithModes(children, modes, forcedModes) {
|
|
|
37
37
|
...modes,
|
|
38
38
|
...existingModes
|
|
39
39
|
} : modes;
|
|
40
|
-
|
|
40
|
+
let processedChildren;
|
|
41
|
+
if (hasChildren) {
|
|
42
|
+
const childArray = React.Children.toArray(childChildren);
|
|
43
|
+
const processed = cloneChildrenWithModes(childArray, modes, forcedModes);
|
|
44
|
+
processedChildren = processed.length === 1 ? processed[0] : processed;
|
|
45
|
+
}
|
|
41
46
|
result.push(/*#__PURE__*/React.cloneElement(child, {
|
|
42
47
|
...child.props,
|
|
43
48
|
modes: mergedModes
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Auto-generated from SVG files in src/icons/
|
|
5
5
|
* DO NOT EDIT MANUALLY - Run "npm run icons:generate" to regenerate
|
|
6
6
|
*
|
|
7
|
-
* Generated: 2026-04-14T20:
|
|
7
|
+
* Generated: 2026-04-14T20:42:38.764Z
|
|
8
8
|
*/
|
|
9
9
|
export declare const iconRegistry: Record<string, {
|
|
10
10
|
path: string;
|
package/package.json
CHANGED
|
@@ -107,13 +107,13 @@ function Button({
|
|
|
107
107
|
const hoverBg = getVariableByName('button/background', hoverModes) || backgroundColor
|
|
108
108
|
const hoverBorderColor = getVariableByName('button/border/color', hoverModes) || borderColor
|
|
109
109
|
const hoverTextColor = getVariableByName('button/foreground', hoverModes) || textColor
|
|
110
|
-
const hoverIconColor =
|
|
110
|
+
const hoverIconColor = hoverTextColor
|
|
111
111
|
|
|
112
112
|
const pressedModes = { ...modes, "Button / State": "Pressed" }
|
|
113
113
|
const pressedBg = getVariableByName('button/background', pressedModes) || backgroundColor
|
|
114
114
|
const pressedBorderColor = getVariableByName('button/border/color', pressedModes) || borderColor
|
|
115
115
|
const pressedTextColor = getVariableByName('button/foreground', pressedModes) || textColor
|
|
116
|
-
const pressedIconColor =
|
|
116
|
+
const pressedIconColor = pressedTextColor
|
|
117
117
|
|
|
118
118
|
const activeTextColor = isPressed && !disabled ? pressedTextColor : isHovered && !disabled ? hoverTextColor : textColor
|
|
119
119
|
const activeIconColor = isPressed && !disabled ? pressedIconColor : isHovered && !disabled ? hoverIconColor : iconColor
|
|
@@ -19,14 +19,22 @@ type SlotGridProps = {
|
|
|
19
19
|
|
|
20
20
|
function SlotGrid({ items, gap, maxColumns = SLOT_GRID_MAX_COLUMNS }: SlotGridProps) {
|
|
21
21
|
const [maxItemWidth, setMaxItemWidth] = useState<number | null>(null)
|
|
22
|
+
const [measureTimedOut, setMeasureTimedOut] = useState(false)
|
|
22
23
|
const itemWidthsRef = useRef<Map<number, number>>(new Map())
|
|
23
24
|
const totalItems = items.length
|
|
24
25
|
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
itemWidthsRef.current.clear()
|
|
27
28
|
setMaxItemWidth(null)
|
|
29
|
+
setMeasureTimedOut(false)
|
|
28
30
|
}, [totalItems])
|
|
29
31
|
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (maxItemWidth !== null) return
|
|
34
|
+
const timer = setTimeout(() => setMeasureTimedOut(true), 500)
|
|
35
|
+
return () => clearTimeout(timer)
|
|
36
|
+
}, [maxItemWidth, totalItems])
|
|
37
|
+
|
|
30
38
|
const handleItemLayout = useCallback((index: number, width: number) => {
|
|
31
39
|
itemWidthsRef.current.set(index, width)
|
|
32
40
|
if (itemWidthsRef.current.size >= totalItems && totalItems > 0) {
|
|
@@ -43,7 +51,7 @@ function SlotGrid({ items, gap, maxColumns = SLOT_GRID_MAX_COLUMNS }: SlotGridPr
|
|
|
43
51
|
}
|
|
44
52
|
|
|
45
53
|
return (
|
|
46
|
-
<View style={{ gap, ...(isMeasured ? {} : { opacity: 0 }) }}>
|
|
54
|
+
<View style={{ gap, ...(isMeasured || measureTimedOut ? {} : { opacity: 0 }) }}>
|
|
47
55
|
{rows.map((row, rowIndex) => {
|
|
48
56
|
const spacersNeeded = row.length < columns ? columns - row.length : 0
|
|
49
57
|
return (
|
package/src/icons/registry.ts
CHANGED
package/src/utils/react-utils.ts
CHANGED
|
@@ -39,9 +39,12 @@ export function cloneChildrenWithModes(
|
|
|
39
39
|
? { ...modes, ...existingModes }
|
|
40
40
|
: modes
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
let processedChildren: React.ReactNode | React.ReactNode[] | undefined
|
|
43
|
+
if (hasChildren) {
|
|
44
|
+
const childArray = React.Children.toArray(childChildren)
|
|
45
|
+
const processed = cloneChildrenWithModes(childArray, modes, forcedModes)
|
|
46
|
+
processedChildren = processed.length === 1 ? processed[0] : processed
|
|
47
|
+
}
|
|
45
48
|
|
|
46
49
|
result.push(
|
|
47
50
|
React.cloneElement(
|