jfs-components 0.0.53 → 0.0.55

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.
@@ -3,32 +3,37 @@ import { View, type StyleProp, type ViewStyle } from 'react-native';
3
3
  type ListGroupProps = {
4
4
  label?: string;
5
5
  listGroupSlot?: React.ReactNode;
6
+ children?: React.ReactNode;
6
7
  modes?: Record<string, any>;
7
8
  style?: StyleProp<ViewStyle>;
8
9
  accessibilityLabel?: string;
9
10
  accessibilityHint?: string;
10
- } & React.ComponentProps<typeof View>;
11
+ } & Omit<React.ComponentProps<typeof View>, 'children'>;
11
12
  /**
12
13
  * ListGroup component that mirrors the Figma "List Group" component.
13
14
  *
14
15
  * This component supports:
15
16
  * - **label** text at the top
16
- * - **listGroupSlot** for custom content (typically ListItem components)
17
+ * - **listGroupSlot** or **children** for content (typically ListItem components)
17
18
  * - **design-token driven styling** via `getVariableByName` and `modes`
18
19
  *
19
- * Wherever the Figma layer name contains "Slot", this component exposes a
20
- * dedicated React "slot" prop:
21
- * - Slot "List group" → `listGroupSlot`
20
+ * Content can be provided in two interchangeable ways:
21
+ * - Via the `listGroupSlot` prop (Figma Slot "List group")
22
+ * - Via `children`
23
+ *
24
+ * Both produce identical results. If both are provided, they are merged
25
+ * (listGroupSlot items render first, then children).
22
26
  *
23
27
  * @component
24
28
  * @param {Object} props
25
29
  * @param {string} [props.label=''] - Label text displayed at the top of the list group
26
- * @param {React.ReactNode} [props.listGroupSlot] - Optional custom slot for list items (Figma Slot "List group")
30
+ * @param {React.ReactNode} [props.listGroupSlot] - Slot for list items (Figma Slot "List group")
31
+ * @param {React.ReactNode} [props.children] - Children for list items (equivalent to listGroupSlot)
27
32
  * @param {Object} [props.modes={}] - Modes object passed to `getVariableByName` for all design tokens
28
33
  * @param {Object} [props.style] - Optional container style overrides
29
34
  * @param {string} [props.accessibilityLabel] - Accessibility label for the list group. If not provided, uses label
30
35
  * @param {string} [props.accessibilityHint] - Additional accessibility hint for screen readers
31
36
  */
32
- declare function ListGroup({ label, listGroupSlot, modes, style, accessibilityLabel, accessibilityHint, ...rest }: ListGroupProps): import("react/jsx-runtime").JSX.Element;
37
+ declare function ListGroup({ label, listGroupSlot, children, modes, style, accessibilityLabel, accessibilityHint, ...rest }: ListGroupProps): import("react/jsx-runtime").JSX.Element;
33
38
  export default ListGroup;
34
39
  //# sourceMappingURL=ListGroup.d.ts.map
@@ -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-13T10:56:51.920Z
7
+ * Generated: 2026-04-13T20:48:16.865Z
8
8
  */
9
9
  export declare const iconRegistry: Record<string, {
10
10
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jfs-components",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "description": "React Native Jio Finance Components Library",
5
5
  "author": "sunshuaiqi@gmail.com",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useState, useRef } from 'react'
