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.
- package/lib/commonjs/components/Drawer/Drawer.js +14 -5
- package/lib/commonjs/components/ListGroup/ListGroup.js +15 -9
- package/lib/commonjs/components/Section/Section.js +6 -2
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/Drawer/Drawer.js +15 -6
- package/lib/module/components/ListGroup/ListGroup.js +15 -9
- package/lib/module/components/Section/Section.js +7 -3
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/src/components/ListGroup/ListGroup.d.ts +12 -7
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Drawer/Drawer.tsx +14 -6
- package/src/components/ListGroup/ListGroup.tsx +21 -11
- package/src/components/Section/Section.tsx +3 -3
- package/src/icons/registry.ts +1 -1
|
@@ -186,17 +186,24 @@ function Drawer({
|
|
|
186
186
|
const totalRange = maxTranslateY - minTranslateY;
|
|
187
187
|
const currentRatio = totalRange > 0 ? (translateY.value - minTranslateY) / totalRange : 0;
|
|
188
188
|
|
|
189
|
-
//
|
|
190
|
-
|
|
189
|
+
// How far the drawer sheet itself moved from its position at gesture
|
|
190
|
+
// start. When the scroll view consumed the gesture (content was not
|
|
191
|
+
// at the top), the drawer stays put and displacement ≈ 0 — even
|
|
192
|
+
// though the finger moved fast. We must NOT use velocity to snap in
|
|
193
|
+
// that case; otherwise a fast content-scroll collapses the drawer.
|
|
194
|
+
const drawerDisplacement = Math.abs(translateY.value - context.value.y);
|
|
195
|
+
const drawerMovedEnough = drawerDisplacement > 10;
|
|
196
|
+
if (drawerMovedEnough && event.velocityY < -500) {
|
|
191
197
|
scrollTo(minTranslateY);
|
|
192
198
|
isFullyExpanded.value = true;
|
|
193
199
|
(0, _reactNativeReanimated.runOnJS)(updateMode)('expanded');
|
|
194
|
-
} else if (event.velocityY > 500) {
|
|
200
|
+
} else if (drawerMovedEnough && event.velocityY > 500) {
|
|
195
201
|
scrollTo(maxTranslateY);
|
|
196
202
|
isFullyExpanded.value = false;
|
|
197
203
|
(0, _reactNativeReanimated.runOnJS)(updateMode)('collapsed');
|
|
198
204
|
} else {
|
|
199
|
-
// Slow / medium gesture
|
|
205
|
+
// Slow / medium gesture, or the drawer barely moved → position
|
|
206
|
+
// based snap with asymmetric thresholds.
|
|
200
207
|
// Down stroke: must cross 75% to collapse (hard to dismiss).
|
|
201
208
|
// Up stroke: must reach top 35% to expand (35% from top).
|
|
202
209
|
const isDraggingDown = event.velocityY >= 0;
|
|
@@ -263,7 +270,9 @@ function Drawer({
|
|
|
263
270
|
rowGap: drawerGap
|
|
264
271
|
}, sheetStyle, animatedStyle],
|
|
265
272
|
accessible: true,
|
|
266
|
-
|
|
273
|
+
...(_reactNative.Platform.OS === 'web' ? {
|
|
274
|
+
accessibilityRole: 'dialog'
|
|
275
|
+
} : undefined),
|
|
267
276
|
accessibilityLabel: undefined,
|
|
268
277
|
accessibilityHint: accessibilityHint || 'Swipe up to expand, swipe down to collapse',
|
|
269
278
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
@@ -20,17 +20,21 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
20
20
|
*
|
|
21
21
|
* This component supports:
|
|
22
22
|
* - **label** text at the top
|
|
23
|
-
* - **listGroupSlot** for
|
|
23
|
+
* - **listGroupSlot** or **children** for content (typically ListItem components)
|
|
24
24
|
* - **design-token driven styling** via `getVariableByName` and `modes`
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* -
|
|
26
|
+
* Content can be provided in two interchangeable ways:
|
|
27
|
+
* - Via the `listGroupSlot` prop (Figma Slot "List group")
|
|
28
|
+
* - Via `children`
|
|
29
|
+
*
|
|
30
|
+
* Both produce identical results. If both are provided, they are merged
|
|
31
|
+
* (listGroupSlot items render first, then children).
|
|
29
32
|
*
|
|
30
33
|
* @component
|
|
31
34
|
* @param {Object} props
|
|
32
35
|
* @param {string} [props.label=''] - Label text displayed at the top of the list group
|
|
33
|
-
* @param {React.ReactNode} [props.listGroupSlot] -
|
|
36
|
+
* @param {React.ReactNode} [props.listGroupSlot] - Slot for list items (Figma Slot "List group")
|
|
37
|
+
* @param {React.ReactNode} [props.children] - Children for list items (equivalent to listGroupSlot)
|
|
34
38
|
* @param {Object} [props.modes={}] - Modes object passed to `getVariableByName` for all design tokens
|
|
35
39
|
* @param {Object} [props.style] - Optional container style overrides
|
|
36
40
|
* @param {string} [props.accessibilityLabel] - Accessibility label for the list group. If not provided, uses label
|
|
@@ -39,6 +43,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
39
43
|
function ListGroup({
|
|
40
44
|
label = '',
|
|
41
45
|
listGroupSlot,
|
|
46
|
+
children,
|
|
42
47
|
modes = {},
|
|
43
48
|
style,
|
|
44
49
|
accessibilityLabel,
|
|
@@ -75,10 +80,11 @@ function ListGroup({
|
|
|
75
80
|
fontWeight: labelFontWeight
|
|
76
81
|
};
|
|
77
82
|
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
const
|
|
83
|
+
// Merge listGroupSlot and children into a single list, then flatten and
|
|
84
|
+
// propagate modes. Both props are interchangeable; when both are provided
|
|
85
|
+
// the slot items render first, followed by children.
|
|
86
|
+
const rawItems = [...(listGroupSlot ? (0, _reactUtils.flattenChildren)(listGroupSlot) : []), ...(children ? (0, _reactUtils.flattenChildren)(children) : [])];
|
|
87
|
+
const processedSlot = rawItems.length > 0 ? (0, _reactUtils.cloneChildrenWithModes)(rawItems, modes) : null;
|
|
82
88
|
|
|
83
89
|
// Use provided accessibilityLabel or fall back to label
|
|
84
90
|
const defaultAccessibilityLabel = accessibilityLabel || label || "List group";
|
|
@@ -158,7 +158,9 @@ function Section({
|
|
|
158
158
|
});
|
|
159
159
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
160
160
|
style: [containerStyle, style],
|
|
161
|
-
|
|
161
|
+
...(_reactNative.Platform.OS === 'web' ? {
|
|
162
|
+
accessibilityRole: 'region'
|
|
163
|
+
} : undefined),
|
|
162
164
|
accessibilityLabel: undefined,
|
|
163
165
|
accessibilityHint: accessibilityHint,
|
|
164
166
|
...rest,
|
|
@@ -258,7 +260,9 @@ function SectionBento({
|
|
|
258
260
|
const processedUpiSlot = upiSlot ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(upiSlot), modes) : null;
|
|
259
261
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
260
262
|
style: [containerStyle, style],
|
|
261
|
-
|
|
263
|
+
...(_reactNative.Platform.OS === 'web' ? {
|
|
264
|
+
accessibilityRole: 'region'
|
|
265
|
+
} : undefined),
|
|
262
266
|
accessibilityLabel: undefined,
|
|
263
267
|
accessibilityHint: accessibilityHint,
|
|
264
268
|
...rest,
|