jfs-components 0.0.79 → 0.0.84
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/AppBar/AppBar.js +56 -6
- package/lib/commonjs/components/Attached/Attached.js +46 -7
- package/lib/commonjs/components/Checkbox/Checkbox.js +18 -2
- package/lib/commonjs/components/Drawer/Drawer.js +6 -1
- package/lib/commonjs/components/DropdownInput/DropdownInput.js +30 -6
- package/lib/commonjs/components/ExpandableCheckbox/ExpandableCheckbox.js +17 -11
- package/lib/commonjs/components/FormField/FormField.js +1 -14
- package/lib/commonjs/components/FullscreenModal/FullscreenModal.js +5 -1
- package/lib/commonjs/components/ListItem/ListItem.js +6 -11
- package/lib/commonjs/components/MessageField/MessageField.js +1 -13
- package/lib/commonjs/components/PaymentFeedback/PaymentFeedback.js +12 -9
- package/lib/commonjs/components/PlanComparisonCard/PlanComparisonCard.js +69 -160
- package/lib/commonjs/components/Spinner/Spinner.js +217 -0
- package/lib/commonjs/components/TextInput/TextInput.js +33 -18
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/icons/components/IconArrowdown.js +19 -0
- package/lib/commonjs/icons/components/IconArrowup.js +19 -0
- package/lib/commonjs/icons/components/IconChevrondowncircle.js +19 -0
- package/lib/commonjs/icons/components/IconChevronleftcircle.js +19 -0
- package/lib/commonjs/icons/components/IconChevronrightcircle.js +19 -0
- package/lib/commonjs/icons/components/IconChevronupcircle.js +19 -0
- package/lib/commonjs/icons/components/IconOsnavback.js +19 -0
- package/lib/commonjs/icons/components/IconOsnavcenter.js +19 -0
- package/lib/commonjs/icons/components/IconOsnavhome.js +19 -0
- package/lib/commonjs/icons/components/IconOsnavtask.js +19 -0
- package/lib/commonjs/icons/components/IconSignin.js +19 -0
- package/lib/commonjs/icons/components/IconSignout.js +19 -0
- package/lib/commonjs/icons/components/index.js +132 -0
- package/lib/commonjs/icons/registry.js +2 -2
- package/lib/module/components/AppBar/AppBar.js +56 -6
- package/lib/module/components/Attached/Attached.js +46 -7
- package/lib/module/components/Checkbox/Checkbox.js +18 -2
- package/lib/module/components/Drawer/Drawer.js +6 -1
- package/lib/module/components/DropdownInput/DropdownInput.js +30 -6
- package/lib/module/components/ExpandableCheckbox/ExpandableCheckbox.js +17 -11
- package/lib/module/components/FormField/FormField.js +3 -16
- package/lib/module/components/FullscreenModal/FullscreenModal.js +5 -1
- package/lib/module/components/ListItem/ListItem.js +6 -11
- package/lib/module/components/MessageField/MessageField.js +3 -15
- package/lib/module/components/PaymentFeedback/PaymentFeedback.js +13 -9
- package/lib/module/components/PlanComparisonCard/PlanComparisonCard.js +72 -160
- package/lib/module/components/Spinner/Spinner.js +212 -0
- package/lib/module/components/TextInput/TextInput.js +34 -19
- package/lib/module/components/index.js +1 -0
- package/lib/module/icons/components/IconArrowdown.js +12 -0
- package/lib/module/icons/components/IconArrowup.js +12 -0
- package/lib/module/icons/components/IconChevrondowncircle.js +12 -0
- package/lib/module/icons/components/IconChevronleftcircle.js +12 -0
- package/lib/module/icons/components/IconChevronrightcircle.js +12 -0
- package/lib/module/icons/components/IconChevronupcircle.js +12 -0
- package/lib/module/icons/components/IconOsnavback.js +12 -0
- package/lib/module/icons/components/IconOsnavcenter.js +12 -0
- package/lib/module/icons/components/IconOsnavhome.js +12 -0
- package/lib/module/icons/components/IconOsnavtask.js +12 -0
- package/lib/module/icons/components/IconSignin.js +12 -0
- package/lib/module/icons/components/IconSignout.js +12 -0
- package/lib/module/icons/components/index.js +12 -0
- package/lib/module/icons/registry.js +2 -2
- package/lib/typescript/src/components/AppBar/AppBar.d.ts +12 -1
- package/lib/typescript/src/components/Attached/Attached.d.ts +19 -16
- package/lib/typescript/src/components/DropdownInput/DropdownInput.d.ts +3 -2
- package/lib/typescript/src/components/ListItem/ListItem.d.ts +3 -3
- package/lib/typescript/src/components/PaymentFeedback/PaymentFeedback.d.ts +5 -1
- package/lib/typescript/src/components/PlanComparisonCard/PlanComparisonCard.d.ts +10 -8
- package/lib/typescript/src/components/Spinner/Spinner.d.ts +45 -0
- package/lib/typescript/src/components/index.d.ts +1 -0
- package/lib/typescript/src/icons/components/IconArrowdown.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconArrowup.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconChevrondowncircle.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconChevronleftcircle.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconChevronrightcircle.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconChevronupcircle.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconOsnavback.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconOsnavcenter.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconOsnavhome.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconOsnavtask.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconSignin.d.ts +3 -0
- package/lib/typescript/src/icons/components/IconSignout.d.ts +3 -0
- package/lib/typescript/src/icons/components/index.d.ts +12 -0
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +3 -2
- package/src/components/AppBar/AppBar.tsx +79 -12
- package/src/components/Attached/Attached.tsx +63 -7
- package/src/components/Checkbox/Checkbox.tsx +14 -2
- package/src/components/Drawer/Drawer.tsx +4 -0
- package/src/components/DropdownInput/DropdownInput.tsx +54 -20
- package/src/components/ExpandableCheckbox/ExpandableCheckbox.tsx +13 -9
- package/src/components/FormField/FormField.tsx +3 -19
- package/src/components/FullscreenModal/FullscreenModal.tsx +3 -0
- package/src/components/ListItem/ListItem.tsx +14 -16
- package/src/components/MessageField/MessageField.tsx +3 -18
- package/src/components/PaymentFeedback/PaymentFeedback.tsx +15 -8
- package/src/components/PlanComparisonCard/PlanComparisonCard.tsx +82 -192
- package/src/components/Spinner/Spinner.tsx +273 -0
- package/src/components/TextInput/TextInput.tsx +37 -19
- package/src/components/index.ts +1 -0
- package/src/icons/components/IconArrowdown.tsx +11 -0
- package/src/icons/components/IconArrowup.tsx +11 -0
- package/src/icons/components/IconChevrondowncircle.tsx +11 -0
- package/src/icons/components/IconChevronleftcircle.tsx +11 -0
- package/src/icons/components/IconChevronrightcircle.tsx +11 -0
- package/src/icons/components/IconChevronupcircle.tsx +11 -0
- package/src/icons/components/IconOsnavback.tsx +11 -0
- package/src/icons/components/IconOsnavcenter.tsx +11 -0
- package/src/icons/components/IconOsnavhome.tsx +11 -0
- package/src/icons/components/IconOsnavtask.tsx +11 -0
- package/src/icons/components/IconSignin.tsx +11 -0
- package/src/icons/components/IconSignout.tsx +11 -0
- package/src/icons/components/index.ts +12 -0
- package/src/icons/registry.ts +49 -1
|
@@ -12,10 +12,18 @@ var _NavArrow = _interopRequireDefault(require("../NavArrow/NavArrow"));
|
|
|
12
12
|
var _reactUtils = require("../../utils/react-utils");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
// SubPage "slot wrap" geometry, taken directly from the Figma design
|
|
16
|
+
// (node 449:7876). The middle slot is an absolutely-centered box of a fixed
|
|
17
|
+
// size; its inner content (node 3991:4125) is a `flex: 1 0 0; min-width: 1px`
|
|
18
|
+
// item so it fills / shrinks responsively within that box.
|
|
19
|
+
const SUBPAGE_MIDDLE_DEFAULT_WIDTH = 192;
|
|
20
|
+
const SUBPAGE_MIDDLE_HEIGHT = 32;
|
|
21
|
+
const SUBPAGE_MIDDLE_PADDING_HORIZONTAL = 21;
|
|
15
22
|
function AppBar({
|
|
16
23
|
type = 'MainPage',
|
|
17
24
|
leadingSlot,
|
|
18
25
|
middleSlot,
|
|
26
|
+
middleSlotWidth = SUBPAGE_MIDDLE_DEFAULT_WIDTH,
|
|
19
27
|
actionsSlot,
|
|
20
28
|
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
21
29
|
onLeadingPress,
|
|
@@ -117,13 +125,40 @@ function AppBar({
|
|
|
117
125
|
children: (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(actionsSlot), modes)
|
|
118
126
|
}) : null;
|
|
119
127
|
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
|
|
128
|
+
// SubPage centers its middle slot via absolute positioning (see Figma
|
|
129
|
+
// "slot wrap"), so it never participates in the row flow. Only MainPage
|
|
130
|
+
// keeps the legacy in-flow middle slot.
|
|
131
|
+
const hasInFlowMiddle = isMain && !!processedMiddle;
|
|
132
|
+
|
|
133
|
+
// With an in-flow middle (MainPage) the middle (flex: 1) absorbs the
|
|
134
|
+
// remaining space, so leading & actions sit at the edges naturally. In all
|
|
135
|
+
// other cases we pin leading & actions to the outer edges with
|
|
136
|
+
// `space-between`; the SubPage middle floats above, centered.
|
|
124
137
|
const wrapperStyle = {
|
|
125
138
|
...containerStyle,
|
|
126
|
-
justifyContent:
|
|
139
|
+
justifyContent: hasInFlowMiddle ? 'flex-start' : 'space-between'
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Absolutely-centered middle box for SubPage, mirroring the Figma geometry.
|
|
143
|
+
// `left/top: 50%` + a negative translate keeps it centered regardless of the
|
|
144
|
+
// bar width, while the fixed width clips overly-wide content (overflow:
|
|
145
|
+
// hidden) instead of letting it bleed under the leading/actions slots.
|
|
146
|
+
const subPageMiddleStyle = {
|
|
147
|
+
position: 'absolute',
|
|
148
|
+
top: '50%',
|
|
149
|
+
left: '50%',
|
|
150
|
+
width: middleSlotWidth,
|
|
151
|
+
height: SUBPAGE_MIDDLE_HEIGHT,
|
|
152
|
+
transform: [{
|
|
153
|
+
translateX: -middleSlotWidth / 2
|
|
154
|
+
}, {
|
|
155
|
+
translateY: -SUBPAGE_MIDDLE_HEIGHT / 2
|
|
156
|
+
}],
|
|
157
|
+
flexDirection: 'row',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
justifyContent: 'center',
|
|
160
|
+
paddingHorizontal: SUBPAGE_MIDDLE_PADDING_HORIZONTAL,
|
|
161
|
+
overflow: 'hidden'
|
|
127
162
|
};
|
|
128
163
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
129
164
|
style: [wrapperStyle, style],
|
|
@@ -139,7 +174,7 @@ function AppBar({
|
|
|
139
174
|
alignItems: 'center'
|
|
140
175
|
},
|
|
141
176
|
children: processedLeading
|
|
142
|
-
}),
|
|
177
|
+
}), hasInFlowMiddle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
143
178
|
style: {
|
|
144
179
|
flex: 1,
|
|
145
180
|
minWidth: 0,
|
|
@@ -152,6 +187,21 @@ function AppBar({
|
|
|
152
187
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
153
188
|
style: actionsStyle,
|
|
154
189
|
children: processedActions
|
|
190
|
+
}), isSub && processedMiddle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
191
|
+
style: subPageMiddleStyle,
|
|
192
|
+
pointerEvents: "box-none",
|
|
193
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
194
|
+
style: {
|
|
195
|
+
flex: 1,
|
|
196
|
+
minWidth: 1,
|
|
197
|
+
height: '100%',
|
|
198
|
+
flexDirection: 'row',
|
|
199
|
+
alignItems: 'center',
|
|
200
|
+
justifyContent: 'center'
|
|
201
|
+
},
|
|
202
|
+
pointerEvents: "box-none",
|
|
203
|
+
children: processedMiddle
|
|
204
|
+
})
|
|
155
205
|
})]
|
|
156
206
|
});
|
|
157
207
|
}
|
|
@@ -48,9 +48,27 @@ function resolveAnchorFractions(position) {
|
|
|
48
48
|
* </Attached>
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
+
/**
|
|
52
|
+
* Stretches the immediate badge child/children to fill the enforced badge box.
|
|
53
|
+
* Merges `{ width: '100%', height: '100%' }` into each top-level element's
|
|
54
|
+
* `style` so an arbitrary node (e.g. an `Image` with its own width/aspectRatio)
|
|
55
|
+
* fills the fixed `badgeSize` box instead of laying out at its intrinsic size.
|
|
56
|
+
* The wrapping box's `overflow: 'hidden'` clips anything that still overflows.
|
|
57
|
+
*/
|
|
58
|
+
function forceBadgeFill(children) {
|
|
59
|
+
return _react.default.Children.map(children, child => {
|
|
60
|
+
if (! /*#__PURE__*/_react.default.isValidElement(child)) return child;
|
|
61
|
+
const childStyle = child.props?.style;
|
|
62
|
+
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
63
|
+
style: [FILL_STYLE, childStyle]
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
51
67
|
function Attached({
|
|
52
68
|
children,
|
|
53
69
|
badge,
|
|
70
|
+
badgeSize,
|
|
71
|
+
badgeRadius,
|
|
54
72
|
position = 'bottom-right',
|
|
55
73
|
circular = true,
|
|
56
74
|
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
@@ -65,7 +83,7 @@ function Attached({
|
|
|
65
83
|
...propModes
|
|
66
84
|
}, [globalModes, propModes]);
|
|
67
85
|
const [mainSize, setMainSize] = (0, _react.useState)(ZERO_SIZE);
|
|
68
|
-
const [
|
|
86
|
+
const [measuredBadgeSize, setMeasuredBadgeSize] = (0, _react.useState)(ZERO_SIZE);
|
|
69
87
|
const onMainLayout = (0, _react.useCallback)(e => {
|
|
70
88
|
const {
|
|
71
89
|
width,
|
|
@@ -81,19 +99,31 @@ function Attached({
|
|
|
81
99
|
width,
|
|
82
100
|
height
|
|
83
101
|
} = e.nativeEvent.layout;
|
|
84
|
-
|
|
102
|
+
setMeasuredBadgeSize(prev => prev.width === width && prev.height === height ? prev : {
|
|
85
103
|
width,
|
|
86
104
|
height
|
|
87
105
|
});
|
|
88
106
|
}, []);
|
|
89
107
|
const mainChildren = (0, _react.useMemo)(() => children != null ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : null, [children, modes]);
|
|
90
108
|
const badgeChildren = (0, _react.useMemo)(() => badge != null ? (0, _reactUtils.cloneChildrenWithModes)(badge, modes) : null, [badge, modes]);
|
|
109
|
+
|
|
110
|
+
// When a fixed size is requested, the badge is wrapped in a clipped box and
|
|
111
|
+
// its content is force-stretched to fill it (see `forceBadgeFill`).
|
|
112
|
+
const badgeBoxStyle = (0, _react.useMemo)(() => {
|
|
113
|
+
if (badgeSize == null) return null;
|
|
114
|
+
return {
|
|
115
|
+
width: badgeSize,
|
|
116
|
+
height: badgeSize,
|
|
117
|
+
borderRadius: badgeRadius ?? badgeSize / 2,
|
|
118
|
+
overflow: 'hidden'
|
|
119
|
+
};
|
|
120
|
+
}, [badgeSize, badgeRadius]);
|
|
91
121
|
const badgePlacement = (0, _react.useMemo)(() => {
|
|
92
122
|
const {
|
|
93
123
|
fx,
|
|
94
124
|
fy
|
|
95
125
|
} = resolveAnchorFractions(position);
|
|
96
|
-
const measured = mainSize.width > 0 &&
|
|
126
|
+
const measured = mainSize.width > 0 && measuredBadgeSize.width > 0;
|
|
97
127
|
let anchorX;
|
|
98
128
|
let anchorY;
|
|
99
129
|
if (circular) {
|
|
@@ -113,12 +143,12 @@ function Attached({
|
|
|
113
143
|
}
|
|
114
144
|
return {
|
|
115
145
|
position: 'absolute',
|
|
116
|
-
left: anchorX -
|
|
117
|
-
top: anchorY -
|
|
146
|
+
left: anchorX - measuredBadgeSize.width / 2,
|
|
147
|
+
top: anchorY - measuredBadgeSize.height / 2,
|
|
118
148
|
// Hide until both elements are measured to avoid a one-frame flash at (0,0).
|
|
119
149
|
opacity: measured ? 1 : 0
|
|
120
150
|
};
|
|
121
|
-
}, [position, circular, mainSize,
|
|
151
|
+
}, [position, circular, mainSize, measuredBadgeSize]);
|
|
122
152
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
123
153
|
style: [styles.container, style],
|
|
124
154
|
...rest,
|
|
@@ -129,7 +159,10 @@ function Attached({
|
|
|
129
159
|
style: badgePlacement,
|
|
130
160
|
onLayout: onBadgeLayout,
|
|
131
161
|
pointerEvents: "box-none",
|
|
132
|
-
children:
|
|
162
|
+
children: badgeBoxStyle != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
163
|
+
style: badgeBoxStyle,
|
|
164
|
+
children: forceBadgeFill(badgeChildren)
|
|
165
|
+
}) : badgeChildren
|
|
133
166
|
})]
|
|
134
167
|
});
|
|
135
168
|
}
|
|
@@ -141,4 +174,10 @@ const styles = {
|
|
|
141
174
|
alignSelf: 'flex-start'
|
|
142
175
|
}
|
|
143
176
|
};
|
|
177
|
+
|
|
178
|
+
/** Fill style merged into badge content when `badgeSize` enforces a fixed box. */
|
|
179
|
+
const FILL_STYLE = {
|
|
180
|
+
width: '100%',
|
|
181
|
+
height: '100%'
|
|
182
|
+
};
|
|
144
183
|
var _default = exports.default = /*#__PURE__*/_react.default.memo(Attached);
|
|
@@ -53,11 +53,25 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
53
53
|
/** Minimum touch target per iOS HIG / Material accessibility guidance. */
|
|
54
54
|
const MIN_TOUCH_TARGET = 44;
|
|
55
55
|
const touchTargetStyle = {
|
|
56
|
-
minWidth: MIN_TOUCH_TARGET,
|
|
57
|
-
minHeight: MIN_TOUCH_TARGET,
|
|
58
56
|
alignItems: 'center',
|
|
59
57
|
justifyContent: 'center'
|
|
60
58
|
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Expands the tappable region to the 44pt minimum without changing layout.
|
|
62
|
+
* `hitSlop` extends the press-responder bounds beyond the visual box on both
|
|
63
|
+
* native and web (react-native-web ≥ 0.19), so the Pressable keeps its natural
|
|
64
|
+
* checkbox-sized footprint and sibling alignment stays intact.
|
|
65
|
+
*/
|
|
66
|
+
function invisibleTouchHitSlop(checkboxSize) {
|
|
67
|
+
const slop = Math.max(0, Math.ceil((MIN_TOUCH_TARGET - checkboxSize) / 2));
|
|
68
|
+
return {
|
|
69
|
+
top: slop,
|
|
70
|
+
bottom: slop,
|
|
71
|
+
left: slop,
|
|
72
|
+
right: slop
|
|
73
|
+
};
|
|
74
|
+
}
|
|
61
75
|
/**
|
|
62
76
|
* Checkbox component that maps directly to the Figma design using design tokens.
|
|
63
77
|
*
|
|
@@ -182,8 +196,10 @@ function Checkbox({
|
|
|
182
196
|
};
|
|
183
197
|
};
|
|
184
198
|
const markColor = disabled && isChecked ? disabledActiveMark : selectedMarkColor;
|
|
199
|
+
const hitSlop = invisibleTouchHitSlop(size);
|
|
185
200
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
186
201
|
style: [touchTargetStyle, style],
|
|
202
|
+
hitSlop: hitSlop,
|
|
187
203
|
onPress: handlePress,
|
|
188
204
|
disabled: disabled,
|
|
189
205
|
onHoverIn: () => setIsHovered(true),
|
|
@@ -368,7 +368,12 @@ function Drawer({
|
|
|
368
368
|
flexDirection: 'column',
|
|
369
369
|
alignItems: 'stretch'
|
|
370
370
|
}, contentContainerStyle],
|
|
371
|
-
showsVerticalScrollIndicator: showsVerticalScrollIndicator
|
|
371
|
+
showsVerticalScrollIndicator: showsVerticalScrollIndicator
|
|
372
|
+
// Let a tap on an input inside the sheet focus it on the FIRST tap
|
|
373
|
+
// even while the keyboard is already open (default 'never' would
|
|
374
|
+
// eat that tap just to dismiss the keyboard).
|
|
375
|
+
,
|
|
376
|
+
keyboardShouldPersistTaps: "handled",
|
|
372
377
|
animatedProps: animatedScrollProps,
|
|
373
378
|
alwaysBounceVertical: false,
|
|
374
379
|
overScrollMode: "always",
|
|
@@ -145,7 +145,7 @@ function DropdownInput({
|
|
|
145
145
|
supportText,
|
|
146
146
|
errorMessage,
|
|
147
147
|
menuMaxHeight = 240,
|
|
148
|
-
menuOffset
|
|
148
|
+
menuOffset,
|
|
149
149
|
matchTriggerWidth = true,
|
|
150
150
|
closeOnBackdropPress = true,
|
|
151
151
|
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
@@ -208,10 +208,29 @@ function DropdownInput({
|
|
|
208
208
|
const tokens = useFormFieldTokens(modes);
|
|
209
209
|
const chevron = useChevronTokens(modes);
|
|
210
210
|
|
|
211
|
+
// Gap between the input and the popup. Falls back to the `formField/gap`
|
|
212
|
+
// token so the menu's offset matches the field's own internal spacing.
|
|
213
|
+
const effectiveMenuOffset = menuOffset ?? tokens.gap;
|
|
214
|
+
|
|
211
215
|
// ---------------- Layout / measurement ----------------
|
|
212
216
|
const triggerRef = (0, _react.useRef)(null);
|
|
213
217
|
const [triggerRect, setTriggerRect] = (0, _react.useState)(null);
|
|
214
218
|
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
219
|
+
|
|
220
|
+
// Android coordinate-space bridge.
|
|
221
|
+
//
|
|
222
|
+
// The popup lives inside a `statusBarTranslucent` Modal, whose window is
|
|
223
|
+
// laid out from the PHYSICAL top of the screen (behind the status bar).
|
|
224
|
+
// The trigger, however, is rendered inside the app's content area (Expo
|
|
225
|
+
// Router / react-native-screens under edge-to-edge), so its
|
|
226
|
+
// `measureInWindow` Y is relative to the content area — it does NOT include
|
|
227
|
+
// the status bar height. Feeding that Y straight into the Modal would place
|
|
228
|
+
// the popup one status-bar-height too high, landing it on top of the input.
|
|
229
|
+
//
|
|
230
|
+
// Adding `insets.top` converts the trigger's content-relative Y into the
|
|
231
|
+
// Modal's full-screen coordinate space. iOS/web share a single coordinate
|
|
232
|
+
// space for the Modal and the trigger, so no shift is needed there.
|
|
233
|
+
const windowTopOffset = _reactNative.Platform.OS === 'android' ? insets.top : 0;
|
|
215
234
|
const measure = (0, _react.useCallback)(() => {
|
|
216
235
|
if (!triggerRef.current) return;
|
|
217
236
|
triggerRef.current.measureInWindow((x, y, width, height) => {
|
|
@@ -277,7 +296,7 @@ function DropdownInput({
|
|
|
277
296
|
const spaceBelow = windowHeight - (triggerRect.y + triggerRect.height) - insets.bottom;
|
|
278
297
|
const spaceAbove = triggerRect.y - insets.top;
|
|
279
298
|
const desiredHeight = Math.min(menuSize?.height ?? menuMaxHeight, menuMaxHeight);
|
|
280
|
-
const needed = desiredHeight +
|
|
299
|
+
const needed = desiredHeight + effectiveMenuOffset + 8;
|
|
281
300
|
if (placement === 'top') {
|
|
282
301
|
return spaceAbove >= needed || spaceAbove >= spaceBelow ? 'top' : 'bottom';
|
|
283
302
|
}
|
|
@@ -285,7 +304,7 @@ function DropdownInput({
|
|
|
285
304
|
return spaceBelow >= needed || spaceBelow >= spaceAbove ? 'bottom' : 'top';
|
|
286
305
|
}
|
|
287
306
|
return spaceBelow >= needed || spaceBelow >= spaceAbove ? 'bottom' : 'top';
|
|
288
|
-
}, [triggerRect, placement, windowHeight, menuSize?.height, menuMaxHeight,
|
|
307
|
+
}, [triggerRect, placement, windowHeight, menuSize?.height, menuMaxHeight, effectiveMenuOffset, insets.top, insets.bottom]);
|
|
289
308
|
const popupStyle = (0, _react.useMemo)(() => {
|
|
290
309
|
if (!triggerRect) {
|
|
291
310
|
return {
|
|
@@ -304,15 +323,18 @@ function DropdownInput({
|
|
|
304
323
|
const minLeft = insets.left + screenPadding;
|
|
305
324
|
if (leftPos > maxLeft) leftPos = maxLeft;
|
|
306
325
|
if (leftPos < minLeft) leftPos = minLeft;
|
|
326
|
+
|
|
327
|
+
// Trigger top expressed in the Modal's (full-screen) coordinate space.
|
|
328
|
+
const triggerTop = triggerRect.y + windowTopOffset;
|
|
307
329
|
let topPos;
|
|
308
330
|
if (computedPlacement === 'top') {
|
|
309
331
|
const desiredHeight = menuSize?.height ?? menuMaxHeight;
|
|
310
|
-
topPos =
|
|
332
|
+
topPos = triggerTop - desiredHeight - effectiveMenuOffset;
|
|
311
333
|
if (topPos < insets.top + screenPadding) {
|
|
312
334
|
topPos = insets.top + screenPadding;
|
|
313
335
|
}
|
|
314
336
|
} else {
|
|
315
|
-
topPos =
|
|
337
|
+
topPos = triggerTop + triggerRect.height + effectiveMenuOffset;
|
|
316
338
|
}
|
|
317
339
|
const style = {
|
|
318
340
|
position: 'absolute',
|
|
@@ -324,7 +346,7 @@ function DropdownInput({
|
|
|
324
346
|
// the wrong place. menuSize becomes truthy after the first layout.
|
|
325
347
|
if (menuSize == null) style.opacity = 0;
|
|
326
348
|
return style;
|
|
327
|
-
}, [triggerRect, computedPlacement, menuSize,
|
|
349
|
+
}, [triggerRect, computedPlacement, menuSize, effectiveMenuOffset, windowTopOffset, menuMaxHeight, matchTriggerWidth, windowWidth, insets.top, insets.left, insets.right]);
|
|
328
350
|
|
|
329
351
|
// Reset menu size when closing so the next open re-measures (handles items
|
|
330
352
|
// changing while the menu was closed).
|
|
@@ -513,6 +535,8 @@ function DropdownInput({
|
|
|
513
535
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
|
|
514
536
|
visible: isOpen,
|
|
515
537
|
transparent: true,
|
|
538
|
+
statusBarTranslucent: true,
|
|
539
|
+
navigationBarTranslucent: true,
|
|
516
540
|
animationType: "fade",
|
|
517
541
|
onRequestClose: closeMenu,
|
|
518
542
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
@@ -88,8 +88,6 @@ function ExpandableCheckbox({
|
|
|
88
88
|
}, [disabled, isExpanded, isExpandedControlled, onExpandedChange]);
|
|
89
89
|
const gap = (0, _figmaVariablesResolver.getVariableByName)('expandableCheckbox/gap', modes) ?? 8;
|
|
90
90
|
const rowGap = (0, _figmaVariablesResolver.getVariableByName)('checkboxItem/gap', modes) ?? 8;
|
|
91
|
-
const rowPaddingHorizontal = (0, _figmaVariablesResolver.getVariableByName)('checkboxItem/padding/horizontal', modes) ?? 0;
|
|
92
|
-
const rowPaddingVertical = (0, _figmaVariablesResolver.getVariableByName)('checkboxItem/padding/vertical', modes) ?? 0;
|
|
93
91
|
const labelColor = (0, _figmaVariablesResolver.getVariableByName)('checkboxItem/foreground', modes) ?? '#1a1c1f';
|
|
94
92
|
const labelFontFamily = (0, _figmaVariablesResolver.getVariableByName)('checkboxItem/label/fontFamily', modes) ?? 'JioType Var';
|
|
95
93
|
const labelFontSize = (0, _figmaVariablesResolver.getVariableByName)('checkboxItem/label/fontSize', modes) ?? 14;
|
|
@@ -110,11 +108,9 @@ function ExpandableCheckbox({
|
|
|
110
108
|
alignSelf: isExpanded ? 'stretch' : 'auto',
|
|
111
109
|
minWidth: 0,
|
|
112
110
|
flexDirection: 'row',
|
|
113
|
-
alignItems: 'flex-start',
|
|
114
|
-
gap: rowGap
|
|
115
|
-
|
|
116
|
-
paddingVertical: rowPaddingVertical
|
|
117
|
-
}), [isExpanded, rowGap, rowPaddingHorizontal, rowPaddingVertical]);
|
|
111
|
+
alignItems: isExpanded ? 'flex-start' : 'center',
|
|
112
|
+
gap: rowGap
|
|
113
|
+
}), [isExpanded, rowGap]);
|
|
118
114
|
const resolvedLabelStyle = (0, _react.useMemo)(() => ({
|
|
119
115
|
flex: 1,
|
|
120
116
|
minWidth: 0,
|
|
@@ -122,11 +118,21 @@ function ExpandableCheckbox({
|
|
|
122
118
|
fontFamily: labelFontFamily,
|
|
123
119
|
fontSize: labelFontSize,
|
|
124
120
|
lineHeight: labelLineHeight,
|
|
125
|
-
fontWeight: labelFontWeight
|
|
126
|
-
|
|
121
|
+
fontWeight: labelFontWeight,
|
|
122
|
+
// Android adds asymmetric font padding and top-aligns the glyph inside
|
|
123
|
+
// an inflated line box when `lineHeight` is set. That makes the centered
|
|
124
|
+
// checkbox look like it drops below the text. Disabling the extra
|
|
125
|
+
// padding + centering the glyph keeps the single-line label optically
|
|
126
|
+
// aligned with the checkbox. No-op on iOS / web.
|
|
127
|
+
includeFontPadding: false,
|
|
128
|
+
textAlignVertical: isExpanded ? 'top' : 'center'
|
|
129
|
+
}), [labelColor, labelFontFamily, labelFontSize, labelLineHeight, labelFontWeight, isExpanded]);
|
|
130
|
+
|
|
131
|
+
// Layer component modes first (e.g. Color Mode), then button defaults so
|
|
132
|
+
// Secondary / XS / Low always win unless a dedicated override prop is added.
|
|
127
133
|
const buttonModes = (0, _react.useMemo)(() => ({
|
|
128
|
-
...
|
|
129
|
-
...
|
|
134
|
+
...modes,
|
|
135
|
+
...BUTTON_DEFAULT_MODES
|
|
130
136
|
}), [modes]);
|
|
131
137
|
const a11yLabel = accessibilityLabel ?? (typeof label === 'string' ? label : undefined);
|
|
132
138
|
const buttonLabel = isExpanded ? readLessLabel : readMoreLabel;
|
|
@@ -208,16 +208,6 @@ function FormField({
|
|
|
208
208
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
209
209
|
const interactive = !isDisabled && !isReadOnly;
|
|
210
210
|
|
|
211
|
-
// Ref to the native input so tapping anywhere in the input row (padding,
|
|
212
|
-
// leading/trailing gutters) focuses it on the FIRST tap — fixing the Android
|
|
213
|
-
// "two taps to open the keyboard" issue caused by the row intercepting the
|
|
214
|
-
// initial touch.
|
|
215
|
-
const inputRef = (0, _react.useRef)(null);
|
|
216
|
-
const focusInput = (0, _react.useCallback)(() => {
|
|
217
|
-
if (!interactive) return;
|
|
218
|
-
inputRef.current?.focus();
|
|
219
|
-
}, [interactive]);
|
|
220
|
-
|
|
221
211
|
// FormField States cascade — error > read only/disabled > active (focused) > idle.
|
|
222
212
|
// Disabled maps to "Read Only" since there is no dedicated disabled mode and
|
|
223
213
|
// the visual treatment is closest. This is only the DEFAULT — an explicit
|
|
@@ -350,16 +340,13 @@ function FormField({
|
|
|
350
340
|
style: requiredIndicatorStyle,
|
|
351
341
|
children: " *"
|
|
352
342
|
})]
|
|
353
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.
|
|
343
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
354
344
|
style: [inputRowStyle, inputStyle],
|
|
355
|
-
onPress: focusInput,
|
|
356
|
-
accessible: false,
|
|
357
345
|
children: [processedLeading != null && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
358
346
|
accessibilityElementsHidden: true,
|
|
359
347
|
importantForAccessibility: "no",
|
|
360
348
|
children: processedLeading
|
|
361
349
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
362
|
-
ref: inputRef,
|
|
363
350
|
style: [inputTextStyles, inputTextStyle],
|
|
364
351
|
value: value ?? '',
|
|
365
352
|
onChangeText: handleChangeText,
|
|
@@ -301,7 +301,11 @@ function FullscreenModal({
|
|
|
301
301
|
contentContainerStyle: scrollContentStyle,
|
|
302
302
|
showsVerticalScrollIndicator: false,
|
|
303
303
|
onScroll: onScroll,
|
|
304
|
-
scrollEventThrottle: 16
|
|
304
|
+
scrollEventThrottle: 16
|
|
305
|
+
// Tap an input in the body and it focuses on the FIRST tap, even when
|
|
306
|
+
// the keyboard is already open (default 'never' eats that tap).
|
|
307
|
+
,
|
|
308
|
+
keyboardShouldPersistTaps: "handled",
|
|
305
309
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
306
310
|
style: heroTextRegionStyle,
|
|
307
311
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HeroText, {
|
|
@@ -7,7 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
-
var _IconCapsule = _interopRequireDefault(require("../IconCapsule/IconCapsule"));
|
|
11
10
|
var _NavArrow = _interopRequireDefault(require("../NavArrow/NavArrow"));
|
|
12
11
|
var _webPlatformUtils = require("../../utils/web-platform-utils");
|
|
13
12
|
var _reactUtils = require("../../utils/react-utils");
|
|
@@ -150,7 +149,7 @@ const verticalSupportTextOverride = {
|
|
|
150
149
|
* @param {string} [props.title='Title'] - Primary title used in the horizontal layout.
|
|
151
150
|
* @param {string} [props.supportText='Support Text'] - Support text used in both layouts when `supportSlot` is not provided.
|
|
152
151
|
* @param {boolean} [props.showSupportText=true] - Toggles rendering of the support text in Horizontal layout.
|
|
153
|
-
* @param {React.ReactNode} [props.leading] - Optional leading slot.
|
|
152
|
+
* @param {React.ReactNode|null} [props.leading] - Optional leading slot. Omitted or `null` renders nothing.
|
|
154
153
|
* @param {React.ReactNode} [props.supportSlot] - Optional custom slot used instead of the default support text block.
|
|
155
154
|
* @param {React.ReactNode} [props.trailing] - Optional trailing slot (Figma Slot "trailing"). Horizontal layout only.
|
|
156
155
|
* @param {boolean} [props.navArrow=true] - Whether to show NavArrow on the far right (Horizontal layout only).
|
|
@@ -219,13 +218,9 @@ function ListItemImpl({
|
|
|
219
218
|
// Process leading slot to pass modes to children. Memoized on
|
|
220
219
|
// (leading, resolvedModes) so a parent re-render doesn't re-walk the tree.
|
|
221
220
|
const leadingElement = (0, _react.useMemo)(() => {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
modes: tokens.resolvedModes,
|
|
226
|
-
accessibilityLabel: undefined
|
|
227
|
-
});
|
|
228
|
-
}
|
|
221
|
+
if (leading == null) return null;
|
|
222
|
+
const processed = (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(leading), tokens.resolvedModes, SLOT_FORCED_MODES);
|
|
223
|
+
if (processed.length === 0) return null;
|
|
229
224
|
return processed.length === 1 ? processed[0] : processed;
|
|
230
225
|
}, [leading, tokens.resolvedModes]);
|
|
231
226
|
const processedSupportSlot = (0, _react.useMemo)(() => {
|
|
@@ -275,7 +270,7 @@ function ListItemImpl({
|
|
|
275
270
|
if (layout === 'Horizontal') {
|
|
276
271
|
const innerContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
277
272
|
style: innerContentStyleArray,
|
|
278
|
-
children: [leadingElement, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
273
|
+
children: [leadingElement ?? null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
279
274
|
style: {
|
|
280
275
|
flex: 1,
|
|
281
276
|
minWidth: 1,
|
|
@@ -322,7 +317,7 @@ function ListItemImpl({
|
|
|
322
317
|
// Vertical layout — icon on top, support text/slot below
|
|
323
318
|
const verticalContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
324
319
|
style: verticalContentStyleArray,
|
|
325
|
-
children: [leadingElement, renderSupportContent()]
|
|
320
|
+
children: [leadingElement ?? null, renderSupportContent()]
|
|
326
321
|
});
|
|
327
322
|
if (onPress) {
|
|
328
323
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
@@ -145,15 +145,6 @@ function MessageField({
|
|
|
145
145
|
const currentValue = isControlled ? value : uncontrolledValue;
|
|
146
146
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
147
147
|
const interactive = !isDisabled && !isReadOnly;
|
|
148
|
-
|
|
149
|
-
// Ref to the native textarea so tapping anywhere in the (padded) textarea
|
|
150
|
-
// container focuses it on the FIRST tap, fixing the Android "two taps to
|
|
151
|
-
// open the keyboard" issue.
|
|
152
|
-
const inputRef = (0, _react.useRef)(null);
|
|
153
|
-
const focusInput = (0, _react.useCallback)(() => {
|
|
154
|
-
if (!interactive) return;
|
|
155
|
-
inputRef.current?.focus();
|
|
156
|
-
}, [interactive]);
|
|
157
148
|
const {
|
|
158
149
|
modes: globalModes
|
|
159
150
|
} = (0, _JFSThemeProvider.useTokens)();
|
|
@@ -288,12 +279,9 @@ function MessageField({
|
|
|
288
279
|
style: requiredIndicatorStyle,
|
|
289
280
|
children: " *"
|
|
290
281
|
})]
|
|
291
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.
|
|
282
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
292
283
|
style: [textareaContainerStyle, textareaStyle],
|
|
293
|
-
onPress: focusInput,
|
|
294
|
-
accessible: false,
|
|
295
284
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
296
|
-
ref: inputRef,
|
|
297
285
|
multiline: true,
|
|
298
286
|
value: currentValue,
|
|
299
287
|
onChangeText: handleChangeText,
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = PaymentFeedback;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
10
|
var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
|
|
@@ -12,11 +12,10 @@ var _IconCapsule = _interopRequireDefault(require("../IconCapsule/IconCapsule"))
|
|
|
12
12
|
var _reactUtils = require("../../utils/react-utils");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
15
|
function PaymentFeedback({
|
|
17
16
|
title = '₹50,000',
|
|
18
17
|
subtitle = 'Payment successful',
|
|
19
|
-
body
|
|
18
|
+
body,
|
|
20
19
|
details = '18 March 2025, 4:15 pm\nTransaction ID: TXN121466784',
|
|
21
20
|
showDetails = true,
|
|
22
21
|
iconName = 'ic_confirm',
|
|
@@ -103,17 +102,21 @@ function PaymentFeedback({
|
|
|
103
102
|
fontWeight: String(detailsFontWeight),
|
|
104
103
|
textAlign: 'center'
|
|
105
104
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
|
|
106
|
+
// Cascade modes into a custom media slot (per the modes-cascade convention);
|
|
107
|
+
// any modes the consumer set on the slot child still take precedence.
|
|
108
|
+
const mediaContent = renderMedia != null ? (0, _reactUtils.cloneChildrenWithModes)(renderMedia, modes) : null;
|
|
109
109
|
const defaultMedia = /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconCapsule.default, {
|
|
110
|
-
iconName: iconName
|
|
110
|
+
iconName: iconName
|
|
111
|
+
// `positive` is the default; consumers override the capsule color by
|
|
112
|
+
// passing `AppearanceSystem` (or any other mode) via the `modes` prop.
|
|
113
|
+
,
|
|
111
114
|
modes: {
|
|
115
|
+
AppearanceSystem: 'positive',
|
|
112
116
|
...modes,
|
|
113
117
|
'Icon Capsule Size': 'L',
|
|
114
118
|
Emphasis: 'High',
|
|
115
|
-
'Semantic Intent': 'System'
|
|
116
|
-
AppearanceSystem: 'positive'
|
|
119
|
+
'Semantic Intent': 'System'
|
|
117
120
|
}
|
|
118
121
|
});
|
|
119
122
|
const detailLines = details?.split('\n') ?? [];
|