2
- import { StyleSheet, Text, useWindowDimensions, View } from 'react-native'
2
+ import { Platform, StyleSheet, Text, useWindowDimensions, View } from 'react-native'
3
3
  import {
4
4
  Gesture,
5
5
  GestureDetector,
@@ -232,17 +232,25 @@ function Drawer({
232
232
  ? (translateY.value - minTranslateY) / totalRange
233
233
  : 0
234
234
 
235
- // Fast fling always follow the fling direction
236
- if (event.velocityY < -500) {
235
+ // How far the drawer sheet itself moved from its position at gesture
236
+ // start. When the scroll view consumed the gesture (content was not
237
+ // at the top), the drawer stays put and displacement ≈ 0 — even
238
+ // though the finger moved fast. We must NOT use velocity to snap in
239
+ // that case; otherwise a fast content-scroll collapses the drawer.
240
+ const drawerDisplacement = Math.abs(translateY.value - context.value.y)
241
+ const drawerMovedEnough = drawerDisplacement > 10
242
+
243
+ if (drawerMovedEnough && event.velocityY < -500) {
237
244
  scrollTo(minTranslateY)
238
245
  isFullyExpanded.value = true
239
246
  runOnJS(updateMode)('expanded')
240
- } else if (event.velocityY > 500) {
247
+ } else if (drawerMovedEnough && event.velocityY > 500) {
241
248
  scrollTo(maxTranslateY)
242
249
  isFullyExpanded.value = false
243
250
  runOnJS(updateMode)('collapsed')
244
251
  } else {
245
- // Slow / medium gesture use asymmetric snap thresholds.
252
+ // Slow / medium gesture, or the drawer barely moved → position
253
+ // based snap with asymmetric thresholds.
246
254
  // Down stroke: must cross 75% to collapse (hard to dismiss).
247
255
  // Up stroke: must reach top 35% to expand (35% from top).
248
256
  const isDraggingDown = event.velocityY >= 0
@@ -314,7 +322,7 @@ function Drawer({
314
322
  animatedStyle,
315
323
  ]}
316
324
  accessible={true}
317
- accessibilityRole={'dialog' as any}
325
+ {...(Platform.OS === 'web' ? { accessibilityRole: 'dialog' as any } : undefined)}
318
326
  accessibilityLabel={undefined}
319
327
  accessibilityHint={accessibilityHint || 'Swipe up to expand, swipe down to collapse'}
320
328
  >
@@ -11,28 +11,33 @@ import { cloneChildrenWithModes, flattenChildren } from '../../utils/react-utils
11
11
  type ListGroupProps = {
12
12
  label?: string;
13
13
  listGroupSlot?: React.ReactNode;
14
+ children?: React.ReactNode;
14
15
  modes?: Record<string, any>;
15
16
  style?: StyleProp<ViewStyle>;
16
17
  accessibilityLabel?: string;
17
18
  accessibilityHint?: string;
18
- } & React.ComponentProps<typeof View>;
19
+ } & Omit<React.ComponentProps<typeof View>, 'children'>;
19
20
 
20
21
  /**
21
22
  * ListGroup component that mirrors the Figma "List Group" component.
22
23
  *
23
24
  * This component supports:
24
25
  * - **label** text at the top
25
- * - **listGroupSlot** for custom content (typically ListItem components)
26
+ * - **listGroupSlot** or **children** for content (typically ListItem components)
26
27
  * - **design-token driven styling** via `getVariableByName` and `modes`
27
28
  *
28
- * Wherever the Figma layer name contains "Slot", this component exposes a
29
- * dedicated React "slot" prop:
30
- * - Slot "List group" → `listGroupSlot`
29
+ * Content can be provided in two interchangeable ways:
30
+ * - Via the `listGroupSlot` prop (Figma Slot "List group")
31
+ * - Via `children`
32
+ *
33
+ * Both produce identical results. If both are provided, they are merged
34
+ * (listGroupSlot items render first, then children).
31
35
  *
32
36
  * @component
33
37
  * @param {Object} props
34
38
  * @param {string} [props.label=''] - Label text displayed at the top of the list group
35
- * @param {React.ReactNode} [props.listGroupSlot] - Optional custom slot for list items (Figma Slot "List group")
39
+ * @param {React.ReactNode} [props.listGroupSlot] - Slot for list items (Figma Slot "List group")
40
+ * @param {React.ReactNode} [props.children] - Children for list items (equivalent to listGroupSlot)
36
41
  * @param {Object} [props.modes={}] - Modes object passed to `getVariableByName` for all design tokens
37
42
  * @param {Object} [props.style] - Optional container style overrides
38
43
  * @param {string} [props.accessibilityLabel] - Accessibility label for the list group. If not provided, uses label
@@ -41,6 +46,7 @@ type ListGroupProps = {
41
46
  function ListGroup({
42
47
  label = '',
43
48
  listGroupSlot,
49
+ children,
44
50
  modes = {},
45
51
  style,
46
52
  accessibilityLabel,
@@ -79,11 +85,15 @@ function ListGroup({
79
85
  fontWeight: labelFontWeight,
80
86
  }
81
87
 
82
- // Clone listGroupSlot children and pass modes to all children that accept it
83
- // We flatten children first so that if a Fragment is passed, the items inside
84
- // become direct children of the container, allowing `gap` to apply correctly between them.
85
- const processedSlot = listGroupSlot
86
- ? cloneChildrenWithModes(flattenChildren(listGroupSlot), modes)
88
+ // Merge listGroupSlot and children into a single list, then flatten and
89
+ // propagate modes. Both props are interchangeable; when both are provided
90
+ // the slot items render first, followed by children.
91
+ const rawItems = [
92
+ ...(listGroupSlot ? flattenChildren(listGroupSlot) : []),
93
+ ...(children ? flattenChildren(children) : []),
94
+ ]
95
+ const processedSlot = rawItems.length > 0
96
+ ? cloneChildrenWithModes(rawItems, modes)
87
97
  : null
88
98
 
89
99
  // Use provided accessibilityLabel or fall back to label
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { View, Text, Pressable, type StyleProp, type ViewStyle, type PressableStateCallbackType } from 'react-native'
2
+ import { View, Text, Pressable, Platform, type StyleProp, type ViewStyle, type PressableStateCallbackType } from 'react-native'
3
3
  import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
4
4
  import NavArrow from '../NavArrow/NavArrow'
5
5
  import { usePressableWebSupport, type WebAccessibilityProps } from '../../utils/web-platform-utils'
@@ -182,7 +182,7 @@ function Section({
182
182
  return (
183
183
  <View
184
184
  style={[containerStyle, style]}
185
- accessibilityRole={'region' as any}
185
+ {...(Platform.OS === 'web' ? { accessibilityRole: 'region' as any } : undefined)}
186
186
  accessibilityLabel={undefined}
187
187
  accessibilityHint={accessibilityHint}
188
188
  {...rest}
@@ -314,7 +314,7 @@ function SectionBento({
314
314
  return (
315
315
  <View
316
316
  style={[containerStyle, style]}
317
- accessibilityRole={'region' as any}
317
+ {...(Platform.OS === 'web' ? { accessibilityRole: 'region' as any } : undefined)}
318
318
  accessibilityLabel={undefined}
319
319
  accessibilityHint={accessibilityHint}
320
320
  {...rest}
@@ -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-13T10:56:51.920Z
7
+ * Generated: 2026-04-13T20:48:16.865Z
8
8
  */
9
9
 
10
10
  // Icon name to SVG data mapping